Skip to contentSkip to conversation

Add support for keystone2 SoC and K2HK EVM

PATCH Superseded Murali Karicheri 4 participants 45 messages Feb 20, 2014 – Mar 12, 2014 1 message not in the archive

Subsystems (7)

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add support for keystone2 SoC and K2HK EVM

This patch series add support for keystone2 SoC and K2HK EVM

Change history:
v2
- Review comments incorporated. Following are major comments addressed
- split network driver to navigator driver + ethernet driver
- replaced register base + offset implemenation with struct based register access implementation
- Added Readme for NAND no subpage write option
- re-use code for davinci i2c driver on keystone2 with updates
- clock-k2hk.c merged to clock.c
- currently keeping board specific getclk() command. See the thread for the rational.
- Added update to davinci spi driver to re-use on keystone

v1
- added separate patch for sorting tools/Makefile entries
- reworked gpimage patch to allow more re-use across omapimage/gpimage
- dropped patch related to ubifs file size
- added keystone SoC and K2HK EVM support

v0
- preparatory patch for keystone

Murali Karicheri (5):
tools: sort the entries in Makefile
tools: mkimage: add support for gpimage format
NAND: DaVinci: allow forced disable of subpage writes i2c, davinci: move i2c_defs.h to the drivers/i2c directory
k2hk-evm: add configuration for spi1 and spi2 support

Rex Chang (1):
spi: davinci: add support for multiple bus and chip select

Vitaly Andrianov (6):
fdt: call ft_board_setup_ex() at the end of image_setup_libfdt()
arm: add support for arch timer
i2c, davinci: add support for multiple i2c buses
k2hk: add support for k2hk SOC and EVM
keystone2: add keystone multicore navigator driver
keystone2: net: add keystone ethernet driver

 Makefile                                           |   19 +
 README                                             |    5 +
 arch/arm/cpu/armv7/keystone/Makefile               |   18 +
 arch/arm/cpu/armv7/keystone/aemif.c                |   71 ++
 arch/arm/cpu/armv7/keystone/clock.c                |  313 +++++++
 arch/arm/cpu/armv7/keystone/cmd_clock.c            |  124 +++
 arch/arm/cpu/armv7/keystone/cmd_mon.c              |  131 +++
 arch/arm/cpu/armv7/keystone/config.mk              |   15 +
 arch/arm/cpu/armv7/keystone/ddr3.c                 |   69 ++
 arch/arm/cpu/armv7/keystone/init.c                 |   56 ++
 arch/arm/cpu/armv7/keystone/keystone_nav.c         |  376 +++++++++
 arch/arm/cpu/armv7/keystone/msmc.c                 |   68 ++
 arch/arm/cpu/armv7/keystone/psc.c                  |  238 ++++++
 arch/arm/cpu/armv7/keystone/spl.c                  |   45 +
 arch/arm/include/asm/arch-davinci/i2c_defs.h       |   71 +-
 arch/arm/include/asm/arch-keystone/clock-k2hk.h    |  109 +++
 arch/arm/include/asm/arch-keystone/clock.h         |   17 +
 arch/arm/include/asm/arch-keystone/clock_defs.h    |  121 +++
 arch/arm/include/asm/arch-keystone/emac_defs.h     |  250 ++++++
 arch/arm/include/asm/arch-keystone/emif_defs.h     |   73 ++
 arch/arm/include/asm/arch-keystone/hardware-k2hk.h |  145 ++++
 arch/arm/include/asm/arch-keystone/hardware.h      |  175 ++++
 arch/arm/include/asm/arch-keystone/i2c_defs.h      |   17 +
 arch/arm/include/asm/arch-keystone/keystone_nav.h  |  193 +++++
 arch/arm/include/asm/arch-keystone/nand_defs.h     |   25 +
 arch/arm/include/asm/arch-keystone/psc_defs.h      |   90 ++
 arch/arm/include/asm/arch-keystone/spl.h           |   12 +
 arch/arm/lib/Makefile                              |    1 +
 arch/arm/lib/arch_timer.c                          |   58 ++
 board/ti/k2hk_evm/Makefile                         |    9 +
 board/ti/k2hk_evm/README                           |   56 ++
 board/ti/k2hk_evm/board.c                          |  301 +++++++
 board/ti/k2hk_evm/ddr3.c                           |  269 ++++++
 boards.cfg                                         |    1 +
 common/image-fdt.c                                 |    5 +
 common/image.c                                     |    1 +
 drivers/i2c/davinci_i2c.c                          |  345 ++++----
 drivers/i2c/davinci_i2c.h                          |   78 ++
 drivers/mtd/nand/davinci_nand.c                    |    3 +
 drivers/net/Makefile                               |    1 +
 drivers/net/keystone_net.c                         |  859 ++++++++++++++++++++
 drivers/serial/ns16550.c                           |    8 +
 drivers/spi/davinci_spi.c                          |   62 +-
 drivers/spi/davinci_spi.h                          |   33 +
 include/configs/k2hk_evm.h                         |  268 ++++++
 include/fdt_support.h                              |    1 +
 include/image.h                                    |    1 +
 tools/Makefile                                     |   20 +-
 tools/gpheader.h                                   |   40 +
 tools/gpimage-common.c                             |   80 ++
 tools/gpimage.c                                    |   77 ++
 tools/imagetool.c                                  |    2 +
 tools/imagetool.h                                  |    1 +
 tools/omapimage.c                                  |  104 +--
 tools/omapimage.h                                  |    5 -
 55 files changed, 5222 insertions(+), 313 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/keystone/Makefile
 create mode 100644 arch/arm/cpu/armv7/keystone/aemif.c
 create mode 100644 arch/arm/cpu/armv7/keystone/clock.c
 create mode 100644 arch/arm/cpu/armv7/keystone/cmd_clock.c
 create mode 100644 arch/arm/cpu/armv7/keystone/cmd_mon.c
 create mode 100644 arch/arm/cpu/armv7/keystone/config.mk
 create mode 100644 arch/arm/cpu/armv7/keystone/ddr3.c
 create mode 100644 arch/arm/cpu/armv7/keystone/init.c
 create mode 100644 arch/arm/cpu/armv7/keystone/keystone_nav.c
 create mode 100644 arch/arm/cpu/armv7/keystone/msmc.c
 create mode 100644 arch/arm/cpu/armv7/keystone/psc.c
 create mode 100644 arch/arm/cpu/armv7/keystone/spl.c
 create mode 100644 arch/arm/include/asm/arch-keystone/clock-k2hk.h
 create mode 100644 arch/arm/include/asm/arch-keystone/clock.h
 create mode 100644 arch/arm/include/asm/arch-keystone/clock_defs.h
 create mode 100644 arch/arm/include/asm/arch-keystone/emac_defs.h
 create mode 100644 arch/arm/include/asm/arch-keystone/emif_defs.h
 create mode 100644 arch/arm/include/asm/arch-keystone/hardware-k2hk.h
 create mode 100644 arch/arm/include/asm/arch-keystone/hardware.h
 create mode 100644 arch/arm/include/asm/arch-keystone/i2c_defs.h
 create mode 100644 arch/arm/include/asm/arch-keystone/keystone_nav.h
 create mode 100644 arch/arm/include/asm/arch-keystone/nand_defs.h
 create mode 100644 arch/arm/include/asm/arch-keystone/psc_defs.h
 create mode 100644 arch/arm/include/asm/arch-keystone/spl.h
 create mode 100644 arch/arm/lib/arch_timer.c
 create mode 100644 board/ti/k2hk_evm/Makefile
 create mode 100644 board/ti/k2hk_evm/README
 create mode 100644 board/ti/k2hk_evm/board.c
 create mode 100644 board/ti/k2hk_evm/ddr3.c
 create mode 100644 drivers/i2c/davinci_i2c.h
 create mode 100644 drivers/net/keystone_net.c
 create mode 100644 include/configs/k2hk_evm.h
 create mode 100644 tools/gpheader.h
 create mode 100644 tools/gpimage-common.c
 create mode 100644 tools/gpimage.c
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v2 1/12 fdt: call ft_board_setup_ex() at the end of image_setup_libfdt()

From: Vitaly Andrianov <[email protected]>

The keystone2 SOC requires to fix all 32 bit aliased addresses to their 36 physical format. This has to happen after all fdt nodes are added or modified.

---
- no update since v1

 common/image-fdt.c    |    5 +++++
 include/fdt_support.h |    1 +
 2 files changed, 6 insertions(+)
common/image-fdt.c +5 -0
index 6f9ce7d..ee4dd6f 100644
@@ -487,5 +487,10 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
 	if (!ft_verify_fdt(blob))
 		return -1;
 
+#ifdef CONFIG_SOC_K2HK
+	if (IMAAGE_OF_BOARD_SETUP)
+		ft_board_setup_ex(blob, gd->bd);
+#endif
+
 	return 0;
 }
include/fdt_support.h +1 -0
index 9871e2f..4c1416d 100644
@@ -63,6 +63,7 @@ int fdt_pci_dma_ranges(void *blob, int phb_off, struct pci_controller *hose);
 #endif
 
 void ft_board_setup(void *blob, bd_t *bd);
+void ft_board_setup_ex(void *blob, bd_t *bd);
 void ft_cpu_setup(void *blob, bd_t *bd);
 void ft_pci_setup(void *blob, bd_t *bd);
 
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v2 1/12 fdt: call ft_board_setup_ex() at the end of image_setup_libfdt()

Quoted 7 lines · Murali Karicheri

From: Vitaly Andrianov <[email protected]>

The keystone2 SOC requires to fix all 32 bit aliased addresses to their 36 physical format. This has to happen after all fdt nodes are added or modified.

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

PATCH v2 2/12 tools: sort the entries in Makefile

In reply to Murali Karicheri

The NOPED_OBJ_FILES, dumpimage and mkimage object file entries are to be kept sorted. This patch fix this issue.

---
- No update since v1

 tools/Makefile |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
tools/Makefile +7 -7
index 328cea3..3c719b3 100644
@@ -77,10 +77,10 @@ NOPED_OBJ_FILES-y += aisimage.o
 NOPED_OBJ_FILES-y += default_image.o
 NOPED_OBJ_FILES-y += dumpimage.o
 NOPED_OBJ_FILES-y += fit_image.o
+NOPED_OBJ_FILES-y += imagetool.o
 NOPED_OBJ_FILES-y += image-host.o
 NOPED_OBJ_FILES-y += imximage.o
 NOPED_OBJ_FILES-y += kwbimage.o
-NOPED_OBJ_FILES-y += imagetool.o
 NOPED_OBJ_FILES-y += mkenvimage.o
 NOPED_OBJ_FILES-y += mkimage.o
 NOPED_OBJ_FILES-y += mxsimage.o
@@ -88,8 +88,8 @@ NOPED_OBJ_FILES-y += omapimage.o
 NOPED_OBJ_FILES-y += os_support.o
 NOPED_OBJ_FILES-y += pblimage.o
 NOPED_OBJ_FILES-y += proftool.o
-NOPED_OBJ_FILES-y += ublimage.o
 NOPED_OBJ_FILES-y += relocate-rela.o
+NOPED_OBJ_FILES-y += ublimage.o
 OBJ_FILES-$(CONFIG_BUILD_ENVCRC) += envcrc.o
 OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o
 OBJ_FILES-$(CONFIG_CMD_NET) += gen_eth_addr.o
@@ -209,14 +209,14 @@ $(obj)dumpimage$(SFX):	$(obj)aisimage.o \
 			$(FIT_SIG_OBJS) \
 			$(obj)crc32.o \
 			$(obj)default_image.o \
+			$(obj)dumpimage.o \
 			$(obj)fit_image.o \
-			$(obj)image-fit.o \
 			$(obj)image.o \
-			$(obj)image-host.o \
 			$(obj)imagetool.o \
+			$(obj)image-fit.o \
+			$(obj)image-host.o \
 			$(obj)imximage.o \
 			$(obj)kwbimage.o \
-			$(obj)dumpimage.o \
 			$(obj)md5.o \
 			$(obj)mxsimage.o \
 			$(obj)omapimage.o \
@@ -239,10 +239,10 @@ $(obj)mkimage$(SFX):	$(obj)aisimage.o \
 			$(obj)crc32.o \
 			$(obj)default_image.o \
 			$(obj)fit_image.o \
-			$(obj)image-fit.o \
-			$(obj)image-host.o \
 			$(obj)image.o \
 			$(obj)imagetool.o \
+			$(obj)image-host.o \
+			$(obj)image-fit.o \
 			$(obj)imximage.o \
 			$(obj)kwbimage.o \
 			$(obj)md5.o \
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH v2 2/12 tools: sort the entries in Makefile

Quoted 4 lines · Murali Karicheri

The NOPED_OBJ_FILES, dumpimage and mkimage object file entries are to be kept sorted. This patch fix this issue.

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

PATCH v2 3/12 tools: mkimage: add support for gpimage format

In reply to Murali Karicheri

This patch add support for gpimage format as a preparatory patch for porting u-boot for keystone2 devices and is based on omapimage format. It re-uses gph header to store the size and loadaddr as done in omapimage.c

---
- No update since v1

 common/image.c         |    1 +
 include/image.h        |    1 +
 tools/Makefile         |    6 +++
 tools/gpheader.h       |   40 +++++++++++++++++++
 tools/gpimage-common.c |   80 +++++++++++++++++++++++++++++++++++++
 tools/gpimage.c        |   77 +++++++++++++++++++++++++++++++++++
 tools/imagetool.c      |    2 +
 tools/imagetool.h      |    1 +
 tools/omapimage.c      |  104 ++++++++----------------------------------------
 tools/omapimage.h      |    5 ---
 10 files changed, 224 insertions(+), 93 deletions(-)
 create mode 100644 tools/gpheader.h
 create mode 100644 tools/gpimage-common.c
 create mode 100644 tools/gpimage.c
common/image.c +1 -0
index ae95c3f..cb5c656 100644
@@ -124,6 +124,7 @@ static const table_entry_t uimage_type[] = {
 	{	IH_TYPE_FILESYSTEM, "filesystem", "Filesystem Image",	},
 	{	IH_TYPE_FIRMWARE,   "firmware",	  "Firmware",		},
 	{	IH_TYPE_FLATDT,     "flat_dt",    "Flat Device Tree",	},
+	{	IH_TYPE_GPIMAGE,    "gpimage",    "TI Keystone SPL Image",},
 	{	IH_TYPE_KERNEL,	    "kernel",	  "Kernel Image",	},
 	{	IH_TYPE_KERNEL_NOLOAD, "kernel_noload",  "Kernel Image (no loading done)", },
 	{	IH_TYPE_KWBIMAGE,   "kwbimage",   "Kirkwood Boot Image",},
include/image.h +1 -0
index 7de2bb2..0a3d346 100644
@@ -214,6 +214,7 @@ struct lmb;
 #define IH_TYPE_KERNEL_NOLOAD	14	/* OS Kernel Image, can run from any load address */
 #define IH_TYPE_PBLIMAGE	15	/* Freescale PBL Boot Image	*/
 #define IH_TYPE_MXSIMAGE	16	/* Freescale MXSBoot Image	*/
+#define IH_TYPE_GPIMAGE		17	/* TI Keystone GPHeader Image	*/
 
 /*
  * Compression Types
tools/Makefile +6 -0
index 3c719b3..421aba5 100644
@@ -77,6 +77,8 @@ NOPED_OBJ_FILES-y += aisimage.o
 NOPED_OBJ_FILES-y += default_image.o
 NOPED_OBJ_FILES-y += dumpimage.o
 NOPED_OBJ_FILES-y += fit_image.o
+NOPED_OBJ_FILES-y += gpimage.o
+NOPED_OBJ_FILES-y += gpimage-common.o
 NOPED_OBJ_FILES-y += imagetool.o
 NOPED_OBJ_FILES-y += image-host.o
 NOPED_OBJ_FILES-y += imximage.o
@@ -211,6 +213,8 @@ $(obj)dumpimage$(SFX):	$(obj)aisimage.o \
 			$(obj)default_image.o \
 			$(obj)dumpimage.o \
 			$(obj)fit_image.o \
+			$(obj)gpimage.o \
+			$(obj)gpimage-common.o \
 			$(obj)image.o \
 			$(obj)imagetool.o \
 			$(obj)image-fit.o \
@@ -239,6 +243,8 @@ $(obj)mkimage$(SFX):	$(obj)aisimage.o \
 			$(obj)crc32.o \
 			$(obj)default_image.o \
 			$(obj)fit_image.o \
+			$(obj)gpimage.o \
+			$(obj)gpimage-common.o \
 			$(obj)image.o \
 			$(obj)imagetool.o \
 			$(obj)image-host.o \
tools/gpheader.h new file +40 -0
new file mode 100644
index 0000000..63a28a2
@@ -0,0 +1,40 @@
+/*
+ * (C) Copyright 2014
+ * Texas Instruments Incorporated
+ * Refactored common functions in to gpimage-common.c. Include this common
+ * header file
+ *
+ * (C) Copyright 2010
+ * Linaro LTD, www.linaro.org
+ * Author: John Rigby <[email protected]>
+ * Based on TI's signGP.c
+ *
+ * (C) Copyright 2009
+ * Stefano Babic, DENX Software Engineering, sbabic at denx.de.
+ *
+ * (C) Copyright 2008
+ * Marvell Semiconductor <www.marvell.com>
+ * Written-by: Prafulla Wadaskar <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#ifndef _GPIMAGE_H_
+#define _GPIMAGE_H_
+
+/* common headers for gpimage and omapimage formats */
+struct gp_header {
+	uint32_t size;
+	uint32_t load_addr;
+};
+#define GPIMAGE_HDR_SIZE (sizeof(struct gp_header))
+
+/* common functions across gpimage and omapimage handlers */
+int valid_gph_size(uint32_t size);
+int valid_gph_load_addr(uint32_t load_addr);
+int gph_verify_header(struct gp_header *gph, int be);
+void gph_print_header(const struct gp_header *gph, int be);
+void gph_set_header(struct gp_header *gph, uint32_t size, uint32_t load_addr,
+			int be);
+int gpimage_check_params(struct image_tool_params *params);
+#endif
tools/gpimage-common.c new file +80 -0

80 lines not on this page · raw message

tools/gpimage.c new file +77 -0

77 lines not on this page · raw message

tools/imagetool.c +2 -0
index 29d2189..da72115 100644
@@ -45,6 +45,8 @@ void register_image_tool(imagetool_register_t image_register)
 	init_ubl_image_type();
 	/* Init Davinci AIS support */
 	init_ais_image_type();
+	/* Init TI Keystone boot image generation/list support */
+	init_gpimage_type();
 }
 
 /*
tools/imagetool.h +1 -0
index c2c9aea..a3e9d30 100644
@@ -167,6 +167,7 @@ void init_mxs_image_type(void);
 void init_fit_image_type(void);
 void init_ubl_image_type(void);
 void init_omap_image_type(void);
+void init_gpimage_type(void);
 
 void pbl_load_uboot(int fd, struct image_tool_params *mparams);
 
tools/omapimage.c +16 -88

180 lines not on this page · raw message

tools/omapimage.h +0 -5
index 45d14ea..8744ae7 100644
@@ -25,10 +25,5 @@ struct ch_settings {
 	uint32_t flags;
 };
 
-struct gp_header {
-	uint32_t size;
-	uint32_t load_addr;
-};
-
 #define KEY_CHSETTINGS 0xC0C0C0C1
 #endif /* _OMAPIMAGE_H_ */
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH v2 3/12 tools: mkimage: add support for gpimage format

Quoted 7 lines · Murali Karicheri

This patch add support for gpimage format as a preparatory patch for porting u-boot for keystone2 devices and is based on omapimage format. It re-uses gph header to store the size and loadaddr as done in omapimage.c

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

PATCH v2 4/12 arm: add support for arch timer

In reply to Murali Karicheri

From: Vitaly Andrianov <[email protected]>

This patch add basic support for the architecture timer found on recent ARMv7 based SoCs.

---
- No update since v1

 arch/arm/lib/Makefile     |    1 +
 arch/arm/lib/arch_timer.c |   58 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+)
 create mode 100644 arch/arm/lib/arch_timer.c
arch/arm/lib/Makefile +1 -0
index 321997c..726f229 100644
@@ -42,6 +42,7 @@ obj-$(CONFIG_USE_ARCH_MEMCPY) += memcpy.o
 else
 obj-$(CONFIG_SPL_FRAMEWORK) += spl.o
 endif
+obj-$(CONFIG_SYS_ARCH_TIMER) += arch_timer.o
 
 ifdef CONFIG_ARM64
 obj-y	+= interrupts_64.o
arch/arm/lib/arch_timer.c new file +58 -0

58 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#8 lore raw

PATCH v2 4/12 arm: add support for arch timer

Quoted 7 lines · Murali Karicheri

From: Vitaly Andrianov <[email protected]>

This patch add basic support for the architecture timer found on recent ARMv7 based SoCs.

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

PATCH v2 5/12 NAND: DaVinci: allow forced disable of subpage writes

In reply to Murali Karicheri

This patch introduces a configurable mechanism to disable subpage writes in the DaVinci NAND driver.

---
- Added README

 README                          |    5 +++++
 drivers/mtd/nand/davinci_nand.c |    3 +++
 2 files changed, 8 insertions(+)
README +5 -0
index aea82be..caf60a2 100644
@@ -4427,6 +4427,11 @@ Low Level (hardware related) configuration options:
 - CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC:
 		Enables the RTC32K OSC on AM33xx based plattforms
 
+- CONFIG_SYS_NAND_NO_SUBPAGE_WRITE
+		Option to disable subpage write in NAND driver
+		Example driver that use this:
+		drivers/mtd/nand/davinci_nand.c
+
 Freescale QE/FMAN Firmware Support:
 -----------------------------------
 
