setup.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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 unsigned char heartbeat_bit_pos[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
  19. static struct resource heartbeat_resources[] = {
  20. [0] = {
  21. .start = PA_LED,
  22. .end = PA_LED + ARRAY_SIZE(heartbeat_bit_pos) - 1,
  23. .flags = IORESOURCE_MEM,
  24. },
  25. };
  26. static struct platform_device heartbeat_device = {
  27. .name = "heartbeat",
  28. .id = -1,
  29. .dev = {
  30. .platform_data = heartbeat_bit_pos,
  31. },
  32. .num_resources = ARRAY_SIZE(heartbeat_resources),
  33. .resource = heartbeat_resources,
  34. };
  35. /* SMC91x */
  36. static struct resource smc91x_eth_resources[] = {
  37. [0] = {
  38. .name = "smc91x-regs" ,
  39. .start = PA_LAN + 0x300,
  40. .end = PA_LAN + 0x300 + 0x10 ,
  41. .flags = IORESOURCE_MEM,
  42. },
  43. [1] = {
  44. .start = SMC_IRQ,
  45. .end = SMC_IRQ,
  46. .flags = IORESOURCE_IRQ,
  47. },
  48. };
  49. static struct platform_device smc91x_eth_device = {
  50. .name = "smc91x",
  51. .id = 0,
  52. .dev = {
  53. .dma_mask = NULL, /* don't use dma */
  54. .coherent_dma_mask = 0xffffffff,
  55. },
  56. .num_resources = ARRAY_SIZE(smc91x_eth_resources),
  57. .resource = smc91x_eth_resources,
  58. };
  59. static struct platform_device *se7780_devices[] __initdata = {
  60. &heartbeat_device,
  61. &smc91x_eth_device,
  62. };
  63. static int __init se7780_devices_setup(void)
  64. {
  65. return platform_add_devices(se7780_devices,
  66. ARRAY_SIZE(se7780_devices));
  67. }
  68. device_initcall(se7780_devices_setup);
  69. #define GPIO_PHCR 0xFFEA000E
  70. #define GPIO_PMSELR 0xFFEA0080
  71. #define GPIO_PECR 0xFFEA0008
  72. static void __init se7780_setup(char **cmdline_p)
  73. {
  74. /* "SH-Linux" on LED Display */
  75. ctrl_outw( 'S' , PA_LED_DISP + (DISP_SEL0_ADDR << 1) );
  76. ctrl_outw( 'H' , PA_LED_DISP + (DISP_SEL1_ADDR << 1) );
  77. ctrl_outw( '-' , PA_LED_DISP + (DISP_SEL2_ADDR << 1) );
  78. ctrl_outw( 'L' , PA_LED_DISP + (DISP_SEL3_ADDR << 1) );
  79. ctrl_outw( 'i' , PA_LED_DISP + (DISP_SEL4_ADDR << 1) );
  80. ctrl_outw( 'n' , PA_LED_DISP + (DISP_SEL5_ADDR << 1) );
  81. ctrl_outw( 'u' , PA_LED_DISP + (DISP_SEL6_ADDR << 1) );
  82. ctrl_outw( 'x' , PA_LED_DISP + (DISP_SEL7_ADDR << 1) );
  83. printk(KERN_INFO "Hitachi UL Solutions Engine 7780SE03 support.\n");
  84. /*
  85. * PCI REQ/GNT setting
  86. * REQ0/GNT0 -> USB
  87. * REQ1/GNT1 -> PC Card
  88. * REQ2/GNT2 -> Serial ATA
  89. * REQ3/GNT3 -> PCI slot
  90. */
  91. ctrl_outw(0x0213, FPGA_REQSEL);
  92. /* GPIO setting */
  93. ctrl_outw(0x0000, GPIO_PECR);
  94. ctrl_outw(ctrl_inw(GPIO_PHCR)&0xfff3, GPIO_PHCR);
  95. ctrl_outw(0x0c00, GPIO_PMSELR);
  96. /* iVDR Power ON */
  97. ctrl_outw(0x0001, FPGA_IVDRPW);
  98. }
  99. /*
  100. * The Machine Vector
  101. */
  102. struct sh_machine_vector mv_se7780 __initmv = {
  103. .mv_name = "Solution Engine 7780" ,
  104. .mv_setup = se7780_setup ,
  105. .mv_nr_irqs = 111 ,
  106. .mv_init_irq = init_se7780_IRQ,
  107. };
  108. ALIAS_MV(se7780)