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
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>
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
[] = {
35 .flags
= IORESOURCE_MEM
,
40 .flags
= IORESOURCE_IRQ
,
44 static struct platform_device smc9118_device
= {
47 .num_resources
= ARRAY_SIZE(smc9118_resources
),
48 .resource
= smc9118_resources
,
50 .platform_data
= &smc911x_info
,
54 static struct mtd_partition ap325rxa_nor_flash_partitions
[] = {
58 .size
= (1 * 1024 * 1024),
59 .mask_flags
= MTD_WRITEABLE
, /* Read-only */
62 .offset
= MTDPART_OFS_APPEND
,
63 .size
= (2 * 1024 * 1024),
66 .offset
= MTDPART_OFS_APPEND
,
67 .size
= MTDPART_SIZ_FULL
,
71 static struct physmap_flash_data ap325rxa_nor_flash_data
= {
73 .parts
= ap325rxa_nor_flash_partitions
,
74 .nr_parts
= ARRAY_SIZE(ap325rxa_nor_flash_partitions
),
77 static struct resource ap325rxa_nor_flash_resources
[] = {
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
),
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
)
110 /* ASD AP-320/325 LCD ON */
111 ctrl_outw(FPGA_LCDREG_VAL
, FPGA_LCDREG
);
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
,
122 .chan
= LCDC_CHAN_MAINLCD
,
124 .interface_type
= RGB18
,
136 .sync
= 0, /* hsync and vsync are active low */
139 .display_on
= ap320_wvga_power_on
,
144 static struct resource lcdc_resources
[] = {
147 .start
= 0xfe940000, /* P4-only space */
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
,
158 .platform_data
= &lcdc_info
,
162 static struct platform_device
*ap325rxa_devices
[] __initdata
= {
164 &ap325rxa_nor_flash_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
,