arm: kirkwood: Change naming of dram functions from km_foo() to mvebu_foo()
authorStefan Roese <sr@denx.de>
Wed, 22 Oct 2014 10:13:13 +0000 (12:13 +0200)
committerTom Rini <trini@ti.com>
Thu, 23 Oct 2014 13:59:21 +0000 (09:59 -0400)
Additionally the SDRAM address decoding register address is not hard coded
in the C code any more. A define is introduced for this base address.

This makes is possible to use those gpio functions from other MVEBU SoC's
as well.

Signed-off-by: Stefan Roese <sr@denx.de>
Tested-by: Luka Perkov <luka@openwrt.org>
Acked-by: Prafulla Wadaskar <prafulla@marvell.com>
21 files changed:
arch/arm/include/asm/arch-kirkwood/cpu.h
arch/arm/include/asm/arch-kirkwood/soc.h
arch/arm/mvebu-common/dram.c
board/LaCie/net2big_v2/net2big_v2.c
board/LaCie/netspace_v2/netspace_v2.c
board/LaCie/wireless_space/wireless_space.c
board/Marvell/dreamplug/dreamplug.c
board/Marvell/guruplug/guruplug.c
board/Marvell/mv88f6281gtw_ge/mv88f6281gtw_ge.c
board/Marvell/openrd/openrd.c
board/Marvell/rd6281a/rd6281a.c
board/Marvell/sheevaplug/sheevaplug.c
board/Seagate/dockstar/dockstar.c
board/Seagate/goflexhome/goflexhome.c
board/buffalo/lsxl/lsxl.c
board/cloudengines/pogo_e02/pogo_e02.c
board/d-link/dns325/dns325.c
board/iomega/iconnect/iconnect.c
board/karo/tk71/tk71.c
board/keymile/km_arm/km_arm.c
board/raidsonic/ib62x0/ib62x0.c