drivers/mtd/nand/davinci_nand.c +3 -0
index 5b17d7b..75b03a7 100644
@@ -609,6 +609,9 @@ void davinci_nand_init(struct nand_chip *nand)
 #ifdef CONFIG_SYS_NAND_USE_FLASH_BBT
 	nand->bbt_options	  |= NAND_BBT_USE_FLASH;
 #endif
+#ifdef CONFIG_SYS_NAND_NO_SUBPAGE_WRITE
+	nand->options	  |= NAND_NO_SUBPAGE_WRITE;
+#endif
 #ifdef CONFIG_SYS_NAND_HW_ECC
 	nand->ecc.mode = NAND_ECC_HW;
 	nand->ecc.size = 512;
Signature · 1 line
1.7.9.5
#10 lore raw

PATCH v2 5/12 NAND: DaVinci: allow forced disable of subpage writes

Quoted 5 lines · Murali Karicheri

This patch introduces a configurable mechanism to disable subpage writes in the DaVinci NAND driver.

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

PATCH v2 5/12 NAND: DaVinci: allow forced disable of subpage writes

In reply to Murali Karicheri
Quoted 16 lines · Murali Karicheri

This patch introduces a configurable mechanism to disable subpage writes in the DaVinci NAND driver.

---
- Added README

 README                          |    5 +++++
 drivers/mtd/nand/davinci_nand.c |    3 +++
 2 files changed, 8 insertions(+)
README +0 -0
index aea82be..caf60a2 100644

README Low Level (hardware related) configuration options: · line 4433

Quoted 7 lines
README +4 -0
@@ -4427,6 +4427,11 @@ Low Level (hardware related) configuration options:
 - CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC:
 		Enables the RTC32K OSC on AM33xx based plattforms
 
+- CONFIG_SYS_NAND_NO_SUBPAGE_WRITE
+		Option to disable subpage write in NAND driver
+		Example driver that use this:
+		drivers/mtd/nand/davinci_nand.c

I'd rather this be a full list of drivers that use it, not an example.

-Scott

#12 lore raw

PATCH v2 5/12 NAND: DaVinci: allow forced disable of subpage writes

Quoted 20 lines · Scott Wood
Quoted 19 lines · Murali Karicheri

This patch introduces a configurable mechanism to disable subpage writes in the DaVinci NAND driver.

---
- Added README

  README                          |    5 +++++
  drivers/mtd/nand/davinci_nand.c |    3 +++
  2 files changed, 8 insertions(+)
README +0 -0
index aea82be..caf60a2 100644
@@ -4427,6 +4427,11 @@ Low Level (hardware related) configuration options:
  - CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC:
  		Enables the RTC32K OSC on AM33xx based plattforms
 
Quoted 5 lines

README Low Level (hardware related) configuration options: · line 4433

Quoted 4 lines
README +4 -0
+- CONFIG_SYS_NAND_NO_SUBPAGE_WRITE
+		Option to disable subpage write in NAND driver
+		Example driver that use this:
+		drivers/mtd/nand/davinci_nand.c

I'd rather this be a full list of drivers that use it, not an example.

There are 3 nand drivers that disable sub page write using NAND_NO_SUBPAGE_WRITE by default.

nand/docg4.c
nand/fsl_ifc_nand.c
nand/mxs_nand.c

nand/davinci_nand.c is used across many of ti's existing davinci platforms and some of them do enable sub page write. In Keystone platform, we want to disable this option. So to answer your question, davinci_nand.c is the only user driver using this configuration option, but that doesn't prevent anyone from using the option. So I want to keep this configuration option as a generic option.

Hope this clarifies.

Murali

Quoted 3 lines

-Scott

A message that is not in the archive (sent off-list or not yet received): [email protected]

#14 lore raw

PATCH v2 5/12 NAND: DaVinci: allow forced disable of subpage writes

Quoted 38 lines · Muralidharan
Quoted 28 lines

-----Original Message-----
From: Scott Wood [mailto:scottwood at freescale.com]
Sent: Tuesday, February 25, 2014 11:01 PM
To: Karicheri, Muralidharan
Cc: u-boot at lists.denx.de; Rini, Tom
Subject: Re: [U-Boot] [U-Boot PATCH v2 05/12] NAND: DaVinci: allow forced disable of subpage writes

Quoted 19 lines · Murali Karicheri

This patch introduces a configurable mechanism to disable subpage writes in the DaVinci NAND driver.

---
- Added README

 README                          |    5 +++++
 drivers/mtd/nand/davinci_nand.c |    3 +++
 2 files changed, 8 insertions(+)
README +0 -0
index aea82be..caf60a2 100644
@@ -4427,6 +4427,11 @@ Low Level (hardware related) configuration options:
 - CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC:
 		Enables the RTC32K OSC on AM33xx based plattforms
 
Quoted 6 lines

README Low Level (hardware related) configuration options: · line 4433

Quoted 4 lines
README +4 -0
+- CONFIG_SYS_NAND_NO_SUBPAGE_WRITE
+		Option to disable subpage write in NAND driver
+		Example driver that use this:
+		drivers/mtd/nand/davinci_nand.c

I'd rather this be a full list of drivers that use it, not an example.

There are 3 drivers out there that disable sub page write using NAND_NO_SUBPAGE_WRITE by default.

Quoted 6 lines

nand/docg4.c
nand/fsl_ifc_nand.c
nand/mxs_nand.c

nand/davinci_nand.c is used across many of ti's existing davinci platforms and some of them do enable sub page write.

And only one of them uses CONFIG_SYS_NAND_NO_SUBPAGE_WRITE, which is a potentially confusing thing given the generic naming, and thus warrants clear documentation.

Quoted 4 lines

In Keystone platform, we want to disable this option. So to answer
your question, davinci_nand.c is the only user driver using this configuration option, but that doesn't prevent anyone from using the option. So I want to keep this configuration option as a generic option.

That's fine. My point is just to s/Example driver/Drivers/ so that if someone adds this to a new driver, they (hopefully) add it to the list in README, rather than just thinking one example is enough.

-Scott

#15 lore raw

PATCH v2 5/12 NAND: DaVinci: allow forced disable of subpage writes

Quoted 51 lines · Scott Wood
Quoted 36 lines · Muralidharan
Quoted 28 lines

-----Original Message-----
From: Scott Wood [mailto:scottwood at freescale.com]
Sent: Tuesday, February 25, 2014 11:01 PM
To: Karicheri, Muralidharan
Cc: u-boot at lists.denx.de; Rini, Tom
Subject: Re: [U-Boot] [U-Boot PATCH v2 05/12] NAND: DaVinci: allow forced disable of subpage writes

Quoted 19 lines · Murali Karicheri

This patch introduces a configurable mechanism to disable subpage writes in the DaVinci NAND driver.

---
- Added README

  README                          |    5 +++++
  drivers/mtd/nand/davinci_nand.c |    3 +++
  2 files changed, 8 insertions(+)
README +0 -0
index aea82be..caf60a2 100644
@@ -4427,6 +4427,11 @@ Low Level (hardware related) configuration options:
  - CONFIG_SPL_AM33XX_ENABLE_RTC32K_OSC:
  		Enables the RTC32K OSC on AM33xx based plattforms
 
Quoted 5 lines

README Low Level (hardware related) configuration options: · line 4433

Quoted 4 lines
README +4 -0
+- CONFIG_SYS_NAND_NO_SUBPAGE_WRITE
+		Option to disable subpage write in NAND driver
+		Example driver that use this:
+		drivers/mtd/nand/davinci_nand.c

I'd rather this be a full list of drivers that use it, not an example.

There are 3 drivers out there that disable sub page write using NAND_NO_SUBPAGE_WRITE by default.

Quoted 6 lines

nand/docg4.c
nand/fsl_ifc_nand.c
nand/mxs_nand.c

nand/davinci_nand.c is used across many of ti's existing davinci platforms and some of them do enable sub page write.

And only one of them uses CONFIG_SYS_NAND_NO_SUBPAGE_WRITE, which is a potentially confusing thing given the generic naming, and thus warrants clear documentation.

Quoted 4 lines

In Keystone platform, we want to disable this option. So to answer
your question, davinci_nand.c is the only user driver using this configuration option, but that doesn't prevent anyone from using the option. So I want to keep this configuration option as a generic option.

Quoted 7 lines

That's fine. My point is just to s/Example driver/Drivers/ so that if someone adds this to a new driver, they (hopefully) add it to the list in README, rather than just thinking one example is enough.

-Scott

That is fine. I will make the change in v3.

Murali

#16 lore raw

PATCH v2 6/12 i2c, davinci: move i2c_defs.h to the drivers/i2c directory

In reply to Murali Karicheri

This patch moves the davinci i2c_defs.h file to drivers.i2c directory. It will allow to reuse the davinci_i2c driver for TI Keystone2 SOCs.

Not used "git mv" command to move the file because small part of it with definitions specific for Davinci SOCs has to remain in the arch/arm/include/asm/arch-davinci.

---
- updated based on review comments

 arch/arm/include/asm/arch-davinci/i2c_defs.h |   71 ++----------------------
 drivers/i2c/davinci_i2c.c                    |    1 +
 drivers/i2c/davinci_i2c.h                    |   75 ++++++++++++++++++++++++++
 3 files changed, 79 insertions(+), 68 deletions(-)
 create mode 100644 drivers/i2c/davinci_i2c.h
arch/arm/include/asm/arch-davinci/i2c_defs.h +3 -68
index c388dc0..06da894 100644
@@ -1,16 +1,13 @@
 /*
- * (C) Copyright 2004
+ * (C) Copyright 2004-2014
  * Texas Instruments, <www.ti.com>
  *
  * Some changes copyright (C) 2007 Sergey Kubushyn <[email protected]>
  *
  * SPDX-License-Identifier:	GPL-2.0+
  */
-#ifndef _DAVINCI_I2C_H_
-#define _DAVINCI_I2C_H_
-
-#define I2C_WRITE		0
-#define I2C_READ		1
+#ifndef _I2C_DEFS_H_
+#define _I2C_DEFS_H_
 
 #ifndef CONFIG_SOC_DA8XX
 #define I2C_BASE		0x01c21000
@@ -18,66 +15,4 @@
 #define I2C_BASE		0x01c22000
 #endif
 
-#define	I2C_OA			(I2C_BASE + 0x00)
-#define I2C_IE			(I2C_BASE + 0x04)
-#define I2C_STAT		(I2C_BASE + 0x08)
-#define I2C_SCLL		(I2C_BASE + 0x0c)
-#define I2C_SCLH		(I2C_BASE + 0x10)
-#define I2C_CNT			(I2C_BASE + 0x14)
-#define I2C_DRR			(I2C_BASE + 0x18)
-#define I2C_SA			(I2C_BASE + 0x1c)
-#define I2C_DXR			(I2C_BASE + 0x20)
-#define I2C_CON			(I2C_BASE + 0x24)
-#define I2C_IV			(I2C_BASE + 0x28)
-#define I2C_PSC			(I2C_BASE + 0x30)
-
-/* I2C masks */
-
-/* I2C Interrupt Enable Register (I2C_IE): */
-#define I2C_IE_SCD_IE	(1 << 5)	/* Stop condition detect interrupt enable */
-#define I2C_IE_XRDY_IE	(1 << 4)	/* Transmit data ready interrupt enable */
-#define I2C_IE_RRDY_IE	(1 << 3)	/* Receive data ready interrupt enable */
-#define I2C_IE_ARDY_IE	(1 << 2)	/* Register access ready interrupt enable */
-#define I2C_IE_NACK_IE	(1 << 1)	/* No acknowledgment interrupt enable */
-#define I2C_IE_AL_IE	(1 << 0)	/* Arbitration lost interrupt enable */
-
-/* I2C Status Register (I2C_STAT): */
-
-#define I2C_STAT_BB	(1 << 12)	/* Bus busy */
-#define I2C_STAT_ROVR	(1 << 11)	/* Receive overrun */
-#define I2C_STAT_XUDF	(1 << 10)	/* Transmit underflow */
-#define I2C_STAT_AAS	(1 << 9)	/* Address as slave */
-#define I2C_STAT_SCD	(1 << 5)	/* Stop condition detect */
-#define I2C_STAT_XRDY	(1 << 4)	/* Transmit data ready */
-#define I2C_STAT_RRDY	(1 << 3)	/* Receive data ready */
-#define I2C_STAT_ARDY	(1 << 2)	/* Register access ready */
-#define I2C_STAT_NACK	(1 << 1)	/* No acknowledgment interrupt enable */
-#define I2C_STAT_AL	(1 << 0)	/* Arbitration lost interrupt enable */
-
-
-/* I2C Interrupt Code Register (I2C_INTCODE): */
-
-#define I2C_INTCODE_MASK	7
-#define I2C_INTCODE_NONE	0
-#define I2C_INTCODE_AL		1	/* Arbitration lost */
-#define I2C_INTCODE_NAK		2	/* No acknowledgement/general call */
-#define I2C_INTCODE_ARDY	3	/* Register access ready */
-#define I2C_INTCODE_RRDY	4	/* Rcv data ready */
-#define I2C_INTCODE_XRDY	5	/* Xmit data ready */
-#define I2C_INTCODE_SCD		6	/* Stop condition detect */
-
-
-/* I2C Configuration Register (I2C_CON): */
-
-#define I2C_CON_EN	(1 << 5)	/* I2C module enable */
-#define I2C_CON_STB	(1 << 4)	/* Start byte mode (master mode only) */
-#define I2C_CON_MST	(1 << 10)	/* Master/slave mode */
-#define I2C_CON_TRX	(1 << 9)	/* Transmitter/receiver mode (master mode only) */
-#define I2C_CON_XA	(1 << 8)	/* Expand address */
-#define I2C_CON_STP	(1 << 11)	/* Stop condition (master mode only) */
-#define I2C_CON_STT	(1 << 13)	/* Start condition (master mode only) */
-#define I2C_CON_FREE	(1 << 14)	/* Free run on emulation */
-
-#define I2C_TIMEOUT	0xffff0000	/* Timeout mask for poll_i2c_irq() */
-
 #endif
drivers/i2c/davinci_i2c.c +1 -0
index e56fe75..6e5260c 100644
@@ -12,6 +12,7 @@
 #include <i2c.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/i2c_defs.h>
+#include "davinci_i2c.h"
 
 #define CHECK_NACK() \
 	do {\
drivers/i2c/davinci_i2c.h new file +75 -0

75 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#17 lore raw

PATCH v2 6/12 i2c, davinci: move i2c_defs.h to the drivers/i2c directory

Quoted 8 lines · Murali Karicheri

This patch moves the davinci i2c_defs.h file to drivers.i2c directory. It will allow to reuse the davinci_i2c driver for TI Keystone2 SOCs.

Not used "git mv" command to move the file because small part of it with definitions specific for Davinci SOCs has to remain in the arch/arm/include/asm/arch-davinci.

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

PATCH v2 7/12 i2c, davinci: add support for multiple i2c buses

In reply to Murali Karicheri

From: Vitaly Andrianov <[email protected]>

---
 drivers/i2c/davinci_i2c.c |  344 ++++++++++++++++++++++++++-------------------
 drivers/i2c/davinci_i2c.h |   27 ++--
 2 files changed, 218 insertions(+), 153 deletions(-)
drivers/i2c/davinci_i2c.c +203 -141
index 6e5260c..c584a11 100644
@@ -1,25 +1,37 @@
 /*
  * TI DaVinci (TMS320DM644x) I2C driver.
  *
- * Copyright (C) 2007 Sergey Kubushyn <[email protected]>
+ * (C) Copyright 2012-2014
+ *     Texas Instruments Incorporated, <www.ti.com>
+ * (C) Copyright 2007 Sergey Kubushyn <[email protected]>
  *
- * --------------------------------------------------------
- *
- * SPDX-License-Identifier:	GPL-2.0+
+ * SPDX-License-Identifier:     GPL-2.0+
  */
 
 #include <common.h>
 #include <i2c.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/i2c_defs.h>
+#include <asm/io.h>
 #include "davinci_i2c.h"
 
+DECLARE_GLOBAL_DATA_PTR;
+
+static struct i2c_regs __attribute__((section(".data"))) *i2c_base =
+						(struct i2c_regs *)I2C_BASE;
+
+#ifdef CONFIG_I2C_MULTI_BUS
+static unsigned int __attribute__((section(".data")))
+		bus_initialized[I2C_BUS_MAX] = { [0 ... (I2C_BUS_MAX-1)] = 0 };
+static unsigned int __attribute__((section(".data"))) current_bus;
+#endif
+
 #define CHECK_NACK() \
 	do {\
 		if (tmp & (I2C_TIMEOUT | I2C_STAT_NACK)) {\
-			REG(I2C_CON) = 0;\
-			return(1);\
-		}\
+			REG(&(i2c_base->i2c_con)) = 0;\
+			return 1;\
+		} \
 	} while (0)
 
 
@@ -27,20 +39,21 @@ static int wait_for_bus(void)
 {
 	int	stat, timeout;
 
-	REG(I2C_STAT) = 0xffff;
+	REG(&(i2c_base->i2c_stat)) = 0xffff;
 
 	for (timeout = 0; timeout < 10; timeout++) {
-		if (!((stat = REG(I2C_STAT)) & I2C_STAT_BB)) {
-			REG(I2C_STAT) = 0xffff;
-			return(0);
+		stat = REG(&(i2c_base->i2c_stat));
+		if (!((stat) & I2C_STAT_BB)) {
+			REG(&(i2c_base->i2c_stat)) = 0xffff;
+			return 0;
 		}
 
-		REG(I2C_STAT) = stat;
+		REG(&(i2c_base->i2c_stat)) = stat;
 		udelay(50000);
 	}
 
-	REG(I2C_STAT) = 0xffff;
-	return(1);
+	REG(&(i2c_base->i2c_stat)) = 0xffff;
+	return 1;
 }
 
 
@@ -50,25 +63,24 @@ static int poll_i2c_irq(int mask)
 
 	for (timeout = 0; timeout < 10; timeout++) {
 		udelay(1000);
-		stat = REG(I2C_STAT);
-		if (stat & mask) {
-			return(stat);
-		}
+		stat = REG(&(i2c_base->i2c_stat));
+		if (stat & mask)
+			return stat;
 	}
 
-	REG(I2C_STAT) = 0xffff;
-	return(stat | I2C_TIMEOUT);
+	REG(&(i2c_base->i2c_stat)) = 0xffff;
+	return stat | I2C_TIMEOUT;
 }
 
 
 void flush_rx(void)
 {
 	while (1) {
-		if (!(REG(I2C_STAT) & I2C_STAT_RRDY))
+		if (!(REG(&(i2c_base->i2c_stat)) & I2C_STAT_RRDY))
 			break;
 
-		REG(I2C_DRR);
-		REG(I2C_STAT) = I2C_STAT_RRDY;
+		REG(&(i2c_base->i2c_drr));
+		REG(&(i2c_base->i2c_stat)) = I2C_STAT_RRDY;
 		udelay(1000);
 	}
 }
