scb9328.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /*
  2. * linux/arch/arm/mach-mx1/scb9328.c
  3. *
  4. * Copyright (c) 2004 Sascha Hauer <saschahauer@web.de>
  5. * Copyright (c) 2006-2008 Juergen Beisert <jbeisert@netscape.net>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. *
  11. */
  12. #include <linux/platform_device.h>
  13. #include <linux/mtd/physmap.h>
  14. #include <linux/interrupt.h>
  15. #include <linux/dm9000.h>
  16. #include <asm/mach-types.h>
  17. #include <asm/mach/arch.h>
  18. #include <asm/mach/time.h>
  19. #include <mach/common.h>
  20. #include <mach/hardware.h>
  21. #include <mach/irqs.h>
  22. #include <mach/imx-uart.h>
  23. #include <mach/iomux.h>
  24. #include "devices.h"
  25. /*
  26. * This scb9328 has a 32MiB flash
  27. */
  28. static struct resource flash_resource = {
  29. .start = IMX_CS0_PHYS,
  30. .end = IMX_CS0_PHYS + (32 * 1024 * 1024) - 1,
  31. .flags = IORESOURCE_MEM,
  32. };
  33. static struct physmap_flash_data scb_flash_data = {
  34. .width = 2,
  35. };
  36. static struct platform_device scb_flash_device = {
  37. .name = "physmap-flash",
  38. .id = 0,
  39. .dev = {
  40. .platform_data = &scb_flash_data,
  41. },
  42. .resource = &flash_resource,
  43. .num_resources = 1,
  44. };
  45. /*
  46. * scb9328 has a DM9000 network controller
  47. * connected to CS5, with 16 bit data path
  48. * and interrupt connected to GPIO 3
  49. */
  50. /*
  51. * internal datapath is fixed 16 bit
  52. */
  53. static struct dm9000_plat_data dm9000_platdata = {
  54. .flags = DM9000_PLATF_16BITONLY,
  55. };
  56. /*
  57. * the DM9000 drivers wants two defined address spaces
  58. * to gain access to address latch registers and the data path.
  59. */
  60. static struct resource dm9000x_resources[] = {
  61. {
  62. .name = "address area",
  63. .start = IMX_CS5_PHYS,
  64. .end = IMX_CS5_PHYS + 1,
  65. .flags = IORESOURCE_MEM, /* address access */
  66. }, {
  67. .name = "data area",
  68. .start = IMX_CS5_PHYS + 4,
  69. .end = IMX_CS5_PHYS + 5,
  70. .flags = IORESOURCE_MEM, /* data access */
  71. }, {
  72. .start = IRQ_GPIOC(3),
  73. .end = IRQ_GPIOC(3),
  74. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  75. },
  76. };
  77. static struct platform_device dm9000x_device = {
  78. .name = "dm9000",
  79. .id = 0,
  80. .num_resources = ARRAY_SIZE(dm9000x_resources),
  81. .resource = dm9000x_resources,
  82. .dev = {
  83. .platform_data = &dm9000_platdata,
  84. }
  85. };
  86. static int mxc_uart1_pins[] = {
  87. PC9_PF_UART1_CTS,
  88. PC10_PF_UART1_RTS,
  89. PC11_PF_UART1_TXD,
  90. PC12_PF_UART1_RXD,
  91. };
  92. static int uart1_mxc_init(struct platform_device *pdev)
  93. {
  94. return mxc_gpio_setup_multiple_pins(mxc_uart1_pins,
  95. ARRAY_SIZE(mxc_uart1_pins), "UART1");
  96. }
  97. static int uart1_mxc_exit(struct platform_device *pdev)
  98. {
  99. mxc_gpio_release_multiple_pins(mxc_uart1_pins,
  100. ARRAY_SIZE(mxc_uart1_pins));
  101. return 0;
  102. }
  103. static struct imxuart_platform_data uart_pdata = {
  104. .init = uart1_mxc_init,
  105. .exit = uart1_mxc_exit,
  106. .flags = IMXUART_HAVE_RTSCTS,
  107. };
  108. static struct platform_device *devices[] __initdata = {
  109. &scb_flash_device,
  110. &dm9000x_device,
  111. };
  112. /*
  113. * scb9328_init - Init the CPU card itself
  114. */
  115. static void __init scb9328_init(void)
  116. {
  117. mxc_register_device(&imx_uart1_device, &uart_pdata);
  118. printk(KERN_INFO"Scb9328: Adding devices\n");
  119. platform_add_devices(devices, ARRAY_SIZE(devices));
  120. }
  121. static void __init scb9328_timer_init(void)
  122. {
  123. mx1_clocks_init(32000);
  124. }
  125. static struct sys_timer scb9328_timer = {
  126. .init = scb9328_timer_init,
  127. };
  128. MACHINE_START(SCB9328, "Synertronixx scb9328")
  129. /* Sascha Hauer */
  130. .phys_io = 0x00200000,
  131. .io_pg_offst = ((0xe0200000) >> 18) & 0xfffc,
  132. .boot_params = 0x08000100,
  133. .map_io = mx1_map_io,
  134. .init_irq = mx1_init_irq,
  135. .timer = &scb9328_timer,
  136. .init_machine = scb9328_init,
  137. MACHINE_END