scb9328.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. [0] = {
  62. .name = "address area",
  63. .start = IMX_CS5_PHYS,
  64. .end = IMX_CS5_PHYS + 1,
  65. .flags = IORESOURCE_MEM /* address access */
  66. },
  67. [1] = {
  68. .name = "data area",
  69. .start = IMX_CS5_PHYS + 4,
  70. .end = IMX_CS5_PHYS + 5,
  71. .flags = IORESOURCE_MEM /* data access */
  72. },
  73. [2] = {
  74. .start = IRQ_GPIOC(3),
  75. .end = IRQ_GPIOC(3),
  76. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL
  77. },
  78. };
  79. static struct platform_device dm9000x_device = {
  80. .name = "dm9000",
  81. .id = 0,
  82. .num_resources = ARRAY_SIZE(dm9000x_resources),
  83. .resource = dm9000x_resources,
  84. .dev = {
  85. .platform_data = &dm9000_platdata,
  86. }
  87. };
  88. static int mxc_uart1_pins[] = {
  89. PC9_PF_UART1_CTS,
  90. PC10_PF_UART1_RTS,
  91. PC11_PF_UART1_TXD,
  92. PC12_PF_UART1_RXD,
  93. };
  94. static int uart1_mxc_init(struct platform_device *pdev)
  95. {
  96. return mxc_gpio_setup_multiple_pins(mxc_uart1_pins,
  97. ARRAY_SIZE(mxc_uart1_pins), "UART1");
  98. }
  99. static int uart1_mxc_exit(struct platform_device *pdev)
  100. {
  101. mxc_gpio_release_multiple_pins(mxc_uart1_pins,
  102. ARRAY_SIZE(mxc_uart1_pins));
  103. return 0;
  104. }
  105. static struct imxuart_platform_data uart_pdata = {
  106. .init = uart1_mxc_init,
  107. .exit = uart1_mxc_exit,
  108. .flags = IMXUART_HAVE_RTSCTS,
  109. };
  110. static struct platform_device *devices[] __initdata = {
  111. &scb_flash_device,
  112. &dm9000x_device,
  113. };
  114. /*
  115. * scb9328_init - Init the CPU card itself
  116. */
  117. static void __init scb9328_init(void)
  118. {
  119. mxc_register_device(&imx_uart1_device, &uart_pdata);
  120. printk(KERN_INFO"Scb9328: Adding devices\n");
  121. platform_add_devices(devices, ARRAY_SIZE(devices));
  122. }
  123. static void __init scb9328_timer_init(void)
  124. {
  125. mx1_clocks_init(32000);
  126. }
  127. static struct sys_timer scb9328_timer = {
  128. .init = scb9328_timer_init,
  129. };
  130. MACHINE_START(SCB9328, "Synertronixx scb9328")
  131. /* Sascha Hauer */
  132. .phys_io = 0x00200000,
  133. .io_pg_offst = ((0xe0200000) >> 18) & 0xfffc,
  134. .boot_params = 0x08000100,
  135. .map_io = mxc_map_io,
  136. .init_irq = mxc_init_irq,
  137. .timer = &scb9328_timer,
  138. .init_machine = scb9328_init,
  139. MACHINE_END