@@ -78,28 +90,33 @@ void i2c_init(int speed, int slaveadd)
 {
 	u_int32_t	div, psc;
 
-	if (REG(I2C_CON) & I2C_CON_EN) {
-		REG(I2C_CON) = 0;
-		udelay (50000);
+	if (REG(&(i2c_base->i2c_con)) & I2C_CON_EN) {
+		REG(&(i2c_base->i2c_con)) = 0;
+		udelay(50000);
 	}
 
 	psc = 2;
-	div = (CONFIG_SYS_HZ_CLOCK / ((psc + 1) * speed)) - 10;	/* SCLL + SCLH */
-	REG(I2C_PSC) = psc;			/* 27MHz / (2 + 1) = 9MHz */
-	REG(I2C_SCLL) = (div * 50) / 100;	/* 50% Duty */
-	REG(I2C_SCLH) = div - REG(I2C_SCLL);
+	div = (CONFIG_SYS_HZ_CLOCK / ((psc + 1) * speed)) - 10;
+	REG(&(i2c_base->i2c_psc)) = psc;
+	REG(&(i2c_base->i2c_scll)) = (div * 50) / 100;
+	REG(&(i2c_base->i2c_sclh)) = div - REG(&(i2c_base->i2c_scll));
 
-	REG(I2C_OA) = slaveadd;
-	REG(I2C_CNT) = 0;
+	REG(&(i2c_base->i2c_oa)) = slaveadd;
+	REG(&(i2c_base->i2c_cnt)) = 0;
 
 	/* Interrupts must be enabled or I2C module won't work */
-	REG(I2C_IE) = I2C_IE_SCD_IE | I2C_IE_XRDY_IE |
+	REG(&(i2c_base->i2c_ie)) = I2C_IE_SCD_IE | I2C_IE_XRDY_IE |
 		I2C_IE_RRDY_IE | I2C_IE_ARDY_IE | I2C_IE_NACK_IE;
 
 	/* Now enable I2C controller (get it out of reset) */
-	REG(I2C_CON) = I2C_CON_EN;
+	REG(&(i2c_base->i2c_con)) = I2C_CON_EN;
 
 	udelay(1000);
+
+#ifdef CONFIG_I2C_MULTI_BUS
+	if (gd->flags & GD_FLG_RELOC)
+		bus_initialized[current_bus] = 1;
+#endif
 }
 
 int i2c_set_bus_speed(unsigned int speed)
@@ -112,34 +129,36 @@ int i2c_probe(u_int8_t chip)
 {
 	int	rc = 1;
 
-	if (chip == REG(I2C_OA)) {
-		return(rc);
-	}
+	if (chip == REG(&(i2c_base->i2c_oa)))
+		return rc;
 
-	REG(I2C_CON) = 0;
-	if (wait_for_bus()) {return(1);}
+	REG(&(i2c_base->i2c_con)) = 0;
+	if (wait_for_bus())
+		return 1;
 
 	/* try to read one byte from current (or only) address */
-	REG(I2C_CNT) = 1;
-	REG(I2C_SA) = chip;
-	REG(I2C_CON) = (I2C_CON_EN | I2C_CON_MST | I2C_CON_STT | I2C_CON_STP);
-	udelay (50000);
+	REG(&(i2c_base->i2c_cnt)) = 1;
+	REG(&(i2c_base->i2c_sa))  = chip;
+	REG(&(i2c_base->i2c_con)) = (I2C_CON_EN | I2C_CON_MST | I2C_CON_STT |
+				     I2C_CON_STP);
+	udelay(50000);
 
-	if (!(REG(I2C_STAT) & I2C_STAT_NACK)) {
+	if (!(REG(&(i2c_base->i2c_stat)) & I2C_STAT_NACK)) {
 		rc = 0;
 		flush_rx();
-		REG(I2C_STAT) = 0xffff;
+		REG(&(i2c_base->i2c_stat)) = 0xffff;
 	} else {
-		REG(I2C_STAT) = 0xffff;
-		REG(I2C_CON) |= I2C_CON_STP;
+		REG(&(i2c_base->i2c_stat)) = 0xffff;
+		REG(&(i2c_base->i2c_con)) |= I2C_CON_STP;
 		udelay(20000);
-		if (wait_for_bus()) {return(1);}
+		if (wait_for_bus())
+			return 1;
 	}
 
 	flush_rx();
-	REG(I2C_STAT) = 0xffff;
-	REG(I2C_CNT) = 0;
-	return(rc);
+	REG(&(i2c_base->i2c_stat)) = 0xffff;
+	REG(&(i2c_base->i2c_cnt)) = 0;
+	return rc;
 }
 
 
@@ -149,73 +168,76 @@ int i2c_read(u_int8_t chip, u_int32_t addr, int alen, u_int8_t *buf, int len)
 	int		i;
 
 	if ((alen < 0) || (alen > 2)) {
-		printf("%s(): bogus address length %x\n", __FUNCTION__, alen);
-		return(1);
+		printf("%s(): bogus address length %x\n", __func__, alen);
+		return 1;
 	}
 
-	if (wait_for_bus()) {return(1);}
+	if (wait_for_bus())
+		return 1;
 
 	if (alen != 0) {
 		/* Start address phase */
 		tmp = I2C_CON_EN | I2C_CON_MST | I2C_CON_STT | I2C_CON_TRX;
-		REG(I2C_CNT) = alen;
-		REG(I2C_SA) = chip;
-		REG(I2C_CON) = tmp;
+		REG(&(i2c_base->i2c_cnt)) = alen;
+		REG(&(i2c_base->i2c_sa)) = chip;
+		REG(&(i2c_base->i2c_con)) = tmp;
 
 		tmp = poll_i2c_irq(I2C_STAT_XRDY | I2C_STAT_NACK);
 
 		CHECK_NACK();
 
 		switch (alen) {
-			case 2:
-				/* Send address MSByte */
-				if (tmp & I2C_STAT_XRDY) {
-					REG(I2C_DXR) = (addr >> 8) & 0xff;
-				} else {
-					REG(I2C_CON) = 0;
-					return(1);
-				}
-
-				tmp = poll_i2c_irq(I2C_STAT_XRDY | I2C_STAT_NACK);
-
-				CHECK_NACK();
-				/* No break, fall through */
-			case 1:
-				/* Send address LSByte */
-				if (tmp & I2C_STAT_XRDY) {
-					REG(I2C_DXR) = addr & 0xff;
-				} else {
-					REG(I2C_CON) = 0;
-					return(1);
-				}
-
-				tmp = poll_i2c_irq(I2C_STAT_XRDY | I2C_STAT_NACK | I2C_STAT_ARDY);
-
-				CHECK_NACK();
-
-				if (!(tmp & I2C_STAT_ARDY)) {
-					REG(I2C_CON) = 0;
-					return(1);
-				}
+		case 2:
+			/* Send address MSByte */
+			if (tmp & I2C_STAT_XRDY) {
+				REG(&(i2c_base->i2c_dxr)) = (addr >> 8) & 0xff;
+			} else {
+				REG(&(i2c_base->i2c_con)) = 0;
+				return 1;
+			}
+
+			tmp = poll_i2c_irq(I2C_STAT_XRDY | I2C_STAT_NACK);
+
+			CHECK_NACK();
+			/* No break, fall through */
+		case 1:
+			/* Send address LSByte */
+			if (tmp & I2C_STAT_XRDY) {
+				REG(&(i2c_base->i2c_dxr)) = addr & 0xff;
+			} else {
+				REG(&(i2c_base->i2c_con)) = 0;
+				return 1;
+			}
+
+			tmp = poll_i2c_irq(I2C_STAT_XRDY | I2C_STAT_NACK |
+					   I2C_STAT_ARDY);
+
+			CHECK_NACK();
+
+			if (!(tmp & I2C_STAT_ARDY)) {
+				REG(&(i2c_base->i2c_con)) = 0;
+				return 1;
+			}
 		}
 	}
 
 	/* Address phase is over, now read 'len' bytes and stop */
 	tmp = I2C_CON_EN | I2C_CON_MST | I2C_CON_STT | I2C_CON_STP;
-	REG(I2C_CNT) = len & 0xffff;
-	REG(I2C_SA) = chip;
-	REG(I2C_CON) = tmp;
+	REG(&(i2c_base->i2c_cnt)) = len & 0xffff;
+	REG(&(i2c_base->i2c_sa)) = chip;
+	REG(&(i2c_base->i2c_con)) = tmp;
 
 	for (i = 0; i < len; i++) {
-		tmp = poll_i2c_irq(I2C_STAT_RRDY | I2C_STAT_NACK | I2C_STAT_ROVR);
+		tmp = poll_i2c_irq(I2C_STAT_RRDY | I2C_STAT_NACK |
+				   I2C_STAT_ROVR);
 
 		CHECK_NACK();
 
 		if (tmp & I2C_STAT_RRDY) {
-			buf[i] = REG(I2C_DRR);
+			buf[i] = REG(&(i2c_base->i2c_drr));
 		} else {
-			REG(I2C_CON) = 0;
-			return(1);
+			REG(&(i2c_base->i2c_con)) = 0;
+			return 1;
 		}
 	}
 
@@ -224,16 +246,16 @@ int i2c_read(u_int8_t chip, u_int32_t addr, int alen, u_int8_t *buf, int len)
 	CHECK_NACK();
 
 	if (!(tmp & I2C_STAT_SCD)) {
-		REG(I2C_CON) = 0;
-		return(1);
+		REG(&(i2c_base->i2c_con)) = 0;
+		return 1;
 	}
 
 	flush_rx();
-	REG(I2C_STAT) = 0xffff;
-	REG(I2C_CNT) = 0;
-	REG(I2C_CON) = 0;
+	REG(&(i2c_base->i2c_stat)) = 0xffff;
+	REG(&(i2c_base->i2c_cnt)) = 0;
+	REG(&(i2c_base->i2c_con)) = 0;
 
-	return(0);
+	return 0;
 }
 
 
@@ -243,48 +265,51 @@ int i2c_write(u_int8_t chip, u_int32_t addr, int alen, u_int8_t *buf, int len)
 	int		i;
 
 	if ((alen < 0) || (alen > 2)) {
-		printf("%s(): bogus address length %x\n", __FUNCTION__, alen);
-		return(1);
+		printf("%s(): bogus address length %x\n", __func__, alen);
+		return 1;
 	}
 	if (len < 0) {
-		printf("%s(): bogus length %x\n", __FUNCTION__, len);
-		return(1);
+		printf("%s(): bogus length %x\n", __func__, len);
+		return 1;
 	}
 
-	if (wait_for_bus()) {return(1);}
+	if (wait_for_bus())
+		return 1;
 
 	/* Start address phase */
-	tmp = I2C_CON_EN | I2C_CON_MST | I2C_CON_STT | I2C_CON_TRX | I2C_CON_STP;
-	REG(I2C_CNT) = (alen == 0) ? len & 0xffff : (len & 0xffff) + alen;
-	REG(I2C_SA) = chip;
-	REG(I2C_CON) = tmp;
+	tmp = I2C_CON_EN | I2C_CON_MST | I2C_CON_STT |
+		I2C_CON_TRX | I2C_CON_STP;
+	REG(&(i2c_base->i2c_cnt)) = (alen == 0) ?
+		len & 0xffff : (len & 0xffff) + alen;
+	REG(&(i2c_base->i2c_sa)) = chip;
+	REG(&(i2c_base->i2c_con)) = tmp;
 
 	switch (alen) {
-		case 2:
-			/* Send address MSByte */
-			tmp = poll_i2c_irq(I2C_STAT_XRDY | I2C_STAT_NACK);
+	case 2:
+		/* Send address MSByte */
+		tmp = poll_i2c_irq(I2C_STAT_XRDY | I2C_STAT_NACK);
 
-			CHECK_NACK();
+		CHECK_NACK();
 
-			if (tmp & I2C_STAT_XRDY) {
-				REG(I2C_DXR) = (addr >> 8) & 0xff;
-			} else {
-				REG(I2C_CON) = 0;
-				return(1);
-			}
-			/* No break, fall through */
-		case 1:
-			/* Send address LSByte */
-			tmp = poll_i2c_irq(I2C_STAT_XRDY | I2C_STAT_NACK);
+		if (tmp & I2C_STAT_XRDY) {
+			REG(&(i2c_base->i2c_dxr)) = (addr >> 8) & 0xff;
+		} else {
+			REG(&(i2c_base->i2c_con)) = 0;
+			return 1;
+		}
+		/* No break, fall through */
+	case 1:
+		/* Send address LSByte */
+		tmp = poll_i2c_irq(I2C_STAT_XRDY | I2C_STAT_NACK);
 
-			CHECK_NACK();
+		CHECK_NACK();
 
-			if (tmp & I2C_STAT_XRDY) {
-				REG(I2C_DXR) = addr & 0xff;
-			} else {
-				REG(I2C_CON) = 0;
-				return(1);
-			}
+		if (tmp & I2C_STAT_XRDY) {
+			REG(&(i2c_base->i2c_dxr)) = addr & 0xff;
+		} else {
+			REG(&(i2c_base->i2c_con)) = 0;
+			return 1;
+		}
 	}
 
 	for (i = 0; i < len; i++) {
@@ -292,11 +317,10 @@ int i2c_write(u_int8_t chip, u_int32_t addr, int alen, u_int8_t *buf, int len)
 
 		CHECK_NACK();
 
-		if (tmp & I2C_STAT_XRDY) {
-			REG(I2C_DXR) = buf[i];
-		} else {
-			return(1);
-		}
+		if (tmp & I2C_STAT_XRDY)
+			REG(&(i2c_base->i2c_dxr)) = buf[i];
+		else
+			return 1;
 	}
 
 	tmp = poll_i2c_irq(I2C_STAT_SCD | I2C_STAT_NACK);
@@ -304,14 +328,52 @@ int i2c_write(u_int8_t chip, u_int32_t addr, int alen, u_int8_t *buf, int len)
 	CHECK_NACK();
 
 	if (!(tmp & I2C_STAT_SCD)) {
-		REG(I2C_CON) = 0;
-		return(1);
+		REG(&(i2c_base->i2c_con)) = 0;
+		return 1;
 	}
 
 	flush_rx();
-	REG(I2C_STAT) = 0xffff;
-	REG(I2C_CNT) = 0;
-	REG(I2C_CON) = 0;
+	REG(&(i2c_base->i2c_stat)) = 0xffff;
+	REG(&(i2c_base->i2c_cnt)) = 0;
+	REG(&(i2c_base->i2c_con)) = 0;
+
+	return 0;
+}
+
+#ifdef CONFIG_I2C_MULTI_BUS
+int i2c_set_bus_num(unsigned int bus)
+{
+	if ((bus < 0) || (bus >= I2C_BUS_MAX)) {
+		printf("Bad bus: %d\n", bus);
+		return -1;
+	}
 
-	return(0);
+	switch (bus) {
+#if I2C_BUS_MAX == 3
+	case 2:
+		i2c_base = (struct i2c_regs *)I2C2_BASE;
+		break;
+#endif
+#if I2C_BUS_MAX >= 2
+	case 1:
+		i2c_base = (struct i2c_regs *)I2C1_BASE;
+		break;
+#endif
+	default:
+		i2c_base = (struct i2c_regs *)I2C0_BASE;
+		bus = 0;
+	}
+
+	current_bus = bus;
+
+	if (!bus_initialized[current_bus])
+		i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+
+	return 0;
+}
+
+unsigned int i2c_get_bus_num(void)
+{
+	return (int) current_bus;
 }
+#endif
drivers/i2c/davinci_i2c.h +15 -12
index 79ff7a3..20d4342 100644
@@ -12,18 +12,21 @@
 #define I2C_WRITE		0
 #define I2C_READ		1
 
-#define	I2C_OA			(I2C_BASE + 0x00)
-#define I2C_IE			(I2C_BASE + 0x04)
-#define I2C_STAT		(I2C_BASE + 0x08)
-#define I2C_SCLL		(I2C_BASE + 0x0c)
-#define I2C_SCLH		(I2C_BASE + 0x10)
-#define I2C_CNT			(I2C_BASE + 0x14)
-#define I2C_DRR			(I2C_BASE + 0x18)
-#define I2C_SA			(I2C_BASE + 0x1c)
-#define I2C_DXR			(I2C_BASE + 0x20)
-#define I2C_CON			(I2C_BASE + 0x24)
-#define I2C_IV			(I2C_BASE + 0x28)
-#define I2C_PSC			(I2C_BASE + 0x30)
+struct i2c_regs {
+	u32	i2c_oa;
+	u32	i2c_ie;
+	u32	i2c_stat;
+	u32	i2c_scll;
+	u32	i2c_sclh;
+	u32	i2c_cnt;
+	u32	i2c_drr;
+	u32	i2c_sa;
+	u32	i2c_dxr;
+	u32	i2c_con;
+	u32	i2c_iv;
+	u32	res_2c;
+	u32	i2c_psc;
+};
 
 /* I2C masks */
 
Signature · 1 line
1.7.9.5
#19 lore raw

PATCH v2 7/12 i2c, davinci: add support for multiple i2c buses

Quoted 3 lines · Murali Karicheri

From: Vitaly Andrianov <[email protected]>

[snip]

Quoted 2 lines

- * SPDX-License-Identifier: GPL-2.0+
+ * SPDX-License-Identifier: GPL-2.0+

Don't change whitespace.

drivers/i2c/davinci_i2c.c line 21

Quoted 2 lines
drivers/i2c/davinci_i2c.c +2 -0
+static struct i2c_regs __attribute__((section(".data"))) *i2c_base =
+						(struct i2c_regs *)I2C_BASE;

So you're going to need the i2c driver in SPL?

[snip]

drivers/i2c/davinci_i2c.c void i2c_init(int speed, int slaveadd) · line 102

Quoted 8 lines
drivers/i2c/davinci_i2c.c +4 -4
-	div = (CONFIG_SYS_HZ_CLOCK / ((psc + 1) * speed)) - 10;	/* SCLL + SCLH */
-	REG(I2C_PSC) = psc;			/* 27MHz / (2 + 1) = 9MHz */
-	REG(I2C_SCLL) = (div * 50) / 100;	/* 50% Duty */
-	REG(I2C_SCLH) = div - REG(I2C_SCLL);
+	div = (CONFIG_SYS_HZ_CLOCK / ((psc + 1) * speed)) - 10;
+	REG(&(i2c_base->i2c_psc)) = psc;
+	REG(&(i2c_base->i2c_scll)) = (div * 50) / 100;
+	REG(&(i2c_base->i2c_sclh)) = div - REG(&(i2c_base->i2c_scll));

Code is equivalent but we lost the comments about what's being done, please fix. I think this is the only place but please double check, thanks!

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

PATCH v2 8/12 k2hk: add support for k2hk SOC and EVM

In reply to Murali Karicheri

From: Vitaly Andrianov <[email protected]>

k2hk EVM is based on Texas Instruments Keystone2 Hawking/Kepler SoC. Keystone2 SoC has ARM v7 Cortex-A15 MPCore processor. Please refer the ti/k2hk_evm/README for details on the board, build and other information.

This patch add support for keystone architecture and k2hk evm.

---
- Updated based on review comments

 Makefile                                           |   19 ++
 arch/arm/cpu/armv7/keystone/Makefile               |   17 ++
 arch/arm/cpu/armv7/keystone/aemif.c                |   71 +++++
 arch/arm/cpu/armv7/keystone/clock.c                |  313 ++++++++++++++++++++
 arch/arm/cpu/armv7/keystone/cmd_clock.c            |  124 ++++++++
 arch/arm/cpu/armv7/keystone/cmd_mon.c              |  131 ++++++++
 arch/arm/cpu/armv7/keystone/config.mk              |   15 +
 arch/arm/cpu/armv7/keystone/ddr3.c                 |   69 +++++
 arch/arm/cpu/armv7/keystone/init.c                 |   56 ++++
 arch/arm/cpu/armv7/keystone/msmc.c                 |   68 +++++
 arch/arm/cpu/armv7/keystone/psc.c                  |  238 +++++++++++++++
 arch/arm/cpu/armv7/keystone/spl.c                  |   45 +++
 arch/arm/include/asm/arch-keystone/clock-k2hk.h    |  109 +++++++
 arch/arm/include/asm/arch-keystone/clock.h         |   17 ++
 arch/arm/include/asm/arch-keystone/clock_defs.h    |  121 ++++++++
 arch/arm/include/asm/arch-keystone/emif_defs.h     |   73 +++++
 arch/arm/include/asm/arch-keystone/hardware-k2hk.h |  145 +++++++++
 arch/arm/include/asm/arch-keystone/hardware.h      |  175 +++++++++++
 arch/arm/include/asm/arch-keystone/i2c_defs.h      |   17 ++
 arch/arm/include/asm/arch-keystone/nand_defs.h     |   25 ++
 arch/arm/include/asm/arch-keystone/psc_defs.h      |   90 ++++++
 arch/arm/include/asm/arch-keystone/spl.h           |   12 +
 board/ti/k2hk_evm/Makefile                         |    9 +
 board/ti/k2hk_evm/README                           |   56 ++++
 board/ti/k2hk_evm/board.c                          |  236 +++++++++++++++
 board/ti/k2hk_evm/ddr3.c                           |  269 +++++++++++++++++
 boards.cfg                                         |    1 +
 drivers/serial/ns16550.c                           |    8 +
 include/configs/k2hk_evm.h                         |  221 ++++++++++++++
 29 files changed, 2750 insertions(+)
 create mode 100644 arch/arm/cpu/armv7/keystone/Makefile
 create mode 100644 arch/arm/cpu/armv7/keystone/aemif.c
 create mode 100644 arch/arm/cpu/armv7/keystone/clock.c
 create mode 100644 arch/arm/cpu/armv7/keystone/cmd_clock.c
 create mode 100644 arch/arm/cpu/armv7/keystone/cmd_mon.c
 create mode 100644 arch/arm/cpu/armv7/keystone/config.mk
 create mode 100644 arch/arm/cpu/armv7/keystone/ddr3.c
 create mode 100644 arch/arm/cpu/armv7/keystone/init.c
 create mode 100644 arch/arm/cpu/armv7/keystone/msmc.c
 create mode 100644 arch/arm/cpu/armv7/keystone/psc.c
 create mode 100644 arch/arm/cpu/armv7/keystone/spl.c
 create mode 100644 arch/arm/include/asm/arch-keystone/clock-k2hk.h
 create mode 100644 arch/arm/include/asm/arch-keystone/clock.h
 create mode 100644 arch/arm/include/asm/arch-keystone/clock_defs.h
 create mode 100644 arch/arm/include/asm/arch-keystone/emif_defs.h
 create mode 100644 arch/arm/include/asm/arch-keystone/hardware-k2hk.h
 create mode 100644 arch/arm/include/asm/arch-keystone/hardware.h
 create mode 100644 arch/arm/include/asm/arch-keystone/i2c_defs.h
 create mode 100644 arch/arm/include/asm/arch-keystone/nand_defs.h
 create mode 100644 arch/arm/include/asm/arch-keystone/psc_defs.h
 create mode 100644 arch/arm/include/asm/arch-keystone/spl.h
 create mode 100644 board/ti/k2hk_evm/Makefile
 create mode 100644 board/ti/k2hk_evm/README
 create mode 100644 board/ti/k2hk_evm/board.c
 create mode 100644 board/ti/k2hk_evm/ddr3.c
 create mode 100644 include/configs/k2hk_evm.h
Makefile +19 -0
index 47a03e3..ea2a387 100644
@@ -491,6 +491,23 @@ $(obj)u-boot.spr:	$(obj)u-boot.img $(obj)spl/u-boot-spl.bin
 			--pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff $@
 		cat $(obj)u-boot.img >> $@
 
+$(obj)u-boot-spi.gph:	$(obj)u-boot.img $(obj)spl/u-boot-spl.bin
+		$(obj)tools/mkimage -A $(ARCH) -T gpimage -C none \
+			-a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) \
+			-n SPL -d $(obj)spl/u-boot-spl.bin $(obj)spl/u-boot-spl.gph
+		$(OBJCOPY) ${OBJCFLAGS} -I binary \
+			--pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0 -O binary \
+			$(obj)spl/u-boot-spl.gph $(obj)spl/u-boot-spl-pad.gph
+		cat $(obj)spl/u-boot-spl-pad.gph $(obj)u-boot.img > $@
+
+$(obj)u-boot-nand.gph:	$(obj)u-boot.bin
+		$(obj)tools/mkimage -A $(ARCH) -T gpimage -C none \
+			-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) \
+			-n U-Boot -d $(obj)u-boot.bin $(obj)gph-u-boot.bin
+		@dd if=/dev/zero of=$(obj)zero.bin bs=8 count=1 2>/dev/null
+		@cat $(obj)gph-u-boot.bin $(obj)zero.bin > $@
+		@rm $(obj)zero.bin
+
 ifneq ($(CONFIG_TEGRA),)
 $(obj)u-boot-nodtb-tegra.bin: $(obj)spl/u-boot-spl.bin $(obj)u-boot.bin
 		$(OBJCOPY) ${OBJCFLAGS} --pad-to=$(CONFIG_SYS_TEXT_BASE) -O binary $(obj)spl/u-boot-spl $(obj)spl/u-boot-spl-pad.bin
