From fedb29f920918c99ccdce11e10a1662b13f47223 Mon Sep 17 00:00:00 2001 From: Ruixuan Li Date: Mon, 26 Nov 2018 15:16:55 +0800 Subject: [PATCH] arm: dts: tl1: config device on portB with dts [1/1] PD#172587 Problem: configuration for portB in dtsi can not support the sdcard and sdio at same time. Solution: move the device configuration into dts. SKT->SDCARD REF->SDIO Verify: test pass on tl1 skt and ref board Signed-off-by: Ruixuan Li Change-Id: I6d1da7a8d0d8d901c4a40a74f04973c155188ade --- arch/arm/boot/dts/amlogic/mesontl1.dtsi | 37 +---------- arch/arm/boot/dts/amlogic/tl1_pxp.dts | 45 ++++++++++++++ arch/arm/boot/dts/amlogic/tl1_t962x2_skt.dts | 90 ++++++++++++--------------- arch/arm/boot/dts/amlogic/tl1_t962x2_x301.dts | 63 ++++++++++++++----- drivers/amlogic/mmc/amlsd.c | 15 +++-- 5 files changed, 143 insertions(+), 107 deletions(-) diff --git a/arch/arm/boot/dts/amlogic/mesontl1.dtsi b/arch/arm/boot/dts/amlogic/mesontl1.dtsi index b811f6a..4776979 100644 --- a/arch/arm/boot/dts/amlogic/mesontl1.dtsi +++ b/arch/arm/boot/dts/amlogic/mesontl1.dtsi @@ -1147,39 +1147,6 @@ }; }; - sd_emmc_b: sdio@ffe05000 { - status = "disabled"; - compatible = "amlogic, meson-mmc-tl1"; - reg = <0xffe05000 0x800>; - interrupts = <0 190 4>; - - pinctrl-names = "sdio_all_pins", - "sdio_clk_cmd_pins"; - pinctrl-0 = <&sdio_all_pins>; - pinctrl-1 = <&sdio_clk_cmd_pins>; - - clocks = <&clkc CLKID_SD_EMMC_B>, - <&clkc CLKID_SD_EMMC_B_P0_COMP>, - <&clkc CLKID_FCLK_DIV2>, - <&clkc CLKID_FCLK_DIV5>, - <&xtal>; - clock-names = "core", "clkin0", "clkin1", "clkin2", "xtal"; - - bus-width = <4>; - cap-sd-highspeed; - cap-mmc-highspeed; - max-frequency = <100000000>; - disable-wp; - sdio { - pinname = "sdio"; - ocr_avail = <0x200080>; /**VDD voltage 3.3 ~ 3.4 */ - max_req_size = <0x20000>; /**128KB*/ - card_type = <3>; - /* 3:sdio device(ie:sdio-wifi), - * 4:SD combo (IO+mem) card - */ - }; - }; spifc: spifc@ffd14000 { compatible = "amlogic,aml-spi-nor"; @@ -1689,9 +1656,7 @@ ao_to_sd_uart_pins: ao_to_sd_uart_pins { mux { - groups = "uart_ao_a_rx_c", - "uart_ao_a_tx_c", - "uart_ao_a_rx_w3", + groups ="uart_ao_a_rx_w3", "uart_ao_a_tx_w2", "uart_ao_a_rx_w7", "uart_ao_a_tx_w6", diff --git a/arch/arm/boot/dts/amlogic/tl1_pxp.dts b/arch/arm/boot/dts/amlogic/tl1_pxp.dts index 3ab3a9b..abf96db 100644 --- a/arch/arm/boot/dts/amlogic/tl1_pxp.dts +++ b/arch/arm/boot/dts/amlogic/tl1_pxp.dts @@ -640,6 +640,51 @@ /*default:0x88188832;r840 on haier:0x48188832*/ }; + sd_emmc_b: sd@ffe05000 { + status = "okay"; + compatible = "amlogic, meson-mmc-tl1"; + reg = <0xffe05000 0x800>; + interrupts = <0 190 1>; + + pinctrl-names = "sd_all_pins", + "sd_clk_cmd_pins", + "sd_1bit_pins"; + pinctrl-0 = <&sd_all_pins>; + pinctrl-1 = <&sd_clk_cmd_pins>; + pinctrl-2 = <&sd_1bit_pins>; + + clocks = <&clkc CLKID_SD_EMMC_B>, + <&clkc CLKID_SD_EMMC_B_P0_COMP>, + <&clkc CLKID_FCLK_DIV2>, + <&clkc CLKID_FCLK_DIV5>, + <&xtal>; + clock-names = "core", "clkin0", "clkin1", "clkin2", "xtal"; + + bus-width = <4>; + cap-sd-highspeed; + cap-mmc-highspeed; + max-frequency = <100000000>; + disable-wp; + sd { + pinname = "sd"; + ocr_avail = <0x200080>; /**VDD voltage 3.3 ~ 3.4 */ + caps = "MMC_CAP_4_BIT_DATA", + "MMC_CAP_MMC_HIGHSPEED", + "MMC_CAP_SD_HIGHSPEED", + "MMC_CAP_NONREMOVABLE"; /**ptm debug */ + f_min = <400000>; + f_max = <200000000>; + max_req_size = <0x20000>; /**128KB*/ + gpio_dat3 = <&gpio GPIOC_3 GPIO_ACTIVE_HIGH>; + jtag_pin = <&gpio GPIOC_0 GPIO_ACTIVE_HIGH>; + gpio_cd = <&gpio GPIOC_10 GPIO_ACTIVE_HIGH>; + card_type = <5>; + /* 3:sdio device(ie:sdio-wifi), + * 4:SD combo (IO+mem) card + */ + }; + }; + }; /* end of / */ &i2c0 { diff --git a/arch/arm/boot/dts/amlogic/tl1_t962x2_skt.dts b/arch/arm/boot/dts/amlogic/tl1_t962x2_skt.dts index 09ac1611..8b2e13a 100644 --- a/arch/arm/boot/dts/amlogic/tl1_t962x2_skt.dts +++ b/arch/arm/boot/dts/amlogic/tl1_t962x2_skt.dts @@ -1068,34 +1068,48 @@ /*default:0x88188832;r840 on haier:0x48188832*/ }; - bt-dev{ - compatible = "amlogic, bt-dev"; + sd_emmc_b: sd@ffe05000 { status = "okay"; - gpio_reset = <&gpio GPIOC_13 GPIO_ACTIVE_HIGH>; - }; - - wifi{ - compatible = "amlogic, aml_wifi"; - status = "okay"; - interrupt_pin = <&gpio GPIOC_12 GPIO_ACTIVE_HIGH>; - irq_trigger_type = "GPIO_IRQ_LOW"; - dhd_static_buf; //dhd_static_buf support - power_on_pin = <&gpio GPIOC_11 GPIO_ACTIVE_HIGH>; - pinctrl-names = "default"; - pinctrl-0 = <&pwm_b_pins1>; - pwm_config = <&wifi_pwm_conf>; - }; - - wifi_pwm_conf:wifi_pwm_conf{ - pwm_channel1_conf { - pwms = <&pwm_ab MESON_PWM_1 30040 0>; - duty-cycle = <15020>; - times = <8>; - }; - pwm_channel2_conf { - pwms = <&pwm_ab MESON_PWM_3 30030 0>; - duty-cycle = <15015>; - times = <12>; + compatible = "amlogic, meson-mmc-tl1"; + reg = <0xffe05000 0x800>; + interrupts = <0 190 1>; + + pinctrl-names = "sd_all_pins", + "sd_clk_cmd_pins", + "sd_1bit_pins"; + pinctrl-0 = <&sd_all_pins>; + pinctrl-1 = <&sd_clk_cmd_pins>; + pinctrl-2 = <&sd_1bit_pins>; + + clocks = <&clkc CLKID_SD_EMMC_B>, + <&clkc CLKID_SD_EMMC_B_P0_COMP>, + <&clkc CLKID_FCLK_DIV2>, + <&clkc CLKID_FCLK_DIV5>, + <&xtal>; + clock-names = "core", "clkin0", "clkin1", "clkin2", "xtal"; + + bus-width = <4>; + cap-sd-highspeed; + cap-mmc-highspeed; + max-frequency = <100000000>; + disable-wp; + sd { + pinname = "sd"; + ocr_avail = <0x200080>; /**VDD voltage 3.3 ~ 3.4 */ + caps = "MMC_CAP_4_BIT_DATA", + "MMC_CAP_MMC_HIGHSPEED", + "MMC_CAP_SD_HIGHSPEED"; + //"MMC_CAP_NONREMOVABLE"; /**ptm debug */ + f_min = <400000>; + f_max = <200000000>; + max_req_size = <0x20000>; /**128KB*/ + gpio_dat3 = <&gpio GPIOC_3 GPIO_ACTIVE_HIGH>; + jtag_pin = <&gpio GPIOC_0 GPIO_ACTIVE_HIGH>; + gpio_cd = <&gpio GPIOC_10 GPIO_ACTIVE_HIGH>; + card_type = <5>; + /* 3:sdio device(ie:sdio-wifi), + * 4:SD combo (IO+mem) card + */ }; }; @@ -1428,24 +1442,6 @@ }; }; -&sd_emmc_b { - status = "okay"; - sdio { - caps = "MMC_CAP_4_BIT_DATA", - "MMC_CAP_MMC_HIGHSPEED", - "MMC_CAP_SD_HIGHSPEED", - "MMC_CAP_NONREMOVABLE", /**ptm debug */ - "MMC_CAP_UHS_SDR12", - "MMC_CAP_UHS_SDR25", - "MMC_CAP_UHS_SDR50", - "MMC_CAP_UHS_SDR104", - "MMC_PM_KEEP_POWER", - "MMC_CAP_SDIO_IRQ"; - f_min = <400000>; - f_max = <200000000>; - }; -}; - &spifc { status = "disabled"; spi-nor@0 { @@ -1606,10 +1602,6 @@ }; }; -&pwm_ab { - status = "okay"; -}; - &efuse { status = "okay"; }; diff --git a/arch/arm/boot/dts/amlogic/tl1_t962x2_x301.dts b/arch/arm/boot/dts/amlogic/tl1_t962x2_x301.dts index c7e51c5..499eb26 100644 --- a/arch/arm/boot/dts/amlogic/tl1_t962x2_x301.dts +++ b/arch/arm/boot/dts/amlogic/tl1_t962x2_x301.dts @@ -1103,6 +1103,51 @@ }; }; + sd_emmc_b: sdio@ffe05000 { + status = "okay"; + compatible = "amlogic, meson-mmc-tl1"; + reg = <0xffe05000 0x800>; + interrupts = <0 190 4>; + + pinctrl-names = "sdio_all_pins", + "sdio_clk_cmd_pins"; + pinctrl-0 = <&sdio_all_pins>; + pinctrl-1 = <&sdio_clk_cmd_pins>; + + clocks = <&clkc CLKID_SD_EMMC_B>, + <&clkc CLKID_SD_EMMC_B_P0_COMP>, + <&clkc CLKID_FCLK_DIV2>, + <&clkc CLKID_FCLK_DIV5>, + <&xtal>; + clock-names = "core", "clkin0", "clkin1", "clkin2", "xtal"; + + bus-width = <4>; + cap-sd-highspeed; + cap-mmc-highspeed; + max-frequency = <100000000>; + disable-wp; + sdio { + pinname = "sdio"; + ocr_avail = <0x200080>; /**VDD voltage 3.3 ~ 3.4 */ + caps = "MMC_CAP_4_BIT_DATA", + "MMC_CAP_MMC_HIGHSPEED", + "MMC_CAP_SD_HIGHSPEED", + "MMC_CAP_NONREMOVABLE", /**ptm debug */ + "MMC_CAP_UHS_SDR12", + "MMC_CAP_UHS_SDR25", + "MMC_CAP_UHS_SDR50", + "MMC_CAP_UHS_SDR104", + "MMC_PM_KEEP_POWER", + "MMC_CAP_SDIO_IRQ"; + f_min = <400000>; + f_max = <200000000>; + max_req_size = <0x20000>; /**128KB*/ + card_type = <3>; + /* 3:sdio device(ie:sdio-wifi), + * 4:SD combo (IO+mem) card + */ + }; + }; }; /* end of / */ &i2c0 { @@ -1474,23 +1519,7 @@ }; }; -&sd_emmc_b { - status = "okay"; - sdio { - caps = "MMC_CAP_4_BIT_DATA", - "MMC_CAP_MMC_HIGHSPEED", - "MMC_CAP_SD_HIGHSPEED", - "MMC_CAP_NONREMOVABLE", /**ptm debug */ - "MMC_CAP_UHS_SDR12", - "MMC_CAP_UHS_SDR25", - "MMC_CAP_UHS_SDR50", - "MMC_CAP_UHS_SDR104", - "MMC_PM_KEEP_POWER", - "MMC_CAP_SDIO_IRQ"; - f_min = <400000>; - f_max = <200000000>; - }; -}; + &spifc { status = "disabled"; diff --git a/drivers/amlogic/mmc/amlsd.c b/drivers/amlogic/mmc/amlsd.c index eea5ccf..854c9ca 100644 --- a/drivers/amlogic/mmc/amlsd.c +++ b/drivers/amlogic/mmc/amlsd.c @@ -850,7 +850,8 @@ int aml_sd_uart_detect(struct amlsd_platform *pdata) return 1; pdata->is_in = true; pdata->gpio_cd_sta = true; - if (aml_is_sduart(pdata)) { + if ((host->data->chip_type < MMC_CHIP_TL1) + && aml_is_sduart(pdata)) { aml_uart_switch(pdata, 1); pr_info("Uart in\n"); mmc->caps &= ~MMC_CAP_4_BIT_DATA; @@ -865,8 +866,10 @@ int aml_sd_uart_detect(struct amlsd_platform *pdata) } } else { pr_info("normal card in\n"); - aml_uart_switch(pdata, 0); - aml_jtag_switch_ao(pdata); + if (host->data->chip_type < MMC_CHIP_TL1) { + aml_uart_switch(pdata, 0); + aml_jtag_switch_ao(pdata); + } if (host->data->chip_type == MMC_CHIP_G12A) host->is_sduart = 0; if (pdata->caps & MMC_CAP_4_BIT_DATA) @@ -888,8 +891,10 @@ int aml_sd_uart_detect(struct amlsd_platform *pdata) host->is_sduart = 0; if (mmc && mmc->card) mmc_card_set_removed(mmc->card); - aml_uart_switch(pdata, 0); - aml_jtag_switch_ao(pdata); + if (host->data->chip_type < MMC_CHIP_TL1) { + aml_uart_switch(pdata, 0); + aml_jtag_switch_ao(pdata); + } /* switch to 3.3V */ aml_sd_voltage_switch(mmc, MMC_SIGNAL_VOLTAGE_330); -- 2.7.4