[U-Boot] [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 Signed-off-by: Klaus Heydeck --- 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 diff --git a/board/kup/common/kup.c b/board/kup/common/kup.c index 2418d59..96a2c2c 100644 --- a/board/kup/common/kup.c +++ b/board/kup/common/kup.c @@ -24,49 +24,61 @@ #include #include #include "kup.h" +#include -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 & 0x2000) { - /* printf("waiting for 5V VCC\n"); */ - ; + while (in_be32 (&siu->sc_sipend) & 0x2000) { + 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"); } + diff --git a/board/kup/common/kup.h b/board/kup/common/kup.h index b736283..55c0e82 100644 --- a/board/kup/common/kup.h +++ b/board/kup/common/kup.h @@ -24,23 +24,34 @@ #ifndef __KUP_H #define __KUP_H -#define PA_8 0x0080 -#define PA_11 0x0010 -#define PA_12 0x0008 - -#define PB_14 0x0002 -#define PB_17 0x4000 - -#define PC_9 0x0040 - -#define PA_RS485 PA_11 /* SCC1: 0=RS232 1=RS485 */ -#define PA_LED_YELLOWPA_8 -#define BP_USB_VCC PB_14 /* VCC for USB devices 0=vcc on, 1=vcc off*/ -#define PB_LCD_PWM PB_17 /* PB 17 */ -#define PC_SWITCH1 PC_9/* Reboot switch */ - -extern void poweron_key (void); - +#define PA_8 0x0080 +#define PA_9 0x0040 +#define PA_10 0x0020 +#define PA_11 0x0010 +#define PA_12 0x0008 + +#define PB_14 0x0002 +#define PB_15 0x0001 +#define PB_16 0x8000 +#define PB_17 0x4000 + +#define PC_4 0x0800 +#define PC_5 0x0400 +#define PC_9 0x0040 + +#define PA_RS485 PA_11 /* SCC1: 0=RS232 1=RS485 */ +#define PA_LED_YELLOW PA_8 +#define PA_RESET_IO_01 PA_9/* Reset left IO */ +#define PA_RESET_IO_02 PA_10 /* Reset right IO */ +#define PB_PROG_IO_01 PB_15 /* Program left IO */ +#define PB_PROG_IO_02 PB_16 /* Program right IO */ +#define BP_USB_VCC
Re: [U-Boot] [PATCH 1/2] 8xx, kup4: minor configuration changes
Dear Heiko Schocher, In message <4c348537.4010...@denx.de> you wrote: > - nfs-options removed > - hda->sda changed > - mtd parts added > - loadaddress changed > - cmd-line length increased > - lcd stuff removed > - code cleanup > > Signed-off-by: Klaus Heydeck ... > + 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. > - 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. > setenv ("key1", "off"); > else > setenv ("key1", "on"); > } > + Please do not add trailing empty lines. > +#define PA_8 0x0080 > +#define PA_9 0x0040 > +#define PA_100x0020 > +#define PA_110x0010 > +#define PA_120x0008 > + > +#define PB_140x0002 > +#define PB_150x0001 > +#define PB_160x8000 > +#define PB_170x4000 > + > +#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). > +extern void poweron_key(void); > extern void load_sernum_ethaddr(void); > > #endif /* __KUP_H */ > + No trailing blank lines, please fix globally! ... > + 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! > + /* > + * 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 {" ... > + /* 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. > /* Configure PA8 as output port */ ... > + 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. ... > + out_be32 (&memctl->memc_or1, 0xFF000A00); > + out_be32 (&memctl->memc_br1, 0x0081); > + out_be32 (&memctl->memc_or2, 0xFE000A00); > + out_be32 (&memctl->memc_br2, 0x0181); > + out_be32 (&memctl->memc_or3, 0xFD000A00); > + out_be32 (&memctl->memc_br3, 0x0281); > + out_be32 (&memctl->memc_or6, 0xFC000A00); > + out_be32 (&memctl->memc_br6, 0x0381); > udelay (1); > - > - 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... > #define CONFIG_BOOTCOMMAND \ > -"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? > +/*--- > + * Dynamic MTD partition support > + */ Incorrect multiline comment style. Best regards, Wolfgang Denk -- 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: w...@denx.de Sometimes, too long is too long. - Joe Crowe ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot