linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] add inversion signal presence support
@ 2019-11-18 10:46 Ivan Mikhaylov
  2019-11-18 10:46 ` [PATCH v3 1/3] aspeed: dts: add sd card for vesnin Ivan Mikhaylov
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Ivan Mikhaylov @ 2019-11-18 10:46 UTC (permalink / raw)
  Cc: Ivan Mikhaylov, Joel Stanley, Andrew Jeffery, Rob Herring,
	Mark Rutland, Adrian Hunter, Ulf Hansson, devicetree,
	linux-arm-kernel, linux-aspeed, linux-kernel, linux-mmc, openbmc

Vesnin BMC uses microSD with card presence signal inversion in the
schematics. Add the .read_l callback to detect 'cd-inverted' option
in dts. There is no WP switch, due to this 'disable-wp' also was added
into vesnin dts for sdhci.

Ivan Mikhaylov (3):
  aspeed: dts: add sd card for vesnin
  mmc: sdhci-of-aspeed: enable CONFIG_MMC_SDHCI_IO_ACCESSORS
  mmc: sdhci-of-aspeed: add inversion signal presence

 arch/arm/boot/dts/aspeed-bmc-opp-vesnin.dts | 13 +++++++++++++
 drivers/mmc/host/Kconfig                    |  1 +
 drivers/mmc/host/sdhci-of-aspeed.c          | 12 ++++++++++++
 3 files changed, 26 insertions(+)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v3 1/3] aspeed: dts: add sd card for vesnin
  2019-11-18 10:46 [PATCH v3 0/3] add inversion signal presence support Ivan Mikhaylov
@ 2019-11-18 10:46 ` Ivan Mikhaylov
  2019-11-20  6:09   ` Andrew Jeffery
  2019-11-18 10:46 ` [PATCH v3 2/3] mmc: sdhci-of-aspeed: enable CONFIG_MMC_SDHCI_IO_ACCESSORS Ivan Mikhaylov
  2019-11-18 10:46 ` [PATCH v3 3/3] mmc: sdhci-of-aspeed: add inversion signal presence Ivan Mikhaylov
  2 siblings, 1 reply; 12+ messages in thread
From: Ivan Mikhaylov @ 2019-11-18 10:46 UTC (permalink / raw)
  Cc: Ivan Mikhaylov, Joel Stanley, Andrew Jeffery, Rob Herring,
	Mark Rutland, Adrian Hunter, Ulf Hansson, devicetree,
	linux-arm-kernel, linux-aspeed, linux-kernel, linux-mmc, openbmc

Presence signal is inverted for vesnin boards, 'cd-inverted' added
for invertion signal enablement. Vesnin BMC uses microSD, there is
no WP switch, 'disable-wp' is used for this purpose.

Signed-off-by: Ivan Mikhaylov <i.mikhaylov@yadro.com>

diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-vesnin.dts b/arch/arm/boot/dts/aspeed-bmc-opp-vesnin.dts
index a27c88d23056..7ae3436e0d99 100644
--- a/arch/arm/boot/dts/aspeed-bmc-opp-vesnin.dts
+++ b/arch/arm/boot/dts/aspeed-bmc-opp-vesnin.dts
@@ -232,3 +232,16 @@
 &wdt2 {
 	aspeed,alt-boot;
 };
+
+&sdmmc {
+	status = "okay";
+};
+
+&sdhci1 {
+	status = "okay";
+
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_sd2_default>;
+	cd-inverted;
+	disable-wp;
+};
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v3 2/3] mmc: sdhci-of-aspeed: enable CONFIG_MMC_SDHCI_IO_ACCESSORS
  2019-11-18 10:46 [PATCH v3 0/3] add inversion signal presence support Ivan Mikhaylov
  2019-11-18 10:46 ` [PATCH v3 1/3] aspeed: dts: add sd card for vesnin Ivan Mikhaylov
@ 2019-11-18 10:46 ` Ivan Mikhaylov
  2019-11-20  6:08   ` Andrew Jeffery
                     ` (2 more replies)
  2019-11-18 10:46 ` [PATCH v3 3/3] mmc: sdhci-of-aspeed: add inversion signal presence Ivan Mikhaylov
  2 siblings, 3 replies; 12+ messages in thread
From: Ivan Mikhaylov @ 2019-11-18 10:46 UTC (permalink / raw)
  Cc: Ivan Mikhaylov, Joel Stanley, Andrew Jeffery, Rob Herring,
	Mark Rutland, Adrian Hunter, Ulf Hansson, devicetree,
	linux-arm-kernel, linux-aspeed, linux-kernel, linux-mmc, openbmc

