Skip to contentSkip to conversation

Add support for keystone2 SoC and K2HK EVM

PATCH Superseded Murali Karicheri 4 participants 15 messages Mar 27, 2014 – Apr 1, 2014

Subsystems (6)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v4 cover Add support for keystone2 SoC and K2HK EVM

*** BLURB HERE ***

Murali Karicheri (5):
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
spi: davinci: add support for multiple bus and chip select
k2hk-evm: add configuration for spi1 and spi2 support

Vitaly Andrianov (4):
fdt: call ft_board_setup_ex() at the end of image_setup_libfdt()
arm: add support for arch timer
i2c, davinci: convert driver to new mutlibus/mutliadapter framework
k2hk: add support for k2hk SOC and EVM

 Makefile                                           |   10 +
 README                                             |    5 +
 arch/arm/cpu/arm926ejs/davinci/dm355.c             |    2 +-
 arch/arm/cpu/arm926ejs/davinci/dm365.c             |    2 +-
 arch/arm/cpu/arm926ejs/davinci/dm644x.c            |    2 +-
 arch/arm/cpu/arm926ejs/davinci/dm646x.c            |    2 +-
 arch/arm/cpu/armv7/keystone/Makefile               |   17 +
 arch/arm/cpu/armv7/keystone/aemif.c                |   71 ++++
 arch/arm/cpu/armv7/keystone/clock.c                |  318 ++++++++++++++++
 arch/arm/cpu/armv7/keystone/cmd_clock.c            |  124 ++++++
 arch/arm/cpu/armv7/keystone/cmd_mon.c              |  131 +++++++
 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-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/emif_defs.h     |   73 ++++
 arch/arm/include/asm/arch-keystone/hardware-k2hk.h |  150 ++++++++
 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 +
 arch/arm/lib/Makefile                              |    1 +
 arch/arm/lib/arch_timer.c                          |   58 +++
 board/ti/k2hk_evm/Makefile                         |    9 +
 board/ti/k2hk_evm/README                           |  122 ++++++
 board/ti/k2hk_evm/board.c                          |  236 ++++++++++++
 board/ti/k2hk_evm/ddr3.c                           |  269 +++++++++++++
 boards.cfg                                         |    1 +
 common/image-fdt.c                                 |    5 +
 common/image.c                                     |    1 +
 drivers/i2c/Makefile                               |    2 +-
 drivers/i2c/davinci_i2c.c                          |  402 ++++++++++++--------
 drivers/i2c/davinci_i2c.h                          |   78 ++++
 drivers/mtd/nand/davinci_nand.c                    |    3 +
 drivers/serial/ns16550.c                           |    8 +
 drivers/spi/davinci_spi.c                          |   60 ++-
 drivers/spi/davinci_spi.h                          |   33 ++
 include/configs/cam_enc_4xx.h                      |    8 +-
 include/configs/da830evm.h                         |    8 +-
 include/configs/da850evm.h                         |    8 +-
 include/configs/davinci_dm355evm.h                 |    8 +-
 include/configs/davinci_dm355leopard.h             |    8 +-
 include/configs/davinci_dm365evm.h                 |    8 +-
 include/configs/davinci_dm6467evm.h                |    8 +-
 include/configs/davinci_dvevm.h                    |    8 +-
 include/configs/davinci_schmoogie.h                |    8 +-
 include/configs/davinci_sffsdr.h                   |    8 +-
 include/configs/davinci_sonata.h                   |    8 +-
 include/configs/ea20.h                             |    6 +-
 include/configs/enbw_cmc.h                         |    8 +-
 include/configs/k2hk_evm.h                         |  221 +++++++++++
 include/fdt_support.h                              |    7 +
 include/image.h                                    |    1 +
 tools/Makefile                                     |    2 +
 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 -
 67 files changed, 3563 insertions(+), 387 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/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 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 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 v4 1/9 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.

---
 common/image-fdt.c    |    5 +++++
 include/fdt_support.h |    7 +++++++
 2 files changed, 12 insertions(+)
common/image-fdt.c +5 -0
index a54a919..5d64009 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 (IMAGE_OF_BOARD_SETUP)
+		ft_board_setup_ex(blob, gd->bd);
+#endif
+
 	return 0;
 }
include/fdt_support.h +7 -0
index 9871e2f..15eba01 100644
@@ -63,6 +63,13 @@ int fdt_pci_dma_ranges(void *blob, int phb_off, struct pci_controller *hose);
 #endif
 
 void ft_board_setup(void *blob, bd_t *bd);
+/*
+ * The keystone2 SOC requires all 32 bit aliased addresses to be converted
+ * to their 36 physical format. This has to happen after all fdt nodes
+ * are added or modified by the image_setup_libfdt(). The ft_board_setup_ex()
+ * called at the end of the image_setup_libfdt() is to do that convertion.
+ */
+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 v4 2/9 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

---
 common/image.c         |    1 +
 include/image.h        |    1 +
 tools/Makefile         |    2 +
 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, 220 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 9c6bec5..fcc5a9c 100644
@@ -125,6 +125,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 6afd57b..8095bc8 100644
@@ -215,6 +215,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 +2 -0
index dcd49f8..56587c9 100644
@@ -73,6 +73,8 @@ dumpimage-mkimage-objs := aisimage.o \
 			crc32.o \
 			default_image.o \
 			fit_image.o \
