setup.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. static struct resource cf_ide_resources[] = {
  23. [0] = {
  24. .start = 0x1f0,
  25. .end = 0x1f0 + 8,
  26. .flags = IORESOURCE_IO,
  27. },
  28. [1] = {
  29. .start = 0x1f0 + 0x206,
  30. .end = 0x1f0 +8 + 0x206 + 8,
  31. .flags = IORESOURCE_IO,
  32. },
  33. [2] = {
  34. .start = IRL2_IRQ,
  35. .flags = IORESOURCE_IRQ,
  36. },
  37. };
  38. static struct platform_device cf_ide_device = {
  39. .name = "pata_platform",
  40. .id = -1,
  41. .num_resources = ARRAY_SIZE(cf_ide_resources),
  42. .resource = cf_ide_resources,
  43. };
  44. static struct resource heartbeat_resources[] = {
  45. [0] = {
  46. .start = 0xa0800000,
  47. .end = 0xa0800000,
  48. .flags = IORESOURCE_MEM,
  49. },
  50. };
  51. static struct platform_device heartbeat_device = {
  52. .name = "heartbeat",
  53. .id = -1,
  54. .num_resources = ARRAY_SIZE(heartbeat_resources),
  55. .resource = heartbeat_resources,
  56. };
  57. static struct platform_device *sh03_devices[] __initdata = {
  58. &heartbeat_device,
  59. &cf_ide_device,
  60. };
  61. static int __init sh03_devices_setup(void)
  62. {
  63. pgprot_t prot;
  64. unsigned long paddrbase;
  65. void *cf_ide_base;
  66. /* open I/O area window */
  67. paddrbase = virt_to_phys((void *)PA_AREA5_IO);
  68. prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16);
  69. cf_ide_base = ioremap_prot(paddrbase, PAGE_SIZE, pgprot_val(prot));
  70. if (!cf_ide_base) {
  71. printk("allocate_cf_area : can't open CF I/O window!\n");
  72. return -ENOMEM;
  73. }
  74. /* IDE cmd address : 0x1f0-0x1f7 and 0x3f6 */
  75. cf_ide_resources[0].start += (unsigned long)cf_ide_base;
  76. cf_ide_resources[0].end += (unsigned long)cf_ide_base;
  77. cf_ide_resources[1].start += (unsigned long)cf_ide_base;
  78. cf_ide_resources[1].end += (unsigned long)cf_ide_base;
  79. return platform_add_devices(sh03_devices, ARRAY_SIZE(sh03_devices));
  80. }
  81. device_initcall(sh03_devices_setup);
  82. static struct sh_machine_vector mv_sh03 __initmv = {
  83. .mv_name = "Interface (CTP/PCI-SH03)",
  84. .mv_init_irq = init_sh03_IRQ,
  85. };