config.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. /***************************************************************************/
  2. /*
  3. * linux/arch/m68knommu/platform/523x/config.c
  4. *
  5. * Sub-architcture dependant initialization code for the Freescale
  6. * 523x CPUs.
  7. *
  8. * Copyright (C) 1999-2005, Greg Ungerer (gerg@snapgear.com)
  9. * Copyright (C) 2001-2003, SnapGear Inc. (www.snapgear.com)
  10. */
  11. /***************************************************************************/
  12. #include <linux/kernel.h>
  13. #include <linux/param.h>
  14. #include <linux/init.h>
  15. #include <linux/io.h>
  16. #include <asm/machdep.h>
  17. #include <asm/coldfire.h>
  18. #include <asm/mcfsim.h>
  19. #include <asm/mcfuart.h>
  20. /***************************************************************************/
  21. static struct mcf_platform_uart m523x_uart_platform[] = {
  22. {
  23. .mapbase = MCF_MBAR + MCFUART_BASE1,
  24. .irq = MCFINT_VECBASE + MCFINT_UART0,
  25. },
  26. {
  27. .mapbase = MCF_MBAR + MCFUART_BASE2,
  28. .irq = MCFINT_VECBASE + MCFINT_UART0 + 1,
  29. },
  30. {
  31. .mapbase = MCF_MBAR + MCFUART_BASE3,
  32. .irq = MCFINT_VECBASE + MCFINT_UART0 + 2,
  33. },
  34. { },
  35. };
  36. static struct platform_device m523x_uart = {
  37. .name = "mcfuart",
  38. .id = 0,
  39. .dev.platform_data = m523x_uart_platform,
  40. };
  41. static struct resource m523x_fec_resources[] = {
  42. {
  43. .start = MCF_MBAR + 0x1000,
  44. .end = MCF_MBAR + 0x1000 + 0x7ff,
  45. .flags = IORESOURCE_MEM,
  46. },
  47. {
  48. .start = 64 + 23,
  49. .end = 64 + 23,
  50. .flags = IORESOURCE_IRQ,
  51. },
  52. {
  53. .start = 64 + 27,
  54. .end = 64 + 27,
  55. .flags = IORESOURCE_IRQ,
  56. },
  57. {
  58. .start = 64 + 29,
  59. .end = 64 + 29,
  60. .flags = IORESOURCE_IRQ,
  61. },
  62. };
  63. static struct platform_device m523x_fec = {
  64. .name = "fec",
  65. .id = 0,
  66. .num_resources = ARRAY_SIZE(m523x_fec_resources),
  67. .resource = m523x_fec_resources,
  68. };
  69. static struct platform_device *m523x_devices[] __initdata = {
  70. &m523x_uart,
  71. &m523x_fec,
  72. };
  73. /***************************************************************************/
  74. static void __init m523x_fec_init(void)
  75. {
  76. u16 par;
  77. u8 v;
  78. /* Set multi-function pins to ethernet use */
  79. par = readw(MCF_IPSBAR + 0x100082);
  80. writew(par | 0xf00, MCF_IPSBAR + 0x100082);
  81. v = readb(MCF_IPSBAR + 0x100078);
  82. writeb(v | 0xc0, MCF_IPSBAR + 0x100078);
  83. }
  84. /***************************************************************************/
  85. static void m523x_cpu_reset(void)
  86. {
  87. local_irq_disable();
  88. __raw_writeb(MCF_RCR_SWRESET, MCF_IPSBAR + MCF_RCR);
  89. }
  90. /***************************************************************************/
  91. void __init config_BSP(char *commandp, int size)
  92. {
  93. mach_reset = m523x_cpu_reset;
  94. }
  95. /***************************************************************************/
  96. static int __init init_BSP(void)
  97. {
  98. m523x_fec_init();
  99. platform_add_devices(m523x_devices, ARRAY_SIZE(m523x_devices));
  100. return 0;
  101. }
  102. arch_initcall(init_BSP);
  103. /***************************************************************************/