Skip to contentSkip to conversation

8xx, kup4: minor configuration changes

PATCH Superseded Heiko Schocher 2 participants 2 messages Jul 7, 2010 – Jul 15, 2010

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 8xx, kup4: minor configuration changes

- nfs-options removed
- hda->sda changed
- mtd parts added
- loadaddress changed
- cmd-line length increased
- lcd stuff removed
- code cleanup

---
 board/kup/common/kup.c     |   52 ++++---
 board/kup/common/kup.h     |   45 +++--
 board/kup/kup4k/kup4k.c    |  408 ++++++++++++++++----------------------------
 board/kup/kup4k/s1d13706.h |  174 -------------------
 board/kup/kup4x/kup4x.c    |  212 ++++++------------------
 include/configs/KUP4K.h    |  161 ++++++++++-------
 include/configs/KUP4X.h    |   62 ++++----
 7 files changed, 386 insertions(+), 728 deletions(-)
 delete mode 100644 board/kup/kup4k/s1d13706.h
board/kup/common/kup.c +32 -20
index 2418d59..96a2c2c 100644
@@ -24,49 +24,61 @@
 #include <common.h>
 #include <mpc8xx.h>
 #include "kup.h"
+#include <asm/io.h>
 
-int misc_init_f (void)
+
+int misc_init_f(void)
 {
 	volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
 	volatile sysconf8xx_t *siu = &immap->im_siu_conf;
 
-	while (siu->sc_sipend & 0x20000000) {
-		/* printf("waiting for 5V VCC\n"); */
-		;
+	while (in_be32 (&siu->sc_sipend) & 0x20000000) {
+		debug("waiting for 5V VCC\n");
 	}
 
 	/* RS232 / RS485 default is RS232 */
-	immap->im_ioport.iop_padat &= ~(PA_RS485);
-	immap->im_ioport.iop_papar &= ~(PA_RS485);
-	immap->im_ioport.iop_paodr &= ~(PA_RS485);
-	immap->im_ioport.iop_padir |= (PA_RS485);
+	clrbits_be16 (&immap->im_ioport.iop_padat, PA_RS485);
+	clrbits_be16 (&immap->im_ioport.iop_papar, PA_RS485);
+	clrbits_be16 (&immap->im_ioport.iop_paodr, PA_RS485);
+	setbits_be16 (&immap->im_ioport.iop_padir, PA_RS485);
+
+	/* IO Reset min 1 msec */
+	setbits_be16 (&immap->im_ioport.iop_padat,
+				 (PA_RESET_IO_01 | PA_RESET_IO_02));
+	clrbits_be16 (&immap->im_ioport.iop_papar,
+				 (PA_RESET_IO_01 | PA_RESET_IO_02));
+	clrbits_be16 (&immap->im_ioport.iop_paodr,
+				 (PA_RESET_IO_01 | PA_RESET_IO_02));
+	setbits_be16 (&immap->im_ioport.iop_padir,
+				 (PA_RESET_IO_01 | PA_RESET_IO_02));
+	udelay(1000);
+	clrbits_be16 (&immap->im_ioport.iop_padat,
+				 (PA_RESET_IO_01 | PA_RESET_IO_02));
 	return (0);
 }
 
-
 #ifdef CONFIG_IDE_LED
-void ide_led (uchar led, uchar status)
+void ide_led(uchar led, uchar status)
 {
 	volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
 
 	/* We have one led for both pcmcia slots */
-	if (status) {		/* led on */
-		immap->im_ioport.iop_padat &= ~(PA_LED_YELLOW);
-	} else {
-		immap->im_ioport.iop_padat |= (PA_LED_YELLOW);
-	}
+	if (status)
+		clrbits_be16 (&immap->im_ioport.iop_padat, PA_LED_YELLOW);
+	else
+		setbits_be16 (&immap->im_ioport.iop_padat, PA_LED_YELLOW);
 }
 #endif
 
-void poweron_key (void)
+void poweron_key(void)
 {
 	volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
 
-	immap->im_ioport.iop_pcpar &= ~(PC_SWITCH1);
-	immap->im_ioport.iop_pcdir &= ~(PC_SWITCH1);
-
-	if (immap->im_ioport.iop_pcdat & (PC_SWITCH1))
+	clrbits_be16 (&immap->im_ioport.iop_pcpar, PC_SWITCH1);
+	clrbits_be16 (&immap->im_ioport.iop_pcdir, PC_SWITCH1);
+	if (in_be16 (&immap->im_ioport.iop_pcdat) & (PC_SWITCH1))
 		setenv ("key1", "off");
 	else
 		setenv ("key1", "on");
 }
+
board/kup/common/kup.h +28 -17

51 lines not on this page · raw message

board/kup/kup4k/kup4k.c +151 -257

526 lines not on this page · raw message

board/kup/kup4k/s1d13706.h deleted +0 -174

174 lines not on this page · raw message

board/kup/kup4x/kup4x.c +50 -162

285 lines not on this page · raw message

include/configs/KUP4K.h +94 -67

269 lines not on this page · raw message

include/configs/KUP4X.h +31 -31

125 lines not on this page · raw message

Signature · 5 lines
1.6.2.5

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#1 lore raw

PATCH 1/2 8xx, kup4: minor configuration changes

Dear Heiko Schocher,

Quoted 9 lines · In message <[email protected]> you wrote:

- nfs-options removed
- hda->sda changed
- mtd parts added
- loadaddress changed
- cmd-line length increased
- lcd stuff removed
- code cleanup

...

board/kup/common/kup.c line 43

Quoted 4 lines
board/kup/common/kup.c +4 -0
+	clrbits_be16 (&immap->im_ioport.iop_padat, PA_RS485);
+	clrbits_be16 (&immap->im_ioport.iop_papar, PA_RS485);
+	clrbits_be16 (&immap->im_ioport.iop_paodr, PA_RS485);
+	setbits_be16 (&immap->im_ioport.iop_padir, PA_RS485);

No space after function names; please fix globally.

board/kup/common/kup.c line 79

Quoted 4 lines
board/kup/common/kup.c +3 -1
-	if (immap->im_ioport.iop_pcdat & (PC_SWITCH1))
+	clrbits_be16 (&immap->im_ioport.iop_pcpar, PC_SWITCH1);
+	clrbits_be16 (&immap->im_ioport.iop_pcdir, PC_SWITCH1);
+	if (in_be16 (&immap->im_ioport.iop_pcdat) & (PC_SWITCH1))

Please insert blank line above the "if" for readability.

board/kup/common/kup.c line 84

Quoted 5 lines
board/kup/common/kup.c +1 -0
 		setenv ("key1", "off");
 	else
 		setenv ("key1", "on");
 }
+

Please do not add trailing empty lines.

Quoted 4 lines
board/kup/common/kup.h +4 -0
+#define PA_8	0x0080
+#define PA_9	0x0040
+#define PA_10	0x0020
+#define PA_11	0x0010

board/kup/common/kup.h line 40

Quoted 10 lines
board/kup/common/kup.h +10 -0
+#define PA_12	0x0008
+
+#define PB_14	0x00020000
+#define PB_15	0x00010000
+#define PB_16	0x00008000
+#define PB_17	0x00004000
+
+#define PC_4	0x0800
+#define PC_5	0x0400
+#define PC_9	0x0040

It would make sense to add these defines (using a more generic name) to include/mpc8xx.h (but note that I don't insist on this, as 8xx is prettymuch dead).

board/kup/common/kup.h line 57

Quoted 5 lines
board/kup/common/kup.h +2 -0
+extern void poweron_key(void);
 extern void load_sernum_ethaddr(void);
 
 #endif	/* __KUP_H */
+

No trailing blank lines, please fix globally!

...

board/kup/kup4k/kup4k.c const uint sdram_table[] = { · line 128

Quoted 3 lines
board/kup/kup4k/kup4k.c +3 -0
+	if (read_diag())
+		gd->flags &= ~GD_FLG_SILENT;
+		printf ("Board: KUP4K Rev %d.%d AK:",rev,mod);

Argh!! Either this is badly indented, or a bug. Please fix!

board/kup/kup4k/kup4k.c const uint sdram_table[] = { · line 138

Quoted 10 lines
board/kup/kup4k/kup4k.c +10 -0
+	/*
+	 * TI Application report: Before using the IO as an input,
+	 * a high must be written to the IO first
+	 */
+	pcf = 0xFF;
+	i2c_write (0x21, 0, 0 , &pcf, 1);
+	if (i2c_read (0x21, 0, 0, &pcf, 1)) {
+		puts ("n/a\n");
+	}
+	else {

Incorrect brace style - make "} else {"

...

board/kup/kup4k/kup4k.c const uint sdram_table[] = { · line 180

Quoted 7 lines
board/kup/kup4k/kup4k.c +7 -0
+	/* no refresh yet */
+	if(rev >= 7)
+		out_be32 (&memctl->memc_mamr,
+				 CONFIG_SYS_MAMR_9COL & (~(MAMR_PTAE)));
+	else
+		out_be32 (&memctl->memc_mamr,
+				 CONFIG_SYS_MAMR_8COL & (~(MAMR_PTAE)));

Braces needed for multiline statements.

Quoted 1 line

/* Configure PA8 as output port */

...

board/kup/kup4k/kup4k.c const uint sdram_table[] = { · line 248

Quoted 4 lines
board/kup/kup4k/kup4k.c +4 -0
+	setbits_be16 (&immap->im_ioport.iop_padir, 0x80);
+	setbits_be16 (&immap->im_ioport.iop_paodr, 0x80);
+	clrbits_be16 (&immap->im_ioport.iop_papar, 0x80);
+	setbits_be16 (&immap->im_ioport.iop_padat, 0x80); /* turn it off */

Why don't you use the #defines you added above (PA_8) ? Please check and fix globally.

...

board/kup/kup4x/kup4x.c const uint sdram_table[] = { · line 180

Quoted 12 lines
board/kup/kup4x/kup4x.c +9 -2
+	out_be32 (&memctl->memc_or1, 0xFF000A00);
+	out_be32 (&memctl->memc_br1, 0x00000081);
+	out_be32 (&memctl->memc_or2, 0xFE000A00);
+	out_be32 (&memctl->memc_br2, 0x01000081);
+	out_be32 (&memctl->memc_or3, 0xFD000A00);
+	out_be32 (&memctl->memc_br3, 0x02000081);
+	out_be32 (&memctl->memc_or6, 0xFC000A00);
+	out_be32 (&memctl->memc_br6, 0x03000081);
 	udelay (10000);
-
-	return (size_b0 + size_b1 + size_b2 + size_b3);
+	return (4 * 16 * 1024 * 1024);

Normally I insist on using get_ram_size() to auto-size and test the RAM...

include/configs/KUP4K.h line 78

Quoted 3 lines

#define CONFIG_BOOTCOMMAND \

include/configs/KUP4K.h +1 -1
-    "run slot_a_boot;run slot_b_boot;run nfs_boot;run panic_boot"
+    "run fat_boot; run slot_b_boot;run slot_a_boot;run nfs_boot;run panic_boot"

Are you absolutely sure you want this behaviour? I would expect you mean

"run fat_boot slot_b_boot slot_a_boot nfs_boot panic_boot"

instead?

Quoted 3 lines

+/*-----------------------------------------------------------------------
+ * Dynamic MTD partition support
+ */

Incorrect multiline comment style.

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
Sometimes, too long is too long.                          - Joe Crowe