wdenk | 88e72a3 | 2003-06-19 23:04:19 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) 2002 Kyle Harris <kharris@nexus-tech.net>, Nexus Technologies, Inc. |
| 3 | * (C) 2002 Marius Groeger <mgroeger@sysgo.de>, Sysgo GmbH |
wdenk | 70764a3 | 2003-06-26 22:04:09 +0000 | [diff] [blame] | 4 | * (C) 2003 Robert Schwebel <r.schwebel@pengutronix.de>, Pengutronix |
wdenk | 88e72a3 | 2003-06-19 23:04:19 +0000 | [diff] [blame] | 5 | * |
| 6 | * See file CREDITS for list of people who contributed to this |
| 7 | * project. |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or |
| 10 | * modify it under the terms of the GNU General Public License as |
| 11 | * published by the Free Software Foundation; either version 2 of |
| 12 | * the License, or (at your option) any later version. |
| 13 | * |
| 14 | * This program is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 22 | * MA 02111-1307 USA |
| 23 | */ |
| 24 | |
| 25 | #include <common.h> |
Ben Warren | 0fd6aae | 2009-10-04 22:37:03 -0700 | [diff] [blame] | 26 | #include <netdev.h> |
wdenk | 88e72a3 | 2003-06-19 23:04:19 +0000 | [diff] [blame] | 27 | #include <asm/arch/pxa-regs.h> |
| 28 | |
Wolfgang Denk | 6405a15 | 2006-03-31 18:32:53 +0200 | [diff] [blame] | 29 | DECLARE_GLOBAL_DATA_PTR; |
| 30 | |
wdenk | 88e72a3 | 2003-06-19 23:04:19 +0000 | [diff] [blame] | 31 | /** |
| 32 | * board_init: - setup some data structures |
| 33 | * |
| 34 | * @return: 0 in case of success |
| 35 | */ |
| 36 | |
| 37 | int board_init (void) |
| 38 | { |
wdenk | 88e72a3 | 2003-06-19 23:04:19 +0000 | [diff] [blame] | 39 | /* memory and cpu-speed are setup before relocation */ |
| 40 | /* so we do _nothing_ here */ |
| 41 | |
| 42 | gd->bd->bi_arch_number = MACH_TYPE_LOGODL; |
| 43 | gd->bd->bi_boot_params = 0x08000100; |
| 44 | gd->bd->bi_baudrate = CONFIG_BAUDRATE; |
| 45 | |
| 46 | (*((volatile short*)0x14800000)) = 0xff; /* power on eth0 */ |
| 47 | (*((volatile short*)0x14000000)) = 0xff; /* power on uart */ |
| 48 | |
| 49 | return 0; |
| 50 | } |
| 51 | |
| 52 | |
| 53 | /** |
| 54 | * dram_init: - setup dynamic RAM |
| 55 | * |
| 56 | * @return: 0 in case of success |
| 57 | */ |
| 58 | |
| 59 | int dram_init (void) |
| 60 | { |
wdenk | 88e72a3 | 2003-06-19 23:04:19 +0000 | [diff] [blame] | 61 | gd->bd->bi_dram[0].start = PHYS_SDRAM_1; |
| 62 | gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; |
| 63 | |
wdenk | 57b2d80 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 64 | return 0; |
wdenk | 88e72a3 | 2003-06-19 23:04:19 +0000 | [diff] [blame] | 65 | } |
| 66 | |
| 67 | |
wdenk | 70764a3 | 2003-06-26 22:04:09 +0000 | [diff] [blame] | 68 | /** |
wdenk | 88e72a3 | 2003-06-19 23:04:19 +0000 | [diff] [blame] | 69 | * logodl_set_led: - switch LEDs on or off |
| 70 | * |
| 71 | * @param led: LED to switch (0,1) |
| 72 | * @param state: switch on (1) or off (0) |
| 73 | */ |
| 74 | |
| 75 | void logodl_set_led(int led, int state) |
| 76 | { |
| 77 | switch(led) { |
| 78 | |
wdenk | 70764a3 | 2003-06-26 22:04:09 +0000 | [diff] [blame] | 79 | case 0: |
| 80 | if (state==1) { |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 81 | CONFIG_SYS_LED_A_CR = CONFIG_SYS_LED_A_BIT; |
wdenk | 88e72a3 | 2003-06-19 23:04:19 +0000 | [diff] [blame] | 82 | } else if (state==0) { |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 83 | CONFIG_SYS_LED_A_SR = CONFIG_SYS_LED_A_BIT; |
wdenk | 88e72a3 | 2003-06-19 23:04:19 +0000 | [diff] [blame] | 84 | } |
| 85 | break; |
| 86 | |
wdenk | 70764a3 | 2003-06-26 22:04:09 +0000 | [diff] [blame] | 87 | case 1: |
wdenk | 88e72a3 | 2003-06-19 23:04:19 +0000 | [diff] [blame] | 88 | if (state==1) { |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 89 | CONFIG_SYS_LED_B_CR = CONFIG_SYS_LED_B_BIT; |
wdenk | 88e72a3 | 2003-06-19 23:04:19 +0000 | [diff] [blame] | 90 | } else if (state==0) { |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 91 | CONFIG_SYS_LED_B_SR = CONFIG_SYS_LED_B_BIT; |
wdenk | 88e72a3 | 2003-06-19 23:04:19 +0000 | [diff] [blame] | 92 | } |
| 93 | break; |
| 94 | } |
wdenk | 70764a3 | 2003-06-26 22:04:09 +0000 | [diff] [blame] | 95 | |
wdenk | 88e72a3 | 2003-06-19 23:04:19 +0000 | [diff] [blame] | 96 | return; |
| 97 | } |
| 98 | |
| 99 | |
| 100 | /** |
| 101 | * show_boot_progress: - indicate state of the boot process |
| 102 | * |
wdenk | 70764a3 | 2003-06-26 22:04:09 +0000 | [diff] [blame] | 103 | * @param status: Status number - see README for details. |
wdenk | 88e72a3 | 2003-06-19 23:04:19 +0000 | [diff] [blame] | 104 | * |
wdenk | 70764a3 | 2003-06-26 22:04:09 +0000 | [diff] [blame] | 105 | * The LOGOTRONIC does only have 2 LEDs, so we switch them on at the most |
wdenk | 88e72a3 | 2003-06-19 23:04:19 +0000 | [diff] [blame] | 106 | * important states (1, 5, 15). |
| 107 | */ |
| 108 | |
| 109 | void show_boot_progress (int status) |
| 110 | { |
Heiko Schocher | 633e03a | 2007-06-22 19:11:54 +0200 | [diff] [blame] | 111 | if (status < -32) status = -1; /* let things compatible */ |
wdenk | 88e72a3 | 2003-06-19 23:04:19 +0000 | [diff] [blame] | 112 | /* |
| 113 | switch(status) { |
| 114 | case 1: logodl_set_led(0,1); break; |
| 115 | case 5: logodl_set_led(1,1); break; |
| 116 | case 15: logodl_set_led(2,1); break; |
| 117 | } |
| 118 | */ |
| 119 | logodl_set_led(0, (status & 1)==1); |
| 120 | logodl_set_led(1, (status & 2)==2); |
| 121 | |
| 122 | return; |
| 123 | } |
Ben Warren | 0fd6aae | 2009-10-04 22:37:03 -0700 | [diff] [blame] | 124 | |
| 125 | #ifdef CONFIG_CMD_NET |
| 126 | int board_eth_init(bd_t *bis) |
| 127 | { |
| 128 | int rc = 0; |
| 129 | #ifdef CONFIG_SMC91111 |
| 130 | rc = smc91111_initialize(0, CONFIG_SMC91111_BASE); |
| 131 | #endif |
| 132 | return rc; |
| 133 | } |
| 134 | #endif |