diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-10-12 09:05:39 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-12 09:05:39 -0400 |
commit | a9b9e81c915e4a57ac3b21d1a7fa7ff184639780 (patch) | |
tree | 98304395fbb5b9c74fca35b196cd414c1949f280 /arch/mips/sibyte/swarm | |
parent | a8b71a2810386a5ac8f43d2095fe3355f0d8db37 (diff) | |
parent | fd048088306656824958e7783ffcee27e241b361 (diff) |
Merge branch 'linus' into x86/memory-corruption-check
Diffstat (limited to 'arch/mips/sibyte/swarm')
-rw-r--r-- | arch/mips/sibyte/swarm/Makefile | 3 | ||||
-rw-r--r-- | arch/mips/sibyte/swarm/platform.c | 85 |
2 files changed, 87 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 @@ | |||
1 | obj-y := setup.o rtc_xicor1241.o rtc_m41t81.o | 1 | obj-y := platform.o setup.o rtc_xicor1241.o \ |
2 | rtc_m41t81.o | ||
2 | 3 | ||
3 | obj-$(CONFIG_I2C_BOARDINFO) += swarm-i2c.o | 4 | obj-$(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..54847fe1e564 --- /dev/null +++ b/arch/mips/sibyte/swarm/platform.c | |||
@@ -0,0 +1,85 @@ | |||
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 | #if defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_LITTLESUR) | ||
13 | |||
14 | #define DRV_NAME "pata-swarm" | ||
15 | |||
16 | #define SWARM_IDE_SHIFT 5 | ||
17 | #define SWARM_IDE_BASE 0x1f0 | ||
18 | #define SWARM_IDE_CTRL 0x3f6 | ||
19 | |||
20 | static struct resource swarm_pata_resource[] = { | ||
21 | { | ||
22 | .name = "Swarm GenBus IDE", | ||
23 | .flags = IORESOURCE_MEM, | ||
24 | }, { | ||
25 | .name = "Swarm GenBus IDE", | ||
26 | .flags = IORESOURCE_MEM, | ||
27 | }, { | ||
28 | .name = "Swarm GenBus IDE", | ||
29 | .flags = IORESOURCE_IRQ, | ||
30 | .start = K_INT_GB_IDE, | ||
31 | .end = K_INT_GB_IDE, | ||
32 | }, | ||
33 | }; | ||
34 | |||
35 | static struct pata_platform_info pata_platform_data = { | ||
36 | .ioport_shift = SWARM_IDE_SHIFT, | ||
37 | }; | ||
38 | |||
39 | static struct platform_device swarm_pata_device = { | ||
40 | .name = "pata_platform", | ||
41 | .id = -1, | ||
42 | .resource = swarm_pata_resource, | ||
43 | .num_resources = ARRAY_SIZE(swarm_pata_resource), | ||
44 | .dev = { | ||
45 | .platform_data = &pata_platform_data, | ||
46 | .coherent_dma_mask = ~0, /* grumble */ | ||
47 | }, | ||
48 | }; | ||
49 | |||
50 | static int __init swarm_pata_init(void) | ||
51 | { | ||
52 | u8 __iomem *base; | ||
53 | phys_t offset, size; | ||
54 | struct resource *r; | ||
55 | |||
56 | if (!SIBYTE_HAVE_IDE) | ||
57 | return -ENODEV; | ||
58 | |||
59 | base = ioremap(A_IO_EXT_BASE, 0x800); | ||
60 | offset = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_START_ADDR, IDE_CS)); | ||
61 | size = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_MULT_SIZE, IDE_CS)); | ||
62 | iounmap(base); | ||
63 | |||
64 | offset = G_IO_START_ADDR(offset) << S_IO_ADDRBASE; | ||
65 | size = (G_IO_MULT_SIZE(size) + 1) << S_IO_REGSIZE; | ||
66 | if (offset < A_PHYS_GENBUS || offset >= A_PHYS_GENBUS_END) { | ||
67 | pr_info(DRV_NAME ": PATA interface at GenBus disabled\n"); | ||
68 | |||
69 | return -EBUSY; | ||
70 | } | ||
71 | |||
72 | pr_info(DRV_NAME ": PATA interface at GenBus slot %i\n", IDE_CS); | ||
73 | |||
74 | r = swarm_pata_resource; | ||
75 | r[0].start = offset + (SWARM_IDE_BASE << SWARM_IDE_SHIFT); | ||
76 | r[0].end = offset + ((SWARM_IDE_BASE + 8) << SWARM_IDE_SHIFT) - 1; | ||
77 | r[1].start = offset + (SWARM_IDE_CTRL << SWARM_IDE_SHIFT); | ||
78 | r[1].end = offset + ((SWARM_IDE_CTRL + 1) << SWARM_IDE_SHIFT) - 1; | ||
79 | |||
80 | return platform_device_register(&swarm_pata_device); | ||
81 | } | ||
82 | |||
83 | device_initcall(swarm_pata_init); | ||
84 | |||
85 | #endif /* defined(CONFIG_SIBYTE_SWARM) || defined(CONFIG_SIBYTE_LITTLESUR) */ | ||