setup.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /*
  2. * Renesas Technology Sales RTS7751R2D Support.
  3. *
  4. * Copyright (C) 2002 - 2006 Atom Create Engineering Co., Ltd.
  5. * Copyright (C) 2004 - 2007 Paul Mundt
  6. *
  7. * This file is subject to the terms and conditions of the GNU General Public
  8. * License. See the file "COPYING" in the main directory of this archive
  9. * for more details.
  10. */
  11. #include <linux/init.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/pata_platform.h>
  14. #include <linux/serial_8250.h>
  15. #include <linux/pm.h>
  16. #include <asm/machvec.h>
  17. #include <asm/rts7751r2d.h>
  18. #include <asm/voyagergx.h>
  19. #include <asm/io.h>
  20. static void __init voyagergx_serial_init(void)
  21. {
  22. unsigned long val;
  23. /*
  24. * GPIO Control
  25. */
  26. val = readl((void __iomem *)GPIO_MUX_HIGH);
  27. val |= 0x00001fe0;
  28. writel(val, (void __iomem *)GPIO_MUX_HIGH);
  29. /*
  30. * Power Mode Gate
  31. */
  32. val = readl((void __iomem *)POWER_MODE0_GATE);
  33. val |= (POWER_MODE0_GATE_U0 | POWER_MODE0_GATE_U1);
  34. writel(val, (void __iomem *)POWER_MODE0_GATE);
  35. val = readl((void __iomem *)POWER_MODE1_GATE);
  36. val |= (POWER_MODE1_GATE_U0 | POWER_MODE1_GATE_U1);
  37. writel(val, (void __iomem *)POWER_MODE1_GATE);
  38. }
  39. static struct resource cf_ide_resources[] = {
  40. [0] = {
  41. .start = PA_AREA5_IO + 0x1000,
  42. .end = PA_AREA5_IO + 0x1000 + 0x08 - 1,
  43. .flags = IORESOURCE_MEM,
  44. },
  45. [1] = {
  46. .start = PA_AREA5_IO + 0x80c,
  47. .end = PA_AREA5_IO + 0x80c + 0x16 - 1,
  48. .flags = IORESOURCE_MEM,
  49. },
  50. [2] = {
  51. #ifdef CONFIG_RTS7751R2D_REV11
  52. .start = 1,
  53. #else
  54. .start = 2,
  55. #endif
  56. .flags = IORESOURCE_IRQ,
  57. },
  58. };
  59. static struct pata_platform_info pata_info = {
  60. .ioport_shift = 1,
  61. };
  62. static struct platform_device cf_ide_device = {
  63. .name = "pata_platform",
  64. .id = -1,
  65. .num_resources = ARRAY_SIZE(cf_ide_resources),
  66. .resource = cf_ide_resources,
  67. .dev = {
  68. .platform_data = &pata_info,
  69. },
  70. };
  71. static struct plat_serial8250_port uart_platform_data[] = {
  72. {
  73. .membase = (void __iomem *)VOYAGER_UART_BASE,
  74. .mapbase = VOYAGER_UART_BASE,
  75. .iotype = UPIO_MEM,
  76. .irq = VOYAGER_UART0_IRQ,
  77. .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
  78. .regshift = 2,
  79. .uartclk = (9600 * 16),
  80. }
  81. };
  82. static struct platform_device uart_device = {
  83. .name = "serial8250",
  84. .id = PLAT8250_DEV_PLATFORM,
  85. .dev = {
  86. .platform_data = uart_platform_data,
  87. },
  88. };
  89. static struct resource heartbeat_resources[] = {
  90. [0] = {
  91. .start = PA_OUTPORT,
  92. .end = PA_OUTPORT + 8 - 1,
  93. .flags = IORESOURCE_MEM,
  94. },
  95. };
  96. static struct platform_device heartbeat_device = {
  97. .name = "heartbeat",
  98. .id = -1,
  99. .num_resources = ARRAY_SIZE(heartbeat_resources),
  100. .resource = heartbeat_resources,
  101. };
  102. static struct platform_device *rts7751r2d_devices[] __initdata = {
  103. &uart_device,
  104. &heartbeat_device,
  105. &cf_ide_device,
  106. };
  107. static int __init rts7751r2d_devices_setup(void)
  108. {
  109. return platform_add_devices(rts7751r2d_devices,
  110. ARRAY_SIZE(rts7751r2d_devices));
  111. }
  112. __initcall(rts7751r2d_devices_setup);
  113. static void rts7751r2d_power_off(void)
  114. {
  115. ctrl_outw(0x0001, PA_POWOFF);
  116. }
  117. /*
  118. * Initialize the board
  119. */
  120. static void __init rts7751r2d_setup(char **cmdline_p)
  121. {
  122. u16 ver = ctrl_inw(PA_VERREG);
  123. printk(KERN_INFO "Renesas Technology Sales RTS7751R2D support.\n");
  124. printk(KERN_INFO "FPGA version:%d (revision:%d)\n",
  125. (ver >> 4) & 0xf, ver & 0xf);
  126. ctrl_outw(0x0000, PA_OUTPORT);
  127. pm_power_off = rts7751r2d_power_off;
  128. voyagergx_serial_init();
  129. }
  130. /*
  131. * The Machine Vector
  132. */
  133. struct sh_machine_vector mv_rts7751r2d __initmv = {
  134. .mv_name = "RTS7751R2D",
  135. .mv_setup = rts7751r2d_setup,
  136. .mv_nr_irqs = 72,
  137. .mv_init_irq = init_rts7751r2d_IRQ,
  138. .mv_irq_demux = rts7751r2d_irq_demux,
  139. #ifdef CONFIG_USB_SM501
  140. .mv_consistent_alloc = voyagergx_consistent_alloc,
  141. .mv_consistent_free = voyagergx_consistent_free,
  142. #endif
  143. };
  144. ALIAS_MV(rts7751r2d)