1 /*
2 * Hardware definitions for HP iPAQ h5xxx Handheld Computers
3 *
4 * Copyright 2000-2003 Hewlett-Packard Company.
5 * Copyright 2002 Jamey Hicks <jamey.hicks@hp.com>
6 * Copyright 2004-2005 Phil Blundell <pb@handhelds.org>
7 * Copyright 2007-2008 Anton Vorontsov <cbouatmailru@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * COMPAQ COMPUTER CORPORATION MAKES NO WARRANTIES, EXPRESSED OR IMPLIED,
15 * AS TO THE USEFULNESS OR CORRECTNESS OF THIS CODE OR ITS
16 * FITNESS FOR ANY PARTICULAR PURPOSE.
17 *
18 * Author: Jamey Hicks.
19 */
20
21 #include <linux/kernel.h>
22 #include <linux/init.h>
23 #include <linux/platform_device.h>
24 #include <linux/mtd/mtd.h>
25 #include <linux/mtd/partitions.h>
26 #include <linux/mtd/physmap.h>
27 #include <asm/mach-types.h>
28 #include <asm/mach/arch.h>
29 #include <asm/mach/map.h>
30 #include <mach/h5000.h>
31 #include <mach/pxa-regs.h>
32 #include <mach/pxa2xx-regs.h>
33 #include <mach/mfp-pxa25x.h>
34 #include <mach/udc.h>
35 #include "generic.h"
36
37 /*
38 * Flash
39 */
40
41 static struct mtd_partition h5000_flash0_partitions[] = {
42 {
43 .name = "bootldr",
44 .size = 0x00040000,
45 .offset = 0,
46 .mask_flags = MTD_WRITEABLE,
47 },
48 {
49 .name = "root",
50 .size = MTDPART_SIZ_FULL,
51 .offset = MTDPART_OFS_APPEND,
52 },
53 };
54
55 static struct mtd_partition h5000_flash1_partitions[] = {
56 {
57 .name = "second root",
58 .size = SZ_16M - 0x00040000,
59 .offset = 0,
60 },
61 {
62 .name = "asset",
63 .size = MTDPART_SIZ_FULL,
64 .offset = MTDPART_OFS_APPEND,
65 .mask_flags = MTD_WRITEABLE,
66 },
67 };
68
69 static struct physmap_flash_data h5000_flash0_data = {
70 .width = 4,
71 .parts = h5000_flash0_partitions,
72 .nr_parts = ARRAY_SIZE(h5000_flash0_partitions),
73 };
74
75 static struct physmap_flash_data h5000_flash1_data = {
76 .width = 4,
77 .parts = h5000_flash1_partitions,
78 .nr_parts = ARRAY_SIZE(h5000_flash1_partitions),
79 };
80
81 static struct resource h5000_flash0_resources = {
82 .start = PXA_CS0_PHYS,
83 .end = PXA_CS0_PHYS + SZ_32M - 1,
84 .flags = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
85 };
86
87 static struct resource h5000_flash1_resources = {
88 .start = PXA_CS0_PHYS + SZ_32M,
89 .end = PXA_CS0_PHYS + SZ_32M + SZ_16M - 1,
90 .flags = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
91 };
92
93 static struct platform_device h5000_flash[] = {
94 {
95 .name = "physmap-flash",
96 .id = 0,
97 .resource = &h5000_flash0_resources,
98 .num_resources = 1,
99 .dev = {
100 .platform_data = &h5000_flash0_data,
101 },
102 },
103 {
104 .name = "physmap-flash",
105 .id = 1,
106 .resource = &h5000_flash1_resources,
107 .num_resources = 1,
108 .dev = {
109 .platform_data = &h5000_flash1_data,
110 },
111 },
112 };
113
114 /*
115 * USB Device Controller
116 */
117
118 static struct pxa2xx_udc_mach_info h5000_udc_mach_info __initdata = {
119 .gpio_pullup = H5000_GPIO_USB_PULLUP,
120 };
121
122 /*
123 * GPIO setup
124 */
125
126 static unsigned long h5000_pin_config[] __initdata = {
127 /* Crystal and Clock Signals */
128 GPIO12_32KHz,
129
130 /* SDRAM and Static Memory I/O Signals */
131 GPIO15_nCS_1,
132 GPIO78_nCS_2,
133 GPIO79_nCS_3,
134 GPIO80_nCS_4,
135
136 /* FFUART */
137 GPIO34_FFUART_RXD,
138 GPIO35_FFUART_CTS,
139 GPIO36_FFUART_DCD,
140 GPIO37_FFUART_DSR,
141 GPIO38_FFUART_RI,
142 GPIO39_FFUART_TXD,
143 GPIO40_FFUART_DTR,
144 GPIO41_FFUART_RTS,
145
146 /* BTUART */
147 GPIO42_BTUART_RXD,
148 GPIO43_BTUART_TXD,
149 GPIO44_BTUART_CTS,
150 GPIO45_BTUART_RTS,
151
152 /* SSP1 */
153 GPIO23_SSP1_SCLK,
154 GPIO25_SSP1_TXD,
155 GPIO26_SSP1_RXD,
156 };
157
158 /*
159 * Localbus setup:
160 * CS0: Flash;
161 * CS1: MediaQ chip, select 16-bit bus and vlio;
162 * CS5: SAMCOP.
163 */
164
fix_msc(void)165 static void fix_msc(void)
166 {
167 MSC0 = 0x129c24f2;
168 MSC1 = 0x7ff424fa;
169 MSC2 = 0x7ff47ff4;
170
171 MDREFR |= 0x02080000;
172 }
173
174 /*
175 * Platform devices
176 */
177
178 static struct platform_device *devices[] __initdata = {
179 &h5000_flash[0],
180 &h5000_flash[1],
181 };
182
h5000_init(void)183 static void __init h5000_init(void)
184 {
185 fix_msc();
186
187 pxa2xx_mfp_config(ARRAY_AND_SIZE(h5000_pin_config));
188 pxa_set_udc_info(&h5000_udc_mach_info);
189 platform_add_devices(ARRAY_AND_SIZE(devices));
190 }
191
192 MACHINE_START(H5400, "HP iPAQ H5000")
193 .phys_io = 0x40000000,
194 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
195 .boot_params = 0xa0000100,
196 .map_io = pxa_map_io,
197 .init_irq = pxa25x_init_irq,
198 .timer = &pxa_timer,
199 .init_machine = h5000_init,
200 MACHINE_END
201