sh: Update smc911x platform data for AP325RXA
[linux-2.6/zen-sources.git] / arch / sh / boards / renesas / ap325rxa / setup.c
blobf8b7859bbdcee3d854211df5ab98571e8a792fbf
1 /*
2 * Renesas - AP-325RXA
3 * (Compatible with Algo System ., LTD. - AP-320A)
5 * Copyright (C) 2008 Renesas Solutions Corp.
6 * Author : Yusuke Goda <goda.yuske@renesas.com>
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
13 #include <linux/init.h>
14 #include <linux/device.h>
15 #include <linux/interrupt.h>
16 #include <linux/platform_device.h>
17 #include <linux/mtd/physmap.h>
18 #include <linux/delay.h>
19 #include <linux/i2c.h>
20 #include <linux/delay.h>
21 #include <linux/smc911x.h>
22 #include <asm/sh_mobile_lcdc.h>
23 #include <asm/io.h>
24 #include <asm/clock.h>
26 static struct smc911x_platdata smc911x_info = {
27 .flags = SMC911X_USE_32BIT,
28 .irq_flags = IRQF_TRIGGER_LOW,
31 static struct resource smc9118_resources[] = {
32 [0] = {
33 .start = 0xb6080000,
34 .end = 0xb60fffff,
35 .flags = IORESOURCE_MEM,
37 [1] = {
38 .start = 35,
39 .end = 35,
40 .flags = IORESOURCE_IRQ,
44 static struct platform_device smc9118_device = {
45 .name = "smc911x",
46 .id = -1,
47 .num_resources = ARRAY_SIZE(smc9118_resources),
48 .resource = smc9118_resources,
49 .dev = {
50 .platform_data = &smc911x_info,
54 static struct mtd_partition ap325rxa_nor_flash_partitions[] = {
56 .name = "uboot",
57 .offset = 0,
58 .size = (1 * 1024 * 1024),
59 .mask_flags = MTD_WRITEABLE, /* Read-only */
60 }, {
61 .name = "kernel",
62 .offset = MTDPART_OFS_APPEND,
63 .size = (2 * 1024 * 1024),
64 }, {
65 .name = "other",
66 .offset = MTDPART_OFS_APPEND,
67 .size = MTDPART_SIZ_FULL,
71 static struct physmap_flash_data ap325rxa_nor_flash_data = {
72 .width = 2,
73 .parts = ap325rxa_nor_flash_partitions,
74 .nr_parts = ARRAY_SIZE(ap325rxa_nor_flash_partitions),
77 static struct resource ap325rxa_nor_flash_resources[] = {
78 [0] = {
79 .name = "NOR Flash",
80 .start = 0x00000000,
81 .end = 0x00ffffff,
82 .flags = IORESOURCE_MEM,
86 static struct platform_device ap325rxa_nor_flash_device = {
87 .name = "physmap-flash",
88 .resource = ap325rxa_nor_flash_resources,
89 .num_resources = ARRAY_SIZE(ap325rxa_nor_flash_resources),
90 .dev = {
91 .platform_data = &ap325rxa_nor_flash_data,
95 #define FPGA_LCDREG 0xB4100180
96 #define FPGA_BKLREG 0xB4100212
97 #define FPGA_LCDREG_VAL 0x0018
98 #define PORT_PHCR 0xA405010E
99 #define PORT_PLCR 0xA4050114
100 #define PORT_PMCR 0xA4050116
101 #define PORT_PRCR 0xA405011C
102 #define PORT_HIZCRA 0xA4050158
103 #define PORT_PSCR 0xA405011E
104 #define PORT_PSDR 0xA405013E
106 static void ap320_wvga_power_on(void *board_data)
108 msleep(100);
110 /* ASD AP-320/325 LCD ON */
111 ctrl_outw(FPGA_LCDREG_VAL, FPGA_LCDREG);
113 /* backlight */
114 ctrl_outw((ctrl_inw(PORT_PSCR) & ~0x00C0) | 0x40, PORT_PSCR);
115 ctrl_outb(ctrl_inb(PORT_PSDR) & ~0x08, PORT_PSDR);
116 ctrl_outw(0x100, FPGA_BKLREG);
119 static struct sh_mobile_lcdc_info lcdc_info = {
120 .clock_source = LCDC_CLK_EXTERNAL,
121 .ch[0] = {
122 .chan = LCDC_CHAN_MAINLCD,
123 .bpp = 16,
124 .interface_type = RGB18,
125 .clock_divider = 1,
126 .lcd_cfg = {
127 .name = "LB070WV1",
128 .xres = 800,
129 .yres = 480,
130 .left_margin = 40,
131 .right_margin = 160,
132 .hsync_len = 8,
133 .upper_margin = 63,
134 .lower_margin = 80,
135 .vsync_len = 1,
136 .sync = 0, /* hsync and vsync are active low */
138 .board_cfg = {
139 .display_on = ap320_wvga_power_on,
144 static struct resource lcdc_resources[] = {
145 [0] = {
146 .name = "LCDC",
147 .start = 0xfe940000, /* P4-only space */
148 .end = 0xfe941fff,
149 .flags = IORESOURCE_MEM,
153 static struct platform_device lcdc_device = {
154 .name = "sh_mobile_lcdc_fb",
155 .num_resources = ARRAY_SIZE(lcdc_resources),
156 .resource = lcdc_resources,
157 .dev = {
158 .platform_data = &lcdc_info,
162 static struct platform_device *ap325rxa_devices[] __initdata = {
163 &smc9118_device,
164 &ap325rxa_nor_flash_device,
165 &lcdc_device,
168 static struct i2c_board_info __initdata ap325rxa_i2c_devices[] = {
171 static int __init ap325rxa_devices_setup(void)
173 clk_always_enable("mstp200"); /* LCDC */
175 i2c_register_board_info(0, ap325rxa_i2c_devices,
176 ARRAY_SIZE(ap325rxa_i2c_devices));
178 return platform_add_devices(ap325rxa_devices,
179 ARRAY_SIZE(ap325rxa_devices));
181 device_initcall(ap325rxa_devices_setup);
183 static void __init ap325rxa_setup(char **cmdline_p)
185 /* LCDC configuration */
186 ctrl_outw(ctrl_inw(PORT_PHCR) & ~0xffff, PORT_PHCR);
187 ctrl_outw(ctrl_inw(PORT_PLCR) & ~0xffff, PORT_PLCR);
188 ctrl_outw(ctrl_inw(PORT_PMCR) & ~0xffff, PORT_PMCR);
189 ctrl_outw(ctrl_inw(PORT_PRCR) & ~0x03ff, PORT_PRCR);
190 ctrl_outw(ctrl_inw(PORT_HIZCRA) & ~0x01C0, PORT_HIZCRA);
193 static struct sh_machine_vector mv_ap325rxa __initmv = {
194 .mv_name = "AP-325RXA",
195 .mv_setup = ap325rxa_setup,