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 * SPDX-License-Identifier: GPL-2.0+
15 #include <asm/processor.h>
22 DECLARE_GLOBAL_DATA_PTR;
24 /* FPGA internal regs */
25 #define FPGA_CTRL ((u16 *)(CONFIG_SYS_FPGA_BASE_ADDR + 0x000))
26 #define FPGA_STATUS ((u16 *)(CONFIG_SYS_FPGA_BASE_ADDR + 0x002))
27 #define FPGA_CTR ((u16 *)(CONFIG_SYS_FPGA_BASE_ADDR + 0x004))
28 #define FPGA_BL ((u16 *)(CONFIG_SYS_FPGA_BASE_ADDR + 0x006))
30 /* FPGA Control Reg */
31 #define FPGA_CTRL_REV0 0x0001
32 #define FPGA_CTRL_REV1 0x0002
33 #define FPGA_CTRL_VGA0_BL 0x0004
34 #define FPGA_CTRL_VGA0_BL_MODE 0x0008
35 #define FPGA_CTRL_CF_RESET 0x0040
36 #define FPGA_CTRL_PS2_PWR 0x0080
37 #define FPGA_CTRL_CF_PWRN 0x0100 /* low active */
38 #define FPGA_CTRL_CF_BUS_EN 0x0200
39 #define FPGA_CTRL_LCD_CLK 0x7000 /* mask for lcd clock */
40 #define FPGA_CTRL_OW_ENABLE 0x8000
42 #define FPGA_STATUS_CF_DETECT 0x8000
44 #ifdef CONFIG_VIDEO_SM501
46 #define SWAP32(x) ((((x) & 0x000000ff) << 24) | (((x) & 0x0000ff00) << 8)|\
47 (((x) & 0x00ff0000) >> 8) | (((x) & 0xff000000) >> 24) )
49 #ifdef CONFIG_VIDEO_SM501_8BPP
50 #error CONFIG_VIDEO_SM501_8BPP not supported.
51 #endif /* CONFIG_VIDEO_SM501_8BPP */
53 #ifdef CONFIG_VIDEO_SM501_16BPP
57 * 800x600 display B084SN03: PCLK = 40MHz
62 static const SMI_REGS init_regs_800x600 [] =
65 {0x0005c, SWAP32(0xffffffff)}, /* set endianess to big endian */
67 {0x0005c, SWAP32(0x00000000)}, /* set endianess to little endian */
69 {0x00004, SWAP32(0x00000000)},
70 /* clocks for pm1... */
71 {0x00048, SWAP32(0x00021807)},
72 {0x0004C, SWAP32(0x221a0a01)},
73 {0x00054, SWAP32(0x00000001)},
74 /* clocks for pm0... */
75 {0x00040, SWAP32(0x00021807)},
76 {0x00044, SWAP32(0x221a0a01)},
77 {0x00054, SWAP32(0x00000000)},
79 {0x1000c, SWAP32(0xfffffff0)}, /* GPIO32..63 direction */
80 /* panel control regs... */
81 {0x80000, SWAP32(0x0f013105)}, /* panel display control: 16-bit RGB 5:6:5 mode */
82 {0x80004, SWAP32(0xc428bb17)}, /* panel panning control ??? */
83 {0x8000C, SWAP32(0x00010000)}, /* panel fb address */
84 {0x80010, SWAP32(0x06400640)}, /* panel fb offset/window width */
85 {0x80014, SWAP32(0x03200000)}, /* panel fb width (0x320=800) */
86 {0x80018, SWAP32(0x02580000)}, /* panel fb height (0x258=600) */
87 {0x8001C, SWAP32(0x00000000)}, /* panel plane tl location */
88 {0x80020, SWAP32(0x02580320)}, /* panel plane br location */
89 {0x80024, SWAP32(0x041f031f)}, /* panel horizontal total */
90 {0x80028, SWAP32(0x00800347)}, /* panel horizontal sync */
91 {0x8002C, SWAP32(0x02730257)}, /* panel vertical total */
92 {0x80030, SWAP32(0x00040258)}, /* panel vertical sync */
93 {0x80200, SWAP32(0x00010000)}, /* crt display control */
98 * 1024x768 display G150XG02: PCLK = 65MHz
103 static const SMI_REGS init_regs_1024x768 [] =
105 {0x00004, SWAP32(0x00000000)},
106 /* clocks for pm1... */
107 {0x00048, SWAP32(0x00021807)},
108 {0x0004C, SWAP32(0x011a0a01)},
109 {0x00054, SWAP32(0x00000001)},
110 /* clocks for pm0... */
111 {0x00040, SWAP32(0x00021807)},
112 {0x00044, SWAP32(0x011a0a01)},
113 {0x00054, SWAP32(0x00000000)},
115 {0x1000c, SWAP32(0xfffffff0)}, /* GPIO32..63 direction */
116 /* panel control regs... */
117 {0x80000, SWAP32(0x0f013105)}, /* panel display control: 16-bit RGB 5:6:5 mode */
118 {0x80004, SWAP32(0xc428bb17)}, /* panel panning control ??? */
119 {0x8000C, SWAP32(0x00010000)}, /* panel fb address */
120 {0x80010, SWAP32(0x08000800)}, /* panel fb offset/window width */
121 {0x80014, SWAP32(0x04000000)}, /* panel fb width (0x400=1024) */
122 {0x80018, SWAP32(0x03000000)}, /* panel fb height (0x300=768) */
123 {0x8001C, SWAP32(0x00000000)}, /* panel plane tl location */
124 {0x80020, SWAP32(0x03000400)}, /* panel plane br location */
125 {0x80024, SWAP32(0x053f03ff)}, /* panel horizontal total */
126 {0x80028, SWAP32(0x0140040f)}, /* panel horizontal sync */
127 {0x8002C, SWAP32(0x032502ff)}, /* panel vertical total */
128 {0x80030, SWAP32(0x00260301)}, /* panel vertical sync */
129 {0x80200, SWAP32(0x00010000)}, /* crt display control */
133 #endif /* CONFIG_VIDEO_SM501_16BPP */
135 #ifdef CONFIG_VIDEO_SM501_32BPP
139 * 800x600 display B084SN03: PCLK = 40MHz
144 static const SMI_REGS init_regs_800x600 [] =
146 #if 0 /* test-only */
147 {0x0005c, SWAP32(0xffffffff)}, /* set endianess to big endian */
149 {0x0005c, SWAP32(0x00000000)}, /* set endianess to little endian */
151 {0x00004, SWAP32(0x00000000)},
152 /* clocks for pm1... */
153 {0x00048, SWAP32(0x00021807)},
154 {0x0004C, SWAP32(0x221a0a01)},
155 {0x00054, SWAP32(0x00000001)},
156 /* clocks for pm0... */
157 {0x00040, SWAP32(0x00021807)},
158 {0x00044, SWAP32(0x221a0a01)},
159 {0x00054, SWAP32(0x00000000)},
161 {0x1000c, SWAP32(0xfffffff0)}, /* GPIO32..63 direction */
162 /* panel control regs... */
163 {0x80000, SWAP32(0x0f013106)}, /* panel display control: 32-bit RGB 8:8:8 mode */
164 {0x80004, SWAP32(0xc428bb17)}, /* panel panning control ??? */
165 {0x8000C, SWAP32(0x00010000)}, /* panel fb address */
166 {0x80010, SWAP32(0x0c800c80)}, /* panel fb offset/window width */
167 {0x80014, SWAP32(0x03200000)}, /* panel fb width (0x320=800) */
168 {0x80018, SWAP32(0x02580000)}, /* panel fb height (0x258=600) */
169 {0x8001C, SWAP32(0x00000000)}, /* panel plane tl location */
170 {0x80020, SWAP32(0x02580320)}, /* panel plane br location */
171 {0x80024, SWAP32(0x041f031f)}, /* panel horizontal total */
172 {0x80028, SWAP32(0x00800347)}, /* panel horizontal sync */
173 {0x8002C, SWAP32(0x02730257)}, /* panel vertical total */
174 {0x80030, SWAP32(0x00040258)}, /* panel vertical sync */
175 {0x80200, SWAP32(0x00010000)}, /* crt display control */
180 * 1024x768 display G150XG02: PCLK = 65MHz
185 static const SMI_REGS init_regs_1024x768 [] =
187 {0x00004, SWAP32(0x00000000)},
188 /* clocks for pm1... */
189 {0x00048, SWAP32(0x00021807)},
190 {0x0004C, SWAP32(0x011a0a01)},
191 {0x00054, SWAP32(0x00000001)},
192 /* clocks for pm0... */
193 {0x00040, SWAP32(0x00021807)},
194 {0x00044, SWAP32(0x011a0a01)},
195 {0x00054, SWAP32(0x00000000)},
197 {0x1000c, SWAP32(0xfffffff0)}, /* GPIO32..63 direction */
198 /* panel control regs... */
199 {0x80000, SWAP32(0x0f013106)}, /* panel display control: 32-bit RGB 8:8:8 mode */
200 {0x80004, SWAP32(0xc428bb17)}, /* panel panning control ??? */
201 {0x8000C, SWAP32(0x00010000)}, /* panel fb address */
202 {0x80010, SWAP32(0x10001000)}, /* panel fb offset/window width */
203 {0x80014, SWAP32(0x04000000)}, /* panel fb width (0x400=1024) */
204 {0x80018, SWAP32(0x03000000)}, /* panel fb height (0x300=768) */
205 {0x8001C, SWAP32(0x00000000)}, /* panel plane tl location */
206 {0x80020, SWAP32(0x03000400)}, /* panel plane br location */
207 {0x80024, SWAP32(0x053f03ff)}, /* panel horizontal total */
208 {0x80028, SWAP32(0x0140040f)}, /* panel horizontal sync */
209 {0x8002C, SWAP32(0x032502ff)}, /* panel vertical total */
210 {0x80030, SWAP32(0x00260301)}, /* panel vertical sync */
211 {0x80200, SWAP32(0x00010000)}, /* crt display control */
215 #endif /* CONFIG_VIDEO_SM501_32BPP */
217 #endif /* CONFIG_VIDEO_SM501 */
223 extern void lxt971_no_sleep(void);
225 /* fpga configuration data - gzip compressed and generated by bin2c */
226 const unsigned char fpgadata[] =
228 #include "fpgadata.c"
232 * include common fpga code (for esd boards)
234 #include "../common/fpga.c"
237 /* logo bitmap data - gzip compressed and generated by bin2c */
238 unsigned char logo_bmp_320[] =
240 #include "logo_320_240_4bpp.c"
243 unsigned char logo_bmp_320_8bpp[] =
245 #include "logo_320_240_8bpp.c"
248 unsigned char logo_bmp_640[] =
250 #include "logo_640_480_24bpp.c"
253 unsigned char logo_bmp_1024[] =
255 #include "logo_1024_768_8bpp.c"
260 * include common lcd code (for esd boards)
262 #include "../common/lcd.c"
264 #include "../common/s1d13704_320_240_4bpp.h"
265 #include "../common/s1d13705_320_240_8bpp.h"
266 #include "../common/s1d13806_640_480_16bpp.h"
267 #include "../common/s1d13806_1024_768_8bpp.h"
271 * include common auto-update code (for esd boards)
273 #include "../common/auto_update.h"
275 au_image_t au_image[] = {
276 {"hh405/preinst.img", 0, -1, AU_SCRIPT},
277 {"hh405/u-boot.img", 0xfff80000, 0x00080000, AU_FIRMWARE},
278 {"hh405/pImage_${bd_type}", 0x00000000, 0x00100000, AU_NAND},
279 {"hh405/pImage.initrd", 0x00100000, 0x00200000, AU_NAND},
280 {"hh405/yaffsmt2.img", 0x00300000, 0x01c00000, AU_NAND},
281 {"hh405/postinst.img", 0, 0, AU_SCRIPT},
284 int N_AU_IMAGES = (sizeof(au_image) / sizeof(au_image[0]));
288 * Get version of HH405 board from GPIO's
290 int board_revision(void)
292 unsigned long osrh_reg;
293 unsigned long isr1h_reg;
294 unsigned long tcr_reg;
298 * Setup GPIO pins (BLAST/GPIO0 and GPIO9 as GPIO)
300 osrh_reg = in_be32((void *)GPIO0_OSRH);
301 isr1h_reg = in_be32((void *)GPIO0_ISR1H);
302 tcr_reg = in_be32((void *)GPIO0_TCR);
303 out_be32((void *)GPIO0_OSRH, osrh_reg & ~0xC0003000); /* output select */
304 out_be32((void *)GPIO0_ISR1H, isr1h_reg | 0xC0003000); /* input select */
305 out_be32((void *)GPIO0_TCR, tcr_reg & ~0x80400000); /* select input */
307 udelay(1000); /* wait some time before reading input */
308 value = in_be32((void *)GPIO0_IR) & 0x80400000; /* get config bits */
311 * Restore GPIO settings
313 out_be32((void *)GPIO0_OSRH, osrh_reg); /* output select */
314 out_be32((void *)GPIO0_ISR1H, isr1h_reg); /* input select */
315 out_be32((void *)GPIO0_TCR, tcr_reg); /* enable output driver for outputs */
317 if (value & 0x80000000) {
318 /* Revision 1.0 or 1.1 detected */
321 if (value & 0x00400000) {
331 int board_early_init_f (void)
334 * IRQ 0-15 405GP internally generated; active high; level sensitive
335 * IRQ 16 405GP internally generated; active low; level sensitive
337 * IRQ 25 (EXT IRQ 0) CAN0; active low; level sensitive
338 * IRQ 26 (EXT IRQ 1) SER0 ; active low; level sensitive
339 * IRQ 27 (EXT IRQ 2) SER1; active low; level sensitive
340 * IRQ 28 (EXT IRQ 3) FPGA 0; active low; level sensitive
341 * IRQ 29 (EXT IRQ 4) FPGA 1; active low; level sensitive
342 * IRQ 30 (EXT IRQ 5) PCI INTA; active low; level sensitive
343 * IRQ 31 (EXT IRQ 6) COMPACT FLASH; active high; level sensitive
345 mtdcr(UIC0SR, 0xFFFFFFFF); /* clear all ints */
346 mtdcr(UIC0ER, 0x00000000); /* disable all ints */
347 mtdcr(UIC0CR, 0x00000000); /* set all to be non-critical*/
348 mtdcr(UIC0PR, CONFIG_SYS_UIC0_POLARITY);/* set int polarities */
349 mtdcr(UIC0TR, 0x10000000); /* set int trigger levels */
350 mtdcr(UIC0VCR, 0x00000001); /* set vect base=0,INT0 highest priority*/
351 mtdcr(UIC0SR, 0xFFFFFFFF); /* clear all ints */
354 * EBC Configuration Register: set ready timeout to 512 ebc-clks -> ca. 15 us
356 mtebc(EBC0_CFG, 0xa8400000); /* ebc always driven */
365 if (gd->board_type >= 2) {
366 if (in_be16(FPGA_STATUS) & FPGA_STATUS_CF_DETECT) {
367 if (!(in_be16(FPGA_CTRL) & FPGA_CTRL_CF_BUS_EN)) {
369 in_be16(FPGA_CTRL) & ~FPGA_CTRL_CF_PWRN);
371 for (i=0; i<300; i++)
375 in_be16(FPGA_CTRL) | FPGA_CTRL_CF_BUS_EN);
382 in_be16(FPGA_CTRL) & ~FPGA_CTRL_CF_BUS_EN);
384 in_be16(FPGA_CTRL) | FPGA_CTRL_CF_PWRN);
391 int misc_init_r (void)
394 ulong len = sizeof(fpgadata);
399 unsigned long contrast0 = 0xffffffff;
401 dst = malloc(CONFIG_SYS_FPGA_MAX_SIZE);
402 if (gunzip (dst, CONFIG_SYS_FPGA_MAX_SIZE, (uchar *)fpgadata, &len) != 0) {
403 printf ("GUNZIP ERROR - must RESET board to recover\n");
404 do_reset (NULL, 0, 0, NULL);
407 status = fpga_boot(dst, len);
409 printf("\nFPGA: Booting failed ");
411 case ERROR_FPGA_PRG_INIT_LOW:
412 printf("(Timeout: INIT not low after asserting PROGRAM*)\n ");
414 case ERROR_FPGA_PRG_INIT_HIGH:
415 printf("(Timeout: INIT not high after deasserting PROGRAM*)\n ");
417 case ERROR_FPGA_PRG_DONE:
418 printf("(Timeout: DONE not high after programming FPGA)\n ");
422 /* display infos on fpgaimage */
424 for (i=0; i<4; i++) {
426 printf("FPGA: %s\n", &(dst[index+1]));
431 for (i=20; i>0; i--) {
432 printf("Rebooting in %2d seconds \r",i);
433 for (index=0;index<1000;index++)
437 do_reset(NULL, 0, 0, NULL);
442 /* display infos on fpgaimage */
444 for (i=0; i<4; i++) {
446 printf("%s ", &(dst[index+1]));
454 * Reset FPGA via FPGA_INIT pin
456 /* setup FPGA_INIT as output */
457 out_be32((void *)GPIO0_TCR,
458 in_be32((void *)GPIO0_TCR) | FPGA_INIT);
459 out_be32((void *)GPIO0_OR,
460 in_be32((void *)GPIO0_OR) & ~FPGA_INIT); /* reset low */
461 udelay(1000); /* wait 1ms */
462 out_be32((void *)GPIO0_OR,
463 in_be32((void *)GPIO0_OR) | FPGA_INIT); /* reset high */
464 udelay(1000); /* wait 1ms */
467 * Write Board revision into FPGA
469 out_be16(FPGA_CTRL, in_be16(FPGA_CTRL) | (gd->board_type & 0x0003));
472 * Setup and enable EEPROM write protection
474 out_be32((void *)GPIO0_OR,
475 in_be32((void *)GPIO0_OR) | CONFIG_SYS_EEPROM_WP);
478 * Reset touch-screen controller
480 out_be32((void *)GPIO0_OR,
481 in_be32((void *)GPIO0_OR) & ~CONFIG_SYS_TOUCH_RST);
483 out_be32((void *)GPIO0_OR,
484 in_be32((void *)GPIO0_OR) | CONFIG_SYS_TOUCH_RST);
487 * Enable power on PS/2 interface (with reset)
489 out_be16(FPGA_CTRL, in_be16(FPGA_CTRL) & ~FPGA_CTRL_PS2_PWR);
492 out_be16(FPGA_CTRL, in_be16(FPGA_CTRL) | FPGA_CTRL_PS2_PWR);
495 * Get contrast value from environment variable
497 str = getenv("contrast0");
499 contrast0 = simple_strtol(str, NULL, 16);
500 if (contrast0 > 255) {
501 printf("ERROR: contrast0 value too high (0x%lx)!\n",
503 contrast0 = 0xffffffff;
508 * Init lcd interface and display logo
511 str = getenv("bd_type");
512 if (strcmp(str, "ppc230") == 0) {
514 * Switch backlight on
517 in_be16(FPGA_CTRL) | FPGA_CTRL_VGA0_BL);
518 out_be16(FPGA_BL, 0x0000);
521 lcd_init((uchar *)CONFIG_SYS_LCD_BIG_REG, (uchar *)CONFIG_SYS_LCD_BIG_MEM,
522 regs_13806_1024_768_8bpp,
523 sizeof(regs_13806_1024_768_8bpp)/sizeof(regs_13806_1024_768_8bpp[0]),
524 logo_bmp_1024, sizeof(logo_bmp_1024));
525 } else if (strcmp(str, "ppc220") == 0) {
527 * Switch backlight on
530 in_be16(FPGA_CTRL) & ~FPGA_CTRL_VGA0_BL);
531 out_be16(FPGA_BL, 0x0000);
534 lcd_init((uchar *)CONFIG_SYS_LCD_BIG_REG, (uchar *)CONFIG_SYS_LCD_BIG_MEM,
535 regs_13806_640_480_16bpp,
536 sizeof(regs_13806_640_480_16bpp)/sizeof(regs_13806_640_480_16bpp[0]),
537 logo_bmp_640, sizeof(logo_bmp_640));
538 } else if (strcmp(str, "ppc215") == 0) {
540 * Set default display contrast voltage
542 if (contrast0 == 0xffffffff) {
543 out_be16(FPGA_CTR, 0x0082);
545 out_be16(FPGA_CTR, contrast0);
547 out_be16(FPGA_BL, 0xffff);
549 * Switch backlight on
554 FPGA_CTRL_VGA0_BL_MODE);
556 * Set lcd clock (small epson)
558 out_be16(FPGA_CTRL, in_be16(FPGA_CTRL) | LCD_CLK_06250);
559 udelay(100); /* wait for 100 us */
562 lcd_init((uchar *)CONFIG_SYS_LCD_SMALL_REG, (uchar *)CONFIG_SYS_LCD_SMALL_MEM,
563 regs_13705_320_240_8bpp,
564 sizeof(regs_13705_320_240_8bpp)/sizeof(regs_13705_320_240_8bpp[0]),
565 logo_bmp_320_8bpp, sizeof(logo_bmp_320_8bpp));
566 } else if (strcmp(str, "ppc210") == 0) {
568 * Set default display contrast voltage
570 if (contrast0 == 0xffffffff) {
571 out_be16(FPGA_CTR, 0x0060);
573 out_be16(FPGA_CTR, contrast0);
575 out_be16(FPGA_BL, 0xffff);
577 * Switch backlight on
582 FPGA_CTRL_VGA0_BL_MODE);
584 * Set lcd clock (small epson), enable 1-wire interface
589 FPGA_CTRL_OW_ENABLE);
592 lcd_init((uchar *)CONFIG_SYS_LCD_SMALL_REG, (uchar *)CONFIG_SYS_LCD_SMALL_MEM,
593 regs_13704_320_240_4bpp,
594 sizeof(regs_13704_320_240_4bpp)/sizeof(regs_13704_320_240_4bpp[0]),
595 logo_bmp_320, sizeof(logo_bmp_320));
596 #ifdef CONFIG_VIDEO_SM501
601 * Is SM501 connected (ppc221/ppc231)?
603 devbusfn = pci_find_device(PCI_VENDOR_SM, PCI_DEVICE_SM501, 0);
604 if (devbusfn != -1) {
605 puts("VGA: SM501 with 8 MB ");
606 if (strcmp(str, "ppc221") == 0) {
607 printf("(800*600, %dbpp)\n", BPP);
608 out_be16(FPGA_BL, 0x002d); /* max. allowed brightness */
609 } else if (strcmp(str, "ppc231") == 0) {
610 printf("(1024*768, %dbpp)\n", BPP);
611 out_be16(FPGA_BL, 0x0000);
613 printf("Unsupported bd_type defined (%s) -> No display configured!\n", str);
617 printf("Unsupported bd_type defined (%s) -> No display configured!\n", str);
620 #endif /* CONFIG_VIDEO_SM501 */
630 * Check Board Identity:
633 int checkboard (void)
636 int i = getenv_f("serial#", str, sizeof(str));
641 puts ("### No HW ID - assuming HH405");
646 if (getenv_f("bd_type", str, sizeof(str)) != -1) {
649 puts(" (Missing bd_type!");
652 gd->board_type = board_revision();
653 printf(", Rev %ld.x)\n", gd->board_type);
658 #ifdef CONFIG_IDE_RESET
659 void ide_set_reset(int on)
661 if (((gd->board_type >= 2) &&
662 (in_be16(FPGA_STATUS) & FPGA_STATUS_CF_DETECT)) ||
663 (gd->board_type < 2)) {
665 * Assert or deassert CompactFlash Reset Pin
667 if (on) { /* assert RESET */
671 ~FPGA_CTRL_CF_RESET);
672 } else { /* release RESET */
679 #endif /* CONFIG_IDE_RESET */
682 #if defined(CONFIG_SYS_EEPROM_WREN)
683 /* Input: <dev_addr> I2C address of EEPROM device to enable.
684 * <state> -1: deliver current state
687 * Returns: -1: wrong device address
688 * 0: dis-/en- able done
689 * 0/1: current state if <state> was -1.
691 int eeprom_write_enable (unsigned dev_addr, int state)
693 if (CONFIG_SYS_I2C_EEPROM_ADDR != dev_addr) {
698 /* Enable write access, clear bit GPIO_SINT2. */
699 out_be32((void *)GPIO0_OR,
700 in_be32((void *)GPIO0_OR) & ~CONFIG_SYS_EEPROM_WP);
704 /* Disable write access, set bit GPIO_SINT2. */
705 out_be32((void *)GPIO0_OR,
706 in_be32((void *)GPIO0_OR) | CONFIG_SYS_EEPROM_WP);
710 /* Read current status back. */
711 state = (0 == (in_be32((void *)GPIO0_OR) &
712 CONFIG_SYS_EEPROM_WP));
719 int do_eep_wren (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
721 int query = argc == 1;
725 /* Query write access state. */
726 state = eeprom_write_enable (CONFIG_SYS_I2C_EEPROM_ADDR, -1);
728 puts ("Query of write access state failed.\n");
730 printf ("Write access for device 0x%0x is %sabled.\n",
731 CONFIG_SYS_I2C_EEPROM_ADDR, state ? "en" : "dis");
735 if ('0' == argv[1][0]) {
736 /* Disable write access. */
737 state = eeprom_write_enable (CONFIG_SYS_I2C_EEPROM_ADDR, 0);
739 /* Enable write access. */
740 state = eeprom_write_enable (CONFIG_SYS_I2C_EEPROM_ADDR, 1);
743 puts ("Setup of write access state failed.\n");
750 U_BOOT_CMD(eepwren, 2, 0, do_eep_wren,
751 "Enable / disable / query EEPROM write access",
754 #endif /* #if defined(CONFIG_SYS_EEPROM_WREN) */
757 #ifdef CONFIG_VIDEO_SM501
758 #ifdef CONFIG_CONSOLE_EXTRA_INFO
760 * Return text to be printed besides the logo.
762 void video_get_info_str (int line_number, char *info)
766 int i = getenv_f("serial#", str2, sizeof(str));
768 if (line_number == 1) {
769 sprintf(str, " Board: ");
772 strcat(str, "### No HW ID - assuming HH405");
777 if (getenv_f("bd_type", str2, sizeof(str2)) != -1) {
781 strcat(str, " (Missing bd_type!");
784 sprintf(str2, ", Rev %ld.x)", gd->board_type);
791 #endif /* CONFIG_CONSOLE_EXTRA_INFO */
794 * Returns SM501 register base address. First thing called in the driver.
796 unsigned int board_video_init (void)
802 * Is SM501 connected (ppc221/ppc231)?
804 devbusfn = pci_find_device(PCI_VENDOR_SM, PCI_DEVICE_SM501, 0);
805 if (devbusfn != -1) {
806 pci_read_config_dword(devbusfn, PCI_BASE_ADDRESS_1, (u32 *)&addr);
807 return (addr & 0xfffffffe);
814 * Returns SM501 framebuffer address
816 unsigned int board_video_get_fb (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_0, (u32 *)&addr);
828 #ifdef CONFIG_VIDEO_SM501_FBMEM_OFFSET
829 addr += CONFIG_VIDEO_SM501_FBMEM_OFFSET;
838 * Called after initializing the SM501 and before clearing the screen.
840 void board_validate_screen (unsigned int base)
845 * Return a pointer to the initialization sequence.
847 const SMI_REGS *board_get_regs (void)
851 str = getenv("bd_type");
852 if (strcmp(str, "ppc221") == 0) {
853 return init_regs_800x600;
855 return init_regs_1024x768;
859 int board_get_width (void)
863 str = getenv("bd_type");
864 if (strcmp(str, "ppc221") == 0) {
871 int board_get_height (void)
875 str = getenv("bd_type");
876 if (strcmp(str, "ppc221") == 0) {
883 #endif /* CONFIG_VIDEO_SM501 */
888 #ifdef CONFIG_LXT971_NO_SLEEP
891 * Disable sleep mode in LXT971