board support patch for phyCORE-MPC5200B-tiny
PATCH v5 1/1 board support patch for phyCORE-MPC5200B-tiny
Add support for the Phytec phyCORE-MPC5200B-tiny. Code originally from Pengutronix.de. v5 - Rebased onto u-boot/next. Changed official board name to phyCORE-MPC5200B-tiny.
--- MAINTAINERS | 4 MAKEALL | 1 Makefile | 9 + board/phytec/pcm030/Makefile | 50 ++++ board/phytec/pcm030/config.mk | 42 +++ board/phytec/pcm030/mt46v32m16-75.h | 54 ++++ board/phytec/pcm030/pcm030.c | 219 ++++++++++++++++ cpu/mpc5xxx/ide.c | 3 include/configs/pcm030.h | 472 +++++++++++++++++++++++++++++++++++ 9 files changed, 854 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
@@ -409,6 +409,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 +9 -0
@@ -696,6 +696,15 @@ 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 + 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 +219 -0
219 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 +472 -0
472 lines not on this page · raw message
PATCH v5 1/1 board support patch for phyCORE-MPC5200B-tiny
Quoted 2 lines · Jon Smirl
Add support for the Phytec phyCORE-MPC5200B-tiny. Code originally from Pengutronix.de. v5 - Rebased onto u-boot/next. Changed official board name to phyCORE-MPC5200B-tiny.
Does this patch need to go in through a maintainer's tree? If so, which one?
Signature · 2 lines
Jon Smirl jonsmirl at gmail.com
PATCH v5 1/1 board support patch for phyCORE-MPC5200B-tiny
Dear Jon Smirl,
Quoted 5 lines · In message <[email protected]> you…
Quoted 2 lines · Jon Smirl
Add support for the Phytec phyCORE-MPC5200B-tiny. Code originally from Pengutronix.de. v5 - Rebased onto u-boot/next. Changed official board name to phyCORE-MPC5200B-tiny.
Does this patch need to go in through a maintainer's tree? If so, which one?
Yes, it does.
Being a 5xxx board, it has to go through the u-boot-mpc5xxx tree.
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 Es sind ?berhaupt nur die Dummk?pfe, die sich den Befehlen der M?ch- tigen widersetzen. Um sie zu ruinieren ist es genug, ihre Befehle treu zu erf?llen. - Peter Hacks: "Die sch?ne Helena"
PATCH v5 1/1 board support patch for phyCORE-MPC5200B-tiny
In reply to Jon SmirlDear Jon Smirl,
Quoted 2 lines · In message <20090610141432.11516.60764.stgit@terra> you wrote:
Add support for the Phytec phyCORE-MPC5200B-tiny. Code originally from Pengutronix.de. v5 - Rebased onto u-boot/next. Changed official board name to phyCORE-MPC5200B-tiny.
This 2nd line is a comment and must go *below* the "---" line.
Quoted 2 lines
Signed-off-by Jon Smirl <[email protected]>---
Add comments only after this line.
Makefile MVBC_P_config: unconfig · line 703
Quoted 13 lines
Makefile +5
-0@@ -696,6 +696,15 @@ 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 ; \
"$(obj)" missing, will fail for out-of-tree builds.
Quoted 38 lines
board/phytec/pcm030/config.mk new file +32
-0@@ -0,0 +1,42 @@ +# +# (C) Copyright 2003 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# 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 +# + +# +# phyCORE-MPC5200B tiny board: +# +# Valid values for TEXT_BASE are: +# +# 0xFFF00000 boot high (standard configuration) +# 0xFF000000 boot low +# 0x00100000 boot from RAM (for testing only) +#
board/phytec/pcm030/config.mk line 42
Quoted 10 lines
board/phytec/pcm030/config.mk new file +10
-0+ +sinclude $(TOPDIR)/board/$(BOARDDIR)/config.tmp + +ifndef TEXT_BASE +## Standard: boot high +TEXT_BASE = 0xFFF00000 +endif + +PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE) -I$(TOPDIR)/board +
Coding Style. No trailing empty lines, please.
Quoted 6 lines
board/phytec/pcm030/mt46v32m16-75.h new file +0
-0@@ -0,0 +1,54 @@
...
board/phytec/pcm030/mt46v32m16-75.h line 52
Quoted 8 lines
board/phytec/pcm030/mt46v32m16-75.h new file +8
-0+/* Settings for XLB = 99 MHz */ +/* +#define SDRAM_MODE 0x008D0000 +#define SDRAM_EMODE 0x40090000 +#define SDRAM_CONTROL 0x714b0f00 +#define SDRAM_CONFIG1 0x63611730 +#define SDRAM_CONFIG2 0x47670000 +*/
Please do not add dead code.
Quoted 39 lines
board/phytec/pcm030/pcm030.c new file +33
-0@@ -0,0 +1,219 @@ +/* +* (C) Copyright 2003 +* Wolfgang Denk, DENX Software Engineering, wd at denx.de. +* +* (C) Copyright 2004 +* Mark Jonas, Freescale Semiconductor, mark.jonas at motorola.com. +* +* (C) Copyright 2006 +* Eric Schumann, Phytec Messtechnik GmbH +* +* 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 <common.h> +#include <mpc5xxx.h> +#include <pci.h> +#include <asm-ppc/io.h>
board/phytec/pcm030/pcm030.c line 43
Quoted 10 lines
board/phytec/pcm030/pcm030.c new file +10
-0+ +#include "mt46v32m16-75.h" + +#ifndef CONFIG_SYS_RAMBOOT +static void sdram_start (int hi_addr) +{ +volatile struct mpc5xxx_cdm *cdm = + (struct mpc5xxx_cdm *)MPC5XXX_CDM ; +volatile struct mpc5xxx_sdram *sdram = + (struct mpc5xxx_sdram *)MPC5XXX_SDRAM ;
Coding style: indentation by TAB only. (here and elsewhere).
...
board/phytec/pcm030/pcm030.c line 99
Quoted 8 lines
board/phytec/pcm030/pcm030.c new file +8
-0+phys_size_t initdram (int board_type) +{ +volatile struct mpc5xxx_mmap_ctl *mm = + (struct mpc5xxx_mmap_ctl *)CONFIG_SYS_MBAR ; +volatile struct mpc5xxx_cdm *cdm = + (struct mpc5xxx_cdm *)MPC5XXX_CDM ; +volatile struct mpc5xxx_sdram *sdram = + (struct mpc5xxx_sdram *)MPC5XXX_SDRAM ;
Incorrect indentation again.
Quoted 32 lines
board/phytec/pcm030/pcm030.c new file +32
-0+ulong dramsize =0 ; +ulong dramsize2 =0 ; +#ifndef CONFIG_SYS_RAMBOOT +ulong test1, test2; + +/* setup SDRAM chip selects */ +/* 256MB at 0x0 */ +out_be32 (&mm->sdram0,0x0000001b ); +/* disabled */ +out_be32 (&mm->sdram1,0x10000000 ); + +/* setup config registers */ +out_be32 (&sdram->config1,SDRAM_CONFIG1 ); +out_be32 (&sdram->config2,SDRAM_CONFIG2 ); + +#if defined(SDRAM_DDR ) && defined(SDRAM_TAPDELAY ) +/* set tap delay */ +out_be32 (&cdm->porcfg,SDRAM_TAPDELAY ); +#endif + +/* find RAM size using SDRAM CS0 only */ +sdram_start (0 ); + test1 =get_ram_size ((long *)CONFIG_SYS_SDRAM_BASE ,0x10000000 ); +sdram_start (1 ); + test2 =get_ram_size ((long *)CONFIG_SYS_SDRAM_BASE ,0x10000000 ); +if (test1 > test2) { +sdram_start (0 ); + dramsize = test1; + }else + dramsize = test2; + +/* memory smaller than 1MB is impossible */
board/phytec/pcm030/pcm030.c line 141
Quoted 10 lines
board/phytec/pcm030/pcm030.c new file +10
-0+if (dramsize < (1 <<20 )) + dramsize =0 ; + +/* set SDRAM CS0 size according to the amount of RAM found */ +if (dramsize >0 ) { +out_be32 (&mm->sdram0, + (0x13 +__builtin_ffs (dramsize >>20 ) -1 )); + }else +/* disabled */ +out_be32 (&mm->sdram0,0 );
That's a multiline else branch as is and thus requires braces.
Quoted 43 lines
board/phytec/pcm030/pcm030.c new file +43
-0+#else /* CONFIG_SYS_RAMBOOT */ + +/* retrieve size of memory connected to SDRAM CS0 */ + dramsize =in_be32 (&mm->sdram0) &0xFF ; +if (dramsize >=0x13 ) + dramsize = (1 << (dramsize -0x13 )) <<20 ; +else + dramsize =0 ; + +/* retrieve size of memory connected to SDRAM CS1 */ + dramsize2 =in_be32 (&mm->sdram1) &0xFF ; +if (dramsize2 >=0x13 ) + dramsize2 = (1 << (dramsize2 -0x13 )) <<20 ; +else + dramsize2 =0 ; + +#endif /* CONFIG_SYS_RAMBOOT */ + +return dramsize + dramsize2; +} + +int checkboard (void ) +{ +puts ("Board: phyCORE-MPC5200B-tiny\n" ); +return 0 ; +} + +#ifdef CONFIG_PCI +static struct pci_controller hose; + +extern void pci_mpc5xxx_init (struct pci_controller *); + +void pci_init_board (void ) +{ +pci_mpc5xxx_init (&hose); +} +#endif + +#if defined(CONFIG_OF_LIBFDT ) && defined(CONFIG_OF_BOARD_SETUP ) +void ft_board_setup (void *blob,bd_t * bd) +{ +ft_cpu_setup (blob, bd); +}
board/phytec/pcm030/pcm030.c line 195
Quoted 10 lines
board/phytec/pcm030/pcm030.c new file +10
-0+#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */ + +#if defined(CONFIG_CMD_IDE ) && defined(CONFIG_IDE_RESET ) + +#define GPIO_PSC2_4 0x02000000UL + +void init_ide_reset (void ) +{ +volatile struct mpc5xxx_wu_gpio *wu_gpio = + (struct mpc5xxx_wu_gpio *)MPC5XXX_WU_GPIO ;
Incorrect indentation again. Will stop here flagging these.
Quoted 29 lines
board/phytec/pcm030/pcm030.c new file +24
-0+debug ("init_ide_reset\n" ); + +/* Configure PSC2_4 as GPIO output for ATA reset */ +setbits_be32 (&wu_gpio->enable,GPIO_PSC2_4 ); +setbits_be32 (&wu_gpio->ddr,GPIO_PSC2_4 ); +/* Deassert reset */ + setbits_be32(&wu_gpio->dvo, GPIO_PSC2_4); +} + +void ide_set_reset (int idereset) +{ +volatile struct mpc5xxx_wu_gpio *wu_gpio = + (struct mpc5xxx_wu_gpio *)MPC5XXX_WU_GPIO ; +debug ("ide_reset(%d)\n" , idereset); + +if (idereset) { +clrbits_be32 (&wu_gpio->dvo,GPIO_PSC2_4 ); +/* Make a delay. MPC5200 spec says 25 usec min */ +udelay (500000 ); + }else +setbits_be32 (&wu_gpio->dvo,GPIO_PSC2_4 ); +} +#endif /* defined(CONFIG_CMD_IDE) && defined(CONFIG_IDE_RESET) */ +cpu/mpc5xxx/ide.c +0
-0
cpu/mpc5xxx/ide.c int ide_preinit (void) · line 51
Quoted 7 lines
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
Please no board-specific #ifdef's in common code. Chose a feature-based name instead.
Quoted 6 lines
include/configs/pcm030.h new file +0
-0@@ -0,0 +1,472 @@
...
Quoted 14 lines
include/configs/pcm030.h new file +14
-0+#ifndef __CONFIG_H +#define __CONFIG_H + +/* #define DEBUG */ + +/* To build RAMBOOT, replace this section the main Makefile +pcm030_config \ +pcm030_RAMBOOT_config \ +pcm030_LOWBOOT_config: unconfig +@ >include/config.h +@[ -z "$(findstring LOWBOOT_,$@)" ] || \ +{ echo "TEXT_BASE = 0xFF000000" >board/phytec/pcm030/config.tmp ; \ +echo "... with LOWBOOT configuration" ; \ +}
include/configs/pcm030.h line 53
Quoted 10 lines
include/configs/pcm030.h new file +10
-0+@[ -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 !!!" ; \ +} +@$(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" +*/
Incorrect multiline comment style. Also, the board config file is not a place for board documentation. Please add docs in the doc/ directory, or in your board directory.
include/configs/pcm030.h line 200
Quoted 2 lines
include/configs/pcm030.h new file +2
-0+#define CONFIG_SYS_FLASH_BASE 0xff000000 +#define CONFIG_SYS_FLASH_SIZE 0x01000000
You should rather use auto-sizing (ditto for RAM).
include/configs/pcm030.h line 233
Quoted 12 lines
include/configs/pcm030.h new file +12
-0+/* pcm030 ships with environment is EEPROM by default */ +#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 + +/* Moving the environment to flash can be more reliable +#define CONFIG_ENV_IS_IN_FLASH 1 +#define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + 0xfe0000) +#define CONFIG_ENV_SIZE 0x20000 +#define CONFIG_ENV_SECT_SIZE 0x20000 +*/
Incorrect multiline comment style.
And please do not add dead code.
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 The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense. - E. W. Dijkstra
PATCH v5 1/1 board support patch for phyCORE-MPC5200B-tiny
Quoted 4 lines · Wolfgang Denk
Review
Quoted 2 lines
(quoted diff) +2
-0+#define CONFIG_SYS_FLASH_BASE ? ? ? ? ? ? ? ?0xff000000 +#define CONFIG_SYS_FLASH_SIZE ? ? ? ? ? ? ? ?0x01000000You should rather use auto-sizing (ditto for RAM).
I don't know how to do this correctly. I took out the old auto-sizing code because it didn't work right.
Also, I don't own any hardware with different sized RAM/flash to test with.
Signature · 2 lines
Jon Smirl jonsmirl at gmail.com
PATCH v5 1/1 board support patch for phyCORE-MPC5200B-tiny
Dear Jon Smirl,
Quoted 8 lines · In message <[email protected]> you…
Quoted 5 lines
Review
Quoted 3 lines
(quoted diff) +2
-0+#define CONFIG_SYS_FLASH_BASE ? ? ? ? ? ? ? ?0xff000000 +#define CONFIG_SYS_FLASH_SIZE ? ? ? ? ? ? ? ?0x01000000You should rather use auto-sizing (ditto for RAM).
I don't know how to do this correctly. I took out the old auto-sizing code because it didn't work right.
See some other boards...
Quoted 1 line
Also, I don't own any hardware with different sized RAM/flash to test with.
Well, then it's sufficient if it auto-detects the correct size on your board.
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 it happens once, it's a bug. If it happens twice, it's a feature. If it happens more than twice, it's a design philosophy.