setup.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * arch/sh/boards/renesas/sdk7780/setup.c
  4. *
  5. * Renesas Solutions SH7780 SDK Support
  6. * Copyright (C) 2008 Nicholas Beck <[email protected]>
  7. */
  8. #include <linux/init.h>
  9. #include <linux/types.h>
  10. #include <linux/platform_device.h>
  11. #include <linux/ata_platform.h>
  12. #include <asm/machvec.h>
  13. #include <mach/sdk7780.h>
  14. #include <asm/heartbeat.h>
  15. #include <asm/io.h>
  16. #include <asm/addrspace.h>
  17. #define GPIO_PECR 0xFFEA0008
  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 = IRQ_ETHERNET,
  40. .end = IRQ_ETHERNET,
  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 *sdk7780_devices[] __initdata = {
  55. &heartbeat_device,
  56. &smc91x_eth_device,
  57. };
  58. static int __init sdk7780_devices_setup(void)
  59. {
  60. return platform_add_devices(sdk7780_devices,
  61. ARRAY_SIZE(sdk7780_devices));
  62. }
  63. device_initcall(sdk7780_devices_setup);
  64. static void __init sdk7780_setup(char **cmdline_p)
  65. {
  66. u16 ver = __raw_readw(FPGA_FPVERR);
  67. u16 dateStamp = __raw_readw(FPGA_FPDATER);
  68. printk(KERN_INFO "Renesas Technology Europe SDK7780 support.\n");
  69. printk(KERN_INFO "Board version: %d (revision %d), "
  70. "FPGA version: %d (revision %d), datestamp : %d\n",
  71. (ver >> 12) & 0xf, (ver >> 8) & 0xf,
  72. (ver >> 4) & 0xf, ver & 0xf,
  73. dateStamp);
  74. /* Setup pin mux'ing for PCIC */
  75. __raw_writew(0x0000, GPIO_PECR);
  76. }
  77. /*
  78. * The Machine Vector
  79. */
  80. static struct sh_machine_vector mv_se7780 __initmv = {
  81. .mv_name = "Renesas SDK7780-R3" ,
  82. .mv_setup = sdk7780_setup,
  83. .mv_init_irq = init_sdk7780_IRQ,
  84. };