xcep.c 4.5 KB

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