Enable CONFIG_MMC_SDHCI_IO_ACCESSORS on the aspeed board. The read_l
callback is used for inverted card detection.

Signed-off-by: Ivan Mikhaylov <i.mikhaylov@yadro.com>

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 49ea02c467bf..c9c1bb722368 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -159,6 +159,7 @@ config MMC_SDHCI_OF_ASPEED
 	tristate "SDHCI OF support for the ASPEED SDHCI controller"
 	depends on MMC_SDHCI_PLTFM
 	depends on OF && OF_ADDRESS
+	select MMC_SDHCI_IO_ACCESSORS
 	help
 	  This selects the ASPEED Secure Digital Host Controller Interface.
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v3 3/3] mmc: sdhci-of-aspeed: add inversion signal presence
  2019-11-18 10:46 [PATCH v3 0/3] add inversion signal presence support Ivan Mikhaylov
  2019-11-18 10:46 ` [PATCH v3 1/3] aspeed: dts: add sd card for vesnin Ivan Mikhaylov
  2019-11-18 10:46 ` [PATCH v3 2/3] mmc: sdhci-of-aspeed: enable CONFIG_MMC_SDHCI_IO_ACCESSORS Ivan Mikhaylov
@ 2019-11-18 10:46 ` Ivan Mikhaylov
  2019-11-20  6:06   ` Andrew Jeffery
                     ` (2 more replies)
  2 siblings, 3 replies; 12+ messages in thread
From: Ivan Mikhaylov @ 2019-11-18 10:46 UTC (permalink / raw)
  Cc: Ivan Mikhaylov, Joel Stanley, Andrew Jeffery, Rob Herring,
	Mark Rutland, Adrian Hunter, Ulf Hansson, devicetree,
	linux-arm-kernel, linux-aspeed, linux-kernel, linux-mmc, openbmc

Add read_l callback in sdhci_ops with flipping of SDHCI_CARD_PRESENT
bit in case of inverted card detection signal.

Signed-off-by: Ivan Mikhaylov <i.mikhaylov@yadro.com>

diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
index 8962f6664381..56912e30c47e 100644
--- a/drivers/mmc/host/sdhci-of-aspeed.c
+++ b/drivers/mmc/host/sdhci-of-aspeed.c
@@ -111,7 +111,19 @@ static void aspeed_sdhci_set_bus_width(struct sdhci_host *host, int width)
 	sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
 }
 
+static u32 aspeed_sdhci_readl(struct sdhci_host *host, int reg)
+{
+	u32 val = readl(host->ioaddr + reg);
+
+	if (unlikely(reg == SDHCI_PRESENT_STATE) &&
+	    (host->mmc->caps2 & MMC_CAP2_CD_ACTIVE_HIGH))
+		val ^= SDHCI_CARD_PRESENT;
+
+	return val;
+}
+
 static const struct sdhci_ops aspeed_sdhci_ops = {
+	.read_l = aspeed_sdhci_readl,
 	.set_clock = aspeed_sdhci_set_clock,
 	.get_max_clock = aspeed_sdhci_get_max_clock,
 	.set_bus_width = aspeed_sdhci_set_bus_width,
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 3/3] mmc: sdhci-of-aspeed: add inversion signal presence
  2019-11-18 10:46 ` [PATCH v3 3/3] mmc: sdhci-of-aspeed: add inversion signal presence Ivan Mikhaylov
@ 2019-11-20  6:06   ` Andrew Jeffery
  2019-11-20  7:45   ` Adrian Hunter
  2019-11-20 12:59   ` Ulf Hansson
  2 siblings, 0 replies; 12+ messages in thread
From: Andrew Jeffery @ 2019-11-20  6:06 UTC (permalink / raw)
  To: Ivan Mikhaylov
  Cc: Joel Stanley, Rob Herring, Mark Rutland, Adrian Hunter,
	Ulf Hansson, devicetree, linux-arm-kernel, linux-aspeed,
	linux-kernel, linux-mmc, openbmc

On Mon, 18 Nov 2019, at 21:16, Ivan Mikhaylov wrote:
> Add read_l callback in sdhci_ops with flipping of SDHCI_CARD_PRESENT
> bit in case of inverted card detection signal.
> 
> Signed-off-by: Ivan Mikhaylov <i.mikhaylov@yadro.com>

Reviewed-by: Andrew Jeffery <andrew@aj.id.au>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 2/3] mmc: sdhci-of-aspeed: enable CONFIG_MMC_SDHCI_IO_ACCESSORS
  2019-11-18 10:46 ` [PATCH v3 2/3] mmc: sdhci-of-aspeed: enable CONFIG_MMC_SDHCI_IO_ACCESSORS Ivan Mikhaylov
@ 2019-11-20  6:08   ` Andrew Jeffery
  2019-11-20  7:44   ` Adrian Hunter
  2019-11-20 12:58   ` Ulf Hansson
  2 siblings, 0 replies; 12+ messages in thread
From: Andrew Jeffery @ 2019-11-20  6:08 UTC (permalink / raw)
  To: Ivan Mikhaylov
  Cc: Joel Stanley, Rob Herring, Mark Rutland, Adrian Hunter,
	Ulf Hansson, devicetree, linux-arm-kernel, linux-aspeed,
	linux-kernel, linux-mmc, openbmc



On Mon, 18 Nov 2019, at 21:16, Ivan Mikhaylov wrote:
> Enable CONFIG_MMC_SDHCI_IO_ACCESSORS on the aspeed board. 

s/on the aspeed board/for the ASPEED MMC driver/

but otherwise:

Reviewed-by: Andrew Jeffery <andrew@aj.id.au>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 1/3] aspeed: dts: add sd card for vesnin
  2019-11-18 10:46 ` [PATCH v3 1/3] aspeed: dts: add sd card for vesnin Ivan Mikhaylov
@ 2019-11-20  6:09   ` Andrew Jeffery
  0 siblings, 0 replies; 12+ messages in thread
From: Andrew Jeffery @ 2019-11-20  6:09 UTC (permalink / raw)
  To: Ivan Mikhaylov
  Cc: Joel Stanley, Rob Herring, Mark Rutland, Adrian Hunter,
	Ulf Hansson, devicetree, linux-arm-kernel, linux-aspeed,
	linux-kernel, linux-mmc, openbmc



On Mon, 18 Nov 2019, at 21:16, Ivan Mikhaylov wrote:
> Presence signal is inverted for vesnin boards, 'cd-inverted' added
> for invertion signal enablement. Vesnin BMC uses microSD, there is
> no WP switch, 'disable-wp' is used for this purpose.
> 
> Signed-off-by: Ivan Mikhaylov <i.mikhaylov@yadro.com>

Acked-by: Andrew Jeffery <andrew@aj.id.au>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 2/3] mmc: sdhci-of-aspeed: enable CONFIG_MMC_SDHCI_IO_ACCESSORS
  2019-11-18 10:46 ` [PATCH v3 2/3] mmc: sdhci-of-aspeed: enable CONFIG_MMC_SDHCI_IO_ACCESSORS Ivan Mikhaylov
  2019-11-20  6:08   ` Andrew Jeffery
@ 2019-11-20  7:44   ` Adrian Hunter
  2019-11-20 12:58   ` Ulf Hansson
  2 siblings, 0 replies; 12+ messages in thread
From: Adrian Hunter @ 2019-11-20  7:44 UTC (permalink / raw)
  To: Ivan Mikhaylov
  Cc: Joel Stanley, Andrew Jeffery, Rob Herring, Mark Rutland,
	Ulf Hansson, devicetree, linux-arm-kernel, linux-aspeed,
	linux-kernel, linux-mmc, openbmc

On 18/11/19 12:46 PM, Ivan Mikhaylov wrote:
> Enable CONFIG_MMC_SDHCI_IO_ACCESSORS on the aspeed board. The read_l
> callback is used for inverted card detection.
> 
> Signed-off-by: Ivan Mikhaylov <i.mikhaylov@yadro.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> 
> diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
> index 49ea02c467bf..c9c1bb722368 100644
> --- a/drivers/mmc/host/Kconfig
> +++ b/drivers/mmc/host/Kconfig
> @@ -159,6 +159,7 @@ config MMC_SDHCI_OF_ASPEED
>  	tristate "SDHCI OF support for the ASPEED SDHCI controller"
>  	depends on MMC_SDHCI_PLTFM
>  	depends on OF && OF_ADDRESS
> +	select MMC_SDHCI_IO_ACCESSORS
>  	help
>  	  This selects the ASPEED Secure Digital Host Controller Interface.
>  
> 


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 3/3] mmc: sdhci-of-aspeed: add inversion signal presence
  2019-11-18 10:46 ` [PATCH v3 3/3] mmc: sdhci-of-aspeed: add inversion signal presence Ivan Mikhaylov
  2019-11-20  6:06   ` Andrew Jeffery
@ 2019-11-20  7:45   ` Adrian Hunter
  2019-11-20 12:59   ` Ulf Hansson
  2 siblings, 0 replies; 12+ messages in thread
From: Adrian Hunter @ 2019-11-20  7:45 UTC (permalink / raw)
  To: Ivan Mikhaylov
  Cc: Joel Stanley, Andrew Jeffery, Rob Herring, Mark Rutland,
	Ulf Hansson, devicetree, linux-arm-kernel, linux-aspeed,
	linux-kernel, linux-mmc, openbmc

On 18/11/19 12:46 PM, Ivan Mikhaylov wrote:
> Add read_l callback in sdhci_ops with flipping of SDHCI_CARD_PRESENT
> bit in case of inverted card detection signal.
> 
> Signed-off-by: Ivan Mikhaylov <i.mikhaylov@yadro.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> 
> diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
> index 8962f6664381..56912e30c47e 100644
> --- a/drivers/mmc/host/sdhci-of-aspeed.c
> +++ b/drivers/mmc/host/sdhci-of-aspeed.c
> @@ -111,7 +111,19 @@ static void aspeed_sdhci_set_bus_width(struct sdhci_host *host, int width)
>  	sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
>  }
>  
> +static u32 aspeed_sdhci_readl(struct sdhci_host *host, int reg)
> +{
> +	u32 val = readl(host->ioaddr + reg);
> +
> +	if (unlikely(reg == SDHCI_PRESENT_STATE) &&
> +	    (host->mmc->caps2 & MMC_CAP2_CD_ACTIVE_HIGH))
> +		val ^= SDHCI_CARD_PRESENT;
> +
> +	return val;
> +}
> +
>  static const struct sdhci_ops aspeed_sdhci_ops = {
> +	.read_l = aspeed_sdhci_readl,
>  	.set_clock = aspeed_sdhci_set_clock,
>  	.get_max_clock = aspeed_sdhci_get_max_clock,
>  	.set_bus_width = aspeed_sdhci_set_bus_width,
> 


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 2/3] mmc: sdhci-of-aspeed: enable CONFIG_MMC_SDHCI_IO_ACCESSORS
  2019-11-18 10:46 ` [PATCH v3 2/3] mmc: sdhci-of-aspeed: enable CONFIG_MMC_SDHCI_IO_ACCESSORS Ivan Mikhaylov
  2019-11-20  6:08   ` Andrew Jeffery
  2019-11-20  7:44   ` Adrian Hunter