+			gpimage.o \
+			gpimage-common.o \
 			image-fit.o \
 			image-host.o \
 			image.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
#3 lore raw

PATCH v4 3/9 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.

---
 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 45febcf..a1d774a 100644
@@ -41,6 +41,7 @@ obj-$(CONFIG_USE_ARCH_MEMCPY) += memcpy.o
 else
 obj-$(CONFIG_SPL_FRAMEWORK) += spl.o
 endif
+obj-$(CONFIG_SYS_ARCH_TIMER) += arch_timer.o
 
 obj-y	+= sections.o
 ifdef CONFIG_ARM64
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
#4 lore raw

PATCH v4 4/9 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.

---
 README                          |    5 +++++
 drivers/mtd/nand/davinci_nand.c |    3 +++
 2 files changed, 8 insertions(+)
README +5 -0
index ff49260..faec8ef 100644
@@ -4473,6 +4473,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
+		driver that uses 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
#5 lore raw

PATCH v4 5/9 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.

---
 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
#6 lore raw

PATCH v4 6/9 i2c, davinci: convert driver to new mutlibus/mutliadapter framework

In reply to Murali Karicheri

From: Vitaly Andrianov <[email protected]>

- add davinci driver to new multibus/multiadpater support
- adapted all config files, which uses this driver

---
 arch/arm/cpu/arm926ejs/davinci/dm355.c  |    2 +-
 arch/arm/cpu/arm926ejs/davinci/dm365.c  |    2 +-
 arch/arm/cpu/arm926ejs/davinci/dm644x.c |    2 +-
 arch/arm/cpu/arm926ejs/davinci/dm646x.c |    2 +-
 drivers/i2c/Makefile                    |    2 +-
 drivers/i2c/davinci_i2c.c               |  401 ++++++++++++++++++-------------
 drivers/i2c/davinci_i2c.h               |   27 ++-
 include/configs/cam_enc_4xx.h           |    8 +-
 include/configs/da830evm.h              |    8 +-
 include/configs/da850evm.h              |    8 +-
 include/configs/davinci_dm355evm.h      |    8 +-
 include/configs/davinci_dm355leopard.h  |    8 +-
 include/configs/davinci_dm365evm.h      |    8 +-
 include/configs/davinci_dm6467evm.h     |    8 +-
 include/configs/davinci_dvevm.h         |    8 +-
 include/configs/davinci_schmoogie.h     |    8 +-
 include/configs/davinci_sffsdr.h        |    8 +-
 include/configs/davinci_sonata.h        |    8 +-
 include/configs/ea20.h                  |    6 +-
 include/configs/enbw_cmc.h              |    8 +-
 20 files changed, 305 insertions(+), 235 deletions(-)
arch/arm/cpu/arm926ejs/davinci/dm355.c +1 -1
index 5f85162..f9550a1 100644
@@ -19,7 +19,7 @@ void davinci_enable_uart0(void)
 }
 
 
-#ifdef CONFIG_DRIVER_DAVINCI_I2C
+#ifdef CONFIG_SYS_I2C_DAVINCI
 void davinci_enable_i2c(void)
 {
 	lpsc_on(DAVINCI_LPSC_I2C);
arch/arm/cpu/arm926ejs/davinci/dm365.c +1 -1
index 0af2d02..f6ca527 100644
@@ -12,7 +12,7 @@ void davinci_enable_uart0(void)
 	lpsc_on(DAVINCI_LPSC_UART0);
 }
 
-#ifdef CONFIG_DRIVER_DAVINCI_I2C
+#ifdef CONFIG_SYS_I2C_DAVINCI
 void davinci_enable_i2c(void)
 {
 	lpsc_on(DAVINCI_LPSC_I2C);
arch/arm/cpu/arm926ejs/davinci/dm644x.c +1 -1
index 788e578..c58e271 100644
@@ -47,7 +47,7 @@ void davinci_enable_emac(void)
 }
 #endif
 
-#ifdef CONFIG_DRIVER_DAVINCI_I2C
+#ifdef CONFIG_SYS_I2C_DAVINCI
 void davinci_enable_i2c(void)
 {
 	lpsc_on(DAVINCI_LPSC_I2C);
arch/arm/cpu/arm926ejs/davinci/dm646x.c +1 -1
index 86a508f..cfea830 100644
@@ -18,7 +18,7 @@ void davinci_enable_emac(void)
 }
 #endif
 
