Skip to contentSkip to conversation

Add mpc5125ads board and processor to the mpc512x family

PATCH New Martha M Stan 3 participants 3 messages Sep 21, 2009 – Oct 3, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add mpc5125ads board and processor to the mpc512x family

---
 Makefile                                |    3 +
 board/freescale/mpc5125ads/Makefile     |   53 +++
 board/freescale/mpc5125ads/config.mk    |   23 ++
 board/freescale/mpc5125ads/mpc5125ads.c |  420 +++++++++++++++++++++
 board/freescale/mpc5125ads/u-boot.lds   |  122 ++++++
 cpu/mpc512x/asm-offsets.h               |    6 +
 cpu/mpc512x/cpu.c                       |    3 +
 cpu/mpc512x/fixed_sdram.c               |    8 +-
 cpu/mpc512x/iopin.c                     |   17 +-
 cpu/mpc512x/serial.c                    |   23 +-
 cpu/mpc512x/start.S                     |   15 +
 drivers/net/mpc512x_fec.c               |   47 ++-
 include/asm-ppc/immap_512x.h            |  618 +++++++++++++++++++++----------
 include/configs/mpc5121ads.h            |    1 +
 include/configs/mpc5125ads.h            |  501 +++++++++++++++++++++++++
 15 files changed, 1638 insertions(+), 222 deletions(-)
 create mode 100644 board/freescale/mpc5125ads/Makefile
 create mode 100644 board/freescale/mpc5125ads/config.mk
 create mode 100644 board/freescale/mpc5125ads/mpc5125ads.c
 create mode 100644 board/freescale/mpc5125ads/u-boot.lds
 create mode 100644 include/configs/mpc5125ads.h
Makefile +3 -0
index 0b61d05..a8ec984 100644
@@ -844,6 +844,9 @@ mpc5121ads_rev2_config	\
 	fi
 	@$(MKCONFIG) -a mpc5121ads ppc mpc512x mpc5121ads freescale
 
+mpc5125ads_config:	unconfig
+	@$(MKCONFIG) -a mpc5125ads ppc mpc512x mpc5125ads freescale
+
 #########################################################################
 ## MPC8xx Systems
 #########################################################################
board/freescale/mpc5125ads/Makefile new file +53 -0

53 lines not on this page · raw message

board/freescale/mpc5125ads/config.mk new file +23 -0
new file mode 100644
index 0000000..14998f4
@@ -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/mpc5125ads/mpc5125ads.c new file +420 -0

420 lines not on this page · raw message

board/freescale/mpc5125ads/u-boot.lds new file +122 -0

122 lines not on this page · raw message

cpu/mpc512x/asm-offsets.h +6 -0
index 4b14778..b79c656 100644
@@ -11,5 +11,11 @@
 #define CS_CTRL			0x00020
 #define CS_CTRL_ME		0x01000000	/* CS Master Enable bit */
 
+/* needed for pin muxing in MPC5125 */
+#define IOCTRL_OFFSET	0xA000
+#define IOCTRL_LPC_AX03	0x09
+#define IOCTRL_I2C1_SCL	0x4f
+#define IOCTRL_I2C1_SDA	0x50
+
 #define EXC_OFF_SYS_RESET	0x0100
 #define	_START_OFFSET		EXC_OFF_SYS_RESET
cpu/mpc512x/cpu.c +3 -0
index 42ccd81..12d21f6 100644
@@ -53,6 +53,9 @@ int checkcpu (void)
 	case SPR_5121E:
 		puts ("MPC5121e ");
 		break;
+	case SPR_5125:
+		puts ("MPC5125 ");
+		break;	
 	default:
 		printf ("Unknown part ID %08x ", spridr & 0xffff0000);
 	}
cpu/mpc512x/fixed_sdram.c +7 -1
index 63a3035..12ac44d 100644
@@ -36,6 +36,7 @@ u32 default_mddrc_config[4] = {
 };
 
 u32 default_init_seq[] = {
+#ifndef CONFIG_SYS_DDR_OVRIDE_DEF
 	CONFIG_SYS_DDRCMD_NOP,
 	CONFIG_SYS_DDRCMD_NOP,
 	CONFIG_SYS_DDRCMD_NOP,
@@ -67,6 +68,7 @@ u32 default_init_seq[] = {
 	CONFIG_SYS_DDRCMD_OCD_DEFAULT,
 	CONFIG_SYS_DDRCMD_PCHG_ALL,
 	CONFIG_SYS_DDRCMD_NOP
+#endif
 };
 
 /*
@@ -90,7 +92,11 @@ long int fixed_sdram(u32 *mddrc_config, u32 *dram_init_seq, int seq_sz)
 	}
 
 	/* Initialize IO Control */
-	out_be32(&im->io_ctrl.io_control_mem, IOCTRL_MUX_DDR);
+#ifdef CONFIG_MPC5125
+	out_8(&im->io_ctrl.io_control_mem, IOCTRL_MUX_DDR);
+#else
+  	out_be32(&im->io_ctrl.io_control_mem, IOCTRL_MUX_DDR);
+#endif
 
 	/* Initialize DDR Local Window */
 	out_be32(&im->sysconf.ddrlaw.bar, CONFIG_SYS_DDR_BASE & 0xFFFFF000);
cpu/mpc512x/iopin.c +15 -2
index be20947..ab5dd1c 100644
@@ -28,15 +28,27 @@
 void iopin_initialize(iopin_t *ioregs_init, int len)
 {
 	short i, j, p;
-	u32 *reg;
 	immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
 
-	reg = (u32 *)&(im->io_ctrl);
+#ifdef CONFIG_MPC5125
+	u8 *reg =(u8 *)&(im->io_ctrl);
+#else
+	u32 *reg =(u32 *)&(im->io_ctrl);
+#endif
 
 	if (sizeof(ioregs_init) == 0)
 		return;
 
 	for (i = 0; i < len; i++) {
+#ifdef CONFIG_MPC5125
+		for (p = 0, j = ioregs_init[i].p_offset;
+			p < ioregs_init[i].nr_pins; p++, j++) {
+			if (ioregs_init[i].bit_or)
+				setbits_8(&(reg[j]), ioregs_init[i].val);
+			else
+				out_8(&reg[j], ioregs_init[i].val);
+		}
+#else
 		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)
@@ -44,6 +56,7 @@ void iopin_initialize(iopin_t *ioregs_init, int len)
 			else
 				out_be32 (reg + j, ioregs_init[i].val);
 		}
+#endif
 	}
 	return;
 }
cpu/mpc512x/serial.c +17 -6
index 4fc4693..c2bd29c 100644
@@ -64,12 +64,17 @@ void serial_setbrg(void)
 {
 	volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
 	volatile psc512x_t *psc = (psc512x_t *) &im->psc[CONFIG_PSC_CONSOLE];
-	unsigned long baseclk, div;
+	unsigned long div;
 
 	/* calculate dividor for setting PSC CTUR and CTLR registers */
-	baseclk = (gd->ips_clk + 8) / 16;
-	div = (baseclk + (gd->baudrate / 2)) / gd->baudrate;
 
+#ifndef CONFIG_MPC5125
+	unsigned long baseclk = (gd->ips_clk + 8) / 16;
+
+	div = (baseclk + (gd->baudrate / 2)) / gd->baudrate;
+#else
+	div = gd->ips_clk/(16 * gd->baudrate);
+#endif
 	out_8(&psc->ctur, (div >> 8) & 0xff);
 	out_8(&psc->ctlr,  div & 0xff); /* set baudrate */
 }
@@ -81,9 +86,10 @@ int serial_init(void)
 
 	fifo_init (psc);
 
+#ifndef CONFIG_MPC5125
 	/* set MR register to point to MR1 */
 	out_8(&psc->command, PSC_SEL_MODE_REG_1);
-
+#endif
 	/* disable Tx/Rx */
 	out_8(&psc->command, PSC_TX_DISABLE | PSC_RX_DISABLE);
 
@@ -93,12 +99,17 @@ int serial_init(void)
 	/* switch to UART mode */
 	out_be32(&psc->sicr, 0);
 
+
+	/* configure parity, bit length and so on in mode registers */
+#ifdef CONFIG_MPC5125
+	out_8(&psc->mr1, PSC_MODE_8_BITS | PSC_MODE_PARNONE);
+	out_8(&psc->mr2, PSC_MODE_1_STOPBIT);
+#else
 	/* mode register points to mr1 */
