Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ARM: spitz: Use software nodes to describe SPI CS lines

Convert the Spitz to use software nodes for specifying SPI CS. Because
the SPI core can figure out the number of chipselects from the number
of GPIO handles specified in properties, setting "num-cs" property is
no longer needed.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20240628180852.1738922-6-dmitry.torokhov@gmail.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

authored by

Linus Walleij and committed by
Arnd Bergmann
224b9329 6eabaf9d

+11 -11
+1
arch/arm/mach-pxa/pxa27x.c
··· 341 341 register_syscore_ops(&pxa2xx_mfp_syscore_ops); 342 342 343 343 if (!of_have_populated_dt()) { 344 + software_node_register(&pxa2xx_gpiochip_node); 344 345 pxa2xx_set_dmac_info(&pxa27x_dma_pdata); 345 346 ret = platform_add_devices(devices, 346 347 ARRAY_SIZE(devices));
+10 -11
arch/arm/mach-pxa/spitz.c
··· 14 14 #include <linux/gpio_keys.h> 15 15 #include <linux/gpio.h> 16 16 #include <linux/gpio/machine.h> 17 + #include <linux/gpio/property.h> 17 18 #include <linux/leds.h> 18 19 #include <linux/i2c.h> 19 20 #include <linux/platform_data/i2c-pxa.h> ··· 29 28 #include <linux/input/matrix_keypad.h> 30 29 #include <linux/regulator/machine.h> 31 30 #include <linux/io.h> 31 + #include <linux/property.h> 32 32 #include <linux/reboot.h> 33 33 #include <linux/memblock.h> 34 34 ··· 129 127 GPIO0_GPIO | WAKEUP_ON_EDGE_RISE, /* SPITZ_GPIO_KEY_INT */ 130 128 GPIO1_GPIO | WAKEUP_ON_EDGE_FALL, /* SPITZ_GPIO_RESET */ 131 129 }; 132 - 133 130 134 131 /****************************************************************************** 135 132 * Scoop GPIO expander ··· 566 565 }, 567 566 }; 568 567 569 - static struct gpiod_lookup_table spitz_spi_gpio_table = { 570 - .dev_id = "spi2", 571 - .table = { 572 - GPIO_LOOKUP_IDX("gpio-pxa", SPITZ_GPIO_ADS7846_CS, "cs", 0, GPIO_ACTIVE_LOW), 573 - GPIO_LOOKUP_IDX("gpio-pxa", SPITZ_GPIO_LCDCON_CS, "cs", 1, GPIO_ACTIVE_LOW), 574 - GPIO_LOOKUP_IDX("gpio-pxa", SPITZ_GPIO_MAX1111_CS, "cs", 2, GPIO_ACTIVE_LOW), 575 - { }, 576 - }, 568 + static const struct software_node_ref_args spitz_spi_gpio_refs[] = { 569 + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, SPITZ_GPIO_ADS7846_CS, 570 + GPIO_ACTIVE_LOW), 571 + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, SPITZ_GPIO_LCDCON_CS, 572 + GPIO_ACTIVE_LOW), 573 + SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, SPITZ_GPIO_MAX1111_CS, 574 + GPIO_ACTIVE_LOW), 577 575 }; 578 576 579 577 static const struct property_entry spitz_spi_properties[] = { 580 - PROPERTY_ENTRY_U32("num-cs", 3), 578 + PROPERTY_ENTRY_REF_ARRAY("gpios", spitz_spi_gpio_refs), 581 579 { } 582 580 }; 583 581 ··· 598 598 gpiod_add_lookup_table(&spitz_lcdcon_gpio_table); 599 599 600 600 gpiod_add_lookup_table(&spitz_ads7846_gpio_table); 601 - gpiod_add_lookup_table(&spitz_spi_gpio_table); 602 601 603 602 pd = platform_device_register_full(&spitz_spi_device_info); 604 603 err = PTR_ERR_OR_ZERO(pd);