Skip to contentSkip to conversation

Add board specific code for da850 EVM

PATCH Superseded Sudhakar Rajashekhara 2 participants 6 messages Dec 16, 2009 – Jan 4, 2010

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 Add board specific code for da850 EVM

Provides initial support for TI OMAP-L138/DA850 SoC devices on a Logic PD EVM board.

Provides:
Initial boot and configuration.
Support for i2c.
UART support (console).

---
 board/davinci/da8xxevm/Makefile         |    1 +
 board/davinci/da8xxevm/da850evm.c       |  124 +++++++++++++++++++++++++++++++
 include/asm-arm/arch-davinci/hardware.h |    1 +
 3 files changed, 126 insertions(+), 0 deletions(-)
 create mode 100644 board/davinci/da8xxevm/da850evm.c
board/davinci/da8xxevm/Makefile +1 -0
index 45da94b..93dbcbb 100644
@@ -28,6 +28,7 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)lib$(BOARD).a
 
 COBJS-$(CONFIG_DA830_EVM)	+= da830evm.o
+COBJS-$(CONFIG_DA850_EVM)	+= da850evm.o
 
 COBJS   := $(sort $(COBJS-y))
 
board/davinci/da8xxevm/da850evm.c new file +124 -0

124 lines not on this page · raw message

