From: Chris Morgan <macroalpha82@gmail.com>
To: u-boot@lists.denx.de
Cc: sjg@chromium.org, jernej.skrabec@gmail.com,
neil.armstrong@linaro.org, hdegoede@redhat.com,
andre.przywara@arm.com, jagan@amarulasolutions.com,
trini@konsulko.com, ryan@testtoast.com, iuncuim@gmail.com,
sumit.garg@linaro.org, Chris Morgan <macromorgan@hotmail.com>
Subject: [PATCH V3 2/9] sunxi: H616: DRAM: Add alternative pin mapping
Date: Fri, 30 Aug 2024 10:55:07 -0500 [thread overview]
Message-ID: <20240830155514.481410-3-macroalpha82@gmail.com> (raw)
In-Reply-To: <20240830155514.481410-1-macroalpha82@gmail.com>
From: Chris Morgan <macromorgan@hotmail.com>
It seems that different dies need different PHY pin mapping. Select
alternatives at compile time.
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
[adapted to switch from runtime to compile time config]
Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
---
arch/arm/mach-sunxi/Kconfig | 17 +++++++++++++++++
arch/arm/mach-sunxi/dram_sun50i_h616.c | 22 +++++++++++++++++++++-
2 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index 17666814c5..078f8c19fa 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -108,6 +108,23 @@ config DRAM_SUN50I_H616_TPR12
default 0x0
help
TPR12 value from vendor DRAM settings.
+
+choice
+ prompt "H616 PHY pin mapping selection"
+ default DRAM_SUN50I_H616_PHY_ADDR_MAP_0
+
+config DRAM_SUN50I_H616_PHY_ADDR_MAP_0
+ bool "H313/H616/H618"
+ help
+ The pin mapping selection used by the H313, H616, H618, and
+ possibly other dies which use the H616 DRAM controller.
+
+config DRAM_SUN50I_H616_PHY_ADDR_MAP_1
+ bool "H700"
+ help
+ The pin mapping selection used by the H700 and possibly other
+ dies which use the H616 DRAM controller.
+endchoice
endif
config SUN6I_PRCM
diff --git a/arch/arm/mach-sunxi/dram_sun50i_h616.c b/arch/arm/mach-sunxi/dram_sun50i_h616.c
index 5be2887a06..52f7799173 100644
--- a/arch/arm/mach-sunxi/dram_sun50i_h616.c
+++ b/arch/arm/mach-sunxi/dram_sun50i_h616.c
@@ -225,6 +225,26 @@ static void mctl_set_addrmap(const struct dram_config *config)
mctl_ctl->addrmap[8] = 0x3F3F;
}
+#ifdef CONFIG_DRAM_SUN50I_H616_PHY_ADDR_MAP_1
+static const u8 phy_init[] = {
+#ifdef CONFIG_SUNXI_DRAM_H616_DDR3_1333
+ 0x08, 0x02, 0x12, 0x05, 0x15, 0x17, 0x18, 0x0b,
+ 0x14, 0x07, 0x04, 0x13, 0x0c, 0x00, 0x16, 0x1a,
+ 0x0a, 0x11, 0x03, 0x10, 0x0e, 0x01, 0x0d, 0x19,
+ 0x06, 0x09, 0x0f
+#elif defined(CONFIG_SUNXI_DRAM_H616_LPDDR3)
+ 0x18, 0x00, 0x04, 0x09, 0x06, 0x05, 0x02, 0x19,
+ 0x17, 0x03, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x07,
+ 0x08, 0x01, 0x1a
+#elif defined(CONFIG_SUNXI_DRAM_H616_LPDDR4)
+ 0x03, 0x00, 0x17, 0x05, 0x02, 0x19, 0x06, 0x07,
+ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x01,
+ 0x18, 0x04, 0x1a
+#endif
+};
+#else /* CONFIG_DRAM_SUN50I_H616_PHY_ADDR_MAP_0 */
static const u8 phy_init[] = {
#ifdef CONFIG_SUNXI_DRAM_H616_DDR3_1333
0x07, 0x0b, 0x02, 0x16, 0x0d, 0x0e, 0x14, 0x19,
@@ -243,7 +263,7 @@ static const u8 phy_init[] = {
0x18, 0x03, 0x1a
#endif
};
-
+#endif /* CONFIG_DRAM_SUN50I_H616_PHY_ADDR_MAP_0 */
#define MASK_BYTE(reg, nr) (((reg) >> ((nr) * 8)) & 0x1f)
static void mctl_phy_configure_odt(const struct dram_para *para)
{
--
2.34.1
next prev parent reply other threads:[~2024-08-30 15:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-30 15:55 [PATCH V3 0/9] Add Anbernic RG35XX-2024 Chris Morgan
2024-08-30 15:55 ` [PATCH V3 1/9] sunxi: H616: dram: LPDDR4: adjust settings Chris Morgan
2024-08-30 15:55 ` Chris Morgan [this message]
2024-08-30 15:55 ` [PATCH V3 3/9] sunxi: H616: DRAM: Adjust configuration procedure Chris Morgan
2024-08-30 15:55 ` [PATCH V3 4/9] sunxi: H616: DRAM: Adjust size scan procedure Chris Morgan
2024-08-30 15:55 ` [PATCH V3 5/9] sunxi: H616: dram: Update mbus priorities Chris Morgan
2024-09-02 22:36 ` Andre Przywara
2024-08-30 15:55 ` [PATCH V3 6/9] sunxi: Correct TPR6 parameter for H616 DRAM driver Chris Morgan
2024-09-02 22:35 ` Andre Przywara
2024-08-30 15:55 ` [PATCH V3 7/9] arm64: dts: allwinner: h616: Add r_i2c pinctrl nodes Chris Morgan
2024-09-04 4:32 ` Sumit Garg
2024-09-04 9:11 ` Andre Przywara
2024-08-30 15:55 ` [PATCH V3 8/9] arm64: dts: allwinner: h616: Change RG35XX PMIC to r_i2c Chris Morgan
2024-08-30 15:55 ` [PATCH V3 9/9] sunxi: Add support for Anbernic RG35XX-2024 Chris Morgan
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=20240830155514.481410-3-macroalpha82@gmail.com \
--to=macroalpha82@gmail.com \
--cc=andre.przywara@arm.com \
--cc=hdegoede@redhat.com \
--cc=iuncuim@gmail.com \
--cc=jagan@amarulasolutions.com \
--cc=jernej.skrabec@gmail.com \
--cc=macromorgan@hotmail.com \
--cc=neil.armstrong@linaro.org \
--cc=ryan@testtoast.com \
--cc=sjg@chromium.org \
--cc=sumit.garg@linaro.org \
--cc=trini@konsulko.com \
--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 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.