@@ -841,12 +858,14 @@ clobber:	tidy
 	@rm -f $(obj)u-boot.dtb
 	@rm -f $(obj)u-boot.sb
 	@rm -f $(obj)u-boot.spr
+	@rm -f $(obj)u-boot-*.gph
 	@rm -f $(obj)nand_spl/{u-boot.{lds,lst},System.map}
 	@rm -f $(obj)nand_spl/{u-boot-nand_spl.lds,u-boot-spl,u-boot-spl.map}
 	@rm -f $(obj)spl/{u-boot-spl,u-boot-spl.bin,u-boot-spl.map}
 	@rm -f $(obj)spl/u-boot-spl.lds
 	@rm -f $(obj)tpl/{u-boot-tpl,u-boot-tpl.bin,u-boot-tpl.map}
 	@rm -f $(obj)tpl/u-boot-spl.lds
+	@rm -f $(obj)spl/{u-boot-spl.gph,u-boot-spl-pad.gph}
 	@rm -f $(obj)MLO MLO.byteswap
 	@rm -f $(obj)SPL
 	@rm -f $(obj)tools/xway-swap-bytes
arch/arm/cpu/armv7/keystone/Makefile new file +17 -0
new file mode 100644
index 0000000..7924cfa
@@ -0,0 +1,17 @@
+#
+# (C) Copyright 2012-2014
+#     Texas Instruments Incorporated, <www.ti.com>
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#
+
+obj-y	+= aemif.o
+obj-y	+= init.o
+obj-y	+= psc.o
+obj-y	+= clock.o
+obj-y	+= cmd_clock.o
+obj-y	+= cmd_mon.o
+obj-y	+= msmc.o
+obj-$(CONFIG_SPL_BUILD)	+= spl.o
+obj-y	+= ddr3.o
+
arch/arm/cpu/armv7/keystone/aemif.c new file +71 -0

71 lines not on this page · raw message

arch/arm/cpu/armv7/keystone/clock.c new file +313 -0

313 lines not on this page · raw message

arch/arm/cpu/armv7/keystone/cmd_clock.c new file +124 -0

124 lines not on this page · raw message

arch/arm/cpu/armv7/keystone/cmd_mon.c new file +131 -0

131 lines not on this page · raw message

arch/arm/cpu/armv7/keystone/config.mk new file +15 -0
new file mode 100644
index 0000000..1c8769c
@@ -0,0 +1,15 @@
+# (C) Copyright 2012-2014
+#     Texas Instruments Incorporated, <www.ti.com>
+# SPDX-License-Identifier:     GPL-2.0+
+#
+
+PLATFORM_RELFLAGS += -fno-common -ffixed-r8 -msoft-float
+
+# =========================================================================
+#
+# Supply options according to compiler version
+#
+# =========================================================================
+PF_CPPFLAGS_SLB +=$(call cc-option,-mshort-load-bytes,\
+		    $(call cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS += $(PF_CPPFLAGS_SLB)
arch/arm/cpu/armv7/keystone/ddr3.c new file +69 -0

69 lines not on this page · raw message

arch/arm/cpu/armv7/keystone/init.c new file +56 -0

56 lines not on this page · raw message

arch/arm/cpu/armv7/keystone/msmc.c new file +68 -0

68 lines not on this page · raw message

arch/arm/cpu/armv7/keystone/psc.c new file +238 -0

238 lines not on this page · raw message

arch/arm/cpu/armv7/keystone/spl.c new file +45 -0

45 lines not on this page · raw message

arch/arm/include/asm/arch-keystone/clock-k2hk.h new file +109 -0

109 lines not on this page · raw message

arch/arm/include/asm/arch-keystone/clock.h new file +17 -0
new file mode 100644
index 0000000..324501b
@@ -0,0 +1,17 @@
+/*
+ * keystone2: common clock header file
+ *
+ * (C) Copyright 2012-2014
+ *     Texas Instruments Incorporated, <www.ti.com>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef __ASM_ARCH_CLOCK_H
+#define __ASM_ARCH_CLOCK_H
+
+#ifdef CONFIG_SOC_K2HK
+#include <asm/arch/clock-k2hk.h>
+#endif
+
+#endif
arch/arm/include/asm/arch-keystone/clock_defs.h new file +121 -0

121 lines not on this page · raw message

arch/arm/include/asm/arch-keystone/emif_defs.h new file +73 -0

73 lines not on this page · raw message

arch/arm/include/asm/arch-keystone/hardware-k2hk.h new file +145 -0

145 lines not on this page · raw message

arch/arm/include/asm/arch-keystone/hardware.h new file +175 -0

175 lines not on this page · raw message

arch/arm/include/asm/arch-keystone/i2c_defs.h new file +17 -0
new file mode 100644
index 0000000..d425652
@@ -0,0 +1,17 @@
+/*
+ * keystone: i2c driver definitions
+ *
+ * (C) Copyright 2014
+ *     Texas Instruments Incorporated, <www.ti.com>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+#ifndef _I2C_DEFS_H_
+#define _I2C_DEFS_H_
+
+#define I2C0_BASE		0x02530000
+#define I2C1_BASE		0x02530400
+#define I2C2_BASE		0x02530800
+#define I2C_BASE		I2C0_BASE
+
+#endif
arch/arm/include/asm/arch-keystone/nand_defs.h new file +25 -0
new file mode 100644
index 0000000..6d6f846
@@ -0,0 +1,25 @@
+/*
+ * nand driver definitions to re-use davinci nand driver on Keystone2
+ *
+ * (C) Copyright 2012-2014
+ *     Texas Instruments Incorporated, <www.ti.com>
+ * (C) Copyright 2007 Sergey Kubushyn <[email protected]>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+#ifndef _NAND_DEFS_H_
+#define _NAND_DEFS_H_
+
+#include <asm/arch/hardware.h>
+#include <linux/mtd/nand.h>
+
+#define	MASK_CLE	0x4000
+#define	MASK_ALE	0x2000
+
+#define NAND_READ_START		0x00
+#define NAND_READ_END		0x30
+#define NAND_STATUS		0x70
+
+extern void davinci_nand_init(struct nand_chip *nand);
+
+#endif
arch/arm/include/asm/arch-keystone/psc_defs.h new file +90 -0

90 lines not on this page · raw message

arch/arm/include/asm/arch-keystone/spl.h new file +12 -0
new file mode 100644
index 0000000..eb0b3ed
@@ -0,0 +1,12 @@
+/*
+ * (C) Copyright 2012-2014
+ * Texas Instruments, <www.ti.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+#ifndef	_ASM_ARCH_SPL_H_
+#define	_ASM_SPL_H_
+
+#define BOOT_DEVICE_SPI		2
+
+#endif
board/ti/k2hk_evm/Makefile new file +9 -0
new file mode 100644
index 0000000..3645f2f
@@ -0,0 +1,9 @@
+#
+# K2HK-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
board/ti/k2hk_evm/README new file +56 -0

56 lines not on this page · raw message

board/ti/k2hk_evm/board.c new file +236 -0

236 lines not on this page · raw message

board/ti/k2hk_evm/ddr3.c new file +269 -0

269 lines not on this page · raw message

boards.cfg +1 -0
index a8336cc..1690315 100644
@@ -362,6 +362,7 @@ Active  arm	    armv7	   zynq	       xilinx	       zynq	   	   zynq_microzed			-
 Active  arm	    armv7	   zynq	       xilinx	       zynq	   	   zynq_zc770_xm010			zynq_zc770:ZC770_XM010                                                                                                            Michal Simek <[email protected]>:Jagannadha Sutradharudu Teki <[email protected]>
 Active  arm	    armv7	   zynq	       xilinx	       zynq	   	   zynq_zc770_xm012			zynq_zc770:ZC770_XM012                                                                                                            Michal Simek <[email protected]>:Jagannadha Sutradharudu Teki <[email protected]>
 Active  arm	    armv7	   zynq	       xilinx	       zynq	   	   zynq_zc770_xm013			zynq_zc770:ZC770_XM013                                                                                                            Michal Simek <[email protected]>:Jagannadha Sutradharudu Teki <[email protected]>
+Active  arm         armv7          keystone    ti              k2hk_evm            k2hk_evm                             -                                                                                                                                 Vitaly Andrianov <[email protected]>
 Active  arm         armv7:arm720t  tegra114    nvidia          dalmore             dalmore                              -                                                                                                                                 Tom Warren <[email protected]>
 Active  arm         armv7:arm720t  tegra20     avionic-design  medcom-wide         medcom-wide                          -                                                                                                                                 Alban Bedel <[email protected]>
 Active  arm         armv7:arm720t  tegra20     avionic-design  plutux              plutux                               -                                                                                                                                 Alban Bedel <[email protected]>
drivers/serial/ns16550.c +8 -0
index fbc37b2..8a13454 100644
@@ -30,6 +30,11 @@
 #define serial_in(y)		readb(y)
 #endif
 
+#if defined(CONFIG_K2HK_EVM)
+#define UART_REG_VAL_PWREMU_MGMT_UART_DISABLE   0
+#define UART_REG_VAL_PWREMU_MGMT_UART_ENABLE ((1 << 14) | (1 << 13) | (1 << 0))
+#endif
+
 #ifndef CONFIG_SYS_NS16550_IER
 #define CONFIG_SYS_NS16550_IER  0x00
 #endif /* CONFIG_SYS_NS16550_IER */
@@ -77,6 +82,9 @@ void NS16550_init(NS16550_t com_port, int baud_divisor)
 	/* /16 is proper to hit 115200 with 48MHz */
 	serial_out(0, &com_port->mdr1);
 #endif /* CONFIG_OMAP */
+#if defined(CONFIG_K2HK_EVM)
+	serial_out(UART_REG_VAL_PWREMU_MGMT_UART_ENABLE, &com_port->regC);
+#endif
 }
 
 #ifndef CONFIG_NS16550_MIN_FUNCTIONS
include/configs/k2hk_evm.h new file +221 -0

221 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#21 lore raw

PATCH v2 8/12 k2hk: add support for k2hk SOC and EVM

Quoted 13 lines · Murali Karicheri

From: Vitaly Andrianov <[email protected]>

k2hk EVM is based on Texas Instruments Keystone2 Hawking/Kepler SoC. Keystone2 SoC has ARM v7 Cortex-A15 MPCore processor. Please refer the ti/k2hk_evm/README for details on the board, build and other information.

This patch add support for keystone architecture and k2hk evm.

[snip]

Quoted 14 lines
Makefile +6 -0
index 47a03e3..ea2a387 100644
@@ -491,6 +491,23 @@ $(obj)u-boot.spr:	$(obj)u-boot.img $(obj)spl/u-boot-spl.bin
 			--pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff $@
 		cat $(obj)u-boot.img >> $@
 
+$(obj)u-boot-spi.gph:	$(obj)u-boot.img $(obj)spl/u-boot-spl.bin
+		$(obj)tools/mkimage -A $(ARCH) -T gpimage -C none \
+			-a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) \
+			-n SPL -d $(obj)spl/u-boot-spl.bin $(obj)spl/u-boot-spl.gph
+		$(OBJCOPY) ${OBJCFLAGS} -I binary \
+			--pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0 -O binary \

Makefile $(obj)u-boot.spr: $(obj)u-boot.img $(obj)spl/u-boot-spl.bin · line 509

Quoted 10 lines
Makefile +10 -0
+			$(obj)spl/u-boot-spl.gph $(obj)spl/u-boot-spl-pad.gph
+		cat $(obj)spl/u-boot-spl-pad.gph $(obj)u-boot.img > $@
+
+$(obj)u-boot-nand.gph:	$(obj)u-boot.bin
+		$(obj)tools/mkimage -A $(ARCH) -T gpimage -C none \
+			-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) \
+			-n U-Boot -d $(obj)u-boot.bin $(obj)gph-u-boot.bin
+		@dd if=/dev/zero of=$(obj)zero.bin bs=8 count=1 2>/dev/null
+		@cat $(obj)gph-u-boot.bin $(obj)zero.bin > $@
+		@rm $(obj)zero.bin

First, these need re-writing for Kbuild. Second, we don't ever use u-boot-nand.gph or talk about it in the README, do we?

[snip]

Makefile $(obj)u-boot.spr: $(obj)u-boot.img $(obj)spl/u-boot-spl.bin

Quoted 10 lines
Makefile +10 -0
+void init_pll(const struct pll_init_data *data)
+{
+	u32 tmp, tmp_ctl, pllm, plld, pllod, bwadj;
+
+	pllm = data->pll_m - 1;
+	plld = (data->pll_d - 1) & PLL_DIV_MASK;
+	pllod = (data->pll_od - 1) & PLL_CLKOD_MASK;
+
+	if (data->pll == MAIN_PLL) {
+		sdelay(210000);

Comments on the delay please.

arch/arm/cpu/armv7/keystone/config.mk line 6

Quoted 12 lines
arch/arm/cpu/armv7/keystone/config.mk new file +6 -0
new file mode 100644
index 0000000..1c8769c
@@ -0,0 +1,15 @@
+# (C) Copyright 2012-2014
+#     Texas Instruments Incorporated, <www.ti.com>
+# SPDX-License-Identifier:     GPL-2.0+
+#
+
+PLATFORM_RELFLAGS += -fno-common -ffixed-r8 -msoft-float

This is incorrect and not needed.

arch/arm/cpu/armv7/keystone/config.mk line 15

Quoted 8 lines
arch/arm/cpu/armv7/keystone/config.mk new file +8 -0
+# =========================================================================
+#
+# Supply options according to compiler version
+#
+# =========================================================================
+PF_CPPFLAGS_SLB +=$(call cc-option,-mshort-load-bytes,\
+		    $(call cc-option,-malignment-traps,))
+PLATFORM_RELFLAGS += $(PF_CPPFLAGS_SLB)

Also not needed.

Quoted 5 lines
arch/arm/cpu/armv7/keystone/init.c new file +0 -0
new file mode 100644
index 0000000..1b7e52a

[snip]

arch/arm/cpu/armv7/keystone/init.c line 44

Quoted 9 lines
arch/arm/cpu/armv7/keystone/init.c new file +9 -0
+void reset_cpu(ulong addr)
+{
+	volatile u32 *rstctrl = (volatile u32 *)(CLOCK_BASE + 0xe8);
+	u32 tmp;
+
+	tmp = *rstctrl & 0xffff0000;
+	*rstctrl = tmp | 0x5a69;
+
+	*rstctrl &= 0xfffe0000;

Comments / define these please.

Quoted 1 line

+++ b/arch/arm/cpu/armv7/keystone/psc.c

[snip]

Quoted 6 lines

+/*
+ * FUNCTION PURPOSE: Wait for end of transitional state
+ *
+ * DESCRIPTION: Polls pstat for the selected domain and waits for transitions
+ * to be complete.
+ *

Quoted 6 lines
+ *              Since this is boot loader code it is *ASSUMED* that interrupts
+ *              are disabled and no other core is mucking around with the psc
+ *              at the same time.

+ *
+ * Returns 0 when the domain is free. Returns -1 if a timeout
+ * occurred waiting for the completion.

Rewrap these lines please, and anywhere else things are too long.

Quoted 1 line

+++ b/arch/arm/cpu/armv7/keystone/spl.c

[snip]

arch/arm/cpu/armv7/keystone/init.c

Quoted 8 lines
arch/arm/cpu/armv7/keystone/init.c new file +8 -0
+u32 spl_boot_device(void)
+{
+#if defined(CONFIG_SPL_SPI_LOAD)
+	return BOOT_DEVICE_SPI;
+#else
+	puts("Unknown boot device\n");
+	hang();
+#endif

return -EINVAL (or define and use BOOT_DEVICE_UNKNOWN) and fall back to the common hang() case please.

arch/arm/cpu/armv7/keystone/init.c

Quoted 1 line
arch/arm/cpu/armv7/keystone/init.c new file +1 -0
+	u32	__pad0;

General form is resvN.

[snip]

arch/arm/cpu/armv7/keystone/init.c

Quoted 2 lines
arch/arm/cpu/armv7/keystone/init.c new file +2 -0
+struct davinci_emif_regs {
+	u_int32_t	ercsr;

Generally we do uint32_t

[snip]

arch/arm/cpu/armv7/keystone/init.c

Quoted 5 lines
arch/arm/cpu/armv7/keystone/init.c new file +5 -0
+#define	REG(addr)	(*(volatile unsigned int *)(addr))
+#define REG_P(addr)	((volatile unsigned int *)(addr))
+
+typedef volatile unsigned int	dv_reg;
+typedef volatile unsigned int	*dv_reg_p;

Where are we using this? This looks like older davinci drivers that aren't being proper about using structs to define the hardware and need to be converted as part of this effort. I'm not disagreeable with seeing that be a later part of the initial series, since you'll have to convert davinci stuff too and I realize you might not have easy access to the davinci parts for run time testing of the conversion so having K2 work will be important.

Quoted 1 line

+++ b/board/ti/k2hk_evm/README

[snip]

What's missing here and I'd like to see is flashing instructions.

arch/arm/cpu/armv7/keystone/init.c

Quoted 10 lines
arch/arm/cpu/armv7/keystone/init.c new file +10 -0
+Build instructions:
+===================
+
+To build u-boot.bin
+  >make k2hk_evm_config
+  >make u-boot-spi.gph
+
+To build u-boot-spi.gph
+  >make k2hk_evm_config
+  >make u-boot-spi.gph

We need to use CONFIG_SPL_TARGET so that make all just works.

arch/arm/cpu/armv7/keystone/init.c

Quoted 2 lines
arch/arm/cpu/armv7/keystone/init.c new file +2 -0
+				if (err < 0)
+					printf("error deleting linux,initrd-start\n");

Here and elsewhere, puts when we aren't using format chars.

boards.cfg

Quoted 4 lines
boards.cfg +0 -0
index a8336cc..1690315 100644

Please make sure that the entry is correctly sorted, see the top of boards.cfg.

boards.cfg line 10

Quoted 12 lines

+++ b/include/configs/k2hk_evm.h

boards.cfg +10 -0
@@ -0,0 +1,221 @@
+/*
+ * Configuration header file for TI's k2hk-evm
+ *
+ * (C) Copyright 2012-2014
+ *     Texas Instruments Incorporated, <www.ti.com>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef __CONFIG_H

Please use __CONFIG_K2HK_EVM_H

boards.cfg line 13

Quoted 3 lines
boards.cfg +3 -0
+/* Platform type */
+#define CONFIG_SOC_K2HK
+#define CONFIG_K2HK_EVM

Make sure we use these.

boards.cfg line 16

Quoted 3 lines
boards.cfg +3 -0
+
+/* U-Boot Build Configuration */
+#define CONFIG_SKIP_LOWLEVEL_INIT	/* U-Boot is a 2nd stage loader */

So there's a level before SPL that is doing a certain amount of init we don't want to re-do?

boards.cfg line 17

Quoted 1 line
boards.cfg +1 -0
+#define CONFIG_SYS_DCACHE_OFF

Really?

boards.cfg line 18

Quoted 1 line
boards.cfg +1 -0
+#define CONFIG_SYS_MALLOC_LEN		(1024 << 10)	/* 1 MiB */

This is pretty small, especially since we care about UBI.

boards.cfg line 20

Quoted 2 lines
boards.cfg +2 -0
+#define CONFIG_SYS_MEMTEST_START	CONFIG_SYS_SDRAM_BASE
+#define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_SDRAM_BASE + 32 << 20)

Please see doc/README.memory-test

boards.cfg line 24

Quoted 4 lines
boards.cfg +4 -0
+/* SPL SPI Loader Configuration */
+#define CONFIG_SPL_TEXT_BASE		0x0c200000
+#define CONFIG_SPL_PAD_TO		65536
+#define CONFIG_SPL_MAX_SIZE		(CONFIG_SPL_PAD_TO - 8)

Please explain this a bit more, esp since SPL_PAD_TO should take into account the header size already...

boards.cfg line 27

Quoted 3 lines
boards.cfg +3 -0
+#define CONFIG_SPL_BSS_START_ADDR	(CONFIG_SPL_TEXT_BASE +		\
+					 CONFIG_SPL_MAX_SIZE)
+#define CONFIG_SPL_BSS_MAX_SIZE		(32 * 1024)

Do we really want SPL BSS in early ram (I don't want to get the name of the type wrong) rather than DDR?

boards.cfg line 30

Quoted 3 lines
boards.cfg +3 -0
+#define CONFIG_SYS_SPL_MALLOC_START	(CONFIG_SPL_BSS_START_ADDR +	\
+					 CONFIG_SPL_BSS_MAX_SIZE)
+#define CONFIG_SYS_SPL_MALLOC_SIZE	(32 * 1024)

Same.

boards.cfg line 31

Quoted 1 line
boards.cfg +1 -0
+#define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200 }

Please use the default table.

boards.cfg line 36

Quoted 5 lines
boards.cfg +5 -0
+#define PART_BOOT			"1024k(bootloader)ro,"
+#define PART_PARAMS			"512k(params)ro,"
+#define PART_UBI			"-(ubifs)"
+#define MTDPARTS_DEFAULT		"mtdparts=davinci_nand.0:"	\
+					PART_BOOT PART_PARAMS PART_UBI

Please just set these outright.

boards.cfg line 39

Quoted 3 lines
boards.cfg +3 -0
+/* U-Boot command configuration */
+#include <config_cmd_default.h>
+#undef CONFIG_CMD_BDI

Why?

boards.cfg line 40

Quoted 1 line
boards.cfg +1 -0
+#undef CONFIG_CMD_FLASH

Shouldn't be needed.

boards.cfg line 42

Quoted 2 lines
boards.cfg +2 -0
+#undef CONFIG_CMD_FPGA
+#undef CONFIG_CMD_SETGETDCR

Same.

boards.cfg line 43

Quoted 1 line
boards.cfg +1 -0
+#define CONFIG_SYS_PROMPT_HUSH_PS2	"> "

Not needed.

boards.cfg line 44

Quoted 1 line
boards.cfg +1 -0
+	"fdt_high=0xffffffff\0"						\

Please don't do this, set it to the top of kernel low mem.

boards.cfg line 46

Quoted 2 lines
boards.cfg +2 -0
+	"mtdparts=mtdparts=davinci_nand.0:"				\
+		"1024k(bootloader)ro,512k(params)ro,522752k(ubifs)\0"

Now you're not using the mtdparts you define, this shouldn't be needed.

boards.cfg line 49

Quoted 3 lines
boards.cfg +3 -0
+/* Linux interfacing */
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_SETUP_MEMORY_TAGS

OF/FDT things should be down here.

boards.cfg line 50

Quoted 1 line
boards.cfg +1 -0
+#define LINUX_BOOT_PARAM_ADDR		(CONFIG_SYS_SDRAM_BASE + 0x100)

Just use this in the code.

Thanks!

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

PATCH v2 8/12 k2hk: add support for k2hk SOC and EVM

Makefile +16 -0
index 47a03e3..ea2a387 100644
@@ -491,6 +491,23 @@ $(obj)u-boot.spr:	$(obj)u-boot.img $(obj)spl/u-boot-spl.bin
  			--pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff $@
  		cat $(obj)u-boot.img >> $@
  
+$(obj)u-boot-spi.gph:	$(obj)u-boot.img $(obj)spl/u-boot-spl.bin
+		$(obj)tools/mkimage -A $(ARCH) -T gpimage -C none \
+			-a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) \
+			-n SPL -d $(obj)spl/u-boot-spl.bin $(obj)spl/u-boot-spl.gph
+		$(OBJCOPY) ${OBJCFLAGS} -I binary \
+			--pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0 -O binary \
+			$(obj)spl/u-boot-spl.gph $(obj)spl/u-boot-spl-pad.gph
+		cat $(obj)spl/u-boot-spl-pad.gph $(obj)u-boot.img > $@
+
+$(obj)u-boot-nand.gph:	$(obj)u-boot.bin
+		$(obj)tools/mkimage -A $(ARCH) -T gpimage -C none \
+			-a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) \
+			-n U-Boot -d $(obj)u-boot.bin $(obj)gph-u-boot.bin
+		@dd if=/dev/zero of=$(obj)zero.bin bs=8 count=1 2>/dev/null
+		@cat $(obj)gph-u-boot.bin $(obj)zero.bin > $@
+		@rm $(obj)zero.bin
 
