]> git.sur5r.net Git - u-boot/commitdiff
sh: add common dram_init() function for all boards
authorVladimir Zapolskiy <vz@mleia.com>
Sun, 27 Nov 2016 22:15:31 +0000 (00:15 +0200)
committerTom Rini <trini@konsulko.com>
Sat, 3 Dec 2016 02:32:51 +0000 (21:32 -0500)
Generic board support assumes a different method of specifying
DRAM size on board, also it can be shared among all boards, notably
only sh7763rdp board has a custom legacy dram_init(), however
the difference is only in printing some additional information,
this feature can be removed.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
23 files changed:
arch/sh/lib/Makefile
arch/sh/lib/board.c [new file with mode: 0644]
board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c
board/espt/espt.c
board/mpr2/mpr2.c
board/ms7720se/ms7720se.c
board/ms7722se/ms7722se.c
board/ms7750se/ms7750se.c
board/renesas/MigoR/migo_r.c
board/renesas/ap325rxa/ap325rxa.c
board/renesas/ecovec/ecovec.c
board/renesas/r0p7734/r0p7734.c
board/renesas/r2dplus/r2dplus.c
board/renesas/r7780mp/r7780mp.c
board/renesas/rsk7203/rsk7203.c
board/renesas/rsk7264/rsk7264.c
board/renesas/rsk7269/rsk7269.c
board/renesas/sh7752evb/sh7752evb.c
board/renesas/sh7753evb/sh7753evb.c
board/renesas/sh7757lcr/sh7757lcr.c
board/renesas/sh7763rdp/sh7763rdp.c
board/renesas/sh7785lcr/sh7785lcr.c
board/shmin/shmin.c

index c5cf89f49346d4c893c0b2ff0d6dd2c5085fe1e3..7be20b1bdd760469c3668034386cc275df9fb772 100644 (file)
@@ -5,7 +5,7 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
-
+obj-y  += board.o
 obj-$(CONFIG_CMD_BOOTM) += bootm.o
 ifeq ($(CONFIG_CPU_SH2),y)
 obj-y  += time_sh2.o
diff --git a/arch/sh/lib/board.c b/arch/sh/lib/board.c
new file mode 100644 (file)
index 0000000..7cb594e
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2016 Vladimir Zapolskiy <vz@mleia.com>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <common.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int dram_init(void)
+{
+       gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE,
+                                   CONFIG_SYS_SDRAM_SIZE);
+
+       return 0;
+}
index e65befc3ba0405d4fb5625d07927a3aba92b868f..31418a1f961e3c6a6dc5c9fae00118cb9e83fa18 100644 (file)
@@ -11,8 +11,6 @@
 #include <netdev.h>
 #include <i2c.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 #define MODEMR                 (0xFFCC0020)
 #define MODEMR_MASK            (0x6)
 #define MODEMR_533MHZ  (0x2)
@@ -172,12 +170,3 @@ int board_late_init(void)
 
        return 0;
 }
