stefano babic | 6708a60 | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2007 |
| 3 | * Stefano Babic, DENX Gmbh, sbabic@denx.de |
| 4 | * |
| 5 | * (C) Copyright 2004 |
| 6 | * Robert Whaley, Applied Data Systems, Inc. rwhaley@applieddata.net |
| 7 | * |
| 8 | * (C) Copyright 2002 |
| 9 | * Kyle Harris, Nexus Technologies, Inc. kharris@nexus-tech.net |
| 10 | * |
| 11 | * (C) Copyright 2002 |
| 12 | * Sysgo Real-Time Solutions, GmbH <www.elinos.com> |
| 13 | * Marius Groeger <mgroeger@sysgo.de> |
| 14 | * |
| 15 | * See file CREDITS for list of people who contributed to this |
| 16 | * project. |
| 17 | * |
| 18 | * This program is free software; you can redistribute it and/or |
| 19 | * modify it under the terms of the GNU General Public License as |
| 20 | * published by the Free Software Foundation; either version 2 of |
| 21 | * the License, or (at your option) any later version. |
| 22 | * |
| 23 | * This program is distributed in the hope that it will be useful, |
| 24 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 25 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 26 | * GNU General Public License for more details. |
| 27 | * |
| 28 | * You should have received a copy of the GNU General Public License |
| 29 | * along with this program; if not, write to the Free Software |
| 30 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 31 | * MA 02111-1307 USA |
| 32 | */ |
| 33 | |
| 34 | #include <common.h> |
| 35 | #include <asm/arch/pxa-regs.h> |
Remy Bohmer | 7eefd92 | 2009-05-02 21:49:18 +0200 | [diff] [blame] | 36 | #include <netdev.h> |
stefano babic | 6708a60 | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 37 | |
| 38 | DECLARE_GLOBAL_DATA_PTR; |
| 39 | |
| 40 | #define RH_A_PSM (1 << 8) /* power switching mode */ |
| 41 | #define RH_A_NPS (1 << 9) /* no power switching */ |
| 42 | |
| 43 | extern struct serial_device serial_ffuart_device; |
| 44 | extern struct serial_device serial_btuart_device; |
| 45 | extern struct serial_device serial_stuart_device; |
| 46 | |
Stefano Babic | e33f804 | 2009-07-01 20:40:41 +0200 | [diff] [blame] | 47 | #if CONFIG_POLARIS |
| 48 | #define BOOT_CONSOLE "serial_stuart" |
| 49 | #else |
| 50 | #define BOOT_CONSOLE "serial_ffuart" |
| 51 | #endif |
stefano babic | 6708a60 | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 52 | /* ------------------------------------------------------------------------- */ |
| 53 | |
| 54 | /* |
| 55 | * Miscelaneous platform dependent initialisations |
| 56 | */ |
| 57 | |
Stefano Babic | 57eb46b | 2009-07-01 04:33:56 +0200 | [diff] [blame] | 58 | int usb_board_init(void) |
stefano babic | 6708a60 | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 59 | { |
| 60 | UHCHR = (UHCHR | UHCHR_PCPL | UHCHR_PSPL) & |
| 61 | ~(UHCHR_SSEP0 | UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSE); |
| 62 | |
| 63 | UHCHR |= UHCHR_FSBIR; |
| 64 | |
| 65 | while (UHCHR & UHCHR_FSBIR); |
| 66 | |
| 67 | UHCHR &= ~UHCHR_SSE; |
| 68 | UHCHIE = (UHCHIE_UPRIE | UHCHIE_RWIE); |
| 69 | |
| 70 | /* Clear any OTG Pin Hold */ |
| 71 | if (PSSR & PSSR_OTGPH) |
| 72 | PSSR |= PSSR_OTGPH; |
| 73 | |
| 74 | UHCRHDA &= ~(RH_A_NPS); |
| 75 | UHCRHDA |= RH_A_PSM; |
| 76 | |
| 77 | /* Set port power control mask bits, only 3 ports. */ |
| 78 | UHCRHDB |= (0x7<<17); |
Stefano Babic | 57eb46b | 2009-07-01 04:33:56 +0200 | [diff] [blame] | 79 | |
| 80 | return 0; |
stefano babic | 6708a60 | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 81 | } |
| 82 | |
| 83 | void usb_board_init_fail(void) |
| 84 | { |
| 85 | return; |
| 86 | } |
| 87 | |
| 88 | void usb_board_stop(void) |
| 89 | { |
| 90 | UHCHR |= UHCHR_FHR; |
| 91 | udelay(11); |
| 92 | UHCHR &= ~UHCHR_FHR; |
| 93 | |
| 94 | UHCCOMS |= 1; |
| 95 | udelay(10); |
| 96 | |
| 97 | CKEN &= ~CKEN10_USBHOST; |
| 98 | |
stefano babic | 6708a60 | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 99 | return; |
| 100 | } |
| 101 | |
| 102 | int board_init (void) |
| 103 | { |
| 104 | /* memory and cpu-speed are setup before relocation */ |
| 105 | /* so we do _nothing_ here */ |
| 106 | |
| 107 | /* arch number of ConXS Board */ |
| 108 | gd->bd->bi_arch_number = 776; |
| 109 | |
| 110 | /* adress of boot parameters */ |
| 111 | gd->bd->bi_boot_params = 0xa000003c; |
| 112 | |
| 113 | return 0; |
| 114 | } |
| 115 | |
| 116 | int board_late_init(void) |
| 117 | { |
| 118 | #if defined(CONFIG_SERIAL_MULTI) |
| 119 | char *console=getenv("boot_console"); |
| 120 | |
Stefano Babic | e33f804 | 2009-07-01 20:40:41 +0200 | [diff] [blame] | 121 | if ((console == NULL) || (strcmp(console,"serial_btuart") && |
| 122 | strcmp(console,"serial_stuart") && |
| 123 | strcmp(console,"serial_ffuart"))) { |
| 124 | console = BOOT_CONSOLE; |
stefano babic | 6708a60 | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 125 | } |
Stefano Babic | e33f804 | 2009-07-01 20:40:41 +0200 | [diff] [blame] | 126 | setenv("stdout",console); |
| 127 | setenv("stdin", console); |
| 128 | setenv("stderr",console); |
stefano babic | 6708a60 | 2007-08-30 23:01:49 +0200 | [diff] [blame] | 129 | #endif |
| 130 | return 0; |
| 131 | } |
| 132 | |
| 133 | struct serial_device *default_serial_console (void) |
| 134 | { |
| 135 | return &serial_ffuart_device; |
| 136 | } |
| 137 | |
| 138 | int dram_init (void) |
| 139 | { |
| 140 | gd->bd->bi_dram[0].start = PHYS_SDRAM_1; |
| 141 | gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; |
| 142 | gd->bd->bi_dram[1].start = PHYS_SDRAM_2; |
| 143 | gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE; |
| 144 | gd->bd->bi_dram[2].start = PHYS_SDRAM_3; |
| 145 | gd->bd->bi_dram[2].size = PHYS_SDRAM_3_SIZE; |
| 146 | gd->bd->bi_dram[3].start = PHYS_SDRAM_4; |
| 147 | gd->bd->bi_dram[3].size = PHYS_SDRAM_4_SIZE; |
| 148 | |
| 149 | return 0; |
| 150 | } |
Remy Bohmer | 7eefd92 | 2009-05-02 21:49:18 +0200 | [diff] [blame] | 151 | |
| 152 | #ifdef CONFIG_DRIVER_DM9000 |
| 153 | int board_eth_init(bd_t *bis) |
| 154 | { |
| 155 | return dm9000_initialize(bis); |
| 156 | } |
| 157 | #endif |