Deepa Dinamani | 7d6c897 | 2011-12-14 15:16:56 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2009, Google Inc. |
| 3 | * All rights reserved. |
| 4 | * Copyright (c) 2009-2012, Code Aurora Forum. All rights reserved. |
| 5 | * |
| 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions |
| 8 | * are met: |
| 9 | * * Redistributions of source code must retain the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer. |
| 11 | * * Redistributions in binary form must reproduce the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer in |
| 13 | * the documentation and/or other materials provided with the |
| 14 | * distribution. |
| 15 | * * Neither the name of Google, Inc. nor the names of its contributors |
| 16 | * may be used to endorse or promote products derived from this |
| 17 | * software without specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 22 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 23 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 24 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS |
| 26 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
| 27 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
| 29 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 30 | * SUCH DAMAGE. |
| 31 | */ |
| 32 | |
| 33 | #include <debug.h> |
| 34 | #include <platform/iomap.h> |
| 35 | #include <reg.h> |
| 36 | #include <target.h> |
| 37 | #include <platform.h> |
Deepa Dinamani | 26e9326 | 2012-05-21 17:35:14 -0700 | [diff] [blame] | 38 | #include <uart_dm.h> |
Deepa Dinamani | 7d6c897 | 2011-12-14 15:16:56 -0800 | [diff] [blame] | 39 | |
| 40 | static unsigned int target_id; |
| 41 | extern void dmb(void); |
| 42 | |
| 43 | static void target_detect(void); |
| 44 | |
| 45 | #define COPPER_TARGET_ID 3999 |
| 46 | |
Deepa Dinamani | ca5ad85 | 2012-05-07 18:19:47 -0700 | [diff] [blame] | 47 | static uint32_t mmc_sdc_base[] = |
| 48 | { MSM_SDC1_BASE, MSM_SDC2_BASE, MSM_SDC3_BASE, MSM_SDC4_BASE }; |
| 49 | |
Deepa Dinamani | 7d6c897 | 2011-12-14 15:16:56 -0800 | [diff] [blame] | 50 | void target_early_init(void) |
| 51 | { |
| 52 | |
| 53 | } |
| 54 | |
| 55 | void target_init(void) |
| 56 | { |
Deepa Dinamani | ca5ad85 | 2012-05-07 18:19:47 -0700 | [diff] [blame] | 57 | uint32_t base_addr; |
| 58 | uint8_t slot; |
Deepa Dinamani | 7d6c897 | 2011-12-14 15:16:56 -0800 | [diff] [blame] | 59 | |
Deepa Dinamani | 26e9326 | 2012-05-21 17:35:14 -0700 | [diff] [blame] | 60 | uart_dm_init(0, 0, BLSP1_UART0_BASE); |
| 61 | |
Deepa Dinamani | 7d6c897 | 2011-12-14 15:16:56 -0800 | [diff] [blame] | 62 | dprintf(INFO, "target_init()\n"); |
| 63 | |
| 64 | target_id = COPPER_TARGET_ID; |
| 65 | |
Deepa Dinamani | ca5ad85 | 2012-05-07 18:19:47 -0700 | [diff] [blame] | 66 | /* Trying Slot 1*/ |
| 67 | slot = 1; |
| 68 | base_addr = mmc_sdc_base[slot - 1]; |
| 69 | if (mmc_boot_main(slot, base_addr)) |
| 70 | { |
Deepa Dinamani | d18b47a | 2012-06-27 13:06:03 -0700 | [diff] [blame^] | 71 | |
| 72 | /* Trying Slot 2 next */ |
| 73 | slot = 2; |
| 74 | base_addr = mmc_sdc_base[slot - 1]; |
| 75 | if (mmc_boot_main(slot, base_addr)) { |
| 76 | dprintf(CRITICAL, "mmc init failed!"); |
| 77 | ASSERT(0); |
| 78 | } |
Deepa Dinamani | ca5ad85 | 2012-05-07 18:19:47 -0700 | [diff] [blame] | 79 | } |
| 80 | |
Deepa Dinamani | 7d6c897 | 2011-12-14 15:16:56 -0800 | [diff] [blame] | 81 | } |
| 82 | |
| 83 | unsigned board_machtype(void) |
| 84 | { |
| 85 | return target_id; |
| 86 | } |
| 87 | |
| 88 | /* Do any target specific intialization needed before entering fastboot mode */ |
| 89 | void target_fastboot_init(void) |
| 90 | { |
| 91 | |
| 92 | } |