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