Anton Vorontsov | bc2fd1c | 2008-10-23 21:06:56 +0200 | [diff] [blame] | 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> |
Eric Miao | 51c6298 | 2009-01-02 23:17:22 +0800 | [diff] [blame] | 27 | |
Anton Vorontsov | bc2fd1c | 2008-10-23 21:06:56 +0200 | [diff] [blame] | 28 | #include <asm/mach-types.h> |
| 29 | #include <asm/mach/arch.h> |
| 30 | #include <asm/mach/map.h> |
Eric Miao | 8a97ae2 | 2011-05-18 21:30:04 +0800 | [diff] [blame] | 31 | #include <asm/irq.h> |
Eric Miao | 51c6298 | 2009-01-02 23:17:22 +0800 | [diff] [blame] | 32 | |
| 33 | #include <mach/pxa25x.h> |
Anton Vorontsov | bc2fd1c | 2008-10-23 21:06:56 +0200 | [diff] [blame] | 34 | #include <mach/h5000.h> |
Anton Vorontsov | bc2fd1c | 2008-10-23 21:06:56 +0200 | [diff] [blame] | 35 | #include <mach/udc.h> |
Marek Vasut | ad68bb9 | 2010-11-03 16:29:35 +0100 | [diff] [blame] | 36 | #include <mach/smemc.h> |
Eric Miao | 51c6298 | 2009-01-02 23:17:22 +0800 | [diff] [blame] | 37 | |
Anton Vorontsov | bc2fd1c | 2008-10-23 21:06:56 +0200 | [diff] [blame] | 38 | #include "generic.h" |
| 39 | |
| 40 | /* |
| 41 | * Flash |
| 42 | */ |
| 43 | |
| 44 | static struct mtd_partition h5000_flash0_partitions[] = { |
| 45 | { |
| 46 | .name = "bootldr", |
| 47 | .size = 0x00040000, |
| 48 | .offset = 0, |
| 49 | .mask_flags = MTD_WRITEABLE, |
| 50 | }, |
| 51 | { |
| 52 | .name = "root", |
| 53 | .size = MTDPART_SIZ_FULL, |
| 54 | .offset = MTDPART_OFS_APPEND, |
| 55 | }, |
| 56 | }; |
| 57 | |
| 58 | static struct mtd_partition h5000_flash1_partitions[] = { |
| 59 | { |
| 60 | .name = "second root", |
| 61 | .size = SZ_16M - 0x00040000, |
| 62 | .offset = 0, |
| 63 | }, |
| 64 | { |
| 65 | .name = "asset", |
| 66 | .size = MTDPART_SIZ_FULL, |
| 67 | .offset = MTDPART_OFS_APPEND, |
| 68 | .mask_flags = MTD_WRITEABLE, |
| 69 | }, |
| 70 | }; |
| 71 | |
| 72 | static struct physmap_flash_data h5000_flash0_data = { |
| 73 | .width = 4, |
| 74 | .parts = h5000_flash0_partitions, |
| 75 | .nr_parts = ARRAY_SIZE(h5000_flash0_partitions), |
| 76 | }; |
| 77 | |
| 78 | static struct physmap_flash_data h5000_flash1_data = { |
| 79 | .width = 4, |
| 80 | .parts = h5000_flash1_partitions, |
| 81 | .nr_parts = ARRAY_SIZE(h5000_flash1_partitions), |
| 82 | }; |
| 83 | |
| 84 | static struct resource h5000_flash0_resources = { |
| 85 | .start = PXA_CS0_PHYS, |
| 86 | .end = PXA_CS0_PHYS + SZ_32M - 1, |
| 87 | .flags = IORESOURCE_MEM | IORESOURCE_MEM_32BIT, |
| 88 | }; |
| 89 | |
| 90 | static struct resource h5000_flash1_resources = { |
| 91 | .start = PXA_CS0_PHYS + SZ_32M, |
| 92 | .end = PXA_CS0_PHYS + SZ_32M + SZ_16M - 1, |
| 93 | .flags = IORESOURCE_MEM | IORESOURCE_MEM_32BIT, |
| 94 | }; |
| 95 | |
| 96 | static struct platform_device h5000_flash[] = { |
| 97 | { |
| 98 | .name = "physmap-flash", |
| 99 | .id = 0, |
| 100 | .resource = &h5000_flash0_resources, |
| 101 | .num_resources = 1, |
| 102 | .dev = { |
| 103 | .platform_data = &h5000_flash0_data, |
| 104 | }, |
| 105 | }, |
| 106 | { |
| 107 | .name = "physmap-flash", |
| 108 | .id = 1, |
| 109 | .resource = &h5000_flash1_resources, |
| 110 | .num_resources = 1, |
| 111 | .dev = { |
| 112 | .platform_data = &h5000_flash1_data, |
| 113 | }, |
| 114 | }, |
| 115 | }; |
| 116 | |
| 117 | /* |
| 118 | * USB Device Controller |
| 119 | */ |
| 120 | |
| 121 | static struct pxa2xx_udc_mach_info h5000_udc_mach_info __initdata = { |
| 122 | .gpio_pullup = H5000_GPIO_USB_PULLUP, |
| 123 | }; |
| 124 | |
| 125 | /* |
| 126 | * GPIO setup |
| 127 | */ |
| 128 | |
| 129 | static unsigned long h5000_pin_config[] __initdata = { |
| 130 | /* Crystal and Clock Signals */ |
| 131 | GPIO12_32KHz, |
| 132 | |
| 133 | /* SDRAM and Static Memory I/O Signals */ |
| 134 | GPIO15_nCS_1, |
| 135 | GPIO78_nCS_2, |
| 136 | GPIO79_nCS_3, |
| 137 | GPIO80_nCS_4, |
| 138 | |
| 139 | /* FFUART */ |
| 140 | GPIO34_FFUART_RXD, |
| 141 | GPIO35_FFUART_CTS, |
| 142 | GPIO36_FFUART_DCD, |
| 143 | GPIO37_FFUART_DSR, |
| 144 | GPIO38_FFUART_RI, |
| 145 | GPIO39_FFUART_TXD, |
| 146 | GPIO40_FFUART_DTR, |
| 147 | GPIO41_FFUART_RTS, |
| 148 | |
| 149 | /* BTUART */ |
| 150 | GPIO42_BTUART_RXD, |
| 151 | GPIO43_BTUART_TXD, |
| 152 | GPIO44_BTUART_CTS, |
| 153 | GPIO45_BTUART_RTS, |
| 154 | |
| 155 | /* SSP1 */ |
| 156 | GPIO23_SSP1_SCLK, |
| 157 | GPIO25_SSP1_TXD, |
| 158 | GPIO26_SSP1_RXD, |
Philipp Zabel | 4e7f78f | 2009-02-05 17:48:19 +0100 | [diff] [blame] | 159 | |
| 160 | /* I2S */ |
| 161 | GPIO28_I2S_BITCLK_OUT, |
| 162 | GPIO29_I2S_SDATA_IN, |
| 163 | GPIO30_I2S_SDATA_OUT, |
| 164 | GPIO31_I2S_SYNC, |
| 165 | GPIO32_I2S_SYSCLK, |
Anton Vorontsov | bc2fd1c | 2008-10-23 21:06:56 +0200 | [diff] [blame] | 166 | }; |
| 167 | |
| 168 | /* |
| 169 | * Localbus setup: |
| 170 | * CS0: Flash; |
| 171 | * CS1: MediaQ chip, select 16-bit bus and vlio; |
| 172 | * CS5: SAMCOP. |
| 173 | */ |
| 174 | |
| 175 | static void fix_msc(void) |
| 176 | { |
Marek Vasut | ad68bb9 | 2010-11-03 16:29:35 +0100 | [diff] [blame] | 177 | __raw_writel(0x129c24f2, MSC0); |
| 178 | __raw_writel(0x7ff424fa, MSC1); |
| 179 | __raw_writel(0x7ff47ff4, MSC2); |
Anton Vorontsov | bc2fd1c | 2008-10-23 21:06:56 +0200 | [diff] [blame] | 180 | |
Marek Vasut | ad68bb9 | 2010-11-03 16:29:35 +0100 | [diff] [blame] | 181 | __raw_writel(__raw_readl(MDREFR) | 0x02080000, MDREFR); |
Anton Vorontsov | bc2fd1c | 2008-10-23 21:06:56 +0200 | [diff] [blame] | 182 | } |
| 183 | |
| 184 | /* |
| 185 | * Platform devices |
| 186 | */ |
| 187 | |
| 188 | static struct platform_device *devices[] __initdata = { |
| 189 | &h5000_flash[0], |
| 190 | &h5000_flash[1], |
| 191 | }; |
| 192 | |
| 193 | static void __init h5000_init(void) |
| 194 | { |
| 195 | fix_msc(); |
| 196 | |
| 197 | pxa2xx_mfp_config(ARRAY_AND_SIZE(h5000_pin_config)); |
Russell King | cc155c6 | 2009-11-09 13:34:08 +0800 | [diff] [blame] | 198 | pxa_set_ffuart_info(NULL); |
| 199 | pxa_set_btuart_info(NULL); |
| 200 | pxa_set_stuart_info(NULL); |
Anton Vorontsov | bc2fd1c | 2008-10-23 21:06:56 +0200 | [diff] [blame] | 201 | pxa_set_udc_info(&h5000_udc_mach_info); |
| 202 | platform_add_devices(ARRAY_AND_SIZE(devices)); |
| 203 | } |
| 204 | |
| 205 | MACHINE_START(H5400, "HP iPAQ H5000") |
Nicolas Pitre | 7375aba | 2011-07-05 22:38:15 -0400 | [diff] [blame] | 206 | .atag_offset = 0x100, |
Marek Vasut | 851982c | 2010-10-11 02:20:19 +0200 | [diff] [blame] | 207 | .map_io = pxa25x_map_io, |
Rob Herring | 4e61109 | 2012-01-03 16:53:48 -0600 | [diff] [blame] | 208 | .nr_irqs = PXA_NR_IRQS, |
Anton Vorontsov | bc2fd1c | 2008-10-23 21:06:56 +0200 | [diff] [blame] | 209 | .init_irq = pxa25x_init_irq, |
Eric Miao | 8a97ae2 | 2011-05-18 21:30:04 +0800 | [diff] [blame] | 210 | .handle_irq = pxa25x_handle_irq, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 211 | .init_time = pxa_timer_init, |
Anton Vorontsov | bc2fd1c | 2008-10-23 21:06:56 +0200 | [diff] [blame] | 212 | .init_machine = h5000_init, |
Russell King | 271a74f | 2011-11-04 14:15:53 +0000 | [diff] [blame] | 213 | .restart = pxa_restart, |
Anton Vorontsov | bc2fd1c | 2008-10-23 21:06:56 +0200 | [diff] [blame] | 214 | MACHINE_END |