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