-#ifdef CONFIG_DRIVER_DAVINCI_I2C
+#ifdef CONFIG_SYS_I2C_DAVINCI
 void davinci_enable_i2c(void)
 {
 	lpsc_on(DAVINCI_DM646X_LPSC_I2C);
drivers/i2c/Makefile +1 -1
index 36d5e5f..fd1cb11 100644
@@ -6,7 +6,7 @@
 #
 
 obj-$(CONFIG_BFIN_TWI_I2C) += bfin-twi_i2c.o
-obj-$(CONFIG_DRIVER_DAVINCI_I2C) += davinci_i2c.o
+obj-$(CONFIG_SYS_I2C_DAVINCI) += davinci_i2c.o
 obj-$(CONFIG_DW_I2C) += designware_i2c.o
 obj-$(CONFIG_I2C_MVTWSI) += mvtwsi.o
 obj-$(CONFIG_I2C_MV) += mv_i2c.o
drivers/i2c/davinci_i2c.c +234 -167

548 lines not on this page · raw message

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 */
 
include/configs/cam_enc_4xx.h +4 -4
index 8182a75..d1a8ff2 100644
@@ -57,10 +57,10 @@
 #define CONFIG_RESET_PHY_R
 
 /* I2C */
-#define CONFIG_HARD_I2C
-#define CONFIG_DRIVER_DAVINCI_I2C
-#define CONFIG_SYS_I2C_SPEED		400000
-#define CONFIG_SYS_I2C_SLAVE		0x10	/* SMBus host address */
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_DAVINCI
+#define CONFIG_SYS_DAVINCI_I2C_SPEED		400000
+#define CONFIG_SYS_DAVINCI_I2C_SLAVE		0x10	/* SMBus host address */
 
 /* NAND: socketed, two chipselects, normally 2 GBytes */
 #define CONFIG_NAND_DAVINCI
include/configs/da830evm.h +4 -4
index c4cc62e..2717195 100644
@@ -55,10 +55,10 @@
 /*
  * I2C Configuration
  */
-#define CONFIG_HARD_I2C
-#define CONFIG_DRIVER_DAVINCI_I2C
-#define CONFIG_SYS_I2C_SPEED		25000 /* 100Kbps won't work, H/W bug */
-#define CONFIG_SYS_I2C_SLAVE		10 /* Bogus, master-only in U-Boot */
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_DAVINCI
+#define CONFIG_SYS_DAVINCI_I2C_SPEED     25000 /* 100Kbps won't work, H/W bug */
+#define CONFIG_SYS_DAVINCI_I2C_SLAVE     10 /* Bogus, master-only in U-Boot */
 
 /*
  * I2C EEPROM definitions for catalyst 24W256 EEPROM chip
include/configs/da850evm.h +4 -4
index 509fe20..860a11d 100644
@@ -166,10 +166,10 @@
 /*
  * I2C Configuration
  */
-#define CONFIG_HARD_I2C
-#define CONFIG_DRIVER_DAVINCI_I2C
-#define CONFIG_SYS_I2C_SPEED		25000
-#define CONFIG_SYS_I2C_SLAVE		10 /* Bogus, master-only in U-Boot */
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_DAVINCI
+#define CONFIG_SYS_DAVINCI_I2C_SPEED		25000
+#define CONFIG_SYS_DAVINCI_I2C_SLAVE   10 /* Bogus, master-only in U-Boot */
 #define CONFIG_SYS_I2C_EXPANDER_ADDR   0x20
 
 /*
include/configs/davinci_dm355evm.h +4 -4
index 6382e75..c2e187e 100644
@@ -41,10 +41,10 @@
 #define DM9000_DATA			(CONFIG_DM9000_BASE + 2)
 
 /* I2C */
-#define CONFIG_HARD_I2C
-#define CONFIG_DRIVER_DAVINCI_I2C
-#define CONFIG_SYS_I2C_SPEED		400000
-#define CONFIG_SYS_I2C_SLAVE		0x10	/* SMBus host address */
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_DAVINCI
+#define CONFIG_SYS_DAVINCI_I2C_SPEED		400000
+#define CONFIG_SYS_DAVINCI_I2C_SLAVE		0x10	/* SMBus host address */
 
 /* NAND: socketed, two chipselects, normally 2 GBytes */
 #define CONFIG_NAND_DAVINCI
include/configs/davinci_dm355leopard.h +4 -4
index 234bbc0..5188fdf 100644
@@ -40,10 +40,10 @@
 #define DM9000_DATA			(CONFIG_DM9000_BASE + 16)
 
 /* I2C */
-#define CONFIG_HARD_I2C
-#define CONFIG_DRIVER_DAVINCI_I2C
-#define CONFIG_SYS_I2C_SPEED		400000
-#define CONFIG_SYS_I2C_SLAVE		0x10
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_DAVINCI
+#define CONFIG_SYS_DAVINCI_I2C_SPEED		400000
+#define CONFIG_SYS_DAVINCI_I2C_SLAVE		0x10
 
 /* NAND */
 #define CONFIG_NAND_DAVINCI
include/configs/davinci_dm365evm.h +4 -4
index b547289..c4fccfd 100644
@@ -49,10 +49,10 @@
 #define CONFIG_NET_RETRY_COUNT	10
 
 /* I2C */
-#define CONFIG_HARD_I2C
-#define CONFIG_DRIVER_DAVINCI_I2C
-#define CONFIG_SYS_I2C_SPEED		400000
-#define CONFIG_SYS_I2C_SLAVE		0x10	/* SMBus host address */
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_DAVINCI
+#define CONFIG_SYS_DAVINCI_I2C_SPEED		400000
+#define CONFIG_SYS_DAVINCI_I2C_SLAVE		0x10	/* SMBus host address */
 
 /* NAND: socketed, two chipselects, normally 2 GBytes */
 #define CONFIG_NAND_DAVINCI
include/configs/davinci_dm6467evm.h +4 -4
index 2132342..8a3c453 100644
@@ -60,10 +60,10 @@ extern unsigned int davinci_arm_clk_get(void);
 #define CONFIG_BAUDRATE			115200
 
 /* I2C Configuration */
-#define CONFIG_HARD_I2C
-#define CONFIG_DRIVER_DAVINCI_I2C
-#define CONFIG_SYS_I2C_SPEED		80000
-#define CONFIG_SYS_I2C_SLAVE		10
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_DAVINCI
+#define CONFIG_SYS_DAVINCI_I2C_SPEED		80000
+#define CONFIG_SYS_DAVINCI_I2C_SLAVE		10
 
 /* Network & Ethernet Configuration */
 #define CONFIG_DRIVER_TI_EMAC
include/configs/davinci_dvevm.h +4 -4
index d8fa646..9b3d0fe 100644
@@ -77,10 +77,10 @@
 /*===================*/
 /* I2C Configuration */
 /*===================*/
-#define CONFIG_HARD_I2C
-#define CONFIG_DRIVER_DAVINCI_I2C
-#define CONFIG_SYS_I2C_SPEED		80000	/* 100Kbps won't work, silicon bug */
-#define CONFIG_SYS_I2C_SLAVE		10	/* Bogus, master-only in U-Boot */
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_DAVINCI
+#define CONFIG_SYS_DAVINCI_I2C_SPEED 80000 /* 100Kbps won't work, silicon bug */
+#define CONFIG_SYS_DAVINCI_I2C_SLAVE 10	/* Bogus, master-only in U-Boot */
 /*==================================*/
 /* Network & Ethernet Configuration */
 /*==================================*/
include/configs/davinci_schmoogie.h +4 -4
index f9a0a76..96c8fe2 100644
@@ -46,10 +46,10 @@
 /*===================*/
 /* I2C Configuration */
 /*===================*/
-#define CONFIG_HARD_I2C
-#define CONFIG_DRIVER_DAVINCI_I2C
-#define CONFIG_SYS_I2C_SPEED		80000	/* 100Kbps won't work, silicon bug */
-#define CONFIG_SYS_I2C_SLAVE		10	/* Bogus, master-only in U-Boot */
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_DAVINCI
+#define CONFIG_SYS_DAVINCI_I2C_SPEED 80000 /* 100Kbps won't work, silicon bug */
+#define CONFIG_SYS_DAVINCI_I2C_SLAVE 10    /* Bogus, master-only in U-Boot */
 /*==================================*/
 /* Network & Ethernet Configuration */
 /*==================================*/
include/configs/davinci_sffsdr.h +4 -4
index 44449df..6e07cce 100644
@@ -42,10 +42,10 @@
 #define CONFIG_CONS_INDEX	1		/* use UART0 for console */
 #define CONFIG_BAUDRATE		115200		/* Default baud rate */
 /* I2C Configuration */
-#define CONFIG_HARD_I2C
-#define CONFIG_DRIVER_DAVINCI_I2C
-#define CONFIG_SYS_I2C_SPEED		80000	/* 100Kbps won't work, silicon bug */
-#define CONFIG_SYS_I2C_SLAVE		10	/* Bogus, master-only in U-Boot */
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_DAVINCI
+#define CONFIG_SYS_DAVINCI_I2C_SPEED 80000 /* 100Kbps won't work, silicon bug */
+#define CONFIG_SYS_DAVINCI_I2C_SLAVE 10    /* Bogus, master-only in U-Boot */
 /* Network & Ethernet Configuration */
 #define CONFIG_DRIVER_TI_EMAC
 #define CONFIG_MII
include/configs/davinci_sonata.h +4 -4
index ac543f8..cd23aac 100644
@@ -78,10 +78,10 @@
 /*===================*/
 /* I2C Configuration */
 /*===================*/
-#define CONFIG_HARD_I2C
-#define CONFIG_DRIVER_DAVINCI_I2C
-#define CONFIG_SYS_I2C_SPEED		80000	/* 100Kbps won't work, silicon bug */
-#define CONFIG_SYS_I2C_SLAVE		10	/* Bogus, master-only in U-Boot */
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_DAVINCI
+#define CONFIG_SYS_DAVINCI_I2C_SPEED 80000 /* 100Kbps won't work, silicon bug */
+#define CONFIG_SYS_DAVINCI_I2C_SLAVE 10    /* Bogus, master-only in U-Boot */
 /*==================================*/
 /* Network & Ethernet Configuration */
 /*==================================*/
include/configs/ea20.h +3 -3
index 58e40ed..f7d46f3 100644
@@ -78,9 +78,9 @@
 /*
  * I2C Configuration
  */
-#define CONFIG_HARD_I2C
-#define CONFIG_DRIVER_DAVINCI_I2C
-#define CONFIG_SYS_I2C_SPEED		100000
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_DAVINCI
+#define CONFIG_SYS_DAVINCI_I2C_SPEED		100000
 
 /*
  * Network & Ethernet Configuration
include/configs/enbw_cmc.h +4 -4
index 03b74a2..30ca95f 100644
@@ -73,10 +73,10 @@
 /*
  * I2C Configuration
  */
-#define CONFIG_HARD_I2C
-#define CONFIG_DRIVER_DAVINCI_I2C
-#define CONFIG_SYS_I2C_SPEED		80000
-#define CONFIG_SYS_I2C_SLAVE		10 /* Bogus, master-only in U-Boot */
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_DAVINCI
+#define CONFIG_SYS_DAVINCI_I2C_SPEED		80000
+#define CONFIG_SYS_DAVINCI_I2C_SLAVE   10 /* Bogus, master-only in U-Boot */
 #define CONFIG_SYS_I2C_EXPANDER_ADDR   0x20
 #define CONFIG_CMD_I2C
 
Signature · 1 line
1.7.9.5
#7 lore raw

PATCH v4 6/9 i2c, davinci: convert driver to new mutlibus/mutliadapter framework

Hello Mruali,

Am 27.03.2014 16:59, schrieb Murali Karicheri:

Quoted 21 lines

From: Vitaly Andrianov<[email protected]>

- add davinci driver to new multibus/multiadpater support
- adapted all config files, which uses this driver

---
  arch/arm/cpu/arm926ejs/davinci/dm355.c  |    2 +-
  arch/arm/cpu/arm926ejs/davinci/dm365.c  |    2 +-
  arch/arm/cpu/arm926ejs/davinci/dm644x.c |    2 +-
  arch/arm/cpu/arm926ejs/davinci/dm646x.c |    2 +-
  drivers/i2c/Makefile                    |    2 +-
  drivers/i2c/davinci_i2c.c               |  401 ++++++++++++++++++-------------
  drivers/i2c/davinci_i2c.h               |   27 ++-
  include/configs/cam_enc_4xx.h           |    8 +-
  include/configs/da830evm.h              |    8 +-
  include/configs/da850evm.h              |    8 +-
  include/configs/davinci_dm355evm.h      |    8 +-
  include/configs/davinci_dm355leopard.h  |    8 +-
  include/configs/davinci_dm365evm.h      |    8 +-
Quoted 8 lines
  include/configs/davinci_dm6467evm.h     |    8 +-
  include/configs/davinci_dvevm.h         |    8 +-
  include/configs/davinci_schmoogie.h     |    8 +-
  include/configs/davinci_sffsdr.h        |    8 +-
  include/configs/davinci_sonata.h        |    8 +-
  include/configs/ea20.h                  |    6 +-
  include/configs/enbw_cmc.h              |    8 +-
  20 files changed, 305 insertions(+), 235 deletions(-)

This is your v4 post ... some sort of history, what has changed would be nice ...

[...]

drivers/i2c/Makefile line 9

Quoted 10 lines
drivers/i2c/Makefile +1 -1
index 36d5e5f..fd1cb11 100644
@@ -6,7 +6,7 @@
  #
 
  obj-$(CONFIG_BFIN_TWI_I2C) += bfin-twi_i2c.o
-obj-$(CONFIG_DRIVER_DAVINCI_I2C) += davinci_i2c.o
+obj-$(CONFIG_SYS_I2C_DAVINCI) += davinci_i2c.o

please keep lists sorted.

drivers/i2c/Makefile line 12

Quoted 3 lines
drivers/i2c/Makefile +0 -0
  obj-$(CONFIG_DW_I2C) += designware_i2c.o
  obj-$(CONFIG_I2C_MVTWSI) += mvtwsi.o
  obj-$(CONFIG_I2C_MV) += mv_i2c.o

[...]

Rest looks Ok for me ... if checkpatch drops no errors and warnings and MAKEALL compiles clean ;-)

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#8 lore raw

