ARM: Add support for Lyrtech SFF-SDR board (ARM926EJS)
PATCH v7 1/1 ARM: Add support for Lyrtech SFF-SDR board (ARM926EJS)
ARM: This patch adds support for the Lyrtech SFF-SDR board, based on the TI DaVinci architecture (ARM926EJS).
---
CREDITS | 5 + MAKEALL | 1 + Makefile | 3 + board/davinci/sffsdr/Makefile | 51 +++++++ board/davinci/sffsdr/board_init.S | 32 ++++ board/davinci/sffsdr/config.mk | 42 ++++++ board/davinci/sffsdr/sffsdr.c | 288 +++++++++++++++++++++++++++++++++++++ board/davinci/sffsdr/u-boot.lds | 52 +++++++ include/asm-arm/mach-types.h | 13 ++ include/configs/davinci_sffsdr.h | 148 +++++++++++++++++++ 10 files changed, 635 insertions(+), 0 deletions(-)
CREDITS +5 -0
@@ -533,3 +533,8 @@ N: Timo Tuunainen E: timo.tuunainen at sysart.fi D: Support for Artila M-501 starter kit W: http://www.sysart.fi/ + +N: Philip Balister +E: philip at opensdr.com +D: Port to Lyrtech SFFSDR development board. +W: www.opensdr.com
MAKEALL +1 -0
@@ -496,6 +496,7 @@ LIST_ARM9=" \ voiceblue \ davinci_dvevm \ davinci_schmoogie \ + davinci_sffsdr \ davinci_sonata \ "
Makefile +3 -0
@@ -2408,6 +2408,9 @@ davinci_dvevm_config : unconfig davinci_schmoogie_config : unconfig @$(MKCONFIG) $(@:_config=) arm arm926ejs schmoogie davinci davinci +davinci_sffsdr_config : unconfig + @$(MKCONFIG) $(@:_config=) arm arm926ejs sffsdr davinci davinci + davinci_sonata_config : unconfig @$(MKCONFIG) $(@:_config=) arm arm926ejs sonata davinci davinci
board/davinci/sffsdr/Makefile new file +51 -0
51 lines not on this page · raw message
board/davinci/sffsdr/board_init.S new file +32 -0
@@ -0,0 +1,32 @@ +/* + * Board-specific low level initialization code. Called at the very end + * of cpu/arm926ejs/davinci/lowlevel_init.S. Just returns if there is no + * initialization required. + * + * Copyright (C) 2007 Sergey Kubushyn <[email protected]> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <config.h> + +.globl dv_board_init +dv_board_init: + + mov pc, lr
board/davinci/sffsdr/config.mk new file +42 -0
42 lines not on this page · raw message
board/davinci/sffsdr/sffsdr.c new file +288 -0
288 lines not on this page · raw message
board/davinci/sffsdr/u-boot.lds new file +52 -0
52 lines not on this page · raw message
include/asm-arm/mach-types.h +13 -0
@@ -1595,6 +1595,7 @@ extern unsigned int __machine_arch_type;#define MACH_TYPE_P300 1602#define MACH_TYPE_XDACOMET 1603#define MACH_TYPE_DEXFLEX2 1604 +#define MACH_TYPE_SFFSDR 1657#ifdef CONFIG_ARCH_EBSA110 # ifdef machine_arch_type
@@ -16500,6 +16501,18 @@ extern unsigned int __machine_arch_type;# define machine_is_schmoogie () (0)#endif +#ifdef CONFIG_MACH_SFFSDR +# ifdef machine_arch_type +# undef machine_arch_type +# define machine_arch_type __machine_arch_type +# else +# define machine_arch_type MACH_TYPE_SFFSDR +# endif +# define machine_is_sffsdr () (machine_arch_type == MACH_TYPE_SFFSDR) +#else +# define machine_is_sffsdr () (0) +#endif +#ifdef CONFIG_MACH_AZTOOL # ifdef machine_arch_type# undef machine_arch_type
include/configs/davinci_sffsdr.h new file +148 -0
148 lines not on this page · raw message
PATCH v7 1/1 ARM: Add support for Lyrtech SFF-SDR board (ARM926EJS)
Quoted 2 lines · In message <[email protected]> you…
ARM: This patch adds support for the Lyrtech SFF-SDR board, based on the TI DaVinci architecture (ARM926EJS).
...
board/davinci/sffsdr/sffsdr.c line 182
Quoted 10 lines
board/davinci/sffsdr/sffsdr.c new file +10
-0+int read_mac_address (uint8_t *buf) +{ +u_int32_t value, mac[2 ], address; + +/* Read Integrity data structure checkword. */ +if (i2c_read (CFG_I2C_EEPROM_ADDR ,INTEGRITY_CHECKWORD_OFFSET , +CFG_I2C_EEPROM_ADDR_LEN , (uint8_t *) &value,4 )) { +printf ("Read from EEPROM @ 0x%02x failed\n" , +CFG_I2C_EEPROM_ADDR ); +return 1 ;
# 1
board/davinci/sffsdr/sffsdr.c line 192
Quoted 10 lines
board/davinci/sffsdr/sffsdr.c new file +10
-0+ } +if (value !=INTEGRITY_CHECKWORD_VALUE ) +return 1 ; + +/* Read SYSCFG structure offset. */ +if (i2c_read (CFG_I2C_EEPROM_ADDR ,INTEGRITY_SYSCFG_OFFSET , +CFG_I2C_EEPROM_ADDR_LEN , (uint8_t *) &value,4 )) { +printf ("Read from EEPROM @ 0x%02x failed\n" , +CFG_I2C_EEPROM_ADDR ); +return 1 ;
# 2
board/davinci/sffsdr/sffsdr.c line 202
Quoted 10 lines
board/davinci/sffsdr/sffsdr.c new file +10
-0+ } + address =0x800 + (int ) value;/* Address where SYSCFG structure +* is located. */ + +/* Read NET CONFIG structure offset. */ +if (i2c_read (CFG_I2C_EEPROM_ADDR , address, +CFG_I2C_EEPROM_ADDR_LEN , (uint8_t *) &value,4 )) { +printf ("Read from EEPROM @ 0x%02x failed\n" , +CFG_I2C_EEPROM_ADDR ); +return 1 ;
# 3
board/davinci/sffsdr/sffsdr.c line 214
Quoted 12 lines
board/davinci/sffsdr/sffsdr.c new file +12
-0+ } + address =0x800 + (int ) value;/* Address where NET CONFIG structure +* is located. */ + address +=12 ;/* Address where NET INTERFACE CONFIG structure +* is located. */ + +/* Read NET INTERFACE CONFIG 2 structure offset. */ +if (i2c_read (CFG_I2C_EEPROM_ADDR , address, +CFG_I2C_EEPROM_ADDR_LEN , (uint8_t *) &value,4 )) { +printf ("Read from EEPROM @ 0x%02x failed\n" , +CFG_I2C_EEPROM_ADDR ); +return 1 ;
# 4
board/davinci/sffsdr/sffsdr.c line 224
Quoted 10 lines
board/davinci/sffsdr/sffsdr.c new file +10
-0+ } + address =0x800 +16 + (int ) value;/* Address where NET INTERFACE +* CONFIG 2 structure is located. */ + +/* Read MAC address. */ +if (i2c_read (CFG_I2C_EEPROM_ADDR , address, +CFG_I2C_EEPROM_ADDR_LEN , (uint8_t *) &mac[0 ],8 )) { +printf ("Read from EEPROM @ 0x%02x failed\n" , +CFG_I2C_EEPROM_ADDR ); +return 1 ;
# 5
board/davinci/sffsdr/sffsdr.c line 234
Quoted 10 lines
board/davinci/sffsdr/sffsdr.c new file +10
-0+ } + + buf[0 ] = mac[0 ] >>24 ; + buf[1 ] = mac[0 ] >>16 ; + buf[2 ] = mac[0 ] >>8 ; + buf[3 ] = mac[0 ]; + buf[4 ] = mac[1 ] >>24 ; + buf[5 ] = mac[1 ] >>16 ; + +return 0 ;
Instead of repeating the same code 5 times, replace it by a "goto err;" and add here:
err:
printf("Read from EEPROM @ 0x%02x failed\n", CFG_I2C_EEPROM_ADDR);
return 1;That's MUCH easier to read, and especially easier to maintain.
Quoted 8 lines
board/davinci/sffsdr/sffsdr.c new file +8
-0+int misc_init_r (void ) +{ +u_int8_t tmp[20 ], buf[10 ]; +int clk =0 ; + +/* EMIF-A CS3 configuration for FPGA. */ +REG (DAVINCI_A3CR ) =DAVINCI_A3CR_VAL ; +
board/davinci/sffsdr/sffsdr.c line 255
Quoted 10 lines
board/davinci/sffsdr/sffsdr.c new file +10
-0+ clk = ((REG (PLL2_PLLM ) +1 ) *27 ) / ((REG (PLL2_DIV2 ) &0x1f ) +1 ); + +printf ("ARM Clock: %dMHz\n" , ((REG (PLL1_PLLM ) +1 ) *27 ) /2 ); +printf ("DDR Clock: %dMHz\n" , (clk /2 )); + +/* Configure I2C switch (PCA9543) to enable channel 0. */ + tmp[0 ] =CFG_I2C_PCA9543_ENABLE_CH0 ; +if (i2c_write (CFG_I2C_PCA9543_ADDR ,0 , +CFG_I2C_PCA9543_ADDR_LEN , tmp,1 )) +printf ("Write to MUX @ 0x%02x failed\n" ,CFG_I2C_PCA9543_ADDR );
And this is not an error that needs to be handled?
board/davinci/sffsdr/sffsdr.c line 266
Quoted 10 lines
board/davinci/sffsdr/sffsdr.c new file +10
-0+/* Set Ethernet MAC address from EEPROM if available. */ +if (read_mac_address (buf) ==0 ) { +if ((buf[0 ] !=0xff ) && (getenv ("ethaddr" ) ==NULL )) { +sprintf ((char *)&tmp[0 ], +"%02x:%02x:%02x:%02x:%02x:%02x" , + buf[0 ], buf[1 ], buf[2 ], buf[3 ], + buf[4 ], buf[5 ]); +setenv ("ethaddr" , (char *)&tmp[0 ]); + } + }
Hm. I always thought this was documented somewhere (probably it's in the CHANGELOG ?), but I didn't find it right now. The intended "standard" behaviour should be:
If there is a MAC address in the environment, and if it is not identical to the MAC address in the ROM, then a warning shall be printed, and the MAC address from the environment be used.
If there is no MAC address in the environment, then it shall be initialized (silently) from the value in the ROM.
See for example drivers/net/cs8900.c (which is the first driver where we implemented this, IIRC).
board/davinci/sffsdr/sffsdr.c line 277
Quoted 4 lines
board/davinci/sffsdr/sffsdr.c new file +4
-0+/* For most DaVinci boards, U-Boot is copied in RAM by the UBL, +* so we are always in the relocated state. This is +* necessary for command history to work. */ + gd->flags |=GD_FLG_RELOC ;
"most" != "all". What happens for the N (N = all - most) remaining boards?
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Many aligators will be slain, but the swamp will remain.
PATCH v7 1/1 ARM: Add support for Lyrtech SFF-SDR board (ARM926EJS)
Quoted 26 lines · wd at denx.de
In message <[email protected]> you
Quoted 2 lines · wrote:
ARM: This patch adds support for the Lyrtech SFF-SDR board, based on the TI DaVinci architecture (ARM926EJS).
...
board/davinci/sffsdr/sffsdr.c line 182
Quoted 10 lines
board/davinci/sffsdr/sffsdr.c new file +10
-0+int read_mac_address (uint8_t *buf) +{ +u_int32_t value, mac[2 ], address; + +/* Read Integrity data structure checkword. */ +if (i2c_read (CFG_I2C_EEPROM_ADDR ,INTEGRITY_CHECKWORD_OFFSET , +CFG_I2C_EEPROM_ADDR_LEN , (uint8_t *) &value,4 )) { +printf ("Read from EEPROM @ 0x%02x failed\n" , +CFG_I2C_EEPROM_ADDR ); +return 1 ;# 1
# 2
# 3
# 4
# 5
Instead of repeating the same code 5 times, replace it by a "goto err;"
and add here:
Quoted 3 lines
err:
printf("Read from EEPROM @ 0x%02x failed\n", CFG_I2C_EEPROM_ADDR); return 1;
Fixed.
Quoted 7 lines
board/davinci/sffsdr/sffsdr.c line 255
Quoted 5 lines
board/davinci/sffsdr/sffsdr.c new file +5
-0+/* Configure I2C switch (PCA9543) to enable channel 0. */ + tmp[0 ] =CFG_I2C_PCA9543_ENABLE_CH0 ; +if (i2c_write (CFG_I2C_PCA9543_ADDR ,0 , +CFG_I2C_PCA9543_ADDR_LEN , tmp,1 )) +printf ("Write to MUX @ 0x%02x failed\n" ,CFG_I2C_PCA9543_ADDR );And this is not an error that needs to be handled?
Fixed.
Quoted 19 lines
board/davinci/sffsdr/sffsdr.c line 266
Quoted 9 lines
board/davinci/sffsdr/sffsdr.c new file +9
-0+/* Set Ethernet MAC address from EEPROM if available. */ +if (read_mac_address (buf) ==0 ) { +if ((buf[0 ] !=0xff ) && (getenv ("ethaddr" ) ==NULL )) { +sprintf ((char *)&tmp[0 ], +"%02x:%02x:%02x:%02x:%02x:%02x" , + buf[0 ], buf[1 ], buf[2 ], buf[3 ], + buf[4 ], buf[5 ]); +setenv ("ethaddr" , (char *)&tmp[0 ]); + } + }Hm. I always thought this was documented somewhere (probably it's in the
CHANGELOG ?), but I didn't find it right now. The intended "standard" behaviour should be:If there is a MAC address in the environment, and if it is not identical to the MAC address in the ROM, then a warning shall be printed, and the MAC address from the environment be used.
Quoted 5 lines
If there is no MAC address in the environment, then it shall be initialized (silently) from the value in the ROM.
See for example
drivers/net/cs8900.c(which is the first driver where we implemented this, IIRC).
Fixed. I used the exact same code found in drivers/net/cs8900.c.
Quoted 7 lines
board/davinci/sffsdr/sffsdr.c line 277
Quoted 4 lines
board/davinci/sffsdr/sffsdr.c new file +4
-0+/* For most DaVinci boards, U-Boot is copied in RAM by the UBL, +* so we are always in the relocated state. This is +* necessary for command history to work. */ + gd->flags |=GD_FLG_RELOC ;"most" != "all". What happens for the N (N = all - most) remaining boards?
Fixed.
Hugo Villeneuve
Hardware developer | Concepteur mat?riel
Lyrtech
Phone/T?l. : (1) (418) 877-4644 #2395
Toll-free/Sans frais - Canada & USA : (1) (888) 922-4644 #2395 Fax/T?l?c. : (1) (418) 877-7710
www.lyrtech.com
Infinite possibilities...TM