Commit 636f8ba6 authored by Paul Cercueil's avatar Paul Cercueil Committed by Linus Walleij

MIPS: JZ4740: Qi LB60: Add pinctrl configuration for several drivers

We set the pin configuration for the jz4740-nand, jz4740-mmc,
jz4740-fb, jz4740-pwm and jz4740-uart drivers.

This will permit those drivers to be cleaned out of the custom GPIO code
that they currently use.
Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent d32613c3
...@@ -17,3 +17,16 @@ &ext { ...@@ -17,3 +17,16 @@ &ext {
&rtc_dev { &rtc_dev {
system-power-controller; system-power-controller;
}; };
&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&pins_uart0>;
};
&pinctrl {
pins_uart0: uart0 {
function = "uart0";
groups = "uart0-data";
bias-disable;
};
};
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#include <linux/input/matrix_keypad.h> #include <linux/input/matrix_keypad.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/spi/spi_gpio.h> #include <linux/spi/spi_gpio.h>
#include <linux/pinctrl/machine.h>
#include <linux/pinctrl/pinconf-generic.h>
#include <linux/power_supply.h> #include <linux/power_supply.h>
#include <linux/power/jz4740-battery.h> #include <linux/power/jz4740-battery.h>
#include <linux/power/gpio-charger.h> #include <linux/power/gpio-charger.h>
...@@ -159,7 +161,7 @@ static struct jz_nand_platform_data qi_lb60_nand_pdata = { ...@@ -159,7 +161,7 @@ static struct jz_nand_platform_data qi_lb60_nand_pdata = {
static struct gpiod_lookup_table qi_lb60_nand_gpio_table = { static struct gpiod_lookup_table qi_lb60_nand_gpio_table = {
.dev_id = "jz4740-nand.0", .dev_id = "jz4740-nand.0",
.table = { .table = {
GPIO_LOOKUP("Bank C", 30, "busy", 0), GPIO_LOOKUP("GPIOC", 30, "busy", 0),
{ }, { },
}, },
}; };
...@@ -421,8 +423,8 @@ static struct platform_device qi_lb60_audio_device = { ...@@ -421,8 +423,8 @@ static struct platform_device qi_lb60_audio_device = {
static struct gpiod_lookup_table qi_lb60_audio_gpio_table = { static struct gpiod_lookup_table qi_lb60_audio_gpio_table = {
.dev_id = "qi-lb60-audio", .dev_id = "qi-lb60-audio",
.table = { .table = {
GPIO_LOOKUP("Bank B", 29, "snd", 0), GPIO_LOOKUP("GPIOB", 29, "snd", 0),
GPIO_LOOKUP("Bank D", 4, "amp", 0), GPIO_LOOKUP("GPIOD", 4, "amp", 0),
{ }, { },
}, },
}; };
...@@ -447,13 +449,36 @@ static struct platform_device *jz_platform_devices[] __initdata = { ...@@ -447,13 +449,36 @@ static struct platform_device *jz_platform_devices[] __initdata = {
&qi_lb60_audio_device, &qi_lb60_audio_device,
}; };
static void __init board_gpio_setup(void) static unsigned long pin_cfg_bias_disable[] = {
{ PIN_CONFIG_BIAS_DISABLE,
/* We only need to enable/disable pullup here for pins used in generic };
* drivers. Everything else is done by the drivers themselves. */
jz_gpio_disable_pullup(QI_LB60_GPIO_SD_VCC_EN_N); static struct pinctrl_map pin_map[] __initdata = {
jz_gpio_disable_pullup(QI_LB60_GPIO_SD_CD); /* NAND pin configuration */
} PIN_MAP_MUX_GROUP_DEFAULT("jz4740-nand",
"10010000.jz4740-pinctrl", "nand", "nand-cs1"),
/* fbdev pin configuration */
PIN_MAP_MUX_GROUP("jz4740-fb", PINCTRL_STATE_DEFAULT,
"10010000.jz4740-pinctrl", "lcd", "lcd-8bit"),
PIN_MAP_MUX_GROUP("jz4740-fb", PINCTRL_STATE_SLEEP,
"10010000.jz4740-pinctrl", "lcd", "lcd-no-pins"),
/* MMC pin configuration */
PIN_MAP_MUX_GROUP_DEFAULT("jz4740-mmc.0",
"10010000.jz4740-pinctrl", "mmc", "mmc-1bit"),
PIN_MAP_MUX_GROUP_DEFAULT("jz4740-mmc.0",
"10010000.jz4740-pinctrl", "mmc", "mmc-4bit"),
PIN_MAP_CONFIGS_PIN_DEFAULT("jz4740-mmc.0",
"10010000.jz4740-pinctrl", "PD0", pin_cfg_bias_disable),
PIN_MAP_CONFIGS_PIN_DEFAULT("jz4740-mmc.0",
"10010000.jz4740-pinctrl", "PD2", pin_cfg_bias_disable),
/* PWM pin configuration */
PIN_MAP_MUX_GROUP_DEFAULT("jz4740-pwm",
"10010000.jz4740-pinctrl", "pwm4", "pwm4"),
};
static int __init qi_lb60_init_platform_devices(void) static int __init qi_lb60_init_platform_devices(void)
{ {
...@@ -469,6 +494,7 @@ static int __init qi_lb60_init_platform_devices(void) ...@@ -469,6 +494,7 @@ static int __init qi_lb60_init_platform_devices(void)
ARRAY_SIZE(qi_lb60_spi_board_info)); ARRAY_SIZE(qi_lb60_spi_board_info));
pwm_add_table(qi_lb60_pwm_lookup, ARRAY_SIZE(qi_lb60_pwm_lookup)); pwm_add_table(qi_lb60_pwm_lookup, ARRAY_SIZE(qi_lb60_pwm_lookup));
pinctrl_register_mappings(pin_map, ARRAY_SIZE(pin_map));
return platform_add_devices(jz_platform_devices, return platform_add_devices(jz_platform_devices,
ARRAY_SIZE(jz_platform_devices)); ARRAY_SIZE(jz_platform_devices));
...@@ -479,8 +505,6 @@ static int __init qi_lb60_board_setup(void) ...@@ -479,8 +505,6 @@ static int __init qi_lb60_board_setup(void)
{ {
printk(KERN_INFO "Qi Hardware JZ4740 QI LB60 setup\n"); printk(KERN_INFO "Qi Hardware JZ4740 QI LB60 setup\n");
board_gpio_setup();
if (qi_lb60_init_platform_devices()) if (qi_lb60_init_platform_devices())
panic("Failed to initialize platform devices"); panic("Failed to initialize platform devices");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment