setup.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. static void __iomem *sh03_ioport_map(unsigned long port, unsigned int size)
  22. {
  23. if (PXSEG(port))
  24. return (void __iomem *)port;
  25. return (void __iomem *)(port + PCI_IO_BASE);
  26. }
  27. /* arch/sh/boards/sh03/rtc.c */
  28. void sh03_time_init(void);
  29. static void __init sh03_setup(char **cmdline_p)
  30. {
  31. board_time_init = sh03_time_init;
  32. }
  33. static struct resource cf_ide_resources[3];
  34. static struct platform_device cf_ide_device = {
  35. .name = "pata_platform",
  36. .id = -1,
  37. .num_resources = ARRAY_SIZE(cf_ide_resources),
  38. .resource = cf_ide_resources,
  39. };
  40. static struct resource heartbeat_resources[] = {
  41. [0] = {
  42. .start = 0xa0800000,
  43. .end = 0xa0800000,
  44. .flags = IORESOURCE_MEM,
  45. },
  46. };
  47. static struct platform_device heartbeat_device = {
  48. .name = "heartbeat",
  49. .id = -1,
  50. .num_resources = ARRAY_SIZE(heartbeat_resources),
  51. .resource = heartbeat_resources,
  52. };
  53. static struct platform_device *sh03_devices[] __initdata = {
  54. &heartbeat_device,
  55. &cf_ide_device,
  56. };
  57. static int __init sh03_devices_setup(void)
  58. {
  59. pgprot_t prot;
  60. unsigned long paddrbase;
  61. void *cf_ide_base;
  62. /* open I/O area window */
  63. paddrbase = virt_to_phys((void *)PA_AREA5_IO);
  64. prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16);
  65. cf_ide_base = p3_ioremap(paddrbase, PAGE_SIZE, prot.pgprot);
  66. if (!cf_ide_base) {
  67. printk("allocate_cf_area : can't open CF I/O window!\n");
  68. return -ENOMEM;
  69. }
  70. /* IDE cmd address : 0x1f0-0x1f7 and 0x3f6 */
  71. cf_ide_resources[0].start = (unsigned long)cf_ide_base + 0x40;
  72. cf_ide_resources[0].end = (unsigned long)cf_ide_base + 0x40 + 0x0f;
  73. cf_ide_resources[0].flags = IORESOURCE_IO;
  74. cf_ide_resources[1].start = (unsigned long)cf_ide_base + 0x2c;
  75. cf_ide_resources[1].end = (unsigned long)cf_ide_base + 0x2c + 0x03;
  76. cf_ide_resources[1].flags = IORESOURCE_IO;
  77. cf_ide_resources[2].start = IRQ_FATA;
  78. cf_ide_resources[2].flags = IORESOURCE_IRQ;
  79. return platform_add_devices(sh03_devices, ARRAY_SIZE(sh03_devices));
  80. }
  81. __initcall(sh03_devices_setup);
  82. static struct sh_machine_vector mv_sh03 __initmv = {
  83. .mv_name = "Interface (CTP/PCI-SH03)",
  84. .mv_setup = sh03_setup,
  85. .mv_nr_irqs = 48,
  86. .mv_ioport_map = sh03_ioport_map,
  87. .mv_init_irq = init_sh03_IRQ,
  88. };