h5000.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * Hardware definitions for HP iPAQ h5xxx Handheld Computers
  4. *
  5. * Copyright 2000-2003 Hewlett-Packard Company.
  6. * Copyright 2002 Jamey Hicks <[email protected]>
  7. * Copyright 2004-2005 Phil Blundell <[email protected]>
  8. * Copyright 2007-2008 Anton Vorontsov <[email protected]>
  9. *
  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. #include <linux/kernel.h>
  17. #include <linux/init.h>
  18. #include <linux/platform_device.h>
  19. #include <linux/mtd/mtd.h>
  20. #include <linux/mtd/partitions.h>
  21. #include <linux/mtd/physmap.h>
  22. #include <asm/mach-types.h>
  23. #include <asm/mach/arch.h>
  24. #include <asm/mach/map.h>
  25. #include <asm/irq.h>
  26. #include "pxa25x.h"
  27. #include "h5000.h"
  28. #include "udc.h"
  29. #include "smemc.h"
  30. #include "generic.h"
  31. /*
  32. * Flash
  33. */
  34. static struct mtd_partition h5000_flash0_partitions[] = {
  35. {
  36. .name = "bootldr",
  37. .size = 0x00040000,
  38. .offset = 0,
  39. .mask_flags = MTD_WRITEABLE,
  40. },
  41. {
  42. .name = "root",
  43. .size = MTDPART_SIZ_FULL,
  44. .offset = MTDPART_OFS_APPEND,
  45. },
  46. };
  47. static struct mtd_partition h5000_flash1_partitions[] = {
  48. {
  49. .name = "second root",
  50. .size = SZ_16M - 0x00040000,
  51. .offset = 0,
  52. },
  53. {
  54. .name = "asset",
  55. .size = MTDPART_SIZ_FULL,
  56. .offset = MTDPART_OFS_APPEND,
  57. .mask_flags = MTD_WRITEABLE,
  58. },
  59. };
  60. static struct physmap_flash_data h5000_flash0_data = {
  61. .width = 4,
  62. .parts = h5000_flash0_partitions,
  63. .nr_parts = ARRAY_SIZE(h5000_flash0_partitions),
  64. };
  65. static struct physmap_flash_data h5000_flash1_data = {
  66. .width = 4,
  67. .parts = h5000_flash1_partitions,
  68. .nr_parts = ARRAY_SIZE(h5000_flash1_partitions),
  69. };
  70. static struct resource h5000_flash0_resources = {
  71. .start = PXA_CS0_PHYS,
  72. .end = PXA_CS0_PHYS + SZ_32M - 1,
  73. .flags = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
  74. };
  75. static struct resource h5000_flash1_resources = {
  76. .start = PXA_CS0_PHYS + SZ_32M,
  77. .end = PXA_CS0_PHYS + SZ_32M + SZ_16M - 1,
  78. .flags = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
  79. };
  80. static struct platform_device h5000_flash[] = {
  81. {
  82. .name = "physmap-flash",
  83. .id = 0,
  84. .resource = &h5000_flash0_resources,
  85. .num_resources = 1,
  86. .dev = {
  87. .platform_data = &h5000_flash0_data,
  88. },
  89. },
  90. {
  91. .name = "physmap-flash",
  92. .id = 1,
  93. .resource = &h5000_flash1_resources,
  94. .num_resources = 1,
  95. .dev = {
  96. .platform_data = &h5000_flash1_data,
  97. },
  98. },
  99. };
  100. /*
  101. * USB Device Controller
  102. */
  103. static struct pxa2xx_udc_mach_info h5000_udc_mach_info __initdata = {
  104. .gpio_pullup = H5000_GPIO_USB_PULLUP,
  105. };
  106. /*
  107. * GPIO setup
  108. */
  109. static unsigned long h5000_pin_config[] __initdata = {
  110. /* Crystal and Clock Signals */
  111. GPIO12_32KHz,
  112. /* SDRAM and Static Memory I/O Signals */
  113. GPIO15_nCS_1,
  114. GPIO78_nCS_2,
  115. GPIO79_nCS_3,
  116. GPIO80_nCS_4,
  117. /* FFUART */
  118. GPIO34_FFUART_RXD,
  119. GPIO35_FFUART_CTS,
  120. GPIO36_FFUART_DCD,
  121. GPIO37_FFUART_DSR,
  122. GPIO38_FFUART_RI,
  123. GPIO39_FFUART_TXD,
  124. GPIO40_FFUART_DTR,
  125. GPIO41_FFUART_RTS,
  126. /* BTUART */
  127. GPIO42_BTUART_RXD,
  128. GPIO43_BTUART_TXD,
  129. GPIO44_BTUART_CTS,
  130. GPIO45_BTUART_RTS,
  131. /* SSP1 */
  132. GPIO23_SSP1_SCLK,
  133. GPIO25_SSP1_TXD,
  134. GPIO26_SSP1_RXD,
  135. /* I2S */
  136. GPIO28_I2S_BITCLK_OUT,
  137. GPIO29_I2S_SDATA_IN,
  138. GPIO30_I2S_SDATA_OUT,
  139. GPIO31_I2S_SYNC,
  140. GPIO32_I2S_SYSCLK,
  141. };
  142. /*
  143. * Localbus setup:
  144. * CS0: Flash;
  145. * CS1: MediaQ chip, select 16-bit bus and vlio;
  146. * CS5: SAMCOP.
  147. */
  148. static void fix_msc(void)
  149. {
  150. __raw_writel(0x129c24f2, MSC0);
  151. __raw_writel(0x7ff424fa, MSC1);
  152. __raw_writel(0x7ff47ff4, MSC2);
  153. __raw_writel(__raw_readl(MDREFR) | 0x02080000, MDREFR);
  154. }
  155. /*
  156. * Platform devices
  157. */
  158. static struct platform_device *devices[] __initdata = {
  159. &h5000_flash[0],
  160. &h5000_flash[1],
  161. };
  162. static void __init h5000_init(void)
  163. {
  164. fix_msc();
  165. pxa2xx_mfp_config(ARRAY_AND_SIZE(h5000_pin_config));
  166. pxa_set_ffuart_info(NULL);
  167. pxa_set_btuart_info(NULL);
  168. pxa_set_stuart_info(NULL);
  169. pxa_set_udc_info(&h5000_udc_mach_info);
  170. platform_add_devices(ARRAY_AND_SIZE(devices));
  171. }
  172. MACHINE_START(H5400, "HP iPAQ H5000")
  173. .atag_offset = 0x100,
  174. .map_io = pxa25x_map_io,
  175. .nr_irqs = PXA_NR_IRQS,
  176. .init_irq = pxa25x_init_irq,
  177. .handle_irq = pxa25x_handle_irq,
  178. .init_time = pxa_timer_init,
  179. .init_machine = h5000_init,
  180. .restart = pxa_restart,
  181. MACHINE_END