h5000.c revision 4e7f78f815412fd25b207b8c63a698b637c9621d
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
41static 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
55static 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
69static 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
75static 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
81static 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
87static 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
93static 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
118static 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
126static 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	/* I2S */
158	GPIO28_I2S_BITCLK_OUT,
159	GPIO29_I2S_SDATA_IN,
160	GPIO30_I2S_SDATA_OUT,
161	GPIO31_I2S_SYNC,
162	GPIO32_I2S_SYSCLK,
163};
164
165/*
166 * Localbus setup:
167 * CS0: Flash;
168 * CS1: MediaQ chip, select 16-bit bus and vlio;
169 * CS5: SAMCOP.
170 */
171
172static void fix_msc(void)
173{
174	MSC0 = 0x129c24f2;
175	MSC1 = 0x7ff424fa;
176	MSC2 = 0x7ff47ff4;
177
178	MDREFR |= 0x02080000;
179}
180
181/*
182 * Platform devices
183 */
184
185static struct platform_device *devices[] __initdata = {
186	&h5000_flash[0],
187	&h5000_flash[1],
188};
189
190static void __init h5000_init(void)
191{
192	fix_msc();
193
194	pxa2xx_mfp_config(ARRAY_AND_SIZE(h5000_pin_config));
195	pxa_set_udc_info(&h5000_udc_mach_info);
196	platform_add_devices(ARRAY_AND_SIZE(devices));
197}
198
199MACHINE_START(H5400, "HP iPAQ H5000")
200	.phys_io = 0x40000000,
201	.io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
202	.boot_params = 0xa0000100,
203	.map_io = pxa_map_io,
204	.init_irq = pxa25x_init_irq,
205	.timer = &pxa_timer,
206	.init_machine = h5000_init,
207MACHINE_END
208