mmc: host: rk3288-pinctrl: fix sdmmc & sdio0 controller pad iomux setting

rk_sdmmc: setting default pinctrl in controller probe but eMMC.
This commit is contained in:
lintao
2014-03-26 13:19:17 +08:00
parent 8cbfe6bdc8
commit 49264b25b9
4 changed files with 159 additions and 20 deletions

View File

@@ -820,8 +820,122 @@
rockchip,drive = <VALUE_DRV_DEFAULT>;
//rockchip,tristate = <VALUE_TRI_DEFAULT>;
};
sdmmc0_gpio: sdmmc0_gpio{
rockchip,pins =
<GPIO6_C4>, //CMD
<GPIO6_C5>, //CLK
<GPIO6_C6>, //DET
<GPIO6_C0>, //D0
<GPIO6_C1>, //D1
<GPIO6_C2>, //D2
<GPIO6_C3>; //D3
rockchip,pull = <VALUE_PULL_UP>;
//rockchip,voltage = <VALUE_VOL_DEFAULT>;
rockchip,drive = <VALUE_DRV_DEFAULT>;
//rockchip,tristate = <VALUE_TRI_DEFAULT>;
};
};
gpio4_sdio0 {
sdio0_clk: sdio0_clk {
rockchip,pins = <SDIO0_CLKOUT>;
rockchip,pull = <VALUE_PULL_DISABLE>;
//rockchip,voltage = <VALUE_VOL_DEFAULT>;
rockchip,drive = <VALUE_DRV_DEFAULT>;
//rockchip,tristate = <VALUE_TRI_DEFAULT>;
};
sdio0_cmd: sdio0_cmd {
rockchip,pins = <SDIO0_CMD>;
rockchip,pull = <VALUE_PULL_UP>;
//rockchip,voltage = <VALUE_VOL_DEFAULT>;
rockchip,drive = <VALUE_DRV_DEFAULT>;
//rockchip,tristate = <VALUE_TRI_DEFAULT>;
};
sdio0_dectn: sdio0-dectn{
rockchip,pins = <SDIO0_DETECTN>;
rockchip,pull = <VALUE_PULL_UP>;
//rockchip,voltage = <VALUE_VOL_DEFAULT>;
rockchip,drive = <VALUE_DRV_DEFAULT>;
//rockchip,tristate = <VALUE_TRI_DEFAULT>;
};
sdio0_wrprt: sdio0_wrprt{
rockchip,pins = <SDIO0_WRPRT>;
rockchip,pull = <VALUE_PULL_UP>;
//rockchip,voltage = <VALUE_VOL_DEFAULT>;
rockchip,drive = <VALUE_DRV_DEFAULT>;
//rockchip,tristate = <VALUE_TRI_DEFAULT>;
};
sdio0_pwr: sdio0-pwren{
rockchip,pins = <SDIO0_PWREN>;
rockchip,pull = <VALUE_PULL_UP>;
//rockchip,voltage = <VALUE_VOL_DEFAULT>;
rockchip,drive = <VALUE_DRV_DEFAULT>;
//rockchip,tristate = <VALUE_TRI_DEFAULT>;
};
sdio0_bkpwr: sdio0-bkpwr{
rockchip,pins = <SDIO0_BKPWR>;
rockchip,pull = <VALUE_PULL_UP>;
//rockchip,voltage = <VALUE_VOL_DEFAULT>;
rockchip,drive = <VALUE_DRV_DEFAULT>;
//rockchip,tristate = <VALUE_TRI_DEFAULT>;
};
sdio0_intn: sdio0-intn{
rockchip,pins = <SDIO0_INTN>;
rockchip,pull = <VALUE_PULL_UP>;
//rockchip,voltage = <VALUE_VOL_DEFAULT>;
rockchip,drive = <VALUE_DRV_DEFAULT>;
//rockchip,tristate = <VALUE_TRI_DEFAULT>;
};
sdio0_bus1: sdio0-bus-width1 {
rockchip,pins = <SDIO0_DATA0>;
rockchip,pull = <VALUE_PULL_UP>;
//rockchip,voltage = <VALUE_VOL_DEFAULT>;
rockchip,drive = <VALUE_DRV_DEFAULT>;
//rockchip,tristate = <VALUE_TRI_DEFAULT>;
};
sdio0_bus4: sdio0-bus-width4 {
rockchip,pins = <SDIO0_DATA0>,
<SDIO0_DATA1>,
<SDIO0_DATA2>,
<SDIO0_DATA3>;
rockchip,pull = <VALUE_PULL_UP>;
//rockchip,voltage = <VALUE_VOL_DEFAULT>;
rockchip,drive = <VALUE_DRV_DEFAULT>;
//rockchip,tristate = <VALUE_TRI_DEFAULT>;
};
sdio0_gpio: sdio0-all-gpio{
rockchip,pins =
<GPIO4_D1>, //CLK
<GPIO4_D0>, //CMD
<GPIO4_D2>, //DET
<GPIO4_D3>, //wrprt
<GPIO4_D4>, //PWREN
<GPIO4_D5>, //BKPWR
<GPIO4_D6>, //DO
<GPIO4_C4>, //D1
<GPIO4_C5>, //D2
<GPIO4_C6>, //D3
<GPIO4_C7>; //INTN
rockchip,pull = <VALUE_PULL_UP>;
//rockchip,voltage = <VALUE_VOL_DEFAULT>;
rockchip,drive = <VALUE_DRV_DEFAULT>;
//rockchip,tristate = <VALUE_TRI_DEFAULT>;
};
};
gpio2_gps {
gps_mag:gps-mag {
rockchip,pins = <GPS_MAG>;

View File

@@ -271,39 +271,41 @@
};
sdmmc: rksdmmc@ff0c0000 {
compatible = "rockchip,rk_mmc";
compatible = "rockchip,rk_mmc";
reg = <0xff0c0000 0x4000>;
interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>; /*irq=64*/
#address-cells = <1>;
#size-cells = <0>;
#address-cells = <1>;
#size-cells = <0>;
//pinctrl-names = "default","suspend";
//pinctrl-0 = <&sd0_clk &sd0_cmd &sd0_cd &sd0_wp &sd0_pwr &sd0_bus1 &sd0_bus4>;
//pinctrl-1 = <&sd0_cd_gpio>; //for int gpio?
pinctrl-names = "default","idle";
pinctrl-0 = <&sdmmc0_clk &sdmmc0_cmd &sdmmc0_dectn &sdmmc0_bus4>;
pinctrl-1 = <&sdmmc0_gpio>;
clocks = <&clk_sdmmc>, <&clk_gates8 3>;
clock-names = "clk_mmc", "hclk_mmc";
num-slots = <1>;
fifo-depth = <0x100>;
bus-width = <4>;
num-slots = <1>;
fifo-depth = <0x100>;
bus-width = <4>;
};
sdio: rksdmmc@ff0d0000 {
compatible = "rockchip,rk_mmc";
reg = <0xff0d0000 0x4000>;
interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
#address-cells = <1>;
#size-cells = <0>;
//pinctrl-names = "default","suspend";
//pinctrl-0 = <&sd1_clk &sd1_cmd &sd1_cd &sd1_wp &sd1_bus1 &sd1_bus4>;
reg = <0xff0d0000 0x4000>;
interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
#address-cells = <1>;
#size-cells = <0>;
pinctrl-names = "default","idle";
pinctrl-0 = <&sdio0_clk &sdio0_cmd &sdio0_dectn &sdio0_wrprt &sdio0_pwr &sdio0_bkpwr
&sdio0_intn &sdio0_bus4>;
pinctrl-1 = <&sdio0_gpio>;
clocks = <&clk_sdio0>, <&clk_gates8 4>;
clock-names = "clk_mmc", "hclk_mmc";
num-slots = <1>;
num-slots = <1>;
fifo-depth = <0x100>;
bus-width = <4>;
fifo-depth = <0x100>;
bus-width = <4>;
};
sdio1: rksdmmc@ff0e0000 {

View File

@@ -727,7 +727,8 @@ static int dw_mci_submit_data_dma(struct dw_mci *host, struct mmc_data *data)
if (host->prev_blksz != data->blksz)
dw_mci_adjust_fifoth(host, data);
temp = mci_readl(host, CTRL);
/* Reset DMA FIFO*/
temp = mci_readl(host, CTRL);
temp |= (SDMMC_CTRL_DMA_RESET | SDMMC_CTRL_FIFO_RESET);
mci_writel(host, CTRL, temp);
@@ -756,6 +757,11 @@ static void dw_mci_submit_data(struct dw_mci *host, struct mmc_data *data)
host->sg = NULL;
host->data = data;
/* Reset FIFO*/
temp = mci_readl(host, CTRL);
temp |= (SDMMC_CTRL_DMA_RESET | SDMMC_CTRL_FIFO_RESET);
mci_writel(host, CTRL, temp);
if (data->flags & MMC_DATA_READ) {
host->dir_status = DW_MCI_RECV_STATUS;
dw_mci_ctrl_rd_thld(host, data);
@@ -2649,6 +2655,19 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id)
ret = mmc_add_host(mmc);
if (ret)
goto err_setup_bus;
/* Pinctrl set default iomux state to fucntion port.
* Fixme: DON'T TOUCH EMMC SETTING!
*/
if(!(host->mmc->restrict_caps & RESTRICT_CARD_TYPE_EMMC))
{
host->pinctrl = devm_pinctrl_get(host->dev);
host->pins_default = pinctrl_lookup_state(host->pinctrl,PINCTRL_STATE_DEFAULT);
if(!host->pins_default)
pinctrl_select_state(host->pinctrl, host->pins_default);
else
printk("%s: Warning : No default pinctrl matched!\n",mmc_hostname(host->mmc));
}
#if defined(CONFIG_DEBUG_FS)
dw_mci_init_debugfs(slot);

View File

@@ -195,6 +195,10 @@ struct dw_mci {
struct regulator *vmmc; /* Power regulator */
unsigned long irq_flags; /* IRQ flags */
int irq;
struct pinctrl *pinctrl; /*Pinctrl state*/
struct pinctrl_state *pins_default;
struct pinctrl_state *pins_idle;
struct pinctrl_state *pins_sleep;
};
/* DMA ops for Internal/External DMAC interface */