From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: Mark Brown <broonie@kernel.org>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack <daniel@zonque.org>, Haojian Zhuang <haojian.zhuang@gmail.com>, Robert Jarzmik <robert.jarzmik@free.fr>, Russell King <linux@armlinux.org.uk> Subject: [PATCH v3 2/9] spi: pxa2xx: Provide num-cs for Sharp PDAs via device properties Date: Wed, 17 Apr 2024 13:54:29 +0300 [thread overview] Message-ID: <20240417110334.2671228-3-andriy.shevchenko@linux.intel.com> (raw) In-Reply-To: <20240417110334.2671228-1-andriy.shevchenko@linux.intel.com> Since driver can parse num-cs device property, replace platform data with this new approach. This pursues the following objectives: - getting rid of the public header that barely used outside of the SPI subsystem (more specifically the SPI PXA2xx drivers) - making a trampoline for the driver to support non-default number of the chip select pins in case the original code is going to be converted to Device Tree model It's not expected to have more users in board files except this one. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- arch/arm/mach-pxa/spitz.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 318402ad685e..3c5f5a3cb480 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -18,10 +18,10 @@ #include <linux/i2c.h> #include <linux/platform_data/i2c-pxa.h> #include <linux/platform_data/pca953x.h> +#include <linux/property.h> #include <linux/spi/spi.h> #include <linux/spi/ads7846.h> #include <linux/spi/corgi_lcd.h> -#include <linux/spi/pxa2xx_spi.h> #include <linux/mtd/sharpsl.h> #include <linux/mtd/physmap.h> #include <linux/input-event-codes.h> @@ -569,10 +569,6 @@ static struct spi_board_info spitz_spi_devices[] = { }, }; -static struct pxa2xx_spi_controller spitz_spi_info = { - .num_chipselect = 3, -}; - static struct gpiod_lookup_table spitz_spi_gpio_table = { .dev_id = "spi2", .table = { @@ -583,10 +579,20 @@ static struct gpiod_lookup_table spitz_spi_gpio_table = { }, }; +static const struct property_entry spitz_spi_properties[] = { + PROPERTY_ENTRY_U32("num-cs", 3), + { } +}; + +static const struct software_node spitz_spi_node = { + .properties = spitz_spi_properties, +}; + static void __init spitz_spi_init(void) { struct platform_device *pd; int id = 2; + int err; if (machine_is_akita()) gpiod_add_lookup_table(&akita_lcdcon_gpio_table); @@ -601,8 +607,13 @@ static void __init spitz_spi_init(void) if (pd == NULL) { pr_err("pxa2xx-spi: failed to allocate device id %d\n", id); } else { - pd->dev.platform_data = &spitz_spi_info; - platform_device_add(pd); + err = device_add_software_node(&pd->dev, &spitz_spi_node); + if (err) { + platform_device_put(pd); + pr_err("pxa2xx-spi: failed to add software node\n"); + } else { + platform_device_add(pd); + } } spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); -- 2.43.0.rc1.1336.g36b5255a03ac
WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: Mark Brown <broonie@kernel.org>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Daniel Mack <daniel@zonque.org>, Haojian Zhuang <haojian.zhuang@gmail.com>, Robert Jarzmik <robert.jarzmik@free.fr>, Russell King <linux@armlinux.org.uk> Subject: [PATCH v3 2/9] spi: pxa2xx: Provide num-cs for Sharp PDAs via device properties Date: Wed, 17 Apr 2024 13:54:29 +0300 [thread overview] Message-ID: <20240417110334.2671228-3-andriy.shevchenko@linux.intel.com> (raw) In-Reply-To: <20240417110334.2671228-1-andriy.shevchenko@linux.intel.com> Since driver can parse num-cs device property, replace platform data with this new approach. This pursues the following objectives: - getting rid of the public header that barely used outside of the SPI subsystem (more specifically the SPI PXA2xx drivers) - making a trampoline for the driver to support non-default number of the chip select pins in case the original code is going to be converted to Device Tree model It's not expected to have more users in board files except this one. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- arch/arm/mach-pxa/spitz.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 318402ad685e..3c5f5a3cb480 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -18,10 +18,10 @@ #include <linux/i2c.h> #include <linux/platform_data/i2c-pxa.h> #include <linux/platform_data/pca953x.h> +#include <linux/property.h> #include <linux/spi/spi.h> #include <linux/spi/ads7846.h> #include <linux/spi/corgi_lcd.h> -#include <linux/spi/pxa2xx_spi.h> #include <linux/mtd/sharpsl.h> #include <linux/mtd/physmap.h> #include <linux/input-event-codes.h> @@ -569,10 +569,6 @@ static struct spi_board_info spitz_spi_devices[] = { }, }; -static struct pxa2xx_spi_controller spitz_spi_info = { - .num_chipselect = 3, -}; - static struct gpiod_lookup_table spitz_spi_gpio_table = { .dev_id = "spi2", .table = { @@ -583,10 +579,20 @@ static struct gpiod_lookup_table spitz_spi_gpio_table = { }, }; +static const struct property_entry spitz_spi_properties[] = { + PROPERTY_ENTRY_U32("num-cs", 3), + { } +}; + +static const struct software_node spitz_spi_node = { + .properties = spitz_spi_properties, +}; + static void __init spitz_spi_init(void) { struct platform_device *pd; int id = 2; + int err; if (machine_is_akita()) gpiod_add_lookup_table(&akita_lcdcon_gpio_table); @@ -601,8 +607,13 @@ static void __init spitz_spi_init(void) if (pd == NULL) { pr_err("pxa2xx-spi: failed to allocate device id %d\n", id); } else { - pd->dev.platform_data = &spitz_spi_info; - platform_device_add(pd); + err = device_add_software_node(&pd->dev, &spitz_spi_node); + if (err) { + platform_device_put(pd); + pr_err("pxa2xx-spi: failed to add software node\n"); + } else { + platform_device_add(pd); + } } spi_register_board_info(ARRAY_AND_SIZE(spitz_spi_devices)); -- 2.43.0.rc1.1336.g36b5255a03ac _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2024-04-17 11:03 UTC|newest] Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-04-17 10:54 [PATCH v3 0/9] spi: pxa2xx: Drop linux/spi/pxa2xx_spi.h Andy Shevchenko 2024-04-17 10:54 ` Andy Shevchenko 2024-04-17 10:54 ` [PATCH v3 1/9] spi: pxa2xx: Allow number of chip select pins to be read from property Andy Shevchenko 2024-04-17 10:54 ` Andy Shevchenko 2024-05-02 8:06 ` Linus Walleij 2024-05-02 8:06 ` Linus Walleij 2024-04-17 10:54 ` Andy Shevchenko [this message] 2024-04-17 10:54 ` [PATCH v3 2/9] spi: pxa2xx: Provide num-cs for Sharp PDAs via device properties Andy Shevchenko 2024-05-02 8:07 ` Linus Walleij 2024-05-02 8:07 ` Linus Walleij 2024-04-17 10:54 ` [PATCH v3 3/9] spi: pxa2xx: Move contents of linux/spi/pxa2xx_spi.h to a local one Andy Shevchenko 2024-04-17 10:54 ` Andy Shevchenko 2024-05-02 8:09 ` Linus Walleij 2024-05-02 8:09 ` Linus Walleij 2024-04-17 10:54 ` [PATCH v3 4/9] spi: pxa2xx: Remove outdated documentation Andy Shevchenko 2024-04-17 10:54 ` Andy Shevchenko 2024-05-02 8:09 ` Linus Walleij 2024-05-02 8:09 ` Linus Walleij 2024-04-17 10:54 ` [PATCH v3 5/9] spi: pxa2xx: Don't use "proxy" headers Andy Shevchenko 2024-04-17 10:54 ` Andy Shevchenko 2024-05-02 8:10 ` Linus Walleij 2024-05-02 8:10 ` Linus Walleij 2024-04-17 10:54 ` [PATCH v3 6/9] spi: pxa2xx: Drop struct pxa2xx_spi_chip Andy Shevchenko 2024-04-17 10:54 ` Andy Shevchenko 2024-05-02 8:10 ` Linus Walleij 2024-05-02 8:10 ` Linus Walleij 2024-04-17 10:54 ` [PATCH v3 7/9] spi: pxa2xx: Remove DMA parameters from struct chip_data Andy Shevchenko 2024-04-17 10:54 ` Andy Shevchenko 2024-05-02 8:11 ` Linus Walleij 2024-05-02 8:11 ` Linus Walleij 2024-04-17 10:54 ` [PATCH v3 8/9] spi: pxa2xx: Remove timeout field " Andy Shevchenko 2024-04-17 10:54 ` Andy Shevchenko 2024-05-02 8:11 ` Linus Walleij 2024-05-02 8:11 ` Linus Walleij 2024-04-17 10:54 ` [PATCH v3 9/9] spi: pxa2xx: Don't provide struct chip_data for others Andy Shevchenko 2024-04-17 10:54 ` Andy Shevchenko 2024-05-02 8:12 ` Linus Walleij 2024-05-02 8:12 ` Linus Walleij 2024-04-25 11:40 ` [PATCH v3 0/9] spi: pxa2xx: Drop linux/spi/pxa2xx_spi.h Andy Shevchenko 2024-04-25 11:40 ` Andy Shevchenko 2024-05-01 14:18 ` Mark Brown 2024-05-01 14:18 ` Mark Brown 2024-05-06 14:59 ` Mark Brown 2024-05-06 14:59 ` Mark Brown
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240417110334.2671228-3-andriy.shevchenko@linux.intel.com \ --to=andriy.shevchenko@linux.intel.com \ --cc=broonie@kernel.org \ --cc=daniel@zonque.org \ --cc=haojian.zhuang@gmail.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-spi@vger.kernel.org \ --cc=linux@armlinux.org.uk \ --cc=robert.jarzmik@free.fr \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.