mmc: mmci: Improve DT support
Subsystems (6)
v2 cover mmc: mmci: Improve DT support
Step by step, improve the DT support for the mmci host driver.
This enables us to move the final pieces of platform data for mmci for ux500 into DT. We are then able to remove yet another machine specific file for ux500.
This patchset needs to be merged together. I suggest we go through Russell's ARM tree, since most of the patches are mmci specific which he maintains - unless someone think there is a better alternative.
I will thus seek acks from the SOC maintainers for the SOC specific patches.
The goal is to queue this for 3.16, thus I might need to rebase the patches for 3.15 rc[n]. Still I would appreciate any comments at this point.
Changes in v2:
- Adopting to review comments from Rob Herring and Linus Walleij. More or less causing each an every patch to be rebased.
- Removed the patch for regulator for the db8500-prcmu from this patchset, since Mark Brown already queued it for 3.15.
Ulf Hansson (19):
mmc: mmci: Convert to the mmc gpio API
mmc: mmci: Convert to devm functions
mmc: mmci: Update DT documentation
mmc: mmci: Add DT bindings for signal direction
mmc: mmci: Add DT bindings for feedback clock pin
mmc: mmci: Use the common mmc DT parser
ARM: ux500: Add mmci signal directions and feeback clock in DT for
href
ARM: ux500: Convert to the common mmc DT bindings for highspeed mode
ARM: nomadik: Convert to the common mmc DT bindings for highspeed
mode
ARM: u300: Convert to the common mmc DT bindings for highspeed mode
mmc: mmci: Mark the DT bindings for highspeed mode as deprecated
mmc: mmci: Enable MMC_CAP_CMD23
ARM: ux500: Add the mmc capabilities flags to DT
ARM: ux500: Add a vmmc regulator through DT for the poped eMMC for
href
ARM: ux500: Remove redundant board file for mmci platform data
mmc: mmci: Enforce DT for signal direction and feedback clock
mmc: mmci: Enforce mmc capabilities through DT
mmc: mmci: Enforce DMA configuration through DT
mmc: mmci: Enforce max frequency configuration through DT
Documentation/devicetree/bindings/mmc/mmci.txt | 54 ++++- arch/arm/boot/dts/ste-ccu9540.dts | 6 +- arch/arm/boot/dts/ste-href.dtsi | 19 +- arch/arm/boot/dts/ste-nomadik-stn8815.dtsi | 4 +- arch/arm/boot/dts/ste-snowball.dts | 4 +- arch/arm/boot/dts/ste-u300.dts | 4 +- arch/arm/mach-ux500/Makefile | 3 +- arch/arm/mach-ux500/board-mop500-sdi.c | 166 --------------- arch/arm/mach-ux500/board-mop500.h | 5 - arch/arm/mach-ux500/cpu-db8500.c | 4 - drivers/mmc/host/mmci.c | 265 +++++++----------------- drivers/mmc/host/mmci.h | 14 +- include/linux/amba/mmci.h | 42 ---- 13 files changed, 157 insertions(+), 433 deletions(-) delete mode 100644 arch/arm/mach-ux500/board-mop500-sdi.c
Signature · 1 line
1.7.9.5
PATCH v2 1/19 mmc: mmci: Convert to the mmc gpio API
To avoid duplication of code while handling card detect and write protect GPIO pins/irqs, let's convert to use the mmc gpio API.
--- drivers/mmc/host/mmci.c | 97 ++++++++--------------------------------------- drivers/mmc/host/mmci.h | 3 -- 2 files changed, 15 insertions(+), 85 deletions(-)
drivers/mmc/host/mmci.c +15 -82
@@ -23,6 +23,7 @@#include <linux/mmc/pm.h> #include <linux/mmc/host.h> #include <linux/mmc/card.h> +#include <linux/mmc/slot-gpio.h> #include <linux/amba/bus.h> #include <linux/clk.h> #include <linux/scatterlist.h>
@@ -1326,35 +1327,18 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)pm_runtime_put_autosuspend (mmc_dev (mmc)); } -static int mmci_get_ro (struct mmc_host *mmc) -{ -struct mmci_host *host =mmc_priv (mmc); - -if (host->gpio_wp == -ENOSYS ) -return -ENOSYS ; - -return gpio_get_value_cansleep (host->gpio_wp); -} -static int mmci_get_cd (struct mmc_host *mmc) {struct mmci_host *host =mmc_priv (mmc);struct mmci_platform_data *plat = host->plat; -unsigned int status; +unsigned int status =mmc_gpio_get_cd (mmc); -if (host->gpio_cd == -ENOSYS ) { +if (status == -ENOSYS ) {if (!plat->status)return 1 ;/* Assume always present */ status = plat->status (mmc_dev (host->mmc)); - }else - status = !!gpio_get_value_cansleep (host->gpio_cd) - ^ plat->cd_invert; - -/* -* Use positive logic throughout - status is zero for no card, -* non-zero for card inserted. -*/ + }return status; }
@@ -1391,21 +1375,12 @@ static int mmci_sig_volt_switch(struct mmc_host *mmc, struct mmc_ios *ios)return ret; } -static irqreturn_t mmci_cd_irq (int irq,void *dev_id) -{ -struct mmci_host *host = dev_id; - -mmc_detect_change (host->mmc,msecs_to_jiffies (500 )); - -return IRQ_HANDLED ; -} -static struct mmc_host_ops mmci_ops = { .request = mmci_request, .pre_req = mmci_pre_request, .post_req = mmci_post_request, .set_ios = mmci_set_ios, - .get_ro = mmci_get_ro, + .get_ro = mmc_gpio_get_ro, .get_cd = mmci_get_cd, .start_signal_voltage_switch = mmci_sig_volt_switch, };
@@ -1494,10 +1469,6 @@ static int mmci_probe(struct amba_device *dev, host =mmc_priv (mmc); host->mmc = mmc; - host->gpio_wp = -ENOSYS ; - host->gpio_cd = -ENOSYS ; - host->gpio_cd_irq =-1 ; - host->hw_designer =amba_manf (dev); host->hw_revision =amba_rev (dev);dev_dbg (mmc_dev (mmc),"designer ID = 0x%02x\n" , host->hw_designer);
@@ -1568,6 +1539,9 @@ static int mmci_probe(struct amba_device *dev, mmc->caps = plat->capabilities; mmc->caps2 = plat->capabilities2; +if (!plat->cd_invert) + mmc->caps2 |=MMC_CAP2_CD_ACTIVE_HIGH ; + mmc->caps2 |=MMC_CAP2_RO_ACTIVE_HIGH ;if (variant->busy_detect) { mmci_ops.card_busy = mmci_card_busy;
@@ -1621,49 +1595,23 @@ static int mmci_probe(struct amba_device *dev, goto err_gpio_cd; }if (gpio_is_valid (plat->gpio_cd)) { - ret =gpio_request (plat->gpio_cd,DRIVER_NAME " (cd)" ); -if (ret ==0 ) - ret =gpio_direction_input (plat->gpio_cd); -if (ret ==0 ) - host->gpio_cd = plat->gpio_cd; -else if (ret != -ENOSYS ) + ret =mmc_gpio_request_cd (mmc, plat->gpio_cd,0 ); +if (ret) goto err_gpio_cd; - -/* -* A gpio pin that will detect cards when inserted and removed -* will most likely want to trigger on the edges if it is -* 0 when ejected and 1 when inserted (or mutatis mutandis -* for the inverted case) so we request triggers on both -* edges. -*/ - ret =request_any_context_irq (gpio_to_irq (plat->gpio_cd), - mmci_cd_irq, -IRQF_TRIGGER_RISING |IRQF_TRIGGER_FALLING , -DRIVER_NAME " (cd)" , host); -if (ret >=0 ) - host->gpio_cd_irq =gpio_to_irq (plat->gpio_cd); }if (plat->gpio_wp == -EPROBE_DEFER ) { ret = -EPROBE_DEFER ; - goto err_gpio_wp; + goto err_gpio_cd; }if (gpio_is_valid (plat->gpio_wp)) { - ret =gpio_request (plat->gpio_wp,DRIVER_NAME " (wp)" ); -if (ret ==0 ) - ret =gpio_direction_input (plat->gpio_wp); -if (ret ==0 ) - host->gpio_wp = plat->gpio_wp; -else if (ret != -ENOSYS ) - goto err_gpio_wp; + ret =mmc_gpio_request_ro (mmc, plat->gpio_wp); +if (ret) + goto err_gpio_cd; } -if ((host->plat->status || host->gpio_cd != -ENOSYS ) - && host->gpio_cd_irq <0 ) - mmc->caps |=MMC_CAP_NEEDS_POLL ; - ret =request_irq (dev->irq[0 ], mmci_irq,IRQF_SHARED ,DRIVER_NAME " (cmd)" , host);if (ret) - goto unmap; + goto err_gpio_cd;if (!dev->irq[1 ]) host->singleirq = true;
@@ -1695,14 +1643,6 @@ static int mmci_probe(struct amba_device *dev, irq0_free:free_irq (dev->irq[0 ], host); - unmap: -if (host->gpio_wp != -ENOSYS ) -gpio_free (host->gpio_wp); - err_gpio_wp: -if (host->gpio_cd_irq >=0 ) -free_irq (host->gpio_cd_irq, host); -if (host->gpio_cd != -ENOSYS ) -gpio_free (host->gpio_cd); err_gpio_cd:iounmap (host->base); clk_disable:
@@ -1741,13 +1681,6 @@ static int mmci_remove(struct amba_device *dev)if (!host->singleirq)free_irq (dev->irq[1 ], host); -if (host->gpio_wp != -ENOSYS ) -gpio_free (host->gpio_wp); -if (host->gpio_cd_irq >=0 ) -free_irq (host->gpio_cd_irq, host); -if (host->gpio_cd != -ENOSYS ) -gpio_free (host->gpio_cd); -iounmap (host->base);clk_disable_unprepare (host->clk);
drivers/mmc/host/mmci.h +0 -3
@@ -176,9 +176,6 @@ struct mmci_host {struct mmc_data *data;struct mmc_host *mmc;struct clk *clk; -int gpio_cd; -int gpio_wp; -int gpio_cd_irq;bool singleirq;spinlock_t lock;
Signature · 1 line
1.7.9.5
PATCH v2 2/19 mmc: mmci: Convert to devm functions
In reply to Ulf HanssonConverting to devm functions to simplify error handling in ->probe() and to cleanup ->remove().
--- drivers/mmc/host/mmci.c | 51 ++++++++++++++++++----------------------------- 1 file changed, 19 insertions(+), 32 deletions(-)
drivers/mmc/host/mmci.c +19 -32
@@ -13,6 +13,7 @@#include <linux/init.h> #include <linux/ioport.h> #include <linux/device.h> +#include <linux/io.h> #include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/slab.h>
@@ -1456,15 +1457,13 @@ static int mmci_probe(struct amba_device *dev,if (np)mmci_dt_populate_generic_pdata (np, plat); - ret =amba_request_regions (dev,DRIVER_NAME ); -if (ret) - goto out; +if (!devm_request_mem_region (&dev->dev, dev->res.start, +resource_size (&dev->res),DRIVER_NAME )) +return -ENOMEM ; mmc =mmc_alloc_host (sizeof (struct mmci_host ), &dev->dev); -if (!mmc) { - ret = -ENOMEM ; - goto rel_regions; - } +if (!mmc) +return -ENOMEM ; host =mmc_priv (mmc); host->mmc = mmc;
@@ -1500,8 +1499,10 @@ static int mmci_probe(struct amba_device *dev,dev_dbg (mmc_dev (mmc),"eventual mclk rate: %u Hz\n" , host->mclk); } + host->phybase = dev->res.start; - host->base =ioremap (dev->res.start,resource_size (&dev->res)); + host->base =devm_ioremap (&dev->dev, host->phybase, +resource_size (&dev->res));if (!host->base) { ret = -ENOMEM ; goto clk_disable;
@@ -1592,34 +1593,35 @@ static int mmci_probe(struct amba_device *dev,if (plat->gpio_cd == -EPROBE_DEFER ) { ret = -EPROBE_DEFER ; - goto err_gpio_cd; + goto clk_disable; }if (gpio_is_valid (plat->gpio_cd)) { ret =mmc_gpio_request_cd (mmc, plat->gpio_cd,0 );if (ret) - goto err_gpio_cd; + goto clk_disable; }if (plat->gpio_wp == -EPROBE_DEFER ) { ret = -EPROBE_DEFER ; - goto err_gpio_cd; + goto clk_disable; }if (gpio_is_valid (plat->gpio_wp)) { ret =mmc_gpio_request_ro (mmc, plat->gpio_wp);if (ret) - goto err_gpio_cd; + goto clk_disable; } - ret =request_irq (dev->irq[0 ], mmci_irq,IRQF_SHARED ,DRIVER_NAME " (cmd)" , host); + ret =devm_request_irq (&dev->dev, dev->irq[0 ], mmci_irq,IRQF_SHARED , +DRIVER_NAME " (cmd)" , host);if (ret) - goto err_gpio_cd; + goto clk_disable;if (!dev->irq[1 ]) host->singleirq = true;else { - ret =request_irq (dev->irq[1 ], mmci_pio_irq,IRQF_SHARED , -DRIVER_NAME " (pio)" , host); + ret =devm_request_irq (&dev->dev, dev->irq[1 ], mmci_pio_irq, +IRQF_SHARED ,DRIVER_NAME " (pio)" , host);if (ret) - goto irq0_free; + goto clk_disable; }writel (MCI_IRQENABLE , host->base +MMCIMASK0 );
@@ -1641,17 +1643,10 @@ static int mmci_probe(struct amba_device *dev,return 0 ; - irq0_free: -free_irq (dev->irq[0 ], host); - err_gpio_cd: -iounmap (host->base); clk_disable:clk_disable_unprepare (host->clk); host_free:mmc_free_host (mmc); - rel_regions: -amba_release_regions (dev); - out:return ret; }
@@ -1677,16 +1672,8 @@ static int mmci_remove(struct amba_device *dev)writel (0 , host->base +MMCIDATACTRL );mmci_dma_release (host); -free_irq (dev->irq[0 ], host); -if (!host->singleirq) -free_irq (dev->irq[1 ], host); - -iounmap (host->base);clk_disable_unprepare (host->clk); -mmc_free_host (mmc); - -amba_release_regions (dev); }return 0 ;
Signature · 1 line
1.7.9.5
PATCH v2 2/19 mmc: mmci: Convert to devm functions
Quoted 21 lines · Ulf Hansson
Converting to devm functions to simplify error handling in ->probe() and to cleanup ->remove().
Signed-off-by Ulf Hansson <[email protected]>--- drivers/mmc/host/mmci.c | 51 ++++++++++++++++++----------------------------- 1 file changed, 19 insertions(+), 32 deletions(-)drivers/mmc/host/mmci.c +1
-0@@ -13,6 +13,7 @@#include <linux/init.h> #include <linux/ioport.h> #include <linux/device.h> +#include <linux/io.h> #include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/slab.h>
drivers/mmc/host/mmci.c static int mmci_probe(struct amba_device *dev, · line 1462
Quoted 9 lines
drivers/mmc/host/mmci.c +3
-3@@ -1456,15 +1457,13 @@ static int mmci_probe(struct amba_device *dev,if (np)mmci_dt_populate_generic_pdata (np, plat); - ret =amba_request_regions (dev,DRIVER_NAME ); -if (ret) - goto out; +if (!devm_request_mem_region (&dev->dev, dev->res.start, +resource_size (&dev->res),DRIVER_NAME )) +return -ENOMEM ;
here. Look below.
Quoted 12 lines
drivers/mmc/host/mmci.c +2
-4mmc =mmc_alloc_host (sizeof (struct mmci_host ), &dev->dev); -if (!mmc) { - ret = -ENOMEM ; - goto rel_regions; - } +if (!mmc) +return -ENOMEM ; host =mmc_priv (mmc); host->mmc = mmc;
drivers/mmc/host/mmci.c static int mmci_probe(struct amba_device *dev, · line 1505
Quoted 8 lines
drivers/mmc/host/mmci.c +3
-1@@ -1500,8 +1499,10 @@ static int mmci_probe(struct amba_device *dev,dev_dbg (mmc_dev (mmc),"eventual mclk rate: %u Hz\n" , host->mclk); } + host->phybase = dev->res.start; - host->base =ioremap (dev->res.start,resource_size (&dev->res)); + host->base =devm_ioremap (&dev->dev, host->phybase, +resource_size (&dev->res));
Isn't it better to use devm_ioremap_resource directly? You will get correct error return values too.
Thanks,
Michal
Signature · 14 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 263 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140404/45aa4b2b/attachment.sig>
PATCH v2 2/19 mmc: mmci: Convert to devm functions
Quoted 43 lines · Michal Simek
Quoted 21 lines · Ulf Hansson
Converting to devm functions to simplify error handling in ->probe() and to cleanup ->remove().
Signed-off-by Ulf Hansson <[email protected]>--- drivers/mmc/host/mmci.c | 51 ++++++++++++++++++----------------------------- 1 file changed, 19 insertions(+), 32 deletions(-)drivers/mmc/host/mmci.c +1
-0@@ -13,6 +13,7 @@#include <linux/init.h> #include <linux/ioport.h> #include <linux/device.h> +#include <linux/io.h> #include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/slab.h> drivers/mmc/host/mmci.c static int mmci_probe(struct amba_device *dev, · line 1462
Quoted 9 lines
drivers/mmc/host/mmci.c +3
-3@@ -1456,15 +1457,13 @@ static int mmci_probe(struct amba_device *dev,if (np)mmci_dt_populate_generic_pdata (np, plat); - ret =amba_request_regions (dev,DRIVER_NAME ); -if (ret) - goto out; +if (!devm_request_mem_region (&dev->dev, dev->res.start, +resource_size (&dev->res),DRIVER_NAME )) +return -ENOMEM ;here. Look below.
Quoted 9 lines
drivers/mmc/host/mmci.c +2
-4mmc =mmc_alloc_host (sizeof (struct mmci_host ), &dev->dev); -if (!mmc) { - ret = -ENOMEM ; - goto rel_regions; - } +if (!mmc) +return -ENOMEM ;
Quoted 12 lines
drivers/mmc/host/mmci.c static int mmci_probe(struct amba_device *dev, · line 1505
Quoted 11 lines
drivers/mmc/host/mmci.c +3
-1host =mmc_priv (mmc); host->mmc = mmc;@@ -1500,8 +1499,10 @@ static int mmci_probe(struct amba_device *dev,dev_dbg (mmc_dev (mmc),"eventual mclk rate: %u Hz\n" , host->mclk); } + host->phybase = dev->res.start; - host->base =ioremap (dev->res.start,resource_size (&dev->res)); + host->base =devm_ioremap (&dev->dev, host->phybase, +resource_size (&dev->res));
Hi Michal,
Appreciate your review - you are right! I will convert to devm_ioremap_resource().
Kind regards
Ulf Hansson
Quoted 15 lines
Isn't it better to use
devm_ioremap_resourcedirectly? You will get correct error return values too.Thanks,
Michal--
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
PATCH v2 3/19 mmc: mmci: Update DT documentation
In reply to Ulf HanssonDocument how to configure the regulator supplies and add an example of a typical mmci DT node.
--- Documentation/devicetree/bindings/mmc/mmci.txt | 39 ++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/mmc/mmci.txt +36 -3
@@ -8,8 +8,41 @@ by mmc.txt and the properties used by the mmci driver. Required properties: - compatible : contains "arm,pl18x", "arm,primecell". -- arm,primecell-periphid : contains the PrimeCell Peripheral ID. +- vmmc-supply : phandle to the regulator device tree node, mentioned + as the VCC/VDD supply in the eMMC/SD specs. Optional properties: -- mmc-cap-mmc-highspeed : indicates whether MMC is high speed capable -- mmc-cap-sd-highspeed : indicates whether SD is high speed capable +- arm,primecell-periphid : contains the PrimeCell Peripheral ID, it overrides + the ID provided by the HW +- mmc-cap-mmc-highspeed : indicates whether MMC is high speed capable. +- mmc-cap-sd-highspeed : indicates whether SD is high speed capable. +- vqmmc-supply : phandle to the regulator device tree node, mentioned + as the VCCQ/VDD_IO supply in the eMMC/SD specs. + +Example: + +sdi0_per1 at 80126000 { + compatible = "arm,pl18x", "arm,primecell"; + reg = <0x80126000 0x1000>; + interrupts = <0 60 IRQ_TYPE_LEVEL_HIGH>; + + dmas = <&dma 29 0 0x2>, /* Logical - DevToMem */ + <&dma 29 0 0x0>; /* Logical - MemToDev */ + dma-names = "rx", "tx"; + + clocks = <&prcc_kclk 1 5>, <&prcc_pclk 1 5>; + clock-names = "sdi", "apb_pclk"; + + max-frequency = <100000000>; + bus-width = <4>; + mmc-cap-sd-highspeed; + mmc-cap-mmc-highspeed; + cd-gpios = <&gpio2 31 0x4>; // 95 + + vmmc-supply = <&ab8500_ldo_aux3_reg>; + vqmmc-supply = <&vmmci>; + + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&sdi0_default_mode>; + pinctrl-1 = <&sdi0_sleep_mode>; +};
Signature · 1 line
1.7.9.5
PATCH v2 4/19 mmc: mmci: Add DT bindings for signal direction
In reply to Ulf HanssonSome variants have support for indicating the bus signal directions, which currently are configured through platform data.
Add corresponding DT bindings to enable us to move away from using the platform data.
--- Documentation/devicetree/bindings/mmc/mmci.txt | 11 ++++++++++- drivers/mmc/host/mmci.c | 11 +++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/mmc/mmci.txt +10 -1
@@ -4,7 +4,8 @@ The ARM PrimeCell MMCI PL180 and PL181 provides an interface for reading and writing to MultiMedia and SD cards alike. This file documents differences between the core properties described -by mmc.txt and the properties used by the mmci driver. +by mmc.txt and the properties used by the mmci driver. Using "st" as +the prefix for a property, indicates support by the ST Micro variant. Required properties: - compatible : contains "arm,pl18x", "arm,primecell".
@@ -18,6 +19,11 @@ Optional properties: - mmc-cap-sd-highspeed : indicates whether SD is high speed capable. - vqmmc-supply : phandle to the regulator device tree node, mentioned as the VCCQ/VDD_IO supply in the eMMC/SD specs. +- st,sig-dir-dat0 : bus signal direction pin used for DAT[0]. +- st,sig-dir-dat2 : bus signal direction pin used for DAT[2]. +- st,sig-dir-dat31 : bus signal direction pin used for DAT[3] and DAT[1]. +- st,sig-dir-dat74 : bus signal direction pin used for DAT[4] to DAT[7]. +- st,sig-dir-cmd : cmd signal direction pin used for CMD. Example:
@@ -38,6 +44,9 @@ sdi0_per1 at 80126000 { mmc-cap-sd-highspeed; mmc-cap-mmc-highspeed; cd-gpios = <&gpio2 31 0x4>; // 95 + st,sig-dir-dat0; + st,sig-dir-dat2; + st,sig-dir-cmd; vmmc-supply = <&ab8500_ldo_aux3_reg>; vqmmc-supply = <&vmmci>;
drivers/mmc/host/mmci.c +11 -0
@@ -1392,6 +1392,17 @@ static void mmci_dt_populate_generic_pdata(struct device_node *np, {int bus_width =0 ; +if (of_get_property (np,"st,sig-dir-dat0" ,NULL )) + pdata->sigdir |=MCI_ST_DATA0DIREN ; +if (of_get_property (np,"st,sig-dir-dat2" ,NULL )) + pdata->sigdir |=MCI_ST_DATA2DIREN ; +if (of_get_property (np,"st,sig-dir-dat31" ,NULL )) + pdata->sigdir |=MCI_ST_DATA31DIREN ; +if (of_get_property (np,"st,sig-dir-dat74" ,NULL )) + pdata->sigdir |=MCI_ST_DATA74DIREN ; +if (of_get_property (np,"st,sig-dir-cmd" ,NULL )) + pdata->sigdir |=MCI_ST_CMDDIREN ; + pdata->gpio_wp =of_get_named_gpio (np,"wp-gpios" ,0 ); pdata->gpio_cd =of_get_named_gpio (np,"cd-gpios" ,0 );
Signature · 1 line
1.7.9.5
PATCH v2 4/19 mmc: mmci: Add DT bindings for signal direction
Quoted 7 lines · Ulf Hansson
Some variants have support for indicating the bus signal directions, which currently are configured through platform data.
Add corresponding DT bindings to enable us to move away from using the platform data.
Signed-off-by Ulf Hansson <[email protected]>
Yours,
Linus Walleij
PATCH v2 4/19 mmc: mmci: Add DT bindings for signal direction
In reply to Ulf HanssonQuoted 27 lines · Ulf Hansson
Some variants have support for indicating the bus signal directions, which currently are configured through platform data.
Add corresponding DT bindings to enable us to move away from using the platform data.
Signed-off-by Ulf Hansson <[email protected]>--- Documentation/devicetree/bindings/mmc/mmci.txt | 11 ++++++++++- drivers/mmc/host/mmci.c | 11 +++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/mmc/mmci.txt +2
-1@@ -4,7 +4,8 @@ The ARM PrimeCell MMCI PL180 and PL181 provides an interface for reading and writing to MultiMedia and SD cards alike. This file documents differences between the core properties described -by mmc.txt and the properties used by the mmci driver. +by mmc.txt and the properties used by the mmci driver. Using "st" as +the prefix for a property, indicates support by the ST Micro variant. Required properties: - compatible : contains "arm,pl18x", "arm,primecell".
Documentation/devicetree/bindings/mmc/mmci.txt Optional properties: · line 26
Quoted 8 lines
Documentation/devicetree/bindings/mmc/mmci.txt +5
-0@@ -18,6 +19,11 @@ Optional properties: - mmc-cap-sd-highspeed : indicates whether SD is high speed capable. - vqmmc-supply : phandle to the regulator device tree node, mentioned as the VCCQ/VDD_IO supply in the eMMC/SD specs. +- st,sig-dir-dat0 : bus signal direction pin used for DAT[0]. +- st,sig-dir-dat2 : bus signal direction pin used for DAT[2]. +- st,sig-dir-dat31 : bus signal direction pin used for DAT[3] and DAT[1]. +- st,sig-dir-dat74 : bus signal direction pin used for DAT[4] to DAT[7]. +- st,sig-dir-cmd : cmd signal direction pin used for CMD.
What I'm still not clear on is when you set these properties and when you don't. For example, is any combination valid and why wouldn't all data signals be configured the same way?
Rob
PATCH v2 4/19 mmc: mmci: Add DT bindings for signal direction
Quoted 25 lines · Rob Herring
Quoted 24 lines · Ulf Hansson
Some variants have support for indicating the bus signal directions, which currently are configured through platform data.
Add corresponding DT bindings to enable us to move away from using the platform data.
Signed-off-by Ulf Hansson <[email protected]>--- Documentation/devicetree/bindings/mmc/mmci.txt | 11 ++++++++++- drivers/mmc/host/mmci.c | 11 +++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/mmc/mmci.txt +2
-1@@ -4,7 +4,8 @@ The ARM PrimeCell MMCI PL180 and PL181 provides an interface for reading and writing to MultiMedia and SD cards alike. This file documents differences between the core properties described -by mmc.txt and the properties used by the mmci driver. +by mmc.txt and the properties used by the mmci driver. Using "st" as +the prefix for a property, indicates support by the ST Micro variant.
Quoted 15 lines
Documentation/devicetree/bindings/mmc/mmci.txt Optional properties: · line 26
Quoted 11 lines
Documentation/devicetree/bindings/mmc/mmci.txt +5
-0Required properties: - compatible : contains "arm,pl18x", "arm,primecell".@@ -18,6 +19,11 @@ Optional properties: - mmc-cap-sd-highspeed : indicates whether SD is high speed capable. - vqmmc-supply : phandle to the regulator device tree node, mentioned as the VCCQ/VDD_IO supply in the eMMC/SD specs. +- st,sig-dir-dat0 : bus signal direction pin used for DAT[0]. +- st,sig-dir-dat2 : bus signal direction pin used for DAT[2]. +- st,sig-dir-dat31 : bus signal direction pin used for DAT[3] and DAT[1]. +- st,sig-dir-dat74 : bus signal direction pin used for DAT[4] to DAT[7]. +- st,sig-dir-cmd : cmd signal direction pin used for CMD.What I'm still not clear on is when you set these properties and when you don't. For example, is any combination valid and why wouldn't all data signals be configured the same way?
Several combinations are possible.
This is a matter of configuring the internal logic of the primecell to which signals it shall use. That will be depending on what signal connectors there are available on the external voltage level shifter circuit and how you have routed these to the primecell.
The signals are used to introduce a delta delay between the external level shifter drive enable and internal IO drive enable. It's needed to be able to cope with the electrical parts of the SD card specification.
Hope this answers your questions. :-)
Kind regards
Ulf Hansson
Quoted 2 lines
Rob
PATCH v2 5/19 mmc: mmci: Add DT bindings for feedback clock pin
In reply to Ulf HanssonThe ST Micro variant supports the option of using a feedback clock signal in favor of the clockout pin when latching incoming signals on the data bus.
Since this is matter of how pins are being routed we need to provide a new DT binding to be able to configure this through DT.
--- Documentation/devicetree/bindings/mmc/mmci.txt | 2 ++ drivers/mmc/host/mmci.c | 2 ++ 2 files changed, 4 insertions(+)
Documentation/devicetree/bindings/mmc/mmci.txt +2 -0
@@ -24,6 +24,7 @@ Optional properties: - st,sig-dir-dat31 : bus signal direction pin used for DAT[3] and DAT[1]. - st,sig-dir-dat74 : bus signal direction pin used for DAT[4] to DAT[7]. - st,sig-dir-cmd : cmd signal direction pin used for CMD. +- st,sig-pin-fbclk : feedback clock signal pin used. Example:
@@ -47,6 +48,7 @@ sdi0_per1 at 80126000 { st,sig-dir-dat0; st,sig-dir-dat2; st,sig-dir-cmd; + st,sig-pin-fbclk; vmmc-supply = <&ab8500_ldo_aux3_reg>; vqmmc-supply = <&vmmci>;
drivers/mmc/host/mmci.c +2 -0
@@ -1402,6 +1402,8 @@ static void mmci_dt_populate_generic_pdata(struct device_node *np, pdata->sigdir |=MCI_ST_DATA74DIREN ;if (of_get_property (np,"st,sig-dir-cmd" ,NULL )) pdata->sigdir |=MCI_ST_CMDDIREN ; +if (of_get_property (np,"st,sig-pin-fbclk" ,NULL )) + pdata->sigdir |=MCI_ST_FBCLKEN ; pdata->gpio_wp =of_get_named_gpio (np,"wp-gpios" ,0 ); pdata->gpio_cd =of_get_named_gpio (np,"cd-gpios" ,0 );
Signature · 1 line
1.7.9.5
PATCH v2 5/19 mmc: mmci: Add DT bindings for feedback clock pin
Quoted 7 lines · Ulf Hansson
The ST Micro variant supports the option of using a feedback clock signal in favor of the clockout pin when latching incoming signals on the data bus.
Since this is matter of how pins are being routed we need to provide a new DT binding to be able to configure this through DT.
Signed-off-by Ulf Hansson <[email protected]>
Yours,
Linus Walleij
PATCH v2 6/19 mmc: mmci: Use the common mmc DT parser
In reply to Ulf HanssonLet mmci DT parser only handle the specific bindings related to mmci and extend the DT support by converting to the common mmc DT parser.
While both DT and platform data exist, DT takes precedence. If there are supplied DT data, the card detect and write protect GPIOS are enforced to be provided through it.
--- drivers/mmc/host/mmci.c | 92 +++++++++++++++++------------------------------ 1 file changed, 33 insertions(+), 59 deletions(-)
drivers/mmc/host/mmci.c +33 -59
@@ -1386,12 +1386,9 @@ static struct mmc_host_ops mmci_ops = { .start_signal_voltage_switch = mmci_sig_volt_switch, }; -#ifdef CONFIG_OF static void mmci_dt_populate_generic_pdata (struct device_node *np,struct mmci_platform_data *pdata) { -int bus_width =0 ; -if (of_get_property (np,"st,sig-dir-dat0" ,NULL )) pdata->sigdir |=MCI_ST_DATA0DIREN ;if (of_get_property (np,"st,sig-dir-dat2" ,NULL ))
@@ -1404,46 +1401,22 @@ static void mmci_dt_populate_generic_pdata(struct device_node *np, pdata->sigdir |=MCI_ST_CMDDIREN ;if (of_get_property (np,"st,sig-pin-fbclk" ,NULL )) pdata->sigdir |=MCI_ST_FBCLKEN ; +} - pdata->gpio_wp =of_get_named_gpio (np,"wp-gpios" ,0 ); - pdata->gpio_cd =of_get_named_gpio (np,"cd-gpios" ,0 ); - -if (of_get_property (np,"cd-inverted" ,NULL )) - pdata->cd_invert = true; -else - pdata->cd_invert = false; +static int mmci_of_parse (struct device_node *np,struct mmc_host *mmc) +{ +int ret =mmc_of_parse (mmc); -of_property_read_u32 (np,"max-frequency" , &pdata->f_max); -if (!pdata->f_max) -pr_warn ("%s has no 'max-frequency' property\n" , np->full_name); +if (ret) +return ret;if (of_get_property (np,"mmc-cap-mmc-highspeed" ,NULL )) - pdata->capabilities |=MMC_CAP_MMC_HIGHSPEED ; + mmc->caps |=MMC_CAP_MMC_HIGHSPEED ;if (of_get_property (np,"mmc-cap-sd-highspeed" ,NULL )) - pdata->capabilities |=MMC_CAP_SD_HIGHSPEED ; + mmc->caps |=MMC_CAP_SD_HIGHSPEED ; -of_property_read_u32 (np,"bus-width" , &bus_width); -switch (bus_width) { -case 0 : -/* No bus-width supplied. */ -break ; -case 4 : - pdata->capabilities |=MMC_CAP_4_BIT_DATA ; -break ; -case 8 : - pdata->capabilities |=MMC_CAP_8_BIT_DATA ; -break ; -default : -pr_warn ("%s: Unsupported bus width\n" , np->full_name); - } -} -#else -static void mmci_dt_populate_generic_pdata (struct device_node *np, -struct mmci_platform_data *pdata) -{ -return ; +return 0 ; } -#endif static int mmci_probe (struct amba_device *dev,const struct amba_id *id)
@@ -1478,6 +1451,10 @@ static int mmci_probe(struct amba_device *dev,if (!mmc)return -ENOMEM ; + ret =mmci_of_parse (np, mmc); +if (ret) + goto host_free; + host =mmc_priv (mmc); host->mmc = mmc;
@@ -1531,14 +1508,15 @@ static int mmci_probe(struct amba_device *dev,else mmc->f_min =DIV_ROUND_UP (host->mclk,512 );/* -* If the platform data supplies a maximum operating -* frequency, this takes precedence. Else, we fall back -* to using the module parameter, which has a (low) -* default value in case it is not specified. Either -* value must not exceed the clock rate into the block, -* of course. +* If no maximum operating frequency is supplied, fall back to use +* the module parameter, which has a (low) default value in case it +* is not specified. Either value must not exceed the clock rate into +* the block, of course. Also note that DT takes precedence over +* platform data. */ -if (plat->f_max) +if (mmc->f_max) + mmc->f_max =min (host->mclk, mmc->f_max); +else if (plat->f_max) mmc->f_max =min (host->mclk, plat->f_max);else mmc->f_max =min (host->mclk, fmax);
@@ -1551,11 +1529,14 @@ static int mmci_probe(struct amba_device *dev,else if (plat->ocr_mask)dev_warn (mmc_dev (mmc),"Platform OCR mask is ignored\n" ); - mmc->caps = plat->capabilities; - mmc->caps2 = plat->capabilities2; -if (!plat->cd_invert) - mmc->caps2 |=MMC_CAP2_CD_ACTIVE_HIGH ; - mmc->caps2 |=MMC_CAP2_RO_ACTIVE_HIGH ; +/* DT takes precedence over platform data. */ + mmc->caps = np ? mmc->caps : plat->capabilities; + mmc->caps2 = np ? mmc->caps2 : plat->capabilities2; +if (!np) { +if (!plat->cd_invert) + mmc->caps2 |=MMC_CAP2_CD_ACTIVE_HIGH ; + mmc->caps2 |=MMC_CAP2_RO_ACTIVE_HIGH ; + }if (variant->busy_detect) { mmci_ops.card_busy = mmci_card_busy;
@@ -1567,7 +1548,7 @@ static int mmci_probe(struct amba_device *dev, mmc->ops = &mmci_ops;/* We support these PM capabilities. */ - mmc->pm_caps =MMC_PM_KEEP_POWER ; + mmc->pm_caps |=MMC_PM_KEEP_POWER ;/* * We can do SGIO
@@ -1604,20 +1585,13 @@ static int mmci_probe(struct amba_device *dev,writel (0 , host->base +MMCIMASK1 );writel (0xfff , host->base +MMCICLEAR ); -if (plat->gpio_cd == -EPROBE_DEFER ) { - ret = -EPROBE_DEFER ; - goto clk_disable; - } -if (gpio_is_valid (plat->gpio_cd)) { +/* If DT, cd/wp gpios must be supplied through it. */ +if (!np &&gpio_is_valid (plat->gpio_cd)) { ret =mmc_gpio_request_cd (mmc, plat->gpio_cd,0 );if (ret) goto clk_disable; } -if (plat->gpio_wp == -EPROBE_DEFER ) { - ret = -EPROBE_DEFER ; - goto clk_disable; - } -if (gpio_is_valid (plat->gpio_wp)) { +if (!np &&gpio_is_valid (plat->gpio_wp)) { ret =mmc_gpio_request_ro (mmc, plat->gpio_wp);if (ret) goto clk_disable;
Signature · 1 line
1.7.9.5
PATCH v2 7/19 ARM: ux500: Add mmci signal directions and feeback clock in DT for href
In reply to Ulf Hansson--- arch/arm/boot/dts/ste-href.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/boot/dts/ste-href.dtsi +4 -0
@@ -118,6 +118,10 @@ bus-width = <4>; mmc-cap-sd-highspeed; mmc-cap-mmc-highspeed; + st,sig-dir-dat0; + st,sig-dir-dat2; + st,sig-dir-cmd; + st,sig-pin-fbclk; vmmc-supply = <&ab8500_ldo_aux3_reg>; vqmmc-supply = <&vmmci>; pinctrl-names = "default", "sleep";
Signature · 1 line
1.7.9.5
PATCH v2 7/19 ARM: ux500: Add mmci signal directions and feeback clock in DT for href
Quoted 1 line · Ulf Hansson
Signed-off-by Ulf Hansson <[email protected]>
Yours,
Linus Walleij
PATCH v2 8/19 ARM: ux500: Convert to the common mmc DT bindings for highspeed mode
In reply to Ulf HanssonThe mmci host driver supports the common mmc DT parser, which enables us to use the use common names instead.
--- arch/arm/boot/dts/ste-ccu9540.dts | 6 +++--- arch/arm/boot/dts/ste-href.dtsi | 8 ++++---- arch/arm/boot/dts/ste-snowball.dts | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-)
arch/arm/boot/dts/ste-ccu9540.dts +3 -3
@@ -38,8 +38,8 @@ arm,primecell-periphid = <0x10480180>; max-frequency = <100000000>; bus-width = <4>; - mmc-cap-sd-highspeed; - mmc-cap-mmc-highspeed; + cap-sd-highspeed; + cap-mmc-highspeed; vmmc-supply = <&ab8500_ldo_aux3_reg>; cd-gpios = <&gpio7 6 0x4>; // 230
@@ -63,7 +63,7 @@ arm,primecell-periphid = <0x10480180>; max-frequency = <100000000>; bus-width = <8>; - mmc-cap-mmc-highspeed; + cap-mmc-highspeed; vmmc-supply = <&ab8500_ldo_aux2_reg>; status = "okay";
arch/arm/boot/dts/ste-href.dtsi +4 -4
@@ -116,8 +116,8 @@ arm,primecell-periphid = <0x10480180>; max-frequency = <100000000>; bus-width = <4>; - mmc-cap-sd-highspeed; - mmc-cap-mmc-highspeed; + cap-sd-highspeed; + cap-mmc-highspeed; st,sig-dir-dat0; st,sig-dir-dat2; st,sig-dir-cmd;
@@ -148,7 +148,7 @@ arm,primecell-periphid = <0x10480180>; max-frequency = <100000000>; bus-width = <8>; - mmc-cap-mmc-highspeed; + cap-mmc-highspeed; pinctrl-names = "default", "sleep"; pinctrl-0 = <&sdi2_default_mode>; pinctrl-1 = <&sdi2_sleep_mode>;
@@ -161,7 +161,7 @@ arm,primecell-periphid = <0x10480180>; max-frequency = <100000000>; bus-width = <8>; - mmc-cap-mmc-highspeed; + cap-mmc-highspeed; vmmc-supply = <&ab8500_ldo_aux2_reg>; pinctrl-names = "default", "sleep"; pinctrl-0 = <&sdi4_default_mode>;
arch/arm/boot/dts/ste-snowball.dts +2 -2
@@ -156,7 +156,7 @@ arm,primecell-periphid = <0x10480180>; max-frequency = <100000000>; bus-width = <4>; - mmc-cap-mmc-highspeed; + cap-mmc-highspeed; vmmc-supply = <&ab8500_ldo_aux3_reg>; vqmmc-supply = <&vmmci>; pinctrl-names = "default", "sleep";
@@ -195,7 +195,7 @@ arm,primecell-periphid = <0x10480180>; max-frequency = <100000000>; bus-width = <8>; - mmc-cap-mmc-highspeed; + cap-mmc-highspeed; vmmc-supply = <&ab8500_ldo_aux2_reg>; pinctrl-names = "default", "sleep"; pinctrl-0 = <&sdi4_default_mode>;
Signature · 1 line
1.7.9.5
PATCH v2 9/19 ARM: nomadik: Convert to the common mmc DT bindings for highspeed mode
In reply to Ulf HanssonThe mmci host driver supports the common mmc DT parser, which enables us to use the use common names instead.
--- arch/arm/boot/dts/ste-nomadik-stn8815.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/ste-nomadik-stn8815.dtsi +2 -2
@@ -840,8 +840,8 @@ interrupts = <22>; max-frequency = <48000000>; bus-width = <4>; - mmc-cap-mmc-highspeed; - mmc-cap-sd-highspeed; + cap-mmc-highspeed; + cap-sd-highspeed; cd-gpios = <&gpio3 15 0x1>; cd-inverted; pinctrl-names = "default";
Signature · 1 line
1.7.9.5
PATCH v2 10/19 ARM: u300: Convert to the common mmc DT bindings for highspeed mode
In reply to Ulf HanssonThe mmci host driver supports the common mmc DT parser, which enables us to use the use common names instead.
--- arch/arm/boot/dts/ste-u300.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/ste-u300.dts +2 -2
@@ -442,8 +442,8 @@ clock-names = "apb_pclk", "mclk"; max-frequency = <24000000>; bus-width = <4>; // SD-card slot - mmc-cap-mmc-highspeed; - mmc-cap-sd-highspeed; + cap-mmc-highspeed; + cap-sd-highspeed; cd-gpios = <&gpio 12 0x4>; cd-inverted; vmmc-supply = <&ab3100_ldo_g_reg>;
Signature · 1 line
1.7.9.5
PATCH v2 11/19 mmc: mmci: Mark the DT bindings for highspeed mode as deprecated
In reply to Ulf HanssonThe common mmc DT parser supports bindings for highspeed mode, thus there are no need for mmci to provide it's own versions for these. Mark them as deprecated in the documentation.
--- Documentation/devicetree/bindings/mmc/mmci.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
Documentation/devicetree/bindings/mmc/mmci.txt +6 -4
@@ -15,8 +15,6 @@ Required properties: Optional properties: - arm,primecell-periphid : contains the PrimeCell Peripheral ID, it overrides the ID provided by the HW -- mmc-cap-mmc-highspeed : indicates whether MMC is high speed capable. -- mmc-cap-sd-highspeed : indicates whether SD is high speed capable. - vqmmc-supply : phandle to the regulator device tree node, mentioned as the VCCQ/VDD_IO supply in the eMMC/SD specs. - st,sig-dir-dat0 : bus signal direction pin used for DAT[0].
@@ -26,6 +24,10 @@ Optional properties: - st,sig-dir-cmd : cmd signal direction pin used for CMD. - st,sig-pin-fbclk : feedback clock signal pin used. +Deprecated properties: +- mmc-cap-mmc-highspeed : indicates whether MMC is high speed capable. +- mmc-cap-sd-highspeed : indicates whether SD is high speed capable. + Example: sdi0_per1 at 80126000 {
@@ -42,8 +44,8 @@ sdi0_per1 at 80126000 { max-frequency = <100000000>; bus-width = <4>; - mmc-cap-sd-highspeed; - mmc-cap-mmc-highspeed; + cap-sd-highspeed; + cap-mmc-highspeed; cd-gpios = <&gpio2 31 0x4>; // 95 st,sig-dir-dat0; st,sig-dir-dat2;
Signature · 1 line
1.7.9.5
PATCH v2 11/19 mmc: mmci: Mark the DT bindings for highspeed mode as deprecated
Quoted 5 lines · Ulf Hansson
The common mmc DT parser supports bindings for highspeed mode, thus there are no need for mmci to provide it's own versions for these. Mark them as deprecated in the documentation.
Signed-off-by Ulf Hansson <[email protected]>
Yours,
Linus Walleij
PATCH v2 11/19 mmc: mmci: Mark the DT bindings for highspeed mode as deprecated
In reply to Ulf HanssonQuoted 5 lines · Ulf Hansson
The common mmc DT parser supports bindings for highspeed mode, thus there are no need for mmci to provide it's own versions for these. Mark them as deprecated in the documentation.
Signed-off-by Ulf Hansson <[email protected]>
PATCH v2 12/19 mmc: mmci: Enable MMC_CAP_CMD23
In reply to Ulf HanssonThis is pure software configuration, which mmci has been supporting for a while. Let's enable it as default so we can take benefit from it.
--- drivers/mmc/host/mmci.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mmc/host/mmci.c +3 -0
@@ -1538,6 +1538,9 @@ static int mmci_probe(struct amba_device *dev, mmc->caps2 |=MMC_CAP2_RO_ACTIVE_HIGH ; } +/* We support these capabilities. */ + mmc->caps |=MMC_CAP_CMD23 ; +if (variant->busy_detect) { mmci_ops.card_busy = mmci_card_busy;mmci_write_datactrlreg (host,MCI_ST_DPSM_BUSYMODE );
Signature · 1 line
1.7.9.5
PATCH v2 13/19 ARM: ux500: Add the mmc capabilities flags to DT
In reply to Ulf Hansson--- arch/arm/boot/dts/ste-href.dtsi | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/boot/dts/ste-href.dtsi +6 -0
@@ -118,6 +118,9 @@ bus-width = <4>; cap-sd-highspeed; cap-mmc-highspeed; + sd-uhs-sdr12; + sd-uhs-sdr25; + full-pwr-cycle; st,sig-dir-dat0; st,sig-dir-dat2; st,sig-dir-cmd;
@@ -136,6 +139,7 @@ arm,primecell-periphid = <0x10480180>; max-frequency = <100000000>; bus-width = <4>; + non-removable; pinctrl-names = "default", "sleep"; pinctrl-0 = <&sdi1_default_mode>; pinctrl-1 = <&sdi1_sleep_mode>;
@@ -149,6 +153,7 @@ max-frequency = <100000000>; bus-width = <8>; cap-mmc-highspeed; + non-removable; pinctrl-names = "default", "sleep"; pinctrl-0 = <&sdi2_default_mode>; pinctrl-1 = <&sdi2_sleep_mode>;
@@ -162,6 +167,7 @@ max-frequency = <100000000>; bus-width = <8>; cap-mmc-highspeed; + non-removable; vmmc-supply = <&ab8500_ldo_aux2_reg>; pinctrl-names = "default", "sleep"; pinctrl-0 = <&sdi4_default_mode>;
Signature · 1 line
1.7.9.5
PATCH v2 14/19 ARM: ux500: Add a vmmc regulator through DT for the poped eMMC for href
In reply to Ulf HanssonAdd a node in DT for the proper regulator which means we can move away from the mmci platform data which currently holds the corresponding OCR mask.
The mmci driver can then calculate the OCR mask based on the voltages supported by the regulator, instead of relying on the platform data.
--- arch/arm/boot/dts/ste-href.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/ste-href.dtsi +1 -0
@@ -154,6 +154,7 @@ bus-width = <8>; cap-mmc-highspeed; non-removable; + vmmc-supply = <&db8500_vsmps2_reg>; pinctrl-names = "default", "sleep"; pinctrl-0 = <&sdi2_default_mode>; pinctrl-1 = <&sdi2_sleep_mode>;
Signature · 1 line
1.7.9.5
PATCH v2 15/19 ARM: ux500: Remove redundant board file for mmci platform data
In reply to Ulf HanssonSince all platform data has been transfered to DT, we don't need the container for the mmci platform data anymore. Remove the file and the corresponding references to it's data.
--- arch/arm/mach-ux500/Makefile | 3 +- arch/arm/mach-ux500/board-mop500-sdi.c | 166 -------------------------------- arch/arm/mach-ux500/board-mop500.h | 5 - arch/arm/mach-ux500/cpu-db8500.c | 4 - 4 files changed, 1 insertion(+), 177 deletions(-) delete mode 100644 arch/arm/mach-ux500/board-mop500-sdi.c
arch/arm/mach-ux500/Makefile +1 -2
@@ -5,8 +5,7 @@ obj-y := cpu.o id.o timer.o pm.o obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o -obj-$(CONFIG_MACH_MOP500) += board-mop500-sdi.o \ - board-mop500-regulators.o \ +obj-$(CONFIG_MACH_MOP500) += board-mop500-regulators.o \ board-mop500-audio.o obj-$(CONFIG_SMP) += platsmp.o headsmp.o obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
arch/arm/mach-ux500/board-mop500-sdi.c deleted +0 -166
166 lines not on this page · raw message
arch/arm/mach-ux500/board-mop500.h +0 -5
@@ -8,12 +8,7 @@#define __BOARD_MOP500_H#include <linux/platform_data/asoc-ux500-msp.h> -#include <linux/amba/mmci.h> -extern struct mmci_platform_data mop500_sdi0_data; -extern struct mmci_platform_data mop500_sdi1_data; -extern struct mmci_platform_data mop500_sdi2_data; -extern struct mmci_platform_data mop500_sdi4_data;extern struct msp_i2s_platform_data msp0_platform_data;extern struct msp_i2s_platform_data msp1_platform_data;extern struct msp_i2s_platform_data msp2_platform_data;
arch/arm/mach-ux500/cpu-db8500.c +0 -4
@@ -146,10 +146,6 @@ static struct of_dev_auxdata u8500_auxdata_lookup[] __initdata = {/* Requires call-back bindings. */ OF_DEV_AUXDATA ("arm,cortex-a9-pmu" ,0 ,"arm-pmu" , &db8500_pmu_platdata),/* Requires DMA bindings. */ -OF_DEV_AUXDATA ("arm,pl18x" ,0x80126000 ,"sdi0" , &mop500_sdi0_data), -OF_DEV_AUXDATA ("arm,pl18x" ,0x80118000 ,"sdi1" , &mop500_sdi1_data), -OF_DEV_AUXDATA ("arm,pl18x" ,0x80005000 ,"sdi2" , &mop500_sdi2_data), -OF_DEV_AUXDATA ("arm,pl18x" ,0x80114000 ,"sdi4" , &mop500_sdi4_data),OF_DEV_AUXDATA ("stericsson,ux500-msp-i2s" ,0x80123000 ,"ux500-msp-i2s.0" , &msp0_platform_data), OF_DEV_AUXDATA("stericsson,ux500-msp-i2s", 0x80124000,
Signature · 1 line
1.7.9.5
PATCH v2 16/19 mmc: mmci: Enforce DT for signal direction and feedback clock
In reply to Ulf HanssonRemove the option to provide signal direction configuration and feeback clock as platform data, enforce it through DT.
--- drivers/mmc/host/mmci.c | 34 ++++++++++++++-------------------- drivers/mmc/host/mmci.h | 11 +++++++++++ include/linux/amba/mmci.h | 16 ---------------- 3 files changed, 25 insertions(+), 36 deletions(-)
drivers/mmc/host/mmci.c +14 -20
@@ -1287,7 +1287,7 @@ static void mmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)* indicating signal direction for the signals in * the SD/MMC bus and feedback-clock usage. */ - pwr |= host->plat->sigdir; + pwr |= host->pwr_reg_add;if (ios->bus_width ==MMC_BUS_WIDTH_4 ) pwr &= ~MCI_ST_DATA74DIREN ;
@@ -1386,29 +1386,26 @@ static struct mmc_host_ops mmci_ops = { .start_signal_voltage_switch = mmci_sig_volt_switch, }; -static void mmci_dt_populate_generic_pdata (struct device_node *np, -struct mmci_platform_data *pdata) +static int mmci_of_parse (struct device_node *np,struct mmc_host *mmc) { +struct mmci_host *host =mmc_priv (mmc); +int ret =mmc_of_parse (mmc); + +if (ret) +return ret; +if (of_get_property (np,"st,sig-dir-dat0" ,NULL )) - pdata->sigdir |=MCI_ST_DATA0DIREN ; + host->pwr_reg_add |=MCI_ST_DATA0DIREN ;if (of_get_property (np,"st,sig-dir-dat2" ,NULL )) - pdata->sigdir |=MCI_ST_DATA2DIREN ; + host->pwr_reg_add |=MCI_ST_DATA2DIREN ;if (of_get_property (np,"st,sig-dir-dat31" ,NULL )) - pdata->sigdir |=MCI_ST_DATA31DIREN ; + host->pwr_reg_add |=MCI_ST_DATA31DIREN ;if (of_get_property (np,"st,sig-dir-dat74" ,NULL )) - pdata->sigdir |=MCI_ST_DATA74DIREN ; + host->pwr_reg_add |=MCI_ST_DATA74DIREN ;if (of_get_property (np,"st,sig-dir-cmd" ,NULL )) - pdata->sigdir |=MCI_ST_CMDDIREN ; + host->pwr_reg_add |=MCI_ST_CMDDIREN ;if (of_get_property (np,"st,sig-pin-fbclk" ,NULL )) - pdata->sigdir |=MCI_ST_FBCLKEN ; -} - -static int mmci_of_parse (struct device_node *np,struct mmc_host *mmc) -{ -int ret =mmc_of_parse (mmc); - -if (ret) -return ret; + host->pwr_reg_add |=MCI_ST_FBCLKEN ;if (of_get_property (np,"mmc-cap-mmc-highspeed" ,NULL )) mmc->caps |=MMC_CAP_MMC_HIGHSPEED ;
@@ -1440,9 +1437,6 @@ static int mmci_probe(struct amba_device *dev,return -ENOMEM ; } -if (np) -mmci_dt_populate_generic_pdata (np, plat); -if (!devm_request_mem_region (&dev->dev, dev->res.start,resource_size (&dev->res),DRIVER_NAME ))return -ENOMEM ;
drivers/mmc/host/mmci.h +11 -0
@@ -13,6 +13,16 @@#define MCI_PWR_ON 0x03#define MCI_OD (1 << 6)#define MCI_ROD (1 << 7) +/* +* The ST Micro version does not have ROD and reuse the voltage registers for +* direction settings. +*/ +#define MCI_ST_DATA2DIREN (1 << 2) +#define MCI_ST_CMDDIREN (1 << 3) +#define MCI_ST_DATA0DIREN (1 << 4) +#define MCI_ST_DATA31DIREN (1 << 5) +#define MCI_ST_FBCLKEN (1 << 7) +#define MCI_ST_DATA74DIREN (1 << 8)#define MMCICLOCK 0x004#define MCI_CLK_ENABLE (1 << 8)
@@ -183,6 +193,7 @@ struct mmci_host {unsigned int mclk;unsigned int cclk;u32 pwr_reg; +u32 pwr_reg_add;u32 clk_reg;u32 datactrl_reg;u32 busy_status;
include/linux/amba/mmci.h +0 -16
@@ -6,19 +6,6 @@#include <linux/mmc/host.h> - -/* -* These defines is places here due to access is needed from machine -* configuration files. The ST Micro version does not have ROD and -* reuse the voltage registers for direction settings. -*/ -#define MCI_ST_DATA2DIREN (1 << 2) -#define MCI_ST_CMDDIREN (1 << 3) -#define MCI_ST_DATA0DIREN (1 << 4) -#define MCI_ST_DATA31DIREN (1 << 5) -#define MCI_ST_FBCLKEN (1 << 7) -#define MCI_ST_DATA74DIREN (1 << 8) -/* Just some dummy forwarding */ struct dma_chan ;
@@ -45,8 +32,6 @@ struct dma_chan;* @capabilities: the capabilities of the block as implemented in * this platform, signify anything MMC_CAP_* from mmc/host.h * @capabilities2: more capabilities, MMC_CAP2_* from mmc/host.h -* @sigdir: a bit field indicating for what bits in the MMC bus the host -* should enable signal direction indication. * @dma_filter: function used to select an appropriate RX and TX * DMA channel to be used for DMA, if and only if you're deploying the * generic DMA engine
@@ -69,7 +54,6 @@ struct mmci_platform_data {bool cd_invert;unsigned long capabilities;unsigned long capabilities2; -u32 sigdir;bool (*dma_filter)(struct dma_chan *chan,void *filter_param);void *dma_rx_param;void *dma_tx_param;
Signature · 1 line
1.7.9.5
PATCH v2 17/19 mmc: mmci: Enforce mmc capabilities through DT
In reply to Ulf HanssonRemove the option to provide the flags for mmc capabilities as platform data, enforce it through DT.
--- drivers/mmc/host/mmci.c | 2 -- include/linux/amba/mmci.h | 5 ----- 2 files changed, 7 deletions(-)
drivers/mmc/host/mmci.c +0 -2
@@ -1524,8 +1524,6 @@ static int mmci_probe(struct amba_device *dev,dev_warn (mmc_dev (mmc),"Platform OCR mask is ignored\n" );/* DT takes precedence over platform data. */ - mmc->caps = np ? mmc->caps : plat->capabilities; - mmc->caps2 = np ? mmc->caps2 : plat->capabilities2;if (!np) {if (!plat->cd_invert) mmc->caps2 |=MMC_CAP2_CD_ACTIVE_HIGH ;
include/linux/amba/mmci.h +0 -5
@@ -29,9 +29,6 @@ struct dma_chan;* @gpio_wp: read this GPIO pin to see if the card is write protected * @gpio_cd: read this GPIO pin to detect card insertion * @cd_invert: true if the gpio_cd pin value is active low -* @capabilities: the capabilities of the block as implemented in -* this platform, signify anything MMC_CAP_* from mmc/host.h -* @capabilities2: more capabilities, MMC_CAP2_* from mmc/host.h * @dma_filter: function used to select an appropriate RX and TX * DMA channel to be used for DMA, if and only if you're deploying the * generic DMA engine
@@ -52,8 +49,6 @@ struct mmci_platform_data {int gpio_wp;int gpio_cd;bool cd_invert; -unsigned long capabilities; -unsigned long capabilities2;bool (*dma_filter)(struct dma_chan *chan,void *filter_param);void *dma_rx_param;void *dma_tx_param;
Signature · 1 line
1.7.9.5
PATCH v2 18/19 mmc: mmci: Enforce DMA configuration through DT
In reply to Ulf HanssonRemove the option to provide DMA configuration as platform data, enforce it through DT.
--- drivers/mmc/host/mmci.c | 24 +----------------------- include/linux/amba/mmci.h | 17 ----------------- 2 files changed, 1 insertion(+), 40 deletions(-)
drivers/mmc/host/mmci.c +1 -23
@@ -366,7 +366,6 @@ static void mmci_init_sg(struct mmci_host *host, struct mmc_data *data)#ifdef CONFIG_DMA_ENGINE static void mmci_dma_setup (struct mmci_host *host) { -struct mmci_platform_data *plat = host->plat;const char *rxname, *txname;dma_cap_mask_t mask;
@@ -380,25 +379,6 @@ static void mmci_dma_setup(struct mmci_host *host)dma_cap_zero (mask);dma_cap_set (DMA_SLAVE , mask); -if (plat && plat->dma_filter) { -if (!host->dma_rx_channel && plat->dma_rx_param) { - host->dma_rx_channel =dma_request_channel (mask, - plat->dma_filter, - plat->dma_rx_param); -/* E.g if no DMA hardware is present */ -if (!host->dma_rx_channel) -dev_err (mmc_dev (host->mmc),"no RX DMA channel\n" ); - } - -if (!host->dma_tx_channel && plat->dma_tx_param) { - host->dma_tx_channel =dma_request_channel (mask, - plat->dma_filter, - plat->dma_tx_param); -if (!host->dma_tx_channel) -dev_warn (mmc_dev (host->mmc),"no TX DMA channel\n" ); - } - } -/* * If only an RX channel is specified, the driver will * attempt to use it bidirectionally, however if it is
@@ -446,11 +426,9 @@ static void mmci_dma_setup(struct mmci_host *host)*/ static inline void mmci_dma_release (struct mmci_host *host) { -struct mmci_platform_data *plat = host->plat; -if (host->dma_rx_channel)dma_release_channel (host->dma_rx_channel); -if (host->dma_tx_channel && plat->dma_tx_param) +if (host->dma_tx_channel)dma_release_channel (host->dma_tx_channel); host->dma_rx_channel = host->dma_tx_channel =NULL ; }
include/linux/amba/mmci.h +0 -17
@@ -6,9 +6,6 @@#include <linux/mmc/host.h> -/* Just some dummy forwarding */ -struct dma_chan ; -/** * struct mmci_platform_data - platform configuration for the MMCI * (also known as PL180) block.
@@ -29,17 +26,6 @@ struct dma_chan;* @gpio_wp: read this GPIO pin to see if the card is write protected * @gpio_cd: read this GPIO pin to detect card insertion * @cd_invert: true if the gpio_cd pin value is active low -* @dma_filter: function used to select an appropriate RX and TX -* DMA channel to be used for DMA, if and only if you're deploying the -* generic DMA engine -* @dma_rx_param: parameter passed to the DMA allocation -* filter in order to select an appropriate RX channel. If -* there is a bidirectional RX+TX channel, then just specify -* this and leave dma_tx_param set to NULL -* @dma_tx_param: parameter passed to the DMA allocation -* filter in order to select an appropriate TX channel. If this -* is NULL the driver will attempt to use the RX channel as a -* bidirectional channel */ struct mmci_platform_data {unsigned int f_max;
@@ -49,9 +35,6 @@ struct mmci_platform_data {int gpio_wp;int gpio_cd; bool cd_invert; -bool (*dma_filter)(struct dma_chan *chan,void *filter_param); -void *dma_rx_param; - void *dma_tx_param; };#endif
Signature · 1 line
1.7.9.5
PATCH v2 19/19 mmc: mmci: Enforce max frequency configuration through DT
In reply to Ulf HanssonRemove the option to provide a maximum frequency as platform data, enforce it through DT.
--- drivers/mmc/host/mmci.c | 5 +---- include/linux/amba/mmci.h | 4 ---- 2 files changed, 1 insertion(+), 8 deletions(-)
drivers/mmc/host/mmci.c +1 -4
@@ -1483,13 +1483,10 @@ static int mmci_probe(struct amba_device *dev,* If no maximum operating frequency is supplied, fall back to use * the module parameter, which has a (low) default value in case it * is not specified. Either value must not exceed the clock rate into -* the block, of course. Also note that DT takes precedence over -* platform data. +* the block, of course. */ if (mmc->f_max) mmc->f_max =min (host->mclk, mmc->f_max); -else if (plat->f_max) - mmc->f_max =min (host->mclk, plat->f_max);else mmc->f_max =min (host->mclk, fmax);dev_dbg (mmc_dev (mmc),"clocking block at %u Hz\n" , mmc->f_max);
include/linux/amba/mmci.h +0 -4
@@ -9,9 +9,6 @@/** * struct mmci_platform_data - platform configuration for the MMCI * (also known as PL180) block. -* @f_max: the maximum operational frequency for this host in this -* platform configuration. When this is specified it takes precedence -* over the module parameter for the same frequency. * @ocr_mask: available voltages on the 4 pins from the block, this * is ignored if a regulator is used, see the MMC_VDD_* masks in * mmc/host.h
@@ -28,7 +25,6 @@* @cd_invert: true if the gpio_cd pin value is active low */ struct mmci_platform_data { -unsigned int f_max;unsigned int ocr_mask;int (*ios_handler)(struct device *,struct mmc_ios *);unsigned int (*status)(struct device *);
Signature · 1 line
1.7.9.5