All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] mmc: meson-mx-sdhc: two fixes
@ 2021-12-19 15:34 ` Martin Blumenstingl
  0 siblings, 0 replies; 15+ messages in thread
From: Martin Blumenstingl @ 2021-12-19 15:34 UTC (permalink / raw)
  To: linux-mmc, linux-amlogic
  Cc: linux-kernel, linux-arm-kernel, ulf.hansson, Martin Blumenstingl

The first patch in this series fixes Broadcom SDIO wifi cards (using
the brcmfmac driver) on Meson8 SoCs. Meson8b with Realtek (RTL8723BS)
SDIO wifi is unaffected by this (it worked fine before). Testing was
done (on the S82 board) in private by a user who wants to remain
anonymous.

The second patch in this series is a minor cleanup which I found when
working on the first patch.

Changes since v1 [0]:
- Drop SD_IO_RW_DIRECT from the first patch since it has nothing to do
  with the actual problem. That command was carried over from the
  vendor driver. The patch description was also updated accordingly.
  Thanks to Ulf for spotting this!
- Add a comment to the manual_stop variable as suggested by Ulf


[0] https://patchwork.kernel.org/project/linux-amlogic/cover/20211212145956.1423755-1-martin.blumenstingl@googlemail.com/


Martin Blumenstingl (2):
  mmc: meson-mx-sdhc: Set MANUAL_STOP for multi-block SDIO commands
  mmc: meson-mx-sdhc: Drop unused MESON_SDHC_NUM_BUILTIN_CLKS macro

 drivers/mmc/host/meson-mx-sdhc-clkc.c |  2 --
 drivers/mmc/host/meson-mx-sdhc-mmc.c  | 16 ++++++++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)

-- 
2.34.1


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

* [PATCH v2 0/2] mmc: meson-mx-sdhc: two fixes
@ 2021-12-19 15:34 ` Martin Blumenstingl
  0 siblings, 0 replies; 15+ messages in thread
From: Martin Blumenstingl @ 2021-12-19 15:34 UTC (permalink / raw)
  To: linux-mmc, linux-amlogic
  Cc: linux-kernel, linux-arm-kernel, ulf.hansson, Martin Blumenstingl

The first patch in this series fixes Broadcom SDIO wifi cards (using
the brcmfmac driver) on Meson8 SoCs. Meson8b with Realtek (RTL8723BS)
SDIO wifi is unaffected by this (it worked fine before). Testing was
done (on the S82 board) in private by a user who wants to remain
anonymous.

The second patch in this series is a minor cleanup which I found when
working on the first patch.

Changes since v1 [0]:
- Drop SD_IO_RW_DIRECT from the first patch since it has nothing to do
  with the actual problem. That command was carried over from the
  vendor driver. The patch description was also updated accordingly.
  Thanks to Ulf for spotting this!
- Add a comment to the manual_stop variable as suggested by Ulf


[0] https://patchwork.kernel.org/project/linux-amlogic/cover/20211212145956.1423755-1-martin.blumenstingl@googlemail.com/


Martin Blumenstingl (2):
  mmc: meson-mx-sdhc: Set MANUAL_STOP for multi-block SDIO commands
  mmc: meson-mx-sdhc: Drop unused MESON_SDHC_NUM_BUILTIN_CLKS macro

 drivers/mmc/host/meson-mx-sdhc-clkc.c |  2 --
 drivers/mmc/host/meson-mx-sdhc-mmc.c  | 16 ++++++++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)

-- 
2.34.1


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* [PATCH v2 0/2] mmc: meson-mx-sdhc: two fixes
@ 2021-12-19 15:34 ` Martin Blumenstingl
  0 siblings, 0 replies; 15+ messages in thread
From: Martin Blumenstingl @ 2021-12-19 15:34 UTC (permalink / raw)
  To: linux-mmc, linux-amlogic
  Cc: linux-kernel, linux-arm-kernel, ulf.hansson, Martin Blumenstingl

The first patch in this series fixes Broadcom SDIO wifi cards (using
the brcmfmac driver) on Meson8 SoCs. Meson8b with Realtek (RTL8723BS)
SDIO wifi is unaffected by this (it worked fine before). Testing was
done (on the S82 board) in private by a user who wants to remain
anonymous.

The second patch in this series is a minor cleanup which I found when
working on the first patch.

Changes since v1 [0]:
- Drop SD_IO_RW_DIRECT from the first patch since it has nothing to do
  with the actual problem. That command was carried over from the
  vendor driver. The patch description was also updated accordingly.
  Thanks to Ulf for spotting this!
- Add a comment to the manual_stop variable as suggested by Ulf


[0] https://patchwork.kernel.org/project/linux-amlogic/cover/20211212145956.1423755-1-martin.blumenstingl@googlemail.com/


Martin Blumenstingl (2):
  mmc: meson-mx-sdhc: Set MANUAL_STOP for multi-block SDIO commands
  mmc: meson-mx-sdhc: Drop unused MESON_SDHC_NUM_BUILTIN_CLKS macro

 drivers/mmc/host/meson-mx-sdhc-clkc.c |  2 --
 drivers/mmc/host/meson-mx-sdhc-mmc.c  | 16 ++++++++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)

-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 1/2] mmc: meson-mx-sdhc: Set MANUAL_STOP for multi-block SDIO commands
  2021-12-19 15:34 ` Martin Blumenstingl
  (?)