PATCH v4 6/9 i2c, davinci: convert driver to new mutlibus/mutliadapter framework

Quoted 10 lines

-----Original Message-----
From: Heiko Schocher [mailto:hs at denx.de]
Sent: Monday, March 31, 2014 1:24 AM
To: Karicheri, Muralidharan
Cc: Rini, Tom; u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH v4 6/9] i2c, davinci: convert driver to new mutlibus/mutliadapter framework

Hello Mruali,

Heiko,

Thanks for reviewing this. See below for my response.

BTW, there is a Typo, it should have been Hello Murali, :)

Quoted 31 lines

Am 27.03.2014 16:59, schrieb Murali Karicheri:

Quoted 21 lines

From: Vitaly Andrianov<[email protected]>

- add davinci driver to new multibus/multiadpater support
- adapted all config files, which uses this driver

---
  arch/arm/cpu/arm926ejs/davinci/dm355.c  |    2 +-
  arch/arm/cpu/arm926ejs/davinci/dm365.c  |    2 +-
  arch/arm/cpu/arm926ejs/davinci/dm644x.c |    2 +-
  arch/arm/cpu/arm926ejs/davinci/dm646x.c |    2 +-
  drivers/i2c/Makefile                    |    2 +-
  drivers/i2c/davinci_i2c.c               |  401 ++++++++++++++++++-------------
  drivers/i2c/davinci_i2c.h               |   27 ++-
  include/configs/cam_enc_4xx.h           |    8 +-
  include/configs/da830evm.h              |    8 +-
  include/configs/da850evm.h              |    8 +-
  include/configs/davinci_dm355evm.h      |    8 +-
  include/configs/davinci_dm355leopard.h  |    8 +-
  include/configs/davinci_dm365evm.h      |    8 +-
