Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1247964 > unrolled thread

[PATCH v3 0/5] Armada 38x SDHCI driver improvements

Started byMarcin Wojtas <mw@semihalf.com>
First post2015-10-15 18:20 +0200
Last post2015-10-15 18:20 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v3 0/5] Armada 38x SDHCI driver improvements Marcin Wojtas <mw@semihalf.com> - 2015-10-15 18:20 +0200
    [PATCH v3 3/5] ARM: mvebu: set SW polling as SDHCI card detection on A388-GP Marcin Wojtas <mw@semihalf.com> - 2015-10-15 18:20 +0200
      Re: [PATCH v3 3/5] ARM: mvebu: set SW polling as SDHCI card detection on A388-GP Gregory CLEMENT <gregory.clement@free-electrons.com> - 2015-10-16 19:20 +0200
    [PATCH v3 1/5] mmc: sdhci-pxav3: enable proper resuming on Armada 38x SoC Marcin Wojtas <mw@semihalf.com> - 2015-10-15 18:20 +0200

#1247964 — [PATCH v3 0/5] Armada 38x SDHCI driver improvements

FromMarcin Wojtas <mw@semihalf.com>
Date2015-10-15 18:20 +0200
Subject[PATCH v3 0/5] Armada 38x SDHCI driver improvements
Message-ID<qjTq2-3aG-7@gated-at.bofh.it>
Hi,

Thank you for reviewing the patches. According to your remarks and some
new ideas I prepared third patchset. I modified my HW and now I could
check operation when using all three modes of detection (polling, gpio
and dat3) - it all seems working fine. Any remarks will be wellcome.

Best regards,
Marcin

Changes:
v1 -> v2
* enable SW polling as card detection
* in resume function change condition for mbus windows reconfiguration

v2 -> v3
* remove redundant print after fail of mbus_win_regs obtaining
* add big comment on possible card detection options in armada-388-gp.dts
* reconstruct dat3-cd support
	- use dedicated flag in sdhci_pxa structure instead of checking
	  property in DT
	- instead of global SDHCI quirk add wrapper for sdhci_set_clock
	  function in order to keep internal clock enabled
	- prevent using pm_runtime in case of using dat3-cd
* improve MMC_CARD bit modification - do not check Armada 38x compatible
  string in pxav3_init_card callback, but use pxa->mbus_win_regs as a flag

Marcin Wojtas (5):
  mmc: sdhci-pxav3: enable proper resuming on Armada 38x SoC
  mmc: sdhci-pxav3: enable usage of DAT3 pin as HW card detect
  ARM: mvebu: set SW polling as SDHCI card detection on A388-GP
  mmc: sdhci: add init_card callback to sdhci
  mmc: sdhci-pxav3: enable modifying MMC_CARD bit during card
    initialization

 .../devicetree/bindings/mmc/sdhci-pxa.txt          |   5 +
 arch/arm/boot/dts/armada-388-gp.dts                |  15 +-
 drivers/mmc/host/sdhci-pxav3.c                     | 157 ++++++++++++++++-----
 drivers/mmc/host/sdhci.c                           |   9 ++
 drivers/mmc/host/sdhci.h                           |   1 +
 5 files changed, 149 insertions(+), 38 deletions(-)

-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1247966 — [PATCH v3 3/5] ARM: mvebu: set SW polling as SDHCI card detection on A388-GP

FromMarcin Wojtas <mw@semihalf.com>
Date2015-10-15 18:20 +0200
Subject[PATCH v3 3/5] ARM: mvebu: set SW polling as SDHCI card detection on A388-GP
Message-ID<qjTq4-3aG-59@gated-at.bofh.it>
In reply to#1247964
The newest revisions of A388-GP (v1.5 and higher) support only
DAT3-based card detection. Revisions < v1.5 based on GPIO detection
via I2C expander, but this solution is supposed to be deprecated on
new boards. In order to satisfy all type of hardware this commit
changes card detection to use software polling mechanism. Also a
comment is added on possible card detection options in A388-GP
DT board file.