Quoted 2 lines

First, these need re-writing for Kbuild. Second, we don't ever use u-boot-nand.gph or talk about it in the README, do we?

Tom,

Will remove remove u-boot-nand.gph for time being as we didn't verify nand boot in this
series. What you mean by re-writing for kbuild. The u-boot-spi.gph target is added similar to
existing u-boot-spr (see just above this target). Could you provide an example?

Murali

#23 lore raw

PATCH v2 8/12 k2hk: add support for k2hk SOC and EVM

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 29 lines · Murali Karicheri
Makefile +0 -0
index 47a03e3..ea2a387 100644
@@ -491,6 +491,23 @@ $(obj)u-boot.spr:    $(obj)u-boot.img

$(obj)spl/u-boot-spl.bin

             --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0xff $@
         cat $(obj)u-boot.img >> $@

+$(obj)u-boot-spi.gph: $(obj)u-boot.img $(obj)spl/u-boot-spl.bin

Makefile +15 -0
+        $(obj)tools/mkimage -A $(ARCH) -T gpimage -C none \
+            -a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) \
+            -n SPL -d $(obj)spl/u-boot-spl.bin $(obj)spl/u-boot-spl.gph
+        $(OBJCOPY) ${OBJCFLAGS} -I binary \
+            --pad-to=$(CONFIG_SPL_PAD_TO) --gap-fill=0 -O binary \
+            $(obj)spl/u-boot-spl.gph $(obj)spl/u-boot-spl-pad.gph
+        cat $(obj)spl/u-boot-spl-pad.gph $(obj)u-boot.img > $@
+
+$(obj)u-boot-nand.gph:    $(obj)u-boot.bin
+        $(obj)tools/mkimage -A $(ARCH) -T gpimage -C none \
+            -a $(CONFIG_SYS_TEXT_BASE) -e $(CONFIG_SYS_TEXT_BASE) \
+            -n U-Boot -d $(obj)u-boot.bin $(obj)gph-u-boot.bin
+        @dd if=/dev/zero of=$(obj)zero.bin bs=8 count=1 2>/dev/null
+        @cat $(obj)gph-u-boot.bin $(obj)zero.bin > $@
+        @rm $(obj)zero.bin
Quoted 3 lines

First, these need re-writing for Kbuild. Second, we don't ever use u-boot-nand.gph or talk about it in the README, do we?

Quoted 8 lines

Tom,

Will remove remove u-boot-nand.gph for time being as we didn't verify nand boot in this
series. What you mean by re-writing for kbuild. The u-boot-spi.gph target is added similar to
existing u-boot-spr (see just above this target). Could you provide an example?

Yes, look at how u-boot.spr looks on master now. Things have changed a good bit and this needs updating again.

- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJTFMoGAAoJENk4IS6UOR1WlpIP/Rkbl9ejGjmlvUcFQ6klnrNH ztie7jDThbxqlnGJJJVCALCf5sWgI/W5X/IaiFtBJsAF2JE0h8HaCQjvjBU2r0vq HSXMzBMfXXURrgbtuU8OcrkG8CUN93rQj06Q3hDNSej2cIQAuZt685G3svQ//Jnw rvhg3rnnXFK/ypEE20ZT1bETlH76e/RAZXd/V897j53j4rnWzonQisF0P1C9Nguu DRdH0DPQ4VaDfQ8MHAG9M0L79mSFFaDS6o9fkipEiPJjwYjoI5CNbzcd9jszcWhw fQtkTl1B7tiD7Aqd48apytOvjO8RSrGyJ1ntdOCvnqlemvACMMO/RoWqJtOnZLD/ 6PhPIN4ewYPoWop5Hf8fgSAvaYEQW7s5TnB6KKnk3MTixCtzdFOywoAqAhxZAV6p eOglTRQ81rR702fHJBT7uNQrUGIjc6DebjtcJkEZmWNoT8TZAvpXXIqLu/3PeFna U/Ppfq2C4SUyRXf365aODGicKhkEuRi1XseluytvHFHL3/sJZgrkRF32+/g3JBv/ haP/MVw4nGSN4dgsb/UQCBxoLHe6wWfXPktYvHN1ne1QUaXzLbHdi7TM4tejfjjS ULjMWpaaOuPPgrkQsleAL20Ctx6oY/aArnXf1qjj+CJ0cU1hnYWOxXoOEDVVjYI+ 5f9FAQtYTSgSV1uvhX9u
=k4+m
-----END PGP SIGNATURE-----

#24 lore raw

PATCH v2 8/12 k2hk: add support for k2hk SOC and EVM

In reply to Tom Rini

Hi Tom,

Quoted 25 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot- bounces at lists.denx.de] On Behalf Of Rini, Tom
Sent: Tuesday, February 25, 2014 5:12 PM
To: Karicheri, Muralidharan
Cc: Kwok, WingMan; u-boot at lists.denx.de; Nair, Sandeep
Subject: Re: [U-Boot] [U-Boot PATCH v2 08/12] k2hk: add support for k2hk SOC and EVM

Quoted 4 lines · Murali Karicheri

From: Vitaly Andrianov <[email protected]>

k2hk EVM is based on Texas Instruments Keystone2 Hawking/Kepler SoC. Keystone2 SoC has ARM v7 Cortex-A15 MPCore processor. Please refer

the

Quoted 9 lines

ti/k2hk_evm/README for details on the board, build and other information.

This patch add support for keystone architecture and k2hk evm.

[snip]

Quoted 5 lines

include/configs/k2hk_evm.h line 181

Quoted 2 lines
include/configs/k2hk_evm.h new file +1 -0
+	"fdt_high=0xffffffff\0"						\

Please don't do this, set it to the top of kernel low mem.

The EVM may have up to 8GB of DDR and u-boot can see the first 2GB with physical address range 0x80000000-0xffffffff.
If we don't use the "fdt_high" environment variable, u-boot relocates the dtb to the end of that memory, which is outside of the lowmem.

Here is the part of bootlog:
-------------------------------------------------------------
## Flattened Device Tree blob at 87000000
Booting using the fdt blob at 0x87000000 Loading Kernel Image ... OK
OK
Loading Device Tree to ffff1000, end fffffcab ... OK
--------------------------------------------------------------

But K2 lowmem VA starts from 0xc0000000 and has size ~760MB. That corresponds to the physical range 0x80000000-0xaf800000.
That is why we have to use the "fdt_high=0xffffffff" environment variable.

Have I missed something I u-boot memory configuration? Is there a way to tell u-boot to relocate fdt to the end lowmem?

Thanks,
Vitaly

#25 lore raw

PATCH v2 8/12 k2hk: add support for k2hk SOC and EVM

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 35 lines · Vitaly

Hi Tom,

Quoted 25 lines

-----Original Message-----
From: u-boot-bounces at lists.denx.de [mailto:u-boot- bounces at lists.denx.de] On Behalf Of Rini, Tom
Sent: Tuesday, February 25, 2014 5:12 PM
To: Karicheri, Muralidharan
Cc: Kwok, WingMan; u-boot at lists.denx.de; Nair, Sandeep
Subject: Re: [U-Boot] [U-Boot PATCH v2 08/12] k2hk: add support for k2hk SOC and EVM

Quoted 4 lines · Murali Karicheri

From: Vitaly Andrianov <[email protected]>

k2hk EVM is based on Texas Instruments Keystone2 Hawking/Kepler SoC. Keystone2 SoC has ARM v7 Cortex-A15 MPCore processor. Please refer

the

Quoted 9 lines

ti/k2hk_evm/README for details on the board, build and other information.

This patch add support for keystone architecture and k2hk evm.

[snip]

Quoted 5 lines

include/configs/k2hk_evm.h line 181

Quoted 2 lines
include/configs/k2hk_evm.h new file +1 -0
+	"fdt_high=0xffffffff\0"						\

Please don't do this, set it to the top of kernel low mem.

Quoted 4 lines

The EVM may have up to 8GB of DDR and u-boot can see the first 2GB with physical address range 0x80000000-0xffffffff.
If we don't use the "fdt_high" environment variable, u-boot relocates the dtb to the end of that memory, which is outside of the lowmem.

Right.

Quoted 9 lines

Here is the part of bootlog:
-------------------------------------------------------------
## Flattened Device Tree blob at 87000000
Booting using the fdt blob at 0x87000000 Loading Kernel Image ... OK
OK
Loading Device Tree to ffff1000, end fffffcab ... OK
--------------------------------------------------------------

Quoted 6 lines

But K2 lowmem VA starts from 0xc0000000 and has size ~760MB. That corresponds to the physical range 0x80000000-0xaf800000.
That is why we have to use the "fdt_high=0xffffffff" environment variable.

Have I missed something I u-boot memory configuration? Is there a way to tell u-boot to relocate fdt to the end lowmem?

Yes, set fdt_high to 0xaf800000 instead :)

- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJTGMyjAAoJENk4IS6UOR1WGvwP/0uN28wfBHAY3u6reHUv77H4 Xq5OMMxhtS+fOSvUZORBmV22aliFIX7vckshM65KgWQkmxx0fO8zmuVRxUMdXL9R rNGa7azCtQVTwJTvuWDxEhVLxQbIJk+9YuBGGajLG1qDpYBhkAVendpGPGt8FflX YW5pJxMztcRm4bVFZxXZkiqzAwPDc+f/yAYD9VUHnwCImqpTEAcvF7ktUU6QpClr D1DySfhFyV6v0r3/WRVMzsiCmQq5mOkla/dWW0xPp4fl+4trN2sQeM5fusQXd1kR qq2M3hmYRSgo++h9mQDjhKbTmpFi/mRLuYiq0nk90tnAOBH6aOTZoKlpFaqFEO3b /DXq2wUheKs6Y4eE1WtAB99MBkt3u4bLAR1WuVNifdGPgIsUum95WqWQdedKyu4L nGALiBuceykkn0FvvpCa8F8LnF+3BzXY2OmY/VtfwZ3qhcW7/gzaVwPX7rLs035d 1hTJapU9LtmBcDk7Bme4OlTrQczquAo2zfDwKaR3MnPVrDHnwBfsPJ1mWVcWU4dC ATvb8kbLM8TBgKrn/Qsx9DARkeVb+R6/WX99c2bzWtorrVU/oO632B8fDlbi02vi bJVPc/OEMPjB9FHychiDwtBkGCt6pgu3GJ4VVviVmnH50RHKU+sC/DuNg2kmRLmf pXfAZ0dbyhCs0uPnhbS/
=WBxm
-----END PGP SIGNATURE-----

#26 lore raw

PATCH v2 8/12 k2hk: add support for k2hk SOC and EVM

Hi Tom,

[snip]

Quoted 11 lines
Quoted 10 lines
Quoted 5 lines

include/configs/k2hk_evm.h line 181

Quoted 2 lines
include/configs/k2hk_evm.h new file +1 -0
+	"fdt_high=0xffffffff\0"						\

Please don't do this, set it to the top of kernel low mem.

The EVM may have up to 8GB of DDR and u-boot can see the first 2GB with physical address range 0x80000000-0xffffffff.
If we don't use the "fdt_high" environment variable, u-boot relocates the dtb to the end of that memory, which is outside of the lowmem.

[snip]

Quoted 10 lines
Quoted 3 lines

But K2 lowmem VA starts from 0xc0000000 and has size ~760MB. That corresponds to the physical range 0x80000000-0xaf800000. That is why we have to use the "fdt_high=0xffffffff" environment

variable.

Quoted 3 lines

Have I missed something I u-boot memory configuration? Is there a way to tell u-boot to relocate fdt to the end lowmem?

Yes, set fdt_high to 0xaf800000 instead :)

I think there is a bug in the lmb_alloc_base() and this approach doesn't work.

else if (lmbbase < max_addr) {
	base = min(lmbbase + lmbsize, max_addr);
	base = lmb_align_down(base - size, align);
} else

For boards that have DDR@the end of 32 bit address space the (lmbbase + lmbsize) = 0 which is < max_addr.
So, base becomes 0, and moved to the "end of DDR" - size on the next line.

I tried a quick fix in the __lmb_alloc_base() and got the fdt relocated correctly. As I'm not sure that is only one buggy place in the lmb.c I don't want to commit the quick fix. Let's leave the "fdt_high=0xffffffff" in the Keystone2 for awhile and change it later when we fix the bug.

Thanks,
Vitaly

#27 lore raw

PATCH v2 8/12 k2hk: add support for k2hk SOC and EVM

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 35 lines · Vitaly

Hi Tom,

[snip]

Quoted 11 lines
Quoted 10 lines
Quoted 5 lines

include/configs/k2hk_evm.h line 181

Quoted 2 lines
include/configs/k2hk_evm.h new file +1 -0
+	"fdt_high=0xffffffff\0"						\

Please don't do this, set it to the top of kernel low mem.

The EVM may have up to 8GB of DDR and u-boot can see the first 2GB with physical address range 0x80000000-0xffffffff.
If we don't use the "fdt_high" environment variable, u-boot relocates the dtb to the end of that memory, which is outside of the lowmem.

[snip]

Quoted 10 lines
Quoted 3 lines

But K2 lowmem VA starts from 0xc0000000 and has size ~760MB. That corresponds to the physical range 0x80000000-0xaf800000. That is why we have to use the "fdt_high=0xffffffff" environment

variable.

Quoted 3 lines

Have I missed something I u-boot memory configuration? Is there a way to tell u-boot to relocate fdt to the end lowmem?

Yes, set fdt_high to 0xaf800000 instead :)

I think there is a bug in the lmb_alloc_base() and this approach doesn't work.

else if (lmbbase < max_addr) {
	base = min(lmbbase + lmbsize, max_addr);
	base = lmb_align_down(base - size, align);
} else
Quoted 8 lines

For boards that have DDR at the end of 32 bit address space the (lmbbase + lmbsize) = 0 which is < max_addr.
So, base becomes 0, and moved to the "end of DDR" - size on the next line.

I tried a quick fix in the __lmb_alloc_base() and got the fdt relocated correctly. As I'm not sure that is only one buggy place in the lmb.c I don't want to commit the quick fix. Let's leave the "fdt_high=0xffffffff" in the Keystone2 for awhile and change it later when we fix the bug.

If you're committing to look at this later then yes.

- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJTGfjRAAoJENk4IS6UOR1WxBYQAKjH1cWlziYl74cR7FhPINWd WEn7AtPKYLXs47D8dMYvshjrg9kBgjpy3VqDKf23t3yndBUugmznV5MdmSMlx2IQ TuNg0ICqnXt/2NxclKwxtmznohIwx2t8gJ355UP9XzGrr17lf1+WglOvBolI0R0m VjP3eBivHDlfwLHF3MWdLjmCjGn1sVDCng2JuZZIjfoqxGto2UsDllh1CQx2O9js tOeAY+i5cHCag8b5+6jtujZ6GICwQ0vg2qB5XFXeOYAZWY+XTvlGgQCZ27RaspRF pBHhlOH7iftUnKOTGt/HauEnB62TSfSPjan9ww48VA861fAkrpeANjtPz9uZQKwh Hd/Ib0XOHrfKkReerF/C+R2vJjlYBfKeEFCvF+SuZApgIMX6am4gdHWiGgZq45/Q YemR9Exj+KJ4MYZky/a8y2z8cowck+RsnpZozojFiPlNmuvXS+qXZste42nIYTRX puZx4+xogoaLL4HHjOuKR6QlnCSQDvyxPvLPMNw5HbrZ3Eof0Uwxu2omnJpUvx2+ v/xl6gsqcxOZ07Mz7g3sGwsG5HWZPevFK8CZd8xDFQwj/DZo4pAJO7XFj4MZTgaM Tg3bpsvQFugK9yU/F96Uoie0EYCpCsgGPu5moOSPYB4sl8OlkHj0Mw1oq3rpWF77 2bFm9XxAOL/awEM/X2l/
=n9Wd
-----END PGP SIGNATURE-----

#28 lore raw

PATCH v2 8/12 k2hk: add support for k2hk SOC and EVM

In reply to Tom Rini

[snip]

Quoted 11 lines

board/ti/k2hk_evm/README line 56

Quoted 10 lines
board/ti/k2hk_evm/README new file +10 -0
+Build instructions:
+===================
+
+To build u-boot.bin
+  >make k2hk_evm_config
+  >make u-boot-spi.gph
+
+To build u-boot-spi.gph
+  >make k2hk_evm_config
+  >make u-boot-spi.gph

We need to use CONFIG_SPL_TARGET so that make all just works.

I am assuming we need to do

#define CONFIG_SPL_TARGET "u-boot-spi.gph"

and then

./MAKEALL -a arm

will build this image as well. Is that right?

Murali

Quoted 107 lines

board/ti/k2hk_evm/board.c line 178

Quoted 3 lines
board/ti/k2hk_evm/board.c new file +2 -0
+				if (err < 0)
+					printf("error deleting linux,initrd-start\n");

Here and elsewhere, puts when we aren't using format chars.

boards.cfg

Quoted 4 lines
boards.cfg +0 -0
index a8336cc..1690315 100644

Please make sure that the entry is correctly sorted, see the top of boards.cfg.

boards.cfg line 10

Quoted 12 lines

+++ b/include/configs/k2hk_evm.h

boards.cfg +10 -0
@@ -0,0 +1,221 @@
+/*
+ * Configuration header file for TI's k2hk-evm
+ *
+ * (C) Copyright 2012-2014
+ *     Texas Instruments Incorporated, <www.ti.com>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef __CONFIG_H

Please use __CONFIG_K2HK_EVM_H

boards.cfg line 13

Quoted 3 lines
boards.cfg +3 -0
+/* Platform type */
+#define CONFIG_SOC_K2HK
+#define CONFIG_K2HK_EVM

Make sure we use these.

boards.cfg line 16

Quoted 3 lines
boards.cfg +3 -0
+
+/* U-Boot Build Configuration */
+#define CONFIG_SKIP_LOWLEVEL_INIT	/* U-Boot is a 2nd stage loader */

So there's a level before SPL that is doing a certain amount of init we don't want to re-do?

boards.cfg line 17

Quoted 1 line
boards.cfg +1 -0
+#define CONFIG_SYS_DCACHE_OFF

Really?

boards.cfg line 18

Quoted 1 line
boards.cfg +1 -0
+#define CONFIG_SYS_MALLOC_LEN		(1024 << 10)	/* 1 MiB */

This is pretty small, especially since we care about UBI.

boards.cfg line 20

Quoted 2 lines
boards.cfg +2 -0
+#define CONFIG_SYS_MEMTEST_START	CONFIG_SYS_SDRAM_BASE
+#define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_SDRAM_BASE + 32 << 20)

Please see doc/README.memory-test

boards.cfg line 24

