setup.c 2.8 KB

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