* PATA updates (rebased)
@ 2006-07-04 18:14 alan
2006-07-04 18:14 ` [PATCH 01/24] ata_piix TIME0/TIME1 setup alan
` (2 more replies)
0 siblings, 3 replies; 49+ messages in thread
From: alan @ 2006-07-04 18:14 UTC (permalink / raw)
To: jgarzik; +Cc: akpm, linux-ide
PATA updates rebased onto latest tree
Adds full support for Jmicron controllers including the PATA port which means
you can finally install Linux on a system with the CD on a PATA jmicron port.
Turns on per device speed setting
^ permalink raw reply [flat|nested] 49+ messages in thread* [PATCH 01/24] ata_piix TIME0/TIME1 setup 2006-07-04 18:14 PATA updates (rebased) alan @ 2006-07-04 18:14 ` alan 2006-07-04 18:14 ` [PATCH 02/24] pata_ali - further debug work alan 2006-07-05 12:44 ` PATA updates (rebased) Erik Mouw 2006-07-07 16:07 ` Jeff Garzik 2 siblings, 1 reply; 49+ messages in thread From: alan @ 2006-07-04 18:14 UTC (permalink / raw) To: jgarzik; +Cc: akpm, linux-ide, root, Alan Cox From: root <root@hraefn.swansea.linux.org.uk> We were using PIO 0 setup for PIO 2. Fix the off by one check Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/scsi/ata_piix.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) 4a153b397c817c9115b6a423fcadfaa0e7ad8a76 diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c index 31bc08f..f7893ef 100644 --- a/drivers/scsi/ata_piix.c +++ b/drivers/scsi/ata_piix.c @@ -717,7 +717,7 @@ static void piix_set_piomode (struct ata { 2, 1 }, { 2, 3 }, }; - if (pio > 2) + if (pio >= 2) control |= 1; /* TIME1 enable */ if (ata_pio_need_iordy(adev)) control |= 2; /* IE enable */ -- 1.2.GIT ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 02/24] pata_ali - further debug work 2006-07-04 18:14 ` [PATCH 01/24] ata_piix TIME0/TIME1 setup alan @ 2006-07-04 18:14 ` alan 2006-07-04 18:15 ` [PATCH 03/24] pata_amd - new chips alan 0 siblings, 1 reply; 49+ messages in thread From: alan @ 2006-07-04 18:14 UTC (permalink / raw) To: jgarzik; +Cc: akpm, linux-ide, root, Alan Cox From: root <root@hraefn.swansea.linux.org.uk> Further mode setup work for ALi. Follow BIOS guide for the FIFO setup Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/scsi/pata_ali.c | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-) 7dd0e43445080ca5410c99cc4d6788037cdc9138 diff --git a/drivers/scsi/pata_ali.c b/drivers/scsi/pata_ali.c index 1889551..eacc13b 100644 --- a/drivers/scsi/pata_ali.c +++ b/drivers/scsi/pata_ali.c @@ -34,7 +34,7 @@ #include <linux/dmi.h> #define DRV_NAME "pata_ali" -#define DRV_VERSION "0.6.1" +#define DRV_VERSION "0.6.3" /* * Cable special cases @@ -181,11 +181,12 @@ static void ali_fifo_control(struct ata_ u8 fifo; int shift = 4 * adev->devno; - /* Bits 3:2 (7:6 for slave) control the PIO. 00 is off 01 - is on. The FIFO must not be used for ATAPI. We preserve - BIOS set thresholds */ + /* ATA - FIFO on set nibble to 0x05, ATAPI - FIFO off, set nibble to + 0x00. Not all the docs agree but the behaviour we now use is the + one stated in the BIOS Programming Guide */ + pci_read_config_byte(pdev, pio_fifo, &fifo); - fifo &= ~(0x0C << shift); + fifo &= ~(0x0F << shift); if (on) fifo |= (on << shift); pci_write_config_byte(pdev, pio_fifo, fifo); @@ -261,10 +262,10 @@ static void ali_set_piomode(struct ata_p /* PIO FIFO is only permitted on ATA disk */ if (adev->class != ATA_DEV_ATA) - ali_fifo_control(ap, adev, 0); + ali_fifo_control(ap, adev, 0x00); ali_program_modes(ap, adev, &t, 0); if (adev->class == ATA_DEV_ATA) - ali_fifo_control(ap, adev, 0x04); + ali_fifo_control(ap, adev, 0x05); } @@ -289,6 +290,12 @@ static void ali_set_dmamode(struct ata_p if (adev->dma_mode >= XFER_UDMA_0) { ali_program_modes(ap, adev, NULL, udma_timing[adev->dma_mode - XFER_UDMA_0]); + if (adev->dma_mode >= XFER_UDMA_3) { + u8 reg54; + pci_read_config_byte(pdev, 0x54, ®54); + reg54 |= 1; + pci_write_config_byte(pdev, 0x54, reg54); + } } else { ata_timing_compute(adev, adev->dma_mode, &t, T, 1); if (pair) { -- 1.2.GIT ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 03/24] pata_amd - new chips 2006-07-04 18:14 ` [PATCH 02/24] pata_ali - further debug work alan @ 2006-07-04 18:15 ` alan 2006-07-04 18:17 ` [PATCH 04/24] pata_pcmcia: Make drivers/scsi/pata_pcmcia.c:pcmcia_remove_one() static alan 0 siblings, 1 reply; 49+ messages in thread From: alan @ 2006-07-04 18:15 UTC (permalink / raw) To: jgarzik; +Cc: akpm, linux-ide, root, Alan Cox From: root <root@hraefn.swansea.linux.org.uk> Add PCI identifiers for Nvidia newer chips Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/scsi/pata_amd.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) d2462e58448b854d4ff4f3f8140f99f2cc2158a9 diff --git a/drivers/scsi/pata_amd.c b/drivers/scsi/pata_amd.c index 77f9372..d208581 100644 --- a/drivers/scsi/pata_amd.c +++ b/drivers/scsi/pata_amd.c @@ -25,7 +25,7 @@ #include <linux/libata.h> #define DRV_NAME "pata_amd" -#define DRV_VERSION "0.2.1" +#define DRV_VERSION "0.2.2" /** * timing_setup - shared timing computation and load @@ -674,6 +674,8 @@ static const struct pci_device_id amd[] { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP04_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8 }, { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8 }, { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8 }, + { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8 }, + { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8 }, { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 9 }, { 0, }, }; -- 1.2.GIT ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 04/24] pata_pcmcia: Make drivers/scsi/pata_pcmcia.c:pcmcia_remove_one() static 2006-07-04 18:15 ` [PATCH 03/24] pata_amd - new chips alan @ 2006-07-04 18:17 ` alan 2006-07-04 18:14 ` [PATCH 05/24] pata_ali: Revisions below 0x20 need CD config poking too alan 0 siblings, 1 reply; 49+ messages in thread From: alan @ 2006-07-04 18:17 UTC (permalink / raw) To: jgarzik; +Cc: akpm, linux-ide, root, Adrian Bunk, Alan Cox From: root <root@hraefn.swansea.linux.org.uk> This patch makes a needlessly global function static. Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/scsi/pata_pcmcia.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) fac48280be51547d8841b24d72c48be5eb434769 diff --git a/drivers/scsi/pata_pcmcia.c b/drivers/scsi/pata_pcmcia.c index b078e64..9f630d7 100644 --- a/drivers/scsi/pata_pcmcia.c +++ b/drivers/scsi/pata_pcmcia.c @@ -294,7 +294,7 @@ out1: * cleanup. Also called on module unload for any active devices. */ -void pcmcia_remove_one(struct pcmcia_device *pdev) +static void pcmcia_remove_one(struct pcmcia_device *pdev) { struct ata_pcmcia_info *info = pdev->priv; struct device *dev = &pdev->dev; -- 1.2.GIT ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 05/24] pata_ali: Revisions below 0x20 need CD config poking too 2006-07-04 18:17 ` [PATCH 04/24] pata_pcmcia: Make drivers/scsi/pata_pcmcia.c:pcmcia_remove_one() static alan @ 2006-07-04 18:14 ` alan 2006-07-04 18:14 ` [PATCH 06/24] Sort out MC65 compile for now alan 0 siblings, 1 reply; 49+ messages in thread From: alan @ 2006-07-04 18:14 UTC (permalink / raw) To: jgarzik; +Cc: akpm, linux-ide, root, Alan Cox From: root <root@hraefn.swansea.linux.org.uk> Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/scsi/pata_ali.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) 4592b74f2e12f8da82f18f2ee073907398daaac1 diff --git a/drivers/scsi/pata_ali.c b/drivers/scsi/pata_ali.c index eacc13b..91f00c7 100644 --- a/drivers/scsi/pata_ali.c +++ b/drivers/scsi/pata_ali.c @@ -34,7 +34,7 @@ #include <linux/dmi.h> #define DRV_NAME "pata_ali" -#define DRV_VERSION "0.6.3" +#define DRV_VERSION "0.6.4" /* * Cable special cases @@ -283,6 +283,7 @@ static void ali_set_dmamode(struct ata_p struct ata_device *pair = ata_dev_pair(adev); struct ata_timing t; unsigned long T = 1000000000 / 33333; /* PCI clock based */ + struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); if (adev->class == ATA_DEV_ATA) @@ -627,7 +628,7 @@ static int ali_init_one(struct pci_dev * * via 0x54/55. */ pci_read_config_byte(pdev, 0x53, &tmp); - if (rev == 0x20) + if (rev <= 0x20) tmp &= ~0x02; if (rev == 0xc7) tmp |= 0x03; -- 1.2.GIT ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 06/24] Sort out MC65 compile for now 2006-07-04 18:14 ` [PATCH 05/24] pata_ali: Revisions below 0x20 need CD config poking too alan @ 2006-07-04 18:14 ` alan 2006-07-04 18:15 ` [PATCH 07/24] libata: Fix the host_set hacks and sort out simplex mode alan 0 siblings, 1 reply; 49+ messages in thread From: alan @ 2006-07-04 18:14 UTC (permalink / raw) To: jgarzik; +Cc: akpm, linux-ide, root, Alan Cox From: root <root@hraefn.swansea.linux.org.uk> Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/scsi/pata_amd.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) 1f5d15d9442ff8aabda8e77f1446287e668987a2 diff --git a/drivers/scsi/pata_amd.c b/drivers/scsi/pata_amd.c index d208581..c9e87d0 100644 --- a/drivers/scsi/pata_amd.c +++ b/drivers/scsi/pata_amd.c @@ -675,7 +675,6 @@ static const struct pci_device_id amd[] { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP51_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8 }, { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP55_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8 }, { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8 }, - { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 8 }, { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 9 }, { 0, }, }; -- 1.2.GIT ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 07/24] libata: Fix the host_set hacks and sort out simplex mode 2006-07-04 18:14 ` [PATCH 06/24] Sort out MC65 compile for now alan @ 2006-07-04 18:15 ` alan 2006-07-04 18:15 ` [PATCH 08/24] pata_it821x: Fix pass through alan 2006-07-07 16:15 ` [PATCH 07/24] libata: Fix the host_set hacks and sort out simplex mode Jeff Garzik 0 siblings, 2 replies; 49+ messages in thread From: alan @ 2006-07-04 18:15 UTC (permalink / raw) To: jgarzik; +Cc: akpm, linux-ide, root, Alan Cox From: root <root@hraefn.swansea.linux.org.uk> A host_set and probe_ent now have an "irq2" field which is used for the legacy interface cases. Currently we still check both ports on either IRQ but a little thinking suggests this is only a minor performance glitch that can be fixed later on. Also sorted out the FIXME for making port addresses for legacy ports adjustable by platform. This may not be enough for PA-RISC and other platforms with PCI bridges hung off a different primary bridge. We'll cross that bridge ;) when we come to it. Alan Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/scsi/libata-bmdma.c | 134 ++++++++++++++++------------------- drivers/scsi/libata-core.c | 40 ++++++++-- include/asm-alpha/libata-portmap.h | 12 +++ include/asm-i386/libata-portmap.h | 12 +++ include/asm-x86_64/libata-portmap.h | 12 +++ include/linux/libata.h | 5 + 6 files changed, 135 insertions(+), 80 deletions(-) create mode 100644 include/asm-alpha/libata-portmap.h create mode 100644 include/asm-i386/libata-portmap.h create mode 100644 include/asm-x86_64/libata-portmap.h 1addd5a92018c7ed53756bf84854e1b6b45c2d12 diff --git a/drivers/scsi/libata-bmdma.c b/drivers/scsi/libata-bmdma.c index 004e1a0..b1dfa8c 100644 --- a/drivers/scsi/libata-bmdma.c +++ b/drivers/scsi/libata-bmdma.c @@ -881,7 +881,7 @@ ata_pci_init_native_mode(struct pci_dev if (bmdma) { bmdma += 8; if(inb(bmdma + 2) & 0x80) - probe_ent->host_set_flags |= ATA_HOST_SIMPLEX; + probe_ent->host_set_flags |= ATA_HOST_SIMPLEX; probe_ent->port[p].bmdma_addr = bmdma; } ata_std_ports(&probe_ent->port[p]); @@ -894,45 +894,55 @@ ata_pci_init_native_mode(struct pci_dev static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev, - struct ata_port_info *port, int port_num) + struct ata_port_info **port, int port_mask) { struct ata_probe_ent *probe_ent; - unsigned long bmdma; + unsigned long bmdma = pci_resource_start(pdev, 4); + + int port_num = 0; - probe_ent = ata_probe_ent_alloc(pci_dev_to_dev(pdev), port); + probe_ent = ata_probe_ent_alloc(pci_dev_to_dev(pdev), port[0]); if (!probe_ent) return NULL; probe_ent->legacy_mode = 1; probe_ent->n_ports = 1; - probe_ent->hard_port_no = port_num; - probe_ent->private_data = port->private_data; + probe_ent->hard_port_no = 0; + probe_ent->private_data = port[0]->private_data; - switch(port_num) - { - case 0: - probe_ent->irq = 14; - probe_ent->port[0].cmd_addr = 0x1f0; - probe_ent->port[0].altstatus_addr = - probe_ent->port[0].ctl_addr = 0x3f6; - break; - case 1: - probe_ent->irq = 15; - probe_ent->port[0].cmd_addr = 0x170; - probe_ent->port[0].altstatus_addr = - probe_ent->port[0].ctl_addr = 0x376; - break; + if (port_mask & ATA_PORT_PRIMARY) { + probe_ent->irq = 14; + probe_ent->port[port_num].cmd_addr = ATA_PRIMARY_CMD; + probe_ent->port[port_num].altstatus_addr = + probe_ent->port[port_num].ctl_addr = ATA_PRIMARY_CTL; + if (bmdma) { + probe_ent->port[0].bmdma_addr = bmdma; + if (inb(bmdma + 2) & 0x80) + probe_ent->host_set_flags |= ATA_HOST_SIMPLEX; + } + ata_std_ports(&probe_ent->port[port_num]); + port_num ++; } - - bmdma = pci_resource_start(pdev, 4); - if (bmdma != 0) { - bmdma += 8 * port_num; - probe_ent->port[0].bmdma_addr = bmdma; - if (inb(bmdma + 2) & 0x80) - probe_ent->host_set_flags |= ATA_HOST_SIMPLEX; + if (port_mask & ATA_PORT_SECONDARY) { + if (port_num == 1) + probe_ent->irq2 = 15; + else { + /* Secondary only. IRQ 15 only and "first" port is port 1 */ + probe_ent->irq = 15; + probe_ent->hard_port_no = 1; + } + probe_ent->port[port_num].cmd_addr = ATA_SECONDARY_CMD; + probe_ent->port[port_num].altstatus_addr = + probe_ent->port[port_num].ctl_addr = ATA_SECONDARY_CTL; + port_num ++; + if (bmdma) { + probe_ent->port[port_num].bmdma_addr = bmdma + 8; + if (inb(bmdma + 10) & 0x80) + probe_ent->host_set_flags |= ATA_HOST_SIMPLEX; + } + ata_std_ports(&probe_ent->port[port_num]); + port_num ++; } - ata_std_ports(&probe_ent->port[0]); - return probe_ent; } @@ -951,6 +961,10 @@ static struct ata_probe_ent *ata_pci_ini * regions, sets the dma mask, enables bus master mode, and calls * ata_device_add() * + * ASSUMPTION: + * Nobody makes a single channel controller that appears solely as + * the secondary legacy port on PCI. + * * LOCKING: * Inherited from PCI layer (may sleep). * @@ -961,7 +975,7 @@ static struct ata_probe_ent *ata_pci_ini int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, unsigned int n_ports) { - struct ata_probe_ent *probe_ent = NULL, *probe_ent2 = NULL; + struct ata_probe_ent *probe_ent = NULL; struct ata_port_info *port[2]; u8 tmp8, mask; unsigned int legacy_mode = 0; @@ -1010,35 +1024,34 @@ int ata_pci_init_one (struct pci_dev *pd goto err_out; } - /* FIXME: Should use platform specific mappers for legacy port ranges */ if (legacy_mode) { - if (!request_region(0x1f0, 8, "libata")) { + if (!request_region(ATA_PRIMARY_CMD, 8, "libata")) { struct resource *conflict, res; - res.start = 0x1f0; - res.end = 0x1f0 + 8 - 1; + res.start = ATA_PRIMARY_CMD; + res.end = ATA_PRIMARY_CMD + 8 - 1; conflict = ____request_resource(&ioport_resource, &res); if (!strcmp(conflict->name, "libata")) - legacy_mode |= (1 << 0); + legacy_mode |= ATA_PORT_PRIMARY; else { disable_dev_on_err = 0; - printk(KERN_WARNING "ata: 0x1f0 IDE port busy\n"); + printk(KERN_WARNING "ata: 0x%0X IDE port busy\n", ATA_PRIMARY_CMD); } } else - legacy_mode |= (1 << 0); + legacy_mode |= ATA_PORT_PRIMARY; - if (!request_region(0x170, 8, "libata")) { + if (!request_region(ATA_SECONDARY_CMD, 8, "libata")) { struct resource *conflict, res; - res.start = 0x170; - res.end = 0x170 + 8 - 1; + res.start = ATA_SECONDARY_CMD; + res.end = ATA_SECONDARY_CMD + 8 - 1; conflict = ____request_resource(&ioport_resource, &res); if (!strcmp(conflict->name, "libata")) - legacy_mode |= (1 << 1); + legacy_mode |= ATA_PORT_SECONDARY; else { disable_dev_on_err = 0; - printk(KERN_WARNING "ata: 0x170 IDE port busy\n"); + printk(KERN_WARNING "ata: 0x%X IDE port busy\n", ATA_SECONDARY_CMD); } } else - legacy_mode |= (1 << 1); + legacy_mode |= ATA_PORT_SECONDARY; } /* we have legacy mode, but all ports are unavailable */ @@ -1056,17 +1069,14 @@ int ata_pci_init_one (struct pci_dev *pd goto err_out_regions; if (legacy_mode) { - if (legacy_mode & (1 << 0)) - probe_ent = ata_pci_init_legacy_port(pdev, port[0], 0); - if (legacy_mode & (1 << 1)) - probe_ent2 = ata_pci_init_legacy_port(pdev, port[1], 1); + probe_ent = ata_pci_init_legacy_port(pdev, port, legacy_mode); } else { if (n_ports == 2) probe_ent = ata_pci_init_native_mode(pdev, port, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY); else probe_ent = ata_pci_init_native_mode(pdev, port, ATA_PORT_PRIMARY); } - if (!probe_ent && !probe_ent2) { + if (!probe_ent) { rc = -ENOMEM; goto err_out_regions; } @@ -1074,35 +1084,17 @@ int ata_pci_init_one (struct pci_dev *pd pci_set_master(pdev); /* FIXME: check ata_device_add return */ - if (legacy_mode) { - struct device *dev = &pdev->dev; - struct ata_host_set *host_set = NULL; - - if (legacy_mode & (1 << 0)) { - ata_device_add(probe_ent); - host_set = dev_get_drvdata(dev); - } - - if (legacy_mode & (1 << 1)) { - ata_device_add(probe_ent2); - if (host_set) { - host_set->next = dev_get_drvdata(dev); - dev_set_drvdata(dev, host_set); - } - } - } else - ata_device_add(probe_ent); + ata_device_add(probe_ent); kfree(probe_ent); - kfree(probe_ent2); return 0; err_out_regions: - if (legacy_mode & (1 << 0)) - release_region(0x1f0, 8); - if (legacy_mode & (1 << 1)) - release_region(0x170, 8); + if (legacy_mode & ATA_PORT_PRIMARY) + release_region(ATA_PRIMARY_CMD, 8); + if (legacy_mode & ATA_PORT_SECONDARY) + release_region(ATA_SECONDARY_CMD, 8); pci_release_regions(pdev); err_out: if (disable_dev_on_err) diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index d1c1c30..cc6ae67 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c @@ -5232,6 +5232,7 @@ static void ata_host_init(struct ata_por ap->host_set = host_set; ap->dev = ent->dev; ap->port_no = port_no; + ap->hard_port_no = ent->legacy_mode ? ent->hard_port_no : port_no; ap->pio_mask = ent->pio_mask; @@ -5367,6 +5368,7 @@ int ata_device_add(const struct ata_prob host_set->dev = dev; host_set->n_ports = ent->n_ports; host_set->irq = ent->irq; + host_set->irq2 = ent->irq2; host_set->mmio_base = ent->mmio_base; host_set->private_data = ent->private_data; host_set->ops = ent->port_ops; @@ -5376,16 +5378,23 @@ int ata_device_add(const struct ata_prob for (i = 0; i < ent->n_ports; i++) { struct ata_port *ap; unsigned long xfer_mode_mask; + int irq_line = ent->irq; + ap = ata_host_add(ent, host_set, i); if (!ap) goto err_out; + /* Report the secondary IRQ for second channel legacy */ + if (i == 1 && ent->irq2) + irq_line = ent->irq2; + host_set->ports[i] = ap; xfer_mode_mask =(ap->udma_mask << ATA_SHIFT_UDMA) | (ap->mwdma_mask << ATA_SHIFT_MWDMA) | (ap->pio_mask << ATA_SHIFT_PIO); + /* FIXME: maybe print both IRQ lines ? */ /* print per-port info to dmesg */ ata_port_printk(ap, KERN_INFO, "%cATA max %s cmd 0x%lX " "ctl 0x%lX bmdma 0x%lX irq %lu\n", @@ -5405,7 +5414,7 @@ int ata_device_add(const struct ata_prob if (!count) goto err_free_ret; - /* obtain irq, that is shared between channels */ + /* obtain irq, that may be shared between channels */ rc = request_irq(ent->irq, ent->port_ops->irq_handler, ent->irq_flags, DRV_NAME, host_set); if (rc) { @@ -5414,6 +5423,21 @@ int ata_device_add(const struct ata_prob goto err_out; } + /* do we have a second IRQ for the other channel, eg legacy mode */ + if (ent->irq2) { + /* We will get weird core code crashes later if this is true + so trap it now */ + BUG_ON(ent->irq == ent->irq2); + + rc = request_irq(ent->irq2, ent->port_ops->irq_handler, ent->irq_flags, + DRV_NAME, host_set); + if (rc) { + dev_printk(KERN_ERR, dev, "irq %lu request failed: %d\n", + ent->irq2, rc); + goto err_out; + } + } + /* perform each probe synchronously */ DPRINTK("probe begin\n"); for (i = 0; i < count; i++) { @@ -5574,6 +5598,8 @@ void ata_host_set_remove(struct ata_host ata_port_detach(host_set->ports[i]); free_irq(host_set->irq, host_set); + if (host_set->irq2) + free_irq(host_set->irq2, host_set); for (i = 0; i < host_set->n_ports; i++) { struct ata_port *ap = host_set->ports[i]; @@ -5583,10 +5609,11 @@ void ata_host_set_remove(struct ata_host if ((ap->flags & ATA_FLAG_NO_LEGACY) == 0) { struct ata_ioports *ioaddr = &ap->ioaddr; - if (ioaddr->cmd_addr == 0x1f0) - release_region(0x1f0, 8); - else if (ioaddr->cmd_addr == 0x170) - release_region(0x170, 8); + /* FIXME: Add -ac IDE pci mods to remove these special cases */ + if (ioaddr->cmd_addr == ATA_PRIMARY_CMD) + release_region(ATA_PRIMARY_CMD, 8); + else if (ioaddr->cmd_addr == ATA_SECONDARY_CMD) + release_region(ATA_SECONDARY_CMD, 8); } scsi_host_put(ap->host); @@ -5679,11 +5706,8 @@ void ata_pci_remove_one (struct pci_dev { struct device *dev = pci_dev_to_dev(pdev); struct ata_host_set *host_set = dev_get_drvdata(dev); - struct ata_host_set *host_set2 = host_set->next; ata_host_set_remove(host_set); - if (host_set2) - ata_host_set_remove(host_set2); pci_release_regions(pdev); pci_disable_device(pdev); diff --git a/include/asm-alpha/libata-portmap.h b/include/asm-alpha/libata-portmap.h new file mode 100644 index 0000000..9202fd0 --- /dev/null +++ b/include/asm-alpha/libata-portmap.h @@ -0,0 +1,12 @@ +#ifndef __ASM_GENERIC_LIBATA_PORTMAP_H +#define __ASM_GENERIC_LIBATA_PORTMAP_H + +#define ATA_PRIMARY_CMD 0x1F0 +#define ATA_PRIMARY_CTL 0x3F6 +#define ATA_PRIMARY_IRQ 14 + +#define ATA_SECONDARY_CMD 0x170 +#define ATA_SECONDARY_CTL 0x376 +#define ATA_SECONDARY_IRQ 15 + +#endif diff --git a/include/asm-i386/libata-portmap.h b/include/asm-i386/libata-portmap.h new file mode 100644 index 0000000..9202fd0 --- /dev/null +++ b/include/asm-i386/libata-portmap.h @@ -0,0 +1,12 @@ +#ifndef __ASM_GENERIC_LIBATA_PORTMAP_H +#define __ASM_GENERIC_LIBATA_PORTMAP_H + +#define ATA_PRIMARY_CMD 0x1F0 +#define ATA_PRIMARY_CTL 0x3F6 +#define ATA_PRIMARY_IRQ 14 + +#define ATA_SECONDARY_CMD 0x170 +#define ATA_SECONDARY_CTL 0x376 +#define ATA_SECONDARY_IRQ 15 + +#endif diff --git a/include/asm-x86_64/libata-portmap.h b/include/asm-x86_64/libata-portmap.h new file mode 100644 index 0000000..9202fd0 --- /dev/null +++ b/include/asm-x86_64/libata-portmap.h @@ -0,0 +1,12 @@ +#ifndef __ASM_GENERIC_LIBATA_PORTMAP_H +#define __ASM_GENERIC_LIBATA_PORTMAP_H + +#define ATA_PRIMARY_CMD 0x1F0 +#define ATA_PRIMARY_CTL 0x3F6 +#define ATA_PRIMARY_IRQ 14 + +#define ATA_SECONDARY_CMD 0x170 +#define ATA_SECONDARY_CTL 0x376 +#define ATA_SECONDARY_IRQ 15 + +#endif diff --git a/include/linux/libata.h b/include/linux/libata.h index e5f5697..cf8bfba 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -36,6 +36,8 @@ #include <linux/workqueue.h> #include <scsi/scsi_host.h> +#include <asm/libata-portmap.h> + /* * compile-time options: to be removed as soon as all the drivers are * converted to the new debugging mechanism @@ -340,6 +342,7 @@ struct ata_probe_ent { unsigned int udma_mask; unsigned int legacy_mode; unsigned long irq; + unsigned long irq2; unsigned int irq_flags; unsigned long host_flags; unsigned long host_set_flags; @@ -351,6 +354,7 @@ struct ata_host_set { spinlock_t lock; struct device *dev; unsigned long irq; + unsigned long irq2; void __iomem *mmio_base; unsigned int n_ports; void *private_data; @@ -358,7 +362,6 @@ struct ata_host_set { unsigned long flags; int simplex_claimed; /* Keep seperate in case we ever need to do this locked */ - struct ata_host_set *next; /* for legacy mode */ struct ata_port *ports[0]; }; -- 1.2.GIT ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 08/24] pata_it821x: Fix pass through 2006-07-04 18:15 ` [PATCH 07/24] libata: Fix the host_set hacks and sort out simplex mode alan @ 2006-07-04 18:15 ` alan 2006-07-04 18:14 ` [PATCH 09/24] pci_ids: Add JMicron identifiers as we need them in various drivers and quirks alan 2006-07-07 16:15 ` [PATCH 07/24] libata: Fix the host_set hacks and sort out simplex mode Jeff Garzik 1 sibling, 1 reply; 49+ messages in thread From: alan @ 2006-07-04 18:15 UTC (permalink / raw) To: jgarzik; +Cc: akpm, linux-ide, root, Alan Cox From: root <root@hraefn.swansea.linux.org.uk> Pass through was lacking irq_clear and also had a problem with device selection when a slave device is present Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/scsi/pata_it821x.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) fba593cdc70481724480df71f1a3136340bf0d95 diff --git a/drivers/scsi/pata_it821x.c b/drivers/scsi/pata_it821x.c index 8282f78..b0ebf9c 100644 --- a/drivers/scsi/pata_it821x.c +++ b/drivers/scsi/pata_it821x.c @@ -80,7 +80,7 @@ #define DRV_NAME "pata_it821x" -#define DRV_VERSION "0.3.1" +#define DRV_VERSION "0.3.2" struct it821x_dev { @@ -419,6 +419,7 @@ void it821x_passthru_dev_select(struct a it821x_program(ap, adev, itdev->pio[adev->devno]); itdev->last_device = device; } + ata_std_dev_select(ap, device); } /** @@ -483,11 +484,13 @@ static unsigned int it821x_passthru_qc_i static void it821x_smart_set_mode(struct ata_port *ap) { - int dma_enabled; + int dma_enabled = 0; int i; /* Bits 5 and 6 indicate if DMA is active on master/slave */ - dma_enabled = inb(ap->ioaddr.bmdma_addr + ATA_DMA_CMD); + /* It is possible that BMDMA isn't allocated */ + if (ap->ioaddr.bmdma_addr) + dma_enabled = inb(ap->ioaddr.bmdma_addr + ATA_DMA_CMD); for (i = 0; i < ATA_MAX_DEVICES; i++) { struct ata_device *dev = &ap->device[i]; @@ -737,7 +740,10 @@ static struct ata_port_operations it821x .qc_issue = it821x_passthru_qc_issue_prot, .eng_timeout = ata_eng_timeout, .data_xfer = ata_pio_data_xfer, + + .irq_clear = ata_bmdma_irq_clear, .irq_handler = ata_interrupt, + .port_start = it821x_port_start, .port_stop = it821x_port_stop, .host_stop = ata_host_stop -- 1.2.GIT ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 09/24] pci_ids: Add JMicron identifiers as we need them in various drivers and quirks 2006-07-04 18:15 ` [PATCH 08/24] pata_it821x: Fix pass through alan @ 2006-07-04 18:14 ` alan 2006-07-04 18:14 ` [PATCH 10/24] ahci: Ensure that we don't grab both functions alan 0 siblings, 1 reply; 49+ messages in thread From: alan @ 2006-07-04 18:14 UTC (permalink / raw) To: jgarzik; +Cc: akpm, linux-ide, root, Alan Cox From: root <root@hraefn.swansea.linux.org.uk> now. Signed-off-by: Alan Cox <alan@redhat.com> --- include/linux/pci_ids.h | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) dec51da9fefcc65cccbf99874590a8f35b2a73f7 diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 9ae6b1a..3b167f8 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -2016,6 +2016,13 @@ #define PCI_VENDOR_ID_TDI 0x192E #define PCI_DEVICE_ID_TDI_EHCI 0x0101 +#define PCI_VENDOR_ID_JMICRON 0x197B +#define PCI_DEVICE_ID_JMICRON_JMB360 0x2360 +#define PCI_DEVICE_ID_JMICRON_JMB361 0x2361 +#define PCI_DEVICE_ID_JMICRON_JMB363 0x2363 +#define PCI_DEVICE_ID_JMICRON_JMB365 0x2365 +#define PCI_DEVICE_ID_JMICRON_JMB366 0x2366 +#define PCI_DEVICE_ID_JMICRON_JMB368 0x2368 #define PCI_VENDOR_ID_TEKRAM 0x1de1 #define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29 -- 1.2.GIT ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 10/24] ahci: Ensure that we don't grab both functions 2006-07-04 18:14 ` [PATCH 09/24] pci_ids: Add JMicron identifiers as we need them in various drivers and quirks alan @ 2006-07-04 18:14 ` alan 2006-07-04 18:14 ` [PATCH 11/24] jmicron: Add quirks to force the device into a sane mode alan 0 siblings, 1 reply; 49+ messages in thread From: alan @ 2006-07-04 18:14 UTC (permalink / raw) To: jgarzik; +Cc: akpm, linux-ide, root, Alan Cox From: root <root@hraefn.swansea.linux.org.uk> When we force the chip into dual fn mode so we get PATA and AHCI we must be sure we don't then do anything dumb like try and grab both with the AHCI driver. Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/scsi/ahci.c | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) 6241745ff9aab30eb502b2da46d8cbaaad22716d diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index f059467..1edfade 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c @@ -1323,6 +1323,17 @@ static int ahci_init_one (struct pci_dev if (!printed_version++) dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); + /* JMicron-specific fixup: make sure we're in AHCI mode */ + /* This is protected from races with ata_jmicron by the pci probe + locking */ + if (pdev->vendor == PCI_VENDOR_ID_JMICRON) { + /* AHCI enable, AHCI on function 0 */ + pci_write_config_byte(pdev, 0x41, 0xa1); + /* Function 1 is the PATA controller */ + if (PCI_FUNC(pdev->devfn)) + return -ENODEV; + } + rc = pci_enable_device(pdev); if (rc) return rc; @@ -1378,10 +1389,6 @@ static int ahci_init_one (struct pci_dev if (have_msi) hpriv->flags |= AHCI_FLAG_MSI; - /* JMicron-specific fixup: make sure we're in AHCI mode */ - if (pdev->vendor == 0x197b) - pci_write_config_byte(pdev, 0x41, 0xa1); - /* initialize adapter */ rc = ahci_host_init(probe_ent); if (rc) -- 1.2.GIT ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 11/24] jmicron: Add quirks to force the device into a sane mode 2006-07-04 18:14 ` [PATCH 10/24] ahci: Ensure that we don't grab both functions alan @ 2006-07-04 18:14 ` alan 2006-07-04 18:14 ` [PATCH 12/24] jmicron: Configuration alan 2006-07-07 16:23 ` [PATCH 11/24] jmicron: Add quirks to force the device into a sane mode Jeff Garzik 0 siblings, 2 replies; 49+ messages in thread From: alan @ 2006-07-04 18:14 UTC (permalink / raw) To: jgarzik; +Cc: akpm, linux-ide, root, Alan Cox From: root <root@hraefn.swansea.linux.org.uk> When running with libata we want the device in dual function mode. We must do this early on via a quirk so that the PCI scan of function zero enables function one and it is correctly detected, assigned resources and configured. The ata_jmicron driver then grabs the legacy mapped ports and handles them. Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/pci/quirks.c | 39 ++++++ drivers/scsi/ata_jmicron.c | 266 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 305 insertions(+), 0 deletions(-) create mode 100644 drivers/scsi/ata_jmicron.c 88bb63520c07940596ce43af3d3a47b94f28ecdf diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 4364d79..5f7e0a9 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -1175,6 +1175,45 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_963, quirk_sis_96x_smbus ); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SI, PCI_DEVICE_ID_SI_LPC, quirk_sis_96x_smbus ); +#if defined(CONFIG_SCSI_SATA) || defined(CONFIG_SCSI_SATA_MODULE) + +/* + * If we are using libata we can drive this chip proeprly but must + * do this early on to make the additional device appear during + * the PCI scanning. + */ + +static void __devinit quirk_jmicron_dualfn(struct pci_dev *pdev) +{ + u32 conf; + + if (PCI_FUNC(pdev->devfn)) + return; + + switch(pdev->device) { + case PCI_DEVICE_ID_JMICRON_JMB365: + case PCI_DEVICE_ID_JMICRON_JMB366: + /* Redirect IDE second PATA port to the right spot */ + pci_read_config_dword(pdev, 0x80, &conf); + conf |= (1 << 24); + /* Fall through */ + pci_write_config_dword(pdev, 0x80, conf); + case PCI_DEVICE_ID_JMICRON_JMB361: + case PCI_DEVICE_ID_JMICRON_JMB363: + pci_read_config_dword(pdev, 0x40, &conf); + /* Enable dual function mode, AHCI on fn 0, IDE fn1 */ + /* Set the class codes correctly and then direct IDE 0 */ + conf &= ~0x000F0200; /* Clear bit 9 and 16-19 */ + conf |= 0x00C20002; /* Set bit 1, 17, 22, 23 */ + pci_write_config_dword(pdev, 0x40, conf); + break; + } +} + +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, quirk_jmicron_dualfn); + +#endif + #ifdef CONFIG_X86_IO_APIC static void __init quirk_alder_ioapic(struct pci_dev *pdev) { diff --git a/drivers/scsi/ata_jmicron.c b/drivers/scsi/ata_jmicron.c new file mode 100644 index 0000000..23f362b --- /dev/null +++ b/drivers/scsi/ata_jmicron.c @@ -0,0 +1,266 @@ +/* + * ata_jmicron.c - JMicron ATA driver for non AHCI mode. This drives the + * PATA port of the controller. The SATA ports are + * driven by AHCI in the usual configuration although + * this driver can handle other setups if we need it. + * + * (c) 2006 Red Hat <alan@redhat.com> + */ + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/pci.h> +#include <linux/init.h> +#include <linux/blkdev.h> +#include <linux/delay.h> +#include <linux/device.h> +#include <scsi/scsi_host.h> +#include <linux/libata.h> +#include <linux/ata.h> + +#define DRV_NAME "ata_jmicron" +#define DRV_VERSION "0.1" + +enum port_type { + PORT_PATA0 = 0; + PORT_PATA1 = 1; + PORT_SATA = 2; +} + +/** + * jmicron_pre_reset - check for 40/80 pin + * @ap: Port + * + * Perform the PATA port setup we need. + + * On the Jmicron 361/363 there is a single PATA port that can be mapped + * either as primary or secondary (or neither). We don't do any policy + * and setup here. We assume that has been done by init_one and the + * BIOS. + */ + +static int jmicron_pre_reset(struct ata_port *ap) +{ + struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); + u32 control; + u32 control5; + int port_mask = 1<< (4 * ap->hard_port_no); + int is_sata = 0; + int port = ap->hard_port_no; + port_type port_map[2]; + + /* Check if our port is enabled */ + pci_read_config_dword(pdev, 0x40, &control); + if ((control & port_mask) == 0) + return 0; + + /* There are two basic mappings. One has the two SATA ports merged + as master/slave and the secondary as PATA, the other has only the + SATA port mapped */ + if (control & (1 << 23)) { + port_map[0] = PORT_SATA; + port_map[1] = PORT_PATA0; + } else { + port_map[0] = PORT_SATA; + port_map[1] = PORT_SATA; + } + + /* The 365/366 may have this bit set to map the second PATA port + as the internal primary channel */ + pci_read_config_dword(pdev, 0x80, &control5); + if (control5 & (1<<24)) + port_map[0] == PORT_PATA1; + + /* The two ports may then be logically swapped by the firmware */ + if (control & (1 << 22)) + port = port ^ 1; + + /* + * Now we know which physical port we are talking about we can + * actually do our cable checking etc. Thankfully we don't need + * to do the plumbing for other cases. + */ + switch (port_map[port]) + { + case PORT_PATA0: + if (control & (1 << 5)) + return 0; + if (control & (1 << 3)) /* 40/80 pin primary */ + ap->cbl = ATA_CBL_PATA40; + else + ap->cbl = ATA_CBL_PATA80; + break; + case PORT_PATA1: + /* Bit 21 is set if the port is enabled */ + if ((control5 & (1 << 21)) == 0) + return 0; + if (control5 & (1 << 19)) /* 40/80 pin secondary */ + ap->cbl = ATA_CBL_PATA40; + else + ap->cbl = ATA_CBL_PATA80; + break; + case PORT_SATA: + ap->cbl = ATA_CBL_SATA + break; + } + return ata_std_prereset(ap); +} + +/** + * jmicron_error_handler - Setup and error handler + * @ap: Port to handle + * + * LOCKING: + * None (inherited from caller). + */ + +static void jmicron_error_handler(struct ata_port *ap) +{ + return ata_bmdma_drive_eh(ap, jmicron_pre_reset, ata_std_softreset, NULL, ata_std_postreset); +} + +/* No PIO or DMA methods needed for this device */ + +static struct scsi_host_template jmicron_sht = { + .module = THIS_MODULE, + .name = DRV_NAME, + .ioctl = ata_scsi_ioctl, + .queuecommand = ata_scsi_queuecmd, + .can_queue = ATA_DEF_QUEUE, + .this_id = ATA_SHT_THIS_ID, + .sg_tablesize = LIBATA_MAX_PRD, + /* Special handling needed if you have sector or LBA48 limits */ + .max_sectors = ATA_MAX_SECTORS, + .cmd_per_lun = ATA_SHT_CMD_PER_LUN, + .emulated = ATA_SHT_EMULATED, + .use_clustering = ATA_SHT_USE_CLUSTERING, + .proc_name = DRV_NAME, + .dma_boundary = ATA_DMA_BOUNDARY, + .slave_configure = ata_scsi_slave_config, + /* Use standard CHS mapping rules */ + .bios_param = ata_std_bios_param, +}; + +static const struct ata_port_operations jmicron_ops = { + .port_disable = ata_port_disable, + + /* Task file is PCI ATA format, use helpers */ + .tf_load = ata_tf_load, + .tf_read = ata_tf_read, + .check_status = ata_check_status, + .exec_command = ata_exec_command, + .dev_select = ata_std_dev_select, + + .freeze = ata_bmdma_freeze, + .thaw = ata_bmdma_thaw, + .error_handler = jmicron_error_handler, + .post_internal_cmd = ata_bmdma_post_internal_cmd, + + /* BMDMA handling is PCI ATA format, use helpers */ + .bmdma_setup = ata_bmdma_setup, + .bmdma_start = ata_bmdma_start, + .bmdma_stop = ata_bmdma_stop, + .bmdma_status = ata_bmdma_status, + .qc_prep = ata_qc_prep, + .qc_issue = ata_qc_issue_prot, + .data_xfer = ata_pio_data_xfer, + + /* Timeout handling. Special recovery hooks here */ + .eng_timeout = ata_eng_timeout, + .irq_handler = ata_interrupt, + .irq_clear = ata_bmdma_irq_clear, + + /* Generic PATA PCI ATA helpers */ + .port_start = ata_port_start, + .port_stop = ata_port_stop, + .host_stop = ata_host_stop, +}; + + +/** + * jmicron_init_one - Register Netcell ATA PCI device with kernel services + * @pdev: PCI device to register + * @ent: Entry in jmicron_pci_tbl matching with @pdev + * + * Called from kernel PCI layer. + * + * LOCKING: + * Inherited from PCI layer (may sleep). + * + * RETURNS: + * Zero on success, or -ERRNO value. + */ + +static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) +{ + static struct ata_port_info info = { + .sht = &jmicron_sht, + .host_flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, + + .pio_mask = 0x1f, + .mwdma_mask = 0x07, + .udma_mask = 0x3f, + + .port_ops = &jmicron_ops, + }; + + u32 reg; + + if (id->device_data != 368) { + /* Put the controller into AHCI mode in case the AHCI driver + has not yet been loaded. This can be done with either + function present */ + + /* FIXME: We may want a way to override this in future */ + pci_write_config_byte(pdev, 0x41, 0xa1); + } + + /* PATA controller is fn 0, AHCI is fn 1 */ + if (PCI_FUNC(pdev->devfn) != 1) + return -ENODEV; + + if ( id->device_data == 365 || id->device_data == 366) { + /* The 365/66 have two PATA channels, redirect the second */ + pci_read_config_dword(pdev, 0x80, ®); + reg |= (1 << 24); /* IDE1 to PATA IDE secondary */ + pci_write_config_dword(pdev, 0x80, reg); + } + + return ata_pci_init_one(pdev, port_info, 2); +} + +static const struct pci_device_id jmicron_pci_tbl[] = { + { PCI_DEVICE(PCI_VENDOR_ID_JMICRO, PCI_DEVICE_ID_JMICRON_JMB361), 361}, + { PCI_DEVICE(PCI_VENDOR_ID_JMICRO, PCI_DEVICE_ID_JMICRON_JMB363), 363}, + { PCI_DEVICE(PCI_VENDOR_ID_JMICRO, PCI_DEVICE_ID_JMICRON_JMB365), 365}, + { PCI_DEVICE(PCI_VENDOR_ID_JMICRO, PCI_DEVICE_ID_JMICRON_JMB366), 366}, + { PCI_DEVICE(PCI_VENDOR_ID_JMICRO, PCI_DEVICE_ID_JMICRON_JMB368), 368}, + { } /* terminate list */ +}; + +static struct pci_driver jmicron_pci_driver = { + .name = DRV_NAME, + .id_table = jmicron_pci_tbl, + .probe = jmicron_init_one, + .remove = ata_pci_remove_one, +}; + +static int __init jmicron_init(void) +{ + return pci_register_driver(&jmicron_pci_driver); +} + +static void __exit jmicron_exit(void) +{ + pci_unregister_driver(&jmicron_pci_driver); +} + +module_init(jmicron_init); +module_exit(jmicron_exit); + +MODULE_AUTHOR("Alan Cox"); +MODULE_DESCRIPTION("SCSI low-level driver for Netcell PATA RAID"); +MODULE_LICENSE("GPL"); +MODULE_DEVICE_TABLE(pci, jmicron_pci_tbl); +MODULE_VERSION(DRV_VERSION); + -- 1.2.GIT ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 12/24] jmicron: Configuration 2006-07-04 18:14 ` [PATCH 11/24] jmicron: Add quirks to force the device into a sane mode alan @ 2006-07-04 18:14 ` alan 2006-07-04 18:14 ` [PATCH 13/24] My name is Ingo Molnar, you killed my make allyesconfig, prepare to die alan 2006-07-07 16:23 ` [PATCH 11/24] jmicron: Add quirks to force the device into a sane mode Jeff Garzik 1 sibling, 1 reply; 49+ messages in thread From: alan @ 2006-07-04 18:14 UTC (permalink / raw) To: jgarzik; +Cc: akpm, linux-ide, root, Alan Cox From: root <root@hraefn.swansea.linux.org.uk> Add the new jmicron driver to the configuration options Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/scsi/Kconfig | 8 ++++++++ drivers/scsi/Makefile | 1 + 2 files changed, 9 insertions(+), 0 deletions(-) 32a334dd5c47fb4b5c1ac30357a4e53c83cc3ac2 diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 53fae27..13c5943 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -641,6 +641,14 @@ config SCSI_PATA_IT821X If unsure, say N. +config SCSI_ATA_JMICRON + tristate "JMicron non-AHCI support (Experimental)" + depends on SCSI_SATA && PCI && EXPERIMENTAL + help + This option enables support for Jmicron ATA controllers + when running in non-AHCI mode. Where possible you should + set the configuration for AHCI to get better performance + config SCSI_PATA_LEGACY tristate "Legacy ISA PATA support (Experimental)" depends on SCSI_SATA && PCI && EXPERIMENTAL diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile index 8464997..0031c76 100644 --- a/drivers/scsi/Makefile +++ b/drivers/scsi/Makefile @@ -140,6 +140,7 @@ obj-$(CONFIG_SCSI_PATA_HPT3X3) += libata obj-$(CONFIG_SCSI_PATA_ISAPNP) += libata.o pata_isapnp.o obj-$(CONFIG_SCSI_PATA_IT8172) += libata.o pata_it8172.o obj-$(CONFIG_SCSI_PATA_IT821X) += libata.o pata_it821x.o +obj-$(CONFIG_SCSI_PATA_JMICRON) += libata.o ata_jmicron.o obj-$(CONFIG_SCSI_PATA_NETCELL) += libata.o pata_netcell.o obj-$(CONFIG_SCSI_PATA_NS87410) += libata.o pata_ns87410.o obj-$(CONFIG_SCSI_PATA_OPTI) += libata.o pata_opti.o -- 1.2.GIT ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 13/24] My name is Ingo Molnar, you killed my make allyesconfig, prepare to die 2006-07-04 18:14 ` [PATCH 12/24] jmicron: Configuration alan @ 2006-07-04 18:14 ` alan 2006-07-04 18:15 ` [PATCH 14/24] it821x: Fix the ATAPI autodma setup alan 2006-07-07 16:25 ` [PATCH 13/24] My name is Ingo Molnar, you killed my make allyesconfig, prepare to die Jeff Garzik 0 siblings, 2 replies; 49+ messages in thread From: alan @ 2006-07-04 18:14 UTC (permalink / raw) To: jgarzik; +Cc: akpm, linux-ide, root, Alan Cox From: root <root@hraefn.swansea.linux.org.uk> Teach the qdi driver to be more polite about probing when compiled in so that people who make allyesconfig don't get burned. Alan Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/scsi/pata_qdi.c | 15 +++++++++++++-- 1 files changed, 13 insertions(+), 2 deletions(-) ff61ee478044f481f73c07a392aab7dfdcfee215 diff --git a/drivers/scsi/pata_qdi.c b/drivers/scsi/pata_qdi.c index ca6fef0..f8fc0ef 100644 --- a/drivers/scsi/pata_qdi.c +++ b/drivers/scsi/pata_qdi.c @@ -26,7 +26,7 @@ #include <linux/platform_device.h> #define DRV_NAME "pata_qdi" -#define DRV_VERSION "0.2.3" +#define DRV_VERSION "0.2.4" #define NR_HOST 4 /* Two 6580s */ @@ -41,7 +41,13 @@ struct qdi_data { static struct ata_host_set *qdi_host[NR_HOST]; static struct qdi_data qdi_data[NR_HOST]; -static int nr_qdi_host = 0; +static int nr_qdi_host; + +#ifdef MODULE +static int probe_qdi = 1; +#else +static int probe_qdi; +#endif static void qdi6500_set_piomode(struct ata_port *ap, struct ata_device *adev) { @@ -302,6 +308,9 @@ static __init int qdi_init(void) int ct = 0; int i; + if (probe_qdi == 0) + return; + /* * Check each possible QD65xx base address */ @@ -390,3 +399,5 @@ MODULE_VERSION(DRV_VERSION); module_init(qdi_init); module_exit(qdi_exit); +module_param(probe_qdi, int, 0); + -- 1.2.GIT ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 14/24] it821x: Fix the ATAPI autodma setup 2006-07-04 18:14 ` [PATCH 13/24] My name is Ingo Molnar, you killed my make allyesconfig, prepare to die alan @ 2006-07-04 18:15 ` alan 2006-07-04 18:14 ` [PATCH 15/24] ata_generic - generic BIOS setup SFF ATA driver alan 2006-07-07 16:26 ` [PATCH 14/24] it821x: Fix the ATAPI autodma setup Jeff Garzik 2006-07-07 16:25 ` [PATCH 13/24] My name is Ingo Molnar, you killed my make allyesconfig, prepare to die Jeff Garzik 1 sibling, 2 replies; 49+ messages in thread From: alan @ 2006-07-04 18:15 UTC (permalink / raw) To: jgarzik; +Cc: akpm, linux-ide, root, Alan Cox From: root <root@hraefn.swansea.linux.org.uk> Don't assume atapi dma is defaulted to on. Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/ide/pci/it821x.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) 85cc34b0e65068dedb8370af2086e29625519a6a diff --git a/drivers/ide/pci/it821x.c b/drivers/ide/pci/it821x.c index 38f41b3..5928a09 100644 --- a/drivers/ide/pci/it821x.c +++ b/drivers/ide/pci/it821x.c @@ -650,6 +650,8 @@ static void __devinit init_hwif_it821x(i goto fallback; } ide_set_hwifdata(hwif, idev); + + hwif->atapi_dma = 1; pci_read_config_byte(hwif->pci_dev, 0x50, &conf); if(conf & 1) { -- 1.2.GIT ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 15/24] ata_generic - generic BIOS setup SFF ATA driver 2006-07-04 18:15 ` [PATCH 14/24] it821x: Fix the ATAPI autodma setup alan @ 2006-07-04 18:14 ` alan 2006-07-04 18:15 ` [PATCH 16/24] jmicron: IDE old type driver alan 2006-07-07 16:31 ` [PATCH 15/24] ata_generic - generic BIOS setup SFF ATA driver Jeff Garzik 2006-07-07 16:26 ` [PATCH 14/24] it821x: Fix the ATAPI autodma setup Jeff Garzik 1 sibling, 2 replies; 49+ messages in thread From: alan @ 2006-07-04 18:14 UTC (permalink / raw) To: jgarzik; +Cc: akpm, linux-ide, root, Alan Cox From: root <root@hraefn.swansea.linux.org.uk> Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/scsi/Kconfig | 9 ++ drivers/scsi/Makefile | 2 drivers/scsi/ata_generic.c | 256 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 267 insertions(+), 0 deletions(-) create mode 100644 drivers/scsi/ata_generic.c 9027b93110c628892846cacf1ca9875132e2d83b diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 13c5943..fd6a545 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -577,6 +577,15 @@ config SCSI_PATA_EFAR If unsure, say N. +config SCSI_ATA_GENERIC + tristate "Generic PATA support" + depends on SCSI_SATA && PCI + help + This option enables support for generic BIOS configured + PATA controllers via the new ATA layer + + If unsure, say N. + config SCSI_PATA_HPT366 tristate "HPT 366/368 PATA support (Very Experimental)" depends on SCSI_SATA && PCI && EXPERIMENTAL diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile index 0031c76..3654dab 100644 --- a/drivers/scsi/Makefile +++ b/drivers/scsi/Makefile @@ -174,6 +174,8 @@ obj-$(CONFIG_SCSI_SATA_NV) += libata.o s obj-$(CONFIG_SCSI_SATA_ULI) += libata.o sata_uli.o obj-$(CONFIG_SCSI_SATA_MV) += libata.o sata_mv.o obj-$(CONFIG_SCSI_PDC_ADMA) += libata.o pdc_adma.o +# Should be last but one libata driver +obj-$(CONFIG_SCSI_ATA_GENERIC) += libata.o ata_generic.o # Should be last libata driver obj-$(CONFIG_SCSI_PATA_LEGACY) += libata.o pata_legacy.o obj-$(CONFIG_SCSI_HPTIOP) += hptiop.o diff --git a/drivers/scsi/ata_generic.c b/drivers/scsi/ata_generic.c new file mode 100644 index 0000000..6df7ca5 --- /dev/null +++ b/drivers/scsi/ata_generic.c @@ -0,0 +1,256 @@ +/* + * ata_generic.c - Generic PATA/SATA controller driver. + * Copyright 2005 Red Hat Inc <alan@redhat.com>, all rights reserved. + * + * Elements from ide/pci/generic.c + * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> + * Portions (C) Copyright 2002 Red Hat Inc <alan@redhat.com> + * + * May be copied or modified under the terms of the GNU General Public License + * + * Driver for PCI IDE interfaces implementing the standard bus mastering + * interface functionality. This assumes the BIOS did the drive set up and + * tuning for us. By default we do not grab all IDE class devices as they + * may have other drivers or need fixups to avoid problems. Instead we keep + * a default list of stuff without documentation/driver that appears to + * work. + */ + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/pci.h> +#include <linux/init.h> +#include <linux/blkdev.h> +#include <linux/delay.h> +#include "scsi.h" +#include <scsi/scsi_host.h> +#include <linux/libata.h> + +#define DRV_NAME "ata_generic" +#define DRV_VERSION "0.2.4" + +/* + * A generic parallel ATA driver using libata + */ + +/** + * genpata_pre_reset - probe begin + * @ap: ATA port + * + * Set up cable type and use generic probe init + */ + +static int genpata_pre_reset(struct ata_port *ap) +{ + ap->cbl = ATA_CBL_PATA80; + return ata_std_prereset(ap); +} + + +/** + * genpata_error_handler - Probe specified port on PATA host controller + * @ap: Port to probe + * @classes: + * + * LOCKING: + * None (inherited from caller). + */ + + +static void genpata_error_handler(struct ata_port *ap) +{ + ata_bmdma_drive_eh(ap, genpata_pre_reset, ata_std_softreset, NULL, ata_std_postreset); +} + +/** + * genpata_set_mode - mode setting + * @ap: interface to set up + * + * Use a non standard set_mode function. We don't want to be tuned. + * The BIOS configured everything. Our job is not to fiddle. We + * read the dma enabled bits from the PCI configuration of the device + * and respect them. + */ + +static void genpata_set_mode(struct ata_port *ap) +{ + int dma_enabled = 0; + int i; + + /* Bits 5 and 6 indicate if DMA is active on master/slave */ + if (ap->ioaddr.bmdma_addr) + dma_enabled = inb(ap->ioaddr.bmdma_addr + ATA_DMA_CMD); + + for (i = 0; i < ATA_MAX_DEVICES; i++) { + struct ata_device *dev = &ap->device[i]; + if (ata_dev_enabled(dev)) { + /* We don't really care */ + dev->pio_mode = XFER_PIO_0; + dev->dma_mode = XFER_MW_DMA_0; + /* We do need the right mode information for DMA or PIO + and this comes from the current configuration flags */ + /* FIXME: at some point in the future this should become + a library helper which reads the disk modes from the + disk as well */ + if (dma_enabled & (1 << (5 + i))) { + dev->xfer_mode = XFER_MW_DMA_0; + dev->xfer_shift = ATA_SHIFT_MWDMA; + dev->flags &= ~ATA_DFLAG_PIO; + } else { + dev->xfer_mode = XFER_PIO_0; + dev->xfer_shift = ATA_SHIFT_PIO; + dev->flags |= ATA_DFLAG_PIO; + } + } + } +} + +static struct scsi_host_template genpata_sht = { + .module = THIS_MODULE, + .name = DRV_NAME, + .ioctl = ata_scsi_ioctl, + .queuecommand = ata_scsi_queuecmd, + .can_queue = ATA_DEF_QUEUE, + .this_id = ATA_SHT_THIS_ID, + .sg_tablesize = LIBATA_MAX_PRD, + .max_sectors = ATA_MAX_SECTORS, + .cmd_per_lun = ATA_SHT_CMD_PER_LUN, + .emulated = ATA_SHT_EMULATED, + .use_clustering = ATA_SHT_USE_CLUSTERING, + .proc_name = DRV_NAME, + .dma_boundary = ATA_DMA_BOUNDARY, + .slave_configure = ata_scsi_slave_config, + .bios_param = ata_std_bios_param, +}; + +static struct ata_port_operations genpata_port_ops = { + .set_mode = genpata_set_mode, + + .port_disable = ata_port_disable, + .tf_load = ata_tf_load, + .tf_read = ata_tf_read, + .check_status = ata_check_status, + .exec_command = ata_exec_command, + .dev_select = ata_std_dev_select, + + .bmdma_setup = ata_bmdma_setup, + .bmdma_start = ata_bmdma_start, + .bmdma_stop = ata_bmdma_stop, + .bmdma_status = ata_bmdma_status, + + .data_xfer = ata_pio_data_xfer, + + .freeze = ata_bmdma_freeze, + .thaw = ata_bmdma_thaw, + .error_handler = genpata_error_handler, + .post_internal_cmd = ata_bmdma_post_internal_cmd, + + .qc_prep = ata_qc_prep, + .qc_issue = ata_qc_issue_prot, + .eng_timeout = ata_eng_timeout, + .irq_handler = ata_interrupt, + .irq_clear = ata_bmdma_irq_clear, + + .port_start = ata_port_start, + .port_stop = ata_port_stop, + .host_stop = ata_host_stop +}; + +static int all_generic_ide; /* Set to claim all devices */ + +/** + * pata_generic_init - attach generic IDE + * @dev: PCI device found + * @id: match entry + * + * Called each time a matching IDE interface is found. We check if the + * interface is one we wish to claim and if so we perform any chip + * specific hacks then let the ATA layer do the heavy lifting. + */ + +static int pata_generic_init_one(struct pci_dev *dev, const struct pci_device_id *id) +{ + u16 command; + static struct ata_port_info info = { + .sht = &genpata_sht, + .host_flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, + .pio_mask = 0x1f, + .mwdma_mask = 0x07, + .udma_mask = 0x3f, + .port_ops = &genpata_port_ops + }; + static struct ata_port_info *port_info[2] = { &info, &info }; + + /* Don't use the generic entry unless instructed to do so */ + if (id->driver_data == 1 && all_generic_ide == 0) + return -ENODEV; + + /* Devices that need care */ + if (dev->vendor == PCI_VENDOR_ID_UMC && + dev->device == PCI_DEVICE_ID_UMC_UM8886A && + (!(PCI_FUNC(dev->devfn) & 1))) + return -ENODEV; + + if (dev->vendor == PCI_VENDOR_ID_OPTI && + dev->device == PCI_DEVICE_ID_OPTI_82C558 && + (!(PCI_FUNC(dev->devfn) & 1))) + return -ENODEV; + + /* Don't re-enable devices in generic mode or we will break some + motherboards with disabled and unused IDE controllers */ + pci_read_config_word(dev, PCI_COMMAND, &command); + if (!(command & PCI_COMMAND_IO)) + return -ENODEV; + + if (dev->vendor == PCI_VENDOR_ID_AL) + ata_pci_clear_simplex(dev); + + return ata_pci_init_one(dev, port_info, 2); +} + +static struct pci_device_id pata_generic[] = { + { PCI_DEVICE(PCI_VENDOR_ID_PCTECH, PCI_DEVICE_ID_PCTECH_SAMURAI_IDE), }, + { PCI_DEVICE(PCI_VENDOR_ID_HOLTEK, PCI_DEVICE_ID_HOLTEK_6565), }, + { PCI_DEVICE(PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8673F), }, + { PCI_DEVICE(PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886A), }, + { PCI_DEVICE(PCI_VENDOR_ID_UMC, PCI_DEVICE_ID_UMC_UM8886BF), }, + { PCI_DEVICE(PCI_VENDOR_ID_HINT, PCI_DEVICE_ID_HINT_VXPROII_IDE), }, + { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C561), }, + { PCI_DEVICE(PCI_VENDOR_ID_OPTI, PCI_DEVICE_ID_OPTI_82C558), }, + { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO), }, + { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_1), }, + { PCI_DEVICE(PCI_VENDOR_ID_TOSHIBA,PCI_DEVICE_ID_TOSHIBA_PICCOLO_2), }, + /* Must come last. If you add entries adjust this table appropriately */ + { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_CLASS_STORAGE_IDE << 8, 0xFFFFFF00UL, 1}, + { 0, }, +}; + +static struct pci_driver pata_generic_pci_driver = { + .name = DRV_NAME, + .id_table = pata_generic, + .probe = pata_generic_init_one, + .remove = ata_pci_remove_one +}; + +static int __init pata_generic_init(void) +{ + return pci_module_init(&pata_generic_pci_driver); +} + + +static void __exit pata_generic_exit(void) +{ + pci_unregister_driver(&pata_generic_pci_driver); +} + + +MODULE_AUTHOR("Alan Cox"); +MODULE_DESCRIPTION("low-level driver for generic ATA"); +MODULE_LICENSE("GPL"); +MODULE_DEVICE_TABLE(pci, pata_generic); +MODULE_VERSION(DRV_VERSION); + +module_init(pata_generic_init); +module_exit(pata_generic_exit); + +module_param(all_generic_ide, int, 0); -- 1.2.GIT ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 16/24] jmicron: IDE old type driver. 2006-07-04 18:14 ` [PATCH 15/24] ata_generic - generic BIOS setup SFF ATA driver alan @ 2006-07-04 18:15 ` alan 2006-07-04 18:15 ` [PATCH 17/24] pata_qdi: Fix return code alan 2006-07-07 16:31 ` [PATCH 15/24] ata_generic - generic BIOS setup SFF ATA driver Jeff Garzik 1 sibling, 1 reply; 49+ messages in thread From: alan @ 2006-07-04 18:15 UTC (permalink / raw) To: jgarzik; +Cc: akpm, linux-ide, root, Alan Cox From: root <root@hraefn.swansea.linux.org.uk> Work in progress not yet ready to build/use Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/ide/Kconfig | 6 + drivers/ide/pci/Makefile | 1 drivers/ide/pci/jmicron.c | 280 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 287 insertions(+), 0 deletions(-) create mode 100644 drivers/ide/pci/jmicron.c 095278c3c09dab093965841f758fee7e491f81dc diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index d1266fe..7422ca8 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig @@ -592,6 +592,12 @@ config BLK_DEV_HPT366 ide-probe at boot. It is reported to support DVD II drives, by the manufacturer. +config BLK_DEV_JMICRON + tristate "JMicron JMB36x support" + help + Basic support for the JMicron ATA controllers. For full support + use the libata drivers. + config BLK_DEV_SC1200 tristate "National SCx200 chipset support" help diff --git a/drivers/ide/pci/Makefile b/drivers/ide/pci/Makefile index f35d684..640a54b 100644 --- a/drivers/ide/pci/Makefile +++ b/drivers/ide/pci/Makefile @@ -14,6 +14,7 @@ obj-$(CONFIG_BLK_DEV_HPT366) += hpt366. #obj-$(CONFIG_BLK_DEV_HPT37X) += hpt37x.o obj-$(CONFIG_BLK_DEV_IT8172) += it8172.o obj-$(CONFIG_BLK_DEV_IT821X) += it821x.o +obj-$(CONFIG_BLK_DEV_JMICRON) += jmicron.o obj-$(CONFIG_BLK_DEV_NS87415) += ns87415.o obj-$(CONFIG_BLK_DEV_OPTI621) += opti621.o obj-$(CONFIG_BLK_DEV_PDC202XX_OLD) += pdc202xx_old.o diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c new file mode 100644 index 0000000..b7301f0 --- /dev/null +++ b/drivers/ide/pci/jmicron.c @@ -0,0 +1,280 @@ + +/* + * Copyright (C) 2006 Red Hat <alan@redhat.com> + * + * May be copied or modified under the terms of the GNU General Public License + */ + +#include <linux/config.h> +#include <linux/types.h> +#include <linux/module.h> +#include <linux/pci.h> +#include <linux/delay.h> +#include <linux/hdreg.h> +#include <linux/ide.h> +#include <linux/init.h> + +#include <asm/io.h> + +enum port_type { + PORT_PATA0 = 0; + PORT_PATA1 = 1; + PORT_SATA = 2; +} + +/** + * jmicron_ratemask - Compute available modes + * @drive: IDE drive + * + * Compute the available speeds for the devices on the interface. This + * is all modes to ATA133 clipped by drive cable setup. + */ + +static u8 jmicron_ratemask(ide_drive_t *drive) +{ + u8 mode = 4; + if (!eighty_ninty_three(drive)) + mode = min(mode, (u8)1); + return mode; +} + +/** + * ata66_jmicron - Cable check + * @hwif: IDE port + * + * Return 1 if the cable is 80pin + */ + +static int ata66_jmicron(ide_hwif_t *hwif) +{ + struct pci_dev *pdev = hwif->pci_dev; + + u32 control; + u32 control5; + + int port_mask = 1<< (4 * hwif->channel); + int port = hwif->channel; + port_type port_map[2]; + + /* There are two basic mappings. One has the two SATA ports merged + as master/slave and the secondary as PATA, the other has only the + SATA port mapped */ + if (control & (1 << 23)) { + port_map[0] = PORT_SATA; + port_map[1] = PORT_PATA0; + } else { + port_map[0] = PORT_SATA; + port_map[1] = PORT_SATA; + } + + /* The 365/366 may have this bit set to map the second PATA port + as the internal primary channel */ + pci_read_config_dword(pdev, 0x80, &control5); + if (control5 & (1<<24)) + port_map[0] == PORT_PATA1; + + /* The two ports may then be logically swapped by the firmware */ + if (control & (1 << 22)) + port = port ^ 1; + + /* + * Now we know which physical port we are talking about we can + * actually do our cable checking etc. Thankfully we don't need + * to do the plumbing for other cases. + */ + switch (port_map[port]) + { + case PORT_PATA0: + if (control & (1 << 3)) /* 40/80 pin primary */ + return 1; + else + return 0; + break; + case PORT_PATA1: + if (control5 & (1 << 19)) /* 40/80 pin secondary */ + return 0; + return 1; + case PORT_SATA + return 1; + } +} + +static void jmicron_tuneproc (ide_drive_t *drive, byte mode_wanted) +{ + return; +} + +/** + * config_jmicron_chipset_for_pio - set drive timings + * @drive: drive to tune + * @speed we want + * + */ + +static void config_jmicron_chipset_for_pio (ide_drive_t *drive, byte set_speed) +{ + if (set_speed) + (void) ide_config_drive_speed(drive, speed); +} + +/** + * jmicron_tune_chipset - set controller timings + * @drive: Drive to set up + * @xferspeed: speed we want to achieve + * + * As the JMicron snoops for timings all we actually need to do is + * make sure we don't set an invalid mode. We do need to honour + * the cable detect here. + */ + +static int jmicron_tune_chipset (ide_drive_t *drive, byte xferspeed) +{ + + ide_hwif_t *hwif = drive->hwif; + u8 speed = ide_rate_filter(jmicron_ratemask(drive), xferspeed); + + return ide_config_drive_speed(drive, speed); +} + +/** + * config_chipset_for_dma - configure for DMA + * @drive: drive to configure + * + * As the JMicron snoops for timings all we actually need to do is + * make sure we don't set an invalid mode. + */ + +static int config_chipset_for_dma (ide_drive_t *drive) +{ + u8 speed = ide_dma_speed(drive, jmicron_ratemask(drive)); + + config_jmicron_chipset_for_pio(drive, !speed); + jmicron_tune_chipset(drive, speed); + return ide_dma_enable(drive); +} + +/** + * jmicron_configure_drive_for_dma - set up for DMA transfers + * @drive: drive we are going to set up + * + * As the JMicron snoops for timings all we actually need to do is + * make sure we don't set an invalid mode. + */ + +static int jmicron_config_drive_for_dma (ide_drive_t *drive) +{ + ide_hwif_t *hwif = drive->hwif; + + if (ide_use_dma(drive)) { + if (config_chipset_for_dma(drive)) + return hwif->ide_dma_on(drive); + } + config_jmicron_chipset_for_pio(drive, 1); + return hwif->ide_dma_off_quietly(drive); +} + +/** + * ata66_jmicron - check for 80 pin cable + * @hwif: interface to check + * + */ + +static unsigned int __devinit ata66_jmicron(ide_hwif_t *hwif) +{ +} + +/** + * init_hwif_jmicron - set up hwif structs + * @hwif: interface to set up + * + * Minimal set up is required for the Jmicron hardware. + */ + +static void __devinit init_hwif_jmicron(ide_hwif_t *hwif) +{ + hwif->speedproc = &jmicron_tune_chipset; + hwif->tuneproc = &jmicron_tuneproc; + + hwif->drives[0].autotune = 1; + hwif->drives[1].autotune = 1; + + if (!hwif->dma_base) + goto fallback; + + hwif->atapi_dma = 1; + hwif->ultra_mask = 0x7f; + hwif->mwdma_mask = 0x07; + + hwif->ide_dma_check = &jmicron_config_drive_for_dma; + if (!(hwif->udma_four)) + hwif->udma_four = ata66_jmicron(hwif); + + hwif->autodma = 1; + hwif->drives[0].autodma = hwif->autodma; + hwif->drives[1].autodma = hwif->autodma; + return; +fallback: + hwif->autodma = 0; + return; +} + +#define DECLARE_JMB_DEV(name_str) \ + { \ + .name = name_str, \ + .init_hwif = init_hwif_jmicron, \ + .channels = 2, \ + .autodma = AUTODMA, \ + .bootable = ON_BOARD, \ + .enablebits = { {0x40, 1, 1}, {0x40, 0x10, 0x10} }, \ + } + +static ide_pci_device_t jmicron_chipsets[] __devinitdata = { + /* 0 */ DECLARE_JMB_DEV("JMB361"), + /* 1 */ DECLARE_JMB_DEV("JMB363"), + /* 2 */ DECLARE_JMB_DEV("JMB365"), + /* 3 */ DECLARE_JMB_DEV("JMB366"), + /* 4 */ DECLARE_JMB_DEV("JMB368"), +}; + +/** + * jmicron_init_one - pci layer discovery entry + * @dev: PCI device + * @id: ident table entry + * + * Called by the PCI code when it finds a Jmicron controller. + * We then use the IDE PCI generic helper to do most of the work. + */ + +static int __devinit jmicron_init_one(struct pci_dev *dev, const struct pci_device_id *id) +{ + ide_setup_pci_device(dev, &jmicron_chipsets[id->driver_data]); + return 0; +} + +static struct pci_device_id jmicron_pci_tbl[] = { + { PCI_DEVICE(PCI_VENDOR_ID_JMICRO, PCI_DEVICE_ID_JMICRON_JMB361), 0}, + { PCI_DEVICE(PCI_VENDOR_ID_JMICRO, PCI_DEVICE_ID_JMICRON_JMB363), 1}, + { PCI_DEVICE(PCI_VENDOR_ID_JMICRO, PCI_DEVICE_ID_JMICRON_JMB365), 2}, + { PCI_DEVICE(PCI_VENDOR_ID_JMICRO, PCI_DEVICE_ID_JMICRON_JMB366), 3}, + { PCI_DEVICE(PCI_VENDOR_ID_JMICRO, PCI_DEVICE_ID_JMICRON_JMB368), 4}, + { 0, }, +}; + +MODULE_DEVICE_TABLE(pci, jmicron_pci_tbl); + +static struct pci_driver driver = { + .name = "JMicron IDE", + .id_table = jmicron_pci_tbl, + .probe = jmicron_init_one, +}; + +static int __init jmicron_ide_init(void) +{ + return ide_pci_register_driver(&driver); +} + +module_init(jmicron_ide_init); + +MODULE_AUTHOR("Alan Cox"); +MODULE_DESCRIPTION("PCI driver module for the JMicron in legacy modes"); +MODULE_LICENSE("GPL"); -- 1.2.GIT ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 17/24] pata_qdi: Fix return code 2006-07-04 18:15 ` [PATCH 16/24] jmicron: IDE old type driver alan @ 2006-07-04 18:15 ` alan 2006-07-04 18:15 ` [PATCH 18/24] ide jmicron: Finish writing alan 2006-07-07 16:31 ` [PATCH 17/24] pata_qdi: Fix return code Jeff Garzik 0 siblings, 2 replies; 49+ messages in thread From: alan @ 2006-07-04 18:15 UTC (permalink / raw) To: jgarzik; +Cc: akpm, linux-ide, root, Alan Cox From: root <root@hraefn.swansea.linux.org.uk> Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/scsi/pata_qdi.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) 50c4cfe08714a41b64a4375c3616e158f02ec3e5 diff --git a/drivers/scsi/pata_qdi.c b/drivers/scsi/pata_qdi.c index f8fc0ef..5ddd708 100644 --- a/drivers/scsi/pata_qdi.c +++ b/drivers/scsi/pata_qdi.c @@ -309,7 +309,7 @@ static __init int qdi_init(void) int i; if (probe_qdi == 0) - return; + return -ENODEV; /* * Check each possible QD65xx base address -- 1.2.GIT ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 18/24] ide jmicron: Finish writing 2006-07-04 18:15 ` [PATCH 17/24] pata_qdi: Fix return code alan @ 2006-07-04 18:15 ` alan 2006-07-04 18:15 ` [PATCH 19/24] jmicron: It works better if you get the file name right alan 2006-07-07 16:31 ` [PATCH 17/24] pata_qdi: Fix return code Jeff Garzik 1 sibling, 1 reply; 49+ messages in thread From: alan @ 2006-07-04 18:15 UTC (permalink / raw) To: jgarzik; +Cc: akpm, linux-ide, Alan Cox From: Alan Cox <alan@redhat.com> Finish writing/compiling the IDE mode driver. Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/ide/pci/jmicron.c | 45 +++++++++++++++++---------------------------- 1 files changed, 17 insertions(+), 28 deletions(-) d3dd976e6cf56cf3ea90f016fd0ae9e7d13a180e diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c index b7301f0..987c81b 100644 --- a/drivers/ide/pci/jmicron.c +++ b/drivers/ide/pci/jmicron.c @@ -16,11 +16,11 @@ #include <asm/io.h> -enum port_type { - PORT_PATA0 = 0; - PORT_PATA1 = 1; - PORT_SATA = 2; -} +typedef enum { + PORT_PATA0 = 0, + PORT_PATA1 = 1, + PORT_SATA = 2, +} port_type; /** * jmicron_ratemask - Compute available modes @@ -45,17 +45,18 @@ static u8 jmicron_ratemask(ide_drive_t * * Return 1 if the cable is 80pin */ -static int ata66_jmicron(ide_hwif_t *hwif) +static int __devinit ata66_jmicron(ide_hwif_t *hwif) { struct pci_dev *pdev = hwif->pci_dev; u32 control; u32 control5; - int port_mask = 1<< (4 * hwif->channel); int port = hwif->channel; port_type port_map[2]; + pci_read_config_dword(pdev, 0x40, &control); + /* There are two basic mappings. One has the two SATA ports merged as master/slave and the secondary as PATA, the other has only the SATA port mapped */ @@ -71,7 +72,7 @@ static int ata66_jmicron(ide_hwif_t *hwi as the internal primary channel */ pci_read_config_dword(pdev, 0x80, &control5); if (control5 & (1<<24)) - port_map[0] == PORT_PATA1; + port_map[0] = PORT_PATA1; /* The two ports may then be logically swapped by the firmware */ if (control & (1 << 22)) @@ -87,14 +88,12 @@ static int ata66_jmicron(ide_hwif_t *hwi case PORT_PATA0: if (control & (1 << 3)) /* 40/80 pin primary */ return 1; - else - return 0; - break; + return 0; case PORT_PATA1: if (control5 & (1 << 19)) /* 40/80 pin secondary */ return 0; return 1; - case PORT_SATA + case PORT_SATA: return 1; } } @@ -113,6 +112,7 @@ static void jmicron_tuneproc (ide_drive_ static void config_jmicron_chipset_for_pio (ide_drive_t *drive, byte set_speed) { + u8 speed = XFER_PIO_0 + ide_get_best_pio_mode(drive, 255, 5, NULL); if (set_speed) (void) ide_config_drive_speed(drive, speed); } @@ -130,7 +130,6 @@ static void config_jmicron_chipset_for_p static int jmicron_tune_chipset (ide_drive_t *drive, byte xferspeed) { - ide_hwif_t *hwif = drive->hwif; u8 speed = ide_rate_filter(jmicron_ratemask(drive), xferspeed); return ide_config_drive_speed(drive, speed); @@ -174,16 +173,6 @@ static int jmicron_config_drive_for_dma } /** - * ata66_jmicron - check for 80 pin cable - * @hwif: interface to check - * - */ - -static unsigned int __devinit ata66_jmicron(ide_hwif_t *hwif) -{ -} - -/** * init_hwif_jmicron - set up hwif structs * @hwif: interface to set up * @@ -252,11 +241,11 @@ static int __devinit jmicron_init_one(st } static struct pci_device_id jmicron_pci_tbl[] = { - { PCI_DEVICE(PCI_VENDOR_ID_JMICRO, PCI_DEVICE_ID_JMICRON_JMB361), 0}, - { PCI_DEVICE(PCI_VENDOR_ID_JMICRO, PCI_DEVICE_ID_JMICRON_JMB363), 1}, - { PCI_DEVICE(PCI_VENDOR_ID_JMICRO, PCI_DEVICE_ID_JMICRON_JMB365), 2}, - { PCI_DEVICE(PCI_VENDOR_ID_JMICRO, PCI_DEVICE_ID_JMICRON_JMB366), 3}, - { PCI_DEVICE(PCI_VENDOR_ID_JMICRO, PCI_DEVICE_ID_JMICRON_JMB368), 4}, + { PCI_DEVICE(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361), 0}, + { PCI_DEVICE(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363), 1}, + { PCI_DEVICE(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365), 2}, + { PCI_DEVICE(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366), 3}, + { PCI_DEVICE(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB368), 4}, { 0, }, }; -- 1.2.GIT ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 19/24] jmicron: It works better if you get the file name right 2006-07-04 18:15 ` [PATCH 18/24] ide jmicron: Finish writing alan @ 2006-07-04 18:15 ` alan 2006-07-04 18:15 ` [PATCH 20/24] jmicron: Further clean up alan 0 siblings, 1 reply; 49+ messages in thread From: alan @ 2006-07-04 18:15 UTC (permalink / raw) To: jgarzik; +Cc: akpm, linux-ide, Alan Cox From: Alan Cox <alan@redhat.com> Fix the Makefile to be ata_ Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/scsi/Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) 25c581221bf9095dbf8a32aee395d83bd1fa4f9e diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile index 3654dab..e925bad 100644 --- a/drivers/scsi/Makefile +++ b/drivers/scsi/Makefile @@ -140,7 +140,7 @@ obj-$(CONFIG_SCSI_PATA_HPT3X3) += libata obj-$(CONFIG_SCSI_PATA_ISAPNP) += libata.o pata_isapnp.o obj-$(CONFIG_SCSI_PATA_IT8172) += libata.o pata_it8172.o obj-$(CONFIG_SCSI_PATA_IT821X) += libata.o pata_it821x.o -obj-$(CONFIG_SCSI_PATA_JMICRON) += libata.o ata_jmicron.o +obj-$(CONFIG_SCSI_ATA_JMICRON) += libata.o ata_jmicron.o obj-$(CONFIG_SCSI_PATA_NETCELL) += libata.o pata_netcell.o obj-$(CONFIG_SCSI_PATA_NS87410) += libata.o pata_ns87410.o obj-$(CONFIG_SCSI_PATA_OPTI) += libata.o pata_opti.o -- 1.2.GIT ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 20/24] jmicron: Further clean up 2006-07-04 18:15 ` [PATCH 19/24] jmicron: It works better if you get the file name right alan @ 2006-07-04 18:15 ` alan 2006-07-04 18:15 ` [PATCH 21/24] ata_jmicro: Fix an escapee alan 0 siblings, 1 reply; 49+ messages in thread From: alan @ 2006-07-04 18:15 UTC (permalink / raw) To: jgarzik; +Cc: akpm, linux-ide, Alan Cox From: Alan Cox <alan@redhat.com> - Fix the comment that is bass ackwards in jmicron.c - Switch ahci to use PCI_VENDOR_ID.. definitions [PS: Jeff you'd tell me off for not using PCI_DEVICE_ID() here... ;)] Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/scsi/ahci.c | 10 +++++----- drivers/scsi/ata_jmicron.c | 34 +++++++++++++++++----------------- 2 files changed, 22 insertions(+), 22 deletions(-) 954521d7fd805123573035d3d9eba59cd8705549 diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index 1edfade..71b626b 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c @@ -319,15 +319,15 @@ static const struct pci_device_id ahci_p board_ahci }, /* ICH8M */ /* JMicron */ - { 0x197b, 0x2360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, board_ahci }, /* JMicron JMB360 */ - { 0x197b, 0x2361, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361, PCI_ANY_ID, PCI_ANY_ID, 0, 0, board_ahci }, /* JMicron JMB361 */ - { 0x197b, 0x2363, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363, PCI_ANY_ID, PCI_ANY_ID, 0, 0, board_ahci }, /* JMicron JMB363 */ - { 0x197b, 0x2365, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365, PCI_ANY_ID, PCI_ANY_ID, 0, 0, board_ahci }, /* JMicron JMB365 */ - { 0x197b, 0x2366, PCI_ANY_ID, PCI_ANY_ID, 0, 0, + { PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366, PCI_ANY_ID, PCI_ANY_ID, 0, 0, board_ahci }, /* JMicron JMB366 */ /* ATI */ diff --git a/drivers/scsi/ata_jmicron.c b/drivers/scsi/ata_jmicron.c index 23f362b..b3136c8 100644 --- a/drivers/scsi/ata_jmicron.c +++ b/drivers/scsi/ata_jmicron.c @@ -21,11 +21,11 @@ #define DRV_NAME "ata_jmicron" #define DRV_VERSION "0.1" -enum port_type { - PORT_PATA0 = 0; - PORT_PATA1 = 1; - PORT_SATA = 2; -} +typedef enum { + PORT_PATA0 = 0, + PORT_PATA1 = 1, + PORT_SATA = 2, +} port_type; /** * jmicron_pre_reset - check for 40/80 pin @@ -45,7 +45,6 @@ static int jmicron_pre_reset(struct ata_ u32 control; u32 control5; int port_mask = 1<< (4 * ap->hard_port_no); - int is_sata = 0; int port = ap->hard_port_no; port_type port_map[2]; @@ -69,7 +68,7 @@ static int jmicron_pre_reset(struct ata_ as the internal primary channel */ pci_read_config_dword(pdev, 0x80, &control5); if (control5 & (1<<24)) - port_map[0] == PORT_PATA1; + port_map[0] = PORT_PATA1; /* The two ports may then be logically swapped by the firmware */ if (control & (1 << 22)) @@ -100,7 +99,7 @@ static int jmicron_pre_reset(struct ata_ ap->cbl = ATA_CBL_PATA80; break; case PORT_SATA: - ap->cbl = ATA_CBL_SATA + ap->cbl = ATA_CBL_SATA; break; } return ata_std_prereset(ap); @@ -191,7 +190,7 @@ static const struct ata_port_operations * Zero on success, or -ERRNO value. */ -static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) +static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *id) { static struct ata_port_info info = { .sht = &jmicron_sht, @@ -203,10 +202,11 @@ static int jmicron_init_one (struct pci_ .port_ops = &jmicron_ops, }; + struct ata_port_info *port_info[2] = { &info, &info }; u32 reg; - if (id->device_data != 368) { + if (id->driver_data != 368) { /* Put the controller into AHCI mode in case the AHCI driver has not yet been loaded. This can be done with either function present */ @@ -215,11 +215,11 @@ static int jmicron_init_one (struct pci_ pci_write_config_byte(pdev, 0x41, 0xa1); } - /* PATA controller is fn 0, AHCI is fn 1 */ + /* PATA controller is fn 1, AHCI is fn 0 */ if (PCI_FUNC(pdev->devfn) != 1) return -ENODEV; - if ( id->device_data == 365 || id->device_data == 366) { + if ( id->driver_data == 365 || id->driver_data == 366) { /* The 365/66 have two PATA channels, redirect the second */ pci_read_config_dword(pdev, 0x80, ®); reg |= (1 << 24); /* IDE1 to PATA IDE secondary */ @@ -230,11 +230,11 @@ static int jmicron_init_one (struct pci_ } static const struct pci_device_id jmicron_pci_tbl[] = { - { PCI_DEVICE(PCI_VENDOR_ID_JMICRO, PCI_DEVICE_ID_JMICRON_JMB361), 361}, - { PCI_DEVICE(PCI_VENDOR_ID_JMICRO, PCI_DEVICE_ID_JMICRON_JMB363), 363}, - { PCI_DEVICE(PCI_VENDOR_ID_JMICRO, PCI_DEVICE_ID_JMICRON_JMB365), 365}, - { PCI_DEVICE(PCI_VENDOR_ID_JMICRO, PCI_DEVICE_ID_JMICRON_JMB366), 366}, - { PCI_DEVICE(PCI_VENDOR_ID_JMICRO, PCI_DEVICE_ID_JMICRON_JMB368), 368}, + { PCI_DEVICE(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB361), 361}, + { PCI_DEVICE(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB363), 363}, + { PCI_DEVICE(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB365), 365}, + { PCI_DEVICE(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB366), 366}, + { PCI_DEVICE(PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB368), 368}, { } /* terminate list */ }; -- 1.2.GIT ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 21/24] ata_jmicro: Fix an escapee 2006-07-04 18:15 ` [PATCH 20/24] jmicron: Further clean up alan @ 2006-07-04 18:15 ` alan 2006-07-04 18:14 ` [PATCH 22/24] jmicron: Jmicron multifunction setup alan 0 siblings, 1 reply; 49+ messages in thread From: alan @ 2006-07-04 18:15 UTC (permalink / raw) To: jgarzik; +Cc: akpm, linux-ide, Alan Cox From: Alan Cox <alan@redhat.com> Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/scsi/ata_jmicron.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) 4131a25c5ff7e00d9bd6f7e98c1c91b53e0346dc diff --git a/drivers/scsi/ata_jmicron.c b/drivers/scsi/ata_jmicron.c index b3136c8..f141ee7 100644 --- a/drivers/scsi/ata_jmicron.c +++ b/drivers/scsi/ata_jmicron.c @@ -19,7 +19,7 @@ #include <linux/ata.h> #define DRV_NAME "ata_jmicron" -#define DRV_VERSION "0.1" +#define DRV_VERSION "0.1.1" typedef enum { PORT_PATA0 = 0, @@ -259,7 +259,7 @@ module_init(jmicron_init); module_exit(jmicron_exit); MODULE_AUTHOR("Alan Cox"); -MODULE_DESCRIPTION("SCSI low-level driver for Netcell PATA RAID"); +MODULE_DESCRIPTION("SCSI low-level driver for Jmicron PATA ports"); MODULE_LICENSE("GPL"); MODULE_DEVICE_TABLE(pci, jmicron_pci_tbl); MODULE_VERSION(DRV_VERSION); -- 1.2.GIT ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 22/24] jmicron: Jmicron multifunction setup 2006-07-04 18:15 ` [PATCH 21/24] ata_jmicro: Fix an escapee alan @ 2006-07-04 18:14 ` alan 2006-07-04 18:15 ` [PATCH 23/24] libata: Enable per device speed setting alan ` (2 more replies) 0 siblings, 3 replies; 49+ messages in thread From: alan @ 2006-07-04 18:14 UTC (permalink / raw) To: jgarzik; +Cc: akpm, linux-ide, Alan Cox From: Alan Cox <alan@redhat.com> JMicron controllers start out in life pretending to be a single legacy IDE interface with the ports magically mangled into it. When prodding they turn into a dual function device which has an AHCI controller for SATA and a PATA controller for the PATA ports. Do the prodding early enough that our PCI layer enumeration finds and discovers the extra functions. Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/pci/quirks.c | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) e2b0e59a480b7d437b387cced5d96f60e6cb7aff diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 5f7e0a9..0a115ca 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -1186,7 +1186,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S static void __devinit quirk_jmicron_dualfn(struct pci_dev *pdev) { u32 conf; + u8 hdr; + /* Only poke fn 0 */ if (PCI_FUNC(pdev->devfn)) return; @@ -1206,11 +1208,19 @@ static void __devinit quirk_jmicron_dual conf &= ~0x000F0200; /* Clear bit 9 and 16-19 */ conf |= 0x00C20002; /* Set bit 1, 17, 22, 23 */ pci_write_config_dword(pdev, 0x40, conf); + + /* Reconfigure so that the PCI scanner discovers the + device is now multifunction */ + + pci_read_config_byte(pdev, PCI_HEADER_TYPE, &hdr); + pdev->hdr_type = hdr & 0x7f; + pdev->multifunction = !!(hdr & 0x80); + break; } } -DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, quirk_jmicron_dualfn); +DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_JMICRON, PCI_ANY_ID, quirk_jmicron_dualfn); #endif -- 1.2.GIT ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 23/24] libata: Enable per device speed setting 2006-07-04 18:14 ` [PATCH 22/24] jmicron: Jmicron multifunction setup alan @ 2006-07-04 18:15 ` alan 2006-07-04 18:15 ` [PATCH 24/24] jmicron: Missed one alan 2006-07-07 16:39 ` [PATCH 23/24] libata: Enable per device speed setting Jeff Garzik 2006-07-07 16:34 ` [PATCH 22/24] jmicron: Jmicron multifunction setup Jeff Garzik 2006-07-07 16:35 ` Jeff Garzik 2 siblings, 2 replies; 49+ messages in thread From: alan @ 2006-07-04 18:15 UTC (permalink / raw) To: jgarzik; +Cc: akpm, linux-ide, Alan Cox From: Alan Cox <alan@redhat.com> Testing says that nothing seems to break when we do this. Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/scsi/libata-core.c | 36 ++++++++++++++---------------------- 1 files changed, 14 insertions(+), 22 deletions(-) 6f3a15e1fd177bab7bb093c23bdefac6fbf6253a diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index cc6ae67..75eb556 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c @@ -3047,6 +3047,7 @@ static void ata_dev_xfermask(struct ata_ unsigned long xfer_mask; int i; + /* Controller modes available */ xfer_mask = ata_pack_xfermask(ap->pio_mask, ap->mwdma_mask, ap->udma_mask); @@ -3056,30 +3057,21 @@ static void ata_dev_xfermask(struct ata_ if (ap->cbl == ATA_CBL_PATA40) xfer_mask &= ~(0xF8 << ATA_SHIFT_UDMA); - /* FIXME: Use port-wide xfermask for now */ - for (i = 0; i < ATA_MAX_DEVICES; i++) { - struct ata_device *d = &ap->device[i]; - - if (ata_dev_absent(d)) - continue; - - if (ata_dev_disabled(d)) { - /* to avoid violating device selection timing */ - xfer_mask &= ata_pack_xfermask(d->pio_mask, - UINT_MAX, UINT_MAX); - continue; - } + if (ata_dev_disabled(dev)) { + /* to avoid violating device selection timing */ + xfer_mask &= ata_pack_xfermask(dev->pio_mask, + UINT_MAX, UINT_MAX); + goto out; + } + xfer_mask &= ata_pack_xfermask(dev->pio_mask, + dev->mwdma_mask, dev->udma_mask); + xfer_mask &= ata_id_xfermask(dev->id); - xfer_mask &= ata_pack_xfermask(d->pio_mask, - d->mwdma_mask, d->udma_mask); - xfer_mask &= ata_id_xfermask(d->id); - if (ata_dma_blacklisted(d)) - xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); - } - - if (ata_dma_blacklisted(dev)) + if (ata_dma_blacklisted(dev)) { + xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); ata_dev_printk(dev, KERN_WARNING, "device is on DMA blacklist, disabling DMA\n"); + } if (hs->flags & ATA_HOST_SIMPLEX) { if (hs->simplex_claimed) @@ -3088,7 +3080,7 @@ static void ata_dev_xfermask(struct ata_ if (ap->ops->mode_filter) xfer_mask = ap->ops->mode_filter(ap, dev, xfer_mask); - +out: ata_unpack_xfermask(xfer_mask, &dev->pio_mask, &dev->mwdma_mask, &dev->udma_mask); } -- 1.2.GIT ^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH 24/24] jmicron: Missed one 2006-07-04 18:15 ` [PATCH 23/24] libata: Enable per device speed setting alan @ 2006-07-04 18:15 ` alan 2006-07-07 16:36 ` Jeff Garzik 2006-07-07 16:39 ` [PATCH 23/24] libata: Enable per device speed setting Jeff Garzik 1 sibling, 1 reply; 49+ messages in thread From: alan @ 2006-07-04 18:15 UTC (permalink / raw) To: jgarzik; +Cc: akpm, linux-ide, Alan Cox From: Alan Cox <alan@redhat.com> Signed-off-by: Alan Cox <alan@redhat.com> --- drivers/scsi/ata_jmicron.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) 56d473e506ba2cda167f25df4cfd21910eb2d1ab diff --git a/drivers/scsi/ata_jmicron.c b/drivers/scsi/ata_jmicron.c index f141ee7..85a7ffc 100644 --- a/drivers/scsi/ata_jmicron.c +++ b/drivers/scsi/ata_jmicron.c @@ -177,7 +177,7 @@ static const struct ata_port_operations /** - * jmicron_init_one - Register Netcell ATA PCI device with kernel services + * jmicron_init_one - Register Jmicron ATA PCI device with kernel services * @pdev: PCI device to register * @ent: Entry in jmicron_pci_tbl matching with @pdev * -- 1.2.GIT ^ permalink raw reply related [flat|nested] 49+ messages in thread
* Re: [PATCH 24/24] jmicron: Missed one 2006-07-04 18:15 ` [PATCH 24/24] jmicron: Missed one alan @ 2006-07-07 16:36 ` Jeff Garzik 0 siblings, 0 replies; 49+ messages in thread From: Jeff Garzik @ 2006-07-07 16:36 UTC (permalink / raw) To: alan; +Cc: akpm, linux-ide, Alan Cox ACK ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 23/24] libata: Enable per device speed setting 2006-07-04 18:15 ` [PATCH 23/24] libata: Enable per device speed setting alan 2006-07-04 18:15 ` [PATCH 24/24] jmicron: Missed one alan @ 2006-07-07 16:39 ` Jeff Garzik 2006-07-07 17:06 ` Alan Cox 1 sibling, 1 reply; 49+ messages in thread From: Jeff Garzik @ 2006-07-07 16:39 UTC (permalink / raw) To: alan; +Cc: akpm, linux-ide, Alan Cox alan@lxorguk.ukuu.org.uk wrote: > From: Alan Cox <alan@redhat.com> > > Testing says that nothing seems to break when we do this. > > Signed-off-by: Alan Cox <alan@redhat.com> Tested with ata_piix? Evaluated to ensure that it matches up with Intel ICH and all other PATA controller timing register setups? If yes to both... ACK. ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 23/24] libata: Enable per device speed setting 2006-07-07 16:39 ` [PATCH 23/24] libata: Enable per device speed setting Jeff Garzik @ 2006-07-07 17:06 ` Alan Cox 0 siblings, 0 replies; 49+ messages in thread From: Alan Cox @ 2006-07-07 17:06 UTC (permalink / raw) To: Jeff Garzik; +Cc: akpm, linux-ide, Alan Cox Ar Gwe, 2006-07-07 am 12:39 -0400, ysgrifennodd Jeff Garzik: > Tested with ata_piix? > > Evaluated to ensure that it matches up with Intel ICH and all other PATA > controller timing register setups? > > If yes to both... ACK. Yes, tested and double checked. The one bug I found with this was the secondary slave timing bug and that was fixed some time ago. Alan ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 22/24] jmicron: Jmicron multifunction setup 2006-07-04 18:14 ` [PATCH 22/24] jmicron: Jmicron multifunction setup alan 2006-07-04 18:15 ` [PATCH 23/24] libata: Enable per device speed setting alan @ 2006-07-07 16:34 ` Jeff Garzik [not found] ` <20060707124359.670e84c6.akpm@osdl.o! rg> ` (2 more replies) 2006-07-07 16:35 ` Jeff Garzik 2 siblings, 3 replies; 49+ messages in thread From: Jeff Garzik @ 2006-07-07 16:34 UTC (permalink / raw) To: alan; +Cc: akpm, linux-ide, Alan Cox ACK patches 19-22 ^ permalink raw reply [flat|nested] 49+ messages in thread
[parent not found: <20060707124359.670e84c6.akpm@osdl.o! rg>]
* Re: [PATCH 22/24] jmicron: Jmicron multifunction setup 2006-07-07 16:34 ` [PATCH 22/24] jmicron: Jmicron multifunction setup Jeff Garzik [not found] ` <20060707124359.670e84c6.akpm@osdl.o! rg> @ 2006-07-07 19:43 ` Andrew Morton 2006-07-07 19:48 ` Jeff Garzik 2006-07-07 19:45 ` Andrew Morton 2 siblings, 1 reply; 49+ messages in thread From: Andrew Morton @ 2006-07-07 19:43 UTC (permalink / raw) To: Jeff Garzik; +Cc: alan, linux-ide, alan On Fri, 07 Jul 2006 12:34:16 -0400 Jeff Garzik <jgarzik@pobox.com> wrote: > ACK patches 19-22 You wouldn't _believe_ how much grief this causes. I cannot, with any reliability, identify what patches 19-22 actually are. Please, ack 'em individually? ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 22/24] jmicron: Jmicron multifunction setup 2006-07-07 19:43 ` Andrew Morton @ 2006-07-07 19:48 ` Jeff Garzik 2006-07-07 20:01 ` Andrew Morton 0 siblings, 1 reply; 49+ messages in thread From: Jeff Garzik @ 2006-07-07 19:48 UTC (permalink / raw) To: Andrew Morton; +Cc: alan, linux-ide, alan Andrew Morton wrote: > On Fri, 07 Jul 2006 12:34:16 -0400 > Jeff Garzik <jgarzik@pobox.com> wrote: > >> ACK patches 19-22 > > You wouldn't _believe_ how much grief this causes. I cannot, with any > reliability, identify what patches 19-22 actually are. Why not? They are reliably in the subject lines, like they always are... Plus its a bit silly to send out 24 emails, when five will suffice. Jeff ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 22/24] jmicron: Jmicron multifunction setup 2006-07-07 19:48 ` Jeff Garzik @ 2006-07-07 20:01 ` Andrew Morton 2006-07-07 20:05 ` Jeff Garzik 0 siblings, 1 reply; 49+ messages in thread From: Andrew Morton @ 2006-07-07 20:01 UTC (permalink / raw) To: Jeff Garzik; +Cc: alan, linux-ide, alan On Fri, 07 Jul 2006 15:48:30 -0400 Jeff Garzik <jgarzik@pobox.com> wrote: > Andrew Morton wrote: > > On Fri, 07 Jul 2006 12:34:16 -0400 > > Jeff Garzik <jgarzik@pobox.com> wrote: > > > >> ACK patches 19-22 > > > > You wouldn't _believe_ how much grief this causes. I cannot, with any > > reliability, identify what patches 19-22 actually are. > > Why not? They are reliably in the subject lines, like they always are... Because the numbers change all the time. After I realised you were replying to Alan's patch series and not to mine I was able to go off and find the right email folder, find Alan's originals and then translate things back. I'm not subscribed to linux-ide, but I happen to keep everything. Mostly. > Plus its a bit silly to send out 24 emails, when five will suffice. False economy ;) ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 22/24] jmicron: Jmicron multifunction setup 2006-07-07 20:01 ` Andrew Morton @ 2006-07-07 20:05 ` Jeff Garzik 0 siblings, 0 replies; 49+ messages in thread From: Jeff Garzik @ 2006-07-07 20:05 UTC (permalink / raw) To: Andrew Morton; +Cc: alan, linux-ide, alan Andrew Morton wrote: > On Fri, 07 Jul 2006 15:48:30 -0400 > Jeff Garzik <jgarzik@pobox.com> wrote: > >> Andrew Morton wrote: >>> On Fri, 07 Jul 2006 12:34:16 -0400 >>> Jeff Garzik <jgarzik@pobox.com> wrote: >>> >>>> ACK patches 19-22 >>> You wouldn't _believe_ how much grief this causes. I cannot, with any >>> reliability, identify what patches 19-22 actually are. >> Why not? They are reliably in the subject lines, like they always are... > > Because the numbers change all the time. After I realised you were > replying to Alan's patch series and not to mine I was able to go off and > find the right email folder, find Alan's originals and then translate > things back. > > I'm not subscribed to linux-ide, but I happen to keep everything. Mostly. Would it take much changing to record the original author's subject, on your side? I reply to a lot of Tejun's 100+ patchbombs this way too. >> Plus its a bit silly to send out 24 emails, when five will suffice. > > False economy ;) Not really. More typing == more hand pain :) [though its better in recent months, with increased exercise] Jeff ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 22/24] jmicron: Jmicron multifunction setup 2006-07-07 16:34 ` [PATCH 22/24] jmicron: Jmicron multifunction setup Jeff Garzik [not found] ` <20060707124359.670e84c6.akpm@osdl.o! rg> 2006-07-07 19:43 ` Andrew Morton @ 2006-07-07 19:45 ` Andrew Morton 2006-07-07 19:50 ` Jeff Garzik 2 siblings, 1 reply; 49+ messages in thread From: Andrew Morton @ 2006-07-07 19:45 UTC (permalink / raw) To: Jeff Garzik; +Cc: alan, linux-ide, alan On Fri, 07 Jul 2006 12:34:16 -0400 Jeff Garzik <jgarzik@pobox.com> wrote: > ACK patches 19-22 I found them! pata-jmicron-it-works-better-if-you-get-the-file-name-right.patch pata-jmicron-further-clean-up.patch pata-ata_jmicro-fix-an-escapee.patch pata-jmicron-jmicron-multifunction-setup.patch ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 22/24] jmicron: Jmicron multifunction setup 2006-07-07 19:45 ` Andrew Morton @ 2006-07-07 19:50 ` Jeff Garzik 0 siblings, 0 replies; 49+ messages in thread From: Jeff Garzik @ 2006-07-07 19:50 UTC (permalink / raw) To: Andrew Morton; +Cc: alan, linux-ide, alan Andrew Morton wrote: > On Fri, 07 Jul 2006 12:34:16 -0400 > Jeff Garzik <jgarzik@pobox.com> wrote: > >> ACK patches 19-22 > > I found them! > > pata-jmicron-it-works-better-if-you-get-the-file-name-right.patch > pata-jmicron-further-clean-up.patch > pata-ata_jmicro-fix-an-escapee.patch > pata-jmicron-jmicron-multifunction-setup.patch Hopefully Alan will collapse that down to a single jmicron libata patch. FWIW the earlier patches in the series should be in libata-dev.git#pata-drivers (and thus libata-dev.git#ALL). Jeff ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 22/24] jmicron: Jmicron multifunction setup 2006-07-04 18:14 ` [PATCH 22/24] jmicron: Jmicron multifunction setup alan 2006-07-04 18:15 ` [PATCH 23/24] libata: Enable per device speed setting alan 2006-07-07 16:34 ` [PATCH 22/24] jmicron: Jmicron multifunction setup Jeff Garzik @ 2006-07-07 16:35 ` Jeff Garzik 2 siblings, 0 replies; 49+ messages in thread From: Jeff Garzik @ 2006-07-07 16:35 UTC (permalink / raw) To: alan; +Cc: akpm, linux-ide, Alan Cox Oh: For the future, PLEASE put new drivers into a single patch. It is particularly important these days for 'git rebase' to always produce a compileable kernel, and it wastes some cycles during review (I caught bugs you fixed in later patches). Jeff ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 17/24] pata_qdi: Fix return code 2006-07-04 18:15 ` [PATCH 17/24] pata_qdi: Fix return code alan 2006-07-04 18:15 ` [PATCH 18/24] ide jmicron: Finish writing alan @ 2006-07-07 16:31 ` Jeff Garzik 1 sibling, 0 replies; 49+ messages in thread From: Jeff Garzik @ 2006-07-07 16:31 UTC (permalink / raw) To: alan; +Cc: akpm, linux-ide, root, Alan Cox ACK, of course ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 15/24] ata_generic - generic BIOS setup SFF ATA driver 2006-07-04 18:14 ` [PATCH 15/24] ata_generic - generic BIOS setup SFF ATA driver alan 2006-07-04 18:15 ` [PATCH 16/24] jmicron: IDE old type driver alan @ 2006-07-07 16:31 ` Jeff Garzik 2006-07-07 17:20 ` Alan Cox 1 sibling, 1 reply; 49+ messages in thread From: Jeff Garzik @ 2006-07-07 16:31 UTC (permalink / raw) To: alan; +Cc: akpm, linux-ide, root, Alan Cox alan@lxorguk.ukuu.org.uk wrote: > + /* We don't really care */ > + dev->pio_mode = XFER_PIO_0; > + dev->dma_mode = XFER_MW_DMA_0; > + /* We do need the right mode information for DMA or PIO > + and this comes from the current configuration flags */ > + /* FIXME: at some point in the future this should become > + a library helper which reads the disk modes from the > + disk as well */ This sounds like a comment bug? We already have the IDENTIFY [PACKET] DEVICE page with this info... > +static int all_generic_ide; /* Set to claim all devices */ Maybe a better name is 'claim_all'? > +static struct pci_driver pata_generic_pci_driver = { > + .name = DRV_NAME, weird whitespace > +MODULE_AUTHOR("Alan Cox"); > +MODULE_DESCRIPTION("low-level driver for generic ATA"); > +MODULE_LICENSE("GPL"); > +MODULE_DEVICE_TABLE(pci, pata_generic); > +MODULE_VERSION(DRV_VERSION); Various symbols and strings seem to be confused as to whether this is generic PATA or generic ATA. Suggest either s/pata_/ata_/ or s/ata_/pata_/ ACK everything else Jeff ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 15/24] ata_generic - generic BIOS setup SFF ATA driver 2006-07-07 16:31 ` [PATCH 15/24] ata_generic - generic BIOS setup SFF ATA driver Jeff Garzik @ 2006-07-07 17:20 ` Alan Cox 2006-07-07 17:22 ` Jeff Garzik 0 siblings, 1 reply; 49+ messages in thread From: Alan Cox @ 2006-07-07 17:20 UTC (permalink / raw) To: Jeff Garzik; +Cc: alan, akpm, linux-ide, root, Alan Cox On Fri, Jul 07, 2006 at 12:31:28PM -0400, Jeff Garzik wrote: > >+static int all_generic_ide; /* Set to claim all devices */ > > Maybe a better name is 'claim_all'? all_generic_ide is also the name used in the old IDE so it seems good to keep it together > Various symbols and strings seem to be confused as to whether this is > generic PATA or generic ATA. Will rework that ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 15/24] ata_generic - generic BIOS setup SFF ATA driver 2006-07-07 17:20 ` Alan Cox @ 2006-07-07 17:22 ` Jeff Garzik 0 siblings, 0 replies; 49+ messages in thread From: Jeff Garzik @ 2006-07-07 17:22 UTC (permalink / raw) To: Alan Cox; +Cc: alan, akpm, linux-ide, root Alan Cox wrote: > On Fri, Jul 07, 2006 at 12:31:28PM -0400, Jeff Garzik wrote: >>> +static int all_generic_ide; /* Set to claim all devices */ >> Maybe a better name is 'claim_all'? > > all_generic_ide is also the name used in the old IDE so it seems good to keep > it together ACK this detail, then ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 14/24] it821x: Fix the ATAPI autodma setup 2006-07-04 18:15 ` [PATCH 14/24] it821x: Fix the ATAPI autodma setup alan 2006-07-04 18:14 ` [PATCH 15/24] ata_generic - generic BIOS setup SFF ATA driver alan @ 2006-07-07 16:26 ` Jeff Garzik 1 sibling, 0 replies; 49+ messages in thread From: Jeff Garzik @ 2006-07-07 16:26 UTC (permalink / raw) To: alan; +Cc: akpm, linux-ide, root, Alan Cox alan@lxorguk.ukuu.org.uk wrote: > From: root <root@hraefn.swansea.linux.org.uk> > > Don't assume atapi dma is defaulted to on. > > Signed-off-by: Alan Cox <alan@redhat.com> I'm not tricked that easily ;-) ;-) I will bitbucket drivers/ide patches... that's a rabbit hole I do not wish to go down... :) Jeff ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 13/24] My name is Ingo Molnar, you killed my make allyesconfig, prepare to die 2006-07-04 18:14 ` [PATCH 13/24] My name is Ingo Molnar, you killed my make allyesconfig, prepare to die alan 2006-07-04 18:15 ` [PATCH 14/24] it821x: Fix the ATAPI autodma setup alan @ 2006-07-07 16:25 ` Jeff Garzik 1 sibling, 0 replies; 49+ messages in thread From: Jeff Garzik @ 2006-07-07 16:25 UTC (permalink / raw) To: alan; +Cc: akpm, linux-ide, root, Alan Cox ACK patches 12-13 ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 11/24] jmicron: Add quirks to force the device into a sane mode 2006-07-04 18:14 ` [PATCH 11/24] jmicron: Add quirks to force the device into a sane mode alan 2006-07-04 18:14 ` [PATCH 12/24] jmicron: Configuration alan @ 2006-07-07 16:23 ` Jeff Garzik 2006-07-07 16:51 ` Alan Cox 1 sibling, 1 reply; 49+ messages in thread From: Jeff Garzik @ 2006-07-07 16:23 UTC (permalink / raw) To: alan; +Cc: akpm, linux-ide, root, Alan Cox alan@lxorguk.ukuu.org.uk wrote: > +/** > + * jmicron_pre_reset - check for 40/80 pin > + * @ap: Port > + * > + * Perform the PATA port setup we need. > + > + * On the Jmicron 361/363 there is a single PATA port that can be mapped > + * either as primary or secondary (or neither). We don't do any policy > + * and setup here. We assume that has been done by init_one and the > + * BIOS. > + */ > + > +static int jmicron_pre_reset(struct ata_port *ap) > +{ > + struct pci_dev *pdev = to_pci_dev(ap->host_set->dev); > + u32 control; > + u32 control5; > + int port_mask = 1<< (4 * ap->hard_port_no); nit: add space after '1' > + int is_sata = 0; > + int port = ap->hard_port_no; > + port_type port_map[2]; > + > + /* Check if our port is enabled */ > + pci_read_config_dword(pdev, 0x40, &control); > + if ((control & port_mask) == 0) > + return 0; > + > + /* There are two basic mappings. One has the two SATA ports merged > + as master/slave and the secondary as PATA, the other has only the > + SATA port mapped */ > + if (control & (1 << 23)) { > + port_map[0] = PORT_SATA; > + port_map[1] = PORT_PATA0; > + } else { > + port_map[0] = PORT_SATA; > + port_map[1] = PORT_SATA; > + } > + > + /* The 365/366 may have this bit set to map the second PATA port > + as the internal primary channel */ > + pci_read_config_dword(pdev, 0x80, &control5); > + if (control5 & (1<<24)) > + port_map[0] == PORT_PATA1; > + > + /* The two ports may then be logically swapped by the firmware */ > + if (control & (1 << 22)) > + port = port ^ 1; > + > + /* > + * Now we know which physical port we are talking about we can > + * actually do our cable checking etc. Thankfully we don't need > + * to do the plumbing for other cases. > + */ > + switch (port_map[port]) > + { > + case PORT_PATA0: > + if (control & (1 << 5)) > + return 0; > + if (control & (1 << 3)) /* 40/80 pin primary */ > + ap->cbl = ATA_CBL_PATA40; > + else > + ap->cbl = ATA_CBL_PATA80; > + break; > + case PORT_PATA1: > + /* Bit 21 is set if the port is enabled */ > + if ((control5 & (1 << 21)) == 0) > + return 0; > + if (control5 & (1 << 19)) /* 40/80 pin secondary */ > + ap->cbl = ATA_CBL_PATA40; > + else > + ap->cbl = ATA_CBL_PATA80; > + break; > + case PORT_SATA: > + ap->cbl = ATA_CBL_SATA > + break; > + } > + return ata_std_prereset(ap); > +} > + > +/** > + * jmicron_error_handler - Setup and error handler > + * @ap: Port to handle > + * > + * LOCKING: > + * None (inherited from caller). > + */ > + > +static void jmicron_error_handler(struct ata_port *ap) > +{ > + return ata_bmdma_drive_eh(ap, jmicron_pre_reset, ata_std_softreset, NULL, ata_std_postreset); > +} > + > +/* No PIO or DMA methods needed for this device */ > + > +static struct scsi_host_template jmicron_sht = { > + .module = THIS_MODULE, > + .name = DRV_NAME, > + .ioctl = ata_scsi_ioctl, > + .queuecommand = ata_scsi_queuecmd, > + .can_queue = ATA_DEF_QUEUE, > + .this_id = ATA_SHT_THIS_ID, > + .sg_tablesize = LIBATA_MAX_PRD, > + /* Special handling needed if you have sector or LBA48 limits */ > + .max_sectors = ATA_MAX_SECTORS, > + .cmd_per_lun = ATA_SHT_CMD_PER_LUN, > + .emulated = ATA_SHT_EMULATED, > + .use_clustering = ATA_SHT_USE_CLUSTERING, > + .proc_name = DRV_NAME, > + .dma_boundary = ATA_DMA_BOUNDARY, > + .slave_configure = ata_scsi_slave_config, > + /* Use standard CHS mapping rules */ > + .bios_param = ata_std_bios_param, > +}; > + > +static const struct ata_port_operations jmicron_ops = { > + .port_disable = ata_port_disable, > + > + /* Task file is PCI ATA format, use helpers */ > + .tf_load = ata_tf_load, > + .tf_read = ata_tf_read, > + .check_status = ata_check_status, > + .exec_command = ata_exec_command, > + .dev_select = ata_std_dev_select, > + > + .freeze = ata_bmdma_freeze, > + .thaw = ata_bmdma_thaw, > + .error_handler = jmicron_error_handler, > + .post_internal_cmd = ata_bmdma_post_internal_cmd, > + > + /* BMDMA handling is PCI ATA format, use helpers */ > + .bmdma_setup = ata_bmdma_setup, > + .bmdma_start = ata_bmdma_start, > + .bmdma_stop = ata_bmdma_stop, > + .bmdma_status = ata_bmdma_status, > + .qc_prep = ata_qc_prep, > + .qc_issue = ata_qc_issue_prot, > + .data_xfer = ata_pio_data_xfer, > + > + /* Timeout handling. Special recovery hooks here */ > + .eng_timeout = ata_eng_timeout, Remove this, you already use new EH > + .irq_handler = ata_interrupt, > + .irq_clear = ata_bmdma_irq_clear, > + > + /* Generic PATA PCI ATA helpers */ > + .port_start = ata_port_start, > + .port_stop = ata_port_stop, > + .host_stop = ata_host_stop, > +}; > + > + > +/** > + * jmicron_init_one - Register Netcell ATA PCI device with kernel services > + * @pdev: PCI device to register > + * @ent: Entry in jmicron_pci_tbl matching with @pdev > + * > + * Called from kernel PCI layer. > + * > + * LOCKING: > + * Inherited from PCI layer (may sleep). > + * > + * RETURNS: > + * Zero on success, or -ERRNO value. > + */ > + > +static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) > +{ > + static struct ata_port_info info = { > + .sht = &jmicron_sht, > + .host_flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, > + > + .pio_mask = 0x1f, > + .mwdma_mask = 0x07, > + .udma_mask = 0x3f, > + > + .port_ops = &jmicron_ops, > + }; > + > + u32 reg; > + > + if (id->device_data != 368) { > + /* Put the controller into AHCI mode in case the AHCI driver > + has not yet been loaded. This can be done with either > + function present */ > + > + /* FIXME: We may want a way to override this in future */ > + pci_write_config_byte(pdev, 0x41, 0xa1); its easy enough to add a module_param() for this FIXME? > +MODULE_DESCRIPTION("SCSI low-level driver for Netcell PATA RAID"); obviously wrong :) ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 11/24] jmicron: Add quirks to force the device into a sane mode 2006-07-07 16:23 ` [PATCH 11/24] jmicron: Add quirks to force the device into a sane mode Jeff Garzik @ 2006-07-07 16:51 ` Alan Cox 0 siblings, 0 replies; 49+ messages in thread From: Alan Cox @ 2006-07-07 16:51 UTC (permalink / raw) To: Jeff Garzik; +Cc: akpm, linux-ide, Alan Cox Ar Gwe, 2006-07-07 am 12:23 -0400, ysgrifennodd Jeff Garzik: > > +MODULE_DESCRIPTION("SCSI low-level driver for Netcell PATA RAID"); > > obviously wrong :) Alread fixed by the end of the jmicron diffs in the queue. ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 07/24] libata: Fix the host_set hacks and sort out simplex mode 2006-07-04 18:15 ` [PATCH 07/24] libata: Fix the host_set hacks and sort out simplex mode alan 2006-07-04 18:15 ` [PATCH 08/24] pata_it821x: Fix pass through alan @ 2006-07-07 16:15 ` Jeff Garzik 2006-07-07 16:50 ` Alan Cox 1 sibling, 1 reply; 49+ messages in thread From: Jeff Garzik @ 2006-07-07 16:15 UTC (permalink / raw) To: alan; +Cc: akpm, linux-ide, root, Alan Cox alan@lxorguk.ukuu.org.uk wrote: > From: root <root@hraefn.swansea.linux.org.uk> > > A host_set and probe_ent now have an "irq2" field which is used for the > legacy interface cases. Currently we still check both ports on either IRQ > but a little thinking suggests this is only a minor performance glitch that > can be fixed later on. > > Also sorted out the FIXME for making port addresses for legacy ports adjustable > by platform. This may not be enough for PA-RISC and other platforms with PCI > bridges hung off a different primary bridge. We'll cross that bridge ;) when > we come to it. > > Alan > > Signed-off-by: Alan Cox <alan@redhat.com> I am thinking about touching this area heavily, for iomap support, in the next couple days. iomap support requires making irq/IO/MMIO resource handling more sane, and so should be a better patch than this (and heavily touches the same areas). FWIW, iomap means that, like MMIO (ioremap), you must map IO ports obtained from pci_resource_start(). If nothing happens in a few days, please yell at me, and I'll apply this patch and work on top of it. As it stands, it does some things I don't want (irq2) and wish to avoid. Some minor inline comments below, as well... > drivers/scsi/libata-bmdma.c | 134 ++++++++++++++++------------------- > drivers/scsi/libata-core.c | 40 ++++++++-- > include/asm-alpha/libata-portmap.h | 12 +++ > include/asm-i386/libata-portmap.h | 12 +++ > include/asm-x86_64/libata-portmap.h | 12 +++ > include/linux/libata.h | 5 + > 6 files changed, 135 insertions(+), 80 deletions(-) > create mode 100644 include/asm-alpha/libata-portmap.h > create mode 100644 include/asm-i386/libata-portmap.h > create mode 100644 include/asm-x86_64/libata-portmap.h > > 1addd5a92018c7ed53756bf84854e1b6b45c2d12 > diff --git a/drivers/scsi/libata-bmdma.c b/drivers/scsi/libata-bmdma.c > index 004e1a0..b1dfa8c 100644 > --- a/drivers/scsi/libata-bmdma.c > +++ b/drivers/scsi/libata-bmdma.c > @@ -881,7 +881,7 @@ ata_pci_init_native_mode(struct pci_dev > if (bmdma) { > bmdma += 8; > if(inb(bmdma + 2) & 0x80) > - probe_ent->host_set_flags |= ATA_HOST_SIMPLEX; > + probe_ent->host_set_flags |= ATA_HOST_SIMPLEX; > probe_ent->port[p].bmdma_addr = bmdma; > } > ata_std_ports(&probe_ent->port[p]); > @@ -894,45 +894,55 @@ ata_pci_init_native_mode(struct pci_dev > > > static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev, > - struct ata_port_info *port, int port_num) > + struct ata_port_info **port, int port_mask) > { > struct ata_probe_ent *probe_ent; > - unsigned long bmdma; > + unsigned long bmdma = pci_resource_start(pdev, 4); > + > + int port_num = 0; > > - probe_ent = ata_probe_ent_alloc(pci_dev_to_dev(pdev), port); > + probe_ent = ata_probe_ent_alloc(pci_dev_to_dev(pdev), port[0]); > if (!probe_ent) > return NULL; > > probe_ent->legacy_mode = 1; > probe_ent->n_ports = 1; > - probe_ent->hard_port_no = port_num; > - probe_ent->private_data = port->private_data; > + probe_ent->hard_port_no = 0; > + probe_ent->private_data = port[0]->private_data; > > - switch(port_num) > - { > - case 0: > - probe_ent->irq = 14; > - probe_ent->port[0].cmd_addr = 0x1f0; > - probe_ent->port[0].altstatus_addr = > - probe_ent->port[0].ctl_addr = 0x3f6; > - break; > - case 1: > - probe_ent->irq = 15; > - probe_ent->port[0].cmd_addr = 0x170; > - probe_ent->port[0].altstatus_addr = > - probe_ent->port[0].ctl_addr = 0x376; > - break; > + if (port_mask & ATA_PORT_PRIMARY) { > + probe_ent->irq = 14; > + probe_ent->port[port_num].cmd_addr = ATA_PRIMARY_CMD; > + probe_ent->port[port_num].altstatus_addr = > + probe_ent->port[port_num].ctl_addr = ATA_PRIMARY_CTL; > + if (bmdma) { > + probe_ent->port[0].bmdma_addr = bmdma; > + if (inb(bmdma + 2) & 0x80) > + probe_ent->host_set_flags |= ATA_HOST_SIMPLEX; > + } > + ata_std_ports(&probe_ent->port[port_num]); > + port_num ++; > } > - > - bmdma = pci_resource_start(pdev, 4); > - if (bmdma != 0) { > - bmdma += 8 * port_num; > - probe_ent->port[0].bmdma_addr = bmdma; > - if (inb(bmdma + 2) & 0x80) > - probe_ent->host_set_flags |= ATA_HOST_SIMPLEX; > + if (port_mask & ATA_PORT_SECONDARY) { > + if (port_num == 1) > + probe_ent->irq2 = 15; > + else { > + /* Secondary only. IRQ 15 only and "first" port is port 1 */ > + probe_ent->irq = 15; > + probe_ent->hard_port_no = 1; > + } > + probe_ent->port[port_num].cmd_addr = ATA_SECONDARY_CMD; > + probe_ent->port[port_num].altstatus_addr = > + probe_ent->port[port_num].ctl_addr = ATA_SECONDARY_CTL; > + port_num ++; > + if (bmdma) { > + probe_ent->port[port_num].bmdma_addr = bmdma + 8; > + if (inb(bmdma + 10) & 0x80) > + probe_ent->host_set_flags |= ATA_HOST_SIMPLEX; > + } > + ata_std_ports(&probe_ent->port[port_num]); > + port_num ++; > } > - ata_std_ports(&probe_ent->port[0]); > - this looks like a needed improvement > @@ -951,6 +961,10 @@ static struct ata_probe_ent *ata_pci_ini > * regions, sets the dma mask, enables bus master mode, and calls > * ata_device_add() > * > + * ASSUMPTION: > + * Nobody makes a single channel controller that appears solely as > + * the secondary legacy port on PCI. > + * > * LOCKING: > * Inherited from PCI layer (may sleep). > * > @@ -961,7 +975,7 @@ static struct ata_probe_ent *ata_pci_ini > int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, > unsigned int n_ports) > { > - struct ata_probe_ent *probe_ent = NULL, *probe_ent2 = NULL; > + struct ata_probe_ent *probe_ent = NULL; > struct ata_port_info *port[2]; > u8 tmp8, mask; > unsigned int legacy_mode = 0; > @@ -1010,35 +1024,34 @@ int ata_pci_init_one (struct pci_dev *pd > goto err_out; > } > > - /* FIXME: Should use platform specific mappers for legacy port ranges */ > if (legacy_mode) { > - if (!request_region(0x1f0, 8, "libata")) { > + if (!request_region(ATA_PRIMARY_CMD, 8, "libata")) { > struct resource *conflict, res; > - res.start = 0x1f0; > - res.end = 0x1f0 + 8 - 1; > + res.start = ATA_PRIMARY_CMD; > + res.end = ATA_PRIMARY_CMD + 8 - 1; > conflict = ____request_resource(&ioport_resource, &res); > if (!strcmp(conflict->name, "libata")) > - legacy_mode |= (1 << 0); > + legacy_mode |= ATA_PORT_PRIMARY; > else { > disable_dev_on_err = 0; > - printk(KERN_WARNING "ata: 0x1f0 IDE port busy\n"); > + printk(KERN_WARNING "ata: 0x%0X IDE port busy\n", ATA_PRIMARY_CMD); > } > } else > - legacy_mode |= (1 << 0); > + legacy_mode |= ATA_PORT_PRIMARY; > > - if (!request_region(0x170, 8, "libata")) { > + if (!request_region(ATA_SECONDARY_CMD, 8, "libata")) { > struct resource *conflict, res; > - res.start = 0x170; > - res.end = 0x170 + 8 - 1; > + res.start = ATA_SECONDARY_CMD; > + res.end = ATA_SECONDARY_CMD + 8 - 1; > conflict = ____request_resource(&ioport_resource, &res); > if (!strcmp(conflict->name, "libata")) > - legacy_mode |= (1 << 1); > + legacy_mode |= ATA_PORT_SECONDARY; > else { > disable_dev_on_err = 0; > - printk(KERN_WARNING "ata: 0x170 IDE port busy\n"); > + printk(KERN_WARNING "ata: 0x%X IDE port busy\n", ATA_SECONDARY_CMD); > } > } else > - legacy_mode |= (1 << 1); > + legacy_mode |= ATA_PORT_SECONDARY; > } > > /* we have legacy mode, but all ports are unavailable */ > @@ -1056,17 +1069,14 @@ int ata_pci_init_one (struct pci_dev *pd > goto err_out_regions; > > if (legacy_mode) { > - if (legacy_mode & (1 << 0)) > - probe_ent = ata_pci_init_legacy_port(pdev, port[0], 0); > - if (legacy_mode & (1 << 1)) > - probe_ent2 = ata_pci_init_legacy_port(pdev, port[1], 1); > + probe_ent = ata_pci_init_legacy_port(pdev, port, legacy_mode); > } else { > if (n_ports == 2) > probe_ent = ata_pci_init_native_mode(pdev, port, ATA_PORT_PRIMARY | ATA_PORT_SECONDARY); > else > probe_ent = ata_pci_init_native_mode(pdev, port, ATA_PORT_PRIMARY); > } > - if (!probe_ent && !probe_ent2) { > + if (!probe_ent) { > rc = -ENOMEM; > goto err_out_regions; > } ditto, some nice cleanups of ugly (but necessary) code > @@ -1074,35 +1084,17 @@ int ata_pci_init_one (struct pci_dev *pd > pci_set_master(pdev); > > /* FIXME: check ata_device_add return */ > - if (legacy_mode) { > - struct device *dev = &pdev->dev; > - struct ata_host_set *host_set = NULL; > - > - if (legacy_mode & (1 << 0)) { > - ata_device_add(probe_ent); > - host_set = dev_get_drvdata(dev); > - } > - > - if (legacy_mode & (1 << 1)) { > - ata_device_add(probe_ent2); > - if (host_set) { > - host_set->next = dev_get_drvdata(dev); > - dev_set_drvdata(dev, host_set); > - } > - } > - } else > - ata_device_add(probe_ent); > + ata_device_add(probe_ent); > > kfree(probe_ent); > - kfree(probe_ent2); > > return 0; > > err_out_regions: > - if (legacy_mode & (1 << 0)) > - release_region(0x1f0, 8); > - if (legacy_mode & (1 << 1)) > - release_region(0x170, 8); > + if (legacy_mode & ATA_PORT_PRIMARY) > + release_region(ATA_PRIMARY_CMD, 8); > + if (legacy_mode & ATA_PORT_SECONDARY) > + release_region(ATA_SECONDARY_CMD, 8); > pci_release_regions(pdev); ditto > diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c > index d1c1c30..cc6ae67 100644 > --- a/drivers/scsi/libata-core.c > +++ b/drivers/scsi/libata-core.c > @@ -5232,6 +5232,7 @@ static void ata_host_init(struct ata_por > ap->host_set = host_set; > ap->dev = ent->dev; > ap->port_no = port_no; > + > ap->hard_port_no = > ent->legacy_mode ? ent->hard_port_no : port_no; > ap->pio_mask = ent->pio_mask; > @@ -5367,6 +5368,7 @@ int ata_device_add(const struct ata_prob > host_set->dev = dev; > host_set->n_ports = ent->n_ports; > host_set->irq = ent->irq; > + host_set->irq2 = ent->irq2; > host_set->mmio_base = ent->mmio_base; > host_set->private_data = ent->private_data; > host_set->ops = ent->port_ops; > @@ -5376,16 +5378,23 @@ int ata_device_add(const struct ata_prob > for (i = 0; i < ent->n_ports; i++) { > struct ata_port *ap; > unsigned long xfer_mode_mask; > + int irq_line = ent->irq; > + > > ap = ata_host_add(ent, host_set, i); > if (!ap) > goto err_out; > > + /* Report the secondary IRQ for second channel legacy */ > + if (i == 1 && ent->irq2) > + irq_line = ent->irq2; > + > host_set->ports[i] = ap; > xfer_mode_mask =(ap->udma_mask << ATA_SHIFT_UDMA) | > (ap->mwdma_mask << ATA_SHIFT_MWDMA) | > (ap->pio_mask << ATA_SHIFT_PIO); > > + /* FIXME: maybe print both IRQ lines ? */ > /* print per-port info to dmesg */ > ata_port_printk(ap, KERN_INFO, "%cATA max %s cmd 0x%lX " > "ctl 0x%lX bmdma 0x%lX irq %lu\n", > @@ -5405,7 +5414,7 @@ int ata_device_add(const struct ata_prob > if (!count) > goto err_free_ret; > > - /* obtain irq, that is shared between channels */ > + /* obtain irq, that may be shared between channels */ > rc = request_irq(ent->irq, ent->port_ops->irq_handler, ent->irq_flags, > DRV_NAME, host_set); > if (rc) { > @@ -5414,6 +5423,21 @@ int ata_device_add(const struct ata_prob > goto err_out; > } > > + /* do we have a second IRQ for the other channel, eg legacy mode */ > + if (ent->irq2) { > + /* We will get weird core code crashes later if this is true > + so trap it now */ > + BUG_ON(ent->irq == ent->irq2); > + > + rc = request_irq(ent->irq2, ent->port_ops->irq_handler, ent->irq_flags, > + DRV_NAME, host_set); > + if (rc) { > + dev_printk(KERN_ERR, dev, "irq %lu request failed: %d\n", > + ent->irq2, rc); > + goto err_out; > + } > + } > + > /* perform each probe synchronously */ > DPRINTK("probe begin\n"); > for (i = 0; i < count; i++) { As you know, this is the nasty part that I _really_ want to avoid. This is compounding my design mistake of putting request_irq() in the core code. Such code is appropriate ONLY in libata-bmdma.c (PCI IDE-specific code). > @@ -5574,6 +5598,8 @@ void ata_host_set_remove(struct ata_host > ata_port_detach(host_set->ports[i]); > > free_irq(host_set->irq, host_set); > + if (host_set->irq2) > + free_irq(host_set->irq2, host_set); > > for (i = 0; i < host_set->n_ports; i++) { > struct ata_port *ap = host_set->ports[i]; > @@ -5583,10 +5609,11 @@ void ata_host_set_remove(struct ata_host > if ((ap->flags & ATA_FLAG_NO_LEGACY) == 0) { > struct ata_ioports *ioaddr = &ap->ioaddr; > > - if (ioaddr->cmd_addr == 0x1f0) > - release_region(0x1f0, 8); > - else if (ioaddr->cmd_addr == 0x170) > - release_region(0x170, 8); > + /* FIXME: Add -ac IDE pci mods to remove these special cases */ > + if (ioaddr->cmd_addr == ATA_PRIMARY_CMD) > + release_region(ATA_PRIMARY_CMD, 8); > + else if (ioaddr->cmd_addr == ATA_SECONDARY_CMD) > + release_region(ATA_SECONDARY_CMD, 8); > } > > scsi_host_put(ap->host); FWIW, this is also the area where ioport_unmap() calls will go. > @@ -5679,11 +5706,8 @@ void ata_pci_remove_one (struct pci_dev > { > struct device *dev = pci_dev_to_dev(pdev); > struct ata_host_set *host_set = dev_get_drvdata(dev); > - struct ata_host_set *host_set2 = host_set->next; > > ata_host_set_remove(host_set); > - if (host_set2) > - ata_host_set_remove(host_set2); > > pci_release_regions(pdev); > pci_disable_device(pdev); Though it is very nice to remove host_set->next. > diff --git a/include/asm-alpha/libata-portmap.h b/include/asm-alpha/libata-portmap.h > new file mode 100644 > index 0000000..9202fd0 > --- /dev/null > +++ b/include/asm-alpha/libata-portmap.h > @@ -0,0 +1,12 @@ > +#ifndef __ASM_GENERIC_LIBATA_PORTMAP_H > +#define __ASM_GENERIC_LIBATA_PORTMAP_H > + > +#define ATA_PRIMARY_CMD 0x1F0 > +#define ATA_PRIMARY_CTL 0x3F6 > +#define ATA_PRIMARY_IRQ 14 > + > +#define ATA_SECONDARY_CMD 0x170 > +#define ATA_SECONDARY_CTL 0x376 > +#define ATA_SECONDARY_IRQ 15 > + > +#endif > diff --git a/include/asm-i386/libata-portmap.h b/include/asm-i386/libata-portmap.h > new file mode 100644 > index 0000000..9202fd0 > --- /dev/null > +++ b/include/asm-i386/libata-portmap.h > @@ -0,0 +1,12 @@ > +#ifndef __ASM_GENERIC_LIBATA_PORTMAP_H > +#define __ASM_GENERIC_LIBATA_PORTMAP_H > + > +#define ATA_PRIMARY_CMD 0x1F0 > +#define ATA_PRIMARY_CTL 0x3F6 > +#define ATA_PRIMARY_IRQ 14 > + > +#define ATA_SECONDARY_CMD 0x170 > +#define ATA_SECONDARY_CTL 0x376 > +#define ATA_SECONDARY_IRQ 15 > + > +#endif > diff --git a/include/asm-x86_64/libata-portmap.h b/include/asm-x86_64/libata-portmap.h > new file mode 100644 > index 0000000..9202fd0 > --- /dev/null > +++ b/include/asm-x86_64/libata-portmap.h > @@ -0,0 +1,12 @@ > +#ifndef __ASM_GENERIC_LIBATA_PORTMAP_H > +#define __ASM_GENERIC_LIBATA_PORTMAP_H > + > +#define ATA_PRIMARY_CMD 0x1F0 > +#define ATA_PRIMARY_CTL 0x3F6 > +#define ATA_PRIMARY_IRQ 14 > + > +#define ATA_SECONDARY_CMD 0x170 > +#define ATA_SECONDARY_CTL 0x376 > +#define ATA_SECONDARY_IRQ 15 > + > +#endif This is either silly, or obviously-preliminary code. We don't want to duplicate this information, but instead do as your __ASM_GENERIC_LIBATA_PORTMAP_H symbol implies: put a single copy into include/asm-generic. ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: [PATCH 07/24] libata: Fix the host_set hacks and sort out simplex mode 2006-07-07 16:15 ` [PATCH 07/24] libata: Fix the host_set hacks and sort out simplex mode Jeff Garzik @ 2006-07-07 16:50 ` Alan Cox 0 siblings, 0 replies; 49+ messages in thread From: Alan Cox @ 2006-07-07 16:50 UTC (permalink / raw) To: Jeff Garzik; +Cc: akpm, linux-ide, Alan Cox Ar Gwe, 2006-07-07 am 12:15 -0400, ysgrifennodd Jeff Garzik: > If nothing happens in a few days, please yell at me, and I'll apply this > patch and work on top of it. As it stands, it does some things I don't > want (irq2) and wish to avoid. If nothing happens in the next few days it'll be OLS so I'll beat you [verbally] senseless in person ;) I agree with your "push IRQ out of libata" direction so I'm more than happy to see it go that way > Such code is appropriate ONLY in libata-bmdma.c (PCI IDE-specific code). I wish you'd rename that file, its got very little to do with BMDMA and very much to do with ST506/SFF. > > +#define ATA_SECONDARY_CMD 0x170 > > +#define ATA_SECONDARY_CTL 0x376 > > +#define ATA_SECONDARY_IRQ 15 > > + > > +#endif > > This is either silly, or obviously-preliminary code. > > We don't want to duplicate this information, but instead do as your > __ASM_GENERIC_LIBATA_PORTMAP_H symbol implies: put a single copy into > include/asm-generic. Its the first cut. I need to rework it a little because it turns out that for some platforms you can only answer the question "what port is legacy IDE on" if you know the PCI root bridge. In fact some boxes may have multiple legacy mode IDE devices each on "0x1F0" as far as the PCI bus is concerned and elsewhere as far as the bridge to cpu mapping is concerned. I'm still pondering that particular vomitous mess and I'd prefer to shoot all the special cases here and do what I'm testing in the patches which is to spot legacy mode IDE and "fix" the bars up when reading the otherwise invalid PCI registers in that mode. Alan ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: PATA updates (rebased) 2006-07-04 18:14 PATA updates (rebased) alan 2006-07-04 18:14 ` [PATCH 01/24] ata_piix TIME0/TIME1 setup alan @ 2006-07-05 12:44 ` Erik Mouw 2006-07-05 16:15 ` Alan Cox 2006-07-07 16:07 ` Jeff Garzik 2 siblings, 1 reply; 49+ messages in thread From: Erik Mouw @ 2006-07-05 12:44 UTC (permalink / raw) To: alan; +Cc: jgarzik, akpm, linux-ide On Tue, Jul 04, 2006 at 06:15:43PM +0000, alan@lxorguk.ukuu.org.uk wrote: > PATA updates rebased onto latest tree Against which latest tree exactly? Erik -- +-- Erik Mouw -- www.harddisk-recovery.com -- +31 70 370 12 90 -- | Lab address: Delftechpark 26, 2628 XH, Delft, The Netherlands ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: PATA updates (rebased) 2006-07-05 12:44 ` PATA updates (rebased) Erik Mouw @ 2006-07-05 16:15 ` Alan Cox 0 siblings, 0 replies; 49+ messages in thread From: Alan Cox @ 2006-07-05 16:15 UTC (permalink / raw) To: Erik Mouw; +Cc: jgarzik, akpm, linux-ide Ar Mer, 2006-07-05 am 14:44 +0200, ysgrifennodd Erik Mouw: > On Tue, Jul 04, 2006 at 06:15:43PM +0000, alan@lxorguk.ukuu.org.uk wrote: > > PATA updates rebased onto latest tree > > Against which latest tree exactly? libata-dev:#pata-drivers I did look at shifting it to 2.6.17 but the pata driver changes suck in the new eh which sucks in post 2.6.17 scsi bits ^ permalink raw reply [flat|nested] 49+ messages in thread
* Re: PATA updates (rebased) 2006-07-04 18:14 PATA updates (rebased) alan 2006-07-04 18:14 ` [PATCH 01/24] ata_piix TIME0/TIME1 setup alan 2006-07-05 12:44 ` PATA updates (rebased) Erik Mouw @ 2006-07-07 16:07 ` Jeff Garzik 2 siblings, 0 replies; 49+ messages in thread From: Jeff Garzik @ 2006-07-07 16:07 UTC (permalink / raw) To: alan; +Cc: akpm, linux-ide alan@lxorguk.ukuu.org.uk wrote: > PATA updates rebased onto latest tree > > Adds full support for Jmicron controllers including the PATA port which means > you can finally install Linux on a system with the CD on a PATA jmicron port. > > Turns on per device speed setting Merged patches 1-6, 8-10 so far. ^ permalink raw reply [flat|nested] 49+ messages in thread
end of thread, other threads:[~2006-07-07 20:05 UTC | newest]
Thread overview: 49+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-04 18:14 PATA updates (rebased) alan
2006-07-04 18:14 ` [PATCH 01/24] ata_piix TIME0/TIME1 setup alan
2006-07-04 18:14 ` [PATCH 02/24] pata_ali - further debug work alan
2006-07-04 18:15 ` [PATCH 03/24] pata_amd - new chips alan
2006-07-04 18:17 ` [PATCH 04/24] pata_pcmcia: Make drivers/scsi/pata_pcmcia.c:pcmcia_remove_one() static alan
2006-07-04 18:14 ` [PATCH 05/24] pata_ali: Revisions below 0x20 need CD config poking too alan
2006-07-04 18:14 ` [PATCH 06/24] Sort out MC65 compile for now alan
2006-07-04 18:15 ` [PATCH 07/24] libata: Fix the host_set hacks and sort out simplex mode alan
2006-07-04 18:15 ` [PATCH 08/24] pata_it821x: Fix pass through alan
2006-07-04 18:14 ` [PATCH 09/24] pci_ids: Add JMicron identifiers as we need them in various drivers and quirks alan
2006-07-04 18:14 ` [PATCH 10/24] ahci: Ensure that we don't grab both functions alan
2006-07-04 18:14 ` [PATCH 11/24] jmicron: Add quirks to force the device into a sane mode alan
2006-07-04 18:14 ` [PATCH 12/24] jmicron: Configuration alan
2006-07-04 18:14 ` [PATCH 13/24] My name is Ingo Molnar, you killed my make allyesconfig, prepare to die alan
2006-07-04 18:15 ` [PATCH 14/24] it821x: Fix the ATAPI autodma setup alan
2006-07-04 18:14 ` [PATCH 15/24] ata_generic - generic BIOS setup SFF ATA driver alan
2006-07-04 18:15 ` [PATCH 16/24] jmicron: IDE old type driver alan
2006-07-04 18:15 ` [PATCH 17/24] pata_qdi: Fix return code alan
2006-07-04 18:15 ` [PATCH 18/24] ide jmicron: Finish writing alan
2006-07-04 18:15 ` [PATCH 19/24] jmicron: It works better if you get the file name right alan
2006-07-04 18:15 ` [PATCH 20/24] jmicron: Further clean up alan
2006-07-04 18:15 ` [PATCH 21/24] ata_jmicro: Fix an escapee alan
2006-07-04 18:14 ` [PATCH 22/24] jmicron: Jmicron multifunction setup alan
2006-07-04 18:15 ` [PATCH 23/24] libata: Enable per device speed setting alan
2006-07-04 18:15 ` [PATCH 24/24] jmicron: Missed one alan
2006-07-07 16:36 ` Jeff Garzik
2006-07-07 16:39 ` [PATCH 23/24] libata: Enable per device speed setting Jeff Garzik
2006-07-07 17:06 ` Alan Cox
2006-07-07 16:34 ` [PATCH 22/24] jmicron: Jmicron multifunction setup Jeff Garzik
[not found] ` <20060707124359.670e84c6.akpm@osdl.o! rg>
2006-07-07 19:43 ` Andrew Morton
2006-07-07 19:48 ` Jeff Garzik
2006-07-07 20:01 ` Andrew Morton
2006-07-07 20:05 ` Jeff Garzik
2006-07-07 19:45 ` Andrew Morton
2006-07-07 19:50 ` Jeff Garzik
2006-07-07 16:35 ` Jeff Garzik
2006-07-07 16:31 ` [PATCH 17/24] pata_qdi: Fix return code Jeff Garzik
2006-07-07 16:31 ` [PATCH 15/24] ata_generic - generic BIOS setup SFF ATA driver Jeff Garzik
2006-07-07 17:20 ` Alan Cox
2006-07-07 17:22 ` Jeff Garzik
2006-07-07 16:26 ` [PATCH 14/24] it821x: Fix the ATAPI autodma setup Jeff Garzik
2006-07-07 16:25 ` [PATCH 13/24] My name is Ingo Molnar, you killed my make allyesconfig, prepare to die Jeff Garzik
2006-07-07 16:23 ` [PATCH 11/24] jmicron: Add quirks to force the device into a sane mode Jeff Garzik
2006-07-07 16:51 ` Alan Cox
2006-07-07 16:15 ` [PATCH 07/24] libata: Fix the host_set hacks and sort out simplex mode Jeff Garzik
2006-07-07 16:50 ` Alan Cox
2006-07-05 12:44 ` PATA updates (rebased) Erik Mouw
2006-07-05 16:15 ` Alan Cox
2006-07-07 16:07 ` Jeff Garzik
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).