blob: a2f3f14b976f4338b8674eee7894043d4dd1169f [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 Dinamanic2a9b362012-02-23 15:15:54 -080038#include <spmi.h>
39
Deepa Dinamani7d6c8972011-12-14 15:16:56 -080040
41static unsigned int target_id;
Deepa Dinamani7d6c8972011-12-14 15:16:56 -080042
43static void target_detect(void);
44
Deepa Dinamanic2a9b362012-02-23 15:15:54 -080045#define COPPER_TARGET_ID 0xffffffff
46#define PMIC_ARB_CHANNEL_NUM 0
47#define PMIC_ARB_OWNER_ID 0
48
Deepa Dinamani7d6c8972011-12-14 15:16:56 -080049
Deepa Dinamanica5ad852012-05-07 18:19:47 -070050static uint32_t mmc_sdc_base[] =
51 { MSM_SDC1_BASE, MSM_SDC2_BASE, MSM_SDC3_BASE, MSM_SDC4_BASE };
52
Deepa Dinamani7d6c8972011-12-14 15:16:56 -080053void target_early_init(void)
54{
Amol Jadi29f95032012-06-22 12:52:54 -070055 uart_dm_init(0, 0, BLSP1_UART0_BASE);
Deepa Dinamani7d6c8972011-12-14 15:16:56 -080056}
57
58void target_init(void)
59{
Deepa Dinamanica5ad852012-05-07 18:19:47 -070060 uint32_t base_addr;
61 uint8_t slot;
Deepa Dinamani7d6c8972011-12-14 15:16:56 -080062
Deepa Dinamani26e93262012-05-21 17:35:14 -070063
Deepa Dinamani7d6c8972011-12-14 15:16:56 -080064 dprintf(INFO, "target_init()\n");
65
66 target_id = COPPER_TARGET_ID;
Deepa Dinamanic2a9b362012-02-23 15:15:54 -080067 spmi_init(PMIC_ARB_CHANNEL_NUM, PMIC_ARB_OWNER_ID);
Deepa Dinamani7d6c8972011-12-14 15:16:56 -080068
Deepa Dinamanica5ad852012-05-07 18:19:47 -070069 /* Trying Slot 1*/
70 slot = 1;
71 base_addr = mmc_sdc_base[slot - 1];
72 if (mmc_boot_main(slot, base_addr))
73 {
Deepa Dinamanid18b47a2012-06-27 13:06:03 -070074
75 /* Trying Slot 2 next */
76 slot = 2;
77 base_addr = mmc_sdc_base[slot - 1];
78 if (mmc_boot_main(slot, base_addr)) {
79 dprintf(CRITICAL, "mmc init failed!");
80 ASSERT(0);
81 }
Deepa Dinamanica5ad852012-05-07 18:19:47 -070082 }
Deepa Dinamani7d6c8972011-12-14 15:16:56 -080083}
84
85unsigned board_machtype(void)
86{
87 return target_id;
88}
89
90/* Do any target specific intialization needed before entering fastboot mode */
91void target_fastboot_init(void)
92{
93
94}