aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/include/asm
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2023-06-07 01:07:43 +0100
committerAndre Przywara <andre.przywara@arm.com>2023-07-21 00:29:42 +0100
commit78aa00c38e86ea06e625c9c7e0365fc87353d5a5 (patch)
tree08d03e6274b23f059abb096cd2192a06f1a32ce3 /arch/arm/include/asm
parent457e2cd665bd0e17f6fe0be936525f7d3dd8efb5 (diff)
downloadu-boot-78aa00c38e86ea06e625c9c7e0365fc87353d5a5.zip
u-boot-78aa00c38e86ea06e625c9c7e0365fc87353d5a5.tar.gz
u-boot-78aa00c38e86ea06e625c9c7e0365fc87353d5a5.tar.bz2
sunxi: H616: dram: split struct dram_para
Currently there is one DRAM parameter struct for the Allwinner H616 DRAM "driver". It contains many fields that are compile time constants (set by Kconfig variables), though there are also some fields that are probed and changed over the runtime of the DRAM initialisation. Because of this mixture, the compiler cannot properly optimise the code for size, as it does not consider constant propagation in its full potential. Help the compiler out by splitting that structure into two: one that only contains values known at compile time, and another one where the values will actually change. The former can then be declared "const", which will let the compiler fold its values directly into the code using it. We also add "const" tags for some new "struct dram_config" pointers, to further increase code optimisation. To help the compiler optimise the code further, the definition of the now "const struct dram_para" has to happen at a file-global level, so move that part out of sunxi_dram_init(). That results in quite some code savings (almost 2KB), and helps to keep the code small with the LPDDR3 support added later. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Diffstat (limited to 'arch/arm/include/asm')
-rw-r--r--arch/arm/include/asm/arch-sunxi/dram_sun50i_h616.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/arm/include/asm/arch-sunxi/dram_sun50i_h616.h b/arch/arm/include/asm/arch-sunxi/dram_sun50i_h616.h
index 34d19f7..11774de 100644
--- a/arch/arm/include/asm/arch-sunxi/dram_sun50i_h616.h
+++ b/arch/arm/include/asm/arch-sunxi/dram_sun50i_h616.h
@@ -148,10 +148,6 @@ check_member(sunxi_mctl_ctl_reg, unk_0x4240, 0x4240);
struct dram_para {
u32 clk;
enum sunxi_dram_type type;
- u8 cols;
- u8 rows;
- u8 ranks;
- u8 bus_full_width;
u32 dx_odt;
u32 dx_dri;
u32 ca_dri;
@@ -163,6 +159,12 @@ struct dram_para {
u32 tpr12;
};
+struct dram_config {
+ u8 cols;
+ u8 rows;
+ u8 ranks;
+ u8 bus_full_width;
+};
static inline int ns_to_t(int nanoseconds)
{