summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Przywara <[email protected]>2025-01-25 23:49:27 +0000
committerTom Rini <[email protected]>2025-04-28 12:45:44 -0600
commit3389c5729766ce0c7d7b64cce0676fe5c963fc0b (patch)
treedb94eb7a737a09882ccb3adbff3906d6e66b30a6
parent90b74b3f51a9637c6fa226d0fdf162b6e94a3ecb (diff)
sunxi: H6/H616: dram: remove usage of struct sunxi_prcm_reg
The Allwinner H6 and H616 DRAM initialisation code uses a complex C struct, modelling the PRCM clock register frame. For those SoCs, this struct contains 20 registers, but the DRAM code only uses two of them. Since we want to get rid of this struct, drop the usage of the struct in the H6 and H616 DRAM code, by using #define'd register names and their offset, and then adding those names to the base pointer. This removes one more user of the PRCM clock register struct. Signed-off-by: Andre Przywara <[email protected]>
-rw-r--r--arch/arm/include/asm/arch-sunxi/prcm_sun50i.h1
-rw-r--r--arch/arm/mach-sunxi/dram_sun50i_h6.c8
-rw-r--r--arch/arm/mach-sunxi/dram_sun50i_h616.c7
3 files changed, 7 insertions, 9 deletions
diff --git a/arch/arm/include/asm/arch-sunxi/prcm_sun50i.h b/arch/arm/include/asm/arch-sunxi/prcm_sun50i.h
index 8ed78dccf10..738cd68320c 100644
--- a/arch/arm/include/asm/arch-sunxi/prcm_sun50i.h
+++ b/arch/arm/include/asm/arch-sunxi/prcm_sun50i.h
@@ -15,6 +15,7 @@
#define CCU_PRCM_PLL_LDO_CFG 0x244
#define CCU_PRCM_SYS_PWROFF_GATING 0x250
#define CCU_PRCM_RES_CAL_CTRL 0x310
+#define CCU_PRCM_OHMS240 0x318
struct sunxi_prcm_reg {
u32 cpus_cfg; /* 0x000 */
diff --git a/arch/arm/mach-sunxi/dram_sun50i_h6.c b/arch/arm/mach-sunxi/dram_sun50i_h6.c
index 66a30d846a8..84fd64a2bfc 100644
--- a/arch/arm/mach-sunxi/dram_sun50i_h6.c
+++ b/arch/arm/mach-sunxi/dram_sun50i_h6.c
@@ -600,14 +600,12 @@ unsigned long sunxi_dram_init(void)
{
struct sunxi_mctl_com_reg * const mctl_com =
(struct sunxi_mctl_com_reg *)SUNXI_DRAM_COM_BASE;
- struct sunxi_prcm_reg *const prcm =
- (struct sunxi_prcm_reg *)SUNXI_PRCM_BASE;
+ void *const prcm = (void *)SUNXI_PRCM_BASE;
struct dram_config config;
-
unsigned long size;
- setbits_le32(&prcm->res_cal_ctrl, BIT(8));
- clrbits_le32(&prcm->ohms240, 0x3f);
+ setbits_le32(prcm + CCU_PRCM_RES_CAL_CTRL, BIT(8));
+ clrbits_le32(prcm + CCU_PRCM_OHMS240, 0x3f);
mctl_auto_detect_rank_width(&para, &config);
mctl_auto_detect_dram_size(&para, &config);
diff --git a/arch/arm/mach-sunxi/dram_sun50i_h616.c b/arch/arm/mach-sunxi/dram_sun50i_h616.c
index 5a431f3eb9f..5a59f82d1ef 100644
--- a/arch/arm/mach-sunxi/dram_sun50i_h616.c
+++ b/arch/arm/mach-sunxi/dram_sun50i_h616.c
@@ -1342,13 +1342,12 @@ static const struct dram_para para = {
unsigned long sunxi_dram_init(void)
{
- struct sunxi_prcm_reg *const prcm =
- (struct sunxi_prcm_reg *)SUNXI_PRCM_BASE;
+ void *const prcm = (void *)SUNXI_PRCM_BASE;
struct dram_config config;
unsigned long size;
- setbits_le32(&prcm->res_cal_ctrl, BIT(8));
- clrbits_le32(&prcm->ohms240, 0x3f);
+ setbits_le32(prcm + CCU_PRCM_RES_CAL_CTRL, BIT(8));
+ clrbits_le32(prcm + CCU_PRCM_OHMS240, 0x3f);
mctl_auto_detect_rank_width(&para, &config);
mctl_auto_detect_dram_size(&para, &config);