h5000.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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. #include <linux/kernel.h>
  21. #include <linux/init.h>
  22. #include <linux/platform_device.h>
  23. #include <linux/mtd/mtd.h>
  24. #include <linux/mtd/partitions.h>
  25. #include <linux/mtd/physmap.h>
  26. #include <asm/mach-types.h>
  27. #include <asm/mach/arch.h>
  28. #include <asm/mach/map.h>
  29. #include <mach/h5000.h>
  30. #include <mach/pxa-regs.h>
  31. #include <mach/pxa2xx-regs.h>
  32. #include <mach/mfp-pxa25x.h>
  33. #include <mach/udc.h>
  34. #include "generic.h"
  35. /*
  36. * Flash
  37. */
  38. static struct mtd_partition h5000_flash0_partitions[] = {
  39. {
  40. .name = "bootldr",
  41. .size = 0x00040000,
  42. .offset = 0,
  43. .mask_flags = MTD_WRITEABLE,
  44. },
  45. {
  46. .name = "root",
  47. .size = MTDPART_SIZ_FULL,
  48. .offset = MTDPART_OFS_APPEND,
  49. },
  50. };
  51. static struct mtd_partition h5000_flash1_partitions[] = {
  52. {
  53. .name = "second root",
  54. .size = SZ_16M - 0x00040000,
  55. .offset = 0,
  56. },
  57. {
  58. .name = "asset",
  59. .size = MTDPART_SIZ_FULL,
  60. .offset = MTDPART_OFS_APPEND,
  61. .mask_flags = MTD_WRITEABLE,
  62. },
  63. };
  64. static struct physmap_flash_data h5000_flash0_data = {
  65. .width = 4,
  66. .parts = h5000_flash0_partitions,
  67. .nr_parts = ARRAY_SIZE(h5000_flash0_partitions),
  68. };
  69. static struct physmap_flash_data h5000_flash1_data = {
  70. .width = 4,
  71. .parts = h5000_flash1_partitions,
  72. .nr_parts = ARRAY_SIZE(h5000_flash1_partitions),
  73. };
  74. static struct resource h5000_flash0_resources = {
  75. .start = PXA_CS0_PHYS,
  76. .end = PXA_CS0_PHYS + SZ_32M - 1,
  77. .flags = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
  78. };
  79. static struct resource h5000_flash1_resources = {
  80. .start = PXA_CS0_PHYS + SZ_32M,
  81. .end = PXA_CS0_PHYS + SZ_32M + SZ_16M - 1,
  82. .flags = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
  83. };
  84. static struct platform_device h5000_flash[] = {
  85. {
  86. .name = "physmap-flash",
  87. .id = 0,
  88. .resource = &h5000_flash0_resources,
  89. .num_resources = 1,
  90. .dev = {
  91. .platform_data = &h5000_flash0_data,
  92. },
  93. },
  94. {
  95. .name = "physmap-flash",
  96. .id = 1,
  97. .resource = &h5000_flash1_resources,
  98. .num_resources = 1,
  99. .dev = {
  100. .platform_data = &h5000_flash1_data,
  101. },
  102. },
  103. };
  104. /*
  105. * USB Device Controller
  106. */
  107. static struct pxa2xx_udc_mach_info h5000_udc_mach_info __initdata = {
  108. .gpio_pullup = H5000_GPIO_USB_PULLUP,
  109. };
  110. /*
  111. * GPIO setup
  112. */
  113. static unsigned long h5000_pin_config[] __initdata = {
  114. /* Crystal and Clock Signals */
  115. GPIO12_32KHz,
  116. /* SDRAM and Static Memory I/O Signals */
  117. GPIO15_nCS_1,
  118. GPIO78_nCS_2,
  119. GPIO79_nCS_3,
  120. GPIO80_nCS_4,
  121. /* FFUART */
  122. GPIO34_FFUART_RXD,
  123. GPIO35_FFUART_CTS,
  124. GPIO36_FFUART_DCD,
  125. GPIO37_FFUART_DSR,
  126. GPIO38_FFUART_RI,
  127. GPIO39_FFUART_TXD,
  128. GPIO40_FFUART_DTR,
  129. GPIO41_FFUART_RTS,
  130. /* BTUART */
  131. GPIO42_BTUART_RXD,
  132. GPIO43_BTUART_TXD,
  133. GPIO44_BTUART_CTS,
  134. GPIO45_BTUART_RTS,
  135. /* SSP1 */
  136. GPIO23_SSP1_SCLK,
  137. GPIO25_SSP1_TXD,
  138. GPIO26_SSP1_RXD,
  139. };
  140. /*
  141. * Localbus setup:
  142. * CS0: Flash;
  143. * CS1: MediaQ chip, select 16-bit bus and vlio;
  144. * CS5: SAMCOP.
  145. */
  146. static void fix_msc(void)
  147. {
  148. MSC0 = 0x129c24f2;
  149. MSC1 = 0x7ff424fa;
  150. MSC2 = 0x7ff47ff4;
  151. MDREFR |= 0x02080000;
  152. }
  153. /*
  154. * Platform devices
  155. */
  156. static struct platform_device *devices[] __initdata = {
  157. &h5000_flash[0],
  158. &h5000_flash[1],
  159. };
  160. static void __init h5000_init(void)
  161. {
  162. fix_msc();
  163. pxa2xx_mfp_config(ARRAY_AND_SIZE(h5000_pin_config));
  164. pxa_set_udc_info(&h5000_udc_mach_info);
  165. platform_add_devices(ARRAY_AND_SIZE(devices));
  166. }
  167. MACHINE_START(H5400, "HP iPAQ H5000")
  168. .phys_io = 0x40000000,
  169. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  170. .boot_params = 0xa0000100,
  171. .map_io = pxa_map_io,
  172. .init_irq = pxa25x_init_irq,
  173. .timer = &pxa_timer,
  174. .init_machine = h5000_init,
  175. MACHINE_END