-
-int dram_init(void)
-{
-       gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
-       gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
-       printf("DRAM:  %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
-
-       return 0;
-}
index ee6e538c3754e592adb66dff85c52aa244eeb97d..9ab71fe17148fbd9b59b856d2c73e6a5ea38b756 100644 (file)
@@ -11,8 +11,6 @@
 #include <asm/io.h>
 #include <asm/processor.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 int checkboard(void)
 {
        puts("BOARD: ESPT-GIGA\n");
@@ -24,14 +22,6 @@ int board_init(void)
        return 0;
 }
 
-int dram_init(void)
-{
-       gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
-       gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
-       printf("DRAM:  %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
-       return 0;
-}
-
 void led_set_state(unsigned short value)
 {
 }
index 7449e036e42dbbc3aaf2ce7c032f3ffecf8f237f..3788a390b88cc16f64f688897adbaa75b1844cb1 100644 (file)
@@ -11,8 +11,6 @@
 #include <asm/io.h>
 #include <asm/processor.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 int checkboard(void)
 {
        puts("BOARD: MPR2\n");
@@ -138,11 +136,3 @@ int board_init(void)
 
        return 0;
 }
-
-int dram_init(void)
-{
-       gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
-       gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
-       printf("SDRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
-       return 0;
-}
index 534a4220430d65bcbc645eaf12e7e1467d055ed9..48edcc62fd9f47941d078b6f812dc78a4710899a 100644 (file)
@@ -17,8 +17,6 @@
 #include <asm/io.h>
 #include <asm/processor.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 #define LED_BASE       0xB0800000
 
 int checkboard(void)
@@ -32,14 +30,6 @@ int board_init(void)
        return 0;
 }
 
-int dram_init(void)
-{
-       gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
-       gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
-       printf("DRAM:  %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
-       return 0;
-}
-
 void led_set_state(unsigned short value)
 {
        outw(value & 0xFF, LED_BASE);
index ee1e99c1172688cacef807360e5a8c8e5e0629ab..869b415ba981520a9d04b5c69d50e0b452af844a 100644 (file)
@@ -15,8 +15,6 @@
 #include <asm/io.h>
 #include <asm/processor.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 #define LED_BASE       0xB0800000
 
 int checkboard(void)
@@ -33,14 +31,6 @@ int board_init(void)
        return 0;
 }
 
-int dram_init(void)
-{
-       gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
-       gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
-       printf("DRAM:  %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
-       return 0;
-}
-
 void led_set_state(unsigned short value)
 {
        writew(value & 0xFF, LED_BASE);
index a7f9346b2dd822d1273fbb787e4d43b7d64e1705..d252faa91f92bbb59035765175bc924bfbd10e05 100644 (file)
@@ -8,8 +8,6 @@
 #include <common.h>
 #include <asm/processor.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 int checkboard(void)
 {
        puts("BOARD: SH7750/SH7750S/SH7750R Solution Engine\n");
@@ -21,14 +19,6 @@ int board_init(void)
        return 0;
 }
 
-int dram_init (void)
-{
-       gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
-       gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
-       printf("DRAM:  %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
-       return 0;
-}
-
 int board_late_init(void)
 {
        return 0;
index fa2bf78cf157f0efc420912002363b7b0e45ab03..6409a73de1447a4ae15cd6eed9b37ffa7591536b 100644 (file)
@@ -15,8 +15,6 @@
 #include <asm/io.h>
 #include <asm/processor.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 int checkboard(void)
 {
        puts("BOARD: Renesas MigoR\n");
@@ -28,14 +26,6 @@ int board_init(void)
        return 0;
 }
 
-int dram_init (void)
-{
-       gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
-       gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
-       printf("DRAM:  %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
-       return 0;
-}
-
 void led_set_state (unsigned short value)
 {
 }
index 518ad7b6a14e6b209cc7caebeac868ef15be727f..218d479c6b29d86dd3acf032837db99ed6157f51 100644 (file)
@@ -10,8 +10,6 @@
 #include <asm/io.h>
 #include <asm/processor.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 /* PRI control register */
 #define PRPRICR5       0xFF800048 /* LMB */
 #define PRPRICR5_D     0x2a
@@ -130,14 +128,6 @@ int board_init(void)
        return 0;
 }
 
-int dram_init(void)
-{
-       gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
-       gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
-       printf("DRAM:  %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
-       return 0;
-}
-
 void led_set_state(unsigned short value)
 {
 }
index d862d997e5607aa7eb69d6d61b6ea8e606102a52..28b557a5b08ad76a4a81bbd4bf3277c01bbf7f0f 100644 (file)
@@ -22,16 +22,6 @@ int checkboard(void)
        return 0;
 }
 
-int dram_init(void)
-{
-       DECLARE_GLOBAL_DATA_PTR;
-
-       gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
-       gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
-       printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
-       return 0;
-}
-
 static void debug_led(u8 led)
 {
        /* PDGR[0-4] is debug LED */
index 2e31ba673162dcf15a39f1179207465626042b87..360e0a1a6fd051443a47e66667ad30b564d24699 100644 (file)
@@ -11,8 +11,6 @@
 #include <netdev.h>
 #include <i2c.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 #define MODEMR                 (0xFFCC0020)
 #define MODEMR_MASK            (0x6)
 #define MODEMR_533MHZ  (0x2)
@@ -61,15 +59,6 @@ int board_late_init(void)
        return 0;
 }
 
-int dram_init(void)
-{
-       gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
-       gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
-       printf("DRAM:  %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
-
-       return 0;
-}
-
 #ifdef CONFIG_SMC911X
 int board_eth_init(bd_t *bis)
 {
index 249c35f3a2c681d530a631e9eeac2280351a6601..d6fb4da82b4cfc6d033bb408512bc3ac9c04cda5 100644 (file)
@@ -12,8 +12,6 @@
 #include <asm/io.h>
 #include <asm/pci.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 int checkboard(void)
 {
        puts("BOARD: Renesas Solutions R2D Plus\n");
@@ -25,14 +23,6 @@ int board_init(void)
        return 0;
 }
 
-int dram_init(void)
-{
-       gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
-       gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
-       printf("DRAM:  %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
-       return 0;
-}
-
 int board_late_init(void)
 {
        return 0;
index 783352d476348ae00245a1f50d88b95fd05b71fc..de259f502b4c174401f5414af1b88d1e47aa38ab 100644 (file)
@@ -13,8 +13,6 @@
 #include <netdev.h>
 #include "r7780mp.h"
 
-DECLARE_GLOBAL_DATA_PTR;
-
 int checkboard(void)
 {
 #if defined(CONFIG_R7780MP)
@@ -33,14 +31,6 @@ int board_init(void)
        return 0;
 }
 
-int dram_init(void)
-{
-       gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
-       gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
-       printf("DRAM:  %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
-       return 0;
-}
-
 void led_set_state(unsigned short value)
 {
 
index 8800371b00427b5bf0f4cc08c97adcc3bdbcb0aa..72c562d3e579f75b28b6c180317eb93ad728b039 100644 (file)
@@ -13,8 +13,6 @@
 #include <asm/io.h>
 #include <asm/processor.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 int checkboard(void)
 {
        puts("BOARD: Renesas Technology RSK7203\n");
@@ -26,14 +24,6 @@ int board_init(void)
        return 0;
 }
 
-int dram_init(void)
-{
-       gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
-       gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
-       printf("DRAM:  %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
-       return 0;
-}
-
 void led_set_state(unsigned short value)
 {
 }
index d938b3a7b6539131a8ff288b7e2d50b1b8e4efc2..4ebb27b463d3822c357091fa11b3186b0b2af127 100644 (file)
@@ -14,8 +14,6 @@
 #include <asm/io.h>
 #include <asm/processor.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 int checkboard(void)
 {
        puts("BOARD: Renesas Technology RSK7264\n");
@@ -27,14 +25,6 @@ int board_init(void)
        return 0;
 }
 
-int dram_init(void)
-{
-       gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
-       gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
-       printf("DRAM:  %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
-       return 0;
-}
-
 void led_set_state(unsigned short value)
 {
 }
index ae32b6a6d52c612b6ca68a5607e7e12bd81e2ff0..0066f9f6d016e1e971ccc9becbde51c471f30f8f 100644 (file)
@@ -15,8 +15,6 @@
 #include <asm/io.h>
 #include <asm/processor.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 int checkboard(void)
 {
        puts("BOARD: Renesas RSK7269\n");
@@ -28,14 +26,6 @@ int board_init(void)
        return 0;
 }
 
-int dram_init(void)
-{
-       gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
-       gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
-       printf("DRAM:  %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
-       return 0;
-}
-
 void led_set_state(unsigned short value)
 {
 }
index 3aad532367b361cfe0c5bba0ed72f2f0e5c69c90..525d9797242ddeac2ab7e1663b668d76f7aa2510 100644 (file)
@@ -159,17 +159,6 @@ int board_init(void)
        return 0;
 }
 
-int dram_init(void)
-{
-       DECLARE_GLOBAL_DATA_PTR;
-
-       gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
-       gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
-       printf("DRAM:  %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
-
-       return 0;
-}
-
 int board_mmc_init(bd_t *bis)
 {
        struct gpio_regs *gpio = GPIO_BASE;
index 52a1906c7f0703f6d8dec93cd6f1486aa5aa6aa2..3d1eedaa5f520562799f963a659061e6fa7be01a 100644 (file)
@@ -175,17 +175,6 @@ int board_init(void)
        return 0;
 }
 
-int dram_init(void)
-{
-       DECLARE_GLOBAL_DATA_PTR;
-
-       gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
-       gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
-       printf("DRAM:  %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
-
-       return 0;
-}
-
 int board_mmc_init(bd_t *bis)
 {
        struct gpio_regs *gpio = GPIO_BASE;
index ddcf275f6e7854ca6d23cc7ab1d24162cf3c626f..0a04a9d39dcbb9c21d8e7ea5559365c360eed6a3 100644 (file)
@@ -224,31 +224,6 @@ int board_init(void)
        return 0;
 }
 
-int dram_init(void)
-{
-       DECLARE_GLOBAL_DATA_PTR;
-
-       gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
-       gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
-       printf("DRAM:  %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
-       printf("    Physical address\n");
-       printf("    0x%08x - 0x%08x : Accessible Space as ECC Area\n",
-               SH7757LCR_SDRAM_PHYS_TOP,
-               SH7757LCR_SDRAM_PHYS_TOP + SH7757LCR_SDRAM_SIZE - 1);
-       printf("    0x%08x - 0x%08x : No Access Area\n",
-               SH7757LCR_SDRAM_PHYS_TOP + SH7757LCR_SDRAM_SIZE,
-               SH7757LCR_SDRAM_PHYS_TOP + SH7757LCR_SDRAM_SIZE * 2 - 1);
-       printf("    0x%08x - 0x%08x : Non-ECC Area for DVC/AVC\n",
-               SH7757LCR_SDRAM_PHYS_TOP + SH7757LCR_SDRAM_ECC_SETTING * 2,
-               SH7757LCR_SDRAM_PHYS_TOP + SH7757LCR_SDRAM_ECC_SETTING * 2 +
-                       SH7757LCR_SDRAM_DVC_SIZE - 1);
-       printf("    0x%08x - 0x%08x : Non-ECC Area for G200eR2\n",
-               SH7757LCR_SDRAM_PHYS_TOP + SH7757LCR_GRA_OFFSET,
-               SH7757LCR_SDRAM_PHYS_TOP + SH7757LCR_GRA_OFFSET + 0x00ffffff);
-
-       return 0;
-}
-
 int board_mmc_init(bd_t *bis)
 {
        return mmcif_mmc_init();
index 9658a5e440798f619a911bd9edb9f98d847e59db..d83e2f83b26a20b91a4b4ebd3b35d0aee512d216 100644 (file)
@@ -12,8 +12,6 @@
 #include <asm/io.h>
 #include <asm/processor.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 #define CPU_CMDREG     0xB1000006
 #define PDCR        0xffef0006
 #define PECR        0xffef0008
@@ -51,14 +49,6 @@ int board_init(void)
        return 0;
 }
 
-int dram_init(void)
-{
-       gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
-       gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
-       printf("DRAM:  %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
-       return 0;
-}
-
 void led_set_state(unsigned short value)
 {
 }
index 622e6026137acac78591288fbf501d2cd9f76bc8..a1a030197182f0844e4f51460819979eccfcfbbc 100644 (file)
@@ -10,8 +10,6 @@
 #include <asm/pci.h>
 #include <netdev.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 int checkboard(void)
 {
        puts("BOARD: Renesas Technology Corp. R0P7785LC0011RL\n");
@@ -23,14 +21,6 @@ int board_init(void)
        return 0;
 }
 
-int dram_init(void)
-{
-       gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
-       gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
-       printf("DRAM:  %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
-       return 0;
-}
-
 static struct pci_controller hose;
 void pci_init_board(void)
 {
index 74d1e39734f7598d98f33d588b6d537358b629c5..42bd1261b20ae8f9ec25e32f40976a3e61dec781 100644 (file)
@@ -33,16 +33,6 @@ int board_init(void)
        return 0;
 }
 
-int dram_init(void)
-{
-       DECLARE_GLOBAL_DATA_PTR;
-
-       gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE;
-       gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE;
-       printf("DRAM:  %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024));
-       return 0;
-}
-
 int board_eth_init(bd_t *bis)
 {
        return ne2k_register();