OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved. |
| 3 * |
| 4 * (C) Copyright 2002 |
| 5 * Sysgo Real-Time Solutions, GmbH <www.elinos.com> |
| 6 * Marius Groeger <mgroeger@sysgo.de> |
| 7 * |
| 8 * (C) Copyright 2002 |
| 9 * David Mueller, ELSOFT AG, <d.mueller@elsoft.ch> |
| 10 * |
| 11 * (C) Copyright 2003 |
| 12 * Texas Instruments, <www.ti.com> |
| 13 * Kshitij Gupta <Kshitij@ti.com> |
| 14 * |
| 15 * (C) Copyright 2004 |
| 16 * ARM Ltd. |
| 17 * Philippe Robin, <philippe.robin@arm.com> |
| 18 * |
| 19 * See file CREDITS for list of people who contributed to this |
| 20 * project. |
| 21 * |
| 22 * This program is free software; you can redistribute it and/or |
| 23 * modify it under the terms of the GNU General Public License as |
| 24 * published by the Free Software Foundation; either version 2 of |
| 25 * the License, or (at your option) any later version. |
| 26 * |
| 27 * This program is distributed in the hope that it will be useful, |
| 28 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 30 * GNU General Public License for more details. |
| 31 * |
| 32 * You should have received a copy of the GNU General Public License |
| 33 * along with this program; if not, write to the Free Software |
| 34 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 35 * MA 02111-1307 USA |
| 36 */ |
| 37 |
| 38 #include <common.h> |
| 39 #include <linux/mtd/nand.h> |
| 40 #ifdef CONFIG_CMD_USB |
| 41 #include <usb.h> |
| 42 #endif |
| 43 #ifdef USE_PROC_COMM |
| 44 #include <asm/arch/proc_comm.h> |
| 45 #endif |
| 46 #include <asm/arch/memtypes.h> |
| 47 |
| 48 #ifdef CONFIG_GENERIC_MMC |
| 49 #include <mmc.h> |
| 50 #endif |
| 51 |
| 52 #ifdef CONFIG_QSD_SDCC |
| 53 #include <qsd_sdcc.h> |
| 54 #include <asm/arch/adm.h> |
| 55 |
| 56 static struct mmc mmc_1; |
| 57 static struct mmc mmc_2; |
| 58 static sdcc_params_t sdcc_1; |
| 59 static sdcc_params_t sdcc_3; |
| 60 |
| 61 #define SDCC_1_VOLTAGE_SUPPORTED 0x00FF8000; |
| 62 #define SDCC_3_VOLTAGE_SUPPORTED 0x00FF8080; |
| 63 #endif |
| 64 |
| 65 extern int timer_init(void); |
| 66 extern void scorpion_pll_init (void); |
| 67 extern void SDCn_deinit(uint32_t instance); |
| 68 |
| 69 /* |
| 70 * Optional boot progress function. |
| 71 */ |
| 72 #ifdef CONFIG_SHOW_BOOT_PROGRESS |
| 73 void show_boot_progress(int progress) |
| 74 { |
| 75 printf("Boot reached stage %d\n", progress); |
| 76 } |
| 77 #endif |
| 78 |
| 79 /* |
| 80 * Miscellaneous platform dependent initialisations |
| 81 */ |
| 82 |
| 83 int board_init (void) |
| 84 { |
| 85 DECLARE_GLOBAL_DATA_PTR; |
| 86 |
| 87 /* arch number of Qualcomm MSM */ |
| 88 gd->bd->bi_arch_number = LINUX_MACH_TYPE; |
| 89 |
| 90 /* address of boot parameters */ |
| 91 gd->bd->bi_boot_params = CFG_QC_BOOT_PARAM_ADDR; |
| 92 |
| 93 gd->flags = 0; |
| 94 |
| 95 /* Initialize GPT timer support */ |
| 96 timer_init(); |
| 97 |
| 98 /* When released from reset, Scorpion gets its clock from the AXI bus clock. |
| 99 * Start up the Scorpion PLL and start using it instead. |
| 100 */ |
| 101 scorpion_pll_init(); |
| 102 |
| 103 #ifdef CONFIG_SILENT_CONSOLE |
| 104 gd->flags |= GD_FLG_SILENT; |
| 105 #endif |
| 106 |
| 107 /* |
| 108 * Before proceeding, wait until ARM9 has finished booting. |
| 109 */ |
| 110 #ifdef USE_PROC_COMM |
| 111 proc_comm_init(); |
| 112 proc_comm_wait_for_modem_ready(); |
| 113 #else |
| 114 |
| 115 udelay(5000000); |
| 116 #endif |
| 117 |
| 118 #ifdef CONFIG_QSD8X50_LCDC |
| 119 gd->fb_base = LCDC_FB_ADDR; |
| 120 #endif |
| 121 |
| 122 return 0; |
| 123 } |
| 124 |
| 125 #ifdef CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE |
| 126 int overwrite_console(void) |
| 127 { |
| 128 #ifdef CONFIG_USB_KEYBOARD |
| 129 static int usb_init_called = 0; |
| 130 #endif |
| 131 |
| 132 #ifdef CONFIG_STDERR |
| 133 setenv("stderr", CONFIG_STDERR); |
| 134 #endif |
| 135 |
| 136 #ifdef CONFIG_STDOUT |
| 137 setenv("stdout", CONFIG_STDOUT); |
| 138 #endif |
| 139 |
| 140 #ifdef CONFIG_STDIN |
| 141 setenv("stdin", CONFIG_STDIN); |
| 142 #endif |
| 143 |
| 144 #if defined(CONFIG_USB_KEYBOARD) && defined(CONFIG_CMD_USB) |
| 145 if (strcmp(CONFIG_STDIN, "usbkbd") == 0) |
| 146 { |
| 147 if (usb_init_called == 0) |
| 148 { |
| 149 usb_init_called = 1; |
| 150 usb_stop(); |
| 151 usb_init(); |
| 152 } |
| 153 } |
| 154 #endif /* CONFIG_USB_KEYBOARD */ |
| 155 |
| 156 return 0; |
| 157 } |
| 158 #endif /* CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE */ |
| 159 |
| 160 int misc_init_r (void) |
| 161 { |
| 162 //dont checksum loaded image |
| 163 setenv("verify", "n"); |
| 164 //dont tftp images automatically for dhcp,bootp,rarp commands |
| 165 setenv("autoload", "no"); |
| 166 return (0); |
| 167 } |
| 168 |
| 169 /****************************** |
| 170 Routine: cleanup_platform_before_linux |
| 171 Description: Calls various functions to deinitialize that were initialized. |
| 172 ******************************/ |
| 173 int cleanup_platform_before_linux(void) |
| 174 { |
| 175 /* Defined in start.S, global to track warm booting */ |
| 176 extern ulong _warmboot; |
| 177 #ifdef CONFIG_MMC |
| 178 #ifndef CONFIG_GENERIC_MMC |
| 179 // Cleanup SD resources if they were used |
| 180 SDCn_deinit(SDC_INSTANCE); |
| 181 #endif |
| 182 #endif |
| 183 |
| 184 /* Just about to boot the kernel, next power collapse should warm boot |
| 185 * on wakeup. |
| 186 */ |
| 187 _warmboot = CONFIG_WARMBOOT_TRUE; |
| 188 |
| 189 return(0); |
| 190 } |
| 191 |
| 192 void board_lcd_enable(void) |
| 193 { |
| 194 const uint GPIO_BANK1 = 0xa9100c00; |
| 195 const uint GPIO_BANK7 = 0xa9000818; |
| 196 |
| 197 uint value = IO_READ32(GPIO_BANK1); |
| 198 |
| 199 value |= (1 << 4) | (1 << 16); |
| 200 |
| 201 IO_WRITE32(GPIO_BANK1, value); |
| 202 |
| 203 value = IO_READ32(GPIO_BANK7); |
| 204 |
| 205 value |= (1 << 2); |
| 206 |
| 207 IO_WRITE32(GPIO_BANK7, value); |
| 208 } |
| 209 |
| 210 void board_lcd_disble(void) |
| 211 { |
| 212 } |
| 213 |
| 214 #ifdef CONFIG_QSD_SDCC |
| 215 int board_mmc_init(bd_t *bis) |
| 216 { |
| 217 /* populate sdcc_1 struct with base addresses and other info */ |
| 218 sdcc_1.instance = 1; |
| 219 sdcc_1.base = SDC1_BASE; |
| 220 sdcc_1.ns_addr = SDC1_NS_REG; |
| 221 sdcc_1.md_addr = SDC1_MD_REG; |
| 222 sdcc_1.row_reset_mask = ROW_RESET__SDC1___M; |
| 223 sdcc_1.glbl_clk_ena_mask = GLBL_CLK_ENA__SDC1_H_CLK_ENA___M; |
| 224 sdcc_1.adm_crci_num = ADM_CRCI_SDC1; |
| 225 |
| 226 /* GPIO config */ |
| 227 proc_comm_sdcard_gpio_config(1); |
| 228 |
| 229 mmc_1.priv = &sdcc_1; |
| 230 mmc_1.send_cmd = sdcc_send_cmd; |
| 231 mmc_1.set_ios = sdcc_set_ios; |
| 232 mmc_1.init = sdcc_init; |
| 233 mmc_1.voltages = SDCC_1_VOLTAGE_SUPPORTED ; |
| 234 mmc_1.host_caps = MMC_MODE_4BIT | MMC_MODE_HS | MMC_MODE_HS_52MHz; |
| 235 mmc_1.f_min = 400000; |
| 236 mmc_1.f_max = MCLK_48MHz; |
| 237 sprintf(mmc_1.name, "External_Card"); |
| 238 |
| 239 |
| 240 /* populate sdcc_3 struct with base addresses and other info */ |
| 241 sdcc_3.instance = 3; |
| 242 sdcc_3.base = SDC3_BASE; |
| 243 sdcc_3.ns_addr = SDC3_NS_REG; |
| 244 sdcc_3.md_addr = SDC3_MD_REG; |
| 245 sdcc_3.row_reset_mask = ROW_RESET__SDC3___M; |
| 246 sdcc_3.glbl_clk_ena_mask = GLBL_CLK_ENA__SDC3_H_CLK_ENA___M; |
| 247 sdcc_3.adm_crci_num = ADM_CRCI_SDC3; |
| 248 |
| 249 /* GPIO config */ |
| 250 proc_comm_sdcard_gpio_config(3); |
| 251 |
| 252 mmc_2.priv = &sdcc_3; |
| 253 mmc_2.send_cmd = sdcc_send_cmd; |
| 254 mmc_2.set_ios = sdcc_set_ios; |
| 255 mmc_2.init = sdcc_init; |
| 256 mmc_2.voltages = SDCC_3_VOLTAGE_SUPPORTED; |
| 257 mmc_2.host_caps = MMC_MODE_4BIT | MMC_MODE_8BIT | MMC_MODE_HS | MMC_MODE_HS_
52MHz; |
| 258 mmc_2.f_min = 400000; |
| 259 mmc_2.f_max = MCLK_48MHz; |
| 260 sprintf(mmc_2.name, "Embedded_MMC"); |
| 261 |
| 262 |
| 263 /* register our available mmc interfaces with mmc framework */ |
| 264 mmc_register(&mmc_1); |
| 265 mmc_register(&mmc_2); |
| 266 |
| 267 return 0; |
| 268 } |
| 269 |
| 270 int board_sdcc_init(sdcc_params_t *sd) |
| 271 { |
| 272 if(sd->instance == 1) |
| 273 { |
| 274 /* Power cycle the card. */ |
| 275 proc_comm_vreg_control(PM_VREG_WLAN_ID, 2850, 0); |
| 276 udelay(1000); |
| 277 proc_comm_vreg_control(PM_VREG_WLAN_ID, 2850, 1); |
| 278 } |
| 279 else if(sd->instance == 3) |
| 280 { |
| 281 /* Power cycle the card. */ |
| 282 proc_comm_vreg_control(PM_VREG_WLAN_ID, 2850, 0); |
| 283 udelay(1000); |
| 284 proc_comm_vreg_control(PM_VREG_WLAN_ID, 2850, 1); |
| 285 } |
| 286 else |
| 287 { |
| 288 /* this board does not have an sd/mmc card on this interface. */ |
| 289 return -1; |
| 290 } |
| 291 |
| 292 return 0; |
| 293 } |
| 294 #endif |
OLD | NEW |