index 5900a15abc1e2693491c89e70e22bdfeac0913bc..926d347110f8265680171cd12f6bdc1302404b52 100644 (file)
@@ -140,9 +140,9 @@ struct kwgpio_registers {
  * functions
  */
 unsigned char get_random_hex(void);
-unsigned int kw_sdram_bar(enum memory_bank bank);
-unsigned int kw_sdram_bs(enum memory_bank bank);
-void kw_sdram_size_adjust(enum memory_bank bank);
+unsigned int mvebu_sdram_bar(enum memory_bank bank);
+unsigned int mvebu_sdram_bs(enum memory_bank bank);
+void mvebu_sdram_size_adjust(enum memory_bank bank);
 int kw_config_adr_windows(void);
 void mvebu_config_gpio(unsigned int gpp0_oe_val, unsigned int gpp1_oe_val,
                unsigned int gpp0_oe, unsigned int gpp1_oe);
index 4ef32c7f5c12eb19805d4045a2398d9ab80c7be2..58ed71b186413c4c014ca672a3af8ab29246928c 100644 (file)
@@ -22,6 +22,7 @@
 #define KW_REG_UNDOC_0x1470            (KW_REGISTER(0x1470))
 #define KW_REG_UNDOC_0x1478            (KW_REGISTER(0x1478))
 
+#define MVEBU_SDRAM_BASE               (KW_REGISTER(0x1500))
 #define KW_TWSI_BASE                   (KW_REGISTER(0x11000))
 #define KW_UART0_BASE                  (KW_REGISTER(0x12000))
 #define KW_UART1_BASE                  (KW_REGISTER(0x12100))
index e468136eb9dbfb045b9344eee948366de74d8c7b..db18791a8627e77f9baba41199a9ba5fba3af37c 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
-struct kw_sdram_bank {
+struct sdram_bank {
        u32     win_bar;
        u32     win_sz;
 };
 
-struct kw_sdram_addr_dec {
-       struct kw_sdram_bank    sdram_bank[4];
+struct sdram_addr_dec {
+       struct sdram_bank sdram_bank[4];
 };
 
-#define KW_REG_CPUCS_WIN_ENABLE                (1 << 0)
-#define KW_REG_CPUCS_WIN_WR_PROTECT    (1 << 1)
-#define KW_REG_CPUCS_WIN_WIN0_CS(x)    (((x) & 0x3) << 2)
-#define KW_REG_CPUCS_WIN_SIZE(x)       (((x) & 0xff) << 24)
+#define REG_CPUCS_WIN_ENABLE           (1 << 0)
+#define REG_CPUCS_WIN_WR_PROTECT       (1 << 1)
+#define REG_CPUCS_WIN_WIN0_CS(x)       (((x) & 0x3) << 2)
+#define REG_CPUCS_WIN_SIZE(x)          (((x) & 0xff) << 24)
 
 /*
- * kw_sdram_bar - reads SDRAM Base Address Register
+ * mvebu_sdram_bar - reads SDRAM Base Address Register
  */
-u32 kw_sdram_bar(enum memory_bank bank)
+u32 mvebu_sdram_bar(enum memory_bank bank)
 {
-       struct kw_sdram_addr_dec *base =
-               (struct kw_sdram_addr_dec *)KW_REGISTER(0x1500);
+       struct sdram_addr_dec *base =
+               (struct sdram_addr_dec *)MVEBU_SDRAM_BASE;
        u32 result = 0;
        u32 enable = 0x01 & readl(&base->sdram_bank[bank].win_sz);
 
@@ -46,31 +46,31 @@ u32 kw_sdram_bar(enum memory_bank bank)
 }
 
 /*
- * kw_sdram_bs_set - writes SDRAM Bank size
+ * mvebu_sdram_bs_set - writes SDRAM Bank size
  */
-static void kw_sdram_bs_set(enum memory_bank bank, u32 size)
+static void mvebu_sdram_bs_set(enum memory_bank bank, u32 size)
 {
-       struct kw_sdram_addr_dec *base =
-               (struct kw_sdram_addr_dec *)KW_REGISTER(0x1500);
+       struct sdram_addr_dec *base =
+               (struct sdram_addr_dec *)MVEBU_SDRAM_BASE;
        /* Read current register value */
        u32 reg = readl(&base->sdram_bank[bank].win_sz);
 
        /* Clear window size */
-       reg &= ~KW_REG_CPUCS_WIN_SIZE(0xFF);
+       reg &= ~REG_CPUCS_WIN_SIZE(0xFF);
 
        /* Set new window size */
-       reg |= KW_REG_CPUCS_WIN_SIZE((size - 1) >> 24);
+       reg |= REG_CPUCS_WIN_SIZE((size - 1) >> 24);
 
        writel(reg, &base->sdram_bank[bank].win_sz);
 }
 
 /*
- * kw_sdram_bs - reads SDRAM Bank size
+ * mvebu_sdram_bs - reads SDRAM Bank size
  */
-u32 kw_sdram_bs(enum memory_bank bank)
+u32 mvebu_sdram_bs(enum memory_bank bank)
 {
-       struct kw_sdram_addr_dec *base =
-               (struct kw_sdram_addr_dec *)KW_REGISTER(0x1500);
+       struct sdram_addr_dec *base =
+               (struct sdram_addr_dec *)MVEBU_SDRAM_BASE;
        u32 result = 0;
        u32 enable = 0x01 & readl(&base->sdram_bank[bank].win_sz);
 
@@ -81,15 +81,16 @@ u32 kw_sdram_bs(enum memory_bank bank)
        return result;
 }
 
-void kw_sdram_size_adjust(enum memory_bank bank)
+void mvebu_sdram_size_adjust(enum memory_bank bank)
 {
        u32 size;
 
        /* probe currently equipped RAM size */
-       size = get_ram_size((void *)kw_sdram_bar(bank), kw_sdram_bs(bank));
+       size = get_ram_size((void *)mvebu_sdram_bar(bank),
+                           mvebu_sdram_bs(bank));
 
        /* adjust SDRAM window size accordingly */
-       kw_sdram_bs_set(bank, size);
+       mvebu_sdram_bs_set(bank, size);
 }
 
 #ifndef CONFIG_SYS_BOARD_DRAM_INIT
@@ -99,8 +100,8 @@ int dram_init(void)
 
        gd->ram_size = 0;
        for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
-               gd->bd->bi_dram[i].start = kw_sdram_bar(i);
-               gd->bd->bi_dram[i].size = kw_sdram_bs(i);
+               gd->bd->bi_dram[i].start = mvebu_sdram_bar(i);
+               gd->bd->bi_dram[i].size = mvebu_sdram_bs(i);
                /*
                 * It is assumed that all memory banks are consecutive
                 * and without gaps.
index 12a516e30ab6106d55c0f9c7a57cbb68c123f947..263bb5426c0d1a7086b9ed28ea7085e7ee0a96ed 100644 (file)
@@ -77,7 +77,7 @@ int board_init(void)
        gd->bd->bi_arch_number = MACH_TYPE_NET2BIG_V2;
 
        /* Boot parameters address */
-       gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
+       gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
 
        return 0;
 }
index 323e34a6c2dd0d1aac9d071398a53acd0dd47f0f..17e629622ff733487303611f58730835e1317246 100644 (file)
@@ -73,7 +73,7 @@ int board_init(void)
        gd->bd->bi_arch_number = CONFIG_MACH_TYPE;
 
        /* Boot parameters address */
-       gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
+       gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
 
        return 0;
 }
index 15b34a388ce28891c8758fb69e23828f8b4b818e..8620e4b5d135fa1022043a4cf53f40b2491dde20 100644 (file)
@@ -112,7 +112,7 @@ int board_init(void)
        gd->bd->bi_arch_number = CONFIG_MACH_TYPE;
 
        /* Boot parameters address */
-       gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
+       gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
 
        return 0;
 }
