Rework MPC512x Support
Subsystems (2)
cover Rework MPC512x Support
The following patch series includes a heavy rework of the existing code for MPC512x processors. The changes include especially:
- move common files from mpc5121ads (so far ads5121) board to common directory so they can be reused by other boards based on the same CPU
- rename "ads5121" into "freescale/mpc5121ads" so thesame board name as in Linux is used, and the vendor directory is correct
- rework the whole MPC512x related code to use I/O acessors (i. e. in_*() and out_*() functions) instead of deprecated pointer accesses
- Don't #define register offsets, but use the offset from the respective C structs instead [1]
- remove include/mpc512x.h to avoid duplication of the same information in include/asm-ppc/immap_512x.h
- add support for the ARIA board, a MPC5121e based COM Express module
[1] Note: It was not possible to get completely rid of #define'd register offsets yet, as some are used in cpu/mpc512x/start.S, and in assembly the available options are limited. In Linux, the required header files with the respective #define's are auto-generated from the C struct definitions. We intend to do the same, but this needs co-ordinations across architectures - for example, Blackfin already uses such an approach. For now, we created cpu/mpc512x/asm-offsets.h; this file will be removed again as soon as auto-generation works.
Note: It might seem a good idea to squash related patches (like all I/O accessors patches into one, and all mpc512x.h removal patches into another one) to reduce the number of commits. I decided against doing this, as the amount of changes carries the risk that, inspite of pretty careful testing, some errors have not been discovered yet. The current one-step-at-a-time approach is more git-bisect friendly.
Patches are agains v2009.06-rc1; they have been tested on the "mpc5121ads" and the "aria" boards.
Patch overview:
[PATCH 01/29] mpc512x: change cpu/mpc512x/Makefile to use Kconfig style [PATCH 02/29] mpc512x: Move common files to share them by several boards [PATCH 03/29] cpu/mpc512x/pci.c: minor coding style cleanup
[PATCH 04/29] cpu/mpc512x/diu.c: fix warning: assignment from incompatible pointer type [PATCH 05/29] Rename ads5121 board into mpc5121ads
[PATCH 06/29] MPC512x: add more hardware description to immap_512x.h [PATCH 07/29] mpc5121ads: use I/O accessors instead of pointer accesses [PATCH 08/29] MPC512x: add support for ARIA board
[PATCH 09/29] cpu/mpc512x/iopin.c: convert to use I/O acessors.
[PATCH 10/29] cpu/mpc512x/iopin.c: remove redundant include of <asm/immap_512x.h> [PATCH 11/29] MPC512x: prepare removal of include/mpc512x.h
[PATCH 12/29] include/configs/mpc5121ads.h: prepare removal of include/mpc512x.h [PATCH 13/29] include/configs/aria.h: prepare removal of include/mpc512x.h [PATCH 14/29] common/cmd_ide.c: prepare removal of include/mpc512x.h [PATCH 15/29] cpu/mpc512x/cpu.c: prepare removal of include/mpc512x.h [PATCH 16/29] cpu/mpc512x/cpu_init.c: prepare removal of include/mpc512x.h [PATCH 17/29] cpu/mpc512x/cpu_init.c: use I/O accessors instead of pointer accesses [PATCH 18/29] cpu/mpc512x/speed.c: prepare removal of include/mpc512x.h [PATCH 19/29] cpu/mpc512x/speed.c: use I/O accessors instead of pointer accesses [PATCH 20/29] cpu/mpc512x/serial.c: use I/O accessors instead of pointer accesses [PATCH 21/29] cpu/mpc512x/i2c.c: prepare removal of include/mpc512x.h [PATCH 22/29] cpu/mpc512x/i2c.c: use immr offsets from C struct instead of #define [PATCH 23/29] cpu/mpc512x/i2c.c: use I/O accessors instead of pointer accesses [PATCH 24/29] cpu/mpc512x/pci.c: use I/O accessors instead of pointer accesses [PATCH 25/29] drivers/net/mpc512x_fec.c: prepare removal of include/mpc512x.h [PATCH 26/29] MPC512x FEC: remove duplicated code and data types
[PATCH 27/29] drivers/net/mpc512x_fec.c: use I/O accessors instead of pointer accesses [PATCH 28/29] MPC512x FEC: get rid of duplicated struct ethernet_regs [PATCH 29/29] Remove include/mpc512x.h
---
Summary statistics:
MAINTAINERS | 2 + MAKEALL | 3 +- Makefile | 10 +- board/ads5121/Makefile | 57 --- board/ads5121/README | 7 - board/ads5121/ads5121.c | 432 ------------------- board/ads5121/ads5121_diu.c | 193 --------- board/ads5121/config.mk | 23 - board/ads5121/pci.c | 213 ---------- board/ads5121/u-boot.lds | 121 ------ board/davedenx/aria/Makefile | 53 +++ board/davedenx/aria/aria.c | 418 ++++++++++++++++++ board/davedenx/aria/config.mk | 23 + board/freescale/mpc5121ads/Makefile | 53 +++ board/freescale/mpc5121ads/README | 7 + board/freescale/mpc5121ads/config.mk | 23 + board/freescale/mpc5121ads/mpc5121ads.c | 438 +++++++++++++++++++ common/cmd_ide.c | 4 - cpu/mpc512x/Makefile | 13 +- cpu/mpc512x/asm-offsets.h | 15 + cpu/mpc512x/config.mk | 4 + cpu/mpc512x/cpu.c | 1 - cpu/mpc512x/cpu_init.c | 25 +- cpu/mpc512x/diu.c | 189 +++++++++ cpu/mpc512x/i2c.c | 55 ++-- cpu/mpc512x/iopin.c | 10 +- cpu/mpc512x/pci.c | 226 ++++++++++ cpu/mpc512x/serial.c | 62 ++-- cpu/mpc512x/speed.c | 22 +- cpu/mpc512x/start.S | 4 +- cpu/mpc512x/u-boot.lds | 121 ++++++ drivers/net/mpc512x_fec.c | 168 ++++---- drivers/net/mpc512x_fec.h | 153 +------ include/asm-ppc/immap_512x.h | 575 +++++++++++++++++++++++++- include/common.h | 1 - include/configs/ads5121.h | 551 ------------------------ include/configs/aria.h | 543 ++++++++++++++++++++++++ include/configs/mpc5121ads.h | 551 ++++++++++++++++++++++++ include/mpc512x.h | 702 ------------------------------- 39 files changed, 3456 insertions(+), 2615 deletions(-)
PATCH 1/29 mpc512x: change cpu/mpc512x/Makefile to use Kconfig style
--- cpu/mpc512x/Makefile | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
cpu/mpc512x/Makefile +3 -4
@@ -25,11 +25,10 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(CPU).a START = start.o -COBJS = traps.o cpu.o cpu_init.o speed.o interrupts.o serial.o i2c.o iopin.o -ifdef CONFIG_IIM -COBJS += iim.o -endif +COBJS-y := traps.o cpu.o cpu_init.o speed.o interrupts.o serial.o i2c.o iopin.o +COBJS-${CONFIG_IIM} += iim.o +COBJS := $(COBJS-y) SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) START := $(addprefix $(obj),$(START))
Signature · 1 line
1.6.0.6
PATCH 2/29 mpc512x: Move common files to share them by several boards
In reply to Wolfgang DenkWe will soon see several new MPC521x based boards added. This patch moves files that are not board specific to a common directory so they can be shared by all such ports.
--- board/ads5121/Makefile | 4 - board/ads5121/ads5121.c | 4 +- board/ads5121/ads5121_diu.c | 193 --------------------------------------- board/ads5121/pci.c | 213 ------------------------------------------- board/ads5121/u-boot.lds | 121 ------------------------ cpu/mpc512x/Makefile | 4 + cpu/mpc512x/config.mk | 4 + cpu/mpc512x/diu.c | 189 ++++++++++++++++++++++++++++++++++++++ cpu/mpc512x/pci.c | 213 +++++++++++++++++++++++++++++++++++++++++++ cpu/mpc512x/u-boot.lds | 121 ++++++++++++++++++++++++ 10 files changed, 533 insertions(+), 533 deletions(-) delete mode 100644 board/ads5121/ads5121_diu.c delete mode 100644 board/ads5121/pci.c delete mode 100644 board/ads5121/u-boot.lds create mode 100644 cpu/mpc512x/diu.c create mode 100644 cpu/mpc512x/pci.c create mode 100644 cpu/mpc512x/u-boot.lds
board/ads5121/Makefile +0 -4
@@ -28,10 +28,6 @@ $(shell mkdir -p $(OBJTREE)/board/freescale/common) LIB = $(obj)lib$(BOARD).a COBJS-y := $(BOARD).o -COBJS-${CONFIG_FSL_DIU_FB} += ads5121_diu.o -COBJS-${CONFIG_FSL_DIU_FB} += ../freescale/common/fsl_diu_fb.o -COBJS-${CONFIG_FSL_DIU_FB} += ../freescale/common/fsl_logo_bmp.o -COBJS-$(CONFIG_PCI) += pci.o COBJS := $(COBJS-y) SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
board/ads5121/ads5121.c +2 -2
@@ -216,7 +216,7 @@ long int fixed_sdram (void)int misc_init_r (void ) {u8 tmp_val; -extern int ads5121_diu_init (void ); +extern int mpc5121_diu_init (void );/* Using this for DIU init before the driver in linux takes over * Enable the TFP410 Encoder (I2C address 0x38)
@@ -239,7 +239,7 @@ int misc_init_r(void)#ifdef CONFIG_FSL_DIU_FB #if !(defined(CONFIG_VIDEO ) || defined(CONFIG_CFB_CONSOLE )) -ads5121_diu_init (); +mpc5121_diu_init ();#endif #endif
board/ads5121/ads5121_diu.c deleted +0 -193
193 lines not on this page · raw message
board/ads5121/pci.c deleted +0 -213
213 lines not on this page · raw message
board/ads5121/u-boot.lds deleted +0 -121
121 lines not on this page · raw message
cpu/mpc512x/Makefile +4 -0
@@ -26,7 +26,11 @@ LIB = $(obj)lib$(CPU).a START = start.o COBJS-y := traps.o cpu.o cpu_init.o speed.o interrupts.o serial.o i2c.o iopin.o +COBJS-${CONFIG_FSL_DIU_FB} += diu.o +COBJS-${CONFIG_FSL_DIU_FB} += ../../board/freescale/common/fsl_diu_fb.o +COBJS-${CONFIG_FSL_DIU_FB} += ../../board/freescale/common/fsl_logo_bmp.o COBJS-${CONFIG_IIM} += iim.o +COBJS-$(CONFIG_PCI) += pci.o COBJS := $(COBJS-y) SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
cpu/mpc512x/config.mk +4 -0
@@ -23,3 +23,7 @@ PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi PLATFORM_CPPFLAGS += -DCONFIG_MPC512X -DCONFIG_E300 \ -ffixed-r2 -msoft-float -mcpu=603e + +# Use default linker script. +# A board port can override this setting in board/*/config.mk +LDSCRIPT := $(SRCTREE)/cpu/mpc512x/u-boot.lds
cpu/mpc512x/diu.c new file +189 -0
189 lines not on this page · raw message
cpu/mpc512x/pci.c new file +213 -0
213 lines not on this page · raw message
cpu/mpc512x/u-boot.lds new file +121 -0
121 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH 3/29 cpu/mpc512x/pci.c: minor coding style cleanup
In reply to Wolfgang DenkGet rid of variable declaration in the middle of the code.
--- cpu/mpc512x/pci.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-)
cpu/mpc512x/pci.c +3 -6
@@ -54,6 +54,7 @@ pci_init_board(void)u16 reg16;u32 reg32;u32 dev; +int i;struct pci_controller *hose;/* Set PCI divider for 33MHz */
@@ -77,12 +78,8 @@ pci_init_board(void) pci_ctrl->gcr =1 ;/* We need to wait at least a 1sec based on PCI specs */ - { -int i; - -for (i =0 ; i <1000 ; i++) -udelay (1000 ); - } +for (i =0 ; i <1000 ; i++) +udelay (1000 );/* * Configure PCI Local Access Windows
Signature · 1 line
1.6.0.6
PATCH 4/29 cpu/mpc512x/diu.c: fix warning: assignment from incompatible pointer type
In reply to Wolfgang Denk--- cpu/mpc512x/diu.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
cpu/mpc512x/diu.c +1 -1
@@ -95,7 +95,7 @@ int mpc5121_diu_init(void) bmp =valid_bmp (bmp_env); }if (!bmp) - bmp = FSL_Logo_BMP; + bmp = (char *)FSL_Logo_BMP;return fsl_diu_init (xres, pixel_format,0 , (unsigned char *)bmp); }
Signature · 1 line
1.6.0.6
PATCH 5/29 Rename ads5121 board into mpc5121ads
In reply to Wolfgang DenkWe rename the board so we use a consistent name in U-Boot and in Linux. Also, we use this opportunity to move the board into the Freecale vendor directory.
--- MAKEALL | 2 +- Makefile | 6 +- board/ads5121/Makefile | 53 --- board/ads5121/README | 7 - board/ads5121/ads5121.c | 432 ------------------------ board/ads5121/config.mk | 23 -- board/freescale/mpc5121ads/Makefile | 53 +++ board/freescale/mpc5121ads/README | 7 + board/freescale/mpc5121ads/config.mk | 23 ++ board/freescale/mpc5121ads/mpc5121ads.c | 432 ++++++++++++++++++++++++ include/configs/ads5121.h | 551 ------------------------------- include/configs/mpc5121ads.h | 551 +++++++++++++++++++++++++++++++ 12 files changed, 1070 insertions(+), 1070 deletions(-) delete mode 100644 board/ads5121/Makefile delete mode 100644 board/ads5121/README delete mode 100644 board/ads5121/ads5121.c delete mode 100644 board/ads5121/config.mk create mode 100644 board/freescale/mpc5121ads/Makefile create mode 100644 board/freescale/mpc5121ads/README create mode 100644 board/freescale/mpc5121ads/config.mk create mode 100644 board/freescale/mpc5121ads/mpc5121ads.c delete mode 100644 include/configs/ads5121.h create mode 100644 include/configs/mpc5121ads.h
MAKEALL +1 -1
@@ -77,7 +77,7 @@ LIST_5xxx=" \ ######################################################################### LIST_512x=" \ - ads5121 \ + mpc5121ads \ " #########################################################################
Makefile +3 -3
@@ -812,14 +812,14 @@ v38b_config: unconfig ## MPC512x Systems ######################################################################### -ads5121_config \ -ads5121_rev2_config \ +mpc5121ads_config \ +mpc5121ads_rev2_config \ : unconfig @mkdir -p $(obj)include @if [ "$(findstring rev2,$@)" ] ; then \ echo "#define CONFIG_ADS5121_REV2 1" > $(obj)include/config.h; \ fi - @$(MKCONFIG) -a ads5121 ppc mpc512x ads5121 + @$(MKCONFIG) -a mpc5121ads ppc mpc512x mpc5121ads freescale #########################################################################
board/ads5121/Makefile deleted +0 -53
53 lines not on this page · raw message
board/ads5121/README deleted +0 -7
@@ -1,7 +0,0 @@ -To configure for the current (Rev 3.x) ADS5121 - make ads5121_config -This will automatically include PCI, the Real Time CLock, add backup flash -ability and set the correct frequency and memory configuration. - -To configure for the older Rev 2 ADS5121 type (this will not have PCI) - make ads5121_rev2_config
board/ads5121/ads5121.c deleted +0 -432
432 lines not on this page · raw message
board/ads5121/config.mk deleted +0 -23
@@ -1,23 +0,0 @@ -# -# (C) Copyright 2007 DENX Software Engineering -# -# 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 -# - -TEXT_BASE = 0xFFF00000
board/freescale/mpc5121ads/Makefile new file +53 -0
53 lines not on this page · raw message
board/freescale/mpc5121ads/README new file +7 -0
@@ -0,0 +1,7 @@ +To configure for the current (Rev 3.x) ADS5121 + make ads5121_config +This will automatically include PCI, the Real Time CLock, add backup flash +ability and set the correct frequency and memory configuration. + +To configure for the older Rev 2 ADS5121 type (this will not have PCI) + make ads5121_rev2_config
board/freescale/mpc5121ads/config.mk new file +23 -0
@@ -0,0 +1,23 @@ +# +# (C) Copyright 2007 DENX Software Engineering +# +# 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 +# + +TEXT_BASE = 0xFFF00000
board/freescale/mpc5121ads/mpc5121ads.c new file +432 -0
432 lines not on this page · raw message
include/configs/ads5121.h deleted +0 -551
551 lines not on this page · raw message
include/configs/mpc5121ads.h new file +551 -0
551 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH 5/29 Rename ads5121 board into mpc5121ads
Quoted 15 lines · On Sat, 9 May 2009 21:50:44 +0200 Wolfgang Denk <[email protected]> wrote:
MAKEALL | 2 +- Makefile | 6 +- board/ads5121/Makefile | 53 --- board/ads5121/README | 7 - board/ads5121/ads5121.c | 432 ------------------------ board/ads5121/config.mk | 23 -- board/freescale/mpc5121ads/Makefile | 53 +++ board/freescale/mpc5121ads/README | 7 + board/freescale/mpc5121ads/config.mk | 23 ++ board/freescale/mpc5121ads/mpc5121ads.c | 432 ++++++++++++++++++++++++ include/configs/ads5121.h | 551 ------------------------------- include/configs/mpc5121ads.h | 551 +++++++++++++++++++++++++++++++ 12 files changed, 1070 insertions(+), 1070 deletions(-) delete mode 100644 board/ads5121/Makefile delete mode 100644 board/ads5121/README
Quoted 8 lines
delete mode 100644 board/ads5121/ads5121.c delete mode 100644 board/ads5121/config.mk create mode 100644 board/freescale/mpc5121ads/Makefile create mode 100644 board/freescale/mpc5121ads/README create mode 100644 board/freescale/mpc5121ads/config.mk create mode 100644 board/freescale/mpc5121ads/mpc5121ads.c delete mode 100644 include/configs/ads5121.h create mode 100644 include/configs/mpc5121ads.h
can git format-patch's -M and -B options be used to submit mass rename patches such as these please?
Thanks,
Kim
PATCH 5/29 Rename ads5121 board into mpc5121ads
Dear Kim,
Quoted 3 lines · In message <[email protected]> you wrote:
can git format-patch's -M and -B options be used to submit mass rename patches such as these please?
Sorry - yes, of course.
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 An optimist believes we live in the best world possible; a pessimist fears this is true.
PATCH 6/29 MPC512x: add more hardware description to immap_512x.h
In reply to Wolfgang Denk- add GPIO module description
- add Address Latch Timing Register description
- add IO Control Memory Map
- add FEC Memory Map
Also change board/freescale/mpc5121ads/mpc5121ads.c and cpu/mpc512x/iopin.c as needed.
--- board/freescale/mpc5121ads/mpc5121ads.c | 2 +- cpu/mpc512x/iopin.c | 6 +- include/asm-ppc/immap_512x.h | 251 ++++++++++++++++++++++++++++++- 3 files changed, 251 insertions(+), 8 deletions(-)
board/freescale/mpc5121ads/mpc5121ads.c +1 -1
@@ -132,7 +132,7 @@ long int fixed_sdram (void)u32 i;/* Initialize IO Control */ - im->io_ctrl.regs[IOCTL_MEM /4 ] =IOCTRL_MUX_DDR ; + im->io_ctrl.io_control_mem =IOCTRL_MUX_DDR ;/* Initialize DDR Local Window */ im->sysconf.ddrlaw.bar =CONFIG_SYS_DDR_BASE &0xFFFFF000 ;
cpu/mpc512x/iopin.c +3 -3
@@ -23,15 +23,15 @@#include <common.h> #include <linux/types.h> -#include <mpc512x.h> +#include <asm/immap_512x.h> void iopin_initialize (iopin_t *ioregs_init,int len) {short i, j, p; -u_long *reg; +u32 *reg;immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; - reg = (u_long *)&(im->io_ctrl.regs[0 ]); + reg = (u32 *)&(im->io_ctrl);if (sizeof (ioregs_init) ==0 )return ;
include/asm-ppc/immap_512x.h +247 -4
275 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH 7/29 mpc5121ads: use I/O accessors instead of pointer accesses
In reply to Wolfgang DenkThis commit and several others that will follow change the MPC512x code to use I/O accessor calls (i.e. out_*() and in_*()) instead of using deprecated pointer accesses.
The commits are kept separate to allow for easier tracking of any potential regressions.
--- board/freescale/mpc5121ads/mpc5121ads.c | 208 ++++++++++++++++--------------- 1 files changed, 107 insertions(+), 101 deletions(-)
board/freescale/mpc5121ads/mpc5121ads.c +107 -101
@@ -1,5 +1,5 @@/* -* (C) Copyright 2007 DENX Software Engineering +* (C) Copyright 2007-2009 DENX Software Engineering * * See file CREDITS for list of people who contributed to this * project.
@@ -22,9 +22,9 @@*/ #include <common.h> -#include <mpc512x.h> #include <asm/bitops.h> #include <command.h> +#include <asm/io.h> #include <asm/processor.h> #include <fdt_support.h> #ifdef CONFIG_MISC_INIT_R
@@ -33,6 +33,8 @@DECLARE_GLOBAL_DATA_PTR ; +extern void ide_set_reset (int idereset); +/* Clocks in use */ #define SCCR1_CLOCKS_EN (CLOCK_SCCR1_CFG_EN | \ CLOCK_SCCR1_LPC_EN | \
@@ -57,22 +59,24 @@ long int fixed_sdram(void);int board_early_init_f (void ) {volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; -u32 lpcaw; +u32 lpcaw, spridr;/* * Initialize Local Window for the CPLD registers access (CS2 selects * the CPLD chip) */ - im->sysconf.lpcs2aw =CSAW_START (CONFIG_SYS_CPLD_BASE ) | -CSAW_STOP (CONFIG_SYS_CPLD_BASE ,CONFIG_SYS_CPLD_SIZE ); - im->lpc.cs_cfg[2 ] =CONFIG_SYS_CS2_CFG ; +out_be32 (&im->sysconf.lpcs2aw, +CSAW_START (CONFIG_SYS_CPLD_BASE ) | +CSAW_STOP (CONFIG_SYS_CPLD_BASE ,CONFIG_SYS_CPLD_SIZE ) + ); +out_be32 (&im->lpc.cs_cfg[2 ],CONFIG_SYS_CS2_CFG );/* * According to MPC5121e RM, configuring local access windows should * be followed by a dummy read of the config register that was * modified last and an isync */ - lpcaw = im->sysconf.lpcs2aw; + lpcaw =in_be32 (&im->sysconf.lpcs6aw); __asm__ __volatile__ ("isync" );/*
@@ -83,29 +87,32 @@ int board_early_init_f (void)*/ #ifdef CONFIG_ADS5121_REV2 - *((volatile u8 *)(CONFIG_SYS_CPLD_BASE +0x08 )) =0xC1 ; +out_8 ((u8 *)(CONFIG_SYS_CPLD_BASE +0x08 ),0xC1 );#else -if (*((u8 *)(CONFIG_SYS_CPLD_BASE +0x08 )) &0x04 ) { - *((volatile u8 *)(CONFIG_SYS_CPLD_BASE +0x08 )) =0xC1 ; +if (in_8 ((u8 *)(CONFIG_SYS_CPLD_BASE +0x08 )) &0x04 ) { +out_8 ((u8 *)(CONFIG_SYS_CPLD_BASE +0x08 ),0xC1 ); }else {/* running from Backup flash */ - *((volatile u8 *)(CONFIG_SYS_CPLD_BASE +0x08 )) =0x32 ; +out_8 ((u8 *)(CONFIG_SYS_CPLD_BASE +0x08 ),0x32 ); }#endif /* * Configure Flash Speed */ - *((volatile u32 *)(CONFIG_SYS_IMMR +LPC_OFFSET +CS0_CONFIG )) =CONFIG_SYS_CS0_CFG ; -if (SVR_MJREV (im->sysconf.spridr) >=2 ) { - *((volatile u32 *)(CONFIG_SYS_IMMR +LPC_OFFSET +CS_ALE_TIMING_CONFIG )) =CONFIG_SYS_CS_ALETIMING ; +out_be32 (&im->lpc.cs_cfg[0 ],CONFIG_SYS_CS0_CFG ); + + spridr =in_be32 (&im->sysconf.spridr); + +if (SVR_MJREV (spridr) >=2 ) { +out_be32 (&im->lpc.altr,CONFIG_SYS_CS_ALETIMING ); }/* * Enable clocks */ - im->clk.sccr[0 ] =SCCR1_CLOCKS_EN ; - im->clk.sccr[1 ] =SCCR2_CLOCKS_EN ; +out_be32 (&im->clk.sccr[0 ],SCCR1_CLOCKS_EN ); +out_be32 (&im->clk.sccr[1 ],SCCR2_CLOCKS_EN );#if defined(CONFIG_IIM ) || defined(CONFIG_CMD_FUSE ) - im->clk.sccr[1 ] |=CLOCK_SCCR2_IIM_EN ; +setbits_be32 (&im->clk.sccr[1 ],CLOCK_SCCR2_IIM_EN );#endif return 0 ;
@@ -132,83 +139,83 @@ long int fixed_sdram (void)u32 i;/* Initialize IO Control */ - im->io_ctrl.io_control_mem =IOCTRL_MUX_DDR ; +out_be32 (&im->io_ctrl.io_control_mem,IOCTRL_MUX_DDR );/* Initialize DDR Local Window */ - im->sysconf.ddrlaw.bar =CONFIG_SYS_DDR_BASE &0xFFFFF000 ; - im->sysconf.ddrlaw.ar = msize_log2 -1 ; +out_be32 (&im->sysconf.ddrlaw.bar,CONFIG_SYS_DDR_BASE &0xFFFFF000 ); +out_be32 (&im->sysconf.ddrlaw.ar, msize_log2 -1 );/* * According to MPC5121e RM, configuring local access windows should * be followed by a dummy read of the config register that was * modified last and an isync */ - i = im->sysconf.ddrlaw.ar; +in_be32 (&im->sysconf.ddrlaw.ar); __asm__ __volatile__ ("isync" );/* Enable DDR */ - im->mddrc.ddr_sys_config =CONFIG_SYS_MDDRC_SYS_CFG_EN ; +out_be32 (&im->mddrc.ddr_sys_config,CONFIG_SYS_MDDRC_SYS_CFG_EN );/* Initialize DDR Priority Manager */ - im->mddrc.prioman_config1 =CONFIG_SYS_MDDRCGRP_PM_CFG1 ; - im->mddrc.prioman_config2 =CONFIG_SYS_MDDRCGRP_PM_CFG2 ; - im->mddrc.hiprio_config =CONFIG_SYS_MDDRCGRP_HIPRIO_CFG ; - im->mddrc.lut_table0_main_upper =CONFIG_SYS_MDDRCGRP_LUT0_MU ; - im->mddrc.lut_table0_main_lower =CONFIG_SYS_MDDRCGRP_LUT0_ML ; - im->mddrc.lut_table1_main_upper =CONFIG_SYS_MDDRCGRP_LUT1_MU ; - im->mddrc.lut_table1_main_lower =CONFIG_SYS_MDDRCGRP_LUT1_ML ; - im->mddrc.lut_table2_main_upper =CONFIG_SYS_MDDRCGRP_LUT2_MU ; - im->mddrc.lut_table2_main_lower =CONFIG_SYS_MDDRCGRP_LUT2_ML ; - im->mddrc.lut_table3_main_upper =CONFIG_SYS_MDDRCGRP_LUT3_MU ; - im->mddrc.lut_table3_main_lower =CONFIG_SYS_MDDRCGRP_LUT3_ML ; - im->mddrc.lut_table4_main_upper =CONFIG_SYS_MDDRCGRP_LUT4_MU ; - im->mddrc.lut_table4_main_lower =CONFIG_SYS_MDDRCGRP_LUT4_ML ; - im->mddrc.lut_table0_alternate_upper =CONFIG_SYS_MDDRCGRP_LUT0_AU ; - im->mddrc.lut_table0_alternate_lower =CONFIG_SYS_MDDRCGRP_LUT0_AL ; - im->mddrc.lut_table1_alternate_upper =CONFIG_SYS_MDDRCGRP_LUT1_AU ; - im->mddrc.lut_table1_alternate_lower =CONFIG_SYS_MDDRCGRP_LUT1_AL ; - im->mddrc.lut_table2_alternate_upper =CONFIG_SYS_MDDRCGRP_LUT2_AU ; - im->mddrc.lut_table2_alternate_lower =CONFIG_SYS_MDDRCGRP_LUT2_AL ; - im->mddrc.lut_table3_alternate_upper =CONFIG_SYS_MDDRCGRP_LUT3_AU ; - im->mddrc.lut_table3_alternate_lower =CONFIG_SYS_MDDRCGRP_LUT3_AL ; - im->mddrc.lut_table4_alternate_upper =CONFIG_SYS_MDDRCGRP_LUT4_AU ; - im->mddrc.lut_table4_alternate_lower =CONFIG_SYS_MDDRCGRP_LUT4_AL ; +out_be32 (&im->mddrc.prioman_config1,CONFIG_SYS_MDDRCGRP_PM_CFG1 ); +out_be32 (&im->mddrc.prioman_config2,CONFIG_SYS_MDDRCGRP_PM_CFG2 ); +out_be32 (&im->mddrc.hiprio_config,CONFIG_SYS_MDDRCGRP_HIPRIO_CFG ); +out_be32 (&im->mddrc.lut_table0_main_upper,CONFIG_SYS_MDDRCGRP_LUT0_MU ); +out_be32 (&im->mddrc.lut_table0_main_lower,CONFIG_SYS_MDDRCGRP_LUT0_ML ); +out_be32 (&im->mddrc.lut_table1_main_upper,CONFIG_SYS_MDDRCGRP_LUT1_MU ); +out_be32 (&im->mddrc.lut_table1_main_lower,CONFIG_SYS_MDDRCGRP_LUT1_ML ); +out_be32 (&im->mddrc.lut_table2_main_upper,CONFIG_SYS_MDDRCGRP_LUT2_MU ); +out_be32 (&im->mddrc.lut_table2_main_lower,CONFIG_SYS_MDDRCGRP_LUT2_ML ); +out_be32 (&im->mddrc.lut_table3_main_upper,CONFIG_SYS_MDDRCGRP_LUT3_MU ); +out_be32 (&im->mddrc.lut_table3_main_lower,CONFIG_SYS_MDDRCGRP_LUT3_ML ); +out_be32 (&im->mddrc.lut_table4_main_upper,CONFIG_SYS_MDDRCGRP_LUT4_MU ); +out_be32 (&im->mddrc.lut_table4_main_lower,CONFIG_SYS_MDDRCGRP_LUT4_ML ); +out_be32 (&im->mddrc.lut_table0_alternate_upper,CONFIG_SYS_MDDRCGRP_LUT0_AU ); +out_be32 (&im->mddrc.lut_table0_alternate_lower,CONFIG_SYS_MDDRCGRP_LUT0_AL ); +out_be32 (&im->mddrc.lut_table1_alternate_upper,CONFIG_SYS_MDDRCGRP_LUT1_AU ); +out_be32 (&im->mddrc.lut_table1_alternate_lower,CONFIG_SYS_MDDRCGRP_LUT1_AL ); +out_be32 (&im->mddrc.lut_table2_alternate_upper,CONFIG_SYS_MDDRCGRP_LUT2_AU ); +out_be32 (&im->mddrc.lut_table2_alternate_lower,CONFIG_SYS_MDDRCGRP_LUT2_AL ); +out_be32 (&im->mddrc.lut_table3_alternate_upper,CONFIG_SYS_MDDRCGRP_LUT3_AU ); +out_be32 (&im->mddrc.lut_table3_alternate_lower,CONFIG_SYS_MDDRCGRP_LUT3_AL ); +out_be32 (&im->mddrc.lut_table4_alternate_upper,CONFIG_SYS_MDDRCGRP_LUT4_AU ); +out_be32 (&im->mddrc.lut_table4_alternate_lower,CONFIG_SYS_MDDRCGRP_LUT4_AL );/* Initialize MDDRC */ - im->mddrc.ddr_sys_config =CONFIG_SYS_MDDRC_SYS_CFG ; - im->mddrc.ddr_time_config0 =CONFIG_SYS_MDDRC_TIME_CFG0 ; - im->mddrc.ddr_time_config1 =CONFIG_SYS_MDDRC_TIME_CFG1 ; - im->mddrc.ddr_time_config2 =CONFIG_SYS_MDDRC_TIME_CFG2 ; +out_be32 (&im->mddrc.ddr_sys_config,CONFIG_SYS_MDDRC_SYS_CFG ); +out_be32 (&im->mddrc.ddr_time_config0,CONFIG_SYS_MDDRC_TIME_CFG0 ); +out_be32 (&im->mddrc.ddr_time_config1,CONFIG_SYS_MDDRC_TIME_CFG1 ); +out_be32 (&im->mddrc.ddr_time_config2,CONFIG_SYS_MDDRC_TIME_CFG2 );/* Initialize DDR */ for (i =0 ; i <10 ; i++) - im->mddrc.ddr_command =CONFIG_SYS_MICRON_NOP ; - - im->mddrc.ddr_command =CONFIG_SYS_MICRON_PCHG_ALL ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_NOP ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_RFSH ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_NOP ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_RFSH ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_NOP ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_INIT_DEV_OP ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_NOP ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_EM2 ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_NOP ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_PCHG_ALL ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_EM2 ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_EM3 ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_EN_DLL ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_INIT_DEV_OP ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_PCHG_ALL ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_RFSH ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_INIT_DEV_OP ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_OCD_DEFAULT ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_PCHG_ALL ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_NOP ; +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP ); + +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_PCHG_ALL ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_RFSH ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_RFSH ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_INIT_DEV_OP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_EM2 ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_PCHG_ALL ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_EM2 ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_EM3 ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_EN_DLL ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_INIT_DEV_OP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_PCHG_ALL ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_RFSH ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_INIT_DEV_OP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_OCD_DEFAULT ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_PCHG_ALL ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP );/* Start MDDRC */ - im->mddrc.ddr_time_config0 =CONFIG_SYS_MDDRC_TIME_CFG0_RUN ; - im->mddrc.ddr_sys_config =CONFIG_SYS_MDDRC_SYS_CFG_RUN ; +out_be32 (&im->mddrc.ddr_time_config0,CONFIG_SYS_MDDRC_TIME_CFG0_RUN ); +out_be32 (&im->mddrc.ddr_sys_config,CONFIG_SYS_MDDRC_SYS_CFG_RUN );return msize; }
@@ -248,49 +255,49 @@ int misc_init_r(void)static iopin_t ioregs_init[] = {/* FUNC1=FEC_RX_DV Sets Next 3 to FEC pads */ { -IOCTL_SPDIF_TXCLK ,3 ,0 , + offsetof(struct ioctrl512x , io_control_spdif_txclk),3 ,0 ,IO_PIN_FMUX (1 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) |IO_PIN_PUE (0 ) |IO_PIN_ST (0 ) |IO_PIN_DS (3 ) },/* Set highest Slew on 9 PATA pins */ { -IOCTL_PATA_CE1 ,9 ,1 , + offsetof(struct ioctrl512x , io_control_pata_ce1),9 ,1 ,IO_PIN_FMUX (0 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) |IO_PIN_PUE (0 ) |IO_PIN_ST (0 ) |IO_PIN_DS (3 ) },/* FUNC1=FEC_COL Sets Next 15 to FEC pads */ { -IOCTL_PSC0_0 ,15 ,0 , + offsetof(struct ioctrl512x , io_control_psc0_0),15 ,0 ,IO_PIN_FMUX (1 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) |IO_PIN_PUE (0 ) |IO_PIN_ST (0 ) |IO_PIN_DS (3 ) },/* FUNC1=SPDIF_TXCLK */ { -IOCTL_LPC_CS1 ,1 ,0 , + offsetof(struct ioctrl512x , io_control_lpc_cs1),1 ,0 ,IO_PIN_FMUX (1 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) |IO_PIN_PUE (0 ) |IO_PIN_ST (1 ) |IO_PIN_DS (3 ) },/* FUNC2=SPDIF_TX and sets Next pin to SPDIF_RX */ { -IOCTL_I2C1_SCL ,2 ,0 , + offsetof(struct ioctrl512x , io_control_i2c1_scl),2 ,0 ,IO_PIN_FMUX (2 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) |IO_PIN_PUE (0 ) |IO_PIN_ST (1 ) |IO_PIN_DS (3 ) },/* FUNC2=DIU CLK */ { -IOCTL_PSC6_0 ,1 ,0 , + offsetof(struct ioctrl512x , io_control_psc6_0),1 ,0 ,IO_PIN_FMUX (2 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) |IO_PIN_PUE (0 ) |IO_PIN_ST (1 ) |IO_PIN_DS (3 ) },/* FUNC2=DIU_HSYNC */ { -IOCTL_PSC6_1 ,1 ,0 , + offsetof(struct ioctrl512x , io_control_psc6_1),1 ,0 ,IO_PIN_FMUX (2 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) |IO_PIN_PUE (0 ) |IO_PIN_ST (0 ) |IO_PIN_DS (3 ) },/* FUNC2=DIUVSYNC Sets Next 26 to DIU Pads */ { -IOCTL_PSC6_4 ,26 ,0 , + offsetof(struct ioctrl512x , io_control_psc6_4),26 ,0 ,IO_PIN_FMUX (2 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) |IO_PIN_PUE (0 ) |IO_PIN_ST (0 ) |IO_PIN_DS (3 ) }
@@ -299,7 +306,7 @@ static iopin_t ioregs_init[] = {static iopin_t rev2_silicon_pci_ioregs_init[] = {/* FUNC0=PCI Sets next 54 to PCI pads */ { -IOCTL_PCI_AD31 ,54 ,0 , + offsetof(struct ioctrl512x , io_control_pci_ad31),54 ,0 ,IO_PIN_FMUX (0 ) |IO_PIN_HOLD (0 ) |IO_PIN_DS (0 ) } };
@@ -309,13 +316,14 @@ int checkboard (void)ushort brd_rev = *(vu_short *) (CONFIG_SYS_CPLD_BASE +0x00 );uchar cpld_rev = *(vu_char *) (CONFIG_SYS_CPLD_BASE +0x02 );volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +u32 spridr =in_be32 (&im->sysconf.spridr);printf ("Board: ADS5121 rev. 0x%04x (CPLD rev. 0x%02x)\n" , brd_rev, cpld_rev);/* initialize function mux & slew rate IO inter alia on IO Pins */ iopin_initialize (ioregs_init,sizeof (ioregs_init) /sizeof (ioregs_init[0 ])); -if (SVR_MJREV (im->sysconf.spridr) >=2 ) { +if (SVR_MJREV (spridr) >=2 ) {iopin_initialize (rev2_silicon_pci_ioregs_init,1 ); }
@@ -334,40 +342,37 @@ void ft_board_setup(void *blob, bd_t *bd)void init_ide_reset (void ) { -volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR ;debug ("init_ide_reset\n" );/* * Clear the reset bit to reset the interface * cf. RefMan MPC5121EE: 28.4.1 Resetting the ATA Bus */ - immr->pata.pata_ata_control =0 ; -udelay (100 ); +ide_set_reset (1 ); +/* Assert the reset bit to enable the interface */ - immr->pata.pata_ata_control =FSL_ATA_CTRL_ATA_RST_B ; -udelay (100 ); +ide_set_reset (0 ); }void ide_set_reset (int idereset) { -volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR ; +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ;debug ("ide_set_reset(%d)\n" , idereset);if (idereset) { - immr->pata.pata_ata_control =0 ; -udelay (100 ); +out_be32 (&im->pata.pata_ata_control,0 ); }else { - immr->pata.pata_ata_control =FSL_ATA_CTRL_ATA_RST_B ; -udelay (100 ); +out_be32 (&im->pata.pata_ata_control,FSL_ATA_CTRL_ATA_RST_B ); } +udelay (100 ); }#define CALC_TIMING (t) (t + period - 1) / periodint ide_preinit (void ) { -volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR ; +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ;long t; const struct { short t0;
@@ -399,10 +404,10 @@ int ide_preinit (void) }cfg;debug ("IDE preinit using PATA peripheral at IMMR-ADDR %08x\n" , - (u32)&immr->pata); +in_be32 (&im->pata));/* Set the reset bit to 1 to enable the interface */ - immr->pata.pata_ata_control =FSL_ATA_CTRL_ATA_RST_B ; +ide_set_reset (0 );/* Init timings : we use PIO mode 0 timings */ t =1000000000 / gd->ips_clk;/* period in ns */
@@ -411,19 +416,20 @@ int ide_preinit (void) cfg.bytes.field3 = (pio_specs.t1 + t) / t; cfg.bytes.field4 = (pio_specs.t2_8 + t) / t; - immr->pata.pata_time1 = cfg.config; +out_be32 (&im->pata.pata_time1, cfg.config); cfg.bytes.field1 = (pio_specs.t2_8 + t) / t; cfg.bytes.field2 = (pio_specs.tA + t) / t +2 ; cfg.bytes.field3 =1 ; cfg.bytes.field4 = (pio_specs.t4 + t) / t; - immr->pata.pata_time2 = cfg.config; +out_be32 (&im->pata.pata_time2, cfg.config); - cfg.config = immr->pata.pata_time3; + cfg.config =in_be32 (&im->pata.pata_time3); cfg.bytes.field1 = (pio_specs.t9 + t) / t; - immr->pata.pata_time3 = cfg.config; +out_be32 (&im->pata.pata_time3, cfg.config); +debug ("PATA preinit complete.\n" );return 0 ;
Signature · 1 line
1.6.0.6
PATCH 8/29 MPC512x: add support for ARIA board
In reply to Wolfgang DenkARIA is a MPC5121E based COM Express module by Dave/DENX.
--- MAINTAINERS | 2 + MAKEALL | 1 + Makefile | 4 +- board/davedenx/aria/Makefile | 53 ++++ board/davedenx/aria/aria.c | 418 +++++++++++++++++++++++++++++++ board/davedenx/aria/config.mk | 23 ++ include/configs/aria.h | 543 +++++++++++++++++++++++++++++++++++++++++ 7 files changed, 1043 insertions(+), 1 deletions(-) create mode 100644 board/davedenx/aria/Makefile create mode 100644 board/davedenx/aria/aria.c create mode 100644 board/davedenx/aria/config.mk create mode 100644 include/configs/aria.h
MAINTAINERS +2 -0
@@ -75,6 +75,8 @@ Wolfgang Denk <[email protected]> IceCube_5100 MGT5100 IceCube_5200 MPC5200 + ARIA MPC5121e + AMX860 MPC860 ETX094 MPC850 FPS850L MPC850
MAKEALL +1 -0
@@ -77,6 +77,7 @@ LIST_5xxx=" \ ######################################################################### LIST_512x=" \ + aria \ mpc5121ads \ "
Makefile +3 -1
@@ -812,6 +812,9 @@ v38b_config: unconfig ## MPC512x Systems ######################################################################### +aria_config: unconfig + @$(MKCONFIG) -a aria ppc mpc512x aria davedenx + mpc5121ads_config \ mpc5121ads_rev2_config \ : unconfig
@@ -821,7 +824,6 @@ mpc5121ads_rev2_config \ fi @$(MKCONFIG) -a mpc5121ads ppc mpc512x mpc5121ads freescale - ######################################################################### ## MPC8xx Systems #########################################################################
board/davedenx/aria/Makefile new file +53 -0
53 lines not on this page · raw message
board/davedenx/aria/aria.c new file +418 -0
418 lines not on this page · raw message
board/davedenx/aria/config.mk new file +23 -0
@@ -0,0 +1,23 @@ +# +# (C) Copyright 2009 Wolfgang Denk <[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 +# + +TEXT_BASE = 0xFFF00000
include/configs/aria.h new file +543 -0
543 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH 8/29 MPC512x: add support for ARIA board
Hello Wolfgang,
some minor coments ..
Quoted 5 lines · Wolfgang Denk
ARIA is a MPC5121E based COM Express module by Dave/DENX.
Signed-off-by Wolfgang Denk <[email protected]>Cc John Rigby <[email protected]>---
[...]
Quoted 10 lines
(quoted diff) +1
-0+#########################################################################board/davedenx/aria/aria.c new file +3
-0@@ -0,0 +1,418 @@ +/* +* (C) Copyright 2009 Wolfgang Denk <[email protected]> +* (C) Copyright 2009 Dave Srl www.dave.eu
[...]
Quoted 36 lines
board/davedenx/aria/aria.c new file +36
-0+int board_early_init_f (void ) +{ +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +u32 spridr; + +/* +* Initialize Local Window for the On Board FPGA access +*/ +out_be32 (&im->sysconf.lpcs2aw, +CSAW_START (CONFIG_SYS_ARIA_FPGA_BASE ) | +CSAW_STOP (CONFIG_SYS_ARIA_FPGA_BASE ,CONFIG_SYS_ARIA_FPGA_SIZE ) + ); +out_be32 (&im->lpc.cs_cfg[2 ],CONFIG_SYS_CS2_CFG ); + +/* +* According to MPC5121e RM, configuring local access windows should +* be followed by a dummy read of the config register that was +* modified last and an isync +*/ +in_be32 (&im->sysconf.lpcs2aw); + __asm__ __volatile__ ("isync" ); + +/* +* Initialize Local Window for the On Board SRAM access +*/ +out_be32 (&im->sysconf.lpcs6aw, +CSAW_START (CONFIG_SYS_ARIA_SRAM_BASE ) | +CSAW_STOP (CONFIG_SYS_ARIA_SRAM_BASE ,CONFIG_SYS_ARIA_SRAM_SIZE ) + ); +out_be32 (&im->lpc.cs_cfg[6 ],CONFIG_SYS_CS6_CFG ); + +/* +* According to MPC5121e RM, configuring local access windows should +* be followed by a dummy read of the config register that was +* modified last and an isync +*/
board/davedenx/aria/aria.c line 105
Quoted 10 lines
board/davedenx/aria/aria.c new file +10
-0+in_be32 (&im->sysconf.lpcs6aw); + __asm__ __volatile__ ("isync" ); + +/* +* Configure Flash Speed +*/ +out_be32 (&im->lpc.cs_cfg[0 ],CONFIG_SYS_CS0_CFG ); + + spridr =in_be32 (&im->sysconf.spridr); +
no blank line necessary.
Quoted 11 lines
board/davedenx/aria/aria.c new file +11
-0+if (SVR_MJREV (spridr) >=2 ) { +out_be32 (&im->lpc.altr,CONFIG_SYS_CS_ALETIMING ); + } +/* +* Enable clocks +*/ +out_be32 (&im->clk.sccr[0 ],SCCR1_CLOCKS_EN ); +out_be32 (&im->clk.sccr[1 ],SCCR2_CLOCKS_EN ); +#if defined(CONFIG_IIM ) || defined(CONFIG_CMD_FUSE ) +setbits_be32 (&im->clk.sccr[1 ],CLOCK_SCCR2_IIM_EN ); +#endif
board/davedenx/aria/aria.c line 126
Quoted 10 lines
board/davedenx/aria/aria.c new file +10
-0+ +return 0 ; +} + +phys_size_t initdram (int board_type) +{ +u32 msize =0 ; + + msize =fixed_sdram (); +
no blank line necessary.
Quoted 46 lines
board/davedenx/aria/aria.c new file +46
-0+return msize; +} + +/* +* fixed sdram init -- the board doesn't use memory modules that have serial presence +* detect or similar mechanism for discovery of the DRAM settings +*/ +long int fixed_sdram (void ) +{ +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +u32 msize =CONFIG_SYS_DDR_SIZE *1024 *1024 ; +u32 msize_log2 =__ilog2 (msize); +u32 i; + +/* Initialize IO Control */ +out_be32 (&im->io_ctrl.io_control_mem,IOCTRL_MUX_DDR ); + +/* Initialize DDR Local Window */ +out_be32 (&im->sysconf.ddrlaw.bar,CONFIG_SYS_DDR_BASE &0xFFFFF000 ); +out_be32 (&im->sysconf.ddrlaw.ar, msize_log2 -1 ); + +/* +* According to MPC5121e RM, configuring local access windows should +* be followed by a dummy read of the config register that was +* modified last and an isync +*/ +in_be32 (&im->sysconf.ddrlaw.ar); + __asm__ __volatile__ ("isync" ); + +/* Enable DDR */ +out_be32 (&im->mddrc.ddr_sys_config,CONFIG_SYS_MDDRC_SYS_CFG_EN ); + +/* Initialize DDR Priority Manager */ +out_be32 (&im->mddrc.prioman_config1,CONFIG_SYS_MDDRCGRP_PM_CFG1 ); +out_be32 (&im->mddrc.prioman_config2,CONFIG_SYS_MDDRCGRP_PM_CFG2 ); +out_be32 (&im->mddrc.hiprio_config,CONFIG_SYS_MDDRCGRP_HIPRIO_CFG ); +out_be32 (&im->mddrc.lut_table0_main_upper,CONFIG_SYS_MDDRCGRP_LUT0_MU ); +out_be32 (&im->mddrc.lut_table0_main_lower,CONFIG_SYS_MDDRCGRP_LUT0_ML ); +out_be32 (&im->mddrc.lut_table1_main_upper,CONFIG_SYS_MDDRCGRP_LUT1_MU ); +out_be32 (&im->mddrc.lut_table1_main_lower,CONFIG_SYS_MDDRCGRP_LUT1_ML ); +out_be32 (&im->mddrc.lut_table2_main_upper,CONFIG_SYS_MDDRCGRP_LUT2_MU ); +out_be32 (&im->mddrc.lut_table2_main_lower,CONFIG_SYS_MDDRCGRP_LUT2_ML ); +out_be32 (&im->mddrc.lut_table3_main_upper,CONFIG_SYS_MDDRCGRP_LUT3_MU ); +out_be32 (&im->mddrc.lut_table3_main_lower,CONFIG_SYS_MDDRCGRP_LUT3_ML ); +out_be32 (&im->mddrc.lut_table4_main_upper,CONFIG_SYS_MDDRCGRP_LUT4_MU ); +out_be32 (&im->mddrc.lut_table4_main_lower,CONFIG_SYS_MDDRCGRP_LUT4_ML );
board/davedenx/aria/aria.c line 182
Quoted 10 lines
board/davedenx/aria/aria.c new file +10
-0+out_be32 (&im->mddrc.lut_table0_alternate_upper,CONFIG_SYS_MDDRCGRP_LUT0_AU ); +out_be32 (&im->mddrc.lut_table0_alternate_lower,CONFIG_SYS_MDDRCGRP_LUT0_AL ); +out_be32 (&im->mddrc.lut_table1_alternate_upper,CONFIG_SYS_MDDRCGRP_LUT1_AU ); +out_be32 (&im->mddrc.lut_table1_alternate_lower,CONFIG_SYS_MDDRCGRP_LUT1_AL ); +out_be32 (&im->mddrc.lut_table2_alternate_upper,CONFIG_SYS_MDDRCGRP_LUT2_AU ); +out_be32 (&im->mddrc.lut_table2_alternate_lower,CONFIG_SYS_MDDRCGRP_LUT2_AL ); +out_be32 (&im->mddrc.lut_table3_alternate_upper,CONFIG_SYS_MDDRCGRP_LUT3_AU ); +out_be32 (&im->mddrc.lut_table3_alternate_lower,CONFIG_SYS_MDDRCGRP_LUT3_AL ); +out_be32 (&im->mddrc.lut_table4_alternate_upper,CONFIG_SYS_MDDRCGRP_LUT4_AU ); +out_be32 (&im->mddrc.lut_table4_alternate_lower,CONFIG_SYS_MDDRCGRP_LUT4_AL );
too long lines ... but 2 lines would also look ugly ...
Quoted 52 lines
board/davedenx/aria/aria.c new file +52
-0+ +/* Initialize MDDRC */ +out_be32 (&im->mddrc.ddr_sys_config,CONFIG_SYS_MDDRC_SYS_CFG ); +out_be32 (&im->mddrc.ddr_time_config0,CONFIG_SYS_MDDRC_TIME_CFG0 ); +out_be32 (&im->mddrc.ddr_time_config1,CONFIG_SYS_MDDRC_TIME_CFG1 ); +out_be32 (&im->mddrc.ddr_time_config2,CONFIG_SYS_MDDRC_TIME_CFG2 ); + +/* Initialize DDR */ +for (i =0 ; i <10 ; i++) +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP ); + +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_PCHG_ALL ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_RFSH ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_RFSH ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_INIT_DEV_OP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_EM2 ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_PCHG_ALL ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_EM2 ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_EM3 ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_EN_DLL ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_INIT_DEV_OP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_PCHG_ALL ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_RFSH ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_INIT_DEV_OP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_OCD_DEFAULT ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_PCHG_ALL ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP ); + +/* Start MDDRC */ +out_be32 (&im->mddrc.ddr_time_config0,CONFIG_SYS_MDDRC_TIME_CFG0_RUN ); +out_be32 (&im->mddrc.ddr_sys_config,CONFIG_SYS_MDDRC_SYS_CFG_RUN ); + +return msize; +} + +int misc_init_r (void ) +{ +u32 tmp; +extern int mpc5121_diu_init (void ); + +/* we use I2C-2 for on-board eeprom */ +i2c_set_bus_num (2 ); + + tmp =in_be32 ((u32 *)CONFIG_SYS_ARIA_FPGA_BASE ); + printf("FPGA: %u-%u.%u.%u\n", + (tmp & 0xFF000000) >> 24, + (tmp & 0x00FF0000) >> 16,
board/davedenx/aria/aria.c line 244
Quoted 10 lines
board/davedenx/aria/aria.c new file +10
-0+ (tmp &0x0000FF00 ) >>8 , + tmp &0x000000FF + ); + +#ifdef CONFIG_FSL_DIU_FB +#if !(defined(CONFIG_VIDEO ) || defined(CONFIG_CFB_CONSOLE )) +mpc5121_diu_init (); +#endif +#endif +
no blank line necessary.
Quoted 53 lines
board/davedenx/aria/aria.c new file +53
-0+return 0 ; +} +static iopin_t ioregs_init[] = { +/* +* FEC +*/ + +/* FEC on PSCx_x*/ + { + offsetof(struct ioctrl512x , io_control_psc0_0),5 ,0 , +IO_PIN_FMUX (1 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) | +IO_PIN_PUE (0 ) |IO_PIN_ST (0 ) |IO_PIN_DS (3 ) + }, + { + offsetof(struct ioctrl512x , io_control_psc1_0),10 ,0 , +IO_PIN_FMUX (1 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) | +IO_PIN_PUE (0 ) |IO_PIN_ST (0 ) |IO_PIN_DS (3 ) + }, + { + offsetof(struct ioctrl512x , io_control_spdif_txclk),3 ,0 , +IO_PIN_FMUX (1 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) | +IO_PIN_PUE (0 ) |IO_PIN_ST (0 ) |IO_PIN_DS (3 ) + }, + +/* +* DIU +*/ +/* FUNC2=DIU CLK */ + { + offsetof(struct ioctrl512x , io_control_psc6_0),1 ,0 , +IO_PIN_FMUX (2 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) | +IO_PIN_PUE (0 ) |IO_PIN_ST (1 ) |IO_PIN_DS (3 ) + }, +/* FUNC2=DIU_HSYNC */ + { + offsetof(struct ioctrl512x , io_control_psc6_1),1 ,0 , +IO_PIN_FMUX (2 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) | +IO_PIN_PUE (0 ) |IO_PIN_ST (0 ) |IO_PIN_DS (3 ) + }, +/* FUNC2=DIUVSYNC Sets Next 26 to DIU Pads */ + { + offsetof(struct ioctrl512x , io_control_psc6_4),26 ,0 , +IO_PIN_FMUX (2 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) | +IO_PIN_PUE (0 ) |IO_PIN_ST (0 ) |IO_PIN_DS (3 ) + }, +/* +* On board SRAM +*/ +/* FUNC2=/LPC CS6 */ + { + offsetof(struct ioctrl512x , io_control_j1850_rx),1 ,0 , +IO_PIN_FMUX (2 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) | +IO_PIN_PUE (1 ) |IO_PIN_ST (1 ) |IO_PIN_DS (3 )
board/davedenx/aria/aria.c line 307
Quoted 10 lines
board/davedenx/aria/aria.c new file +10
-0+ }, +}; + + +int checkboard (void ) +{ +puts ("Board: ARIA\n" ); + +/* initialize function mux & slew rate IO inter alia on IO Pins */ +
no blank line necessary
board/davedenx/aria/aria.c line 308
Quoted 1 line
board/davedenx/aria/aria.c new file +1
-0+iopin_initialize (ioregs_init,sizeof (ioregs_init) /sizeof (ioregs_init[0 ]));
line too long
Quoted 17 lines
board/davedenx/aria/aria.c new file +17
-0+ +return 0 ; +} + +#if defined(CONFIG_OF_LIBFDT ) && defined(CONFIG_OF_BOARD_SETUP ) +void ft_board_setup (void *blob,bd_t *bd) +{ +ft_cpu_setup (blob, bd); +fdt_fixup_memory (blob, (u64 )bd->bi_memstart, (u64 )bd->bi_memsize); +} +#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */ + +#if defined(CONFIG_CMD_IDE ) && defined(CONFIG_IDE_RESET ) + +void init_ide_reset (void ) +{ +debug ("init_ide_reset\n" );
board/davedenx/aria/aria.c line 335
Quoted 10 lines
board/davedenx/aria/aria.c new file +10
-0+ +/* +* Clear the reset bit to reset the interface +* cf. RefMan MPC5121EE: 28.4.1 Resetting the ATA Bus +*/ +ide_set_reset (1 ); + +/* Assert the reset bit to enable the interface */ +ide_set_reset (0 ); +
no blank line necessary
Quoted 21 lines
board/davedenx/aria/aria.c new file +21
-0+} + +void ide_set_reset (int idereset) +{ +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +debug ("ide_set_reset(%d)\n" , idereset); + +if (idereset) { +out_be32 (&im->pata.pata_ata_control,0 ); + }else { +out_be32 (&im->pata.pata_ata_control,FSL_ATA_CTRL_ATA_RST_B ); + } +udelay (100 ); +} + +#define CALC_TIMING (t) (t + period - 1) / period + +int ide_preinit (void ) +{ +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +long t;
board/davedenx/aria/aria.c line 366
Quoted 10 lines
board/davedenx/aria/aria.c new file +10
-0+const struct { +short t0; +short t1; +short t2_8; +short t2_16; +short t2i; +short t4; +short t9; +short tA; + } pio_specs = {
Is this a processor specific register? If so, shouldn;t this go in include/asm-ppc/immap_512x.h?
Quoted 114 lines
board/davedenx/aria/aria.c new file +52
-0+ .t0 = 600, + .t1 = 70, + .t2_8 = 290, + .t2_16 = 165, + .t2i = 0, + .t4 = 30, + .t9 = 20, + .tA = 50, + }; +union { +u32 config; +struct { +u8 field1; +u8 field2; +u8 field3; +u8 field4; + }bytes; + }cfg; + +debug ("IDE preinit using PATA peripheral at IMMR-ADDR %08x\n" , +in_be32 (&im->pata)); + +/* Set the reset bit to 1 to enable the interface */ +ide_set_reset (0 ); + +/* Init timings : we use PIO mode 0 timings */ + t =1000000000 / gd->ips_clk;/* period in ns */ + cfg.bytes.field1 =3 ; + cfg.bytes.field2 =3 ; + cfg.bytes.field3 = (pio_specs.t1 + t) / t; + cfg.bytes.field4 = (pio_specs.t2_8 + t) / t; + +out_be32 (&im->pata.pata_time1, cfg.config); + + cfg.bytes.field1 = (pio_specs.t2_8 + t) / t; + cfg.bytes.field2 = (pio_specs.tA + t) / t +2 ; + cfg.bytes.field3 =1 ; + cfg.bytes.field4 = (pio_specs.t4 + t) / t; + +out_be32 (&im->pata.pata_time2, cfg.config); + + cfg.config =in_be32 (&im->pata.pata_time3); + cfg.bytes.field1 = (pio_specs.t9 + t) / t; + +out_be32 (&im->pata.pata_time3, cfg.config); + +debug ("PATA preinit complete.\n" ); + +return 0 ; +} + +#endif /* defined(CONFIG_CMD_IDE) && defined(CONFIG_IDE_RESET) */ board/davedenx/aria/config.mk new file +23
-0@@ -0,0 +1,23 @@ +# +# (C) Copyright 2009 Wolfgang Denk <[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 +# + +TEXT_BASE = 0xFFF00000include/configs/aria.h new file +27
-0@@ -0,0 +1,543 @@ +/* +* (C) Copyright 2009 Wolfgang Denk <[email protected]> +* (C) Copyright 2009, DAVE Srl <www.dave.eu> +* +* 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 +*/ + +/* +* Aria board configuration file +*/ +
include/configs/aria.h line 37
Quoted 10 lines
include/configs/aria.h new file +10
-0+#ifndef __CONFIG_H +#define __CONFIG_H + +#define CONFIG_ARIA 1 +/* +* Memory map for the ARIA board: +* +* 0x0000_0000 - 0x0FFF_FFFF DDR RAM (256 MB) +* 0x3000_0000 - 0x3001_FFFF On Chip SRAM (128 KB) +* 0x3010_0000 - 0x3003_FFFF On Board SRAM (128 KB - max 512KB - 1MB reserved) - CS6
line too long.
Quoted 5 lines
include/configs/aria.h new file +5
-0+* 0x3020_0000 - 0x3021_FFFF FPGA (128 KB) - CS2 +* 0x8000_0000 - 0x803F_FFFF IMMR (4 MB) +* 0x8400_0000 - 0x82FF_FFFF PCI I/O space (16 MB) +* 0xA000_0000 - 0xAFFF_FFFF PCI memory space (256 MB) +* 0xB000_0000 - 0xBFFF_FFFF PCI memory mapped I/O space (256 MB)
include/configs/aria.h line 52
Quoted 10 lines
include/configs/aria.h new file +10
-0+* 0xFC00_0000 - 0xFFFF_FFFF NOR Boot FLASH (64 MB) +*/ + +/* +* High Level Configuration Options +*/ +#define CONFIG_E300 1/* E300 Family */ +#define CONFIG_MPC512X 1/* MPC512X family */ +#define CONFIG_FSL_DIU_FB 1/* FSL DIU */ +#define CONFIG_FSL_DIU_LOGO_BMP 1/* Don't include FSL DIU binary bmp */
here too.
Quoted 113 lines
include/configs/aria.h new file +113
-0+ +/* video */ +#undef CONFIG_VIDEO + +#if defined(CONFIG_VIDEO ) +#define CONFIG_CFB_CONSOLE +#define CONFIG_VGA_AS_SINGLE_DEVICE +#endif + +/* CONFIG_PCI is defined at config time */ + +#define CONFIG_SYS_MPC512X_CLKIN 33000000/* in Hz */ + +#define CONFIG_BOARD_EARLY_INIT_F /* call board_early_init_f() */ +#define CONFIG_MISC_INIT_R + +#define CONFIG_SYS_IMMR 0x80000000 +#define CONFIG_SYS_DIU_ADDR (CONFIG_SYS_IMMR+0x2100) + +#define CONFIG_SYS_MEMTEST_START 0x00200000/* memtest region */ +#define CONFIG_SYS_MEMTEST_END 0x00400000 + +/* +* DDR Setup - manually set all parameters as there's no SPD etc. +*/ +#define CONFIG_SYS_DDR_SIZE 256/* MB */ +#define CONFIG_SYS_DDR_BASE 0x00000000/* DDR is system memory*/ +#define CONFIG_SYS_SDRAM_BASE CONFIG_SYS_DDR_BASE + +/* DDR Controller Configuration +* +* SYS_CFG: +* [31:31] MDDRC Soft Reset: Diabled +* [30:30] DRAM CKE pin: Enabled +* [29:29] DRAM CLK: Enabled +* [28:28] Command Mode: Enabled (For initialization only) +* [27:25] DRAM Row Select: dram_row[15:0] = magenta_address[25:10] +* [24:21] DRAM Bank Select: dram_bank[1:0] = magenta_address[11:10] +* [20:19] Read Test: DON'T USE +* [18:18] Self Refresh: Enabled +* [17:17] 16bit Mode: Disabled +* [16:13] Ready Delay: 2 +* [12:12] Half DQS Delay: Disabled +* [11:11] Quarter DQS Delay: Disabled +* [10:08] Write Delay: 2 +* [07:07] Early ODT: Disabled +* [06:06] On DIE Termination: Disabled +* [05:05] FIFO Overflow Clear: DON'T USE here +* [04:04] FIFO Underflow Clear: DON'T USE here +* [03:03] FIFO Overflow Pending: DON'T USE here +* [02:02] FIFO Underlfow Pending: DON'T USE here +* [01:01] FIFO Overlfow Enabled: Enabled +* [00:00] FIFO Underflow Enabled: Enabled +* TIME_CFG0 +* [31:16] DRAM Refresh Time: 0 CSB clocks +* [15:8] DRAM Command Time: 0 CSB clocks +* [07:00] DRAM Precharge Time: 0 CSB clocks +* TIME_CFG1 +* [31:26] DRAM tRFC: +* [25:21] DRAM tWR1: +* [20:17] DRAM tWRT1: +* [16:11] DRAM tDRR: +* [10:05] DRAM tRC: +* [04:00] DRAM tRAS: +* TIME_CFG2 +* [31:28] DRAM tRCD: +* [27:23] DRAM tFAW: +* [22:19] DRAM tRTW1: +* [18:15] DRAM tCCD: +* [14:10] DRAM tRTP: +* [09:05] DRAM tRP: +* [04:00] DRAM tRPA +*/ +#define CONFIG_SYS_MDDRC_SYS_CFG 0xF8604A00 +#define CONFIG_SYS_MDDRC_SYS_CFG_RUN 0xE8604A00 +//#define CONFIG_SYS_MDDRC_TIME_CFG1 0x54EC1168 +#define CONFIG_SYS_MDDRC_TIME_CFG1 0x55D81189 +//#define CONFIG_SYS_MDDRC_TIME_CFG2 0x35210864 +#define CONFIG_SYS_MDDRC_TIME_CFG2 0x34790863 + +#define CONFIG_SYS_MDDRC_SYS_CFG_EN 0xF0000000 +#define CONFIG_SYS_MDDRC_TIME_CFG0 0x00003D2E +//#define CONFIG_SYS_MDDRC_TIME_CFG0_RUN 0x06183D2E +#define CONFIG_SYS_MDDRC_TIME_CFG0_RUN 0x030C3D2E + +#define CONFIG_SYS_MICRON_NOP 0x01380000 +#define CONFIG_SYS_MICRON_PCHG_ALL 0x01100400 +#define CONFIG_SYS_MICRON_EM2 0x01020000 +#define CONFIG_SYS_MICRON_EM3 0x01030000 +#define CONFIG_SYS_MICRON_EN_DLL 0x01010000 +#define CONFIG_SYS_MICRON_RFSH 0x01080000 +#define CONFIG_SYS_MICRON_INIT_DEV_OP 0x01000432 +#define CONFIG_SYS_MICRON_OCD_DEFAULT 0x01010780 + +/* DDR Priority Manager Configuration */ +#define CONFIG_SYS_MDDRCGRP_PM_CFG1 0x00077777 +#define CONFIG_SYS_MDDRCGRP_PM_CFG2 0x00000000 +#define CONFIG_SYS_MDDRCGRP_HIPRIO_CFG 0x00000001 +#define CONFIG_SYS_MDDRCGRP_LUT0_MU 0xFFEEDDCC +#define CONFIG_SYS_MDDRCGRP_LUT0_ML 0xBBAAAAAA +#define CONFIG_SYS_MDDRCGRP_LUT1_MU 0x66666666 +#define CONFIG_SYS_MDDRCGRP_LUT1_ML 0x55555555 +#define CONFIG_SYS_MDDRCGRP_LUT2_MU 0x44444444 +#define CONFIG_SYS_MDDRCGRP_LUT2_ML 0x44444444 +#define CONFIG_SYS_MDDRCGRP_LUT3_MU 0x55555555 +#define CONFIG_SYS_MDDRCGRP_LUT3_ML 0x55555558 +#define CONFIG_SYS_MDDRCGRP_LUT4_MU 0x11111111 +#define CONFIG_SYS_MDDRCGRP_LUT4_ML 0x11111122 +#define CONFIG_SYS_MDDRCGRP_LUT0_AU 0xaaaaaaaa +#define CONFIG_SYS_MDDRCGRP_LUT0_AL 0xaaaaaaaa +#define CONFIG_SYS_MDDRCGRP_LUT1_AU 0x66666666 +#define CONFIG_SYS_MDDRCGRP_LUT1_AL 0x66666666 +#define CONFIG_SYS_MDDRCGRP_LUT2_AU 0x11111111
include/configs/aria.h line 175
Quoted 10 lines
include/configs/aria.h new file +10
-0+#define CONFIG_SYS_MDDRCGRP_LUT2_AL 0x11111111 +#define CONFIG_SYS_MDDRCGRP_LUT3_AU 0x11111111 +#define CONFIG_SYS_MDDRCGRP_LUT3_AL 0x11111111 +#define CONFIG_SYS_MDDRCGRP_LUT4_AU 0x11111111 +#define CONFIG_SYS_MDDRCGRP_LUT4_AL 0x11111111 + +/* +* NOR FLASH on the Local Bus +*/ +#define CONFIG_SYS_FLASH_CFI /* use the Common Flash Interface */
line too long.
Quoted 8 lines
include/configs/aria.h new file +8
-0+#define CONFIG_FLASH_CFI_DRIVER /* use the CFI driver */ +#define CONFIG_SYS_FLASH_BASE 0xF8000000/* start of FLASH */ +#define CONFIG_SYS_FLASH_SIZE 0x8000000/* max flash size in bytes */ + +#define CONFIG_SYS_FLASH_USE_BUFFER_WRITE +#define CONFIG_SYS_MAX_FLASH_BANKS 1/* number of banks */ +#define CONFIG_SYS_FLASH_BANKS_LIST {CONFIG_SYS_FLASH_BASE} +#define CONFIG_SYS_MAX_FLASH_SECT 1024/* max sectors per device */
include/configs/aria.h line 193
Quoted 10 lines
include/configs/aria.h new file +10
-0+ +#undef CONFIG_SYS_FLASH_CHECKSUM + +#define CONFIG_SYS_SRAM_BASE 0x30000000 +#define CONFIG_SYS_SRAM_SIZE 0x00020000/* 128 KB */ + +#define CONFIG_SYS_ARIA_SRAM_BASE 0x30020000 +#define CONFIG_SYS_ARIA_SRAM_SIZE 0x20000/* 128 KB */ + +#define CONFIG_SYS_ARIA_FPGA_BASE (CONFIG_SYS_ARIA_SRAM_BASE + CONFIG_SYS_ARIA_SRAM_SIZE)
line too long
Quoted 8 lines
include/configs/aria.h new file +8
-0+#define CONFIG_SYS_ARIA_FPGA_SIZE 0x20000/* 128 KB */ + +#define CONFIG_SYS_CS0_CFG 0x05059150 +#define CONFIG_SYS_CS2_CFG ( (5 << 24) | \ + (5 << 16) | \ + (1 << 15) | \ + (0 << 14) | \ + (0 << 13) | \
include/configs/aria.h line 211
Quoted 10 lines
include/configs/aria.h new file +10
-0+ (1 <<12 ) | \ + (0 <<10 ) | \ + (3 <<8 ) |/* 32 bit */ \ + (0 <<7 ) | \ + (1 <<6 ) | \ + (1 <<4 ) | \ + (0 <<3 ) | \ + (0 <<2 ) | \ + (0 <<1 ) | \ + (0 <<0 ) \
Hmm... seems to my, there are some tabs too much here ...
include/configs/aria.h line 214
Quoted 3 lines
include/configs/aria.h new file +3
-0+ ) +#define CONFIG_SYS_CS6_CFG 0x05059150 +#define CONFIG_SYS_CS_ALETIMING 0x00000005/* Use alternative CS timing for CS0 and CS2 */
line too long
include/configs/aria.h line 218
Quoted 4 lines
include/configs/aria.h new file +4
-0+ +/* Use SRAM for initial stack */ +#define CONFIG_SYS_INIT_RAM_ADDR CONFIG_SYS_SRAM_BASE/* Initial RAM address */ +#define CONFIG_SYS_INIT_RAM_END CONFIG_SYS_SRAM_SIZE/* End of used area in RAM */
here too
Quoted 84 lines
include/configs/aria.h new file +84
-0+ +#define CONFIG_SYS_GBL_DATA_SIZE 0x100/* num bytes initial data */ +#define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_INIT_RAM_END - CONFIG_SYS_GBL_DATA_SIZE) +#define CONFIG_SYS_INIT_SP_OFFSET CONFIG_SYS_GBL_DATA_OFFSET + +#define CONFIG_SYS_MONITOR_BASE TEXT_BASE/* Start of monitor */ +#define CONFIG_SYS_MONITOR_LEN (256 * 1024)/* Reserve 256 kB for Mon */ +#ifdef CONFIG_FSL_DIU_FB +#define CONFIG_SYS_MALLOC_LEN (6 * 1024 * 1024)/* Reserved for malloc */ +#else +#define CONFIG_SYS_MALLOC_LEN (512 * 1024) +#endif + +/* FPGA */ +#define CONFIG_ARIA_FPGA 1 + + +/* +* Serial Port +*/ +#define CONFIG_CONS_INDEX 1 +#undef CONFIG_SERIAL_SOFTWARE_FIFO + +/* +* Serial console configuration +*/ +#define CONFIG_PSC_CONSOLE 3/* console is on PSC3 */ +#if CONFIG_PSC_CONSOLE !=3 +#error CONFIG_PSC_CONSOLE must be 3 +#endif +#define CONFIG_BAUDRATE 115200/* ... at 115200 bps */ +#define CONFIG_SYS_BAUDRATE_TABLE \ + {300, 600, 1200, 2400, 4800, 9600, 19200, 38400,115200} + +#define CONSOLE_FIFO_TX_SIZE FIFOC_PSC3_TX_SIZE +#define CONSOLE_FIFO_TX_ADDR FIFOC_PSC3_TX_ADDR +#define CONSOLE_FIFO_RX_SIZE FIFOC_PSC3_RX_SIZE +#define CONSOLE_FIFO_RX_ADDR FIFOC_PSC3_RX_ADDR + +#define CONFIG_CMDLINE_EDITING 1/* add command line history */ +/* Use the HUSH parser */ +#define CONFIG_SYS_HUSH_PARSER +#ifdef CONFIG_SYS_HUSH_PARSER +#define CONFIG_SYS_PROMPT_HUSH_PS2 "> " +#endif + +/* +* PCI +*/ +#ifdef CONFIG_PCI + +/* +* General PCI +*/ +#define CONFIG_SYS_PCI_MEM_BASE 0xA0000000 +#define CONFIG_SYS_PCI_MEM_PHYS CONFIG_SYS_PCI_MEM_BASE +#define CONFIG_SYS_PCI_MEM_SIZE 0x10000000/* 256M */ +#define CONFIG_SYS_PCI_MMIO_BASE (CONFIG_SYS_PCI_MEM_BASE + CONFIG_SYS_PCI_MEM_SIZE) +#define CONFIG_SYS_PCI_MMIO_PHYS CONFIG_SYS_PCI_MMIO_BASE +#define CONFIG_SYS_PCI_MMIO_SIZE 0x10000000/* 256M */ +#define CONFIG_SYS_PCI_IO_BASE 0x00000000 +#define CONFIG_SYS_PCI_IO_PHYS 0x84000000 +#define CONFIG_SYS_PCI_IO_SIZE 0x01000000/* 16M */ + + +#define CONFIG_PCI_PNP /* do pci plug-and-play */ + +#define CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */ + +#endif + +/* I2C */ +#define CONFIG_HARD_I2C /* I2C with hardware support */ +#undef CONFIG_SOFT_I2C/* so disable bit-banged I2C */ +#define CONFIG_I2C_MULTI_BUS +#define CONFIG_I2C_CMD_TREE +#define CONFIG_SYS_I2C_SPEED 100000/* I2C speed and slave address */ +#define CONFIG_SYS_I2C_SLAVE 0x7F +#if 0 +#define CONFIG_SYS_I2C_NOPROBES {{0,0x69}}/* Don't probe these addrs */ +#endif + +/* +* IIM - IC Identification Module
include/configs/aria.h line 312
Quoted 10 lines
include/configs/aria.h new file +10
-0+*/ +#undef CONFIG_IIM + +/* +* EEPROM configuration +*/ +#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2/* 16-bit EEPROM address */ +#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50/* Atmel: AT24C32A-10TQ-2.7 */ +#define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 10/* 10ms of delay */ +#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 5/* 32-Byte Page Write Mode */
long lines
Quoted 7 lines
include/configs/aria.h new file +7
-0+ +/* +* Ethernet configuration +*/ +#define CONFIG_MPC512x_FEC 1 +#define CONFIG_NET_MULTI +#define CONFIG_PHY_ADDR 0x17
include/configs/aria.h line 329
Quoted 10 lines
include/configs/aria.h new file +10
-0+#define CONFIG_MII 1/* MII PHY management */ +#define CONFIG_FEC_AN_TIMEOUT 1 +#define CONFIG_HAS_ETH0 + +/* +* Environment +*/ +#define CONFIG_ENV_IS_IN_FLASH 1 +/* This has to be a multiple of the Flash sector size */ +#define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)
line too long ... Hmm.. shouldn;t we accept such long lines? It seems better to me to have such long lines, because it would look uglier if we split this in two or more lines?
Quoted 51 lines
include/configs/aria.h new file +51
-0+#define CONFIG_ENV_SIZE 0x2000 +#define CONFIG_ENV_SECT_SIZE 0x20000/* one sector (256K) for env */ + +/* Address and size of Redundant Environment Sector */ +#define CONFIG_ENV_ADDR_REDUND (CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE) +#define CONFIG_ENV_SIZE_REDUND (CONFIG_ENV_SIZE) + +#define CONFIG_LOADS_ECHO 1/* echo on for serial download */ +#define CONFIG_SYS_LOADS_BAUD_CHANGE 1/* allow baudrate change */ + +#include <config_cmd_default.h> + +#define CONFIG_CMD_ASKENV +#define CONFIG_CMD_DHCP +#define CONFIG_CMD_I2C +#define CONFIG_CMD_MII +#define CONFIG_CMD_NFS +#define CONFIG_CMD_PING +#define CONFIG_CMD_REGINFO +#define CONFIG_CMD_EEPROM +#undef CONFIG_CMD_FUSE +#undef CONFIG_CMD_IDE +#undef CONFIG_CMD_EXT2 + +#if defined(CONFIG_PCI ) +#define CONFIG_CMD_PCI +#endif + +#if defined(CONFIG_CMD_IDE ) +#define CONFIG_DOS_PARTITION +#define CONFIG_MAC_PARTITION +#define CONFIG_ISO_PARTITION +#endif /* defined(CONFIG_CMD_IDE) */ + +/* +* Watchdog timeout = CONFIG_SYS_WATCHDOG_VALUE * 65536 / IPS clock. +* For example, when IPS is set to 66MHz and CONFIG_SYS_WATCHDOG_VALUE is set +* to 0xFFFF, watchdog timeouts after about 64s. For details refer +* to chapter 36 of the MPC5121e Reference Manual. +*/ +/* #define CONFIG_WATCHDOG */ /* enable watchdog */ +#define CONFIG_SYS_WATCHDOG_VALUE 0xFFFF + +/* +* Miscellaneous configurable options +*/ +#define CONFIG_SYS_LONGHELP /* undef to save memory */ +#define CONFIG_SYS_LOAD_ADDR 0x2000000/* default load address */ +#define CONFIG_SYS_PROMPT "=> "/* Monitor Command Prompt */ + +#ifdef CONFIG_CMD_KGDB
include/configs/aria.h line 390
Quoted 10 lines
include/configs/aria.h new file +10
-0+#define CONFIG_SYS_CBSIZE 1024/* Console I/O Buffer Size */ +#else +#define CONFIG_SYS_CBSIZE 256/* Console I/O Buffer Size */ +#endif + + +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)/* Print Buffer Size */ +#define CONFIG_SYS_MAXARGS 16/* max number of command args */ +#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE/* Boot Argument Buffer Size */ +#define CONFIG_SYS_HZ 1000/* decrementer freq: 1ms ticks */
long lines.
include/configs/aria.h line 396
Quoted 6 lines
include/configs/aria.h new file +6
-0+ +/* +* For booting Linux, the board info and command line data +* have to be in the first 8 MB of memory, since this is +* the maximum mapped by the Linux kernel during initialization. +*/
[...]
bye
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 8/29 MPC512x: add support for ARIA board
Dear Heiko Schocher,
Quoted 10 lines · In message <[email protected]> you wrote:
board/davedenx/aria/aria.c line 105
Quoted 8 lines
board/davedenx/aria/aria.c new file +7
-0+/* +* Configure Flash Speed +*/ +out_be32 (&im->lpc.cs_cfg[0 ],CONFIG_SYS_CS0_CFG ); + + spridr =in_be32 (&im->sysconf.spridr); +no blank line necessary.
Not necessary, but I find it easier to read.
Quoted 8 lines
board/davedenx/aria/aria.c line 126
Quoted 4 lines
board/davedenx/aria/aria.c new file +4
-0+u32 msize =0 ; + + msize =fixed_sdram (); +no blank line necessary.
Review
Quoted 1 line
(quoted diff) +1
-0+ return msize;
Same here.
...
Quoted 9 lines
board/davedenx/aria/aria.c line 182
Quoted 7 lines
board/davedenx/aria/aria.c new file +7
-0+out_be32 (&im->mddrc.lut_table1_alternate_lower,CONFIG_SYS_MDDRCGRP_LUT1_AL ); +out_be32 (&im->mddrc.lut_table2_alternate_upper,CONFIG_SYS_MDDRCGRP_LUT2_AU ); +out_be32 (&im->mddrc.lut_table2_alternate_lower,CONFIG_SYS_MDDRCGRP_LUT2_AL ); +out_be32 (&im->mddrc.lut_table3_alternate_upper,CONFIG_SYS_MDDRCGRP_LUT3_AU ); +out_be32 (&im->mddrc.lut_table3_alternate_lower,CONFIG_SYS_MDDRCGRP_LUT3_AL ); +out_be32 (&im->mddrc.lut_table4_alternate_upper,CONFIG_SYS_MDDRCGRP_LUT4_AU ); +out_be32 (&im->mddrc.lut_table4_alternate_lower,CONFIG_SYS_MDDRCGRP_LUT4_AL );too long lines ... but 2 lines would also look ugly ...
I tried splitting it in too lines, but it looks *really* ugly. As it's just 85 columns, I decided to leave it that way.
Quoted 8 lines
board/davedenx/aria/aria.c line 244
Quoted 6 lines
board/davedenx/aria/aria.c new file +6
-0+#ifdef CONFIG_FSL_DIU_FB +#if !(defined(CONFIG_VIDEO ) || defined(CONFIG_CFB_CONSOLE )) +mpc5121_diu_init (); +#endif +#endif +no blank line necessary.
Same as above.
Quoted 3 lines
board/davedenx/aria/aria.c line 308
Quoted 1 line
board/davedenx/aria/aria.c new file +1
-0+iopin_initialize (ioregs_init,sizeof (ioregs_init) /sizeof (ioregs_init[0 ]));line too long
Changed.
Quoted 12 lines
Quoted 12 lines
board/davedenx/aria/aria.c new file +12
-0+ +#define CALC_TIMING (t) (t + period - 1) / period + +int ide_preinit (void ) +{ +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +long t; + const struct { + short t0; + short t1; + short t2_8; + short t2_16;
Quoted 8 lines
board/davedenx/aria/aria.c line 366
Quoted 5 lines
board/davedenx/aria/aria.c new file +5
-0+short t2i; +short t4; +short t9; +short tA; + } pio_specs = {Is this a processor specific register? If so, shouldn;t this go in
include/asm-ppc/immap_512x.h?
Well spotted, thanks - especially, since the whole code is duplicated in board/freescale/mpc5121ads/mpc5121ads.c; split into new file, cpu/mpc512x/ide.c
Quoted 9 lines
include/configs/aria.h line 37
Quoted 7 lines
include/configs/aria.h new file +7
-0+#define CONFIG_ARIA 1 +/* +* Memory map for the ARIA board: +* +* 0x0000_0000 - 0x0FFF_FFFF DDR RAM (256 MB) +* 0x3000_0000 - 0x3001_FFFF On Chip SRAM (128 KB) +* 0x3010_0000 - 0x3003_FFFF On Board SRAM (128 KB - max 512KB - 1MB reserved) - CS6 line too long.
Indeed. All long lines fixed. Thanks for pointing out.
Quoted 7 lines
include/configs/aria.h line 329
Quoted 3 lines
include/configs/aria.h new file +3
-0+#define CONFIG_ENV_IS_IN_FLASH 1 +/* This has to be a multiple of the Flash sector size */ +#define CONFIG_ENV_ADDR (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)line too long ... Hmm.. shouldn;t we accept such long lines? It seems better to me to have such long lines, because it would look uglier if we split this in two or more lines?
No, in this case it's easy to write n two lines, I think.
Thanks a lot!
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 How many QA engineers does it take to screw in a lightbulb? 3: 1 to screw it in and 2 to say "I told you so" when it doesn't work.
PATCH 8/29 MPC512x: add support for ARIA board
In reply to Wolfgang DenkHi Wolfgang,
Quoted 1 line · On Saturday 09 May 2009 21:50:47 Wolfgang Denk wrote:
ARIA is a MPC5121E based COM Express module by Dave/DENX.
Please find some comments below.
<snip>
Quoted 1 line
board/davedenx/aria/aria.c +0
-0
<snip>
Quoted 10 lines
board/davedenx/aria/aria.c +10
-0+/* +* Enable clocks +*/ +out_be32 (&im->clk.sccr[0 ],SCCR1_CLOCKS_EN ); +out_be32 (&im->clk.sccr[1 ],SCCR2_CLOCKS_EN ); +#if defined(CONFIG_IIM ) || defined(CONFIG_CMD_FUSE ) +setbits_be32 (&im->clk.sccr[1 ],CLOCK_SCCR2_IIM_EN ); +#endif + +return 0 ;
board/davedenx/aria/aria.c line 128
Quoted 10 lines
board/davedenx/aria/aria.c +10
-0+} + +phys_size_t initdram (int board_type) +{ +u32 msize =0 ; + + msize =fixed_sdram (); + +return msize; +}
Or just:
phys_size_t initdram (int board_type)
{
return fixed_sdram ();
}And I noticed that are mixing the coding style's in this file (space before "(" of functions): fixed_sdram () vs. out_be(...). Better it would be consistent.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
PATCH 8/29 MPC512x: add support for ARIA board
Dear Stefan,
Quoted 12 lines · In message <[email protected]> you wrote:
board/davedenx/aria/aria.c line 128
Quoted 9 lines
board/davedenx/aria/aria.c new file +8
-0+phys_size_t initdram (int board_type) +{ +u32 msize =0 ; + + msize =fixed_sdram (); + +return msize; +}Or just:
Quoted 4 lines
phys_size_tinitdram (intboard_type){ return fixed_sdram (); }
Right, will change.
Quoted 3 lines
And I noticed that are mixing the coding style's in this file (space before "(" of functions):
fixed_sdram() vs.out_be(...). Better it would be consistent.
Indeed. Will change, too. Thanks for pointing out.
[I'll continue to collect review comments for a few more days and then post patch series V2; in the meantime, the current, updated code, rebased against "next", is available in the "aria" branch of the u-boot-testing repository.]
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 There comes to all races an ultimate crisis which you have yet to face .... One day our minds became so powerful we dared think of ourselves as gods. -- Sargon, "Return to Tomorrow", stardate 4768.3
PATCH 9/29 cpu/mpc512x/iopin.c: convert to use I/O acessors.
In reply to Wolfgang Denk--- cpu/mpc512x/iopin.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
cpu/mpc512x/iopin.c +3 -2
@@ -23,6 +23,7 @@#include <common.h> #include <linux/types.h> +#include <asm/io.h> #include <asm/immap_512x.h> void iopin_initialize (iopin_t *ioregs_init,int len)
@@ -40,9 +41,9 @@ void iopin_initialize(iopin_t *ioregs_init, int len)for (p =0 , j = ioregs_init[i].p_offset /sizeof (u_long); p < ioregs_init[i].nr_pins; p++, j++) {if (ioregs_init[i].bit_or) - reg[j] |= ioregs_init[i].val; +setbits_be32 (reg + j, ioregs_init[i].val);else - reg[j] = ioregs_init[i].val; +out_be32 (reg + j, ioregs_init[i].val); } }return ;
Signature · 1 line
1.6.0.6
PATCH 10/29 cpu/mpc512x/iopin.c: remove redundant include of <asm/immap_512x.h>
In reply to Wolfgang DenkThis already gets included by <common.h>
--- cpu/mpc512x/iopin.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
cpu/mpc512x/iopin.c +0 -1
@@ -24,7 +24,6 @@#include <common.h> #include <linux/types.h> #include <asm/io.h> -#include <asm/immap_512x.h> void iopin_initialize (iopin_t *ioregs_init,int len) {
Signature · 1 line
1.6.0.6
PATCH 11/29 MPC512x: prepare removal of include/mpc512x.h
In reply to Wolfgang DenkMove needed definitions (register descriptions etc.) from include/mpc512x.h into include/asm-ppc/immap_512x.h.
All the rest of include/mpc512x.h are register offset definitions which can be eliminated by proper use of C structures - of course in combination with replacing pointer accesses by I/O accessor calls.
There are only a few register offsets remaining that are needed in cpu/mpc512x/start.S; for these we provide cpu/mpc512x/asm-offsets.h which is intended as a temporary workaround only. In a later patch this file will be removed, too, and then auto-generated from the respective C structs.
--- cpu/mpc512x/asm-offsets.h | 15 ++ cpu/mpc512x/start.S | 4 +- include/asm-ppc/immap_512x.h | 324 +++++++++++++++++++++++++++++++++++++++++- include/mpc512x.h | 317 ----------------------------------------- 4 files changed, 341 insertions(+), 319 deletions(-) create mode 100644 cpu/mpc512x/asm-offsets.h
cpu/mpc512x/asm-offsets.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* needed for cpu/mpc512x/start.S +* +* These should be auto-generated +*/ +#define LPCS0AW 0x0024 +#define SRAMBAR 0x00C4 +#define SWCRR 0x0904 +#define LPC_OFFSET 0x10000 +#define CS0_CONFIG 0x00000 +#define CS_CTRL 0x00020 +#define CS_CTRL_ME 0x01000000/* CS Master Enable bit */ + +#define EXC_OFF_SYS_RESET 0x0100 +#define _START_OFFSET EXC_OFF_SYS_RESET
cpu/mpc512x/start.S +3 -1
@@ -30,12 +30,14 @@ */ #include <config.h> -#include <mpc512x.h> #include <timestamp.h> #include <version.h> #define CONFIG_521X 1 /* needed for Linux kernel header files*/ +#include <asm/immap_512x.h> +#include "asm-offsets.h" + #include <ppc_asm.tmpl> #include <ppc_defs.h>
include/asm-ppc/immap_512x.h +323 -1
395 lines not on this page · raw message
include/mpc512x.h +0 -317
358 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH 12/29 include/configs/mpc5121ads.h: prepare removal of include/mpc512x.h
In reply to Wolfgang DenkInstead of using a #define'd register offset, use a function that provides the PATA controller's base address.
This allows us to get rid of all such register offset definitions (at least for use in C files).
--- include/configs/mpc5121ads.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
include/configs/mpc5121ads.h +2 -2
@@ -520,7 +520,7 @@#define CONFIG_SYS_IDE_MAXDEVICE 2/* max. 1 drive per IDE bus */ #define CONFIG_SYS_ATA_IDE0_OFFSET 0x0000 -#define CONFIG_SYS_ATA_BASE_ADDR MPC512X_PATA +#define CONFIG_SYS_ATA_BASE_ADDR get_pata_base()/* Offset for data I/O RefMan MPC5121EE Table 28-10 */ #define CONFIG_SYS_ATA_DATA_OFFSET (0x00A0)
@@ -534,7 +534,7 @@/* Interval between registers */ #define CONFIG_SYS_ATA_STRIDE 4 -#define ATA_BASE_ADDR MPC512X_PATA +#define ATA_BASE_ADDR get_pata_base()/* * Control register bit definitions
Signature · 1 line
1.6.0.6
PATCH 13/29 include/configs/aria.h: prepare removal of include/mpc512x.h
In reply to Wolfgang DenkInstead of using a #define'd register offset, use a function that provides the PATA controller's base address.
This allows us to get rid of all such register offset definitions (at least for use in C files).
--- include/configs/aria.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
include/configs/aria.h +2 -2
@@ -512,7 +512,7 @@#define CONFIG_SYS_IDE_MAXDEVICE 2/* max. 1 drive per IDE bus */ #define CONFIG_SYS_ATA_IDE0_OFFSET 0x0000 -#define CONFIG_SYS_ATA_BASE_ADDR MPC512X_PATA +#define CONFIG_SYS_ATA_BASE_ADDR get_pata_base()/* Offset for data I/O RefMan MPC5121EE Table 28-10 */ #define CONFIG_SYS_ATA_DATA_OFFSET (0x00A0)
@@ -526,7 +526,7 @@/* Interval between registers */ #define CONFIG_SYS_ATA_STRIDE 4 -#define ATA_BASE_ADDR MPC512X_PATA +#define ATA_BASE_ADDR get_pata_base()/* * Control register bit definitions
Signature · 1 line
1.6.0.6
PATCH 14/29 common/cmd_ide.c: prepare removal of include/mpc512x.h
In reply to Wolfgang Denkremove include - it's not needed any more.
--- common/cmd_ide.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
common/cmd_ide.c +0 -4
@@ -45,10 +45,6 @@#include <mpc5xxx.h> #endif -#ifdef CONFIG_MPC512X -#include <mpc512x.h> -#endif -#include <ide.h> #include <ata.h>
Signature · 1 line
1.6.0.6
PATCH 15/29 cpu/mpc512x/cpu.c: prepare removal of include/mpc512x.h
In reply to Wolfgang Denkremove include - it's not needed any more.
--- cpu/mpc512x/cpu.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
cpu/mpc512x/cpu.c +0 -1
@@ -29,7 +29,6 @@#include <common.h> #include <command.h> -#include <mpc512x.h> #include <net.h> #include <netdev.h> #include <asm/processor.h>
Signature · 1 line
1.6.0.6
PATCH 16/29 cpu/mpc512x/cpu_init.c: prepare removal of include/mpc512x.h
In reply to Wolfgang Denkremove include - it's not needed any more.
--- cpu/mpc512x/cpu_init.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
cpu/mpc512x/cpu_init.c +0 -1
@@ -25,7 +25,6 @@*/ #include <common.h> -#include <mpc512x.h> DECLARE_GLOBAL_DATA_PTR ;
Signature · 1 line
1.6.0.6
PATCH 17/29 cpu/mpc512x/cpu_init.c: use I/O accessors instead of pointer accesses
In reply to Wolfgang Denk--- cpu/mpc512x/cpu_init.c | 24 +++++++++++++++--------- 1 files changed, 15 insertions(+), 9 deletions(-)
cpu/mpc512x/cpu_init.c +15 -9
@@ -25,6 +25,8 @@*/ #include <common.h> +#include <asm/io.h> +#include <asm/processor.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -45,30 +47,34 @@ void cpu_init_f (volatile immap_t * im)#ifdef CONFIG_SYS_ACR_PIPE_DEP /* Arbiter pipeline depth */ - im->arbiter.acr = (im->arbiter.acr & ~ACR_PIPE_DEP ) | - (CONFIG_SYS_ACR_PIPE_DEP <<ACR_PIPE_DEP_SHIFT ); +out_be32 (&im->arbiter.acr, + (im->arbiter.acr & ~ACR_PIPE_DEP ) | + (CONFIG_SYS_ACR_PIPE_DEP <<ACR_PIPE_DEP_SHIFT ) + );#endif #ifdef CONFIG_SYS_ACR_RPTCNT /* Arbiter repeat count */ - im->arbiter.acr = ((im->arbiter.acr & ~(ACR_RPTCNT )) | - (CONFIG_SYS_ACR_RPTCNT <<ACR_RPTCNT_SHIFT )); +out_be32 (im->arbiter.acr, + (im->arbiter.acr & ~(ACR_RPTCNT )) | + (CONFIG_SYS_ACR_RPTCNT <<ACR_RPTCNT_SHIFT ) + );#endif /* RSR - Reset Status Register - clear all status */ gd->reset_status = im->reset.rsr; - im->reset.rsr = ~(RSR_RES ); +out_be32 (&im->reset.rsr, ~RSR_RES );/* * RMR - Reset Mode Register - enable checkstop reset */ - im->reset.rmr = (RMR_CSRE & (1 <<RMR_CSRE_SHIFT )); +out_be32 (&im->reset.rmr,RMR_CSRE & (1 <<RMR_CSRE_SHIFT ));/* Set IPS-CSB divider: IPS = 1/2 CSB */ - ips_div = im->clk.scfr[0 ]; + ips_div =in_be32 (&im->clk.scfr[0 ]); ips_div &= ~(SCFR1_IPS_DIV_MASK ); ips_div |=SCFR1_IPS_DIV <<SCFR1_IPS_DIV_SHIFT ; - im->clk.scfr[0 ] = ips_div; +out_be32 (&im->clk.scfr[0 ], ips_div);/* * Enable Time Base/Decrementer
@@ -77,7 +83,7 @@ void cpu_init_f (volatile immap_t * im)* have udelay() working; if not enabled, usually leads to a hang, like * during FLASH chip identification etc. */ - im->sysconf.spcr |=SPCR_TBEN ; +setbits_be32 (&im->sysconf.spcr,SPCR_TBEN ); }int cpu_init_r (void )
Signature · 1 line
1.6.0.6
PATCH 18/29 cpu/mpc512x/speed.c: prepare removal of include/mpc512x.h
In reply to Wolfgang Denkremove include - it's not needed any more.
--- cpu/mpc512x/speed.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
cpu/mpc512x/speed.c +0 -1
@@ -26,7 +26,6 @@*/ #include <common.h> -#include <mpc512x.h> #include <command.h> #include <asm/processor.h>
Signature · 1 line
1.6.0.6
PATCH 19/29 cpu/mpc512x/speed.c: use I/O accessors instead of pointer accesses
In reply to Wolfgang Denk--- cpu/mpc512x/speed.c | 21 +++++++++++++++------ 1 files changed, 15 insertions(+), 6 deletions(-)
cpu/mpc512x/speed.c +15 -6
@@ -27,6 +27,7 @@#include <common.h> #include <command.h> +#include <asm/io.h> #include <asm/processor.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -74,29 +75,37 @@ int get_clocks (void)u32 csb_clk;u32 ips_clk;u32 pci_clk; +u32 reg; -if ((im->sysconf.immrbar &IMMRBAR_BASE_ADDR ) != (u32 ) im) + reg =in_be32 (&im->sysconf.immrbar); +if ((reg &IMMRBAR_BASE_ADDR ) != (u32 ) im)return -1 ; - spmf = (im->clk.spmr &SPMR_SPMF ) >>SPMR_SPMF_SHIFT ; + reg =in_be32 (&im->clk.spmr); + spmf = (reg &SPMR_SPMF ) >>SPMR_SPMF_SHIFT ; spll = ref_clk * spmf_mult[spmf]; - sys_div = (im->clk.scfr[1 ] &SCFR2_SYS_DIV ) >>SCFR2_SYS_DIV_SHIFT ; + reg =in_be32 (&im->clk.scfr[1 ]); + sys_div = (reg &SCFR2_SYS_DIV ) >>SCFR2_SYS_DIV_SHIFT ; sys_clk = (spll * sys_dividors[sys_div][1 ]) / sys_dividors[sys_div][0 ]; csb_clk = sys_clk /2 ; - cpmf = (im->clk.spmr &SPMR_CPMF ) >>SPMR_CPMF_SHIFT ; + reg =in_be32 (&im->clk.spmr); + cpmf = (reg &SPMR_CPMF ) >>SPMR_CPMF_SHIFT ; core_clk = (csb_clk * cpmf_mult[cpmf][0 ]) / cpmf_mult[cpmf][1 ]; - ips_div = (im->clk.scfr[0 ] &SCFR1_IPS_DIV_MASK ) >>SCFR1_IPS_DIV_SHIFT ; + reg =in_be32 (&im->clk.scfr[0 ]); + ips_div = (reg &SCFR1_IPS_DIV_MASK ) >>SCFR1_IPS_DIV_SHIFT ;if (ips_div !=0 ) { ips_clk = csb_clk / ips_div; }else {/* in case we cannot get a sane IPS divisor, fail gracefully */ ips_clk =0 ; } - pci_div = (im->clk.scfr[0 ] &SCFR1_PCI_DIV_MASK ) >>SCFR1_PCI_DIV_SHIFT ; + + reg =in_be32 (&im->clk.scfr[0 ]); + pci_div = (reg &SCFR1_PCI_DIV_MASK ) >>SCFR1_PCI_DIV_SHIFT ;if (pci_div !=0 ) { pci_clk = csb_clk / pci_div; }else {
Signature · 1 line
1.6.0.6
PATCH 20/29 cpu/mpc512x/serial.c: use I/O accessors instead of pointer accesses
In reply to Wolfgang Denk--- cpu/mpc512x/serial.c | 62 +++++++++++++++++++++++++------------------------ 1 files changed, 32 insertions(+), 30 deletions(-)
cpu/mpc512x/serial.c +32 -30
@@ -30,6 +30,8 @@*/ #include <common.h> +#include <asm/io.h> +#include <asm/processor.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -40,21 +42,21 @@ static void fifo_init (volatile psc512x_t *psc)volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ;/* reset Rx & Tx fifo slice */ - psc->rfcmd =PSC_FIFO_RESET_SLICE ; - psc->tfcmd =PSC_FIFO_RESET_SLICE ; +out_be32 (&psc->rfcmd,PSC_FIFO_RESET_SLICE ); +out_be32 (&psc->tfcmd,PSC_FIFO_RESET_SLICE );/* disable Tx & Rx FIFO interrupts */ - psc->rfintmask =0 ; - psc->tfintmask =0 ; +out_be32 (&psc->rfintmask,0 ); +out_be32 (&psc->tfintmask,0 ); - psc->tfsize =CONSOLE_FIFO_TX_SIZE | (CONSOLE_FIFO_TX_ADDR <<16 ); - psc->rfsize =CONSOLE_FIFO_RX_SIZE | (CONSOLE_FIFO_RX_ADDR <<16 ); +out_be32 (&psc->tfsize,CONSOLE_FIFO_TX_SIZE | (CONSOLE_FIFO_TX_ADDR <<16 )); +out_be32 (&psc->rfsize,CONSOLE_FIFO_RX_SIZE | (CONSOLE_FIFO_RX_ADDR <<16 ));/* enable Tx & Rx FIFO slice */ - psc->rfcmd =PSC_FIFO_ENABLE_SLICE ; - psc->tfcmd =PSC_FIFO_ENABLE_SLICE ; +out_be32 (&psc->rfcmd,PSC_FIFO_ENABLE_SLICE ); +out_be32 (&psc->tfcmd,PSC_FIFO_ENABLE_SLICE ); - im->fifoc.fifoc_cmd =FIFOC_DISABLE_CLOCK_GATE ; +out_be32 (&im->fifoc.fifoc_cmd,FIFOC_DISABLE_CLOCK_GATE ); __asm__volatile ("sync" ); }
@@ -68,38 +70,38 @@ int serial_init(void)fifo_init (psc);/* set MR register to point to MR1 */ - psc->command =PSC_SEL_MODE_REG_1 ; +out_8 (&psc->command,PSC_SEL_MODE_REG_1 );/* disable Tx/Rx */ - psc->command =PSC_TX_DISABLE |PSC_RX_DISABLE ; +out_8 (&psc->command,PSC_TX_DISABLE |PSC_RX_DISABLE );/* choose the prescaler by 16 for the Tx/Rx clock generation */ - psc->psc_clock_select =0xdd00 ; +out_be16 (&psc->psc_clock_select,0xdd00 );/* switch to UART mode */ - psc->sicr =0 ; +out_be32 (&psc->sicr,0 );/* mode register points to mr1 */ /* configure parity, bit length and so on in mode register 1*/ - psc->mode =PSC_MODE_8_BITS |PSC_MODE_PARNONE ; +out_8 (&psc->mode,PSC_MODE_8_BITS |PSC_MODE_PARNONE );/* now, mode register points to mr2 */ - psc->mode =PSC_MODE_1_STOPBIT ; +out_8 (&psc->mode,PSC_MODE_1_STOPBIT );/* calculate dividor for setting PSC CTUR and CTLR registers */ baseclk = (gd->ips_clk +8 ) /16 ; div = (baseclk + (gd->baudrate /2 )) / gd->baudrate; - psc->ctur = (div >>8 ) &0xff ; +out_8 (&psc->ctur, (div >>8 ) &0xff );/* set baudrate */ - psc->ctlr = div &0xff ; +out_8 (&psc->ctlr, div &0xff );/* disable all interrupts */ - psc->psc_imr =0 ; +out_be16 (&psc->psc_imr,0 );/* reset and enable Rx/Tx */ - psc->command =PSC_RST_RX ; - psc->command =PSC_RST_TX ; - psc->command =PSC_RX_ENABLE |PSC_TX_ENABLE ; +out_8 (&psc->command,PSC_RST_RX ); +out_8 (&psc->command,PSC_RST_TX ); +out_8 (&psc->command,PSC_RX_ENABLE |PSC_TX_ENABLE );return 0 ; }
@@ -113,7 +115,7 @@ void serial_putc (const char c)serial_putc ('\r' );/* Wait for last character to go. */ -while (!(psc->psc_status &PSC_SR_TXEMP )) +while (!(in_be16 (&psc->psc_status) &PSC_SR_TXEMP )) ; psc->tfdata_8 = c;
@@ -125,7 +127,7 @@ void serial_putc_raw (const char c)volatile psc512x_t *psc = (psc512x_t *) &im->psc[CONFIG_PSC_CONSOLE ];/* Wait for last character to go. */ -while (!(psc->psc_status &PSC_SR_TXEMP )) +while (!(in_be16 (&psc->psc_status) &PSC_SR_TXEMP )) ; psc->tfdata_8 = c;
@@ -145,7 +147,7 @@ int serial_getc (void)volatile psc512x_t *psc = (psc512x_t *) &im->psc[CONFIG_PSC_CONSOLE ];/* Wait for a character to arrive. */ -while (psc->rfstat &PSC_FIFO_EMPTY ) +while (in_be32 (&psc->rfstat) &PSC_FIFO_EMPTY ) ;return psc->rfdata_8;
@@ -156,7 +158,7 @@ int serial_tstc (void)volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ;volatile psc512x_t *psc = (psc512x_t *) &im->psc[CONFIG_PSC_CONSOLE ]; -return !(psc->rfstat &PSC_FIFO_EMPTY ); +return !(in_be32 (&psc->rfstat) &PSC_FIFO_EMPTY ); }void serial_setbrg (void )
@@ -168,8 +170,8 @@ void serial_setbrg (void) baseclk = (gd->csb_clk +8 ) /16 ; div = (baseclk + (gd->baudrate /2 )) / gd->baudrate; - psc->ctur = (div >>8 ) &0xFF ; - psc->ctlr = div &0xff ;/* set baudrate */ +out_8 (&psc->ctur, (div >>8 ) &0xFF ); +out_8 (&psc->ctlr, div &0xff );/* set baudrate */ }void serial_setrts (int s)
@@ -179,11 +181,11 @@ void serial_setrts(int s)if (s) {/* Assert RTS (become LOW) */ - psc->op1 =0x1 ; +out_8 (&psc->op1,0x1 ); }else {/* Negate RTS (become HIGH) */ - psc->op0 =0x1 ; +out_8 (&psc->op0,0x1 ); } }
@@ -192,6 +194,6 @@ int serial_getcts(void)volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ;volatile psc512x_t *psc = (psc512x_t *) &im->psc[CONFIG_PSC_CONSOLE ]; - return (psc->ip & 0x1) ? 0 : 1; + return (in_8(&psc->ip) & 0x1) ? 0 : 1; }#endif /* CONFIG_PSC_CONSOLE */
Signature · 1 line
1.6.0.6
PATCH 21/29 cpu/mpc512x/i2c.c: prepare removal of include/mpc512x.h
In reply to Wolfgang Denkremove include - it's not needed any more.
--- cpu/mpc512x/i2c.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
cpu/mpc512x/i2c.c +0 -1
@@ -29,7 +29,6 @@ DECLARE_GLOBAL_DATA_PTR;#ifdef CONFIG_HARD_I2C -#include <mpc512x.h> #include <i2c.h> #define immr ((immap_t *)CONFIG_SYS_IMMR)
Signature · 1 line
1.6.0.6
PATCH 21/29 cpu/mpc512x/i2c.c: prepare removal of include/mpc512x.h
Hello Wolfgang,
Quoted 8 lines · Wolfgang Denk
remove include - it's not needed any more.
Signed-off-by Wolfgang Denk <[email protected]>Cc John Rigby <[email protected]>--- cpu/mpc512x/i2c.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
bye
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 22/29 cpu/mpc512x/i2c.c: use immr offsets from C struct instead of #define
In reply to Wolfgang Denk--- cpu/mpc512x/i2c.c | 33 ++++++++++++++++++++------------- 1 files changed, 20 insertions(+), 13 deletions(-)
cpu/mpc512x/i2c.c +20 -13
@@ -31,8 +31,6 @@ DECLARE_GLOBAL_DATA_PTR;#include <i2c.h> -#define immr ((immap_t *)CONFIG_SYS_IMMR) -/* by default set I2C bus 0 active */ static unsigned int bus_num =0 ;
@@ -77,7 +75,8 @@ static void mpc_reg_out (volatile u32 *reg, int val, int mask)static int wait_for_bb (void ) { -i2c512x_dev_t *regs = &immr->i2c.dev[bus_num]; +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +volatile i2c512x_dev_t *regs = &im->i2c.dev[bus_num];int timeout =I2C_TIMEOUT ;int status;
@@ -100,7 +99,8 @@ static int wait_for_bb (void)static int wait_for_pin (int *status) { -i2c512x_dev_t *regs = &immr->i2c.dev[bus_num]; +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +volatile i2c512x_dev_t *regs = &im->i2c.dev[bus_num];int timeout =I2C_TIMEOUT ; *status =mpc_reg_in (®s->msr);
@@ -121,7 +121,8 @@ static int wait_for_pin (int *status)static int do_address (uchar chip,char rdwr_flag) { -i2c512x_dev_t *regs = &immr->i2c.dev[bus_num]; +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +volatile i2c512x_dev_t *regs = &im->i2c.dev[bus_num];int status; chip <<=1 ;
@@ -146,7 +147,8 @@ static int do_address (uchar chip, char rdwr_flag)static int send_bytes (uchar chip,char *buf,int len) { -i2c512x_dev_t *regs = &immr->i2c.dev[bus_num]; +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +volatile i2c512x_dev_t *regs = &im->i2c.dev[bus_num];int wrcount;int status;
@@ -169,7 +171,8 @@ static int send_bytes (uchar chip, char *buf, int len)static int receive_bytes (uchar chip,char *buf,int len) { -i2c512x_dev_t *regs = &immr->i2c.dev[bus_num]; +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +volatile i2c512x_dev_t *regs = &im->i2c.dev[bus_num];int dummy =1 ;int rdcount =0 ;int status;
@@ -207,9 +210,10 @@ static int receive_bytes (uchar chip, char *buf, int len)void i2c_init (int speed,int saddr) { +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ;int i;for (i =0 ; i <I2C_BUS_CNT ; i++){ -i2c512x_dev_t *regs = &immr->i2c.dev[i]; +volatile i2c512x_dev_t *regs = &im->i2c.dev[i];mpc_reg_out (®s->mcr,0 ,0 );/* Set clock */
@@ -222,9 +226,9 @@ void i2c_init (int speed, int saddr) }/* Disable interrupts */ - immr->i2c.icr =0 ; + im->i2c.icr =0 ;/* Turn off filters */ - immr->i2c.mifr =0 ; + im->i2c.mifr =0 ;return ; }
@@ -280,7 +284,8 @@ static int mpc_get_fdr (int speed)int i2c_probe (uchar chip) { -i2c512x_dev_t *regs = &immr->i2c.dev[bus_num]; +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +volatile i2c512x_dev_t *regs = &im->i2c.dev[bus_num];int i;for (i =0 ; i <I2C_RETRIES ; i++) {
@@ -301,8 +306,9 @@ int i2c_probe (uchar chip)int i2c_read (uchar chip,uint addr,int alen,uchar *buf,int len) { +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +volatile i2c512x_dev_t *regs = &im->i2c.dev[bus_num];char xaddr[4 ]; -i2c512x_dev_t *regs = &immr->i2c.dev[bus_num];int ret =-1 ; xaddr[0 ] = (addr >>24 ) &0xFF ;
@@ -345,8 +351,9 @@ Done:int i2c_write (uchar chip,uint addr,int alen,uchar *buf,int len) { +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +volatile i2c512x_dev_t *regs = &im->i2c.dev[bus_num];char xaddr[4 ]; -i2c512x_dev_t *regs = &immr->i2c.dev[bus_num];int ret =-1 ; xaddr[0 ] = (addr >>24 ) &0xFF ;
Signature · 1 line
1.6.0.6
PATCH 22/29 cpu/mpc512x/i2c.c: use immr offsets from C struct instead of #define
Hello Wolfgang,
Quoted 11 lines · Wolfgang Denk
Signed-off-by Wolfgang Denk <[email protected]>Cc John Rigby <[email protected]>--- cpu/mpc512x/i2c.c | 33 ++++++++++++++++++++------------- 1 files changed, 20 insertions(+), 13 deletions(-)cpu/mpc512x/i2c.c +0
-0
cpu/mpc512x/i2c.c DECLARE_GLOBAL_DATA_PTR; · line 35
Quoted 7 lines
cpu/mpc512x/i2c.c +0
-2@@ -31,8 +31,6 @@ DECLARE_GLOBAL_DATA_PTR;#include <i2c.h> -#define immr ((immap_t *)CONFIG_SYS_IMMR) -/* by default set I2C bus 0 active */ static unsigned int bus_num =0 ;
If no other bus then the first needed, when running from Flash, its okay for me.
Quoted 63 lines
cpu/mpc512x/i2c.c +12
-6@@ -77,7 +75,8 @@ static void mpc_reg_out (volatile u32 *reg, int val, int mask)static int wait_for_bb (void ) { -i2c512x_dev_t *regs = &immr->i2c.dev[bus_num]; +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +volatile i2c512x_dev_t *regs = &im->i2c.dev[bus_num];int timeout =I2C_TIMEOUT ;int status;@@ -100,7 +99,8 @@ static int wait_for_bb (void)static int wait_for_pin (int *status) { -i2c512x_dev_t *regs = &immr->i2c.dev[bus_num]; +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +volatile i2c512x_dev_t *regs = &im->i2c.dev[bus_num];int timeout =I2C_TIMEOUT ; *status =mpc_reg_in (®s->msr);@@ -121,7 +121,8 @@ static int wait_for_pin (int *status)static int do_address (uchar chip,char rdwr_flag) { -i2c512x_dev_t *regs = &immr->i2c.dev[bus_num]; +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +volatile i2c512x_dev_t *regs = &im->i2c.dev[bus_num];int status; chip <<=1 ;@@ -146,7 +147,8 @@ static int do_address (uchar chip, char rdwr_flag)static int send_bytes (uchar chip,char *buf,int len) { -i2c512x_dev_t *regs = &immr->i2c.dev[bus_num]; +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +volatile i2c512x_dev_t *regs = &im->i2c.dev[bus_num];int wrcount;int status;@@ -169,7 +171,8 @@ static int send_bytes (uchar chip, char *buf, int len)static int receive_bytes (uchar chip,char *buf,int len) { -i2c512x_dev_t *regs = &immr->i2c.dev[bus_num]; +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +volatile i2c512x_dev_t *regs = &im->i2c.dev[bus_num];int dummy =1 ;int rdcount =0 ;int status;@@ -207,9 +210,10 @@ static int receive_bytes (uchar chip, char *buf, int len)void i2c_init (int speed,int saddr) { +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ;int i;for (i =0 ; i <I2C_BUS_CNT ; i++){ -i2c512x_dev_t *regs = &immr->i2c.dev[i]; +volatile i2c512x_dev_t *regs = &im->i2c.dev[i];mpc_reg_out (®s->mcr,0 ,0 );/* Set clock */
cpu/mpc512x/i2c.c void i2c_init (int speed, int saddr) · line 229
Quoted 5 lines
cpu/mpc512x/i2c.c +1
-1@@ -222,9 +226,9 @@ void i2c_init (int speed, int saddr) }/* Disable interrupts */ - immr->i2c.icr =0 ; + im->i2c.icr =0 ;
shouldn;t we use in/out accessors for this?
cpu/mpc512x/i2c.c void i2c_init (int speed, int saddr) · line 231
Quoted 3 lines
cpu/mpc512x/i2c.c +1
-1/* Turn off filters */ - immr->i2c.mifr =0 ; + im->i2c.mifr =0 ;
here too (and so on) ...
Quoted 25 lines
cpu/mpc512x/i2c.c +4
-2return ; }@@ -280,7 +284,8 @@ static int mpc_get_fdr (int speed)int i2c_probe (uchar chip) { -i2c512x_dev_t *regs = &immr->i2c.dev[bus_num]; +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +volatile i2c512x_dev_t *regs = &im->i2c.dev[bus_num];int i;for (i =0 ; i <I2C_RETRIES ; i++) {@@ -301,8 +306,9 @@ int i2c_probe (uchar chip)int i2c_read (uchar chip,uint addr,int alen,uchar *buf,int len) { +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +volatile i2c512x_dev_t *regs = &im->i2c.dev[bus_num];char xaddr[4 ]; -i2c512x_dev_t *regs = &immr->i2c.dev[bus_num];int ret =-1 ; xaddr[0 ] = (addr >>24 ) &0xFF ;
cpu/mpc512x/i2c.c Done: · line 359
Quoted 10 lines
cpu/mpc512x/i2c.c +2
-1@@ -345,8 +351,9 @@ Done:int i2c_write (uchar chip,uint addr,int alen,uchar *buf,int len) { +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +volatile i2c512x_dev_t *regs = &im->i2c.dev[bus_num];char xaddr[4 ]; -i2c512x_dev_t *regs = &immr->i2c.dev[bus_num];int ret =-1 ; xaddr[0 ] = (addr >>24 ) &0xFF ;
bye
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 22/29 cpu/mpc512x/i2c.c: use immr offsets from C struct instead of #define
Dear Heiko,
Quoted 8 lines · In message <[email protected]> you wrote:
cpu/mpc512x/i2c.c DECLARE_GLOBAL_DATA_PTR; · line 35
Quoted 5 lines
cpu/mpc512x/i2c.c +0
-2-#define immr ((immap_t *)CONFIG_SYS_IMMR) -/* by default set I2C bus 0 active */ static unsigned int bus_num =0 ;If no other bus then the first needed, when running from Flash, its okay for me.
Actually no I2C is needed while running from flash. In most cases, I2C will not be touched at all in U-Boot (i. e. only when a user runs a I2C command).
Quoted 9 lines
cpu/mpc512x/i2c.c void i2c_init (int speed, int saddr) · line 229
Quoted 6 lines
cpu/mpc512x/i2c.c +1
-1@@ -222,9 +226,9 @@ void i2c_init (int speed, int saddr) }/* Disable interrupts */ - immr->i2c.icr =0 ; + im->i2c.icr =0 ;shouldn;t we use in/out accessors for this?
Quoted 5 lines
cpu/mpc512x/i2c.c void i2c_init (int speed, int saddr) · line 231
Quoted 3 lines
cpu/mpc512x/i2c.c +1
-1/* Turn off filters */ - immr->i2c.mifr =0 ; + im->i2c.mifr =0 ;here too (and so on) ...
Yes - as you saw later, I decided to do this in a separate commit.
Would you prefer if I squashed these commits into one? I can do that, of course. But I found debugging easier as is now...
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
Perfection is reached, not when there is no longer anything to add,
but when there is no longer anything to take away.
- Antoine de Saint-ExuperyPATCH 22/29 cpu/mpc512x/i2c.c: use immr offsets from C struct instead of #define
Hello Wolfgang,
Quoted 11 lines · Wolfgang Denk
Quoted 6 lines · In message <[email protected]> you wrote:
cpu/mpc512x/i2c.c DECLARE_GLOBAL_DATA_PTR; · line 35
Quoted 4 lines
cpu/mpc512x/i2c.c +0
-2-#define immr ((immap_t *)CONFIG_SYS_IMMR) -/* by default set I2C bus 0 active */ static unsigned int bus_num =0 ;If no other bus then the first needed, when running from Flash, its okay for me.
Actually no I2C is needed while running from flash. In most cases, I2C will not be touched at all in U-Boot (i. e. only when a user runs a I2C command).
so it is fully ok for me.
Quoted 8 lines
Quoted 8 lines
cpu/mpc512x/i2c.c void i2c_init (int speed, int saddr) · line 229
Quoted 6 lines
cpu/mpc512x/i2c.c +1
-1@@ -222,9 +226,9 @@ void i2c_init (int speed, int saddr) }/* Disable interrupts */ - immr->i2c.icr =0 ; + im->i2c.icr =0 ;shouldn;t we use in/out accessors for this?
Quoted 6 lines
Quoted 4 lines
cpu/mpc512x/i2c.c void i2c_init (int speed, int saddr) · line 231
Quoted 3 lines
cpu/mpc512x/i2c.c +1
-1/* Turn off filters */ - immr->i2c.mifr =0 ; + im->i2c.mifr =0 ;here too (and so on) ...
Yes - as you saw later, I decided to do this in a separate commit.
Yep.
Quoted 2 lines
Would you prefer if I squashed these commits into one? I can do that, of course. But I found debugging easier as is now...
No it is fine for me, I just sequentially read the EMails, so I saw the patch, which uses the in/out accessors later ;-)
Hmm... I think the complete patchseries go through the mpc5xxx custodian, so I only have to ACK this patches, right?
bye
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 22/29 cpu/mpc512x/i2c.c: use immr offsets from C struct instead of #define
Dear Heiko,
Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 3 lines
Would you prefer if I squashed these commits into one? I can do that, of course. But I found debugging easier as is now...
No it is fine for me, I just sequentially read the EMails, so I saw the patch, which uses the in/out accessors later ;-)
Yes, I know - for reviewing the stuff the split into small steps is not optimal. BUt I found it very useful for debugging.
Quoted 2 lines
Hmm... I think the complete patchseries go through the mpc5xxx custodian, so I only have to ACK this patches, right?
Indeed.
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 A Freudian slip is when you say one thing but mean your mother.
PATCH 23/29 cpu/mpc512x/i2c.c: use I/O accessors instead of pointer accesses
In reply to Wolfgang Denk--- cpu/mpc512x/i2c.c | 25 +++++++++++-------------- 1 files changed, 11 insertions(+), 14 deletions(-)
cpu/mpc512x/i2c.c +11 -14
@@ -24,6 +24,7 @@*/ #include <common.h> +#include <asm/io.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -53,24 +54,18 @@ static int mpc_get_fdr(int);static int mpc_reg_in (volatile u32 *reg) { -int ret = *reg >>24 ; - __asm__ __volatile__ ("eieio" ); +int ret =in_be32 (reg) >>24 ; +return ret; }static void mpc_reg_out (volatile u32 *reg,int val,int mask) { -int tmp; -if (!mask) { - *reg = val <<24 ; +out_be32 (reg, val <<24 ); }else { - tmp =mpc_reg_in (reg); - *reg = ((tmp & ~mask) | (val & mask)) <<24 ; +clrsetbits_be32 (reg, mask <<24 , (val & mask) <<24 ); } - __asm__ __volatile__ ("eieio" ); - -return ; }static int wait_for_bb (void )
@@ -212,8 +207,10 @@ void i2c_init (int speed, int saddr) {volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ;int i; -for (i =0 ; i <I2C_BUS_CNT ; i++){ + +for (i =0 ; i <I2C_BUS_CNT ; i++){volatile i2c512x_dev_t *regs = &im->i2c.dev[i]; +mpc_reg_out (®s->mcr,0 ,0 );/* Set clock */
@@ -226,10 +223,10 @@ void i2c_init (int speed, int saddr) }/* Disable interrupts */ - im->i2c.icr =0 ; +out_be32 (&im->i2c.icr,0 ); +/* Turn off filters */ - im->i2c.mifr =0 ; -return ; +out_be32 (&im->i2c.mifr,0 ); }static int mpc_get_fdr (int speed)
Signature · 1 line
1.6.0.6
PATCH 23/29 cpu/mpc512x/i2c.c: use I/O accessors instead of pointer accesses
Helllo Wolfgang,
Quoted 5 lines · Wolfgang Denk
Signed-off-by Wolfgang Denk <[email protected]>Cc John Rigby <[email protected]>--- cpu/mpc512x/i2c.c | 25 +++++++++++-------------- 1 files changed, 11 insertions(+), 14 deletions(-)
Ah, okay, so forget my previous comment ;-)
bye
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 24/29 cpu/mpc512x/pci.c: use I/O accessors instead of pointer accesses
In reply to Wolfgang Denk--- cpu/mpc512x/pci.c | 70 ++++++++++++++++++++++++++++++++-------------------- 1 files changed, 43 insertions(+), 27 deletions(-)
cpu/mpc512x/pci.c +43 -27
@@ -22,6 +22,7 @@#include <common.h> +#include <asm/io.h> #include <asm/mmu.h> #include <asm/global_data.h> #include <pci.h>
@@ -46,7 +47,7 @@ static struct pci_controller pci_hose;void pci_init_board (void ) { -volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR ; +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ;volatile law512x_t *pci_law;volatile pot512x_t *pci_pot;volatile pcictrl512x_t *pci_ctrl;
@@ -58,24 +59,29 @@ pci_init_board(void)struct pci_controller *hose;/* Set PCI divider for 33MHz */ - reg32 = immr->clk.scfr[0 ]; + reg32 = im->clk.scfr[0 ]; reg32 &= ~(SCFR1_PCI_DIV_MASK ); reg32 |=SCFR1_PCI_DIV <<SCFR1_PCI_DIV_SHIFT ; - immr->clk.scfr[0 ] = reg32; + im->clk.scfr[0 ] = reg32; - pci_law = immr->sysconf.pcilaw; - pci_pot = immr->ios.pot; - pci_ctrl = &immr->pci_ctrl; - pci_conf = &immr->pci_conf; +clrsetbits_be32 (&im->clk.scfr[0 ], +SCFR1_PCI_DIV_MASK , +SCFR1_PCI_DIV <<SCFR1_PCI_DIV_SHIFT + ); + + pci_law = im->sysconf.pcilaw; + pci_pot = im->ios.pot; + pci_ctrl = &im->pci_ctrl; + pci_conf = &im->pci_conf; hose = &pci_hose;/* * Release PCI RST Output signal */ - pci_ctrl->gcr =0 ; +out_be32 (&pci_ctrl->gcr,0 );udelay (2000 ); - pci_ctrl->gcr =1 ; +out_be32 (&pci_ctrl->gcr,1 );/* We need to wait at least a 1sec based on PCI specs */ for (i =0 ; i <1000 ; i++)
@@ -84,30 +90,39 @@ pci_init_board(void)/* * Configure PCI Local Access Windows */ - pci_law[0 ].bar =CONFIG_SYS_PCI_MEM_PHYS &LAWBAR_BAR ; - pci_law[0 ].ar =LAWAR_EN |LAWAR_SIZE_512M ; +out_be32 (&pci_law[0 ].bar,CONFIG_SYS_PCI_MEM_PHYS &LAWBAR_BAR ); +out_be32 (&pci_law[0 ].ar,LAWAR_EN |LAWAR_SIZE_512M ); - pci_law[1 ].bar =CONFIG_SYS_PCI_IO_PHYS &LAWBAR_BAR ; - pci_law[1 ].ar =LAWAR_EN |LAWAR_SIZE_16M ; +out_be32 (&pci_law[1 ].bar,CONFIG_SYS_PCI_IO_PHYS &LAWBAR_BAR ); +out_be32 (&pci_law[1 ].ar,LAWAR_EN |LAWAR_SIZE_16M );/* * Configure PCI Outbound Translation Windows */ /* PCI mem space - prefetch */ - pci_pot[0 ].potar = (CONFIG_SYS_PCI_MEM_BASE >>12 ) &POTAR_TA_MASK ; - pci_pot[0 ].pobar = (CONFIG_SYS_PCI_MEM_PHYS >>12 ) &POBAR_BA_MASK ; - pci_pot[0 ].pocmr =POCMR_EN |POCMR_PRE |POCMR_CM_256M ; +out_be32 (&pci_pot[0 ].potar, + (CONFIG_SYS_PCI_MEM_BASE >>12 ) &POTAR_TA_MASK ); +out_be32 (&pci_pot[0 ].pobar, + (CONFIG_SYS_PCI_MEM_PHYS >>12 ) &POBAR_BA_MASK ); +out_be32 (&pci_pot[0 ].pocmr, +POCMR_EN |POCMR_PRE |POCMR_CM_256M );/* PCI IO space */ - pci_pot[1 ].potar = (CONFIG_SYS_PCI_IO_BASE >>12 ) &POTAR_TA_MASK ; - pci_pot[1 ].pobar = (CONFIG_SYS_PCI_IO_PHYS >>12 ) &POBAR_BA_MASK ; - pci_pot[1 ].pocmr =POCMR_EN |POCMR_IO |POCMR_CM_16M ; +out_be32 (&pci_pot[1 ].potar, + (CONFIG_SYS_PCI_IO_BASE >>12 ) &POTAR_TA_MASK ); +out_be32 (&pci_pot[1 ].pobar, + (CONFIG_SYS_PCI_IO_PHYS >>12 ) &POBAR_BA_MASK ); +out_be32 (&pci_pot[1 ].pocmr, +POCMR_EN |POCMR_IO |POCMR_CM_16M );/* PCI mmio - non-prefetch mem space */ - pci_pot[2 ].potar = (CONFIG_SYS_PCI_MMIO_BASE >>12 ) &POTAR_TA_MASK ; - pci_pot[2 ].pobar = (CONFIG_SYS_PCI_MMIO_PHYS >>12 ) &POBAR_BA_MASK ; - pci_pot[2 ].pocmr =POCMR_EN |POCMR_CM_256M ; +out_be32 (&pci_pot[2 ].potar, + (CONFIG_SYS_PCI_MMIO_BASE >>12 ) &POTAR_TA_MASK ); +out_be32 (&pci_pot[2 ].pobar, + (CONFIG_SYS_PCI_MMIO_PHYS >>12 ) &POBAR_BA_MASK ); +out_be32 (&pci_pot[2 ].pocmr, +POCMR_EN |POCMR_CM_256M );/* * Configure PCI Inbound Translation Windows
@@ -115,11 +130,12 @@ pci_init_board(void)/* we need RAM mapped to PCI space for the devices to * access main memory */ - pci_ctrl[0 ].pitar1 =0x0 ; - pci_ctrl[0 ].pibar1 =0x0 ; - pci_ctrl[0 ].piebar1 =0x0 ; - pci_ctrl[0 ].piwar1 =PIWAR_EN |PIWAR_PF |PIWAR_RTT_SNOOP | -PIWAR_WTT_SNOOP | (__ilog2 (gd->ram_size) -1 ); +out_be32 (&pci_ctrl[0 ].pitar1,0x0 ); +out_be32 (&pci_ctrl[0 ].pibar1,0x0 ); +out_be32 (&pci_ctrl[0 ].piebar1,0x0 ); +out_be32 (&pci_ctrl[0 ].piwar1, +PIWAR_EN |PIWAR_PF |PIWAR_RTT_SNOOP | +PIWAR_WTT_SNOOP | (__ilog2 (gd->ram_size) -1 )); hose->first_busno =0 ; hose->last_busno =0xff ;
Signature · 1 line
1.6.0.6
PATCH 25/29 drivers/net/mpc512x_fec.c: prepare removal of include/mpc512x.h
In reply to Wolfgang Denk"ethernet_regs" in include/mpc512x.h duplicates "fec512x_t" in include/asm-ppc/immap_512x.h; switch to using the latter so we can remove include/mpc512x.h later.
--- drivers/net/mpc512x_fec.c | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-)
drivers/net/mpc512x_fec.c +12 -5
@@ -605,6 +605,8 @@ static int mpc512x_fec_recv (struct eth_device *dev)/********************************************************************/ int mpc512x_fec_initialize (bd_t * bis) { +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +volatile fec512x_t *fec512x = &im->fec;mpc512x_fec_priv *fec;struct eth_device *dev;int i;
@@ -615,7 +617,7 @@ int mpc512x_fec_initialize (bd_t * bis) dev = (struct eth_device *)malloc (sizeof (*dev));memset (dev,0 ,sizeof *dev); - fec->eth = (ethernet_regs *)MPC512X_FEC ; + fec->eth = (ethernet_regs *)fec512x;# ifndef CONFIG_FEC_10MBIT fec->xcv_type =MII100 ;
@@ -623,7 +625,7 @@ int mpc512x_fec_initialize (bd_t * bis) fec->xcv_type =MII10 ;# endif dev->priv = (void *)fec; - dev->iobase =MPC512X_FEC ; + dev->iobase = (int )fec512x; dev->init = mpc512x_fec_init; dev->halt = mpc512x_fec_halt; dev->send = mpc512x_fec_send;
@@ -638,7 +640,8 @@ int mpc512x_fec_initialize (bd_t * bis)#endif /* Clean up space FEC's MIB and FIFO RAM ...*/ -memset ((void *)MPC512X_FEC +0x200 ,0x00 ,0x400 ); +memset ((void *)&im->fec.mib,0x00 ,sizeof (im->fec.mib)); +memset ((void *)&im->fec.fifo,0x00 ,sizeof (im->fec.fifo));/* * Malloc space for BDs (must be quad word-aligned)
@@ -684,7 +687,9 @@ int mpc512x_fec_initialize (bd_t * bis)/********************************************************************/ int fec512x_miiphy_read (char *devname,uint8 phyAddr,uint8 regAddr,uint16 * retVal) { -ethernet_regs *eth = (ethernet_regs *)MPC512X_FEC ; +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +volatile fec512x_t *fec512x = &im->fec; +ethernet_regs *eth = (ethernet_regs *)fec512x;uint32 reg;/* convenient holder for the PHY register */ uint32 phy;/* convenient holder for the PHY */ int timeout =0xffff ;
@@ -726,7 +731,9 @@ int fec512x_miiphy_read (char *devname, uint8 phyAddr, uint8 regAddr, uint16 * r/********************************************************************/ int fec512x_miiphy_write (char *devname,uint8 phyAddr,uint8 regAddr,uint16 data) { -ethernet_regs *eth = (ethernet_regs *)MPC512X_FEC ; +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +volatile fec512x_t *fec512x = &im->fec; +ethernet_regs *eth = (ethernet_regs *)fec512x;uint32 reg;/* convenient holder for the PHY register */ uint32 phy;/* convenient holder for the PHY */ int timeout =0xffff ;
Signature · 1 line
1.6.0.6
PATCH 26/29 MPC512x FEC: remove duplicated code and data types
In reply to Wolfgang Denk* Use "u{8,16,32}" instead of "uint{8,16,32}" data types
* Drop use of include/mpc512x.h
--- drivers/net/mpc512x_fec.c | 49 +++++----- drivers/net/mpc512x_fec.h | 253 ++++++++++++++++++++++----------------------- 2 files changed, 148 insertions(+), 154 deletions(-)
drivers/net/mpc512x_fec.c +24 -25
@@ -7,7 +7,6 @@*/ #include <common.h> -#include <mpc512x.h> #include <malloc.h> #include <net.h> #include <netdev.h>
@@ -26,11 +25,11 @@ DECLARE_GLOBAL_DATA_PTR;#endif #if (DEBUG &0x40 ) -static uint32 local_crc32 (char *string,unsigned int crc_value,int len); +static u32 local_crc32 (char *string,unsigned int crc_value,int len);#endif -int fec512x_miiphy_read (char *devname,uint8 phyAddr,uint8 regAddr,uint16 * retVal); -int fec512x_miiphy_write (char *devname,uint8 phyAddr,uint8 regAddr,uint16 data); +int fec512x_miiphy_read (char *devname,u8 phyAddr,u8 regAddr,u16 * retVal); +int fec512x_miiphy_write (char *devname,u8 phyAddr,u8 regAddr,u16 data);int mpc512x_fec_init_phy (struct eth_device *dev,bd_t * bis);static uchar rx_buff[FEC_BUFFER_SIZE ];
@@ -40,9 +39,9 @@ static int rx_buff_idx = 0; #if (DEBUG & 0x2) static void mpc512x_fec_phydump (char *devname) { - uint16 phyStatus, i; - uint8 phyAddr = CONFIG_PHY_ADDR; - uint8 reg_mask[] = { + u16 phyStatus, i; + u8 phyAddr = CONFIG_PHY_ADDR; + u8 reg_mask[] = { /* regs to print: 0...8, 21,27,31 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1,
@@ -66,7 +65,7 @@ static int mpc512x_fec_bd_init (mpc512x_fec_priv *fec)* Receive BDs init */ for (ix =0 ; ix <FEC_RBD_NUM ; ix++) { - fec->bdBase->rbd[ix].dataPointer = (uint32)&fec->bdBase->recv_frames[ix]; + fec->bdBase->rbd[ix].dataPointer = (u32)&fec->bdBase->recv_frames[ix]; fec->bdBase->rbd[ix].status =FEC_RBD_EMPTY ; fec->bdBase->rbd[ix].dataLength =0 ; }
@@ -164,10 +163,10 @@ static void mpc512x_fec_tbd_scrub (mpc512x_fec_priv *fec)/********************************************************************/ static void mpc512x_fec_set_hwaddr (mpc512x_fec_priv *fec,char *mac) { -uint8 currByte;/* byte for which to compute the CRC */ +u8 currByte;/* byte for which to compute the CRC */ int byte;/* loop - counter */ int bit;/* loop - counter */ -uint32 crc =0xffffffff ;/* initial value */ +u32 crc =0xffffffff ;/* initial value */ /* * The algorithm used is the following:
@@ -252,8 +251,8 @@ static int mpc512x_fec_init (struct eth_device *dev, bd_t * bis) fec->eth->r_buff_size =FEC_BUFFER_SIZE ;/* Setup BD base addresses */ - fec->eth->r_des_start = (uint32 )fec->bdBase->rbd; - fec->eth->x_des_start = (uint32 )fec->bdBase->tbd; + fec->eth->r_des_start = (u32 )fec->bdBase->rbd; + fec->eth->x_des_start = (u32 )fec->bdBase->tbd;/* DMA Control */ fec->eth->dma_control =0xc0000000 ;
@@ -277,9 +276,9 @@ static int mpc512x_fec_init (struct eth_device *dev, bd_t * bis)int mpc512x_fec_init_phy (struct eth_device *dev,bd_t * bis) {mpc512x_fec_priv *fec = (mpc512x_fec_priv *)dev->priv; -const uint8 phyAddr =CONFIG_PHY_ADDR ;/* Only one PHY */ +const u8 phyAddr =CONFIG_PHY_ADDR ;/* Only one PHY */ int timeout =1 ; -uint16 phyStatus; +u16 phyStatus;#if (DEBUG &0x1 )printf ("mpc512x_fec_init_phy... Begin\n" );
@@ -488,7 +487,7 @@ static int mpc512x_fec_send (struct eth_device *dev, volatile void *eth_data,*/ pTbd = &fec->bdBase->tbd[fec->tbdIndex]; pTbd->dataLength = data_length; - pTbd->dataPointer = (uint32 )eth_data; + pTbd->dataPointer = (u32 )eth_data; pTbd->status |=FEC_TBD_LAST |FEC_TBD_TC |FEC_TBD_READY ; fec->tbdIndex = (fec->tbdIndex +1 ) %FEC_TBD_NUM ;
@@ -574,7 +573,7 @@ static int mpc512x_fec_recv (struct eth_device *dev)printf ("recv data length 0x%08x data hdr: " , pRbd->dataLength);for (i =0 ; i <14 ; i++) -printf ("%x " , *((uint8 *)pRbd->dataPointer + i)); +printf ("%x " , *((u8 *)pRbd->dataPointer + i)); printf("\n"); }#endif
@@ -648,7 +647,7 @@ int mpc512x_fec_initialize (bd_t * bis)* this pointer is lost, so cannot be freed */ bd =malloc (sizeof (mpc512x_buff_descs) +0x1f ); - fec->bdBase = (mpc512x_buff_descs *)((uint32 )bd &0xfffffff0 ); + fec->bdBase = (mpc512x_buff_descs *)((u32 )bd &0xfffffff0 );memset ((void *) bd,0x00 ,sizeof (mpc512x_buff_descs) +0x1f );/*
@@ -685,13 +684,13 @@ int mpc512x_fec_initialize (bd_t * bis)/* MII-interface related functions */ /********************************************************************/ -int fec512x_miiphy_read (char *devname,uint8 phyAddr,uint8 regAddr,uint16 * retVal) +int fec512x_miiphy_read (char *devname,u8 phyAddr,u8 regAddr,u16 * retVal) {volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ;volatile fec512x_t *fec512x = &im->fec;ethernet_regs *eth = (ethernet_regs *)fec512x; -uint32 reg;/* convenient holder for the PHY register */ -uint32 phy;/* convenient holder for the PHY */ +u32 reg;/* convenient holder for the PHY register */ +u32 phy;/* convenient holder for the PHY */ int timeout =0xffff ;/*
@@ -723,19 +722,19 @@ int fec512x_miiphy_read (char *devname, uint8 phyAddr, uint8 regAddr, uint16 * r/* * it's now safe to read the PHY's register */ - *retVal = (uint16 ) eth->mii_data; + *retVal = (u16 ) eth->mii_data;return 0 ; }/********************************************************************/ -int fec512x_miiphy_write (char *devname,uint8 phyAddr,uint8 regAddr,uint16 data) +int fec512x_miiphy_write (char *devname,u8 phyAddr,u8 regAddr,u16 data) {volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ;volatile fec512x_t *fec512x = &im->fec;ethernet_regs *eth = (ethernet_regs *)fec512x; -uint32 reg;/* convenient holder for the PHY register */ -uint32 phy;/* convenient holder for the PHY */ +u32 reg;/* convenient holder for the PHY register */ +u32 phy;/* convenient holder for the PHY */ int timeout =0xffff ; reg = regAddr <<FEC_MII_DATA_RA_SHIFT ;
@@ -765,7 +764,7 @@ int fec512x_miiphy_write (char *devname, uint8 phyAddr, uint8 regAddr, uint16 da }#if (DEBUG &0x40 ) -static uint32 local_crc32 (char *string,unsigned int crc_value,int len) +static u32 local_crc32 (char *string,unsigned int crc_value,int len) {int i;char c;
drivers/net/mpc512x_fec.h +124 -129
287 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH 27/29 drivers/net/mpc512x_fec.c: use I/O accessors instead of pointer accesses
In reply to Wolfgang Denk--- drivers/net/mpc512x_fec.c | 113 +++++++++++++++++++++++++------------------- 1 files changed, 64 insertions(+), 49 deletions(-)
drivers/net/mpc512x_fec.c +64 -49
@@ -11,6 +11,7 @@#include <net.h> #include <netdev.h> #include <miiphy.h> +#include <asm/io.h> #include "mpc512x_fec.h" DECLARE_GLOBAL_DATA_PTR ;
@@ -65,7 +66,8 @@ static int mpc512x_fec_bd_init (mpc512x_fec_priv *fec)* Receive BDs init */ for (ix =0 ; ix <FEC_RBD_NUM ; ix++) { - fec->bdBase->rbd[ix].dataPointer = (u32)&fec->bdBase->recv_frames[ix]; + fec->bdBase->rbd[ix].dataPointer = + (u32)&fec->bdBase->recv_frames[ix]; fec->bdBase->rbd[ix].status =FEC_RBD_EMPTY ; fec->bdBase->rbd[ix].dataLength =0 ; }
@@ -118,8 +120,9 @@ static void mpc512x_fec_rbd_clean (mpc512x_fec_priv *fec, volatile FEC_RBD * pRb/* * Now, we have an empty RxBD, notify FEC +* Set Descriptor polling active */ - fec->eth->r_des_active =0x01000000 ;/* Descriptor polling active */ +out_be32 (&fec->eth->r_des_active,0x01000000 ); }/********************************************************************/
@@ -202,18 +205,20 @@ static void mpc512x_fec_set_hwaddr (mpc512x_fec_priv *fec, char *mac)* Set individual hash table register */ if (crc >=32 ) { - fec->eth->iaddr1 = (1 << (crc -32 )); - fec->eth->iaddr2 =0 ; +out_be32 (&fec->eth->iaddr1, (1 << (crc -32 ))); +out_be32 (&fec->eth->iaddr2,0 ); }else { - fec->eth->iaddr1 =0 ; - fec->eth->iaddr2 = (1 << crc); +out_be32 (&fec->eth->iaddr1,0 ); +out_be32 (&fec->eth->iaddr2, (1 << crc)); }/* * Set physical address */ - fec->eth->paddr1 = (mac[0 ] <<24 ) + (mac[1 ] <<16 ) + (mac[2 ] <<8 ) + mac[3 ]; - fec->eth->paddr2 = (mac[4 ] <<24 ) + (mac[5 ] <<16 ) +0x8808 ; +out_be32 (&fec->eth->paddr1, (mac[0 ] <<24 ) + (mac[1 ] <<16 ) + + (mac[2 ] <<8 ) + mac[3 ]); +out_be32 (&fec->eth->paddr2, (mac[4 ] <<24 ) + (mac[5 ] <<16 ) + +0x8808 ); }/********************************************************************/
@@ -226,45 +231,45 @@ static int mpc512x_fec_init (struct eth_device *dev, bd_t * bis)#endif /* Set interrupt mask register */ - fec->eth->imask =0x00000000 ; +out_be32 (&fec->eth->imask,0x00000000 );/* Clear FEC-Lite interrupt event register(IEVENT) */ - fec->eth->ievent =0xffffffff ; +out_be32 (&fec->eth->ievent,0xffffffff );/* Set transmit fifo watermark register(X_WMRK), default = 64 */ - fec->eth->x_wmrk =0x0 ; +out_be32 (&fec->eth->x_wmrk,0x0 );/* Set Opcode/Pause Duration Register */ - fec->eth->op_pause =0x00010020 ; +out_be32 (&fec->eth->op_pause,0x00010020 );/* Frame length=1522; MII mode */ - fec->eth->r_cntrl = (FEC_MAX_FRAME_LEN <<16 ) |0x24 ; +out_be32 (&fec->eth->r_cntrl, (FEC_MAX_FRAME_LEN <<16 ) |0x24 );/* Half-duplex, heartbeat disabled */ - fec->eth->x_cntrl =0x00000000 ; +out_be32 (&fec->eth->x_cntrl,0x00000000 );/* Enable MIB counters */ - fec->eth->mib_control =0x0 ; +out_be32 (&fec->eth->mib_control,0x0 );/* Setup recv fifo start and buff size */ - fec->eth->r_fstart =0x500 ; - fec->eth->r_buff_size =FEC_BUFFER_SIZE ; +out_be32 (&fec->eth->r_fstart,0x500 ); +out_be32 (&fec->eth->r_buff_size,FEC_BUFFER_SIZE );/* Setup BD base addresses */ - fec->eth->r_des_start = (u32 )fec->bdBase->rbd; - fec->eth->x_des_start = (u32 )fec->bdBase->tbd; +out_be32 (&fec->eth->r_des_start, (u32 )fec->bdBase->rbd); +out_be32 (&fec->eth->x_des_start, (u32 )fec->bdBase->tbd);/* DMA Control */ - fec->eth->dma_control =0xc0000000 ; +out_be32 (&fec->eth->dma_control,0xc0000000 );/* Enable FEC */ - fec->eth->ecntrl |=0x00000006 ; +setbits_be32 (&fec->eth->ecntrl,0x00000006 );/* Initilize addresses and status words of BDs */ mpc512x_fec_bd_init (fec);/* Descriptor polling active */ - fec->eth->r_des_active =0x01000000 ; +out_be32 (&fec->eth->r_des_active,0x01000000 );#if (DEBUG &0x1 )printf ("mpc512x_fec_init... Done \n" );
@@ -287,19 +292,20 @@ int mpc512x_fec_init_phy (struct eth_device *dev, bd_t * bis)/* * Clear FEC-Lite interrupt event register(IEVENT) */ - fec->eth->ievent =0xffffffff ; +out_be32 (&fec->eth->ievent,0xffffffff );/* * Set interrupt mask register */ - fec->eth->imask =0x00000000 ; +out_be32 (&fec->eth->imask,0x00000000 );if (fec->xcv_type !=SEVENWIRE ) {/* * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock * and do not drop the Preamble. */ - fec->eth->mii_speed = (((gd->ips_clk /1000000 ) /5 ) +1 ) <<1 ; +out_be32 (&fec->eth->mii_speed, + (((gd->ips_clk /1000000 ) /5 ) +1 ) <<1 );/* * Reset PHY, then delay 300ns
@@ -413,27 +419,28 @@ static void mpc512x_fec_halt (struct eth_device *dev)/* * mask FEC chip interrupts */ - fec->eth->imask =0 ; +out_be32 (&fec->eth->imask,0 );/* * issue graceful stop command to the FEC transmitter if necessary */ - fec->eth->x_cntrl |=0x00000001 ; +setbits_be32 (&fec->eth->x_cntrl,0x00000001 );/* * wait for graceful stop to register */ -while ((counter--) && (!(fec->eth->ievent &0x10000000 ))) ; +while ((counter--) && (!(in_be32 (&fec->eth->ievent) &0x10000000 ))) + ;/* * Disable the Ethernet Controller */ - fec->eth->ecntrl &=0xfffffffd ; +clrbits_be32 (&fec->eth->ecntrl,0x00000002 );/* * Issue a reset command to the FEC chip */ - fec->eth->ecntrl |=0x1 ; +setbits_be32 (&fec->eth->ecntrl,0x1 );/* * wait at least 16 clock cycles
@@ -492,7 +499,7 @@ static int mpc512x_fec_send (struct eth_device *dev, volatile void *eth_data, fec->tbdIndex = (fec->tbdIndex +1 ) %FEC_TBD_NUM ;/* Activate transmit Buffer Descriptor polling */ - fec->eth->x_des_active =0x01000000 ;/* Descriptor polling active */ +out_be32 (&fec->eth->x_des_active,0x01000000 );#if (DEBUG &0x8 )printf ("+" );
@@ -535,8 +542,8 @@ static int mpc512x_fec_recv (struct eth_device *dev)/* * Check if any critical events have happened */ - ievent = fec->eth->ievent; - fec->eth->ievent = ievent; + ievent =in_be32 (&fec->eth->ievent); +out_be32 (&fec->eth->ievent, ievent);if (ievent &0x20060000 ) {/* BABT, Rx/Tx FIFO errors */ mpc512x_fec_halt (dev);
@@ -545,13 +552,13 @@ static int mpc512x_fec_recv (struct eth_device *dev) }if (ievent &0x80000000 ) {/* Heartbeat error */ - fec->eth->x_cntrl |=0x00000001 ; +setbits_be32 (&fec->eth->x_cntrl,0x00000001 ); }if (ievent &0x10000000 ) {/* Graceful stop complete */ -if (fec->eth->x_cntrl &0x00000001 ) { +if (in_be32 (&fec->eth->x_cntrl) &0x00000001 ) {mpc512x_fec_halt (dev); - fec->eth->x_cntrl &= ~0x00000001 ; +clrbits_be32 (&fec->eth->x_cntrl,0x00000001 );;mpc512x_fec_init (dev,NULL ); } }
@@ -597,7 +604,8 @@ static int mpc512x_fec_recv (struct eth_device *dev) }/* Try to fill Buffer Descriptors */ - fec->eth->r_des_active =0x01000000 ;/* Descriptor polling active */ +out_be32 (&fec->eth->r_des_active,0x01000000 ); +return frame_length; }
@@ -653,12 +661,12 @@ int mpc512x_fec_initialize (bd_t * bis)/* * Set interrupt mask register */ - fec->eth->imask =0x00000000 ; +out_be32 (&fec->eth->imask,0x00000000 );/* * Clear FEC-Lite interrupt event register(IEVENT) */ - fec->eth->ievent =0xffffffff ; +out_be32 (&fec->eth->ievent,0xffffffff );/* * Try to set the mac address now. The fec mac address is
@@ -673,8 +681,8 @@ int mpc512x_fec_initialize (bd_t * bis) tmp = (*end) ? end+1 : end; }mpc512x_fec_set_hwaddr (fec, env_enetaddr); - fec->eth->gaddr1 =0x00000000 ; - fec->eth->gaddr2 =0x00000000 ; +out_be32 (&fec->eth->gaddr1,0x00000000 ); +out_be32 (&fec->eth->gaddr2,0x00000000 ); }mpc512x_fec_init_phy (dev, bis);
@@ -700,12 +708,16 @@ int fec512x_miiphy_read (char *devname, u8 phyAddr, u8 regAddr, u16 * retVal) reg = regAddr <<FEC_MII_DATA_RA_SHIFT ; phy = phyAddr <<FEC_MII_DATA_PA_SHIFT ; - eth->mii_data = (FEC_MII_DATA_ST |FEC_MII_DATA_OP_RD |FEC_MII_DATA_TA | phy | reg); +out_be32 (ð->mii_data,FEC_MII_DATA_ST | +FEC_MII_DATA_OP_RD | +FEC_MII_DATA_TA | + phy | reg);/* * wait for the related interrupt */ -while ((timeout--) && (!(eth->ievent &0x00800000 ))) ; +while ((timeout--) && (!(in_be32 (ð->ievent) &0x00800000 ))) + ;if (timeout ==0 ) {#if (DEBUG &0x2 )
@@ -717,12 +729,12 @@ int fec512x_miiphy_read (char *devname, u8 phyAddr, u8 regAddr, u16 * retVal)/* * clear mii interrupt bit */ - eth->ievent =0x00800000 ; +out_be32 (ð->ievent,0x00800000 );/* * it's now safe to read the PHY's register */ - *retVal = (u16 ) eth->mii_data; + *retVal = (u16 )in_be32 (ð->mii_data);return 0 ; }
@@ -740,13 +752,16 @@ int fec512x_miiphy_write (char *devname, u8 phyAddr, u8 regAddr, u16 data) reg = regAddr <<FEC_MII_DATA_RA_SHIFT ; phy = phyAddr <<FEC_MII_DATA_PA_SHIFT ; - eth->mii_data = (FEC_MII_DATA_ST |FEC_MII_DATA_OP_WR | -FEC_MII_DATA_TA | phy | reg | data); +out_be32 (ð->mii_data,FEC_MII_DATA_ST | +FEC_MII_DATA_OP_WR | +FEC_MII_DATA_TA | + phy | reg | data);/* * wait for the MII interrupt */ -while ((timeout--) && (!(eth->ievent &0x00800000 ))) ; +while ((timeout--) && (!(in_be32 (ð->ievent) &0x00800000 ))) + ;if (timeout ==0 ) {#if (DEBUG &0x2 )
@@ -758,7 +773,7 @@ int fec512x_miiphy_write (char *devname, u8 phyAddr, u8 regAddr, u16 data)/* * clear MII interrupt bit */ - eth->ievent =0x00800000 ; +out_be32 (ð->ievent,0x00800000 );return 0 ; }
Signature · 1 line
1.6.0.6
PATCH 28/29 MPC512x FEC: get rid of duplicated struct ethernet_regs
In reply to Wolfgang DenkUse existing struct fec512x instead.
--- drivers/net/mpc512x_fec.c | 11 ++--- drivers/net/mpc512x_fec.h | 126 +-------------------------------------------- 2 files changed, 5 insertions(+), 132 deletions(-)
drivers/net/mpc512x_fec.c +4 -7
@@ -613,7 +613,6 @@ static int mpc512x_fec_recv (struct eth_device *dev)int mpc512x_fec_initialize (bd_t * bis) {volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; -volatile fec512x_t *fec512x = &im->fec;mpc512x_fec_priv *fec;struct eth_device *dev;int i;
@@ -624,7 +623,7 @@ int mpc512x_fec_initialize (bd_t * bis) dev = (struct eth_device *)malloc (sizeof (*dev));memset (dev,0 ,sizeof *dev); - fec->eth = (ethernet_regs *)fec512x; + fec->eth = &im->fec;# ifndef CONFIG_FEC_10MBIT fec->xcv_type =MII100 ;
@@ -632,7 +631,7 @@ int mpc512x_fec_initialize (bd_t * bis) fec->xcv_type =MII10 ;# endif dev->priv = (void *)fec; - dev->iobase = (int )fec512x; + dev->iobase = (int )&im->fec; dev->init = mpc512x_fec_init; dev->halt = mpc512x_fec_halt; dev->send = mpc512x_fec_send;
@@ -695,8 +694,7 @@ int mpc512x_fec_initialize (bd_t * bis)int fec512x_miiphy_read (char *devname,u8 phyAddr,u8 regAddr,u16 * retVal) {volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; -volatile fec512x_t *fec512x = &im->fec; -ethernet_regs *eth = (ethernet_regs *)fec512x; +volatile fec512x_t *eth = &im->fec;u32 reg;/* convenient holder for the PHY register */ u32 phy;/* convenient holder for the PHY */ int timeout =0xffff ;
@@ -743,8 +741,7 @@ int fec512x_miiphy_read (char *devname, u8 phyAddr, u8 regAddr, u16 * retVal)int fec512x_miiphy_write (char *devname,u8 phyAddr,u8 regAddr,u16 data) {volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; -volatile fec512x_t *fec512x = &im->fec; -ethernet_regs *eth = (ethernet_regs *)fec512x; +volatile fec512x_t *eth = &im->fec;u32 reg;/* convenient holder for the PHY register */ u32 phy;/* convenient holder for the PHY */ int timeout =0xffff ;
drivers/net/mpc512x_fec.h +1 -125
138 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH 29/29 Remove include/mpc512x.h
In reply to Wolfgang DenkAfter removing the last reference to it, we can finally ditch include/mpc512x.h
--- include/common.h | 1 - include/mpc512x.h | 385 ----------------------------------------------------- 2 files changed, 0 insertions(+), 386 deletions(-) delete mode 100644 include/mpc512x.h
include/common.h +0 -1
@@ -66,7 +66,6 @@ typedef volatile unsigned char vu_char;#elif defined(CONFIG_MPC5xxx)#include <mpc5xxx.h> #elif defined(CONFIG_MPC512X ) -#include <mpc512x.h> #include <asm/immap_512x.h> #elif defined(CONFIG_MPC8220 )#include <asm/immap_8220.h>
include/mpc512x.h deleted +0 -385
385 lines not on this page · raw message
Signature · 1 line
1.6.0.6
cover Rework MPC512x Support
In reply to Wolfgang DenkWolfgang,
I think it is time to hand over 5xxx maintainership to you.
I did go over these patches they look good to me.
John
Quoted 127 lines · Wolfgang Denk
The following patch series includes a heavy rework of the existing code for MPC512x processors. The changes include especially:
- move common files from mpc5121ads (so far ads5121) board to common directory so they can be reused by other boards based on the same CPU
- rename "ads5121" into "freescale/mpc5121ads" so thesame board name as in Linux is used, and the vendor directory is correct
- rework the whole MPC512x related code to use I/O acessors (i. e. in_*() and out_*() functions) instead of deprecated pointer accesses
- Don't #define register offsets, but use the offset from the respective C structs instead [1]
- removeinclude/mpc512x.hto avoid duplication of the same information ininclude/asm-ppc/immap_512x.h
- add support for the ARIA board, a MPC5121e based COM Express module[1] Note: It was not possible to get completely rid of #define'd register offsets yet, as some are used in
cpu/mpc512x/start.S, and in assembly the available options are limited. In Linux, the required header files with the respective #define's are auto-generated from the C struct definitions. We intend to do the same, but this needs co-ordinations across architectures - for example, Blackfin already uses such an approach. For now, we createdcpu/mpc512x/asm-offsets.h; this file will be removed again as soon as auto-generation works.Note: It might seem a good idea to squash related patches (like all I/O accessors patches into one, and all
mpc512x.hremoval patches into another one) to reduce the number of commits. I decided against doing this, as the amount of changes carries the risk that, inspite of pretty careful testing, some errors have not been discovered yet. The current one-step-at-a-time approach is more git-bisect friendly.Patches are agains v2009.06-rc1; they have been tested on the "mpc5121ads" and the "aria" boards.
Patch overview:
[PATCH 01/29] mpc512x: change cpu/mpc512x/Makefile to use
Kconfigstyle [PATCH 02/29] mpc512x: Move common files to share them by several boards [PATCH 03/29]cpu/mpc512x/pci.c: minor coding style cleanup [PATCH 04/29]cpu/mpc512x/diu.c: fix warning: assignment from incompatible pointer type
[PATCH 05/29] Rename ads5121 board into mpc5121ads
[PATCH 06/29] MPC512x: add more hardware description toimmap_512x.h[PATCH 07/29] mpc5121ads: use I/O accessors instead of pointer accesses [PATCH 08/29] MPC512x: add support for ARIA board
[PATCH 09/29]cpu/mpc512x/iopin.c: convert to use I/O acessors. [PATCH 10/29]cpu/mpc512x/iopin.c: remove redundant include of <asm/immap_512x.h>
[PATCH 11/29] MPC512x: prepare removal ofinclude/mpc512x.h[PATCH 12/29]include/configs/mpc5121ads.h: prepare removal ofinclude/mpc512x.h
[PATCH 13/29]include/configs/aria.h: prepare removal ofinclude/mpc512x.h[PATCH 14/29]common/cmd_ide.c: prepare removal ofinclude/mpc512x.h[PATCH 15/29]cpu/mpc512x/cpu.c: prepare removal ofinclude/mpc512x.h[PATCH 16/29]cpu/mpc512x/cpu_init.c: prepare removal ofinclude/mpc512x.h[PATCH 17/29]cpu/mpc512x/cpu_init.c: use I/O accessors instead of pointer accesses
[PATCH 18/29]cpu/mpc512x/speed.c: prepare removal ofinclude/mpc512x.h[PATCH 19/29]cpu/mpc512x/speed.c: use I/O accessors instead of pointer accesses
[PATCH 20/29]cpu/mpc512x/serial.c: use I/O accessors instead of pointer accesses
[PATCH 21/29]cpu/mpc512x/i2c.c: prepare removal ofinclude/mpc512x.h[PATCH 22/29]cpu/mpc512x/i2c.c: use immr offsets from C struct instead of #define
[PATCH 23/29]cpu/mpc512x/i2c.c: use I/O accessors instead of pointer accesses
[PATCH 24/29]cpu/mpc512x/pci.c: use I/O accessors instead of pointer accesses
[PATCH 25/29]drivers/net/mpc512x_fec.c: prepare removal ofinclude/mpc512x.h
[PATCH 26/29] MPC512x FEC: remove duplicated code and data types [PATCH 27/29]drivers/net/mpc512x_fec.c: use I/O accessors instead of pointer accesses
[PATCH 28/29] MPC512x FEC: get rid of duplicated structethernet_regs[PATCH 29/29] Removeinclude/mpc512x.hSigned-off-by Wolfgang Denk <[email protected]>Cc John Rigby <[email protected]>---
Summary statistics:MAINTAINERS | 2 + MAKEALL | 3 +- Makefile | 10 +- board/ads5121/Makefile | 57 --- board/ads5121/README | 7 - board/ads5121/ads5121.c | 432 ------------------- board/ads5121/ads5121_diu.c | 193 --------- board/ads5121/config.mk | 23 - board/ads5121/pci.c | 213 ---------- board/ads5121/u-boot.lds | 121 ------ board/davedenx/aria/Makefile | 53 +++ board/davedenx/aria/aria.c | 418 ++++++++++++++++++ board/davedenx/aria/config.mk | 23 + board/freescale/mpc5121ads/Makefile | 53 +++ board/freescale/mpc5121ads/README | 7 + board/freescale/mpc5121ads/config.mk | 23 + board/freescale/mpc5121ads/mpc5121ads.c | 438 +++++++++++++++++++ common/cmd_ide.c | 4 - cpu/mpc512x/Makefile | 13 +- cpu/mpc512x/asm-offsets.h | 15 + cpu/mpc512x/config.mk | 4 + cpu/mpc512x/cpu.c | 1 - cpu/mpc512x/cpu_init.c | 25 +- cpu/mpc512x/diu.c | 189 +++++++++ cpu/mpc512x/i2c.c | 55 ++-- cpu/mpc512x/iopin.c | 10 +- cpu/mpc512x/pci.c | 226 ++++++++++ cpu/mpc512x/serial.c | 62 ++-- cpu/mpc512x/speed.c | 22 +- cpu/mpc512x/start.S | 4 +- cpu/mpc512x/u-boot.lds | 121 ++++++ drivers/net/mpc512x_fec.c | 168 ++++---- drivers/net/mpc512x_fec.h | 153 +------ include/asm-ppc/immap_512x.h | 575 +++++++++++++++++++++++++- include/common.h | 1 - include/configs/ads5121.h | 551 ------------------------ include/configs/aria.h | 543 ++++++++++++++++++++++++ include/configs/mpc5121ads.h | 551 ++++++++++++++++++++++++ include/mpc512x.h | 702 ------------------------------- 39 files changed, 3456 insertions(+), 2615 deletions(-)
cover Rework MPC512x Support
Dear Johny,
Quoted 2 lines · In message <[email protected]> you…
I think it is time to hand over 5xxx maintainership to you.
It's apitty you're leaving, but of course I understand your situation. Hope to see you back aboard soon :-)
Quoted 1 line
I did go over these patches they look good to me.
Thanks.
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 is dangerous to be sincere unless you are also stupid.
- George Bernard Shawcover Rework MPC512x Support
In reply to Wolfgang DenkQuoted 60 lines · On Sat, 9 May 2009 21:50:39 +0200 Wolfgang Denk <[email protected]> wrote:
The following patch series includes a heavy rework of the existing code for MPC512x processors. The changes include especially:
- move common files from mpc5121ads (so far ads5121) board to common directory so they can be reused by other boards based on the same CPU
- rename "ads5121" into "freescale/mpc5121ads" so thesame board name as in Linux is used, and the vendor directory is correct
- rework the whole MPC512x related code to use I/O acessors (i. e. in_*() and out_*() functions) instead of deprecated pointer accesses
- Don't #define register offsets, but use the offset from the respective C structs instead [1]
- removeinclude/mpc512x.hto avoid duplication of the same information ininclude/asm-ppc/immap_512x.h
- add support for the ARIA board, a MPC5121e based COM Express module[1] Note: It was not possible to get completely rid of #define'd register offsets yet, as some are used in
cpu/mpc512x/start.S, and in assembly the available options are limited. In Linux, the required header files with the respective #define's are auto-generated from the C struct definitions. We intend to do the same, but this needs co-ordinations across architectures - for example, Blackfin already uses such an approach. For now, we createdcpu/mpc512x/asm-offsets.h; this file will be removed again as soon as auto-generation works.Note: It might seem a good idea to squash related patches (like all I/O accessors patches into one, and all
mpc512x.hremoval patches into another one) to reduce the number of commits. I decided against doing this, as the amount of changes carries the risk that, inspite of pretty careful testing, some errors have not been discovered yet. The current one-step-at-a-time approach is more git-bisect friendly.Patches are agains v2009.06-rc1; they have been tested on the "mpc5121ads" and the "aria" boards.
Patch overview:
[PATCH 01/29] mpc512x: change cpu/mpc512x/Makefile to use
Kconfigstyle [PATCH 02/29] mpc512x: Move common files to share them by several boards [PATCH 03/29]cpu/mpc512x/pci.c: minor coding style cleanup
[PATCH 04/29]cpu/mpc512x/diu.c: fix warning: assignment from incompatible pointer type [PATCH 05/29] Rename ads5121 board into mpc5121ads
[PATCH 06/29] MPC512x: add more hardware description toimmap_512x.h[PATCH 07/29] mpc5121ads: use I/O accessors instead of pointer accesses [PATCH 08/29] MPC512x: add support for ARIA board
[PATCH 09/29]cpu/mpc512x/iopin.c: convert to use I/O acessors.
[PATCH 10/29]cpu/mpc512x/iopin.c: remove redundant include of <asm/immap_512x.h> [PATCH 11/29] MPC512x: prepare removal ofinclude/mpc512x.h
[PATCH 12/29]include/configs/mpc5121ads.h: prepare removal ofinclude/mpc512x.h[PATCH 13/29]include/configs/aria.h: prepare removal ofinclude/mpc512x.h[PATCH 14/29]common/cmd_ide.c: prepare removal ofinclude/mpc512x.h[PATCH 15/29]cpu/mpc512x/cpu.c: prepare removal ofinclude/mpc512x.h[PATCH 16/29]cpu/mpc512x/cpu_init.c: prepare removal ofinclude/mpc512x.h[PATCH 17/29]cpu/mpc512x/cpu_init.c: use I/O accessors instead of pointer accesses [PATCH 18/29]cpu/mpc512x/speed.c: prepare removal ofinclude/mpc512x.h[PATCH 19/29]cpu/mpc512x/speed.c: use I/O accessors instead of pointer accesses [PATCH 20/29]cpu/mpc512x/serial.c: use I/O accessors instead of pointer accesses [PATCH 21/29]cpu/mpc512x/i2c.c: prepare removal ofinclude/mpc512x.h
Quoted 8 lines
[PATCH 22/29]
cpu/mpc512x/i2c.c: use immr offsets from C struct instead of #define [PATCH 23/29]cpu/mpc512x/i2c.c: use I/O accessors instead of pointer accesses [PATCH 24/29]cpu/mpc512x/pci.c: use I/O accessors instead of pointer accesses [PATCH 25/29]drivers/net/mpc512x_fec.c: prepare removal ofinclude/mpc512x.h[PATCH 26/29] MPC512x FEC: remove duplicated code and data types
[PATCH 27/29]drivers/net/mpc512x_fec.c: use I/O accessors instead of pointer accesses [PATCH 28/29] MPC512x FEC: get rid of duplicated structethernet_regs[PATCH 29/29] Removeinclude/mpc512x.h
there seem to be recurring themes among these patches - this patchseries would be better grouped into theme based content instead of on a file by file basis. Eg., Removal of mpc512x.h shouldn't need 10 "prepare to remove" patches - it should be a single patch that removes all #include references, plus the file removal itself.
Kim
cover Rework MPC512x Support
Dear Kim Phillips,
Quoted 6 lines · In message <[email protected]> you wrote:
there seem to be recurring themes among these patches - this patchseries would be better grouped into theme based content instead of on a file by file basis. Eg., Removal of
mpc512x.hshouldn't need 10 "prepare to remove" patches - it should be a single patch that removes all #include references, plus the file removal itself.
You are right, there should be just a single patch. But that patch would be big, and if it later turns out that I missed something during my testing, it will be a nightmare to debug.
Been there before. I already had such a patch stack, which I then collapsed into a small number of handy commits. Until it turned out that there was a nasty bug somewhere. And there is no "unsquash" option to "git-besect -i" yet ;-) In the end, I had to restore the previous version from backup tape.
I really thought about this, and I came to the conclusion that it's better to keep the commits separate, step by step.
Best regards,
Wolfgang Denk
Signature · 8 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
Ill-chosen abstraction is particularly evident in the design of the
ADA runtime system. The interface to the ADA runtime system is so
opaque that it is impossible to model or predict its performance,
making it effectively useless for real-time systems.
- Marc D. Donner and David H. Jameson.cover Rework MPC512x Support
Quoted 4 lines · On Tue, 12 May 2009 23:21:53 +0200 Wolfgang Denk <[email protected]> wrote:
Dear Kim Phillips,
Quoted 1 line · In message <[email protected]> you wrote:
Quoted 8 lines
Quoted 5 lines
there seem to be recurring themes among these patches - this patchseries would be better grouped into theme based content instead of on a file by file basis. Eg., Removal of
mpc512x.hshouldn't need 10 "prepare to remove" patches - it should be a single patch that removes all #include references, plus the file removal itself.You are right, there should be just a single patch. But that patch would be big, and if it later turns out that I missed something
? wouldn't it be approximately the size of the file plus ten single-line hunks removing the #include lines in the rest of the code, i.e, a tad larger than patch 29/29? Plus it would significantly reduce the intimidating denominator number of this patchseries (making it approx. 10 commits less, and that's only on the subject of the removal of this mpc512x file).
Quoted 10 lines
during my testing, it will be a nightmare to debug.
Been there before. I already had such a patch stack, which I then collapsed into a small number of handy commits. Until it turned out that there was a nasty bug somewhere. And there is no "unsquash" option to "git-besect -i" yet ;-) In the end, I had to restore the previous version from backup tape.
I really thought about this, and I came to the conclusion that it's better to keep the commits separate, step by step.
I'm not going to tell you how to do your development, but you don't have to expose artefacts of your personal debugging cycles to reviewers nor unnecessarily clutter git bisect with unnecessary commits.
Kim
cover Rework MPC512x Support
Dear Kim Phillips,
Quoted 7 lines · In message <[email protected]> you wrote:
? wouldn't it be approximately the size of the file plus ten single-line hunks removing the #include lines in the rest of the code, i.e, a tad larger than patch 29/29? Plus it would significantly reduce the intimidating denominator number of this patchseries (making it approx. 10 commits less, and that's only on the subject of the removal of this mpc512x file).
It's not exactly that trivial, unfortunately.
Quoted 3 lines
I'm not going to tell you how to do your development, but you don't have to expose artefacts of your personal debugging cycles to reviewers nor unnecessarily clutter git bisect with unnecessary commits.
Ok, ok, ok. I'll see what I can do.
Thanks.
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 I must follow the people. Am I not their leader? - Benjamin Disraeli
v2 cover Rework MPC512x Support
In reply to Wolfgang DenkThe following patch series includes a heavy rework of the existing code for MPC512x processors. The changes include especially:
- move common files from mpc5121ads (so far ads5121) board to common directory so they can be reused by other boards based on the same CPU
- rename "ads5121" into "freescale/mpc5121ads" so the same board name as in Linux is used, and the vendor directory is correct
- rework the whole MPC512x related code to use I/O acessors (i. e. in_*() and out_*() functions) instead of deprecated pointer accesses
- Don't #define register offsets, but use the offset from the respective C structs instead [1]
- remove include/mpc512x.h to avoid duplication of the same information in include/asm-ppc/immap_512x.h
- add support for the ARIA board, a MPC5121e based COM Express module
[1] Note: It was not possible to get completely rid of #define'd register offsets yet, as some are used in cpu/mpc512x/start.S, and in assembly the available options are limited. In Linux, the required header files with the respective #define's are auto-generated from the C struct definitions. We intend to do the same, but this needs co-ordinations across architectures - for example, Blackfin already uses such an approach. For now, we created cpu/mpc512x/asm-offsets.h; this file will be removed again as soon as auto-generation works.
Patches are against current "next" branch; each commit has been compile and run-time tested on the "mpc5121ads" board; the last patch (adding support for ARIA) has been compile and run-time tested on both the "mpc5121ads" and the "aria" boards. Run-time testing inclu- ded at least serial console, network, flash, cold boot (power-on) and warm boot (reset).
Changes since V1: only organizational, i. e. squashing related patches into one, reducing the total number of commits from 29 to 10. The resulting code is still exactly the same (except for one line difference in a comment).
Patch overview:
[PATCH 01/10] mpc512x: change cpu/mpc512x/Makefile to use Kconfig style [PATCH 02/10] mpc512x: Move common files to share them by several boards [PATCH 03/10] cpu/mpc512x/pci.c: minor coding style cleanup
[PATCH 04/10] cpu/mpc512x/diu.c: fix warning: assignment from incompatible pointer type [PATCH 05/10] Rename ads5121 board into mpc5121ads
[PATCH 06/10] MPC512x: add more hardware description to immap_512x.h [PATCH 07/10] MPC512x: use I/O accessors instead of pointer accesses [PATCH 08/10] MPC512x FEC: get rid of duplicated struct ethernet_regs [PATCH 09/10] MPC512x: remove include/mpc512x.h
[PATCH 10/10] MPC512x: add support for ARIA board
---
Summary statistics:
MAINTAINERS | 2 + MAKEALL | 3 +- Makefile | 10 +- board/ads5121/Makefile | 57 --- board/ads5121/README | 7 - board/ads5121/ads5121.c | 432 ------------------- board/ads5121/ads5121_diu.c | 193 --------- board/ads5121/config.mk | 23 - board/ads5121/pci.c | 213 ---------- board/ads5121/u-boot.lds | 121 ------ board/davedenx/aria/Makefile | 53 +++ board/davedenx/aria/aria.c | 317 ++++++++++++++ board/davedenx/aria/config.mk | 23 + board/freescale/mpc5121ads/Makefile | 53 +++ board/freescale/mpc5121ads/README | 7 + board/freescale/mpc5121ads/config.mk | 23 + board/freescale/mpc5121ads/mpc5121ads.c | 339 +++++++++++++++ common/cmd_ide.c | 4 - cpu/mpc512x/Makefile | 16 +- cpu/mpc512x/asm-offsets.h | 15 + cpu/mpc512x/config.mk | 6 +- cpu/mpc512x/cpu.c | 1 - cpu/mpc512x/cpu_init.c | 27 +- cpu/mpc512x/diu.c | 189 +++++++++ cpu/mpc512x/i2c.c | 57 ++-- cpu/mpc512x/ide.c | 128 ++++++ cpu/mpc512x/iopin.c | 10 +- cpu/mpc512x/pci.c | 227 ++++++++++ cpu/mpc512x/serial.c | 64 ++-- cpu/mpc512x/speed.c | 24 +- cpu/mpc512x/start.S | 6 +- cpu/mpc512x/u-boot.lds | 121 ++++++ drivers/net/mpc512x_fec.c | 170 ++++---- drivers/net/mpc512x_fec.h | 155 +------- include/asm-ppc/immap_512x.h | 577 +++++++++++++++++++++++++- include/common.h | 3 +- include/configs/ads5121.h | 550 ------------------------ include/configs/aria.h | 554 ++++++++++++++++++++++++ include/configs/mpc5121ads.h | 550 ++++++++++++++++++++++++ include/mpc512x.h | 702 ------------------------------- 40 files changed, 3407 insertions(+), 2625 deletions(-)
PATCH v2 1/10 mpc512x: change cpu/mpc512x/Makefile to use Kconfig style
In reply to Wolfgang Denk--- cpu/mpc512x/Makefile | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-)
cpu/mpc512x/Makefile +4 -5
@@ -1,5 +1,5 @@ # -# (C) Copyright 2007 DENX Software Engineering +# (C) Copyright 2007-2009 DENX Software Engineering # # See file CREDITS for list of people who contributed to this # project.
@@ -25,11 +25,10 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(CPU).a START = start.o -COBJS = traps.o cpu.o cpu_init.o speed.o interrupts.o serial.o i2c.o iopin.o -ifdef CONFIG_IIM -COBJS += iim.o -endif +COBJS-y := traps.o cpu.o cpu_init.o speed.o interrupts.o serial.o i2c.o iopin.o +COBJS-${CONFIG_IIM} += iim.o +COBJS := $(COBJS-y) SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(SOBJS) $(COBJS)) START := $(addprefix $(obj),$(START))
Signature · 1 line
1.6.0.6
PATCH v2 2/10 mpc512x: Move common files to share them by several boards
In reply to Wolfgang DenkWe will soon see several new MPC521x based boards added. This patch moves files that are not board specific to a common directory so they can be shared by all such ports. It also splits off common IDE code into a new file, cpu/mpc512x/ide.c .
--- board/ads5121/Makefile | 4 - board/ads5121/ads5121.c | 105 +--------------------- board/ads5121/ads5121_diu.c | 193 --------------------------------------- board/ads5121/pci.c | 213 ------------------------------------------- board/ads5121/u-boot.lds | 121 ------------------------ cpu/mpc512x/Makefile | 5 + cpu/mpc512x/config.mk | 6 +- cpu/mpc512x/diu.c | 189 ++++++++++++++++++++++++++++++++++++++ cpu/mpc512x/ide.c | 128 ++++++++++++++++++++++++++ cpu/mpc512x/pci.c | 213 +++++++++++++++++++++++++++++++++++++++++++ cpu/mpc512x/u-boot.lds | 121 ++++++++++++++++++++++++ 11 files changed, 663 insertions(+), 635 deletions(-) delete mode 100644 board/ads5121/ads5121_diu.c delete mode 100644 board/ads5121/pci.c delete mode 100644 board/ads5121/u-boot.lds create mode 100644 cpu/mpc512x/diu.c create mode 100644 cpu/mpc512x/ide.c create mode 100644 cpu/mpc512x/pci.c create mode 100644 cpu/mpc512x/u-boot.lds
board/ads5121/Makefile +0 -4
@@ -28,10 +28,6 @@ $(shell mkdir -p $(OBJTREE)/board/freescale/common) LIB = $(obj)lib$(BOARD).a COBJS-y := $(BOARD).o -COBJS-${CONFIG_FSL_DIU_FB} += ads5121_diu.o -COBJS-${CONFIG_FSL_DIU_FB} += ../freescale/common/fsl_diu_fb.o -COBJS-${CONFIG_FSL_DIU_FB} += ../freescale/common/fsl_logo_bmp.o -COBJS-$(CONFIG_PCI) += pci.o COBJS := $(COBJS-y) SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
board/ads5121/ads5121.c +2 -103
120 lines not on this page · raw message
board/ads5121/ads5121_diu.c deleted +0 -193
193 lines not on this page · raw message
board/ads5121/pci.c deleted +0 -213
213 lines not on this page · raw message
board/ads5121/u-boot.lds deleted +0 -121
121 lines not on this page · raw message
cpu/mpc512x/Makefile +5 -0
@@ -26,7 +26,12 @@ LIB = $(obj)lib$(CPU).a START = start.o COBJS-y := traps.o cpu.o cpu_init.o speed.o interrupts.o serial.o i2c.o iopin.o +COBJS-${CONFIG_FSL_DIU_FB} += diu.o +COBJS-${CONFIG_FSL_DIU_FB} += ../../board/freescale/common/fsl_diu_fb.o +COBJS-${CONFIG_FSL_DIU_FB} += ../../board/freescale/common/fsl_logo_bmp.o +COBJS-${CONFIG_CMD_IDE} += ide.o COBJS-${CONFIG_IIM} += iim.o +COBJS-$(CONFIG_PCI) += pci.o COBJS := $(COBJS-y) SRCS := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
cpu/mpc512x/config.mk +5 -1
@@ -1,5 +1,5 @@ # -# (C) Copyright 2007 DENX Software Engineering +# (C) Copyright 2007-2009 DENX Software Engineering # # See file CREDITS for list of people who contributed to this # project.
@@ -23,3 +23,7 @@ PLATFORM_RELFLAGS += -fPIC -ffixed-r14 -meabi PLATFORM_CPPFLAGS += -DCONFIG_MPC512X -DCONFIG_E300 \ -ffixed-r2 -msoft-float -mcpu=603e + +# Use default linker script. +# A board port can override this setting in board/*/config.mk +LDSCRIPT := $(SRCTREE)/cpu/mpc512x/u-boot.lds
cpu/mpc512x/diu.c new file +189 -0
189 lines not on this page · raw message
cpu/mpc512x/ide.c new file +128 -0
128 lines not on this page · raw message
cpu/mpc512x/pci.c new file +213 -0
213 lines not on this page · raw message
cpu/mpc512x/u-boot.lds new file +121 -0
121 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH v2 3/10 cpu/mpc512x/pci.c: minor coding style cleanup
In reply to Wolfgang DenkGet rid of variable declaration in the middle of the code.
--- cpu/mpc512x/pci.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-)
cpu/mpc512x/pci.c +3 -6
@@ -54,6 +54,7 @@ pci_init_board(void)u16 reg16;u32 reg32;u32 dev; +int i;struct pci_controller *hose;/* Set PCI divider for 33MHz */
@@ -77,12 +78,8 @@ pci_init_board(void) pci_ctrl->gcr =1 ;/* We need to wait at least a 1sec based on PCI specs */ - { -int i; - -for (i =0 ; i <1000 ; i++) -udelay (1000 ); - } +for (i =0 ; i <1000 ; i++) +udelay (1000 );/* * Configure PCI Local Access Windows
Signature · 1 line
1.6.0.6
PATCH v2 4/10 cpu/mpc512x/diu.c: fix warning: assignment from incompatible pointer type
In reply to Wolfgang Denk--- cpu/mpc512x/diu.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
cpu/mpc512x/diu.c +1 -1
@@ -95,7 +95,7 @@ int mpc5121_diu_init(void) bmp =valid_bmp (bmp_env); }if (!bmp) - bmp = FSL_Logo_BMP; + bmp = (char *)FSL_Logo_BMP;return fsl_diu_init (xres, pixel_format,0 , (unsigned char *)bmp); }
Signature · 1 line
1.6.0.6
PATCH v2 5/10 Rename ads5121 board into mpc5121ads
In reply to Wolfgang DenkWe rename the board so we use a consistent name in U-Boot and in Linux. Also, we use this opportunity to move the board into the Freecale vendor directory.
--- MAKEALL | 2 +- Makefile | 6 +- board/ads5121/Makefile | 53 --- board/ads5121/README | 7 - board/ads5121/ads5121.c | 331 ------------------- board/ads5121/config.mk | 23 -- board/freescale/mpc5121ads/Makefile | 53 +++ board/freescale/mpc5121ads/README | 7 + board/freescale/mpc5121ads/config.mk | 23 ++ board/freescale/mpc5121ads/mpc5121ads.c | 331 +++++++++++++++++++ include/configs/ads5121.h | 550 ------------------------------- include/configs/mpc5121ads.h | 550 +++++++++++++++++++++++++++++++ 12 files changed, 968 insertions(+), 968 deletions(-) delete mode 100644 board/ads5121/Makefile delete mode 100644 board/ads5121/README delete mode 100644 board/ads5121/ads5121.c delete mode 100644 board/ads5121/config.mk create mode 100644 board/freescale/mpc5121ads/Makefile create mode 100644 board/freescale/mpc5121ads/README create mode 100644 board/freescale/mpc5121ads/config.mk create mode 100644 board/freescale/mpc5121ads/mpc5121ads.c delete mode 100644 include/configs/ads5121.h create mode 100644 include/configs/mpc5121ads.h
MAKEALL +1 -1
@@ -77,7 +77,7 @@ LIST_5xxx=" \ ######################################################################### LIST_512x=" \ - ads5121 \ + mpc5121ads \ " #########################################################################
Makefile +3 -3
@@ -812,14 +812,14 @@ v38b_config: unconfig ## MPC512x Systems ######################################################################### -ads5121_config \ -ads5121_rev2_config \ +mpc5121ads_config \ +mpc5121ads_rev2_config \ : unconfig @mkdir -p $(obj)include @if [ "$(findstring rev2,$@)" ] ; then \ echo "#define CONFIG_ADS5121_REV2 1" > $(obj)include/config.h; \ fi - @$(MKCONFIG) -a ads5121 ppc mpc512x ads5121 + @$(MKCONFIG) -a mpc5121ads ppc mpc512x mpc5121ads freescale #########################################################################
board/ads5121/Makefile deleted +0 -53
53 lines not on this page · raw message
board/ads5121/README deleted +0 -7
@@ -1,7 +0,0 @@ -To configure for the current (Rev 3.x) ADS5121 - make ads5121_config -This will automatically include PCI, the Real Time CLock, add backup flash -ability and set the correct frequency and memory configuration. - -To configure for the older Rev 2 ADS5121 type (this will not have PCI) - make ads5121_rev2_config
board/ads5121/ads5121.c deleted +0 -331
331 lines not on this page · raw message
board/ads5121/config.mk deleted +0 -23
@@ -1,23 +0,0 @@ -# -# (C) Copyright 2007 DENX Software Engineering -# -# 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 -# - -TEXT_BASE = 0xFFF00000
board/freescale/mpc5121ads/Makefile new file +53 -0
53 lines not on this page · raw message
board/freescale/mpc5121ads/README new file +7 -0
@@ -0,0 +1,7 @@ +To configure for the current (Rev 3.x) ADS5121 + make ads5121_config +This will automatically include PCI, the Real Time CLock, add backup flash +ability and set the correct frequency and memory configuration. + +To configure for the older Rev 2 ADS5121 type (this will not have PCI) + make ads5121_rev2_config
board/freescale/mpc5121ads/config.mk new file +23 -0
@@ -0,0 +1,23 @@ +# +# (C) Copyright 2007 DENX Software Engineering +# +# 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 +# + +TEXT_BASE = 0xFFF00000
board/freescale/mpc5121ads/mpc5121ads.c new file +331 -0
331 lines not on this page · raw message
include/configs/ads5121.h deleted +0 -550
550 lines not on this page · raw message
include/configs/mpc5121ads.h new file +550 -0
550 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH v2 5/10 Rename ads5121 board into mpc5121ads
Quoted 7 lines · On Sat, 16 May 2009 10:47:41 +0200 Wolfgang Denk <[email protected]> wrote:
We rename the board so we use a consistent name in U-Boot and in Linux. Also, we use this opportunity to move the board into the Freecale vendor directory.
Signed-off-by Wolfgang Denk <[email protected]>Cc John Rigby <[email protected]>
Quoted 13 lines
--- MAKEALL | 2 +- Makefile | 6 +- board/ads5121/Makefile | 53 --- board/ads5121/README | 7 - board/ads5121/ads5121.c | 331 ------------------- board/ads5121/config.mk | 23 -- board/freescale/mpc5121ads/Makefile | 53 +++ board/freescale/mpc5121ads/README | 7 + board/freescale/mpc5121ads/config.mk | 23 ++ board/freescale/mpc5121ads/mpc5121ads.c | 331 +++++++++++++++++++ include/configs/ads5121.h | 550 ------------------------------- include/configs/mpc5121ads.h | 550 +++++++++++++++++++++++++++++++
great consolidating so many patches - much easier to review.
it's just that we get into the habit of using git format-patch -B -M - it greatly facilitates reviewing mass-rename patches such as this one.
Kim
PATCH v2 5/10 Rename ads5121 board into mpc5121ads
In reply to Wolfgang DenkIn article <[email protected]>, wd at denx.de says...
Quoted 4 lines
We rename the board so we use a consistent name in U-Boot and in Linux. Also, we use this opportunity to move the board into the Freecale vendor directory.
Hello Mr. Denk!
Maybe a stupid question - but the manufacturer called it ADS512101 - should not that name be the right one for linux and u-boot ?
Best regards,
Arno Fischer
PATCH v2 5/10 Rename ads5121 board into mpc5121ads
Dear Arno Fischer,
Quoted 9 lines · In message <[email protected]> you wrote:
In article <[email protected]>, wd at denx.de says...
Quoted 4 lines
We rename the board so we use a consistent name in U-Boot and in Linux. Also, we use this opportunity to move the board into the Freecale vendor directory.
Maybe a stupid question - but the manufacturer called it ADS512101 - should not that name be the right one for linux and u-boot ?
It's not a stupid question. There is indeed confusion around the board name.
Situation is as follows: the manufacturer called the board "Hellrosa"; see http://www.silicontkx.com/hellrosa.htm
Freescale decided to distributre the board under the product name ADS5121 (or ADS512101).
The Linux kernel has been using the name "mpc5121ads" for the related board configuration from the beginning.
U-Boot used "ads5121" as board config name.
I don't care at all about the name of the product, i. e. the part number you have to use when ordering the board.
Also, the board configuration name is not somthing I would fight for
- it's just a name after all. It does not have to be identical to the product name (which is even impossible here, as we would have to use either "hellrosa" or "ads5121", and neither of them makes everybody happy; also it's not 100% clear to me whether board/freescale/ or board/stx/ is more correct - technically or politically).
But I think it is important to use the *same* configuration name in Linux and in U-Boot - we received a lot of avoidable support calls in the past because users got confused when they had to use "ads5121" in U-Boot and "mpc5121ads" in Linux.
The purpose of the patch is to get a unique configuration name. "mpc5121" fits well with the other config names used for Freescale boards, and is identical to Linux.
If anybody wants a different board name, I don't object. But he should please care to get the config name in Linux changed first, U-Boot will then follow.
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 I don't want to be young again, I just don't want to get any older.
PATCH v2 6/10 MPC512x: add more hardware description to immap_512x.h
In reply to Wolfgang Denk- add GPIO module description
- add Address Latch Timing Register description
- add IO Control Memory Map
- add FEC Memory Map
Also change board/freescale/mpc5121ads/mpc5121ads.c and cpu/mpc512x/iopin.c as needed.
--- board/freescale/mpc5121ads/mpc5121ads.c | 2 +- cpu/mpc512x/iopin.c | 6 +- include/asm-ppc/immap_512x.h | 253 ++++++++++++++++++++++++++++++- 3 files changed, 252 insertions(+), 9 deletions(-)
board/freescale/mpc5121ads/mpc5121ads.c +1 -1
@@ -132,7 +132,7 @@ long int fixed_sdram (void)u32 i;/* Initialize IO Control */ - im->io_ctrl.regs[IOCTL_MEM /4 ] =IOCTRL_MUX_DDR ; + im->io_ctrl.io_control_mem =IOCTRL_MUX_DDR ;/* Initialize DDR Local Window */ im->sysconf.ddrlaw.bar =CONFIG_SYS_DDR_BASE &0xFFFFF000 ;
cpu/mpc512x/iopin.c +3 -3
@@ -23,15 +23,15 @@#include <common.h> #include <linux/types.h> -#include <mpc512x.h> +#include <asm/immap_512x.h> void iopin_initialize (iopin_t *ioregs_init,int len) {short i, j, p; -u_long *reg; +u32 *reg;immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; - reg = (u_long *)&(im->io_ctrl.regs[0 ]); + reg = (u32 *)&(im->io_ctrl);if (sizeof (ioregs_init) ==0 )return ;
include/asm-ppc/immap_512x.h +248 -5
281 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH v2 7/10 MPC512x: use I/O accessors instead of pointer accesses
In reply to Wolfgang DenkThis commit changes the MPC512x code to use I/O accessor calls (i.e. out_*() and in_*()) instead of using deprecated pointer accesses.
--- board/freescale/mpc5121ads/mpc5121ads.c | 176 ++++++++++++++++--------------- cpu/mpc512x/cpu_init.c | 26 +++-- cpu/mpc512x/i2c.c | 56 +++++----- cpu/mpc512x/ide.c | 52 +++++----- cpu/mpc512x/iopin.c | 6 +- cpu/mpc512x/pci.c | 71 ++++++++----- cpu/mpc512x/serial.c | 64 ++++++------ cpu/mpc512x/speed.c | 23 +++-- drivers/net/mpc512x_fec.c | 113 +++++++++++--------- 9 files changed, 324 insertions(+), 263 deletions(-)
board/freescale/mpc5121ads/mpc5121ads.c +92 -84
@@ -1,5 +1,5 @@/* -* (C) Copyright 2007 DENX Software Engineering +* (C) Copyright 2007-2009 DENX Software Engineering * * See file CREDITS for list of people who contributed to this * project.
@@ -22,9 +22,9 @@*/ #include <common.h> -#include <mpc512x.h> #include <asm/bitops.h> #include <command.h> +#include <asm/io.h> #include <asm/processor.h> #include <fdt_support.h> #ifdef CONFIG_MISC_INIT_R
@@ -33,6 +33,8 @@DECLARE_GLOBAL_DATA_PTR ; +extern void ide_set_reset (int idereset); +/* Clocks in use */ #define SCCR1_CLOCKS_EN (CLOCK_SCCR1_CFG_EN | \ CLOCK_SCCR1_LPC_EN | \
@@ -57,22 +59,24 @@ long int fixed_sdram(void);int board_early_init_f (void ) {volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; -u32 lpcaw; +u32 lpcaw, spridr;/* * Initialize Local Window for the CPLD registers access (CS2 selects * the CPLD chip) */ - im->sysconf.lpcs2aw =CSAW_START (CONFIG_SYS_CPLD_BASE ) | -CSAW_STOP (CONFIG_SYS_CPLD_BASE ,CONFIG_SYS_CPLD_SIZE ); - im->lpc.cs_cfg[2 ] =CONFIG_SYS_CS2_CFG ; +out_be32 (&im->sysconf.lpcs2aw, +CSAW_START (CONFIG_SYS_CPLD_BASE ) | +CSAW_STOP (CONFIG_SYS_CPLD_BASE ,CONFIG_SYS_CPLD_SIZE ) + ); +out_be32 (&im->lpc.cs_cfg[2 ],CONFIG_SYS_CS2_CFG );/* * According to MPC5121e RM, configuring local access windows should * be followed by a dummy read of the config register that was * modified last and an isync */ - lpcaw = im->sysconf.lpcs2aw; + lpcaw =in_be32 (&im->sysconf.lpcs6aw); __asm__ __volatile__ ("isync" );/*
@@ -83,29 +87,32 @@ int board_early_init_f (void)*/ #ifdef CONFIG_ADS5121_REV2 - *((volatile u8 *)(CONFIG_SYS_CPLD_BASE +0x08 )) =0xC1 ; +out_8 ((u8 *)(CONFIG_SYS_CPLD_BASE +0x08 ),0xC1 );#else -if (*((u8 *)(CONFIG_SYS_CPLD_BASE +0x08 )) &0x04 ) { - *((volatile u8 *)(CONFIG_SYS_CPLD_BASE +0x08 )) =0xC1 ; +if (in_8 ((u8 *)(CONFIG_SYS_CPLD_BASE +0x08 )) &0x04 ) { +out_8 ((u8 *)(CONFIG_SYS_CPLD_BASE +0x08 ),0xC1 ); }else {/* running from Backup flash */ - *((volatile u8 *)(CONFIG_SYS_CPLD_BASE +0x08 )) =0x32 ; +out_8 ((u8 *)(CONFIG_SYS_CPLD_BASE +0x08 ),0x32 ); }#endif /* * Configure Flash Speed */ - *((volatile u32 *)(CONFIG_SYS_IMMR +LPC_OFFSET +CS0_CONFIG )) =CONFIG_SYS_CS0_CFG ; -if (SVR_MJREV (im->sysconf.spridr) >=2 ) { - *((volatile u32 *)(CONFIG_SYS_IMMR +LPC_OFFSET +CS_ALE_TIMING_CONFIG )) =CONFIG_SYS_CS_ALETIMING ; +out_be32 (&im->lpc.cs_cfg[0 ],CONFIG_SYS_CS0_CFG ); + + spridr =in_be32 (&im->sysconf.spridr); + +if (SVR_MJREV (spridr) >=2 ) { +out_be32 (&im->lpc.altr,CONFIG_SYS_CS_ALETIMING ); }/* * Enable clocks */ - im->clk.sccr[0 ] =SCCR1_CLOCKS_EN ; - im->clk.sccr[1 ] =SCCR2_CLOCKS_EN ; +out_be32 (&im->clk.sccr[0 ],SCCR1_CLOCKS_EN ); +out_be32 (&im->clk.sccr[1 ],SCCR2_CLOCKS_EN );#if defined(CONFIG_IIM ) || defined(CONFIG_CMD_FUSE ) - im->clk.sccr[1 ] |=CLOCK_SCCR2_IIM_EN ; +setbits_be32 (&im->clk.sccr[1 ],CLOCK_SCCR2_IIM_EN );#endif return 0 ;
@@ -132,83 +139,83 @@ long int fixed_sdram (void)u32 i;/* Initialize IO Control */ - im->io_ctrl.io_control_mem =IOCTRL_MUX_DDR ; +out_be32 (&im->io_ctrl.io_control_mem,IOCTRL_MUX_DDR );/* Initialize DDR Local Window */ - im->sysconf.ddrlaw.bar =CONFIG_SYS_DDR_BASE &0xFFFFF000 ; - im->sysconf.ddrlaw.ar = msize_log2 -1 ; +out_be32 (&im->sysconf.ddrlaw.bar,CONFIG_SYS_DDR_BASE &0xFFFFF000 ); +out_be32 (&im->sysconf.ddrlaw.ar, msize_log2 -1 );/* * According to MPC5121e RM, configuring local access windows should * be followed by a dummy read of the config register that was * modified last and an isync */ - i = im->sysconf.ddrlaw.ar; +in_be32 (&im->sysconf.ddrlaw.ar); __asm__ __volatile__ ("isync" );/* Enable DDR */ - im->mddrc.ddr_sys_config =CONFIG_SYS_MDDRC_SYS_CFG_EN ; +out_be32 (&im->mddrc.ddr_sys_config,CONFIG_SYS_MDDRC_SYS_CFG_EN );/* Initialize DDR Priority Manager */ - im->mddrc.prioman_config1 =CONFIG_SYS_MDDRCGRP_PM_CFG1 ; - im->mddrc.prioman_config2 =CONFIG_SYS_MDDRCGRP_PM_CFG2 ; - im->mddrc.hiprio_config =CONFIG_SYS_MDDRCGRP_HIPRIO_CFG ; - im->mddrc.lut_table0_main_upper =CONFIG_SYS_MDDRCGRP_LUT0_MU ; - im->mddrc.lut_table0_main_lower =CONFIG_SYS_MDDRCGRP_LUT0_ML ; - im->mddrc.lut_table1_main_upper =CONFIG_SYS_MDDRCGRP_LUT1_MU ; - im->mddrc.lut_table1_main_lower =CONFIG_SYS_MDDRCGRP_LUT1_ML ; - im->mddrc.lut_table2_main_upper =CONFIG_SYS_MDDRCGRP_LUT2_MU ; - im->mddrc.lut_table2_main_lower =CONFIG_SYS_MDDRCGRP_LUT2_ML ; - im->mddrc.lut_table3_main_upper =CONFIG_SYS_MDDRCGRP_LUT3_MU ; - im->mddrc.lut_table3_main_lower =CONFIG_SYS_MDDRCGRP_LUT3_ML ; - im->mddrc.lut_table4_main_upper =CONFIG_SYS_MDDRCGRP_LUT4_MU ; - im->mddrc.lut_table4_main_lower =CONFIG_SYS_MDDRCGRP_LUT4_ML ; - im->mddrc.lut_table0_alternate_upper =CONFIG_SYS_MDDRCGRP_LUT0_AU ; - im->mddrc.lut_table0_alternate_lower =CONFIG_SYS_MDDRCGRP_LUT0_AL ; - im->mddrc.lut_table1_alternate_upper =CONFIG_SYS_MDDRCGRP_LUT1_AU ; - im->mddrc.lut_table1_alternate_lower =CONFIG_SYS_MDDRCGRP_LUT1_AL ; - im->mddrc.lut_table2_alternate_upper =CONFIG_SYS_MDDRCGRP_LUT2_AU ; - im->mddrc.lut_table2_alternate_lower =CONFIG_SYS_MDDRCGRP_LUT2_AL ; - im->mddrc.lut_table3_alternate_upper =CONFIG_SYS_MDDRCGRP_LUT3_AU ; - im->mddrc.lut_table3_alternate_lower =CONFIG_SYS_MDDRCGRP_LUT3_AL ; - im->mddrc.lut_table4_alternate_upper =CONFIG_SYS_MDDRCGRP_LUT4_AU ; - im->mddrc.lut_table4_alternate_lower =CONFIG_SYS_MDDRCGRP_LUT4_AL ; +out_be32 (&im->mddrc.prioman_config1,CONFIG_SYS_MDDRCGRP_PM_CFG1 ); +out_be32 (&im->mddrc.prioman_config2,CONFIG_SYS_MDDRCGRP_PM_CFG2 ); +out_be32 (&im->mddrc.hiprio_config,CONFIG_SYS_MDDRCGRP_HIPRIO_CFG ); +out_be32 (&im->mddrc.lut_table0_main_upper,CONFIG_SYS_MDDRCGRP_LUT0_MU ); +out_be32 (&im->mddrc.lut_table0_main_lower,CONFIG_SYS_MDDRCGRP_LUT0_ML ); +out_be32 (&im->mddrc.lut_table1_main_upper,CONFIG_SYS_MDDRCGRP_LUT1_MU ); +out_be32 (&im->mddrc.lut_table1_main_lower,CONFIG_SYS_MDDRCGRP_LUT1_ML ); +out_be32 (&im->mddrc.lut_table2_main_upper,CONFIG_SYS_MDDRCGRP_LUT2_MU ); +out_be32 (&im->mddrc.lut_table2_main_lower,CONFIG_SYS_MDDRCGRP_LUT2_ML ); +out_be32 (&im->mddrc.lut_table3_main_upper,CONFIG_SYS_MDDRCGRP_LUT3_MU ); +out_be32 (&im->mddrc.lut_table3_main_lower,CONFIG_SYS_MDDRCGRP_LUT3_ML ); +out_be32 (&im->mddrc.lut_table4_main_upper,CONFIG_SYS_MDDRCGRP_LUT4_MU ); +out_be32 (&im->mddrc.lut_table4_main_lower,CONFIG_SYS_MDDRCGRP_LUT4_ML ); +out_be32 (&im->mddrc.lut_table0_alternate_upper,CONFIG_SYS_MDDRCGRP_LUT0_AU ); +out_be32 (&im->mddrc.lut_table0_alternate_lower,CONFIG_SYS_MDDRCGRP_LUT0_AL ); +out_be32 (&im->mddrc.lut_table1_alternate_upper,CONFIG_SYS_MDDRCGRP_LUT1_AU ); +out_be32 (&im->mddrc.lut_table1_alternate_lower,CONFIG_SYS_MDDRCGRP_LUT1_AL ); +out_be32 (&im->mddrc.lut_table2_alternate_upper,CONFIG_SYS_MDDRCGRP_LUT2_AU ); +out_be32 (&im->mddrc.lut_table2_alternate_lower,CONFIG_SYS_MDDRCGRP_LUT2_AL ); +out_be32 (&im->mddrc.lut_table3_alternate_upper,CONFIG_SYS_MDDRCGRP_LUT3_AU ); +out_be32 (&im->mddrc.lut_table3_alternate_lower,CONFIG_SYS_MDDRCGRP_LUT3_AL ); +out_be32 (&im->mddrc.lut_table4_alternate_upper,CONFIG_SYS_MDDRCGRP_LUT4_AU ); +out_be32 (&im->mddrc.lut_table4_alternate_lower,CONFIG_SYS_MDDRCGRP_LUT4_AL );/* Initialize MDDRC */ - im->mddrc.ddr_sys_config =CONFIG_SYS_MDDRC_SYS_CFG ; - im->mddrc.ddr_time_config0 =CONFIG_SYS_MDDRC_TIME_CFG0 ; - im->mddrc.ddr_time_config1 =CONFIG_SYS_MDDRC_TIME_CFG1 ; - im->mddrc.ddr_time_config2 =CONFIG_SYS_MDDRC_TIME_CFG2 ; +out_be32 (&im->mddrc.ddr_sys_config,CONFIG_SYS_MDDRC_SYS_CFG ); +out_be32 (&im->mddrc.ddr_time_config0,CONFIG_SYS_MDDRC_TIME_CFG0 ); +out_be32 (&im->mddrc.ddr_time_config1,CONFIG_SYS_MDDRC_TIME_CFG1 ); +out_be32 (&im->mddrc.ddr_time_config2,CONFIG_SYS_MDDRC_TIME_CFG2 );/* Initialize DDR */ for (i =0 ; i <10 ; i++) - im->mddrc.ddr_command =CONFIG_SYS_MICRON_NOP ; - - im->mddrc.ddr_command =CONFIG_SYS_MICRON_PCHG_ALL ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_NOP ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_RFSH ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_NOP ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_RFSH ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_NOP ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_INIT_DEV_OP ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_NOP ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_EM2 ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_NOP ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_PCHG_ALL ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_EM2 ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_EM3 ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_EN_DLL ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_INIT_DEV_OP ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_PCHG_ALL ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_RFSH ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_INIT_DEV_OP ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_OCD_DEFAULT ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_PCHG_ALL ; - im->mddrc.ddr_command =CONFIG_SYS_MICRON_NOP ; +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP ); + +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_PCHG_ALL ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_RFSH ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_RFSH ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_INIT_DEV_OP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_EM2 ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_PCHG_ALL ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_EM2 ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_EM3 ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_EN_DLL ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_INIT_DEV_OP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_PCHG_ALL ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_RFSH ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_INIT_DEV_OP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_OCD_DEFAULT ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_PCHG_ALL ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP );/* Start MDDRC */ - im->mddrc.ddr_time_config0 =CONFIG_SYS_MDDRC_TIME_CFG0_RUN ; - im->mddrc.ddr_sys_config =CONFIG_SYS_MDDRC_SYS_CFG_RUN ; +out_be32 (&im->mddrc.ddr_time_config0,CONFIG_SYS_MDDRC_TIME_CFG0_RUN ); +out_be32 (&im->mddrc.ddr_sys_config,CONFIG_SYS_MDDRC_SYS_CFG_RUN );return msize; }
@@ -248,49 +255,49 @@ int misc_init_r(void)static iopin_t ioregs_init[] = {/* FUNC1=FEC_RX_DV Sets Next 3 to FEC pads */ { -IOCTL_SPDIF_TXCLK ,3 ,0 , + offsetof(struct ioctrl512x , io_control_spdif_txclk),3 ,0 ,IO_PIN_FMUX (1 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) |IO_PIN_PUE (0 ) |IO_PIN_ST (0 ) |IO_PIN_DS (3 ) },/* Set highest Slew on 9 PATA pins */ { -IOCTL_PATA_CE1 ,9 ,1 , + offsetof(struct ioctrl512x , io_control_pata_ce1),9 ,1 ,IO_PIN_FMUX (0 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) |IO_PIN_PUE (0 ) |IO_PIN_ST (0 ) |IO_PIN_DS (3 ) },/* FUNC1=FEC_COL Sets Next 15 to FEC pads */ { -IOCTL_PSC0_0 ,15 ,0 , + offsetof(struct ioctrl512x , io_control_psc0_0),15 ,0 ,IO_PIN_FMUX (1 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) |IO_PIN_PUE (0 ) |IO_PIN_ST (0 ) |IO_PIN_DS (3 ) },/* FUNC1=SPDIF_TXCLK */ { -IOCTL_LPC_CS1 ,1 ,0 , + offsetof(struct ioctrl512x , io_control_lpc_cs1),1 ,0 ,IO_PIN_FMUX (1 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) |IO_PIN_PUE (0 ) |IO_PIN_ST (1 ) |IO_PIN_DS (3 ) },/* FUNC2=SPDIF_TX and sets Next pin to SPDIF_RX */ { -IOCTL_I2C1_SCL ,2 ,0 , + offsetof(struct ioctrl512x , io_control_i2c1_scl),2 ,0 ,IO_PIN_FMUX (2 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) |IO_PIN_PUE (0 ) |IO_PIN_ST (1 ) |IO_PIN_DS (3 ) },/* FUNC2=DIU CLK */ { -IOCTL_PSC6_0 ,1 ,0 , + offsetof(struct ioctrl512x , io_control_psc6_0),1 ,0 ,IO_PIN_FMUX (2 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) |IO_PIN_PUE (0 ) |IO_PIN_ST (1 ) |IO_PIN_DS (3 ) },/* FUNC2=DIU_HSYNC */ { -IOCTL_PSC6_1 ,1 ,0 , + offsetof(struct ioctrl512x , io_control_psc6_1),1 ,0 ,IO_PIN_FMUX (2 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) |IO_PIN_PUE (0 ) |IO_PIN_ST (0 ) |IO_PIN_DS (3 ) },/* FUNC2=DIUVSYNC Sets Next 26 to DIU Pads */ { -IOCTL_PSC6_4 ,26 ,0 , + offsetof(struct ioctrl512x , io_control_psc6_4),26 ,0 ,IO_PIN_FMUX (2 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) |IO_PIN_PUE (0 ) |IO_PIN_ST (0 ) |IO_PIN_DS (3 ) }
@@ -299,7 +306,7 @@ static iopin_t ioregs_init[] = {static iopin_t rev2_silicon_pci_ioregs_init[] = {/* FUNC0=PCI Sets next 54 to PCI pads */ { -IOCTL_PCI_AD31 ,54 ,0 , + offsetof(struct ioctrl512x , io_control_pci_ad31),54 ,0 ,IO_PIN_FMUX (0 ) |IO_PIN_HOLD (0 ) |IO_PIN_DS (0 ) } };
@@ -309,13 +316,14 @@ int checkboard (void)ushort brd_rev = *(vu_short *) (CONFIG_SYS_CPLD_BASE +0x00 );uchar cpld_rev = *(vu_char *) (CONFIG_SYS_CPLD_BASE +0x02 );volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +u32 spridr =in_be32 (&im->sysconf.spridr);printf ("Board: ADS5121 rev. 0x%04x (CPLD rev. 0x%02x)\n" , brd_rev, cpld_rev);/* initialize function mux & slew rate IO inter alia on IO Pins */ iopin_initialize (ioregs_init,sizeof (ioregs_init) /sizeof (ioregs_init[0 ])); -if (SVR_MJREV (im->sysconf.spridr) >=2 ) { +if (SVR_MJREV (spridr) >=2 ) {iopin_initialize (rev2_silicon_pci_ioregs_init,1 ); }
cpu/mpc512x/cpu_init.c +16 -10
@@ -1,6 +1,6 @@/* * Copyright (C) 2004-2006 Freescale Semiconductor, Inc. -* (C) Copyright 2007 DENX Software Engineering +* Copyright (C) 2007-2009 DENX Software Engineering * * See file CREDITS for list of people who contributed to this * project.
@@ -26,6 +26,8 @@#include <common.h> #include <mpc512x.h> +#include <asm/io.h> +#include <asm/processor.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -46,30 +48,34 @@ void cpu_init_f (volatile immap_t * im)#ifdef CONFIG_SYS_ACR_PIPE_DEP /* Arbiter pipeline depth */ - im->arbiter.acr = (im->arbiter.acr & ~ACR_PIPE_DEP ) | - (CONFIG_SYS_ACR_PIPE_DEP <<ACR_PIPE_DEP_SHIFT ); +out_be32 (&im->arbiter.acr, + (im->arbiter.acr & ~ACR_PIPE_DEP ) | + (CONFIG_SYS_ACR_PIPE_DEP <<ACR_PIPE_DEP_SHIFT ) + );#endif #ifdef CONFIG_SYS_ACR_RPTCNT /* Arbiter repeat count */ - im->arbiter.acr = ((im->arbiter.acr & ~(ACR_RPTCNT )) | - (CONFIG_SYS_ACR_RPTCNT <<ACR_RPTCNT_SHIFT )); +out_be32 (im->arbiter.acr, + (im->arbiter.acr & ~(ACR_RPTCNT )) | + (CONFIG_SYS_ACR_RPTCNT <<ACR_RPTCNT_SHIFT ) + );#endif /* RSR - Reset Status Register - clear all status */ gd->reset_status = im->reset.rsr; - im->reset.rsr = ~(RSR_RES ); +out_be32 (&im->reset.rsr, ~RSR_RES );/* * RMR - Reset Mode Register - enable checkstop reset */ - im->reset.rmr = (RMR_CSRE & (1 <<RMR_CSRE_SHIFT )); +out_be32 (&im->reset.rmr,RMR_CSRE & (1 <<RMR_CSRE_SHIFT ));/* Set IPS-CSB divider: IPS = 1/2 CSB */ - ips_div = im->clk.scfr[0 ]; + ips_div =in_be32 (&im->clk.scfr[0 ]); ips_div &= ~(SCFR1_IPS_DIV_MASK ); ips_div |=SCFR1_IPS_DIV <<SCFR1_IPS_DIV_SHIFT ; - im->clk.scfr[0 ] = ips_div; +out_be32 (&im->clk.scfr[0 ], ips_div);/* * Enable Time Base/Decrementer
@@ -78,7 +84,7 @@ void cpu_init_f (volatile immap_t * im)* have udelay() working; if not enabled, usually leads to a hang, like * during FLASH chip identification etc. */ - im->sysconf.spcr |=SPCR_TBEN ; +setbits_be32 (&im->sysconf.spcr,SPCR_TBEN ); }int cpu_init_r (void )
cpu/mpc512x/i2c.c +30 -26
148 lines not on this page · raw message
cpu/mpc512x/ide.c +26 -26
105 lines not on this page · raw message
cpu/mpc512x/iopin.c +3 -3
@@ -23,7 +23,7 @@#include <common.h> #include <linux/types.h> -#include <asm/immap_512x.h> +#include <asm/io.h> void iopin_initialize (iopin_t *ioregs_init,int len) {
@@ -40,9 +40,9 @@ void iopin_initialize(iopin_t *ioregs_init, int len)for (p =0 , j = ioregs_init[i].p_offset /sizeof (u_long); p < ioregs_init[i].nr_pins; p++, j++) {if (ioregs_init[i].bit_or) - reg[j] |= ioregs_init[i].val; +setbits_be32 (reg + j, ioregs_init[i].val);else - reg[j] = ioregs_init[i].val; +out_be32 (reg + j, ioregs_init[i].val); } }return ;
cpu/mpc512x/pci.c +44 -27
127 lines not on this page · raw message
cpu/mpc512x/serial.c +33 -31
156 lines not on this page · raw message
cpu/mpc512x/speed.c +16 -7
@@ -1,5 +1,5 @@/* -* (C) Copyright 2000-2007 +* (C) Copyright 2000-2009 * Wolfgang Denk, DENX Software Engineering, wd at denx.de. * * Copyright (C) 2004-2006 Freescale Semiconductor, Inc.
@@ -28,6 +28,7 @@#include <common.h> #include <mpc512x.h> #include <command.h> +#include <asm/io.h> #include <asm/processor.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -75,29 +76,37 @@ int get_clocks (void)u32 csb_clk;u32 ips_clk;u32 pci_clk; +u32 reg; -if ((im->sysconf.immrbar &IMMRBAR_BASE_ADDR ) != (u32 ) im) + reg =in_be32 (&im->sysconf.immrbar); +if ((reg &IMMRBAR_BASE_ADDR ) != (u32 ) im)return -1 ; - spmf = (im->clk.spmr &SPMR_SPMF ) >>SPMR_SPMF_SHIFT ; + reg =in_be32 (&im->clk.spmr); + spmf = (reg &SPMR_SPMF ) >>SPMR_SPMF_SHIFT ; spll = ref_clk * spmf_mult[spmf]; - sys_div = (im->clk.scfr[1 ] &SCFR2_SYS_DIV ) >>SCFR2_SYS_DIV_SHIFT ; + reg =in_be32 (&im->clk.scfr[1 ]); + sys_div = (reg &SCFR2_SYS_DIV ) >>SCFR2_SYS_DIV_SHIFT ; sys_clk = (spll * sys_dividors[sys_div][1 ]) / sys_dividors[sys_div][0 ]; csb_clk = sys_clk /2 ; - cpmf = (im->clk.spmr &SPMR_CPMF ) >>SPMR_CPMF_SHIFT ; + reg =in_be32 (&im->clk.spmr); + cpmf = (reg &SPMR_CPMF ) >>SPMR_CPMF_SHIFT ; core_clk = (csb_clk * cpmf_mult[cpmf][0 ]) / cpmf_mult[cpmf][1 ]; - ips_div = (im->clk.scfr[0 ] &SCFR1_IPS_DIV_MASK ) >>SCFR1_IPS_DIV_SHIFT ; + reg =in_be32 (&im->clk.scfr[0 ]); + ips_div = (reg &SCFR1_IPS_DIV_MASK ) >>SCFR1_IPS_DIV_SHIFT ;if (ips_div !=0 ) { ips_clk = csb_clk / ips_div; }else {/* in case we cannot get a sane IPS divisor, fail gracefully */ ips_clk =0 ; } - pci_div = (im->clk.scfr[0 ] &SCFR1_PCI_DIV_MASK ) >>SCFR1_PCI_DIV_SHIFT ; + + reg =in_be32 (&im->clk.scfr[0 ]); + pci_div = (reg &SCFR1_PCI_DIV_MASK ) >>SCFR1_PCI_DIV_SHIFT ;if (pci_div !=0 ) { pci_clk = csb_clk / pci_div; }else {
drivers/net/mpc512x_fec.c +64 -49
293 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH v2 8/10 MPC512x FEC: get rid of duplicated struct ethernet_regs
In reply to Wolfgang DenkUse existing struct fec512x instead.
--- drivers/net/mpc512x_fec.c | 13 +++-- drivers/net/mpc512x_fec.h | 128 +-------------------------------------------- 2 files changed, 10 insertions(+), 131 deletions(-)
drivers/net/mpc512x_fec.c +8 -5
@@ -1,5 +1,5 @@/* -* (C) Copyright 2003-2007 +* (C) Copyright 2003-2009 * Wolfgang Denk, DENX Software Engineering, wd at denx.de. * * Derived from the MPC8xx FEC driver.
@@ -613,6 +613,7 @@ static int mpc512x_fec_recv (struct eth_device *dev)/********************************************************************/ int mpc512x_fec_initialize (bd_t * bis) { +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ;mpc512x_fec_priv *fec;struct eth_device *dev;int i;
@@ -623,7 +624,7 @@ int mpc512x_fec_initialize (bd_t * bis) dev = (struct eth_device *)malloc (sizeof (*dev));memset (dev,0 ,sizeof *dev); - fec->eth = (ethernet_regs *)MPC512X_FEC ; + fec->eth = &im->fec;# ifndef CONFIG_FEC_10MBIT fec->xcv_type =MII100 ;
@@ -631,7 +632,7 @@ int mpc512x_fec_initialize (bd_t * bis) fec->xcv_type =MII10 ;# endif dev->priv = (void *)fec; - dev->iobase =MPC512X_FEC ; + dev->iobase = (int )&im->fec; dev->init = mpc512x_fec_init; dev->halt = mpc512x_fec_halt; dev->send = mpc512x_fec_send;
@@ -692,7 +693,8 @@ int mpc512x_fec_initialize (bd_t * bis)/********************************************************************/ int fec512x_miiphy_read (char *devname,uint8 phyAddr,uint8 regAddr,uint16 * retVal) { -ethernet_regs *eth = (ethernet_regs *)MPC512X_FEC ; +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +volatile fec512x_t *eth = &im->fec;uint32 reg;/* convenient holder for the PHY register */ uint32 phy;/* convenient holder for the PHY */ int timeout =0xffff ;
@@ -738,7 +740,8 @@ int fec512x_miiphy_read (char *devname, uint8 phyAddr, uint8 regAddr, uint16 * r/********************************************************************/ int fec512x_miiphy_write (char *devname,uint8 phyAddr,uint8 regAddr,uint16 data) { -ethernet_regs *eth = (ethernet_regs *)MPC512X_FEC ; +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +volatile fec512x_t *eth = &im->fec;uint32 reg;/* convenient holder for the PHY register */ uint32 phy;/* convenient holder for the PHY */ int timeout =0xffff ;
drivers/net/mpc512x_fec.h +2 -126
144 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH v2 8/10 MPC512x FEC: get rid of duplicated struct ethernet_regs
Hi Wolfgang,
Quoted 9 lines · Wolfgang Denk
Use existing struct fec512x instead.
Signed-off-by Wolfgang Denk <[email protected]>Cc John Rigby <[email protected]>--- drivers/net/mpc512x_fec.c | 13 +++-- drivers/net/mpc512x_fec.h | 128 +-------------------------------------------- 2 files changed, 10 insertions(+), 131 deletions(-)
I can't apply this patch:
Applying MPC512x FEC: get rid of duplicated struct ethernet_regs
fatal: patch fragment without header at line 206: @@ -180,7 +56,7 @@ typedef struct { Patch failed at 0001.
When you have resolved this problem run "git-am --resolved".
If you would prefer to skip this patch, instead run "git-am --skip".
Any idea what's going on?
regards,
Ben
PATCH v2 8/10 MPC512x FEC: get rid of duplicated struct ethernet_regs
Dear Ben Warren,
Quoted 13 lines · In message <[email protected]> you wrote:
Quoted 9 lines · Wolfgang Denk
Use existing struct fec512x instead.
Signed-off-by Wolfgang Denk <[email protected]>Cc John Rigby <[email protected]>--- drivers/net/mpc512x_fec.c | 13 +++-- drivers/net/mpc512x_fec.h | 128 +-------------------------------------------- 2 files changed, 10 insertions(+), 131 deletions(-)I can't apply this patch:
Quoted 7 lines
Applying MPC512x FEC: get rid of duplicated struct
ethernet_regs
fatal: patch fragment without header at line 206: @@ -180,7 +56,7 @@ typedef struct { Patch failed at 0001.
When you have resolved this problem run "git-am --resolved".
If you would prefer to skip this patch, instead run "git-am --skip".Any idea what's going on?
The whole patch series applies to the "next" branch. I just verified that it still applies cleanly (git-am) against gurrent next.
Error message above makes me think your file might have been corrupted?
If you agree with the patch, then just ACK it, and I pull everything into the 5xxx repo.
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 A right is not what someone gives you; it's what no one can take from you. - Ramsey Clark
PATCH v2 8/10 MPC512x FEC: get rid of duplicated struct ethernet_regs
Quoted 27 lines · Wolfgang Denk
Dear Ben Warren,
Quoted 14 lines · In message <[email protected]> you wrote:
Quoted 10 lines · Wolfgang Denk
Use existing struct fec512x instead.
Signed-off-by Wolfgang Denk <[email protected]>Cc John Rigby <[email protected]>--- drivers/net/mpc512x_fec.c | 13 +++-- drivers/net/mpc512x_fec.h | 128 +-------------------------------------------- 2 files changed, 10 insertions(+), 131 deletions(-)I can't apply this patch:
Quoted 8 lines
Applying MPC512x FEC: get rid of duplicated struct
ethernet_regs
fatal: patch fragment without header at line 206: @@ -180,7 +56,7 @@ typedef struct { Patch failed at 0001.
When you have resolved this problem run "git-am --resolved".
If you would prefer to skip this patch, instead run "git-am --skip".Any idea what's going on?
Quoted 10 lines
The whole patch series applies to the "next" branch. I just verified that it still applies cleanly (git-am) against gurrent next.
Error message above makes me think your file might have been corrupted?
If you agree with the patch, then just ACK it, and I pull everything into the 5xxx repo.
Thanks for taking care of this. I'll look into my repo to figure this out.
Quoted 5 lines
Best regards,
Wolfgang Denk
regards,
Ben
PATCH v2 8/10 MPC512x FEC: get rid of duplicated struct ethernet_regs
Dear Ben,
Quoted 4 lines · in message <[email protected]> you wrote:
Acked-by Ben Warren <[email protected]>Thanks for taking care of this. I'll look into my repo to figure this out.
Thanks. Pushed into the mpc5xxx repo (next branch).
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 "The good Christian should beware of mathematicians and all those who make empty prophecies. The danger already exists that mathematicians have made a covenant with the devil to darken the spirit and confine man in the bonds of Hell." - Saint Augustine
PATCH v2 9/10 MPC512x: remove include/mpc512x.h
In reply to Wolfgang DenkMove needed definitions (register descriptions etc.) from include/mpc512x.h into include/asm-ppc/immap_512x.h.
Instead of using a #define'd register offset, use a function that provides the PATA controller's base address.
All the rest of include/mpc512x.h are register offset definitions which can be eliminated by proper use of C structures.
There are only a few register offsets remaining that are needed in cpu/mpc512x/start.S; for these we provide cpu/mpc512x/asm-offsets.h which is intended as a temporary workaround only. In a later patch this file will be removed, too, and then auto-generated from the respective C structs.
--- common/cmd_ide.c | 4 - cpu/mpc512x/asm-offsets.h | 15 + cpu/mpc512x/cpu.c | 1 - cpu/mpc512x/cpu_init.c | 1 - cpu/mpc512x/i2c.c | 1 - cpu/mpc512x/speed.c | 1 - cpu/mpc512x/start.S | 6 +- drivers/net/mpc512x_fec.c | 52 ++-- drivers/net/mpc512x_fec.h | 27 +- include/asm-ppc/immap_512x.h | 324 +++++++++++++++++++- include/common.h | 3 +- include/configs/mpc5121ads.h | 6 +- include/mpc512x.h | 702 ------------------------------------------ 13 files changed, 383 insertions(+), 760 deletions(-) create mode 100644 cpu/mpc512x/asm-offsets.h delete mode 100644 include/mpc512x.h
common/cmd_ide.c +0 -4
@@ -45,10 +45,6 @@#include <mpc5xxx.h> #endif -#ifdef CONFIG_MPC512X -#include <mpc512x.h> -#endif -#include <ide.h> #include <ata.h>
cpu/mpc512x/asm-offsets.h new file +15 -0
@@ -0,0 +1,15 @@ +/* +* needed for cpu/mpc512x/start.S +* +* These should be auto-generated +*/ +#define LPCS0AW 0x0024 +#define SRAMBAR 0x00C4 +#define SWCRR 0x0904 +#define LPC_OFFSET 0x10000 +#define CS0_CONFIG 0x00000 +#define CS_CTRL 0x00020 +#define CS_CTRL_ME 0x01000000/* CS Master Enable bit */ + +#define EXC_OFF_SYS_RESET 0x0100 +#define _START_OFFSET EXC_OFF_SYS_RESET
cpu/mpc512x/cpu.c +0 -1
@@ -29,7 +29,6 @@#include <common.h> #include <command.h> -#include <mpc512x.h> #include <net.h> #include <netdev.h> #include <asm/processor.h>
cpu/mpc512x/cpu_init.c +0 -1
@@ -25,7 +25,6 @@*/ #include <common.h> -#include <mpc512x.h> #include <asm/io.h> #include <asm/processor.h>
cpu/mpc512x/i2c.c +0 -1
@@ -30,7 +30,6 @@ DECLARE_GLOBAL_DATA_PTR;#ifdef CONFIG_HARD_I2C -#include <mpc512x.h> #include <i2c.h> /* by default set I2C bus 0 active */
cpu/mpc512x/speed.c +0 -1
@@ -26,7 +26,6 @@*/ #include <common.h> -#include <mpc512x.h> #include <command.h> #include <asm/io.h> #include <asm/processor.h>
cpu/mpc512x/start.S +4 -2
@@ -1,7 +1,7 @@ /* * Copyright (C) 1998 Dan Malek <[email protected]> * Copyright (C) 1999 Magnus Damm <kieraypc01.p.y.kie.era.ericsson.se> - * Copyright (C) 2000, 2001, 2002, 2007 Wolfgang Denk <[email protected]> + * Copyright (C) 2000-2009 Wolfgang Denk <[email protected]> * Copyright Freescale Semiconductor, Inc. 2004, 2006. All rights reserved. * * See file CREDITS for list of people who contributed to this
@@ -30,12 +30,14 @@ */ #include <config.h> -#include <mpc512x.h> #include <timestamp.h> #include <version.h> #define CONFIG_521X 1 /* needed for Linux kernel header files*/ +#include <asm/immap_512x.h> +#include "asm-offsets.h" + #include <ppc_asm.tmpl> #include <ppc_defs.h>
drivers/net/mpc512x_fec.c +26 -26
152 lines not on this page · raw message
drivers/net/mpc512x_fec.h +11 -16
@@ -9,23 +9,18 @@#define __MPC512X_FEC_H#include <common.h> -#include <mpc512x.h> - -typedef unsigned long uint32 ; -typedef unsigned short uint16 ; -typedef unsigned char uint8 ;/* Receive & Transmit Buffer Descriptor definitions */ typedef struct BufferDescriptor { -uint16 status; -uint16 dataLength; -uint32 dataPointer; +u16 status; +u16 dataLength; +u32 dataPointer; }FEC_RBD ;typedef struct { -uint16 status; -uint16 dataLength; -uint32 dataPointer; +u16 status; +u16 dataLength; +u32 dataPointer; }FEC_TBD ;/* private structure */
@@ -46,7 +41,7 @@ typedef enum {#define FEC_BUFFER_SIZE ((FEC_MAX_FRAME_LEN + 0x10) & (~0xf))typedef struct { -uint8 frame[FEC_BUFFER_SIZE ]; +u8 frame[FEC_BUFFER_SIZE ]; }mpc512x_frame ; typedef struct {
@@ -59,10 +54,10 @@ typedef struct {volatile fec512x_t *eth;xceiver_type xcv_type;/* transceiver type */ mpc512x_buff_descs *bdBase;/* BD rings and recv buffer */ -uint16 rbdIndex;/* next receive BD to read */ -uint16 tbdIndex;/* next transmit BD to send */ -uint16 usedTbdIndex;/* next transmit BD to clean */ -uint16 cleanTbdNum;/* the number of available transmit BDs */ +u16 rbdIndex;/* next receive BD to read */ +u16 tbdIndex;/* next transmit BD to send */ +u16 usedTbdIndex;/* next transmit BD to clean */ +u16 cleanTbdNum;/* the number of available transmit BDs */ } mpc512x_fec_priv;/* RBD bits definitions */
include/asm-ppc/immap_512x.h +323 -1
395 lines not on this page · raw message
include/common.h +1 -2
@@ -1,5 +1,5 @@/* -* (C) Copyright 2000-2007 +* (C) Copyright 2000-2009 * Wolfgang Denk, DENX Software Engineering, wd at denx.de. * * See file CREDITS for list of people who contributed to this
@@ -66,7 +66,6 @@ typedef volatile unsigned char vu_char;#elif defined(CONFIG_MPC5xxx)#include <mpc5xxx.h> #elif defined(CONFIG_MPC512X ) -#include <mpc512x.h> #include <asm/immap_512x.h> #elif defined(CONFIG_MPC8220 )#include <asm/immap_8220.h>
include/configs/mpc5121ads.h +3 -3
@@ -1,5 +1,5 @@/* -* (C) Copyright 2007, 2008 DENX Software Engineering +* (C) Copyright 2007-2009 DENX Software Engineering * * See file CREDITS for list of people who contributed to this * project.
@@ -519,7 +519,7 @@#define CONFIG_SYS_IDE_MAXDEVICE 2/* max. 1 drive per IDE bus */ #define CONFIG_SYS_ATA_IDE0_OFFSET 0x0000 -#define CONFIG_SYS_ATA_BASE_ADDR MPC512X_PATA +#define CONFIG_SYS_ATA_BASE_ADDR get_pata_base()/* Offset for data I/O RefMan MPC5121EE Table 28-10 */ #define CONFIG_SYS_ATA_DATA_OFFSET (0x00A0)
@@ -533,7 +533,7 @@/* Interval between registers */ #define CONFIG_SYS_ATA_STRIDE 4 -#define ATA_BASE_ADDR MPC512X_PATA +#define ATA_BASE_ADDR get_pata_base()/* * Control register bit definitions
include/mpc512x.h deleted +0 -702
702 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH v2 10/10 MPC512x: add support for ARIA board
In reply to Wolfgang DenkARIA is a MPC5121E based COM Express module by Dave/DENX.
--- MAINTAINERS | 2 + MAKEALL | 1 + Makefile | 4 +- board/davedenx/aria/Makefile | 53 ++++ board/davedenx/aria/aria.c | 317 +++++++++++++++++++++++ board/davedenx/aria/config.mk | 23 ++ include/configs/aria.h | 554 +++++++++++++++++++++++++++++++++++++++++ 7 files changed, 953 insertions(+), 1 deletions(-) create mode 100644 board/davedenx/aria/Makefile create mode 100644 board/davedenx/aria/aria.c create mode 100644 board/davedenx/aria/config.mk create mode 100644 include/configs/aria.h
MAINTAINERS +2 -0
@@ -75,6 +75,8 @@ Wolfgang Denk <[email protected]> IceCube_5100 MGT5100 IceCube_5200 MPC5200 + ARIA MPC5121e + AMX860 MPC860 ETX094 MPC850 FPS850L MPC850
MAKEALL +1 -0
@@ -77,6 +77,7 @@ LIST_5xxx=" \ ######################################################################### LIST_512x=" \ + aria \ mpc5121ads \ "
Makefile +3 -1
@@ -812,6 +812,9 @@ v38b_config: unconfig ## MPC512x Systems ######################################################################### +aria_config: unconfig + @$(MKCONFIG) -a aria ppc mpc512x aria davedenx + mpc5121ads_config \ mpc5121ads_rev2_config \ : unconfig
@@ -821,7 +824,6 @@ mpc5121ads_rev2_config \ fi @$(MKCONFIG) -a mpc5121ads ppc mpc512x mpc5121ads freescale - ######################################################################### ## MPC8xx Systems #########################################################################
board/davedenx/aria/Makefile new file +53 -0
53 lines not on this page · raw message
board/davedenx/aria/aria.c new file +317 -0
317 lines not on this page · raw message
board/davedenx/aria/config.mk new file +23 -0
@@ -0,0 +1,23 @@ +# +# (C) Copyright 2009 Wolfgang Denk <[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 +# + +TEXT_BASE = 0xFFF00000
include/configs/aria.h new file +554 -0
554 lines not on this page · raw message
Signature · 1 line
1.6.0.6
PATCH v2 10/10 MPC512x: add support for ARIA board
Hi Wolfgang,
Quoted 4 lines · On Saturday 16 May 2009 10:47:46 Wolfgang Denk wrote:
ARIA is a MPC5121E based COM Express module by Dave/DENX.
Signed-off-by Wolfgang Denk <[email protected]>Cc John Rigby <[email protected]>
Please find some mostly nitpicking comments below. (Sorry about the late review - I just stumbled over a few issue while using this port as basis for a port for an MPC5123 board from esd).
<snip>
Quoted 21 lines
board/davedenx/aria/Makefile new file +15
-0@@ -0,0 +1,53 @@ +# +# (C) Copyright 2009 Wolfgang Denk <[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.
board/davedenx/aria/Makefile line 25
Quoted 10 lines
board/davedenx/aria/Makefile new file +10
-0+# +# 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 $(TOPDIR)/config.mk + +$(shell mkdir -p $(OBJTREE)/board/freescale/common)
Is this really needed?
board/davedenx/aria/Makefile line 38
Quoted 13 lines
board/davedenx/aria/Makefile new file +13
-0+ +LIB = $(obj)lib$(BOARD).a + +COBJS-y := $(BOARD).o + +COBJS := $(COBJS-y) +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) +SOBJS := $(addprefix $(obj),$(SOBJS)) + +$(LIB): $(obj).depend $(OBJS) + + $(AR) $(ARFLAGS) $@ $(OBJS)
Please remove this empty line above.
Quoted 119 lines
board/davedenx/aria/Makefile new file +15
-0+ +clean: + rm -f $(SOBJS) $(OBJS) + +distclean: clean + rm -f $(LIB) core *.bak $(obj).depend + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +#########################################################################board/davedenx/aria/aria.c new file +98
-0@@ -0,0 +1,317 @@ +/* +* (C) Copyright 2009 Wolfgang Denk <[email protected]> +* (C) Copyright 2009 Dave Srl www.dave.eu +* +* 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 <asm/bitops.h> +#include <command.h> +#include <asm/io.h> +#include <asm/processor.h> +#include <fdt_support.h> +#ifdef CONFIG_MISC_INIT_R +#include <i2c.h> +#endif + +DECLARE_GLOBAL_DATA_PTR ; + +extern void ide_set_reset (int idereset); + +/* Clocks in use */ +#define SCCR1_CLOCKS_EN (CLOCK_SCCR1_CFG_EN | \ + CLOCK_SCCR1_LPC_EN | \ + CLOCK_SCCR1_PSC_EN(CONFIG_PSC_CONSOLE) | \ + CLOCK_SCCR1_PSCFIFO_EN | \ + CLOCK_SCCR1_DDR_EN | \ + CLOCK_SCCR1_FEC_EN | \ + CLOCK_SCCR1_PATA_EN | \ + CLOCK_SCCR1_PCI_EN | \ + CLOCK_SCCR1_TPR_EN) + +#define SCCR2_CLOCKS_EN (CLOCK_SCCR2_MEM_EN | \ + CLOCK_SCCR2_SPDIF_EN | \ + CLOCK_SCCR2_DIU_EN | \ + CLOCK_SCCR2_I2C_EN) + +#define CSAW_START (start) ((start) & 0xFFFF0000) +#define CSAW_STOP (start, size) (((start) + (size) - 1) >> 16) + +long int fixed_sdram (void ); + +int board_early_init_f (void ) +{ +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +u32 spridr; + +/* +* Initialize Local Window for the On Board FPGA access +*/ +out_be32 (&im->sysconf.lpcs2aw, +CSAW_START (CONFIG_SYS_ARIA_FPGA_BASE ) | +CSAW_STOP (CONFIG_SYS_ARIA_FPGA_BASE ,CONFIG_SYS_ARIA_FPGA_SIZE ) + ); +out_be32 (&im->lpc.cs_cfg[2 ],CONFIG_SYS_CS2_CFG ); + +/* +* According to MPC5121e RM, configuring local access windows should +* be followed by a dummy read of the config register that was +* modified last and an isync +*/ +in_be32 (&im->sysconf.lpcs2aw); + __asm__ __volatile__ ("isync" ); + +/* +* Initialize Local Window for the On Board SRAM access +*/ +out_be32 (&im->sysconf.lpcs6aw, +CSAW_START (CONFIG_SYS_ARIA_SRAM_BASE ) | +CSAW_STOP (CONFIG_SYS_ARIA_SRAM_BASE ,CONFIG_SYS_ARIA_SRAM_SIZE ) + ); +out_be32 (&im->lpc.cs_cfg[6 ],CONFIG_SYS_CS6_CFG ); + +/* +* According to MPC5121e RM, configuring local access windows should +* be followed by a dummy read of the config register that was +* modified last and an isync +*/ +in_be32 (&im->sysconf.lpcs6aw); + __asm__ __volatile__ ("isync" ); +
board/davedenx/aria/aria.c line 108
Quoted 10 lines
board/davedenx/aria/aria.c new file +10
-0+/* +* Configure Flash Speed +*/ +out_be32 (&im->lpc.cs_cfg[0 ],CONFIG_SYS_CS0_CFG ); + + spridr =in_be32 (&im->sysconf.spridr); + +if (SVR_MJREV (spridr) >=2 ) { +out_be32 (&im->lpc.altr,CONFIG_SYS_CS_ALETIMING ); + }
Curly braces can be removed. And I suggest to add an empty line here.
Quoted 114 lines
board/davedenx/aria/aria.c new file +62
-0+/* +* Enable clocks +*/ +out_be32 (&im->clk.sccr[0 ],SCCR1_CLOCKS_EN ); +out_be32 (&im->clk.sccr[1 ],SCCR2_CLOCKS_EN ); +#if defined(CONFIG_IIM ) || defined(CONFIG_CMD_FUSE ) +setbits_be32 (&im->clk.sccr[1 ],CLOCK_SCCR2_IIM_EN ); +#endif + +return 0 ; +} + +phys_size_t initdram (int board_type) +{ +return fixed_sdram (); +} + +/* +* fixed sdram init: +* The board doesn't use memory modules that have serial presence +* detect or similar mechanism for discovery of the DRAM settings +*/ +long int fixed_sdram (void ) +{ +volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR ; +u32 msize =CONFIG_SYS_DDR_SIZE *1024 *1024 ; +u32 msize_log2 =__ilog2 (msize); +u32 i; + +/* Initialize IO Control */ +out_be32 (&im->io_ctrl.io_control_mem,IOCTRL_MUX_DDR ); + +/* Initialize DDR Local Window */ +out_be32 (&im->sysconf.ddrlaw.bar,CONFIG_SYS_DDR_BASE &0xFFFFF000 ); +out_be32 (&im->sysconf.ddrlaw.ar, msize_log2 -1 ); + +/* +* According to MPC5121e RM, configuring local access windows should +* be followed by a dummy read of the config register that was +* modified last and an isync +*/ +in_be32 (&im->sysconf.ddrlaw.ar); + __asm__ __volatile__ ("isync" ); + +/* Enable DDR */ +out_be32 (&im->mddrc.ddr_sys_config,CONFIG_SYS_MDDRC_SYS_CFG_EN ); + +/* Initialize DDR Priority Manager */ +out_be32 (&im->mddrc.prioman_config1,CONFIG_SYS_MDDRCGRP_PM_CFG1 ); +out_be32 (&im->mddrc.prioman_config2,CONFIG_SYS_MDDRCGRP_PM_CFG2 ); +out_be32 (&im->mddrc.hiprio_config,CONFIG_SYS_MDDRCGRP_HIPRIO_CFG ); +out_be32 (&im->mddrc.lut_table0_main_upper,CONFIG_SYS_MDDRCGRP_LUT0_MU ); +out_be32 (&im->mddrc.lut_table0_main_lower,CONFIG_SYS_MDDRCGRP_LUT0_ML ); +out_be32 (&im->mddrc.lut_table1_main_upper,CONFIG_SYS_MDDRCGRP_LUT1_MU ); +out_be32 (&im->mddrc.lut_table1_main_lower,CONFIG_SYS_MDDRCGRP_LUT1_ML ); +out_be32 (&im->mddrc.lut_table2_main_upper,CONFIG_SYS_MDDRCGRP_LUT2_MU ); +out_be32 (&im->mddrc.lut_table2_main_lower,CONFIG_SYS_MDDRCGRP_LUT2_ML ); +out_be32 (&im->mddrc.lut_table3_main_upper,CONFIG_SYS_MDDRCGRP_LUT3_MU ); +out_be32 (&im->mddrc.lut_table3_main_lower,CONFIG_SYS_MDDRCGRP_LUT3_ML ); +out_be32 (&im->mddrc.lut_table4_main_upper,CONFIG_SYS_MDDRCGRP_LUT4_MU ); +out_be32 (&im->mddrc.lut_table4_main_lower,CONFIG_SYS_MDDRCGRP_LUT4_ML ); + out_be32(&im->mddrc.lut_table0_alternate_upper,
CONFIG_SYS_MDDRCGRP_LUT0_AU);board/davedenx/aria/aria.c new file +1
-0+ out_be32(&im->mddrc.lut_table0_alternate_lower,
CONFIG_SYS_MDDRCGRP_LUT0_AL);board/davedenx/aria/aria.c new file +1
-0+ out_be32(&im->mddrc.lut_table1_alternate_upper,
CONFIG_SYS_MDDRCGRP_LUT1_AU);board/davedenx/aria/aria.c new file +1
-0+ out_be32(&im->mddrc.lut_table1_alternate_lower,
CONFIG_SYS_MDDRCGRP_LUT1_AL);board/davedenx/aria/aria.c new file +1
-0+ out_be32(&im->mddrc.lut_table2_alternate_upper,
CONFIG_SYS_MDDRCGRP_LUT2_AU);board/davedenx/aria/aria.c new file +1
-0+ out_be32(&im->mddrc.lut_table2_alternate_lower,
CONFIG_SYS_MDDRCGRP_LUT2_AL);board/davedenx/aria/aria.c new file +1
-0+ out_be32(&im->mddrc.lut_table3_alternate_upper,
CONFIG_SYS_MDDRCGRP_LUT3_AU);board/davedenx/aria/aria.c new file +1
-0+ out_be32(&im->mddrc.lut_table3_alternate_lower,
CONFIG_SYS_MDDRCGRP_LUT3_AL);board/davedenx/aria/aria.c new file +1
-0+ out_be32(&im->mddrc.lut_table4_alternate_upper,
CONFIG_SYS_MDDRCGRP_LUT4_AU);board/davedenx/aria/aria.c new file +1
-0+ out_be32(&im->mddrc.lut_table4_alternate_lower,
CONFIG_SYS_MDDRCGRP_LUT4_AL); +board/davedenx/aria/aria.c new file +33
-0+/* Initialize MDDRC */ +out_be32 (&im->mddrc.ddr_sys_config,CONFIG_SYS_MDDRC_SYS_CFG ); +out_be32 (&im->mddrc.ddr_time_config0,CONFIG_SYS_MDDRC_TIME_CFG0 ); +out_be32 (&im->mddrc.ddr_time_config1,CONFIG_SYS_MDDRC_TIME_CFG1 ); +out_be32 (&im->mddrc.ddr_time_config2,CONFIG_SYS_MDDRC_TIME_CFG2 ); + +/* Initialize DDR */ +for (i =0 ; i <10 ; i++) +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP ); + +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_PCHG_ALL ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_RFSH ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_RFSH ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_INIT_DEV_OP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_EM2 ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_PCHG_ALL ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_EM2 ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_EM3 ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_EN_DLL ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_INIT_DEV_OP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_PCHG_ALL ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_RFSH ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_INIT_DEV_OP ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_OCD_DEFAULT ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_PCHG_ALL ); +out_be32 (&im->mddrc.ddr_command,CONFIG_SYS_MICRON_NOP ); + +/* Start MDDRC */
board/davedenx/aria/aria.c line 223
Quoted 10 lines
board/davedenx/aria/aria.c new file +10
-0+out_be32 (&im->mddrc.ddr_time_config0,CONFIG_SYS_MDDRC_TIME_CFG0_RUN ); +out_be32 (&im->mddrc.ddr_sys_config,CONFIG_SYS_MDDRC_SYS_CFG_RUN ); + +return msize; +} + +int misc_init_r (void ) +{ +u32 tmp; +extern int mpc5121_diu_init (void );
Please move prototype declaration to top of file or to some header.
Quoted 10 lines
board/davedenx/aria/aria.c new file +10
-0+ +/* we use I2C-2 for on-board eeprom */ +i2c_set_bus_num (2 ); + + tmp =in_be32 ((u32 *)CONFIG_SYS_ARIA_FPGA_BASE ); +printf ("FPGA: %u-%u.%u.%u\n" , + (tmp &0xFF000000 ) >>24 , + (tmp &0x00FF0000 ) >>16 , + (tmp &0x0000FF00 ) >>8 , + tmp & 0x000000FF
board/davedenx/aria/aria.c line 243
Quoted 10 lines
board/davedenx/aria/aria.c new file +10
-0+ ); + +#ifdef CONFIG_FSL_DIU_FB +#if !(defined(CONFIG_VIDEO ) || defined(CONFIG_CFB_CONSOLE )) +mpc5121_diu_init (); +#endif +#endif + +return 0 ; +}
Insert empty line here.
Quoted 53 lines
board/davedenx/aria/aria.c new file +53
-0+static iopin_t ioregs_init[] = { +/* +* FEC +*/ + +/* FEC on PSCx_x*/ + { + offsetof(struct ioctrl512x , io_control_psc0_0),5 ,0 , +IO_PIN_FMUX (1 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) | +IO_PIN_PUE (0 ) |IO_PIN_ST (0 ) |IO_PIN_DS (3 ) + }, + { + offsetof(struct ioctrl512x , io_control_psc1_0),10 ,0 , +IO_PIN_FMUX (1 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) | +IO_PIN_PUE (0 ) |IO_PIN_ST (0 ) |IO_PIN_DS (3 ) + }, + { + offsetof(struct ioctrl512x , io_control_spdif_txclk),3 ,0 , +IO_PIN_FMUX (1 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) | +IO_PIN_PUE (0 ) |IO_PIN_ST (0 ) |IO_PIN_DS (3 ) + }, + +/* +* DIU +*/ +/* FUNC2=DIU CLK */ + { + offsetof(struct ioctrl512x , io_control_psc6_0),1 ,0 , +IO_PIN_FMUX (2 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) | +IO_PIN_PUE (0 ) |IO_PIN_ST (1 ) |IO_PIN_DS (3 ) + }, +/* FUNC2=DIU_HSYNC */ + { + offsetof(struct ioctrl512x , io_control_psc6_1),1 ,0 , +IO_PIN_FMUX (2 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) | +IO_PIN_PUE (0 ) |IO_PIN_ST (0 ) |IO_PIN_DS (3 ) + }, +/* FUNC2=DIUVSYNC Sets Next 26 to DIU Pads */ + { + offsetof(struct ioctrl512x , io_control_psc6_4),26 ,0 , +IO_PIN_FMUX (2 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) | +IO_PIN_PUE (0 ) |IO_PIN_ST (0 ) |IO_PIN_DS (3 ) + }, +/* +* On board SRAM +*/ +/* FUNC2=/LPC CS6 */ + { + offsetof(struct ioctrl512x , io_control_j1850_rx),1 ,0 , +IO_PIN_FMUX (2 ) |IO_PIN_HOLD (0 ) |IO_PIN_PUD (0 ) | +IO_PIN_PUE (1 ) |IO_PIN_ST (1 ) |IO_PIN_DS (3 ) + }, +};
board/davedenx/aria/aria.c line 306
Quoted 10 lines
board/davedenx/aria/aria.c new file +10
-0+ + +int checkboard (void ) +{ +puts ("Board: ARIA\n" ); + +/* initialize function mux & slew rate IO inter alia on IO Pins */ + +iopin_initialize (ioregs_init, +sizeof (ioregs_init) /sizeof (ioregs_init[0 ]));
Please use ARRAY_SIZE(ioregs_init) here.
Thanks.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
PATCH v2 10/10 MPC512x: add support for ARIA board
Dear Stefan,
Quoted 10 lines · In message <[email protected]> you wrote:
Quoted 4 lines · On Saturday 16 May 2009 10:47:46 Wolfgang Denk wrote:
ARIA is a MPC5121E based COM Express module by Dave/DENX.
Signed-off-by Wolfgang Denk <[email protected]>Cc John Rigby <[email protected]>Please find some mostly nitpicking comments below. (Sorry about the late review - I just stumbled over a few issue while using this port as basis for a port for an MPC5123 board from esd).
Thanks for the review.
Quoted 27 lines
<snip>
Quoted 25 lines
board/davedenx/aria/Makefile new file +19
-0@@ -0,0 +1,53 @@ +# +# (C) Copyright 2009 Wolfgang Denk <[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,
Quoted 8 lines
board/davedenx/aria/Makefile line 25
Quoted 6 lines
board/davedenx/aria/Makefile new file +6
-0+# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk + +$(shell mkdir -p $(OBJTREE)/board/freescale/common)Is this really needed?
Yes, it is - but not here. It must be added to cpu/mpc512x/Makefile, i. e. go into the "mpc512x: Move common files to share them by several boards" commit.
Quoted 5 lines
board/davedenx/aria/Makefile line 38
Quoted 3 lines
board/davedenx/aria/Makefile new file +3
-0+$(LIB): $(obj).depend $(OBJS) + + $(AR) $(ARFLAGS) $@ $(OBJS)Please remove this empty line above.
Will do.
Quoted 5 lines
Quoted 5 lines
board/davedenx/aria/aria.c new file +0
-0
...
Quoted 5 lines
board/davedenx/aria/aria.c line 108
Quoted 3 lines
board/davedenx/aria/aria.c new file +3
-0+if (SVR_MJREV (spridr) >=2 ) { +out_be32 (&im->lpc.altr,CONFIG_SYS_CS_ALETIMING ); + }Curly braces can be removed. And I suggest to add an empty line here.
Will do.
...
Quoted 6 lines
board/davedenx/aria/aria.c line 223
Quoted 4 lines
board/davedenx/aria/aria.c new file +4
-0+int misc_init_r (void ) +{ +u32 tmp; +extern int mpc5121_diu_init (void );Please move prototype declaration to top of file or to some header.
Moved to top of file as I did't find a good header.
Quoted 10 lines
board/davedenx/aria/aria.c line 243
Quoted 8 lines
board/davedenx/aria/aria.c new file +8
-0+#ifdef CONFIG_FSL_DIU_FB +#if !(defined(CONFIG_VIDEO ) || defined(CONFIG_CFB_CONSOLE )) +mpc5121_diu_init (); +#endif +#endif + +return 0 ; +}Insert empty line here.
Done.
...
Quoted 10 lines
board/davedenx/aria/aria.c line 306
Quoted 8 lines
board/davedenx/aria/aria.c new file +8
-0+int checkboard (void ) +{ +puts ("Board: ARIA\n" ); + +/* initialize function mux & slew rate IO inter alia on IO Pins */ + +iopin_initialize (ioregs_init, +sizeof (ioregs_init) /sizeof (ioregs_init[0 ]));Please use
ARRAY_SIZE(ioregs_init)here.
Done.
Same changes applied to board/freescale/mpc5121ads/mpc5121ads.c as well.
As the modifications are mostly cosmetical only, I will push the changes directly into the u-boot-mpc5xxx repo, without posting new patches. Hope this is OK.
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 They're usually so busy thinking about what happens next that the only time they ever find out what is happening now is when they come to look back on it. - Terry Pratchett, _Wyrd Sisters_
cover Rework MPC512x Support
In reply to Wolfgang DenkDear Mr. Denk!
In article <[email protected]>, wd at denx.de says...
Quoted 6 lines
The following patch series includes a heavy rework of the existing code for MPC512x processors...
...
[PATCH 01/29] mpc512x: change cpu/mpc512x/Makefile to useKconfigstyle [PATCH 02/29] mpc512x: Move common files to share them by several boards [PATCH 03/29]cpu/mpc512x/pci.c: minor coding style cleanup
Quoted 8 lines
[PATCH 04/29]
cpu/mpc512x/diu.c: fix warning: assignment from incompatible pointer type [PATCH 05/29] Rename ads5121 board into mpc5121ads
[PATCH 06/29] MPC512x: add more hardware description toimmap_512x.h[PATCH 07/29] mpc5121ads: use I/O accessors instead of pointer accesses [PATCH 08/29] MPC512x: add support for ARIA board
[PATCH 09/29]cpu/mpc512x/iopin.c: convert to use I/O acessors.
[PATCH 10/29]cpu/mpc512x/iopin.c: remove redundant include of <asm/immap_512x.h> [PATCH 11/29] MPC512x: prepare removal ofinclude/mpc512x.h
I have tested the ELPIDA memory patch from Martha Marx from Feb. 20th 2009 for the ADS5121 and it worked - and even solved a DRAM init problem at power on (u-boot hangs at power on when board is warmed up). Is there a chance to include that patch too?
Best regards,
Arno Fischer
cover Rework MPC512x Support
Dear Arno Fischer,
Quoted 6 lines · in message <[email protected]> you wrote:
I have tested the ELPIDA memory patch from Martha Marx from Feb. 20th 2009 for the ADS5121 and it worked - and even solved a DRAM init problem at power on (u-boot hangs at power on when board is warmed up). Is there a chance to include that patch too?
As you can see in this posting:
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/54983/focus=55035
I asked Martha to perform a number or relatively small and simple changes, but she never responded.
When these changes are implemented and the patches rebased against current code, they will be reconsidered.
As is, they are dropped.
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
In any group of employed individuals the only naturally early riser
is _always_ the office manager, who will _always_ leave reproachful
little notes ... on the desks of their subordinates.
- Terry Pratchett, _Lords and Ladies_