setup.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*
  2. * Renesas Technology Sales RTS7751R2D Support.
  3. *
  4. * Copyright (C) 2002 Atom Create Engineering Co., Ltd.
  5. * Copyright (C) 2004 - 2006 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/serial_8250.h>
  14. #include <linux/pm.h>
  15. #include <asm/machvec.h>
  16. #include <asm/mach/rts7751r2d.h>
  17. #include <asm/io.h>
  18. #include <asm/voyagergx.h>
  19. extern void heartbeat_rts7751r2d(void);
  20. extern void init_rts7751r2d_IRQ(void);
  21. extern int rts7751r2d_irq_demux(int irq);
  22. extern void *voyagergx_consistent_alloc(struct device *, size_t, dma_addr_t *, gfp_t);
  23. extern int voyagergx_consistent_free(struct device *, size_t, void *, dma_addr_t);
  24. static struct plat_serial8250_port uart_platform_data[] = {
  25. {
  26. .membase = (void *)VOYAGER_UART_BASE,
  27. .mapbase = VOYAGER_UART_BASE,
  28. .iotype = UPIO_MEM,
  29. .irq = VOYAGER_UART0_IRQ,
  30. .flags = UPF_BOOT_AUTOCONF,
  31. .regshift = 2,
  32. .uartclk = (9600 * 16),
  33. }, {
  34. .flags = 0,
  35. },
  36. };
  37. static void __init voyagergx_serial_init(void)
  38. {
  39. unsigned long val;
  40. /*
  41. * GPIO Control
  42. */
  43. val = inl(GPIO_MUX_HIGH);
  44. val |= 0x00001fe0;
  45. outl(val, GPIO_MUX_HIGH);
  46. /*
  47. * Power Mode Gate
  48. */
  49. val = inl(POWER_MODE0_GATE);
  50. val |= (POWER_MODE0_GATE_U0 | POWER_MODE0_GATE_U1);
  51. outl(val, POWER_MODE0_GATE);
  52. val = inl(POWER_MODE1_GATE);
  53. val |= (POWER_MODE1_GATE_U0 | POWER_MODE1_GATE_U1);
  54. outl(val, POWER_MODE1_GATE);
  55. }
  56. static struct platform_device uart_device = {
  57. .name = "serial8250",
  58. .id = -1,
  59. .dev = {
  60. .platform_data = uart_platform_data,
  61. },
  62. };
  63. static struct platform_device *rts7751r2d_devices[] __initdata = {
  64. &uart_device,
  65. };
  66. static int __init rts7751r2d_devices_setup(void)
  67. {
  68. return platform_add_devices(rts7751r2d_devices,
  69. ARRAY_SIZE(rts7751r2d_devices));
  70. }
  71. static void rts7751r2d_power_off(void)
  72. {
  73. ctrl_outw(0x0001, PA_POWOFF);
  74. }
  75. /*
  76. * Initialize the board
  77. */
  78. static void __init rts7751r2d_setup(char **cmdline_p)
  79. {
  80. device_initcall(rts7751r2d_devices_setup);
  81. ctrl_outw(0x0000, PA_OUTPORT);
  82. pm_power_off = rts7751r2d_power_off;
  83. voyagergx_serial_init();
  84. printk(KERN_INFO "Renesas Technology Sales RTS7751R2D support.\n");
  85. }
  86. /*
  87. * The Machine Vector
  88. */
  89. struct sh_machine_vector mv_rts7751r2d __initmv = {
  90. .mv_name = "RTS7751R2D",
  91. .mv_setup = rts7751r2d_setup,
  92. .mv_nr_irqs = 72,
  93. .mv_inb = rts7751r2d_inb,
  94. .mv_inw = rts7751r2d_inw,
  95. .mv_inl = rts7751r2d_inl,
  96. .mv_outb = rts7751r2d_outb,
  97. .mv_outw = rts7751r2d_outw,
  98. .mv_outl = rts7751r2d_outl,
  99. .mv_inb_p = rts7751r2d_inb_p,
  100. .mv_inw_p = rts7751r2d_inw,
  101. .mv_inl_p = rts7751r2d_inl,
  102. .mv_outb_p = rts7751r2d_outb_p,
  103. .mv_outw_p = rts7751r2d_outw,
  104. .mv_outl_p = rts7751r2d_outl,
  105. .mv_insb = rts7751r2d_insb,
  106. .mv_insw = rts7751r2d_insw,
  107. .mv_insl = rts7751r2d_insl,
  108. .mv_outsb = rts7751r2d_outsb,
  109. .mv_outsw = rts7751r2d_outsw,
  110. .mv_outsl = rts7751r2d_outsl,
  111. .mv_init_irq = init_rts7751r2d_IRQ,
  112. #ifdef CONFIG_HEARTBEAT
  113. .mv_heartbeat = heartbeat_rts7751r2d,
  114. #endif
  115. .mv_irq_demux = rts7751r2d_irq_demux,
  116. #ifdef CONFIG_USB_SM501
  117. .mv_consistent_alloc = voyagergx_consistent_alloc,
  118. .mv_consistent_free = voyagergx_consistent_free,
  119. #endif
  120. };
  121. ALIAS_MV(rts7751r2d)