GPIO regression fixes for n8x0

A series of fixes for n8x0 GPIO regressions caused by the changes to use
 GPIO descriptors.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEkgNvrZJU/QSQYIcQG9Q+yVyrpXMFAmYNHfIRHHRvbnlAYXRv
 bWlkZS5jb20ACgkQG9Q+yVyrpXOMJw/8Cdkb5dqmEur/qYK70eUE73tN6ytvncaH
 HKzPkK3251Me/zz4+iEdyEHLfKGLmVCIAYjlfVOFxmMwBLJXgg3mUmQl2n1sfaJm
 k26EkjBBcrH1ZscLoUv7J2LmRrexWOcU2LrHvaCMvuSw6O+fvk63nu6Xn9Lm+0V6
 00PR22x7FHJVKllglhcfm+gcxFNKAwCfKitRBIPC+jDirsdj91W1L0vP5FL9qt2E
 0INfpoFr4H8IhHezOuY+i4uYuaFiazzn2usL5CaDR+7g+wsDY/oP1TBXjidWMVEY
 3VPiO/h//u7jhUKvrul+I2bZN8DUPSBt5TPImXGvBfTwRVM2pJWUzTVcrAXB4BV9
 qx32rC1s0wUHSbit2d5vECjjO90xQrLLwWwfegQ7M1ALi5ZFKBEU2wq6GTMKkiQn
 7bleU4Dq64hqYA7klhHdSfhkXxfWLuS+3DOBRIYbZk468HoRtNrLWGJ5SoXURB8B
 1/wri5YarrDeo2J9J/AAentoQQyVJKvNpNBqPeEzGZApX0M/L0oKHSGqAQBZLTi2
 ooiRXjSNprh4sD+e1JiLwl7stqITAVtLksGLt99ZN7QZN76Sk661FF5RtqmCP+QG
 +kqildZALwVCO1qSe3q5Mboy/FxxQSdcg2+eKKK8kKIybqG7B/YTQMS30uPQNuTs
 QdmnSLuHqdA=
 =pHnd
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmYVTgEACgkQYKtH/8kJ
 UiethRAAjH6U7D1G4FjlixHcgkfLaunDCMjzqYqFLD0StMEz9yJ5wmADtO62Xsrz
 gH4dMjD0+5UOS4ogs6rsfq7QcKVE9Wy7RocbFw0ZyBQquL6+AAcDKTgWQGYOpJ0L
 9pAqgg/mBBgud+uk8B7nPt9qwTudQPKx6Ibj59UDwRfEoayYmu3X8t3qvVbO8ZOf
 nEjTsrZ43fceWE+0mODBBX5OKd2Vv6qZQH+w+ZTKymEfxvEw3VjoCZ/4KDW3JZq4
 e9eP0l8rdyjzwk709Eu1KDRkzXQLNBD0DIZUxXeyiNV2bE/nP/UUKk1lzgVhlvKZ
 mxHywXbLn9lR0Nmmdgu2opj0UvVBBKOSnJ4//f1TjRGx1SMDBmqHHFZ8YNAl7SJj
 1tDvxJI/pGYOK+BqU9Pj821wrTxjNzVedGTU6VCYyGn/r8OWbjVyOOMr01tI5LGK
 IDZ7mPeGaDQGk4bWRtACXzfBbm+HgHE3nUAzoZY9DszXi5/JaxOySAKiIq3X0LQT
 1dXfvCEX/p8GmNSCzlbavu9ucuDdNgNUXH6II3HszSLDZpDs7gt7DBkbkJ5w/rRt
 Exgstlv5xoolzYHdmD1XUfufsOPbSjHySLhqp2nTrjYKPsBRggP/dIzH+UFaCTSN
 ythuAm8i5MXyIOgZscPJGTH8aHSowp9DsX/x7a8luKRagiX4sh0=
 =m+W/
 -----END PGP SIGNATURE-----

Merge tag 'omap-for-v6.9/n8x0-fixes-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into arm/fixes

GPIO regression fixes for n8x0

A series of fixes for n8x0 GPIO regressions caused by the changes to use
GPIO descriptors.

* tag 'omap-for-v6.9/n8x0-fixes-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
  ARM: OMAP2+: fix USB regression on Nokia N8x0
  mmc: omap: restore original power up/down steps
  mmc: omap: fix deferred probe
  mmc: omap: fix broken slot switch lookup
  ARM: OMAP2+: fix N810 MMC gpiod table
  ARM: OMAP2+: fix bogus MMC GPIO labels on Nokia N8x0

Link: https://lore.kernel.org/r/pull-1712135932-125424@atomide.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
Arnd Bergmann 2024-04-09 16:17:28 +02:00
commit 06bd7e4463
2 changed files with 41 additions and 30 deletions

View File