Quoted 4 lines
boards.cfg +4 -0
+/* SPL SPI Loader Configuration */
+#define CONFIG_SPL_TEXT_BASE		0x0c200000
+#define CONFIG_SPL_PAD_TO		65536
+#define CONFIG_SPL_MAX_SIZE		(CONFIG_SPL_PAD_TO - 8)

Please explain this a bit more, esp since SPL_PAD_TO should take into account the header size already...

boards.cfg line 27

Quoted 3 lines
boards.cfg +3 -0
+#define CONFIG_SPL_BSS_START_ADDR	(CONFIG_SPL_TEXT_BASE +		\
+					 CONFIG_SPL_MAX_SIZE)
+#define CONFIG_SPL_BSS_MAX_SIZE		(32 * 1024)

Do we really want SPL BSS in early ram (I don't want to get the name of the type wrong) rather than DDR?

boards.cfg line 30

Quoted 3 lines
boards.cfg +3 -0
+#define CONFIG_SYS_SPL_MALLOC_START	(CONFIG_SPL_BSS_START_ADDR +	\
+					 CONFIG_SPL_BSS_MAX_SIZE)
+#define CONFIG_SYS_SPL_MALLOC_SIZE	(32 * 1024)

Same.

boards.cfg line 31

Quoted 1 line
boards.cfg +1 -0
+#define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200 }

Please use the default table.

boards.cfg line 36

Quoted 5 lines
boards.cfg +5 -0
+#define PART_BOOT			"1024k(bootloader)ro,"
+#define PART_PARAMS			"512k(params)ro,"
+#define PART_UBI			"-(ubifs)"
+#define MTDPARTS_DEFAULT		"mtdparts=davinci_nand.0:"	\
+					PART_BOOT PART_PARAMS PART_UBI

Please just set these outright.

boards.cfg line 39

Quoted 3 lines
boards.cfg +3 -0
+/* U-Boot command configuration */
+#include <config_cmd_default.h>
+#undef CONFIG_CMD_BDI

Why?

boards.cfg line 40

Quoted 1 line
boards.cfg +1 -0
+#undef CONFIG_CMD_FLASH

Shouldn't be needed.

boards.cfg line 42

Quoted 2 lines
boards.cfg +2 -0
+#undef CONFIG_CMD_FPGA
+#undef CONFIG_CMD_SETGETDCR

Same.

boards.cfg line 43

Quoted 1 line
boards.cfg +1 -0
+#define CONFIG_SYS_PROMPT_HUSH_PS2	"> "

Not needed.

boards.cfg line 44

Quoted 1 line
boards.cfg +1 -0
+	"fdt_high=0xffffffff\0"						\

Please don't do this, set it to the top of kernel low mem.

boards.cfg line 46

Quoted 2 lines
boards.cfg +2 -0
+	"mtdparts=mtdparts=davinci_nand.0:"				\
+		"1024k(bootloader)ro,512k(params)ro,522752k(ubifs)\0"

Now you're not using the mtdparts you define, this shouldn't be needed.

boards.cfg line 49

Quoted 3 lines
boards.cfg +3 -0
+/* Linux interfacing */
+#define CONFIG_CMDLINE_TAG
+#define CONFIG_SETUP_MEMORY_TAGS

OF/FDT things should be down here.

boards.cfg line 50

Quoted 1 line
boards.cfg +1 -0
+#define LINUX_BOOT_PARAM_ADDR		(CONFIG_SYS_SDRAM_BASE + 0x100)

Just use this in the code.

Thanks!

#29 lore raw

PATCH v2 8/12 k2hk: add support for k2hk SOC and EVM

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 15 lines · Murali Karicheri

[snip]

Quoted 11 lines

board/ti/k2hk_evm/README line 56

Quoted 10 lines
board/ti/k2hk_evm/README new file +10 -0
+Build instructions:
+===================
+
+To build u-boot.bin
+  >make k2hk_evm_config
+  >make u-boot-spi.gph
+
+To build u-boot-spi.gph
+  >make k2hk_evm_config
+  >make u-boot-spi.gph

We need to use CONFIG_SPL_TARGET so that make all just works.

I am assuming we need to do

Quoted 7 lines

#define CONFIG_SPL_TARGET "u-boot-spi.gph"

and then

./MAKEALL -a arm

will build this image as well. Is that right?

Yes.

- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJTGjnAAAoJENk4IS6UOR1WJyIQAK6bDPHLGoVdi2v+1jktrQ/X H+QTdFvokX9j4gQim7IOIhWvv106N7oeIX7QrCeNieEDPfav1TDMx9vu40DmIiDc o3REaoCzGJ7Vo8kdNIXKwjV7y4tUOjB1q+2b9iqf/p4gJ/OjmQNcbioG9APCIeme cfVZeypANQczMzUfXPGTrZX5GkVOYMFbtkK+pXXckD6XuROWc1CITDXKPjOh1qSt HUQhJA5JtiR72rQvjWXXDsmuGhcYmmSXUQpml/16bBNhb4zxsZxnPB6skv11f0gr kKevhfYREiqAIUmHR888NYB8+PyGsXWoEScYUmzzrFSrZmNH+aUu0gy0/NRaPidg o3dUKun654SbzOXic/Gt/VzFt29ioMmFZAXDHtMwXM+V7V//mhfeQdCDnBgC6ty5 cUtSHsaFmWUuOR3E9IKoeP0Orplf6A8U+wy6swIwmKYPzlEHtI7IL0tweHo/KUyV CYPPBICjJdPconYAN5cV1rQuem+VeBTKTNwtUdXuy9iYk1kwxM3aLi562DVUHBOa oWBi2Aynar4ofFvRqNMYMynJM/ASjs9/nny5jFcxpcvrdzEDlPhcU61mpqEMyBWW 9iJyVN5UV5gJEWf9pofVGdokXl9yZ1YPwjLQF6+KZQwY6qeZhD614yx0MnE9553X 7VOJdxzoPPRazEx3azaB
=25vk
-----END PGP SIGNATURE-----

#30 lore raw

PATCH v2 9/12 keystone2: add keystone multicore navigator driver

In reply to Murali Karicheri

From: Vitaly Andrianov <[email protected]>

Multicore navigator consists of Network Coprocessor (NetCP) and Queue Manager sub system. More details on the hardware can be obtained from the following links:-

Network Coprocessor: http://www.ti.com/lit/pdf/sprugz6
Multicore Navigator: http://www.ti.com/lit/pdf/sprugr9

Multicore navigator driver implements APIs to configure the Queue Manager and NetCP Pkt DMA.

---
- Updated based on review comments

 arch/arm/cpu/armv7/keystone/Makefile              |    1 +
 arch/arm/cpu/armv7/keystone/keystone_nav.c        |  376 +++++++++++++++++++++
 arch/arm/include/asm/arch-keystone/keystone_nav.h |  193 +++++++++++
 3 files changed, 570 insertions(+)
 create mode 100644 arch/arm/cpu/armv7/keystone/keystone_nav.c
 create mode 100644 arch/arm/include/asm/arch-keystone/keystone_nav.h
arch/arm/cpu/armv7/keystone/Makefile +1 -0
index 7924cfa..7d0374b 100644
@@ -11,6 +11,7 @@ obj-y	+= psc.o
 obj-y	+= clock.o
 obj-y	+= cmd_clock.o
 obj-y	+= cmd_mon.o
+obj-y	+= keystone_nav.o
 obj-y	+= msmc.o
 obj-$(CONFIG_SPL_BUILD)	+= spl.o
 obj-y	+= ddr3.o
arch/arm/cpu/armv7/keystone/keystone_nav.c new file +376 -0

376 lines not on this page · raw message

arch/arm/include/asm/arch-keystone/keystone_nav.h new file +193 -0

193 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#31 lore raw

PATCH v2 9/12 keystone2: add keystone multicore navigator driver

Quoted 9 lines · Murali Karicheri

From: Vitaly Andrianov <[email protected]>

Multicore navigator consists of Network Coprocessor (NetCP) and Queue Manager sub system. More details on the hardware can be obtained from the following links:-

Network Coprocessor: http://www.ti.com/lit/pdf/sprugz6
Multicore Navigator: http://www.ti.com/lit/pdf/sprugr9

Quoted 6 lines

Multicore navigator driver implements APIs to configure the Queue Manager and NetCP Pkt DMA.

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

PATCH v2 10/12 keystone2: net: add keystone ethernet driver

In reply to Murali Karicheri

From: Vitaly Andrianov <[email protected]>

Ethernet driver configures the CPSW, SGMI and Phy and uses the the Navigator APIs. The driver supports 4 Ethernet ports and can work with only one port at a time.

Port configurations are defined in board.c.

---
- updated based on review comments

 arch/arm/include/asm/arch-keystone/emac_defs.h |  250 +++++++
 board/ti/k2hk_evm/board.c                      |   65 ++
 drivers/net/Makefile                           |    1 +
 drivers/net/keystone_net.c                     |  859 ++++++++++++++++++++++++
 include/configs/k2hk_evm.h                     |   38 ++
 5 files changed, 1213 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-keystone/emac_defs.h
 create mode 100644 drivers/net/keystone_net.c
arch/arm/include/asm/arch-keystone/emac_defs.h new file +250 -0
new file mode 100644
index 0000000..9c1c5bc
@@ -0,0 +1,250 @@
+/*
+ * emac definitions for keystone2 devices
+ *
+ * (C) Copyright 2012-2014
+ *     Texas Instruments Incorporated, <www.ti.com>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef _EMAC_DEFS_H_
+#define _EMAC_DEFS_H_
+
+#include <asm/arch/hardware.h>
+#include <asm/io.h>
+
+#define DEVICE_REG32_R(a)			readl(a)
+#define DEVICE_REG32_W(a, v)			writel(v, a)
+
+/*#define chipLmbd(x,y) _lmbd(x,y) */
+
+#define EMAC_EMACSL_BASE_ADDR		(KS2_PASS_BASE + 0x00090900)
+#define EMAC_MDIO_BASE_ADDR		(KS2_PASS_BASE + 0x00090300)
+#define EMAC_SGMII_BASE_ADDR		(KS2_PASS_BASE + 0x00090100)
+
+#define KEYSTONE2_EMAC_GIG_ENABLE
+
+#define MAC_ID_BASE_ADDR		(KS2_DEVICE_STATE_CTRL_BASE + 0x110)
+
+#ifdef CONFIG_SOC_K2HK
+/* MDIO module input frequency */
+#define EMAC_MDIO_BUS_FREQ		(clk_get_rate(pass_pll_clk))
+/* MDIO clock output frequency */
+#define EMAC_MDIO_CLOCK_FREQ		1000000		/* 1.0 MHz */
+#endif
+
+/* MII Status Register */
+#define MII_STATUS_REG			1
+#define MII_STATUS_LINK_MASK		(0x4)
+
+/* Marvell 88E1111 PHY ID */
+#define PHY_MARVELL_88E1111		(0x01410cc0)
+
+#define MDIO_CONTROL_IDLE		(0x80000000)
+#define MDIO_CONTROL_ENABLE		(0x40000000)
+#define MDIO_CONTROL_FAULT_ENABLE	(0x40000)
+#define MDIO_CONTROL_FAULT		(0x80000)
+#define MDIO_USERACCESS0_GO		(0x80000000)
+#define MDIO_USERACCESS0_WRITE_READ	(0x0)
+#define MDIO_USERACCESS0_WRITE_WRITE	(0x40000000)
+#define MDIO_USERACCESS0_ACK		(0x20000000)
+
+#define EMAC_MACCONTROL_MIIEN_ENABLE		(0x20)
+#define EMAC_MACCONTROL_FULLDUPLEX_ENABLE	(0x1)
+#define EMAC_MACCONTROL_GIGABIT_ENABLE		(1 << 7)
+#define EMAC_MACCONTROL_GIGFORCE		(1 << 17)
+#define EMAC_MACCONTROL_RMIISPEED_100		(1 << 15)
+
+#define EMAC_MIN_ETHERNET_PKT_SIZE	60
+
+struct mac_sl_cfg {
+	u_int32_t max_rx_len;	/* Maximum receive packet length. */
+	u_int32_t ctl;		/* Control bitfield */
+};
+
+/*
+ * Definition: Control bitfields used in the ctl field of hwGmacSlCfg_t
+ */
+#define GMACSL_RX_ENABLE_RCV_CONTROL_FRAMES       (1 << 24)
+#define GMACSL_RX_ENABLE_RCV_SHORT_FRAMES         (1 << 23)
+#define GMACSL_RX_ENABLE_RCV_ERROR_FRAMES         (1 << 22)
+#define GMACSL_RX_ENABLE_EXT_CTL                  (1 << 18)
+#define GMACSL_RX_ENABLE_GIG_FORCE                (1 << 17)
+#define GMACSL_RX_ENABLE_IFCTL_B                  (1 << 16)
+#define GMACSL_RX_ENABLE_IFCTL_A                  (1 << 15)
+#define GMACSL_RX_ENABLE_CMD_IDLE                 (1 << 11)
+#define GMACSL_TX_ENABLE_SHORT_GAP                (1 << 10)
+#define GMACSL_ENABLE_GIG_MODE                    (1 <<  7)
+#define GMACSL_TX_ENABLE_PACE                     (1 <<  6)
+#define GMACSL_ENABLE                             (1 <<  5)
+#define GMACSL_TX_ENABLE_FLOW_CTL                 (1 <<  4)
+#define GMACSL_RX_ENABLE_FLOW_CTL                 (1 <<  3)
+#define GMACSL_ENABLE_LOOPBACK                    (1 <<  1)
+#define GMACSL_ENABLE_FULL_DUPLEX                 (1 <<  0)
+
+/*
+ * DEFINTITION: function return values
+ */
+#define GMACSL_RET_OK                        0
+#define GMACSL_RET_INVALID_PORT             -1
+#define GMACSL_RET_WARN_RESET_INCOMPLETE    -2
+#define GMACSL_RET_WARN_MAXLEN_TOO_BIG      -3
+#define GMACSL_RET_CONFIG_FAIL_RESET_ACTIVE -4
+
+/* Register offsets */
+#define CPGMACSL_REG_ID         0x00
+#define CPGMACSL_REG_CTL        0x04
+#define CPGMACSL_REG_STATUS     0x08
+#define CPGMACSL_REG_RESET      0x0c
+#define CPGMACSL_REG_MAXLEN     0x10
+#define CPGMACSL_REG_BOFF       0x14
+#define CPGMACSL_REG_RX_PAUSE   0x18
+#define CPGMACSL_REG_TX_PAURSE  0x1c
+#define CPGMACSL_REG_EM_CTL     0x20
+#define CPGMACSL_REG_PRI        0x24
+
+/* Soft reset register values */
+#define CPGMAC_REG_RESET_VAL_RESET_MASK      (1 << 0)
+#define CPGMAC_REG_RESET_VAL_RESET           (1 << 0)
+
+/* Maxlen register values */
+#define CPGMAC_REG_MAXLEN_LEN                0x3fff
+
+/* Control bitfields */
+#define CPSW_CTL_P2_PASS_PRI_TAGGED     (1 << 5)
+#define CPSW_CTL_P1_PASS_PRI_TAGGED     (1 << 4)
+#define CPSW_CTL_P0_PASS_PRI_TAGGED     (1 << 3)
+#define CPSW_CTL_P0_ENABLE              (1 << 2)
+#define CPSW_CTL_VLAN_AWARE             (1 << 1)
+#define CPSW_CTL_FIFO_LOOPBACK          (1 << 0)
+
+#define DEVICE_CPSW_NUM_PORTS       5                    /* 5 switch ports */
+#define DEVICE_CPSW_BASE            (0x02090800)
+#define target_get_switch_ctl()        CPSW_CTL_P0_ENABLE   /* Enable port 0 */
+#define SWITCH_MAX_PKT_SIZE	9000
+
+/* Register offsets */
+#define CPSW_REG_CTL                0x004
+#define CPSW_REG_STAT_PORT_EN       0x00c
+#define CPSW_REG_MAXLEN             0x040
+#define CPSW_REG_ALE_CONTROL        0x608
+#define CPSW_REG_ALE_PORTCTL(x)     (0x640 + (x)*4)
+
+/* Register values */
+#define CPSW_REG_VAL_STAT_ENABLE_ALL             0xf
+#define CPSW_REG_VAL_ALE_CTL_RESET_AND_ENABLE	((u_int32_t)0xc0000000)
+#define CPSW_REG_VAL_ALE_CTL_BYPASS		((u_int32_t)0x00000010)
+#define CPSW_REG_VAL_PORTCTL_FORWARD_MODE        0x3
+
+#define SGMII_REG_STATUS_LOCK		BIT(4)
+#define	SGMII_REG_STATUS_LINK		BIT(0)
+#define SGMII_REG_STATUS_AUTONEG	BIT(2)
+#define SGMII_REG_CONTROL_AUTONEG	BIT(0)
+#define SGMII_REG_CONTROL_MASTER	BIT(5)
+#define	SGMII_REG_MR_ADV_ENABLE		BIT(0)
+#define	SGMII_REG_MR_ADV_LINK		BIT(15)
+#define	SGMII_REG_MR_ADV_FULL_DUPLEX	BIT(12)
+#define SGMII_REG_MR_ADV_GIG_MODE	BIT(11)
+
+#define SGMII_LINK_MAC_MAC_AUTONEG	0
+#define SGMII_LINK_MAC_PHY		1
+#define SGMII_LINK_MAC_MAC_FORCED	2
+#define SGMII_LINK_MAC_FIBER		3
+#define SGMII_LINK_MAC_PHY_FORCED	4
+
+#define TARGET_SGMII_BASE		KS2_PASS_BASE + 0x00090100
+#define TARGET_SGMII_BASE_ADDRESSES    {KS2_PASS_BASE+0x00090100, \
+					KS2_PASS_BASE+0x00090200, \
+					KS2_PASS_BASE+0x00090400, \
+					KS2_PASS_BASE+0x00090500  }
+
+#define SGMII_OFFSET(x)	((x <= 1) ? (x * 0x100) : ((x * 0x100) + 0x100))
+
+/*
+ * SGMII registers
+ */
+#define SGMII_IDVER_REG(x)    (TARGET_SGMII_BASE + SGMII_OFFSET(x) + 0x000)
+#define SGMII_SRESET_REG(x)   (TARGET_SGMII_BASE + SGMII_OFFSET(x) + 0x004)
+#define SGMII_CTL_REG(x)      (TARGET_SGMII_BASE + SGMII_OFFSET(x) + 0x010)
+#define SGMII_STATUS_REG(x)   (TARGET_SGMII_BASE + SGMII_OFFSET(x) + 0x014)
+#define SGMII_MRADV_REG(x)    (TARGET_SGMII_BASE + SGMII_OFFSET(x) + 0x018)
+#define SGMII_LPADV_REG(x)    (TARGET_SGMII_BASE + SGMII_OFFSET(x) + 0x020)
+#define SGMII_TXCFG_REG(x)    (TARGET_SGMII_BASE + SGMII_OFFSET(x) + 0x030)
+#define SGMII_RXCFG_REG(x)    (TARGET_SGMII_BASE + SGMII_OFFSET(x) + 0x034)
+#define SGMII_AUXCFG_REG(x)   (TARGET_SGMII_BASE + SGMII_OFFSET(x) + 0x038)
+
+#define DEVICE_EMACSL_BASE(x)           (KS2_PASS_BASE + 0x00090900 + (x)*0x040)
+#define DEVICE_N_GMACSL_PORTS           4
+#define DEVICE_EMACSL_RESET_POLL_COUNT  100
+
+#define DEVICE_PSTREAM_CFG_REG_ADDR                 (KS2_PASS_BASE + 0x604)
+
+#ifdef CONFIG_SOC_K2HK
+#define DEVICE_PSTREAM_CFG_REG_VAL_ROUTE_CPPI      0x06060606
+#endif
+
+#define hw_config_streaming_switch() \
+	DEVICE_REG32_W(DEVICE_PSTREAM_CFG_REG_ADDR, \
+		       DEVICE_PSTREAM_CFG_REG_VAL_ROUTE_CPPI);
+
+/* EMAC MDIO Registers Structure */
+struct mdio_regs {
+	dv_reg		VERSION;
+	dv_reg		CONTROL;
+	dv_reg		ALIVE;
+	dv_reg		LINK;
+	dv_reg		LINKINTRAW;
+	dv_reg		LINKINTMASKED;
+	u_int8_t	RSVD0[8];
+	dv_reg		USERINTRAW;
+	dv_reg		USERINTMASKED;
+	dv_reg		USERINTMASKSET;
+	dv_reg		USERINTMASKCLEAR;
+	u_int8_t	RSVD1[80];
+	dv_reg		USERACCESS0;
+	dv_reg		USERPHYSEL0;
+	dv_reg		USERACCESS1;
+	dv_reg		USERPHYSEL1;
+};
+
+/* Ethernet MAC Registers Structure */
+struct emac_regs {
+	dv_reg		IDVER;
+	dv_reg		MACCONTROL;
+	dv_reg		MACSTATUS;
+	dv_reg		SOFT_RESET;
+	dv_reg		RX_MAXLEN;
+	u32		RSVD0;
+	dv_reg		RX_PAUSE;
+	dv_reg		TX_PAUSE;
+	dv_reg		EMCONTROL;
+	dv_reg		PRI_MAP;
+	u32		RSVD1[6];
+};
+
+struct phy_t {
+	char	name[64];
+	int	(*init)(int phy_addr);
+	int	(*is_phy_connected)(int phy_addr);
+	int	(*get_link_speed)(int phy_addr);
+	int	(*auto_negotiate)(int phy_addr);
+};
+
+#define SGMII_ACCESS(port, reg) \
+	*((volatile unsigned int *)(sgmiis[port] + reg))
+
+struct eth_priv_t {
+	char	int_name[32];
+	int	rx_flow;
+	int	phy_addr;
+	int	slave_port;
+	int	sgmii_link_type;
+};
+
+extern struct eth_priv_t eth_priv_cfg[];
+
+int keystone2_emac_initialize(struct eth_priv_t *eth_priv);
+void sgmii_serdes_setup_156p25mhz(void);
+void sgmii_serdes_shutdown(void);
+
+#endif  /* _EMAC_DEFS_H_ */
board/ti/k2hk_evm/board.c +65 -0

