bast-ide.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /* linux/arch/arm/mach-s3c2410/bast-ide.c
  2. *
  3. * Copyright 2007 Simtec Electronics
  4. * http://www.simtec.co.uk/products/EB2410ITX/
  5. * http://armlinux.simtec.co.uk/
  6. * Ben Dooks <ben@simtec.co.uk>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <linux/kernel.h>
  13. #include <linux/types.h>
  14. #include <linux/init.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/ata_platform.h>
  18. #include <asm/mach-types.h>
  19. #include <asm/mach/arch.h>
  20. #include <asm/mach/map.h>
  21. #include <asm/mach/irq.h>
  22. #include <mach/map.h>
  23. #include <mach/bast-map.h>
  24. #include <mach/bast-irq.h>
  25. /* IDE ports */
  26. static struct pata_platform_info bast_ide_platdata = {
  27. .ioport_shift = 5,
  28. };
  29. #define IDE_CS S3C2410_CS5
  30. static struct resource bast_ide0_resource[] = {
  31. [0] = {
  32. .start = IDE_CS + BAST_PA_IDEPRI,
  33. .end = IDE_CS + BAST_PA_IDEPRI + (8 * 0x20) - 1,
  34. .flags = IORESOURCE_MEM,
  35. },
  36. [1] = {
  37. .start = IDE_CS + BAST_PA_IDEPRIAUX + (6 * 0x20) ,
  38. .end = IDE_CS + BAST_PA_IDEPRIAUX + (7 * 0x20) - 1,
  39. .flags = IORESOURCE_MEM,
  40. },
  41. [2] = {
  42. .start = IRQ_IDE0,
  43. .end = IRQ_IDE0,
  44. .flags = IORESOURCE_IRQ,
  45. },
  46. };
  47. static struct platform_device bast_device_ide0 = {
  48. .name = "pata_platform",
  49. .id = 0,
  50. .num_resources = ARRAY_SIZE(bast_ide0_resource),
  51. .resource = bast_ide0_resource,
  52. .dev = {
  53. .platform_data = &bast_ide_platdata,
  54. .coherent_dma_mask = ~0,
  55. }
  56. };
  57. static struct resource bast_ide1_resource[] = {
  58. [0] = {
  59. .start = IDE_CS + BAST_PA_IDESEC,
  60. .end = IDE_CS + BAST_PA_IDESEC + (8 * 0x20) - 1,
  61. .flags = IORESOURCE_MEM,
  62. },
  63. [1] = {
  64. .start = IDE_CS + BAST_PA_IDESECAUX + (6 * 0x20),
  65. .end = IDE_CS + BAST_PA_IDESECAUX + (7 * 0x20) - 1,
  66. .flags = IORESOURCE_MEM,
  67. },
  68. [2] = {
  69. .start = IRQ_IDE1,
  70. .end = IRQ_IDE1,
  71. .flags = IORESOURCE_IRQ,
  72. },
  73. };
  74. static struct platform_device bast_device_ide1 = {
  75. .name = "pata_platform",
  76. .id = 1,
  77. .num_resources = ARRAY_SIZE(bast_ide1_resource),
  78. .resource = bast_ide1_resource,
  79. .dev = {
  80. .platform_data = &bast_ide_platdata,
  81. .coherent_dma_mask = ~0,
  82. }
  83. };
  84. static struct platform_device *bast_ide_devices[] __initdata = {
  85. &bast_device_ide0,
  86. &bast_device_ide1,
  87. };
  88. static __init int bast_ide_init(void)
  89. {
  90. if (machine_is_bast() || machine_is_vr1000())
  91. return platform_add_devices(bast_ide_devices,
  92. ARRAY_SIZE(bast_ide_devices));
  93. return 0;
  94. }
  95. fs_initcall(bast_ide_init);