public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: David Hewitt <davidmhewitt@gmail.com>
To: u-boot@lists.denx.de
Cc: David Hewitt <davidmhewitt@gmail.com>,
	Simon Glass <sjg@chromium.org>,
	Philipp Tomsich <philipp.tomsich@vrull.eu>,
	Kever Yang <kever.yang@rock-chips.com>,
	Peng Fan <peng.fan@nxp.com>,
	Jaehoon Chung <jh80.chung@samsung.com>
Subject: [PATCH 2/2] mmc: Add quirk to disable PWREN for dw_mmc
Date: Mon, 10 Jul 2023 12:05:58 +0100	[thread overview]
Message-ID: <20230710110558.61852-3-davidmhewitt@gmail.com> (raw)
In-Reply-To: <20230710110558.61852-1-davidmhewitt@gmail.com>

This is required for correct booting of the PINE64 PineTab2. If
PWREN is pulled high on this device, the SD card cannot be detected.

This is required in other PINE64 devices (e.g. Quartz64 Model A) too.

See commit ba33172a36f298641f51a5e6b855c3e89e3f5d3e in
https://github.com/CounterPillow/u-boot-quartz64

Signed-off-by: David Hewitt <davidmhewitt@gmail.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Philipp Tomsich <philipp.tomsich@vrull.eu>
Cc: Kever Yang <kever.yang@rock-chips.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
---
 drivers/mmc/dw_mmc.c            | 3 ++-
 drivers/mmc/rockchip_dw_mmc.c   | 3 +++
 include/configs/rk3568_common.h | 4 ++--
 include/dwmmc.h                 | 1 +
 4 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
index 5085a3b491..cb1d99132f 100644
--- a/drivers/mmc/dw_mmc.c
+++ b/drivers/mmc/dw_mmc.c
@@ -530,7 +530,8 @@ static int dwmci_init(struct mmc *mmc)
 	if (host->board_init)
 		host->board_init(host);
 
-	dwmci_writel(host, DWMCI_PWREN, 1);
+	if (!(host->quirks & DWMCI_QUIRK_DISABLE_PWREN))
+		dwmci_writel(host, DWMCI_PWREN, 1);
 
 	if (!dwmci_wait_reset(host, DWMCI_RESET_ALL)) {
 		debug("%s[%d] Fail-reset!!\n", __func__, __LINE__);
diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c
index 72c820ee63..af6ac59a46 100644
--- a/drivers/mmc/rockchip_dw_mmc.c
+++ b/drivers/mmc/rockchip_dw_mmc.c
@@ -78,6 +78,9 @@ static int rockchip_dwmmc_of_to_plat(struct udevice *dev)
 	else
 		host->dev_index = 1;
 
+	if (dev_read_bool(dev, "rockchip,disable-pwren-quirk"))
+		host->quirks |= DWMCI_QUIRK_DISABLE_PWREN;
+
 	priv->fifo_depth = dev_read_u32_default(dev, "fifo-depth", 0);
 
 	if (priv->fifo_depth < 0)
diff --git a/include/configs/rk3568_common.h b/include/configs/rk3568_common.h
index 1b7d3437b1..fb9897ff2e 100644
--- a/include/configs/rk3568_common.h
+++ b/include/configs/rk3568_common.h
@@ -20,10 +20,10 @@
 	"script_offset_f=0xffe000\0"	\
 	"script_size_f=0x2000\0"	\
 	"pxefile_addr_r=0x00e00000\0"	\
-	"fdt_addr_r=0x0a100000\0"	\
+	"fdt_addr_r=0x0c000000\0"	\
 	"fdtoverlay_addr_r=0x02000000\0"	\
 	"kernel_addr_r=0x02080000\0"	\
-	"ramdisk_addr_r=0x0a200000\0"	\
+	"ramdisk_addr_r=0x0c100000\0"	\
 	"kernel_comp_addr_r=0x08000000\0"	\
 	"kernel_comp_size=0x2000000\0"
 
diff --git a/include/dwmmc.h b/include/dwmmc.h
index 136a95b8cd..98aebb46f1 100644
--- a/include/dwmmc.h
+++ b/include/dwmmc.h
@@ -141,6 +141,7 @@
 
 /* quirks */
 #define DWMCI_QUIRK_DISABLE_SMU		(1 << 0)
+#define DWMCI_QUIRK_DISABLE_PWREN	(1 << 1)
 
 /**
  * struct dwmci_host - Information about a designware MMC host
-- 
2.34.1


  parent reply	other threads:[~2023-07-10 12:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-10 11:05 [PATCH 0/2] Add initial support for PINE64 PineTab2 David Hewitt
2023-07-10 11:05 ` [PATCH 1/2] rockchip: Add initial support for the PineTab2 from PINE64 David Hewitt
2023-07-10 17:18   ` Jonas Karlman
2023-07-10 11:05 ` David Hewitt [this message]
2023-07-10 13:08   ` [PATCH v2 2/2] mmc: Add quirk to disable PWREN for dw_mmc David Hewitt
2023-07-10 16:51     ` Jonas Karlman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230710110558.61852-3-davidmhewitt@gmail.com \
    --to=davidmhewitt@gmail.com \
    --cc=jh80.chung@samsung.com \
    --cc=kever.yang@rock-chips.com \
    --cc=peng.fan@nxp.com \
    --cc=philipp.tomsich@vrull.eu \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox