diff options
author | Vladimir Zapolskiy <vz@mleia.com> | 2016-11-28 00:15:31 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-12-02 21:32:51 -0500 |
commit | cdbb0cf8ecf30d5dbbfa500e8939a32ef45896c5 (patch) | |
tree | 6d01620f6567eaa8b5b5177a3882501752d17552 | |
parent | 18a40e8470246da3ee4cdef721524140f54cc6c9 (diff) | |
download | u-boot-cdbb0cf8ecf30d5dbbfa500e8939a32ef45896c5.zip u-boot-cdbb0cf8ecf30d5dbbfa500e8939a32ef45896c5.tar.gz u-boot-cdbb0cf8ecf30d5dbbfa500e8939a32ef45896c5.tar.bz2 |
sh: add common dram_init() function for all boards
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>
-rw-r--r-- | arch/sh/lib/Makefile | 2 | ||||
-rw-r--r-- | arch/sh/lib/board.c | 17 | ||||
-rw-r--r-- | board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c | 11 | ||||
-rw-r--r-- | board/espt/espt.c | 10 | ||||
-rw-r--r-- | board/mpr2/mpr2.c | 10 | ||||
-rw-r--r-- | board/ms7720se/ms7720se.c | 10 | ||||
-rw-r--r-- | board/ms7722se/ms7722se.c | 10 | ||||
-rw-r--r-- | board/ms7750se/ms7750se.c | 10 | ||||
-rw-r--r-- | board/renesas/MigoR/migo_r.c | 10 | ||||
-rw-r--r-- | board/renesas/ap325rxa/ap325rxa.c | 10 | ||||
-rw-r--r-- | board/renesas/ecovec/ecovec.c | 10 | ||||
-rw-r--r-- | board/renesas/r0p7734/r0p7734.c | 11 | ||||
-rw-r--r-- | board/renesas/r2dplus/r2dplus.c | 10 | ||||
-rw-r--r-- | board/renesas/r7780mp/r7780mp.c | 10 | ||||
-rw-r--r-- | board/renesas/rsk7203/rsk7203.c | 10 | ||||
-rw-r--r-- | board/renesas/rsk7264/rsk7264.c | 10 | ||||
-rw-r--r-- | board/renesas/rsk7269/rsk7269.c | 10 | ||||
-rw-r--r-- | board/renesas/sh7752evb/sh7752evb.c | 11 | ||||
-rw-r--r-- | board/renesas/sh7753evb/sh7753evb.c | 11 | ||||
-rw-r--r-- | board/renesas/sh7757lcr/sh7757lcr.c | 25 | ||||
-rw-r--r-- | board/renesas/sh7763rdp/sh7763rdp.c | 10 | ||||
-rw-r--r-- | board/renesas/sh7785lcr/sh7785lcr.c | 10 | ||||
-rw-r--r-- | board/shmin/shmin.c | 10 |
23 files changed, 18 insertions, 230 deletions
diff --git a/arch/sh/lib/Makefile b/arch/sh/lib/Makefile index c5cf89f..7be20b1 100644 --- a/arch/sh/lib/Makefile +++ b/arch/sh/lib/Makefile @@ -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 index 0000000..7cb594e --- /dev/null +++ b/arch/sh/lib/board.c @@ -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; +} diff --git a/board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c b/board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c index e65befc..31418a1 100644 --- a/board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c +++ b/board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c @@ -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; -} diff --git a/board/espt/espt.c b/board/espt/espt.c index ee6e538..9ab71fe 100644 --- a/board/espt/espt.c +++ b/board/espt/espt.c @@ -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) { } diff --git a/board/mpr2/mpr2.c b/board/mpr2/mpr2.c index 7449e03..3788a39 100644 --- a/board/mpr2/mpr2.c +++ b/board/mpr2/mpr2.c @@ -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; -} diff --git a/board/ms7720se/ms7720se.c b/board/ms7720se/ms7720se.c index 534a422..48edcc6 100644 --- a/board/ms7720se/ms7720se.c +++ b/board/ms7720se/ms7720se.c @@ -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); diff --git a/board/ms7722se/ms7722se.c b/board/ms7722se/ms7722se.c index ee1e99c..869b415 100644 --- a/board/ms7722se/ms7722se.c +++ b/board/ms7722se/ms7722se.c @@ -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); diff --git a/board/ms7750se/ms7750se.c b/board/ms7750se/ms7750se.c index a7f9346..d252faa 100644 --- a/board/ms7750se/ms7750se.c +++ b/board/ms7750se/ms7750se.c @@ -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; diff --git a/board/renesas/MigoR/migo_r.c b/board/renesas/MigoR/migo_r.c index fa2bf78..6409a73 100644 --- a/board/renesas/MigoR/migo_r.c +++ b/board/renesas/MigoR/migo_r.c @@ -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) { } diff --git a/board/renesas/ap325rxa/ap325rxa.c b/board/renesas/ap325rxa/ap325rxa.c index 518ad7b..218d479 100644 --- a/board/renesas/ap325rxa/ap325rxa.c +++ b/board/renesas/ap325rxa/ap325rxa.c @@ -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) { } diff --git a/board/renesas/ecovec/ecovec.c b/board/renesas/ecovec/ecovec.c index d862d99..28b557a 100644 --- a/board/renesas/ecovec/ecovec.c +++ b/board/renesas/ecovec/ecovec.c @@ -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 */ diff --git a/board/renesas/r0p7734/r0p7734.c b/board/renesas/r0p7734/r0p7734.c index 2e31ba6..360e0a1 100644 --- a/board/renesas/r0p7734/r0p7734.c +++ b/board/renesas/r0p7734/r0p7734.c @@ -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) { diff --git a/board/renesas/r2dplus/r2dplus.c b/board/renesas/r2dplus/r2dplus.c index 249c35f..d6fb4da 100644 --- a/board/renesas/r2dplus/r2dplus.c +++ b/board/renesas/r2dplus/r2dplus.c @@ -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; diff --git a/board/renesas/r7780mp/r7780mp.c b/board/renesas/r7780mp/r7780mp.c index 783352d..de259f5 100644 --- a/board/renesas/r7780mp/r7780mp.c +++ b/board/renesas/r7780mp/r7780mp.c @@ -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) { diff --git a/board/renesas/rsk7203/rsk7203.c b/board/renesas/rsk7203/rsk7203.c index 8800371..72c562d 100644 --- a/board/renesas/rsk7203/rsk7203.c +++ b/board/renesas/rsk7203/rsk7203.c @@ -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) { } diff --git a/board/renesas/rsk7264/rsk7264.c b/board/renesas/rsk7264/rsk7264.c index d938b3a..4ebb27b 100644 --- a/board/renesas/rsk7264/rsk7264.c +++ b/board/renesas/rsk7264/rsk7264.c @@ -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) { } diff --git a/board/renesas/rsk7269/rsk7269.c b/board/renesas/rsk7269/rsk7269.c index ae32b6a..0066f9f 100644 --- a/board/renesas/rsk7269/rsk7269.c +++ b/board/renesas/rsk7269/rsk7269.c @@ -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) { } diff --git a/board/renesas/sh7752evb/sh7752evb.c b/board/renesas/sh7752evb/sh7752evb.c index 3aad532..525d979 100644 --- a/board/renesas/sh7752evb/sh7752evb.c +++ b/board/renesas/sh7752evb/sh7752evb.c @@ -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; diff --git a/board/renesas/sh7753evb/sh7753evb.c b/board/renesas/sh7753evb/sh7753evb.c index 52a1906..3d1eeda 100644 --- a/board/renesas/sh7753evb/sh7753evb.c +++ b/board/renesas/sh7753evb/sh7753evb.c @@ -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; diff --git a/board/renesas/sh7757lcr/sh7757lcr.c b/board/renesas/sh7757lcr/sh7757lcr.c index ddcf275..0a04a9d 100644 --- a/board/renesas/sh7757lcr/sh7757lcr.c +++ b/board/renesas/sh7757lcr/sh7757lcr.c @@ -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(); diff --git a/board/renesas/sh7763rdp/sh7763rdp.c b/board/renesas/sh7763rdp/sh7763rdp.c index 9658a5e..d83e2f8 100644 --- a/board/renesas/sh7763rdp/sh7763rdp.c +++ b/board/renesas/sh7763rdp/sh7763rdp.c @@ -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) { } diff --git a/board/renesas/sh7785lcr/sh7785lcr.c b/board/renesas/sh7785lcr/sh7785lcr.c index 622e602..a1a0301 100644 --- a/board/renesas/sh7785lcr/sh7785lcr.c +++ b/board/renesas/sh7785lcr/sh7785lcr.c @@ -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) { diff --git a/board/shmin/shmin.c b/board/shmin/shmin.c index 74d1e39..42bd126 100644 --- a/board/shmin/shmin.c +++ b/board/shmin/shmin.c @@ -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(); |