blob: d6c32d10a833cebdbd9de9031ca0c0641c88854b [file] [log] [blame]
Amol Jadica4f4c92011-01-13 20:19:34 -08001/*
2 * Copyright (c) 2009, Google Inc.
3 * All rights reserved.
4 * Copyright (c) 2009-2011, 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 <lib/ptable.h>
35#include <smem.h>
36#include <platform/iomap.h>
37#include <reg.h>
38
39#define LINUX_MACHTYPE_8960_SIM 3230
40#define LINUX_MACHTYPE_8960_RUMI3 3231
41
42void target_init(void)
43{
44 dprintf(INFO, "target_init()\n");
45
46 if(mmc_boot_main(MMC_SLOT, MSM_SDC1_BASE))
47 {
48 dprintf(CRITICAL, "mmc init failed!");
49 ASSERT(0);
50 }
51}
52
53unsigned board_machtype(void)
54{
55/* TODO: Add a run time mechanism to detect if we are running on RUMI3.
56 * Until then, LINUX_MACHTYPE_RUMI3 can be defined as compile time
57 * option for RUMI3.
58 */
59
60#ifdef LINUX_MACHTYPE_RUMI3
61 return LINUX_MACHTYPE_8960_RUMI3;
62#else
63 return LINUX_MACHTYPE_8960_SIM;
64#endif
65}
66
67void reboot_device(unsigned reboot_reason)
68{
69 /* Reset WDG0 counter */
70 writel(1,MSM_WDT0_RST);
71 /* Disable WDG0 */
72 writel(0,MSM_WDT0_EN);
73 /* Set WDG0 bark time */
74 writel(0x31F3,MSM_WDT0_BT);
75 /* Enable WDG0 */
76 writel(3,MSM_WDT0_EN);
77 dmb();
78 /* Enable WDG output */
79 writel(3,MSM_TCSR_BASE + TCSR_WDOG_CFG);
80 mdelay(10000);
81 dprintf (CRITICAL, "Rebooting failed\n");
82 return;
83}
84
85unsigned check_reboot_mode(void)
86{
87 unsigned restart_reason = 0;
88 void *restart_reason_addr = 0x401FFFFC;
89
90 /* Read reboot reason and scrub it */
91 restart_reason = readl(restart_reason_addr);
92 writel(0x00, restart_reason_addr);
93
94 return restart_reason;
95}
96
97void target_battery_charging_enable(unsigned enable, unsigned disconnect)
98{
99}