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>
This commit is contained in:
Dmitry Torokhov 2024-06-28 11:08:48 -07:00 committed by Arnd Bergmann
parent 1447c7df38
commit 444b89875f
No known key found for this signature in database
GPG Key ID: 60AB47FFC9095227
5 changed files with 31 additions and 30 deletions

View File

@ -48,7 +48,7 @@ struct platform_device pxa_device_pmu = {
.num_resources = 1,
};
static struct resource pxamci_resources[] = {
static const struct resource pxamci_resources[] = {
[0] = {
.start = 0x41100000,
.end = 0x41100fff,
@ -61,22 +61,26 @@ static struct resource pxamci_resources[] = {
},
};
static u64 pxamci_dmamask = 0xffffffffUL;
struct platform_device pxa_device_mci = {
.name = "pxa2xx-mci",
.id = 0,
.dev = {
.dma_mask = &pxamci_dmamask,
.coherent_dma_mask = 0xffffffff,
},
.num_resources = ARRAY_SIZE(pxamci_resources),
.resource = pxamci_resources,
};
void __init pxa_set_mci_info(struct pxamci_platform_data *info)
void __init pxa_set_mci_info(const struct pxamci_platform_data *info,
const struct property_entry *props)
{
pxa_register_device(&pxa_device_mci, info);
const struct platform_device_info mci_info = {
.name = "pxa2xx-mci",
.id = 0,
.res = pxamci_resources,
.num_res = ARRAY_SIZE(pxamci_resources),
.data = info,
.size_data = sizeof(*info),
.dma_mask = 0xffffffffUL,
.properties = props,
};
struct platform_device *mci_dev;
int err;
mci_dev = platform_device_register_full(&mci_info);
err = PTR_ERR_OR_ZERO(mci_dev);
if (err)
pr_err("Unable to create mci device: %d\n", err);
}
static struct pxa2xx_udc_mach_info pxa_udc_info = {

View File

@ -4,7 +4,6 @@
struct mmp_dma_platdata;
extern struct platform_device pxa_device_pmu;
extern struct platform_device pxa_device_mci;
extern struct platform_device pxa3xx_device_mci2;
extern struct platform_device pxa3xx_device_mci3;
extern struct platform_device pxa25x_device_udc;

View File

@ -90,7 +90,7 @@ static struct pxamci_platform_data gumstix_mci_platform_data = {
static void __init gumstix_mmc_init(void)
{
pxa_set_mci_info(&gumstix_mci_platform_data);
pxa_set_mci_info(&gumstix_mci_platform_data, NULL);
}
#else
static void __init gumstix_mmc_init(void)

View File

@ -651,21 +651,17 @@ static struct pxamci_platform_data spitz_mci_platform_data = {
.setpower = spitz_mci_setpower,
};
static struct gpiod_lookup_table spitz_mci_gpio_table = {
.dev_id = "pxa2xx-mci.0",
.table = {
GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_nSD_DETECT,
"cd", GPIO_ACTIVE_LOW),
GPIO_LOOKUP("gpio-pxa", SPITZ_GPIO_nSD_WP,
"wp", GPIO_ACTIVE_LOW),
{ },
},
static const struct property_entry spitz_mci_props[] __initconst = {
PROPERTY_ENTRY_GPIO("cd-gpios", &pxa2xx_gpiochip_node,
SPITZ_GPIO_nSD_DETECT, GPIO_ACTIVE_LOW),
PROPERTY_ENTRY_GPIO("wp-gpios", &pxa2xx_gpiochip_node,
SPITZ_GPIO_nSD_WP, GPIO_ACTIVE_LOW),
{ }
};
static void __init spitz_mmc_init(void)
{
gpiod_add_lookup_table(&spitz_mci_gpio_table);
pxa_set_mci_info(&spitz_mci_platform_data);
pxa_set_mci_info(&spitz_mci_platform_data, spitz_mci_props);
}
#else
static inline void spitz_mmc_init(void) {}

View File

@ -7,6 +7,7 @@
struct device;
struct mmc_host;
struct property_entry;
struct pxamci_platform_data {
unsigned int ocr_mask; /* available voltages */
@ -18,7 +19,8 @@ struct pxamci_platform_data {
bool gpio_card_ro_invert; /* gpio ro is inverted */
};
extern void pxa_set_mci_info(struct pxamci_platform_data *info);
extern void pxa_set_mci_info(const struct pxamci_platform_data *info,
const struct property_entry *props);
extern void pxa3xx_set_mci2_info(struct pxamci_platform_data *info);
extern void pxa3xx_set_mci3_info(struct pxamci_platform_data *info);