Documentation/gpio.txt: Explain expected pinctrl interaction
Subsystems (8)
PATCH v2 1/3 Documentation/gpio.txt: Explain expected pinctrl interaction
Update gpio.txt based on recent discussions regarding interaction with the pinctrl subsystem.
Previously, gpio_request() was described as explicitly not performing any required mux setup operations etc.
Now, gpio_request() is explicitly as explicitly performing any required mux setup operations where possible. In the case it isn't, platform code is required to have set up any required muxing or other configuration prior to gpio_request() being called, in order to maintain the same semantics.
This is achieved by gpiolib drivers calling e.g. pinctrl_request_gpio() in their .request() operation.
---
v2: Modified to state that pin multiplexing should be performed within direction_input()/output() rather than request(), to address Russell King's need for glitchless transition between special function and GPIO usage of a pin. Various rewording and cleanup due to this.
--- Documentation/gpio.txt | 23 ++++++++++++++++++++--- 1 files changed, 20 insertions(+), 3 deletions(-)
Documentation/gpio.txt +20 -3
@@ -271,9 +271,26 @@ Some platforms may also use knowledge about what GPIOs are active for power management, such as by powering down unused chip sectors and, more easily, gating off unused clocks. -Note that requesting a GPIO does NOT cause it to be configured in any -way; it just marks that GPIO as in use. Separate code must handle any -pin setup (e.g. controlling which pin the GPIO uses, pullup/pulldown). +For GPIOs that use pins known to the pinctrl subsystem, that subsystem should +be informed of their use; a gpiolib driver's .request() operation may call +pinctrl_request_gpio(), and a gpiolib driver's .free() operation may call +pinctrl_free_gpio(). The pinctrl subsystem allows a pinctrl_request_gpio() +to succeed concurrently with a pin or pingroup being "owned" by a device for +pin multiplexing. + +Any programming of pin multiplexing hardware that is needed to route the +GPIO signal to the appropriate pin should occur within a GPIO driver's +.direction_input() or .direction_output() operations, and occur after any +setup of an output GPIO's value. This allows a glitch-free migration from a +pin's special function to GPIO. This is sometimes required when using a GPIO +to implement a workaround on signals typically driven by a non-GPIO HW block. + +Some platforms allow some or all GPIO signals to be routed to different pins. +Similarly, other aspects of the GPIO or pin may need to be configured, such as +pullup/pulldown. Platform software should arrange that any such details are +configured prior to gpio_request() being called for those GPIOs, e.g. using +the pinctrl subsystem's mapping table, so that GPIO users need not be aware +of these details. Also note that it's your responsibility to have stopped using a GPIO before you free it.
Signature · 1 line
1.7.0.4
PATCH v2 2/3 pinctrl: allow concurrent gpio and mux function ownership of pins
Per recent updates to Documentation/gpio.txt, gpiolib drivers should inform pinctrl when a GPIO is requested. pinctrl then marks that pin as in-use for that GPIO function.
When an SoC muxes pins in a group, it's quite possible for the group to contain e.g. 6 pins, but only 4 of them actually be needed by the HW module that's mux'd to them. In this case, the other 2 pins could be used as GPIOs. However, pinctrl marks all the pins within the group as in-use by the selected mux function. To allow the expected gpiolib interaction, separate the concepts of pin ownership into two parts: One for the mux function and one for GPIO usage. Finally, allow those two ownerships to exist in parallel.
---
v2: New patch.
--- drivers/pinctrl/core.h | 13 ++++---- drivers/pinctrl/pinmux.c | 72 +++++++++++++++++++++++++++++++-------------- 2 files changed, 56 insertions(+), 29 deletions(-)
drivers/pinctrl/core.h +7 -6
@@ -118,15 +118,15 @@ struct pinctrl_setting {* @name: a name for the pin, e.g. the name of the pin/pad/finger on a * datasheet or such * @dynamic_name: if the name of this pin was dynamically allocated -* @usecount: If zero, the pin is not claimed, and @owner should be NULL. +* @mux_usecount: If zero, the pin is not claimed, and @owner should be NULL. * If non-zero, this pin is claimed by @owner. This field is an integer * rather than a boolean, since pinctrl_get() might process multiple * mapping table entries that refer to, and hence claim, the same group * or pin, and each of these will increment the @usecount. -* @owner: The name of the entity owning the pin. Typically, this is the name -* of the device that called pinctrl_get(). Alternatively, it may be the -* name of the GPIO passed to pinctrl_request_gpio(). +* @mux_owner: The name of device that called pinctrl_get(). * @mux_setting: The most recent selected mux setting for this pin, if any. +* @gpio_owner: If pinctrl_request_gpio() was called for this pin, this is +* the name of the GPIO that "owns" this pin. */ struct pin_desc {struct pinctrl_dev *pctldev;
@@ -134,9 +134,10 @@ struct pin_desc {bool dynamic_name;/* These fields only added when supporting pinmux drivers */ #ifdef CONFIG_PINMUX -unsigned usecount; -const char *owner; +unsigned mux_usecount; +const char *mux_owner;const struct pinctrl_setting_mux *mux_setting; +const char *gpio_owner;#endif };
drivers/pinctrl/pinmux.c +49 -23
113 lines not on this page · raw message
Signature · 1 line
1.7.0.4
PATCH v2 3/3 gpio: tegra: Hide tegra_gpio_enable/disable()
In reply to Stephen WarrenRecent 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.
---
v2: Adjusted per changes to latest version of Documentation/gpio.txt. Fixed tegra_board_pinmux_bus_notify() to still check the device name, so it waits for the pinmux device to be registered, not just /any/ device.
Merging note: The first two (or at least the 2nd) patches can go through the pinctrl susbsystem without issue. This patch should probably be taken through the Tegra tree. Once patch 2 is in pinctrl, and considered stable, I can just use that as a dependency for the branch containing this Tegra patch. I assume that this series will go into 3.5 not 3.4, but I'm willing to be surprised:-)
arch/arm/mach-tegra/board-dt-tegra20.c | 1 - arch/arm/mach-tegra/board-harmony-pinmux.c | 17 ----------- arch/arm/mach-tegra/board-paz00-pinmux.c | 14 --------- arch/arm/mach-tegra/board-pinmux.c | 33 +++-------------------- arch/arm/mach-tegra/board-pinmux.h | 5 --- arch/arm/mach-tegra/board-seaboard-pinmux.c | 32 ---------------------- arch/arm/mach-tegra/board-seaboard.c | 1 - arch/arm/mach-tegra/board-trimslice-pinmux.c | 12 -------- arch/arm/mach-tegra/include/mach/gpio-tegra.h | 9 ------ arch/arm/mach-tegra/usb_phy.c | 1 - drivers/gpio/gpio-tegra.c | 36 ++++++++++++------------ drivers/mmc/host/sdhci-tegra.c | 24 +++------------- 12 files changed, 27 insertions(+), 158 deletions(-)
arch/arm/mach-tegra/board-dt-tegra20.c +0 -1
@@ -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 ),
arch/arm/mach-tegra/board-harmony-pinmux.c +0 -17
@@ -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 )
arch/arm/mach-tegra/board-paz00-pinmux.c +0 -14
@@ -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 )
arch/arm/mach-tegra/board-pinmux.c +4 -29
@@ -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; - } +tegra_board_pinmux_setup_pinmux (); -if (had_gpio && had_pinmux) -return NOTIFY_STOP_MASK ; -else -return NOTIFY_DONE ; +return NOTIFY_STOP_MASK ; }static struct notifier_block nb = {
arch/arm/mach-tegra/board-pinmux.h +0 -5
@@ -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,
arch/arm/mach-tegra/board-seaboard-pinmux.c +0 -32
@@ -15,13 +15,11 @@#include <linux/kernel.h> #include <linux/init.h> -#include <linux/gpio.h> #include <linux/of.h> #include <mach/pinmux.h> #include <mach/pinmux-tegra20.h> -#include "gpio-names.h" #include "board-pinmux.h" #include "board-seaboard.h"
@@ -179,35 +177,9 @@ static struct tegra_pingroup_config ventana_pinmux[] = { {TEGRA_PINGROUP_SPIG, TEGRA_MUX_SPI2_ALT, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, }; -static struct tegra_gpio_table common_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_CDC_IRQ , .enable = true }, -}; - -static struct tegra_gpio_table seaboard_gpio_table[] = { - { .gpio =TEGRA_GPIO_LIDSWITCH , .enable = true }, - { .gpio =TEGRA_GPIO_POWERKEY , .enable = true }, - { .gpio =TEGRA_GPIO_HP_DET , .enable = true }, - { .gpio =TEGRA_GPIO_ISL29018_IRQ , .enable = true }, - { .gpio =TEGRA_GPIO_USB1 , .enable = true }, -}; - -static struct tegra_gpio_table ventana_gpio_table[] = { -/* hp_det */ - { .gpio =TEGRA_GPIO_PW2 , .enable = true }, -/* int_mic_en */ - { .gpio =TEGRA_GPIO_PX0 , .enable = true }, -/* ext_mic_en */ - { .gpio =TEGRA_GPIO_PX1 , .enable = true }, -}; -static struct tegra_board_pinmux_conf common_conf = { .pgs = common_pinmux, .pg_count =ARRAY_SIZE (common_pinmux), - .gpios = common_gpio_table, - .gpio_count =ARRAY_SIZE (common_gpio_table), }; static struct tegra_board_pinmux_conf seaboard_conf = {
@@ -215,15 +187,11 @@ static struct tegra_board_pinmux_conf seaboard_conf = { .pg_count = ARRAY_SIZE(seaboard_pinmux), .drives = seaboard_drive_pinmux, .drive_count = ARRAY_SIZE(seaboard_drive_pinmux), - .gpios = seaboard_gpio_table, - .gpio_count = ARRAY_SIZE(seaboard_gpio_table), };static struct tegra_board_pinmux_conf ventana_conf = { .pgs = ventana_pinmux, .pg_count =ARRAY_SIZE (ventana_pinmux), - .gpios = ventana_gpio_table, - .gpio_count =ARRAY_SIZE (ventana_gpio_table), };void seaboard_pinmux_init (void )
arch/arm/mach-tegra/board-seaboard.c +0 -1
@@ -261,7 +261,6 @@ static void __init tegra_kaen_init(void) debug_uart_platform_data[0 ].irq =INT_UARTB ; seaboard_audio_pdata.gpio_hp_mute =TEGRA_GPIO_KAEN_HP_MUTE ; -tegra_gpio_enable (TEGRA_GPIO_KAEN_HP_MUTE );seaboard_common_init ();
arch/arm/mach-tegra/board-trimslice-pinmux.c +0 -12
@@ -13,7 +13,6 @@* GNU General Public License for more details. * */ -#include <linux/gpio.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/of.h>
@@ -21,7 +20,6 @@#include <mach/pinmux.h> #include <mach/pinmux-tegra20.h> -#include "gpio-names.h" #include "board-pinmux.h" #include "board-trimslice.h"
@@ -144,19 +142,9 @@ static struct tegra_pingroup_config trimslice_pinmux[] = { {TEGRA_PINGROUP_XM2D, TEGRA_MUX_NONE, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, }; -static struct tegra_gpio_table gpio_table[] = { - { .gpio =TRIMSLICE_GPIO_SD4_CD , .enable = true },/* mmc4 cd */ - { .gpio =TRIMSLICE_GPIO_SD4_WP , .enable = true },/* mmc4 wp */ - - { .gpio =TRIMSLICE_GPIO_USB1_MODE , .enable = true },/* USB1 mode */ - { .gpio =TRIMSLICE_GPIO_USB2_RST , .enable = true },/* USB2 PHY rst */ -}; -static struct tegra_board_pinmux_conf conf = { .pgs = trimslice_pinmux, .pg_count =ARRAY_SIZE (trimslice_pinmux), - .gpios = gpio_table, - .gpio_count =ARRAY_SIZE (gpio_table), };void trimslice_pinmux_init (void )
arch/arm/mach-tegra/include/mach/gpio-tegra.h +0 -9
@@ -25,13 +25,4 @@#define TEGRA_NR_GPIOS INT_GPIO_NR -struct tegra_gpio_table { -int gpio;/* GPIO number */ -bool enable;/* Enable for GPIO at init? */ -}; - -void tegra_gpio_config (struct tegra_gpio_table *table,int num); -void tegra_gpio_enable (int gpio); -void tegra_gpio_disable (int gpio); -#endif
arch/arm/mach-tegra/usb_phy.c +0 -1
@@ -711,7 +711,6 @@ struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs, err = -ENXIO ; goto err1; } -tegra_gpio_enable (ulpi_config->reset_gpio);gpio_request (ulpi_config->reset_gpio,"ulpi_phy_reset_b" );gpio_direction_output (ulpi_config->reset_gpio,0 ); phy->ulpi =otg_ulpi_create (&ulpi_viewport_access_ops,0 );
drivers/gpio/gpio-tegra.c +18 -18
@@ -26,10 +26,10 @@#include <linux/platform_device.h> #include <linux/module.h> #include <linux/irqdomain.h> +#include <linux/pinctrl/consumer.h> #include <asm/mach/irq.h> -#include <mach/gpio-tegra.h> #include <mach/iomap.h> #include <mach/suspend.h>
@@ -105,16 +105,27 @@ static void tegra_gpio_mask_write(u32 reg, int gpio, int value)tegra_gpio_writel (val, reg); } -void tegra_gpio_enable (int gpio) +static void tegra_gpio_enable (int gpio) {tegra_gpio_mask_write (GPIO_MSK_CNF (gpio), gpio,1 ); } -void tegra_gpio_disable (int gpio) +static void tegra_gpio_disable (int gpio) {tegra_gpio_mask_write (GPIO_MSK_CNF (gpio), gpio,0 ); } +int tegra_gpio_request (struct gpio_chip *chip,unsigned offset) +{ +return pinctrl_request_gpio (offset); +} + +void tegra_gpio_free (struct gpio_chip *chip,unsigned offset) +{ +pinctrl_free_gpio (offset); +tegra_gpio_disable (offset); +} +static void tegra_gpio_set (struct gpio_chip *chip,unsigned offset,int value) {tegra_gpio_mask_write (GPIO_MSK_OUT (offset), offset, value);
@@ -128,6 +139,7 @@ static int tegra_gpio_get(struct gpio_chip *chip, unsigned offset)static int tegra_gpio_direction_input (struct gpio_chip *chip,unsigned offset) {tegra_gpio_mask_write (GPIO_MSK_OE (offset), offset,0 ); +tegra_gpio_enable (offset);return 0 ; }
@@ -136,6 +148,7 @@ static int tegra_gpio_direction_output(struct gpio_chip *chip, unsigned offset, {tegra_gpio_set (chip, offset, value);tegra_gpio_mask_write (GPIO_MSK_OE (offset), offset,1 ); +tegra_gpio_enable (offset);return 0 ; }
@@ -146,13 +159,14 @@ static int tegra_gpio_to_irq(struct gpio_chip *chip, unsigned offset)static struct gpio_chip tegra_gpio_chip = { .label ="tegra-gpio" , + .request = tegra_gpio_request, + .free = tegra_gpio_free, .direction_input = tegra_gpio_direction_input, .get = tegra_gpio_get, .direction_output = tegra_gpio_direction_output, .set = tegra_gpio_set, .to_irq = tegra_gpio_to_irq, .base =0 , - .ngpio =TEGRA_NR_GPIOS , };static void tegra_gpio_irq_ack (struct irq_data *d)
@@ -459,20 +473,6 @@ static int __init tegra_gpio_init(void) }postcore_initcall (tegra_gpio_init); -void __init tegra_gpio_config (struct tegra_gpio_table *table,int num) -{ -int i; - -for (i =0 ; i < num; i++) { -int gpio = table[i].gpio; - -if (table[i].enable) -tegra_gpio_enable (gpio); -else -tegra_gpio_disable (gpio); - } -} -#ifdef CONFIG_DEBUG_FS #include <linux/debugfs.h>
drivers/mmc/host/sdhci-tegra.c +5 -19
@@ -270,7 +270,6 @@ static int __devinit sdhci_tegra_probe(struct platform_device *pdev) "failed to allocate power gpio\n"); goto err_power_req; } -tegra_gpio_enable (plat->power_gpio);gpio_direction_output (plat->power_gpio,1 ); }
@@ -281,7 +280,6 @@ static int __devinit sdhci_tegra_probe(struct platform_device *pdev) "failed to allocate cd gpio\n"); goto err_cd_req; } -tegra_gpio_enable (plat->cd_gpio);gpio_direction_input (plat->cd_gpio); rc = request_irq(gpio_to_irq(plat->cd_gpio), carddetect_irq,
@@ -302,7 +300,6 @@ static int __devinit sdhci_tegra_probe(struct platform_device *pdev) "failed to allocate wp gpio\n"); goto err_wp_req; } -tegra_gpio_enable (plat->wp_gpio);gpio_direction_input (plat->wp_gpio); }
@@ -330,23 +327,17 @@ err_add_host:clk_disable (pltfm_host->clk);clk_put (pltfm_host->clk); err_clk_get: -if (gpio_is_valid (plat->wp_gpio)) { -tegra_gpio_disable (plat->wp_gpio); +if (gpio_is_valid (plat->wp_gpio))gpio_free (plat->wp_gpio); - } err_wp_req:if (gpio_is_valid (plat->cd_gpio))free_irq (gpio_to_irq (plat->cd_gpio), host); err_cd_irq_req: -if (gpio_is_valid (plat->cd_gpio)) { -tegra_gpio_disable (plat->cd_gpio); +if (gpio_is_valid (plat->cd_gpio))gpio_free (plat->cd_gpio); - } err_cd_req: -if (gpio_is_valid (plat->power_gpio)) { -tegra_gpio_disable (plat->power_gpio); +if (gpio_is_valid (plat->power_gpio))gpio_free (plat->power_gpio); - } err_power_req: err_no_plat:sdhci_pltfm_free (pdev);
@@ -363,21 +354,16 @@ static int __devexit sdhci_tegra_remove(struct platform_device *pdev)sdhci_remove_host (host, dead); -if (gpio_is_valid (plat->wp_gpio)) { -tegra_gpio_disable (plat->wp_gpio); +if (gpio_is_valid (plat->wp_gpio))gpio_free (plat->wp_gpio); - }if (gpio_is_valid (plat->cd_gpio)) {free_irq (gpio_to_irq (plat->cd_gpio), host); -tegra_gpio_disable (plat->cd_gpio);gpio_free (plat->cd_gpio); } -if (gpio_is_valid (plat->power_gpio)) { -tegra_gpio_disable (plat->power_gpio); +if (gpio_is_valid (plat->power_gpio))gpio_free (plat->power_gpio); - }clk_disable (pltfm_host->clk);clk_put (pltfm_host->clk);
Signature · 1 line
1.7.0.4
Quoted 2 lines · Stephen Warren
Update gpio.txt based on recent discussions regarding interaction with the pinctrl subsystem.
Looks good to me:
Yours,
Linus Walleij
Re: [PATCH V2 2/3] pinctrl: allow concurrent gpio and mux function ownership of pins
In reply to Stephen WarrenQuoted 13 lines · Stephen Warren
Per recent updates to
Documentation/gpio.txt, gpiolib drivers should inform pinctrl when a GPIO is requested. pinctrl then marks that pin as in-use for that GPIO function.When an SoC muxes pins in a group, it's quite possible for the group to contain e.g. 6 pins, but only 4 of them actually be needed by the HW module that's mux'd to them. In this case, the other 2 pins could be used as GPIOs. However, pinctrl marks all the pins within the group as in-use by the selected mux function. To allow the expected gpiolib interaction, separate the concepts of pin ownership into two parts: One for the mux function and one for GPIO usage. Finally, allow those two ownerships to exist in parallel.
Quoted 1 line
Signed-off-by Stephen Warren <[email protected]>
Good, and 100% in accordance with earlier discussions.
Thanks,
Linus Walleij
Re: [PATCH V2 3/3] gpio: tegra: Hide tegra_gpio_enable/disable()
In reply to Stephen WarrenQuoted 8 lines · Stephen Warren
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 <[email protected]>Cc linux-mmc at vger.kernel.orgSigned-off-by Stephen Warren <[email protected]>
Quoted 2 lines
Merging note: The first two (or at least the 2nd) patches can go through the pinctrl susbsystem without issue.
I will give Grant a chance to comment on the GPIO interaction doc atleast, then I'll apply them.
Quoted 5 lines
This patch should probably be taken
through the Tegra tree. Once patch 2 is in pinctrl, and considered stable, I can just use that as a dependency for the branch containing this Tegra patch. I assume that this series will go into 3.5 not 3.4, but I'm willing to be surprised:-)
Should be possible if my pinctrl-tegra-for-next-diet branch is considered stable and could be pulled into the Tegra tree for further augmenting by this and other patches!
But I guess you'd need to merge some stable development base for the rest of the pinctrl stuff as well, shall I freeze the for-next branch with tegra diet stuff merged on top now? I can promise to just add new patches on top of that if it helps you.
Is Olof the one to ask?
Yours,
Linus Walleij
Re: [PATCH V2 3/3] gpio: tegra: Hide tegra_gpio_enable/disable()
Quoted 6 lines · Linus Walleij
Quoted 4 lines · Stephen Warren
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.
...
Quoted 10 lines
Quoted 5 lines
This patch should probably be taken
through the Tegra tree. Once patch 2 is in pinctrl, and considered stable, I can just use that as a dependency for the branch containing this Tegra patch. I assume that this series will go into 3.5 not 3.4, but I'm willing to be surprised:-)Should be possible if my pinctrl-tegra-for-next-diet branch is considered stable and could be pulled into the Tegra tree for further augmenting by this and other patches!
Quoted 6 lines
But I guess you'd need to merge some stable development base for the rest of the pinctrl stuff as well, shall I freeze the for-next branch with tegra diet stuff merged on top now? I can promise to just add new patches on top of that if it helps you.
Is Olof the one to ask?
For 3.4 yes Olof, but since this is probably going into 3.5, it's me!
At this point, I expect picking up a stable commit from pinctrl's for-next branch would be the easiest for 3.5. Probably the same is true for 3.4 too, since "everything" is in pinctrl's for-next now.
Quoted 7 lines · Linus Walleij
Quoted 2 lines · Stephen Warren
Update gpio.txt based on recent discussions regarding interaction with the pinctrl subsystem.
Looks good to me:
Reviewed-by Linus Walleij <[email protected]>
Oops, missed this updated version. I've dropped the v1 and picked up this one.
g.
Re: [PATCH V2 2/3] pinctrl: allow concurrent gpio and mux function ownership of pins
In reply to Linus WalleijQuoted 15 lines · Linus Walleij
Quoted 13 lines · Stephen Warren
Per recent updates to
Documentation/gpio.txt, gpiolib drivers should inform pinctrl when a GPIO is requested. pinctrl then marks that pin as in-use for that GPIO function.When an SoC muxes pins in a group, it's quite possible for the group to contain e.g. 6 pins, but only 4 of them actually be needed by the HW module that's mux'd to them. In this case, the other 2 pins could be used as GPIOs. However, pinctrl marks all the pins within the group as in-use by the selected mux function. To allow the expected gpiolib interaction, separate the concepts of pin ownership into two parts: One for the mux function and one for GPIO usage. Finally, allow those two ownerships to exist in parallel.
Quoted 4 lines
Quoted 1 line
Signed-off-by Stephen Warren <[email protected]>Good, and 100% in accordance with earlier discussions.
Acked-by Linus Walleij <[email protected]>
Linus, now that Grant has ack'd and applied the documentation change behind this, could you take this one patch into the pinctrl tree. I assume it's 3.5 material. After the 3.4 merge window closes, I'll probably come back and ask for a stable pinctrl branch that I can use as the basis for a Tegra branch that'll contain patch 3 in this series.
(Olof, I assume that's the right way to approach this; having Linus apply both patches 2/3 in this series to pinctrl is going to make life difficult in the Tegra tree, since my outstanding patches to convert Tegra to use pinctrl will touch many of the same files as patch 3 in this series, in conflicting or dependent ways.)
Thanks.
Re: [PATCH V2 2/3] pinctrl: allow concurrent gpio and mux function ownership of pins
Quoted 2 lines · Stephen Warren
Linus, now that Grant has ack'd and applied the documentation change behind this, could you take this one patch into the pinctrl tree.
Of course, applied.
Quoted 1 line
I assume it's 3.5 material.
No it goes in now, we can't have documentation that is misleading... Besides, I like it.
Yours,
Linus Walleij
Re: [PATCH V2 2/3] pinctrl: allow concurrent gpio and mux function ownership of pins
In reply to Stephen WarrenQuoted 27 lines · Stephen Warren
Quoted 15 lines · Linus Walleij
Quoted 13 lines · Stephen Warren
Per recent updates to
Documentation/gpio.txt, gpiolib drivers should inform pinctrl when a GPIO is requested. pinctrl then marks that pin as in-use for that GPIO function.When an SoC muxes pins in a group, it's quite possible for the group to contain e.g. 6 pins, but only 4 of them actually be needed by the HW module that's mux'd to them. In this case, the other 2 pins could be used as GPIOs. However, pinctrl marks all the pins within the group as in-use by the selected mux function. To allow the expected gpiolib interaction, separate the concepts of pin ownership into two parts: One for the mux function and one for GPIO usage. Finally, allow those two ownerships to exist in parallel.
Quoted 4 lines
Quoted 1 line
Signed-off-by Stephen Warren <[email protected]>Good, and 100% in accordance with earlier discussions.
Acked-by Linus Walleij <[email protected]>Linus, now that Grant has ack'd and applied the documentation change behind this, could you take this one patch into the pinctrl tree. I assume it's 3.5 material. After the 3.4 merge window closes, I'll probably come back and ask for a stable pinctrl branch that I can use as the basis for a Tegra branch that'll contain patch 3 in this series.
Quoted 5 lines
(Olof, I assume that's the right way to approach this; having Linus apply both patches 2/3 in this series to pinctrl is going to make life difficult in the Tegra tree, since my outstanding patches to convert Tegra to use pinctrl will touch many of the same files as patch 3 in this series, in conflicting or dependent ways.)
Yes, that seems like a good way to handle it.
-Olof
Re: [PATCH V2 2/3] pinctrl: allow concurrent gpio and mux function ownership of pins
In reply to Linus WalleijQuoted 11 lines · Linus Walleij
Quoted 2 lines · Stephen Warren
Linus, now that Grant has ack'd and applied the documentation change behind this, could you take this one patch into the pinctrl tree.
Of course, applied.
Quoted 1 line
I assume it's 3.5 material.
No it goes in now, we can't have documentation that is misleading... Besides, I like it.
Oops, this reply didn't show before I hit reply on the other one.
Stephen, that makes things easy for you if you still need time to sort things out on the tegra side, since 3.4-rc1 can be the base for that work.
-Olof