Unverified Commit 06bd7e44 authored by Arnd Bergmann's avatar Arnd Bergmann
Browse files

Merge tag 'omap-for-v6.9/n8x0-fixes-signed' of...

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: default avatarArnd Bergmann <arnd@arndb.de>
parents 39cd87c4 4421405e
Loading
Loading
Loading
Loading
+10 −13
Original line number Diff line number Diff line
@@ -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;
+31 −17
Original line number Diff line number Diff line
@@ -1114,10 +1114,25 @@ static void mmc_omap_set_power(struct mmc_omap_slot *slot, int power_on,

	host = slot->host;

	if (slot->vsd)
	if (power_on) {
		if (slot->vsd) {
			gpiod_set_value(slot->vsd, power_on);
	if (slot->vio)
			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,17 +1269,17 @@ 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",
	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",
	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",
	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),
@@ -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;