jornada720.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. /*
  2. * linux/arch/arm/mach-sa1100/jornada720.c
  3. */
  4. #include <linux/init.h>
  5. #include <linux/kernel.h>
  6. #include <linux/tty.h>
  7. #include <linux/delay.h>
  8. #include <linux/platform_device.h>
  9. #include <linux/ioport.h>
  10. #include <linux/mtd/mtd.h>
  11. #include <linux/mtd/partitions.h>
  12. #include <asm/hardware.h>
  13. #include <asm/hardware/sa1111.h>
  14. #include <asm/irq.h>
  15. #include <asm/mach-types.h>
  16. #include <asm/setup.h>
  17. #include <asm/mach/arch.h>
  18. #include <asm/mach/flash.h>
  19. #include <asm/mach/map.h>
  20. #include <asm/mach/serial_sa1100.h>
  21. #include "generic.h"
  22. #define JORTUCR_VAL 0x20000400
  23. static struct resource sa1111_resources[] = {
  24. [0] = {
  25. .start = 0x40000000,
  26. .end = 0x40001fff,
  27. .flags = IORESOURCE_MEM,
  28. },
  29. [1] = {
  30. .start = IRQ_GPIO1,
  31. .end = IRQ_GPIO1,
  32. .flags = IORESOURCE_IRQ,
  33. },
  34. };
  35. static u64 sa1111_dmamask = 0xffffffffUL;
  36. static struct platform_device sa1111_device = {
  37. .name = "sa1111",
  38. .id = 0,
  39. .dev = {
  40. .dma_mask = &sa1111_dmamask,
  41. .coherent_dma_mask = 0xffffffff,
  42. },
  43. .num_resources = ARRAY_SIZE(sa1111_resources),
  44. .resource = sa1111_resources,
  45. };
  46. static struct platform_device *devices[] __initdata = {
  47. &sa1111_device,
  48. };
  49. static int __init jornada720_init(void)
  50. {
  51. int ret = -ENODEV;
  52. if (machine_is_jornada720()) {
  53. GPDR |= GPIO_GPIO20;
  54. TUCR = JORTUCR_VAL; /* set the oscillator out to the SA-1101 */
  55. GPSR = GPIO_GPIO20;
  56. udelay(1);
  57. GPCR = GPIO_GPIO20;
  58. udelay(1);
  59. GPSR = GPIO_GPIO20;
  60. udelay(20);
  61. /* LDD4 is speaker, LDD3 is microphone */
  62. PPSR &= ~(PPC_LDD3 | PPC_LDD4);
  63. PPDR |= PPC_LDD3 | PPC_LDD4;
  64. ret = platform_add_devices(devices, ARRAY_SIZE(devices));
  65. }
  66. return ret;
  67. }
  68. arch_initcall(jornada720_init);
  69. static struct map_desc jornada720_io_desc[] __initdata = {
  70. { /* Epson registers */
  71. .virtual = 0xf0000000,
  72. .pfn = __phys_to_pfn(0x48000000),
  73. .length = 0x00100000,
  74. .type = MT_DEVICE
  75. }, { /* Epson frame buffer */
  76. .virtual = 0xf1000000,
  77. .pfn = __phys_to_pfn(0x48200000),
  78. .length = 0x00100000,
  79. .type = MT_DEVICE
  80. }, { /* SA-1111 */
  81. .virtual = 0xf4000000,
  82. .pfn = __phys_to_pfn(0x40000000),
  83. .length = 0x00100000,
  84. .type = MT_DEVICE
  85. }
  86. };
  87. static void __init jornada720_map_io(void)
  88. {
  89. sa1100_map_io();
  90. iotable_init(jornada720_io_desc, ARRAY_SIZE(jornada720_io_desc));
  91. sa1100_register_uart(0, 3);
  92. sa1100_register_uart(1, 1);
  93. }
  94. static struct mtd_partition jornada720_partitions[] = {
  95. {
  96. .name = "JORNADA720 boot firmware",
  97. .size = 0x00040000,
  98. .offset = 0,
  99. .mask_flags = MTD_WRITEABLE, /* force read-only */
  100. }, {
  101. .name = "JORNADA720 kernel",
  102. .size = 0x000c0000,
  103. .offset = 0x00040000,
  104. }, {
  105. .name = "JORNADA720 params",
  106. .size = 0x00040000,
  107. .offset = 0x00100000,
  108. }, {
  109. .name = "JORNADA720 initrd",
  110. .size = 0x00100000,
  111. .offset = 0x00140000,
  112. }, {
  113. .name = "JORNADA720 root cramfs",
  114. .size = 0x00300000,
  115. .offset = 0x00240000,
  116. }, {
  117. .name = "JORNADA720 usr cramfs",
  118. .size = 0x00800000,
  119. .offset = 0x00540000,
  120. }, {
  121. .name = "JORNADA720 usr local",
  122. .size = 0, /* will expand to the end of the flash */
  123. .offset = 0x00d00000,
  124. }
  125. };
  126. static void jornada720_set_vpp(int vpp)
  127. {
  128. if (vpp)
  129. PPSR |= 0x80;
  130. else
  131. PPSR &= ~0x80;
  132. PPDR |= 0x80;
  133. }
  134. static struct flash_platform_data jornada720_flash_data = {
  135. .map_name = "cfi_probe",
  136. .set_vpp = jornada720_set_vpp,
  137. .parts = jornada720_partitions,
  138. .nr_parts = ARRAY_SIZE(jornada720_partitions),
  139. };
  140. static struct resource jornada720_flash_resource = {
  141. .start = SA1100_CS0_PHYS,
  142. .end = SA1100_CS0_PHYS + SZ_32M - 1,
  143. .flags = IORESOURCE_MEM,
  144. };
  145. static void __init jornada720_mach_init(void)
  146. {
  147. sa11x0_set_flash_data(&jornada720_flash_data, &jornada720_flash_resource, 1);
  148. }
  149. MACHINE_START(JORNADA720, "HP Jornada 720")
  150. /* Maintainer: Michael Gernoth <michael@gernoth.net> */
  151. .phys_io = 0x80000000,
  152. .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
  153. .boot_params = 0xc0000100,
  154. .map_io = jornada720_map_io,
  155. .init_irq = sa1100_init_irq,
  156. .timer = &sa1100_timer,
  157. .init_machine = jornada720_mach_init,
  158. MACHINE_END