Markus Klotzbücher | 20e3b32 | 2006-02-20 16:37:37 +0100 | [diff] [blame] | 1 | /* |
Markus Klotzbuecher | 9809551 | 2006-05-23 10:33:11 +0200 | [diff] [blame] | 2 | * (C) Copyright 2006 |
| 3 | * DENX Software Engineering |
Markus Klotzbücher | 20e3b32 | 2006-02-20 16:37:37 +0100 | [diff] [blame] | 4 | * |
| 5 | * See file CREDITS for list of people who contributed to this |
| 6 | * project. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License as |
| 10 | * published by the Free Software Foundation; either version 2 of |
| 11 | * the License, or (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 21 | * MA 02111-1307 USA |
| 22 | */ |
| 23 | |
| 24 | #include <common.h> |
Ben Warren | 0fd6aae | 2009-10-04 22:37:03 -0700 | [diff] [blame] | 25 | #include <netdev.h> |
Markus Klotzbuecher | 7cf18be | 2006-03-24 12:23:27 +0100 | [diff] [blame] | 26 | #include <i2c.h> |
| 27 | #include <da9030.h> |
Markus Klotzbuecher | 4629e66 | 2006-04-25 10:03:01 +0200 | [diff] [blame] | 28 | #include <malloc.h> |
| 29 | #include <command.h> |
Markus Klotzbuecher | 7cf18be | 2006-03-24 12:23:27 +0100 | [diff] [blame] | 30 | #include <asm/arch/pxa-regs.h> |
Marek Vasut | 2db1e96 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 31 | #include <asm/io.h> |
Markus Klotzbücher | 20e3b32 | 2006-02-20 16:37:37 +0100 | [diff] [blame] | 32 | |
Wolfgang Denk | 6405a15 | 2006-03-31 18:32:53 +0200 | [diff] [blame] | 33 | DECLARE_GLOBAL_DATA_PTR; |
| 34 | |
Markus Klotzbücher | 20e3b32 | 2006-02-20 16:37:37 +0100 | [diff] [blame] | 35 | /* ------------------------------------------------------------------------- */ |
| 36 | |
Markus Klotzbuecher | 7cf18be | 2006-03-24 12:23:27 +0100 | [diff] [blame] | 37 | static void init_DA9030(void); |
Markus Klotzbuecher | 4629e66 | 2006-04-25 10:03:01 +0200 | [diff] [blame] | 38 | static void keys_init(void); |
| 39 | static void get_pressed_keys(uchar *s); |
| 40 | static uchar *key_match(uchar *kbd_data); |
Markus Klotzbücher | 20e3b32 | 2006-02-20 16:37:37 +0100 | [diff] [blame] | 41 | |
| 42 | /* |
| 43 | * Miscelaneous platform dependent initialisations |
| 44 | */ |
| 45 | |
| 46 | int board_init (void) |
| 47 | { |
Markus Klotzbücher | 20e3b32 | 2006-02-20 16:37:37 +0100 | [diff] [blame] | 48 | /* memory and cpu-speed are setup before relocation */ |
| 49 | /* so we do _nothing_ here */ |
| 50 | |
Markus Klotzbücher | f4a5c61 | 2006-02-28 18:05:25 +0100 | [diff] [blame] | 51 | /* arch number of Lubbock-Board mk@tbd: fix this! */ |
Markus Klotzbücher | 20e3b32 | 2006-02-20 16:37:37 +0100 | [diff] [blame] | 52 | gd->bd->bi_arch_number = MACH_TYPE_LUBBOCK; |
| 53 | |
| 54 | /* adress of boot parameters */ |
| 55 | gd->bd->bi_boot_params = 0xa0000100; |
| 56 | |
| 57 | return 0; |
| 58 | } |
| 59 | |
| 60 | int board_late_init(void) |
| 61 | { |
Markus Klotzbuecher | 4629e66 | 2006-04-25 10:03:01 +0200 | [diff] [blame] | 62 | #ifdef DELTA_CHECK_KEYBD |
| 63 | uchar kbd_data[KEYBD_DATALEN]; |
| 64 | char keybd_env[2 * KEYBD_DATALEN + 1]; |
| 65 | char *str; |
| 66 | int i; |
| 67 | #endif /* DELTA_CHECK_KEYBD */ |
| 68 | |
Markus Klotzbücher | 20e3b32 | 2006-02-20 16:37:37 +0100 | [diff] [blame] | 69 | setenv("stdout", "serial"); |
| 70 | setenv("stderr", "serial"); |
Markus Klotzbuecher | 4629e66 | 2006-04-25 10:03:01 +0200 | [diff] [blame] | 71 | |
| 72 | #ifdef DELTA_CHECK_KEYBD |
| 73 | keys_init(); |
| 74 | |
| 75 | memset(kbd_data, '\0', KEYBD_DATALEN); |
| 76 | |
| 77 | /* check for pressed keys and setup keybd_env */ |
| 78 | get_pressed_keys(kbd_data); |
| 79 | |
| 80 | for (i = 0; i < KEYBD_DATALEN; ++i) { |
| 81 | sprintf (keybd_env + i + i, "%02X", kbd_data[i]); |
| 82 | } |
| 83 | setenv ("keybd", keybd_env); |
| 84 | |
| 85 | str = strdup ((char *)key_match (kbd_data)); /* decode keys */ |
| 86 | |
| 87 | # ifdef CONFIG_PREBOOT /* automatically configure "preboot" command on key match */ |
| 88 | setenv ("preboot", str); /* set or delete definition */ |
| 89 | # endif /* CONFIG_PREBOOT */ |
| 90 | if (str != NULL) { |
| 91 | free (str); |
| 92 | } |
| 93 | #endif /* DELTA_CHECK_KEYBD */ |
| 94 | |
Markus Klotzbuecher | 7cf18be | 2006-03-24 12:23:27 +0100 | [diff] [blame] | 95 | init_DA9030(); |
Markus Klotzbücher | 20e3b32 | 2006-02-20 16:37:37 +0100 | [diff] [blame] | 96 | return 0; |
| 97 | } |
| 98 | |
Markus Klotzbuecher | 4629e66 | 2006-04-25 10:03:01 +0200 | [diff] [blame] | 99 | /* |
| 100 | * Magic Key Handling, mainly copied from board/lwmon/lwmon.c |
| 101 | */ |
| 102 | #ifdef DELTA_CHECK_KEYBD |
| 103 | |
| 104 | static uchar kbd_magic_prefix[] = "key_magic"; |
| 105 | static uchar kbd_command_prefix[] = "key_cmd"; |
| 106 | |
| 107 | /* |
| 108 | * Get pressed keys |
| 109 | * s is a buffer of size KEYBD_DATALEN-1 |
| 110 | */ |
| 111 | static void get_pressed_keys(uchar *s) |
| 112 | { |
| 113 | unsigned long val; |
Marek Vasut | 2db1e96 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 114 | val = readl(GPLR3); |
Markus Klotzbuecher | 4629e66 | 2006-04-25 10:03:01 +0200 | [diff] [blame] | 115 | |
| 116 | if(val & (1<<31)) |
| 117 | *s++ = KEYBD_KP_DKIN0; |
| 118 | if(val & (1<<18)) |
| 119 | *s++ = KEYBD_KP_DKIN1; |
| 120 | if(val & (1<<29)) |
| 121 | *s++ = KEYBD_KP_DKIN2; |
| 122 | if(val & (1<<22)) |
| 123 | *s++ = KEYBD_KP_DKIN5; |
| 124 | } |
| 125 | |
| 126 | static void keys_init() |
| 127 | { |
Marek Vasut | 2db1e96 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 128 | writel(readl(CKENB) | CKENB_7_GPIO, CKENB); |
Markus Klotzbuecher | 4629e66 | 2006-04-25 10:03:01 +0200 | [diff] [blame] | 129 | udelay(100); |
| 130 | |
| 131 | /* Configure GPIOs */ |
Marek Vasut | 2db1e96 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 132 | writel(0xa840, GPIO127); /* KP_DKIN0 */ |
| 133 | writel(0xa840, GPIO114); /* KP_DKIN1 */ |
| 134 | writel(0xa840, GPIO125); /* KP_DKIN2 */ |
| 135 | writel(0xa840, GPIO118); /* KP_DKIN5 */ |
Markus Klotzbuecher | 4629e66 | 2006-04-25 10:03:01 +0200 | [diff] [blame] | 136 | |
| 137 | /* Configure GPIOs as inputs */ |
Marek Vasut | 2db1e96 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 138 | writel(readl(GPDR3) & ~(1<<31 | 1<<18 | 1<<29 | 1<<22), GPDR3); |
| 139 | writel((1<<31 | 1<<18 | 1<<29 | 1<<22), GCDR3); |
Markus Klotzbuecher | 4629e66 | 2006-04-25 10:03:01 +0200 | [diff] [blame] | 140 | |
| 141 | udelay(100); |
| 142 | } |
| 143 | |
| 144 | static int compare_magic (uchar *kbd_data, uchar *str) |
| 145 | { |
| 146 | /* uchar compare[KEYBD_DATALEN-1]; */ |
| 147 | uchar compare[KEYBD_DATALEN]; |
| 148 | char *nxt; |
| 149 | int i; |
| 150 | |
| 151 | /* Don't include modifier byte */ |
| 152 | /* memcpy (compare, kbd_data+1, KEYBD_DATALEN-1); */ |
| 153 | memcpy (compare, kbd_data, KEYBD_DATALEN); |
| 154 | |
| 155 | for (; str != NULL; str = (*nxt) ? (uchar *)(nxt+1) : (uchar *)nxt) { |
| 156 | uchar c; |
| 157 | int k; |
| 158 | |
| 159 | c = (uchar) simple_strtoul ((char *)str, (char **) (&nxt), 16); |
| 160 | |
| 161 | if (str == (uchar *)nxt) { /* invalid character */ |
| 162 | break; |
| 163 | } |
| 164 | |
| 165 | /* |
| 166 | * Check if this key matches the input. |
| 167 | * Set matches to zero, so they match only once |
| 168 | * and we can find duplicates or extra keys |
| 169 | */ |
| 170 | for (k = 0; k < sizeof(compare); ++k) { |
| 171 | if (compare[k] == '\0') /* only non-zero entries */ |
| 172 | continue; |
| 173 | if (c == compare[k]) { /* found matching key */ |
| 174 | compare[k] = '\0'; |
| 175 | break; |
| 176 | } |
| 177 | } |
| 178 | if (k == sizeof(compare)) { |
| 179 | return -1; /* unmatched key */ |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | /* |
| 184 | * A full match leaves no keys in the `compare' array, |
| 185 | */ |
| 186 | for (i = 0; i < sizeof(compare); ++i) { |
| 187 | if (compare[i]) |
| 188 | { |
| 189 | return -1; |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | return 0; |
| 194 | } |
| 195 | |
| 196 | |
| 197 | static uchar *key_match (uchar *kbd_data) |
| 198 | { |
| 199 | char magic[sizeof (kbd_magic_prefix) + 1]; |
| 200 | uchar *suffix; |
| 201 | char *kbd_magic_keys; |
| 202 | |
| 203 | /* |
| 204 | * The following string defines the characters that can pe appended |
| 205 | * to "key_magic" to form the names of environment variables that |
| 206 | * hold "magic" key codes, i. e. such key codes that can cause |
| 207 | * pre-boot actions. If the string is empty (""), then only |
| 208 | * "key_magic" is checked (old behaviour); the string "125" causes |
| 209 | * checks for "key_magic1", "key_magic2" and "key_magic5", etc. |
| 210 | */ |
| 211 | if ((kbd_magic_keys = getenv ("magic_keys")) == NULL) |
| 212 | kbd_magic_keys = ""; |
| 213 | |
| 214 | /* loop over all magic keys; |
| 215 | * use '\0' suffix in case of empty string |
| 216 | */ |
| 217 | for (suffix=(uchar *)kbd_magic_keys; *suffix || suffix==(uchar *)kbd_magic_keys; ++suffix) { |
| 218 | sprintf (magic, "%s%c", kbd_magic_prefix, *suffix); |
| 219 | #if 0 |
| 220 | printf ("### Check magic \"%s\"\n", magic); |
| 221 | #endif |
| 222 | if (compare_magic(kbd_data, (uchar *)getenv(magic)) == 0) { |
| 223 | char cmd_name[sizeof (kbd_command_prefix) + 1]; |
| 224 | char *cmd; |
| 225 | |
| 226 | sprintf (cmd_name, "%s%c", kbd_command_prefix, *suffix); |
| 227 | |
| 228 | cmd = getenv (cmd_name); |
| 229 | #if 0 |
| 230 | printf ("### Set PREBOOT to $(%s): \"%s\"\n", |
| 231 | cmd_name, cmd ? cmd : "<<NULL>>"); |
| 232 | #endif |
| 233 | *kbd_data = *suffix; |
| 234 | return ((uchar *)cmd); |
| 235 | } |
| 236 | } |
| 237 | #if 0 |
| 238 | printf ("### Delete PREBOOT\n"); |
| 239 | #endif |
| 240 | *kbd_data = '\0'; |
| 241 | return (NULL); |
| 242 | } |
| 243 | |
Wolfgang Denk | 6262d021 | 2010-06-28 22:00:46 +0200 | [diff] [blame] | 244 | int do_kbd (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
Markus Klotzbuecher | 4629e66 | 2006-04-25 10:03:01 +0200 | [diff] [blame] | 245 | { |
| 246 | uchar kbd_data[KEYBD_DATALEN]; |
| 247 | char keybd_env[2 * KEYBD_DATALEN + 1]; |
| 248 | int i; |
| 249 | |
| 250 | /* Read keys */ |
| 251 | get_pressed_keys(kbd_data); |
| 252 | puts ("Keys:"); |
| 253 | for (i = 0; i < KEYBD_DATALEN; ++i) { |
| 254 | sprintf (keybd_env + i + i, "%02X", kbd_data[i]); |
| 255 | printf (" %02x", kbd_data[i]); |
| 256 | } |
| 257 | putc ('\n'); |
| 258 | setenv ("keybd", keybd_env); |
| 259 | return 0; |
| 260 | } |
| 261 | |
| 262 | U_BOOT_CMD( |
| 263 | kbd, 1, 1, do_kbd, |
Peter Tyser | dfb72b8 | 2009-01-27 18:03:12 -0600 | [diff] [blame] | 264 | "read keyboard status", |
Wolfgang Denk | c54781c | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 265 | "" |
Markus Klotzbuecher | 4629e66 | 2006-04-25 10:03:01 +0200 | [diff] [blame] | 266 | ); |
| 267 | |
| 268 | #endif /* DELTA_CHECK_KEYBD */ |
| 269 | |
Markus Klotzbücher | 20e3b32 | 2006-02-20 16:37:37 +0100 | [diff] [blame] | 270 | |
| 271 | int dram_init (void) |
| 272 | { |
Markus Klotzbücher | 20e3b32 | 2006-02-20 16:37:37 +0100 | [diff] [blame] | 273 | gd->bd->bi_dram[0].start = PHYS_SDRAM_1; |
| 274 | gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; |
| 275 | gd->bd->bi_dram[1].start = PHYS_SDRAM_2; |
| 276 | gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE; |
| 277 | gd->bd->bi_dram[2].start = PHYS_SDRAM_3; |
| 278 | gd->bd->bi_dram[2].size = PHYS_SDRAM_3_SIZE; |
| 279 | gd->bd->bi_dram[3].start = PHYS_SDRAM_4; |
| 280 | gd->bd->bi_dram[3].size = PHYS_SDRAM_4_SIZE; |
| 281 | |
| 282 | return 0; |
| 283 | } |
Markus Klotzbuecher | 7cf18be | 2006-03-24 12:23:27 +0100 | [diff] [blame] | 284 | |
Markus Klotzbuecher | 3041319 | 2006-03-30 17:00:39 +0200 | [diff] [blame] | 285 | void i2c_init_board() |
Markus Klotzbuecher | 7cf18be | 2006-03-24 12:23:27 +0100 | [diff] [blame] | 286 | { |
Marek Vasut | 2db1e96 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 287 | writel(readl(CKENB) | (CKENB_4_I2C), CKENB); |
Markus Klotzbuecher | 7cf18be | 2006-03-24 12:23:27 +0100 | [diff] [blame] | 288 | |
| 289 | /* setup I2C GPIO's */ |
Marek Vasut | 2db1e96 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 290 | writel(0x801, GPIO32); /* SCL = Alt. Fkt. 1 */ |
| 291 | writel(0x801, GPIO33); /* SDA = Alt. Fkt. 1 */ |
Markus Klotzbuecher | 3041319 | 2006-03-30 17:00:39 +0200 | [diff] [blame] | 292 | } |
Markus Klotzbuecher | 7cf18be | 2006-03-24 12:23:27 +0100 | [diff] [blame] | 293 | |
Markus Klotzbuecher | 3041319 | 2006-03-30 17:00:39 +0200 | [diff] [blame] | 294 | /* initialize the DA9030 Power Controller */ |
| 295 | static void init_DA9030() |
| 296 | { |
| 297 | uchar addr = (uchar) DA9030_I2C_ADDR, val = 0; |
Markus Klotzbuecher | 7cf18be | 2006-03-24 12:23:27 +0100 | [diff] [blame] | 298 | |
Marek Vasut | 2db1e96 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 299 | writel(readl(CKENB) | CKENB_7_GPIO, CKENB); |
Markus Klotzbuecher | 3041319 | 2006-03-30 17:00:39 +0200 | [diff] [blame] | 300 | udelay(100); |
| 301 | |
| 302 | /* Rising Edge on EXTON to reset DA9030 */ |
Marek Vasut | 2db1e96 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 303 | writel(0x8800, GPIO17); /* configure GPIO17, no pullup, -down */ |
| 304 | writel(readl(GPDR0) | (1<<17), GPDR0); /* GPIO17 is output */ |
| 305 | writel((1<<17), GSDR0); |
| 306 | writel((1<<17), GPCR0); /* drive GPIO17 low */ |
| 307 | writel((1<<17), GPSR0); /* drive GPIO17 high */ |
Markus Klotzbuecher | 3041319 | 2006-03-30 17:00:39 +0200 | [diff] [blame] | 308 | |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 309 | #if CONFIG_SYS_DA9030_EXTON_DELAY |
| 310 | udelay((unsigned long) CONFIG_SYS_DA9030_EXTON_DELAY); /* wait for DA9030 */ |
Markus Klotzbuecher | b62261b | 2006-03-27 16:01:03 +0200 | [diff] [blame] | 311 | #endif |
Marek Vasut | 2db1e96 | 2010-09-09 09:50:39 +0200 | [diff] [blame] | 312 | writel((1<<17), GPCR0); /* drive GPIO17 low */ |
Markus Klotzbuecher | 7cf18be | 2006-03-24 12:23:27 +0100 | [diff] [blame] | 313 | |
| 314 | /* reset the watchdog and go active (0xec) */ |
| 315 | val = (SYS_CONTROL_A_HWRES_ENABLE | |
| 316 | (0x6<<4) | |
| 317 | SYS_CONTROL_A_WDOG_ACTION | |
| 318 | SYS_CONTROL_A_WATCHDOG); |
Markus Klotzbuecher | fdc33ac | 2006-03-29 17:49:27 +0200 | [diff] [blame] | 319 | if(i2c_write(addr, SYS_CONTROL_A, 1, &val, 1)) { |
| 320 | printf("Error accessing DA9030 via i2c.\n"); |
| 321 | return; |
| 322 | } |
Markus Klotzbuecher | 7cf18be | 2006-03-24 12:23:27 +0100 | [diff] [blame] | 323 | |
Markus Klotzbuecher | d8d023f | 2006-05-22 16:33:54 +0200 | [diff] [blame] | 324 | val = 0x80; |
| 325 | if(i2c_write(addr, IRQ_MASK_B, 1, &val, 1)) { |
| 326 | printf("Error accessing DA9030 via i2c.\n"); |
| 327 | return; |
| 328 | } |
| 329 | |
Markus Klotzbuecher | 7cf18be | 2006-03-24 12:23:27 +0100 | [diff] [blame] | 330 | i2c_reg_write(addr, REG_CONTROL_1_97, 0xfd); /* disable LDO1, enable LDO6 */ |
| 331 | i2c_reg_write(addr, LDO2_3, 0xd1); /* LDO2 =1,9V, LDO3=3,1V */ |
| 332 | i2c_reg_write(addr, LDO4_5, 0xcc); /* LDO2 =1,9V, LDO3=3,1V */ |
Markus Klotzbuecher | 3041319 | 2006-03-30 17:00:39 +0200 | [diff] [blame] | 333 | i2c_reg_write(addr, LDO6_SIMCP, 0x3e); /* LDO6=3,2V, SIMCP = 5V support */ |
Markus Klotzbuecher | 7cf18be | 2006-03-24 12:23:27 +0100 | [diff] [blame] | 334 | i2c_reg_write(addr, LDO7_8, 0xc9); /* LDO7=2,7V, LDO8=3,0V */ |
| 335 | i2c_reg_write(addr, LDO9_12, 0xec); /* LDO9=3,0V, LDO12=3,2V */ |
Markus Klotzbuecher | 3041319 | 2006-03-30 17:00:39 +0200 | [diff] [blame] | 336 | i2c_reg_write(addr, BUCK, 0x0c); /* Buck=1.2V */ |
Markus Klotzbuecher | 7cf18be | 2006-03-24 12:23:27 +0100 | [diff] [blame] | 337 | i2c_reg_write(addr, REG_CONTROL_2_98, 0x7f); /* All LDO'S on 8,9,10,11,12,14 */ |
Markus Klotzbuecher | 3041319 | 2006-03-30 17:00:39 +0200 | [diff] [blame] | 338 | i2c_reg_write(addr, LDO_10_11, 0xcc); /* LDO10=3.0V LDO11=3.0V */ |
Markus Klotzbuecher | 7cf18be | 2006-03-24 12:23:27 +0100 | [diff] [blame] | 339 | i2c_reg_write(addr, LDO_15, 0xae); /* LDO15=1.8V, dislock first 3bit */ |
Markus Klotzbuecher | 3041319 | 2006-03-30 17:00:39 +0200 | [diff] [blame] | 340 | i2c_reg_write(addr, LDO_14_16, 0x05); /* LDO14=2.8V, LDO16=NB */ |
Markus Klotzbuecher | 7cf18be | 2006-03-24 12:23:27 +0100 | [diff] [blame] | 341 | i2c_reg_write(addr, LDO_18_19, 0x9c); /* LDO18=3.0V, LDO19=2.7V */ |
| 342 | i2c_reg_write(addr, LDO_17_SIMCP0, 0x2c); /* LDO17=3.0V, SIMCP=3V support */ |
| 343 | i2c_reg_write(addr, BUCK2_DVC1, 0x9a); /* Buck2=1.5V plus Update support of 520 MHz */ |
| 344 | i2c_reg_write(addr, REG_CONTROL_2_18, 0x43); /* Ball on */ |
| 345 | i2c_reg_write(addr, MISC_CONTROLB, 0x08); /* session valid enable */ |
| 346 | i2c_reg_write(addr, USBPUMP, 0xc1); /* start pump, ignore HW signals */ |
| 347 | |
| 348 | val = i2c_reg_read(addr, STATUS); |
| 349 | if(val & STATUS_CHDET) |
| 350 | printf("Charger detected, turning on LED.\n"); |
| 351 | else { |
| 352 | printf("No charger detetected.\n"); |
| 353 | /* undervoltage? print error and power down */ |
| 354 | } |
| 355 | } |
| 356 | |
| 357 | |
| 358 | #if 0 |
| 359 | /* reset the DA9030 watchdog */ |
| 360 | void hw_watchdog_reset(void) |
| 361 | { |
| 362 | uchar addr = (uchar) DA9030_I2C_ADDR, val = 0; |
| 363 | val = i2c_reg_read(addr, SYS_CONTROL_A); |
| 364 | val |= SYS_CONTROL_A_WATCHDOG; |
| 365 | i2c_reg_write(addr, SYS_CONTROL_A, val); |
| 366 | } |
| 367 | #endif |
Ben Warren | 0fd6aae | 2009-10-04 22:37:03 -0700 | [diff] [blame] | 368 | |
| 369 | #ifdef CONFIG_CMD_NET |
| 370 | int board_eth_init(bd_t *bis) |
| 371 | { |
| 372 | int rc = 0; |
| 373 | #ifdef CONFIG_SMC91111 |
| 374 | rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); |
| 375 | #endif |
| 376 | return rc; |
| 377 | } |
| 378 | #endif |