Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 224b932

Browse files
linuswarndb
authored andcommitted
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>
1 parent 6eabaf9 commit 224b932

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

arch/arm/mach-pxa/pxa27x.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ static int __init pxa27x_init(void)
341341
register_syscore_ops(&pxa2xx_mfp_syscore_ops);
342342

343343
if (!of_have_populated_dt()) {
344+
software_node_register(&pxa2xx_gpiochip_node);
344345
pxa2xx_set_dmac_info(&pxa27x_dma_pdata);
345346
ret = platform_add_devices(devices,
346347
ARRAY_SIZE(devices));

arch/arm/mach-pxa/spitz.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/gpio_keys.h>
1515
#include <linux/gpio.h>
1616
#include <linux/gpio/machine.h>
17+
#include <linux/gpio/property.h>
1718
#include <linux/leds.h>
1819
#include <linux/i2c.h>
1920
#include <linux/platform_data/i2c-pxa.h>
@@ -28,6 +29,7 @@
2829
#include <linux/input/matrix_keypad.h>
2930
#include <linux/regulator/machine.h>
3031
#include <linux/io.h>
32+
#include <linux/property.h>
3133
#include <linux/reboot.h>
3234
#include <linux/memblock.h>
3335

@@ -128,7 +130,6 @@ static unsigned long spitz_pin_config[] __initdata = {
128130
GPIO1_GPIO | WAKEUP_ON_EDGE_FALL, /* SPITZ_GPIO_RESET */
129131
};
130132

131-
132133
/******************************************************************************
133134
* Scoop GPIO expander
134135
******************************************************************************/
@@ -565,18 +566,17 @@ static struct spi_board_info spitz_spi_devices[] = {
565566
},
566567
};
567568

568-
static struct gpiod_lookup_table spitz_spi_gpio_table = {
569-
.dev_id = "spi2",
570-
.table = {
571-
GPIO_LOOKUP_IDX("gpio-pxa", SPITZ_GPIO_ADS7846_CS, "cs", 0, GPIO_ACTIVE_LOW),
572-
GPIO_LOOKUP_IDX("gpio-pxa", SPITZ_GPIO_LCDCON_CS, "cs", 1, GPIO_ACTIVE_LOW),
573-
GPIO_LOOKUP_IDX("gpio-pxa", SPITZ_GPIO_MAX1111_CS, "cs", 2, GPIO_ACTIVE_LOW),
574-
{ },
575-
},
569+
static const struct software_node_ref_args spitz_spi_gpio_refs[] = {
570+
SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, SPITZ_GPIO_ADS7846_CS,
571+
GPIO_ACTIVE_LOW),
572+
SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, SPITZ_GPIO_LCDCON_CS,
573+
GPIO_ACTIVE_LOW),
574+
SOFTWARE_NODE_REFERENCE(&pxa2xx_gpiochip_node, SPITZ_GPIO_MAX1111_CS,
575+
GPIO_ACTIVE_LOW),
576576
};
577577

578578
static const struct property_entry spitz_spi_properties[] = {
579-
PROPERTY_ENTRY_U32("num-cs", 3),
579+
PROPERTY_ENTRY_REF_ARRAY("gpios", spitz_spi_gpio_refs),
580580
{ }
581581
};
582582

@@ -598,7 +598,6 @@ static void __init spitz_spi_init(void)
598598
gpiod_add_lookup_table(&spitz_lcdcon_gpio_table);
599599

600600
gpiod_add_lookup_table(&spitz_ads7846_gpio_table);
601-
gpiod_add_lookup_table(&spitz_spi_gpio_table);
602601

603602
pd = platform_device_register_full(&spitz_spi_device_info);
604603
err = PTR_ERR_OR_ZERO(pd);

0 commit comments

Comments
 (0)