Quoted 8 lines
  include/configs/davinci_dm6467evm.h     |    8 +-
  include/configs/davinci_dvevm.h         |    8 +-
  include/configs/davinci_schmoogie.h     |    8 +-
  include/configs/davinci_sffsdr.h        |    8 +-
  include/configs/davinci_sonata.h        |    8 +-
  include/configs/ea20.h                  |    6 +-
  include/configs/enbw_cmc.h              |    8 +-
  20 files changed, 305 insertions(+), 235 deletions(-)
Quoted 2 lines

This is your v4 post ... some sort of history, what has changed would be nice ...

The history is maintained for the series that is part of the cover letter. I have reproduced it below for your convenience.

Change history:
v4
- Added multibus support in i2c driver. Tested only on Keystone
- Added comments to fdt patch

v3
- Seperated network driver patches from the original series and and is now a different set as there are outstanding issues to be discussed and sorted out. Also the original series is ready for merge to upstream IMO.
- Review comments incorporated. Following are the major comments addressed
- Added KBUILD target for u-boot-spi.gph
- Added bootup and flashing instructions in README
- Cleaned up manually replacing #define <tab> with #define <space>
- Cleaned up k2hk_evm.h include file to remove unnecessary options
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

Quoted 8 lines

[...]

Quoted 7 lines
drivers/i2c/Makefile index renamed from drivers/i2c/Makefile +0 -0

