1 Index: linux-2.6.38-rc6/arch/arm/mach-omap2/board-n8x0.c
2 ===================================================================
3 --- linux-2.6.38-rc6.orig/arch/arm/mach-omap2/board-n8x0.c 2011-02-28 16:48:12.972504055 +0100
4 +++ linux-2.6.38-rc6/arch/arm/mach-omap2/board-n8x0.c 2011-02-28 21:03:41.761254167 +0100
6 #include <linux/spi/spi.h>
7 #include <linux/usb/musb.h>
8 #include <sound/tlv320aic3x.h>
9 +#include <linux/input.h>
10 +#include <linux/i2c/lm8323.h>
11 +#include <linux/spi/tsc2005.h>
13 #include <asm/mach/arch.h>
14 #include <asm/mach-types.h>
17 #include <plat/serial.h>
18 #include <plat/cbus.h>
19 +#include <plat/gpio-switch.h>
23 @@ -43,6 +47,221 @@ static int slot1_cover_open;
24 static int slot2_cover_open;
25 static struct device *mmc_device;
27 +/* We map the FN key as LALT to workaround an X keycode problem.
28 + * The XKB map needs to be adjusted to support this. */
29 +#define MAP_FN_AS_LEFTALT
31 +static s16 rx44_keymap[LM8323_KEYMAP_SIZE] = {
36 + [0x05] = KEY_BACKSPACE,
48 + [0x14] = KEY_APOSTROPHE,
55 + [0x1c] = KEY_LEFTSHIFT, /* Actually, this is both shift keys */
59 + [0x22] = KEY_SEMICOLON,
62 +#ifdef MAP_FN_AS_LEFTALT
63 + [0x2b] = KEY_LEFTALT,
71 + [0x32] = KEY_RIGHTCTRL,
75 + [0x3c] = KEY_COMPOSE,
91 + [0x75] = KEY_KPENTER,
94 +static struct lm8323_platform_data lm8323_pdata = {
95 + .repeat = 0, /* Repeat is handled in userspace for now. */
96 + .keymap = rx44_keymap,
99 + .debounce_time = 12,
100 + .active_time = 500,
102 + .name = "Internal keyboard",
103 + .pwm_names[0] = "n810::keyboard",
104 + .pwm_names[1] = "n810::cover",
107 +#define OMAP_TAG_NOKIA_BT 0x4e01
109 +struct omap_bluetooth_config {
112 + u8 host_wakeup_gpio;
119 +static struct platform_device n8x0_bt_device = {
122 + .num_resources = 0,
125 +void __init n8x0_bt_init(void)
127 + const struct omap_bluetooth_config *bt_config;
129 + bt_config = (void *) omap_get_config(OMAP_TAG_NOKIA_BT,
130 + struct omap_bluetooth_config);
131 + n8x0_bt_device.dev.platform_data = (void *) bt_config;
132 + if (platform_device_register(&n8x0_bt_device) < 0)
136 +#define RX51_TSC2005_RESET_GPIO 94
137 +#define RX51_TSC2005_IRQ_GPIO 106
139 +#ifdef CONFIG_TOUCHSCREEN_TSC2005
140 +static struct tsc2005_platform_data tsc2005_config;
141 +static void rx51_tsc2005_set_reset(bool enable)
143 + gpio_set_value(RX51_TSC2005_RESET_GPIO, enable);
146 +static struct omap2_mcspi_device_config tsc2005_mcspi_config = {
148 + .single_channel = 1,
152 +static void __init tsc2005_set_config(void)
154 + const struct omap_lcd_config *conf;
156 + conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
157 + if (conf != NULL) {
158 +#ifdef CONFIG_TOUCHSCREEN_TSC2005
159 + if (strcmp(conf->panel_name, "lph8923") == 0) {
160 + tsc2005_config.ts_x_plate_ohm = 180;
161 + tsc2005_config.ts_hw_avg = 0;
162 + tsc2005_config.ts_ignore_last = 0;
163 + tsc2005_config.ts_touch_pressure = 1500;
164 + tsc2005_config.ts_stab_time = 100;
165 + tsc2005_config.ts_pressure_max = 2048;
166 + tsc2005_config.ts_pressure_fudge = 2;
167 + tsc2005_config.ts_x_max = 4096;
168 + tsc2005_config.ts_x_fudge = 4;
169 + tsc2005_config.ts_y_max = 4096;
170 + tsc2005_config.ts_y_fudge = 7;
171 + tsc2005_config.set_reset = rx51_tsc2005_set_reset;
172 + } else if (strcmp(conf->panel_name, "ls041y3") == 0) {
173 + tsc2005_config.ts_x_plate_ohm = 280;
174 + tsc2005_config.ts_hw_avg = 0;
175 + tsc2005_config.ts_ignore_last = 0;
176 + tsc2005_config.ts_touch_pressure = 1500;
177 + tsc2005_config.ts_stab_time = 1000;
178 + tsc2005_config.ts_pressure_max = 2048;
179 + tsc2005_config.ts_pressure_fudge = 2;
180 + tsc2005_config.ts_x_max = 4096;
181 + tsc2005_config.ts_x_fudge = 4;
182 + tsc2005_config.ts_y_max = 4096;
183 + tsc2005_config.ts_y_fudge = 7;
184 + tsc2005_config.set_reset = rx51_tsc2005_set_reset;
186 + printk(KERN_ERR "Unknown panel type, set default "
187 + "touchscreen configuration\n");
188 + tsc2005_config.ts_x_plate_ohm = 200;
189 + tsc2005_config.ts_stab_time = 100;
195 +static struct omap2_mcspi_device_config mipid_mcspi_config = {
197 + .single_channel = 1,
200 +extern struct mipid_platform_data n8x0_mipid_platform_data;
202 +extern void n8x0_mipid_init(void);
203 +extern void n8x0_blizzard_init(void);
205 +static struct omap_gpio_switch n8x0_gpio_switches[] __initdata = {
207 + .name = "headphone",
209 + .debounce_rising = 200,
210 + .debounce_falling = 200,
214 + .debounce_rising = 200,
215 + .debounce_falling = 200,
217 + .name = "cam_turn",
219 + .debounce_rising = 100,
220 + .debounce_falling = 100,
224 + .debounce_rising = 200,
225 + .debounce_falling = 200,
229 + .debounce_rising = 200,
230 + .debounce_falling = 200,
234 +static void __init n8x0_gpio_switches_init(void)
236 + /* The switches are actually registered through ATAG mechanism.
237 + * This just updates the parameters (thus .gpio is -1) */
238 + omap_register_gpio_switches(n8x0_gpio_switches,
239 + ARRAY_SIZE(n8x0_gpio_switches));
242 #define TUSB6010_ASYNC_CS 1
243 #define TUSB6010_SYNC_CS 4
244 #define TUSB6010_GPIO_INT 58
245 @@ -146,12 +365,29 @@ static struct omap2_mcspi_device_config
247 static struct spi_board_info n800_spi_board_info[] __initdata = {
249 + .modalias = "lcd_mipid",
252 + .max_speed_hz = 4000000,
253 + .controller_data= &mipid_mcspi_config,
254 + .platform_data = &n8x0_mipid_platform_data,
257 .modalias = "p54spi",
260 .max_speed_hz = 48000000,
261 .controller_data = &p54spi_mcspi_config,
264 + .modalias = "tsc2005",
267 + .irq = OMAP_GPIO_IRQ(RX51_TSC2005_IRQ_GPIO),
268 + .max_speed_hz = 6000000,
269 + .controller_data = &tsc2005_mcspi_config,
270 + .platform_data = &tsc2005_config,
274 #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
275 @@ -727,6 +963,11 @@ static struct aic3x_pdata n810_aic33_dat
278 static struct i2c_board_info n810_i2c_board_info_2[] __initdata = {
280 + I2C_BOARD_INFO("lm8323", 0x45),
281 + .irq = OMAP_GPIO_IRQ(109),
282 + .platform_data = &lm8323_pdata,
285 I2C_BOARD_INFO("tlv320aic3x", 0x18),
286 .platform_data = &n810_aic33_data,
287 @@ -796,9 +1037,12 @@ static inline void board_serial_init(voi
288 static void __init n8x0_init_machine(void)
290 omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC);
291 + n8x0_gpio_switches_init();
295 /* FIXME: add n810 spi devices */
296 + tsc2005_set_config();
297 spi_register_board_info(n800_spi_board_info,
298 ARRAY_SIZE(n800_spi_board_info));
299 omap_register_i2c_bus(1, 400, n8x0_i2c_board_info_1,
300 @@ -808,6 +1052,8 @@ static void __init n8x0_init_machine(voi
301 i2c_register_board_info(2, n810_i2c_board_info_2,
302 ARRAY_SIZE(n810_i2c_board_info_2));
305 + n8x0_blizzard_init();
306 gpmc_onenand_init(board_onenand_data);
309 Index: linux-2.6.38-rc6/arch/arm/mach-omap2/board-n8x0-lcd.c
310 ===================================================================
311 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
312 +++ linux-2.6.38-rc6/arch/arm/mach-omap2/board-n8x0-lcd.c 2011-02-28 21:08:50.105894872 +0100
315 + * linux/arch/arm/mach-omap2/board-n8x0.c
317 + * Copyright (C) 2005-2009 Nokia Corporation
318 + * Author: Juha Yrjola <juha.yrjola@nokia.com>
320 + * Modified from mach-omap2/board-generic.c
322 + * This program is free software; you can redistribute it and/or modify
323 + * it under the terms of the GNU General Public License version 2 as
324 + * published by the Free Software Foundation.
327 +#include <linux/clk.h>
328 +#include <linux/delay.h>
329 +#include <linux/gpio.h>
330 +#include <linux/omapfb.h>
332 +#include <plat/lcd_mipid.h>
333 +#include <plat/blizzard.h>
335 +#include <../drivers/cbus/tahvo.h>
337 +#define N8X0_BLIZZARD_POWERDOWN_GPIO 15
341 +static void mipid_shutdown(struct mipid_platform_data *pdata)
343 + if (pdata->nreset_gpio != -1) {
344 + pr_info("shutdown LCD\n");
345 + gpio_set_value(pdata->nreset_gpio, 0);
350 +struct mipid_platform_data n8x0_mipid_platform_data = {
351 + .shutdown = mipid_shutdown,
354 +void __init n8x0_mipid_init(void)
356 + const struct omap_lcd_config *conf;
359 + conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
360 + if (conf != NULL) {
361 + n8x0_mipid_platform_data.nreset_gpio = conf->nreset_gpio;
362 + n8x0_mipid_platform_data.data_lines = conf->data_lines;
363 + if (conf->nreset_gpio != -1) {
364 + err = gpio_request(conf->nreset_gpio, "MIPID nreset");
366 + printk(KERN_ERR "N8x0 MIPID failed to request nreset GPIO %d\n",
367 + conf->nreset_gpio);
369 + err = gpio_direction_output(conf->nreset_gpio, 1);
371 + printk(KERN_ERR "N8x0 MIPID failed to set nreset GPIO %d\n",
372 + conf->nreset_gpio);
376 + printk(KERN_INFO "N8x0 MIPID config loaded");
379 + printk(KERN_INFO "N8x0 MIPID config not provided");
383 +// Epson Blizzard LCD Controller
386 + struct clk *sys_ck;
389 +static int blizzard_get_clocks(void)
391 + blizzard.sys_ck = clk_get(0, "osc_ck");
392 + if (IS_ERR(blizzard.sys_ck)) {
393 + printk(KERN_ERR "can't get Blizzard clock\n");
394 + return PTR_ERR(blizzard.sys_ck);
399 +static unsigned long blizzard_get_clock_rate(struct device *dev)
401 + return clk_get_rate(blizzard.sys_ck);
404 +static void blizzard_enable_clocks(int enable)
407 + clk_enable(blizzard.sys_ck);
409 + clk_disable(blizzard.sys_ck);
412 +static void blizzard_power_up(struct device *dev)
414 + /* Vcore to 1.475V */
415 + tahvo_set_clear_reg_bits(0x07, 0, 0xf);
418 + blizzard_enable_clocks(1);
419 + gpio_set_value(N8X0_BLIZZARD_POWERDOWN_GPIO, 1);
422 +static void blizzard_power_down(struct device *dev)
424 + gpio_set_value(N8X0_BLIZZARD_POWERDOWN_GPIO, 0);
425 + blizzard_enable_clocks(0);
427 + /* Vcore to 1.005V */
428 + tahvo_set_clear_reg_bits(0x07, 0xf, 0);
431 +static struct blizzard_platform_data n8x0_blizzard_data = {
432 + .power_up = blizzard_power_up,
433 + .power_down = blizzard_power_down,
434 + .get_clock_rate = blizzard_get_clock_rate,
438 +void __init n8x0_blizzard_init(void)
442 + r = gpio_request(N8X0_BLIZZARD_POWERDOWN_GPIO, "Blizzard pd");
445 + printk(KERN_ERR "Can't get N8x0 Blizzard powerdown GPIO %d\n", N8X0_BLIZZARD_POWERDOWN_GPIO);
448 + gpio_direction_output(N8X0_BLIZZARD_POWERDOWN_GPIO, 1);
450 + blizzard_get_clocks();
451 + omapfb_set_ctrl_platform_data(&n8x0_blizzard_data);
453 + printk(KERN_INFO "N8x0 Blizzard initialized");
455 Index: linux-2.6.38-rc6/arch/arm/mach-omap2/Makefile
456 ===================================================================
457 --- linux-2.6.38-rc6.orig/arch/arm/mach-omap2/Makefile 2011-02-28 16:45:53.321456871 +0100
458 +++ linux-2.6.38-rc6/arch/arm/mach-omap2/Makefile 2011-02-28 16:48:12.997503690 +0100
459 @@ -177,6 +177,7 @@ obj-$(CONFIG_MACH_OMAP_3430SDP) += boar
462 obj-$(CONFIG_MACH_NOKIA_N8X0) += board-n8x0.o
463 +obj-$(CONFIG_MACH_NOKIA_N8X0) += board-n8x0-lcd.o
464 obj-$(CONFIG_MACH_NOKIA_RM680) += board-rm680.o \
467 Index: linux-2.6.38-rc6/arch/arm/plat-omap/include/plat/cbus.h
468 ===================================================================
469 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
470 +++ linux-2.6.38-rc6/arch/arm/plat-omap/include/plat/cbus.h 2011-02-28 16:48:12.997503690 +0100
473 + * cbus.h - CBUS platform_data definition
475 + * Copyright (C) 2004 - 2009 Nokia Corporation
477 + * Written by Felipe Balbi <felipe.balbi@nokia.com>
479 + * This file is subject to the terms and conditions of the GNU General
480 + * Public License. See the file "COPYING" in the main directory of this
481 + * archive for more details.
483 + * This program is distributed in the hope that it will be useful,
484 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
485 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
486 + * GNU General Public License for more details.
488 + * You should have received a copy of the GNU General Public License
489 + * along with this program; if not, write to the Free Software
490 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
493 +#ifndef __PLAT_CBUS_H
494 +#define __PLAT_CBUS_H
496 +#define CBUS_RETU_DEVICE_ID 0x01
497 +#define CBUS_TAHVO_DEVICE_ID 0x02
499 +struct cbus_host_platform_data {
505 +struct cbus_retu_platform_data {
511 +#endif /* __PLAT_CBUS_H */
512 Index: linux-2.6.38-rc6/arch/arm/plat-omap/include/plat/irqs.h
513 ===================================================================
514 --- linux-2.6.38-rc6.orig/arch/arm/plat-omap/include/plat/irqs.h 2011-02-28 16:45:53.350456485 +0100
515 +++ linux-2.6.38-rc6/arch/arm/plat-omap/include/plat/irqs.h 2011-02-28 16:48:12.998503676 +0100
517 #define TWL_IRQ_END TWL6030_IRQ_END
520 -#define NR_IRQS TWL_IRQ_END
522 +#define OMAP_GPMC_IRQ_BASE (TWL_IRQ_END)
523 +#define OMAP_GPMC_NR_IRQS 7
524 +#define OMAP_GPMC_IRQ_END (OMAP_GPMC_IRQ_BASE + OMAP_GPMC_NR_IRQS)
526 +#define CBUS_RETU_IRQ_BASE OMAP_GPMC_IRQ_END
527 +#ifdef CONFIG_CBUS_RETU
528 +#define CBUS_RETU_NR_IRQS 16
530 +#define CBUS_RETU_NR_IRQS 0
532 +#define CBUS_RETU_IRQ_END (CBUS_RETU_IRQ_BASE + CBUS_RETU_NR_IRQS)
534 +#define NR_IRQS CBUS_RETU_IRQ_END
536 #define OMAP_IRQ_BIT(irq) (1 << ((irq) % 32))
538 Index: linux-2.6.38-rc6/arch/arm/mach-omap2/omap_hwmod_2420_data.c
539 ===================================================================
540 --- linux-2.6.38-rc6.orig/arch/arm/mach-omap2/omap_hwmod_2420_data.c 2011-02-28 21:09:41.170169165 +0100
541 +++ linux-2.6.38-rc6/arch/arm/mach-omap2/omap_hwmod_2420_data.c 2011-02-28 21:10:33.434425329 +0100
542 @@ -673,6 +673,7 @@ static struct omap_hwmod_ocp_if *omap242
544 static struct omap_hwmod omap2420_gpio1_hwmod = {
546 + .flags = HWMOD_INIT_NO_RESET, /* Workaround: Don't reset the n810 MIPID */
547 .mpu_irqs = omap242x_gpio1_irqs,
548 .mpu_irqs_cnt = ARRAY_SIZE(omap242x_gpio1_irqs),
549 .main_clk = "gpios_fck",