@ 2019-11-20 12:58   ` Ulf Hansson
  2 siblings, 0 replies; 12+ messages in thread
From: Ulf Hansson @ 2019-11-20 12:58 UTC (permalink / raw)
  To: Ivan Mikhaylov
  Cc: Joel Stanley, Andrew Jeffery, Rob Herring, Mark Rutland,
	Adrian Hunter, DTML, Linux ARM, linux-aspeed,
	Linux Kernel Mailing List, linux-mmc, OpenBMC Maillist

On Mon, 18 Nov 2019 at 11:47, Ivan Mikhaylov <i.mikhaylov@yadro.com> wrote:
>
> Enable CONFIG_MMC_SDHCI_IO_ACCESSORS on the aspeed board. The read_l
> callback is used for inverted card detection.
>
> Signed-off-by: Ivan Mikhaylov <i.mikhaylov@yadro.com>

Applied for next, updating the changelog according to Andrew's comments, thanks!

Kind regards
Uffe


>
> diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
> index 49ea02c467bf..c9c1bb722368 100644
> --- a/drivers/mmc/host/Kconfig
> +++ b/drivers/mmc/host/Kconfig
> @@ -159,6 +159,7 @@ config MMC_SDHCI_OF_ASPEED
>         tristate "SDHCI OF support for the ASPEED SDHCI controller"
>         depends on MMC_SDHCI_PLTFM
>         depends on OF && OF_ADDRESS
> +       select MMC_SDHCI_IO_ACCESSORS
>         help
>           This selects the ASPEED Secure Digital Host Controller Interface.
>
> --
> 2.20.1
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 3/3] mmc: sdhci-of-aspeed: add inversion signal presence
  2019-11-18 10:46 ` [PATCH v3 3/3] mmc: sdhci-of-aspeed: add inversion signal presence Ivan Mikhaylov
  2019-11-20  6:06   ` Andrew Jeffery
  2019-11-20  7:45   ` Adrian Hunter
