Skip to contentSkip to conversation

keystone2: add k2l SoC and k2l_evm board support

PATCH Superseded Ivan Khoronzhuk 2 participants 13 messages Oct 14, 2014 – Oct 22, 2014 Arm (32-bit)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v4 cover keystone2: add k2l SoC and k2l_evm board support

This patch series adds Keystone II Lamar (K2L) SoC and k2l_evm board support.

Based on
"[U-boot] [Patch v2] keystone: usb: add support of usb xhci"
https://patchwork.ozlabs.org/patch/386506/

v4..v3
- keystone2: k2l-evm: add board support
remove dimm name reading

v3..v2
- keystone2: k2l-evm: add board support
Add maintainers information
Enable SPL by default

v2..v1

	Rebased according to changes of c338f09e965a300ddd78af73e86c4af4c9464ce4
	"keystone: kconfig: move board select menu and common settings"

Hao Zhang (6):
ARM: keystone2: add K2L device hardware definitions
keystone2: clock: add K2L clock definitions and commands
keystone2: msmc: add MSMC cache coherency support for K2L SOC
ARM: keystone2: spl: add K2L SoC support
keystone2: enable OSR clock domain for K2L SoC
keystone2: k2l-evm: add board support

 arch/arm/cpu/armv7/keystone/Kconfig                |   3 +
 arch/arm/cpu/armv7/keystone/Makefile               |   1 +
 arch/arm/cpu/armv7/keystone/clock-k2l.c            | 138 +++++++++++++++++++++
 arch/arm/cpu/armv7/keystone/cmd_clock.c            |  10 ++
 arch/arm/cpu/armv7/keystone/init.c                 |  52 ++++++++
 arch/arm/cpu/armv7/keystone/spl.c                  |   7 ++
 arch/arm/include/asm/arch-keystone/clock-k2l.h     |  94 ++++++++++++++
 arch/arm/include/asm/arch-keystone/clock.h         |   4 +
 arch/arm/include/asm/arch-keystone/hardware-k2hk.h |   2 -
 arch/arm/include/asm/arch-keystone/hardware-k2l.h  |  99 +++++++++++++++
 arch/arm/include/asm/arch-keystone/hardware.h      |  14 +++
 board/ti/ks2_evm/Kconfig                           |  16 +++
 board/ti/ks2_evm/MAINTAINERS                       |   2 +
 board/ti/ks2_evm/Makefile                          |   2 +
 board/ti/ks2_evm/board_k2l.c                       |  60 +++++++++
 board/ti/ks2_evm/ddr3_cfg.c                        |  36 ++++++
 board/ti/ks2_evm/ddr3_cfg.h                        |   3 +
 board/ti/ks2_evm/ddr3_k2l.c                        |  43 +++++++
 configs/k2l_evm_defconfig                          |   4 +
 include/configs/k2l_evm.h                          |  37 ++++++
 20 files changed, 625 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/keystone/clock-k2l.c
 create mode 100644 arch/arm/include/asm/arch-keystone/clock-k2l.h
 create mode 100644 arch/arm/include/asm/arch-keystone/hardware-k2l.h
 create mode 100644 board/ti/ks2_evm/board_k2l.c
 create mode 100644 board/ti/ks2_evm/ddr3_k2l.c
 create mode 100644 configs/k2l_evm_defconfig
 create mode 100644 include/configs/k2l_evm.h
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH v4 1/6 ARM: keystone2: add K2L device hardware definitions

From: Hao Zhang <[email protected]>

This patch adds hardware definitions specific to Keystone II Lamar (K2L) SoC.

---
 arch/arm/include/asm/arch-keystone/hardware-k2hk.h |  2 -
 arch/arm/include/asm/arch-keystone/hardware-k2l.h  | 74 ++++++++++++++++++++++
 arch/arm/include/asm/arch-keystone/hardware.h      | 13 ++++
 3 files changed, 87 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-keystone/hardware-k2l.h
arch/arm/include/asm/arch-keystone/hardware-k2hk.h +0 -2
index 43c2c42..2db806c 100644
@@ -10,8 +10,6 @@
 #ifndef __ASM_ARCH_HARDWARE_K2HK_H
 #define __ASM_ARCH_HARDWARE_K2HK_H
 
-#define KS2_MISC_CTRL			(KS2_DEVICE_STATE_CTRL_BASE + 0xc7c)
-
 #define KS2_ARM_PLL_EN			BIT(13)
 
 /* PA SS Registers */
arch/arm/include/asm/arch-keystone/hardware-k2l.h new file +74 -0

74 lines not on this page · raw message

arch/arm/include/asm/arch-keystone/hardware.h +13 -0
index c1642a5..adae69e 100644
@@ -143,6 +143,7 @@ typedef volatile unsigned int   *dv_reg_p;
 /* Device speed */
 #define KS2_REV1_DEVSPEED		(KS2_DEVICE_STATE_CTRL_BASE + 0xc98)
 #define KS2_EFUSE_BOOTROM		(KS2_DEVICE_STATE_CTRL_BASE + 0xc90)
