diff options
| author | Linus Walleij <linus.walleij@linaro.org> | 2012-03-06 17:30:15 -0500 |
|---|---|---|
| committer | Linus Walleij <linus.walleij@linaro.org> | 2012-03-06 17:30:15 -0500 |
| commit | a6c3b33f02c799db69a3cd82545e45e9df3d69ca (patch) | |
| tree | 02c8d17867c1c552a5c44c7c3158a27afadd0c66 | |
| parent | 0acfb076f7987bd4bb5cd5de879ba3e3e71724e9 (diff) | |
| parent | f1f1ffa0d2fd562b610940c7374b8217597af47f (diff) | |
Merge branch 'pinctrl-tegra-for-next-diet' into for-next
| -rw-r--r-- | arch/arm/mach-tegra/Kconfig | 4 | ||||
| -rw-r--r-- | arch/arm/mach-tegra/include/mach/pinconf-tegra.h | 63 | ||||
| -rw-r--r-- | drivers/pinctrl/Kconfig | 15 | ||||
| -rw-r--r-- | drivers/pinctrl/Makefile | 3 | ||||
| -rw-r--r-- | drivers/pinctrl/pinctrl-tegra.c | 559 | ||||
| -rw-r--r-- | drivers/pinctrl/pinctrl-tegra.h | 163 | ||||
| -rw-r--r-- | drivers/pinctrl/pinctrl-tegra20.c | 2860 | ||||
| -rw-r--r-- | drivers/pinctrl/pinctrl-tegra30.c | 3726 |
8 files changed, 7393 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig index 373652d76b90..32b420a90c3d 100644 --- a/arch/arm/mach-tegra/Kconfig +++ b/arch/arm/mach-tegra/Kconfig | |||
| @@ -7,6 +7,8 @@ config ARCH_TEGRA_2x_SOC | |||
| 7 | select CPU_V7 | 7 | select CPU_V7 |
| 8 | select ARM_GIC | 8 | select ARM_GIC |
| 9 | select ARCH_REQUIRE_GPIOLIB | 9 | select ARCH_REQUIRE_GPIOLIB |
| 10 | select PINCTRL | ||
| 11 | select PINCTRL_TEGRA20 | ||
| 10 | select USB_ARCH_HAS_EHCI if USB_SUPPORT | 12 | select USB_ARCH_HAS_EHCI if USB_SUPPORT |
| 11 | select USB_ULPI if USB_SUPPORT | 13 | select USB_ULPI if USB_SUPPORT |
| 12 | select USB_ULPI_VIEWPORT if USB_SUPPORT | 14 | select USB_ULPI_VIEWPORT if USB_SUPPORT |
| @@ -19,6 +21,8 @@ config ARCH_TEGRA_3x_SOC | |||
| 19 | select CPU_V7 | 21 | select CPU_V7 |
| 20 | select ARM_GIC | 22 | select ARM_GIC |
| 21 | select ARCH_REQUIRE_GPIOLIB | 23 | select ARCH_REQUIRE_GPIOLIB |
| 24 | select PINCTRL | ||
| 25 | select PINCTRL_TEGRA30 | ||
| 22 | select USB_ARCH_HAS_EHCI if USB_SUPPORT | 26 | select USB_ARCH_HAS_EHCI if USB_SUPPORT |
| 23 | select USB_ULPI if USB_SUPPORT | 27 | select USB_ULPI if USB_SUPPORT |
| 24 | select USB_ULPI_VIEWPORT if USB_SUPPORT | 28 | select USB_ULPI_VIEWPORT if USB_SUPPORT |
diff --git a/arch/arm/mach-tegra/include/mach/pinconf-tegra.h b/arch/arm/mach-tegra/include/mach/pinconf-tegra.h new file mode 100644 index 000000000000..1f24d304921e --- /dev/null +++ b/arch/arm/mach-tegra/include/mach/pinconf-tegra.h | |||
| @@ -0,0 +1,63 @@ | |||
| 1 | /* | ||
| 2 | * pinctrl configuration definitions for the NVIDIA Tegra pinmux | ||
| 3 | * | ||
| 4 | * Copyright (c) 2011, NVIDIA CORPORATION. All rights reserved. | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify it | ||
| 7 | * under the terms and conditions of the GNU General Public License, | ||
| 8 | * version 2, as published by the Free Software Foundation. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 13 | * more details. | ||
| 14 | */ | ||
| 15 | |||
| 16 | #ifndef __PINCONF_TEGRA_H__ | ||
| 17 | #define __PINCONF_TEGRA_H__ | ||
| 18 | |||
| 19 | enum tegra_pinconf_param { | ||
| 20 | /* argument: tegra_pinconf_pull */ | ||
| 21 | TEGRA_PINCONF_PARAM_PULL, | ||
| 22 | /* argument: tegra_pinconf_tristate */ | ||
| 23 | TEGRA_PINCONF_PARAM_TRISTATE, | ||
| 24 | /* argument: Boolean */ | ||
| 25 | TEGRA_PINCONF_PARAM_ENABLE_INPUT, | ||
| 26 | /* argument: Boolean */ | ||
| 27 | TEGRA_PINCONF_PARAM_OPEN_DRAIN, | ||
| 28 | /* argument: Boolean */ | ||
| 29 | TEGRA_PINCONF_PARAM_LOCK, | ||
| 30 | /* argument: Boolean */ | ||
| 31 | TEGRA_PINCONF_PARAM_IORESET, | ||
| 32 | /* argument: Boolean */ | ||
| 33 | TEGRA_PINCONF_PARAM_HIGH_SPEED_MODE, | ||
| 34 | /* argument: Boolean */ | ||
| 35 | TEGRA_PINCONF_PARAM_SCHMITT, | ||
| 36 | /* argument: Boolean */ | ||
| 37 | TEGRA_PINCONF_PARAM_LOW_POWER_MODE, | ||
| 38 | /* argument: Integer, range is HW-dependant */ | ||
| 39 | TEGRA_PINCONF_PARAM_DRIVE_DOWN_STRENGTH, | ||
| 40 | /* argument: Integer, range is HW-dependant */ | ||
| 41 | TEGRA_PINCONF_PARAM_DRIVE_UP_STRENGTH, | ||
| 42 | /* argument: Integer, range is HW-dependant */ | ||
| 43 | TEGRA_PINCONF_PARAM_SLEW_RATE_FALLING, | ||
| 44 | /* argument: Integer, range is HW-dependant */ | ||
| 45 | TEGRA_PINCONF_PARAM_SLEW_RATE_RISING, | ||
| 46 | }; | ||
| 47 | |||
| 48 | enum tegra_pinconf_pull { | ||
| 49 | TEGRA_PINCONFIG_PULL_NONE, | ||
| 50 | TEGRA_PINCONFIG_PULL_DOWN, | ||
| 51 | TEGRA_PINCONFIG_PULL_UP, | ||
| 52 | }; | ||
| 53 | |||
| 54 | enum tegra_pinconf_tristate { | ||
| 55 | TEGRA_PINCONFIG_DRIVEN, | ||
| 56 | TEGRA_PINCONFIG_TRISTATE, | ||
| 57 | }; | ||
| 58 | |||
| 59 | #define TEGRA_PINCONF_PACK(_param_, _arg_) ((_param_) << 16 | (_arg_)) | ||
| 60 | #define TEGRA_PINCONF_UNPACK_PARAM(_conf_) ((_conf_) >> 16) | ||
| 61 | #define TEGRA_PINCONF_UNPACK_ARG(_conf_) ((_conf_) & 0xffff) | ||
| 62 | |||
| 63 | #endif | ||
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig index 3bea79fc35d5..c6d29ff61d7e 100644 --- a/drivers/pinctrl/Kconfig +++ b/drivers/pinctrl/Kconfig | |||
| @@ -50,6 +50,21 @@ config PINCTRL_SIRF | |||
| 50 | depends on ARCH_PRIMA2 | 50 | depends on ARCH_PRIMA2 |
| 51 | select PINMUX | 51 | select PINMUX |
| 52 | 52 | ||
| 53 | config PINCTRL_TEGRA | ||
| 54 | bool | ||
| 55 | |||
| 56 | config PINCTRL_TEGRA20 | ||
| 57 | bool | ||
| 58 | select PINMUX | ||
| 59 | select PINCONF | ||
| 60 | select PINCTRL_TEGRA | ||
| 61 | |||
| 62 | config PINCTRL_TEGRA30 | ||
| 63 | bool | ||
| 64 | select PINMUX | ||
| 65 | select PINCONF | ||
| 66 | select PINCTRL_TEGRA | ||
| 67 | |||
| 53 | config PINCTRL_U300 | 68 | config PINCTRL_U300 |
| 54 | bool "U300 pin controller driver" | 69 | bool "U300 pin controller driver" |
| 55 | depends on ARCH_U300 | 70 | depends on ARCH_U300 |
diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile index c95d91e87b55..754329b9c611 100644 --- a/drivers/pinctrl/Makefile +++ b/drivers/pinctrl/Makefile | |||
| @@ -10,5 +10,8 @@ obj-$(CONFIG_PINCTRL_MMP2) += pinctrl-mmp2.o | |||
| 10 | obj-$(CONFIG_PINCTRL_PXA168) += pinctrl-pxa168.o | 10 | obj-$(CONFIG_PINCTRL_PXA168) += pinctrl-pxa168.o |
| 11 | obj-$(CONFIG_PINCTRL_PXA910) += pinctrl-pxa910.o | 11 | obj-$(CONFIG_PINCTRL_PXA910) += pinctrl-pxa910.o |
| 12 | obj-$(CONFIG_PINCTRL_SIRF) += pinctrl-sirf.o | 12 | obj-$(CONFIG_PINCTRL_SIRF) += pinctrl-sirf.o |
| 13 | obj-$(CONFIG_PINCTRL_TEGRA) += pinctrl-tegra.o | ||
| 14 | obj-$(CONFIG_PINCTRL_TEGRA20) += pinctrl-tegra20.o | ||
| 15 | obj-$(CONFIG_PINCTRL_TEGRA30) += pinctrl-tegra30.o | ||
| 13 | obj-$(CONFIG_PINCTRL_U300) += pinctrl-u300.o | 16 | obj-$(CONFIG_PINCTRL_U300) += pinctrl-u300.o |
| 14 | obj-$(CONFIG_PINCTRL_COH901) += pinctrl-coh901.o | 17 | obj-$(CONFIG_PINCTRL_COH901) += pinctrl-coh901.o |
diff --git a/drivers/pinctrl/pinctrl-tegra.c b/drivers/pinctrl/pinctrl-tegra.c new file mode 100644 index 000000000000..9b329688120c --- /dev/null +++ b/drivers/pinctrl/pinctrl-tegra.c | |||
| @@ -0,0 +1,559 @@ | |||
| 1 | /* | ||
| 2 | * Driver for the NVIDIA Tegra pinmux | ||
| 3 | * | ||
| 4 | * Copyright (c) 2011, NVIDIA CORPORATION. All rights reserved. | ||
| 5 | * | ||
| 6 | * Derived from code: | ||
| 7 | * Copyright (C) 2010 Google, Inc. | ||
| 8 | * Copyright (C) 2010 NVIDIA Corporation | ||
| 9 | * Copyright (C) 2009-2011 ST-Ericsson AB | ||
| 10 | * | ||
| 11 | * This program is free software; you can redistribute it and/or modify it | ||
| 12 | * under the terms and conditions of the GNU General Public License, | ||
| 13 | * version 2, as published by the Free Software Foundation. | ||
| 14 | * | ||
| 15 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 16 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 17 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 18 | * more details. | ||
| 19 | */ | ||
| 20 | |||
| 21 | #include <linux/err.h> | ||
| 22 | #include <linux/init.h> | ||
| 23 | #include <linux/io.h> | ||
| 24 | #include <linux/module.h> | ||
| 25 | #include <linux/of_device.h> | ||
| 26 | #include <linux/pinctrl/pinctrl.h> | ||
| 27 | #include <linux/pinctrl/pinmux.h> | ||
| 28 | #include <linux/pinctrl/pinconf.h> | ||
| 29 | |||
| 30 | #include <mach/pinconf-tegra.h> | ||
| 31 | |||
| 32 | #include "pinctrl-tegra.h" | ||
| 33 | |||
| 34 | #define DRIVER_NAME "tegra-pinmux-disabled" | ||
| 35 | |||
| 36 | struct tegra_pmx { | ||
| 37 | struct device *dev; | ||
| 38 | struct pinctrl_dev *pctl; | ||
| 39 | |||
| 40 | const struct tegra_pinctrl_soc_data *soc; | ||
| 41 | |||
| 42 | int nbanks; | ||
| 43 | void __iomem **regs; | ||
| 44 | }; | ||
| 45 | |||
| 46 | static inline u32 pmx_readl(struct tegra_pmx *pmx, u32 bank, u32 reg) | ||
| 47 | { | ||
| 48 | return readl(pmx->regs[bank] + reg); | ||
| 49 | } | ||
| 50 | |||
| 51 | static inline void pmx_w | ||
