aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2011-11-10 21:47:16 -0500
committerPaul Mundt <lethal@linux-sh.org>2011-11-11 02:56:32 -0500
commit665ccfa0904cc0a05aa882d193f9506081824d7c (patch)
treeb21381f3b54e5f43fb5eb45e7ed1fc06a7d4c7ac /arch/arm
parente609b7cb7ab18cf75d4bdd931a33e3caed6cd9e2 (diff)
ARM: mach-shmobile: bonito: Add LCDC0 support
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-shmobile/board-bonito.c117
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7740.c6
2 files changed, 122 insertions, 1 deletions
diff --git a/arch/arm/mach-shmobile/board-bonito.c b/arch/arm/mach-shmobile/board-bonito.c
index d78008bbdf70..5b014764e2a5 100644
--- a/arch/arm/mach-shmobile/board-bonito.c
+++ b/arch/arm/mach-shmobile/board-bonito.c
@@ -33,6 +33,7 @@
33#include <asm/mach/time.h> 33#include <asm/mach/time.h>
34#include <asm/hardware/cache-l2x0.h> 34#include <asm/hardware/cache-l2x0.h>
35#include <mach/r8a7740.h> 35#include <mach/r8a7740.h>
36#include <video/sh_mobile_lcdc.h>
36 37
37/* 38/*
38 * CS Address device note 39 * CS Address device note
@@ -65,6 +66,13 @@
65 */ 66 */
66 67
67/* 68/*
69 * LCDC0 (CN3/CN4/CN7)
70 *
71 * S38.1 = OFF
72 * S38.2 = OFF
73 */
74
75/*
68 * FPGA 76 * FPGA
69 */ 77 */
70#define BUSSWMR1 0x0070 78#define BUSSWMR1 0x0070
@@ -72,6 +80,7 @@
72#define BUSSWMR3 0x0074 80#define BUSSWMR3 0x0074
73#define BUSSWMR4 0x0076 81#define BUSSWMR4 0x0076
74 82
83#define LCDCR 0x10B4
75#define A1MDSR 0x10E0 84#define A1MDSR 0x10E0
76#define BVERR 0x1100 85#define BVERR 0x1100
77static u16 bonito_fpga_read(u32 offset) 86static u16 bonito_fpga_read(u32 offset)
@@ -135,6 +144,63 @@ static int __init pmic_init(void)
135device_initcall(pmic_init); 144device_initcall(pmic_init);
136 145
137/* 146/*
147 * LCDC0
148 */
149static const struct fb_videomode lcdc0_mode = {
150 .name = "WVGA Panel",
151 .xres = 800,
152 .yres = 480,
153 .left_margin = 88,
154 .right_margin = 40,
155 .hsync_len = 128,
156 .upper_margin = 20,
157 .lower_margin = 5,
158 .vsync_len = 5,
159 .sync = 0,
160};
161
162static struct sh_mobile_lcdc_info lcdc0_info = {
163 .clock_source = LCDC_CLK_BUS,
164 .ch[0] = {
165 .chan = LCDC_CHAN_MAINLCD,
166 .bpp = 16,
167 .interface_type = RGB24,
168 .clock_divider = 5,
169 .flags = 0,
170 .lcd_cfg = &lcdc0_mode,
171 .num_cfg = 1,
172 .lcd_size_cfg = {
173 .width = 152,
174 .height = 91,
175 },
176 },
177};
178
179static struct resource lcdc0_resources[] = {
180 [0] = {
181 .name = "LCDC0",
182 .start = 0xfe940000,
183 .end = 0xfe943fff,
184 .flags = IORESOURCE_MEM,
185 },
186 [1] = {
187 .start = intcs_evt2irq(0x0580),
188 .flags = IORESOURCE_IRQ,
189 },
190};
191
192static struct platform_device lcdc0_device = {
193 .name = "sh_mobile_lcdc_fb",
194 .id = 0,
195 .resource = lcdc0_resources,
196 .num_resources = ARRAY_SIZE(lcdc0_resources),
197 .dev = {
198 .platform_data = &lcdc0_info,
199 .coherent_dma_mask = ~0,
200 },
201};
202
203/*
138 * core board devices 204 * core board devices
139 */ 205 */
140static struct platform_device *bonito_core_devices[] __initdata = { 206static struct platform_device *bonito_core_devices[] __initdata = {
@@ -144,6 +210,7 @@ static struct platform_device *bonito_core_devices[] __initdata = {
144 * base board devices 210 * base board devices
145 */ 211 */
146static struct platform_device *bonito_base_devices[] __initdata = { 212static struct platform_device *bonito_base_devices[] __initdata = {
213 &lcdc0_device,
147}; 214};
148 215
149/* 216/*
@@ -199,6 +266,9 @@ static void __init bonito_map_io(void)
199#define BIT_ON(sw, bit) (sw & (1 << bit)) 266#define BIT_ON(sw, bit) (sw & (1 << bit))
200#define BIT_OFF(sw, bit) (!(sw & (1 << bit))) 267#define BIT_OFF(sw, bit) (!(sw & (1 << bit)))
201 268
269#define VCCQ1CR 0xE6058140
270#define VCCQ1LCDCR 0xE6058186
271
202static void __init bonito_init(void) 272static void __init bonito_init(void)
203{ 273{
204 u16 val; 274 u16 val;
@@ -258,6 +328,53 @@ static void __init bonito_init(void)
258 gpio_request(GPIO_FN_SCIFA5_RXD_PORT92, NULL); 328 gpio_request(GPIO_FN_SCIFA5_RXD_PORT92, NULL);
259 } 329 }
260 330
331 /*
332 * LCDC0 (CN3)
333 */
334 if (BIT_ON(bsw2, 3) && /* S38.1 = OFF */
335 BIT_ON(bsw2, 2)) { /* S38.2 = OFF */
336 gpio_request(GPIO_FN_LCDC0_SELECT, NULL);
337 gpio_request(GPIO_FN_LCD0_D0, NULL);
338 gpio_request(GPIO_FN_LCD0_D1, NULL);
339 gpio_request(GPIO_FN_LCD0_D2, NULL);
340 gpio_request(GPIO_FN_LCD0_D3, NULL);
341 gpio_request(GPIO_FN_LCD0_D4, NULL);
342 gpio_request(GPIO_FN_LCD0_D5, NULL);
343 gpio_request(GPIO_FN_LCD0_D6, NULL);
344 gpio_request(GPIO_FN_LCD0_D7, NULL);
345 gpio_request(GPIO_FN_LCD0_D8, NULL);
346 gpio_request(GPIO_FN_LCD0_D9, NULL);
347 gpio_request(GPIO_FN_LCD0_D10, NULL);
348 gpio_request(GPIO_FN_LCD0_D11, NULL);
349 gpio_request(GPIO_FN_LCD0_D12, NULL);
350 gpio_request(GPIO_FN_LCD0_D13, NULL);
351 gpio_request(GPIO_FN_LCD0_D14, NULL);
352 gpio_request(GPIO_FN_LCD0_D15, NULL);
353 gpio_request(GPIO_FN_LCD0_D16, NULL);
354 gpio_request(GPIO_FN_LCD0_D17, NULL);
355 gpio_request(GPIO_FN_LCD0_D18_PORT163, NULL);
356 gpio_request(GPIO_FN_LCD0_D19_PORT162, NULL);
357 gpio_request(GPIO_FN_LCD0_D20_PORT161, NULL);
358 gpio_request(GPIO_FN_LCD0_D21_PORT158, NULL);
359 gpio_request(GPIO_FN_LCD0_D22_PORT160, NULL);
360 gpio_request(GPIO_FN_LCD0_D23_PORT159, NULL);
361 gpio_request(GPIO_FN_LCD0_DCK, NULL);
362 gpio_request(GPIO_FN_LCD0_VSYN, NULL);
363 gpio_request(GPIO_FN_LCD0_HSYN, NULL);
364 gpio_request(GPIO_FN_LCD0_DISP, NULL);
365 gpio_request(GPIO_FN_LCD0_LCLK_PORT165, NULL);
366
367 gpio_request(GPIO_PORT61, NULL); /* LCDDON */
368 gpio_direction_output(GPIO_PORT61, 1);
369
370 /* backlight on */
371 bonito_fpga_write(LCDCR, 1);
372
373 /* drivability Max */
374 __raw_writew(0x00FF , VCCQ1LCDCR);
375 __raw_writew(0xFFFF , VCCQ1CR);
376 }
377
261 platform_add_devices(bonito_base_devices, 378 platform_add_devices(bonito_base_devices,
262 ARRAY_SIZE(bonito_base_devices)); 379 ARRAY_SIZE(bonito_base_devices));
263 } 380 }
diff --git a/arch/arm/mach-shmobile/clock-r8a7740.c b/arch/arm/mach-shmobile/clock-r8a7740.c
index 5bb02f224077..3b35b9afc001 100644
--- a/arch/arm/mach-shmobile/clock-r8a7740.c
+++ b/arch/arm/mach-shmobile/clock-r8a7740.c
@@ -251,7 +251,7 @@ static struct clk div6_clks[DIV6_NR] = {
251 251
252enum { 252enum {
253 MSTP125, 253 MSTP125,
254 MSTP116, MSTP111, 254 MSTP116, MSTP111, MSTP100, MSTP117,
255 255
256 MSTP230, 256 MSTP230,
257 MSTP222, 257 MSTP222,
@@ -264,8 +264,10 @@ enum {
264 264
265static struct clk mstp_clks[MSTP_NR] = { 265static struct clk mstp_clks[MSTP_NR] = {
266 [MSTP125] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 25, 0), /* TMU0 */ 266 [MSTP125] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 25, 0), /* TMU0 */
267 [MSTP117] = SH_CLK_MSTP32(&div4_clks[DIV4_B], SMSTPCR1, 17, 0), /* LCDC1 */
267 [MSTP116] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 16, 0), /* IIC0 */ 268 [MSTP116] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 16, 0), /* IIC0 */
268 [MSTP111] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 11, 0), /* TMU1 */ 269 [MSTP111] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR1, 11, 0), /* TMU1 */
270 [MSTP100] = SH_CLK_MSTP32(&div4_clks[DIV4_B], SMSTPCR1, 0, 0), /* LCDC0 */
269 271
270 [MSTP230] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 30, 0), /* SCIFA6 */ 272 [MSTP230] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 30, 0), /* SCIFA6 */
271 [MSTP222] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 22, 0), /* SCIFA7 */ 273 [MSTP222] = SH_CLK_MSTP32(&div6_clks[DIV6_SUB], SMSTPCR2, 22, 0), /* SCIFA7 */
@@ -314,8 +316,10 @@ static struct clk_lookup lookups[] = {
314 CLKDEV_CON_ID("sub_clk", &div6_clks[DIV6_SUB]), 316 CLKDEV_CON_ID("sub_clk", &div6_clks[DIV6_SUB]),
315 317
316 /* MSTP32 clocks */ 318 /* MSTP32 clocks */
319 CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]),
317 CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP111]), 320 CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP111]),
318 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), 321 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]),
322 CLKDEV_DEV_ID("sh_mobile_lcdc_fb.1", &mstp_clks[MSTP117]),
319 CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP125]), 323 CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP125]),
320 324
321 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), 325 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]),