setup.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * arch/sh/boards/landisk/setup.c
  3. *
  4. * I-O DATA Device, Inc. LANDISK Support.
  5. *
  6. * Copyright (C) 2000 Kazumoto Kojima
  7. * Copyright (C) 2002 Paul Mundt
  8. * Copylight (C) 2002 Atom Create Engineering Co., Ltd.
  9. * Copyright (C) 2005-2007 kogiidena
  10. *
  11. * This file is subject to the terms and conditions of the GNU General Public
  12. * License. See the file "COPYING" in the main directory of this archive
  13. * for more details.
  14. */
  15. #include <linux/init.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/pata_platform.h>
  18. #include <linux/pm.h>
  19. #include <linux/mm.h>
  20. #include <asm/machvec.h>
  21. #include <asm/landisk/iodata_landisk.h>
  22. #include <asm/io.h>
  23. void init_landisk_IRQ(void);
  24. static void landisk_power_off(void)
  25. {
  26. ctrl_outb(0x01, PA_SHUTDOWN);
  27. }
  28. static struct resource cf_ide_resources[3];
  29. static struct pata_platform_info pata_info = {
  30. .ioport_shift = 1,
  31. };
  32. static struct platform_device cf_ide_device = {
  33. .name = "pata_platform",
  34. .id = -1,
  35. .num_resources = ARRAY_SIZE(cf_ide_resources),
  36. .resource = cf_ide_resources,
  37. .dev = {
  38. .platform_data = &pata_info,
  39. },
  40. };
  41. static struct platform_device *landisk_devices[] __initdata = {
  42. &cf_ide_device,
  43. };
  44. static int __init landisk_devices_setup(void)
  45. {
  46. pgprot_t prot;
  47. unsigned long paddrbase;
  48. void *cf_ide_base;
  49. /* open I/O area window */
  50. paddrbase = virt_to_phys((void *)PA_AREA5_IO);
  51. prot = PAGE_KERNEL_PCC(1, _PAGE_PCC_IO16);
  52. cf_ide_base = p3_ioremap(paddrbase, PAGE_SIZE, prot.pgprot);
  53. if (!cf_ide_base) {
  54. printk("allocate_cf_area : can't open CF I/O window!\n");
  55. return -ENOMEM;
  56. }
  57. /* IDE cmd address : 0x1f0-0x1f7 and 0x3f6 */
  58. cf_ide_resources[0].start = (unsigned long)cf_ide_base + 0x40;
  59. cf_ide_resources[0].end = (unsigned long)cf_ide_base + 0x40 + 0x0f;
  60. cf_ide_resources[0].flags = IORESOURCE_IO;
  61. cf_ide_resources[1].start = (unsigned long)cf_ide_base + 0x2c;
  62. cf_ide_resources[1].end = (unsigned long)cf_ide_base + 0x2c + 0x03;
  63. cf_ide_resources[1].flags = IORESOURCE_IO;
  64. cf_ide_resources[2].start = IRQ_FATA;
  65. cf_ide_resources[2].flags = IORESOURCE_IRQ;
  66. return platform_add_devices(landisk_devices,
  67. ARRAY_SIZE(landisk_devices));
  68. }
  69. __initcall(landisk_devices_setup);
  70. static void __init landisk_setup(char **cmdline_p)
  71. {
  72. /* LED ON */
  73. ctrl_outb(ctrl_inb(PA_LED) | 0x03, PA_LED);
  74. printk(KERN_INFO "I-O DATA DEVICE, INC. \"LANDISK Series\" support.\n");
  75. pm_power_off = landisk_power_off;
  76. }
  77. /*
  78. * The Machine Vector
  79. */
  80. struct sh_machine_vector mv_landisk __initmv = {
  81. .mv_name = "LANDISK",
  82. .mv_nr_irqs = 72,
  83. .mv_setup = landisk_setup,
  84. .mv_init_irq = init_landisk_IRQ,
  85. };
  86. ALIAS_MV(landisk)