index 07b7496f3a12fe28900b3859b070c7e2d95d88ba..0887d92c2995469cb115c0ef719846b7e2eb7e24 100644 (file)
@@ -90,7 +90,7 @@ int board_early_init_f(void)
 int board_init(void)
 {
        /* adress of boot parameters */
-       gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
+       gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
 
        return 0;
 }
index b18a30657baeab0e4e4e7541086ca32eb4e3cbfc..b0d5f1e10f4ddf46a4f21371a3f5edaaa22af10f 100644 (file)
@@ -92,7 +92,7 @@ int board_init(void)
        gd->bd->bi_arch_number = MACH_TYPE_GURUPLUG;
 
        /* adress of boot parameters */
-       gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
+       gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
 
        return 0;
 }
index 97fb61bc90ee73682d356447941d75f8ed554a2f..ef08ad8928d04dad71afbebfabd9f80f7943052d 100644 (file)
@@ -94,7 +94,7 @@ int board_init(void)
        gd->bd->bi_arch_number = MACH_TYPE_MV88F6281GTW_GE;
 
        /* adress of boot parameters */
-       gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
+       gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
 
        return 0;
 }
index 52dd08383dfa0df7f97568cdfe8cfd6a8ace2637..55cf525cf8aa18e7aed9542c2761ddc30d41a959 100644 (file)
@@ -104,7 +104,7 @@ int board_init(void)
 #endif
 
        /* adress of boot parameters */
-       gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
+       gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
        return 0;
 }
 
index df5fbea8ae528aa546a2c64e46543c055aabb894..b0020c95a5bb067ebe2291eb4714981751603edf 100644 (file)
@@ -93,7 +93,7 @@ int board_init(void)
        gd->bd->bi_arch_number = MACH_TYPE_RD88F6281;
 
        /* adress of boot parameters */
-       gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
+       gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
 
        return 0;
 }
index 18eeb4c0015534320be7b362368e5d2072bade55..8907fb58ff80f90f48c14545e7bbb04c93ae705f 100644 (file)
@@ -92,7 +92,7 @@ int board_init(void)
        gd->bd->bi_arch_number = MACH_TYPE_SHEEVAPLUG;
 
        /* adress of boot parameters */
