aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/sibyte/swarm/Makefile3
-rw-r--r--arch/mips/sibyte/swarm/platform.c81
-rw-r--r--drivers/ide/Kconfig4
-rw-r--r--drivers/ide/ide-cd.c6
-rw-r--r--drivers/ide/ide-dma.c2
-rw-r--r--drivers/ide/ide-probe.c2
-rw-r--r--drivers/ide/mips/Makefile1
-rw-r--r--drivers/ide/mips/swarm.c197
-rw-r--r--include/linux/ide.h4
9 files changed, 93 insertions, 207 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);
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 8e93a797c93d..052879a6f853 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -780,10 +780,6 @@ config BLK_DEV_IDEDMA_PMAC
780 to transfer data to and from memory. Saying Y is safe and improves 780 to transfer data to and from memory. Saying Y is safe and improves
781 performance. 781 performance.
782 782
783config BLK_DEV_IDE_SWARM
784 tristate "IDE for Sibyte evaluation boards"
785 depends on SIBYTE_SB1xxx_SOC
786
787config BLK_DEV_IDE_AU1XXX 783config BLK_DEV_IDE_AU1XXX
788 bool "IDE for AMD Alchemy Au1200" 784 bool "IDE for AMD Alchemy Au1200"
789 depends on SOC_AU1200 785 depends on SOC_AU1200
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 49a8c589e346..f16bb4667238 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -1661,7 +1661,9 @@ static int ide_cdrom_probe_capabilities(ide_drive_t *drive)
1661 cdi->mask &= ~CDC_PLAY_AUDIO; 1661 cdi->mask &= ~CDC_PLAY_AUDIO;
1662 1662
1663 mechtype = buf[8 + 6] >> 5; 1663 mechtype = buf[8 + 6] >> 5;
1664 if (mechtype == mechtype_caddy || mechtype == mechtype_popup) 1664 if (mechtype == mechtype_caddy ||
1665 mechtype == mechtype_popup ||
1666 (drive->atapi_flags & IDE_AFLAG_NO_AUTOCLOSE))
1665 cdi->mask |= CDC_CLOSE_TRAY; 1667 cdi->mask |= CDC_CLOSE_TRAY;
1666 1668
1667 if (cdi->sanyo_slot > 0) { 1669 if (cdi->sanyo_slot > 0) {
@@ -1859,6 +1861,8 @@ static const struct cd_list_entry ide_cd_quirks_list[] = {
1859 { "MATSHITADVD-ROM SR-8176", NULL, IDE_AFLAG_PLAY_AUDIO_OK }, 1861 { "MATSHITADVD-ROM SR-8176", NULL, IDE_AFLAG_PLAY_AUDIO_OK },
1860 { "MATSHITADVD-ROM SR-8174", NULL, IDE_AFLAG_PLAY_AUDIO_OK }, 1862 { "MATSHITADVD-ROM SR-8174", NULL, IDE_AFLAG_PLAY_AUDIO_OK },
1861 { "Optiarc DVD RW AD-5200A", NULL, IDE_AFLAG_PLAY_AUDIO_OK }, 1863 { "Optiarc DVD RW AD-5200A", NULL, IDE_AFLAG_PLAY_AUDIO_OK },
1864 { "Optiarc DVD RW AD-7200A", NULL, IDE_AFLAG_PLAY_AUDIO_OK },
1865 { "Optiarc DVD RW AD-7543A", NULL, IDE_AFLAG_NO_AUTOCLOSE },
1862 { NULL, NULL, 0 } 1866 { NULL, NULL, 0 }
1863}; 1867};
1864 1868
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index adc682755857..3fa07c0aeaa4 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -211,7 +211,7 @@ int ide_build_dmatable (ide_drive_t *drive, struct request *rq)
211 xcount = bcount & 0xffff; 211 xcount = bcount & 0xffff;
212 if (is_trm290) 212 if (is_trm290)
213 xcount = ((xcount >> 2) - 1) << 16; 213 xcount = ((xcount >> 2) - 1) << 16;
214 if (xcount == 0x0000) { 214 else if (xcount == 0x0000) {
215 /* 215 /*
216 * Most chipsets correctly interpret a length of 0x0000 as 64KB, 216 * Most chipsets correctly interpret a length of 0x0000 as 64KB,
217 * but at least one (e.g. CS5530) misinterprets it as zero (!). 217 * but at least one (e.g. CS5530) misinterprets it as zero (!).
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c
index 994e41099b42..a51a30e9eab3 100644
--- a/drivers/ide/ide-probe.c
+++ b/drivers/ide/ide-probe.c
@@ -1492,7 +1492,7 @@ static struct device_attribute *ide_port_attrs[] = {
1492 1492
1493static int ide_sysfs_register_port(ide_hwif_t *hwif) 1493static int ide_sysfs_register_port(ide_hwif_t *hwif)
1494{ 1494{
1495 int i, rc; 1495 int i, uninitialized_var(rc);
1496 1496
1497 for (i = 0; ide_port_attrs[i]; i++) { 1497 for (i = 0; ide_port_attrs[i]; i++) {
1498 rc = device_create_file(hwif->portdev, ide_port_attrs[i]); 1498 rc = device_create_file(hwif->portdev, ide_port_attrs[i]);
diff --git a/drivers/ide/mips/Makefile b/drivers/ide/mips/Makefile
index 677c7b2bac92..5873fa0b8769 100644
--- a/drivers/ide/mips/Makefile
+++ b/drivers/ide/mips/Makefile
@@ -1,4 +1,3 @@
1obj-$(CONFIG_BLK_DEV_IDE_SWARM) += swarm.o
2obj-$(CONFIG_BLK_DEV_IDE_AU1XXX) += au1xxx-ide.o 1obj-$(CONFIG_BLK_DEV_IDE_AU1XXX) += au1xxx-ide.o
3 2
4EXTRA_CFLAGS := -Idrivers/ide 3EXTRA_CFLAGS := -Idrivers/ide
diff --git a/drivers/ide/mips/swarm.c b/drivers/ide/mips/swarm.c
deleted file mode 100644
index 39c9ee995857..000000000000
--- a/drivers/ide/mips/swarm.c
+++ /dev/null
@@ -1,197 +0,0 @@
1/*
2 * Copyright (C) 2001, 2002, 2003 Broadcom Corporation
3 * Copyright (C) 2004 MontaVista Software Inc.
4 * Author: Manish Lachwani, mlachwani@mvista.com
5 * Copyright (C) 2004 MIPS Technologies, Inc. All rights reserved.
6 * Author: Maciej W. Rozycki <macro@mips.com>
7 * Copyright (c) 2006, 2008 Maciej W. Rozycki
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */
23
24/*
25 * Derived loosely from ide-pmac.c, so:
26 * Copyright (C) 1998 Paul Mackerras.
27 * Copyright (C) 1995-1998 Mark Lord
28 */
29
30/*
31 * Boards with SiByte processors so far have supported IDE devices via
32 * the Generic Bus, PCI bus, and built-in PCMCIA interface. In all
33 * cases, byte-swapping must be avoided for these devices (whereas
34 * other PCI devices, for example, will require swapping). Any
35 * SiByte-targetted kernel including IDE support will include this
36 * file. Probing of a Generic Bus for an IDE device is controlled by
37 * the definition of "SIBYTE_HAVE_IDE", which is provided by
38 * <asm/sibyte/board.h> for Broadcom boards.
39 */
40
41#include <linux/ide.h>
42#include <linux/ioport.h>
43#include <linux/kernel.h>
44#include <linux/types.h>
45#include <linux/platform_device.h>
46
47#include <asm/io.h>
48
49#include <asm/sibyte/board.h>
50#include <asm/sibyte/sb1250_genbus.h>
51#include <asm/sibyte/sb1250_regs.h>
52
53#define DRV_NAME "ide-swarm"
54
55static char swarm_ide_string[] = DRV_NAME;
56
57static struct resource swarm_ide_resource = {
58 .name = "SWARM GenBus IDE",
59 .flags = IORESOURCE_MEM,
60};
61
62static struct platform_device *swarm_ide_dev;
63
64static const struct ide_port_info swarm_port_info = {
65 .name = DRV_NAME,
66 .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
67};
68
69/*
70 * swarm_ide_probe - if the board header indicates the existence of
71 * Generic Bus IDE, allocate a HWIF for it.
72 */
73static int __devinit swarm_ide_probe(struct device *dev)
74{
75 u8 __iomem *base;
76 struct ide_host *host;
77 phys_t offset, size;
78 int i, rc;
79 hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
80
81 if (!SIBYTE_HAVE_IDE)
82 return -ENODEV;
83
84 base = ioremap(A_IO_EXT_BASE, 0x800);
85 offset = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_START_ADDR, IDE_CS));
86 size = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_MULT_SIZE, IDE_CS));
87 iounmap(base);
88
89 offset = G_IO_START_ADDR(offset) << S_IO_ADDRBASE;
90 size = (G_IO_MULT_SIZE(size) + 1) << S_IO_REGSIZE;
91 if (offset < A_PHYS_GENBUS || offset >= A_PHYS_GENBUS_END) {
92 printk(KERN_INFO DRV_NAME
93 ": IDE interface at GenBus disabled\n");
94 return -EBUSY;
95 }
96
97 printk(KERN_INFO DRV_NAME ": IDE interface at GenBus slot %i\n",
98 IDE_CS);
99
100 swarm_ide_resource.start = offset;
101 swarm_ide_resource.end = offset + size - 1;
102 if (request_resource(&iomem_resource, &swarm_ide_resource)) {
103 printk(KERN_ERR DRV_NAME
104 ": can't request I/O memory resource\n");
105 return -EBUSY;
106 }
107
108 base = ioremap(offset, size);
109
110 memset(&hw, 0, sizeof(hw));
111 for (i = 0; i <= 7; i++)
112 hw.io_ports_array[i] =
113 (unsigned long)(base + ((0x1f0 + i) << 5));
114 hw.io_ports.ctl_addr =
115 (unsigned long)(base + (0x3f6 << 5));
116 hw.irq = K_INT_GB_IDE;
117 hw.chipset = ide_generic;
118
119 rc = ide_host_add(&swarm_port_info, hws, &host);
120 if (rc)
121 goto err;
122
123 dev_set_drvdata(dev, host);
124
125 return 0;
126err:
127 release_resource(&swarm_ide_resource);
128 iounmap(base);
129 return rc;
130}
131
132static struct device_driver swarm_ide_driver = {
133 .name = swarm_ide_string,
134 .bus = &platform_bus_type,
135 .probe = swarm_ide_probe,
136};
137
138static void swarm_ide_platform_release(struct device *device)
139{
140 struct platform_device *pldev;
141
142 /* free device */
143 pldev = to_platform_device(device);
144 kfree(pldev);
145}
146
147static int __devinit swarm_ide_init_module(void)
148{
149 struct platform_device *pldev;
150 int err;
151
152 printk(KERN_INFO "SWARM IDE driver\n");
153
154 if (driver_register(&swarm_ide_driver)) {
155 printk(KERN_ERR "Driver registration failed\n");
156 err = -ENODEV;
157 goto out;
158 }
159
160 if (!(pldev = kzalloc(sizeof (*pldev), GFP_KERNEL))) {
161 err = -ENOMEM;
162 goto out_unregister_driver;
163 }
164
165 pldev->name = swarm_ide_string;
166 pldev->id = 0;
167 pldev->dev.release = swarm_ide_platform_release;
168
169 if (platform_device_register(pldev)) {
170 err = -ENODEV;
171 goto out_free_pldev;
172 }
173
174 if (!pldev->dev.driver) {
175 /*
176 * The driver was not bound to this device, there was
177 * no hardware at this address. Unregister it, as the
178 * release fuction will take care of freeing the
179 * allocated structure
180 */
181 platform_device_unregister (pldev);
182 }
183
184 swarm_ide_dev = pldev;
185
186 return 0;
187
188out_free_pldev:
189 kfree(pldev);
190
191out_unregister_driver:
192 driver_unregister(&swarm_ide_driver);
193out:
194 return err;
195}
196
197module_init(swarm_ide_init_module);
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 1524829f73f2..6514db8fd2e4 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -366,7 +366,9 @@ enum {
366 /* Currently on a filemark */ 366 /* Currently on a filemark */
367 IDE_AFLAG_FILEMARK = (1 << 25), 367 IDE_AFLAG_FILEMARK = (1 << 25),
368 /* 0 = no tape is loaded, so we don't rewind after ejecting */ 368 /* 0 = no tape is loaded, so we don't rewind after ejecting */
369 IDE_AFLAG_MEDIUM_PRESENT = (1 << 26) 369 IDE_AFLAG_MEDIUM_PRESENT = (1 << 26),
370
371 IDE_AFLAG_NO_AUTOCLOSE = (1 << 27),
370}; 372};
371 373
372struct ide_drive_s { 374struct ide_drive_s {