Skip to content

Commit 06bd7e4

Browse files
committed
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/[email protected] Signed-off-by: Arnd Bergmann <[email protected]>
2 parents 39cd87c + 4421405 commit 06bd7e4

File tree

2 files changed

+41
-30
lines changed

2 files changed

+41
-30
lines changed

arch/arm/mach-omap2/board-n8x0.c

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,8 @@ static struct musb_hdrc_platform_data tusb_data = {
7979
static struct gpiod_lookup_table tusb_gpio_table = {
8080
.dev_id = "musb-tusb",
8181
.table = {
82-
GPIO_LOOKUP("gpio-0-15", 0, "enable",
83-
GPIO_ACTIVE_HIGH),
84-
GPIO_LOOKUP("gpio-48-63", 10, "int",
85-
GPIO_ACTIVE_HIGH),
82+
GPIO_LOOKUP("gpio-0-31", 0, "enable", GPIO_ACTIVE_HIGH),
83+
GPIO_LOOKUP("gpio-32-63", 26, "int", GPIO_ACTIVE_HIGH),
8684
{ }
8785
},
8886
};
@@ -140,25 +138,24 @@ static int slot1_cover_open;
140138
static int slot2_cover_open;
141139
static struct device *mmc_device;
142140

143-
static struct gpiod_lookup_table nokia8xx_mmc_gpio_table = {
141+
static struct gpiod_lookup_table nokia800_mmc_gpio_table = {
144142
.dev_id = "mmci-omap.0",
145143
.table = {
146144
/* Slot switch, GPIO 96 */
147-
GPIO_LOOKUP("gpio-80-111", 16,
148-
"switch", GPIO_ACTIVE_HIGH),
145+
GPIO_LOOKUP("gpio-96-127", 0, "switch", GPIO_ACTIVE_HIGH),
149146
{ }
150147
},
151148
};
152149

153150
static struct gpiod_lookup_table nokia810_mmc_gpio_table = {
154151
.dev_id = "mmci-omap.0",
155152
.table = {
153+
/* Slot switch, GPIO 96 */
154+
GPIO_LOOKUP("gpio-96-127", 0, "switch", GPIO_ACTIVE_HIGH),
156155
/* Slot index 1, VSD power, GPIO 23 */
157-
GPIO_LOOKUP_IDX("gpio-16-31", 7,
158-
"vsd", 1, GPIO_ACTIVE_HIGH),
156+
GPIO_LOOKUP_IDX("gpio-0-31", 23, "vsd", 1, GPIO_ACTIVE_HIGH),
159157
/* Slot index 1, VIO power, GPIO 9 */
160-
GPIO_LOOKUP_IDX("gpio-0-15", 9,
161-
"vio", 1, GPIO_ACTIVE_HIGH),
158+
GPIO_LOOKUP_IDX("gpio-0-31", 9, "vio", 1, GPIO_ACTIVE_HIGH),
162159
{ }
163160
},
164161
};
@@ -415,8 +412,6 @@ static struct omap_mmc_platform_data *mmc_data[OMAP24XX_NR_MMC];
415412

416413
static void __init n8x0_mmc_init(void)
417414
{
418-
gpiod_add_lookup_table(&nokia8xx_mmc_gpio_table);
419-
420415
if (board_is_n810()) {
421416
mmc1_data.slots[0].name = "external";
422417

@@ -429,6 +424,8 @@ static void __init n8x0_mmc_init(void)
429424
mmc1_data.slots[1].name = "internal";
430425
mmc1_data.slots[1].ban_openended = 1;
431426
gpiod_add_lookup_table(&nokia810_mmc_gpio_table);
427+
} else {
428+
gpiod_add_lookup_table(&nokia800_mmc_gpio_table);
432429
}
433430

434431
mmc1_data.nr_slots = 2;

drivers/mmc/host/omap.c

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,10 +1114,25 @@ static void mmc_omap_set_power(struct mmc_omap_slot *slot, int power_on,
11141114

11151115
host = slot->host;
11161116

1117-
if (slot->vsd)
1118-
gpiod_set_value(slot->vsd, power_on);
1119-
if (slot->vio)
1120-
gpiod_set_value(slot->vio, power_on);
1117+
if (power_on) {
1118+
if (slot->vsd) {
1119+
gpiod_set_value(slot->vsd, power_on);
1120+
msleep(1);
1121+
}
1122+
if (slot->vio) {
1123+
gpiod_set_value(slot->vio, power_on);
1124+
msleep(1);
1125+
}
1126+
} else {
1127+
if (slot->vio) {
1128+
gpiod_set_value(slot->vio, power_on);
1129+
msleep(50);
1130+
}
1131+
if (slot->vsd) {
1132+
gpiod_set_value(slot->vsd, power_on);
1133+
msleep(50);
1134+
}
1135+
}
11211136

11221137
if (slot->pdata->set_power != NULL)
11231138
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)
12541269
slot->pdata = &host->pdata->slots[id];
12551270

12561271
/* Check for some optional GPIO controls */
1257-
slot->vsd = gpiod_get_index_optional(host->dev, "vsd",
1258-
id, GPIOD_OUT_LOW);
1272+
slot->vsd = devm_gpiod_get_index_optional(host->dev, "vsd",
1273+
id, GPIOD_OUT_LOW);
12591274
if (IS_ERR(slot->vsd))
12601275
return dev_err_probe(host->dev, PTR_ERR(slot->vsd),
12611276
"error looking up VSD GPIO\n");
1262-
slot->vio = gpiod_get_index_optional(host->dev, "vio",
1263-
id, GPIOD_OUT_LOW);
1277+
slot->vio = devm_gpiod_get_index_optional(host->dev, "vio",
1278+
id, GPIOD_OUT_LOW);
12641279
if (IS_ERR(slot->vio))
12651280
return dev_err_probe(host->dev, PTR_ERR(slot->vio),
12661281
"error looking up VIO GPIO\n");
1267-
slot->cover = gpiod_get_index_optional(host->dev, "cover",
1268-
id, GPIOD_IN);
1282+
slot->cover = devm_gpiod_get_index_optional(host->dev, "cover",
1283+
id, GPIOD_IN);
12691284
if (IS_ERR(slot->cover))
12701285
return dev_err_probe(host->dev, PTR_ERR(slot->cover),
12711286
"error looking up cover switch GPIO\n");
@@ -1379,13 +1394,6 @@ static int mmc_omap_probe(struct platform_device *pdev)
13791394
if (IS_ERR(host->virt_base))
13801395
return PTR_ERR(host->virt_base);
13811396

1382-
host->slot_switch = gpiod_get_optional(host->dev, "switch",
1383-
GPIOD_OUT_LOW);
1384-
if (IS_ERR(host->slot_switch))
1385-
return dev_err_probe(host->dev, PTR_ERR(host->slot_switch),
1386-
"error looking up slot switch GPIO\n");
1387-
1388-
13891397
INIT_WORK(&host->slot_release_work, mmc_omap_slot_release_work);
13901398
INIT_WORK(&host->send_stop_work, mmc_omap_send_stop_work);
13911399

@@ -1404,6 +1412,12 @@ static int mmc_omap_probe(struct platform_device *pdev)
14041412
host->dev = &pdev->dev;
14051413
platform_set_drvdata(pdev, host);
14061414

1415+
host->slot_switch = devm_gpiod_get_optional(host->dev, "switch",
1416+
GPIOD_OUT_LOW);
1417+
if (IS_ERR(host->slot_switch))
1418+
return dev_err_probe(host->dev, PTR_ERR(host->slot_switch),
1419+
"error looking up slot switch GPIO\n");
1420+
14071421
host->id = pdev->id;
14081422
host->irq = irq;
14091423
host->phys_base = res->start;

0 commit comments

Comments
 (0)