mvebu: switch to 3.10
[openwrt/svn-archive/archive.git] / target / linux / mvebu / patches-3.8 / 008-mmc_mvsdio_implement_a_device_tree_binding.patch
index 4f8cc2011f40c4ea0f0fe60d40e8d9b79e6fe69c..baec5a1467010618ac78e38f850f34f30cc0c9e8 100644 (file)
@@ -1,3 +1,20 @@
+From patchwork Wed Jan 16 13:13:59 2013
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [4/5] mmc: mvsdio: implement a Device Tree binding
+Date: Wed, 16 Jan 2013 13:13:59 -0000
+From: Andrew Lunn <andrew@lunn.ch>
+X-Patchwork-Id: 1987921
+Message-Id: <1358342040-7130-5-git-send-email-andrew@lunn.ch>
+To: Jason Cooper <jason@lakedaemon.net>
+Cc: linux ARM <linux-arm-kernel@lists.infradead.org>,
+ linux-mmc@vger.kernel.org, linux@arm.linux.org.uk,
+ Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
+ Andrew Lunn <andrew@lunn.ch>
+
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+
 This patch adds a simple Device Tree binding for the mvsdio driver, as
 well as the necessary documentation for it. Compatibility with non-DT
 platforms is preserved, by keeping the platform_data based
@@ -11,15 +28,17 @@ reference is not mandatory, but the clock frequency must be passed in
 the "clock" field of the mvsdio_platform_data structure.
 
 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Signed-off-by: Andrew Lunn <andrew@lunn.ch>
+Tested-by: Stefan Peter <s.peter@mpl.ch>
+Tested-by: Florian Fainelli <florian@openwrt.org>
+Signed-off-by: Jason Cooper <jason@lakedaemon.net>
+
 ---
- .../devicetree/bindings/mmc/orion-sdio.txt         |   17 ++++++
- drivers/mmc/host/mvsdio.c                          |   60 +++++++++++++++-----
- 2 files changed, 62 insertions(+), 15 deletions(-)
+.../devicetree/bindings/mmc/orion-sdio.txt         |   17 ++++++
+ drivers/mmc/host/mvsdio.c                          |   62 +++++++++++++++-----
+ 2 files changed, 64 insertions(+), 15 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/mmc/orion-sdio.txt
 
-diff --git a/Documentation/devicetree/bindings/mmc/orion-sdio.txt b/Documentation/devicetree/bindings/mmc/orion-sdio.txt
-new file mode 100644
-index 0000000..84f0ebd
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/mmc/orion-sdio.txt
 @@ -0,0 +1,17 @@
@@ -40,8 +59,6 @@ index 0000000..84f0ebd
 +              clocks = <&gateclk 17>;
 +              status = "disabled";
 +      };
-diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c
-index baf19fc..56954bc 100644
 --- a/drivers/mmc/host/mvsdio.c
 +++ b/drivers/mmc/host/mvsdio.c
 @@ -21,6 +21,8 @@
@@ -53,7 +70,7 @@ index baf19fc..56954bc 100644
  #include <linux/mmc/host.h>
  #include <linux/mmc/slot-gpio.h>
  
-@@ -683,17 +685,17 @@ mv_conf_mbus_windows(struct mvsd_host *host,
+@@ -681,17 +683,17 @@ mv_conf_mbus_windows(struct mvsd_host *h
  
  static int __init mvsd_probe(struct platform_device *pdev)
  {
@@ -73,19 +90,20 @@ index baf19fc..56954bc 100644
 +      if (!r || irq < 0)
                return -ENXIO;
  
-       r = request_mem_region(r->start, SZ_1K, DRIVER_NAME);
-@@ -710,7 +712,35 @@ static int __init mvsd_probe(struct platform_device *pdev)
+       mmc = mmc_alloc_host(sizeof(struct mvsd_host), &pdev->dev);
+@@ -703,8 +705,37 @@ static int __init mvsd_probe(struct plat
+       host = mmc_priv(mmc);
        host->mmc = mmc;
        host->dev = &pdev->dev;
-       host->res = r;
 -      host->base_clock = mvsd_data->clock / 2;
+-      host->clk = ERR_PTR(-EINVAL);
 +
 +      /* Some non-DT platforms do not pass a clock, and the clock
 +         frequency is passed through platform_data. On DT platforms,
 +         a clock must always be passed, even if there is no gatable
 +         clock associated to the SDIO interface (it can simply be a
 +         fixed rate clock). */
-+      host->clk = clk_get(&pdev->dev, NULL);
++      host->clk = devm_clk_get(&pdev->dev, NULL);
 +      if (!IS_ERR(host->clk))
 +              clk_prepare_enable(host->clk);
 +
@@ -102,8 +120,10 @@ index baf19fc..56954bc 100644
 +      } else {
 +              const struct mvsdio_platform_data *mvsd_data;
 +              mvsd_data = pdev->dev.platform_data;
-+              if (!mvsd_data)
-+                      return -ENXIO;
++              if (!mvsd_data) {
++                      ret = -ENXIO;
++                      goto out;
++              }
 +              host->base_clock = mvsd_data->clock / 2;
 +              gpio_card_detect = mvsd_data->gpio_card_detect;
 +              gpio_write_protect = mvsd_data->gpio_write_protect;
@@ -111,16 +131,15 @@ index baf19fc..56954bc 100644
  
        mmc->ops = &mvsd_ops;
  
-@@ -750,21 +780,14 @@ static int __init mvsd_probe(struct platform_device *pdev)
-       } else
-               host->irq = irq;
+@@ -743,20 +774,14 @@ static int __init mvsd_probe(struct plat
+               goto out;
+       }
  
 -      /* Not all platforms can gate the clock, so it is not
 -         an error if the clock does not exists. */
--      host->clk = clk_get(&pdev->dev, NULL);
--      if (!IS_ERR(host->clk)) {
+-      host->clk = devm_clk_get(&pdev->dev, NULL);
+-      if (!IS_ERR(host->clk))
 -              clk_prepare_enable(host->clk);
--      }
 -
 -      if (gpio_is_valid(mvsd_data->gpio_card_detect)) {
 -              ret = mmc_gpio_request_cd(mmc, mvsd_data->gpio_card_detect);
@@ -136,7 +155,7 @@ index baf19fc..56954bc 100644
  
        setup_timer(&host->timer, mvsd_timeout_timer, (unsigned long)host);
        platform_set_drvdata(pdev, mmc);
-@@ -776,7 +799,7 @@ static int __init mvsd_probe(struct platform_device *pdev)
+@@ -768,7 +793,7 @@ static int __init mvsd_probe(struct plat
                           mmc_hostname(mmc), DRIVER_NAME);
        if (!(mmc->caps & MMC_CAP_NEEDS_POLL))
                printk("using GPIO %d for card detection\n",
@@ -145,7 +164,7 @@ index baf19fc..56954bc 100644
        else
                printk("lacking card detect (fall back to polling)\n");
        return 0;
-@@ -855,12 +878,19 @@ static int mvsd_resume(struct platform_device *dev)
+@@ -832,12 +857,19 @@ static int mvsd_resume(struct platform_d
  #define mvsd_resume   NULL
  #endif
  
@@ -165,5 +184,3 @@ index baf19fc..56954bc 100644
        },
  };
  
--- 
-1.7.9.5