]> git.karo-electronics.de Git - karo-tx-uboot.git/commitdiff
i.MX28: Improve passing of data from SPL to U-Boot
authorMarek Vasut <marex@denx.de>
Tue, 1 May 2012 11:09:44 +0000 (11:09 +0000)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Tue, 15 May 2012 06:31:35 +0000 (08:31 +0200)
Pass memory size from SPL via structure located in SRAM instead of SCRATCH
registers. This allows passing more data about boot from SPL to U-Boot, like the
boot mode pads configuration.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Detlev Zundel <dzu@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
arch/arm/cpu/arm926ejs/mx28/mx28.c
arch/arm/cpu/arm926ejs/mx28/mx28_init.h
arch/arm/cpu/arm926ejs/mx28/spl_boot.c
arch/arm/cpu/arm926ejs/mx28/spl_mem_init.c
arch/arm/include/asm/arch-mx28/sys_proto.h

index dc0338dfb585699bcc0850f28c19c77fdf9a8f1a..54a68e17897a08c7c13d8dc372de7c2117baee73 100644 (file)
@@ -279,22 +279,16 @@ void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)
 
 int mx28_dram_init(void)
 {
-       struct mx28_digctl_regs *digctl_regs =
-               (struct mx28_digctl_regs *)MXS_DIGCTL_BASE;
-       uint32_t sz[2];
+       struct mx28_spl_data *data = (struct mx28_spl_data *)
+               ((CONFIG_SYS_TEXT_BASE - sizeof(struct mx28_spl_data)) & ~0xf);
 
-       sz[0] = readl(&digctl_regs->hw_digctl_scratch0);
-       sz[1] = readl(&digctl_regs->hw_digctl_scratch1);
-
-       if (sz[0] != sz[1]) {
+       if (data->mem_dram_size == 0) {
                printf("MX28:\n"
-                       "Error, the RAM size in HW_DIGCTRL_SCRATCH0 and\n"
-                       "HW_DIGCTRL_SCRATCH1 is not the same. Please\n"
-                       "verify these two registers contain valid RAM size!\n");
+                       "Error, the RAM size passed up from SPL is 0!\n");
                hang();
        }
 
-       gd->ram_size = sz[0];
+       gd->ram_size = data->mem_dram_size;
        return 0;
 }
 
index 98d363199dc242be5a78cbec25d992ab01694396..8eac958ff4ca04be14cac30cef7e1f771a3a3771 100644 (file)
@@ -37,5 +37,6 @@ static inline void mx28_power_wait_pswitch(void) { }
 #endif
 
 void mx28_mem_init(void);
+uint32_t mx28_mem_get_size(void);
 
 #endif /* __M28_INIT_H__ */
index dfb8309e7006457975890a48cb13d657c417f6c9..37e1eb75ee8759c951d0a1cd7388f12c32b386cf 100644 (file)
@@ -28,6 +28,7 @@
 #include <asm/io.h>
 #include <asm/arch/iomux-mx28.h>
 #include <asm/arch/imx-regs.h>
+#include <asm/arch/sys_proto.h>
 
 #include "mx28_init.h"
 
@@ -49,9 +50,15 @@ void early_delay(int delay)
 void mx28_common_spl_init(const iomux_cfg_t *iomux_setup,
                        const unsigned int iomux_size)
 {
+       struct mx28_spl_data *data = (struct mx28_spl_data *)
+               ((CONFIG_SYS_TEXT_BASE - sizeof(struct mx28_spl_data)) & ~0xf);
+
        mxs_iomux_setup_multiple_pads(iomux_setup, iomux_size);
        mx28_power_init();
+
        mx28_mem_init();
+       data->mem_dram_size = mx28_mem_get_size();
+
        mx28_power_wait_pswitch();
 }
 
index 69c865eccc0f2abd8a45ebebf9e31203d092199d..9fa5d29e6c7fbb8e82f6b48e2ccc7d25372d89ce 100644 (file)
@@ -175,10 +175,8 @@ void mx28_mem_setup_vddd(void)
                &power_regs->hw_power_vdddctrl);
 }
 
-void mx28_mem_get_size(void)
+uint32_t mx28_mem_get_size(void)
 {
-       struct mx28_digctl_regs *digctl_regs =
-               (struct mx28_digctl_regs *)MXS_DIGCTL_BASE;
        uint32_t sz, da;
        uint32_t *vt = (uint32_t *)0x20;
        /* The following is "subs pc, r14, #4", used as return from DABT. */
@@ -189,11 +187,11 @@ void mx28_mem_get_size(void)
        vt[4] = data_abort_memdetect_handler;
 
        sz = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE);
-       writel(sz, &digctl_regs->hw_digctl_scratch0);
-       writel(sz, &digctl_regs->hw_digctl_scratch1);
 
        /* Restore the old DABT handler. */
        vt[4] = da;
+
+       return sz;
 }
 
 void mx28_mem_init(void)
@@ -241,6 +239,4 @@ void mx28_mem_init(void)
        early_delay(10000);
 
        mx28_mem_setup_cpu_and_hbus();
-
-       mx28_mem_get_size();
 }
index 15d8de31ee91af6089f4731602538892a0bb4e88..04f2e4db3c6a016449c0bb4b8802065c34d114bc 100644 (file)
@@ -39,6 +39,10 @@ void mx28_common_spl_init(const iomux_cfg_t *iomux_setup,
                        const unsigned int iomux_size);
 #endif
 
+struct mx28_spl_data {
+       uint32_t        mem_dram_size;
+};
+
 int mx28_dram_init(void);
 
 #endif /* __MX28_H__ */