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

ARM: spitz: Use software nodes to describe MMC GPIOs

Convert Spitz to use software nodes for specifying GPIOs for the MMC.

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-9-dmitry.torokhov@gmail.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

authored by

Dmitry Torokhov and committed by
Arnd Bergmann
444b8987 1447c7df

+31 -30
+20 -16
arch/arm/mach-pxa/devices.c
··· 48 48 .num_resources = 1, 49 49 }; 50 50 51 - static struct resource pxamci_resources[] = { 51 + static const struct resource pxamci_resources[] = { 52 52 [0] = { 53 53 .start = 0x41100000, 54 54 .end = 0x41100fff, ··· 61 61 }, 62 62 }; 63 63 64 - static u64 pxamci_dmamask = 0xffffffffUL; 65 - 66 - struct platform_device pxa_device_mci = { 67 - .name = "pxa2xx-mci", 68 - .id = 0, 69 - .dev = { 70 - .dma_mask = &pxamci_dmamask, 71 - .coherent_dma_mask = 0xffffffff, 72 - }, 73 - .num_resources = ARRAY_SIZE(pxamci_resources), 74 - .resource = pxamci_resources, 75 - }; 76 - 77 - void __init pxa_set_mci_info(struct pxamci_platform_data *info) 64 + void __init pxa_set_mci_info(const struct pxamci_platform_data *info, 65 + const struct property_entry *props) 78 66 { 79 - pxa_register_device(&pxa_device_mci, info); 67 + const struct platform_device_info mci_info = { 68 + .name = "pxa2xx-mci", 69 + .id = 0, 70 + .res = pxamci_resources, 71 + .num_res = ARRAY_SIZE(pxamci_resources), 72 + .data = info, 73 + .size_data = sizeof(*info), 74 + .dma_mask = 0xffffffffUL, 75 + .properties = props, 76 + }; 77 + struct platform_device *mci_dev; 78 + int err; 79 + 80 + mci_dev = platform_device_register_full(&mci_info); 81 + err = PTR_ERR_OR_ZERO(mci_dev); 82 + if (err) 83 + pr_err("Unable to create mci device: %d\n", err); 80 84 } 81 85 82 86 static struct pxa2xx_udc_mach_info pxa_udc_info = {
-1
arch/arm/mach-pxa/devices.h
··· 4 4 struct mmp_dma_platdata; 5 5 6 6 extern struct platform_device pxa_device_pmu; 7 - extern struct platform_device pxa_device_mci; 8 7 extern struct platform_device pxa3xx_device_mci2; 9 8 extern struct platform_device pxa3xx_device_mci3; 10 9 extern struct platform_device pxa25x_device_udc;
+1 -1
arch/arm/mach-pxa/gumstix.c
··· 90 90 91 91 static void __init gumstix_mmc_init(void) 92 92 { 93 - pxa_set_mci_info(&gumstix_mci_platform_data); 93 + pxa_set_mci_info(&gumstix_mci_platform_data, NULL); 94 94 } 95 95 #else 96 96 static void __init gumstix_mmc_init(void)
+7 -11
arch/arm/mach-pxa/spitz.c
··· 651 651 .setpower = spitz_mci_setpower, 652 652 }; 653 653 654 - static struct gpiod_lookup_table spitz_mci_gpio_table = { 655 - .dev_id = "pxa2xx-mci.0", 656 - .table = { 657 - GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_nSD_DETECT, 658 - "cd", GPIO_ACTIVE_LOW), 659 - GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_nSD_WP, 660 - "wp", GPIO_ACTIVE_LOW), 661 - { }, 662 - }, 654 + static const struct property_entry spitz_mci_props[] __initconst = { 655 + PROPERTY_ENTRY_GPIO("cd-gpios", &pxa2xx_gpiochip_node, 656 + SPITZ_GPIO_nSD_DETECT, GPIO_ACTIVE_LOW), 657 + PROPERTY_ENTRY_GPIO("wp-gpios", &pxa2xx_gpiochip_node, 658 + SPITZ_GPIO_nSD_WP, GPIO_ACTIVE_LOW), 659 + { } 663 660 }; 664 661 665 662 static void __init spitz_mmc_init(void) 666 663 { 667 - gpiod_add_lookup_table(&spitz_mci_gpio_table); 668 - pxa_set_mci_info(&spitz_mci_platform_data); 664 + pxa_set_mci_info(&spitz_mci_platform_data, spitz_mci_props); 669 665 } 670 666 #else 671 667 static inline void spitz_mmc_init(void) {}
+3 -1
include/linux/platform_data/mmc-pxamci.h
··· 7 7 8 8 struct device; 9 9 struct mmc_host; 10 + struct property_entry; 10 11 11 12 struct pxamci_platform_data { 12 13 unsigned int ocr_mask; /* available voltages */ ··· 19 18 bool gpio_card_ro_invert; /* gpio ro is inverted */ 20 19 }; 21 20 22 - extern void pxa_set_mci_info(struct pxamci_platform_data *info); 21 + extern void pxa_set_mci_info(const struct pxamci_platform_data *info, 22 + const struct property_entry *props); 23 23 extern void pxa3xx_set_mci2_info(struct pxamci_platform_data *info); 24 24 extern void pxa3xx_set_mci3_info(struct pxamci_platform_data *info); 25 25