Add support for the digsy MTC board.
PATCH v6 1/1 Add support for the digsy MTC board.
This is the InterControl custom device based on the MPC5200B chip.
---
Version 6:
- adjusted kernel console variable to use PSC4 (to reflect recent DTS changes)
Version 5:
- removed unnecessary braces
- changed out32/in32 to out_be32/in_be32
Version 4:
- rebased to Ben's FEC changes
Version 3:
- updated (c)
Version 2:
- use I/O accessor functions instead of volatile pointer
- set ethernet address only if not set in environment
- add some comments and some style cleanup
MAKEALL | 1 + Makefile | 16 ++ board/digsy_mtc/Makefile | 32 ++++ board/digsy_mtc/config.mk | 24 +++ board/digsy_mtc/digsy_mtc.c | 331 ++++++++++++++++++++++++++++++++++++ board/digsy_mtc/eeprom.h | 32 ++++ board/digsy_mtc/is42s16800a-7t.h | 28 +++ cpu/mpc5xxx/ide.c | 2 +- include/configs/digsy_mtc.h | 346 ++++++++++++++++++++++++++++++++++++++ 9 files changed, 811 insertions(+), 1 deletions(-) create mode 100644 board/digsy_mtc/Makefile create mode 100644 board/digsy_mtc/config.mk create mode 100644 board/digsy_mtc/digsy_mtc.c create mode 100644 board/digsy_mtc/eeprom.h create mode 100644 board/digsy_mtc/is42s16800a-7t.h create mode 100644 include/configs/digsy_mtc.h
MAKEALL +1 -0
@@ -47,6 +47,7 @@ LIST_5xxx=" \ BC3450 \ cm5200 \ cpci5200 \ + digsy_mtc \ EVAL5200 \ fo300 \ icecube_5100 \
Makefile +16 -0
@@ -527,6 +527,22 @@ cm5200_config: unconfig cpci5200_config: unconfig @$(MKCONFIG) -a cpci5200 ppc mpc5xxx cpci5200 esd +digsy_mtc_config \ +digsy_mtc_LOWBOOT_config \ +digsy_mtc_RAMBOOT_config: unconfig + @mkdir -p $(obj)include + @mkdir -p $(obj)board/digsy_mtc + @ >$(obj)include/config.h + @[ -z "$(findstring LOWBOOT_,$@)" ] || \ + { echo "TEXT_BASE = 0xFF000000" >$(obj)board/digsy_mtc/config.tmp ; \ + echo "... with LOWBOOT configuration" ; \ + } + @[ -z "$(findstring RAMBOOT_,$@)" ] || \ + { echo "TEXT_BASE = 0x00100000" >$(obj)board/digsy_mtc/config.tmp ; \ + echo "... with RAMBOOT configuration" ; \ + } + @$(MKCONFIG) -a digsy_mtc ppc mpc5xxx digsy_mtc + hmi1001_config: unconfig @$(MKCONFIG) hmi1001 ppc mpc5xxx hmi1001
board/digsy_mtc/Makefile new file +32 -0
@@ -0,0 +1,32 @@ + +# +# Author: Grzegorz Bernacki, Semihalf, gjb at semihalf.com +# + +include $(TOPDIR)/config.mk + +LIB = $(obj)lib$(BOARD).a + +COBJS := $(BOARD).o + +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) +SOBJS := $(addprefix $(obj),$(SOBJS)) + +$(LIB): $(obj).depend $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) + +clean: + rm -f $(SOBJS) $(OBJS) + +distclean: clean + rm -f $(LIB) core *.bak .depend + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################
board/digsy_mtc/config.mk new file +24 -0
@@ -0,0 +1,24 @@ +# +# Author: Grzegorz Bernacki, Semihalf, gjb at semihalf.com +# + +# +# digsyMTC board: +# +# Valid values for TEXT_BASE are: +# +# 0xFFF00000 boot high (standard configuration) +# 0xFE000000 boot low +# 0x00100000 boot from RAM (for testing only) +# + +sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp + +ifndef TEXT_BASE +## Standard: boot high +TEXT_BASE = 0xFFF00000 +## For testing: boot from RAM +# TEXT_BASE = 0x00100000 +endif + +PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -I$(TOPDIR)/board
board/digsy_mtc/digsy_mtc.c new file +331 -0
331 lines not on this page · raw message
board/digsy_mtc/eeprom.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* (C) Copyright 2009 Semihalf. +* Written by: Grzegorz Bernacki <[email protected]> +* +* 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 anty 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 +* +*/ +#ifndef CMD_EEPROM_H +#define CMD_EEPROM_H + +#define EEPROM_ADDR CONFIG_SYS_I2C_EEPROM_ADDR +#define EEPROM_LEN 1024/* eeprom length */ +#define EEPROM_IDENT 2408/* identification word */ +#define EEPROM_ADDR_IDENT 0/* identification word offset */ +#define EEPROM_ADDR_LEN_SYS 2/* system area lenght offset */ +#define EEPROM_ADDR_LEN_SYSCFG 4/* system config area length offset */ +#define EEPROM_ADDR_ETHADDR 23/* ethernet addres offset */ + +#endif
board/digsy_mtc/is42s16800a-7t.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* (C) Copyright 2004-2009 +* Mark Jonas, Freescale Semiconductor, mark.jonas at motorola.com. +* +* 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 +*/ + +#define SDRAM_MODE 0x00CD0000 +#define SDRAM_CONTROL 0x505F0000 +#define SDRAM_CONFIG1 0xD2322900 +#define SDRAM_CONFIG2 0x8AD70000 +
cpu/mpc5xxx/ide.c +1 -1
@@ -42,7 +42,7 @@ int ide_preinit (void)struct mpc5xxx_sdma *psdma = (struct mpc5xxx_sdma *)MPC5XXX_SDMA ; reg = *(vu_long *)MPC5XXX_GPS_PORT_CONFIG ; -#if defined(CONFIG_TOTAL5200 ) +#if defined(CONFIG_TOTAL5200 ) || defined(CONFIG_DIGSY_MTC )/* ATA cs0/1 on i2c2 clk/io */ reg = (reg & ~0x03000000ul ) |0x02000000ul ;#else
include/configs/digsy_mtc.h new file +346 -0
346 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH v6 1/1 Add support for the digsy MTC board.
Hi John,
I believe this patch should go through your repository. Could you tell me when you can apply it into u-boot-mpc5xxx?
Thanks,
Grzesiek
PATCH v6 1/1 Add support for the digsy MTC board.
In reply to Grzegorz BernackiDear Grzegorz Bernacki,
Quoted 2 lines · In message <[email protected]> you wrote:
Signed-off-by Grzegorz Bernacki <[email protected]>
I was about to apply this as John probably has very little time to care about this.
But I have a few comments / requests first:
...
Review
Quoted 2 lines
(quoted diff) +2
-0+void static set_ethaddr(void) +{
...
Eventually this should be rebased against the "next" branch, and board_get_enetaddr() should be used here?
board/digsy_mtc/digsy_mtc.c line 240
Quoted 5 lines
board/digsy_mtc/digsy_mtc.c new file +5
-0+for (n =0 ; n <6 ; n++) { + addr = addr_of_eth_addr + n; + chip =EEPROM_ADDR + ((addr &0x300 )>>8 ); +i2c_read (chip, (addr &0xFF ),1 , (uchar *)ð_addr[n],1 ); + }
Can we not do this with a single i2c_read() call with length = 6 ?
board/digsy_mtc/digsy_mtc.c line 245
Quoted 4 lines
board/digsy_mtc/digsy_mtc.c new file +4
-0+sprintf (str_eth_addr,"%02X:%02X:%02X:%02X:%02X:%02X" , + eth_addr[0 ], eth_addr[1 ], eth_addr[2 ], + eth_addr[3 ], eth_addr[4 ], eth_addr[5 ]); +setenv ("ethaddr" , str_eth_addr);
eth_setenv_enetaddr() should be used here.
See commit 3754a3b3 (in the "next" branch) for details.
board/digsy_mtc/digsy_mtc.c line 253
Quoted 6 lines
board/digsy_mtc/digsy_mtc.c new file +6
-0+int last_stage_init (void ) +{ +if (getenv ("ethaddr" ) ==NULL ) +set_ethaddr (); +return 0 ; +}
I think this should be removed in the new context.
...
board/digsy_mtc/digsy_mtc.c line 276
Quoted 7 lines
board/digsy_mtc/digsy_mtc.c new file +7
-0+void init_ide_reset (void ) +{ +debug ("init_ide_reset\n" ); + +/* set gpio output value to 1 */ +out_be32 ((void *)MPC5XXX_WU_GPIO_DATA_O , +in_be32 ((void *)MPC5XXX_WU_GPIO_DATA_O ) | (1 <<25 ));
Should that not be replaced by the (much easier to read)
setbits_be32((void *)MPC5XXX_WU_GPIO_DATA_O, (1 << 25));
?
board/digsy_mtc/digsy_mtc.c line 285
Quoted 9 lines
board/digsy_mtc/digsy_mtc.c new file +9
-0+/* open drain output */ +out_be32 ((void *)MPC5XXX_WU_GPIO_ODE , +in_be32 ((void *)MPC5XXX_WU_GPIO_ODE ) | (1 <<25 )); +/* direction output */ +out_be32 ((void *)MPC5XXX_WU_GPIO_DIR , +in_be32 ((void *)MPC5XXX_WU_GPIO_DIR ) | (1 <<25 )); +/* enable gpio */ +out_be32 ((void *)MPC5XXX_WU_GPIO_ENABLE , +in_be32 ((void *)MPC5XXX_WU_GPIO_ENABLE ) | (1 <<25 ));
Ditto here and elsewhere.
board/digsy_mtc/digsy_mtc.c line 295
Quoted 7 lines
board/digsy_mtc/digsy_mtc.c new file +7
-0+void ide_set_reset (int idereset) +{ +debug ("ide_reset(%d)\n" , idereset); + +/* set gpio output value to 0 */ +out_be32 ((void *)MPC5XXX_WU_GPIO_DATA_O , +in_be32 ((void *)MPC5XXX_WU_GPIO_DATA_O ) & ~(1 <<25 ));
And this should probably be replaced by
clrbits_be32((void *)MPC5XXX_WU_GPIO_DATA_O, (1 << 25));
?
cpu/mpc5xxx/ide.c int ide_preinit (void) · line 48
Quoted 13 lines
cpu/mpc5xxx/ide.c +1
-1@@ -42,7 +42,7 @@ int ide_preinit (void)struct mpc5xxx_sdma *psdma = (struct mpc5xxx_sdma *)MPC5XXX_SDMA ; reg = *(vu_long *)MPC5XXX_GPS_PORT_CONFIG ; -#if defined(CONFIG_TOTAL5200 ) +#if defined(CONFIG_TOTAL5200 ) || defined(CONFIG_DIGSY_MTC )/* ATA cs0/1 on i2c2 clk/io */ reg = (reg & ~0x03000000ul ) |0x02000000ul ;#else
Instead of adding board-specific #ifdef's here, we should change it to a feature-specific one, and #define some CONFIG_ATA_CS_ON_I2C2 or similar in the two board config files.
What do you think?
Best regards,
Wolfgang Denk
Signature · 6 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 My challenge to the goto-less programmer is to recode tcp_input() without any gotos ... without any loss of efficiency (there has to be a catch). - W. R. Stevens
PATCH v6 1/1 Add support for the digsy MTC board.
Quoted 8 lines · Wolfgang Denk
board/digsy_mtc/digsy_mtc.c line 240
Quoted 5 lines
board/digsy_mtc/digsy_mtc.c new file +5
-0+for (n =0 ; n <6 ; n++) { + addr = addr_of_eth_addr + n; + chip =EEPROM_ADDR + ((addr &0x300 )>>8 ); +i2c_read (chip, (addr &0xFF ),1 , (uchar *)ð_addr[n],1 ); + }Can we not do this with a single
i2c_read()call with length = 6 ?
Yes we can, but it is safer this way in the case when ethernet address spans across two chips. Rest of comments addressed in version 7 of the patch which will be sent soon.
regards,
Grzesiek
PATCH v6 1/1 Add support for the digsy MTC board.
Dear Grzegorz Bernacki,
Quoted 10 lines · In message <[email protected]> you wrote:
Quoted 8 lines · Wolfgang Denk
board/digsy_mtc/digsy_mtc.c line 240
Quoted 5 lines
board/digsy_mtc/digsy_mtc.c new file +5
-0+for (n =0 ; n <6 ; n++) { + addr = addr_of_eth_addr + n; + chip =EEPROM_ADDR + ((addr &0x300 )>>8 ); +i2c_read (chip, (addr &0xFF ),1 , (uchar *)ð_addr[n],1 ); + }Can we not do this with a single
i2c_read()call with length = 6 ?
Quoted 3 lines
Yes we can, but it is safer this way in the case when ethernet address spans across two chips. Rest of comments addressed in version 7 of the patch which will be sent soon.
Is such a scenario (MAC address split across 2 different EEPROM devices) possible (and supported) on these systems?
Best regards,
Wolfgang Denk
Signature · 5 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 It may be that your whole purpose in life is simply to serve as a warning to others.
PATCH v6 1/1 Add support for the digsy MTC board.
Quoted 8 lines
Quoted 4 lines
Yes we can, but it is safer this way in the case when ethernet address spans across two chips. Rest of comments addressed in version 7 of the patch which will be sent soon.
Is such a scenario (MAC address split across 2 different EEPROM devices) possible (and supported) on these systems?
I think it is possible, cause whole eeprom is threated as a one continuous area. Moreover, this function is called only if ethaddr environment variable is not set, so not very often. I don't think optimizing it is worth risk of reading incorrect ethernet address.
regards,
Grzesiek
PATCH v6 1/1 Add support for the digsy MTC board.
Dear Grzegorz Bernacki,
Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 3 lines
Is such a scenario (MAC address split across 2 different EEPROM devices) possible (and supported) on these systems?
I think it is possible, cause whole eeprom is threated as a one continuous area. Moreover, this function is called only if ethaddr environment variable is not set, so not very often. I don't think optimizing it is worth risk of reading incorrect ethernet address.
You mean, there is actually only *one* phyical EEPROM chip on the board? Then the I2C driver is supposed to support reading / writing accross page boundaries.
If you are sure it doesn't work on this board, then the driver needs fixing.
Best regards,
Wolfgang Denk
Signature · 5 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 When in doubt, mumble; when in trouble, delegate; when in charge, ponder. -- James H. Boren
PATCH v6 1/1 Add support for the digsy MTC board.
Quoted 5 lines · Wolfgang Denk
Dear Grzegorz Bernacki,
Quoted 2 lines · In message <[email protected]> you wrote:
Quoted 2 lines
Is such a scenario (MAC address split across 2 different EEPROM devices) possible (and supported) on these systems?
Quoted 9 lines
Quoted 4 lines
I think it is possible, cause whole eeprom is threated as a one continuous area. Moreover, this function is called only if ethaddr environment variable is not set, so not very often. I don't think optimizing it is worth risk of reading incorrect ethernet address.
You mean, there is actually only *one* phyical EEPROM chip on the board? Then the I2C driver is supposed to support reading / writing accross page boundaries.
Yes, it is one physical chip divided into 4 blocks. The chip is organized so that accessing different blocks requires using different i2c slave addresses, effectively making the chip appear as several i2c slaves. The logic to handle such addressing is already implemented in the eeprom access functions in the common/cmd_eeprom.c. Next version of the patch will just use that existing read method.
regards,
Grzesiek