board support patch for phyCORE-MPC5200B-tiny
PATCH v2 1/1 board support patch for phyCORE-MPC5200B-tiny
Add support for the Phytec phyCORE-MPC5200B-tiny. Code originally from Pengutronix.de. Added MAKEALL and MAINTAINER entry per last posting.
--- MAINTAINERS | 4 MAKEALL | 1 Makefile | 10 + board/phytec/pcm030/Makefile | 50 ++++ board/phytec/pcm030/config.mk | 42 +++ board/phytec/pcm030/mt46v32m16-75.h | 54 ++++ board/phytec/pcm030/pcm030.c | 206 +++++++++++++++ cpu/mpc5xxx/ide.c | 3 include/configs/pcm030.h | 466 +++++++++++++++++++++++++++++++++++ 9 files changed, 836 insertions(+), 0 deletions(-) create mode 100644 board/phytec/pcm030/Makefile create mode 100644 board/phytec/pcm030/config.mk create mode 100644 board/phytec/pcm030/mt46v32m16-75.h create mode 100644 board/phytec/pcm030/pcm030.c create mode 100644 include/configs/pcm030.h
MAINTAINERS +4 -0
@@ -407,6 +407,10 @@ Andre Schwarz <[email protected]> mvbc_p MPC5200 mvblm7 MPC8343 +Jon Smirl <[email protected]> + + pcm030 MPC5200 + Timur Tabi <[email protected]> MPC8349E-mITX MPC8349
MAKEALL +1 -0
@@ -60,6 +60,7 @@ LIST_5xxx=" \ munices \ MVBC_P \ o2dnt \ + pcm030 \ pf5200 \ PM520 \ TB5200 \
Makefile +10 -0
@@ -687,6 +687,16 @@ MVBC_P_config: unconfig o2dnt_config: unconfig @$(MKCONFIG) o2dnt ppc mpc5xxx o2dnt +pcm030_config \ +pcm030_LOWBOOT_config: unconfig + @ >include/config.h + @[ -z "$(findstring LOWBOOT_,$@)" ] || \ + { echo "TEXT_BASE = 0xFF000000" >board/phytec/pcm030/config.tmp ; \ + echo "... with LOWBOOT configuration" ; \ + } + @$(MKCONFIG) -a pcm030 ppc mpc5xxx pcm030 phytec + @ echo "remember to set pcm030_REV to 0 for rev 1245.0 rev or to 1 for rev 1245.1" + pf5200_config: unconfig @$(MKCONFIG) pf5200 ppc mpc5xxx pf5200 esd
board/phytec/pcm030/Makefile new file +50 -0
50 lines not on this page · raw message
board/phytec/pcm030/config.mk new file +42 -0
42 lines not on this page · raw message
board/phytec/pcm030/mt46v32m16-75.h new file +54 -0
54 lines not on this page · raw message
board/phytec/pcm030/pcm030.c new file +206 -0
206 lines not on this page · raw message
cpu/mpc5xxx/ide.c +3 -0
@@ -45,6 +45,9 @@ int ide_preinit (void)#if defined(CONFIG_SYS_ATA_CS_ON_I2C2 )/* ATA cs0/1 on i2c2 clk/io */ reg = (reg & ~0x03000000ul ) |0x02000000ul ; +#elif defined(CONFIG_PHYCORE_MPC5200B_TINY ) +/* ATA cs0/1 on Timer 0/1 */ + reg = (reg & ~0x03000000ul ) |0x03000000ul ;#else /* ATA cs0/1 on Local Plus cs4/5 */ reg = (reg & ~0x03000000ul ) |0x01000000ul ;
include/configs/pcm030.h new file +466 -0
466 lines not on this page · raw message
PATCH v2 1/1 board support patch for phyCORE-MPC5200B-tiny
Dear Jon Smirl,
Quoted 2 lines · In message <20090530194126.12535.19728.stgit@terra> you wrote:
Add support for the Phytec phyCORE-MPC5200B-tiny. Code originally from Pengutronix.de. Added MAKEALL and MAINTAINER entry per last posting.
...
board/phytec/pcm030/pcm030.c line 48
Quoted 12 lines
board/phytec/pcm030/pcm030.c new file +12
-0+#ifndef CONFIG_SYS_RAMBOOT +static void sdram_start (int hi_addr) +{ +long hi_addr_bit = hi_addr ?0x01000000 :0 ; + +/* unlock mode register */ +out_be32 ((unsigned __iomem *)MPC5XXX_SDRAM_CTRL , + (SDRAM_CONTROL |0x80000000 | hi_addr_bit)); + +/* precharge all banks */ +out_be32 ((unsigned __iomem *)MPC5XXX_SDRAM_CTRL , + (SDRAM_CONTROL |0x80000002 | hi_addr_bit));
Please use a proper C struct to describe the memory controller's register layout and get rid of all these casts.
Quoted 1 line
+#if
SDRAM_DDR
Better use "#ifdef" here.
...
board/phytec/pcm030/pcm030.c line 190
Quoted 10 lines
board/phytec/pcm030/pcm030.c new file +10
-0+void init_ide_reset (void ) +{ +debug ("init_ide_reset\n" ); + +/* Configure PSC2_4 as GPIO output for ATA reset */ +setbits_be32 ((unsigned __iomem *)MPC5XXX_WU_GPIO_ENABLE ,GPIO_PSC2_4 ); +setbits_be32 ((unsigned __iomem *)MPC5XXX_WU_GPIO_DIR ,GPIO_PSC2_4 ); +/* Deassert reset */ +setbits_be32 ((unsigned __iomem *)MPC5XXX_WU_GPIO_DATA_O ,GPIO_PSC2_4 ); +}
Ditto here, and in thew rest of the patch.
board/phytec/pcm030/pcm030.c line 203
Quoted 12 lines
board/phytec/pcm030/pcm030.c new file +12
-0+void ide_set_reset (int idereset) +{ +debug ("ide_reset(%d)\n" , idereset); + +if (idereset) { +clrbits_be32 ((unsigned __iomem *) +MPC5XXX_WU_GPIO_DATA_O ,GPIO_PSC2_4 ); +/* Make a delay. MPC5200 spec says 25 usec min */ +udelay (500000 ); + }else +setbits_be32 ((unsigned __iomem *) +MPC5XXX_WU_GPIO_DATA_O ,GPIO_PSC2_4 );
Please use braces for multiline statements.
...
Quoted 5 lines
include/configs/pcm030.h new file +0
-0
...
include/configs/pcm030.h line 43
Quoted 9 lines
include/configs/pcm030.h new file +9
-0+/* To build RAMBOOT, add this to the main Makefile +@[ -z "$(findstring RAMBOOT_,$@)" ] || \ +{ echo "TEXT_BASE = 0x00100000" >board/phycore_mpc5200b_tiny/\ +config.tmp ; \ +echo "... with RAMBOOT configuration" ; \ +echo "... remember to make sure that MBAR is already \ +switched to 0xF0000000 !!!" ; \ +} +*/
This does not belong into the board configuration file. Evantually you want to provide additional documentation for this board? In any case, please provide _clear_ instructions. Just "adding" above lines of code "to the main Makefile" (say, at the end, since you give no beppter instructions) will probably not work as intended.
Quoted 1 line
+#define
CONFIG_BOARDINFO"Phytec Phycore mpc5200b tiny"
Too long. Please be terse.
include/configs/pcm030.h line 56
Quoted 10 lines
include/configs/pcm030.h new file +10
-0+/*----------------------------------------------------------------------------- +High Level Configuration Options +(easy to change) +-----------------------------------------------------------------------------*/ +#define CONFIG_MPC5xxx 1/* This is an MPC5xxx CPU */ +#define CONFIG_MPC5200 1/* (more precisely an MPC5200 CPU) */ +#define CONFIG_MPC5200_DDR 1/* (with DDR-SDRAM) */ +#define CONFIG_PHYCORE_MPC5200B_TINY 1/* phyCORE-MPC5200B -> */ +/* FEC configuration and IDE */ +#define CONFIG_SYS_MPC5XXX_CLKIN 33333333/* ... running at 33.333333MHz */
Please verify: 33.333333 MHz or 33.333000 MHz or 33.0000000 MHz?
Quoted 47 lines
include/configs/pcm030.h new file +47
-0+#define BOOTFLAG_COLD 0x01/* Normal Power-On: Boot from FLASH */ +#define BOOTFLAG_WARM 0x02/* Software reboot */ + +/*----------------------------------------------------------------------------- +Serial console configuration +-----------------------------------------------------------------------------*/ +#define CONFIG_PSC_CONSOLE 3/* console is on PSC3 -> */ +/*define gps port conf. */ +/* register later on to */ +/*enable UART function! */ +#define CONFIG_BAUDRATE 115200/* ... at 115200 bps */ +#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 } + +/* +* Command line configuration. +*/ +#include <config_cmd_default.h> + +#define CONFIG_CMD_DATE +#define CONFIG_CMD_DHCP +#define CONFIG_CMD_EEPROM +#define CONFIG_CMD_I2C +#define CONFIG_CMD_JFFS2 +#define CONFIG_CMD_MII +#define CONFIG_CMD_NFS +#define CONFIG_CMD_PCI + +#define CONFIG_TIMESTAMP 1/* Print image info with timestamp */ + +#if (TEXT_BASE ==0xFF000000 )/* Boot low */ +#define CONFIG_SYS_LOWBOOT 1 +#endif +/* RAMBOOT will be defined automatically in memory section */ + +#define CONFIG_JFFS2_CMDLINE +#define MTDIDS_DEFAULT "nor0=physmap-flash.0" +#define MTDPARTS_DEFAULT "mtdparts=physmap-flash.0:256k(ubootl)," \ + "1792k(kernel),13312k(jffs2),256k(uboot)ro,256k(oftree),-(space)" + +/*----------------------------------------------------------------------------- +Autobooting +-----------------------------------------------------------------------------*/ +#define CONFIG_BOOTDELAY 3/* autoboot after 3 seconds */ +#define CONFIG_ZERO_BOOTDELAY_CHECK /* allow stopping of boot process */ +/* even with bootdelay=0 */ +#undef CONFIG_BOOTARGS +
include/configs/pcm030.h line 113
Quoted 10 lines
include/configs/pcm030.h new file +10
-0+ +#define CONFIG_PREBOOT "echo;" \ + "echo Type \"run bootcmd_net\" to load Kernel over TFTP and to "\ + "mount root filesystem over NFS;" \ + "echo" + +#define CONFIG_EXTRA_ENV_SETTINGS \ + "netdev=eth0\0" \ + "mtdparts=mtdparts=physmap-flash.0:256k(ubootl),1792k(kernel)," \ + "13312k(jffs2),256k(uboot)ro,256k(oftree),-(space)\0" \
Do not repeat this. Use MTDPARTS_DEFAULT as defined above instead.
include/configs/pcm030.h line 117
Quoted 4 lines
include/configs/pcm030.h new file +4
-0+"ipaddr=192.168.23.226\0" \ +"netmask=255.255.255.0\0" \ +"serverip=192.168.23.1\0" \ +"gateway=192.168.23.1\0" \
NAK. We don't allow this in board config files.
Quoted 5 lines
+/*-------------------------------------------------------------------------
+ * PCI Mapping:
+ *0x40000000-0x4fffffff- PCI Memory
+ *0x50000000-0x50ffffff- PCI IO Space
+ * -----------------------------------------------------------------------*/
Just a note: don't attempt to use these mappings in Linux; they overlap with CONFIG_TASKSIZE.
...
Quoted 5 lines
include/configs/pcm030.h new file +5
-0+/*--------------------------------------------------------------------------- +Environment settings +---------------------------------------------------------------------------*/ +#if 0 +#define CONFIG_ENV_IS_IN_FLASH 1
include/configs/pcm030.h line 229
Quoted 10 lines
include/configs/pcm030.h new file +10
-0+#define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + 0xfe0000) +#define CONFIG_ENV_SIZE 0x20000 +#define CONFIG_ENV_SECT_SIZE 0x20000 +#else +#define CONFIG_ENV_IS_IN_EEPROM 1 +#define CONFIG_ENV_OFFSET 0x00/* environment starts at the */ +/*beginning of the EEPROM */ +#define CONFIG_ENV_SIZE CONFIG_SYS_EEPROM_SIZE +#endif +#define CONFIG_ENV_OVERWRITE 1
Are you sure? This is pessimal choice. EEPROM is slow and unreliable.
After you decided for a solution, then please remove the (then) dead code.
...
Quoted 1 line
+#define
CONFIG_SYS_LOAD_ADDR0x100000/* default load address */
This used to be a reasonable choice with Linux 2.4.4; it ain't so any more.
Best regards,
Wolfgang Denk
Signature · 7 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 Abstainer: A weak person who yields to the temptation of denying him- self a pleasure. A total abstainer is one who abstains from every- thing but abstention, and especially from inactivity in the affairs of others. - Ambrose Bierce
PATCH v2 1/1 board support patch for phyCORE-MPC5200B-tiny
Quoted 18 lines · Wolfgang Denk
Quoted 5 lines
include/configs/pcm030.h new file +5
-0+/*--------------------------------------------------------------------------- +Environment settings +---------------------------------------------------------------------------*/ +#if 0 +#define CONFIG_ENV_IS_IN_FLASH ? ? ? 1include/configs/pcm030.h line 229
Quoted 10 lines
include/configs/pcm030.h new file +10
-0+#define CONFIG_ENV_ADDR ? ? ? ? ? ? ?(CONFIG_SYS_FLASH_BASE + 0xfe0000) +#define CONFIG_ENV_SIZE ? ? ? ? ? ? ?0x20000 +#define CONFIG_ENV_SECT_SIZE 0x20000 +#else +#define CONFIG_ENV_IS_IN_EEPROM ? ? ?1 +#define CONFIG_ENV_OFFSET ? ?0x00 ? ?/* environment starts at the */ + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? /*beginning of the EEPROM */ +#define CONFIG_ENV_SIZE ? ? ? ? ? ? ?CONFIG_SYS_EEPROM_SIZE +#endif +#define CONFIG_ENV_OVERWRITE 1Are you sure? This is pessimal choice. EEPROM is slow and unreliable.
Quoted 2 lines
After you decided for a solution, then please remove the (then) dead code.
Phytec ships default with the boards using the EEPROM. But, I'm with you and I flip the #if to use the FLASH.
Both FLASH and EEPROM work. The flash has 128KB page size which wastes a lot of space holding a 2KB environment so I see why some people want to stick with EEPROM.
So I'd like to keep them both in place. Would it be better if the FLASH section was a comment?
Signature · 2 lines
Jon Smirl jonsmirl at gmail.com
PATCH v2 1/1 board support patch for phyCORE-MPC5200B-tiny
Dear Jon Smirl,
Quoted 7 lines · In message <[email protected]> you…
Quoted 5 lines
Are you sure? This is pessimal choice. EEPROM is slow and unreliable.
After you decided for a solution, then please remove the (then) dead code.
Phytec ships default with the boards using the EEPROM.
Once in mainline, you might want to point Phytec to that new, current and well tested code, so they can consoider switching to the mainline version.
Quoted 1 line
But, I'm with you and I flip the #if to use the FLASH.
I also recommend to configure resndant environment.
Quoted 3 lines
Both FLASH and EEPROM work. The flash has 128KB page size which wastes a lot of space holding a 2KB environment so I see why some people want to stick with EEPROM.
Yes, "wasting" 128 or even 256 k of flash for "just a few variables" seems to be an expensive thing. But keep in mind that most 52xx systems boot from 0xFFF00000, so the the last megabyte of flash is an excellent place for this (and probably the device tree).
Quoted 2 lines
So I'd like to keep them both in place. Would it be better if the FLASH section was a comment?
Indeed, a comment would be better.
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 If you believe that feeling bad or worrying long enough will change a past or future event, then you are residing on another planet with a different reality system.
PATCH v2 1/1 board support patch for phyCORE-MPC5200B-tiny
In reply to Wolfgang DenkQuoted 4 lines · Wolfgang Denk
Quoted 1 line
+#define
CONFIG_SYS_LOAD_ADDR0x100000/* default load address */This used to be a reasonable choice with Linux 2.4.4; it ain't so any more.
What should it be?
Signature · 2 lines
Jon Smirl jonsmirl at gmail.com
PATCH v2 1/1 board support patch for phyCORE-MPC5200B-tiny
Dear Jon Smirl,
Quoted 7 lines · In message <[email protected]> you…
Quoted 4 lines · Wolfgang Denk
Quoted 1 line
+#define
CONFIG_SYS_LOAD_ADDR0x100000/* default load address */This used to be a reasonable choice with Linux 2.4.4; it ain't so any more.
What should it be?
At least 4 MB, or higher, depending on your typical kernel configurations.
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 Success in marriage is not so much finding the right person as it is being the right person.
PATCH v2 1/1 board support patch for phyCORE-MPC5200B-tiny
In reply to Wolfgang DenkQuoted 3 lines · Wolfgang Denk
Quoted 1 line
+#define
CONFIG_BOARDINFO"Phytec Phycore mpc5200b tiny"Too long. Please be terse.
The official name of the board is "phyCORE-MPC5200B-tiny".
rsc
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |