2 * (C) Copyright 2001-2004
3 * Stefan Roese, esd gmbh germany, stefan.roese@esd-electronics.com
6 * Stefan Roese, DENX Software Engineering, sr@denx.de.
8 * (C) Copyright 2006-2007
9 * Matthias Fuchs, esd GmbH, matthias.fuchs@esd-electronics.com
11 * See file CREDITS for list of people who contributed to this
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 #include <asm/processor.h>
38 DECLARE_GLOBAL_DATA_PTR;
40 /* FPGA internal regs */
41 #define FPGA_CTRL ((u16 *)(CONFIG_SYS_FPGA_BASE_ADDR + 0x000))
42 #define FPGA_STATUS ((u16 *)(CONFIG_SYS_FPGA_BASE_ADDR + 0x002))
43 #define FPGA_CTR ((u16 *)(CONFIG_SYS_FPGA_BASE_ADDR + 0x004))
44 #define FPGA_BL ((u16 *)(CONFIG_SYS_FPGA_BASE_ADDR + 0x006))
46 /* FPGA Control Reg */
47 #define FPGA_CTRL_REV0 0x0001
48 #define FPGA_CTRL_REV1 0x0002
49 #define FPGA_CTRL_VGA0_BL 0x0004
50 #define FPGA_CTRL_VGA0_BL_MODE 0x0008
51 #define FPGA_CTRL_CF_RESET 0x0040
52 #define FPGA_CTRL_PS2_PWR 0x0080
53 #define FPGA_CTRL_CF_PWRN 0x0100 /* low active */
54 #define FPGA_CTRL_CF_BUS_EN 0x0200
55 #define FPGA_CTRL_LCD_CLK 0x7000 /* mask for lcd clock */
56 #define FPGA_CTRL_OW_ENABLE 0x8000
58 #define FPGA_STATUS_CF_DETECT 0x8000
60 #ifdef CONFIG_VIDEO_SM501
62 #define SWAP32(x) ((((x) & 0x000000ff) << 24) | (((x) & 0x0000ff00) << 8)|\
63 (((x) & 0x00ff0000) >> 8) | (((x) & 0xff000000) >> 24) )
65 #ifdef CONFIG_VIDEO_SM501_8BPP
66 #error CONFIG_VIDEO_SM501_8BPP not supported.
67 #endif /* CONFIG_VIDEO_SM501_8BPP */
69 #ifdef CONFIG_VIDEO_SM501_16BPP
73 * 800x600 display B084SN03: PCLK = 40MHz
78 static const SMI_REGS init_regs_800x600 [] =
81 {0x0005c, SWAP32(0xffffffff)}, /* set endianess to big endian */
83 {0x0005c, SWAP32(0x00000000)}, /* set endianess to little endian */
85 {0x00004, SWAP32(0x00000000)},
86 /* clocks for pm1... */
87 {0x00048, SWAP32(0x00021807)},
88 {0x0004C, SWAP32(0x221a0a01)},
89 {0x00054, SWAP32(0x00000001)},
90 /* clocks for pm0... */
91 {0x00040, SWAP32(0x00021807)},
92 {0x00044, SWAP32(0x221a0a01)},
93 {0x00054, SWAP32(0x00000000)},
95 {0x1000c, SWAP32(0xfffffff0)}, /* GPIO32..63 direction */
96 /* panel control regs... */
97 {0x80000, SWAP32(0x0f013105)}, /* panel display control: 16-bit RGB 5:6:5 mode */
98 {0x80004, SWAP32(0xc428bb17)}, /* panel panning control ??? */
99 {0x8000C, SWAP32(0x00010000)}, /* panel fb address */
100 {0x80010, SWAP32(0x06400640)}, /* panel fb offset/window width */
101 {0x80014, SWAP32(0x03200000)}, /* panel fb width (0x320=800) */
102 {0x80018, SWAP32(0x02580000)}, /* panel fb height (0x258=600) */
103 {0x8001C, SWAP32(0x00000000)}, /* panel plane tl location */
104 {0x80020, SWAP32(0x02580320)}, /* panel plane br location */
105 {0x80024, SWAP32(0x041f031f)}, /* panel horizontal total */
106 {0x80028, SWAP32(0x00800347)}, /* panel horizontal sync */
107 {0x8002C, SWAP32(0x02730257)}, /* panel vertical total */
108 {0x80030, SWAP32(0x00040258)}, /* panel vertical sync */
109 {0x80200, SWAP32(0x00010000)}, /* crt display control */
114 * 1024x768 display G150XG02: PCLK = 65MHz
119 static const SMI_REGS init_regs_1024x768 [] =
121 {0x00004, SWAP32(0x00000000)},
122 /* clocks for pm1... */
123 {0x00048, SWAP32(0x00021807)},
124 {0x0004C, SWAP32(0x011a0a01)},
125 {0x00054, SWAP32(0x00000001)},
126 /* clocks for pm0... */
127 {0x00040, SWAP32(0x00021807)},
128 {0x00044, SWAP32(0x011a0a01)},
129 {0x00054, SWAP32(0x00000000)},
131 {0x1000c, SWAP32(0xfffffff0)}, /* GPIO32..63 direction */
132 /* panel control regs... */
133 {0x80000, SWAP32(0x0f013105)}, /* panel display control: 16-bit RGB 5:6:5 mode */
134 {0x80004, SWAP32(0xc428bb17)}, /* panel panning control ??? */
135 {0x8000C, SWAP32(0x00010000)}, /* panel fb address */
136 {0x80010, SWAP32(0x08000800)}, /* panel fb offset/window width */
137 {0x80014, SWAP32(0x04000000)}, /* panel fb width (0x400=1024) */
138 {0x80018, SWAP32(0x03000000)}, /* panel fb height (0x300=768) */
139 {0x8001C, SWAP32(0x00000000)}, /* panel plane tl location */
140 {0x80020, SWAP32(0x03000400)}, /* panel plane br location */
141 {0x80024, SWAP32(0x053f03ff)}, /* panel horizontal total */
142 {0x80028, SWAP32(0x0140040f)}, /* panel horizontal sync */
143 {0x8002C, SWAP32(0x032502ff)}, /* panel vertical total */
144 {0x80030, SWAP32(0x00260301)}, /* panel vertical sync */
145 {0x80200, SWAP32(0x00010000)}, /* crt display control */
149 #endif /* CONFIG_VIDEO_SM501_16BPP */
151 #ifdef CONFIG_VIDEO_SM501_32BPP
155 * 800x600 display B084SN03: PCLK = 40MHz
160 static const SMI_REGS init_regs_800x600 [] =
162 #if 0 /* test-only */
163 {0x0005c, SWAP32(0xffffffff)}, /* set endianess to big endian */
165 {0x0005c, SWAP32(0x00000000)}, /* set endianess to little endian */
167 {0x00004, SWAP32(0x00000000)},
168 /* clocks for pm1... */
169 {0x00048, SWAP32(0x00021807)},
170 {0x0004C, SWAP32(0x221a0a01)},
171 {0x00054, SWAP32(0x00000001)},
172 /* clocks for pm0... */
173 {0x00040, SWAP32(0x00021807)},
174 {0x00044, SWAP32(0x221a0a01)},
175 {0x00054, SWAP32(0x00000000)},
177 {0x1000c, SWAP32(0xfffffff0)}, /* GPIO32..63 direction */
178 /* panel control regs... */
179 {0x80000, SWAP32(0x0f013106)}, /* panel display control: 32-bit RGB 8:8:8 mode */
180 {0x80004, SWAP32(0xc428bb17)}, /* panel panning control ??? */
181 {0x8000C, SWAP32(0x00010000)}, /* panel fb address */
182 {0x80010, SWAP32(0x0c800c80)}, /* panel fb offset/window width */
183 {0x80014, SWAP32(0x03200000)}, /* panel fb width (0x320=800) */
184 {0x80018, SWAP32(0x02580000)}, /* panel fb height (0x258=600) */
185 {0x8001C, SWAP32(0x00000000)}, /* panel plane tl location */
186 {0x80020, SWAP32(0x02580320)}, /* panel plane br location */
187 {0x80024, SWAP32(0x041f031f)}, /* panel horizontal total */
188 {0x80028, SWAP32(0x00800347)}, /* panel horizontal sync */
189 {0x8002C, SWAP32(0x02730257)}, /* panel vertical total */
190 {0x80030, SWAP32(0x00040258)}, /* panel vertical sync */
191 {0x80200, SWAP32(0x00010000)}, /* crt display control */
196 * 1024x768 display G150XG02: PCLK = 65MHz
201 static const SMI_REGS init_regs_1024x768 [] =
203 {0x00004, SWAP32(0x00000000)},
204 /* clocks for pm1... */
205 {0x00048, SWAP32(0x00021807)},
206 {0x0004C, SWAP32(0x011a0a01)},
207 {0x00054, SWAP32(0x00000001)},
208 /* clocks for pm0... */
209 {0x00040, SWAP32(0x00021807)},
210 {0x00044, SWAP32(0x011a0a01)},
211 {0x00054, SWAP32(0x00000000)},
213 {0x1000c, SWAP32(0xfffffff0)}, /* GPIO32..63 direction */
214 /* panel control regs... */
215 {0x80000, SWAP32(0x0f013106)}, /* panel display control: 32-bit RGB 8:8:8 mode */
216 {0x80004, SWAP32(0xc428bb17)}, /* panel panning control ??? */
217 {0x8000C, SWAP32(0x00010000)}, /* panel fb address */
218 {0x80010, SWAP32(0x10001000)}, /* panel fb offset/window width */
219 {0x80014, SWAP32(0x04000000)}, /* panel fb width (0x400=1024) */
220 {0x80018, SWAP32(0x03000000)}, /* panel fb height (0x300=768) */
221 {0x8001C, SWAP32(0x00000000)}, /* panel plane tl location */
222 {0x80020, SWAP32(0x03000400)}, /* panel plane br location */
223 {0x80024, SWAP32(0x053f03ff)}, /* panel horizontal total */
224 {0x80028, SWAP32(0x0140040f)}, /* panel horizontal sync */
225 {0x8002C, SWAP32(0x032502ff)}, /* panel vertical total */
226 {0x80030, SWAP32(0x00260301)}, /* panel vertical sync */
227 {0x80200, SWAP32(0x00010000)}, /* crt display control */
231 #endif /* CONFIG_VIDEO_SM501_32BPP */
233 #endif /* CONFIG_VIDEO_SM501 */
239 extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
240 extern void lxt971_no_sleep(void);
242 /* fpga configuration data - gzip compressed and generated by bin2c */
243 const unsigned char fpgadata[] =
245 #include "fpgadata.c"
249 * include common fpga code (for esd boards)
251 #include "../common/fpga.c"
255 int gunzip(void *, int, unsigned char *, unsigned long *);
258 /* logo bitmap data - gzip compressed and generated by bin2c */
259 unsigned char logo_bmp_320[] =
261 #include "logo_320_240_4bpp.c"
264 unsigned char logo_bmp_320_8bpp[] =
266 #include "logo_320_240_8bpp.c"
269 unsigned char logo_bmp_640[] =
271 #include "logo_640_480_24bpp.c"
274 unsigned char logo_bmp_1024[] =
276 #include "logo_1024_768_8bpp.c"
281 * include common lcd code (for esd boards)
283 #include "../common/lcd.c"
285 #include "../common/s1d13704_320_240_4bpp.h"
286 #include "../common/s1d13705_320_240_8bpp.h"
287 #include "../common/s1d13806_640_480_16bpp.h"
288 #include "../common/s1d13806_1024_768_8bpp.h"
292 * include common auto-update code (for esd boards)
294 #include "../common/auto_update.h"
296 au_image_t au_image[] = {
297 {"hh405/preinst.img", 0, -1, AU_SCRIPT},
298 {"hh405/u-boot.img", 0xfff80000, 0x00080000, AU_FIRMWARE},
299 {"hh405/pImage_${bd_type}", 0x00000000, 0x00100000, AU_NAND},
300 {"hh405/pImage.initrd", 0x00100000, 0x00200000, AU_NAND},
301 {"hh405/yaffsmt2.img", 0x00300000, 0x01c00000, AU_NAND},
302 {"hh405/postinst.img", 0, 0, AU_SCRIPT},
305 int N_AU_IMAGES = (sizeof(au_image) / sizeof(au_image[0]));
309 * Get version of HH405 board from GPIO's
311 int board_revision(void)
313 unsigned long osrh_reg;
314 unsigned long isr1h_reg;
315 unsigned long tcr_reg;
319 * Setup GPIO pins (BLAST/GPIO0 and GPIO9 as GPIO)
321 osrh_reg = in_be32((void *)GPIO0_OSRH);
322 isr1h_reg = in_be32((void *)GPIO0_ISR1H);
323 tcr_reg = in_be32((void *)GPIO0_TCR);
324 out_be32((void *)GPIO0_OSRH, osrh_reg & ~0xC0003000); /* output select */
325 out_be32((void *)GPIO0_ISR1H, isr1h_reg | 0xC0003000); /* input select */
326 out_be32((void *)GPIO0_TCR, tcr_reg & ~0x80400000); /* select input */
328 udelay(1000); /* wait some time before reading input */
329 value = in_be32((void *)GPIO0_IR) & 0x80400000; /* get config bits */
332 * Restore GPIO settings
334 out_be32((void *)GPIO0_OSRH, osrh_reg); /* output select */
335 out_be32((void *)GPIO0_ISR1H, isr1h_reg); /* input select */
336 out_be32((void *)GPIO0_TCR, tcr_reg); /* enable output driver for outputs */
338 if (value & 0x80000000) {
339 /* Revision 1.0 or 1.1 detected */
342 if (value & 0x00400000) {
352 int board_early_init_f (void)
355 * IRQ 0-15 405GP internally generated; active high; level sensitive
356 * IRQ 16 405GP internally generated; active low; level sensitive
358 * IRQ 25 (EXT IRQ 0) CAN0; active low; level sensitive
359 * IRQ 26 (EXT IRQ 1) SER0 ; active low; level sensitive
360 * IRQ 27 (EXT IRQ 2) SER1; active low; level sensitive
361 * IRQ 28 (EXT IRQ 3) FPGA 0; active low; level sensitive
362 * IRQ 29 (EXT IRQ 4) FPGA 1; active low; level sensitive
363 * IRQ 30 (EXT IRQ 5) PCI INTA; active low; level sensitive
364 * IRQ 31 (EXT IRQ 6) COMPACT FLASH; active high; level sensitive
366 mtdcr(uicsr, 0xFFFFFFFF); /* clear all ints */
367 mtdcr(uicer, 0x00000000); /* disable all ints */
368 mtdcr(uiccr, 0x00000000); /* set all to be non-critical*/
369 mtdcr(uicpr, CONFIG_SYS_UIC0_POLARITY);/* set int polarities */
370 mtdcr(uictr, 0x10000000); /* set int trigger levels */
371 mtdcr(uicvcr, 0x00000001); /* set vect base=0,INT0 highest priority*/
372 mtdcr(uicsr, 0xFFFFFFFF); /* clear all ints */
375 * EBC Configuration Register: set ready timeout to 512 ebc-clks -> ca. 15 us
377 mtebc(epcr, 0xa8400000); /* ebc always driven */
386 if (gd->board_type >= 2) {
387 if (in_be16(FPGA_STATUS) & FPGA_STATUS_CF_DETECT) {
388 if (!(in_be16(FPGA_CTRL) & FPGA_CTRL_CF_BUS_EN)) {
390 in_be16(FPGA_CTRL) & ~FPGA_CTRL_CF_PWRN);
392 for (i=0; i<300; i++)
396 in_be16(FPGA_CTRL) | FPGA_CTRL_CF_BUS_EN);
403 in_be16(FPGA_CTRL) & ~FPGA_CTRL_CF_BUS_EN);
405 in_be16(FPGA_CTRL) | FPGA_CTRL_CF_PWRN);
412 int misc_init_r (void)
415 ulong len = sizeof(fpgadata);
420 unsigned long contrast0 = 0xffffffff;
422 dst = malloc(CONFIG_SYS_FPGA_MAX_SIZE);
423 if (gunzip (dst, CONFIG_SYS_FPGA_MAX_SIZE, (uchar *)fpgadata, &len) != 0) {
424 printf ("GUNZIP ERROR - must RESET board to recover\n");
425 do_reset (NULL, 0, 0, NULL);
428 status = fpga_boot(dst, len);
430 printf("\nFPGA: Booting failed ");
432 case ERROR_FPGA_PRG_INIT_LOW:
433 printf("(Timeout: INIT not low after asserting PROGRAM*)\n ");
435 case ERROR_FPGA_PRG_INIT_HIGH:
436 printf("(Timeout: INIT not high after deasserting PROGRAM*)\n ");
438 case ERROR_FPGA_PRG_DONE:
439 printf("(Timeout: DONE not high after programming FPGA)\n ");
443 /* display infos on fpgaimage */
445 for (i=0; i<4; i++) {
447 printf("FPGA: %s\n", &(dst[index+1]));
452 for (i=20; i>0; i--) {
453 printf("Rebooting in %2d seconds \r",i);
454 for (index=0;index<1000;index++)
458 do_reset(NULL, 0, 0, NULL);
463 /* display infos on fpgaimage */
465 for (i=0; i<4; i++) {
467 printf("%s ", &(dst[index+1]));
475 * Reset FPGA via FPGA_INIT pin
477 /* setup FPGA_INIT as output */
478 out_be32((void *)GPIO0_TCR,
479 in_be32((void *)GPIO0_TCR) | FPGA_INIT);
480 out_be32((void *)GPIO0_OR,
481 in_be32((void *)GPIO0_OR) & ~FPGA_INIT); /* reset low */
482 udelay(1000); /* wait 1ms */
483 out_be32((void *)GPIO0_OR,
484 in_be32((void *)GPIO0_OR) | FPGA_INIT); /* reset high */
485 udelay(1000); /* wait 1ms */
488 * Write Board revision into FPGA
490 out_be16(FPGA_CTRL, in_be16(FPGA_CTRL) | (gd->board_type & 0x0003));
493 * Setup and enable EEPROM write protection
495 out_be32((void *)GPIO0_OR,
496 in_be32((void *)GPIO0_OR) | CONFIG_SYS_EEPROM_WP);
499 * Reset touch-screen controller
501 out_be32((void *)GPIO0_OR,
502 in_be32((void *)GPIO0_OR) & ~CONFIG_SYS_TOUCH_RST);
504 out_be32((void *)GPIO0_OR,
505 in_be32((void *)GPIO0_OR) | CONFIG_SYS_TOUCH_RST);
508 * Enable power on PS/2 interface (with reset)
510 out_be16(FPGA_CTRL, in_be16(FPGA_CTRL) & ~FPGA_CTRL_PS2_PWR);
513 out_be16(FPGA_CTRL, in_be16(FPGA_CTRL) | FPGA_CTRL_PS2_PWR);
516 * Get contrast value from environment variable
518 str = getenv("contrast0");
520 contrast0 = simple_strtol(str, NULL, 16);
521 if (contrast0 > 255) {
522 printf("ERROR: contrast0 value too high (0x%lx)!\n",
524 contrast0 = 0xffffffff;
529 * Init lcd interface and display logo
532 str = getenv("bd_type");
533 if (strcmp(str, "ppc230") == 0) {
535 * Switch backlight on
538 in_be16(FPGA_CTRL) | FPGA_CTRL_VGA0_BL);
539 out_be16(FPGA_BL, 0x0000);
542 lcd_init((uchar *)CONFIG_SYS_LCD_BIG_REG, (uchar *)CONFIG_SYS_LCD_BIG_MEM,
543 regs_13806_1024_768_8bpp,
544 sizeof(regs_13806_1024_768_8bpp)/sizeof(regs_13806_1024_768_8bpp[0]),
545 logo_bmp_1024, sizeof(logo_bmp_1024));
546 } else if (strcmp(str, "ppc220") == 0) {
548 * Switch backlight on
551 in_be16(FPGA_CTRL) & ~FPGA_CTRL_VGA0_BL);
552 out_be16(FPGA_BL, 0x0000);
555 lcd_init((uchar *)CONFIG_SYS_LCD_BIG_REG, (uchar *)CONFIG_SYS_LCD_BIG_MEM,
556 regs_13806_640_480_16bpp,
557 sizeof(regs_13806_640_480_16bpp)/sizeof(regs_13806_640_480_16bpp[0]),
558 logo_bmp_640, sizeof(logo_bmp_640));
559 } else if (strcmp(str, "ppc215") == 0) {
561 * Set default display contrast voltage
563 if (contrast0 == 0xffffffff) {
564 out_be16(FPGA_CTR, 0x0082);
566 out_be16(FPGA_CTR, contrast0);
568 out_be16(FPGA_BL, 0xffff);
570 * Switch backlight on
575 FPGA_CTRL_VGA0_BL_MODE);
577 * Set lcd clock (small epson)
579 out_be16(FPGA_CTRL, in_be16(FPGA_CTRL) | LCD_CLK_06250);
580 udelay(100); /* wait for 100 us */
583 lcd_init((uchar *)CONFIG_SYS_LCD_SMALL_REG, (uchar *)CONFIG_SYS_LCD_SMALL_MEM,
584 regs_13705_320_240_8bpp,
585 sizeof(regs_13705_320_240_8bpp)/sizeof(regs_13705_320_240_8bpp[0]),
586 logo_bmp_320_8bpp, sizeof(logo_bmp_320_8bpp));
587 } else if (strcmp(str, "ppc210") == 0) {
589 * Set default display contrast voltage
591 if (contrast0 == 0xffffffff) {
592 out_be16(FPGA_CTR, 0x0060);
594 out_be16(FPGA_CTR, contrast0);
596 out_be16(FPGA_BL, 0xffff);
598 * Switch backlight on
603 FPGA_CTRL_VGA0_BL_MODE);
605 * Set lcd clock (small epson), enable 1-wire interface
610 FPGA_CTRL_OW_ENABLE);
613 lcd_init((uchar *)CONFIG_SYS_LCD_SMALL_REG, (uchar *)CONFIG_SYS_LCD_SMALL_MEM,
614 regs_13704_320_240_4bpp,
615 sizeof(regs_13704_320_240_4bpp)/sizeof(regs_13704_320_240_4bpp[0]),
616 logo_bmp_320, sizeof(logo_bmp_320));
617 #ifdef CONFIG_VIDEO_SM501
622 * Is SM501 connected (ppc221/ppc231)?
624 devbusfn = pci_find_device(PCI_VENDOR_SM, PCI_DEVICE_SM501, 0);
625 if (devbusfn != -1) {
626 puts("VGA: SM501 with 8 MB ");
627 if (strcmp(str, "ppc221") == 0) {
628 printf("(800*600, %dbpp)\n", BPP);
629 out_be16(FPGA_BL, 0x002d); /* max. allowed brightness */
630 } else if (strcmp(str, "ppc231") == 0) {
631 printf("(1024*768, %dbpp)\n", BPP);
632 out_be16(FPGA_BL, 0x0000);
634 printf("Unsupported bd_type defined (%s) -> No display configured!\n", str);
638 printf("Unsupported bd_type defined (%s) -> No display configured!\n", str);
641 #endif /* CONFIG_VIDEO_SM501 */
651 * Check Board Identity:
654 int checkboard (void)
657 int i = getenv_r ("serial#", str, sizeof(str));
662 puts ("### No HW ID - assuming HH405");
667 if (getenv_r("bd_type", str, sizeof(str)) != -1) {
670 puts(" (Missing bd_type!");
673 gd->board_type = board_revision();
674 printf(", Rev %ld.x)\n", gd->board_type);
679 #ifdef CONFIG_IDE_RESET
680 void ide_set_reset(int on)
682 if (((gd->board_type >= 2) &&
683 (in_be16(FPGA_STATUS) & FPGA_STATUS_CF_DETECT)) ||
684 (gd->board_type < 2)) {
686 * Assert or deassert CompactFlash Reset Pin
688 if (on) { /* assert RESET */
692 ~FPGA_CTRL_CF_RESET);
693 } else { /* release RESET */
700 #endif /* CONFIG_IDE_RESET */
703 #if defined(CONFIG_SYS_EEPROM_WREN)
704 /* Input: <dev_addr> I2C address of EEPROM device to enable.
705 * <state> -1: deliver current state
708 * Returns: -1: wrong device address
709 * 0: dis-/en- able done
710 * 0/1: current state if <state> was -1.
712 int eeprom_write_enable (unsigned dev_addr, int state)
714 if (CONFIG_SYS_I2C_EEPROM_ADDR != dev_addr) {
719 /* Enable write access, clear bit GPIO_SINT2. */
720 out_be32((void *)GPIO0_OR,
721 in_be32((void *)GPIO0_OR) & ~CONFIG_SYS_EEPROM_WP);
725 /* Disable write access, set bit GPIO_SINT2. */
726 out_be32((void *)GPIO0_OR,
727 in_be32((void *)GPIO0_OR) | CONFIG_SYS_EEPROM_WP);
731 /* Read current status back. */
732 state = (0 == (in_be32((void *)GPIO0_OR) &
733 CONFIG_SYS_EEPROM_WP));
740 int do_eep_wren (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
742 int query = argc == 1;
746 /* Query write access state. */
747 state = eeprom_write_enable (CONFIG_SYS_I2C_EEPROM_ADDR, -1);
749 puts ("Query of write access state failed.\n");
751 printf ("Write access for device 0x%0x is %sabled.\n",
752 CONFIG_SYS_I2C_EEPROM_ADDR, state ? "en" : "dis");
756 if ('0' == argv[1][0]) {
757 /* Disable write access. */
758 state = eeprom_write_enable (CONFIG_SYS_I2C_EEPROM_ADDR, 0);
760 /* Enable write access. */
761 state = eeprom_write_enable (CONFIG_SYS_I2C_EEPROM_ADDR, 1);
764 puts ("Setup of write access state failed.\n");
771 U_BOOT_CMD(eepwren, 2, 0, do_eep_wren,
772 "Enable / disable / query EEPROM write access",
774 #endif /* #if defined(CONFIG_SYS_EEPROM_WREN) */
777 #ifdef CONFIG_VIDEO_SM501
778 #ifdef CONFIG_CONSOLE_EXTRA_INFO
780 * Return text to be printed besides the logo.
782 void video_get_info_str (int line_number, char *info)
786 int i = getenv_r("serial#", str2, sizeof(str));
788 if (line_number == 1) {
789 sprintf(str, " Board: ");
792 strcat(str, "### No HW ID - assuming HH405");
797 if (getenv_r("bd_type", str2, sizeof(str2)) != -1) {
801 strcat(str, " (Missing bd_type!");
804 sprintf(str2, ", Rev %ld.x)", gd->board_type);
811 #endif /* CONFIG_CONSOLE_EXTRA_INFO */
814 * Returns SM501 register base address. First thing called in the driver.
816 unsigned int board_video_init (void)
822 * Is SM501 connected (ppc221/ppc231)?
824 devbusfn = pci_find_device(PCI_VENDOR_SM, PCI_DEVICE_SM501, 0);
825 if (devbusfn != -1) {
826 pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_1, (u32 *)&addr);
827 return (addr & 0xfffffffe);
834 * Returns SM501 framebuffer address
836 unsigned int board_video_get_fb (void)
842 * Is SM501 connected (ppc221/ppc231)?
844 devbusfn = pci_find_device(PCI_VENDOR_SM, PCI_DEVICE_SM501, 0);
845 if (devbusfn != -1) {
846 pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_0, (u32 *)&addr);
848 #ifdef CONFIG_VIDEO_SM501_FBMEM_OFFSET
849 addr += CONFIG_VIDEO_SM501_FBMEM_OFFSET;
858 * Called after initializing the SM501 and before clearing the screen.
860 void board_validate_screen (unsigned int base)
865 * Return a pointer to the initialization sequence.
867 const SMI_REGS *board_get_regs (void)
871 str = getenv("bd_type");
872 if (strcmp(str, "ppc221") == 0) {
873 return init_regs_800x600;
875 return init_regs_1024x768;
879 int board_get_width (void)
883 str = getenv("bd_type");
884 if (strcmp(str, "ppc221") == 0) {
891 int board_get_height (void)
895 str = getenv("bd_type");
896 if (strcmp(str, "ppc221") == 0) {
903 #endif /* CONFIG_VIDEO_SM501 */
908 #ifdef CONFIG_LXT971_NO_SLEEP
911 * Disable sleep mode in LXT971