2 * linux/arch/arm/mach-omap2/board-rx51.c
4 * Copyright (C) 2007, 2008 Nokia
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
14 #include <linux/delay.h>
15 #include <linux/err.h>
16 #include <linux/clk.h>
17 #include <linux/omapfb.h>
18 #include <linux/usb/musb.h>
20 #include <mach/hardware.h>
21 #include <asm/mach-types.h>
22 #include <asm/mach/arch.h>
23 #include <asm/mach/map.h>
25 #include <mach/mcspi.h>
26 #include <mach/gpio.h>
28 #include <mach/board.h>
29 #include <mach/common.h>
30 #include <mach/keypad.h>
32 #include <mach/gpmc.h>
33 #include <mach/usb-musb.h>
34 #include <mach/omap-pm.h>
35 #include <mach/vram.h>
38 #include <asm/delay.h>
40 #include "omap3-opp.h"
44 #include <mach/omap-pm.h>
45 #include <mach/prcm.h>
48 #define RX51_USB_TRANSCEIVER_RST_GPIO 67
50 extern int omap_init_fb(void);
51 extern void rx51_video_mem_init(void);
53 static struct omap_uart_config rx51_uart_config = {
54 .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
57 static struct omap_board_config_kernel rx51_config[] = {
58 { OMAP_TAG_UART, &rx51_uart_config },
61 static struct omap_bluetooth_config rx51_bt_config = {
62 .chip_type = BT_CHIP_BCM,
64 .host_wakeup_gpio = 101,
67 .bt_sysclk = BT_SYSCLK_38_4,
70 static void __init rx51_init_irq(void)
72 struct omap_sdrc_params *sdrc_params;
74 sdrc_params = rx51_get_sdram_timings();
76 omap2_init_common_hw(sdrc_params, sdrc_params,
84 static void __init rx51_pm_init(void)
86 struct prm_setup_times prm_setup = {
87 .clksetup = 111, /* must equal Volt offset + voltsetup2 */
88 .voltsetup_time1 = 270,
89 .voltsetup_time2 = 150,
90 /* Time between wakeup event to when the sysoff goes high */
92 /* The following is for a 2.25ms ramp time of the oscillator
93 * Documented 2ms, added .25 as margin. NOTE: scripts
94 * change as oscillator changes
99 omap3_set_prm_setup_times(&prm_setup);
102 static void __init rx51_xceiv_init(void)
104 if (gpio_request(RX51_USB_TRANSCEIVER_RST_GPIO, NULL) < 0)
106 gpio_direction_output(RX51_USB_TRANSCEIVER_RST_GPIO, 1);
109 static int rx51_xceiv_reset(void)
111 printk(KERN_ERR "rx51_xceiv_reset\n");
112 /* make sure the transceiver is awake */
114 /* only reset powered transceivers */
115 if (!gpio_get_value(RX51_USB_TRANSCEIVER_RST_GPIO))
117 gpio_set_value(RX51_USB_TRANSCEIVER_RST_GPIO, 0);
119 gpio_set_value(RX51_USB_TRANSCEIVER_RST_GPIO, 1);
125 static int rx51_xceiv_power(bool power)
127 unsigned long timeout;
129 printk(KERN_ERR "rx51_xceiv_power %d\n",power);
131 /* Let musb go stdby before powering down the transceiver */
132 timeout = jiffies + msecs_to_jiffies(100);
133 while (!time_after(jiffies, timeout))
134 if (cm_read_mod_reg(CORE_MOD, CM_IDLEST1)
135 & OMAP3430ES2_ST_HSOTGUSB_STDBY_MASK)
137 if (!(cm_read_mod_reg(CORE_MOD, CM_IDLEST1)
138 & OMAP3430ES2_ST_HSOTGUSB_STDBY_MASK))
139 WARN(1, "could not put musb to sleep\n");
141 gpio_set_value(RX51_USB_TRANSCEIVER_RST_GPIO, power);
147 * rx51_usb_set_pm_limits - sets omap3-related pm constraints
148 * @dev: musb's device pointer
149 * @set: set or clear constraints
151 * For now we only need mpu wakeup latency mpu frequency, if we
152 * need anything else we just add the logic here and the driver
153 * is already handling what needs to be handled.
155 static void rx51_usb_set_pm_limits(struct device *dev, bool set)
157 omap_pm_set_max_mpu_wakeup_lat(dev, set ? 10 : -1);
158 omap_pm_set_min_mpu_freq(dev, set ? 500000000 : 0);
161 static struct musb_board_data rx51_musb_data = {
162 .xceiv_reset = rx51_xceiv_reset,
163 .xceiv_power = rx51_xceiv_power,
164 .set_pm_limits = rx51_usb_set_pm_limits,
167 static void __init rx51_init(void)
170 usb_musb_init(&rx51_musb_data);
174 * With this early call work around a current clock framework problem
175 * where enabling and then disabling a clock disables a root clock
176 * used by another child clock. In our case this would happen with
177 * hsmmc which is normally initialized before fb.
180 omap_bt_init(&rx51_bt_config);
183 static void __init rx51_map_io(void)
185 omap_board_config = rx51_config;
186 omap_board_config_size = ARRAY_SIZE(rx51_config);
187 omap2_set_globals_343x();
188 omap2_map_common_io();
189 rx51_video_mem_init();
192 MACHINE_START(NOKIA_RX51, "Nokia RX-51 board")
193 /* Maintainer: Lauri Leukkunen <lauri.leukkunen@nokia.com> */
194 .phys_io = 0x48000000,
195 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
196 .boot_params = 0x80000100,
197 .map_io = rx51_map_io,
198 .init_irq = rx51_init_irq,
199 .init_machine = rx51_init,
200 .timer = &omap_timer,