+#define KS2_MISC_CTRL			(KS2_DEVICE_STATE_CTRL_BASE + 0xc7c)
 
 /* Queue manager */
 #define KS2_QM_BASE_ADDRESS		0x23a80000
@@ -177,6 +178,10 @@ typedef volatile unsigned int   *dv_reg_p;
 #include <asm/arch/hardware-k2e.h>
 #endif
 
+#ifdef CONFIG_SOC_K2L
+#include <asm/arch/hardware-k2l.h>
+#endif
+
 #ifndef __ASSEMBLY__
 static inline int cpu_is_k2hk(void)
 {
@@ -194,6 +199,14 @@ static inline int cpu_is_k2e(void)
 	return (part_no == 0xb9a6) ? 1 : 0;
 }
 
+static inline int cpu_is_k2l(void)
+{
+	unsigned int jtag_id    = __raw_readl(KS2_JTAG_ID_REG);
+	unsigned int part_no    = (jtag_id >> 12) & 0xffff;
+
+	return (part_no == 0xb9a7) ? 1 : 0;
+}
+
 static inline int cpu_revision(void)
 {
 	unsigned int jtag_id	= __raw_readl(KS2_JTAG_ID_REG);
Signature · 1 line
1.8.3.2
#2 lore raw

PATCH v4 2/6 keystone2: clock: add K2L clock definitions and commands

In reply to Ivan Khoronzhuk

From: Hao Zhang <[email protected]>

This patch adds clock definitions and commands to support Keystone II K2L SOC.

---
 arch/arm/cpu/armv7/keystone/Makefile           |   1 +
 arch/arm/cpu/armv7/keystone/clock-k2l.c        | 138 +++++++++++++++++++++++++
 arch/arm/cpu/armv7/keystone/cmd_clock.c        |  10 ++
 arch/arm/include/asm/arch-keystone/clock-k2l.h |  88 ++++++++++++++++
 arch/arm/include/asm/arch-keystone/clock.h     |   4 +
 5 files changed, 241 insertions(+)
 create mode 100644 arch/arm/cpu/armv7/keystone/clock-k2l.c
 create mode 100644 arch/arm/include/asm/arch-keystone/clock-k2l.h
arch/arm/cpu/armv7/keystone/Makefile +1 -0
index 3d8fb70..4750371 100644
@@ -10,6 +10,7 @@ obj-y	+= psc.o
 obj-y	+= clock.o
 obj-$(CONFIG_SOC_K2HK) += clock-k2hk.o
 obj-$(CONFIG_SOC_K2E) += clock-k2e.o
+obj-$(CONFIG_SOC_K2L) += clock-k2l.o
 obj-y	+= cmd_clock.o
 obj-y	+= cmd_mon.o
 obj-y	+= msmc.o
arch/arm/cpu/armv7/keystone/clock-k2l.c new file +138 -0

138 lines not on this page · raw message

arch/arm/cpu/armv7/keystone/cmd_clock.c +10 -0
index d97c95b..9204887 100644
@@ -72,6 +72,13 @@ U_BOOT_CMD(
 	"<pa|ddr3> <mult> <div> <OD>\n"
 );
 #endif
+#ifdef CONFIG_SOC_K2L
+U_BOOT_CMD(
+	pllset, 5,      0,      do_pll_cmd,
+	"set pll multiplier and pre divider",
+	"<pa|arm|ddr3> <mult> <div> <OD>\n"
+);
+#endif
 
 int do_getclk_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
@@ -101,6 +108,9 @@ U_BOOT_CMD(
 #ifdef CONFIG_SOC_K2E
 	"See the 'enum clk_e' in the clock-k2e.h for clk indexes\n"
 #endif
+#ifdef CONFIG_SOC_K2L
+	"See the 'enum clk_e' in the clock-k2l.h for clk indexes\n"
+#endif
 );
 
 int do_psc_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
arch/arm/include/asm/arch-keystone/clock-k2l.h new file +88 -0

88 lines not on this page · raw message

arch/arm/include/asm/arch-keystone/clock.h +4 -0
index dae000e..bc31267 100644
@@ -20,6 +20,10 @@
 #include <asm/arch/clock-k2e.h>
 #endif
 
+#ifdef CONFIG_SOC_K2L
+#include <asm/arch/clock-k2l.h>
+#endif
+
 #define MAIN_PLL CORE_PLL
 
 #include <asm/types.h>
Signature · 1 line
1.8.3.2
#3 lore raw

PATCH v4 2/6 keystone2: clock: add K2L clock definitions and commands

Quoted 8 lines · Ivan Khoronzhuk

From: Hao Zhang <[email protected]>

This patch adds clock definitions and commands to support Keystone II K2L SOC.

[snip]

Quoted 19 lines
arch/arm/cpu/armv7/keystone/cmd_clock.c +7 -0
index d97c95b..9204887 100644
@@ -72,6 +72,13 @@ U_BOOT_CMD(
 	"<pa|ddr3> <mult> <div> <OD>\n"
 );
 #endif
+#ifdef CONFIG_SOC_K2L
+U_BOOT_CMD(
+	pllset, 5,      0,      do_pll_cmd,
+	"set pll multiplier and pre divider",
+	"<pa|arm|ddr3> <mult> <div> <OD>\n"
+);
+#endif
 
 int do_getclk_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {

arch/arm/cpu/armv7/keystone/cmd_clock.c U_BOOT_CMD( · line 114

Quoted 7 lines
arch/arm/cpu/armv7/keystone/cmd_clock.c +3 -0
@@ -101,6 +108,9 @@ U_BOOT_CMD(
 #ifdef CONFIG_SOC_K2E
 	"See the 'enum clk_e' in the clock-k2e.h for clk indexes\n"
 #endif
+#ifdef CONFIG_SOC_K2L
+	"See the 'enum clk_e' in the clock-k2l.h for clk indexes\n"
+#endif
 );

I'm not going to block on all of this duplication, but we need to think how to do this cleaner so that the next K2 variant doesn't expand this mess further. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141020/f201ec74/attachment.pgp>
#4 lore raw

PATCH v4 2/6 keystone2: clock: add K2L clock definitions and commands

Quoted 27 lines · Tom Rini
Quoted 8 lines · Ivan Khoronzhuk

From: Hao Zhang <[email protected]>

This patch adds clock definitions and commands to support Keystone II K2L SOC.

[snip]

Quoted 16 lines
arch/arm/cpu/armv7/keystone/cmd_clock.c +7 -0
index d97c95b..9204887 100644
@@ -72,6 +72,13 @@ U_BOOT_CMD(
  	"<pa|ddr3> <mult> <div> <OD>\n"
  );
  #endif
+#ifdef CONFIG_SOC_K2L
+U_BOOT_CMD(
+	pllset, 5,      0,      do_pll_cmd,
+	"set pll multiplier and pre divider",
+	"<pa|arm|ddr3> <mult> <div> <OD>\n"
+);
+#endif
 
Quoted 14 lines

arch/arm/cpu/armv7/keystone/cmd_clock.c U_BOOT_CMD( · line 114

Quoted 10 lines
arch/arm/cpu/armv7/keystone/cmd_clock.c +3 -0
  int do_getclk_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  {
@@ -101,6 +108,9 @@ U_BOOT_CMD(
  #ifdef CONFIG_SOC_K2E
  	"See the 'enum clk_e' in the clock-k2e.h for clk indexes\n"
  #endif
+#ifdef CONFIG_SOC_K2L
+	"See the 'enum clk_e' in the clock-k2l.h for clk indexes\n"
+#endif
  );

I'm not going to block on all of this duplication, but we need to think how to do this cleaner so that the next K2 variant doesn't expand this mess further. Thanks!

I'll correct it to one line:
"See the 'enum clk_e' in the clock-k2*.h for clk indexes\n"

Signature · 2 lines
Regards,
Ivan Khoronzhuk
#5 lore raw

PATCH v4 2/6 keystone2: clock: add K2L clock definitions and commands

Quoted 42 lines · Ivan Khoronzhuk
Quoted 31 lines · Tom Rini
Quoted 8 lines · Ivan Khoronzhuk

From: Hao Zhang <[email protected]>

This patch adds clock definitions and commands to support Keystone II K2L SOC.

[snip]

Quoted 20 lines
arch/arm/cpu/armv7/keystone/cmd_clock.c +7 -0
index d97c95b..9204887 100644
@@ -72,6 +72,13 @@ U_BOOT_CMD(
 	"<pa|ddr3> <mult> <div> <OD>\n"
 );
 #endif
+#ifdef CONFIG_SOC_K2L
+U_BOOT_CMD(
+	pllset, 5,      0,      do_pll_cmd,
+	"set pll multiplier and pre divider",
+	"<pa|arm|ddr3> <mult> <div> <OD>\n"
+);
+#endif
 int do_getclk_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
@@ -101,6 +108,9 @@ U_BOOT_CMD(
 #ifdef CONFIG_SOC_K2E
 	"See the 'enum clk_e' in the clock-k2e.h for clk indexes\n"
Quoted 9 lines

arch/arm/cpu/armv7/keystone/cmd_clock.c U_BOOT_CMD( · line 114

Quoted 5 lines
arch/arm/cpu/armv7/keystone/cmd_clock.c +3 -0
 #endif
+#ifdef CONFIG_SOC_K2L
+	"See the 'enum clk_e' in the clock-k2l.h for clk indexes\n"
+#endif
 );

I'm not going to block on all of this duplication, but we need to think how to do this cleaner so that the next K2 variant doesn't expand this mess further. Thanks!

Quoted 2 lines

I'll correct it to one line:
"See the 'enum clk_e' in the clock-k2*.h for clk indexes\n"

That helps the second hunk, but still leaves the first. At some point, even, we shouldn't say "go modify file foo" in the binary, that belongs in board documentation. Like I said, this needs a little bit of thinking.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141020/5863a505/attachment.pgp>
#6 lore raw

PATCH v4 2/6 keystone2: clock: add K2L clock definitions and commands

Quoted 42 lines · Tom Rini
Quoted 41 lines · Ivan Khoronzhuk
Quoted 40 lines · Tom Rini
Quoted 8 lines · Ivan Khoronzhuk

From: Hao Zhang <[email protected]>

This patch adds clock definitions and commands to support Keystone II K2L SOC.

[snip]

Quoted 18 lines
arch/arm/cpu/armv7/keystone/cmd_clock.c +7 -0
index d97c95b..9204887 100644
@@ -72,6 +72,13 @@ U_BOOT_CMD(
  	"<pa|ddr3> <mult> <div> <OD>\n"
  );
  #endif
+#ifdef CONFIG_SOC_K2L
+U_BOOT_CMD(
+	pllset, 5,      0,      do_pll_cmd,
+	"set pll multiplier and pre divider",
+	"<pa|arm|ddr3> <mult> <div> <OD>\n"
+);
+#endif
  int do_getclk_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  {

arch/arm/cpu/armv7/keystone/cmd_clock.c U_BOOT_CMD( · line 114

Quoted 7 lines
arch/arm/cpu/armv7/keystone/cmd_clock.c +3 -0
@@ -101,6 +108,9 @@ U_BOOT_CMD(
  #ifdef CONFIG_SOC_K2E
  	"See the 'enum clk_e' in the clock-k2e.h for clk indexes\n"
  #endif
+#ifdef CONFIG_SOC_K2L
+	"See the 'enum clk_e' in the clock-k2l.h for clk indexes\n"
+#endif
  );

I'm not going to block on all of this duplication, but we need to think how to do this cleaner so that the next K2 variant doesn't expand this mess further. Thanks!

Quoted 7 lines
Quoted 2 lines

I'll correct it to one line:
"See the 'enum clk_e' in the clock-k2*.h for clk indexes\n"

That helps the second hunk, but still leaves the first. At some point, even, we shouldn't say "go modify file foo" in the binary, that belongs in board documentation. Like I said, this needs a little bit of thinking.

Tom,
the series is updated according to your propositions:
"[U-boot] [Patch v6 0/6] keystone2: add k2l SoC and k2l_evm board support"
https://www.mail-archive.com/u-boot at lists.denx.de/msg150727.html

It's based on patch that corrects command usage descriptions:

"[U-Boot,U-boot] ARM: cmd_clock: generalize command usage description"
http://patchwork.ozlabs.org/patch/402102/

I've sent it separately to not mix it with K2L support series.

Thanks!

Signature · 2 lines
Regards,
Ivan Khoronzhuk
#7 lore raw

PATCH v4 3/6 keystone2: msmc: add MSMC cache coherency support for K2L SOC

In reply to Ivan Khoronzhuk

From: Hao Zhang <[email protected]>

This patch adds Keystone II Lamar (K2L) SoC specific definitions to support MSMC cache coherency.

---
 arch/arm/cpu/armv7/keystone/init.c | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/cpu/armv7/keystone/init.c +3 -0
index a8f8aee..a0ecfa2 100644
@@ -32,6 +32,9 @@ int arch_cpu_init(void)
 #ifdef CONFIG_SOC_K2E
 	msmc_share_all_segments(13); /* PCIE 1 */
 #endif
+#ifdef CONFIG_SOC_K2L
+	msmc_share_all_segments(14); /* PCIE 1 */
+#endif
 
 	/*
 	 * just initialise the COM2 port so that TI specific
Signature · 1 line
1.8.3.2
#8 lore raw

PATCH v4 3/6 keystone2: msmc: add MSMC cache coherency support for K2L SOC

Quoted 17 lines · Ivan Khoronzhuk

From: Hao Zhang <[email protected]>

This patch adds Keystone II Lamar (K2L) SoC specific definitions to support MSMC cache coherency.

---
 arch/arm/cpu/armv7/keystone/init.c | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/cpu/armv7/keystone/init.c +0 -0
index a8f8aee..a0ecfa2 100644

arch/arm/cpu/armv7/keystone/init.c int arch_cpu_init(void) · line 40

Quoted 9 lines
arch/arm/cpu/armv7/keystone/init.c +3 -0
@@ -32,6 +32,9 @@ int arch_cpu_init(void)
 #ifdef CONFIG_SOC_K2E
 	msmc_share_all_segments(13); /* PCIE 1 */
 #endif
+#ifdef CONFIG_SOC_K2L
+	msmc_share_all_segments(14); /* PCIE 1 */
+#endif
 
 	/*
 	 * just initialise the COM2 port so that TI specific

Where does 13/14 come from and can we just define what that means in a K2-foo specific header so we can always do msmc_share_all_segments(K2_MSMC_SEGMENTS_NR) or whatever? Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141020/51835dfa/attachment.pgp>
#9 lore raw

PATCH v4 3/6 keystone2: msmc: add MSMC cache coherency support for K2L SOC

Quoted 25 lines · Tom Rini
Quoted 24 lines · Ivan Khoronzhuk

From: Hao Zhang <[email protected]>

This patch adds Keystone II Lamar (K2L) SoC specific definitions to support MSMC cache coherency.

---
  arch/arm/cpu/armv7/keystone/init.c | 3 +++
  1 file changed, 3 insertions(+)
arch/arm/cpu/armv7/keystone/init.c +3 -0
index a8f8aee..a0ecfa2 100644
@@ -32,6 +32,9 @@ int arch_cpu_init(void)
  #ifdef CONFIG_SOC_K2E
  	msmc_share_all_segments(13); /* PCIE 1 */
  #endif
+#ifdef CONFIG_SOC_K2L
+	msmc_share_all_segments(14); /* PCIE 1 */
+#endif
 
Quoted 6 lines

arch/arm/cpu/armv7/keystone/init.c int arch_cpu_init(void) · line 40

Quoted 2 lines
arch/arm/cpu/armv7/keystone/init.c +0 -0
  	/*
  	 * just initialise the COM2 port so that TI specific

Where does 13/14 come from and can we just define what that means in a K2-foo specific header so we can always do msmc_share_all_segments(K2_MSMC_SEGMENTS_NR) or whatever? Thanks!

Ok, I will update it.
But, currently, there is newer version,
[U-boot] [Patch v5 0/6] keystone2: add k2l SoC and k2l_evm board support
https://www.mail-archive.com/u-boot at lists.denx.de/msg150245.html

Signature · 2 lines
Regards,
Ivan Khoronzhuk
#10 lore raw

PATCH v4 4/6 ARM: keystone2: spl: add K2L SoC support

In reply to Ivan Khoronzhuk

From: Hao Zhang <[email protected]>

Add Keystone II Lamar (K2L) SoC support.

---
 arch/arm/cpu/armv7/keystone/spl.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/cpu/armv7/keystone/spl.c +7 -0
index d4b0e9b..6a3adf4 100644
@@ -31,6 +31,13 @@ static struct pll_init_data spl_pll_config[] = {
 };
 #endif
 
+#ifdef CONFIG_K2L_EVM
+static struct pll_init_data spl_pll_config[] = {
+	CORE_PLL_799,
+	TETRIS_PLL_491,
+};
+#endif
+
 void spl_init_keystone_plls(void)
 {
 	init_plls(ARRAY_SIZE(spl_pll_config), spl_pll_config);
Signature · 1 line
1.8.3.2
#11 lore raw

PATCH v4 5/6 keystone2: enable OSR clock domain for K2L SoC

In reply to Ivan Khoronzhuk

From: Hao Zhang <[email protected]>

This patches enables the On-chip Shared Ram clock domain for K2L SoC.

---
 arch/arm/cpu/armv7/keystone/init.c                | 49 +++++++++++++++++++++++
 arch/arm/include/asm/arch-keystone/hardware-k2l.h | 25 ++++++++++++
 arch/arm/include/asm/arch-keystone/hardware.h     |  1 +
 3 files changed, 75 insertions(+)
arch/arm/cpu/armv7/keystone/init.c +49 -0
index a0ecfa2..2228132 100644
@@ -13,6 +13,7 @@
 #include <asm/arch/msmc.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/hardware.h>
+#include <asm/arch/psc_defs.h>
 
 void chip_configuration_unlock(void)
 {
@@ -20,6 +21,53 @@ void chip_configuration_unlock(void)
 	__raw_writel(KS2_KICK1_MAGIC, KS2_KICK1);
 }
 
+#ifdef CONFIG_SOC_K2L
+void osr_init(void)
+{
+	u32 i;
+	u32 j;
+	u32 val;
+	u32 base = KS2_OSR_CFG_BASE;
+	u32 ecc_ctrl[KS2_OSR_NUM_RAM_BANKS];
+
+	/* Enable the OSR clock domain */
+	psc_enable_module(KS2_LPSC_OSR);
+
+	/* Disable OSR ECC check for all the ram banks */
+	for (i = 0; i < KS2_OSR_NUM_RAM_BANKS; i++) {
+		val = i | KS2_OSR_ECC_VEC_TRIG_RD |
+			(KS2_OSR_ECC_CTRL << KS2_OSR_ECC_VEC_RD_ADDR_SH);
+
+		writel(val , base + KS2_OSR_ECC_VEC);
+
+		/**
+		 * wait till read is done.
+		 * Print should be added after earlyprintk support is added.
+		 */
+		for (j = 0; j < 10000; j++) {
+			val = readl(base + KS2_OSR_ECC_VEC);
+			if (val & KS2_OSR_ECC_VEC_RD_DONE)
+				break;
+		}
+
+		ecc_ctrl[i] = readl(base + KS2_OSR_ECC_CTRL) ^
+						KS2_OSR_ECC_CTRL_CHK;
+
+		writel(ecc_ctrl[i], KS2_MSMC_DATA_BASE + i * 4);
+		writel(ecc_ctrl[i], base + KS2_OSR_ECC_CTRL);
+	}
+
+	/* Reset OSR memory to all zeros */
+	for (i = 0; i < KS2_OSR_SIZE; i += 4)
+		writel(0, KS2_OSR_DATA_BASE + i);
+
+	/* Enable OSR ECC check for all the ram banks */
+	for (i = 0; i < KS2_OSR_NUM_RAM_BANKS; i++)
+		writel(ecc_ctrl[i] |
+		       KS2_OSR_ECC_CTRL_CHK, base + KS2_OSR_ECC_CTRL);
+}
+#endif
+
 int arch_cpu_init(void)
 {
 	chip_configuration_unlock();
@@ -34,6 +82,7 @@ int arch_cpu_init(void)
 #endif
 #ifdef CONFIG_SOC_K2L
 	msmc_share_all_segments(14); /* PCIE 1 */
+	osr_init();
 #endif
 
 	/*
arch/arm/include/asm/arch-keystone/hardware-k2l.h +25 -0
index 3402d0c..dfde040 100644
@@ -57,6 +57,31 @@
 #define KS2_CIC2_DDR3_ECC_IRQ_NUM	0x0D3
 #define KS2_CIC2_DDR3_ECC_CHAN_NUM	0x01D
 
+/* OSR */
+#define KS2_OSR_DATA_BASE		0x70000000	/* OSR data base */
+#define KS2_OSR_CFG_BASE		0x02348c00	/* OSR config base */
+#define KS2_OSR_ECC_VEC			0x08		/* ECC Vector reg */
+#define KS2_OSR_ECC_CTRL		0x14		/* ECC control reg */
+
+/* OSR ECC Vector register */
+#define KS2_OSR_ECC_VEC_TRIG_RD		BIT(15)		/* trigger a read op */
+#define KS2_OSR_ECC_VEC_RD_DONE		BIT(24)		/* read complete */
+
+#define KS2_OSR_ECC_VEC_RAM_ID_SH	0		/* RAM ID shift */
+#define KS2_OSR_ECC_VEC_RD_ADDR_SH	16		/* read address shift */
+
+/* OSR ECC control register */
+#define KS2_OSR_ECC_CTRL_EN		BIT(0)		/* ECC enable bit */
+#define KS2_OSR_ECC_CTRL_CHK		BIT(1)		/* ECC check bit */
+#define KS2_OSR_ECC_CTRL_RMW		BIT(2)		/* ECC check bit */
+
+/* Number of OSR RAM banks */
+#define KS2_OSR_NUM_RAM_BANKS		4
+
+/* OSR memory size */
+#define KS2_OSR_SIZE			0x100000
+
+
 /* Number of DSP cores */
 #define KS2_NUM_DSPS			4
 
arch/arm/include/asm/arch-keystone/hardware.h +1 -0
index adae69e..29f7bf1 100644
@@ -163,6 +163,7 @@ typedef volatile unsigned int   *dv_reg_p;
 
 /* MSMC control */
 #define KS2_MSMC_CTRL_BASE		0x0bc00000
+#define KS2_MSMC_DATA_BASE		0x0c000000
 
 /* USB */
 #define KS2_USB_SS_BASE			0x02680000
Signature · 1 line
1.8.3.2
#12 lore raw

PATCH v4 6/6 keystone2: k2l-evm: add board support

In reply to Ivan Khoronzhuk

From: Hao Zhang <[email protected]>

This patch adds Keystone II Lammar (K2L) EVM board support.

---
 arch/arm/cpu/armv7/keystone/Kconfig            |  3 ++
 arch/arm/include/asm/arch-keystone/clock-k2l.h |  6 +++
 board/ti/ks2_evm/Kconfig                       | 16 +++++++
 board/ti/ks2_evm/MAINTAINERS                   |  2 +
 board/ti/ks2_evm/Makefile                      |  2 +
 board/ti/ks2_evm/board_k2l.c                   | 60 ++++++++++++++++++++++++++
 board/ti/ks2_evm/ddr3_cfg.c                    | 36 ++++++++++++++++
 board/ti/ks2_evm/ddr3_cfg.h                    |  3 ++
 board/ti/ks2_evm/ddr3_k2l.c                    | 43 ++++++++++++++++++
 configs/k2l_evm_defconfig                      |  4 ++
 include/configs/k2l_evm.h                      | 37 ++++++++++++++++
 11 files changed, 212 insertions(+)
 create mode 100644 board/ti/ks2_evm/board_k2l.c
 create mode 100644 board/ti/ks2_evm/ddr3_k2l.c
 create mode 100644 configs/k2l_evm_defconfig
 create mode 100644 include/configs/k2l_evm.h
arch/arm/cpu/armv7/keystone/Kconfig +3 -0
index 24d0cbe..91211fd 100644
@@ -9,6 +9,9 @@ config TARGET_K2HK_EVM
 config TARGET_K2E_EVM
 	bool "TI Keystone 2 Edison EVM"
 
+config TARGET_K2L_EVM
+	bool "TI Keystone 2 Lamar EVM"
+
 endchoice
 
 config SYS_CPU
arch/arm/include/asm/arch-keystone/clock-k2l.h +6 -0
index 8cacee0..b3f4e71 100644
@@ -69,7 +69,9 @@ enum {
 
 #define CORE_PLL_799	{CORE_PLL, 13, 1, 2}
 #define CORE_PLL_983	{CORE_PLL, 16, 1, 2}
+#define CORE_PLL_1000	{CORE_PLL, 114, 7, 2}
 #define CORE_PLL_1167	{CORE_PLL, 19, 1, 2}
+#define CORE_PLL_1198	{CORE_PLL, 39, 2, 2}
 #define CORE_PLL_1228	{CORE_PLL, 20, 1, 2}
 #define PASS_PLL_1228	{PASS_PLL, 20, 1, 2}
 #define PASS_PLL_983	{PASS_PLL, 16, 1, 2}
@@ -78,8 +80,12 @@ enum {
 #define TETRIS_PLL_737	{TETRIS_PLL, 12, 1, 2}
 #define TETRIS_PLL_799	{TETRIS_PLL, 13, 1, 2}
 #define TETRIS_PLL_983	{TETRIS_PLL, 16, 1, 2}
+#define TETRIS_PLL_1000	{TETRIS_PLL, 114, 7, 2}
 #define TETRIS_PLL_1167	{TETRIS_PLL, 19, 1, 2}
+#define TETRIS_PLL_1198	{TETRIS_PLL, 39, 2, 2}
 #define TETRIS_PLL_1228	{TETRIS_PLL, 20, 1, 2}
+#define TETRIS_PLL_1352	{TETRIS_PLL, 22, 1, 2}
+#define TETRIS_PLL_1401	{TETRIS_PLL, 114, 5, 2}
 #define DDR3_PLL_200	{DDR3_PLL, 4, 1, 2}
 #define DDR3_PLL_400	{DDR3_PLL, 16, 1, 4}
 #define DDR3_PLL_800	{DDR3_PLL, 16, 1, 2}
board/ti/ks2_evm/Kconfig +16 -0
index 3108782..36c31ff 100644
@@ -29,3 +29,19 @@ config SYS_CONFIG_NAME
 	default "k2hk_evm"
 
 endif
+
+if TARGET_K2L_EVM
+
+config SYS_BOARD
+	string
+	default "ks2_evm"
+
+config SYS_VENDOR
+	string
+	default "ti"
+
+config SYS_CONFIG_NAME
+	string
+	default "k2l_evm"
+
+endif
board/ti/ks2_evm/MAINTAINERS +2 -0
index 595a80a..87c36c9 100644
@@ -6,3 +6,5 @@ F:	include/configs/k2hk_evm.h
 F:	configs/k2hk_evm_defconfig
 F:	include/configs/k2e_evm.h
 F:	configs/k2e_evm_defconfig
+F:	include/configs/k2l_evm.h
+F:	configs/k2l_evm_defconfig
board/ti/ks2_evm/Makefile +2 -0
index 00f1164..071dbee 100644
@@ -11,3 +11,5 @@ obj-$(CONFIG_K2HK_EVM) += board_k2hk.o
 obj-$(CONFIG_K2HK_EVM) += ddr3_k2hk.o
 obj-$(CONFIG_K2E_EVM) += board_k2e.o
 obj-$(CONFIG_K2E_EVM) += ddr3_k2e.o
+obj-$(CONFIG_K2L_EVM) += board_k2l.o
+obj-$(CONFIG_K2L_EVM) += ddr3_k2l.o
board/ti/ks2_evm/board_k2l.c new file +60 -0

60 lines not on this page · raw message

board/ti/ks2_evm/ddr3_cfg.c +36 -0
index f7da9f2..ab44676 100644
@@ -133,6 +133,42 @@ struct ddr3_emif_config ddr3_1600_4g = {
 };
 #endif
 
+struct ddr3_phy_config ddr3phy_1600_2g = {
+	.pllcr          = 0x0001C000ul,
+	.pgcr1_mask     = (IODDRM_MASK | ZCKSEL_MASK),
+	.pgcr1_val      = ((1 << 2) | (1 << 7) | (1 << 23)),
+	.ptr0           = 0x42C21590ul,
+	.ptr1           = 0xD05612C0ul,
+	.ptr2           = 0, /* not set in gel */
+	.ptr3           = 0x0D861A80ul,
+	.ptr4           = 0x0C827100ul,
+	.dcr_mask       = (PDQ_MASK | MPRDQ_MASK | BYTEMASK_MASK),
+	.dcr_val        = ((1 << 10)),
+	.dtpr0          = 0x9D5CBB66ul,
+	.dtpr1          = 0x12868300ul,
+	.dtpr2          = 0x5002D200ul,
+	.mr0            = 0x00001C70ul,
+	.mr1            = 0x00000006ul,
+	.mr2            = 0x00000018ul,
+	.dtcr           = 0x710035C7ul,
+	.pgcr2          = 0x00F07A12ul,
+	.zq0cr1         = 0x0001005Dul,
+	.zq1cr1         = 0x0001005Bul,
+	.zq2cr1         = 0x0001005Bul,
+	.pir_v1         = 0x00000033ul,
+	.pir_v2         = 0x0000FF81ul,
+};
+
+struct ddr3_emif_config ddr3_1600_2g = {
+	.sdcfg          = 0x6200CE62ul,
+	.sdtim1         = 0x166C9855ul,
+	.sdtim2         = 0x00001D4Aul,
+	.sdtim3         = 0x435DFF53ul,
+	.sdtim4         = 0x543F0CFFul,
+	.zqcfg          = 0x70073200ul,
+	.sdrfc          = 0x00001869ul,
+};
+
 int ddr3_get_dimm_params(char *dimm_name)
 {
 	int ret;
board/ti/ks2_evm/ddr3_cfg.h +3 -0
index 15fcf52..5bd786c 100644
@@ -19,6 +19,9 @@ extern struct ddr3_emif_config ddr3_1333_2g;
 extern struct ddr3_phy_config ddr3phy_1600_4g;
 extern struct ddr3_emif_config ddr3_1600_4g;
 
+extern struct ddr3_phy_config ddr3phy_1600_2g;
+extern struct ddr3_emif_config ddr3_1600_2g;
+
 int ddr3_get_dimm_params(char *dimm_name);
 
 #endif /* __DDR3_CFG_H */
board/ti/ks2_evm/ddr3_k2l.c new file +43 -0

43 lines not on this page · raw message

configs/k2l_evm_defconfig new file +4 -0
new file mode 100644
index 0000000..45399ce
@@ -0,0 +1,4 @@
+CONFIG_SPL=y
++S:CONFIG_ARM=y
++S:CONFIG_ARCH_KEYSTONE=y
++S:CONFIG_TARGET_K2L_EVM=y
include/configs/k2l_evm.h new file +37 -0
new file mode 100644
index 0000000..0e1f725
@@ -0,0 +1,37 @@
+/*
+ * Configuration header file for TI's k2l-evm
+ *
+ * (C) Copyright 2012-2014
+ *     Texas Instruments Incorporated, <www.ti.com>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef __CONFIG_K2L_EVM_H
+#define __CONFIG_K2L_EVM_H
+
+/* Platform type */
+#define CONFIG_SOC_K2L
+#define CONFIG_K2L_EVM
+
+/* U-Boot general configuration */
+#define CONFIG_SYS_PROMPT		"K2L EVM # "
+
+#define KS2_ARGS_UBI   "args_ubi=setenv bootargs ${bootargs} rootfstype=ubifs "\
+		       "root=ubi0:rootfs rootflags=sync rw ubi.mtd=2,4096\0"
+
+#define KS2_FDT_NAME	"name_fdt=k2l-evm.dtb\0"
+#define KS2_ADDR_MON	"addr_mon=0x0c140000\0"
+#define KS2_NAME_MON	"name_mon=skern-k2l-evm.bin\0"
+#define NAME_UBOOT	"name_uboot=u-boot-spi-k2l-evm.gph\0"
+#define NAME_UBI	"name_ubi=k2l-evm-ubifs.ubi\0"
+
+#include <configs/ks2_evm.h>
+
+/* SPL SPI Loader Configuration */
+#define CONFIG_SPL_TEXT_BASE		0x0c100000
+
+/* NAND Configuration */
+#define CONFIG_SYS_NAND_PAGE_4K
+
+#endif /* __CONFIG_K2L_EVM_H */
Signature · 1 line
1.8.3.2