Skip to content

Commit

Permalink
sunxi: dram: add lpddr3 6gbit support
Browse files Browse the repository at this point in the history
  • Loading branch information
iuncuim committed Mar 1, 2023
1 parent 4dbb3a4 commit 196f973
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arch/arm/mach-sunxi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ config DRAM_SUN50I_H616_TPR12
default 0x0
help
TPR12 value from vendor DRAM settings.

config DRAM_LPDDR3_6GBIT_QUIRK
bool "H616 6Gbit LPDDR3 DRAM quirks"

endif

config SUN6I_PRCM
Expand Down
12 changes: 12 additions & 0 deletions arch/arm/mach-sunxi/dram_sun50i_h616.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ static void mctl_set_addrmap(struct dram_para *para)

/* Ranks */
if (ranks == 2)
#ifdef CONFIG_DRAM_LPDDR3_6GBIT_QUIRK
mctl_ctl->addrmap[0] = rows + cols - 5;
#else
mctl_ctl->addrmap[0] = rows + cols - 3;
#endif
else
mctl_ctl->addrmap[0] = 0x1F;

Expand Down Expand Up @@ -204,7 +208,11 @@ static void mctl_set_addrmap(struct dram_para *para)
mctl_ctl->addrmap[7] = 0x0F0F;
break;
case 15:
#ifdef CONFIG_DRAM_LPDDR3_6GBIT_QUIRK
mctl_ctl->addrmap[6] = (cols - 3) | ((cols - 2) << 8) | ((cols - 2) << 16) | 0x0F000000;
#else
mctl_ctl->addrmap[6] = (cols - 3) | ((cols - 3) << 8) | ((cols - 3) << 16) | 0x0F000000;
#endif
mctl_ctl->addrmap[7] = 0x0F0F;
break;
case 16:
Expand Down Expand Up @@ -1206,7 +1214,11 @@ static unsigned long mctl_calc_size(struct dram_para *para)
u8 width = para->bus_full_width ? 4 : 2;

/* 8 banks */
#ifdef CONFIG_DRAM_LPDDR3_6GBIT_QUIRK
return (1ULL << (para->cols + para->rows + 3)) * width * para->ranks * 3 / 4;
#else
return (1ULL << (para->cols + para->rows + 3)) * width * para->ranks;
#endif
}

unsigned long sunxi_dram_init(void)
Expand Down
1 change: 1 addition & 0 deletions configs/h616_lpddr3_tvbox_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ CONFIG_DRAM_SUN50I_H616_TPR11=0xd100b0f
CONFIG_DRAM_SUN50I_H616_TPR12=0x11131113
CONFIG_MACH_SUN50I_H616=y
CONFIG_SUNXI_DRAM_H616_LPDDR3=y
CONFIG_DRAM_LPDDR3_6GBIT_QUIRK=y
CONFIG_DRAM_CLK=792
CONFIG_R_I2C_ENABLE=y
CONFIG_SPL_SPI_SUNXI=y
Expand Down

0 comments on commit 196f973

Please sign in to comment.