xtal_tick_en = <1>;
fifosize = < 64 >;
pinctrl-names = "default";
- pinctrl-0 = <&ao_uart_pins>;
+ /*pinctrl-0 = <&ao_uart_pins>;*/
support-sysrq = <0>; /* 0 not support*/
};
pinname = "sd";
ocr_avail = <0x200080>; /**VDD voltage 3.3 ~ 3.4 */
max_req_size = <0x20000>; /**128KB*/
- gpio_dat3 = <&gpio GPIOC_4 GPIO_ACTIVE_HIGH>;
+ gpio_dat3 = <&gpio GPIOC_3 GPIO_ACTIVE_HIGH>;
jtag_pin = <&gpio GPIOC_0 GPIO_ACTIVE_HIGH>;
gpio_cd = <&gpio GPIOC_6 GPIO_ACTIVE_HIGH>;
card_type = <5>;
pinctrl-names = "sd_all_pins",
"sd_clk_cmd_pins",
+ "sd_1bit_pins",
+ "sd_clk_cmd_uart_pins",
+ "sd_1bit_uart_pins",
+ "sd_to_ao_uart_pins",
+ "ao_to_sd_uart_pins",
+ "sd_to_ao_jtag_pins",
+ "ao_to_sd_jtag_pins",
+ "sdio_noclr_all_pins",
+ "sdio_noclr_clk_cmd_pins",
"sdio_all_pins",
"sdio_clk_cmd_pins";
pinctrl-0 = <&sdio_x_clr_pins &sd_all_pins>;
pinctrl-1 = <&sdio_x_clr_pins &sd_clk_cmd_pins>;
- pinctrl-2 = <&sd_clr_all_pins
+ pinctrl-2 = <&sdio_x_clr_pins &sd_1bit_pins>;
+ pinctrl-3 = <&sdio_x_clr_pins &sd_to_ao_uart_clr_pins
+ &sd_clk_cmd_pins &ao_to_sd_uart_pins>;
+ pinctrl-4 = <&sdio_x_clr_pins &sd_to_ao_uart_clr_pins
+ &sd_1bit_pins &ao_to_sd_uart_pins>;
+ pinctrl-5 = <&sdio_x_clr_pins
+ &sd_all_pins &sd_to_ao_uart_pins>;
+ pinctrl-6 = <&sdio_x_en_pins &sd_to_ao_uart_clr_pins
+ &sd_clr_noall_pins &ao_to_sd_uart_pins>;
+ pinctrl-7 = <&sdio_x_en_pins
+ &sd_clr_all_pins &sd_to_ao_uart_pins>;
+ pinctrl-8 = <&sdio_x_en_pins &sd_to_ao_uart_clr_pins
+ &sd_clr_noall_pins &ao_to_sd_uart_pins>;
+ pinctrl-9 = <&sd_clr_noall_pins
+ &sdio_x_en_pins &sdio_x_all_pins>;
+ pinctrl-10 = <&sd_clr_noall_pins
+ &sdio_x_en_pins &sdio_x_clk_cmd_pins>;
+ pinctrl-11 = <&sd_clr_all_pins
&sdio_x_en_pins &sdio_x_all_pins>;
- pinctrl-3 = <&sd_clr_all_pins
+ pinctrl-12 = <&sd_clr_all_pins
&sdio_x_en_pins &sdio_x_clk_cmd_pins>;
clocks = <&clkc CLKID_SD_EMMC_B>,
pinname = "sd";
ocr_avail = <0x200080>; /**VDD voltage 3.3 ~ 3.4 */
max_req_size = <0x20000>; /**128KB*/
- gpio_dat3 = <&gpio GPIOC_4 GPIO_ACTIVE_HIGH>;
+ gpio_dat3 = <&gpio GPIOC_3 GPIO_ACTIVE_HIGH>;
jtag_pin = <&gpio GPIOC_0 GPIO_ACTIVE_HIGH>;
gpio_cd = <&gpio GPIOC_6 GPIO_ACTIVE_HIGH>;
card_type = <5>;
};/* end of / */
&pinctrl_aobus {
+ sd_to_ao_uart_clr_pins:sd_to_ao_uart_clr_pins {
+ mux {
+ groups = "GPIOAO_0",
+ "GPIOAO_1";
+ function = "gpio_aobus";
+ };
+ };
+
+ sd_to_ao_uart_pins:sd_to_ao_uart_pins {
+ mux {
+ groups = "uart_ao_tx_a",
+ "uart_ao_rx_a";
+ function = "uart_ao_a";
+ bias-pull-up;
+ input-enable;
+ };
+ };
+
ao_uart_pins:ao_uart {
mux {
groups = "uart_ao_tx_a",
};
};
+ sd_1bit_pins:sd_1bit_pins {
+ mux {
+ groups = "sdcard_d0_c",
+ "sdcard_cmd_c";
+ function = "sdcard";
+ input-enable;
+ bias-pull-up;
+ drive-strength = <3>;
+ };
+ mux1 {
+ groups = "sdcard_clk_c";
+ function = "sdcard";
+ bias-pull-up;
+ output-high;
+ drive-strength = <3>;
+ };
+ };
+
sd_clr_all_pins:sd_clr_all_pins {
mux {
groups = "GPIOC_0",
};
};
- sd_1bit_pins:sd_1bit_pins {
+ sd_clr_noall_pins:sd_clr_noall_pins {
mux {
- groups = "sdcard_d0_c",
- "sdcard_cmd_c",
- "sdcard_clk_c";
- function = "sdcard";
- input-enable;
- bias-pull-up;
+ groups = "GPIOC_0",
+ "GPIOC_1",
+ "GPIOC_4",
+ "GPIOC_5";
+ function = "gpio_periphs";
+ output-high;
};
};
ao_to_sd_uart_pins:ao_to_sd_uart_pins {
mux {
- groups = "uart_tx_ao_a_c4",
- "uart_rx_ao_a_c5";
+ groups = "uart_ao_tx_a_c3",
+ "uart_ao_rx_a_c2";
function = "uart_ao_a_ee";
bias-pull-up;
input-enable;
};
};
+
/* sdemmc portA */
sdio_clk_cmd_pins:sdio_clk_cmd_pins {
mux {
devm_pinctrl_put(p);
return ERR_PTR(ret);
}
+ if ((host->mem->start == host->data->port_b_base)
+ && (host->data->chip_type == MMC_CHIP_G12A))
+ strlcpy(host->pinctrl_name, name, sizeof(host->pinctrl_name));
return p;
}
#else /* SD_EMMC_PIN_CTRL */
if (mmc->ios.chip_select == MMC_CS_DONTCARE) {
if ((mmc->caps & MMC_CAP_4_BIT_DATA)
|| (strcmp(pdata->pinname, "sd"))
- || (mmc->caps & MMC_CAP_8_BIT_DATA))
- aml_snprint(&p, &size, "%s_all_pins", pdata->pinname);
- else {
+ || (mmc->caps & MMC_CAP_8_BIT_DATA)) {
+ if (aml_card_type_sdio(pdata)
+ && (host->data->chip_type == MMC_CHIP_G12A)
+ && host->is_sduart)
+ aml_snprint(&p, &size,
+ "%s_noclr_all_pins", pdata->pinname);
+ else
+ aml_snprint(&p, &size,
+ "%s_all_pins", pdata->pinname);
+ } else {
if (pdata->is_sduart && (!strcmp(pdata->pinname, "sd")))
aml_snprint(&p, &size,
"%s_1bit_uart_pins",
aml_snprint(&p, &size,
"%s_clk_cmd_uart_pins", pdata->pinname);
} else {
- aml_snprint(&p, &size,
+ if (aml_card_type_sdio(pdata)
+ && (host->data->chip_type == MMC_CHIP_G12A)
+ && host->is_sduart)
+ aml_snprint(&p, &size,
+ "%s_noclr_clk_cmd_pins",
+ pdata->pinname);
+ else
+ aml_snprint(&p, &size,
"%s_clk_cmd_pins", pdata->pinname);
}
}
int in = 0, i;
int high_cnt = 0, low_cnt = 0;
u32 vstat = 0;
+ struct pinctrl *pc;
struct amlsd_host *host = pdata->host;
struct sd_emmc_status *ista = (struct sd_emmc_status *)&vstat;
+ mutex_lock(&host->pinmux_lock);
+ pc = aml_devm_pinctrl_get_select(host, "sd_to_ao_uart_pins");
+
for (i = 0; ; i++) {
mdelay(1);
vstat = readl(host->base + SD_EMMC_STATUS) & 0xffffffff;
if (low_cnt > 50)
in = 1;
+ mutex_unlock(&host->pinmux_lock);
return !in;
}
{
static bool is_jtag;
struct mmc_host *mmc = pdata->mmc;
+ struct amlsd_host *host = pdata->host;
+
if (aml_is_card_insert(pdata)) {
if (pdata->is_in)
return 1;
aml_uart_switch(pdata, 1);
pr_info("Uart in\n");
mmc->caps &= ~MMC_CAP_4_BIT_DATA;
+ if (host->data->chip_type == MMC_CHIP_G12A)
+ host->is_sduart = 1;
if (aml_is_sdjtag(pdata)) {
aml_jtag_switch_sd(pdata);
is_jtag = true;
struct amlsd_host *host = pdata->host;
int ret = 0;
+#ifdef AML_MMC_TDMA
+ if ((host->mem->start == host->data->port_b_base)
+ && (host->data->chip_type == MMC_CHIP_G12A))
+ wait_for_completion(&host->drv_completion);
+#endif
mutex_lock(&pdata->in_out_lock);
if (card_dealed == 1) {
card_dealed = 0;
mmc_detect_change(mmc, msecs_to_jiffies(0));
card_dealed = 0;
+#ifdef AML_MMC_TDMA
+ if ((host->mem->start == host->data->port_b_base)
+ && (host->data->chip_type == MMC_CHIP_G12A))
+ complete(&host->drv_completion);
+#endif
return 0;
}