include/asm-arm/arch-davinci/hardware.h +1 -0
index 81cc8ab..3520cf8 100644
@@ -398,6 +398,7 @@ struct davinci_syscfg_regs {
 #define DAVINCI_SYSCFG_SUSPSRC_EMAC		(1 << 5)
 #define DAVINCI_SYSCFG_SUSPSRC_I2C		(1 << 16)
 #define DAVINCI_SYSCFG_SUSPSRC_SPI0		(1 << 21)
+#define DAVINCI_SYSCFG_SUSPSRC_SPI1		(1 << 22)
 #define DAVINCI_SYSCFG_SUSPSRC_UART2		(1 << 20)
 #define DAVINCI_SYSCFG_SUSPSRC_TIMER0		(1 << 27)
 
Signature · 1 line
1.5.6
#1 lore raw

PATCH 2/3 Add board specific code for da850 EVM

Quoted 16 lines · Sudhakar Rajashekhara

Provides initial support for TI OMAP-L138/DA850 SoC devices on a Logic PD EVM board.

Provides:
Initial boot and configuration.
Support for i2c.
UART support (console).

---
 board/davinci/da8xxevm/Makefile         |    1 +
 board/davinci/da8xxevm/da850evm.c       |  124 +++++++++++++++++++++++++++++++
 include/asm-arm/arch-davinci/hardware.h |    1 +
 3 files changed, 126 insertions(+), 0 deletions(-)
 create mode 100644 board/davinci/da8xxevm/da850evm.c

[...]

board/davinci/da8xxevm/da850evm.c line 4

Quoted 10 lines
board/davinci/da8xxevm/da850evm.c new file +4 -0
new file mode 100644
index 0000000..92548e2
@@ -0,0 +1,124 @@
+/*
+ * (C) Copyright 2009, Texas Instruments, Inc. http://www.ti.com/
+ *
+ * Based on da830evm.c

At this point, this seem to be a copy of da830evm.c (well except the first few lines above).

Copied code is not good. I have changes still in the pipe line for da830evm.c for adding support for NAND and Ethernet and there is a USB patch out there IIRC.

Since the da850 is so similar, I suspect we can at least factor out the common parts so that we don't have to edit two files to add NAND support for example.

I think it is the case that the only difference is DDR instead of SDRAM and the UBL will handle that for us. Is that true for the device *and* the EVM? If so, then possibly da830evm.c could be renamed to da8xxevm.c and the code kept completely common - at the risk of adding a few ifdefs later.

Nick.

#2 lore raw

PATCH 2/3 Add board specific code for da850 EVM

Quoted 10 lines · Nick Thompson <nick.thompson <at> ge.com> writes:
Quoted 8 lines · Sudhakar Rajashekhara

Provides initial support for TI OMAP-L138/DA850 SoC devices on a Logic PD EVM board.

Provides:
Initial boot and configuration.
Support for i2c.
UART support (console).

Quoted 4 lines
Quoted 4 lines
Signed-off-by Sudhakar Rajashekhara <sudhakar.raj <at> ti.com>
---
 board/davinci/da8xxevm/Makefile         |    1 +
 board/davinci/da8xxevm/da850evm.c       |  124 

+++++++++++++++++++++++++++++++

Quoted 8 lines
Quoted 4 lines
 include/asm-arm/arch-davinci/hardware.h |    1 +
 3 files changed, 126 insertions(+), 0 deletions(-)
 create mode 100644 board/davinci/da8xxevm/da850evm.c

[...]

Review

Quoted 1 line
(quoted diff) +0 -0

b/board/davinci/da8xxevm/da850evm.c

Quoted 11 lines

board/davinci/da8xxevm/da850evm.c line 4

Quoted 9 lines

new file mode 100644
index 0000000..92548e2

board/davinci/da8xxevm/da850evm.c new file +4 -0
@@ -0,0 +1,124 @@
+/*
+ * (C) Copyright 2009, Texas Instruments, Inc. http://www.ti.com/
+ *
+ * Based on da830evm.c

At this point, this seem to be a copy of da830evm.c (well except the first

few lines above).

Quoted 1 line

I don't think you have observed that the PINMUX registers are different on da850. So we are at risk of adding many ifdefs now itself if we combine da830 and da850. Also, there are few things which differ between da830 and da850, for example, MAC address is stored in I2C eeprom on da830 and in SPI eeprom on da850. You can have a look at http://www.arago-project.org/git/people/?
p=sekhar/u-boot-omapl1.git;a=summary to understand how the da830 and da850 files look later when support for most peripherals are added.

To avoid code cluttering, I prefer using two separate files for da830 and da850.

Regards,
Sudhakar

#3 lore raw

PATCH 2/3 Add board specific code for da850 EVM

Quoted 48 lines · Sudhakar Rajashekhar
Quoted 10 lines · Nick Thompson <nick.thompson <at> ge.com> writes:
Quoted 8 lines · Sudhakar Rajashekhara

Provides initial support for TI OMAP-L138/DA850 SoC devices on a Logic PD EVM board.

Provides:
Initial boot and configuration.
Support for i2c.
UART support (console).

Quoted 4 lines
Quoted 4 lines
Signed-off-by Sudhakar Rajashekhara <sudhakar.raj <at> ti.com>
---
 board/davinci/da8xxevm/Makefile         |    1 +
 board/davinci/da8xxevm/da850evm.c       |  124 

+++++++++++++++++++++++++++++++

Quoted 8 lines
Quoted 4 lines
 include/asm-arm/arch-davinci/hardware.h |    1 +
 3 files changed, 126 insertions(+), 0 deletions(-)
 create mode 100644 board/davinci/da8xxevm/da850evm.c

[...]

Review

Quoted 1 line
(quoted diff) +0 -0

b/board/davinci/da8xxevm/da850evm.c

Quoted 11 lines

board/davinci/da8xxevm/da850evm.c line 4

Quoted 9 lines

new file mode 100644
index 0000000..92548e2

board/davinci/da8xxevm/da850evm.c new file +4 -0
@@ -0,0 +1,124 @@
+/*
+ * (C) Copyright 2009, Texas Instruments, Inc. http://www.ti.com/
+ *
+ * Based on da830evm.c

At this point, this seem to be a copy of da830evm.c (well except the first

few lines above).

Quoted 1 line

I don't think you have observed that the PINMUX registers are different on da850. So we are at risk of adding many ifdefs now itself if we combine da830 and da850. Also, there are few things which differ between da830 and da850, for example, MAC address is stored in I2C eeprom on da830 and in SPI eeprom on da850. You can have a look at http://www.arago-project.org/git/people/?
p=sekhar/u-boot-omapl1.git;a=summary to understand how the da830 and da850 files look later when support for most peripherals are added.

Quoted 1 line

To avoid code cluttering, I prefer using two separate files for da830 and da850.

Yes, the pinmux table definitions are different, but I don't see how this requires duplicating code.

In the latest patches for da830, the pinmux setup is table driven. It would be very simple to pull out the two tables into da830 and da850 specific files (selected by the build system) and use common pinmux code to setup the pins appropriately. The code part for this is simply:

	/* configure pinmux settings */
	if (davinci_configure_pin_mux_items(pinmuxes, ARRAY_SIZE(pinmuxes)))
		return 1;

That would be exactly the same line of code for both devices.

It should be possible to put i2c (da830) and spi (da850) equivalent functions into that same file to read the MAC address. Abstractions of this form are also likely to make the code more readable. [In fact the function is already abstracted into misc.c, but it only provides for i2c currently]

There might be an issue with functions supported on one platform that are not supported on the other, but these could also be abstracted out. They also ought to be few because of the similarities of the devices.

Not doing so puts us at risk of increasing commmits and maintenance. There is no need to clutter the code - it can be layered and abstracted to handle differences cleanly.

Nick.

#4 lore raw

PATCH 2/3 Add board specific code for da850 EVM

Hi,

On Mon, Dec 21, 2009 at 15:48:38, Nick Thompson wrote:

[...]

Quoted 23 lines
Quoted 13 lines
Quoted 2 lines

At this point, this seem to be a copy of da830evm.c (well except the first

few lines above).

Quoted 1 line

I don't think you have observed that the PINMUX registers are different on da850. So we are at risk of adding many ifdefs now itself if we combine da830 and da850. Also, there are few things which differ between da830 and da850, for example, MAC address is stored in I2C eeprom on da830 and in SPI eeprom on da850. You can have a look at http://www.arago-project.org/git/people/?
p=sekhar/u-boot-omapl1.git;a=summary to understand how the da830 and da850 files look later when support for most peripherals are added.

Quoted 1 line

To avoid code cluttering, I prefer using two separate files for da830 and da850.

Yes, the pinmux table definitions are different, but I don't see how this requires duplicating code.

In the latest patches for da830, the pinmux setup is table driven. It would be very simple to pull out the two tables into da830 and da850 specific files (selected by the build system) and use common pinmux code to setup the pins appropriately. The code part for this is simply:

Quoted 6 lines
	/* configure pinmux settings */
	if (davinci_configure_pin_mux_items(pinmuxes, ARRAY_SIZE(pinmuxes)))
		return 1;

That would be exactly the same line of code for both devices.

Now I understand your intention. You are OK having two different files for da830 and da850, but you want me to put the common code in one place. I'll rework on this patch based on your comments and will resubmit it.

Also, you are talking about the latest patches for da830 which are following the above framework, but I did not see them in u-boot-ti branch. Have you submitted them to the list? If you have any public tree where you have maintained them, can you point me to that?

Thanks,
Sudhakar

#5 lore raw

PATCH 2/3 Add board specific code for da850 EVM

In reply to Nick Thompson

Hi,

Quoted 70 lines · Nick Thompson
Quoted 48 lines · Sudhakar Rajashekhar
Quoted 10 lines · Nick Thompson <nick.thompson <at> ge.com> writes:
Quoted 8 lines · Sudhakar Rajashekhara

Provides initial support for TI OMAP-L138/DA850 SoC devices on a Logic PD EVM board.

Provides:
Initial boot and configuration.
Support for i2c.
UART support (console).

Quoted 4 lines
Quoted 4 lines
Signed-off-by Sudhakar Rajashekhara <sudhakar.raj <at> ti.com>
---
 board/davinci/da8xxevm/Makefile         |    1 +
 board/davinci/da8xxevm/da850evm.c       |  124 

+++++++++++++++++++++++++++++++

Quoted 8 lines
Quoted 4 lines
 include/asm-arm/arch-davinci/hardware.h |    1 +
 3 files changed, 126 insertions(+), 0 deletions(-)
 create mode 100644 board/davinci/da8xxevm/da850evm.c

[...]

Review

Quoted 1 line
(quoted diff) +0 -0

b/board/davinci/da8xxevm/da850evm.c

Quoted 11 lines

board/davinci/da8xxevm/da850evm.c line 4

Quoted 9 lines

new file mode 100644
index 0000000..92548e2

board/davinci/da8xxevm/da850evm.c new file +4 -0
@@ -0,0 +1,124 @@
+/*
+ * (C) Copyright 2009, Texas Instruments, Inc. http://www.ti.com/
+ *
+ * Based on da830evm.c

At this point, this seem to be a copy of da830evm.c (well except the first

few lines above).

Quoted 1 line

I don't think you have observed that the PINMUX registers are different on da850. So we are at risk of adding many ifdefs now itself if we combine da830 and da850. Also, there are few things which differ between da830 and da850, for example, MAC address is stored in I2C eeprom on da830 and in SPI eeprom on da850. You can have a look at http://www.arago-project.org/git/people/?
p=sekhar/u-boot-omapl1.git;a=summary to understand how the da830 and da850 files look later when support for most peripherals are added.

Quoted 1 line

To avoid code cluttering, I prefer using two separate files for da830 and da850.

Yes, the pinmux table definitions are different, but I don't see how this requires duplicating code.

In the latest patches for da830, the pinmux setup is table driven. It would be very simple to pull out the two tables into da830 and da850 specific files (selected by the build system) and use common pinmux code to setup the pins appropriately. The code part for this is simply:

	/* configure pinmux settings */
	if (davinci_configure_pin_mux_items(pinmuxes, ARRAY_SIZE(pinmuxes)))
		return 1;

That would be exactly the same line of code for both devices.

It should be possible to put i2c (da830) and spi (da850) equivalent functions into that same file to read the MAC address. Abstractions of this form are also likely to make the code more readable. [In fact the function is already abstracted into misc.c, but it only provides for i2c currently]

Quoted 8 lines

There might be an issue with functions supported on one platform that are not supported on the other, but these could also be abstracted out. They also ought to be few because of the similarities of the devices.

Not doing so puts us at risk of increasing commmits and maintenance. There is no need to clutter the code - it can be layered and abstracted to handle differences cleanly.

I tried modifying the code in the way discussed above, but during the process I realized that by doing so it is becoming more difficult to add a new board based on da830/da850 SoC. Also, I feel it is better to extract out the common code in some Soc related file (say da8xx.c in cpu/arm926ejs/davinci) and still have two separate board files. Common code like IRQ disabling etc. can be implemented in this SoC specific file and this function will be called from the board files. Even in Linux kernel, two different board files are being maintained for da830 and da850 and there is a SoC specific file where the common code exists.

Regards,
Sudhakar