Add support for the digsy MTC board.
Subsystems (2)
PATCH 1/1 Add support for the digsy MTC board.
This is the InterControl custom device based on the MPC5200B chip.
MAKEALL +1 -0
@@ -47,6 +47,7 @@ LIST_5xxx=" \ BC3450 \ cm5200 \ cpci5200 \ + digsymtc \ EVAL5200 \ fo300 \ icecube_5100 \
Makefile +16 -0
@@ -527,6 +527,22 @@ cm5200_config: unconfig cpci5200_config: unconfig @$(MKCONFIG) -a cpci5200 ppc mpc5xxx cpci5200 esd +digsymtc_config \ +digsymtc_LOWBOOT_config \ +digsymtc_RAMBOOT_config: unconfig + @mkdir -p $(obj)include + @mkdir -p $(obj)board/digsymtc + @ >$(obj)include/config.h + @[ -z "$(findstring LOWBOOT_,$@)" ] || \ + { echo "TEXT_BASE = 0xFF000000" >$(obj)board/digsymtc/config.tmp ; \ + echo "... with LOWBOOT configuration" ; \ + } + @[ -z "$(findstring RAMBOOT_,$@)" ] || \ + { echo "TEXT_BASE = 0x00100000" >$(obj)board/digsymtc/config.tmp ; \ + echo "... with RAMBOOT configuration" ; \ + } + @$(MKCONFIG) -a digsymtc ppc mpc5xxx digsymtc + hmi1001_config: unconfig @$(MKCONFIG) hmi1001 ppc mpc5xxx hmi1001
board/digsymtc/Makefile new file +51 -0
51 lines not on this page · raw message
board/digsymtc/config.mk new file +43 -0
43 lines not on this page · raw message
board/digsymtc/digsymtc.c new file +316 -0
316 lines not on this page · raw message
board/digsymtc/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 +#define EEPROM_IDENT 2408 +#define EEPROM_ADDR_IDENT 0x0000 +#define EEPROM_ADDR_LEN_SYS 0x0002 +#define EEPROM_ADDR_LEN_SYSCFG 0x0004 +#define EEPROM_OFF_ETHADDR 23 + +#endif
board/digsymtc/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 +2 -2
@@ -12,7 +12,7 @@* * 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 +* 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
@@ -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
drivers/net/mpc5xxx_fec.c +1 -0
@@ -893,6 +893,7 @@ int mpc5xxx_fec_initialize(bd_t * bis) fec->rbdBase = (FEC_RBD *)(FEC_BD_BASE +FEC_TBD_NUM *sizeof (FEC_TBD )); #if defined(CONFIG_CANMB) || \ defined(CONFIG_CM5200) || \ + defined(CONFIG_DIGSY_MTC) || \ defined(CONFIG_HMI1001) || \ defined(CONFIG_ICECUBE) || \ defined(CONFIG_INKA4X0) || \
include/configs/digsymtc.h new file +341 -0
341 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH 1/1 Add support for the digsy MTC board.
Dear Grzegorz,
Quoted 1 line · In message <[email protected]> you wrote:
This is the InterControl custom device based on the MPC5200B chip.
...
General comment: there is a lot of code which could use a few comments so the reader has a chance to understand what exactly you are doing.
Quoted 2 lines
board/digsymtc/digsymtc.c new file +0
-0
...
Quoted 14 lines
board/digsymtc/digsymtc.c new file +14
-0+static void sdram_start (int hi_addr) +{ +long hi_addr_bit = hi_addr ?0x01000000 :0 ; +long control =SDRAM_CONTROL | hi_addr_bit; + +/* unlock mode register */ + *(vu_long *)MPC5XXX_SDRAM_CTRL = control |0x80000000 ; + __asm__volatile ("sync" ); + +/* precharge all banks */ + *(vu_long *)MPC5XXX_SDRAM_CTRL = control |0x80000002 ; + __asm__volatile ("sync" ); + +/* auto refresh */
board/digsymtc/digsymtc.c line 67
Quoted 10 lines
board/digsymtc/digsymtc.c new file +10
-0+ *(vu_long *)MPC5XXX_SDRAM_CTRL = control |0x80000004 ; + __asm__volatile ("sync" ); + +/* set mode register */ + *(vu_long *)MPC5XXX_SDRAM_MODE =SDRAM_MODE ; + __asm__volatile ("sync" ); + +/* normal operation */ + *(vu_long *)MPC5XXX_SDRAM_CTRL = control; + __asm__volatile ("sync" );
Please use proper I/O accessor functions instead of volatile pointer accesses, here and in all other similar places as well...
You can then get rid of the "sync"s as well.
board/digsymtc/digsymtc.c line 87
Quoted 11 lines
board/digsymtc/digsymtc.c new file +11
-0+phys_size_t initdram (int board_type) +{ +ulong dramsize =0 ; +ulong dramsize2 =0 ; +uint svr, pvr; +#ifndef CONFIG_SYS_RAMBOOT +ulong test1, test2; + +/* setup SDRAM chip selects */ + *(vu_long *)MPC5XXX_SDRAM_CS0CFG =0x0000001C ;/* 512MB at 0x0 */ + *(vu_long *)MPC5XXX_SDRAM_CS1CFG =0x80000000 ;/* disabled */
... like here and below.
board/digsymtc/digsymtc.c line 187
Quoted 1 line
board/digsymtc/digsymtc.c new file +1
-0+if (s !=NULL ) {puts (", " );puts (s); }
Please use proper indentation.
Quoted 1 line
+void
set_ethaddr(void)
Please add "static" here.
board/digsymtc/digsymtc.c line 247
Quoted 4 lines
board/digsymtc/digsymtc.c new file +4
-0+int last_stage_init (void ) +{ +set_ethaddr (); +return 0 ;
You should do this only as long as "ethaddr" is not already set in the environment.
Quoted 2 lines
board/digsymtc/eeprom.h new file +0
-0
...
board/digsymtc/eeprom.h line 30
Quoted 8 lines
board/digsymtc/eeprom.h new file +8
-0+ +#define EEPROM_ADDR CONFIG_SYS_I2C_EEPROM_ADDR +#define EEPROM_LEN 1024 +#define EEPROM_IDENT 2408 +#define EEPROM_ADDR_IDENT 0x0000 +#define EEPROM_ADDR_LEN_SYS 0x0002 +#define EEPROM_ADDR_LEN_SYSCFG 0x0004 +#define EEPROM_OFF_ETHADDR 23
You want to add some comments what all these magic defines mean...
cpu/mpc5xxx/ide.c line 18
Quoted 13 lines
cpu/mpc5xxx/ide.c +1
-1@@ -12,7 +12,7 @@* * 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 +* 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
Please don't arbitrarily reformat the code.
Quoted 2 lines
include/configs/digsymtc.h new file +0
-0
...
Quoted 1 line
+#define
CONFIG_PSC_CONSOLE4 /* console is on PSC4 */
...
include/configs/digsymtc.h line 118
Quoted 1 line
include/configs/digsymtc.h new file +1
-0+"console=ttyPSC1\0" \
This looks fishy to me - is it PSC1 or PSC4 ?
include/configs/digsymtc.h line 184
Quoted 4 lines
include/configs/digsymtc.h new file +4
-0+#define OF_CPU "PowerPC,5200 at 0" +#define OF_SOC "soc5200 at f0000000" +#define OF_TBCLK (bd->bi_busfreq / 4) +#define OF_STDOUT_PATH "/soc5200 at f0000000/serial at 2600"
Do we really need this?
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 All he had was nothing, but that was something, and now it had been taken away. - Terry Pratchett, _Sourcery_
PATCH 1/1 Add support for the digsy MTC board.
Quoted 9 lines · Wolfgang Denk
Dear Grzegorz,
Quoted 1 line · In message <[email protected]> you wrote:
This is the InterControl custom device based on the MPC5200B chip.
...
General comment: there is a lot of code which could use a few comments so the reader has a chance to understand what exactly you are doing.
Could you point me out which parts of code except eeprom defines needs more comments?
Quoted 17 lines
Quoted 6 lines
cpu/mpc5xxx/ide.c +0
-0cpu/mpc5xxx/ide.c line 18
Quoted 8 lines
cpu/mpc5xxx/ide.c +1
-1@@ -12,7 +12,7 @@* * 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 +* 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 Please don't arbitrarily reformat the code.
I think this tab was inserted by mistake. In u-boot code there are both versions of license with and without this tab. Do you really want to leave it?
pozdrawiam,
Grzesiek
PATCH 1/1 Add support for the digsy MTC board.
Dear Grzegorz Bernacki,
Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 4 lines
General comment: there is a lot of code which could use a few comments so the reader has a chance to understand what exactly you are doing.
Could you point me out which parts of code except eeprom defines needs more comments?
Hm... ther eare longish code sequences without a single line of comment what you are doing, or why.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
* 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
+ * 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
Quoted 5 lines
Quoted 1 line
Please don't arbitrarily reformat the code.
I think this tab was inserted by mistake. In u-boot code there are both versions of license with and without this tab. Do you really want to leave it?
The original form of the code has 2 spaces there, as usual after a full stop. It seems this file has been run through "unexpand -a" (or an equivalent command), which inserted a TAB instead of the two spaces. This seems no problem to me, as the text still looks exactly the same (and we same one byte of disk storage :-).
Your patch makes the text look different, and the change is to the worse.
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 The light at the end of the tunnel is usually a "No Exit" sign.
PATCH 1/1 Add support for the digsy MTC board.
Quoted 12 lines · Wolfgang Denk
Dear Grzegorz Bernacki,
Quoted 5 lines · In message <[email protected]> you wrote:
Quoted 3 lines
General comment: there is a lot of code which could use a few comments so the reader has a chance to understand what exactly you are doing.
Could you point me out which parts of code except eeprom defines needs more comments?
Hm... ther eare longish code sequences without a single line of comment what you are doing, or why.
I looked over the code again and still don't find the place with long code sequence without any line of comment (except eeprom defines which I'm going to comment). Could you be more specific about where I should add the comments?
regards,
Grzesiek
PATCH 1/1 Add support for the digsy MTC board.
In reply to Wolfgang DenkQuoted 3 lines · Wolfgang Denk
Dear Grzegorz Bernacki,
In message <[email protected]> you wrote:
[snip]
Quoted 12 lines
Quoted 11 lines
Quoted 8 lines
Quoted 7 lines
* 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
+ * 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 LicensePlease don't arbitrarily reformat the code.
I think this tab was inserted by mistake. In u-boot code there are both versions of license with and without this tab. Do you really want to leave it?
Quoted 5 lines
The original form of the code has 2 spaces there, as usual after a full stop. It seems this file has been run through "unexpand -a" (or an equivalent command), which inserted a TAB instead of the two spaces. This seems no problem to me, as the text still looks exactly the same (and we same one byte of disk storage :-).
Ahh, but two spaces vs. one tab have different meanings. They just happen to look the same at the moment (blithely ignoring the fact that this particular line of text isn't likely to change).
IMHO, replacing the two spaces with a tab was inadvertent whitespace damage apparently due to a whitespace cleanup and should be fixed back to being two spaces in all the header files.
Quoted 6 lines
Your patch makes the text look different, and the change is to the worse.
Best regards,
Wolfgang Denk
Painting the bike shed,
gvb
PATCH 1/1 Add support for the digsy MTC board.
In reply to Wolfgang DenkQuoted 40 lines · Wolfgang Denk
Dear Grzegorz,
Quoted 1 line · In message <[email protected]> you wrote:
This is the InterControl custom device based on the MPC5200B chip.
...
General comment: there is a lot of code which could use a few comments so the reader has a chance to understand what exactly you are doing.
Quoted 2 lines
board/digsymtc/digsymtc.c new file +0
-0...
Quoted 14 lines
board/digsymtc/digsymtc.c new file +14
-0+static void sdram_start (int hi_addr) +{ +long hi_addr_bit = hi_addr ?0x01000000 :0 ; +long control =SDRAM_CONTROL | hi_addr_bit; + +/* unlock mode register */ + *(vu_long *)MPC5XXX_SDRAM_CTRL = control |0x80000000 ; + __asm__volatile ("sync" ); + +/* precharge all banks */ + *(vu_long *)MPC5XXX_SDRAM_CTRL = control |0x80000002 ; + __asm__volatile ("sync" ); + +/* auto refresh */ board/digsymtc/digsymtc.c line 67
Quoted 10 lines
board/digsymtc/digsymtc.c new file +10
-0+ *(vu_long *)MPC5XXX_SDRAM_CTRL = control |0x80000004 ; + __asm__volatile ("sync" ); + +/* set mode register */ + *(vu_long *)MPC5XXX_SDRAM_MODE =SDRAM_MODE ; + __asm__volatile ("sync" ); + +/* normal operation */ + *(vu_long *)MPC5XXX_SDRAM_CTRL = control; + __asm__volatile ("sync" );Please use proper I/O accessor functions instead of volatile pointer accesses, here and in all other similar places as well...
Quoted 2 lines
You can then get rid of the "sync"s as well.
Ok, I changed it in whole file.
Quoted 14 lines
board/digsymtc/digsymtc.c line 87
Quoted 11 lines
board/digsymtc/digsymtc.c new file +11
-0+phys_size_t initdram (int board_type) +{ +ulong dramsize =0 ; +ulong dramsize2 =0 ; +uint svr, pvr; +#ifndef CONFIG_SYS_RAMBOOT +ulong test1, test2; + +/* setup SDRAM chip selects */ + *(vu_long *)MPC5XXX_SDRAM_CS0CFG =0x0000001C ;/* 512MB at 0x0 */ + *(vu_long *)MPC5XXX_SDRAM_CS1CFG =0x80000000 ;/* disabled */ ... like here and below.
Quoted 4 lines
board/digsymtc/digsymtc.c line 187
Quoted 1 line
board/digsymtc/digsymtc.c new file +1
-0+if (s !=NULL ) {puts (", " );puts (s); }Please use proper indentation.
ok, done
Quoted 4 lines
Quoted 1 line
+void
set_ethaddr(void)Please add "static" here.
ok, done
Quoted 8 lines
board/digsymtc/digsymtc.c line 247
Quoted 4 lines
board/digsymtc/digsymtc.c new file +4
-0+int last_stage_init (void ) +{ +set_ethaddr (); +return 0 ;You should do this only as long as "ethaddr" is not already set in the environment.
ok, done
Quoted 14 lines
Quoted 2 lines
board/digsymtc/eeprom.h new file +0
-0...
board/digsymtc/eeprom.h line 30
Quoted 8 lines
board/digsymtc/eeprom.h new file +8
-0+ +#define EEPROM_ADDR CONFIG_SYS_I2C_EEPROM_ADDR +#define EEPROM_LEN 1024 +#define EEPROM_IDENT 2408 +#define EEPROM_ADDR_IDENT 0x0000 +#define EEPROM_ADDR_LEN_SYS 0x0002 +#define EEPROM_ADDR_LEN_SYSCFG 0x0004 +#define EEPROM_OFF_ETHADDR 23You want to add some comments what all these magic defines mean...
comments added
Quoted 7 lines
Quoted 7 lines
cpu/mpc5xxx/ide.c +0
-0@@ -12,7 +12,7 @@* * This program is distributed in the hope that it will be useful,
Quoted 9 lines
cpu/mpc5xxx/ide.c line 18
Quoted 6 lines
cpu/mpc5xxx/ide.c +1
-1* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* 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 Please don't arbitrarily reformat the code.
ok, I restored original layout
Quoted 9 lines
Quoted 2 lines
include/configs/digsymtc.h new file +0
-0...
Quoted 1 line
+#define
CONFIG_PSC_CONSOLE4 /* console is on PSC4 */...
include/configs/digsymtc.h line 118
Quoted 1 line
include/configs/digsymtc.h new file +1
-0+"console=ttyPSC1\0" \This looks fishy to me - is it PSC1 or PSC4 ?
Linux enumerates ttyPSC starting from zero, so PSC3 is ttyPSC0 and ttyPSC4 is ttyPSC4. Some time ago ttyPSC number could be enforced by setting port-number field in dts, but lately it was removed.
Quoted 7 lines
include/configs/digsymtc.h line 184
Quoted 5 lines
include/configs/digsymtc.h new file +4
-0+#define OF_CPU "PowerPC,5200 at 0" +#define OF_SOC "soc5200 at f0000000" +#define OF_TBCLK (bd->bi_busfreq / 4) +#define OF_STDOUT_PATH "/soc5200 at f0000000/serial at 2600"Do we really need this?
OF_CPU, OF_SOC and OF_TBCLK is used and I removed OF_STDOUT_PATH.
regards,
Grzesiek