linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/6] tmio: add support for eMMC with 8 bit bus width
@ 2016-09-19 12:49 Wolfram Sang
  2016-09-19 12:49 ` [PATCH v2 1/6] mmc: add define for R1 response without CRC Wolfram Sang
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Wolfram Sang @ 2016-09-19 12:49 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-renesas-soc, Simon Horman, Dirk Behme, Wolfram Sang

This series enables SDHI instances on R-Car Gen3 to access eMMC with 8 bit bus
width. I think the patch descriptions speak for themselves.

I decided to not protect this new feature with a flag because it needs
specifically to be enabled by setting the bus width to 8. No legacy platform
does that.

Note that I decided to use the pattern that pinctrl-0 is 3.3v and
pinctrl-1 is 1.8v, although the eMMC is fixed at 1.8v. I tried a few ways to
only use pinctrl-0 being 1.8v here, but they all ended up to be confusing for
users IMO, so I sticked to the most consistent solution after all.

Changes since V1:

* merged the two distinct series (drivers + DTS) into one: patches 1-4 are for
  Ulf, I will ping Simon for patches 5+6 when the time is ready.

* DTS now contains 'non-removable' and we have a software workaround for now.

These patches are based on top of Simon's sdr104-v7 patches but they apply to
current mmc/next as well. A branch can be found here:

git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git renesas/topic/sdhi-8bit-emmc

Please review, comment, apply...

   Wolfram

Wolfram Sang (6):
  mmc: add define for R1 response without CRC
  mmc: rtsx_pci: use new macro for R1 without CRC
  mmc: rtsx_usb: use new macro for R1 without CRC
  mmc: tmio: add eMMC support
  arm64: dts: r8a7795: salvator: enable on-board eMMC
  arm64: dts: r8a7796: salvator: enable on board eMMC

 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 43 +++++++++++++++++++++
 arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts | 44 +++++++++++++++++++++-
 drivers/mmc/host/rtsx_pci_sdmmc.c                  |  2 +-
 drivers/mmc/host/rtsx_usb_sdmmc.c                  |  2 +-
 drivers/mmc/host/tmio_mmc.h                        |  3 ++
 drivers/mmc/host/tmio_mmc_pio.c                    | 38 +++++++++++++------
 include/linux/mmc/core.h                           |  3 ++
 7 files changed, 120 insertions(+), 15 deletions(-)

-- 
2.9.3

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

* [PATCH v2 1/6] mmc: add define for R1 response without CRC
  2016-09-19 12:49 [PATCH v2 0/6] tmio: add support for eMMC with 8 bit bus width Wolfram Sang
@ 2016-09-19 12:49 ` Wolfram Sang
  2016-09-19 12:49 ` [PATCH v2 2/6] mmc: rtsx_pci: use new macro for R1 " Wolfram Sang
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Wolfram Sang @ 2016-09-19 12:49 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-renesas-soc, Simon Horman, Dirk Behme, Wolfram Sang

The core uses it for polling. Give drivers a proper define handle this
case like for other response types.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 include/linux/mmc/core.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index b01e77de1a74de..4caee099b63a28 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -55,6 +55,9 @@ struct mmc_command {
 #define MMC_RSP_R6	(MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
 #define MMC_RSP_R7	(MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
 
+/* Can be used by core to poll after switch to MMC HS mode */
+#define MMC_RSP_R1_NO_CRC	(MMC_RSP_PRESENT|MMC_RSP_OPCODE)
+
 #define mmc_resp_type(cmd)	((cmd)->flags & (MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC|MMC_RSP_BUSY|MMC_RSP_OPCODE))
 
 /*
-- 
2.9.3

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

* [PATCH v2 2/6] mmc: rtsx_pci: use new macro for R1 without CRC
  2016-09-19 12:49 [PATCH v2 0/6] tmio: add support for eMMC with 8 bit bus width Wolfram Sang
  2016-09-19 12:49 ` [PATCH v2 1/6] mmc: add define for R1 response without CRC Wolfram Sang
@ 2016-09-19 12:49 ` Wolfram Sang
  2016-09-19 12:49 ` [PATCH v2 3/6] mmc: rtsx_usb: " Wolfram Sang
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Wolfram Sang @ 2016-09-19 12:49 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-renesas-soc, Simon Horman, Dirk Behme, Wolfram Sang

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/host/rtsx_pci_sdmmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c
index 396c9b7e4121b0..3ccaa1415f33b2 100644
--- a/drivers/mmc/host/rtsx_pci_sdmmc.c
+++ b/drivers/mmc/host/rtsx_pci_sdmmc.c
@@ -126,7 +126,7 @@ static int sd_response_type(struct mmc_command *cmd)
 		return SD_RSP_TYPE_R0;
 	case MMC_RSP_R1:
 		return SD_RSP_TYPE_R1;