Signed-off-by: Marcin Wojtas <mw@semihalf.com>
Acked-by: Andrew Lunn <andrew@lunn.ch>
---
 arch/arm/boot/dts/armada-388-gp.dts | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/armada-388-gp.dts b/arch/arm/boot/dts/armada-388-gp.dts
index 391dea9..3deba13 100644
--- a/arch/arm/boot/dts/armada-388-gp.dts
+++ b/arch/arm/boot/dts/armada-388-gp.dts
@@ -213,8 +213,21 @@
 			sdhci@d8000 {
 				pinctrl-names = "default";
 				pinctrl-0 = <&sdhci_pins>;
-				cd-gpios = <&expander0 5 GPIO_ACTIVE_LOW>;
 				no-1-8-v;
+				/*
+				 * A388-GP board v1.5 and higher replace
+				 * hitherto card detection method based on GPIO
+				 * with the one using DAT3 pin. As they are
+				 * incompatible, software-based polling is
+				 * enabled with 'broken-cd' property. For boards
+				 * older than v1.5 it can be replaced with:
+				 * 'cd-gpios = <&expander0 5 GPIO_ACTIVE_LOW>;',
+				 * whereas for the newer ones following can be
+				 * used instead:
+				 * 'dat3-cd;'
+				 * 'cd-inverted;'
+				 */
+				broken-cd;
 				wp-inverted;
 				bus-width = <8>;
 				status = "okay";
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1249008 — Re: [PATCH v3 3/5] ARM: mvebu: set SW polling as SDHCI card detection on A388-GP

FromGregory CLEMENT <gregory.clement@free-electrons.com>
Date2015-10-16 19:20 +0200
SubjectRe: [PATCH v3 3/5] ARM: mvebu: set SW polling as SDHCI card detection on A388-GP
Message-ID<qkgPE-4tv-7@gated-at.bofh.it>
In reply to#1247966
Hi Marcin,
 
 On jeu., oct. 15 2015, Marcin Wojtas <mw@semihalf.com> wrote:

> The newest revisions of A388-GP (v1.5 and higher) support only
> DAT3-based card detection. Revisions < v1.5 based on GPIO detection
> via I2C expander, but this solution is supposed to be deprecated on
> new boards. In order to satisfy all type of hardware this commit
> changes card detection to use software polling mechanism. Also a
> comment is added on possible card detection options in A388-GP
> DT board file.
>
> Signed-off-by: Marcin Wojtas <mw@semihalf.com>
> Acked-by: Andrew Lunn <andrew@lunn.ch>

Applied on mvebu/dt

Thanks,

Gregory

> ---
>  arch/arm/boot/dts/armada-388-gp.dts | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm/boot/dts/armada-388-gp.dts b/arch/arm/boot/dts/armada-388-gp.dts
> index 391dea9..3deba13 100644
> --- a/arch/arm/boot/dts/armada-388-gp.dts
> +++ b/arch/arm/boot/dts/armada-388-gp.dts
> @@ -213,8 +213,21 @@
>  			sdhci@d8000 {
>  				pinctrl-names = "default";
>  				pinctrl-0 = <&sdhci_pins>;
> -				cd-gpios = <&expander0 5 GPIO_ACTIVE_LOW>;
>  				no-1-8-v;
> +				/*
> +				 * A388-GP board v1.5 and higher replace
> +				 * hitherto card detection method based on GPIO
> +				 * with the one using DAT3 pin. As they are
> +				 * incompatible, software-based polling is
> +				 * enabled with 'broken-cd' property. For boards
> +				 * older than v1.5 it can be replaced with:
> +				 * 'cd-gpios = <&expander0 5 GPIO_ACTIVE_LOW>;',
> +				 * whereas for the newer ones following can be
> +				 * used instead:
> +				 * 'dat3-cd;'
> +				 * 'cd-inverted;'
> +				 */
> +				broken-cd;
>  				wp-inverted;
>  				bus-width = <8>;
>  				status = "okay";
> -- 
> 1.8.3.1
>

-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1247968 — [PATCH v3 1/5] mmc: sdhci-pxav3: enable proper resuming on Armada 38x SoC

FromMarcin Wojtas <mw@semihalf.com>
Date2015-10-15 18:20 +0200
Subject[PATCH v3 1/5] mmc: sdhci-pxav3: enable proper resuming on Armada 38x SoC
Message-ID<qjTq4-3aG-65@gated-at.bofh.it>
In reply to#1247964
When resuming from suspend on Armada 38x SoC MBus windows have to be
re-configured and for that purpose mv_conf_mbus_windows function needed
rework. MBus windows register base address obtaining was moved to
armada_38x_quirks function in order to be kept in pxa global structure,
because it is used during a resume.

This commit fixes resuming from suspend by calling MBus windows
configuration routine and therefore enabling proper DMA operation.

Signed-off-by: Marcin Wojtas <mw@semihalf.com>
---
 drivers/mmc/host/sdhci-pxav3.c | 35 ++++++++++++++++-------------------
 1 file changed, 16 insertions(+), 19 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index f5edf9d..54a253c0 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -63,6 +63,7 @@ struct sdhci_pxa {
 	struct clk *clk_io;
 	u8	power_mode;
 	void __iomem *sdio3_conf_reg;
+	void __iomem *mbus_win_regs;
 };
 
 /*
@@ -81,30 +82,16 @@ struct sdhci_pxa {
 #define SDIO3_CONF_CLK_INV	BIT(0)
 #define SDIO3_CONF_SD_FB_CLK	BIT(2)
 
-static int mv_conf_mbus_windows(struct platform_device *pdev,
+static int mv_conf_mbus_windows(struct device *dev, void __iomem *regs,
 				const struct mbus_dram_target_info *dram)
 {
 	int i;
-	void __iomem *regs;
-	struct resource *res;
 
 	if (!dram) {
-		dev_err(&pdev->dev, "no mbus dram info\n");
-		return -EINVAL;
-	}
-
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	if (!res) {
-		dev_err(&pdev->dev, "cannot get mbus registers\n");
+		dev_err(dev, "no mbus dram info\n");
 		return -EINVAL;
 	}
 
-	regs = ioremap(res->start, resource_size(res));
-	if (!regs) {
-		dev_err(&pdev->dev, "cannot map mbus registers\n");
-		return -ENOMEM;
-	}
-
 	for (i = 0; i < SDHCI_MAX_WIN_NUM; i++) {
 		writel(0, regs + SDHCI_WINDOW_CTRL(i));
 		writel(0, regs + SDHCI_WINDOW_BASE(i));
@@ -122,8 +109,6 @@ static int mv_conf_mbus_windows(struct platform_device *pdev,
 		writel(cs->base, regs + SDHCI_WINDOW_BASE(i));
 	}
 
-	iounmap(regs);
-
 	return 0;
 }
 
@@ -135,6 +120,11 @@ static int armada_38x_quirks(struct platform_device *pdev,
 	struct sdhci_pxa *pxa = pltfm_host->priv;
 	struct resource *res;
 
+	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mbus");
+	pxa->mbus_win_regs = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(pxa->mbus_win_regs))
+		return PTR_ERR(pxa->mbus_win_regs);
+
 	host->quirks &= ~SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN;
 	host->quirks |= SDHCI_QUIRK_MISSING_CAPS;
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
@@ -403,7 +393,8 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
 		ret = armada_38x_quirks(pdev, host);
 		if (ret < 0)
 			goto err_mbus_win;
-		ret = mv_conf_mbus_windows(pdev, mv_mbus_dram_info());
+		ret = mv_conf_mbus_windows(&pdev->dev, pxa->mbus_win_regs,
+					   mv_mbus_dram_info());
 		if (ret < 0)
 			goto err_mbus_win;
 	}
@@ -520,6 +511,12 @@ static int sdhci_pxav3_resume(struct device *dev)
 {
 	int ret;
 	struct sdhci_host *host = dev_get_drvdata(dev);
+	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+	struct sdhci_pxa *pxa = pltfm_host->priv;
+
+	if (pxa->mbus_win_regs)
+		ret = mv_conf_mbus_windows(dev, pxa->mbus_win_regs,
+					   mv_mbus_dram_info());
 
 	pm_runtime_get_sync(dev);
 	ret = sdhci_resume_host(host);
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web