77 lines not on this page · raw message

drivers/net/Makefile +1 -0
index 7f9ce90..6005f7e 100644
@@ -30,6 +30,7 @@ obj-$(CONFIG_FTMAC110) += ftmac110.o
 obj-$(CONFIG_FTMAC100) += ftmac100.o
 obj-$(CONFIG_GRETH) += greth.o
 obj-$(CONFIG_INCA_IP_SWITCH) += inca-ip_sw.o
+obj-$(CONFIG_DRIVER_TI_KEYSTONE_NET) += keystone_net.o
 obj-$(CONFIG_DRIVER_KS8695ETH) += ks8695eth.o
 obj-$(CONFIG_KS8851_MLL) += ks8851_mll.o
 obj-$(CONFIG_LAN91C96) += lan91c96.o
drivers/net/keystone_net.c new file +859 -0

859 lines not on this page · raw message

include/configs/k2hk_evm.h +38 -0
index 985db8e..33c7551 100644
@@ -106,6 +106,23 @@
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS  20
 #define CONFIG_ENV_EEPROM_IS_ON_I2C
 
+/* Network Configuration */
+#define CONFIG_ETH_PHY_MARVEL_88E1111
+
+#define CONFIG_DRIVER_TI_KEYSTONE_NET
+#define CONFIG_MII
+#define CONFIG_BOOTP_DEFAULT
+#define CONFIG_BOOTP_DNS
+#define CONFIG_BOOTP_DNS2
+#define CONFIG_BOOTP_SEND_HOSTNAME
+#define CONFIG_NET_RETRY_COUNT		32
+#define CONFIG_NET_MULTI
+#define CONFIG_GET_LINK_STATUS_ATTEMPTS 5
+
+#define CONFIG_SYS_SGMII_REFCLK_MHZ	312
+#define CONFIG_SYS_SGMII_LINERATE_MHZ	1250
+#define	CONFIG_SYS_SGMII_RATESCALE	2
+
 /* NAND Configuration */
 #define CONFIG_NAND_DAVINCI
 #define CONFIG_SYS_NAND_CS		2
@@ -179,24 +196,45 @@
 	"addr_fs=0x82000000\0"						\
 	"addr_ubi=0x82000000\0"						\
 	"fdt_high=0xffffffff\0"						\
+	"name_fdt=uImage-k2hk-evm.dtb\0"				\
+	"name_fs=arago-console-image.cpio.gz\0"				\
+	"name_kern=uImage-keystone-evm.bin\0"				\
+	"name_mon=skern-keystone-evm.bin\0"				\
+	"name_uboot=u-boot-spi-keystone-evm.gph\0"			\
+	"name_ubi=keystone-evm-ubifs.ubi\0"				\
 	"run_mon=mon_install ${addr_mon}\0"				\
 	"run_kern=bootm ${addr_kern} - ${addr_fdt}\0"			\
+	"init_net=run args_all args_net\0"				\
 	"init_ubi=run args_all args_ubi; "				\
 		"ubi part ubifs; ubifsmount boot\0"			\
+	"get_fdt_net=dhcp ${addr_fdt} ${tftp_root}/${name_fdt}\0"	\
 	"get_fdt_ubi=ubifsload ${addr_fdt} ${name_fdt}\0"		\
+	"get_kern_net=dhcp ${addr_kern} ${tftp_root}/${name_kern}\0"	\
 	"get_kern_ubi=ubifsload ${addr_kern} ${name_kern}\0"		\
+	"get_mon_net=dhcp ${addr_mon} ${tftp_root}/${name_mon}\0"	\
 	"get_mon_ubi=ubifsload ${addr_mon} ${name_mon}\0"		\
+	"get_uboot_net=dhcp ${addr_uboot} ${tftp_root}/${name_uboot}\0"	\
 	"burn_uboot=sf probe; sf erase 0 0x100000; "			\
 		"sf write ${addr_uboot} 0 ${filesize}\0"		\
 	"args_all=setenv bootargs console=ttyS0,115200n8 rootwait=1\0"	\
 	"args_ubi=setenv bootargs ${bootargs} rootfstype=ubifs "	\
 		"root=ubi0:rootfs rootflags=sync rw ubi.mtd=2,2048\0"	\
+	"args_net=setenv bootargs ${bootargs} rootfstype=nfs "		\
+		"root=/dev/nfs rw nfsroot=${serverip}:${nfs_root},"	\
+		"${nfs_options} ip=dhcp\0"				\
+	"nfs_options=v3,tcp,rsize=4096,wsize=4096\0"			\
+	"get_fdt_ramfs=dhcp ${addr_fdt} ${tftp_root}/${name_fdt}\0"	\
+	"get_kern_ramfs=dhcp ${addr_kern} ${tftp_root}/${name_kern}\0"	\
+	"get_mon_ramfs=dhcp ${addr_mon} ${tftp_root}/${name_mon}\0"	\
+	"get_fs_ramfs=dhcp ${addr_fs} ${tftp_root}/${name_fs}\0"	\
+	"get_ubi_net=dhcp ${addr_ubi} ${tftp_root}/${name_ubi}\0"	\
 	"burn_ubi=nand erase.part ubifs; "				\
 		"nand write ${addr_ubi} ubifs ${filesize}\0"		\
 	"init_ramfs=run args_all args_ramfs get_fs_ramfs\0"		\
 	"args_ramfs=setenv bootargs ${bootargs} earlyprintk "		\
 		"rdinit=/sbin/init rw root=/dev/ram0 "			\
 		"initrd=0x802000000,9M\0"				\
+	"no_post=1\0"							\
 	"mtdparts=mtdparts=davinci_nand.0:"				\
 		"1024k(bootloader)ro,512k(params)ro,522752k(ubifs)\0"
 #define CONFIG_BOOTCOMMAND						\
Signature · 1 line
1.7.9.5
#33 lore raw

PATCH v2 10/12 keystone2: net: add keystone ethernet driver

Quoted 5 lines · Murali Karicheri

From: Vitaly Andrianov <[email protected]>

Ethernet driver configures the CPSW, SGMI and Phy and uses the the Navigator APIs. The driver supports 4 Ethernet ports and can work with only one port at a time.

First, can we just use things in a "dumb" mode and use the existing CPSW driver? Or are there use cases we need to worry about here with a bigger / more robust network driver?

Quoted 5 lines

Port configurations are defined in board.c.

[snip]

Quoted 1 line

+/*#define chipLmbd(x,y) _lmbd(x,y) */

Don't add unused code.

arch/arm/include/asm/arch-keystone/emac_defs.h line 41

Quoted 2 lines
arch/arm/include/asm/arch-keystone/emac_defs.h new file +2 -0
+/* Marvell 88E1111 PHY ID */
+#define PHY_MARVELL_88E1111		(0x01410cc0)

More on this later.

arch/arm/include/asm/arch-keystone/emac_defs.h line 193

