]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
dm: exynos: Make sure that GPIOs are requested
authorSimon Glass <sjg@chromium.org>
Tue, 21 Oct 2014 01:48:39 +0000 (19:48 -0600)
committerSimon Glass <sjg@chromium.org>
Wed, 22 Oct 2014 16:36:33 +0000 (10:36 -0600)
With driver model GPIOs must be requested before use. Make sure this is
done correctly.

(Note that the soft SPI part of universal is omitted, since this driver
is about to be replaced with a driver-model-aware version)

Signed-off-by: Simon Glass <sjg@chromium.org>
arch/arm/cpu/armv7/exynos/pinmux.c
board/samsung/arndale/arndale.c
board/samsung/common/misc.c
board/samsung/goni/goni.c
board/samsung/smdk5250/exynos5-dt.c
board/samsung/smdk5420/smdk5420.c
board/samsung/trats/trats.c
board/samsung/trats2/trats2.c
board/samsung/universal_c210/universal.c
drivers/mmc/s5p_sdhci.c

index 2caeb3e2b4178f91052f89084b2b88b1c407cda4..3d95dc3339e6ee87859748d529510a7036b6cece 100644 (file)
@@ -172,6 +172,9 @@ static int exynos5420_mmc_config(int peripheral, int flags)
                 * this same assumption.
                 */
                if ((peripheral == PERIPH_ID_SDMMC0) && (i == (start + 2))) {
+#ifndef CONFIG_SPL_BUILD
+                       gpio_request(i, "sdmmc0_vdden");
+#endif
                        gpio_set_value(i, 1);
                        gpio_cfg_pin(i, S5P_GPIO_OUTPUT);
                } else {
index e39795dfdfc85f7b3de4daab48e9cc20d0a21394..881d080522563912da43a96e90a7a66a6fa4866a 100644 (file)
@@ -19,6 +19,8 @@ int board_usb_init(int index, enum usb_init_type init)
        /* Configure gpios for usb 3503 hub:
         * disconnect, toggle reset and connect
         */
+       gpio_request(EXYNOS5_GPIO_D17, "usb_connect");
+       gpio_request(EXYNOS5_GPIO_X35, "usb_reset");
        gpio_direction_output(EXYNOS5_GPIO_D17, 0);
        gpio_direction_output(EXYNOS5_GPIO_X35, 0);
 
index b935922eabf8a992dfe9dd362f568c0a733ee6c3..4538ac7f2a2fc2d2a91f840944d13ec542e35e11 100644 (file)
@@ -411,6 +411,8 @@ void check_boot_mode(void)
 void keys_init(void)
 {
        /* Set direction to input */
+       gpio_request(KEY_VOL_UP_GPIO, "volume-up");
+       gpio_request(KEY_VOL_DOWN_GPIO, "volume-down");
        gpio_direction_input(KEY_VOL_UP_GPIO);
        gpio_direction_input(KEY_VOL_DOWN_GPIO);
 }
index 4cee78bab2b4c4907c0f54a2bfa5a306f01975e1..58cf96eaa84f49bcd9ce47a3f2476504deb783be 100644 (file)
@@ -90,6 +90,7 @@ int board_mmc_init(bd_t *bis)
        int i, ret, ret_sd = 0;
 
        /* MASSMEMORY_EN: XMSMDATA7: GPJ2[7] output high */
+       gpio_request(S5PC110_GPIO_J27, "massmemory_en");
        gpio_direction_output(S5PC110_GPIO_J27, 1);
 
        /*
@@ -118,6 +119,7 @@ int board_mmc_init(bd_t *bis)
         * SD card (T_FLASH) detect and init
         * T_FLASH_DETECT: EINT28: GPH3[4] input mode
         */
+       gpio_request(S5PC110_GPIO_H34, "t_flash_detect");
        gpio_cfg_pin(S5PC110_GPIO_H34, S5P_GPIO_INPUT);
        gpio_set_pull(S5PC110_GPIO_H34, S5P_GPIO_PULL_UP);
 
index d6ce1337b94ba6f06172ea6459c7162396dbc5ea..53ff7061d730c293260acd1f77367ec1d5bb4f16 100644 (file)
@@ -29,6 +29,7 @@ DECLARE_GLOBAL_DATA_PTR;
 static void board_enable_audio_codec(void)
 {
        /* Enable MAX98095 Codec */
+       gpio_request(EXYNOS5_GPIO_X17, "max98095_enable");
        gpio_direction_output(EXYNOS5_GPIO_X17, 1);
        gpio_set_pull(EXYNOS5_GPIO_X17, S5P_GPIO_PULL_NONE);
 }
@@ -199,16 +200,19 @@ static int board_dp_bridge_setup(void)
        /* Setup the GPIOs */
 
        /* PD is ACTIVE_LOW, and initially de-asserted */
+       gpio_request(EXYNOS5_GPIO_Y25, "dp_bridge_pd");
        gpio_set_pull(EXYNOS5_GPIO_Y25, S5P_GPIO_PULL_NONE);
        gpio_direction_output(EXYNOS5_GPIO_Y25, 1);
 
        /* Reset is ACTIVE_LOW */
+       gpio_request(EXYNOS5_GPIO_X15, "dp_bridge_reset");
        gpio_set_pull(EXYNOS5_GPIO_X15, S5P_GPIO_PULL_NONE);
        gpio_direction_output(EXYNOS5_GPIO_X15, 0);
 
        udelay(10);
        gpio_set_value(EXYNOS5_GPIO_X15, 1);
 
+       gpio_request(EXYNOS5_GPIO_X07, "dp_bridge_hpd");
        gpio_direction_input(EXYNOS5_GPIO_X07);
 
        /*
@@ -236,10 +240,12 @@ static int board_dp_bridge_setup(void)
 void exynos_cfg_lcd_gpio(void)
 {
        /* For Backlight */
+       gpio_request(EXYNOS5_GPIO_B20, "lcd_backlight");
        gpio_cfg_pin(EXYNOS5_GPIO_B20, S5P_GPIO_OUTPUT);
        gpio_set_value(EXYNOS5_GPIO_B20, 1);
 
        /* LCD power on */
+       gpio_request(EXYNOS5_GPIO_X15, "lcd_power");
        gpio_cfg_pin(EXYNOS5_GPIO_X15, S5P_GPIO_OUTPUT);
        gpio_set_value(EXYNOS5_GPIO_X15, 1);
 
@@ -276,6 +282,7 @@ void exynos_backlight_on(unsigned int on)
        mdelay(10);
 
        /* board_dp_backlight_en */
+       gpio_request(EXYNOS5_GPIO_X30, "board_dp_backlight_en");
        gpio_direction_output(EXYNOS5_GPIO_X30, 1);
 #endif
 }
