From 02d3046a9f5f289bf3765a232eb9bd255a5200fc Mon Sep 17 00:00:00 2001 From: lintao Date: Mon, 11 Aug 2014 10:46:25 +0800 Subject: [PATCH] mmc: fix dts cd-gpio setting --- arch/arm/boot/dts/rk3126-sdk.dts | 3 +++ arch/arm/boot/dts/rk3128-sdk.dts | 4 +++ arch/arm/boot/dts/rk312x-sdk.dtsi | 5 ++-- drivers/mmc/host/rk_sdmmc.c | 42 ++++++++++++++++--------------- 4 files changed, 31 insertions(+), 23 deletions(-) diff --git a/arch/arm/boot/dts/rk3126-sdk.dts b/arch/arm/boot/dts/rk3126-sdk.dts index acdc0f59565d..eeb4943f91c4 100755 --- a/arch/arm/boot/dts/rk3126-sdk.dts +++ b/arch/arm/boot/dts/rk3126-sdk.dts @@ -45,3 +45,6 @@ &key { io-channels = <&adc 2>; }; +&sdmmc { + cd-gpios = <&gpio2 GPIO_A3 GPIO_ACTIVE_HIGH>;/*CD GPIO*/ +}; diff --git a/arch/arm/boot/dts/rk3128-sdk.dts b/arch/arm/boot/dts/rk3128-sdk.dts index e5c7aabed088..0cc5cb71ebe7 100755 --- a/arch/arm/boot/dts/rk3128-sdk.dts +++ b/arch/arm/boot/dts/rk3128-sdk.dts @@ -42,3 +42,7 @@ }; }; }; + +&sdmmc { + cd-gpios = <&gpio1 GPIO_C1 GPIO_ACTIVE_HIGH>;/*CD GPIO*/ +}; diff --git a/arch/arm/boot/dts/rk312x-sdk.dtsi b/arch/arm/boot/dts/rk312x-sdk.dtsi index 1390dd2af07f..ce073c1c1238 100755 --- a/arch/arm/boot/dts/rk312x-sdk.dtsi +++ b/arch/arm/boot/dts/rk312x-sdk.dtsi @@ -73,8 +73,8 @@ }; &emmc { - clock-frequency = <100000000>; - clock-freq-min-max = <400000 100000000>; + clock-frequency = <50000000>; + clock-freq-min-max = <400000 50000000>; supports-highspeed; supports-emmc; bootpart-no-access; @@ -91,7 +91,6 @@ clock-freq-min-max = <400000 50000000>; supports-highspeed; supports-sd; - cd-gpios = <&gpio2 GPIO_A7 GPIO_ACTIVE_HIGH>;/*CD GPIO*/ broken-cd; card-detect-delay = <200>; ignore-pm-notify; diff --git a/drivers/mmc/host/rk_sdmmc.c b/drivers/mmc/host/rk_sdmmc.c index 54465ae4615c..1fe1bcaa9d4d 100755 --- a/drivers/mmc/host/rk_sdmmc.c +++ b/drivers/mmc/host/rk_sdmmc.c @@ -3151,26 +3151,28 @@ static irqreturn_t dw_mci_gpio_cd_irqt(int irq, void *dev_id) static void dw_mci_of_set_cd_gpio_irq(struct device *dev, u32 gpio, struct mmc_host *mmc) { - struct dw_mci_slot *slot = mmc_priv(mmc); - struct dw_mci *host = slot->host; - int irq; - int ret; - - /* Having a missing entry is valid; return silently */ - if (!gpio_is_valid(gpio)) - return; - - irq = gpio_to_irq(gpio); - if (irq >= 0) { - ret = devm_request_threaded_irq(&mmc->class_dev, irq, - NULL, dw_mci_gpio_cd_irqt, - IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, - "dw_mci_cd", mmc); - if (ret < 0) - irq = ret; - } else { - dev_err(host->dev, "Request cd-gpio interrupt error!\n"); - } + struct dw_mci_slot *slot = mmc_priv(mmc); + struct dw_mci *host = slot->host; + int irq; + int ret; + + /* Having a missing entry is valid; return silently */ + if (!gpio_is_valid(gpio)) + return; + + irq = gpio_to_irq(gpio); + if (irq >= 0) { + ret = devm_request_threaded_irq(&mmc->class_dev, irq, + NULL, dw_mci_gpio_cd_irqt, + IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, + "dw_mci_cd", mmc); + if (ret < 0) { + irq = ret; + dev_err(host->dev, "Request cd-gpio %d interrupt error!\n", gpio); + } + } else { + dev_err(host->dev, "Cannot convert gpio %d to irq!\n", gpio); + } } #else /* CONFIG_OF */ static int dw_mci_of_get_slot_quirks(struct device *dev, u8 slot) -- 2.34.1