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

Commit 444b898

Browse files
dtorarndb
authored andcommitted
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>
1 parent 1447c7d commit 444b898

File tree

5 files changed

+31
-30
lines changed

5 files changed

+31
-30
lines changed

arch/arm/mach-pxa/devices.c

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ struct platform_device pxa_device_pmu = {
4848
.num_resources = 1,
4949
};
5050

51-
static struct resource pxamci_resources[] = {
51+
static const struct resource pxamci_resources[] = {
5252
[0] = {
5353
.start = 0x41100000,
5454
.end = 0x41100fff,
@@ -61,22 +61,26 @@ static struct resource pxamci_resources[] = {
6161
},
6262
};
6363

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)
7866
{
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);
8084
}
8185

8286
static struct pxa2xx_udc_mach_info pxa_udc_info = {

arch/arm/mach-pxa/devices.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
struct mmp_dma_platdata;
55

66
extern struct platform_device pxa_device_pmu;
7-
extern struct platform_device pxa_device_mci;
87
extern struct platform_device pxa3xx_device_mci2;
98
extern struct platform_device pxa3xx_device_mci3;
109
extern struct platform_device pxa25x_device_udc;

arch/arm/mach-pxa/gumstix.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static struct pxamci_platform_data gumstix_mci_platform_data = {
9090

9191
static void __init gumstix_mmc_init(void)
9292
{
93-
pxa_set_mci_info(&gumstix_mci_platform_data);
93+
pxa_set_mci_info(&gumstix_mci_platform_data, NULL);
9494
}
9595
#else
9696
static void __init gumstix_mmc_init(void)

arch/arm/mach-pxa/spitz.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -651,21 +651,17 @@ static struct pxamci_platform_data spitz_mci_platform_data = {
651651
.setpower = spitz_mci_setpower,
652652
};
653653

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+
{ }
663660
};
664661

665662
static void __init spitz_mmc_init(void)
666663
{
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);
669665
}
670666
#else
671667
static inline void spitz_mmc_init(void) {}

include/linux/platform_data/mmc-pxamci.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
struct device;
99
struct mmc_host;
10+
struct property_entry;
1011

1112
struct pxamci_platform_data {
1213
unsigned int ocr_mask; /* available voltages */
@@ -18,7 +19,8 @@ struct pxamci_platform_data {
1819
bool gpio_card_ro_invert; /* gpio ro is inverted */
1920
};
2021

21-
extern void pxa_set_mci_info(struct pxamci_platform_data *info);
22+
extern void pxa_set_mci_info(const struct pxamci_platform_data *info,
23+
const struct property_entry *props);
2224
extern void pxa3xx_set_mci2_info(struct pxamci_platform_data *info);
2325
extern void pxa3xx_set_mci3_info(struct pxamci_platform_data *info);
2426

0 commit comments

Comments
 (0)