Add Anbernic RG35XX-2024
Subsystems (3)
v3 cover Add Anbernic RG35XX-2024
From: Chris Morgan <[email protected]>
Add support for the Anbernic RG35XX-2024.
This device is a handheld gaming console (series) based around the Anbernic H700 SoC. It comes with 1GB of RAM and multiple face buttons for input.
Add support for the simplest model for now, and then iterate later to add board detection logic, support the entire device lineup, and move to using the mainline device tree.
Changes since V2:
- Moved back to using the U-Boot specific device tree, for now.
- Changed the cherry picked device tree commits to update both the U-Boot device tree and the mainline device tree, so either could be used.
- Made the DRAM PHY pinconf compile time selectable instead of runtime selectable to decrease SPL memory usage.
Changes since V1:
- Removed DDR3 and LPDDR3 patches from Jernej Skrabec, as they could not be tested by me and were not required to bring up this device.
- Changed the default TPR6 parameter based on a suggestion from Mikhail Kalashnikov.
- Cherry picked 2 commits from linux-next and converted devicetree to upstream.
Chris Morgan (5):
sunxi: H616: DRAM: Add alternative pin mapping
sunxi: Correct TPR6 parameter for H616 DRAM driver
arm64: dts: allwinner: h616: Add r_i2c pinctrl nodes
arm64: dts: allwinner: h616: Change RG35XX PMIC to r_i2c
sunxi: Add support for Anbernic RG35XX-2024
Jernej Skrabec (4):
sunxi: H616: dram: LPDDR4: adjust settings
sunxi: H616: DRAM: Adjust configuration procedure
sunxi: H616: DRAM: Adjust size scan procedure
sunxi: H616: dram: Update mbus priorities
arch/arm/dts/sun50i-h616.dtsi | 2 + .../dts/sun50i-h700-anbernic-rg35xx-2024.dts | 6 +- arch/arm/mach-sunxi/Kconfig | 19 ++- arch/arm/mach-sunxi/dram_sun50i_h616.c | 137 ++++++++++++------ .../dram_timings/h616_lpddr4_2133.c | 2 +- board/sunxi/MAINTAINERS | 5 + configs/anbernic_rg35xx_h700_defconfig | 28 ++++ .../src/arm64/allwinner/sun50i-h616.dtsi | 2 + .../sun50i-h700-anbernic-rg35xx-2024.dts | 6 +- 9 files changed, 154 insertions(+), 53 deletions(-) create mode 100644 configs/anbernic_rg35xx_h700_defconfig
Signature · 1 line
2.34.1
PATCH v3 1/9 sunxi: H616: dram: LPDDR4: adjust settings
From: Jernej Skrabec <[email protected]>
Adjust H616 LPDDR4 DRAM settings to be in line with vendor driver.
--- arch/arm/mach-sunxi/dram_sun50i_h616.c | 33 +++++++++++++------ .../dram_timings/h616_lpddr4_2133.c | 2 +- 2 files changed, 24 insertions(+), 11 deletions(-)
arch/arm/mach-sunxi/dram_sun50i_h616.c +23 -10
@@ -293,14 +293,22 @@ static void mctl_phy_configure_odt(const struct dram_para *para)dmb (); } -static bool mctl_phy_write_leveling (const struct dram_config *config) +static bool mctl_phy_write_leveling (const struct dram_para *para, +const struct dram_config *config) {bool result = true;u32 val;clrsetbits_le32 (SUNXI_DRAM_PHY0_BASE +8 ,0xc0 ,0x80 ); -writel (4 ,SUNXI_DRAM_PHY0_BASE +0xc ); -writel (0x40 ,SUNXI_DRAM_PHY0_BASE +0x10 ); + +if (para->type ==SUNXI_DRAM_TYPE_LPDDR4 ) { +/* MR2 value */ +writel (0x1b ,SUNXI_DRAM_PHY0_BASE +0xc ); +writel (0 ,SUNXI_DRAM_PHY0_BASE +0x10 ); + }else { +writel (4 ,SUNXI_DRAM_PHY0_BASE +0xc ); +writel (0x40 ,SUNXI_DRAM_PHY0_BASE +0x10 ); + }setbits_le32 (SUNXI_DRAM_PHY0_BASE +8 ,4 );
@@ -859,9 +867,9 @@ static void mctl_phy_ca_bit_delay_compensation(const struct dram_para *para, }break ;case SUNXI_DRAM_TYPE_LPDDR4 : -if (para->tpr2 &1 ) { -writel (val,SUNXI_DRAM_PHY0_BASE +0x788 ); - }else { +writel (val,SUNXI_DRAM_PHY0_BASE +0x788 ); +if (config->ranks ==2 ) { + val = (para->tpr10 >>11 ) &0x1e ;writel (val,SUNXI_DRAM_PHY0_BASE +0x794 ); };break ;
@@ -1080,19 +1088,27 @@ static bool mctl_phy_init(const struct dram_para *para,mctl_await_completion (&mctl_ctl->mrctrl0,BIT (31 ),0 );writel (0xb04 , &mctl_ctl->mrctrl1); +udelay (10 );writel (0x80000030 , &mctl_ctl->mrctrl0); +udelay (10 );mctl_await_completion (&mctl_ctl->mrctrl0,BIT (31 ),0 );writel (0xc72 , &mctl_ctl->mrctrl1); +udelay (10 );writel (0x80000030 , &mctl_ctl->mrctrl0); +udelay (10 );mctl_await_completion (&mctl_ctl->mrctrl0,BIT (31 ),0 );writel (0xe09 , &mctl_ctl->mrctrl1); +udelay (10 );writel (0x80000030 , &mctl_ctl->mrctrl0); +udelay (10 );mctl_await_completion (&mctl_ctl->mrctrl0,BIT (31 ),0 );writel (0x1624 , &mctl_ctl->mrctrl1); +udelay (10 );writel (0x80000030 , &mctl_ctl->mrctrl0); +udelay (10 );mctl_await_completion (&mctl_ctl->mrctrl0,BIT (31 ),0 );break ;case SUNXI_DRAM_TYPE_DDR4 :
@@ -1108,7 +1124,7 @@ static bool mctl_phy_init(const struct dram_para *para,if (para->tpr10 &TPR10_WRITE_LEVELING ) {for (i =0 ; i <5 ; i++) -if (mctl_phy_write_leveling (config)) +if (mctl_phy_write_leveling (para, config))break ;if (i ==5 ) {debug ("write leveling failed!\n" );
@@ -1234,9 +1250,6 @@ static bool mctl_ctrl_init(const struct dram_para *para,setbits_le32 (&mctl_ctl->unk_0x3180,BIT (31 ) |BIT (30 ));setbits_le32 (&mctl_ctl->unk_0x4180,BIT (31 ) |BIT (30 )); -if (para->type ==SUNXI_DRAM_TYPE_LPDDR4 ) -setbits_le32 (&mctl_ctl->dbictl,0x1 ); -setbits_le32 (&mctl_ctl->rfshctl3,BIT (0 ));clrbits_le32 (&mctl_ctl->dfimisc,BIT (0 ));
arch/arm/mach-sunxi/dram_timings/h616_lpddr4_2133.c +1 -1
@@ -23,7 +23,7 @@ void mctl_set_timing_params(const struct dram_para *para)u8 trcd =max (ns_to_t (18 ),2 );u8 trc =ns_to_t (65 );u8 txp =max (ns_to_t (8 ),2 ); -u8 trtp =max (ns_to_t (8 ),4 ); +u8 trtp =4 ;u8 trp =ns_to_t (21 );u8 tras =ns_to_t (42 );u16 trefi =ns_to_t (3904 ) /32 ;
Signature · 1 line
2.34.1
PATCH v3 2/9 sunxi: H616: DRAM: Add alternative pin mapping
In reply to Chris MorganFrom: Chris Morgan <[email protected]>
It seems that different dies need different PHY pin mapping. Select alternatives at compile time.
--- arch/arm/mach-sunxi/Kconfig | 17 +++++++++++++++++ arch/arm/mach-sunxi/dram_sun50i_h616.c | 22 +++++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-)
arch/arm/mach-sunxi/Kconfig +17 -0
@@ -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
arch/arm/mach-sunxi/dram_sun50i_h616.c +21 -1
@@ -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) {
Signature · 1 line
2.34.1
PATCH v3 3/9 sunxi: H616: DRAM: Adjust configuration procedure
In reply to Chris MorganFrom: Jernej Skrabec <[email protected]>
When comparing configuration procedure to vendor driver, I noticed that one command was out of order and that some delays were missing.
Fix that.
--- arch/arm/mach-sunxi/dram_sun50i_h616.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
arch/arm/mach-sunxi/dram_sun50i_h616.c +9 -1
@@ -1014,12 +1014,16 @@ static bool mctl_phy_init(const struct dram_para *para,clrsetbits_le32 (SUNXI_DRAM_PHY0_BASE +0x14c ,0xe0 ,0x20 ); } +clrbits_le32 (&mctl_com->unk_0x500,0x200 ); +udelay (1 ); +clrbits_le32 (SUNXI_DRAM_PHY0_BASE +0x14c ,8 );mctl_await_completion ((u32 *)(SUNXI_DRAM_PHY0_BASE +0x180 ),4 ,4 ); +udelay (1000 ); +writel (0x37 ,SUNXI_DRAM_PHY0_BASE +0x58 ); -clrbits_le32 (&mctl_com->unk_0x500,0x200 );writel (0 , &mctl_ctl->swctl);setbits_le32 (&mctl_ctl->dfimisc,1 );
@@ -1038,6 +1042,8 @@ static bool mctl_phy_init(const struct dram_para *para,mctl_await_completion (&mctl_ctl->swstat,1 ,1 );mctl_await_completion (&mctl_ctl->statr,3 ,1 ); +udelay (200 ); +writel (0 , &mctl_ctl->swctl);clrbits_le32 (&mctl_ctl->dfimisc,1 );
@@ -1281,8 +1287,10 @@ static bool mctl_ctrl_init(const struct dram_para *para,setbits_le32 (&mctl_ctl->clken,BIT (8 ));clrsetbits_le32 (&mctl_com->unk_0x500,BIT (24 ),0x300 ); +udelay (1 );/* this write seems to enable PHY MMIO region */ setbits_le32 (&mctl_com->unk_0x500,BIT (24 )); +udelay (1 );if (!mctl_phy_init (para, config))return false;
Signature · 1 line
2.34.1
PATCH v3 4/9 sunxi: H616: DRAM: Adjust size scan procedure
In reply to Chris MorganFrom: Jernej Skrabec <[email protected]>
It's safer to start scanning for columns first and then rows. Columns reside on LSB address pins, which means that second configuration will already have all needed row pins active.
This is also preparation for introducing DDR4 support, which need scan for banks and bank groups too.
--- arch/arm/mach-sunxi/dram_sun50i_h616.c | 31 +++++++++++++++----------- 1 file changed, 18 insertions(+), 13 deletions(-)
arch/arm/mach-sunxi/dram_sun50i_h616.c +18 -13
@@ -1362,28 +1362,33 @@ static void mctl_auto_detect_rank_width(const struct dram_para *para,static void mctl_auto_detect_dram_size (const struct dram_para *para,struct dram_config *config) { -/* detect row address bits */ - config->cols =8 ; - config->rows =18 ; +unsigned int shift; + +/* max. config for columns, but not rows */ + config->cols =11 ; + config->rows =13 ;mctl_core_init (para, config); -for (config->rows =13 ; config->rows <18 ; config->rows++) { -/* 8 banks, 8 bit per byte and 16/32 bit width */ -if (mctl_mem_matches ((1 << (config->rows + config->cols + -4 + config->bus_full_width)))) + shift = config->bus_full_width +1 ; + +/* detect column address bits */ +for (config->cols =8 ; config->cols <11 ; config->cols++) { +if (mctl_mem_matches (1ULL << (config->cols + shift)))break ; } +debug ("detected %u columns\n" , config->cols); -/* detect column address bits */ - config->cols =11 ; +/* reconfigure to make sure that all active rows are accessible */ + config->rows =18 ;mctl_core_init (para, config); -for (config->cols =8 ; config->cols <11 ; config->cols++) { -/* 8 bits per byte and 16/32 bit width */ -if (mctl_mem_matches (1 << (config->cols +1 + - config->bus_full_width))) +/* detect row address bits */ + shift = config->bus_full_width +4 + config->cols; +for (config->rows =13 ; config->rows <18 ; config->rows++) { +if (mctl_mem_matches (1ULL << (config->rows + shift)))break ; } +debug ("detected %u rows\n" , config->rows); }static unsigned long mctl_calc_size (const struct dram_config *config)
Signature · 1 line
2.34.1
PATCH v3 5/9 sunxi: H616: dram: Update mbus priorities
In reply to Chris MorganFrom: Jernej Skrabec <[email protected]>
CSI1 channel (22) is missing and IOMMU (25) has priority flag set in vendor bootloader. Fix that.
While at it, replace bandwidth flag with priority since original flag has always value "true".
--- arch/arm/mach-sunxi/dram_sun50i_h616.c | 41 +++++++++++++------------- 1 file changed, 21 insertions(+), 20 deletions(-)
arch/arm/mach-sunxi/dram_sun50i_h616.c +21 -20
@@ -55,8 +55,8 @@ static void mbus_configure_port(u8 port,writel_relaxed (cfg1, &mctl_com->master[port].cfg1); } -#define MBUS_CONF (port, bwlimit, qos, acs, bwl0, bwl1, bwl2) \ - mbus_configure_port(port, bwlimit, false, \ +#define MBUS_CONF (port, priority, qos, acs, bwl0, bwl1, bwl2) \ + mbus_configure_port(port, true, priority, \ MBUS_QOS_ ## qos, 0, acs, bwl0, bwl1, bwl2)static void mctl_set_master_priority (void )
@@ -68,24 +68,25 @@ static void mctl_set_master_priority(void)writel (399 , &mctl_com->tmr);writel (BIT (16 ), &mctl_com->bwcr); -MBUS_CONF (0 , true,HIGHEST ,0 ,256 ,128 ,100 ); -MBUS_CONF (1 , true,HIGH ,0 ,1536 ,1400 ,256 ); -MBUS_CONF (2 , true,HIGHEST ,0 ,512 ,256 ,96 ); -MBUS_CONF (3 , true,HIGH ,0 ,256 ,100 ,80 ); -MBUS_CONF (4 , true,HIGH ,2 ,8192 ,5500 ,5000 ); -MBUS_CONF (5 , true,HIGH ,2 ,100 ,64 ,32 ); -MBUS_CONF (6 , true,HIGH ,2 ,100 ,64 ,32 ); -MBUS_CONF (8 , true,HIGH ,0 ,256 ,128 ,64 ); -MBUS_CONF (11 , true,HIGH ,0 ,256 ,128 ,100 ); -MBUS_CONF (14 , true,HIGH ,0 ,1024 ,256 ,64 ); -MBUS_CONF (16 , true,HIGHEST ,6 ,8192 ,2800 ,2400 ); -MBUS_CONF (21 , true,HIGHEST ,6 ,2048 ,768 ,512 ); -MBUS_CONF (25 , true,HIGHEST ,0 ,100 ,64 ,32 ); -MBUS_CONF (26 , true,HIGH ,2 ,8192 ,5500 ,5000 ); -MBUS_CONF (37 , true,HIGH ,0 ,256 ,128 ,64 ); -MBUS_CONF (38 , true,HIGH ,2 ,100 ,64 ,32 ); -MBUS_CONF (39 , true,HIGH ,2 ,8192 ,5500 ,5000 ); -MBUS_CONF (40 , true,HIGH ,2 ,100 ,64 ,32 ); +MBUS_CONF (0 , false,HIGHEST ,0 ,256 ,128 ,100 ); +MBUS_CONF (1 , false,HIGH ,0 ,1536 ,1400 ,256 ); +MBUS_CONF (2 , false,HIGHEST ,0 ,512 ,256 ,96 ); +MBUS_CONF (3 , false,HIGH ,0 ,256 ,100 ,80 ); +MBUS_CONF (4 , false,HIGH ,2 ,8192 ,5500 ,5000 ); +MBUS_CONF (5 , false,HIGH ,2 ,100 ,64 ,32 ); +MBUS_CONF (6 , false,HIGH ,2 ,100 ,64 ,32 ); +MBUS_CONF (8 , false,HIGH ,0 ,256 ,128 ,64 ); +MBUS_CONF (11 , false,HIGH ,0 ,256 ,128 ,100 ); +MBUS_CONF (14 , false,HIGH ,0 ,1024 ,256 ,64 ); +MBUS_CONF (16 , false,HIGHEST ,6 ,8192 ,2800 ,2400 ); +MBUS_CONF (21 , false,HIGHEST ,6 ,2048 ,768 ,512 ); +MBUS_CONF (22 , false,HIGH ,0 ,256 ,128 ,100 ); +MBUS_CONF (25 , true,HIGHEST ,0 ,100 ,64 ,32 ); +MBUS_CONF (26 , false,HIGH ,2 ,8192 ,5500 ,5000 ); +MBUS_CONF (37 , false,HIGH ,0 ,256 ,128 ,64 ); +MBUS_CONF (38 , false,HIGH ,2 ,100 ,64 ,32 ); +MBUS_CONF (39 , false,HIGH ,2 ,8192 ,5500 ,5000 ); +MBUS_CONF (40 , false,HIGH ,2 ,100 ,64 ,32 );dmb (); }
Signature · 1 line
2.34.1
Re: [PATCH V3 5/9] sunxi: H616: dram: Update mbus priorities
Hi,
Quoted 7 lines · Chris Morgan
From: Jernej Skrabec <[email protected]>
CSI1 channel (22) is missing and IOMMU (25) has priority flag set in vendor bootloader. Fix that.
While at it, replace bandwidth flag with priority since original flag has always value "true".
I cannot confirm what the vendor bootloader does, nor whether this is correct, but it seems to still work, and the patch does exactly what the commit message claims. So:
Quoted 2 lines
Signed-off-by Jernej Skrabec <[email protected]>Tested-by Chris Morgan <[email protected]>
Cheers,
Andre
Quoted 63 lines
--- arch/arm/mach-sunxi/dram_sun50i_h616.c | 41 +++++++++++++------------- 1 file changed, 21 insertions(+), 20 deletions(-)arch/arm/mach-sunxi/dram_sun50i_h616.c +21
-20@@ -55,8 +55,8 @@ static void mbus_configure_port(u8 port,writel_relaxed (cfg1, &mctl_com->master[port].cfg1); } -#define MBUS_CONF (port, bwlimit, qos, acs, bwl0, bwl1, bwl2) \ - mbus_configure_port(port, bwlimit, false, \ +#define MBUS_CONF (port, priority, qos, acs, bwl0, bwl1, bwl2) \ + mbus_configure_port(port, true, priority, \ MBUS_QOS_ ## qos, 0, acs, bwl0, bwl1, bwl2)static void mctl_set_master_priority (void )@@ -68,24 +68,25 @@ static void mctl_set_master_priority(void)writel (399 , &mctl_com->tmr);writel (BIT (16 ), &mctl_com->bwcr); -MBUS_CONF (0 , true,HIGHEST ,0 ,256 ,128 ,100 ); -MBUS_CONF (1 , true,HIGH ,0 ,1536 ,1400 ,256 ); -MBUS_CONF (2 , true,HIGHEST ,0 ,512 ,256 ,96 ); -MBUS_CONF (3 , true,HIGH ,0 ,256 ,100 ,80 ); -MBUS_CONF (4 , true,HIGH ,2 ,8192 ,5500 ,5000 ); -MBUS_CONF (5 , true,HIGH ,2 ,100 ,64 ,32 ); -MBUS_CONF (6 , true,HIGH ,2 ,100 ,64 ,32 ); -MBUS_CONF (8 , true,HIGH ,0 ,256 ,128 ,64 ); -MBUS_CONF (11 , true,HIGH ,0 ,256 ,128 ,100 ); -MBUS_CONF (14 , true,HIGH ,0 ,1024 ,256 ,64 ); -MBUS_CONF (16 , true,HIGHEST ,6 ,8192 ,2800 ,2400 ); -MBUS_CONF (21 , true,HIGHEST ,6 ,2048 ,768 ,512 ); -MBUS_CONF (25 , true,HIGHEST ,0 ,100 ,64 ,32 ); -MBUS_CONF (26 , true,HIGH ,2 ,8192 ,5500 ,5000 ); -MBUS_CONF (37 , true,HIGH ,0 ,256 ,128 ,64 ); -MBUS_CONF (38 , true,HIGH ,2 ,100 ,64 ,32 ); -MBUS_CONF (39 , true,HIGH ,2 ,8192 ,5500 ,5000 ); -MBUS_CONF (40 , true,HIGH ,2 ,100 ,64 ,32 ); +MBUS_CONF (0 , false,HIGHEST ,0 ,256 ,128 ,100 ); +MBUS_CONF (1 , false,HIGH ,0 ,1536 ,1400 ,256 ); +MBUS_CONF (2 , false,HIGHEST ,0 ,512 ,256 ,96 ); +MBUS_CONF (3 , false,HIGH ,0 ,256 ,100 ,80 ); +MBUS_CONF (4 , false,HIGH ,2 ,8192 ,5500 ,5000 ); +MBUS_CONF (5 , false,HIGH ,2 ,100 ,64 ,32 ); +MBUS_CONF (6 , false,HIGH ,2 ,100 ,64 ,32 ); +MBUS_CONF (8 , false,HIGH ,0 ,256 ,128 ,64 ); +MBUS_CONF (11 , false,HIGH ,0 ,256 ,128 ,100 ); +MBUS_CONF (14 , false,HIGH ,0 ,1024 ,256 ,64 ); +MBUS_CONF (16 , false,HIGHEST ,6 ,8192 ,2800 ,2400 ); +MBUS_CONF (21 , false,HIGHEST ,6 ,2048 ,768 ,512 ); +MBUS_CONF (22 , false,HIGH ,0 ,256 ,128 ,100 ); +MBUS_CONF (25 , true,HIGHEST ,0 ,100 ,64 ,32 ); +MBUS_CONF (26 , false,HIGH ,2 ,8192 ,5500 ,5000 ); +MBUS_CONF (37 , false,HIGH ,0 ,256 ,128 ,64 ); +MBUS_CONF (38 , false,HIGH ,2 ,100 ,64 ,32 ); +MBUS_CONF (39 , false,HIGH ,2 ,8192 ,5500 ,5000 ); +MBUS_CONF (40 , false,HIGH ,2 ,100 ,64 ,32 );dmb (); }
PATCH v3 6/9 sunxi: Correct TPR6 parameter for H616 DRAM driver
In reply to Chris MorganFrom: Chris Morgan <[email protected]>
Correct the default TPR6 parameter based on suggestion from Mikhail Kalashnikov. [1]
[1] https://lore.kernel.org/u-boot/[email protected]/
--- arch/arm/mach-sunxi/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-sunxi/Kconfig +1 -1
@@ -87,7 +87,7 @@ config DRAM_SUN50I_H616_TPR2 config DRAM_SUN50I_H616_TPR6 hex "H616 DRAM TPR6 parameter" - default 0x3300c080 + default 0x33c00080 help TPR6 value from vendor DRAM settings.
Signature · 1 line
2.34.1
Re: [PATCH V3 6/9] sunxi: Correct TPR6 parameter for H616 DRAM driver
Hi,
Quoted 6 lines · Chris Morgan
From: Chris Morgan <[email protected]>
Correct the default TPR6 parameter based on suggestion from Mikhail Kalashnikov. [1]
I am confused, doesn't that change belong together with the one that masks bits[23:16] instead bits[15:8]? So that the same 0xc0 end up in that register?
Mikhail, can you confirm what the intention of your reply mentioned above was? To say that the vendor code masks the different set of bits, and to stay correct we also have to adjust the TPR6 default value? For OPi Zero2W and OPi Zero3 those two bytes are the same, but for the Tanix TX1 and the default value they are not.
Cheers,
Andre
Quoted 20 lines
Fixes 4b02f0120a4b ("sunxi: H616: add LPDDR4 DRAM support")Suggested-by Mikhail Kalashnikov <[email protected]>Signed-off-by Chris Morgan <[email protected]>--- arch/arm/mach-sunxi/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/mach-sunxi/Kconfig +1
-1@@ -87,7 +87,7 @@ config DRAM_SUN50I_H616_TPR2 config DRAM_SUN50I_H616_TPR6 hex "H616 DRAM TPR6 parameter" - default 0x3300c080 + default 0x33c00080 help TPR6 value from vendor DRAM settings.
PATCH v3 7/9 arm64: dts: allwinner: h616: Add r_i2c pinctrl nodes
In reply to Chris MorganFrom: Chris Morgan <[email protected]>
Add pinctrl nodes for the r_i2c node. Without the pinmux defined the r_i2c bus may fail to work, possibly if the bootloader uses rsb mode for the PMIC.
[ upstream commit: 7c9ea4ab76176f65f4f55aa144f9145a4bccaacb ]
--- arch/arm/dts/sun50i-h616.dtsi | 2 ++ dts/upstream/src/arm64/allwinner/sun50i-h616.dtsi | 2 ++ 2 files changed, 4 insertions(+)
arch/arm/dts/sun50i-h616.dtsi +2 -0
@@ -836,6 +836,8 @@ clocks = <&r_ccu CLK_R_APB2_I2C>; dmas = <&dma 48>, <&dma 48>; dma-names = "rx", "tx"; + pinctrl-names = "default"; + pinctrl-0 = <&r_i2c_pins>; resets = <&r_ccu RST_R_APB2_I2C>; status = "disabled"; #address-cells = <1>;
dts/upstream/src/arm64/allwinner/sun50i-h616.dtsi +2 -0
@@ -836,6 +836,8 @@ clocks = <&r_ccu CLK_R_APB2_I2C>; dmas = <&dma 48>, <&dma 48>; dma-names = "rx", "tx"; + pinctrl-names = "default"; + pinctrl-0 = <&r_i2c_pins>; resets = <&r_ccu RST_R_APB2_I2C>; status = "disabled"; #address-cells = <1>;
Signature · 1 line
2.34.1
Re: [PATCH V3 7/9] arm64: dts: allwinner: h616: Add r_i2c pinctrl nodes
Hi Chris,
Quoted 22 lines · Chris Morgan
From: Chris Morgan <[email protected]>
Add pinctrl nodes for the
r_i2cnode. Without the pinmux defined ther_i2cbus may fail to work, possibly if the bootloader uses rsb mode for the PMIC.[ upstream commit:
7c9ea4ab76176f65f4f55aa144f9145a4bccaacb]Signed-off-by Chris Morgan <[email protected]>--- arch/arm/dts/sun50i-h616.dtsi | 2 ++ dts/upstream/src/arm64/allwinner/sun50i-h616.dtsi | 2 ++ 2 files changed, 4 insertions(+)arch/arm/dts/sun50i-h616.dtsi +0
-0
arch/arm/dts/sun50i-h616.dtsi line 840
Quoted 5 lines
arch/arm/dts/sun50i-h616.dtsi +2
-0@@ -836,6 +836,8 @@ clocks = <&r_ccu CLK_R_APB2_I2C>; dmas = <&dma 48>, <&dma 48>; dma-names = "rx", "tx"; + pinctrl-names = "default"; + pinctrl-0 = <&r_i2c_pins>;
This change is sufficient with !OF_UPSTREAM.
dts/upstream/src/arm64/allwinner/sun50i-h616.dtsi line 840
Quoted 13 lines
arch/arm/dts/sun50i-h616.dtsi +0
-0resets = <&r_ccu RST_R_APB2_I2C>; status = "disabled"; #address-cells = <1>;dts/upstream/src/arm64/allwinner/sun50i-h616.dtsi +2
-0@@ -836,6 +836,8 @@ clocks = <&r_ccu CLK_R_APB2_I2C>; dmas = <&dma 48>, <&dma 48>; dma-names = "rx", "tx"; + pinctrl-names = "default"; + pinctrl-0 = <&r_i2c_pins>;
Please don't manually patch dts/upstream subtree. It is meant to be updated only with tools/update-subtree.sh script. Also, it isn't needed as well since you haven't converted to OF_UPSTREAM at this point. Same applies to patch #8 as well.
-Sumit
Quoted 6 lines
dts/upstream/src/arm64/allwinner/sun50i-h616.dtsi +0
-1resets = <&r_ccu RST_R_APB2_I2C>; status = "disabled"; #address-cells = <1>; --2.34.1
Re: [PATCH V3 7/9] arm64: dts: allwinner: h616: Add r_i2c pinctrl nodes
On Wed, 4 Sep 2024 10:02:16 +0530
Sumit Garg <[email protected]> wrote:
Hi,
Quoted 43 lines
Hi Chris,
Quoted 22 lines · Chris Morgan
From: Chris Morgan <[email protected]>
Add pinctrl nodes for the
r_i2cnode. Without the pinmux defined ther_i2cbus may fail to work, possibly if the bootloader uses rsb mode for the PMIC.[ upstream commit:
7c9ea4ab76176f65f4f55aa144f9145a4bccaacb]Signed-off-by Chris Morgan <[email protected]>--- arch/arm/dts/sun50i-h616.dtsi | 2 ++ dts/upstream/src/arm64/allwinner/sun50i-h616.dtsi | 2 ++ 2 files changed, 4 insertions(+)arch/arm/dts/sun50i-h616.dtsi +0
-0arch/arm/dts/sun50i-h616.dtsi line 840
Quoted 5 lines
arch/arm/dts/sun50i-h616.dtsi +2
-0@@ -836,6 +836,8 @@ clocks = <&r_ccu CLK_R_APB2_I2C>; dmas = <&dma 48>, <&dma 48>; dma-names = "rx", "tx"; + pinctrl-names = "default"; + pinctrl-0 = <&r_i2c_pins>;This change is sufficient with !OF_UPSTREAM.
Quoted 10 lines
arch/arm/dts/sun50i-h616.dtsi +0
-0resets = <&r_ccu RST_R_APB2_I2C>; status = "disabled"; #address-cells = <1>;dts/upstream/src/arm64/allwinner/sun50i-h616.dtsi +0
-0@@ -836,6 +836,8 @@ clocks = <&r_ccu CLK_R_APB2_I2C>; dmas = <&dma 48>, <&dma 48>;
Quoted 8 lines
dts/upstream/src/arm64/allwinner/sun50i-h616.dtsi line 840
Quoted 3 lines
dts/upstream/src/arm64/allwinner/sun50i-h616.dtsi +2
-0dma-names = "rx", "tx"; + pinctrl-names = "default"; + pinctrl-0 = <&r_i2c_pins>;Please don't manually patch dts/upstream subtree. It is meant to be updated only with
tools/update-subtree.shscript. Also, it isn't needed as well since you haven't converted toOF_UPSTREAMat this point. Same applies to patch #8 as well.
Yes, but the H616 OF_UPSTREAM patch is already on the list, and this series will intersect at some point. The change above is already in the queue for the kernel tree, so we will pick it up once it appears in the repo.
I will sort this all out when merging, but meanwhile it's good to have some functioning series on the list.
Cheers,
Andre
Quoted 9 lines
-Sumit
Quoted 6 lines
dts/upstream/src/arm64/allwinner/sun50i-h616.dtsi +0
-1resets = <&r_ccu RST_R_APB2_I2C>; status = "disabled"; #address-cells = <1>; --2.34.1
PATCH v3 8/9 arm64: dts: allwinner: h616: Change RG35XX PMIC to r_i2c
In reply to Chris MorganFrom: Chris Morgan <[email protected]>
Change the Anbernic RG35XX series to use the r_i2c bus for the PMIC instead of the r_rsb bus. This is to keep the device tree consistent as there are at least 3 devices (the RG35XX-SP, RG28XX, and RG40XX-H) that have an external RTC on the r_i2c bus.
[ upstream commit: c712e5d0985628b1df13930489b49b740e610a2b ]
--- arch/arm/dts/sun50i-h700-anbernic-rg35xx-2024.dts | 6 +++--- .../arm64/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/dts/sun50i-h700-anbernic-rg35xx-2024.dts +3 -3
@@ -201,12 +201,12 @@ vcc-pi-supply = <®_cldo3>; }; -&r_rsb { +&r_i2c { status = "okay"; - axp717: pmic@3a3 { + axp717: pmic@34 { compatible = "x-powers,axp717"; - reg = <0x3a3>; + reg = <0x34>; interrupt-controller; #interrupt-cells = <1>; interrupt-parent = <&nmi_intc>;
dts/upstream/src/arm64/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts +3 -3
@@ -201,12 +201,12 @@ vcc-pi-supply = <®_cldo3>; }; -&r_rsb { +&r_i2c { status = "okay"; - axp717: pmic@3a3 { + axp717: pmic@34 { compatible = "x-powers,axp717"; - reg = <0x3a3>; + reg = <0x34>; interrupt-controller; #interrupt-cells = <1>; interrupt-parent = <&nmi_intc>;
Signature · 1 line
2.34.1
PATCH v3 9/9 sunxi: Add support for Anbernic RG35XX-2024
In reply to Chris MorganFrom: Chris Morgan <[email protected]>
The Anbernic RG35XX series of devices are based around an Allwinner H700 SoC with 1GB of RAM, 2 SD cards, and multiple input buttons.
This bootloader has been tested on the Anbernic RG35XX-2024 and RG35XX-H, but should be suitable for the entire lineup of H700 based devices.
A future series of updates will add board selection logic to identify and load the correct device tree automatically.
--- board/sunxi/MAINTAINERS | 5 +++++ configs/anbernic_rg35xx_h700_defconfig | 28 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 configs/anbernic_rg35xx_h700_defconfig
board/sunxi/MAINTAINERS +5 -0
@@ -132,6 +132,11 @@ M: Paul Kocialkowski <[email protected]> S: Maintained F: configs/Ampe_A76_defconfig +ANBERNIC RG35XX-2024 +M: Chris Morgan <[email protected]> +S: Maintained +F: configs/anbernic_rg35xx_h700_defconfig + BANANAPI M1 PLUS M: Jagan Teki <[email protected]> S: Maintained
configs/anbernic_rg35xx_h700_defconfig new file +28 -0
@@ -0,0 +1,28 @@ +CONFIG_ARM=y +CONFIG_ARCH_SUNXI=y +CONFIG_DEFAULT_DEVICE_TREE="sun50i-h700-anbernic-rg35xx-2024" +CONFIG_SPL=y +CONFIG_DRAM_SUN50I_H616_DX_ODT=0x08080808 +CONFIG_DRAM_SUN50I_H616_DX_DRI=0x0e0e0e0e +CONFIG_DRAM_SUN50I_H616_CA_DRI=0x0e0e +CONFIG_DRAM_SUN50I_H616_ODT_EN=0x7887bbbb +CONFIG_DRAM_SUN50I_H616_TPR2=0x1 +CONFIG_DRAM_SUN50I_H616_TPR6=0x40808080 +CONFIG_DRAM_SUN50I_H616_TPR10=0x402f6633 +CONFIG_DRAM_SUN50I_H616_TPR11=0x1b1f1e1c +CONFIG_DRAM_SUN50I_H616_TPR12=0x06060606 +CONFIG_DRAM_SUN50I_H616_PHY_ADDR_MAP_1=y +CONFIG_MACH_SUN50I_H616=y +CONFIG_SUNXI_DRAM_H616_LPDDR4=y +CONFIG_DRAM_CLK=672 +CONFIG_R_I2C_ENABLE=y +CONFIG_DEFAULT_FDT_FILE="sun50i-h700-anbernic-rg35xx-2024.dtb" +CONFIG_SPL_I2C=y +CONFIG_SPL_SYS_I2C_LEGACY=y +CONFIG_SYS_I2C_MVTWSI=y +CONFIG_SYS_I2C_SLAVE=0x7f +CONFIG_SYS_I2C_SPEED=400000 +CONFIG_REGULATOR_AXP=y +CONFIG_AXP717_POWER=y +CONFIG_AXP_DCDC2_VOLT=940 +CONFIG_AXP_DCDC3_VOLT=1100
Signature · 1 line
2.34.1