index 47998abeaffd65df8a84a4b74a09506fa41f9043..a691222b8b143dd61e784ae8e3122dc95b8e3953 100644 (file)
@@ -74,9 +74,12 @@ void exynos_lcd_power_on(void)
        mdelay(5);
 
        /* TODO(ajaykumar.rs@samsung.com): Use device tree */
+       gpio_request(EXYNOS5420_GPIO_X35, "edp_slp#");
        gpio_direction_output(EXYNOS5420_GPIO_X35, 1);  /* EDP_SLP# */
        mdelay(10);
+       gpio_request(EXYNOS5420_GPIO_Y77, "edp_rst#");
        gpio_direction_output(EXYNOS5420_GPIO_Y77, 1);  /* EDP_RST# */
+       gpio_request(EXYNOS5420_GPIO_X26, "edp_hpd");
        gpio_direction_input(EXYNOS5420_GPIO_X26);      /* EDP_HPD */
        gpio_set_pull(EXYNOS5420_GPIO_X26, S5P_GPIO_PULL_NONE);
 
@@ -88,6 +91,7 @@ void exynos_lcd_power_on(void)
 void exynos_backlight_on(unsigned int onoff)
 {
        /* For PWM */
+       gpio_request(EXYNOS5420_GPIO_B20, "backlight_on");
        gpio_cfg_pin(EXYNOS5420_GPIO_B20, S5P_GPIO_FUNC(0x1));
        gpio_set_value(EXYNOS5420_GPIO_B20, 1);
 
index 9e76b5d691fc6dd9c52272d946949983cf5d3d9f..e163e45a587df150324e60ee57114a5735269a76 100644 (file)
@@ -63,6 +63,8 @@ void i2c_init_board(void)
        }
 
        /* I2C_8 -> FG */
+       gpio_request(EXYNOS4_GPIO_Y40, "i2c_clk");
+       gpio_request(EXYNOS4_GPIO_Y41, "i2c_data");
        gpio_direction_output(EXYNOS4_GPIO_Y40, 1);
        gpio_direction_output(EXYNOS4_GPIO_Y41, 1);
 }
@@ -346,12 +348,17 @@ int exynos_power_init(void)
 static unsigned int get_hw_revision(void)
 {
        int hwrev = 0;
+       char str[10];
        int i;
 
        /* hw_rev[3:0] == GPE1[3:0] */
-       for (i = EXYNOS4_GPIO_E10; i < EXYNOS4_GPIO_E14; i++) {
-               gpio_cfg_pin(i, S5P_GPIO_INPUT);
-               gpio_set_pull(i, S5P_GPIO_PULL_NONE);
+       for (i = 0; i < 4; i++) {
+               int pin = i + EXYNOS4_GPIO_E10;
+
+               sprintf(str, "hw_rev%d", i);
+               gpio_request(pin, str);
+               gpio_cfg_pin(pin, S5P_GPIO_INPUT);
+               gpio_set_pull(pin, S5P_GPIO_PULL_NONE);
        }
 
        udelay(1);
@@ -517,6 +524,7 @@ static void board_power_init(void)
 static void exynos_uart_init(void)
 {
        /* UART_SEL GPY4[7] (part2) at EXYNOS4 */
+       gpio_request(EXYNOS4_GPIO_Y47, "uart_sel");
        gpio_set_pull(EXYNOS4_GPIO_Y47, S5P_GPIO_PULL_UP);
        gpio_direction_output(EXYNOS4_GPIO_Y47, 1);
 }
@@ -534,6 +542,7 @@ int exynos_early_init_f(void)
 
 void exynos_reset_lcd(void)
 {
+       gpio_request(EXYNOS4_GPIO_Y45, "lcd_reset");
        gpio_direction_output(EXYNOS4_GPIO_Y45, 1);
        udelay(10000);
        gpio_direction_output(EXYNOS4_GPIO_Y45, 0);
index 2924ee68ad617f00c89c3ce1a41f45c8c4ef8353..a7377497e5d2d4002f7b847ae051abfe5e8bb2b9 100644 (file)
@@ -33,6 +33,7 @@ static inline u32 get_model_rev(void);
 static void check_hw_revision(void)
 {
        int modelrev = 0;
+       char str[12];
        int i;
 
        /*
@@ -41,13 +42,22 @@ static void check_hw_revision(void)
         * TRM say that it may cause unexcepted state and leakage current.
         * and pull-none is only for output function.
         */
-       for (i = EXYNOS4X12_GPIO_M10; i < EXYNOS4X12_GPIO_M12; i++)
-               gpio_cfg_pin(i, S5P_GPIO_INPUT);
+       for (i = 0; i < 2; i++) {
+               int pin = i + EXYNOS4X12_GPIO_M10;
+
+               sprintf(str, "model_rev%d", i);
+               gpio_request(pin, str);
+               gpio_cfg_pin(pin, S5P_GPIO_INPUT);
+       }
 
        /* GPM1[5:2]: HW_REV[3:0] */
-       for (i = EXYNOS4X12_GPIO_M12; i < EXYNOS4X12_GPIO_M16; i++) {
-               gpio_cfg_pin(i, S5P_GPIO_INPUT);
-               gpio_set_pull(i, S5P_GPIO_PULL_NONE);
+       for (i = 0; i < 4; i++) {
+               int pin = i + EXYNOS4X12_GPIO_M12;
+
+               sprintf(str, "hw_rev%d", i);
+               gpio_request(pin, str);
+               gpio_cfg_pin(pin, S5P_GPIO_INPUT);
+               gpio_set_pull(pin, S5P_GPIO_PULL_NONE);
        }
 
        /* GPM1[1:0]: MODEL_REV[1:0] */
@@ -103,10 +113,14 @@ static void board_init_i2c(void)
        }
 
        /* I2C_8 */
+       gpio_request(EXYNOS4X12_GPIO_F14, "i2c8_clk");
+       gpio_request(EXYNOS4X12_GPIO_F15, "i2c8_data");
        gpio_direction_output(EXYNOS4X12_GPIO_F14, 1);
        gpio_direction_output(EXYNOS4X12_GPIO_F15, 1);
 
        /* I2C_9 */
+       gpio_request(EXYNOS4X12_GPIO_M21, "i2c9_clk");
+       gpio_request(EXYNOS4X12_GPIO_M20, "i2c9_data");
        gpio_direction_output(EXYNOS4X12_GPIO_M21, 1);
        gpio_direction_output(EXYNOS4X12_GPIO_M20, 1);
 }
@@ -388,6 +402,7 @@ void exynos_lcd_power_on(void)
        struct pmic *p = pmic_get("MAX77686_PMIC");
 
        /* LCD_2.2V_EN: GPC0[1] */
+       gpio_request(EXYNOS4X12_GPIO_C01, "lcd_2v2_en");
        gpio_set_pull(EXYNOS4X12_GPIO_C01, S5P_GPIO_PULL_UP);
        gpio_direction_output(EXYNOS4X12_GPIO_C01, 1);
 
@@ -400,6 +415,7 @@ void exynos_lcd_power_on(void)
 void exynos_reset_lcd(void)
 {
        /* reset lcd */
+       gpio_request(EXYNOS4X12_GPIO_F21, "lcd_reset");
        gpio_direction_output(EXYNOS4X12_GPIO_F21, 0);
        udelay(10);
        gpio_set_value(EXYNOS4X12_GPIO_F21, 1);
index f9d3325b66405b16b336eb459b50ac6dbb8c92bd..c04f48ca99febbba1c4e9570ffe6becabe7e0e80 100644 (file)
@@ -330,6 +330,7 @@ void exynos_cfg_lcd_gpio(void)
        }
 
        /* gpio pad configuration for LCD reset. */
+       gpio_request(EXYNOS4_GPIO_Y45, "lcd_reset");
        gpio_cfg_pin(EXYNOS4_GPIO_Y45, S5P_GPIO_OUTPUT);
 
        spi_init();
@@ -386,6 +387,7 @@ int exynos_init(void)
                 * you should set it HIGH since it removes the inverter
                 */
                /* MASSMEMORY_EN: XMDMDATA_6: GPE3[6] */
+               gpio_request(EXYNOS4_GPIO_E36, "ldo_en");
                gpio_direction_output(EXYNOS4_GPIO_E36, 0);
                break;
        default:
@@ -394,6 +396,7 @@ int exynos_init(void)
                 * But set it as HIGH to ensure
                 */
                /* MASSMEMORY_EN: XMDMADDR_3: GPE1[3] */
+               gpio_request(EXYNOS4_GPIO_E13, "massmemory_en");
                gpio_direction_output(EXYNOS4_GPIO_E13, 1);
                break;
        }
index 637dd972a5b3612d74b0ec3b6924f9f8544aa344..0dea45d079f33e9c4f8b3b55288d7f508e4abc2d 100644 (file)
@@ -102,6 +102,7 @@ struct sdhci_host sdhci_host[SDHCI_MAX_HOSTS];
 
 static int do_sdhci_init(struct sdhci_host *host)
 {
+       char str[20];
        int dev_id, flag;
        int err = 0;
 
@@ -109,6 +110,8 @@ static int do_sdhci_init(struct sdhci_host *host)
        dev_id = host->index + PERIPH_ID_SDMMC0;
 
        if (fdt_gpio_isvalid(&host->pwr_gpio)) {
+               sprintf(str, "sdhci%d_power", host->index & 0xf);
+               gpio_request(host->pwr_gpio.gpio, str);
                gpio_direction_output(host->pwr_gpio.gpio, 1);
                err = exynos_pinmux_config(dev_id, flag);
                if (err) {
@@ -118,7 +121,9 @@ static int do_sdhci_init(struct sdhci_host *host)
        }
 
        if (fdt_gpio_isvalid(&host->cd_gpio)) {
-               gpio_direction_output(host->cd_gpio.gpio, 0xf);
+               sprintf(str, "sdhci%d_cd", host->index & 0xf);
+               gpio_request(host->cd_gpio.gpio, str);
+               gpio_direction_output(host->cd_gpio.gpio, 1);
                if (gpio_get_value(host->cd_gpio.gpio))
                        return -ENODEV;