cerf.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /*
  2. * linux/arch/arm/mach-sa1100/cerf.c
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. *
  8. * Apr-2003 : Removed some old PDA crud [FB]
  9. * Oct-2003 : Added uart2 resource [FB]
  10. * Jan-2004 : Removed io map for flash [FB]
  11. */
  12. #include <linux/init.h>
  13. #include <linux/kernel.h>
  14. #include <linux/tty.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/irq.h>
  17. #include <linux/mtd/mtd.h>
  18. #include <linux/mtd/partitions.h>
  19. #include <mach/hardware.h>
  20. #include <asm/setup.h>
  21. #include <asm/mach-types.h>
  22. #include <asm/mach/arch.h>
  23. #include <asm/mach/flash.h>
  24. #include <asm/mach/map.h>
  25. #include <asm/mach/serial_sa1100.h>
  26. #include <mach/cerf.h>
  27. #include <mach/mcp.h>
  28. #include <mach/irqs.h>
  29. #include "generic.h"
  30. static struct resource cerfuart2_resources[] = {
  31. [0] = DEFINE_RES_MEM(0x80030000, SZ_64K),
  32. };
  33. static struct platform_device cerfuart2_device = {
  34. .name = "sa11x0-uart",
  35. .id = 2,
  36. .num_resources = ARRAY_SIZE(cerfuart2_resources),
  37. .resource = cerfuart2_resources,
  38. };
  39. static struct platform_device *cerf_devices[] __initdata = {
  40. &cerfuart2_device,
  41. };
  42. #ifdef CONFIG_SA1100_CERF_FLASH_32MB
  43. # define CERF_FLASH_SIZE 0x02000000
  44. #elif defined CONFIG_SA1100_CERF_FLASH_16MB
  45. # define CERF_FLASH_SIZE 0x01000000
  46. #elif defined CONFIG_SA1100_CERF_FLASH_8MB
  47. # define CERF_FLASH_SIZE 0x00800000
  48. #else
  49. # error "Undefined flash size for CERF"
  50. #endif
  51. static struct mtd_partition cerf_partitions[] = {
  52. {
  53. .name = "Bootloader",
  54. .size = 0x00020000,
  55. .offset = 0x00000000,
  56. }, {
  57. .name = "Params",
  58. .size = 0x00040000,
  59. .offset = 0x00020000,
  60. }, {
  61. .name = "Kernel",
  62. .size = 0x00100000,
  63. .offset = 0x00060000,
  64. }, {
  65. .name = "Filesystem",
  66. .size = CERF_FLASH_SIZE-0x00160000,
  67. .offset = 0x00160000,
  68. }
  69. };
  70. static struct flash_platform_data cerf_flash_data = {
  71. .map_name = "cfi_probe",
  72. .parts = cerf_partitions,
  73. .nr_parts = ARRAY_SIZE(cerf_partitions),
  74. };
  75. static struct resource cerf_flash_resource =
  76. DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_32M);
  77. static void __init cerf_init_irq(void)
  78. {
  79. sa1100_init_irq();
  80. irq_set_irq_type(CERF_ETH_IRQ, IRQ_TYPE_EDGE_RISING);
  81. }
  82. static struct map_desc cerf_io_desc[] __initdata = {
  83. { /* Crystal Ethernet Chip */
  84. .virtual = 0xf0000000,
  85. .pfn = __phys_to_pfn(0x08000000),
  86. .length = 0x00100000,
  87. .type = MT_DEVICE
  88. }
  89. };
  90. static void __init cerf_map_io(void)
  91. {
  92. sa1100_map_io();
  93. iotable_init(cerf_io_desc, ARRAY_SIZE(cerf_io_desc));
  94. sa1100_register_uart(0, 3);
  95. sa1100_register_uart(1, 2); /* disable this and the uart2 device for sa1100_fir */
  96. sa1100_register_uart(2, 1);
  97. /* set some GPDR bits here while it's safe */
  98. GPDR |= CERF_GPIO_CF_RESET;
  99. }
  100. static struct mcp_plat_data cerf_mcp_data = {
  101. .mccr0 = MCCR0_ADM,
  102. .sclk_rate = 11981000,
  103. };
  104. static void __init cerf_init(void)
  105. {
  106. sa11x0_ppc_configure_mcp();
  107. platform_add_devices(cerf_devices, ARRAY_SIZE(cerf_devices));
  108. sa11x0_register_mtd(&cerf_flash_data, &cerf_flash_resource, 1);
  109. sa11x0_register_mcp(&cerf_mcp_data);
  110. }
  111. MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube")
  112. /* Maintainer: support@intrinsyc.com */
  113. .map_io = cerf_map_io,
  114. .nr_irqs = SA1100_NR_IRQS,
  115. .init_irq = cerf_init_irq,
  116. .timer = &sa1100_timer,
  117. .init_machine = cerf_init,
  118. .restart = sa11x0_restart,
  119. MACHINE_END