setup.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * linux/arch/sh/boards/se/7780/setup.c
  3. *
  4. * Copyright (C) 2006,2007 Nobuhiro Iwamatsu
  5. *
  6. * Hitachi UL SolutionEngine 7780 Support.
  7. *
  8. * This file is subject to the terms and conditions of the GNU General Public
  9. * License. See the file "COPYING" in the main directory of this archive
  10. * for more details.
  11. */
  12. #include <linux/init.h>
  13. #include <linux/platform_device.h>
  14. #include <asm/machvec.h>
  15. #include <asm/se7780.h>
  16. #include <asm/io.h>
  17. /* Heartbeat */
  18. static struct resource heartbeat_resources[] = {
  19. [0] = {
  20. .start = PA_LED,
  21. .end = PA_LED,
  22. .flags = IORESOURCE_MEM,
  23. },
  24. };
  25. static struct platform_device heartbeat_device = {
  26. .name = "heartbeat",
  27. .id = -1,
  28. .num_resources = ARRAY_SIZE(heartbeat_resources),
  29. .resource = heartbeat_resources,
  30. };
  31. /* SMC91x */
  32. static struct resource smc91x_eth_resources[] = {
  33. [0] = {
  34. .name = "smc91x-regs" ,
  35. .start = PA_LAN + 0x300,
  36. .end = PA_LAN + 0x300 + 0x10 ,
  37. .flags = IORESOURCE_MEM,
  38. },
  39. [1] = {
  40. .start = SMC_IRQ,
  41. .end = SMC_IRQ,
  42. .flags = IORESOURCE_IRQ,
  43. },
  44. };
  45. static struct platform_device smc91x_eth_device = {
  46. .name = "smc91x",
  47. .id = 0,
  48. .dev = {
  49. .dma_mask = NULL, /* don't use dma */
  50. .coherent_dma_mask = 0xffffffff,
  51. },
  52. .num_resources = ARRAY_SIZE(smc91x_eth_resources),
  53. .resource = smc91x_eth_resources,
  54. };
  55. static struct platform_device *se7780_devices[] __initdata = {
  56. &heartbeat_device,
  57. &smc91x_eth_device,
  58. };
  59. static int __init se7780_devices_setup(void)
  60. {
  61. return platform_add_devices(se7780_devices,
  62. ARRAY_SIZE(se7780_devices));
  63. }
  64. device_initcall(se7780_devices_setup);
  65. #define GPIO_PHCR 0xFFEA000E
  66. #define GPIO_PMSELR 0xFFEA0080
  67. #define GPIO_PECR 0xFFEA0008
  68. static void __init se7780_setup(char **cmdline_p)
  69. {
  70. /* "SH-Linux" on LED Display */
  71. ctrl_outw( 'S' , PA_LED_DISP + (DISP_SEL0_ADDR << 1) );
  72. ctrl_outw( 'H' , PA_LED_DISP + (DISP_SEL1_ADDR << 1) );
  73. ctrl_outw( '-' , PA_LED_DISP + (DISP_SEL2_ADDR << 1) );
  74. ctrl_outw( 'L' , PA_LED_DISP + (DISP_SEL3_ADDR << 1) );
  75. ctrl_outw( 'i' , PA_LED_DISP + (DISP_SEL4_ADDR << 1) );
  76. ctrl_outw( 'n' , PA_LED_DISP + (DISP_SEL5_ADDR << 1) );
  77. ctrl_outw( 'u' , PA_LED_DISP + (DISP_SEL6_ADDR << 1) );
  78. ctrl_outw( 'x' , PA_LED_DISP + (DISP_SEL7_ADDR << 1) );
  79. printk(KERN_INFO "Hitachi UL Solutions Engine 7780SE03 support.\n");
  80. /*
  81. * PCI REQ/GNT setting
  82. * REQ0/GNT0 -> USB
  83. * REQ1/GNT1 -> PC Card
  84. * REQ2/GNT2 -> Serial ATA
  85. * REQ3/GNT3 -> PCI slot
  86. */
  87. ctrl_outw(0x0213, FPGA_REQSEL);
  88. /* GPIO setting */
  89. ctrl_outw(0x0000, GPIO_PECR);
  90. ctrl_outw(ctrl_inw(GPIO_PHCR)&0xfff3, GPIO_PHCR);
  91. ctrl_outw(0x0c00, GPIO_PMSELR);
  92. /* iVDR Power ON */
  93. ctrl_outw(0x0001, FPGA_IVDRPW);
  94. }
  95. /*
  96. * The Machine Vector
  97. */
  98. static struct sh_machine_vector mv_se7780 __initmv = {
  99. .mv_name = "Solution Engine 7780" ,
  100. .mv_setup = se7780_setup ,
  101. .mv_nr_irqs = 111 ,
  102. .mv_init_irq = init_se7780_IRQ,
  103. };