setup.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 resource heartbeat_resource = {
  23. .start = PA_LED,
  24. .end = PA_LED,
  25. .flags = IORESOURCE_MEM | IORESOURCE_MEM_16BIT,
  26. };
  27. static struct platform_device heartbeat_device = {
  28. .name = "heartbeat",
  29. .id = -1,
  30. .num_resources = 1,
  31. .resource = &heartbeat_resource,
  32. };
  33. /* SMC91x */
  34. static struct resource smc91x_eth_resources[] = {
  35. [0] = {
  36. .name = "smc91x-regs" ,
  37. .start = PA_LAN + 0x300,
  38. .end = PA_LAN + 0x300 + 0x10 ,
  39. .flags = IORESOURCE_MEM,
  40. },
  41. [1] = {
  42. .start = IRQ_ETHERNET,
  43. .end = IRQ_ETHERNET,
  44. .flags = IORESOURCE_IRQ,
  45. },
  46. };
  47. static struct platform_device smc91x_eth_device = {
  48. .name = "smc91x",
  49. .id = 0,
  50. .dev = {
  51. .dma_mask = NULL, /* don't use dma */
  52. .coherent_dma_mask = 0xffffffff,
  53. },
  54. .num_resources = ARRAY_SIZE(smc91x_eth_resources),
  55. .resource = smc91x_eth_resources,
  56. };
  57. static struct platform_device *sdk7780_devices[] __initdata = {
  58. &heartbeat_device,
  59. &smc91x_eth_device,
  60. };
  61. static int __init sdk7780_devices_setup(void)
  62. {
  63. return platform_add_devices(sdk7780_devices,
  64. ARRAY_SIZE(sdk7780_devices));
  65. }
  66. device_initcall(sdk7780_devices_setup);
  67. static void __init sdk7780_setup(char **cmdline_p)
  68. {
  69. u16 ver = __raw_readw(FPGA_FPVERR);
  70. u16 dateStamp = __raw_readw(FPGA_FPDATER);
  71. printk(KERN_INFO "Renesas Technology Europe SDK7780 support.\n");
  72. printk(KERN_INFO "Board version: %d (revision %d), "
  73. "FPGA version: %d (revision %d), datestamp : %d\n",
  74. (ver >> 12) & 0xf, (ver >> 8) & 0xf,
  75. (ver >> 4) & 0xf, ver & 0xf,
  76. dateStamp);
  77. /* Setup pin mux'ing for PCIC */
  78. __raw_writew(0x0000, GPIO_PECR);
  79. }
  80. /*
  81. * The Machine Vector
  82. */
  83. static struct sh_machine_vector mv_se7780 __initmv = {
  84. .mv_name = "Renesas SDK7780-R3" ,
  85. .mv_setup = sdk7780_setup,
  86. .mv_init_irq = init_sdk7780_IRQ,
  87. };