@ 2021-12-19 15:34   ` Martin Blumenstingl
  -1 siblings, 0 replies; 15+ messages in thread
From: Martin Blumenstingl @ 2021-12-19 15:34 UTC (permalink / raw)
  To: linux-mmc, linux-amlogic
  Cc: linux-kernel, linux-arm-kernel, ulf.hansson, Martin Blumenstingl

The vendor driver implements special handling for multi-block
SD_IO_RW_EXTENDED (and SD_IO_RW_DIRECT) commands which have data
attached to them. It sets the MANUAL_STOP bit in the MESON_SDHC_MISC
register for these commands. In all other cases this bit is cleared.
Here we omit SD_IO_RW_DIRECT since that command never has any data
attached to it.

This fixes SDIO wifi using the brcmfmac driver which reported the
following error without this change on a Netxeon S82 board using a
Meson8 (S802) SoC:
  brcmf_fw_alloc_request: using brcm/brcmfmac43362-sdio for chip
                          BCM43362/1
  brcmf_sdiod_ramrw: membytes transfer failed
  brcmf_sdio_download_code_file: error -110 on writing 219557 membytes
                                 at 0x00000000
  brcmf_sdio_download_firmware: dongle image file download failed

And with this change:
  brcmf_fw_alloc_request: using brcm/brcmfmac43362-sdio for chip
                          BCM43362/1
  brcmf_c_process_clm_blob: no clm_blob available (err=-2), device may
                            have limited channels available
  brcmf_c_preinit_dcmds: Firmware: BCM43362/1 wl0: Apr 22 2013 14:50:00
                         version 5.90.195.89.6 FWID 01-b30a427d

Fixes: e4bf1b0970ef96 ("mmc: host: meson-mx-sdhc: new driver for the Amlogic Meson SDHC host")
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 drivers/mmc/host/meson-mx-sdhc-mmc.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/mmc/host/meson-mx-sdhc-mmc.c b/drivers/mmc/host/meson-mx-sdhc-mmc.c
index 7cd9c0ec2fcf..8fdd0bbbfa21 100644
--- a/drivers/mmc/host/meson-mx-sdhc-mmc.c
+++ b/drivers/mmc/host/meson-mx-sdhc-mmc.c
@@ -135,6 +135,7 @@ static void meson_mx_sdhc_start_cmd(struct mmc_host *mmc,
 				    struct mmc_command *cmd)
 {
 	struct meson_mx_sdhc_host *host = mmc_priv(mmc);
+	bool manual_stop = false;
 	u32 ictl, send;
 	int pack_len;
 
@@ -172,12 +173,27 @@ static void meson_mx_sdhc_start_cmd(struct mmc_host *mmc,
 		else
 			/* software flush: */
 			ictl |= MESON_SDHC_ICTL_DATA_XFER_OK;
+
+		/*
+		 * Mimic the logic from the vendor driver where (only)
+		 * SD_IO_RW_EXTENDED commands with more than one block set the
+		 * MESON_SDHC_MISC_MANUAL_STOP bit. This fixes the firmware
+		 * download in the brcmfmac driver for a BCM43362/1 card.
+		 * Without this sdio_memcpy_toio() (with a size of 219557
+		 * bytes) times out if MESON_SDHC_MISC_MANUAL_STOP is not set.
+		 */
+		manual_stop = cmd->data->blocks > 1 &&
+			      cmd->opcode == SD_IO_RW_EXTENDED;
 	} else {
 		pack_len = 0;
 
 		ictl |= MESON_SDHC_ICTL_RESP_OK;
 	}
 
+	regmap_update_bits(host->regmap, MESON_SDHC_MISC,
+			   MESON_SDHC_MISC_MANUAL_STOP,
+			   manual_stop ? MESON_SDHC_MISC_MANUAL_STOP : 0);
+
 	if (cmd->opcode == MMC_STOP_TRANSMISSION)
 		send |= MESON_SDHC_SEND_DATA_STOP;
 
-- 
2.34.1


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

* [PATCH v2 1/2] mmc: meson-mx-sdhc: Set MANUAL_STOP for multi-block SDIO commands
@ 2021-12-19 15:34   ` Martin Blumenstingl
  0 siblings, 0 replies; 15+ messages in thread
From: Martin Blumenstingl @ 2021-12-19 15:34 UTC (permalink / raw)
  To: linux-mmc, linux-amlogic
  Cc: linux-kernel, linux-arm-kernel, ulf.hansson, Martin Blumenstingl

