diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-03-08 16:59:54 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-03-08 16:59:54 -0500 |
| commit | 4221b807d1f73c03d22543416d303b60a5d1ef31 (patch) | |
| tree | 5e66f61602ba1896585026c1c41e1782ab8763ba | |
| parent | 3601fe43e8164f67a8de3de8e988bfcb3a94af46 (diff) | |
| parent | 3bac408a8bcaa2b06e44a3a0254ca26b1ca3025a (diff) | |
Merge tag 'for-5.1/libata-20190301' of git://git.kernel.dk/linux-block
Pull libata updates from Jens Axboe:
"Pretty quiet round: a few small fixes, comment typo, and most notably
a low level driver for the PATA Buddha controller"
* tag 'for-5.1/libata-20190301' of git://git.kernel.dk/linux-block:
ata: libahci: Only warn for AHCI_HFLAG_MULTI_MSI set when genuine custom irq handler implemented
libata: fix a typo in comment
ata: macio: Use of_node_name_eq for node name comparisons
ata: pata_samsung_cf: simplify getting .driver_data
ata: pata_platform: Add IRQF_SHARED to IRQ flags
ata: pata_of_platform: Allow to use 16-bit wide data transfer
ata: add Buddha PATA controller driver
| -rw-r--r-- | drivers/ata/Kconfig | 12 | ||||
| -rw-r--r-- | drivers/ata/Makefile | 1 | ||||
| -rw-r--r-- | drivers/ata/libahci.c | 3 | ||||
| -rw-r--r-- | drivers/ata/libata-scsi.c | 2 | ||||
| -rw-r--r-- | drivers/ata/pata_buddha.c | 257 | ||||
| -rw-r--r-- | drivers/ata/pata_macio.c | 2 | ||||
| -rw-r--r-- | drivers/ata/pata_of_platform.c | 6 | ||||
| -rw-r--r-- | drivers/ata/pata_platform.c | 24 | ||||
| -rw-r--r-- | drivers/ata/pata_samsung_cf.c | 8 | ||||
| -rw-r--r-- | include/linux/ata_platform.h | 3 |
10 files changed, 297 insertions, 21 deletions
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 8218db17ebdb..a6beb2c5a692 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
| @@ -963,6 +963,18 @@ config PATA_GAYLE | |||
| 963 | 963 | ||
| 964 | If unsure, say N. | 964 | If unsure, say N. |
| 965 | 965 | ||
| 966 | config PATA_BUDDHA | ||
| 967 | tristate "Buddha/Catweasel/X-Surf PATA support" | ||
| 968 | depends on ZORRO | ||
| 969 | help | ||
| 970 | This option enables support for the IDE interfaces | ||
| 971 | on the Buddha, Catweasel and X-Surf expansion boards | ||
| 972 | on the Zorro expansion bus. It supports up to two | ||
| 973 | interfaces on the Buddha, three on the Catweasel and | ||
| 974 | two on the X-Surf. | ||
| 975 | |||
| 976 | If unsure, say N. | ||
| 977 | |||
| 966 | config PATA_ISAPNP | 978 | config PATA_ISAPNP |
| 967 | tristate "ISA Plug and Play PATA support" | 979 | tristate "ISA Plug and Play PATA support" |
| 968 | depends on ISAPNP | 980 | depends on ISAPNP |
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index d21cdd83f7ab..d8cc2e04a6c7 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile | |||
| @@ -98,6 +98,7 @@ obj-$(CONFIG_PATA_WINBOND) += pata_sl82c105.o | |||
| 98 | obj-$(CONFIG_PATA_CMD640_PCI) += pata_cmd640.o | 98 | obj-$(CONFIG_PATA_CMD640_PCI) += pata_cmd640.o |
| 99 | obj-$(CONFIG_PATA_FALCON) += pata_falcon.o | 99 | obj-$(CONFIG_PATA_FALCON) += pata_falcon.o |
| 100 | obj-$(CONFIG_PATA_GAYLE) += pata_gayle.o | 100 | obj-$(CONFIG_PATA_GAYLE) += pata_gayle.o |
| 101 | obj-$(CONFIG_PATA_BUDDHA) += pata_buddha.o | ||
| 101 | obj-$(CONFIG_PATA_ISAPNP) += pata_isapnp.o | 102 | obj-$(CONFIG_PATA_ISAPNP) += pata_isapnp.o |
| 102 | obj-$(CONFIG_PATA_IXP4XX_CF) += pata_ixp4xx_cf.o | 103 | obj-$(CONFIG_PATA_IXP4XX_CF) += pata_ixp4xx_cf.o |
| 103 | obj-$(CONFIG_PATA_MPIIX) += pata_mpiix.o | 104 | obj-$(CONFIG_PATA_MPIIX) += pata_mpiix.o |
diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c index b5f57c69c487..692782dddc0f 100644 --- a/drivers/ata/libahci.c +++ b/drivers/ata/libahci.c | |||
| @@ -2599,7 +2599,8 @@ int ahci_host_activate(struct ata_host *host, struct scsi_host_template *sht) | |||
| 2599 | int rc; | 2599 | int rc; |
| 2600 | 2600 | ||
| 2601 | if (hpriv->flags & AHCI_HFLAG_MULTI_MSI) { | 2601 | if (hpriv->flags & AHCI_HFLAG_MULTI_MSI) { |
| 2602 | if (hpriv->irq_handler) | 2602 | if (hpriv->irq_handler && |
| 2603 | hpriv->irq_handler != ahci_single_level_irq_intr) | ||
| 2603 | dev_warn(host->dev, | 2604 | dev_warn(host->dev, |
| 2604 | "both AHCI_HFLAG_MULTI_MSI flag set and custom irq handler implemented\n"); | 2605 | "both AHCI_HFLAG_MULTI_MSI flag set and custom irq handler implemented\n"); |
| 2605 | if (!hpriv->get_irq_vector) { | 2606 | if (!hpriv->get_irq_vector) { |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 3d4887d0e84a..c2adfd8486c4 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
| @@ -2990,7 +2990,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc) | |||
| 2990 | * This inconsistency confuses several controllers which | 2990 | * This inconsistency confuses several controllers which |
| 2991 | * perform PIO using DMA such as Intel AHCIs and sil3124/32. | 2991 | * perform PIO using DMA such as Intel AHCIs and sil3124/32. |
| 2992 | * These controllers use actual number of transferred bytes to | 2992 | * These controllers use actual number of transferred bytes to |
| 2993 | * update DMA poitner and transfer of 4n+2 bytes make those | 2993 | * update DMA pointer and transfer of 4n+2 bytes make those |
| 2994 | * controller push DMA pointer by 4n+4 bytes because SATA data | 2994 | * controller push DMA pointer by 4n+4 bytes because SATA data |
| 2995 | * FISes are aligned to 4 bytes. This causes data corruption | 2995 | * FISes are aligned to 4 bytes. This causes data corruption |
| 2996 | * and buffer overrun. | 2996 | * and buffer overrun. |
diff --git a/drivers/ata/pata_buddha.c b/drivers/ata/pata_buddha.c new file mode 100644 index 000000000000..11a8044ff633 --- /dev/null +++ b/drivers/ata/pata_buddha.c | |||
| @@ -0,0 +1,257 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | /* | ||
| 4 | * Buddha, Catweasel and X-Surf PATA controller driver | ||
| 5 | * | ||
| 6 | * Copyright (c) 2018 Samsung Electronics Co., Ltd. | ||
| 7 | * http://www.samsung.com | ||
| 8 | * | ||
| 9 | * Based on buddha.c: | ||
| 10 | * | ||
| 11 | * Copyright (C) 1997, 2001 by Geert Uytterhoeven and others | ||
| 12 | */ | ||
| 13 | |||
| 14 | #include <linux/ata.h> | ||
| 15 | #include <linux/blkdev.h> | ||
| 16 | #include <linux/delay.h> | ||
| 17 | #include <linux/interrupt.h> | ||
| 18 | #include <linux/kernel.h> | ||
| 19 | #include <linux/libata.h> | ||
| 20 | #include <linux/mm.h> | ||
| 21 | #include <linux/module.h> | ||
| 22 | #include <linux/zorro.h> | ||
| 23 | #include <scsi/scsi_cmnd.h> | ||
| 24 | #include <scsi/scsi_host.h> | ||
| 25 | |||
| 26 | #include <asm/amigahw.h> | ||
| 27 | #include <asm/amigaints.h> | ||
| 28 | #include <asm/ide.h> | ||
| 29 | #include <asm/setup.h> | ||
| 30 | |||
| 31 | #define DRV_NAME "pata_buddha" | ||
| 32 | #define DRV_VERSION "0.1.0" | ||
| 33 | |||
| 34 | #define BUDDHA_BASE1 0x800 | ||
| 35 | #define BUDDHA_BASE2 0xa00 | ||
| 36 | #define BUDDHA_BASE3 0xc00 | ||
| 37 | #define XSURF_BASE1 0xb000 /* 2.5" interface */ | ||
| 38 | #define XSURF_BASE2 0xd000 /* 3.5" interface */ | ||
| 39 | #define BUDDHA_CONTROL 0x11a | ||
| 40 | #define BUDDHA_IRQ 0xf00 | ||
| 41 | #define XSURF_IRQ 0x7e | ||
| 42 | #define BUDDHA_IRQ_MR 0xfc0 /* master interrupt enable */ | ||
| 43 | |||
| 44 | enum { | ||
| 45 | BOARD_BUDDHA = 0, | ||
| 46 | BOARD_CATWEASEL, | ||
| 47 | BOARD_XSURF | ||
| 48 | }; | ||
| 49 | |||
| 50 | static unsigned int buddha_bases[3] __initdata = { | ||
| 51 | BUDDHA_BASE1, BUDDHA_BASE2, BUDDHA_BASE3 | ||
| 52 | }; | ||
| 53 | |||
| 54 | static unsigned int xsurf_bases[2] __initdata = { | ||
| 55 | XSURF_BASE1, XSURF_BASE2 | ||
| 56 | }; | ||
| 57 | |||
| 58 | static struct scsi_host_template pata_buddha_sht = { | ||
| 59 | ATA_PIO_SHT(DRV_NAME), | ||
| 60 | }; | ||
| 61 | |||
| 62 | /* FIXME: is this needed? */ | ||
| 63 | static unsigned int pata_buddha_data_xfer(struct ata_queued_cmd *qc, | ||
| 64 | unsigned char *buf, | ||
| 65 | unsigned int buflen, int rw) | ||
| 66 | { | ||
| 67 | struct ata_device *dev = qc->dev; | ||
| 68 | struct ata_port *ap = dev->link->ap; | ||
| 69 | void __iomem *data_addr = ap->ioaddr.data_addr; | ||
| 70 | unsigned int words = buflen >> 1; | ||
| 71 | |||
| 72 | /* Transfer multiple of 2 bytes */ | ||
| 73 | if (rw == READ) | ||
| 74 | raw_insw((u16 *)data_addr, (u16 *)buf, words); | ||
| 75 | else | ||
| 76 | raw_outsw((u16 *)data_addr, (u16 *)buf, words); | ||
| 77 | |||
| 78 | /* Transfer trailing byte, if any. */ | ||
| 79 | if (unlikely(buflen & 0x01)) { | ||
| 80 | unsigned char pad[2] = { }; | ||
| 81 | |||
| 82 | /* Point buf to the tail of buffer */ | ||
| 83 | buf += buflen - 1; | ||
| 84 | |||
| 85 | if (rw == READ) { | ||
| 86 | raw_insw((u16 *)data_addr, (u16 *)pad, 1); | ||
| 87 | *buf = pad[0]; | ||
| 88 | } else { | ||
| 89 | pad[0] = *buf; | ||
| 90 | raw_outsw((u16 *)data_addr, (u16 *)pad, 1); | ||
| 91 | } | ||
| 92 | words++; | ||
| 93 | } | ||
| 94 | |||
| 95 | return words << 1; | ||
| 96 | } | ||
| 97 | |||
| 98 | /* | ||
| 99 | * Provide our own set_mode() as we don't want to change anything that has | ||
| 100 | * already been configured.. | ||
| 101 | */ | ||
| 102 | static int pata_buddha_set_mode(struct ata_link *link, | ||
| 103 | struct ata_device **unused) | ||
| 104 | { | ||
| 105 | struct ata_device *dev; | ||
| 106 | |||
| 107 | ata_for_each_dev(dev, link, ENABLED) { | ||
| 108 | /* We don't really care */ | ||
| 109 | dev->pio_mode = dev->xfer_mode = XFER_PIO_0; | ||
| 110 | dev->xfer_shift = ATA_SHIFT_PIO; | ||
| 111 | dev->flags |= ATA_DFLAG_PIO; | ||
| 112 | ata_dev_info(dev, "configured for PIO\n"); | ||
| 113 | } | ||
| 114 | return 0; | ||
| 115 | } | ||
| 116 | |||
| 117 | static bool pata_buddha_irq_check(struct ata_port *ap) | ||
| 118 | { | ||
| 119 | u8 ch; | ||
| 120 | |||
| 121 | ch = z_readb((unsigned long)ap->private_data); | ||
| 122 | |||
| 123 | return !!(ch & 0x80); | ||
| 124 | } | ||
| 125 | |||
| 126 | static void pata_xsurf_irq_clear(struct ata_port *ap) | ||
| 127 | { | ||
| 128 | z_writeb(0, (unsigned long)ap->private_data); | ||
| 129 | } | ||
| 130 | |||
| 131 | static struct ata_port_operations pata_buddha_ops = { | ||
| 132 | .inherits = &ata_sff_port_ops, | ||
| 133 | .sff_data_xfer = pata_buddha_data_xfer, | ||
| 134 | .sff_irq_check = pata_buddha_irq_check, | ||
| 135 | .cable_detect = ata_cable_unknown, | ||
| 136 | .set_mode = pata_buddha_set_mode, | ||
| 137 | }; | ||
| 138 | |||
| 139 | static struct ata_port_operations pata_xsurf_ops = { | ||
| 140 | .inherits = &ata_sff_port_ops, | ||
| 141 | .sff_data_xfer = pata_buddha_data_xfer, | ||
| 142 | .sff_irq_check = pata_buddha_irq_check, | ||
| 143 | .sff_irq_clear = pata_xsurf_irq_clear, | ||
| 144 | .cable_detect = ata_cable_unknown, | ||
| 145 | .set_mode = pata_buddha_set_mode, | ||
| 146 | }; | ||
| 147 | |||
| 148 | static int __init pata_buddha_init_one(void) | ||
| 149 | { | ||
| 150 | struct zorro_dev *z = NULL; | ||
| 151 | |||
| 152 | while ((z = zorro_find_device(ZORRO_WILDCARD, z))) { | ||
| 153 | static const char *board_name[] | ||
| 154 | = { "Buddha", "Catweasel", "X-Surf" }; | ||
| 155 | struct ata_host *host; | ||
| 156 | void __iomem *buddha_board; | ||
| 157 | unsigned long board; | ||
| 158 | unsigned int type, nr_ports = 2; | ||
| 159 | int i; | ||
| 160 | |||
| 161 | if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_BUDDHA) { | ||
| 162 | type = BOARD_BUDDHA; | ||
| 163 | } else if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_CATWEASEL) { | ||
| 164 | type = BOARD_CATWEASEL; | ||
| 165 | nr_ports++; | ||
| 166 | } else if (z->id == ZORRO_PROD_INDIVIDUAL_COMPUTERS_X_SURF) { | ||
| 167 | type = BOARD_XSURF; | ||
| 168 | } else | ||
| 169 | continue; | ||
| 170 | |||
| 171 | dev_info(&z->dev, "%s IDE controller\n", board_name[type]); | ||
| 172 | |||
| 173 | board = z->resource.start; | ||
| 174 | |||
| 175 | if (type != BOARD_XSURF) { | ||
| 176 | if (!devm_request_mem_region(&z->dev, | ||
| 177 | board + BUDDHA_BASE1, | ||
| 178 | 0x800, DRV_NAME)) | ||
| 179 | continue; | ||
| 180 | } else { | ||
| 181 | if (!devm_request_mem_region(&z->dev, | ||
| 182 | board + XSURF_BASE1, | ||
| 183 | 0x1000, DRV_NAME)) | ||
| 184 | continue; | ||
| 185 | if (!devm_request_mem_region(&z->dev, | ||
| 186 | board + XSURF_BASE2, | ||
| 187 | 0x1000, DRV_NAME)) | ||
| 188 | continue; | ||
| 189 | } | ||
| 190 | |||
| 191 | /* allocate host */ | ||
| 192 | host = ata_host_alloc(&z->dev, nr_ports); | ||
| 193 | if (!host) | ||
| 194 | continue; | ||
| 195 | |||
| 196 | buddha_board = ZTWO_VADDR(board); | ||
| 197 | |||
| 198 | /* enable the board IRQ on Buddha/Catweasel */ | ||
| 199 | if (type != BOARD_XSURF) | ||
| 200 | z_writeb(0, buddha_board + BUDDHA_IRQ_MR); | ||
| 201 | |||
| 202 | for (i = 0; i < nr_ports; i++) { | ||
| 203 | struct ata_port *ap = host->ports[i]; | ||
| 204 | void __iomem *base, *irqport; | ||
| 205 | unsigned long ctl = 0; | ||
| 206 | |||
| 207 | if (type != BOARD_XSURF) { | ||
| 208 | ap->ops = &pata_buddha_ops; | ||
| 209 | base = buddha_board + buddha_bases[i]; | ||
| 210 | ctl = BUDDHA_CONTROL; | ||
| 211 | irqport = buddha_board + BUDDHA_IRQ + i * 0x40; | ||
| 212 | } else { | ||
| 213 | ap->ops = &pata_xsurf_ops; | ||
| 214 | base = buddha_board + xsurf_bases[i]; | ||
| 215 | /* X-Surf has no CS1* (Control/AltStat) */ | ||
| 216 | irqport = buddha_board + XSURF_IRQ; | ||
| 217 | } | ||
| 218 | |||
| 219 | ap->pio_mask = ATA_PIO4; | ||
| 220 | ap->flags |= ATA_FLAG_SLAVE_POSS | ATA_FLAG_NO_IORDY; | ||
| 221 | |||
| 222 | ap->ioaddr.data_addr = base; | ||
| 223 | ap->ioaddr.error_addr = base + 2 + 1 * 4; | ||
| 224 | ap->ioaddr.feature_addr = base + 2 + 1 * 4; | ||
| 225 | ap->ioaddr.nsect_addr = base + 2 + 2 * 4; | ||
| 226 | ap->ioaddr.lbal_addr = base + 2 + 3 * 4; | ||
| 227 | ap->ioaddr.lbam_addr = base + 2 + 4 * 4; | ||
| 228 | ap->ioaddr.lbah_addr = base + 2 + 5 * 4; | ||
| 229 | ap->ioaddr.device_addr = base + 2 + 6 * 4; | ||
| 230 | ap->ioaddr.status_addr = base + 2 + 7 * 4; | ||
| 231 | ap->ioaddr.command_addr = base + 2 + 7 * 4; | ||
| 232 | |||
| 233 | if (ctl) { | ||
| 234 | ap->ioaddr.altstatus_addr = base + ctl; | ||
| 235 | ap->ioaddr.ctl_addr = base + ctl; | ||
| 236 | } | ||
| 237 | |||
| 238 | ap->private_data = (void *)irqport; | ||
| 239 | |||
| 240 | ata_port_desc(ap, "cmd 0x%lx ctl 0x%lx", board, | ||
| 241 | ctl ? board + buddha_bases[i] + ctl : 0); | ||
| 242 | } | ||
| 243 | |||
| 244 | ata_host_activate(host, IRQ_AMIGA_PORTS, ata_sff_interrupt, | ||
| 245 | IRQF_SHARED, &pata_buddha_sht); | ||
| 246 | |||
| 247 | } | ||
| 248 | |||
| 249 | return 0; | ||
| 250 | } | ||
| 251 | |||
| 252 | module_init(pata_buddha_init_one); | ||
| 253 | |||
| 254 | MODULE_AUTHOR("Bartlomiej Zolnierkiewicz"); | ||
| 255 | MODULE_DESCRIPTION("low-level driver for Buddha/Catweasel/X-Surf PATA"); | ||
| 256 | MODULE_LICENSE("GPL v2"); | ||
| 257 | MODULE_VERSION(DRV_VERSION); | ||
diff --git a/drivers/ata/pata_macio.c b/drivers/ata/pata_macio.c index 9e7fc302430f..456ae7184f92 100644 --- a/drivers/ata/pata_macio.c +++ b/drivers/ata/pata_macio.c | |||
| @@ -954,7 +954,7 @@ static void pata_macio_invariants(struct pata_macio_priv *priv) | |||
| 954 | priv->kind = controller_k2_ata6; | 954 | priv->kind = controller_k2_ata6; |
| 955 | priv->timings = pata_macio_kauai_timings; | 955 | priv->timings = pata_macio_kauai_timings; |
| 956 | } else if (of_device_is_compatible(priv->node, "keylargo-ata")) { | 956 | } else if (of_device_is_compatible(priv->node, "keylargo-ata")) { |
| 957 | if (strcmp(priv->node->name, "ata-4") == 0) { | 957 | if (of_node_name_eq(priv->node, "ata-4")) { |
| 958 | priv->kind = controller_kl_ata4; | 958 | priv->kind = controller_kl_ata4; |
| 959 | priv->timings = pata_macio_kl66_timings; | 959 | priv->timings = pata_macio_kl66_timings; |
| 960 | } else { | 960 | } else { |
diff --git a/drivers/ata/pata_of_platform.c b/drivers/ata/pata_of_platform.c index 01161c1aef4d..7a0b1759e5f0 100644 --- a/drivers/ata/pata_of_platform.c +++ b/drivers/ata/pata_of_platform.c | |||
| @@ -32,6 +32,7 @@ static int pata_of_platform_probe(struct platform_device *ofdev) | |||
| 32 | unsigned int reg_shift = 0; | 32 | unsigned int reg_shift = 0; |
| 33 | int pio_mode = 0; | 33 | int pio_mode = 0; |
| 34 | int pio_mask; | 34 | int pio_mask; |
| 35 | bool use16bit; | ||
| 35 | 36 | ||
| 36 | ret = of_address_to_resource(dn, 0, &io_res); | 37 | ret = of_address_to_resource(dn, 0, &io_res); |
| 37 | if (ret) { | 38 | if (ret) { |
| @@ -60,11 +61,14 @@ static int pata_of_platform_probe(struct platform_device *ofdev) | |||
| 60 | dev_info(&ofdev->dev, "pio-mode unspecified, assuming PIO0\n"); | 61 | dev_info(&ofdev->dev, "pio-mode unspecified, assuming PIO0\n"); |
| 61 | } | 62 | } |
| 62 | 63 | ||
| 64 | use16bit = of_property_read_bool(dn, "ata-generic,use16bit"); | ||
| 65 | |||
| 63 | pio_mask = 1 << pio_mode; | 66 | pio_mask = 1 << pio_mode; |
| 64 | pio_mask |= (1 << pio_mode) - 1; | 67 | pio_mask |= (1 << pio_mode) - 1; |
| 65 | 68 | ||
| 66 | return __pata_platform_probe(&ofdev->dev, &io_res, &ctl_res, irq_res, | 69 | return __pata_platform_probe(&ofdev->dev, &io_res, &ctl_res, irq_res, |
| 67 | reg_shift, pio_mask, &pata_platform_sht); | 70 | reg_shift, pio_mask, &pata_platform_sht, |
| 71 | use16bit); | ||
| 68 | } | 72 | } |
| 69 | 73 | ||
| 70 | static const struct of_device_id pata_of_platform_match[] = { | 74 | static const struct of_device_id pata_of_platform_match[] = { |
diff --git a/drivers/ata/pata_platform.c b/drivers/ata/pata_platform.c index d6f8f5406442..5aba691f09af 100644 --- a/drivers/ata/pata_platform.c +++ b/drivers/ata/pata_platform.c | |||
| @@ -47,13 +47,6 @@ static struct scsi_host_template pata_platform_sht = { | |||
| 47 | ATA_PIO_SHT(DRV_NAME), | 47 | ATA_PIO_SHT(DRV_NAME), |
| 48 | }; | 48 | }; |
| 49 | 49 | ||
| 50 | static struct ata_port_operations pata_platform_port_ops = { | ||
| 51 | .inherits = &ata_sff_port_ops, | ||
| 52 | .sff_data_xfer = ata_sff_data_xfer32, | ||
| 53 | .cable_detect = ata_cable_unknown, | ||
| 54 | .set_mode = pata_platform_set_mode, | ||
| 55 | }; | ||
| 56 | |||
| 57 | static void pata_platform_setup_port(struct ata_ioports *ioaddr, | 50 | static void pata_platform_setup_port(struct ata_ioports *ioaddr, |
| 58 | unsigned int shift) | 51 | unsigned int shift) |
| 59 | { | 52 | { |
| @@ -79,6 +72,7 @@ static void pata_platform_setup_port(struct ata_ioports *ioaddr, | |||
| 79 | * @ioport_shift: I/O port shift | 72 | * @ioport_shift: I/O port shift |
| 80 | * @__pio_mask: PIO mask | 73 | * @__pio_mask: PIO mask |
| 81 | * @sht: scsi_host_template to use when registering | 74 | * @sht: scsi_host_template to use when registering |
| 75 | * @use16bit: Flag to indicate 16-bit IO instead of 32-bit | ||
| 82 | * | 76 | * |
| 83 | * Register a platform bus IDE interface. Such interfaces are PIO and we | 77 | * Register a platform bus IDE interface. Such interfaces are PIO and we |
| 84 | * assume do not support IRQ sharing. | 78 | * assume do not support IRQ sharing. |
| @@ -101,7 +95,7 @@ static void pata_platform_setup_port(struct ata_ioports *ioaddr, | |||
| 101 | int __pata_platform_probe(struct device *dev, struct resource *io_res, | 95 | int __pata_platform_probe(struct device *dev, struct resource *io_res, |
| 102 | struct resource *ctl_res, struct resource *irq_res, | 96 | struct resource *ctl_res, struct resource *irq_res, |
| 103 | unsigned int ioport_shift, int __pio_mask, | 97 | unsigned int ioport_shift, int __pio_mask, |
| 104 | struct scsi_host_template *sht) | 98 | struct scsi_host_template *sht, bool use16bit) |
| 105 | { | 99 | { |
| 106 | struct ata_host *host; | 100 | struct ata_host *host; |
| 107 | struct ata_port *ap; | 101 | struct ata_port *ap; |
| @@ -120,7 +114,7 @@ int __pata_platform_probe(struct device *dev, struct resource *io_res, | |||
| 120 | */ | 114 | */ |
| 121 | if (irq_res && irq_res->start > 0) { | 115 | if (irq_res && irq_res->start > 0) { |
| 122 | irq = irq_res->start; | 116 | irq = irq_res->start; |
| 123 | irq_flags = irq_res->flags & IRQF_TRIGGER_MASK; | 117 | irq_flags = (irq_res->flags & IRQF_TRIGGER_MASK) | IRQF_SHARED; |
| 124 | } | 118 | } |
| 125 | 119 | ||
| 126 | /* | 120 | /* |
| @@ -131,7 +125,15 @@ int __pata_platform_probe(struct device *dev, struct resource *io_res, | |||
| 131 | return -ENOMEM; | 125 | return -ENOMEM; |
| 132 | ap = host->ports[0]; | 126 | ap = host->ports[0]; |
| 133 | 127 | ||
| 134 | ap->ops = &pata_platform_port_ops; | 128 | ap->ops = devm_kzalloc(dev, sizeof(*ap->ops), GFP_KERNEL); |
| 129 | ap->ops->inherits = &ata_sff_port_ops; | ||
| 130 | ap->ops->cable_detect = ata_cable_unknown; | ||
| 131 | ap->ops->set_mode = pata_platform_set_mode; | ||
| 132 | if (use16bit) | ||
| 133 | ap->ops->sff_data_xfer = ata_sff_data_xfer; | ||
| 134 | else | ||
| 135 | ap->ops->sff_data_xfer = ata_sff_data_xfer32; | ||
| 136 | |||
| 135 | ap->pio_mask = __pio_mask; | 137 | ap->pio_mask = __pio_mask; |
| 136 | ap->flags |= ATA_FLAG_SLAVE_POSS; | 138 | ap->flags |= ATA_FLAG_SLAVE_POSS; |
| 137 | 139 | ||
| @@ -218,7 +220,7 @@ static int pata_platform_probe(struct platform_device *pdev) | |||
| 218 | 220 | ||
| 219 | return __pata_platform_probe(&pdev->dev, io_res, ctl_res, irq_res, | 221 | return __pata_platform_probe(&pdev->dev, io_res, ctl_res, irq_res, |
| 220 | pp_info ? pp_info->ioport_shift : 0, | 222 | pp_info ? pp_info->ioport_shift : 0, |
| 221 | pio_mask, &pata_platform_sht); | 223 | pio_mask, &pata_platform_sht, false); |
| 222 | } | 224 | } |
| 223 | 225 | ||
| 224 | static struct platform_driver pata_platform_driver = { | 226 | static struct platform_driver pata_platform_driver = { |
diff --git a/drivers/ata/pata_samsung_cf.c b/drivers/ata/pata_samsung_cf.c index f5bd44b8bd63..1dc3361cb5a5 100644 --- a/drivers/ata/pata_samsung_cf.c +++ b/drivers/ata/pata_samsung_cf.c | |||
| @@ -609,17 +609,15 @@ static int __exit pata_s3c_remove(struct platform_device *pdev) | |||
| 609 | #ifdef CONFIG_PM_SLEEP | 609 | #ifdef CONFIG_PM_SLEEP |
| 610 | static int pata_s3c_suspend(struct device *dev) | 610 | static int pata_s3c_suspend(struct device *dev) |
| 611 | { | 611 | { |
| 612 | struct platform_device *pdev = to_platform_device(dev); | 612 | struct ata_host *host = dev_get_drvdata(dev); |
| 613 | struct ata_host *host = platform_get_drvdata(pdev); | ||
| 614 | 613 | ||
| 615 | return ata_host_suspend(host, PMSG_SUSPEND); | 614 | return ata_host_suspend(host, PMSG_SUSPEND); |
| 616 | } | 615 | } |
| 617 | 616 | ||
| 618 | static int pata_s3c_resume(struct device *dev) | 617 | static int pata_s3c_resume(struct device *dev) |
| 619 | { | 618 | { |
| 620 | struct platform_device *pdev = to_platform_device(dev); | 619 | struct ata_host *host = dev_get_drvdata(dev); |
| 621 | struct ata_host *host = platform_get_drvdata(pdev); | 620 | struct s3c_ide_platdata *pdata = dev_get_platdata(dev); |
| 622 | struct s3c_ide_platdata *pdata = dev_get_platdata(&pdev->dev); | ||
| 623 | struct s3c_ide_info *info = host->private_data; | 621 | struct s3c_ide_info *info = host->private_data; |
| 624 | 622 | ||
| 625 | pata_s3c_hwinit(info, pdata); | 623 | pata_s3c_hwinit(info, pdata); |
diff --git a/include/linux/ata_platform.h b/include/linux/ata_platform.h index ff2120215dec..9cafec92282d 100644 --- a/include/linux/ata_platform.h +++ b/include/linux/ata_platform.h | |||
| @@ -19,7 +19,8 @@ extern int __pata_platform_probe(struct device *dev, | |||
| 19 | struct resource *irq_res, | 19 | struct resource *irq_res, |
| 20 | unsigned int ioport_shift, | 20 | unsigned int ioport_shift, |
| 21 | int __pio_mask, | 21 | int __pio_mask, |
| 22 | struct scsi_host_template *sht); | 22 | struct scsi_host_template *sht, |
| 23 | bool use16bit); | ||
| 23 | 24 | ||
| 24 | /* | 25 | /* |
| 25 | * Marvell SATA private data | 26 | * Marvell SATA private data |
