2 * Machine initialization for Rover P1
4 * Authors: Konstantine A. Beklemishev konstantine@r66.ru
5 * LCD initialization based on h1900.c code and adapted for Rover P1 platform
8 #include <linux/init.h>
9 #include <linux/interrupt.h>
10 #include <linux/kernel.h>
12 #include <linux/major.h>
13 #include <linux/ioport.h>
14 #include <linux/device.h>
15 #include <linux/input.h>
16 #include <linux/delay.h>
17 /* #include <linux/fb.h> */
19 #include <asm/mach/arch.h>
20 #include <asm/mach/map.h>
22 #include <asm/mach-types.h>
24 #include <asm/memory.h>
25 #include <asm/hardware.h>
27 #include <asm/arch/roverp1-init.h>
28 #include <asm/arch/roverp1-gpio.h>
30 #include <asm/arch/pxa-dmabounce.h>
31 /* #include <asm/arch/pxafb.h> */
32 #include <asm/arch/udc.h>
33 #include <asm/arch/pxa-regs.h>
36 #include "../generic.h"
41 # define DPRINTK(fmt, args...) printk("%s: " fmt, __FUNCTION__ , ## args)
43 # define DPRINTK(fmt, args...)
46 /* static void roverp1_backlight_power(int on)
51 * static struct pxafb_mach_info roverp1lcd __initdata = {
52 * .pixclock = 156551, // --
54 * .xres = 240, // PPL + 1
55 * .yres = 320, // LPP + 1
56 * .hsync_len = 24, // HSW + 1
57 * .vsync_len = 2, // VSW + 1
58 * .left_margin= 20, // BLW + 1
59 * .upper_margin = 5, // BFW
60 * .right_margin = 12, // ELW + 1
61 * .lower_margin = 5, // EFW
62 * .sync = FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT,
63 * .lccr0 = 0x003008f0,
64 * .lccr3 = 0x04400008,
65 * .pxafb_backlight_power = roverp1_backlight_power
69 static int roverp1_udc_is_connected(void) {
70 DPRINTK("roverp1_udc_is_connected\n");
71 return GET_ROVERP1_GPIO(USB_DETECT
);
74 /* TODO unified eGPIO write/get function. static var */
76 static void roverp1_udc_command(int cmd
) {
78 DPRINTK("roverp1_udc_command: %d\n", cmd
);
81 case PXA2XX_UDC_CMD_DISCONNECT
:
82 /* SET_ROVERP1_eGPIO(eGPIO_NR_ROVERP1_USB_EN, 0) */
83 /* writel(0x8021,ROVERP1_eGPIO_VIRT); */
84 /* printk("usb disconnected\n"); */
86 case PXA2XX_UDC_CMD_CONNECT
:
87 /* SET_ROVERP1_eGPIO(eGPIO_NR_ROVERP1_USB_EN, 1) */
88 /* writel(0x8220,ROVERP1_eGPIO_VIRT); */
89 /* printk("usb connected\n"); */
92 DPRINTK("roverp1_udc_control: unknown command!\n");
97 static struct pxa2xx_udc_mach_info roverp1_udc_mach_info
= {
98 .udc_is_connected
= roverp1_udc_is_connected
,
99 .udc_command
= roverp1_udc_command
,
102 static void __init
roverp1_init_irq (void)
104 /* Initialize standard IRQs */
109 static struct map_desc roverp1_io_desc
[] __initdata
= {
110 /* virtual physical length domain r w c b */
111 { ROVERP1_eGPIO_VIRT
, ROVERP1_eGPIO_PHYS
, 0x00001000, MT_DEVICE
}, /* CS#2 eGPIO*/
114 static void __init
roverp1_map_io(void)
116 /* Initialize standard IO maps */
118 iotable_init(roverp1_io_desc
, ARRAY_SIZE(roverp1_io_desc
));
119 /* writel(0x8228,ROVERP1_eGPIO_VIRT); */
120 PWER
= PWER_GPIO0
| PWER_RTC
;
121 PFER
= PWER_GPIO0
| PWER_RTC
;
124 /* CKEN = CKEN0_PWM0 | CKEN1_PWM1 | CKEN2_AC97 | CKEN3_SSP |
125 * CKEN4_SSP3 | CKEN5_STUART | CKEN6_FFUART | CKEN8_I2S |
126 * CKEN9_OSTIMER | CKEN10_USBHOST | CKEN11_USB | CKEN12_MMC |
127 * CKEN13_FICP | CKEN14_I2C | CKEN15_PWRI2C | CKEN16_LCD |
128 * CKEN20_IM | CKEN22_MEMC; */
130 PGSR0
= GPSRx_SleepValue
;
131 PGSR1
= GPSRy_SleepValue
;
132 PGSR2
= GPSRz_SleepValue
;
134 /* Set up GPIO direction and alternate function registers */
135 GAFR0_L
= GAFR0x_InitValue
;
136 GAFR0_U
= GAFR1x_InitValue
;
137 GAFR1_L
= GAFR0y_InitValue
;
138 GAFR1_U
= GAFR1y_InitValue
;
139 GAFR2_L
= GAFR0z_InitValue
;
140 GAFR2_U
= GAFR1z_InitValue
;
142 GPDR0
= GPDRx_InitValue
;
143 GPDR1
= GPDRy_InitValue
;
144 GPDR2
= GPDRz_InitValue
;
146 GPSR0
= GPSRx_InitValue
;
147 GPSR1
= GPSRy_InitValue
;
148 GPSR2
= GPSRz_InitValue
;
150 GPCR0
= ~GPSRx_InitValue
;
151 GPCR1
= ~GPSRy_InitValue
;
152 GPCR2
= ~GPSRz_InitValue
;
154 REINIT_ROVERP1_eGPIO
;
156 /* if GET_ROVERP1_GPIO(USB_DETECT)
157 * printk("\n\nusb connected\n\n");
159 * printk("\n\nusb disconnected\n\n");
160 * printk("eGPIO reinited\n"); */
164 /* static struct platform_device *devices[] __initdata = {
168 static void __init
roverp1_init (void)
170 pxa_set_udc_info (&roverp1_udc_mach_info
);
171 /* set_pxa_fb_info(&roverp1lcd); */
174 MACHINE_START(ROVERP1
, "Rover Rover P1")
175 /* Maintainer Konstantine A. Beklemishev */
176 .phys_ram
= 0xa0000000,
177 .phys_io
= 0x40000000,
178 .io_pg_offst
= (io_p2v(0x40000000) >> 18) & 0xfffc,
179 .boot_params
= 0xa0000100,
180 .map_io
= roverp1_map_io
,
181 .init_irq
= roverp1_init_irq
,
183 .init_machine
= roverp1_init
,