-	case MMC_RSP_R1 & ~MMC_RSP_CRC:
+	case MMC_RSP_R1_NO_CRC:
 		return SD_RSP_TYPE_R1 | SD_NO_CHECK_CRC7;
 	case MMC_RSP_R1B:
 		return SD_RSP_TYPE_R1b;
-- 
2.9.3

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

* [PATCH v2 3/6] mmc: rtsx_usb: use new macro for R1 without CRC
  2016-09-19 12:49 [PATCH v2 0/6] tmio: add support for eMMC with 8 bit bus width Wolfram Sang
  2016-09-19 12:49 ` [PATCH v2 1/6] mmc: add define for R1 response without CRC Wolfram Sang
  2016-09-19 12:49 ` [PATCH v2 2/6] mmc: rtsx_pci: use new macro for R1 " Wolfram Sang
@ 2016-09-19 12:49 ` Wolfram Sang
  2016-09-19 12:49 ` [PATCH v2 4/6] mmc: tmio: add eMMC support Wolfram Sang
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Wolfram Sang @ 2016-09-19 12:49 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-renesas-soc, Simon Horman, Dirk Behme, Wolfram Sang

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/host/rtsx_usb_sdmmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/host/rtsx_usb_sdmmc.c b/drivers/mmc/host/rtsx_usb_sdmmc.c
index 6c71fc9f76c7ec..4106295527b9d0 100644
--- a/drivers/mmc/host/rtsx_usb_sdmmc.c
+++ b/drivers/mmc/host/rtsx_usb_sdmmc.c
@@ -324,7 +324,7 @@ static void sd_send_cmd_get_rsp(struct rtsx_usb_sdmmc *host,
 	case MMC_RSP_R1:
 		rsp_type = SD_RSP_TYPE_R1;
 		break;
-	case MMC_RSP_R1 & ~MMC_RSP_CRC:
+	case MMC_RSP_R1_NO_CRC:
 		rsp_type = SD_RSP_TYPE_R1 | SD_NO_CHECK_CRC7;
 		break;
 	case MMC_RSP_R1B:
-- 
2.9.3

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

* [PATCH v2 4/6] mmc: tmio: add eMMC support
  2016-09-19 12:49 [PATCH v2 0/6] tmio: add support for eMMC with 8 bit bus width Wolfram Sang
                   ` (2 preceding siblings ...)
  2016-09-19 12:49 ` [PATCH v2 3/6] mmc: rtsx_usb: " Wolfram Sang
@ 2016-09-19 12:49 ` Wolfram Sang
  2016-09-19 17:31   ` Sergei Shtylyov
  2016-09-19 12:49 ` [PATCH v2 5/6] arm64: dts: r8a7795: salvator: enable on-board eMMC Wolfram Sang
  2016-09-19 12:49 ` [PATCH v2 6/6] arm64: dts: r8a7796: salvator: enable on board eMMC Wolfram Sang
  5 siblings, 1 reply; 11+ messages in thread
From: Wolfram Sang @ 2016-09-19 12:49 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-renesas-soc, Simon Horman, Dirk Behme, Wolfram Sang

We need to add R1 without CRC support, refactor the bus width routine a
little and extend a quirk check. To support "non-removable;" we need a
workaround which will be hopefully removed when reworking PM soon.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/host/tmio_mmc.h     |  3 +++
 drivers/mmc/host/tmio_mmc_pio.c | 38 ++++++++++++++++++++++++++------------
 2 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 4b501f2d529f6e..637581faf756b1 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -79,6 +79,9 @@
 #define	CLK_CTL_DIV_MASK	0xff
 #define	CLK_CTL_SCLKEN		BIT(8)
 
+#define CARD_OPT_WIDTH8		BIT(13)
+#define CARD_OPT_WIDTH		BIT(15)
+
 #define TMIO_BBS		512		/* Boot block size */
 
 /* Definitions for values the CTRL_SDIO_STATUS register can take. */
diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
index 46b5a456243b84..a0f05eb4f34490 100644
--- a/drivers/mmc/host/tmio_mmc_pio.c
+++ b/drivers/mmc/host/tmio_mmc_pio.c
@@ -340,7 +340,9 @@ static int tmio_mmc_start_command(struct tmio_mmc_host *host, struct mmc_command
 
 	switch (mmc_resp_type(cmd)) {
 	case MMC_RSP_NONE: c |= RESP_NONE; break;
-	case MMC_RSP_R1:   c |= RESP_R1;   break;
+	case MMC_RSP_R1:
+	case MMC_RSP_R1_NO_CRC:
+			   c |= RESP_R1;   break;
 	case MMC_RSP_R1B:  c |= RESP_R1B;  break;
 	case MMC_RSP_R2:   c |= RESP_R2;   break;
 	case MMC_RSP_R3:   c |= RESP_R3;   break;
@@ -737,12 +739,13 @@ static int tmio_mmc_start_data(struct tmio_mmc_host *host,
 	pr_debug("setup data transfer: blocksize %08x  nr_blocks %d\n",
 		 data->blksz, data->blocks);
 
-	/* Some hardware cannot perform 2 byte requests in 4 bit mode */
-	if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_4) {
+	/* Some hardware cannot perform 2 byte requests in 4/8 bit mode */
+	if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_4 ||
+	    host->mmc->ios.bus_width == MMC_BUS_WIDTH_8) {
 		int blksz_2bytes = pdata->flags & TMIO_MMC_BLKSZ_2BYTES;
 
 		if (data->blksz < 2 || (data->blksz < 4 && !blksz_2bytes)) {
-			pr_err("%s: %d byte block unsupported in 4 bit mode\n",
+			pr_err("%s: %d byte block unsupported in 4/8 bit mode\n",
 			       mmc_hostname(host->mmc), data->blksz);
 			return -EINVAL;
 		}
@@ -922,14 +925,16 @@ static void tmio_mmc_power_off(struct tmio_mmc_host *host)
 static void tmio_mmc_set_bus_width(struct tmio_mmc_host *host,
 				unsigned char bus_width)
 {
-	switch (bus_width) {
-	case MMC_BUS_WIDTH_1:
-		sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x80e0);
-		break;
-	case MMC_BUS_WIDTH_4:
-		sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x00e0);
-		break;
-	}
+	u16 reg = sd_ctrl_read16(host, CTL_SD_MEM_CARD_OPT)
+				& ~(CARD_OPT_WIDTH | CARD_OPT_WIDTH8);
+
+	/* reg now applies to MMC_BUS_WIDTH_4 */
+	if (bus_width == MMC_BUS_WIDTH_1)
+		reg |= CARD_OPT_WIDTH;
+	else if (bus_width == MMC_BUS_WIDTH_8)
+		reg |= CARD_OPT_WIDTH8;
+
+	sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, reg);
 }
 
 /* Set MMC clock / power.
@@ -1149,6 +1154,15 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host,
 				  !mmc_card_is_removable(mmc) ||
 				  mmc->slot.cd_irq >= 0);
 
+	/*
+	 * On Gen2+, eMMC with NONREMOVABLE currently fails because native
+	 * hotplug gets disabled. It seems RuntimePM related yet we need further
+	 * research. Since we are planning a PM overhaul anyway, let's enforce
+	 * for now the device being active by enabling native hotplug always.
+	 */
+	if (pdata->flags & TMIO_MMC_MIN_RCAR2)
+		_host->native_hotplug = true;
+
 	if (tmio_mmc_clk_enable(_host) < 0) {
 		mmc->f_max = pdata->hclk;
 		mmc->f_min = mmc->f_max / 512;
-- 
2.9.3

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

* [PATCH v2 5/6] arm64: dts: r8a7795: salvator: enable on-board eMMC
  2016-09-19 12:49 [PATCH v2 0/6] tmio: add support for eMMC with 8 bit bus width Wolfram Sang
                   ` (3 preceding siblings ...)
  2016-09-19 12:49 ` [PATCH v2 4/6] mmc: tmio: add eMMC support Wolfram Sang
@ 2016-09-19 12:49 ` Wolfram Sang
  2016-09-19 17:25   ` Sergei Shtylyov
  2016-09-19 12:49 ` [PATCH v2 6/6] arm64: dts: r8a7796: salvator: enable on board eMMC Wolfram Sang
  5 siblings, 1 reply; 11+ messages in thread
From: Wolfram Sang @ 2016-09-19 12:49 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-renesas-soc, Simon Horman, Dirk Behme, Wolfram Sang

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 43 ++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
index 8964b1ea3cea69..7780d02f716a34 100644
--- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
@@ -62,6 +62,24 @@
 		clock-frequency = <24576000>;
 	};
 
+	reg_1p8v: regulator0 {
+		compatible = "regulator-fixed";
+		regulator-name = "fixed-1.8V";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		regulator-boot-on;
+		regulator-always-on;
+	};
+
+	reg_3p3v: regulator1 {
+		compatible = "regulator-fixed";
+		regulator-name = "fixed-3.3V";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-boot-on;
+		regulator-always-on;
+	};
+
 	vcc_sdhi0: regulator-vcc-sdhi0 {
 		compatible = "regulator-fixed";
 
@@ -246,6 +264,18 @@
 		power-source = <1800>;
 	};
 
+	sdhi2_pins: sd2 {
+		groups = "sdhi2_data8", "sdhi2_ctrl";
+		function = "sdhi2";
+		power-source = <3300>;
+	};
+
+	sdhi2_pins_uhs: sd2 {
+		groups = "sdhi2_data8", "sdhi2_ctrl";
+		function = "sdhi2";
+		power-source = <1800>;
+	};
+
 	sdhi3_pins: sd3 {
 		groups = "sdhi3_data4", "sdhi3_ctrl";
 		function = "sdhi3";
@@ -398,6 +428,19 @@
 	status = "okay";
 };
 
+&sdhi2 {
+	/* used for on-board 8bit eMMC */
+	pinctrl-0 = <&sdhi2_pins>;
+	pinctrl-1 = <&sdhi2_pins_uhs>;
+	pinctrl-names = "default", "state_uhs";
+
+	vmmc-supply = <&reg_3p3v>;
+	vqmmc-supply = <&reg_1p8v>;
+	bus-width = <8>;
+	non-removable;
+	status = "okay";
+};
+
 &sdhi3 {
 	pinctrl-0 = <&sdhi3_pins>;
 	pinctrl-1 = <&sdhi3_pins_uhs>;
-- 
2.9.3

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

* [PATCH v2 6/6] arm64: dts: r8a7796: salvator: enable on board eMMC
  2016-09-19 12:49 [PATCH v2 0/6] tmio: add support for eMMC with 8 bit bus width Wolfram Sang
                   ` (4 preceding siblings ...)
  2016-09-19 12:49 ` [PATCH v2 5/6] arm64: dts: r8a7795: salvator: enable on-board eMMC Wolfram Sang
@ 2016-09-19 12:49 ` Wolfram Sang
  5 siblings, 0 replies; 11+ messages in thread
From: Wolfram Sang @ 2016-09-19 12:49 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-renesas-soc, Simon Horman, Dirk Behme, Wolfram Sang

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts | 44 +++++++++++++++++++++-
 1 file changed, 43 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts b/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
index 91440eb2237e72..7b14cb7538b22f 100644
--- a/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
+++ b/arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts
@@ -31,6 +31,24 @@
 		reg = <0x0 0x48000000 0x0 0x78000000>;
 	};
 
+	reg_1p8v: regulator0 {
+		compatible = "regulator-fixed";
+		regulator-name = "fixed-1.8V";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		regulator-boot-on;
+		regulator-always-on;
+	};
+
+	reg_3p3v: regulator1 {
+		compatible = "regulator-fixed";
+		regulator-name = "fixed-3.3V";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-boot-on;
+		regulator-always-on;
+	};
+
 	vcc_sdhi0: regulator-vcc-sdhi0 {
 		compatible = "regulator-fixed";
 
@@ -78,7 +96,6 @@
 		states = <3300000 1
 			  1800000 0>;
 	};
-
 };
 
 &pfc {
@@ -106,6 +123,18 @@
 		power-source = <1800>;
 	};
 
+	sdhi2_pins: sd2 {
+		groups = "sdhi2_data8", "sdhi2_ctrl";
+		function = "sdhi2";
+		power-source = <3300>;
+	};
+
+	sdhi2_pins_uhs: sd2 {
+		groups = "sdhi2_data8", "sdhi2_ctrl";
+		function = "sdhi2";
+		power-source = <1800>;
+	};
+
 	sdhi3_pins: sd3 {
 		groups = "sdhi3_data4", "sdhi3_ctrl";
 		function = "sdhi3";
@@ -138,6 +167,19 @@
 	status = "okay";
 };
 
+&sdhi2 {
+	/* used for on-board 8bit eMMC */
+	pinctrl-0 = <&sdhi2_pins>;
+	pinctrl-1 = <&sdhi2_pins_uhs>;
+	pinctrl-names = "default", "state_uhs";
+
+	vmmc-supply = <&reg_3p3v>;
+	vqmmc-supply = <&reg_1p8v>;
+	bus-width = <8>;
+	non-removable;
+	status = "okay";
+};
+
 &sdhi3 {
 	pinctrl-0 = <&sdhi3_pins>;
 	pinctrl-1 = <&sdhi3_pins_uhs>;
-- 
2.9.3

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

* Re: [PATCH v2 5/6] arm64: dts: r8a7795: salvator: enable on-board eMMC
  2016-09-19 12:49 ` [PATCH v2 5/6] arm64: dts: r8a7795: salvator: enable on-board eMMC Wolfram Sang
@ 2016-09-19 17:25   ` Sergei Shtylyov
  2016-09-19 20:29     ` Wolfram Sang
  0 siblings, 1 reply; 11+ messages in thread
From: Sergei Shtylyov @ 2016-09-19 17:25 UTC (permalink / raw)
  To: Wolfram Sang, linux-mmc; +Cc: linux-renesas-soc, Simon Horman, Dirk Behme

On 09/19/2016 03:49 PM, Wolfram Sang wrote:

> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 43 ++++++++++++++++++++++
>  1 file changed, 43 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
> index 8964b1ea3cea69..7780d02f716a34 100644
> --- a/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
> +++ b/arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts
[...]
> @@ -246,6 +264,18 @@
>  		power-source = <1800>;
>  	};
>
> +	sdhi2_pins: sd2 {
> +		groups = "sdhi2_data8", "sdhi2_ctrl";
> +		function = "sdhi2";
> +		power-source = <3300>;
> +	};
> +
> +	sdhi2_pins_uhs: sd2 {
> +		groups = "sdhi2_data8", "sdhi2_ctrl";
> +		function = "sdhi2";
> +		power-source = <1800>;
> +	};
> +

    I'm afraid you're just overriding the props in the first "sd2" node with 
this...

[...]

MBR, Sergei

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

* Re: [PATCH v2 4/6] mmc: tmio: add eMMC support
  2016-09-19 12:49 ` [PATCH v2 4/6] mmc: tmio: add eMMC support Wolfram Sang
@ 2016-09-19 17:31   ` Sergei Shtylyov
  2016-09-19 20:26     ` Wolfram Sang
  0 siblings, 1 reply; 11+ messages in thread
From: Sergei Shtylyov @ 2016-09-19 17:31 UTC (permalink / raw)
  To: Wolfram Sang, linux-mmc; +Cc: linux-renesas-soc, Simon Horman, Dirk Behme

Hello.

On 09/19/2016 03:49 PM, Wolfram Sang wrote:

> We need to add R1 without CRC support, refactor the bus width routine a
> little and extend a quirk check. To support "non-removable;" we need a
> workaround which will be hopefully removed when reworking PM soon.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  drivers/mmc/host/tmio_mmc.h     |  3 +++
>  drivers/mmc/host/tmio_mmc_pio.c | 38 ++++++++++++++++++++++++++------------
>  2 files changed, 29 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
> index 4b501f2d529f6e..637581faf756b1 100644
> --- a/drivers/mmc/host/tmio_mmc.h
> +++ b/drivers/mmc/host/tmio_mmc.h
> @@ -79,6 +79,9 @@
>  #define	CLK_CTL_DIV_MASK	0xff
>  #define	CLK_CTL_SCLKEN		BIT(8)
>
> +#define CARD_OPT_WIDTH8		BIT(13)
> +#define CARD_OPT_WIDTH		BIT(15)
> +
>  #define TMIO_BBS		512		/* Boot block size */
>
>  /* Definitions for values the CTRL_SDIO_STATUS register can take. */
> diff --git a/drivers/mmc/host/tmio_mmc_pio.c b/drivers/mmc/host/tmio_mmc_pio.c
> index 46b5a456243b84..a0f05eb4f34490 100644
> --- a/drivers/mmc/host/tmio_mmc_pio.c
> +++ b/drivers/mmc/host/tmio_mmc_pio.c
[...]
> @@ -922,14 +925,16 @@ static void tmio_mmc_power_off(struct tmio_mmc_host *host)
>  static void tmio_mmc_set_bus_width(struct tmio_mmc_host *host,
>  				unsigned char bus_width)
>  {
> -	switch (bus_width) {
> -	case MMC_BUS_WIDTH_1:
> -		sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x80e0);
> -		break;
> -	case MMC_BUS_WIDTH_4:
> -		sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, 0x00e0);
> -		break;
> -	}
> +	u16 reg = sd_ctrl_read16(host, CTL_SD_MEM_CARD_OPT)
> +				& ~(CARD_OPT_WIDTH | CARD_OPT_WIDTH8);
> +
> +	/* reg now applies to MMC_BUS_WIDTH_4 */
> +	if (bus_width == MMC_BUS_WIDTH_1)
> +		reg |= CARD_OPT_WIDTH;
> +	else if (bus_width == MMC_BUS_WIDTH_8)
> +		reg |= CARD_OPT_WIDTH8;

    Why not *switch*?

[...]

MBR, Sergei

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

* Re: [PATCH v2 4/6] mmc: tmio: add eMMC support
  2016-09-19 17:31   ` Sergei Shtylyov
@ 2016-09-19 20:26     ` Wolfram Sang
  0 siblings, 0 replies; 11+ messages in thread
From: Wolfram Sang @ 2016-09-19 20:26 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Wolfram Sang, linux-mmc, linux-renesas-soc, Simon Horman,
	Dirk Behme

[-- Attachment #1: Type: text/plain, Size: 366 bytes --]


> >+	u16 reg = sd_ctrl_read16(host, CTL_SD_MEM_CARD_OPT)
> >+				& ~(CARD_OPT_WIDTH | CARD_OPT_WIDTH8);
> >+
> >+	/* reg now applies to MMC_BUS_WIDTH_4 */
> >+	if (bus_width == MMC_BUS_WIDTH_1)
> >+		reg |= CARD_OPT_WIDTH;
> >+	else if (bus_width == MMC_BUS_WIDTH_8)
> >+		reg |= CARD_OPT_WIDTH8;
> 
>    Why not *switch*?

Didn't look better to me.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH v2 5/6] arm64: dts: r8a7795: salvator: enable on-board eMMC
  2016-09-19 17:25   ` Sergei Shtylyov
@ 2016-09-19 20:29     ` Wolfram Sang
  0 siblings, 0 replies; 11+ messages in thread
From: Wolfram Sang @ 2016-09-19 20:29 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: Wolfram Sang, linux-mmc, linux-renesas-soc, Simon Horman,
	Dirk Behme

[-- Attachment #1: Type: text/plain, Size: 411 bytes --]


> >+	sdhi2_pins: sd2 {
> >+		groups = "sdhi2_data8", "sdhi2_ctrl";
> >+		function = "sdhi2";
> >+		power-source = <3300>;
> >+	};
> >+
> >+	sdhi2_pins_uhs: sd2 {
> >+		groups = "sdhi2_data8", "sdhi2_ctrl";
> >+		function = "sdhi2";
> >+		power-source = <1800>;
> >+	};
> >+
> 
>    I'm afraid you're just overriding the props in the first "sd2" node with
> this...

Oops, thanks, will fix!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2016-09-19 20:29 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-19 12:49 [PATCH v2 0/6] tmio: add support for eMMC with 8 bit bus width Wolfram Sang
2016-09-19 12:49 ` [PATCH v2 1/6] mmc: add define for R1 response without CRC Wolfram Sang
2016-09-19 12:49 ` [PATCH v2 2/6] mmc: rtsx_pci: use new macro for R1 " Wolfram Sang
2016-09-19 12:49 ` [PATCH v2 3/6] mmc: rtsx_usb: " Wolfram Sang
2016-09-19 12:49 ` [PATCH v2 4/6] mmc: tmio: add eMMC support Wolfram Sang
2016-09-19 17:31   ` Sergei Shtylyov
2016-09-19 20:26     ` Wolfram Sang
2016-09-19 12:49 ` [PATCH v2 5/6] arm64: dts: r8a7795: salvator: enable on-board eMMC Wolfram Sang
2016-09-19 17:25   ` Sergei Shtylyov
2016-09-19 20:29     ` Wolfram Sang
2016-09-19 12:49 ` [PATCH v2 6/6] arm64: dts: r8a7796: salvator: enable on board eMMC Wolfram Sang

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).