Commit | Line | Data |
---|---|---|
21f47fbc AC |
1 | /* |
2 | * arch/arm/mach-vt8500/wm8505_7in.c | |
3 | * | |
4 | * Copyright (C) 2010 Alexey Charkov <alchark@gmail.com> | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation; either version 2 of the License, or | |
9 | * (at your option) any later version. | |
10 | * | |
11 | * This program is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | * GNU General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program; if not, write to the Free Software | |
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 | */ | |
20 | ||
21 | #include <linux/io.h> | |
22 | #include <linux/pm.h> | |
23 | ||
24 | #include <asm/mach-types.h> | |
25 | #include <asm/mach/arch.h> | |
86cc0ef8 | 26 | #include <mach/restart.h> |
21f47fbc AC |
27 | |
28 | #include "devices.h" | |
29 | ||
30 | static void __iomem *pmc_hiber; | |
31 | ||
32 | static struct platform_device *devices[] __initdata = { | |
33 | &vt8500_device_uart0, | |
34 | &vt8500_device_ehci, | |
35 | &vt8500_device_wm8505_fb, | |
36 | &vt8500_device_ge_rops, | |
37 | &vt8500_device_pwm, | |
38 | &vt8500_device_pwmbl, | |
39 | &vt8500_device_rtc, | |
40 | }; | |
41 | ||
42 | static void vt8500_power_off(void) | |
43 | { | |
44 | local_irq_disable(); | |
45 | writew(5, pmc_hiber); | |
46 | asm("mcr%? p15, 0, %0, c7, c0, 4" : : "r" (0)); | |
47 | } | |
48 | ||
49 | void __init wm8505_7in_init(void) | |
50 | { | |
51 | #ifdef CONFIG_FB_WM8505 | |
52 | void __iomem *gpio_mux_reg = ioremap(wmt_gpio_base + 0x200, 4); | |
53 | if (gpio_mux_reg) { | |
54 | writel(readl(gpio_mux_reg) | 0x80000000, gpio_mux_reg); | |
55 | iounmap(gpio_mux_reg); | |
56 | } else { | |
57 | printk(KERN_ERR "Could not remap the GPIO mux register, display may not work properly!\n"); | |
58 | } | |
59 | #endif | |
60 | pmc_hiber = ioremap(wmt_pmc_base + 0x12, 2); | |
61 | if (pmc_hiber) | |
62 | pm_power_off = &vt8500_power_off; | |
63 | else | |
64 | printk(KERN_ERR "PMC Hibernation register could not be remapped, not enabling power off!\n"); | |
86cc0ef8 | 65 | wmt_setup_restart(); |
21f47fbc AC |
66 | wm8505_set_resources(); |
67 | platform_add_devices(devices, ARRAY_SIZE(devices)); | |
68 | vt8500_gpio_init(); | |
69 | } | |
70 | ||
71 | MACHINE_START(WM8505_7IN_NETBOOK, "WM8505 7-inch generic netbook") | |
59a0e0c5 | 72 | .atag_offset = 0x100, |
86cc0ef8 | 73 | .restart = wmt_restart, |
21f47fbc AC |
74 | .reserve = wm8505_reserve_mem, |
75 | .map_io = wm8505_map_io, | |
76 | .init_irq = wm8505_init_irq, | |
77 | .timer = &vt8500_timer, | |
78 | .init_machine = wm8505_7in_init, | |
79 | MACHINE_END |