-       gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
+       gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
 
        return 0;
 }
index 838f578104d1310208a7ece50da87e807ee22776..83ab1bc32d307dc16b3e5017dcb169d31b32b8d2 100644 (file)
@@ -96,7 +96,7 @@ int board_init(void)
        gd->bd->bi_arch_number = MACH_TYPE_DOCKSTAR;
 
        /* address of boot parameters */
-       gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
+       gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
 
        return 0;
 }
index c3f4cbf84dbb6c718325110ebf7520de48ebe6c8..1f4fb924942a4c65a9833fd660eb6847853b90a7 100644 (file)
@@ -98,7 +98,7 @@ int board_init(void)
        gd->bd->bi_arch_number = MACH_TYPE_GOFLEXHOME;
 
        /* address of boot parameters */
-       gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
+       gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
 
        return 0;
 }
index bca7be5482d652ea3128cb62cb5c6007523ee226..b0d49c4ee6b8ac266588d63c81b8ef3094097346 100644 (file)
@@ -168,7 +168,7 @@ static void set_led(int state)
 int board_init(void)
 {
        /* address of boot parameters */
-       gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
+       gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
 
        set_led(LED_POWER_BLINKING);
 
index 314834f2ba25f7da249e5257d5328d8abb17ebbe..8309d06882e39db567488107608745fd8d694ff7 100644 (file)
@@ -64,7 +64,7 @@ int board_early_init_f(void)
 int board_init(void)
 {
        /* Boot parameters address */
-       gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
+       gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
 
        return 0;
 }
index fd23696fc3131cbde95aba809764f60c01277ba7..a022daf71e419bc87b707aeaf35ea7813d6e13fe 100644 (file)
@@ -92,7 +92,7 @@ int board_early_init_f(void)
 int board_init(void)
 {
        /* Boot parameters address */
-       gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
+       gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
 
        return 0;
 }
index 76c945a969630537c23fb86f86db33b4d3f9fbd7..086a473e8875c98865d9d3dc64d970e93467444b 100644 (file)
@@ -87,7 +87,7 @@ int board_early_init_f(void)
 int board_init(void)
 {
        /* adress of boot parameters */
-       gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
+       gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
 
        return 0;
 }
index 7aec5f9060fa7884ef5990e9f31eae2e22708a2d..35546d24e87560454d3a4a047b76899cd1318413 100644 (file)
@@ -97,7 +97,7 @@ int board_init(void)
        gd->bd->bi_arch_number = CONFIG_MACH_TYPE;
 
        /* adress of boot parameters */
-       gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
+       gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
 
        return 0;
 }
index 662146400975b86ee4fb18b9b18e418aa8fe5554..1c7c108cb5acd7536e0081a7d2a7f40a7eb23a74 100644 (file)
@@ -226,7 +226,7 @@ int board_early_init_f(void)
        writel(tmp & (~KM_KIRKWOOD_SOFT_I2C_GPIOS) , MVEBU_GPIO0_BASE + 4);
 #endif
        /* adjust SDRAM size for bank 0 */
-       kw_sdram_size_adjust(0);
+       mvebu_sdram_size_adjust(0);
        kirkwood_mpp_conf(kwmpp_config, NULL);
        return 0;
 }
@@ -234,7 +234,7 @@ int board_early_init_f(void)
 int board_init(void)
 {
        /* address of boot parameters */
-       gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
+       gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
 
        /*
         * The KM_FLASH_GPIO_PIN switches between using a
index dbcfb438134426ef2c7576a15f44993e5611e6fa..f01fb1c6e7624bbe66d9714fc3fbfe0d98db0619 100644 (file)
@@ -62,7 +62,7 @@ int board_early_init_f(void)
 int board_init(void)
 {
        /* adress of boot parameters */
-       gd->bd->bi_boot_params = kw_sdram_bar(0) + 0x100;
+       gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
 
        return 0;
 }