mach-scb9328.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*
  2. * linux/arch/arm/mach-mx1/mach-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 <linux/gpio.h>
  17. #include <asm/mach-types.h>
  18. #include <asm/mach/arch.h>
  19. #include <asm/mach/time.h>
  20. #include <mach/common.h>
  21. #include <mach/hardware.h>
  22. #include <mach/irqs.h>
  23. #include <mach/iomux-mx1.h>
  24. #include "devices-imx1.h"
  25. /*
  26. * This scb9328 has a 32MiB flash
  27. */
  28. static struct resource flash_resource = {
  29. .start = MX1_CS0_PHYS,
  30. .end = MX1_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 = MX1_CS5_PHYS,
  64. .end = MX1_CS5_PHYS + 1,
  65. .flags = IORESOURCE_MEM, /* address access */
  66. }, {
  67. .name = "data area",
  68. .start = MX1_CS5_PHYS + 4,
  69. .end = MX1_CS5_PHYS + 5,
  70. .flags = IORESOURCE_MEM, /* data access */
  71. }, {
  72. /* irq number is run-time assigned */
  73. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  74. },
  75. };
  76. static struct platform_device dm9000x_device = {
  77. .name = "dm9000",
  78. .id = 0,
  79. .num_resources = ARRAY_SIZE(dm9000x_resources),
  80. .resource = dm9000x_resources,
  81. .dev = {
  82. .platform_data = &dm9000_platdata,
  83. }
  84. };
  85. static const int mxc_uart1_pins[] = {
  86. PC9_PF_UART1_CTS,
  87. PC10_PF_UART1_RTS,
  88. PC11_PF_UART1_TXD,
  89. PC12_PF_UART1_RXD,
  90. };
  91. static const struct imxuart_platform_data uart_pdata __initconst = {
  92. .flags = IMXUART_HAVE_RTSCTS,
  93. };
  94. static struct platform_device *devices[] __initdata = {
  95. &scb_flash_device,
  96. &dm9000x_device,
  97. };
  98. /*
  99. * scb9328_init - Init the CPU card itself
  100. */
  101. static void __init scb9328_init(void)
  102. {
  103. imx1_soc_init();
  104. mxc_gpio_setup_multiple_pins(mxc_uart1_pins,
  105. ARRAY_SIZE(mxc_uart1_pins), "UART1");
  106. imx1_add_imx_uart0(&uart_pdata);
  107. printk(KERN_INFO"Scb9328: Adding devices\n");
  108. dm9000x_resources[2].start = gpio_to_irq(IMX_GPIO_NR(3, 3));
  109. dm9000x_resources[2].end = gpio_to_irq(IMX_GPIO_NR(3, 3));
  110. platform_add_devices(devices, ARRAY_SIZE(devices));
  111. }
  112. static void __init scb9328_timer_init(void)
  113. {
  114. mx1_clocks_init(32000);
  115. }
  116. static struct sys_timer scb9328_timer = {
  117. .init = scb9328_timer_init,
  118. };
  119. MACHINE_START(SCB9328, "Synertronixx scb9328")
  120. /* Sascha Hauer */
  121. .atag_offset = 100,
  122. .map_io = mx1_map_io,
  123. .init_early = imx1_init_early,
  124. .init_irq = mx1_init_irq,
  125. .handle_irq = imx1_handle_irq,
  126. .timer = &scb9328_timer,
  127. .init_machine = scb9328_init,
  128. .restart = mxc_restart,
  129. MACHINE_END