Quoted 4 lines
arch/arm/include/asm/arch-keystone/emac_defs.h new file +4 -0
+/* EMAC MDIO Registers Structure */
+struct mdio_regs {
+	dv_reg		VERSION;
+	dv_reg		CONTROL;

Why caps?

Quoted 1 line

+++ b/drivers/net/keystone_net.c

Generic problem, please use phylib.

Quoted 1 line

+#define debug_emac(fmt, args...) if (emac_dbg) printf(fmt, ##args)

We have debug() already.

drivers/net/keystone_net.c line 29

Quoted 5 lines
drivers/net/keystone_net.c new file +5 -0
+#ifdef KEYSTONE2_EMAC_GIG_ENABLE
+#define emac_gigabit_enable(x)	keystone2_eth_gigabit_enable(x)
+#else
+#define emac_gigabit_enable(x)	/* no gigabit to enable */
+#endif

Do we need to do this?

drivers/net/keystone_net.c line 70

Quoted 7 lines
drivers/net/keystone_net.c new file +7 -0
+static void chip_delay(u32 del)
+{
+	volatile unsigned int i;
+
+	for (i = 0; i < (del / 8); i++)
+		;
+}

Use one of the generic delays please.

drivers/net/keystone_net.c line 163

Quoted 2 lines
drivers/net/keystone_net.c new file +2 -0
+/* PHY functions for a generic PHY */
+static int __attribute__((unused)) gen_init_phy(int phy_addr)

Why are we adding tons of functions that we mark as unused?

drivers/net/keystone_net.c line 326

Quoted 6 lines
drivers/net/keystone_net.c new file +6 -0
+#if CONFIG_GET_LINK_STATUS_ATTEMPTS > 1
+	int j;
+
+	for (j = 0; (j < CONFIG_GET_LINK_STATUS_ATTEMPTS) && (link_state == 0);
+	     j++) {
+#endif

New config option, do we really need this as an option?

drivers/net/keystone_net.c line 735

Quoted 5 lines
drivers/net/keystone_net.c new file +5 -0
+void sgmii_serdes_setup_156p25mhz()
+{
+	unsigned int cnt;
+
+	reg_rmw(0x0232a000, 0x00800000, 0xffff0000);

Please comment on what we're doing here, and why we aren't using a struct to describe whatever is at 0x0232a000 ?

drivers/net/keystone_net.c line 847

Quoted 3 lines
drivers/net/keystone_net.c new file +3 -0
+void sgmii_serdes_shutdown()
+{
+	reg_rmw(0x0232bfe0, 0, 3 << 29 | 3 << 13);

Same.

Thanks!

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

PATCH v2 10/12 keystone2: net: add keystone ethernet driver

Quoted 10 lines · Tom
Quoted 5 lines · Murali Karicheri

From: Vitaly Andrianov <[email protected]>

Ethernet driver configures the CPSW, SGMI and Phy and uses the the Navigator APIs. The driver supports 4 Ethernet ports and can work with only one port at a time.

First, can we just use things in a "dumb" mode and use the existing CPSW driver? Or are there use cases we need to worry about here with a bigger / more robust network driver?

First of all we believe the CPSW driver in u-boot is for tnetv107x CPSW hardware and
keystone CPSW is different and more complex. We need to support different modes
such as MAC to PHY, MAC to MAC and MAC to MAC forced. Also we are using a SGMII
with up to 8 ports in the newer K2 devices. So we don't think we can re-use the CPSW
driver.

Quoted 2 lines
Quoted 1 line

+++ b/drivers/net/keystone_net.c

Generic problem, please use phylib.

Vitaly has done some prototyping with phy lib and found that this adds tons of code and
huge time to change the active port. It doesn't give any advantage of using phylib as the
driver make only very few reads from standard generic phy registers.

keystone driver has to support phy-less mode (different modes listed above) and using the
phylib just unnecessary complicates the driver. So

Does phylib based drivers have similar scenario as in keystone? How does other platforms
that uses phylib solves the above issues? Mainly delayed tftp and handling multiple modes?

We have taken care of all of comments here. So can we go with the current version of the
driver and then switch to phylib implementation if the above issues can be solved on a
phylib based implementation?

Quoted 8 lines

drivers/net/keystone_net.c line 735

Quoted 5 lines
drivers/net/keystone_net.c new file +5 -0
+void sgmii_serdes_setup_156p25mhz()
+{
+	unsigned int cnt;
+
+	reg_rmw(0x0232a000, 0x00800000, 0xffff0000);

Please comment on what we're doing here, and why we aren't using a struct to describe whatever is at 0x0232a000 ?

Quoted 4 lines

drivers/net/keystone_net.c line 847

Quoted 3 lines
drivers/net/keystone_net.c new file +3 -0
+void sgmii_serdes_shutdown()
+{
+	reg_rmw(0x0232bfe0, 0, 3 << 29 | 3 << 13);

Same.

We will add comment here as we are using third party SERDES IP and the register
names are not published by the vendor.

Quoted 2 lines

Thanks!

#35 lore raw

PATCH v2 10/12 keystone2: net: add keystone ethernet driver

Quoted 8 lines · Murali Karicheri
Quoted 7 lines · Tom
Quoted 5 lines · Murali Karicheri

From: Vitaly Andrianov <[email protected]>

Ethernet driver configures the CPSW, SGMI and Phy and uses the the Navigator APIs. The driver supports 4 Ethernet ports and can work with only one port at a time.

Quoted 6 lines
Quoted 3 lines

First, can we just use things in a "dumb" mode and use the existing CPSW driver? Or are there use cases we need to worry about here with a bigger / more robust network driver?

First of all we believe the CPSW driver in u-boot is for tnetv107x CPSW hardware and

No, it's for the am335x and DRA7xx HW.

Quoted 7 lines

keystone CPSW is different and more complex. We need to support different modes
such as MAC to PHY, MAC to MAC and MAC to MAC forced. Also we are using a SGMII
with up to 8 ports in the newer K2 devices. So we don't think we can re-use the CPSW
driver.

How many of these modes do we actually need to support in U-Boot? What usecase(s) do you have for networking in U-Boot? And I assume you're having similar conversations upstreaming the kernel networking driver (which does support am33xx/dra7xx and tnetv107x)..

Quoted 8 lines
Quoted 2 lines
Quoted 1 line

+++ b/drivers/net/keystone_net.c

Generic problem, please use phylib.

Vitaly has done some prototyping with phy lib and found that this adds tons of code and
huge time to change the active port. It doesn't give any advantage of using phylib as the
driver make only very few reads from standard generic phy registers.

OK.

Quoted 8 lines
Quoted 8 lines

drivers/net/keystone_net.c line 735

Quoted 5 lines
drivers/net/keystone_net.c new file +5 -0
+void sgmii_serdes_setup_156p25mhz()
+{
+	unsigned int cnt;
+
+	reg_rmw(0x0232a000, 0x00800000, 0xffff0000);

Please comment on what we're doing here, and why we aren't using a struct to describe whatever is at 0x0232a000 ?

Quoted 8 lines
Quoted 4 lines

drivers/net/keystone_net.c line 847

Quoted 3 lines
drivers/net/keystone_net.c new file +3 -0
+void sgmii_serdes_shutdown()
+{
+	reg_rmw(0x0232bfe0, 0, 3 << 29 | 3 << 13);

Same.

We will add comment here as we are using third party SERDES IP and the register
names are not published by the vendor.

Please check what you are and are not allowed to say. It's usually the case with NDA'd docs that if you can release code based on the docs it doesn't have to be heavily obsucred and you can say what you're doing.

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

PATCH v2 11/12 spi: davinci: add support for multiple bus and chip select

In reply to Murali Karicheri

From: Rex Chang <[email protected]>

Currently davinci spi driver supports only bus 0 cs 0. This patch allows driver to support bus 1 and bus 2 with configurable number of chip selects. Also defaults are selected in a way to avoid regression on other platforms that uses davinci spi driver and has only one spi bus.

---
 drivers/spi/davinci_spi.c |   62 ++++++++++++++++++++++++++++++++++++++++++---
 drivers/spi/davinci_spi.h |   33 ++++++++++++++++++++++++
 2 files changed, 91 insertions(+), 4 deletions(-)
drivers/spi/davinci_spi.c +58 -4
index e3fb321..c708a04 100644
@@ -23,7 +23,7 @@ void spi_init()
 struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
 			unsigned int max_hz, unsigned int mode)
 {
-	struct davinci_spi_slave	*ds;
+	struct davinci_spi_slave        *ds;
 
 	if (!spi_cs_is_valid(bus, cs))
 		return NULL;
@@ -32,7 +32,27 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
 	if (!ds)
 		return NULL;
 
-	ds->regs = (struct davinci_spi_regs *)CONFIG_SYS_SPI_BASE;
+	ds->slave.bus = bus;
+	ds->slave.cs = cs;
+
+	switch (bus) {
+	case SPI0_BUS:
+		ds->regs = (struct davinci_spi_regs *)SPI0_BASE;
+		break;
+#ifdef CONFIG_SYS_SPI1
+	case SPI1_BUS:
+		ds->regs = (struct davinci_spi_regs *)SPI0_BASE;
+		break;
+#endif
+#ifdef CONFIG_SYS_SPI2
+	case SPI2_BUS:
+		ds->regs = (struct davinci_spi_regs *)SPI2_BASE;
+		break;
+#endif
+	default: /* Invalid bus number */
+		return NULL;
+	}
+
 	ds->freq = max_hz;
 
 	return &ds->slave;
@@ -59,7 +79,7 @@ int spi_claim_bus(struct spi_slave *slave)
 	writel(SPIGCR1_MASTER_MASK | SPIGCR1_CLKMOD_MASK, &ds->regs->gcr1);
 
 	/* CS, CLK, SIMO and SOMI are functional pins */
-	writel((SPIPC0_EN0FUN_MASK | SPIPC0_CLKFUN_MASK |
+	writel(((1 << slave->cs) | SPIPC0_CLKFUN_MASK |
 		SPIPC0_DOFUN_MASK | SPIPC0_DIFUN_MASK), &ds->regs->pc0);
 
 	/* setup format */
@@ -262,9 +282,43 @@ out:
 	return 0;
 }
 
+#ifdef CONFIG_SYS_SPI1
+static int bus1_cs_valid(unsigned int bus, unsigned int cs)
+{
+	if ((bus == SPI1_BUS) && (cs < SPI1_NUM_CS))
+		return 1;
+	return 0;
+}
+#else
+static int bus1_cs_valid(unsigned int bus, unsigned int cs)
+{
+	return 0;
+}
+#endif
+
+#ifdef CONFIG_SYS_SPI2
+static int bus2_cs_valid(unsigned int bus, unsigned int cs)
+{
+	if ((bus == SPI2_BUS) && (cs < SPI2_NUM_CS))
+		return 1;
+	return 0;
+}
+#else
+static int bus2_cs_valid(unsigned int bus, unsigned int cs)
+{
+	return 0;
+}
+#endif
+
 int spi_cs_is_valid(unsigned int bus, unsigned int cs)
 {
-	return bus == 0 && cs == 0;
+	if ((bus == SPI0_BUS) && (cs < SPI0_NUM_CS))
+		return 1;
+	else if (bus1_cs_valid(bus, cs))
+		return 1;
+	else if (bus2_cs_valid(bus, cs))
+		return 1;
+	return 0;
 }
 
 void spi_cs_activate(struct spi_slave *slave)
drivers/spi/davinci_spi.h +33 -0
index 33f69b5..d4612d3 100644
@@ -74,6 +74,39 @@ struct davinci_spi_regs {
 /* SPIDEF */
 #define SPIDEF_CSDEF0_MASK	BIT(0)
 
+#define SPI0_BUS		0
+#define SPI0_BASE		CONFIG_SYS_SPI_BASE
+/*
+ * Define default SPI0_NUM_CS as 1 for existing platforms that uses this
+ * driver. Platform can configure number of CS using CONFIG_SYS_SPI0_NUM_CS
+ * if more than one CS is supported and by defining CONFIG_SYS_SPI0.
+ */
+#ifndef CONFIG_SYS_SPI0
+#define SPI0_NUM_CS		1
+#else
+#define SPI0_NUM_CS		CONFIG_SYS_SPI0_NUM_CS
+#endif
+
+/*
+ * define CONFIG_SYS_SPI1 when platform has spi-1 device (bus #1) and
+ * CONFIG_SYS_SPI1_NUM_CS defines number of CS on this bus
+ */
+#ifdef CONFIG_SYS_SPI1
+#define SPI1_BUS		1
+#define SPI1_NUM_CS		CONFIG_SYS_SPI1_NUM_CS
+#define SPI1_BASE		CONFIG_SYS_SPI1_BASE
+#endif
+
+/*
+ * define CONFIG_SYS_SPI2 when platform has spi-2 device (bus #2) and
+ * CONFIG_SYS_SPI2_NUM_CS defines number of CS on this bus
+ */
+#ifdef CONFIG_SYS_SPI2
+#define SPI2_BUS		2
+#define SPI2_NUM_CS		CONFIG_SYS_SPI2_NUM_CS
+#define SPI2_BASE		CONFIG_SYS_SPI2_BASE
+#endif
+
 struct davinci_spi_slave {
 	struct spi_slave slave;
 	struct davinci_spi_regs *regs;
Signature · 1 line
1.7.9.5
#37 lore raw

PATCH v2 11/12 spi: davinci: add support for multiple bus and chip select

Quoted 20 lines · Murali Karicheri

From: Rex Chang <[email protected]>

Currently davinci spi driver supports only bus 0 cs 0. This patch allows driver to support bus 1 and bus 2 with configurable number of chip selects. Also defaults are selected in a way to avoid regression on other platforms that uses davinci spi driver and has only one spi bus.

---
 drivers/spi/davinci_spi.c |   62 ++++++++++++++++++++++++++++++++++++++++++---
 drivers/spi/davinci_spi.h |   33 ++++++++++++++++++++++++
 2 files changed, 91 insertions(+), 4 deletions(-)
drivers/spi/davinci_spi.c +0 -0
index e3fb321..c708a04 100644

drivers/spi/davinci_spi.c void spi_init() · line 26

Quoted 5 lines
drivers/spi/davinci_spi.c +1 -1
@@ -23,7 +23,7 @@ void spi_init()
 struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
 			unsigned int max_hz, unsigned int mode)
 {
-	struct davinci_spi_slave	*ds;
+	struct davinci_spi_slave        *ds;

Drop this whitespace change please. Then you can add:

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

PATCH v2 12/12 k2hk-evm: add configuration for spi1 and spi2 support

In reply to Murali Karicheri

currently only spi0 is enabled on k2hk evm. This configuration update is needed to enable spi1 and spi2.

---
 include/configs/k2hk_evm.h |    9 +++++++++
 1 file changed, 9 insertions(+)
include/configs/k2hk_evm.h +9 -0
index 33c7551..861010a 100644
@@ -85,7 +85,16 @@
 #define CONFIG_SPI_FLASH
 #define CONFIG_SPI_FLASH_STMICRO
 #define CONFIG_DAVINCI_SPI
+#define CONFIG_SYS_SPI0
 #define CONFIG_SYS_SPI_BASE		K2HK_SPI_BASE
+#define CONFIG_SYS_SPI0_NUM_CS		4
+#define CONFIG_SYS_SPI1
+#define CONFIG_SYS_SPI1_BASE            K2HK_SPI1_BASE
+#define CONFIG_SYS_SPI1_NUM_CS		4
+#define CONFIG_SYS_SPI2
+#define CONFIG_SYS_SPI2_NUM_CS		4
+#define CONFIG_SYS_SPI2_BASE            K2HK_SPI2_BASE
+#define CONFIG_CMD_SPI
 #define CONFIG_SYS_SPI_CLK		clk_get_rate(K2HK_LPSC_EMIF25_SPI)
 #define CONFIG_SF_DEFAULT_SPEED		30000000
 #define CONFIG_ENV_SPI_MAX_HZ		CONFIG_SF_DEFAULT_SPEED
Signature · 1 line
1.7.9.5
#39 lore raw

PATCH v2 12/12 k2hk-evm: add configuration for spi1 and spi2 support

Quoted 4 lines · Murali Karicheri

currently only spi0 is enabled on k2hk evm. This configuration update is needed to enable spi1 and spi2.

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

v2 cover Add support for keystone2 SoC and K2HK EVM

In reply to Murali Karicheri
Quoted 1 line · Murali Karicheri

This patch series add support for keystone2 SoC and K2HK EVM

In general, you ran checkpatch.pl right? I see some '#define<tab>' cases that need manual fixing up as well. Further comments and acks coming.

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

v2 cover Add support for keystone2 SoC and K2HK EVM

Quoted 8 lines

-----Original Message-----
From: Tom Rini [mailto:tom.rini at gmail.com] On Behalf Of Rini, Tom
Sent: Tuesday, February 25, 2014 5:11 PM
To: Karicheri, Muralidharan
Cc: u-boot at lists.denx.de
Subject: Re: [U-Boot] [U-Boot PATCH v2 00/12] Add support for keystone2 SoC and K2HK EVM

Quoted 7 lines
Quoted 1 line · Murali Karicheri

This patch series add support for keystone2 SoC and K2HK EVM

In general, you ran checkpatch.pl right? I see some '#define<tab>' cases that need manual fixing up as well. Further comments and acks coming.

Errors are fixed. However there are some warnings that doesn't make sense and are left as is.

Murali

Quoted 2 lines

--
Tom

#42 lore raw

v2 cover Add support for keystone2 SoC and K2HK EVM

In reply to Tom Rini
Quoted 7 lines · Tom
Quoted 1 line · Murali Karicheri

This patch series add support for keystone2 SoC and K2HK EVM

In general, you ran checkpatch.pl right? I see some '#define<tab>' cases that need manual fixing up as well. Further comments and acks coming.

Tom,

Just want to check with you what you want me to fix for #define <tab>. Generally from
my Linux experience, I have seen #define used with tab. I looked at few header files and
that have this tab in #define. So where this restriction come from? I looked into the
Documentation/CodingStyle in Linux source tree and can't find any rule of not to
use #define <tab>.

Murali

#43 lore raw

v2 cover Add support for keystone2 SoC and K2HK EVM

Quoted 10 lines · Murali Karicheri
Quoted 7 lines · Tom
Quoted 1 line · Murali Karicheri

This patch series add support for keystone2 SoC and K2HK EVM

In general, you ran checkpatch.pl right? I see some '#define<tab>' cases that need manual fixing up as well. Further comments and acks coming.

Tom,

Quoted 9 lines

Just want to check with you what you want me to fix for #define <tab>. Generally from
my Linux experience, I have seen #define used with tab. I looked at few header files and
that have this tab in #define. So where this restriction come from? I looked into the
Documentation/CodingStyle in Linux source tree and can't find any rule of not to
use #define <tab>.

It's a thing here at least that yes, '#define<space>' only, and we do have a few things that need cleaning up.

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

v2 cover Add support for keystone2 SoC and K2HK EVM

In reply to Murali Karicheri
Quoted 139 lines

-----Original Message-----
From: Karicheri, Muralidharan
Sent: Thursday, February 20, 2014 12:55 PM
To: u-boot at lists.denx.de; Rini, Tom
Cc: Karicheri, Muralidharan
Subject: [U-Boot PATCH v2 00/12] Add support for keystone2 SoC and K2HK EVM

This patch series add support for keystone2 SoC and K2HK EVM

Change history:
v2
- Review comments incorporated. Following are major comments addressed
- split network driver to navigator driver + ethernet driver
- replaced register base + offset implemenation with struct based register access implementation
- Added Readme for NAND no subpage write option
- re-use code for davinci i2c driver on keystone2 with updates
- clock-k2hk.c merged to clock.c
- currently keeping board specific getclk() command. See the thread for the rational.
- Added update to davinci spi driver to re-use on keystone

v1
- added separate patch for sorting tools/Makefile entries
- reworked gpimage patch to allow more re-use across omapimage/gpimage
- dropped patch related to ubifs file size
- added keystone SoC and K2HK EVM support

v0
- preparatory patch for keystone

Murali Karicheri (5):
tools: sort the entries in Makefile
tools: mkimage: add support for gpimage format
NAND: DaVinci: allow forced disable of subpage writes i2c, davinci: move i2c_defs.h to the drivers/i2c directory
k2hk-evm: add configuration for spi1 and spi2 support

Rex Chang (1):
spi: davinci: add support for multiple bus and chip select

Vitaly Andrianov (6):
fdt: call ft_board_setup_ex() at the end of image_setup_libfdt()
arm: add support for arch timer
i2c, davinci: add support for multiple i2c buses
k2hk: add support for k2hk SOC and EVM
keystone2: add keystone multicore navigator driver
keystone2: net: add keystone ethernet driver

Makefile                                           |   19 +
README                                             |    5 +
arch/arm/cpu/armv7/keystone/Makefile               |   18 +
arch/arm/cpu/armv7/keystone/aemif.c                |   71 ++
arch/arm/cpu/armv7/keystone/clock.c                |  313 +++++++
arch/arm/cpu/armv7/keystone/cmd_clock.c            |  124 +++
arch/arm/cpu/armv7/keystone/cmd_mon.c              |  131 +++
arch/arm/cpu/armv7/keystone/config.mk              |   15 +
arch/arm/cpu/armv7/keystone/ddr3.c                 |   69 ++
arch/arm/cpu/armv7/keystone/init.c                 |   56 ++
arch/arm/cpu/armv7/keystone/keystone_nav.c         |  376 +++++++++
arch/arm/cpu/armv7/keystone/msmc.c                 |   68 ++
arch/arm/cpu/armv7/keystone/psc.c                  |  238 ++++++
arch/arm/cpu/armv7/keystone/spl.c                  |   45 +
arch/arm/include/asm/arch-davinci/i2c_defs.h       |   71 +-
arch/arm/include/asm/arch-keystone/clock-k2hk.h    |  109 +++
arch/arm/include/asm/arch-keystone/clock.h         |   17 +
arch/arm/include/asm/arch-keystone/clock_defs.h    |  121 +++
arch/arm/include/asm/arch-keystone/emac_defs.h     |  250 ++++++
arch/arm/include/asm/arch-keystone/emif_defs.h     |   73 ++
arch/arm/include/asm/arch-keystone/hardware-k2hk.h |  145 ++++
arch/arm/include/asm/arch-keystone/hardware.h      |  175 ++++
arch/arm/include/asm/arch-keystone/i2c_defs.h      |   17 +
arch/arm/include/asm/arch-keystone/keystone_nav.h  |  193 +++++
arch/arm/include/asm/arch-keystone/nand_defs.h     |   25 +
arch/arm/include/asm/arch-keystone/psc_defs.h      |   90 ++
arch/arm/include/asm/arch-keystone/spl.h           |   12 +
arch/arm/lib/Makefile                              |    1 +
arch/arm/lib/arch_timer.c                          |   58 ++
board/ti/k2hk_evm/Makefile                         |    9 +
board/ti/k2hk_evm/README                           |   56 ++
board/ti/k2hk_evm/board.c                          |  301 +++++++
board/ti/k2hk_evm/ddr3.c                           |  269 ++++++
boards.cfg                                         |    1 +
common/image-fdt.c                                 |    5 +
common/image.c                                     |    1 +
drivers/i2c/davinci_i2c.c                          |  345 ++++----
drivers/i2c/davinci_i2c.h                          |   78 ++
drivers/mtd/nand/davinci_nand.c                    |    3 +
drivers/net/Makefile                               |    1 +
drivers/net/keystone_net.c                         |  859 ++++++++++++++++++++
drivers/serial/ns16550.c                           |    8 +
drivers/spi/davinci_spi.c                          |   62 +-
drivers/spi/davinci_spi.h                          |   33 +
include/configs/k2hk_evm.h                         |  268 ++++++
include/fdt_support.h                              |    1 +
include/image.h                                    |    1 +
tools/Makefile                                     |   20 +-
tools/gpheader.h                                   |   40 +
tools/gpimage-common.c                             |   80 ++
tools/gpimage.c                                    |   77 ++
tools/imagetool.c                                  |    2 +
tools/imagetool.h                                  |    1 +
tools/omapimage.c                                  |  104 +--
tools/omapimage.h                                  |    5 -
55 files changed, 5222 insertions(+), 313 deletions(-)  create mode 100644

arch/arm/cpu/armv7/keystone/Makefile
create mode 100644 arch/arm/cpu/armv7/keystone/aemif.c
create mode 100644 arch/arm/cpu/armv7/keystone/clock.c
create mode 100644 arch/arm/cpu/armv7/keystone/cmd_clock.c
create mode 100644 arch/arm/cpu/armv7/keystone/cmd_mon.c
create mode 100644 arch/arm/cpu/armv7/keystone/config.mk
create mode 100644 arch/arm/cpu/armv7/keystone/ddr3.c
create mode 100644 arch/arm/cpu/armv7/keystone/init.c
create mode 100644 arch/arm/cpu/armv7/keystone/keystone_nav.c
create mode 100644 arch/arm/cpu/armv7/keystone/msmc.c
create mode 100644 arch/arm/cpu/armv7/keystone/psc.c create mode 100644 arch/arm/cpu/armv7/keystone/spl.c create mode 100644 arch/arm/include/asm/arch- keystone/clock-k2hk.h
create mode 100644 arch/arm/include/asm/arch-keystone/clock.h
create mode 100644 arch/arm/include/asm/arch-keystone/clock_defs.h create mode 100644 arch/arm/include/asm/arch-keystone/emac_defs.h create mode 100644 arch/arm/include/asm/arch-keystone/emif_defs.h create mode 100644 arch/arm/include/asm/arch-keystone/hardware-k2hk.h create mode 100644 arch/arm/include/asm/arch-keystone/hardware.h create mode 100644 arch/arm/include/asm/arch-keystone/i2c_defs.h create mode 100644 arch/arm/include/asm/arch-keystone/keystone_nav.h create mode 100644 arch/arm/include/asm/arch-keystone/nand_defs.h create mode 100644 arch/arm/include/asm/arch-keystone/psc_defs.h create mode 100644 arch/arm/include/asm/arch-keystone/spl.h
create mode 100644 arch/arm/lib/arch_timer.c create mode 100644 board/ti/k2hk_evm/Makefile create mode 100644 board/ti/k2hk_evm/README create mode 100644 board/ti/k2hk_evm/board.c create mode 100644 board/ti/k2hk_evm/ddr3.c create mode 100644 drivers/i2c/davinci_i2c.h create mode 100644 drivers/net/keystone_net.c create mode 100644 include/configs/k2hk_evm.h create mode 100644 tools/gpheader.h create mode 100644 tools/gpimage-common.c create mode 100644 tools/gpimage.c

Quoted 2 lines

--
1.7.9.5

Hi,

Please review when you get a chance.

Thanks

Murali Karicheri
Linux Kernel, Software Development

#45 lore raw

v2 cover Add support for keystone2 SoC and K2HK EVM

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 131 lines · Muralidharan
Quoted 131 lines

-----Original Message----- From: Karicheri, Muralidharan Sent:
Thursday, February 20, 2014 12:55 PM To: u-boot at lists.denx.de; Rini, Tom Cc: Karicheri, Muralidharan Subject: [U-Boot PATCH v2 00/12] Add support for keystone2 SoC and K2HK EVM

This patch series add support for keystone2 SoC and K2HK EVM

Change history: v2 - Review comments incorporated. Following are major comments addressed - split network driver to navigator driver + ethernet driver - replaced register base + offset implemenation with struct based register access implementation - Added Readme for NAND no subpage write option - re-use code for davinci i2c driver on keystone2 with updates - clock-k2hk.c merged to clock.c - currently keeping board specific getclk() command. See the thread for the rational. - Added update to davinci spi driver to re-use on keystone

v1 - added separate patch for sorting tools/Makefile entries - reworked gpimage patch to allow more re-use across omapimage/gpimage - dropped patch related to ubifs file size - added keystone SoC and K2HK EVM support

v0 - preparatory patch for keystone

Murali Karicheri (5): tools: sort the entries in Makefile tools:
mkimage: add support for gpimage format NAND: DaVinci: allow forced disable of subpage writes i2c, davinci: move i2c_defs.h to the drivers/i2c directory k2hk-evm: add configuration for spi1 and spi2 support

Rex Chang (1): spi: davinci: add support for multiple bus and chip select

Vitaly Andrianov (6): fdt: call ft_board_setup_ex() at the end of image_setup_libfdt() arm: add support for arch timer i2c,
davinci: add support for multiple i2c buses k2hk: add support for k2hk SOC and EVM keystone2: add keystone multicore navigator driver keystone2: net: add keystone ethernet driver

Makefile                                           |   19 + 
README                                             |    5 + 
arch/arm/cpu/armv7/keystone/Makefile               |   18 + 
arch/arm/cpu/armv7/keystone/aemif.c                |   71 ++ 
arch/arm/cpu/armv7/keystone/clock.c                |  313
+++++++ arch/arm/cpu/armv7/keystone/cmd_clock.c            |  124
+++ arch/arm/cpu/armv7/keystone/cmd_mon.c              |  131
+++ arch/arm/cpu/armv7/keystone/config.mk              |   15 + 
arch/arm/cpu/armv7/keystone/ddr3.c                 |   69 ++ 
arch/arm/cpu/armv7/keystone/init.c                 |   56 ++ 

arch/arm/cpu/armv7/keystone/keystone_nav.c | 376
+++++++++ arch/arm/cpu/armv7/keystone/msmc.c |
68 ++ arch/arm/cpu/armv7/keystone/psc.c | 238
++++++ arch/arm/cpu/armv7/keystone/spl.c | 45
+ arch/arm/include/asm/arch-davinci/i2c_defs.h | 71 +-

arch/arm/include/asm/arch-keystone/clock-k2hk.h    |  109 +++ 
arch/arm/include/asm/arch-keystone/clock.h         |   17 + 
arch/arm/include/asm/arch-keystone/clock_defs.h    |  121 +++ 
arch/arm/include/asm/arch-keystone/emac_defs.h     |  250 ++++++ 
arch/arm/include/asm/arch-keystone/emif_defs.h     |   73 ++ 
arch/arm/include/asm/arch-keystone/hardware-k2hk.h |  145 ++++ 
arch/arm/include/asm/arch-keystone/hardware.h      |  175 ++++ 
arch/arm/include/asm/arch-keystone/i2c_defs.h      |   17 + 
arch/arm/include/asm/arch-keystone/keystone_nav.h  |  193 +++++ 
arch/arm/include/asm/arch-keystone/nand_defs.h     |   25 + 
arch/arm/include/asm/arch-keystone/psc_defs.h      |   90 ++ 
arch/arm/include/asm/arch-keystone/spl.h           |   12 + 
arch/arm/lib/Makefile                              |    1 + 
arch/arm/lib/arch_timer.c                          |   58 ++ 
board/ti/k2hk_evm/Makefile                         |    9 + 
board/ti/k2hk_evm/README                           |   56 ++ 
board/ti/k2hk_evm/board.c                          |  301

+++++++ board/ti/k2hk_evm/ddr3.c | 269
++++++ boards.cfg | 1
+ common/image-fdt.c | 5 +
common/image.c | 1 +
drivers/i2c/davinci_i2c.c | 345
++++---- drivers/i2c/davinci_i2c.h |
78 ++ drivers/mtd/nand/davinci_nand.c | 3
+ drivers/net/Makefile | 1 +
drivers/net/keystone_net.c | 859
++++++++++++++++++++ drivers/serial/ns16550.c

|    8 + drivers/spi/davinci_spi.c                          |
62 +- drivers/spi/davinci_spi.h                          |   33
+ include/configs/k2hk_evm.h                         |  268
++++++ include/fdt_support.h                              |    1
+ include/image.h                                    |    1 + 
tools/Makefile                                     |   20 +- 
tools/gpheader.h                                   |   40 + 
tools/gpimage-common.c                             |   80 ++ 
tools/gpimage.c                                    |   77 ++ 
tools/imagetool.c                                  |    2 + 
tools/imagetool.h                                  |    1 + 
tools/omapimage.c                                  |  104 +-- 
tools/omapimage.h                                  |    5 - 55
files changed, 5222 insertions(+), 313 deletions(-)  create mode

100644 arch/arm/cpu/armv7/keystone/Makefile create mode 100644 arch/arm/cpu/armv7/keystone/aemif.c create mode 100644 arch/arm/cpu/armv7/keystone/clock.c create mode 100644 arch/arm/cpu/armv7/keystone/cmd_clock.c create mode 100644 arch/arm/cpu/armv7/keystone/cmd_mon.c create mode 100644 arch/arm/cpu/armv7/keystone/config.mk create mode 100644 arch/arm/cpu/armv7/keystone/ddr3.c create mode 100644 arch/arm/cpu/armv7/keystone/init.c create mode 100644 arch/arm/cpu/armv7/keystone/keystone_nav.c create mode 100644 arch/arm/cpu/armv7/keystone/msmc.c create mode 100644 arch/arm/cpu/armv7/keystone/psc.c create mode 100644 arch/arm/cpu/armv7/keystone/spl.c create mode 100644 arch/arm/include/asm/arch- keystone/clock-k2hk.h create mode 100644 arch/arm/include/asm/arch-keystone/clock.h create mode 100644 arch/arm/include/asm/arch-keystone/clock_defs.h create mode 100644 arch/arm/include/asm/arch-keystone/emac_defs.h create mode 100644 arch/arm/include/asm/arch-keystone/emif_defs.h create mode 100644 arch/arm/include/asm/arch-keystone/hardware-k2hk.h create mode 100644 arch/arm/include/asm/arch-keystone/hardware.h create mode 100644 arch/arm/include/asm/arch-keystone/i2c_defs.h create mode 100644 arch/arm/include/asm/arch-keystone/keystone_nav.h create mode 100644 arch/arm/include/asm/arch-keystone/nand_defs.h create mode 100644 arch/arm/include/asm/arch-keystone/psc_defs.h create mode 100644 arch/arm/include/asm/arch-keystone/spl.h create mode 100644 arch/arm/lib/arch_timer.c create mode 100644 board/ti/k2hk_evm/Makefile create mode 100644 board/ti/k2hk_evm/README create mode 100644 board/ti/k2hk_evm/board.c create mode 100644 board/ti/k2hk_evm/ddr3.c create mode 100644 drivers/i2c/davinci_i2c.h create mode 100644 drivers/net/keystone_net.c create mode 100644 include/configs/k2hk_evm.h create mode 100644 tools/gpheader.h create mode 100644 tools/gpimage-common.c create mode 100644 tools/gpimage.c

Quoted 5 lines
Quoted 1 line

-- 1.7.9.5

Hi,

Please review when you get a chance.

I believe things have crossed in the ether, more or less.

- --
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJTDR5uAAoJENk4IS6UOR1WLwYP/2ZLO7MI8CaEzmuD+BTgGaPP D/6M/L9OvAV3ksG+kPxBkl/oNEqd1k94WioE1R3CUk9yH8FRG71H45knAIBvGsxb tiSnVGX2t2t4w6Bfy9C89+AufTAkG7CpPmEOQxmzF4leZ3C2BY22EdXYYThcjagk R9GkvWH2+mxYzMuK405acfXvRIYReJwYBqm/OS0HJf5RElUjg7G7Dext7W02to4t oq0U6jTeU4UzqO28xO80OixE3cKYj3hFvXYP+qLph8GZSyvkxSNxy2c01c/enP9y ff3Ra/IKsmTTTMT4A2GfqusZDTYjoAU30MsIaYM6T6UXComr0zE2P97TqNQies67 PYdnsiRJ96gSl9N7GGHb6Khd4Wt7I5w6/hpdEVwrdVLiRRaRG2Fi3WTRR9p0zDpE nDilaSA4QlVuE6TqA33lZHkroOiKMRD1TpU++zPgCZnE6bx/OcTOK9HT0Wl+d7d+ i+le0U9C7ci2nKHaP1N/5z0SNSLVbMNTwkaENTalMyNNxPoYgo1VQA5C1jEzGDrr Tu7zXc2MaG+cz8h5E+QH3e0Ey2UJGvIp+Uj0c4x90cygTpvw1T8WCwX8TQ+8EBOI shcGK0QbxeTu0GLVasJNrM4y3XP5FzTDzKKaVuHXfMkmWMheXgCAi+VqItnPf5jT jaarG+AKZ7rBo8yIpDU9
=fnme
-----END PGP SIGNATURE-----