xcep.c 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. /* linux/arch/arm/mach-pxa/xcep.c
  2. *
  3. * Support for the Iskratel Electronics XCEP platform as used in
  4. * the Libera instruments from Instrumentation Technologies.
  5. *
  6. * Author: Ales Bardorfer <ales@i-tech.si>
  7. * Contributions by: Abbott, MG (Michael) <michael.abbott@diamond.ac.uk>
  8. * Contributions by: Matej Kenda <matej.kenda@i-tech.si>
  9. * Created: June 2006
  10. * Copyright: (C) 2006-2009 Instrumentation Technologies
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License version 2 as
  14. * published by the Free Software Foundation.
  15. */
  16. #include <linux/platform_device.h>
  17. #include <linux/i2c.h>
  18. #include <linux/i2c/pxa-i2c.h>
  19. #include <linux/smc91x.h>
  20. #include <linux/mtd/mtd.h>
  21. #include <linux/mtd/partitions.h>
  22. #include <linux/mtd/physmap.h>
  23. #include <asm/mach-types.h>
  24. #include <asm/mach/arch.h>
  25. #include <asm/mach/irq.h>
  26. #include <asm/mach/map.h>
  27. #include <mach/hardware.h>
  28. #include "pxa25x.h"
  29. #include <mach/smemc.h>
  30. #include "generic.h"
  31. #define XCEP_ETH_PHYS (PXA_CS3_PHYS + 0x00000300)
  32. #define XCEP_ETH_PHYS_END (PXA_CS3_PHYS + 0x000fffff)
  33. #define XCEP_ETH_ATTR (PXA_CS3_PHYS + 0x02000000)
  34. #define XCEP_ETH_ATTR_END (PXA_CS3_PHYS + 0x020fffff)
  35. #define XCEP_ETH_IRQ IRQ_GPIO0
  36. /* XCEP CPLD base */
  37. #define XCEP_CPLD_BASE 0xf0000000
  38. /* Flash partitions. */
  39. static struct mtd_partition xcep_partitions[] = {
  40. {
  41. .name = "Bootloader",
  42. .size = 0x00040000,
  43. .offset = 0,
  44. .mask_flags = MTD_WRITEABLE
  45. }, {
  46. .name = "Bootloader ENV",
  47. .size = 0x00040000,
  48. .offset = 0x00040000,
  49. .mask_flags = MTD_WRITEABLE
  50. }, {
  51. .name = "Kernel",
  52. .size = 0x00100000,
  53. .offset = 0x00080000,
  54. }, {
  55. .name = "Rescue fs",
  56. .size = 0x00280000,
  57. .offset = 0x00180000,
  58. }, {
  59. .name = "Filesystem",
  60. .size = MTDPART_SIZ_FULL,
  61. .offset = 0x00400000
  62. }
  63. };
  64. static struct physmap_flash_data xcep_flash_data[] = {
  65. {
  66. .width = 4, /* bankwidth in bytes */
  67. .parts = xcep_partitions,
  68. .nr_parts = ARRAY_SIZE(xcep_partitions)
  69. }
  70. };
  71. static struct resource flash_resource = {
  72. .start = PXA_CS0_PHYS,
  73. .end = PXA_CS0_PHYS + SZ_32M - 1,
  74. .flags = IORESOURCE_MEM,
  75. };
  76. static struct platform_device flash_device = {
  77. .name = "physmap-flash",
  78. .id = 0,
  79. .dev = {
  80. .platform_data = xcep_flash_data,
  81. },
  82. .resource = &flash_resource,
  83. .num_resources = 1,
  84. };
  85. /* SMC LAN91C111 network controller. */
  86. static struct resource smc91x_resources[] = {
  87. [0] = {
  88. .name = "smc91x-regs",
  89. .start = XCEP_ETH_PHYS,
  90. .end = XCEP_ETH_PHYS_END,
  91. .flags = IORESOURCE_MEM,
  92. },
  93. [1] = {
  94. .start = XCEP_ETH_IRQ,
  95. .end = XCEP_ETH_IRQ,
  96. .flags = IORESOURCE_IRQ,
  97. },
  98. [2] = {
  99. .name = "smc91x-attrib",
  100. .start = XCEP_ETH_ATTR,
  101. .end = XCEP_ETH_ATTR_END,
  102. .flags = IORESOURCE_MEM,
  103. },
  104. };
  105. static struct smc91x_platdata xcep_smc91x_info = {
  106. .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT | SMC91X_USE_32BIT |
  107. SMC91X_NOWAIT | SMC91X_USE_DMA,
  108. };
  109. static struct platform_device smc91x_device = {
  110. .name = "smc91x",
  111. .id = -1,
  112. .num_resources = ARRAY_SIZE(smc91x_resources),
  113. .resource = smc91x_resources,
  114. .dev = {
  115. .platform_data = &xcep_smc91x_info,
  116. },
  117. };
  118. static struct platform_device *devices[] __initdata = {
  119. &flash_device,
  120. &smc91x_device,
  121. };
  122. /* We have to state that there are HWMON devices on the I2C bus on XCEP.
  123. * Drivers for HWMON verify capabilities of the adapter when loading and
  124. * refuse to attach if the adapter doesn't support HWMON class of devices. */
  125. static struct i2c_pxa_platform_data xcep_i2c_platform_data = {
  126. .class = I2C_CLASS_HWMON
  127. };
  128. static mfp_cfg_t xcep_pin_config[] __initdata = {
  129. GPIO79_nCS_3, /* SMC 91C111 chip select. */
  130. GPIO80_nCS_4, /* CPLD chip select. */
  131. /* SSP communication to MSP430 */
  132. GPIO23_SSP1_SCLK,
  133. GPIO24_SSP1_SFRM,
  134. GPIO25_SSP1_TXD,
  135. GPIO26_SSP1_RXD,
  136. GPIO27_SSP1_EXTCLK
  137. };
  138. static void __init xcep_init(void)
  139. {
  140. pxa2xx_mfp_config(ARRAY_AND_SIZE(xcep_pin_config));
  141. pxa_set_ffuart_info(NULL);
  142. pxa_set_btuart_info(NULL);
  143. pxa_set_stuart_info(NULL);
  144. pxa_set_hwuart_info(NULL);
  145. /* See Intel XScale Developer's Guide for details */
  146. /* Set RDF and RDN to appropriate values (chip select 3 (smc91x)) */
  147. __raw_writel((__raw_readl(MSC1) & 0xffff) | 0xD5540000, MSC1);
  148. /* Set RDF and RDN to appropriate values (chip select 5 (fpga)) */
  149. __raw_writel((__raw_readl(MSC2) & 0xffff) | 0x72A00000, MSC2);
  150. platform_add_devices(ARRAY_AND_SIZE(devices));
  151. pxa_set_i2c_info(&xcep_i2c_platform_data);
  152. }
  153. MACHINE_START(XCEP, "Iskratel XCEP")
  154. .atag_offset = 0x100,
  155. .init_machine = xcep_init,
  156. .map_io = pxa25x_map_io,
  157. .nr_irqs = PXA_NR_IRQS,
  158. .init_irq = pxa25x_init_irq,
  159. .handle_irq = pxa25x_handle_irq,
  160. .init_time = pxa_timer_init,
  161. .restart = pxa_restart,
  162. MACHINE_END