36d5e5f..fd1cb11 100644

drivers/i2c/Makefile +0 -0
@@ -6,7 +6,7 @@
  #
 
Quoted 5 lines

drivers/i2c/Makefile line 9

Quoted 3 lines
drivers/i2c/Makefile +1 -1
  obj-$(CONFIG_BFIN_TWI_I2C) += bfin-twi_i2c.o
-obj-$(CONFIG_DRIVER_DAVINCI_I2C) += davinci_i2c.o
+obj-$(CONFIG_SYS_I2C_DAVINCI) += davinci_i2c.o

please keep lists sorted.

Are you asking me to sort the entire Makefile based on file name? davinci_i2c.o is at the correct alphabetical position right now. Or are you expecting this to be sorted based on CONFIG_SYS_<xxx> ?

If so, I could change as

obj-$(CONFIG_SYS_I2C) += i2c_core.o
obj-$(CONFIG_SYS_I2C_DAVINCI) += davinci_i2c.o
obj-$(CONFIG_SYS_I2C_FSL) += fsl_i2c.o
obj-$(CONFIG_SYS_I2C_FTI2C010) += fti2c010.o

Please confirm. If sort by file name, then I am missing something.

Quoted 5 lines

[...]

Rest looks Ok for me ... if checkpatch drops no errors and warnings and MAKEALL compiles clean ;-)

Yes. I did it and no errors/warning. ./MAKEALL ran fine too.

Quoted 5 lines

bye,
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

#9 lore raw

PATCH v4 6/9 i2c, davinci: convert driver to new mutlibus/mutliadapter framework

Hello Murali,

Am 31.03.2014 22:23, schrieb Karicheri, Muralidharan:

Quoted 8 lines
Quoted 8 lines

-----Original Message-----
From: Heiko Schocher [mailto:hs at denx.de]
Sent: Monday, March 31, 2014 1:24 AM
To: Karicheri, Muralidharan
Cc: Rini, Tom; u-boot at lists.denx.de
Subject: Re: [U-Boot] [PATCH v4 6/9] i2c, davinci: convert driver to new mutlibus/mutliadapter framework

Quoted 7 lines
Quoted 2 lines

Hello Mruali,

Heiko,

Thanks for reviewing this. See below for my response.

BTW, there is a Typo, it should have been Hello Murali, :)

Oh, Sorry for that.

Quoted 31 lines
Quoted 31 lines

Am 27.03.2014 16:59, schrieb Murali Karicheri:

Quoted 29 lines

From: Vitaly Andrianov<[email protected]>

- add davinci driver to new multibus/multiadpater support
- adapted all config files, which uses this driver

---
   arch/arm/cpu/arm926ejs/davinci/dm355.c  |    2 +-
   arch/arm/cpu/arm926ejs/davinci/dm365.c  |    2 +-
   arch/arm/cpu/arm926ejs/davinci/dm644x.c |    2 +-
   arch/arm/cpu/arm926ejs/davinci/dm646x.c |    2 +-
   drivers/i2c/Makefile                    |    2 +-
   drivers/i2c/davinci_i2c.c               |  401 ++++++++++++++++++-------------
   drivers/i2c/davinci_i2c.h               |   27 ++-
   include/configs/cam_enc_4xx.h           |    8 +-
   include/configs/da830evm.h              |    8 +-
   include/configs/da850evm.h              |    8 +-
   include/configs/davinci_dm355evm.h      |    8 +-
   include/configs/davinci_dm355leopard.h  |    8 +-
   include/configs/davinci_dm365evm.h      |    8 +-
   include/configs/davinci_dm6467evm.h     |    8 +-
   include/configs/davinci_dvevm.h         |    8 +-
   include/configs/davinci_schmoogie.h     |    8 +-
   include/configs/davinci_sffsdr.h        |    8 +-
   include/configs/davinci_sonata.h        |    8 +-
   include/configs/ea20.h                  |    6 +-
   include/configs/enbw_cmc.h              |    8 +-
   20 files changed, 305 insertions(+), 235 deletions(-)
Quoted 5 lines
Quoted 2 lines

This is your v4 post ... some sort of history, what has changed would be nice ...

The history is maintained for the series that is part of the cover letter. I have reproduced it below for your convenience.

Thanks, but it is not only for my convenience, see here for a help, how to send updated patches:

http://www.denx.de/wiki/view/U-Boot/Patches#Sending_updated_patch_versions

Quoted 47 lines

Change history:
v4
- Added multibus support in i2c driver. Tested only on Keystone
- Added comments to fdt patch

v3
- Seperated network driver patches from the original series and and is now a different set as there are outstanding issues to be discussed and sorted out. Also the original series is ready for merge to upstream IMO.
- Review comments incorporated. Following are the major comments addressed
- Added KBUILD target for u-boot-spi.gph
- Added bootup and flashing instructions in README
- Cleaned up manually replacing #define<tab> with #define<space>
- Cleaned up k2hk_evm.h include file to remove unnecessary options
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

