h5000.c 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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 <asm/irq.h>
  30. #include "pxa25x.h"
  31. #include "h5000.h"
  32. #include "udc.h"
  33. #include <mach/smemc.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. /* I2S */
  140. GPIO28_I2S_BITCLK_OUT,
  141. GPIO29_I2S_SDATA_IN,
  142. GPIO30_I2S_SDATA_OUT,
  143. GPIO31_I2S_SYNC,
  144. GPIO32_I2S_SYSCLK,
  145. };
  146. /*
  147. * Localbus setup:
  148. * CS0: Flash;
  149. * CS1: MediaQ chip, select 16-bit bus and vlio;
  150. * CS5: SAMCOP.
  151. */
  152. static void fix_msc(void)
  153. {
  154. __raw_writel(0x129c24f2, MSC0);
  155. __raw_writel(0x7ff424fa, MSC1);
  156. __raw_writel(0x7ff47ff4, MSC2);
  157. __raw_writel(__raw_readl(MDREFR) | 0x02080000, MDREFR);
  158. }
  159. /*
  160. * Platform devices
  161. */
  162. static struct platform_device *devices[] __initdata = {
  163. &h5000_flash[0],
  164. &h5000_flash[1],
  165. };
  166. static void __init h5000_init(void)
  167. {
  168. fix_msc();
  169. pxa2xx_mfp_config(ARRAY_AND_SIZE(h5000_pin_config));
  170. pxa_set_ffuart_info(NULL);
  171. pxa_set_btuart_info(NULL);
  172. pxa_set_stuart_info(NULL);
  173. pxa_set_udc_info(&h5000_udc_mach_info);
  174. platform_add_devices(ARRAY_AND_SIZE(devices));
  175. }
  176. MACHINE_START(H5400, "HP iPAQ H5000")
  177. .atag_offset = 0x100,
  178. .map_io = pxa25x_map_io,
  179. .nr_irqs = PXA_NR_IRQS,
  180. .init_irq = pxa25x_init_irq,
  181. .handle_irq = pxa25x_handle_irq,
  182. .init_time = pxa_timer_init,
  183. .init_machine = h5000_init,
  184. .restart = pxa_restart,
  185. MACHINE_END