aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa
diff options
context:
space:
mode:
authorEric Miao <eric.miao@marvell.com>2009-03-09 09:21:07 -0400
committerEric Miao <eric.miao@marvell.com>2009-03-09 09:21:07 -0400
commitabcea2c322cef559ef2f108b4763d107a5ccc37f (patch)
tree5fec7fec372f9bdb70703f6c77bfc49cda945442 /arch/arm/mach-pxa
parent8118aea23c328fd4913b325af53fda9d530b1d56 (diff)
parent6d831c6554e4f95083919914955a1a3a4a6acfa9 (diff)
Merge branch 'devel' of ssh://master.kernel.org/home/rmk/linux-2.6-arm into devel
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r--arch/arm/mach-pxa/Kconfig8
-rw-r--r--arch/arm/mach-pxa/Makefile2
-rw-r--r--arch/arm/mach-pxa/am300epd.c295
-rw-r--r--arch/arm/mach-pxa/gumstix.c6
-rw-r--r--arch/arm/mach-pxa/himalaya.c168
-rw-r--r--arch/arm/mach-pxa/include/mach/gumstix.h1
6 files changed, 480 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index ffd28e48d75f..04d1a07ced7f 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -40,6 +40,9 @@ choice
40config GUMSTIX_AM200EPD 40config GUMSTIX_AM200EPD
41 bool "Enable AM200EPD board support" 41 bool "Enable AM200EPD board support"
42 42
43config GUMSTIX_AM300EPD
44 bool "Enable AM300EPD board support"
45
43endchoice 46endchoice
44 47
45config MACH_INTELMOTE2 48config MACH_INTELMOTE2
@@ -302,6 +305,11 @@ config MACH_MAGICIAN
302 select HAVE_PWM 305 select HAVE_PWM
303 select PXA_HAVE_BOARD_IRQS 306 select PXA_HAVE_BOARD_IRQS
304 307
308config MACH_HIMALAYA
309 bool "HTC Himalaya Support"
310 select CPU_PXA26x
311 select FB_W100
312
305config MACH_MIOA701 313config MACH_MIOA701
306 bool "Mitac Mio A701 Support" 314 bool "Mitac Mio A701 Support"
307 select PXA27x 315 select PXA27x
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index 146aba72fa22..361fcfa7531a 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -28,6 +28,7 @@ obj-$(CONFIG_CPU_PXA930) += pxa930.o
28# Specific board support 28# Specific board support
29obj-$(CONFIG_ARCH_GUMSTIX) += gumstix.o 29obj-$(CONFIG_ARCH_GUMSTIX) += gumstix.o
30obj-$(CONFIG_GUMSTIX_AM200EPD) += am200epd.o 30obj-$(CONFIG_GUMSTIX_AM200EPD) += am200epd.o
31obj-$(CONFIG_GUMSTIX_AM300EPD) += am300epd.o
31obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o 32obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o
32obj-$(CONFIG_MACH_LOGICPD_PXA270) += lpd270.o 33obj-$(CONFIG_MACH_LOGICPD_PXA270) += lpd270.o
33obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o 34obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o
@@ -45,6 +46,7 @@ obj-$(CONFIG_MACH_PCM990_BASEBOARD) += pcm990-baseboard.o
45obj-$(CONFIG_MACH_TOSA) += tosa.o 46obj-$(CONFIG_MACH_TOSA) += tosa.o
46obj-$(CONFIG_MACH_EM_X270) += em-x270.o 47obj-$(CONFIG_MACH_EM_X270) += em-x270.o
47obj-$(CONFIG_MACH_MAGICIAN) += magician.o 48obj-$(CONFIG_MACH_MAGICIAN) += magician.o
49obj-$(CONFIG_MACH_HIMALAYA) += himalaya.o
48obj-$(CONFIG_MACH_MIOA701) += mioa701.o mioa701_bootresume.o 50obj-$(CONFIG_MACH_MIOA701) += mioa701.o mioa701_bootresume.o
49obj-$(CONFIG_ARCH_PXA_ESERIES) += eseries.o 51obj-$(CONFIG_ARCH_PXA_ESERIES) += eseries.o
50obj-$(CONFIG_MACH_E330) += e330.o 52obj-$(CONFIG_MACH_E330) += e330.o
diff --git a/arch/arm/mach-pxa/am300epd.c b/arch/arm/mach-pxa/am300epd.c
new file mode 100644
index 000000000000..4bd10a17332e
--- /dev/null
+++ b/arch/arm/mach-pxa/am300epd.c
@@ -0,0 +1,295 @@
1/*
2 * am300epd.c -- Platform device for AM300 EPD kit
3 *
4 * Copyright (C) 2008, Jaya Kumar
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive for
8 * more details.
9 *
10 * This work was made possible by help and equipment support from E-Ink
11 * Corporation. http://support.eink.com/community
12 *
13 * This driver is written to be used with the Broadsheet display controller.
14 * on the AM300 EPD prototype kit/development kit with an E-Ink 800x600
15 * Vizplex EPD on a Gumstix board using the Broadsheet interface board.
16 *
17 */
18
19#include <linux/module.h>
20#include <linux/kernel.h>
21#include <linux/errno.h>
22#include <linux/string.h>
23#include <linux/delay.h>
24#include <linux/interrupt.h>
25#include <linux/fb.h>
26#include <linux/init.h>
27#include <linux/platform_device.h>
28#include <linux/irq.h>
29#include <linux/gpio.h>
30
31#include <mach/gumstix.h>
32#include <mach/mfp-pxa25x.h>
33#include <mach/pxafb.h>
34
35#include "generic.h"
36
37#include <video/broadsheetfb.h>
38
39static unsigned int panel_type = 6;
40static struct platform_device *am300_device;
41static struct broadsheet_board am300_board;
42
43static unsigned long am300_pin_config[] __initdata = {
44 GPIO16_GPIO,
45 GPIO17_GPIO,
46 GPIO32_GPIO,
47 GPIO48_GPIO,
48 GPIO49_GPIO,
49 GPIO51_GPIO,
50 GPIO74_GPIO,
51 GPIO75_GPIO,
52 GPIO76_GPIO,
53 GPIO77_GPIO,
54
55 /* this is the 16-bit hdb bus 58-73 */
56 GPIO58_GPIO,
57 GPIO59_GPIO,
58 GPIO60_GPIO,
59 GPIO61_GPIO,
60
61 GPIO62_GPIO,
62 GPIO63_GPIO,
63 GPIO64_GPIO,
64 GPIO65_GPIO,
65
66 GPIO66_GPIO,
67 GPIO67_GPIO,
68 GPIO68_GPIO,
69 GPIO69_GPIO,
70
71 GPIO70_GPIO,
72 GPIO71_GPIO,
73 GPIO72_GPIO,
74 GPIO73_GPIO,
75};
76
77/* register offsets for gpio control */
78#define PWR_GPIO_PIN 16
79#define CFG_GPIO_PIN 17
80#define RDY_GPIO_PIN 32
81#define DC_GPIO_PIN 48
82#define RST_GPIO_PIN 49
83#define LED_GPIO_PIN 51
84#define RD_GPIO_PIN 74
85#define WR_GPIO_PIN 75
86#define CS_GPIO_PIN 76
87#define IRQ_GPIO_PIN 77
88
89/* hdb bus */
90#define DB0_GPIO_PIN 58
91#define DB15_GPIO_PIN 73
92
93static int gpios[] = { PWR_GPIO_PIN, CFG_GPIO_PIN, RDY_GPIO_PIN, DC_GPIO_PIN,
94 RST_GPIO_PIN, RD_GPIO_PIN, WR_GPIO_PIN, CS_GPIO_PIN,
95 IRQ_GPIO_PIN, LED_GPIO_PIN };
96static char *gpio_names[] = { "PWR", "CFG", "RDY", "DC", "RST", "RD", "WR",
97 "CS", "IRQ", "LED" };
98
99static int am300_wait_event(struct broadsheetfb_par *par)
100{
101 /* todo: improve err recovery */
102 wait_event(par->waitq, gpio_get_value(RDY_GPIO_PIN));
103 return 0;
104}
105
106static int am300_init_gpio_regs(struct broadsheetfb_par *par)
107{
108 int i;
109 int err;
110 char dbname[8];
111
112 for (i = 0; i < ARRAY_SIZE(gpios); i++) {
113 err = gpio_request(gpios[i], gpio_names[i]);
114 if (err) {
115 dev_err(&am300_device->dev, "failed requesting "
116 "gpio %s, err=%d\n", gpio_names[i], err);
117 goto err_req_gpio;
118 }
119 }
120
121 /* we also need to take care of the hdb bus */
122 for (i = DB0_GPIO_PIN; i <= DB15_GPIO_PIN; i++) {
123 sprintf(dbname, "DB%d", i);
124 err = gpio_request(i, dbname);
125 if (err) {
126 dev_err(&am300_device->dev, "failed requesting "
127 "gpio %d, err=%d\n", i, err);
128 while (i >= DB0_GPIO_PIN)
129 gpio_free(i--);
130 i = ARRAY_SIZE(gpios) - 1;
131 goto err_req_gpio;
132 }
133 }
134
135 /* setup the outputs and init values */
136 gpio_direction_output(PWR_GPIO_PIN, 0);
137 gpio_direction_output(CFG_GPIO_PIN, 1);
138 gpio_direction_output(DC_GPIO_PIN, 0);
139 gpio_direction_output(RD_GPIO_PIN, 1);
140 gpio_direction_output(WR_GPIO_PIN, 1);
141 gpio_direction_output(CS_GPIO_PIN, 1);
142 gpio_direction_output(RST_GPIO_PIN, 0);
143
144 /* setup the inputs */
145 gpio_direction_input(RDY_GPIO_PIN);
146 gpio_direction_input(IRQ_GPIO_PIN);
147
148 /* start the hdb bus as an input */
149 for (i = DB0_GPIO_PIN; i <= DB15_GPIO_PIN; i++)
150 gpio_direction_output(i, 0);
151
152 /* go into command mode */
153 gpio_set_value(CFG_GPIO_PIN, 1);
154 gpio_set_value(RST_GPIO_PIN, 0);
155 msleep(10);
156 gpio_set_value(RST_GPIO_PIN, 1);
157 msleep(10);
158 am300_wait_event(par);
159
160 return 0;
161
162err_req_gpio:
163 while (i > 0)
164 gpio_free(gpios[i--]);
165
166 return err;
167}
168
169static int am300_init_board(struct broadsheetfb_par *par)
170{
171 return am300_init_gpio_regs(par);
172}
173
174static void am300_cleanup(struct broadsheetfb_par *par)
175{
176 int i;
177
178 free_irq(IRQ_GPIO(RDY_GPIO_PIN), par);
179
180 for (i = 0; i < ARRAY_SIZE(gpios); i++)
181 gpio_free(gpios[i]);
182
183 for (i = DB0_GPIO_PIN; i <= DB15_GPIO_PIN; i++)
184 gpio_free(i);
185
186}
187
188static u16 am300_get_hdb(struct broadsheetfb_par *par)
189{
190 u16 res = 0;
191 int i;
192
193 for (i = 0; i <= (DB15_GPIO_PIN - DB0_GPIO_PIN) ; i++)
194 res |= (gpio_get_value(DB0_GPIO_PIN + i)) ? (1 << i) : 0;
195
196 return res;
197}
198
199static void am300_set_hdb(struct broadsheetfb_par *par, u16 data)
200{
201 int i;
202
203 for (i = 0; i <= (DB15_GPIO_PIN - DB0_GPIO_PIN) ; i++)
204 gpio_set_value(DB0_GPIO_PIN + i, (data >> i) & 0x01);
205}
206
207
208static void am300_set_ctl(struct broadsheetfb_par *par, unsigned char bit,
209 u8 state)
210{
211 switch (bit) {
212 case BS_CS:
213 gpio_set_value(CS_GPIO_PIN, state);
214 break;
215 case BS_DC:
216 gpio_set_value(DC_GPIO_PIN, state);
217 break;
218 case BS_WR:
219 gpio_set_value(WR_GPIO_PIN, state);
220 break;
221 }
222}
223
224static int am300_get_panel_type(void)
225{
226 return panel_type;
227}
228
229static irqreturn_t am300_handle_irq(int irq, void *dev_id)
230{
231 struct broadsheetfb_par *par = dev_id;
232
233 wake_up(&par->waitq);
234 return IRQ_HANDLED;
235}
236
237static int am300_setup_irq(struct fb_info *info)
238{
239 int ret;
240 struct broadsheetfb_par *par = info->par;
241
242 ret = request_irq(IRQ_GPIO(RDY_GPIO_PIN), am300_handle_irq,
243 IRQF_DISABLED|IRQF_TRIGGER_RISING,
244 "AM300", par);
245 if (ret)
246 dev_err(&am300_device->dev, "request_irq failed: %d\n", ret);
247
248 return ret;
249}
250
251static struct broadsheet_board am300_board = {
252 .owner = THIS_MODULE,
253 .init = am300_init_board,
254 .cleanup = am300_cleanup,
255 .set_hdb = am300_set_hdb,
256 .get_hdb = am300_get_hdb,
257 .set_ctl = am300_set_ctl,
258 .wait_for_rdy = am300_wait_event,
259 .get_panel_type = am300_get_panel_type,
260 .setup_irq = am300_setup_irq,
261};
262
263int __init am300_init(void)
264{
265 int ret;
266
267 pxa2xx_mfp_config(ARRAY_AND_SIZE(am300_pin_config));
268
269 /* request our platform independent driver */
270 request_module("broadsheetfb");
271
272 am300_device = platform_device_alloc("broadsheetfb", -1);
273 if (!am300_device)
274 return -ENOMEM;
275
276 /* the am300_board that will be seen by broadsheetfb is a copy */
277 platform_device_add_data(am300_device, &am300_board,
278 sizeof(am300_board));
279
280 ret = platform_device_add(am300_device);
281
282 if (ret) {
283 platform_device_put(am300_device);
284 return ret;
285 }
286
287 return 0;
288}
289
290module_param(panel_type, uint, 0);
291MODULE_PARM_DESC(panel_type, "Select the panel type: 6, 8, 97");
292
293MODULE_DESCRIPTION("board driver for am300 epd kit");
294MODULE_AUTHOR("Jaya Kumar");
295MODULE_LICENSE("GPL");
diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c
index e296ce11658c..9cb4a074d9f0 100644
--- a/arch/arm/mach-pxa/gumstix.c
+++ b/arch/arm/mach-pxa/gumstix.c
@@ -191,6 +191,11 @@ int __attribute__((weak)) am200_init(void)
191 return 0; 191 return 0;
192} 192}
193 193
194int __attribute__((weak)) am300_init(void)
195{
196 return 0;
197}
198
194static void __init carrier_board_init(void) 199static void __init carrier_board_init(void)
195{ 200{
196 /* 201 /*
@@ -198,6 +203,7 @@ static void __init carrier_board_init(void)
198 * they cannot be detected programatically 203 * they cannot be detected programatically
199 */ 204 */
200 am200_init(); 205 am200_init();
206 am300_init();
201} 207}
202 208
203static void __init gumstix_init(void) 209static void __init gumstix_init(void)
diff --git a/arch/arm/mach-pxa/himalaya.c b/arch/arm/mach-pxa/himalaya.c
new file mode 100644
index 000000000000..00884e5a6042
--- /dev/null
+++ b/arch/arm/mach-pxa/himalaya.c
@@ -0,0 +1,168 @@
1/*
2 * linux/arch/arm/mach-pxa/himalaya.c
3 *
4 * Hardware definitions for the HTC Himalaya
5 *
6 * Based on 2.6.21-hh20's himalaya.c and himalaya_lcd.c
7 *
8 * Copyright (c) 2008 Zbynek Michl <Zbynek.Michl@seznam.cz>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/device.h>
18#include <linux/fb.h>
19#include <linux/platform_device.h>
20
21#include <video/w100fb.h>
22
23#include <asm/setup.h>
24#include <asm/mach-types.h>
25#include <asm/mach/arch.h>
26
27#include <mach/mfp-pxa25x.h>
28#include <mach/hardware.h>
29#include <mach/pxa-regs.h>
30#include <mach/pxa2xx-regs.h>
31
32#include "generic.h"
33
34/* ---------------------- Himalaya LCD definitions -------------------- */
35
36static struct w100_gen_regs himalaya_lcd_regs = {
37 .lcd_format = 0x00000003,
38 .lcdd_cntl1 = 0x00000000,
39 .lcdd_cntl2 = 0x0003ffff,
40 .genlcd_cntl1 = 0x00fff003,
41 .genlcd_cntl2 = 0x00000003,
42 .genlcd_cntl3 = 0x000102aa,
43};
44
45static struct w100_mode himalaya4_lcd_mode = {
46 .xres = 240,
47 .yres = 320,
48 .left_margin = 0,
49 .right_margin = 31,
50 .upper_margin = 15,
51 .lower_margin = 0,
52 .crtc_ss = 0x80150014,
53 .crtc_ls = 0xa0fb00f7,
54 .crtc_gs = 0xc0080007,
55 .crtc_vpos_gs = 0x00080007,
56 .crtc_rev = 0x0000000a,
57 .crtc_dclk = 0x81700030,
58 .crtc_gclk = 0x8015010f,
59 .crtc_goe = 0x00000000,
60 .pll_freq = 80,
61 .pixclk_divider = 15,
62 .pixclk_divider_rotated = 15,
63 .pixclk_src = CLK_SRC_PLL,
64 .sysclk_divider = 0,
65 .sysclk_src = CLK_SRC_PLL,
66};
67
68static struct w100_mode himalaya6_lcd_mode = {
69 .xres = 240,
70 .yres = 320,
71 .left_margin = 9,
72 .right_margin = 8,
73 .upper_margin = 5,
74 .lower_margin = 4,
75 .crtc_ss = 0x80150014,
76 .crtc_ls = 0xa0fb00f7,
77 .crtc_gs = 0xc0080007,
78 .crtc_vpos_gs = 0x00080007,
79 .crtc_rev = 0x0000000a,
80 .crtc_dclk = 0xa1700030,
81 .crtc_gclk = 0x8015010f,
82 .crtc_goe = 0x00000000,
83 .pll_freq = 95,
84 .pixclk_divider = 0xb,
85 .pixclk_divider_rotated = 4,
86 .pixclk_src = CLK_SRC_PLL,
87 .sysclk_divider = 1,
88 .sysclk_src = CLK_SRC_PLL,
89};
90
91static struct w100_gpio_regs himalaya_w100_gpio_info = {
92 .init_data1 = 0xffff0000, /* GPIO_DATA */
93 .gpio_dir1 = 0x00000000, /* GPIO_CNTL1 */
94 .gpio_oe1 = 0x003c0000, /* GPIO_CNTL2 */
95 .init_data2 = 0x00000000, /* GPIO_DATA2 */
96 .gpio_dir2 = 0x00000000, /* GPIO_CNTL3 */
97 .gpio_oe2 = 0x00000000, /* GPIO_CNTL4 */
98};
99
100static struct w100fb_mach_info himalaya_fb_info = {
101 .num_modes = 1,
102 .regs = &himalaya_lcd_regs,
103 .gpio = &himalaya_w100_gpio_info,
104 .xtal_freq = 16000000,
105};
106
107static struct resource himalaya_fb_resources[] = {
108 [0] = {
109 .start = 0x08000000,
110 .end = 0x08ffffff,
111 .flags = IORESOURCE_MEM,
112 },
113};
114
115static struct platform_device himalaya_fb_device = {
116 .name = "w100fb",
117 .id = -1,
118 .dev = {
119 .platform_data = &himalaya_fb_info,
120 },
121 .num_resources = ARRAY_SIZE(himalaya_fb_resources),
122 .resource = himalaya_fb_resources,
123};
124
125/* ----------------------------------------------------------------------- */
126
127static struct platform_device *devices[] __initdata = {
128 &himalaya_fb_device,
129};
130
131static void __init himalaya_lcd_init(void)
132{
133 int himalaya_boardid;
134
135 himalaya_boardid = 0x4; /* hardcoded (detection needs ASIC3 functions) */
136 printk(KERN_INFO "himalaya LCD Driver init. boardid=%d\n",
137 himalaya_boardid);
138
139 switch (himalaya_boardid) {
140 case 0x4:
141 himalaya_fb_info.modelist = &himalaya4_lcd_mode;
142 break;
143 case 0x6:
144 himalaya_fb_info.modelist = &himalaya6_lcd_mode;
145 break;
146 default:
147 printk(KERN_INFO "himalaya lcd_init: unknown boardid=%d. Using 0x4\n",
148 himalaya_boardid);
149 himalaya_fb_info.modelist = &himalaya4_lcd_mode;
150 }
151}
152
153static void __init himalaya_init(void)
154{
155 himalaya_lcd_init();
156 platform_add_devices(devices, ARRAY_SIZE(devices));
157}
158
159
160MACHINE_START(HIMALAYA, "HTC Himalaya")
161 .phys_io = 0x40000000,
162 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
163 .boot_params = 0xa0000100,
164 .map_io = pxa_map_io,
165 .init_irq = pxa25x_init_irq,
166 .init_machine = himalaya_init,
167 .timer = &pxa_timer,
168MACHINE_END
diff --git a/arch/arm/mach-pxa/include/mach/gumstix.h b/arch/arm/mach-pxa/include/mach/gumstix.h
index 099f54a41de4..06abd4160607 100644
--- a/arch/arm/mach-pxa/include/mach/gumstix.h
+++ b/arch/arm/mach-pxa/include/mach/gumstix.h
@@ -97,4 +97,5 @@ has detected a cable insertion; driven low otherwise. */
97 97
98/* for expansion boards that can't be programatically detected */ 98/* for expansion boards that can't be programatically detected */
99extern int am200_init(void); 99extern int am200_init(void);
100extern int am300_init(void);
100 101