pinctrl: sh-pfc: Introduce PINCTRL_SH_FUNC_GPIO helper symbol

Pinctrl drivers for SuperH platforms use legacy function GPIOs.
Currently this support is compiled in based on the SUPERH platform
dependency, which hinders the introduction of compile-testing support
for the affected pinctrl drivers.

Introduce a new Kconfig symbol PINCTRL_SH_FUNC_GPIO, which is
auto-selected when needed.  This symbol in turn selects
PINCTRL_SH_PFC_GPIO, to reduce the number of per-driver selects.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
This commit is contained in:
Geert Uytterhoeven 2019-01-21 17:05:45 +01:00
parent 6161b39a14
commit 0ace959614
3 changed files with 23 additions and 17 deletions

View File

@ -20,6 +20,12 @@ config PINCTRL_SH_PFC_GPIO
help
This enables pin control and GPIO drivers for SH/SH Mobile platforms
config PINCTRL_SH_FUNC_GPIO
select PINCTRL_SH_PFC_GPIO
bool
help
This enables legacy function GPIOs for SH platforms
config PINCTRL_PFC_EMEV2
def_bool y
depends on ARCH_EMEV2
@ -138,17 +144,17 @@ config PINCTRL_PFC_R8A77995
config PINCTRL_PFC_SH7203
def_bool y
depends on CPU_SUBTYPE_SH7203
select PINCTRL_SH_PFC_GPIO
select PINCTRL_SH_FUNC_GPIO
config PINCTRL_PFC_SH7264
def_bool y
depends on CPU_SUBTYPE_SH7264
select PINCTRL_SH_PFC_GPIO
select PINCTRL_SH_FUNC_GPIO
config PINCTRL_PFC_SH7269
def_bool y
depends on CPU_SUBTYPE_SH7269
select PINCTRL_SH_PFC_GPIO
select PINCTRL_SH_FUNC_GPIO
config PINCTRL_PFC_SH73A0
def_bool y
@ -159,45 +165,45 @@ config PINCTRL_PFC_SH73A0
config PINCTRL_PFC_SH7720
def_bool y
depends on CPU_SUBTYPE_SH7720
select PINCTRL_SH_PFC_GPIO
select PINCTRL_SH_FUNC_GPIO
config PINCTRL_PFC_SH7722
def_bool y
depends on CPU_SUBTYPE_SH7722
select PINCTRL_SH_PFC_GPIO
select PINCTRL_SH_FUNC_GPIO
config PINCTRL_PFC_SH7723
def_bool y
depends on CPU_SUBTYPE_SH7723
select PINCTRL_SH_PFC_GPIO
select PINCTRL_SH_FUNC_GPIO
config PINCTRL_PFC_SH7724
def_bool y
depends on CPU_SUBTYPE_SH7724
select PINCTRL_SH_PFC_GPIO
select PINCTRL_SH_FUNC_GPIO
config PINCTRL_PFC_SH7734
def_bool y
depends on CPU_SUBTYPE_SH7734
select PINCTRL_SH_PFC_GPIO
select PINCTRL_SH_FUNC_GPIO
config PINCTRL_PFC_SH7757
def_bool y
depends on CPU_SUBTYPE_SH7757
select PINCTRL_SH_PFC_GPIO
select PINCTRL_SH_FUNC_GPIO
config PINCTRL_PFC_SH7785
def_bool y
depends on CPU_SUBTYPE_SH7785
select PINCTRL_SH_PFC_GPIO
select PINCTRL_SH_FUNC_GPIO
config PINCTRL_PFC_SH7786
def_bool y
depends on CPU_SUBTYPE_SH7786
select PINCTRL_SH_PFC_GPIO
select PINCTRL_SH_FUNC_GPIO
config PINCTRL_PFC_SHX3
def_bool y
depends on CPU_SUBTYPE_SHX3
select PINCTRL_SH_PFC_GPIO
select PINCTRL_SH_FUNC_GPIO
endif

View File

@ -252,7 +252,7 @@ static int gpio_pin_setup(struct sh_pfc_chip *chip)
* Function GPIOs
*/
#ifdef CONFIG_SUPERH
#ifdef CONFIG_PINCTRL_SH_FUNC_GPIO
static int gpio_function_request(struct gpio_chip *gc, unsigned offset)
{
static bool __print_once;
@ -292,7 +292,7 @@ static int gpio_function_setup(struct sh_pfc_chip *chip)
return 0;
}
#endif
#endif /* CONFIG_PINCTRL_SH_FUNC_GPIO */
/* -----------------------------------------------------------------------------
* Register/unregister
@ -369,7 +369,7 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc)
if (IS_ENABLED(CONFIG_OF) && pfc->dev->of_node)
return 0;
#ifdef CONFIG_SUPERH
#ifdef CONFIG_PINCTRL_SH_FUNC_GPIO
/*
* Register the GPIO to pin mappings. As pins with GPIO ports
* must come first in the ranges, skip the pins without GPIO
@ -397,7 +397,7 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc)
chip = sh_pfc_add_gpiochip(pfc, gpio_function_setup, NULL);
if (IS_ERR(chip))
return PTR_ERR(chip);
#endif /* CONFIG_SUPERH */
#endif /* CONFIG_PINCTRL_SH_FUNC_GPIO */
return 0;
}

View File

@ -261,7 +261,7 @@ struct sh_pfc_soc_info {
const struct sh_pfc_function *functions;
unsigned int nr_functions;
#ifdef CONFIG_SUPERH
#ifdef CONFIG_PINCTRL_SH_FUNC_GPIO
const struct pinmux_func *func_gpios;
unsigned int nr_func_gpios;
#endif