sdcard: g12a: enbable hotplug
authorYonghui Yu <yonghui.yu@amlogic.com>
Thu, 1 Feb 2018 17:36:02 +0000 (01:36 +0800)
committerYixun Lan <yixun.lan@amlogic.com>
Fri, 2 Mar 2018 07:07:53 +0000 (15:07 +0800)
    PD#156734: sdcard: g12a: enable hotplug on skt.

Change-Id: I04d42895bb526134ea6d9c2a5222e1acbae533a0
Signed-off-by: Yonghui Yu <yonghui.yu@amlogic.com>
arch/arm64/boot/dts/amlogic/g12a_skt.dts
arch/arm64/boot/dts/amlogic/mesong12a.dtsi
drivers/amlogic/mmc/amlsd.c
include/linux/amlogic/amlsd.h

index c4106a1..2433a87 100644 (file)
                reg = <0x0 0xffe05000 0x0 0x2000>;
                interrupts = <0 190 1>;
 
-               pinctrl-names = "sd_clk_cmd_pins", "sd_all_pins";
-               pinctrl-0 = <&sd_clk_cmd_pins>;
-               pinctrl-1 = <&sd_all_pins>;
+               pinctrl-names = "sd_all_pins",
+                       "sd_clk_cmd_pins";
+               pinctrl-0 = <&sd_all_pins>;
+               pinctrl-1 = <&sd_clk_cmd_pins>;
 
                clocks = <&clkc CLKID_SD_EMMC_B>,
                        <&clkc CLKID_SD_EMMC_B_P0_COMP>,
                        <&clkc CLKID_FCLK_DIV2>,
-                       <&clkc CLKID_FCLK_DIV5>;
-               clock-names = "core", "clkin0", "clkin1", "clkin2";
+                       <&clkc CLKID_FCLK_DIV5>,
+                       <&xtal>;
+               clock-names = "core", "clkin0", "clkin1", "clkin2", "xtal";
 
                bus-width = <4>;
                cap-sd-highspeed;
                cap-mmc-highspeed;
                max-frequency = <100000000>;
-               non-removable;
                disable-wp;
                sd {
                        pinname = "sd";
                        caps = "MMC_CAP_4_BIT_DATA",
                                 "MMC_CAP_MMC_HIGHSPEED",
                                 "MMC_CAP_SD_HIGHSPEED",
-                                "MMC_CAP_NONREMOVABLE",
                                 "MMC_CAP_UHS_SDR12",
                                 "MMC_CAP_UHS_SDR25",
-                                "MMC_CAP_UHS_SDR50",
-                                "MMC_PM_KEEP_POWER",
-                                "MMC_CAP_NONREMOVABLE"; /**ptm debug */
+                                "MMC_CAP_UHS_SDR50";
                        f_min = <400000>;
                        f_max = <200000000>;
                        max_req_size = <0x20000>; /**128KB*/
+                       gpio_dat3 = <&gpio GPIOC_4 GPIO_ACTIVE_HIGH>;
+                       jtag_pin = <&gpio GPIOC_0 GPIO_ACTIVE_HIGH>;
+                       gpio_cd = <&gpio GPIOC_6 GPIO_ACTIVE_HIGH>;
                        card_type = <5>;
                        /* 3:sdio device(ie:sdio-wifi),
                         * 4:SD combo (IO+mem) card
index dc5f0d3..1ed8f65 100644 (file)
                        bias-pull-up;
                };
        };
+       sd_1bit_pins:sd_1bit_pins {
+               mux {
+                       groups = "sdcard_d0_c",
+                                       "sdcard_cmd_c",
+                                       "sdcard_clk_c";
+                       function = "sdcard";
+                       input-enable;
+                       bias-pull-up;
+               };
+       };
+
+       ao_to_sd_uart_pins:ao_to_sd_uart_pins {
+               mux {
+                       groups = "uart_tx_ao_a_c4",
+                                       "uart_rx_ao_a_c5";
+                       function = "uart_ao_a_ee";
+                       bias-pull-up;
+                       input-enable;
+               };
+       };
 
        all_nand_pins: all_nand_pins {
                mux {
index 178a2c9..aa51349 100644 (file)
@@ -669,7 +669,7 @@ static int aml_is_sdjtag(struct amlsd_host *host)
 
 static int aml_is_sduart(struct amlsd_host *host)
 {
-#ifdef CONFIG_MESON_CPU_EMULATOR
+#ifndef SD_EMMC_DEBUG_BOARD
        return 0;
 #else
        int in = 0, i;
@@ -705,6 +705,9 @@ static int aml_is_sduart(struct amlsd_host *host)
 /* int n=0; */
 static int aml_uart_switch(struct amlsd_host *host, bool on)
 {
+#ifndef SD_EMMC_DEBUG_BOARD
+       return on;
+#else
        struct pinctrl *pc;
        char *name[2] = {
                "sd_to_ao_uart_pins",
@@ -716,6 +719,7 @@ static int aml_uart_switch(struct amlsd_host *host, bool on)
        mutex_lock(&host->pinmux_lock);
        pc = aml_devm_pinctrl_get_select(host, name[on]);
        mutex_unlock(&host->pinmux_lock);
+#endif
        return on;
 }
 
@@ -786,6 +790,9 @@ static void aml_jtag_switch_sd(struct amlsd_host *host)
 
 static void aml_jtag_switch_ao(struct amlsd_host *host)
 {
+#ifndef SD_EMMC_DEBUG_BOARD
+
+#else
        struct pinctrl *pc;
        int i;
 
@@ -798,6 +805,7 @@ static void aml_jtag_switch_ao(struct amlsd_host *host)
                        break;
                mdelay(1);
        }
+#endif
 }
 #endif
 
index 14c0ce0..96675f3 100644 (file)
@@ -20,7 +20,8 @@
 #include <linux/of_gpio.h>
 
 /* ptm or pxp simulation */
-#define CONFIG_MESON_CPU_EMULATOR
+/* #define CONFIG_MESON_CPU_EMULATOR */
+/* #define SD_EMMC_DEBUG_BOARD */
 /* hardcode clock, for debug or bringup */
 /* #define SD_EMMC_CLK_CTRL    (1) */
 /* #define SD_EMMC_PIN_CTRL    (1) */