aboutsummaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorHao Zhang2014-07-09 23:44:46 +0300
committerTom Rini2014-07-25 16:26:10 -0400
commite595107ebbdeb3e50351e703cce08eb07f70c614 (patch)
treeda6817a6937531220cea7c6933d1b18d30be74e4 /board
parent0bedbb81351193f1507ad127b6b26e19a93c2c42 (diff)
ARM: keystone2: move K2HK board files to common KS2 board directory
This patch moves K2HK board directory to a common Keystone II board directory. The Board related common functions are moved to a common keystone board file. Acked-by: Murali Karicheri <m-karicheri2@ti.com> Signed-off-by: Hao Zhang <hzhang@ti.com> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
Diffstat (limited to 'board')
-rw-r--r--board/ti/ks2_evm/Makefile (renamed from board/ti/k2hk_evm/Makefile)7
-rw-r--r--board/ti/ks2_evm/README_K2HK (renamed from board/ti/k2hk_evm/README)0
-rw-r--r--board/ti/ks2_evm/board.c (renamed from board/ti/k2hk_evm/board.c)135
-rw-r--r--board/ti/ks2_evm/board.h19
-rw-r--r--board/ti/ks2_evm/board_k2hk.c81
-rw-r--r--board/ti/ks2_evm/ddr3_k2hk.c (renamed from board/ti/k2hk_evm/ddr3.c)0
6 files changed, 140 insertions, 102 deletions
diff --git a/board/ti/k2hk_evm/Makefile b/board/ti/ks2_evm/Makefile
index 3645f2feb01..58d77dcae51 100644
--- a/board/ti/k2hk_evm/Makefile
+++ b/board/ti/ks2_evm/Makefile
@@ -1,9 +1,10 @@
#
-# K2HK-EVM: board Makefile
+# KS2-EVM: board Makefile
# (C) Copyright 2012-2014
# Texas Instruments Incorporated, <www.ti.com>
# SPDX-License-Identifier: GPL-2.0+
#
-obj-y += board.o
-obj-y += ddr3.o
+obj-y += board.o
+obj-$(CONFIG_K2HK_EVM) += board_k2hk.o
+obj-$(CONFIG_K2HK_EVM) += ddr3_k2hk.o
diff --git a/board/ti/k2hk_evm/README b/board/ti/ks2_evm/README_K2HK
index 7426b8dc977..7426b8dc977 100644
--- a/board/ti/k2hk_evm/README
+++ b/board/ti/ks2_evm/README_K2HK
diff --git a/board/ti/k2hk_evm/board.c b/board/ti/ks2_evm/board.c
index 646ecb37e73..dfe7be60e71 100644
--- a/board/ti/k2hk_evm/board.c
+++ b/board/ti/ks2_evm/board.c
@@ -1,44 +1,22 @@
/*
- * K2HK EVM : Board initialization
+ * Keystone : Board initialization
*
- * (C) Copyright 2012-2014
+ * (C) Copyright 2014
* Texas Instruments Incorporated, <www.ti.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
+#include "board.h"
#include <common.h>
#include <exports.h>
#include <fdt_support.h>
-#include <libfdt.h>
-
#include <asm/arch/ddr3.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/clock.h>
-#include <asm/io.h>
-#include <asm/mach-types.h>
#include <asm/arch/emac_defs.h>
-#include <asm/arch/psc_defs.h>
#include <asm/ti-common/ti-aemif.h>
DECLARE_GLOBAL_DATA_PTR;
-unsigned int external_clk[ext_clk_count] = {
- [sys_clk] = 122880000,
- [alt_core_clk] = 125000000,
- [pa_clk] = 122880000,
- [tetris_clk] = 125000000,
- [ddr3a_clk] = 100000000,
- [ddr3b_clk] = 100000000,
- [mcm_clk] = 312500000,
- [pcie_clk] = 100000000,
- [sgmii_srio_clk] = 156250000,
- [xgmii_clk] = 156250000,
- [usb_clk] = 100000000,
- [rp1_clk] = 123456789 /* TODO: cannot find
- what is that */
-};
-
static struct aemif_config aemif_configs[] = {
{ /* CS0 */
.mode = AEMIF_MODE_NAND,
@@ -51,13 +29,6 @@ static struct aemif_config aemif_configs[] = {
.turn_around = 3,
.width = AEMIF_WIDTH_8,
},
-
-};
-
-static struct pll_init_data pll_config[] = {
- CORE_PLL_1228,
- PASS_PLL_983,
- TETRIS_PLL_1200,
};
int dram_init(void)
@@ -70,42 +41,18 @@ int dram_init(void)
return 0;
}
-#ifdef CONFIG_DRIVER_TI_KEYSTONE_NET
-struct eth_priv_t eth_priv_cfg[] = {
- {
- .int_name = "K2HK_EMAC",
- .rx_flow = 22,
- .phy_addr = 0,
- .slave_port = 1,
- .sgmii_link_type = SGMII_LINK_MAC_PHY,
- },
- {
- .int_name = "K2HK_EMAC1",
- .rx_flow = 23,
- .phy_addr = 1,
- .slave_port = 2,
- .sgmii_link_type = SGMII_LINK_MAC_PHY,
- },
- {
- .int_name = "K2HK_EMAC2",
- .rx_flow = 24,
- .phy_addr = 2,
- .slave_port = 3,
- .sgmii_link_type = SGMII_LINK_MAC_MAC_FORCED,
- },
- {
- .int_name = "K2HK_EMAC3",
- .rx_flow = 25,
- .phy_addr = 3,
- .slave_port = 4,
- .sgmii_link_type = SGMII_LINK_MAC_MAC_FORCED,
- },
-};
+int board_init(void)
+{
+ gd->bd->bi_boot_params = CONFIG_LINUX_BOOT_PARAM_ADDR;
+
+ return 0;
+}
+#ifdef CONFIG_DRIVER_TI_KEYSTONE_NET
int get_eth_env_param(char *env_name)
{
char *env;
- int res = -1;
+ int res = -1;
env = getenv(env_name);
if (env)
@@ -116,12 +63,14 @@ int get_eth_env_param(char *env_name)
int board_eth_init(bd_t *bis)
{
- int j;
- int res;
- char link_type_name[32];
+ int j;
+ int res;
+ int port_num;
+ char link_type_name[32];
+
+ port_num = get_num_eth_ports();
- for (j = 0; j < (sizeof(eth_priv_cfg) / sizeof(struct eth_priv_t));
- j++) {
+ for (j = 0; j < port_num; j++) {
sprintf(link_type_name, "sgmii%d_link_type", j);
res = get_eth_env_param(link_type_name);
if (res >= 0)
@@ -134,32 +83,19 @@ int board_eth_init(bd_t *bis)
}
#endif
-#if defined(CONFIG_BOARD_EARLY_INIT_F)
-int board_early_init_f(void)
-{
- init_plls(ARRAY_SIZE(pll_config), pll_config);
- return 0;
-}
-#endif
-
-int board_init(void)
-{
- gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
-
- return 0;
-}
-
#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-#define K2_DDR3_START_ADDR 0x80000000
void ft_board_setup(void *blob, bd_t *bd)
{
- u64 start[2];
+ int lpae;
+ char *env;
+ char *endp;
+ int nbanks;
u64 size[2];
- char name[32], *env, *endp;
- int lpae, nodeoffset;
- int unitrd_fixup = 0;
+ u64 start[2];
+ char name[32];
+ int nodeoffset;
u32 ddr3a_size;
- int nbanks;
+ int unitrd_fixup = 0;
env = getenv("mem_lpae");
lpae = env && simple_strtol(env, NULL, 0);
@@ -181,7 +117,7 @@ void ft_board_setup(void *blob, bd_t *bd)
/* adjust memory start address for LPAE */
if (lpae) {
- start[0] -= K2_DDR3_START_ADDR;
+ start[0] -= CONFIG_SYS_SDRAM_BASE;
start[0] += CONFIG_SYS_LPAE_SDRAM_BASE;
}
@@ -208,9 +144,9 @@ void ft_board_setup(void *blob, bd_t *bd)
/* Fix up the initrd */
if (lpae && unitrd_fixup) {
- u64 initrd_start, initrd_end;
- u32 *prop1, *prop2;
int err;
+ u32 *prop1, *prop2;
+ u64 initrd_start, initrd_end;
nodeoffset = fdt_path_offset(blob, "/chosen");
if (nodeoffset >= 0) {
@@ -220,11 +156,11 @@ void ft_board_setup(void *blob, bd_t *bd)
"linux,initrd-end", NULL);
if (prop1 && prop2) {
initrd_start = __be32_to_cpu(*prop1);
- initrd_start -= K2_DDR3_START_ADDR;
+ initrd_start -= CONFIG_SYS_SDRAM_BASE;
initrd_start += CONFIG_SYS_LPAE_SDRAM_BASE;
initrd_start = __cpu_to_be64(initrd_start);
initrd_end = __be32_to_cpu(*prop2);
- initrd_end -= K2_DDR3_START_ADDR;
+ initrd_end -= CONFIG_SYS_SDRAM_BASE;
initrd_end += CONFIG_SYS_LPAE_SDRAM_BASE;
initrd_end = __cpu_to_be64(initrd_end);
@@ -258,9 +194,10 @@ void ft_board_setup(void *blob, bd_t *bd)
void ft_board_setup_ex(void *blob, bd_t *bd)
{
- int lpae;
- char *env;
- u64 *reserve_start, size;
+ int lpae;
+ u64 size;
+ char *env;
+ u64 *reserve_start;
env = getenv("mem_lpae");
lpae = env && simple_strtol(env, NULL, 0);
@@ -277,7 +214,7 @@ void ft_board_setup_ex(void *blob, bd_t *bd)
*reserve_start = __cpu_to_be64(*reserve_start);
size = __cpu_to_be64(*(reserve_start + 1));
if (size) {
- *reserve_start -= K2_DDR3_START_ADDR;
+ *reserve_start -= CONFIG_SYS_SDRAM_BASE;
*reserve_start +=
CONFIG_SYS_LPAE_SDRAM_BASE;
*reserve_start =
diff --git a/board/ti/ks2_evm/board.h b/board/ti/ks2_evm/board.h
new file mode 100644
index 00000000000..d91ef736129
--- /dev/null
+++ b/board/ti/ks2_evm/board.h
@@ -0,0 +1,19 @@
+/*
+ * K2HK EVM : Board common header
+ *
+ * (C) Copyright 2014
+ * Texas Instruments Incorporated, <www.ti.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#ifndef _KS2_BOARD
+#define _KS2_BOARD
+
+#include <asm/arch/emac_defs.h>
+
+extern struct eth_priv_t eth_priv_cfg[];
+
+int get_num_eth_ports(void);
+
+#endif
diff --git a/board/ti/ks2_evm/board_k2hk.c b/board/ti/ks2_evm/board_k2hk.c
new file mode 100644
index 00000000000..a369d6bd63d
--- /dev/null
+++ b/board/ti/ks2_evm/board_k2hk.c
@@ -0,0 +1,81 @@
+/*
+ * K2HK EVM : Board initialization
+ *
+ * (C) Copyright 2012-2014
+ * Texas Instruments Incorporated, <www.ti.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/emac_defs.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+unsigned int external_clk[ext_clk_count] = {
+ [sys_clk] = 122880000,
+ [alt_core_clk] = 125000000,
+ [pa_clk] = 122880000,
+ [tetris_clk] = 125000000,
+ [ddr3a_clk] = 100000000,
+ [ddr3b_clk] = 100000000,
+ [mcm_clk] = 312500000,
+ [pcie_clk] = 100000000,
+ [sgmii_srio_clk] = 156250000,
+ [xgmii_clk] = 156250000,
+ [usb_clk] = 100000000,
+ [rp1_clk] = 123456789
+};
+
+static struct pll_init_data pll_config[] = {
+ CORE_PLL_1228,
+ PASS_PLL_983,
+ TETRIS_PLL_1200,
+};
+
+#ifdef CONFIG_DRIVER_TI_KEYSTONE_NET
+struct eth_priv_t eth_priv_cfg[] = {
+ {
+ .int_name = "K2HK_EMAC",
+ .rx_flow = 22,
+ .phy_addr = 0,
+ .slave_port = 1,
+ .sgmii_link_type = SGMII_LINK_MAC_PHY,
+ },
+ {
+ .int_name = "K2HK_EMAC1",
+ .rx_flow = 23,
+ .phy_addr = 1,
+ .slave_port = 2,
+ .sgmii_link_type = SGMII_LINK_MAC_PHY,
+ },
+ {
+ .int_name = "K2HK_EMAC2",
+ .rx_flow = 24,
+ .phy_addr = 2,
+ .slave_port = 3,
+ .sgmii_link_type = SGMII_LINK_MAC_MAC_FORCED,
+ },
+ {
+ .int_name = "K2HK_EMAC3",
+ .rx_flow = 25,
+ .phy_addr = 3,
+ .slave_port = 4,
+ .sgmii_link_type = SGMII_LINK_MAC_MAC_FORCED,
+ },
+};
+
+int get_num_eth_ports(void)
+{
+ return sizeof(eth_priv_cfg) / sizeof(struct eth_priv_t);
+}
+#endif
+
+#ifdef CONFIG_BOARD_EARLY_INIT_F
+int board_early_init_f(void)
+{
+ init_plls(ARRAY_SIZE(pll_config), pll_config);
+ return 0;
+}
+#endif
diff --git a/board/ti/k2hk_evm/ddr3.c b/board/ti/ks2_evm/ddr3_k2hk.c
index 31e9c31ea2c..31e9c31ea2c 100644
--- a/board/ti/k2hk_evm/ddr3.c
+++ b/board/ti/ks2_evm/ddr3_k2hk.c