Quoted 8 lines

[...]

Quoted 7 lines
drivers/i2c/Makefile index renamed from drivers/i2c/Makefile +0 -0

36d5e5f..fd1cb11 100644

drivers/i2c/Makefile +0 -0
@@ -6,7 +6,7 @@
   #
 
Quoted 7 lines
Quoted 5 lines

drivers/i2c/Makefile line 9

Quoted 3 lines
drivers/i2c/Makefile +1 -1
   obj-$(CONFIG_BFIN_TWI_I2C) += bfin-twi_i2c.o
-obj-$(CONFIG_DRIVER_DAVINCI_I2C) += davinci_i2c.o
+obj-$(CONFIG_SYS_I2C_DAVINCI) += davinci_i2c.o

please keep lists sorted.

Are you asking me to sort the entire Makefile based on file name? davinci_i2c.o is at

No.

Quoted 2 lines

the correct alphabetical position right now. Or are you expecting this to be sorted based on CONFIG_SYS_<xxx> ?

Yes.

Quoted 8 lines

If so, I could change as

obj-$(CONFIG_SYS_I2C) += i2c_core.o
obj-$(CONFIG_SYS_I2C_DAVINCI) += davinci_i2c.o
obj-$(CONFIG_SYS_I2C_FSL) += fsl_i2c.o
obj-$(CONFIG_SYS_I2C_FTI2C010) += fti2c010.o

Please confirm. If sort by file name, then I am missing something.

Yep, thats it!

Quoted 6 lines
Quoted 5 lines

[...]

Rest looks Ok for me ... if checkpatch drops no errors and warnings and MAKEALL compiles clean ;-)

Yes. I did it and no errors/warning. ./MAKEALL ran fine too.

Fine, thanks!

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#10 lore raw

PATCH v4 7/9 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.

---
 Makefile                                           |   10 +
 arch/arm/cpu/armv7/keystone/Makefile               |   17 ++
 arch/arm/cpu/armv7/keystone/aemif.c                |   71 +++++
 arch/arm/cpu/armv7/keystone/clock.c                |  318 ++++++++++++++++++++
 arch/arm/cpu/armv7/keystone/cmd_clock.c            |  124 ++++++++
 arch/arm/cpu/armv7/keystone/cmd_mon.c              |  131 ++++++++
 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 |  150 +++++++++
 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                           |  122 ++++++++
 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                         |  212 +++++++++++++
 28 files changed, 2793 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/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 +10 -0
index 0281171..c497b15 100644
@@ -875,6 +875,16 @@ OBJCOPYFLAGS_u-boot.spr = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \
 u-boot.spr: spl/u-boot-spl.img u-boot.img FORCE
 	$(call if_changed,pad_cat)
 
+MKIMAGEFLAGS_u-boot-spl.gph = -A $(ARCH) -T gpimage -C none \
+	-a $(CONFIG_SPL_TEXT_BASE) -e $(CONFIG_SPL_TEXT_BASE) -n SPL
+spl/u-boot-spl.gph: spl/u-boot-spl.bin FORCE
+	$(call if_changed,mkimage)
+
+OBJCOPYFLAGS_u-boot-spi.gph = -I binary -O binary --pad-to=$(CONFIG_SPL_PAD_TO) \
+			  --gap-fill=0
+u-boot-spi.gph: spl/u-boot-spl.gph u-boot.img FORCE
+	$(call if_changed,pad_cat)
+
 ifneq ($(CONFIG_TEGRA),)
 OBJCOPYFLAGS_u-boot-nodtb-tegra.bin = -O binary --pad-to=$(CONFIG_SYS_TEXT_BASE)
 u-boot-nodtb-tegra.bin: spl/u-boot-spl u-boot.bin FORCE
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 +318 -0

318 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/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 +150 -0

150 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..272f4af
@@ -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..7012ea7
@@ -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 +122 -0

122 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 d28e09b..c61dbbd 100644
@@ -292,6 +292,7 @@ Active  arm         armv7          exynos      samsung         trats
 Active  arm         armv7          exynos      samsung         trats2              trats2                               -                                                                                                                                 Piotr Wilczek <[email protected]>
 Active  arm         armv7          exynos      samsung         universal_c210      s5pc210_universal                    -                                                                                                                                 Przemyslaw Marczak <[email protected]>
 Active  arm         armv7          highbank    -               highbank            highbank                             -                                                                                                                                 Rob Herring <[email protected]>
+Active  arm         armv7          keystone    ti              k2hk_evm            k2hk_evm                             -                                                                                                                                 Vitaly Andrianov <[email protected]>
 Active  arm         armv7          mx5         denx            m53evk              m53evk                               m53evk:IMX_CONFIG=board/denx/m53evk/imximage.cfg                                                                                  Marek Vasut <[email protected]>
 Active  arm         armv7          mx5         esg             ima3-mx53           ima3-mx53                            ima3-mx53:IMX_CONFIG=board/esg/ima3-mx53/imximage.cfg                                                                             -
 Active  arm         armv7          mx5         freescale       mx51evk             mx51evk                              mx51evk:IMX_CONFIG=board/freescale/mx51evk/imximage.cfg                                                                           Stefano Babic <[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 +212 -0

212 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#11 lore raw

PATCH v4 7/9 k2hk: add support for k2hk SOC and EVM

Quoted 8 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]

