collie.c 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /*
  2. * linux/arch/arm/mach-sa1100/collie.c
  3. *
  4. * May be copied or modified under the terms of the GNU General Public
  5. * License. See linux/COPYING for more information.
  6. *
  7. * This file contains all Collie-specific tweaks.
  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 version 2 as
  11. * published by the Free Software Foundation.
  12. *
  13. * ChangeLog:
  14. * 03-06-2004 John Lenz <jelenz@wisc.edu>
  15. * 06-04-2002 Chris Larson <kergoth@digitalnemesis.net>
  16. * 04-16-2001 Lineo Japan,Inc. ...
  17. */
  18. #include <linux/config.h>
  19. #include <linux/init.h>
  20. #include <linux/kernel.h>
  21. #include <linux/tty.h>
  22. #include <linux/delay.h>
  23. #include <linux/platform_device.h>
  24. #include <linux/mtd/mtd.h>
  25. #include <linux/mtd/partitions.h>
  26. #include <linux/timer.h>
  27. #include <asm/hardware.h>
  28. #include <asm/mach-types.h>
  29. #include <asm/irq.h>
  30. #include <asm/setup.h>
  31. #include <asm/arch/collie.h>
  32. #include <asm/mach/arch.h>
  33. #include <asm/mach/flash.h>
  34. #include <asm/mach/map.h>
  35. #include <asm/mach/serial_sa1100.h>
  36. #include <asm/hardware/scoop.h>
  37. #include <asm/mach/sharpsl_param.h>
  38. #include <asm/hardware/locomo.h>
  39. #include "generic.h"
  40. static struct resource collie_scoop_resources[] = {
  41. [0] = {
  42. .start = 0x40800000,
  43. .end = 0x40800fff,
  44. .flags = IORESOURCE_MEM,
  45. },
  46. };
  47. static struct scoop_config collie_scoop_setup = {
  48. .io_dir = COLLIE_SCOOP_IO_DIR,
  49. .io_out = COLLIE_SCOOP_IO_OUT,
  50. };
  51. struct platform_device colliescoop_device = {
  52. .name = "sharp-scoop",
  53. .id = -1,
  54. .dev = {
  55. .platform_data = &collie_scoop_setup,
  56. },
  57. .num_resources = ARRAY_SIZE(collie_scoop_resources),
  58. .resource = collie_scoop_resources,
  59. };
  60. static struct resource locomo_resources[] = {
  61. [0] = {
  62. .start = 0x40000000,
  63. .end = 0x40001fff,
  64. .flags = IORESOURCE_MEM,
  65. },
  66. [1] = {
  67. .start = IRQ_GPIO25,
  68. .end = IRQ_GPIO25,
  69. .flags = IORESOURCE_IRQ,
  70. },
  71. };
  72. static struct platform_device locomo_device = {
  73. .name = "locomo",
  74. .id = 0,
  75. .num_resources = ARRAY_SIZE(locomo_resources),
  76. .resource = locomo_resources,
  77. };
  78. static struct platform_device *devices[] __initdata = {
  79. &locomo_device,
  80. &colliescoop_device,
  81. };
  82. static struct mtd_partition collie_partitions[] = {
  83. {
  84. .name = "bootloader",
  85. .offset = 0,
  86. .size = 0x000C0000,
  87. .mask_flags = MTD_WRITEABLE
  88. }, {
  89. .name = "kernel",
  90. .offset = MTDPART_OFS_APPEND,
  91. .size = 0x00100000,
  92. }, {
  93. .name = "rootfs",
  94. .offset = MTDPART_OFS_APPEND,
  95. .size = 0x00e20000,
  96. }
  97. };
  98. static void collie_set_vpp(int vpp)
  99. {
  100. write_scoop_reg(&colliescoop_device.dev, SCOOP_GPCR, read_scoop_reg(&colliescoop_device.dev, SCOOP_GPCR) | COLLIE_SCP_VPEN);
  101. if (vpp)
  102. write_scoop_reg(&colliescoop_device.dev, SCOOP_GPWR, read_scoop_reg(&colliescoop_device.dev, SCOOP_GPWR) | COLLIE_SCP_VPEN);
  103. else
  104. write_scoop_reg(&colliescoop_device.dev, SCOOP_GPWR, read_scoop_reg(&colliescoop_device.dev, SCOOP_GPWR) & ~COLLIE_SCP_VPEN);
  105. }
  106. static struct flash_platform_data collie_flash_data = {
  107. .map_name = "cfi_probe",
  108. .set_vpp = collie_set_vpp,
  109. .parts = collie_partitions,
  110. .nr_parts = ARRAY_SIZE(collie_partitions),
  111. };
  112. static struct resource collie_flash_resources[] = {
  113. {
  114. .start = SA1100_CS0_PHYS,
  115. .end = SA1100_CS0_PHYS + SZ_32M - 1,
  116. .flags = IORESOURCE_MEM,
  117. }
  118. };
  119. static void __init collie_init(void)
  120. {
  121. int ret = 0;
  122. /* cpu initialize */
  123. GAFR = ( GPIO_SSP_TXD | \
  124. GPIO_SSP_SCLK | GPIO_SSP_SFRM | GPIO_SSP_CLK | GPIO_TIC_ACK | \
  125. GPIO_32_768kHz );
  126. GPDR = ( GPIO_LDD8 | GPIO_LDD9 | GPIO_LDD10 | GPIO_LDD11 | GPIO_LDD12 | \
  127. GPIO_LDD13 | GPIO_LDD14 | GPIO_LDD15 | GPIO_SSP_TXD | \
  128. GPIO_SSP_SCLK | GPIO_SSP_SFRM | GPIO_SDLC_SCLK | \
  129. GPIO_SDLC_AAF | GPIO_UART_SCLK1 | GPIO_32_768kHz );
  130. GPLR = GPIO_GPIO18;
  131. // PPC pin setting
  132. PPDR = ( PPC_LDD0 | PPC_LDD1 | PPC_LDD2 | PPC_LDD3 | PPC_LDD4 | PPC_LDD5 | \
  133. PPC_LDD6 | PPC_LDD7 | PPC_L_PCLK | PPC_L_LCLK | PPC_L_FCLK | PPC_L_BIAS | \
  134. PPC_TXD1 | PPC_TXD2 | PPC_RXD2 | PPC_TXD3 | PPC_TXD4 | PPC_SCLK | PPC_SFRM );
  135. PSDR = ( PPC_RXD1 | PPC_RXD2 | PPC_RXD3 | PPC_RXD4 );
  136. GAFR |= GPIO_32_768kHz;
  137. GPDR |= GPIO_32_768kHz;
  138. TUCR = TUCR_32_768kHz;
  139. ret = platform_add_devices(devices, ARRAY_SIZE(devices));
  140. if (ret) {
  141. printk(KERN_WARNING "collie: Unable to register LoCoMo device\n");
  142. }
  143. sa11x0_set_flash_data(&collie_flash_data, collie_flash_resources,
  144. ARRAY_SIZE(collie_flash_resources));
  145. sharpsl_save_param();
  146. }
  147. static struct map_desc collie_io_desc[] __initdata = {
  148. { /* 32M main flash (cs0) */
  149. .virtual = 0xe8000000,
  150. .pfn = __phys_to_pfn(0x00000000),
  151. .length = 0x02000000,
  152. .type = MT_DEVICE
  153. }, { /* 32M boot flash (cs1) */
  154. .virtual = 0xea000000,
  155. .pfn = __phys_to_pfn(0x08000000),
  156. .length = 0x02000000,
  157. .type = MT_DEVICE
  158. }
  159. };
  160. static void __init collie_map_io(void)
  161. {
  162. sa1100_map_io();
  163. iotable_init(collie_io_desc, ARRAY_SIZE(collie_io_desc));
  164. }
  165. MACHINE_START(COLLIE, "Sharp-Collie")
  166. .phys_io = 0x80000000,
  167. .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
  168. .map_io = collie_map_io,
  169. .init_irq = sa1100_init_irq,
  170. .timer = &sa1100_timer,
  171. .init_machine = collie_init,
  172. MACHINE_END