@ -79,10 +79,8 @@ static struct musb_hdrc_platform_data tusb_data = {
static struct gpiod_lookup_table tusb_gpio_table = {
.dev_id = "musb-tusb",
.table = {
GPIO_LOOKUP("gpio-0-15", 0, "enable",
GPIO_ACTIVE_HIGH),
GPIO_LOOKUP("gpio-48-63", 10, "int",
GPIO_ACTIVE_HIGH),
GPIO_LOOKUP("gpio-0-31", 0, "enable", GPIO_ACTIVE_HIGH),
GPIO_LOOKUP("gpio-32-63", 26, "int", GPIO_ACTIVE_HIGH),
{ }
},
};
@ -140,12 +138,11 @@ static int slot1_cover_open;
static int slot2_cover_open;
static struct device *mmc_device;
static struct gpiod_lookup_table nokia8xx_mmc_gpio_table = {
static struct gpiod_lookup_table nokia800_mmc_gpio_table = {
.dev_id = "mmci-omap.0",
.table = {
/* Slot switch, GPIO 96 */
GPIO_LOOKUP("gpio-80-111", 16,
"switch", GPIO_ACTIVE_HIGH),
GPIO_LOOKUP("gpio-96-127", 0, "switch", GPIO_ACTIVE_HIGH),
{ }
},
};
@ -153,12 +150,12 @@ static struct gpiod_lookup_table nokia8xx_mmc_gpio_table = {
static struct gpiod_lookup_table nokia810_mmc_gpio_table = {
.dev_id = "mmci-omap.0",
.table = {
/* Slot switch, GPIO 96 */
GPIO_LOOKUP("gpio-96-127", 0, "switch", GPIO_ACTIVE_HIGH),
/* Slot index 1, VSD power, GPIO 23 */
GPIO_LOOKUP_IDX("gpio-16-31", 7,
"vsd", 1, GPIO_ACTIVE_HIGH),
GPIO_LOOKUP_IDX("gpio-0-31", 23, "vsd", 1, GPIO_ACTIVE_HIGH),
/* Slot index 1, VIO power, GPIO 9 */
GPIO_LOOKUP_IDX("gpio-0-15", 9,
"vio", 1, GPIO_ACTIVE_HIGH),
GPIO_LOOKUP_IDX("gpio-0-31", 9, "vio", 1, GPIO_ACTIVE_HIGH),
{ }
},
};
@ -415,8 +412,6 @@ static struct omap_mmc_platform_data *mmc_data[OMAP24XX_NR_MMC];
static void __init n8x0_mmc_init(void)
{
gpiod_add_lookup_table(&nokia8xx_mmc_gpio_table);
if (board_is_n810()) {
mmc1_data.slots[0].name = "external";
@ -429,6 +424,8 @@ static void __init n8x0_mmc_init(void)
mmc1_data.slots[1].name = "internal";
mmc1_data.slots[1].ban_openended = 1;
gpiod_add_lookup_table(&nokia810_mmc_gpio_table);
} else {
gpiod_add_lookup_table(&nokia800_mmc_gpio_table);
}
mmc1_data.nr_slots = 2;

View File

@ -1114,10 +1114,25 @@ static void mmc_omap_set_power(struct mmc_omap_slot *slot, int power_on,
host = slot->host;
if (slot->vsd)
gpiod_set_value(slot->vsd, power_on);
if (slot->vio)
gpiod_set_value(slot->vio, power_on);
if (power_on) {
if (slot->vsd) {
gpiod_set_value(slot->vsd, power_on);
msleep(1);
}
if (slot->vio) {
gpiod_set_value(slot->vio, power_on);
msleep(1);
}
} else {
if (slot->vio) {
gpiod_set_value(slot->vio, power_on);
msleep(50);
}
if (slot->vsd) {
gpiod_set_value(slot->vsd, power_on);
msleep(50);
}
}
if (slot->pdata->set_power != NULL)
slot->pdata->set_power(mmc_dev(slot->mmc), slot->id, power_on,
@ -1254,18 +1269,18 @@ static int mmc_omap_new_slot(struct mmc_omap_host *host, int id)
slot->pdata = &host->pdata->slots[id];
/* Check for some optional GPIO controls */
slot->vsd = gpiod_get_index_optional(host->dev, "vsd",
id, GPIOD_OUT_LOW);
slot->vsd = devm_gpiod_get_index_optional(host->dev, "vsd",
id, GPIOD_OUT_LOW);
if (IS_ERR(slot->vsd))
return dev_err_probe(host->dev, PTR_ERR(slot->vsd),
"error looking up VSD GPIO\n");
slot->vio = gpiod_get_index_optional(host->dev, "vio",
id, GPIOD_OUT_LOW);
slot->vio = devm_gpiod_get_index_optional(host->dev, "vio",
id, GPIOD_OUT_LOW);
if (IS_ERR(slot->vio))
return dev_err_probe(host->dev, PTR_ERR(slot->vio),
"error looking up VIO GPIO\n");
slot->cover = gpiod_get_index_optional(host->dev, "cover",
id, GPIOD_IN);
slot->cover = devm_gpiod_get_index_optional(host->dev, "cover",
id, GPIOD_IN);
if (IS_ERR(slot->cover))
return dev_err_probe(host->dev, PTR_ERR(slot->cover),
"error looking up cover switch GPIO\n");
@ -1379,13 +1394,6 @@ static int mmc_omap_probe(struct platform_device *pdev)
if (IS_ERR(host->virt_base))
return PTR_ERR(host->virt_base);
host->slot_switch = gpiod_get_optional(host->dev, "switch",
GPIOD_OUT_LOW);
if (IS_ERR(host->slot_switch))
return dev_err_probe(host->dev, PTR_ERR(host->slot_switch),
"error looking up slot switch GPIO\n");
INIT_WORK(&host->slot_release_work, mmc_omap_slot_release_work);
INIT_WORK(&host->send_stop_work, mmc_omap_send_stop_work);
@ -1404,6 +1412,12 @@ static int mmc_omap_probe(struct platform_device *pdev)
host->dev = &pdev->dev;
platform_set_drvdata(pdev, host);
host->slot_switch = devm_gpiod_get_optional(host->dev, "switch",
GPIOD_OUT_LOW);
if (IS_ERR(host->slot_switch))
return dev_err_probe(host->dev, PTR_ERR(host->slot_switch),
"error looking up slot switch GPIO\n");
host->id = pdev->id;
host->irq = irq;
host->phys_base = res->start;