@ 2019-11-20 12:59   ` Ulf Hansson
  2019-12-02 21:57     ` Joel Stanley
  2 siblings, 1 reply; 12+ messages in thread
From: Ulf Hansson @ 2019-11-20 12:59 UTC (permalink / raw)
  To: Ivan Mikhaylov
  Cc: Joel Stanley, Andrew Jeffery, Rob Herring, Mark Rutland,
	Adrian Hunter, DTML, Linux ARM, linux-aspeed,
	Linux Kernel Mailing List, linux-mmc, OpenBMC Maillist

On Mon, 18 Nov 2019 at 11:47, Ivan Mikhaylov <i.mikhaylov@yadro.com> wrote:
>
> Add read_l callback in sdhci_ops with flipping of SDHCI_CARD_PRESENT
> bit in case of inverted card detection signal.
>
> Signed-off-by: Ivan Mikhaylov <i.mikhaylov@yadro.com>

Applied for next, thanks!

For clarity, I am leaving patch 1 for arm-soc.

Kind regards
Uffe



>
> diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
> index 8962f6664381..56912e30c47e 100644
> --- a/drivers/mmc/host/sdhci-of-aspeed.c
> +++ b/drivers/mmc/host/sdhci-of-aspeed.c
> @@ -111,7 +111,19 @@ static void aspeed_sdhci_set_bus_width(struct sdhci_host *host, int width)
>         sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
>  }
>
> +static u32 aspeed_sdhci_readl(struct sdhci_host *host, int reg)
> +{
> +       u32 val = readl(host->ioaddr + reg);
> +
> +       if (unlikely(reg == SDHCI_PRESENT_STATE) &&
> +           (host->mmc->caps2 & MMC_CAP2_CD_ACTIVE_HIGH))
> +               val ^= SDHCI_CARD_PRESENT;
> +
> +       return val;
> +}
> +
>  static const struct sdhci_ops aspeed_sdhci_ops = {
> +       .read_l = aspeed_sdhci_readl,
>         .set_clock = aspeed_sdhci_set_clock,
>         .get_max_clock = aspeed_sdhci_get_max_clock,
>         .set_bus_width = aspeed_sdhci_set_bus_width,
> --
> 2.20.1
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 3/3] mmc: sdhci-of-aspeed: add inversion signal presence
  2019-11-20 12:59   ` Ulf Hansson
@ 2019-12-02 21:57     ` Joel Stanley
  0 siblings, 0 replies; 12+ messages in thread
From: Joel Stanley @ 2019-12-02 21:57 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Ivan Mikhaylov, Andrew Jeffery, Rob Herring, Mark Rutland,
	Adrian Hunter, DTML, Linux ARM, linux-aspeed,
	Linux Kernel Mailing List, linux-mmc, OpenBMC Maillist

On Wed, 20 Nov 2019 at 12:59, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> On Mon, 18 Nov 2019 at 11:47, Ivan Mikhaylov <i.mikhaylov@yadro.com> wrote:
> >
> > Add read_l callback in sdhci_ops with flipping of SDHCI_CARD_PRESENT
> > bit in case of inverted card detection signal.
> >
> > Signed-off-by: Ivan Mikhaylov <i.mikhaylov@yadro.com>
>
> Applied for next, thanks!
>
> For clarity, I am leaving patch 1 for arm-soc.

Thanks. I'd already sent the aspeed pull request for 5.5, so I'll send
the device tree patch next merge window.

Cheers,

Joel

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-12-02 21:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-18 10:46 [PATCH v3 0/3] add inversion signal presence support Ivan Mikhaylov
2019-11-18 10:46 ` [PATCH v3 1/3] aspeed: dts: add sd card for vesnin Ivan Mikhaylov
2019-11-20  6:09   ` Andrew Jeffery
2019-11-18 10:46 ` [PATCH v3 2/3] mmc: sdhci-of-aspeed: enable CONFIG_MMC_SDHCI_IO_ACCESSORS Ivan Mikhaylov
2019-11-20  6:08   ` Andrew Jeffery
2019-11-20  7:44   ` Adrian Hunter
2019-11-20 12:58   ` Ulf Hansson
2019-11-18 10:46 ` [PATCH v3 3/3] mmc: sdhci-of-aspeed: add inversion signal presence Ivan Mikhaylov
2019-11-20  6:06   ` Andrew Jeffery
2019-11-20  7:45   ` Adrian Hunter
2019-11-20 12:59   ` Ulf Hansson
2019-12-02 21:57     ` Joel Stanley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).