2 arch/arm/mach-omap1/board-nokia770.c | 16 +
3 arch/arm/mach-omap2/Kconfig | 10 +
4 arch/arm/mach-omap2/Makefile | 2
5 arch/arm/mach-omap2/board-n8x0-lcd.c | 127 +++++++++++++
6 arch/arm/mach-omap2/board-n8x0-usb.c | 175 +++++++++++++++++++
7 arch/arm/mach-omap2/board-n8x0.c | 319 +++++++++++++++++++++++++----------
8 arch/arm/mach-omap2/control.c | 2
9 arch/arm/mach-omap2/serial.c | 8
10 8 files changed, 569 insertions(+), 90 deletions(-)
12 --- linux-2.6.35.3.orig/arch/arm/mach-omap1/board-nokia770.c
13 +++ linux-2.6.35.3/arch/arm/mach-omap1/board-nokia770.c
15 #include <plat/lcd_mipid.h>
17 #include <plat/clock.h>
18 +#include <plat/cbus.h>
20 #define ADS7846_PENDOWN_GPIO 15
22 @@ -96,8 +97,23 @@ static struct platform_device nokia770_k
23 .resource = nokia770_kp_resources,
26 +static struct cbus_host_platform_data nokia770_cbus_data = {
27 + .clk_gpio = OMAP_MPUIO(11),
28 + .dat_gpio = OMAP_MPUIO(10),
29 + .sel_gpio = OMAP_MPUIO(9),
32 +static struct platform_device nokia770_cbus_device = {
36 + .platform_data = &nokia770_cbus_data,
40 static struct platform_device *nokia770_devices[] __initdata = {
42 + &nokia770_cbus_device,
45 static void mipid_shutdown(struct mipid_platform_data *pdata)
46 --- linux-2.6.35.3.orig/arch/arm/mach-omap2/board-n8x0.c
47 +++ linux-2.6.35.3/arch/arm/mach-omap2/board-n8x0.c
50 #include <linux/stddef.h>
51 #include <linux/i2c.h>
52 +#include <linux/platform_device.h>
53 #include <linux/spi/spi.h>
54 +#include <linux/spi/tsc2005.h>
55 +#include <linux/input.h>
56 #include <linux/usb/musb.h>
57 +#include <linux/i2c/lm8323.h>
59 #include <asm/mach/arch.h>
60 #include <asm/mach-types.h>
62 #include <plat/onenand.h>
64 #include <plat/serial.h>
65 +#include <plat/cbus.h>
67 -static int slot1_cover_open;
68 -static int slot2_cover_open;
69 -static struct device *mmc_device;
70 +#define RX51_TSC2005_RESET_GPIO 94
71 +#define RX51_TSC2005_IRQ_GPIO 106
72 +#define OMAP_TAG_NOKIA_BT 0x4e01
74 +static s16 rx44_keymap[LM8323_KEYMAP_SIZE] = {
79 + [0x05] = KEY_BACKSPACE,
91 + [0x14] = KEY_APOSTROPHE,
98 + [0x1c] = KEY_LEFTSHIFT, /* Actually, this is both shift keys */
102 + [0x22] = KEY_SEMICOLON,
103 + [0x23] = KEY_MINUS,
104 + [0x24] = KEY_EQUAL,
110 + [0x32] = KEY_RIGHTCTRL,
111 + [0x34] = KEY_SPACE,
112 + [0x35] = KEY_COMMA,
114 + [0x3c] = KEY_COMPOSE,
119 + [0x46] = KEY_RIGHT,
123 + [0x55] = KEY_ENTER,
126 -#define TUSB6010_ASYNC_CS 1
127 -#define TUSB6010_SYNC_CS 4
128 -#define TUSB6010_GPIO_INT 58
129 -#define TUSB6010_GPIO_ENABLE 0
130 -#define TUSB6010_DMACHAN 0x3f
134 -#if defined(CONFIG_USB_TUSB6010) || \
135 - defined(CONFIG_USB_TUSB6010_MODULE)
137 - * Enable or disable power to TUSB6010. When enabling, turn on 3.3 V and
138 - * 1.5 V voltage regulators of PM companion chip. Companion chip will then
139 - * provide then PGOOD signal to TUSB6010 which will release it from reset.
141 -static int tusb_set_power(int state)
145 + [0x75] = KEY_KPENTER,
149 - gpio_set_value(TUSB6010_GPIO_ENABLE, 1);
151 +static struct lm8323_platform_data lm8323_pdata = {
152 + .repeat = 0, /* Repeat is handled in userspace for now. */
153 + .keymap = rx44_keymap,
156 + .debounce_time = 12,
157 + .active_time = 500,
159 + .name = "Internal keyboard",
160 + .pwm_names[0] = "n810::keyboard",
161 + .pwm_names[1] = "n810::cover",
162 + //.pwm1_name = "n810::keyboard",
163 + //.pwm2_name = "n810::cover",
166 - /* Wait until TUSB6010 pulls INT pin down */
168 - while (i && gpio_get_value(TUSB6010_GPIO_INT)) {
172 +struct omap_bluetooth_config {
175 + u8 host_wakeup_gpio;
183 - printk(KERN_ERR "tusb: powerup failed\n");
187 - gpio_set_value(TUSB6010_GPIO_ENABLE, 0);
190 +static struct platform_device n8x0_bt_device = {
193 + .num_resources = 0,
196 +void __init n8x0_bt_init(void)
198 + const struct omap_bluetooth_config *bt_config;
201 + bt_config = (void *) omap_get_config(OMAP_TAG_NOKIA_BT,
202 + struct omap_bluetooth_config);
203 + n8x0_bt_device.dev.platform_data = (void *) bt_config;
204 + if (platform_device_register(&n8x0_bt_device) < 0)
208 -static struct musb_hdrc_config musb_config = {
213 +static struct omap2_mcspi_device_config mipid_mcspi_config = {
215 + .single_channel = 1,
218 -static struct musb_hdrc_platform_data tusb_data = {
219 -#if defined(CONFIG_USB_MUSB_OTG)
221 -#elif defined(CONFIG_USB_MUSB_PERIPHERAL)
222 - .mode = MUSB_PERIPHERAL,
223 -#else /* defined(CONFIG_USB_MUSB_HOST) */
226 - .set_power = tusb_set_power,
227 - .min_power = 25, /* x2 = 50 mA drawn from VBUS as peripheral */
228 - .power = 100, /* Max 100 mA VBUS for host mode */
229 - .config = &musb_config,
232 -static void __init n8x0_usb_init(void)
235 - static char announce[] __initdata = KERN_INFO "TUSB 6010\n";
237 - /* PM companion chip power control pin */
238 - ret = gpio_request(TUSB6010_GPIO_ENABLE, "TUSB6010 enable");
240 - printk(KERN_ERR "Could not get TUSB power GPIO%i\n",
241 - TUSB6010_GPIO_ENABLE);
244 - gpio_direction_output(TUSB6010_GPIO_ENABLE, 0);
247 +static int slot1_cover_open;
248 +static int slot2_cover_open;
249 +static struct device *mmc_device;
251 - ret = tusb6010_setup_interface(&tusb_data, TUSB6010_REFCLK_19, 2,
252 - TUSB6010_ASYNC_CS, TUSB6010_SYNC_CS,
253 - TUSB6010_GPIO_INT, TUSB6010_DMACHAN);
258 +static struct omap2_mcspi_device_config p54spi_mcspi_config = {
260 + .single_channel = 1,
264 +#ifdef CONFIG_MACH_NOKIA_N8X0_LCD
265 +extern struct mipid_platform_data n8x0_mipid_platform_data;
269 - gpio_free(TUSB6010_GPIO_ENABLE);
270 +#ifdef CONFIG_TOUCHSCREEN_TSC2005
271 +static struct tsc2005_platform_data tsc2005_config;
272 +static void rx51_tsc2005_set_reset(bool enable)
274 + gpio_set_value(RX51_TSC2005_RESET_GPIO, enable);
278 -static void __init n8x0_usb_init(void) {}
280 -#endif /*CONFIG_USB_TUSB6010 */
283 -static struct omap2_mcspi_device_config p54spi_mcspi_config = {
284 +static struct omap2_mcspi_device_config tsc2005_mcspi_config = {
290 static struct spi_board_info n800_spi_board_info[] __initdata = {
291 +#ifdef CONFIG_MACH_NOKIA_N8X0_LCD
293 + .modalias = "lcd_mipid",
296 + .max_speed_hz = 4000000,
297 + .controller_data= &mipid_mcspi_config,
298 + .platform_data = &n8x0_mipid_platform_data,
302 .modalias = "p54spi",
304 @@ -147,6 +193,68 @@ static struct spi_board_info n800_spi_bo
305 .max_speed_hz = 48000000,
306 .controller_data = &p54spi_mcspi_config,
309 + .modalias = "tsc2005",
312 + .irq = OMAP_GPIO_IRQ(RX51_TSC2005_IRQ_GPIO),
313 + .max_speed_hz = 6000000,
314 + .controller_data = &tsc2005_mcspi_config,
315 + .platform_data = &tsc2005_config,
319 +static void __init tsc2005_set_config(void)
321 + const struct omap_lcd_config *conf;
323 + conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
324 + if (conf != NULL) {
325 +#ifdef CONFIG_TOUCHSCREEN_TSC2005
326 + if (strcmp(conf->panel_name, "lph8923") == 0) {
327 + tsc2005_config.ts_x_plate_ohm = 180;
328 + tsc2005_config.ts_hw_avg = 0;
329 + tsc2005_config.ts_ignore_last = 0;
330 + tsc2005_config.ts_touch_pressure = 1500;
331 + tsc2005_config.ts_stab_time = 100;
332 + tsc2005_config.ts_pressure_max = 2048;
333 + tsc2005_config.ts_pressure_fudge = 2;
334 + tsc2005_config.ts_x_max = 4096;
335 + tsc2005_config.ts_x_fudge = 4;
336 + tsc2005_config.ts_y_max = 4096;
337 + tsc2005_config.ts_y_fudge = 7;
338 + tsc2005_config.set_reset = rx51_tsc2005_set_reset;
339 + } else if (strcmp(conf->panel_name, "ls041y3") == 0) {
340 + tsc2005_config.ts_x_plate_ohm = 280;
341 + tsc2005_config.ts_hw_avg = 0;
342 + tsc2005_config.ts_ignore_last = 0;
343 + tsc2005_config.ts_touch_pressure = 1500;
344 + tsc2005_config.ts_stab_time = 1000;
345 + tsc2005_config.ts_pressure_max = 2048;
346 + tsc2005_config.ts_pressure_fudge = 2;
347 + tsc2005_config.ts_x_max = 4096;
348 + tsc2005_config.ts_x_fudge = 4;
349 + tsc2005_config.ts_y_max = 4096;
350 + tsc2005_config.ts_y_fudge = 7;
351 + tsc2005_config.set_reset = rx51_tsc2005_set_reset;
353 + printk(KERN_ERR "Unknown panel type, set default "
354 + "touchscreen configuration\n");
355 + tsc2005_config.ts_x_plate_ohm = 200;
356 + tsc2005_config.ts_stab_time = 100;
362 +static struct i2c_board_info __initdata_or_module n8x0_i2c_board_info_2[] = {};
364 +static struct i2c_board_info __initdata_or_module n810_i2c_board_info_2[] = {
366 + I2C_BOARD_INFO("lm8323", 0x45),
367 + .irq = OMAP_GPIO_IRQ(109),
368 + .platform_data = &lm8323_pdata,
372 #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
373 @@ -181,6 +289,20 @@ static struct mtd_partition onenand_part
377 +static struct cbus_host_platform_data n8x0_cbus_data = {
383 +static struct platform_device n8x0_cbus_device = {
387 + .platform_data = &n8x0_cbus_data,
391 static struct omap_onenand_platform_data board_onenand_data = {
394 @@ -649,14 +771,39 @@ static void __init n8x0_init_irq(void)
398 +#ifdef CONFIG_MACH_NOKIA_N8X0_LCD
399 +extern void n8x0_mipid_init(void);
400 +extern void n8x0_blizzard_init(void);
402 +#define n8x0_mipid_init() 0
403 +#define n8x0_blizzard_init() 0
406 +extern void n8x0_usb_init(void);
408 static void __init n8x0_init_machine(void)
410 + platform_device_register(&n8x0_cbus_device);
414 /* FIXME: add n810 spi devices */
415 + tsc2005_set_config();
416 spi_register_board_info(n800_spi_board_info,
417 ARRAY_SIZE(n800_spi_board_info));
420 n8x0_menelaus_init();
422 + omap_register_i2c_bus(2, 400, n8x0_i2c_board_info_2,
423 + ARRAY_SIZE(n8x0_i2c_board_info_2));
425 + i2c_register_board_info(2, n810_i2c_board_info_2,
426 + ARRAY_SIZE(n810_i2c_board_info_2));
429 + n8x0_blizzard_init();
435 +++ linux-2.6.35.3/arch/arm/mach-omap2/board-n8x0-lcd.c
438 + * linux/arch/arm/mach-omap2/board-n8x0.c
440 + * Copyright (C) 2005-2009 Nokia Corporation
441 + * Author: Juha Yrjola <juha.yrjola@nokia.com>
443 + * Modified from mach-omap2/board-generic.c
445 + * This program is free software; you can redistribute it and/or modify
446 + * it under the terms of the GNU General Public License version 2 as
447 + * published by the Free Software Foundation.
450 +#include <linux/clk.h>
451 +#include <linux/delay.h>
452 +#include <linux/gpio.h>
453 +#include <linux/omapfb.h>
455 +#include <plat/lcd_mipid.h>
456 +#include <plat/blizzard.h>
458 +#include <../drivers/cbus/tahvo.h>
460 +#define N8X0_BLIZZARD_POWERDOWN_GPIO 15
464 +static void mipid_shutdown(struct mipid_platform_data *pdata)
466 + if (pdata->nreset_gpio != -1) {
467 + pr_info("shutdown LCD\n");
468 + gpio_set_value(pdata->nreset_gpio, 0);
473 +struct mipid_platform_data n8x0_mipid_platform_data = {
474 + .shutdown = mipid_shutdown,
477 +void __init n8x0_mipid_init(void)
479 + const struct omap_lcd_config *conf;
481 + conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
482 + if (conf != NULL) {
483 + n8x0_mipid_platform_data.nreset_gpio = conf->nreset_gpio;
484 + n8x0_mipid_platform_data.data_lines = conf->data_lines;
485 + printk(KERN_INFO "N8x0 MIPID config loaded");
488 + printk(KERN_INFO "N8x0 MIPID config not provided");
492 +// Epson Blizzard LCD Controller
495 + struct clk *sys_ck;
498 +static int blizzard_get_clocks(void)
500 + blizzard.sys_ck = clk_get(0, "osc_ck");
501 + if (IS_ERR(blizzard.sys_ck)) {
502 + printk(KERN_ERR "can't get Blizzard clock\n");
503 + return PTR_ERR(blizzard.sys_ck);
508 +static unsigned long blizzard_get_clock_rate(struct device *dev)
510 + return clk_get_rate(blizzard.sys_ck);
513 +static void blizzard_enable_clocks(int enable)
516 + clk_enable(blizzard.sys_ck);
518 + clk_disable(blizzard.sys_ck);
521 +static void blizzard_power_up(struct device *dev)
523 + /* Vcore to 1.475V */
524 + tahvo_set_clear_reg_bits(0x07, 0, 0xf);
527 + blizzard_enable_clocks(1);
528 + gpio_set_value(N8X0_BLIZZARD_POWERDOWN_GPIO, 1);
531 +static void blizzard_power_down(struct device *dev)
533 + gpio_set_value(N8X0_BLIZZARD_POWERDOWN_GPIO, 0);
534 + blizzard_enable_clocks(0);
536 + /* Vcore to 1.005V */
537 + tahvo_set_clear_reg_bits(0x07, 0xf, 0);
540 +static struct blizzard_platform_data n8x0_blizzard_data = {
541 + .power_up = blizzard_power_up,
542 + .power_down = blizzard_power_down,
543 + .get_clock_rate = blizzard_get_clock_rate,
547 +void __init n8x0_blizzard_init(void)
551 + r = gpio_request(N8X0_BLIZZARD_POWERDOWN_GPIO, "Blizzard pd");
554 + printk(KERN_ERR "Can't get N8x0 Blizzard powerdown GPIO %d\n", N8X0_BLIZZARD_POWERDOWN_GPIO);
557 + gpio_direction_output(N8X0_BLIZZARD_POWERDOWN_GPIO, 1);
559 + blizzard_get_clocks();
560 + omapfb_set_ctrl_platform_data(&n8x0_blizzard_data);
562 + printk(KERN_INFO "N8x0 Blizzard initialized");
565 +++ linux-2.6.35.3/arch/arm/mach-omap2/board-n8x0-usb.c
568 + * linux/arch/arm/mach-omap2/board-n8x0-usb.c
570 + * Copyright (C) 2006 Nokia Corporation
571 + * Author: Juha Yrjola
573 + * This program is free software; you can redistribute it and/or modify
574 + * it under the terms of the GNU General Public License version 2 as
575 + * published by the Free Software Foundation.
578 +#include <linux/types.h>
579 +#include <linux/delay.h>
580 +#include <linux/platform_device.h>
581 +#include <linux/clk.h>
582 +#include <linux/err.h>
583 +#include <linux/gpio.h>
584 +#include <linux/usb/musb.h>
586 +#include <plat/gpmc.h>
588 +#define TUSB_ASYNC_CS 1
589 +#define TUSB_SYNC_CS 4
590 +#define GPIO_TUSB_INT 58
591 +#define GPIO_TUSB_ENABLE 0
593 +static int tusb_set_power(int state);
594 +static int tusb_set_clock(struct clk *osc_ck, int state);
596 +#if defined(CONFIG_USB_MUSB_OTG)
597 +# define BOARD_MODE MUSB_OTG
598 +#elif defined(CONFIG_USB_MUSB_PERIPHERAL)
599 +# define BOARD_MODE MUSB_PERIPHERAL
600 +#else /* defined(CONFIG_USB_MUSB_HOST) */
601 +# define BOARD_MODE MUSB_HOST
604 +static struct musb_hdrc_eps_bits musb_eps[] = {
637 +static struct musb_hdrc_config musb_config = {
645 + .eps_bits = musb_eps,
648 +static struct musb_hdrc_platform_data tusb_data = {
649 + .mode = BOARD_MODE,
650 + .set_power = tusb_set_power,
651 + .set_clock = tusb_set_clock,
652 + .min_power = 25, /* x2 = 50 mA drawn from VBUS as peripheral */
653 + .power = 100, /* Max 100 mA VBUS for host mode */
655 + .config = &musb_config,
659 + * Enable or disable power to TUSB6010. When enabling, turn on 3.3 V and
660 + * 1.5 V voltage regulators of PM companion chip. Companion chip will then
661 + * provide then PGOOD signal to TUSB6010 which will release it from reset.
663 +static int tusb_set_power(int state)
668 + gpio_set_value(GPIO_TUSB_ENABLE, 1);
671 + /* Wait until TUSB6010 pulls INT pin down */
673 + while (i && gpio_get_value(GPIO_TUSB_INT)) {
679 + printk(KERN_ERR "tusb: powerup failed\n");
683 + gpio_set_value(GPIO_TUSB_ENABLE, 0);
690 +static int osc_ck_on;
692 +static int tusb_set_clock(struct clk *osc_ck, int state)
698 + //omap2_block_sleep();
699 + clk_enable(osc_ck);
702 + if (osc_ck_on == 0)
705 + clk_disable(osc_ck);
707 + //omap2_allow_sleep();
713 +void __init n8x0_usb_init(void)
716 + static char announce[] __initdata = KERN_INFO "TUSB 6010\n";
718 + /* PM companion chip power control pin */
719 + ret = gpio_request(GPIO_TUSB_ENABLE, "TUSB6010 enable");
721 + printk(KERN_ERR "Could not get TUSB power GPIO%i\n",
725 + gpio_direction_output(GPIO_TUSB_ENABLE, 0);
729 + ret = tusb6010_setup_interface(&tusb_data, TUSB6010_REFCLK_19, 2,
730 + TUSB_ASYNC_CS, TUSB_SYNC_CS,
731 + GPIO_TUSB_INT, 0x3f);
740 + gpio_free(GPIO_TUSB_ENABLE);
742 --- linux-2.6.35.3.orig/arch/arm/mach-omap2/control.c
743 +++ linux-2.6.35.3/arch/arm/mach-omap2/control.c
744 @@ -162,6 +162,7 @@ u16 omap_ctrl_readw(u16 offset)
745 return __raw_readw(OMAP_CTRL_REGADDR(offset));
748 +EXPORT_SYMBOL_GPL(omap_ctrl_readl);
749 u32 omap_ctrl_readl(u16 offset)
751 return __raw_readl(OMAP_CTRL_REGADDR(offset));
752 @@ -177,6 +178,7 @@ void omap_ctrl_writew(u16 val, u16 offse
753 __raw_writew(val, OMAP_CTRL_REGADDR(offset));
756 +EXPORT_SYMBOL_GPL(omap_ctrl_writel);
757 void omap_ctrl_writel(u32 val, u16 offset)
759 __raw_writel(val, OMAP_CTRL_REGADDR(offset));
760 --- linux-2.6.35.3.orig/arch/arm/mach-omap2/Kconfig
761 +++ linux-2.6.35.3/arch/arm/mach-omap2/Kconfig
762 @@ -116,6 +116,16 @@ config MACH_NOKIA_N8X0
763 select MACH_NOKIA_N810
764 select MACH_NOKIA_N810_WIMAX
766 +config MACH_NOKIA_N8X0_LCD
768 + depends on MACH_NOKIA_N8X0 && FB_OMAP_LCDC_BLIZZARD && FB_OMAP_LCD_MIPID
771 +config MACH_NOKIA_N8X0_USB
773 + depends on MACH_NOKIA_N8X0 && MACH_OMAP2_TUSB6010
776 config MACH_NOKIA_RX51
777 bool "Nokia RX-51 board"
778 depends on ARCH_OMAP3
779 --- linux-2.6.35.3.orig/arch/arm/mach-omap2/Makefile
780 +++ linux-2.6.35.3/arch/arm/mach-omap2/Makefile
781 @@ -116,6 +116,8 @@ obj-$(CONFIG_MACH_OMAP_3430SDP) += boar
784 obj-$(CONFIG_MACH_NOKIA_N8X0) += board-n8x0.o
785 +obj-$(CONFIG_MACH_NOKIA_N8X0_LCD) += board-n8x0-lcd.o
786 +obj-$(CONFIG_MACH_NOKIA_N8X0_USB) += board-n8x0-usb.o
787 obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51.o \
789 board-rx51-peripherals.o \
790 --- linux-2.6.35.3.orig/arch/arm/mach-omap2/serial.c
791 +++ linux-2.6.35.3/arch/arm/mach-omap2/serial.c
792 @@ -495,10 +495,10 @@ static void omap_uart_idle_init(struct o
796 - p->irqflags |= IRQF_SHARED;
797 +/* p->irqflags |= IRQF_SHARED;
798 ret = request_irq(p->irq, omap_uart_interrupt, IRQF_SHARED,
799 "serial idle", (void *)uart);
804 void omap_uart_enable_irqs(int enable)
805 @@ -506,13 +506,13 @@ void omap_uart_enable_irqs(int enable)
807 struct omap_uart_state *uart;
809 - list_for_each_entry(uart, &uart_list, node) {
810 +/* list_for_each_entry(uart, &uart_list, node) {
812 ret = request_irq(uart->p->irq, omap_uart_interrupt,
813 IRQF_SHARED, "serial idle", (void *)uart);
815 free_irq(uart->p->irq, (void *)uart);
820 static ssize_t sleep_timeout_show(struct device *dev,