setup.c 3.0 KB

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