blob: f30fbde76d1ebd0b3b8737994a478f91b15ec893 [file] [log] [blame]
Unnati Gandhi4d07fac2014-07-04 17:38:25 +05301/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
2 *
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are
5 * met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above
9 * copyright notice, this list of conditions and the following
10 * disclaimer in the documentation and/or other materials provided
11 * with the distribution.
12 * * Neither the name of The Linux Foundation nor the names of its
13 * contributors may be used to endorse or promote products derived
14 * from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <debug.h>
30#include <platform/iomap.h>
31#include <reg.h>
32#include <target.h>
33#include <platform.h>
34#include <uart_dm.h>
35#include <mmc.h>
36#include <platform/gpio.h>
37#include <dev/keys.h>
38#include <spmi_v2.h>
39#include <pm8x41.h>
40#include <board.h>
41#include <baseband.h>
42#include <hsusb.h>
43#include <scm.h>
44#include <platform/gpio.h>
45#include <platform/gpio.h>
46#include <platform/irqs.h>
47#include <platform/clock.h>
48#include <crypto5_wrapper.h>
49#include <partition_parser.h>
50#include <stdlib.h>
51
52#define PMIC_ARB_CHANNEL_NUM 0
53#define PMIC_ARB_OWNER_ID 0
54
55
56static uint32_t mmc_sdc_base[] =
57 { MSM_SDC1_BASE, MSM_SDC2_BASE };
58
59
60void target_early_init(void)
61{
62#if WITH_DEBUG_UART
63 uart_dm_init(1, 0, BLSP1_UART1_BASE);
64#endif
65}
66
67void target_mmc_caps(struct mmc_host *host)
68{
69 host->caps.ddr_mode = 0;
70 host->caps.hs200_mode = 0;
71 host->caps.bus_width = MMC_BOOT_BUS_WIDTH_8_BIT;
72 host->caps.hs_clk_rate = MMC_CLK_50MHZ;
73}
74
75
76static void target_keystatus()
77{
78}
79
80void target_init(void)
81{
82 uint32_t base_addr;
83 uint8_t slot;
84
85 dprintf(INFO, "target_init()\n");
86
87 spmi_init(PMIC_ARB_CHANNEL_NUM, PMIC_ARB_OWNER_ID);
88
89 target_keystatus();
90
91 /* Trying Slot 1*/
92 slot = 1;
93 base_addr = mmc_sdc_base[slot - 1];
94 if (mmc_boot_main(slot, base_addr))
95 {
96
97 /* Trying Slot 2 next */
98 slot = 2;
99 base_addr = mmc_sdc_base[slot - 1];
100 if (mmc_boot_main(slot, base_addr)) {
101 dprintf(CRITICAL, "mmc init failed!");
102 ASSERT(0);
103 }
104 }
105}
106
107void target_serialno(unsigned char *buf)
108{
109 uint32_t serialno;
110 if (target_is_emmc_boot()) {
111 serialno = mmc_get_psn();
112 snprintf((char *)buf, 13, "%x", serialno);
113 }
114}
115
116unsigned board_machtype(void)
117{
118}
119