Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * linux/arch/arm/mach-sa1100/jornada720.c | |
3 | */ | |
4 | ||
5 | #include <linux/init.h> | |
6 | #include <linux/kernel.h> | |
7 | #include <linux/tty.h> | |
8 | #include <linux/delay.h> | |
d052d1be | 9 | #include <linux/platform_device.h> |
1da177e4 | 10 | #include <linux/ioport.h> |
183e1a34 RK |
11 | #include <linux/mtd/mtd.h> |
12 | #include <linux/mtd/partitions.h> | |
1da177e4 LT |
13 | |
14 | #include <asm/hardware.h> | |
15 | #include <asm/hardware/sa1111.h> | |
16 | #include <asm/irq.h> | |
17 | #include <asm/mach-types.h> | |
18 | #include <asm/setup.h> | |
19 | ||
20 | #include <asm/mach/arch.h> | |
183e1a34 | 21 | #include <asm/mach/flash.h> |
1da177e4 LT |
22 | #include <asm/mach/map.h> |
23 | #include <asm/mach/serial_sa1100.h> | |
24 | ||
25 | #include "generic.h" | |
26 | ||
27 | ||
28 | #define JORTUCR_VAL 0x20000400 | |
29 | ||
30 | static struct resource sa1111_resources[] = { | |
31 | [0] = { | |
32 | .start = 0x40000000, | |
33 | .end = 0x40001fff, | |
34 | .flags = IORESOURCE_MEM, | |
35 | }, | |
36 | [1] = { | |
37 | .start = IRQ_GPIO1, | |
38 | .end = IRQ_GPIO1, | |
39 | .flags = IORESOURCE_IRQ, | |
40 | }, | |
41 | }; | |
42 | ||
43 | static u64 sa1111_dmamask = 0xffffffffUL; | |
44 | ||
45 | static struct platform_device sa1111_device = { | |
46 | .name = "sa1111", | |
47 | .id = 0, | |
48 | .dev = { | |
49 | .dma_mask = &sa1111_dmamask, | |
50 | .coherent_dma_mask = 0xffffffff, | |
51 | }, | |
52 | .num_resources = ARRAY_SIZE(sa1111_resources), | |
53 | .resource = sa1111_resources, | |
54 | }; | |
55 | ||
56 | static struct platform_device *devices[] __initdata = { | |
57 | &sa1111_device, | |
58 | }; | |
59 | ||
60 | static int __init jornada720_init(void) | |
61 | { | |
62 | int ret = -ENODEV; | |
63 | ||
64 | if (machine_is_jornada720()) { | |
65 | GPDR |= GPIO_GPIO20; | |
66 | TUCR = JORTUCR_VAL; /* set the oscillator out to the SA-1101 */ | |
67 | ||
68 | GPSR = GPIO_GPIO20; | |
69 | udelay(1); | |
70 | GPCR = GPIO_GPIO20; | |
71 | udelay(1); | |
72 | GPSR = GPIO_GPIO20; | |
73 | udelay(20); | |
74 | ||
75 | /* LDD4 is speaker, LDD3 is microphone */ | |
76 | PPSR &= ~(PPC_LDD3 | PPC_LDD4); | |
77 | PPDR |= PPC_LDD3 | PPC_LDD4; | |
78 | ||
79 | ret = platform_add_devices(devices, ARRAY_SIZE(devices)); | |
80 | } | |
81 | return ret; | |
82 | } | |
83 | ||
84 | arch_initcall(jornada720_init); | |
85 | ||
86 | static struct map_desc jornada720_io_desc[] __initdata = { | |
92519d82 DS |
87 | { /* Epson registers */ |
88 | .virtual = 0xf0000000, | |
89 | .pfn = __phys_to_pfn(0x48000000), | |
90 | .length = 0x00100000, | |
91 | .type = MT_DEVICE | |
92 | }, { /* Epson frame buffer */ | |
93 | .virtual = 0xf1000000, | |
94 | .pfn = __phys_to_pfn(0x48200000), | |
95 | .length = 0x00100000, | |
96 | .type = MT_DEVICE | |
97 | }, { /* SA-1111 */ | |
98 | .virtual = 0xf4000000, | |
99 | .pfn = __phys_to_pfn(0x40000000), | |
100 | .length = 0x00100000, | |
101 | .type = MT_DEVICE | |
102 | } | |
1da177e4 LT |
103 | }; |
104 | ||
105 | static void __init jornada720_map_io(void) | |
106 | { | |
107 | sa1100_map_io(); | |
108 | iotable_init(jornada720_io_desc, ARRAY_SIZE(jornada720_io_desc)); | |
109 | ||
110 | sa1100_register_uart(0, 3); | |
111 | sa1100_register_uart(1, 1); | |
112 | } | |
113 | ||
183e1a34 RK |
114 | static struct mtd_partition jornada720_partitions[] = { |
115 | { | |
116 | .name = "JORNADA720 boot firmware", | |
117 | .size = 0x00040000, | |
118 | .offset = 0, | |
119 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | |
120 | }, { | |
121 | .name = "JORNADA720 kernel", | |
122 | .size = 0x000c0000, | |
123 | .offset = 0x00040000, | |
124 | }, { | |
125 | .name = "JORNADA720 params", | |
126 | .size = 0x00040000, | |
127 | .offset = 0x00100000, | |
128 | }, { | |
129 | .name = "JORNADA720 initrd", | |
130 | .size = 0x00100000, | |
131 | .offset = 0x00140000, | |
132 | }, { | |
133 | .name = "JORNADA720 root cramfs", | |
134 | .size = 0x00300000, | |
135 | .offset = 0x00240000, | |
136 | }, { | |
137 | .name = "JORNADA720 usr cramfs", | |
138 | .size = 0x00800000, | |
139 | .offset = 0x00540000, | |
140 | }, { | |
141 | .name = "JORNADA720 usr local", | |
142 | .size = 0, /* will expand to the end of the flash */ | |
143 | .offset = 0x00d00000, | |
144 | } | |
145 | }; | |
146 | ||
147 | static void jornada720_set_vpp(int vpp) | |
148 | { | |
149 | if (vpp) | |
150 | PPSR |= 0x80; | |
151 | else | |
152 | PPSR &= ~0x80; | |
153 | PPDR |= 0x80; | |
154 | } | |
155 | ||
156 | static struct flash_platform_data jornada720_flash_data = { | |
157 | .map_name = "cfi_probe", | |
158 | .set_vpp = jornada720_set_vpp, | |
159 | .parts = jornada720_partitions, | |
160 | .nr_parts = ARRAY_SIZE(jornada720_partitions), | |
161 | }; | |
162 | ||
163 | static struct resource jornada720_flash_resource = { | |
164 | .start = SA1100_CS0_PHYS, | |
165 | .end = SA1100_CS0_PHYS + SZ_32M - 1, | |
166 | .flags = IORESOURCE_MEM, | |
167 | }; | |
168 | ||
169 | static void __init jornada720_mach_init(void) | |
170 | { | |
171 | sa11x0_set_flash_data(&jornada720_flash_data, &jornada720_flash_resource, 1); | |
172 | } | |
173 | ||
1da177e4 | 174 | MACHINE_START(JORNADA720, "HP Jornada 720") |
c80f90ba | 175 | /* Maintainer: Michael Gernoth <michael@gernoth.net> */ |
e9dea0c6 RK |
176 | .phys_io = 0x80000000, |
177 | .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, | |
178 | .boot_params = 0xc0000100, | |
179 | .map_io = jornada720_map_io, | |
180 | .init_irq = sa1100_init_irq, | |
1da177e4 | 181 | .timer = &sa1100_timer, |
183e1a34 | 182 | .init_machine = jornada720_mach_init, |
1da177e4 | 183 | MACHINE_END |