The vendor driver implements special handling for multi-block
SD_IO_RW_EXTENDED (and SD_IO_RW_DIRECT) commands which have data
attached to them. It sets the MANUAL_STOP bit in the MESON_SDHC_MISC
register for these commands. In all other cases this bit is cleared.
Here we omit SD_IO_RW_DIRECT since that command never has any data
attached to it.

This fixes SDIO wifi using the brcmfmac driver which reported the
following error without this change on a Netxeon S82 board using a
Meson8 (S802) SoC:
  brcmf_fw_alloc_request: using brcm/brcmfmac43362-sdio for chip
                          BCM43362/1
  brcmf_sdiod_ramrw: membytes transfer failed
  brcmf_sdio_download_code_file: error -110 on writing 219557 membytes
                                 at 0x00000000
  brcmf_sdio_download_firmware: dongle image file download failed

And with this change:
  brcmf_fw_alloc_request: using brcm/brcmfmac43362-sdio for chip
                          BCM43362/1
  brcmf_c_process_clm_blob: no clm_blob available (err=-2), device may
                            have limited channels available
  brcmf_c_preinit_dcmds: Firmware: BCM43362/1 wl0: Apr 22 2013 14:50:00
                         version 5.90.195.89.6 FWID 01-b30a427d

Fixes: e4bf1b0970ef96 ("mmc: host: meson-mx-sdhc: new driver for the Amlogic Meson SDHC host")
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 drivers/mmc/host/meson-mx-sdhc-mmc.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/mmc/host/meson-mx-sdhc-mmc.c b/drivers/mmc/host/meson-mx-sdhc-mmc.c
index 7cd9c0ec2fcf..8fdd0bbbfa21 100644
--- a/drivers/mmc/host/meson-mx-sdhc-mmc.c
+++ b/drivers/mmc/host/meson-mx-sdhc-mmc.c
@@ -135,6 +135,7 @@ static void meson_mx_sdhc_start_cmd(struct mmc_host *mmc,
 				    struct mmc_command *cmd)
 {
 	struct meson_mx_sdhc_host *host = mmc_priv(mmc);
+	bool manual_stop = false;
 	u32 ictl, send;
 	int pack_len;
 
@@ -172,12 +173,27 @@ static void meson_mx_sdhc_start_cmd(struct mmc_host *mmc,
 		else
 			/* software flush: */
 			ictl |= MESON_SDHC_ICTL_DATA_XFER_OK;
+
+		/*
+		 * Mimic the logic from the vendor driver where (only)
+		 * SD_IO_RW_EXTENDED commands with more than one block set the
+		 * MESON_SDHC_MISC_MANUAL_STOP bit. This fixes the firmware
+		 * download in the brcmfmac driver for a BCM43362/1 card.
+		 * Without this sdio_memcpy_toio() (with a size of 219557
+		 * bytes) times out if MESON_SDHC_MISC_MANUAL_STOP is not set.
+		 */
+		manual_stop = cmd->data->blocks > 1 &&
+			      cmd->opcode == SD_IO_RW_EXTENDED;
 	} else {
 		pack_len = 0;
 
 		ictl |= MESON_SDHC_ICTL_RESP_OK;
 	}
 
+	regmap_update_bits(host->regmap, MESON_SDHC_MISC,
+			   MESON_SDHC_MISC_MANUAL_STOP,
+			   manual_stop ? MESON_SDHC_MISC_MANUAL_STOP : 0);
+
 	if (cmd->opcode == MMC_STOP_TRANSMISSION)
 		send |= MESON_SDHC_SEND_DATA_STOP;
 
-- 
2.34.1


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* [PATCH v2 1/2] mmc: meson-mx-sdhc: Set MANUAL_STOP for multi-block SDIO commands
@ 2021-12-19 15:34   ` Martin Blumenstingl
  0 siblings, 0 replies; 15+ messages in thread
From: Martin Blumenstingl @ 2021-12-19 15:34 UTC (permalink / raw)
  To: linux-mmc, linux-amlogic
  Cc: linux-kernel, linux-arm-kernel, ulf.hansson, Martin Blumenstingl

The vendor driver implements special handling for multi-block
SD_IO_RW_EXTENDED (and SD_IO_RW_DIRECT) commands which have data
attached to them. It sets the MANUAL_STOP bit in the MESON_SDHC_MISC
register for these commands. In all other cases this bit is cleared.
Here we omit SD_IO_RW_DIRECT since that command never has any data
attached to it.

This fixes SDIO wifi using the brcmfmac driver which reported the
following error without this change on a Netxeon S82 board using a
Meson8 (S802) SoC:
  brcmf_fw_alloc_request: using brcm/brcmfmac43362-sdio for chip
                          BCM43362/1
  brcmf_sdiod_ramrw: membytes transfer failed
  brcmf_sdio_download_code_file: error -110 on writing 219557 membytes
                                 at 0x00000000
  brcmf_sdio_download_firmware: dongle image file download failed

And with this change:
  brcmf_fw_alloc_request: using brcm/brcmfmac43362-sdio for chip
                          BCM43362/1
  brcmf_c_process_clm_blob: no clm_blob available (err=-2), device may
                            have limited channels available
  brcmf_c_preinit_dcmds: Firmware: BCM43362/1 wl0: Apr 22 2013 14:50:00
                         version 5.90.195.89.6 FWID 01-b30a427d

Fixes: e4bf1b0970ef96 ("mmc: host: meson-mx-sdhc: new driver for the Amlogic Meson SDHC host")
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 drivers/mmc/host/meson-mx-sdhc-mmc.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/mmc/host/meson-mx-sdhc-mmc.c b/drivers/mmc/host/meson-mx-sdhc-mmc.c
index 7cd9c0ec2fcf..8fdd0bbbfa21 100644
--- a/drivers/mmc/host/meson-mx-sdhc-mmc.c
+++ b/drivers/mmc/host/meson-mx-sdhc-mmc.c
@@ -135,6 +135,7 @@ static void meson_mx_sdhc_start_cmd(struct mmc_host *mmc,
 				    struct mmc_command *cmd)
 {
 	struct meson_mx_sdhc_host *host = mmc_priv(mmc);
+	bool manual_stop = false;
 	u32 ictl, send;
 	int pack_len;
 
@@ -172,12 +173,27 @@ static void meson_mx_sdhc_start_cmd(struct mmc_host *mmc,
 		else
 			/* software flush: */
 			ictl |= MESON_SDHC_ICTL_DATA_XFER_OK;
+
+		/*
+		 * Mimic the logic from the vendor driver where (only)
+		 * SD_IO_RW_EXTENDED commands with more than one block set the
+		 * MESON_SDHC_MISC_MANUAL_STOP bit. This fixes the firmware
+		 * download in the brcmfmac driver for a BCM43362/1 card.
+		 * Without this sdio_memcpy_toio() (with a size of 219557
+		 * bytes) times out if MESON_SDHC_MISC_MANUAL_STOP is not set.
+		 */
+		manual_stop = cmd->data->blocks > 1 &&
+			      cmd->opcode == SD_IO_RW_EXTENDED;
 	} else {
 		pack_len = 0;
 
 		ictl |= MESON_SDHC_ICTL_RESP_OK;
 	}
 
+	regmap_update_bits(host->regmap, MESON_SDHC_MISC,
+			   MESON_SDHC_MISC_MANUAL_STOP,
+			   manual_stop ? MESON_SDHC_MISC_MANUAL_STOP : 0);
+
 	if (cmd->opcode == MMC_STOP_TRANSMISSION)
 		send |= MESON_SDHC_SEND_DATA_STOP;
 
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH v2 2/2] mmc: meson-mx-sdhc: Drop unused MESON_SDHC_NUM_BUILTIN_CLKS macro
  2021-12-19 15:34 ` Martin Blumenstingl
  (?)
@ 2021-12-19 15:34   ` Martin Blumenstingl
  -1 siblings, 0 replies; 15+ messages in thread
From: Martin Blumenstingl @ 2021-12-19 15:34 UTC (permalink / raw)
  To: linux-mmc, linux-amlogic
  Cc: linux-kernel, linux-arm-kernel, ulf.hansson, Martin Blumenstingl

Remove MESON_SDHC_NUM_BUILTIN_CLKS because it is not used anywhere in
the driver.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 drivers/mmc/host/meson-mx-sdhc-clkc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/mmc/host/meson-mx-sdhc-clkc.c b/drivers/mmc/host/meson-mx-sdhc-clkc.c
index e1f29b279123..19200b7079a6 100644
--- a/drivers/mmc/host/meson-mx-sdhc-clkc.c
+++ b/drivers/mmc/host/meson-mx-sdhc-clkc.c
@@ -12,8 +12,6 @@
 
 #include "meson-mx-sdhc.h"
 
-#define MESON_SDHC_NUM_BUILTIN_CLKS	6
-
 struct meson_mx_sdhc_clkc {
 	struct clk_mux			src_sel;
 	struct clk_divider		div;
-- 
2.34.1


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

* [PATCH v2 2/2] mmc: meson-mx-sdhc: Drop unused MESON_SDHC_NUM_BUILTIN_CLKS macro
@ 2021-12-19 15:34   ` Martin Blumenstingl
  0 siblings, 0 replies; 15+ messages in thread
From: Martin Blumenstingl @ 2021-12-19 15:34 UTC (permalink / raw)
  To: linux-mmc, linux-amlogic
  Cc: linux-kernel, linux-arm-kernel, ulf.hansson, Martin Blumenstingl

Remove MESON_SDHC_NUM_BUILTIN_CLKS because it is not used anywhere in
the driver.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 drivers/mmc/host/meson-mx-sdhc-clkc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/mmc/host/meson-mx-sdhc-clkc.c b/drivers/mmc/host/meson-mx-sdhc-clkc.c
index e1f29b279123..19200b7079a6 100644
--- a/drivers/mmc/host/meson-mx-sdhc-clkc.c
+++ b/drivers/mmc/host/meson-mx-sdhc-clkc.c
@@ -12,8 +12,6 @@
 
 #include "meson-mx-sdhc.h"
 
-#define MESON_SDHC_NUM_BUILTIN_CLKS	6
-
 struct meson_mx_sdhc_clkc {
 	struct clk_mux			src_sel;
 	struct clk_divider		div;
-- 
2.34.1


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* [PATCH v2 2/2] mmc: meson-mx-sdhc: Drop unused MESON_SDHC_NUM_BUILTIN_CLKS macro
@ 2021-12-19 15:34   ` Martin Blumenstingl
  0 siblings, 0 replies; 15+ messages in thread
From: Martin Blumenstingl @ 2021-12-19 15:34 UTC (permalink / raw)
  To: linux-mmc, linux-amlogic
  Cc: linux-kernel, linux-arm-kernel, ulf.hansson, Martin Blumenstingl

Remove MESON_SDHC_NUM_BUILTIN_CLKS because it is not used anywhere in
the driver.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 drivers/mmc/host/meson-mx-sdhc-clkc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/mmc/host/meson-mx-sdhc-clkc.c b/drivers/mmc/host/meson-mx-sdhc-clkc.c
index e1f29b279123..19200b7079a6 100644
--- a/drivers/mmc/host/meson-mx-sdhc-clkc.c
+++ b/drivers/mmc/host/meson-mx-sdhc-clkc.c
@@ -12,8 +12,6 @@
 
 #include "meson-mx-sdhc.h"
 
-#define MESON_SDHC_NUM_BUILTIN_CLKS	6
-
 struct meson_mx_sdhc_clkc {
 	struct clk_mux			src_sel;
 	struct clk_divider		div;
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 1/2] mmc: meson-mx-sdhc: Set MANUAL_STOP for multi-block SDIO commands
  2021-12-19 15:34   ` Martin Blumenstingl
  (?)
@ 2021-12-21 13:02     ` Ulf Hansson
  -1 siblings, 0 replies; 15+ messages in thread
From: Ulf Hansson @ 2021-12-21 13:02 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: linux-mmc, linux-amlogic, linux-kernel, linux-arm-kernel

On Sun, 19 Dec 2021 at 16:34, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> The vendor driver implements special handling for multi-block
> SD_IO_RW_EXTENDED (and SD_IO_RW_DIRECT) commands which have data
> attached to them. It sets the MANUAL_STOP bit in the MESON_SDHC_MISC
> register for these commands. In all other cases this bit is cleared.
> Here we omit SD_IO_RW_DIRECT since that command never has any data
> attached to it.
>
> This fixes SDIO wifi using the brcmfmac driver which reported the
> following error without this change on a Netxeon S82 board using a
> Meson8 (S802) SoC:
>   brcmf_fw_alloc_request: using brcm/brcmfmac43362-sdio for chip
>                           BCM43362/1
>   brcmf_sdiod_ramrw: membytes transfer failed
>   brcmf_sdio_download_code_file: error -110 on writing 219557 membytes
>                                  at 0x00000000
>   brcmf_sdio_download_firmware: dongle image file download failed
>
> And with this change:
>   brcmf_fw_alloc_request: using brcm/brcmfmac43362-sdio for chip
>                           BCM43362/1
>   brcmf_c_process_clm_blob: no clm_blob available (err=-2), device may
>                             have limited channels available
>   brcmf_c_preinit_dcmds: Firmware: BCM43362/1 wl0: Apr 22 2013 14:50:00
>                          version 5.90.195.89.6 FWID 01-b30a427d
>
> Fixes: e4bf1b0970ef96 ("mmc: host: meson-mx-sdhc: new driver for the Amlogic Meson SDHC host")
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

Applied for fixes and by adding a stable tag, thanks!

Kind regards
Uffe



> ---
>  drivers/mmc/host/meson-mx-sdhc-mmc.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/drivers/mmc/host/meson-mx-sdhc-mmc.c b/drivers/mmc/host/meson-mx-sdhc-mmc.c
> index 7cd9c0ec2fcf..8fdd0bbbfa21 100644
> --- a/drivers/mmc/host/meson-mx-sdhc-mmc.c
> +++ b/drivers/mmc/host/meson-mx-sdhc-mmc.c
> @@ -135,6 +135,7 @@ static void meson_mx_sdhc_start_cmd(struct mmc_host *mmc,
>                                     struct mmc_command *cmd)
>  {
>         struct meson_mx_sdhc_host *host = mmc_priv(mmc);
> +       bool manual_stop = false;
>         u32 ictl, send;
>         int pack_len;
>
> @@ -172,12 +173,27 @@ static void meson_mx_sdhc_start_cmd(struct mmc_host *mmc,
>                 else
>                         /* software flush: */
>                         ictl |= MESON_SDHC_ICTL_DATA_XFER_OK;
> +
> +               /*
> +                * Mimic the logic from the vendor driver where (only)
> +                * SD_IO_RW_EXTENDED commands with more than one block set the
> +                * MESON_SDHC_MISC_MANUAL_STOP bit. This fixes the firmware
> +                * download in the brcmfmac driver for a BCM43362/1 card.
> +                * Without this sdio_memcpy_toio() (with a size of 219557
> +                * bytes) times out if MESON_SDHC_MISC_MANUAL_STOP is not set.
> +                */
> +               manual_stop = cmd->data->blocks > 1 &&
> +                             cmd->opcode == SD_IO_RW_EXTENDED;
>         } else {
>                 pack_len = 0;
>
>                 ictl |= MESON_SDHC_ICTL_RESP_OK;
>         }
>
> +       regmap_update_bits(host->regmap, MESON_SDHC_MISC,
> +                          MESON_SDHC_MISC_MANUAL_STOP,
> +                          manual_stop ? MESON_SDHC_MISC_MANUAL_STOP : 0);
> +
>         if (cmd->opcode == MMC_STOP_TRANSMISSION)
>                 send |= MESON_SDHC_SEND_DATA_STOP;
>
> --
> 2.34.1
>

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

* Re: [PATCH v2 1/2] mmc: meson-mx-sdhc: Set MANUAL_STOP for multi-block SDIO commands
@ 2021-12-21 13:02     ` Ulf Hansson
  0 siblings, 0 replies; 15+ messages in thread
From: Ulf Hansson @ 2021-12-21 13:02 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: linux-mmc, linux-amlogic, linux-kernel, linux-arm-kernel

On Sun, 19 Dec 2021 at 16:34, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> The vendor driver implements special handling for multi-block
> SD_IO_RW_EXTENDED (and SD_IO_RW_DIRECT) commands which have data
> attached to them. It sets the MANUAL_STOP bit in the MESON_SDHC_MISC
> register for these commands. In all other cases this bit is cleared.
> Here we omit SD_IO_RW_DIRECT since that command never has any data
> attached to it.
>
> This fixes SDIO wifi using the brcmfmac driver which reported the
> following error without this change on a Netxeon S82 board using a
> Meson8 (S802) SoC:
>   brcmf_fw_alloc_request: using brcm/brcmfmac43362-sdio for chip
>                           BCM43362/1
>   brcmf_sdiod_ramrw: membytes transfer failed
>   brcmf_sdio_download_code_file: error -110 on writing 219557 membytes
>                                  at 0x00000000
>   brcmf_sdio_download_firmware: dongle image file download failed
>
> And with this change:
>   brcmf_fw_alloc_request: using brcm/brcmfmac43362-sdio for chip
>                           BCM43362/1
>   brcmf_c_process_clm_blob: no clm_blob available (err=-2), device may
>                             have limited channels available
>   brcmf_c_preinit_dcmds: Firmware: BCM43362/1 wl0: Apr 22 2013 14:50:00
>                          version 5.90.195.89.6 FWID 01-b30a427d
>
> Fixes: e4bf1b0970ef96 ("mmc: host: meson-mx-sdhc: new driver for the Amlogic Meson SDHC host")
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

Applied for fixes and by adding a stable tag, thanks!

Kind regards
Uffe



> ---
>  drivers/mmc/host/meson-mx-sdhc-mmc.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/drivers/mmc/host/meson-mx-sdhc-mmc.c b/drivers/mmc/host/meson-mx-sdhc-mmc.c
> index 7cd9c0ec2fcf..8fdd0bbbfa21 100644
> --- a/drivers/mmc/host/meson-mx-sdhc-mmc.c
> +++ b/drivers/mmc/host/meson-mx-sdhc-mmc.c
> @@ -135,6 +135,7 @@ static void meson_mx_sdhc_start_cmd(struct mmc_host *mmc,
>                                     struct mmc_command *cmd)
>  {
>         struct meson_mx_sdhc_host *host = mmc_priv(mmc);
> +       bool manual_stop = false;
>         u32 ictl, send;
>         int pack_len;
>
> @@ -172,12 +173,27 @@ static void meson_mx_sdhc_start_cmd(struct mmc_host *mmc,
>                 else
>                         /* software flush: */
>                         ictl |= MESON_SDHC_ICTL_DATA_XFER_OK;
> +
> +               /*
> +                * Mimic the logic from the vendor driver where (only)
> +                * SD_IO_RW_EXTENDED commands with more than one block set the
> +                * MESON_SDHC_MISC_MANUAL_STOP bit. This fixes the firmware
> +                * download in the brcmfmac driver for a BCM43362/1 card.
> +                * Without this sdio_memcpy_toio() (with a size of 219557
> +                * bytes) times out if MESON_SDHC_MISC_MANUAL_STOP is not set.
> +                */
> +               manual_stop = cmd->data->blocks > 1 &&
> +                             cmd->opcode == SD_IO_RW_EXTENDED;
>         } else {
>                 pack_len = 0;
>
>                 ictl |= MESON_SDHC_ICTL_RESP_OK;
>         }
>
> +       regmap_update_bits(host->regmap, MESON_SDHC_MISC,
> +                          MESON_SDHC_MISC_MANUAL_STOP,
> +                          manual_stop ? MESON_SDHC_MISC_MANUAL_STOP : 0);
> +
>         if (cmd->opcode == MMC_STOP_TRANSMISSION)
>                 send |= MESON_SDHC_SEND_DATA_STOP;
>
> --
> 2.34.1
>

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH v2 1/2] mmc: meson-mx-sdhc: Set MANUAL_STOP for multi-block SDIO commands
@ 2021-12-21 13:02     ` Ulf Hansson
  0 siblings, 0 replies; 15+ messages in thread
From: Ulf Hansson @ 2021-12-21 13:02 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: linux-mmc, linux-amlogic, linux-kernel, linux-arm-kernel

On Sun, 19 Dec 2021 at 16:34, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> The vendor driver implements special handling for multi-block
> SD_IO_RW_EXTENDED (and SD_IO_RW_DIRECT) commands which have data
> attached to them. It sets the MANUAL_STOP bit in the MESON_SDHC_MISC
> register for these commands. In all other cases this bit is cleared.
> Here we omit SD_IO_RW_DIRECT since that command never has any data
> attached to it.
>
> This fixes SDIO wifi using the brcmfmac driver which reported the
> following error without this change on a Netxeon S82 board using a
> Meson8 (S802) SoC:
>   brcmf_fw_alloc_request: using brcm/brcmfmac43362-sdio for chip
>                           BCM43362/1
>   brcmf_sdiod_ramrw: membytes transfer failed
>   brcmf_sdio_download_code_file: error -110 on writing 219557 membytes
>                                  at 0x00000000
>   brcmf_sdio_download_firmware: dongle image file download failed
>
> And with this change:
>   brcmf_fw_alloc_request: using brcm/brcmfmac43362-sdio for chip
>                           BCM43362/1
>   brcmf_c_process_clm_blob: no clm_blob available (err=-2), device may
>                             have limited channels available
>   brcmf_c_preinit_dcmds: Firmware: BCM43362/1 wl0: Apr 22 2013 14:50:00
>                          version 5.90.195.89.6 FWID 01-b30a427d
>
> Fixes: e4bf1b0970ef96 ("mmc: host: meson-mx-sdhc: new driver for the Amlogic Meson SDHC host")
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

Applied for fixes and by adding a stable tag, thanks!

Kind regards
Uffe



> ---
>  drivers/mmc/host/meson-mx-sdhc-mmc.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/drivers/mmc/host/meson-mx-sdhc-mmc.c b/drivers/mmc/host/meson-mx-sdhc-mmc.c
> index 7cd9c0ec2fcf..8fdd0bbbfa21 100644
> --- a/drivers/mmc/host/meson-mx-sdhc-mmc.c
> +++ b/drivers/mmc/host/meson-mx-sdhc-mmc.c
> @@ -135,6 +135,7 @@ static void meson_mx_sdhc_start_cmd(struct mmc_host *mmc,
>                                     struct mmc_command *cmd)
>  {
>         struct meson_mx_sdhc_host *host = mmc_priv(mmc);
> +       bool manual_stop = false;
>         u32 ictl, send;
>         int pack_len;
>
> @@ -172,12 +173,27 @@ static void meson_mx_sdhc_start_cmd(struct mmc_host *mmc,
>                 else
>                         /* software flush: */
>                         ictl |= MESON_SDHC_ICTL_DATA_XFER_OK;
> +
> +               /*
> +                * Mimic the logic from the vendor driver where (only)
> +                * SD_IO_RW_EXTENDED commands with more than one block set the
> +                * MESON_SDHC_MISC_MANUAL_STOP bit. This fixes the firmware
> +                * download in the brcmfmac driver for a BCM43362/1 card.
> +                * Without this sdio_memcpy_toio() (with a size of 219557
> +                * bytes) times out if MESON_SDHC_MISC_MANUAL_STOP is not set.
> +                */
> +               manual_stop = cmd->data->blocks > 1 &&
> +                             cmd->opcode == SD_IO_RW_EXTENDED;
>         } else {
>                 pack_len = 0;
>
>                 ictl |= MESON_SDHC_ICTL_RESP_OK;
>         }
>
> +       regmap_update_bits(host->regmap, MESON_SDHC_MISC,
> +                          MESON_SDHC_MISC_MANUAL_STOP,
> +                          manual_stop ? MESON_SDHC_MISC_MANUAL_STOP : 0);
> +
>         if (cmd->opcode == MMC_STOP_TRANSMISSION)
>                 send |= MESON_SDHC_SEND_DATA_STOP;
>
> --
> 2.34.1
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2 2/2] mmc: meson-mx-sdhc: Drop unused MESON_SDHC_NUM_BUILTIN_CLKS macro
  2021-12-19 15:34   ` Martin Blumenstingl
  (?)
@ 2021-12-21 13:02     ` Ulf Hansson
  -1 siblings, 0 replies; 15+ messages in thread
From: Ulf Hansson @ 2021-12-21 13:02 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: linux-mmc, linux-amlogic, linux-kernel, linux-arm-kernel

On Sun, 19 Dec 2021 at 16:34, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> Remove MESON_SDHC_NUM_BUILTIN_CLKS because it is not used anywhere in
> the driver.
>
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/meson-mx-sdhc-clkc.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/mmc/host/meson-mx-sdhc-clkc.c b/drivers/mmc/host/meson-mx-sdhc-clkc.c
> index e1f29b279123..19200b7079a6 100644
> --- a/drivers/mmc/host/meson-mx-sdhc-clkc.c
> +++ b/drivers/mmc/host/meson-mx-sdhc-clkc.c
> @@ -12,8 +12,6 @@
>
>  #include "meson-mx-sdhc.h"
>
> -#define MESON_SDHC_NUM_BUILTIN_CLKS    6
> -
>  struct meson_mx_sdhc_clkc {
>         struct clk_mux                  src_sel;
>         struct clk_divider              div;
> --
> 2.34.1
>

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

* Re: [PATCH v2 2/2] mmc: meson-mx-sdhc: Drop unused MESON_SDHC_NUM_BUILTIN_CLKS macro
@ 2021-12-21 13:02     ` Ulf Hansson
  0 siblings, 0 replies; 15+ messages in thread
From: Ulf Hansson @ 2021-12-21 13:02 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: linux-mmc, linux-amlogic, linux-kernel, linux-arm-kernel

On Sun, 19 Dec 2021 at 16:34, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> Remove MESON_SDHC_NUM_BUILTIN_CLKS because it is not used anywhere in
> the driver.
>
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/meson-mx-sdhc-clkc.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/mmc/host/meson-mx-sdhc-clkc.c b/drivers/mmc/host/meson-mx-sdhc-clkc.c
> index e1f29b279123..19200b7079a6 100644
> --- a/drivers/mmc/host/meson-mx-sdhc-clkc.c
> +++ b/drivers/mmc/host/meson-mx-sdhc-clkc.c
> @@ -12,8 +12,6 @@
>
>  #include "meson-mx-sdhc.h"
>
> -#define MESON_SDHC_NUM_BUILTIN_CLKS    6
> -
>  struct meson_mx_sdhc_clkc {
>         struct clk_mux                  src_sel;
>         struct clk_divider              div;
> --
> 2.34.1
>

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH v2 2/2] mmc: meson-mx-sdhc: Drop unused MESON_SDHC_NUM_BUILTIN_CLKS macro
@ 2021-12-21 13:02     ` Ulf Hansson
  0 siblings, 0 replies; 15+ messages in thread
From: Ulf Hansson @ 2021-12-21 13:02 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: linux-mmc, linux-amlogic, linux-kernel, linux-arm-kernel

On Sun, 19 Dec 2021 at 16:34, Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
>
> Remove MESON_SDHC_NUM_BUILTIN_CLKS because it is not used anywhere in
> the driver.
>
> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/meson-mx-sdhc-clkc.c | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/drivers/mmc/host/meson-mx-sdhc-clkc.c b/drivers/mmc/host/meson-mx-sdhc-clkc.c
> index e1f29b279123..19200b7079a6 100644
> --- a/drivers/mmc/host/meson-mx-sdhc-clkc.c
> +++ b/drivers/mmc/host/meson-mx-sdhc-clkc.c
> @@ -12,8 +12,6 @@
>
>  #include "meson-mx-sdhc.h"
>
> -#define MESON_SDHC_NUM_BUILTIN_CLKS    6
> -
>  struct meson_mx_sdhc_clkc {
>         struct clk_mux                  src_sel;
>         struct clk_divider              div;
> --
> 2.34.1
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2021-12-21 13:04 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-19 15:34 [PATCH v2 0/2] mmc: meson-mx-sdhc: two fixes Martin Blumenstingl
2021-12-19 15:34 ` Martin Blumenstingl
2021-12-19 15:34 ` Martin Blumenstingl
2021-12-19 15:34 ` [PATCH v2 1/2] mmc: meson-mx-sdhc: Set MANUAL_STOP for multi-block SDIO commands Martin Blumenstingl
2021-12-19 15:34   ` Martin Blumenstingl
2021-12-19 15:34   ` Martin Blumenstingl
2021-12-21 13:02   ` Ulf Hansson
2021-12-21 13:02     ` Ulf Hansson
2021-12-21 13:02     ` Ulf Hansson
2021-12-19 15:34 ` [PATCH v2 2/2] mmc: meson-mx-sdhc: Drop unused MESON_SDHC_NUM_BUILTIN_CLKS macro Martin Blumenstingl
2021-12-19 15:34   ` Martin Blumenstingl
2021-12-19 15:34   ` Martin Blumenstingl
2021-12-21 13:02   ` Ulf Hansson
2021-12-21 13:02     ` Ulf Hansson
2021-12-21 13:02     ` Ulf Hansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.