Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3e215d0a authored by Stephen Warren's avatar Stephen Warren
Browse files

gpio: tegra: Hide tegra_gpio_enable/disable()



Recent pinctrl discussions concluded that gpiolib APIs should in fact do
whatever is required to mux a GPIO onto pins, by calling pinctrl APIs if
required. This change implements this for the Tegra GPIO driver, and removes
calls to the Tegra-specific APIs from drivers and board files.

Cc: Chris Ball <cjb@laptop.org>
Cc: linux-mmc@vger.kernel.org
Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
Acked-by: Chris Ball <cjb@laptop.org> # for sdhci-tegra.c
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Acked-by: default avatarOlof Johansson <olof@lixom.net>
parent c61b3da0
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -55,7 +55,6 @@ void ventana_pinmux_init(void);

struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = {
	OF_DEV_AUXDATA("nvidia,tegra20-pinmux", TEGRA_APB_MISC_BASE + 0x14, "tegra-pinmux", NULL),
	OF_DEV_AUXDATA("nvidia,tegra20-gpio", TEGRA_GPIO_BASE, "tegra-gpio", NULL),
	OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC1_BASE, "sdhci-tegra.0", NULL),
	OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC2_BASE, "sdhci-tegra.1", NULL),
	OF_DEV_AUXDATA("nvidia,tegra20-sdhci", TEGRA_SDMMC3_BASE, "sdhci-tegra.2", NULL),
+0 −17
Original line number Diff line number Diff line
@@ -15,13 +15,11 @@
 */

#include <linux/kernel.h>
#include <linux/gpio.h>
#include <linux/of.h>

#include <mach/pinmux.h>
#include <mach/pinmux-tegra20.h>

#include "gpio-names.h"
#include "board-harmony.h"
#include "board-pinmux.h"

@@ -144,24 +142,9 @@ static struct tegra_pingroup_config harmony_pinmux[] = {
	{TEGRA_PINGROUP_XM2D,  TEGRA_MUX_NONE,          TEGRA_PUPD_NORMAL,    TEGRA_TRI_NORMAL},
};

static struct tegra_gpio_table gpio_table[] = {
	{ .gpio = TEGRA_GPIO_SD2_CD,		.enable = true	},
	{ .gpio = TEGRA_GPIO_SD2_WP,		.enable = true	},
	{ .gpio = TEGRA_GPIO_SD2_POWER,		.enable = true	},
	{ .gpio = TEGRA_GPIO_SD4_CD,		.enable = true	},
	{ .gpio = TEGRA_GPIO_SD4_WP,		.enable = true	},
	{ .gpio = TEGRA_GPIO_SD4_POWER,		.enable = true	},
	{ .gpio = TEGRA_GPIO_CDC_IRQ,		.enable = true	},
	{ .gpio = TEGRA_GPIO_HP_DET,		.enable = true	},
	{ .gpio = TEGRA_GPIO_INT_MIC_EN,	.enable = true	},
	{ .gpio = TEGRA_GPIO_EXT_MIC_EN,	.enable = true	},
};

static struct tegra_board_pinmux_conf conf = {
	.pgs = harmony_pinmux,
	.pg_count = ARRAY_SIZE(harmony_pinmux),
	.gpios = gpio_table,
	.gpio_count = ARRAY_SIZE(gpio_table),
};

void harmony_pinmux_init(void)
+0 −14
Original line number Diff line number Diff line
@@ -15,13 +15,11 @@
 */

#include <linux/kernel.h>
#include <linux/gpio.h>
#include <linux/of.h>

#include <mach/pinmux.h>
#include <mach/pinmux-tegra20.h>

#include "gpio-names.h"
#include "board-paz00.h"
#include "board-pinmux.h"

@@ -144,21 +142,9 @@ static struct tegra_pingroup_config paz00_pinmux[] = {
	{TEGRA_PINGROUP_XM2D,  TEGRA_MUX_NONE,          TEGRA_PUPD_NORMAL,    TEGRA_TRI_NORMAL},
};

static struct tegra_gpio_table gpio_table[] = {
	{ .gpio = TEGRA_GPIO_SD1_CD,	.enable = true },
	{ .gpio = TEGRA_GPIO_SD1_WP,	.enable = true },
	{ .gpio = TEGRA_GPIO_SD1_POWER,	.enable = true },
	{ .gpio = TEGRA_ULPI_RST,	.enable = true },
	{ .gpio = TEGRA_WIFI_PWRN,	.enable = true },
	{ .gpio = TEGRA_WIFI_RST,	.enable = true },
	{ .gpio = TEGRA_WIFI_LED,	.enable = true },
};

static struct tegra_board_pinmux_conf conf = {
	.pgs = paz00_pinmux,
	.pg_count = ARRAY_SIZE(paz00_pinmux),
	.gpios = gpio_table,
	.gpio_count = ARRAY_SIZE(gpio_table),
};

void paz00_pinmux_init(void)
+4 −29
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@
#include <linux/of.h>
#include <linux/string.h>

#include <mach/gpio-tegra.h>
#include <mach/pinmux.h>

#include "board-pinmux.h"
@@ -26,18 +25,6 @@

struct tegra_board_pinmux_conf *confs[2];

static void tegra_board_pinmux_setup_gpios(void)
{
	int i;

	for (i = 0; i < ARRAY_SIZE(confs); i++) {
		if (!confs[i])
			continue;

		tegra_gpio_config(confs[i]->gpios, confs[i]->gpio_count);
	}
}

static void tegra_board_pinmux_setup_pinmux(void)
{
	int i;
@@ -57,29 +44,17 @@ static void tegra_board_pinmux_setup_pinmux(void)
static int tegra_board_pinmux_bus_notify(struct notifier_block *nb,
					 unsigned long event, void *vdev)
{
	static bool had_gpio;
	static bool had_pinmux;

	struct device *dev = vdev;
	const char *devname;

	if (event != BUS_NOTIFY_BOUND_DRIVER)
		return NOTIFY_DONE;

	devname = dev_name(dev);
	if (strcmp(dev_name(dev), PINMUX_DEV))
		return NOTIFY_DONE;

	if (!had_gpio && !strcmp(devname, GPIO_DEV)) {
		tegra_board_pinmux_setup_gpios();
		had_gpio = true;
	} else if (!had_pinmux && !strcmp(devname, PINMUX_DEV)) {
	tegra_board_pinmux_setup_pinmux();
		had_pinmux = true;
	}

	if (had_gpio && had_pinmux)
	return NOTIFY_STOP_MASK;
	else
		return NOTIFY_DONE;
}

static struct notifier_block nb = {
+0 −5
Original line number Diff line number Diff line
@@ -15,11 +15,9 @@
#ifndef __MACH_TEGRA_BOARD_PINMUX_H
#define __MACH_TEGRA_BOARD_PINMUX_H

#define GPIO_DEV "tegra-gpio"
#define PINMUX_DEV "tegra-pinmux"

struct tegra_pingroup_config;
struct tegra_gpio_table;

struct tegra_board_pinmux_conf {
	struct tegra_pingroup_config *pgs;
@@ -27,9 +25,6 @@ struct tegra_board_pinmux_conf {

	struct tegra_drive_pingroup_config *drives;
	int drive_count;

	struct tegra_gpio_table *gpios;
	int gpio_count;
};

void tegra_board_pinmux_init(struct tegra_board_pinmux_conf *conf_a,
Loading