-	/* configure parity, bit length and so on in mode register 1*/
 	out_8(&psc->mode, PSC_MODE_8_BITS | PSC_MODE_PARNONE);
 	/* now, mode register points to mr2 */
 	out_8(&psc->mode, PSC_MODE_1_STOPBIT);
-
+#endif
 	/* set baudrate */
 	serial_setbrg();
 
cpu/mpc512x/start.S +15 -0
index 2e3f645..61e3b50 100644
@@ -243,6 +243,21 @@ boot_cold:
 	lis     r4, CONFIG_SYS_CS0_CFG at h
 	ori     r4, r4, CONFIG_SYS_CS0_CFG at l
 	stw     r4, CS0_CONFIG(r3)
+#ifdef CONFIG_MPC5125
+	/* CS2 FUNC MUX must be done before CS is enabled */
+	lis     r5, (CONFIG_SYS_IMMR + IOCTRL_OFFSET)@h
+	ori     r5, r5, (CONFIG_SYS_IMMR + IOCTRL_OFFSET)@l
+
+	li	r4, CONFIG_SYS_IOCTRL_MUX_CS2
+	stb	r4, IOCTRL_LPC_AX03(r5)
+
+	/* change the pin muxing on PSC9 if it is being used as console */
+#if (CONFIG_PSC_CONSOLE == 9)
+	li	r4, CONFIG_SYS_IOCTRL_MUX_PSC9
+	stb	r4, IOCTRL_I2C1_SCL(r5) 
+	stb	r4, IOCTRL_I2C1_SDA(r5)
+#endif
+#endif
 
 	/* Master enable all CS's */
 	lis	r4, CS_CTRL_ME at h
drivers/net/mpc512x_fec.c +38 -9

102 lines not on this page · raw message

include/asm-ppc/immap_512x.h +414 -204

708 lines not on this page · raw message

include/configs/mpc5121ads.h +1 -0
index ebc518c..35e69c4 100644
@@ -28,6 +28,7 @@
 #define __CONFIG_H
 
 #define CONFIG_MPC5121ADS 1
+
 /*
  * Memory map for the MPC5121ADS board:
  *
include/configs/mpc5125ads.h new file +501 -0

501 lines not on this page · raw message

Signature · 1 line
1.5.2.4
#1 lore raw

PATCH 1/1 Add mpc5125ads board and processor to the mpc512x family

Hi Martha,

Quoted 7 lines · Martha M Stan

From: Martha M Stan <[email protected]>
Subject: [U-Boot] [PATCH] Add mpc5125ads board and processor to the mpc512x family
To: u-boot at lists.denx.de
Cc: "Martha M Stan" <[email protected]>
Date: Monday, September 21, 2009, 5:27 PM

You missed MAKEALL and MAINTAINERS entries.

Regards,

Fabio Estevam

#2 lore raw

PATCH 1/1 Add mpc5125ads board and processor to the mpc512x family

In reply to Martha M Stan

Dear Martha M Stan,

do you plan to send an updated patch for this release?

In addition to Fabio's comments here a few more:

Quoted 1 line · In message <[email protected]> you wrote:

...

Quoted 5 lines
board/freescale/mpc5125ads/mpc5125ads.c new file +0 -0
new file mode 100644
index 0000000..445c765

...

board/freescale/mpc5125ads/mpc5125ads.c line 218

Quoted 6 lines
board/freescale/mpc5125ads/mpc5125ads.c new file +6 -0
+	if (in_8((u8 *)(CONFIG_SYS_CPLD_BASE + 0x08)) & 0x04) {
+		out_8((u8 *)(CONFIG_SYS_CPLD_BASE + 0x08), 0xc1);
+	} else {
+		/* running from Backup flash */
+		out_8((u8 *)(CONFIG_SYS_CPLD_BASE + 0x08), 0x32);
+	}

Please do not use base address plus offset, but define a C struct to describe the CPLD's register layout.

[That would also be most welcome to fix similar code in "board/freescale/mpc5121ads/mpc5121ads.c"; sorry - due to lack of documentation I was not able to clean this up yet.]

board/freescale/mpc5125ads/mpc5125ads.c line 248

