setup.c 2.4 KB

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