diff --git a/Documentation/devicetree/bindings/mmc/k3-dw-mshc.txt b/Documentation/devicetree/bindings/mmc/k3-dw-mshc.txt index 8af1afcb86dc..6edc0a4af8f0 100644 --- a/Documentation/devicetree/bindings/mmc/k3-dw-mshc.txt +++ b/Documentation/devicetree/bindings/mmc/k3-dw-mshc.txt @@ -12,6 +12,7 @@ extensions to the Synopsys Designware Mobile Storage Host Controller. Required Properties: * compatible: should be one of the following. + - "hisilicon,hi3670-dw-mshc": for controllers with hi3670 specific extensions. - "hisilicon,hi3660-dw-mshc": for controllers with hi3660 specific extensions. - "hisilicon,hi4511-dw-mshc": for controllers with hi4511 specific extensions. - "hisilicon,hi6220-dw-mshc": for controllers with hi6220 specific extensions. diff --git a/arch/arm64/boot/dts/hisilicon/kirin970-hikey970.dts b/arch/arm64/boot/dts/hisilicon/kirin970-hikey970.dts index 7889358f9d92..af33c03583c4 100644 --- a/arch/arm64/boot/dts/hisilicon/kirin970-hikey970.dts +++ b/arch/arm64/boot/dts/hisilicon/kirin970-hikey970.dts @@ -14,6 +14,7 @@ #include "kirin970_spmi.dtsi" #include "hisi_6421v600_pmic_spmi.dtsi" +#include "kirin970-ion.dtsi" / { model = "HiKey970"; compatible = "Hisilicon,kirin970-hikey970", "Hisilicon,kirin970"; @@ -138,10 +139,10 @@ leds { compatible = "gpio-leds"; - user_led2 { - label = "user_led2"; - /* gpio_151_user_led2 */ - gpios = <&gpio20 7 0>; + sdcard_active_led { + label = "sdcard_active"; + /* gpio_192_user_led2 */ + gpios = <&gpio24 0 0>; linux,default-trigger = "mmc0"; }; diff --git a/arch/arm64/boot/dts/hisilicon/kirin970-ion.dtsi b/arch/arm64/boot/dts/hisilicon/kirin970-ion.dtsi new file mode 100644 index 000000000000..812620db075f --- /dev/null +++ b/arch/arm64/boot/dts/hisilicon/kirin970-ion.dtsi @@ -0,0 +1,48 @@ +/ { + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + graphic_heap: graphic { + size = <0x0 0x1E00000>; + alignment = <0x0 0x100000>; + alloc-ranges = <0x0 0x0 0x1 0x0>; + compatible = "hisi_ion"; + heap-name = "carveout_gralloc"; + }; + }; + + hisi,ion { + compatible = "hisilicon,hisi-ion"; + + iommu_info { + start-addr = <0x40000>; + size = <0xbffc0000>; + iova-align = <0x0 0x8000>; + }; + + linear { + start-addr = <0x40000>; + size = <0xbffc0000>; + page-size = <0x1000>; + page-align = <0x40000>; + }; + + heap_sys_user@0 { + heap-name = "sys_heap"; + heap-id = <0x0>; + heap-base = <0x0>; + heap-size = <0x0>; + heap-type = "ion_system"; + }; + + heap_carveout_gralloc@2 { + heap-name = <&graphic_heap>; + heap-id = <0x2>; + heap-base = <0x0>; + heap-size = <0x0>; + heap-type = "ion_carveout"; + }; + }; +}; diff --git a/arch/arm64/configs/hikey970_defconfig b/arch/arm64/configs/hikey970_defconfig index 65922503cf8b..7f273f12fda5 100644 --- a/arch/arm64/configs/hikey970_defconfig +++ b/arch/arm64/configs/hikey970_defconfig @@ -603,7 +603,7 @@ CONFIG_STAGING=y CONFIG_ASHMEM=y CONFIG_ANDROID_LOW_MEMORY_KILLER=y CONFIG_ION=y -# CONFIG_ION_HISI is not set +CONFIG_ION_HISI=y CONFIG_COMMON_CLK_SCPI=y CONFIG_COMMON_CLK_CS2000_CP=y CONFIG_COMMON_CLK_S2MPS11=y @@ -620,7 +620,7 @@ CONFIG_PM_DEVFREQ=y CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y CONFIG_DEVFREQ_GOV_USERSPACE=y CONFIG_HISI_DDR_DEVFREQ=y -# CONFIG_HISI_IOMMU_LPAE is not set +CONFIG_HISI_IOMMU_LPAE=y CONFIG_ARM_SMMU=y CONFIG_QCOM_SMEM=y CONFIG_QCOM_SMD=y diff --git a/drivers/mmc/host/dw_mmc-k3.c b/drivers/mmc/host/dw_mmc-k3.c index 74bee944d7d6..a54e37a137c7 100644 --- a/drivers/mmc/host/dw_mmc-k3.c +++ b/drivers/mmc/host/dw_mmc-k3.c @@ -49,9 +49,6 @@ #define TIMING_MODE 3 #define TIMING_CFG_NUM 10 -#define PULL_DOWN BIT(1) -#define PULL_UP BIT(0) - #define NUM_PHASES (40) #define ENABLE_SHIFT_MIN_SMPL (4) @@ -78,7 +75,7 @@ struct hs_timing { u32 smpl_phase_min; }; -struct hs_timing hs_timing_cfg[TIMING_MODE][TIMING_CFG_NUM] = { +static struct hs_timing hs_timing_cfg[TIMING_MODE][TIMING_CFG_NUM] = { { /* reserved */ }, { /* SD */ {7, 0, 15, 15,}, /* 0: LEGACY 400k */ @@ -297,7 +294,7 @@ static int dw_mci_set_sel18(struct dw_mci *host, bool set) return 0; } -void dw_mci_hi3660_set_ios(struct dw_mci *host, struct mmc_ios *ios) +static void dw_mci_hi3660_set_ios(struct dw_mci *host, struct mmc_ios *ios) { int ret; unsigned long wanted; @@ -339,9 +336,10 @@ static int dw_mci_get_best_clksmpl(unsigned int sample_flag) i = ffs(sample_flag) - 1; - /*A clock cycle is divided into 32 phases, - *each of which is represented by a bit, - *finding the optimal phase. + /* + * A clock cycle is divided into 32 phases, + * each of which is represented by a bit, + * finding the optimal phase. */ while (i < 32) { v = ror32(sample_flag, i); @@ -403,9 +401,7 @@ static int dw_mci_hi3660_execute_tuning(struct dw_mci_slot *slot, u32 opcode) static int dw_mci_hi3660_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios) { - int ret; - int min_uv = 0; - int max_uv = 0; + int ret = 0; struct dw_mci_slot *slot = mmc_priv(mmc); struct k3_priv *priv; struct dw_mci *host; @@ -419,29 +415,24 @@ static int dw_mci_hi3660_switch_voltage(struct mmc_host *mmc, if (priv->ctrl_id == DWMMC_SDIO_ID) return 0; - if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330) { + if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330) ret = dw_mci_set_sel18(host, 0); - if (ret) - return ret; - min_uv = 2950000; - max_uv = 2950000; - } else if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_180) { + else if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_180) ret = dw_mci_set_sel18(host, 1); - if (ret) - return ret; - min_uv = 1800000; - max_uv = 1800000; - } + else + dev_err(host->dev, "voltage not supported\n"); - if (IS_ERR_OR_NULL(mmc->supply.vqmmc)) - return 0; - - ret = regulator_set_voltage(mmc->supply.vqmmc, min_uv, max_uv); - if (ret) { - dev_err(host->dev, "Regulator set error %d: %d - %d\n", - ret, min_uv, max_uv); + if (ret) return ret; + + if (!IS_ERR(mmc->supply.vqmmc)) { + ret = mmc_regulator_set_vqmmc(mmc, ios); + if (ret) { + dev_err(host->dev, "Regulator set error %d\n", ret); + return ret; + } } + return 0; } @@ -454,6 +445,7 @@ static const struct dw_mci_drv_data hi3660_data = { }; static const struct of_device_id dw_mci_k3_match[] = { + { .compatible = "hisilicon,hi3670-dw-mshc", .data = &hi3660_data, }, { .compatible = "hisilicon,hi3660-dw-mshc", .data = &hi3660_data, }, { .compatible = "hisilicon,hi4511-dw-mshc", .data = &k3_drv_data, }, { .compatible = "hisilicon,hi6220-dw-mshc", .data = &hi6220_data, },