Quoted 6 lines
board/freescale/mpc5125ads/mpc5125ads.c new file +6 -0
+#endif
+	/* 
+	 * initialize function mux & slew rate for all IO pins
+	 * there are two peripheral options controlled by switch 8 
+	 */
+        if (IS_CFG1_SWITCH) {

Indentation not by TAB.

board/freescale/mpc5125ads/mpc5125ads.c line 335

Quoted 10 lines
board/freescale/mpc5125ads/mpc5125ads.c new file +10 -0
+#ifdef CONFIG_MISC_INIT_R
+int misc_init_r(void)
+{
+	u8 tmp_val;
+
+	extern int ads5121_diu_init(void);
+
+       immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
+       u32 bkup_size = flash_info[0].size;
+       u32 bkup_start = 0xffffffff - bkup_size +1;

Indentation not by TAB. Please fix globally.

Quoted 3 lines
board/freescale/mpc5125ads/mpc5125ads.c new file +3 -0
+		/* Verify if enabled */
+		tmp_val = 0;
+		i2c_read(0x38, 0x08, 1, &tmp_val, sizeof(tmp_val));

...

board/freescale/mpc5125ads/mpc5125ads.c

Quoted 2 lines
board/freescale/mpc5125ads/mpc5125ads.c new file +2 -0
+		tmp_val = 0;
+		i2c_read(0x38, 0x0A, 1, &tmp_val, sizeof(tmp_val));

Which sense does it make to set tmp_val when you overwrite the value immediately by running i2c_read()?

And would it be not a good idea to check i2c_read() / i2c_write() return codes?

board/freescale/mpc5125ads/mpc5125ads.c line 396

Quoted 5 lines
board/freescale/mpc5125ads/mpc5125ads.c new file +5 -0
+int checkboard (void)
+{
+	ushort brd_rev = *(vu_short *) (CONFIG_SYS_CPLD_BASE + 0x00);
+	uchar cpld_rev = *(vu_char *) (CONFIG_SYS_CPLD_BASE + 0x02);
+	uchar cpld_min_rev = *(vu_char *) (CONFIG_SYS_CPLD_BASE + 0x03);

See above - please use a C struct to describe the CPLD layout.

board/freescale/mpc5125ads/mpc5125ads.c line 409

Quoted 4 lines
board/freescale/mpc5125ads/mpc5125ads.c new file +4 -0
+	if (IS_CFG1_SWITCH) /* CAN1+2, SDHC1, USB1+2, FEC1+2, I2C1+2*/
+		printf("Peripheral Option Set 1\n");
+	else	/* CAN1+2, SDHC1, DIU, USB1, FEC1, I2C1+3*/
+		printf("Peripheral Option Set 0\n");

Don't repeat long strings without need. How about:

	printf("Peripheral Option Set %d\n", IS_CFG1_SWITCH != 0);

Hm... I wonder what the output format will look like. I guess there might be vertical alignment issues?

board/freescale/mpc5125ads/u-boot.lds

Quoted 5 lines
board/freescale/mpc5125ads/u-boot.lds new file +0 -0
new file mode 100644
index 0000000..f2f6e14

Do you really need a private linker script? Why?

Quoted 13 lines
cpu/mpc512x/fixed_sdram.c +1 -0
index 63a3035..12ac44d 100644
@@ -36,6 +36,7 @@ u32 default_mddrc_config[4] = {
 };
 
 u32 default_init_seq[] = {
+#ifndef CONFIG_SYS_DDR_OVRIDE_DEF
 	CONFIG_SYS_DDRCMD_NOP,
 	CONFIG_SYS_DDRCMD_NOP,
 	CONFIG_SYS_DDRCMD_NOP,

cpu/mpc512x/fixed_sdram.c u32 default_init_seq[] = { · line 71

Quoted 4 lines
cpu/mpc512x/fixed_sdram.c +1 -0
@@ -67,6 +68,7 @@ u32 default_init_seq[] = {
 	CONFIG_SYS_DDRCMD_OCD_DEFAULT,
 	CONFIG_SYS_DDRCMD_PCHG_ALL,
 	CONFIG_SYS_DDRCMD_NOP
+#endif

Isn't there way to do without such #ifdef's in common code?

cpu/mpc512x/fixed_sdram.c long int fixed_sdram(u32 *mddrc_config, u32 *dram_init_seq, int seq_sz) · line 99

Quoted 7 lines
cpu/mpc512x/fixed_sdram.c +5 -1
 	/* Initialize IO Control */
-	out_be32(&im->io_ctrl.io_control_mem, IOCTRL_MUX_DDR);
+#ifdef CONFIG_MPC5125
+	out_8(&im->io_ctrl.io_control_mem, IOCTRL_MUX_DDR);
+#else
+  	out_be32(&im->io_ctrl.io_control_mem, IOCTRL_MUX_DDR);
+#endif

Ditto here.

Quoted 7 lines
cpu/mpc512x/iopin.c +0 -0
index be20947..ab5dd1c 100644
@@ -28,15 +28,27 @@
 void iopin_initialize(iopin_t *ioregs_init, int len)
 {

cpu/mpc512x/iopin.c line 37

Quoted 10 lines
cpu/mpc512x/iopin.c +5 -2
 	short i, j, p;
-	u32 *reg;
 	immap_t *im = (immap_t *)CONFIG_SYS_IMMR;
 
-	reg = (u32 *)&(im->io_ctrl);
+#ifdef CONFIG_MPC5125
+	u8 *reg =(u8 *)&(im->io_ctrl);
+#else
+	u32 *reg =(u32 *)&(im->io_ctrl);
+#endif

And here again.

This is becoming an #ifdef mess, it seems. Usually this is an indiaction of a major design issue.

Quoted 13 lines
cpu/mpc512x/iopin.c +9 -0
+#ifdef CONFIG_MPC5125
+		for (p = 0, j = ioregs_init[i].p_offset;
+			p < ioregs_init[i].nr_pins; p++, j++) {
+			if (ioregs_init[i].bit_or)
+				setbits_8(&(reg[j]), ioregs_init[i].val);
+			else
+				out_8(&reg[j], ioregs_init[i].val);
+		}
+#else
 		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)

cpu/mpc512x/iopin.c void iopin_initialize(iopin_t *ioregs_init, int len) · line 59

Quoted 4 lines
cpu/mpc512x/iopin.c +1 -0
@@ -44,6 +56,7 @@ void iopin_initialize(iopin_t *ioregs_init, int len)
 			else
 				out_be32 (reg + j, ioregs_init[i].val);
 		}
+#endif

And again. That's enough: NAK!

Quoted 5 lines
drivers/net/mpc512x_fec.c +0 -0
index fb2c19a..3ff1c31 100644

drivers/net/mpc512x_fec.c static int rx_buff_idx = 0; · line 48

Quoted 9 lines
drivers/net/mpc512x_fec.c +5 -1
@@ -41,7 +41,11 @@ static int rx_buff_idx = 0;
 static void mpc512x_fec_phydump (char *devname)
 {
 	u16 phyStatus, i;
-	u8 phyAddr = CONFIG_PHY_ADDR;
+#ifdef CONFIG_MPC5125
+	uint8 phyAddr = ((devname[3]=='2') ? CONFIG_PHY2_ADDR : CONFIG_PHY_ADDR);
+#else
+	uint8 phyAddr = CONFIG_PHY_ADDR;
+#endif

Umm.. does this work with CONFIG_NET_MULTI ?

include/asm-ppc/immap_512x.h line 41

Quoted 11 lines
include/asm-ppc/immap_512x.h +2 -0
index 79cdd80..50ef20c 100644
@@ -36,6 +36,8 @@
 #define	_START_OFFSET		EXC_OFF_SYS_RESET
 
 #define SPR_5121E		0x80180000
+#define SPR_5125		0x80190000
+
 

Please don't add random white space.

Quoted 6 lines
include/asm-ppc/immap_512x.h +0 -0
 /*
  * IMMRBAR - Internal Memory Register Base Address
@@ -210,21 +212,25 @@ typedef struct clk512x {
 #define CLOCK_SCCR1_TPR_EN		0x00001000
 #define CLOCK_SCCR1_PCI_EN		0x00000800
 #define CLOCK_SCCR1_DDR_EN		0x00000400

include/asm-ppc/immap_512x.h typedef struct clk512x { · line 222

Quoted 10 lines
include/asm-ppc/immap_512x.h +3 -2
+#define CLOCK_SCCR1_FEC2_EN		0x00000200
 
 /* System Clock Control Register 2 commands */
 #define CLOCK_SCCR2_DIU_EN		0x80000000
 #define CLOCK_SCCR2_AXE_EN		0x40000000
 #define CLOCK_SCCR2_MEM_EN		0x20000000
-#define CLOCK_SCCR2_USB2_EN		0x10000000
-#define CLOCK_SCCR2_USB1_EN		0x08000000
+#define CLOCK_SCCR2_USB1_EN		0x10000000
+#define CLOCK_SCCR2_USB2_EN		0x08000000

Is this a bug fix to existing code? This should be a separate patch, then.

include/asm-ppc/immap_512x.h typedef struct clk512x { · line 227

Quoted 4 lines
include/asm-ppc/immap_512x.h +2 -0
 #define CLOCK_SCCR2_BDLC_EN		0x02000000
+#define CLOCK_SCCR2_AUTO_EN		0x02000000
 #define CLOCK_SCCR2_SDHC_EN		0x01000000
+#define CLOCK_SCCR2_AUTO_EN		0x02000000

Why are you adding CLOCK_SCCR2_AUTO_EN twice?

Quoted 16 lines
include/asm-ppc/immap_512x.h +0 -15
 typedef struct ioctrl512x {
-	u32	io_control_mem;			/* MEM pad ctrl reg */
-	u32	io_control_gp;			/* GP pad ctrl reg */
-	u32	io_control_lpc_clk;		/* LPC_CLK pad ctrl reg */
-	u32	io_control_lpc_oe;		/* LPC_OE pad ctrl reg */
-	u32	io_control_lpc_rw;		/* LPC_R/W pad ctrl reg */
-	u32	io_control_lpc_ack;		/* LPC_ACK pad ctrl reg */
-	u32	io_control_lpc_cs0;		/* LPC_CS0 pad ctrl reg */
-	u32	io_control_nfc_ce0;		/* NFC_CE0 pad ctrl reg */
-	u32	io_control_lpc_cs1;		/* LPC_CS1 pad ctrl reg */
-	u32	io_control_lpc_cs2;		/* LPC_CS2 pad ctrl reg */
-	u32	io_control_lpc_ax03;		/* LPC_AX03 pad ctrl reg */
-	u32	io_control_emb_ax02;		/* EMB_AX02 pad ctrl reg */
-	u32	io_control_emb_ax01;		/* EMB_AX01 pad ctrl reg */
-	u32	io_control_emb_ax00;		/* EMB_AX00 pad ctrl reg */
-	u32	io_control_emb_ad31;		/* EMB_AD31 pad ctrl reg */

...

Quoted 6 lines
include/asm-ppc/immap_512x.h +4 -2
-	u32	io_control_usb_phy_drvvbus;	/* USB2_DRVVBUS pad ctrl reg */
-	u8	reserved[0x0cfc];		/* fill to 4096 bytes size */
+#ifdef CONFIG_MPC5125
+	u8 	io_control_mem;		/* offset 0x00 mem pad ctrl reg 	*/
+	u8 	io_control_gbobe;	/* offset 0x01 gbobe pad ctrl reg 	*/
+	u8	res1[2];

include/asm-ppc/immap_512x.h typedef struct pcidma512x { · line 664

Quoted 10 lines
include/asm-ppc/immap_512x.h +10 -0
+	u8 	io_control_lpc_clk;	/* offset 0x04 lpc_clk pad ctrl reg 	*/
+	u8 	io_control_lpc_oe_b;	/* offset 0x05 lpc_oe_b pad ctrl reg 	*/
+	u8 	io_control_lpc_rwb;	/* offset 0x06 lpc_rwb pad ctrl reg 	*/
+	u8 	io_control_lpc_cs0_b;	/* offset 0x07 lpc_cs0_b		*/
+	u8 	io_control_lpc_ack_b;	/* offset 0x08 lpc_ack_b pad ctrl reg 	*/
+	u8 	io_control_lpc_ax03;	/* offset 0x09 lpc_ax03 pad ctrl reg 	*/
+	u8 	io_control_emb_ax02;	/* offset 0x0a emb_ax02 pad ctrl reg 	*/
+	u8 	io_control_emb_ax01;	/* offset 0x0b emb_ax01 pad ctrl reg 	*/
+	u8 	io_control_emb_ax00;	/* offset 0x0c emb_ax00 pad ctrl reg 	*/
+	u8 	io_control_emb_ad31;	/* offset 0x0d emb_ad31 pad ctrl reg 	*/

NAK!!! If structures are so fundamentally different, it makes zero sense trying to make them look the same. Instead, make clear that these are separate, incompatible things. Declare a new struct for the 5125.

Quoted 9 lines

typedef struct psc512x {

include/asm-ppc/immap_512x.h +8 -0
+#ifdef CONFIG_MPC5125
+	volatile u8	mr1;		/* PSC + 0x00 */
+	volatile u8	res0[3];
+	volatile u8	mr2;		/* PSC + 0x04 */
+	volatile u8	res0a[3];
+	volatile u16	psc_status;	/* PSC + 0x08 */
+	volatile u16	res1;
+	volatile u16	psc_clock_select;/* PSC + 0x0C mpc5125 manual has this as u8       */

include/asm-ppc/immap_512x.h typedef struct pata512x { · line 1121

Quoted 10 lines
include/asm-ppc/immap_512x.h +10 -0
+					 /* it has u8 res after it and for compatibility   */
+					 /* will keep u16 so high bits are set as before   */ 
+	volatile u16	res1a;
+	volatile u8	command;	/* PSC + 0x10 */
+	volatile u8	res2[3];
+	union {				/* PSC + 0x14 */
+		volatile u8	buffer_8;
+		volatile u16	buffer_16;
+		volatile u32	buffer_32;
+	} buffer;

Same here. Such huge monster-#ifdef's make zero sense. If structs are different, they _are_ different and code shoud reflect that.

include/configs/mpc5121ads.h line 32

Quoted 10 lines
include/configs/mpc5121ads.h +1 -0
index ebc518c..35e69c4 100644
@@ -28,6 +28,7 @@
 #define __CONFIG_H
 
 #define CONFIG_MPC5121ADS 1
+
 /*

What exactly is the intention behind such a random whitespace change? Please do not mess aroiund with unrelated files.

Quoted 5 lines
include/configs/mpc5125ads.h new file +0 -0
new file mode 100644
index 0000000..2ba7ba3

...

include/configs/mpc5125ads.h line 56

Quoted 2 lines
include/configs/mpc5125ads.h new file +2 -0
+/* video */
+#undef CONFIG_VIDEO

Please do not add dead code - do not undef undefined stuff.

Quoted 3 lines

+ * Enable Fast boot
+ */
+#define CONFIG_FASTBOOT

And do not add non-existing #defines either.

...

Quoted 1 line

+#define CONFIG_SYS_CS_ALETIMING 0x00000005 /* Use alternative CS timing for CS0 and CS2 */

Lines too long. Please fix globally.

include/configs/mpc5125ads.h line 291

Quoted 4 lines
include/configs/mpc5125ads.h new file +4 -0
+/*
+ * IIM - IC Identification Module
+ */
+#undef CONFIG_IIM

See above. Don;t add dead code.

include/configs/mpc5125ads.h line 295

Quoted 3 lines
include/configs/mpc5125ads.h new file +3 -0
+/* I2C */
+#define CONFIG_HARD_I2C			/* defd in ads5121 I2C with hardware support */
+#undef CONFIG_SOFT_I2C			/* so disable bit-banged I2C */

Ditto.

include/configs/mpc5125ads.h line 303

Quoted 8 lines
include/configs/mpc5125ads.h new file +8 -0
+#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_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

And again.

Quoted 1 line

+/* #define CONFIG_WATCHDOG */ /* enable watchdog */

And again - please fix globally.

include/configs/mpc5125ads.h line 380

Quoted 2 lines
include/configs/mpc5125ads.h new file +2 -0
+#define CONFIG_SYS_LONGHELP			/* undef to save memory */
+#define CONFIG_SYS_LOAD_ADDR	0x2000000	/* default load address */

Probably too low for most recent kernel versions... And inconsistent with later settings...

Seems this needs a major overhaul.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If programming was easy, they wouldn't need something as  complicated
as a human being to do it, now would they?
                       - L. Wall & R. L. Schwartz, _Programming Perl_