aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-06 17:27:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-06 17:27:57 -0400
commitf1ea7254726d25a333056619ec6b1a8ee1b7358d (patch)
treead0a6307890595172406fda45ec763f7a6bb8686 /arch
parentba9b0c11285bcdaa3243c4123e924094b626c740 (diff)
parentca09a237b8c6b053e101a4a83bc30d2c48435bd5 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: ide: workaround for bogus gcc warning in ide_sysfs_register_port() ide-cd: Optiarc DVD RW AD-7200A does play audio IDE: Fix platform device registration in Swarm IDE driver (v2) ide-dma: fix ide_build_dmatable() for TRM290 ide-cd: temporary tray close fix
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/sibyte/swarm/Makefile3
-rw-r--r--arch/mips/sibyte/swarm/platform.c81
2 files changed, 83 insertions, 1 deletions
diff --git a/arch/mips/sibyte/swarm/Makefile b/arch/mips/sibyte/swarm/Makefile
index f18ba9201bbc..7b45f199d92a 100644
--- a/arch/mips/sibyte/swarm/Makefile
+++ b/arch/mips/sibyte/swarm/Makefile
@@ -1,3 +1,4 @@
1obj-y := setup.o rtc_xicor1241.o rtc_m41t81.o 1obj-y := platform.o setup.o rtc_xicor1241.o \
2 rtc_m41t81.o
2 3
3obj-$(CONFIG_I2C_BOARDINFO) += swarm-i2c.o 4obj-$(CONFIG_I2C_BOARDINFO) += swarm-i2c.o
diff --git a/arch/mips/sibyte/swarm/platform.c b/arch/mips/sibyte/swarm/platform.c
new file mode 100644
index 000000000000..dd0e5b9b64e8
--- /dev/null
+++ b/arch/mips/sibyte/swarm/platform.c
@@ -0,0 +1,81 @@
1#include <linux/err.h>
2#include <linux/kernel.h>
3#include <linux/init.h>
4#include <linux/io.h>
5#include <linux/platform_device.h>
6#include <linux/ata_platform.h>
7
8#include <asm/sibyte/board.h>
9#include <asm/sibyte/sb1250_genbus.h>
10#include <asm/sibyte/sb1250_regs.h>
11
12#define DRV_NAME "pata-swarm"
13
14#define SWARM_IDE_SHIFT 5
15#define SWARM_IDE_BASE 0x1f0
16#define SWARM_IDE_CTRL 0x3f6
17
18static struct resource swarm_pata_resource[] = {
19 {
20 .name = "Swarm GenBus IDE",
21 .flags = IORESOURCE_MEM,
22 }, {
23 .name = "Swarm GenBus IDE",
24 .flags = IORESOURCE_MEM,
25 }, {
26 .name = "Swarm GenBus IDE",
27 .flags = IORESOURCE_IRQ,
28 .start = K_INT_GB_IDE,
29 .end = K_INT_GB_IDE,
30 },
31};
32
33static struct pata_platform_info pata_platform_data = {
34 .ioport_shift = SWARM_IDE_SHIFT,
35};
36
37static struct platform_device swarm_pata_device = {
38 .name = "pata_platform",
39 .id = -1,
40 .resource = swarm_pata_resource,
41 .num_resources = ARRAY_SIZE(swarm_pata_resource),
42 .dev = {
43 .platform_data = &pata_platform_data,
44 .coherent_dma_mask = ~0, /* grumble */
45 },
46};
47
48static int __init swarm_pata_init(void)
49{
50 u8 __iomem *base;
51 phys_t offset, size;
52 struct resource *r;
53
54 if (!SIBYTE_HAVE_IDE)
55 return -ENODEV;
56
57 base = ioremap(A_IO_EXT_BASE, 0x800);
58 offset = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_START_ADDR, IDE_CS));
59 size = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_MULT_SIZE, IDE_CS));
60 iounmap(base);
61
62 offset = G_IO_START_ADDR(offset) << S_IO_ADDRBASE;
63 size = (G_IO_MULT_SIZE(size) + 1) << S_IO_REGSIZE;
64 if (offset < A_PHYS_GENBUS || offset >= A_PHYS_GENBUS_END) {
65 pr_info(DRV_NAME ": PATA interface at GenBus disabled\n");
66
67 return -EBUSY;
68 }
69
70 pr_info(DRV_NAME ": PATA interface at GenBus slot %i\n", IDE_CS);
71
72 r = swarm_pata_resource;
73 r[0].start = offset + (SWARM_IDE_BASE << SWARM_IDE_SHIFT);
74 r[0].end = offset + ((SWARM_IDE_BASE + 8) << SWARM_IDE_SHIFT) - 1;
75 r[1].start = offset + (SWARM_IDE_CTRL << SWARM_IDE_SHIFT);
76 r[1].end = offset + ((SWARM_IDE_CTRL + 1) << SWARM_IDE_SHIFT) - 1;
77
78 return platform_device_register(&swarm_pata_device);
79}
80
81device_initcall(swarm_pata_init);