setup.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. // SPDX-License-Identifier: GPL-2.0
  2. /*
  3. * linux/arch/sh/boards/sh03/setup.c
  4. *
  5. * Copyright (C) 2004 Interface Co.,Ltd. Saito.K
  6. *
  7. */
  8. #include <linux/init.h>
  9. #include <linux/irq.h>
  10. #include <linux/pci.h>
  11. #include <linux/platform_device.h>
  12. #include <linux/ata_platform.h>
  13. #include <asm/io.h>
  14. #include <asm/rtc.h>
  15. #include <mach-sh03/mach/io.h>
  16. #include <mach-sh03/mach/sh03.h>
  17. #include <asm/addrspace.h>
  18. static void __init init_sh03_IRQ(void)
  19. {
  20. plat_irq_setup_pins(IRQ_MODE_IRQ);
  21. }
  22. /* arch/sh/boards/sh03/rtc.c */
  23. void sh03_time_init(void);
  24. static void __init sh03_setup(char **cmdline_p)
  25. {
  26. board_time_init = sh03_time_init;
  27. }
  28. static struct resource cf_ide_resources[] = {
  29. [0] = {
  30. .start = 0x1f0,
  31. .end = 0x1f0 + 8,
  32. .flags = IORESOURCE_IO,
  33. },
  34. [1] = {
  35. .start = 0x1f0 + 0x206,
  36. .end = 0x1f0 +8 + 0x206 + 8,
  37. .flags = IORESOURCE_IO,
  38. },
  39. [2] = {
  40. .start = IRL2_IRQ,
  41. .flags = IORESOURCE_IRQ,
  42. },
  43. };
  44. static struct platform_device cf_ide_device = {
  45. .name = "pata_platform",
  46. .id = -1,
  47. .num_resources = ARRAY_SIZE(cf_ide_resources),
  48. .resource = cf_ide_resources,
  49. };
  50. static struct resource heartbeat_resources[] = {
  51. [0] = {
  52. .start = 0xa0800000,
  53. .end = 0xa0800000,
  54. .flags = IORESOURCE_MEM,
  55. },
  56. };
  57. static struct platform_device heartbeat_device = {
  58. .name = "heartbeat",
  59. .id = -1,
  60. .num_resources = ARRAY_SIZE(heartbeat_resources),
  61. .resource = heartbeat_resources,
  62. };
  63. static struct platform_device *sh03_devices[] __initdata = {
  64. &heartbeat_device,
  65. &cf_ide_device,
  66. };
  67. static int __init sh03_devices_setup(void)
  68. {
  69. pgprot_t prot;
  70. unsigned long paddrbase;
  71. void *cf_ide_base;
  72. /* open I/O area window */
  73. paddrbase = virt_to_phys((void *)PA_AREA5_IO);
  74. prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16);
  75. cf_ide_base = ioremap_prot(paddrbase, PAGE_SIZE, pgprot_val(prot));
  76. if (!cf_ide_base) {
  77. printk("allocate_cf_area : can't open CF I/O window!\n");
  78. return -ENOMEM;
  79. }
  80. /* IDE cmd address : 0x1f0-0x1f7 and 0x3f6 */
  81. cf_ide_resources[0].start += (unsigned long)cf_ide_base;
  82. cf_ide_resources[0].end += (unsigned long)cf_ide_base;
  83. cf_ide_resources[1].start += (unsigned long)cf_ide_base;
  84. cf_ide_resources[1].end += (unsigned long)cf_ide_base;
  85. return platform_add_devices(sh03_devices, ARRAY_SIZE(sh03_devices));
  86. }
  87. device_initcall(sh03_devices_setup);
  88. static struct sh_machine_vector mv_sh03 __initmv = {
  89. .mv_name = "Interface (CTP/PCI-SH03)",
  90. .mv_setup = sh03_setup,
  91. .mv_init_irq = init_sh03_IRQ,
  92. };