setup.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * arch/sh/boards/renesas/sdk7780/setup.c
  3. *
  4. * Renesas Solutions SH7780 SDK Support
  5. * Copyright (C) 2008 Nicholas Beck <nbeck@mpc-data.co.uk>
  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/types.h>
  13. #include <linux/platform_device.h>
  14. #include <linux/ata_platform.h>
  15. #include <asm/machvec.h>
  16. #include <mach/sdk7780.h>
  17. #include <asm/heartbeat.h>
  18. #include <asm/io.h>
  19. #include <asm/addrspace.h>
  20. #define GPIO_PECR 0xFFEA0008
  21. //* Heartbeat */
  22. static struct heartbeat_data heartbeat_data = {
  23. .regsize = 16,
  24. };
  25. static struct resource heartbeat_resources[] = {
  26. [0] = {
  27. .start = PA_LED,
  28. .end = PA_LED,
  29. .flags = IORESOURCE_MEM,
  30. },
  31. };
  32. static struct platform_device heartbeat_device = {
  33. .name = "heartbeat",
  34. .id = -1,
  35. .dev = {
  36. .platform_data = &heartbeat_data,
  37. },
  38. .num_resources = ARRAY_SIZE(heartbeat_resources),
  39. .resource = heartbeat_resources,
  40. };
  41. /* SMC91x */
  42. static struct resource smc91x_eth_resources[] = {
  43. [0] = {
  44. .name = "smc91x-regs" ,
  45. .start = PA_LAN + 0x300,
  46. .end = PA_LAN + 0x300 + 0x10 ,
  47. .flags = IORESOURCE_MEM,
  48. },
  49. [1] = {
  50. .start = IRQ_ETHERNET,
  51. .end = IRQ_ETHERNET,
  52. .flags = IORESOURCE_IRQ,
  53. },
  54. };
  55. static struct platform_device smc91x_eth_device = {
  56. .name = "smc91x",
  57. .id = 0,
  58. .dev = {
  59. .dma_mask = NULL, /* don't use dma */
  60. .coherent_dma_mask = 0xffffffff,
  61. },
  62. .num_resources = ARRAY_SIZE(smc91x_eth_resources),
  63. .resource = smc91x_eth_resources,
  64. };
  65. static struct platform_device *sdk7780_devices[] __initdata = {
  66. &heartbeat_device,
  67. &smc91x_eth_device,
  68. };
  69. static int __init sdk7780_devices_setup(void)
  70. {
  71. return platform_add_devices(sdk7780_devices,
  72. ARRAY_SIZE(sdk7780_devices));
  73. }
  74. device_initcall(sdk7780_devices_setup);
  75. static void __init sdk7780_setup(char **cmdline_p)
  76. {
  77. u16 ver = ctrl_inw(FPGA_FPVERR);
  78. u16 dateStamp = ctrl_inw(FPGA_FPDATER);
  79. printk(KERN_INFO "Renesas Technology Europe SDK7780 support.\n");
  80. printk(KERN_INFO "Board version: %d (revision %d), "
  81. "FPGA version: %d (revision %d), datestamp : %d\n",
  82. (ver >> 12) & 0xf, (ver >> 8) & 0xf,
  83. (ver >> 4) & 0xf, ver & 0xf,
  84. dateStamp);
  85. /* Setup pin mux'ing for PCIC */
  86. ctrl_outw(0x0000, GPIO_PECR);
  87. }
  88. /*
  89. * The Machine Vector
  90. */
  91. static struct sh_machine_vector mv_se7780 __initmv = {
  92. .mv_name = "Renesas SDK7780-R3" ,
  93. .mv_setup = sdk7780_setup,
  94. .mv_nr_irqs = 111,
  95. .mv_init_irq = init_sdk7780_IRQ,
  96. };