arch/arm/include/asm/arch-keystone/clock_defs.h line 78

Quoted 9 lines
arch/arm/include/asm/arch-keystone/clock_defs.h new file +9 -0
+#define reg_rmw(reg, mask, val) \
+	__raw_writel((__raw_readl((reg)) & ~(mask)) | ((val) & (mask)) , \
+		     (reg));
+
+#define reg_setbits(reg, bits) \
+	__raw_writel((__raw_readl(reg) | (bits)) , (reg));
+
+#define reg_clrbits(reg, bits)	\
+	__raw_writel((__raw_readl(reg) & ~(bits)) , (reg));

I think the first one is just another way of saying clrsetbits_le32 (or can be re-written as such), but reg_setbits/reg_clrbits are convertable to setbits/clrbits.

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/20140328/66e4b9ff/attachment.pgp>
#12 lore raw

PATCH v4 8/9 spi: davinci: add support for multiple bus and chip select

In reply to Murali Karicheri

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 |   60 ++++++++++++++++++++++++++++++++++++++++++---
 drivers/spi/davinci_spi.h |   33 +++++++++++++++++++++++++
 2 files changed, 90 insertions(+), 3 deletions(-)
drivers/spi/davinci_spi.c +57 -3
index e3fb321..b682bc4 100644
@@ -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
#13 lore raw

PATCH v4 9/9 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 9d0ba24..28a6d72 100644
@@ -81,7 +81,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
#14 lore raw

v4 cover Add support for keystone2 SoC and K2HK EVM

In reply to Murali Karicheri
Quoted 117 lines

-----Original Message-----
From: Karicheri, Muralidharan
Sent: Thursday, March 27, 2014 11:59 AM
To: Rini, Tom; u-boot at lists.denx.de
Cc: Karicheri, Muralidharan
Subject: [PATCH v4 0/9] Add support for keystone2 SoC and K2HK EVM

*** BLURB HERE ***

Murali Karicheri (5):
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
spi: davinci: add support for multiple bus and chip select
k2hk-evm: add configuration for spi1 and spi2 support

Vitaly Andrianov (4):
fdt: call ft_board_setup_ex() at the end of image_setup_libfdt()
arm: add support for arch timer
i2c, davinci: convert driver to new mutlibus/mutliadapter framework
k2hk: add support for k2hk SOC and EVM

Makefile                                           |   10 +
README                                             |    5 +
arch/arm/cpu/arm926ejs/davinci/dm355.c             |    2 +-
arch/arm/cpu/arm926ejs/davinci/dm365.c             |    2 +-
arch/arm/cpu/arm926ejs/davinci/dm644x.c            |    2 +-
arch/arm/cpu/arm926ejs/davinci/dm646x.c            |    2 +-
arch/arm/cpu/armv7/keystone/Makefile               |   17 +
arch/arm/cpu/armv7/keystone/aemif.c                |   71 ++++
arch/arm/cpu/armv7/keystone/clock.c                |  318 ++++++++++++++++
arch/arm/cpu/armv7/keystone/cmd_clock.c            |  124 ++++++
arch/arm/cpu/armv7/keystone/cmd_mon.c              |  131 +++++++
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-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/emif_defs.h     |   73 ++++
arch/arm/include/asm/arch-keystone/hardware-k2hk.h |  150 ++++++++
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 +
arch/arm/lib/Makefile                              |    1 +
arch/arm/lib/arch_timer.c                          |   58 +++
board/ti/k2hk_evm/Makefile                         |    9 +
board/ti/k2hk_evm/README                           |  122 ++++++
board/ti/k2hk_evm/board.c                          |  236 ++++++++++++
board/ti/k2hk_evm/ddr3.c                           |  269 +++++++++++++
boards.cfg                                         |    1 +
common/image-fdt.c                                 |    5 +
common/image.c                                     |    1 +
drivers/i2c/Makefile                               |    2 +-
drivers/i2c/davinci_i2c.c                          |  402 ++++++++++++--------
drivers/i2c/davinci_i2c.h                          |   78 ++++
drivers/mtd/nand/davinci_nand.c                    |    3 +
drivers/serial/ns16550.c                           |    8 +
drivers/spi/davinci_spi.c                          |   60 ++-
drivers/spi/davinci_spi.h                          |   33 ++
include/configs/cam_enc_4xx.h                      |    8 +-
include/configs/da830evm.h                         |    8 +-
include/configs/da850evm.h                         |    8 +-
include/configs/davinci_dm355evm.h                 |    8 +-
include/configs/davinci_dm355leopard.h             |    8 +-
include/configs/davinci_dm365evm.h                 |    8 +-
include/configs/davinci_dm6467evm.h                |    8 +-
include/configs/davinci_dvevm.h                    |    8 +-
include/configs/davinci_schmoogie.h                |    8 +-
include/configs/davinci_sffsdr.h                   |    8 +-
include/configs/davinci_sonata.h                   |    8 +-
include/configs/ea20.h                             |    6 +-
include/configs/enbw_cmc.h                         |    8 +-
include/configs/k2hk_evm.h                         |  221 +++++++++++
include/fdt_support.h                              |    7 +
include/image.h                                    |    1 +
tools/Makefile                                     |    2 +
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 -
67 files changed, 3563 insertions(+), 387 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/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 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 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

Please ignore this. I have re-send this with correct description.

Murali