From 5f068992a1bccda5574b4f6d33458ef806686d7f Mon Sep 17 00:00:00 2001 From: Roland Dreier Date: Fri, 11 Nov 2005 14:06:01 -0800 Subject: [IB] srp: increase max_luns Increase SRP max_luns to 512 to match the kernel's default, since SRP storage targets can have lots of LUNs and the SRP initiator itself doesn't have any particular limit. Signed-off-by: Roland Dreier --- drivers/infiniband/ulp/srp/ib_srp.c | 2 ++ drivers/infiniband/ulp/srp/ib_srp.h | 1 + 2 files changed, 3 insertions(+) (limited to 'drivers') diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 321a3a10e69..a3645303cb9 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -1417,6 +1417,8 @@ static ssize_t srp_create_target(struct class_device *class_dev, if (!target_host) return -ENOMEM; + target_host->max_lun = SRP_MAX_LUN; + target = host_to_target(target_host); memset(target, 0, sizeof *target); diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h index 4fec28a7136..b564f18caf7 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.h +++ b/drivers/infiniband/ulp/srp/ib_srp.h @@ -54,6 +54,7 @@ enum { SRP_PORT_REDIRECT = 1, SRP_DLID_REDIRECT = 2, + SRP_MAX_LUN = 512, SRP_MAX_IU_LEN = 256, SRP_RQ_SHIFT = 6, -- cgit v1.2.3 From 095fec887eaa1c38d17c0c929a6733c744a9fa1f Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Sat, 12 Nov 2005 09:50:49 -0500 Subject: [libata sata_mv] minor fixes - clear SError and EDMA irq cause registers, after re-init'ing the phy - move enums with type suffix 'U' to their own enum --- drivers/scsi/sata_mv.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'drivers') diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index 257c128f4aa..82d1750e779 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c @@ -72,11 +72,6 @@ enum { MV_SG_TBL_SZ = (16 * MV_MAX_SG_CT), MV_PORT_PRIV_DMA_SZ = (MV_CRQB_Q_SZ + MV_CRPB_Q_SZ + MV_SG_TBL_SZ), - /* Our DMA boundary is determined by an ePRD being unable to handle - * anything larger than 64KB - */ - MV_DMA_BOUNDARY = 0xffffU, - MV_PORTS_PER_HC = 4, /* == (port / MV_PORTS_PER_HC) to determine HC from 0-7 port */ MV_PORT_HC_SHIFT = 2, @@ -192,7 +187,6 @@ enum { EDMA_REQ_Q_BASE_HI_OFS = 0x10, EDMA_REQ_Q_IN_PTR_OFS = 0x14, /* also contains BASE_LO */ - EDMA_REQ_Q_BASE_LO_MASK = 0xfffffc00U, EDMA_REQ_Q_OUT_PTR_OFS = 0x18, EDMA_REQ_Q_PTR_SHIFT = 5, @@ -200,7 +194,6 @@ enum { EDMA_RSP_Q_BASE_HI_OFS = 0x1c, EDMA_RSP_Q_IN_PTR_OFS = 0x20, EDMA_RSP_Q_OUT_PTR_OFS = 0x24, /* also contains BASE_LO */ - EDMA_RSP_Q_BASE_LO_MASK = 0xffffff00U, EDMA_RSP_Q_PTR_SHIFT = 3, EDMA_CMD_OFS = 0x28, @@ -216,6 +209,17 @@ enum { MV_PP_FLAG_EDMA_DS_ACT = (1 << 1), }; +enum { + /* Our DMA boundary is determined by an ePRD being unable to handle + * anything larger than 64KB + */ + MV_DMA_BOUNDARY = 0xffffU, + + EDMA_REQ_Q_BASE_LO_MASK = 0xfffffc00U, + + EDMA_RSP_Q_BASE_LO_MASK = 0xffffff00U, +}; + /* Command ReQuest Block: 32B */ struct mv_crqb { u32 sg_addr; @@ -1215,6 +1219,7 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance, */ static void mv_phy_reset(struct ata_port *ap) { + struct mv_port_priv *pp = ap->private_data; void __iomem *port_mmio = mv_ap_base(ap); struct ata_taskfile tf; struct ata_device *dev = &ap->device[0]; @@ -1232,7 +1237,7 @@ static void mv_phy_reset(struct ata_port *ap) */ writelfl(0, port_mmio + EDMA_CMD_OFS); - VPRINTK("S-regs after ATA_RST: SStat 0x%08x SErr 0x%08x " + DPRINTK("S-regs after ATA_RST: SStat 0x%08x SErr 0x%08x " "SCtrl 0x%08x\n", mv_scr_read(ap, SCR_STATUS), mv_scr_read(ap, SCR_ERROR), mv_scr_read(ap, SCR_CONTROL)); @@ -1247,7 +1252,9 @@ static void mv_phy_reset(struct ata_port *ap) break; } while (time_before(jiffies, timeout)); - VPRINTK("S-regs after PHY wake: SStat 0x%08x SErr 0x%08x " + mv_scr_write(ap, SCR_ERROR, mv_scr_read(ap, SCR_ERROR)); + + DPRINTK("S-regs after PHY wake: SStat 0x%08x SErr 0x%08x " "SCtrl 0x%08x\n", mv_scr_read(ap, SCR_STATUS), mv_scr_read(ap, SCR_ERROR), mv_scr_read(ap, SCR_CONTROL)); @@ -1271,7 +1278,12 @@ static void mv_phy_reset(struct ata_port *ap) VPRINTK("Port disabled post-sig: No device present.\n"); ata_port_disable(ap); } - VPRINTK("EXIT\n"); + + writelfl(0, port_mmio + EDMA_ERR_IRQ_CAUSE_OFS); + + pp->pp_flags &= ~MV_PP_FLAG_EDMA_EN; + + printk("EXIT\n"); } /** -- cgit v1.2.3 From 8b260248d9e0e8b64bb72fd4dee03ad86984c344 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Sat, 12 Nov 2005 12:32:50 -0500 Subject: [libata sata_mv] trim trailing whitespace --- drivers/scsi/sata_mv.c | 76 +++++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 38 deletions(-) (limited to 'drivers') diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index 82d1750e779..26e9d51e6ca 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c @@ -1,7 +1,7 @@ /* * sata_mv.c - Marvell SATA support * - * Copyright 2005: EMC Corporation, all rights reserved. + * Copyright 2005: EMC Corporation, all rights reserved. * * Please ALWAYS copy linux-ide@vger.kernel.org on emails. * @@ -84,7 +84,7 @@ enum { MV_FLAG_GLBL_SFT_RST = (1 << 28), /* Global Soft Reset support */ MV_COMMON_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO), - MV_6XXX_FLAGS = (MV_FLAG_IRQ_COALESCE | + MV_6XXX_FLAGS = (MV_FLAG_IRQ_COALESCE | MV_FLAG_GLBL_SFT_RST), chip_504x = 0, @@ -129,7 +129,7 @@ enum { SELF_INT = (1 << 23), TWSI_INT = (1 << 24), HC_MAIN_RSVD = (0x7f << 25), /* bits 31-25 */ - HC_MAIN_MASKED_IRQS = (TRAN_LO_DONE | TRAN_HI_DONE | + HC_MAIN_MASKED_IRQS = (TRAN_LO_DONE | TRAN_HI_DONE | PORTS_0_7_COAL_DONE | GPIO_INT | TWSI_INT | HC_MAIN_RSVD), @@ -177,12 +177,12 @@ enum { EDMA_ERR_LNK_CTRL_TX = (0x1f << 21), EDMA_ERR_LNK_DATA_TX = (0x1f << 26), EDMA_ERR_TRANS_PROTO = (1 << 31), - EDMA_ERR_FATAL = (EDMA_ERR_D_PAR | EDMA_ERR_PRD_PAR | + EDMA_ERR_FATAL = (EDMA_ERR_D_PAR | EDMA_ERR_PRD_PAR | EDMA_ERR_DEV_DCON | EDMA_ERR_CRBQ_PAR | EDMA_ERR_CRPB_PAR | EDMA_ERR_INTRL_PAR | - EDMA_ERR_IORDY | EDMA_ERR_LNK_CTRL_RX_2 | + EDMA_ERR_IORDY | EDMA_ERR_LNK_CTRL_RX_2 | EDMA_ERR_LNK_DATA_RX | - EDMA_ERR_LNK_DATA_TX | + EDMA_ERR_LNK_DATA_TX | EDMA_ERR_TRANS_PROTO), EDMA_REQ_Q_BASE_HI_OFS = 0x10, @@ -345,7 +345,7 @@ static struct ata_port_info mv_port_info[] = { }, { /* chip_608x */ .sht = &mv_sht, - .host_flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS | + .host_flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS | MV_FLAG_DUAL_HC), .pio_mask = 0x1f, /* pio0-4 */ .udma_mask = 0x7f, /* udma0-6 */ @@ -393,7 +393,7 @@ static inline void __iomem *mv_hc_base(void __iomem *base, unsigned int hc) static inline void __iomem *mv_port_base(void __iomem *base, unsigned int port) { return (mv_hc_base(base, port >> MV_PORT_HC_SHIFT) + - MV_SATAHC_ARBTR_REG_SZ + + MV_SATAHC_ARBTR_REG_SZ + ((port & MV_PORT_MASK) * MV_PORT_REG_SZ)); } @@ -456,7 +456,7 @@ static void mv_stop_dma(struct ata_port *ap) } else { assert(!(EDMA_EN & readl(port_mmio + EDMA_CMD_OFS))); } - + /* now properly wait for the eDMA to stop */ for (i = 1000; i > 0; i--) { reg = readl(port_mmio + EDMA_CMD_OFS); @@ -507,7 +507,7 @@ static void mv_dump_all_regs(void __iomem *mmio_base, int port, struct pci_dev *pdev) { #ifdef ATA_DEBUG - void __iomem *hc_base = mv_hc_base(mmio_base, + void __iomem *hc_base = mv_hc_base(mmio_base, port >> MV_PORT_HC_SHIFT); void __iomem *port_base; int start_port, num_ports, p, start_hc, num_hcs, hc; @@ -521,7 +521,7 @@ static void mv_dump_all_regs(void __iomem *mmio_base, int port, start_port = port; num_ports = num_hcs = 1; } - DPRINTK("All registers for port(s) %u-%u:\n", start_port, + DPRINTK("All registers for port(s) %u-%u:\n", start_port, num_ports > 1 ? num_ports - 1 : start_port); if (NULL != pdev) { @@ -705,7 +705,7 @@ static int mv_port_start(struct ata_port *ap) goto err_out; memset(pp, 0, sizeof(*pp)); - mem = dma_alloc_coherent(dev, MV_PORT_PRIV_DMA_SZ, &mem_dma, + mem = dma_alloc_coherent(dev, MV_PORT_PRIV_DMA_SZ, &mem_dma, GFP_KERNEL); if (!mem) goto err_out_pp; @@ -715,7 +715,7 @@ static int mv_port_start(struct ata_port *ap) if (rc) goto err_out_priv; - /* First item in chunk of DMA memory: + /* First item in chunk of DMA memory: * 32-slot command request table (CRQB), 32 bytes each in size */ pp->crqb = mem; @@ -723,7 +723,7 @@ static int mv_port_start(struct ata_port *ap) mem += MV_CRQB_Q_SZ; mem_dma += MV_CRQB_Q_SZ; - /* Second item: + /* Second item: * 32-slot command response table (CRPB), 8 bytes each in size */ pp->crpb = mem; @@ -737,18 +737,18 @@ static int mv_port_start(struct ata_port *ap) pp->sg_tbl = mem; pp->sg_tbl_dma = mem_dma; - writelfl(EDMA_CFG_Q_DEPTH | EDMA_CFG_RD_BRST_EXT | + writelfl(EDMA_CFG_Q_DEPTH | EDMA_CFG_RD_BRST_EXT | EDMA_CFG_WR_BUFF_LEN, port_mmio + EDMA_CFG_OFS); writel((pp->crqb_dma >> 16) >> 16, port_mmio + EDMA_REQ_Q_BASE_HI_OFS); - writelfl(pp->crqb_dma & EDMA_REQ_Q_BASE_LO_MASK, + writelfl(pp->crqb_dma & EDMA_REQ_Q_BASE_LO_MASK, port_mmio + EDMA_REQ_Q_IN_PTR_OFS); writelfl(0, port_mmio + EDMA_REQ_Q_OUT_PTR_OFS); writelfl(0, port_mmio + EDMA_RSP_Q_IN_PTR_OFS); writel((pp->crpb_dma >> 16) >> 16, port_mmio + EDMA_RSP_Q_BASE_HI_OFS); - writelfl(pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK, + writelfl(pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK, port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); pp->req_producer = pp->rsp_consumer = 0; @@ -863,7 +863,7 @@ static void mv_qc_prep(struct ata_queued_cmd *qc) } /* the req producer index should be the same as we remember it */ - assert(((readl(mv_ap_base(qc->ap) + EDMA_REQ_Q_IN_PTR_OFS) >> + assert(((readl(mv_ap_base(qc->ap) + EDMA_REQ_Q_IN_PTR_OFS) >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == pp->req_producer); @@ -875,9 +875,9 @@ static void mv_qc_prep(struct ata_queued_cmd *qc) assert(MV_MAX_Q_DEPTH > qc->tag); flags |= qc->tag << CRQB_TAG_SHIFT; - pp->crqb[pp->req_producer].sg_addr = + pp->crqb[pp->req_producer].sg_addr = cpu_to_le32(pp->sg_tbl_dma & 0xffffffff); - pp->crqb[pp->req_producer].sg_addr_hi = + pp->crqb[pp->req_producer].sg_addr_hi = cpu_to_le32((pp->sg_tbl_dma >> 16) >> 16); pp->crqb[pp->req_producer].ctrl_flags = cpu_to_le16(flags); @@ -900,7 +900,7 @@ static void mv_qc_prep(struct ata_queued_cmd *qc) #ifdef LIBATA_NCQ /* FIXME: remove this line when NCQ added */ case ATA_CMD_FPDMA_READ: case ATA_CMD_FPDMA_WRITE: - mv_crqb_pack_cmd(cw++, tf->hob_feature, ATA_REG_FEATURE, 0); + mv_crqb_pack_cmd(cw++, tf->hob_feature, ATA_REG_FEATURE, 0); mv_crqb_pack_cmd(cw++, tf->feature, ATA_REG_FEATURE, 0); break; #endif /* FIXME: remove this line when NCQ added */ @@ -966,7 +966,7 @@ static int mv_qc_issue(struct ata_queued_cmd *qc) pp->req_producer); /* until we do queuing, the queue should be empty at this point */ assert(((in_ptr >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == - ((readl(port_mmio + EDMA_REQ_Q_OUT_PTR_OFS) >> + ((readl(port_mmio + EDMA_REQ_Q_OUT_PTR_OFS) >> EDMA_REQ_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK)); mv_inc_q_index(&pp->req_producer); /* now incr producer index */ @@ -1003,15 +1003,15 @@ static u8 mv_get_crpb_status(struct ata_port *ap) out_ptr = readl(port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); /* the response consumer index should be the same as we remember it */ - assert(((out_ptr >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == + assert(((out_ptr >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == pp->rsp_consumer); /* increment our consumer index... */ pp->rsp_consumer = mv_inc_q_index(&pp->rsp_consumer); - + /* and, until we do NCQ, there should only be 1 CRPB waiting */ - assert(((readl(port_mmio + EDMA_RSP_Q_IN_PTR_OFS) >> - EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == + assert(((readl(port_mmio + EDMA_RSP_Q_IN_PTR_OFS) >> + EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) == pp->rsp_consumer); /* write out our inc'd consumer index so EDMA knows we're caught up */ @@ -1135,7 +1135,7 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, err_mask |= AC_ERR_OTHER; handled++; } - + if (handled && ap) { qc = ata_qc_from_tag(ap, ap->active_tag); if (NULL != qc) { @@ -1150,7 +1150,7 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, } /** - * mv_interrupt - + * mv_interrupt - * @irq: unused * @dev_instance: private data; in this case the host structure * @regs: unused @@ -1160,7 +1160,7 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, * routine to handle. Also check for PCI errors which are only * reported here. * - * LOCKING: + * LOCKING: * This routine holds the host_set lock while processing pending * interrupts. */ @@ -1303,12 +1303,12 @@ static void mv_eng_timeout(struct ata_port *ap) printk(KERN_ERR "ata%u: Entering mv_eng_timeout\n",ap->id); DPRINTK("All regs @ start of eng_timeout\n"); - mv_dump_all_regs(ap->host_set->mmio_base, ap->port_no, + mv_dump_all_regs(ap->host_set->mmio_base, ap->port_no, to_pci_dev(ap->host_set->dev)); qc = ata_qc_from_tag(ap, ap->active_tag); printk(KERN_ERR "mmio_base %p ap %p qc %p scsi_cmnd %p &cmnd %p\n", - ap->host_set->mmio_base, ap, qc, qc->scsicmd, + ap->host_set->mmio_base, ap, qc, qc->scsicmd, &qc->scsicmd->cmnd); mv_err_intr(ap); @@ -1348,17 +1348,17 @@ static void mv_port_init(struct ata_ioports *port, void __iomem *port_mmio) unsigned long shd_base = (unsigned long) port_mmio + SHD_BLK_OFS; unsigned serr_ofs; - /* PIO related setup + /* PIO related setup */ port->data_addr = shd_base + (sizeof(u32) * ATA_REG_DATA); - port->error_addr = + port->error_addr = port->feature_addr = shd_base + (sizeof(u32) * ATA_REG_ERR); port->nsect_addr = shd_base + (sizeof(u32) * ATA_REG_NSECT); port->lbal_addr = shd_base + (sizeof(u32) * ATA_REG_LBAL); port->lbam_addr = shd_base + (sizeof(u32) * ATA_REG_LBAM); port->lbah_addr = shd_base + (sizeof(u32) * ATA_REG_LBAH); port->device_addr = shd_base + (sizeof(u32) * ATA_REG_DEVICE); - port->status_addr = + port->status_addr = port->command_addr = shd_base + (sizeof(u32) * ATA_REG_STATUS); /* special case: control/altstatus doesn't have ATA_REG_ address */ port->altstatus_addr = port->ctl_addr = shd_base + SHD_CTL_AST_OFS; @@ -1374,7 +1374,7 @@ static void mv_port_init(struct ata_ioports *port, void __iomem *port_mmio) /* unmask all EDMA error interrupts */ writelfl(~0, port_mmio + EDMA_ERR_IRQ_MASK_OFS); - VPRINTK("EDMA cfg=0x%08x EDMA IRQ err cause/mask=0x%08x/0x%08x\n", + VPRINTK("EDMA cfg=0x%08x EDMA IRQ err cause/mask=0x%08x/0x%08x\n", readl(port_mmio + EDMA_CFG_OFS), readl(port_mmio + EDMA_ERR_IRQ_CAUSE_OFS), readl(port_mmio + EDMA_ERR_IRQ_MASK_OFS)); @@ -1396,7 +1396,7 @@ static int mv_host_init(struct ata_probe_ent *probe_ent) void __iomem *mmio = probe_ent->mmio_base; void __iomem *port_mmio; - if ((MV_FLAG_GLBL_SFT_RST & probe_ent->host_flags) && + if ((MV_FLAG_GLBL_SFT_RST & probe_ent->host_flags) && mv_global_soft_reset(probe_ent->mmio_base)) { rc = 1; goto done; @@ -1430,7 +1430,7 @@ static int mv_host_init(struct ata_probe_ent *probe_ent) writelfl(~HC_MAIN_MASKED_IRQS, mmio + HC_MAIN_IRQ_MASK_OFS); VPRINTK("HC MAIN IRQ cause/mask=0x%08x/0x%08x " - "PCI int cause/mask=0x%08x/0x%08x\n", + "PCI int cause/mask=0x%08x/0x%08x\n", readl(mmio + HC_MAIN_IRQ_CAUSE_OFS), readl(mmio + HC_MAIN_IRQ_MASK_OFS), readl(mmio + PCI_IRQ_CAUSE_OFS), @@ -1470,7 +1470,7 @@ static void mv_print_info(struct ata_probe_ent *probe_ent) dev_printk(KERN_INFO, &pdev->dev, "%u slots %u ports %s mode IRQ via %s\n", - (unsigned)MV_MAX_Q_DEPTH, probe_ent->n_ports, + (unsigned)MV_MAX_Q_DEPTH, probe_ent->n_ports, scc_s, (MV_HP_FLAG_MSI & hpriv->hp_flags) ? "MSI" : "INTx"); } -- cgit v1.2.3 From 9a68c1b9580886a2ff07a42733adb7583ee3d9ac Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Sat, 12 Nov 2005 12:40:41 -0500 Subject: [libata sata_mv] note driver is "HIGHLY EXPERIMENTAL" in Kconfig --- drivers/scsi/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 84c42c44e04..20dd85a7781 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -497,7 +497,7 @@ config SCSI_ATA_PIIX If unsure, say N. config SCSI_SATA_MV - tristate "Marvell SATA support" + tristate "Marvell SATA support (HIGHLY EXPERIMENTAL)" depends on SCSI_SATA && PCI && EXPERIMENTAL help This option enables support for the Marvell Serial ATA family. -- cgit v1.2.3 From bca1c4eb9411533d613123618c0d127fae532595 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Sat, 12 Nov 2005 12:48:15 -0500 Subject: [libata sata_mv] implement a bunch of errata workarounds Based largely on the GPL'd Marvell vendor driver. --- drivers/scsi/sata_mv.c | 268 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 261 insertions(+), 7 deletions(-) (limited to 'drivers') diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index 26e9d51e6ca..b1696e353dd 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c @@ -50,6 +50,8 @@ enum { MV_PCI_REG_BASE = 0, MV_IRQ_COAL_REG_BASE = 0x18000, /* 6xxx part only */ MV_SATAHC0_REG_BASE = 0x20000, + MV_GPIO_PORT_CTL = 0x104f0, + MV_RESET_CFG = 0x180d8, MV_PCI_REG_SZ = MV_MAJOR_REG_AREA_SZ, MV_SATAHC_REG_SZ = MV_MAJOR_REG_AREA_SZ, @@ -148,6 +150,11 @@ enum { /* SATA registers */ SATA_STATUS_OFS = 0x300, /* ctrl, err regs follow status */ SATA_ACTIVE_OFS = 0x350, + PHY_MODE4 = 0x314, + PHY_MODE2 = 0x330, + SATA_INTERFACE_CTL = 0x050, + + MV_M2_PREAMP_MASK = 0x7e0, /* Port registers */ EDMA_CFG_OFS = 0, @@ -201,14 +208,26 @@ enum { EDMA_DS = (1 << 1), ATA_RST = (1 << 2), + EDMA_ARB_CFG = 0x38, + EDMA_NO_SNOOP = (1 << 6), + /* Host private flags (hp_flags) */ MV_HP_FLAG_MSI = (1 << 0), + MV_HP_ERRATA_60X1A1 = (1 << 1), + MV_HP_ERRATA_60X1B0 = (1 << 2), + MV_HP_ERRATA_50XXB0 = (1 << 3), + MV_HP_ERRATA_50XXB1 = (1 << 4), + MV_HP_ERRATA_50XXB2 = (1 << 5), + MV_HP_50XX = (1 << 6), /* Port private flags (pp_flags) */ MV_PP_FLAG_EDMA_EN = (1 << 0), MV_PP_FLAG_EDMA_DS_ACT = (1 << 1), }; +#define IS_50XX(hpriv) ((hpriv)->hp_flags & MV_HP_50XX) +#define IS_60XX(hpriv) (((hpriv)->hp_flags & MV_HP_50XX) == 0) + enum { /* Our DMA boundary is determined by an ePRD being unable to handle * anything larger than 64KB @@ -256,8 +275,14 @@ struct mv_port_priv { u32 pp_flags; }; +struct mv_port_signal { + u32 amps; + u32 pre; +}; + struct mv_host_priv { u32 hp_flags; + struct mv_port_signal signal[8]; }; static void mv_irq_clear(struct ata_port *ap); @@ -354,10 +379,12 @@ static struct ata_port_info mv_port_info[] = { }; static const struct pci_device_id mv_pci_tbl[] = { +#if 0 /* unusably broken right now */ {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5040), 0, 0, chip_504x}, {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5041), 0, 0, chip_504x}, {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5080), 0, 0, chip_508x}, {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5081), 0, 0, chip_508x}, +#endif {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6040), 0, 0, chip_604x}, {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6041), 0, 0, chip_604x}, @@ -402,9 +429,9 @@ static inline void __iomem *mv_ap_base(struct ata_port *ap) return mv_port_base(ap->host_set->mmio_base, ap->port_no); } -static inline int mv_get_hc_count(unsigned long hp_flags) +static inline int mv_get_hc_count(unsigned long host_flags) { - return ((hp_flags & MV_FLAG_DUAL_HC) ? 2 : 1); + return ((host_flags & MV_FLAG_DUAL_HC) ? 2 : 1); } static void mv_irq_clear(struct ata_port *ap) @@ -694,6 +721,7 @@ static inline void mv_priv_free(struct mv_port_priv *pp, struct device *dev) static int mv_port_start(struct ata_port *ap) { struct device *dev = ap->host_set->dev; + struct mv_host_priv *hpriv = ap->host_set->private_data; struct mv_port_priv *pp; void __iomem *port_mmio = mv_ap_base(ap); void *mem; @@ -751,6 +779,15 @@ static int mv_port_start(struct ata_port *ap) writelfl(pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK, port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); + if (hpriv->hp_flags & MV_HP_ERRATA_60X1A1) { + u32 new_tmp, tmp; + + new_tmp = tmp = readl(port_mmio + EDMA_ARB_CFG); + new_tmp &= ~EDMA_NO_SNOOP; + if (new_tmp != tmp) + writel(new_tmp, port_mmio + EDMA_ARB_CFG); + } + pp->req_producer = pp->rsp_consumer = 0; /* Don't turn on EDMA here...do it before DMA commands only. Else @@ -1206,6 +1243,52 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance, return IRQ_RETVAL(handled); } +static void mv_phy_errata5(struct ata_port *ap) +{ + /* FIXME */ +} + +static void mv_phy_errata6(struct ata_port *ap) +{ + struct mv_host_priv *hpriv = ap->host_set->private_data; + u32 hp_flags = hpriv->hp_flags; + void __iomem *port_mmio = mv_ap_base(ap); + int fix_phy_mode4 = + hp_flags & (MV_HP_ERRATA_60X1A1 | MV_HP_ERRATA_60X1B0); + u32 m2; + + if (fix_phy_mode4) { + u32 tmp, m4; + + m4 = readl(port_mmio + PHY_MODE4); + tmp = readl(port_mmio + 0x310); + + m4 = (m4 & ~(1 << 1)) | (1 << 0); + + writel(m4, port_mmio + PHY_MODE4); + writel(tmp, port_mmio + 0x310); + } + + /* Revert values of pre-emphasis and signal amps to the saved ones */ + m2 = readl(port_mmio + PHY_MODE2); + + m2 &= ~MV_M2_PREAMP_MASK; + m2 |= hpriv->signal[ap->port_no].amps; + m2 |= hpriv->signal[ap->port_no].pre; + + writel(m2, port_mmio + PHY_MODE2); +} + +static void mv_phy_errata(struct ata_port *ap) +{ + struct mv_host_priv *hpriv = ap->host_set->private_data; + + if (IS_50XX(hpriv)) + mv_phy_errata5(ap); + else + mv_phy_errata6(ap); +} + /** * mv_phy_reset - Perform eDMA reset followed by COMRESET * @ap: ATA channel to manipulate @@ -1220,6 +1303,7 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance, static void mv_phy_reset(struct ata_port *ap) { struct mv_port_priv *pp = ap->private_data; + struct mv_host_priv *hpriv = ap->host_set->private_data; void __iomem *port_mmio = mv_ap_base(ap); struct ata_taskfile tf; struct ata_device *dev = &ap->device[0]; @@ -1230,6 +1314,13 @@ static void mv_phy_reset(struct ata_port *ap) mv_stop_dma(ap); writelfl(ATA_RST, port_mmio + EDMA_CMD_OFS); + + if (IS_60XX(hpriv)) { + u32 ifctl = readl(port_mmio + SATA_INTERFACE_CTL); + ifctl |= (1 << 12) | (1 << 7); + writelfl(ifctl, port_mmio + SATA_INTERFACE_CTL); + } + udelay(25); /* allow reset propagation */ /* Spec never mentions clearing the bit. Marvell's driver does @@ -1237,6 +1328,8 @@ static void mv_phy_reset(struct ata_port *ap) */ writelfl(0, port_mmio + EDMA_CMD_OFS); + mv_phy_errata(ap); + DPRINTK("S-regs after ATA_RST: SStat 0x%08x SErr 0x%08x " "SCtrl 0x%08x\n", mv_scr_read(ap, SCR_STATUS), mv_scr_read(ap, SCR_ERROR), mv_scr_read(ap, SCR_CONTROL)); @@ -1283,7 +1376,7 @@ static void mv_phy_reset(struct ata_port *ap) pp->pp_flags &= ~MV_PP_FLAG_EDMA_EN; - printk("EXIT\n"); + VPRINTK("EXIT\n"); } /** @@ -1380,8 +1473,152 @@ static void mv_port_init(struct ata_ioports *port, void __iomem *port_mmio) readl(port_mmio + EDMA_ERR_IRQ_MASK_OFS)); } +static void mv_enable_leds5(struct mv_host_priv *hpriv, void __iomem *mmio) +{ + /* FIXME */ +} + +static void mv_enable_leds6(struct mv_host_priv *hpriv, void __iomem *mmio) +{ + if (hpriv->hp_flags & MV_HP_ERRATA_60X1A1) + writel(0x00020060, mmio + MV_GPIO_PORT_CTL); + + else if (hpriv->hp_flags & MV_HP_ERRATA_60X1B0) + writel(0x00000060, mmio + MV_GPIO_PORT_CTL); +} + +static void mv_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio) +{ + if (IS_50XX(hpriv)) + mv_enable_leds5(hpriv, mmio); + else + mv_enable_leds6(hpriv, mmio); +} + +static void mv_cfg_signal5(struct mv_host_priv *hpriv, int idx, + void __iomem *mmio) +{ + /* FIXME */ +} + +static void mv_cfg_signal6(struct mv_host_priv *hpriv, int idx, + void __iomem *mmio) +{ + void __iomem *port_mmio; + u32 tmp; + + if (hpriv->hp_flags & MV_HP_ERRATA_60X1A1) { + hpriv->signal[idx].amps = 0x5 << 8; + hpriv->signal[idx].pre = 0x3 << 5; + return; + } + + assert (hpriv->hp_flags & MV_HP_ERRATA_60X1B0); + + tmp = readl(mmio + MV_RESET_CFG); + if ((tmp & (1 << 0)) == 0) { + hpriv->signal[idx].amps = 0x4 << 8; + hpriv->signal[idx].pre = 0x1 << 5; + return; + } + + port_mmio = mv_port_base(mmio, idx); + tmp = readl(port_mmio + PHY_MODE2); + + hpriv->signal[idx].amps = tmp & 0x700; /* bits 10:8 */ + hpriv->signal[idx].pre = tmp & 0xe0; /* bits 7:5 */ +} + +static int mv_cfg_errata(struct pci_dev *pdev, struct mv_host_priv *hpriv, + unsigned int board_idx) +{ + u8 rev_id; + u32 hp_flags = hpriv->hp_flags; + + pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id); + + switch(board_idx) { + case chip_504x: + case chip_508x: + hp_flags |= MV_HP_50XX; + + if (pdev->device == 0x5080) { + switch (rev_id) { + case 0x0: + dev_printk(KERN_WARNING, &pdev->dev, + "Applying B0 workarounds to unknown rev 0\n"); + /* fall through */ + case 0x1: + hp_flags |= MV_HP_ERRATA_50XXB0; + break; + case 0x2: + hp_flags |= MV_HP_ERRATA_50XXB1; + break; + case 0x3: + hp_flags |= MV_HP_ERRATA_50XXB2; + break; + default: + dev_printk(KERN_WARNING, &pdev->dev, + "Applying B2 workarounds to future rev\n"); + hp_flags |= MV_HP_ERRATA_50XXB2; + break; + } + } else { + switch (rev_id) { + case 0x0: + hp_flags |= MV_HP_ERRATA_50XXB0; + break; + case 0x1: + dev_printk(KERN_WARNING, &pdev->dev, + "Applying B1 workarounds to unknown rev 1\n"); + /* fall through */ + case 0x2: + hp_flags |= MV_HP_ERRATA_50XXB1; + break; + default: + dev_printk(KERN_WARNING, &pdev->dev, + "Applying B2 workarounds to future rev\n"); + /* fall through */ + case 0x3: + hp_flags |= MV_HP_ERRATA_50XXB2; + break; + } + } + break; + + case chip_604x: + case chip_608x: + switch (rev_id) { + case 0x0: + dev_printk(KERN_WARNING, &pdev->dev, + "Applying A1 workarounds to unknown rev 0\n"); + /* fall through */ + case 0x1: + hp_flags |= MV_HP_ERRATA_60X1A1; + break; + default: + dev_printk(KERN_WARNING, &pdev->dev, + "Applying B0 workarounds to future rev\n"); + /* fall through */ + case 0x2: + hp_flags |= MV_HP_ERRATA_60X1B0; + break; + } + break; + + default: + printk(KERN_ERR DRV_NAME ": BUG: invalid board index %u\n", board_idx); + return 1; + } + + hpriv->hp_flags = hp_flags; + + return 0; +} + /** * mv_host_init - Perform some early initialization of the host. + * @pdev: host PCI device * @probe_ent: early data struct representing the host * * If possible, do an early global reset of the host. Then do @@ -1390,11 +1627,28 @@ static void mv_port_init(struct ata_ioports *port, void __iomem *port_mmio) * LOCKING: * Inherited from caller. */ -static int mv_host_init(struct ata_probe_ent *probe_ent) +static int mv_host_init(struct pci_dev *pdev, struct ata_probe_ent *probe_ent, + unsigned int board_idx) { int rc = 0, n_hc, port, hc; void __iomem *mmio = probe_ent->mmio_base; void __iomem *port_mmio; + struct mv_host_priv *hpriv = probe_ent->private_data; + + rc = mv_cfg_errata(pdev, hpriv, board_idx); + if (rc) + goto done; + + n_hc = mv_get_hc_count(probe_ent->host_flags); + probe_ent->n_ports = MV_PORTS_PER_HC * n_hc; + + if (IS_50XX(hpriv)) { + for (port = 0; port < probe_ent->n_ports; port++) + mv_cfg_signal5(hpriv, port, mmio); + } else { + for (port = 0; port < probe_ent->n_ports; port++) + mv_cfg_signal6(hpriv, port, mmio); + } if ((MV_FLAG_GLBL_SFT_RST & probe_ent->host_flags) && mv_global_soft_reset(probe_ent->mmio_base)) { @@ -1402,8 +1656,7 @@ static int mv_host_init(struct ata_probe_ent *probe_ent) goto done; } - n_hc = mv_get_hc_count(probe_ent->host_flags); - probe_ent->n_ports = MV_PORTS_PER_HC * n_hc; + mv_enable_leds(hpriv, mmio); for (port = 0; port < probe_ent->n_ports; port++) { port_mmio = mv_port_base(mmio, port); @@ -1435,6 +1688,7 @@ static int mv_host_init(struct ata_probe_ent *probe_ent) readl(mmio + HC_MAIN_IRQ_MASK_OFS), readl(mmio + PCI_IRQ_CAUSE_OFS), readl(mmio + PCI_IRQ_MASK_OFS)); + done: return rc; } @@ -1540,7 +1794,7 @@ static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) probe_ent->private_data = hpriv; /* initialize adapter */ - rc = mv_host_init(probe_ent); + rc = mv_host_init(pdev, probe_ent, board_idx); if (rc) { goto err_out_hpriv; } -- cgit v1.2.3 From ba3fe8fb6a469390a14379519915f3c39a973d99 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Sat, 12 Nov 2005 19:08:48 -0500 Subject: [libata sata_mv] move code around No content change, just prepping up future mv_hw_ops modularization. --- drivers/scsi/sata_mv.c | 96 +++++++++++++++++++++++++------------------------- 1 file changed, 48 insertions(+), 48 deletions(-) (limited to 'drivers') diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index b1696e353dd..9d116d00273 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c @@ -1243,11 +1243,59 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance, return IRQ_RETVAL(handled); } +static void mv_cfg_signal5(struct mv_host_priv *hpriv, int idx, + void __iomem *mmio) +{ + /* FIXME */ +} + +static void mv_enable_leds5(struct mv_host_priv *hpriv, void __iomem *mmio) +{ + /* FIXME */ +} + static void mv_phy_errata5(struct ata_port *ap) { /* FIXME */ } +static void mv_cfg_signal6(struct mv_host_priv *hpriv, int idx, + void __iomem *mmio) +{ + void __iomem *port_mmio; + u32 tmp; + + if (hpriv->hp_flags & MV_HP_ERRATA_60X1A1) { + hpriv->signal[idx].amps = 0x5 << 8; + hpriv->signal[idx].pre = 0x3 << 5; + return; + } + + assert (hpriv->hp_flags & MV_HP_ERRATA_60X1B0); + + tmp = readl(mmio + MV_RESET_CFG); + if ((tmp & (1 << 0)) == 0) { + hpriv->signal[idx].amps = 0x4 << 8; + hpriv->signal[idx].pre = 0x1 << 5; + return; + } + + port_mmio = mv_port_base(mmio, idx); + tmp = readl(port_mmio + PHY_MODE2); + + hpriv->signal[idx].amps = tmp & 0x700; /* bits 10:8 */ + hpriv->signal[idx].pre = tmp & 0xe0; /* bits 7:5 */ +} + +static void mv_enable_leds6(struct mv_host_priv *hpriv, void __iomem *mmio) +{ + if (hpriv->hp_flags & MV_HP_ERRATA_60X1A1) + writel(0x00020060, mmio + MV_GPIO_PORT_CTL); + + else if (hpriv->hp_flags & MV_HP_ERRATA_60X1B0) + writel(0x00000060, mmio + MV_GPIO_PORT_CTL); +} + static void mv_phy_errata6(struct ata_port *ap) { struct mv_host_priv *hpriv = ap->host_set->private_data; @@ -1473,20 +1521,6 @@ static void mv_port_init(struct ata_ioports *port, void __iomem *port_mmio) readl(port_mmio + EDMA_ERR_IRQ_MASK_OFS)); } -static void mv_enable_leds5(struct mv_host_priv *hpriv, void __iomem *mmio) -{ - /* FIXME */ -} - -static void mv_enable_leds6(struct mv_host_priv *hpriv, void __iomem *mmio) -{ - if (hpriv->hp_flags & MV_HP_ERRATA_60X1A1) - writel(0x00020060, mmio + MV_GPIO_PORT_CTL); - - else if (hpriv->hp_flags & MV_HP_ERRATA_60X1B0) - writel(0x00000060, mmio + MV_GPIO_PORT_CTL); -} - static void mv_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio) { if (IS_50XX(hpriv)) @@ -1495,40 +1529,6 @@ static void mv_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio) mv_enable_leds6(hpriv, mmio); } -static void mv_cfg_signal5(struct mv_host_priv *hpriv, int idx, - void __iomem *mmio) -{ - /* FIXME */ -} - -static void mv_cfg_signal6(struct mv_host_priv *hpriv, int idx, - void __iomem *mmio) -{ - void __iomem *port_mmio; - u32 tmp; - - if (hpriv->hp_flags & MV_HP_ERRATA_60X1A1) { - hpriv->signal[idx].amps = 0x5 << 8; - hpriv->signal[idx].pre = 0x3 << 5; - return; - } - - assert (hpriv->hp_flags & MV_HP_ERRATA_60X1B0); - - tmp = readl(mmio + MV_RESET_CFG); - if ((tmp & (1 << 0)) == 0) { - hpriv->signal[idx].amps = 0x4 << 8; - hpriv->signal[idx].pre = 0x1 << 5; - return; - } - - port_mmio = mv_port_base(mmio, idx); - tmp = readl(port_mmio + PHY_MODE2); - - hpriv->signal[idx].amps = tmp & 0x700; /* bits 10:8 */ - hpriv->signal[idx].pre = tmp & 0xe0; /* bits 7:5 */ -} - static int mv_cfg_errata(struct pci_dev *pdev, struct mv_host_priv *hpriv, unsigned int board_idx) { -- cgit v1.2.3 From 47c2b677daeed9c79ecb7167c211ff36876ea611 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Sat, 12 Nov 2005 21:13:17 -0500 Subject: [libata sata_mv] mv_hw_ops for hardware families; new errata - eliminate a bunch of redundant tests by creating a per-chip-family set of hooks, mv_hw_ops - implement more errata, from newer Marvell GPL'd driver --- drivers/scsi/sata_mv.c | 296 ++++++++++++++++++++++++++----------------------- 1 file changed, 158 insertions(+), 138 deletions(-) (limited to 'drivers') diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index 9d116d00273..4ca4b35d002 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c @@ -83,16 +83,15 @@ enum { /* Host Flags */ MV_FLAG_DUAL_HC = (1 << 30), /* two SATA Host Controllers */ MV_FLAG_IRQ_COALESCE = (1 << 29), /* IRQ coalescing capability */ - MV_FLAG_GLBL_SFT_RST = (1 << 28), /* Global Soft Reset support */ MV_COMMON_FLAGS = (ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO), - MV_6XXX_FLAGS = (MV_FLAG_IRQ_COALESCE | - MV_FLAG_GLBL_SFT_RST), + MV_6XXX_FLAGS = MV_FLAG_IRQ_COALESCE, chip_504x = 0, chip_508x = 1, - chip_604x = 2, - chip_608x = 3, + chip_5080 = 2, + chip_604x = 3, + chip_608x = 4, CRQB_FLAG_READ = (1 << 0), CRQB_TAG_SHIFT = 1, @@ -150,6 +149,7 @@ enum { /* SATA registers */ SATA_STATUS_OFS = 0x300, /* ctrl, err regs follow status */ SATA_ACTIVE_OFS = 0x350, + PHY_MODE3 = 0x310, PHY_MODE4 = 0x314, PHY_MODE2 = 0x330, SATA_INTERFACE_CTL = 0x050, @@ -209,23 +209,20 @@ enum { ATA_RST = (1 << 2), EDMA_ARB_CFG = 0x38, - EDMA_NO_SNOOP = (1 << 6), /* Host private flags (hp_flags) */ MV_HP_FLAG_MSI = (1 << 0), - MV_HP_ERRATA_60X1A1 = (1 << 1), - MV_HP_ERRATA_60X1B0 = (1 << 2), - MV_HP_ERRATA_50XXB0 = (1 << 3), - MV_HP_ERRATA_50XXB1 = (1 << 4), - MV_HP_ERRATA_50XXB2 = (1 << 5), - MV_HP_50XX = (1 << 6), + MV_HP_ERRATA_50XXB0 = (1 << 1), + MV_HP_ERRATA_50XXB2 = (1 << 2), + MV_HP_ERRATA_60X1B2 = (1 << 3), + MV_HP_ERRATA_60X1C0 = (1 << 4), + MV_HP_50XX = (1 << 5), /* Port private flags (pp_flags) */ MV_PP_FLAG_EDMA_EN = (1 << 0), MV_PP_FLAG_EDMA_DS_ACT = (1 << 1), }; -#define IS_50XX(hpriv) ((hpriv)->hp_flags & MV_HP_50XX) #define IS_60XX(hpriv) (((hpriv)->hp_flags & MV_HP_50XX) == 0) enum { @@ -280,9 +277,19 @@ struct mv_port_signal { u32 pre; }; +struct mv_host_priv; +struct mv_hw_ops { + void (*phy_errata)(struct ata_port *ap); + void (*enable_leds)(struct mv_host_priv *hpriv, void __iomem *mmio); + void (*read_preamp)(struct mv_host_priv *hpriv, int idx, + void __iomem *mmio); + int (*reset_hc)(struct mv_host_priv *hpriv, void __iomem *mmio); +}; + struct mv_host_priv { u32 hp_flags; struct mv_port_signal signal[8]; + const struct mv_hw_ops *ops; }; static void mv_irq_clear(struct ata_port *ap); @@ -299,6 +306,18 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance, static void mv_eng_timeout(struct ata_port *ap); static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); +static void mv5_phy_errata(struct ata_port *ap); +static void mv5_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio); +static void mv5_read_preamp(struct mv_host_priv *hpriv, int idx, + void __iomem *mmio); +static int mv5_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio); + +static void mv6_phy_errata(struct ata_port *ap); +static void mv6_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio); +static void mv6_read_preamp(struct mv_host_priv *hpriv, int idx, + void __iomem *mmio); +static int mv6_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio); + static struct scsi_host_template mv_sht = { .module = THIS_MODULE, .name = DRV_NAME, @@ -361,6 +380,13 @@ static struct ata_port_info mv_port_info[] = { .udma_mask = 0, /* 0x7f (udma0-6 disabled for now) */ .port_ops = &mv_ops, }, + { /* chip_5080 */ + .sht = &mv_sht, + .host_flags = (MV_COMMON_FLAGS | MV_FLAG_DUAL_HC), + .pio_mask = 0x1f, /* pio0-4 */ + .udma_mask = 0, /* 0x7f (udma0-6 disabled for now) */ + .port_ops = &mv_ops, + }, { /* chip_604x */ .sht = &mv_sht, .host_flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS), @@ -382,7 +408,7 @@ static const struct pci_device_id mv_pci_tbl[] = { #if 0 /* unusably broken right now */ {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5040), 0, 0, chip_504x}, {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5041), 0, 0, chip_504x}, - {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5080), 0, 0, chip_508x}, + {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5080), 0, 0, chip_5080}, {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5081), 0, 0, chip_508x}, #endif @@ -402,6 +428,20 @@ static struct pci_driver mv_pci_driver = { .remove = ata_pci_remove_one, }; +static const struct mv_hw_ops mv5xxx_ops = { + .phy_errata = mv5_phy_errata, + .enable_leds = mv5_enable_leds, + .read_preamp = mv5_read_preamp, + .reset_hc = mv5_reset_hc, +}; + +static const struct mv_hw_ops mv6xxx_ops = { + .phy_errata = mv6_phy_errata, + .enable_leds = mv6_enable_leds, + .read_preamp = mv6_read_preamp, + .reset_hc = mv6_reset_hc, +}; + /* * Functions */ @@ -624,9 +664,9 @@ static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val) * LOCKING: * Inherited from caller. */ -static int mv_global_soft_reset(void __iomem *mmio_base) +static int mv6_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio) { - void __iomem *reg = mmio_base + PCI_MAIN_CMD_STS_OFS; + void __iomem *reg = mmio + PCI_MAIN_CMD_STS_OFS; int i, rc = 0; u32 t; @@ -721,7 +761,6 @@ static inline void mv_priv_free(struct mv_port_priv *pp, struct device *dev) static int mv_port_start(struct ata_port *ap) { struct device *dev = ap->host_set->dev; - struct mv_host_priv *hpriv = ap->host_set->private_data; struct mv_port_priv *pp; void __iomem *port_mmio = mv_ap_base(ap); void *mem; @@ -779,15 +818,6 @@ static int mv_port_start(struct ata_port *ap) writelfl(pp->crpb_dma & EDMA_RSP_Q_BASE_LO_MASK, port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); - if (hpriv->hp_flags & MV_HP_ERRATA_60X1A1) { - u32 new_tmp, tmp; - - new_tmp = tmp = readl(port_mmio + EDMA_ARB_CFG); - new_tmp &= ~EDMA_NO_SNOOP; - if (new_tmp != tmp) - writel(new_tmp, port_mmio + EDMA_ARB_CFG); - } - pp->req_producer = pp->rsp_consumer = 0; /* Don't turn on EDMA here...do it before DMA commands only. Else @@ -1243,39 +1273,37 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance, return IRQ_RETVAL(handled); } -static void mv_cfg_signal5(struct mv_host_priv *hpriv, int idx, +static void mv5_read_preamp(struct mv_host_priv *hpriv, int idx, void __iomem *mmio) { /* FIXME */ } -static void mv_enable_leds5(struct mv_host_priv *hpriv, void __iomem *mmio) +static void mv5_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio) { /* FIXME */ } -static void mv_phy_errata5(struct ata_port *ap) +static void mv5_phy_errata(struct ata_port *ap) { /* FIXME */ } -static void mv_cfg_signal6(struct mv_host_priv *hpriv, int idx, +static int mv5_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio) +{ + /* FIXME */ + return 1; +} + +static void mv6_read_preamp(struct mv_host_priv *hpriv, int idx, void __iomem *mmio) { void __iomem *port_mmio; u32 tmp; - if (hpriv->hp_flags & MV_HP_ERRATA_60X1A1) { - hpriv->signal[idx].amps = 0x5 << 8; - hpriv->signal[idx].pre = 0x3 << 5; - return; - } - - assert (hpriv->hp_flags & MV_HP_ERRATA_60X1B0); - tmp = readl(mmio + MV_RESET_CFG); if ((tmp & (1 << 0)) == 0) { - hpriv->signal[idx].amps = 0x4 << 8; + hpriv->signal[idx].amps = 0x7 << 8; hpriv->signal[idx].pre = 0x1 << 5; return; } @@ -1287,34 +1315,57 @@ static void mv_cfg_signal6(struct mv_host_priv *hpriv, int idx, hpriv->signal[idx].pre = tmp & 0xe0; /* bits 7:5 */ } -static void mv_enable_leds6(struct mv_host_priv *hpriv, void __iomem *mmio) +static void mv6_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio) { - if (hpriv->hp_flags & MV_HP_ERRATA_60X1A1) - writel(0x00020060, mmio + MV_GPIO_PORT_CTL); - - else if (hpriv->hp_flags & MV_HP_ERRATA_60X1B0) - writel(0x00000060, mmio + MV_GPIO_PORT_CTL); + writel(0x00000060, mmio + MV_GPIO_PORT_CTL); } -static void mv_phy_errata6(struct ata_port *ap) +static void mv6_phy_errata(struct ata_port *ap) { struct mv_host_priv *hpriv = ap->host_set->private_data; u32 hp_flags = hpriv->hp_flags; void __iomem *port_mmio = mv_ap_base(ap); + int fix_phy_mode2 = + hp_flags & (MV_HP_ERRATA_60X1B2 | MV_HP_ERRATA_60X1C0); int fix_phy_mode4 = - hp_flags & (MV_HP_ERRATA_60X1A1 | MV_HP_ERRATA_60X1B0); - u32 m2; + hp_flags & (MV_HP_ERRATA_60X1B2 | MV_HP_ERRATA_60X1C0); + u32 m2, tmp; + + if (fix_phy_mode2) { + m2 = readl(port_mmio + PHY_MODE2); + m2 &= ~(1 << 16); + m2 |= (1 << 31); + writel(m2, port_mmio + PHY_MODE2); + + udelay(200); + + m2 = readl(port_mmio + PHY_MODE2); + m2 &= ~((1 << 16) | (1 << 31)); + writel(m2, port_mmio + PHY_MODE2); + + udelay(200); + } + + /* who knows what this magic does */ + tmp = readl(port_mmio + PHY_MODE3); + tmp &= ~0x7F800000; + tmp |= 0x2A800000; + writel(tmp, port_mmio + PHY_MODE3); if (fix_phy_mode4) { - u32 tmp, m4; + u32 m4; m4 = readl(port_mmio + PHY_MODE4); - tmp = readl(port_mmio + 0x310); + + if (hp_flags & MV_HP_ERRATA_60X1B2) + tmp = readl(port_mmio + 0x310); m4 = (m4 & ~(1 << 1)) | (1 << 0); writel(m4, port_mmio + PHY_MODE4); - writel(tmp, port_mmio + 0x310); + + if (hp_flags & MV_HP_ERRATA_60X1B2) + writel(tmp, port_mmio + 0x310); } /* Revert values of pre-emphasis and signal amps to the saved ones */ @@ -1323,20 +1374,11 @@ static void mv_phy_errata6(struct ata_port *ap) m2 &= ~MV_M2_PREAMP_MASK; m2 |= hpriv->signal[ap->port_no].amps; m2 |= hpriv->signal[ap->port_no].pre; + m2 &= ~(1 << 16); writel(m2, port_mmio + PHY_MODE2); } -static void mv_phy_errata(struct ata_port *ap) -{ - struct mv_host_priv *hpriv = ap->host_set->private_data; - - if (IS_50XX(hpriv)) - mv_phy_errata5(ap); - else - mv_phy_errata6(ap); -} - /** * mv_phy_reset - Perform eDMA reset followed by COMRESET * @ap: ATA channel to manipulate @@ -1376,7 +1418,7 @@ static void mv_phy_reset(struct ata_port *ap) */ writelfl(0, port_mmio + EDMA_CMD_OFS); - mv_phy_errata(ap); + hpriv->ops->phy_errata(ap); DPRINTK("S-regs after ATA_RST: SStat 0x%08x SErr 0x%08x " "SCtrl 0x%08x\n", mv_scr_read(ap, SCR_STATUS), @@ -1521,15 +1563,7 @@ static void mv_port_init(struct ata_ioports *port, void __iomem *port_mmio) readl(port_mmio + EDMA_ERR_IRQ_MASK_OFS)); } -static void mv_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio) -{ - if (IS_50XX(hpriv)) - mv_enable_leds5(hpriv, mmio); - else - mv_enable_leds6(hpriv, mmio); -} - -static int mv_cfg_errata(struct pci_dev *pdev, struct mv_host_priv *hpriv, +static int mv_chip_id(struct pci_dev *pdev, struct mv_host_priv *hpriv, unsigned int board_idx) { u8 rev_id; @@ -1538,70 +1572,60 @@ static int mv_cfg_errata(struct pci_dev *pdev, struct mv_host_priv *hpriv, pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id); switch(board_idx) { + case chip_5080: + hpriv->ops = &mv5xxx_ops; + hp_flags |= MV_HP_50XX; + + switch (rev_id) { + case 0x1: + hp_flags |= MV_HP_ERRATA_50XXB0; + break; + case 0x3: + hp_flags |= MV_HP_ERRATA_50XXB2; + break; + default: + dev_printk(KERN_WARNING, &pdev->dev, + "Applying 50XXB2 workarounds to unknown rev\n"); + hp_flags |= MV_HP_ERRATA_50XXB2; + break; + } + break; + case chip_504x: case chip_508x: + hpriv->ops = &mv5xxx_ops; hp_flags |= MV_HP_50XX; - if (pdev->device == 0x5080) { - switch (rev_id) { - case 0x0: - dev_printk(KERN_WARNING, &pdev->dev, - "Applying B0 workarounds to unknown rev 0\n"); - /* fall through */ - case 0x1: - hp_flags |= MV_HP_ERRATA_50XXB0; - break; - case 0x2: - hp_flags |= MV_HP_ERRATA_50XXB1; - break; - case 0x3: - hp_flags |= MV_HP_ERRATA_50XXB2; - break; - default: - dev_printk(KERN_WARNING, &pdev->dev, - "Applying B2 workarounds to future rev\n"); - hp_flags |= MV_HP_ERRATA_50XXB2; - break; - } - } else { - switch (rev_id) { - case 0x0: - hp_flags |= MV_HP_ERRATA_50XXB0; - break; - case 0x1: - dev_printk(KERN_WARNING, &pdev->dev, - "Applying B1 workarounds to unknown rev 1\n"); - /* fall through */ - case 0x2: - hp_flags |= MV_HP_ERRATA_50XXB1; - break; - default: - dev_printk(KERN_WARNING, &pdev->dev, - "Applying B2 workarounds to future rev\n"); - /* fall through */ - case 0x3: - hp_flags |= MV_HP_ERRATA_50XXB2; - break; - } + switch (rev_id) { + case 0x0: + hp_flags |= MV_HP_ERRATA_50XXB0; + break; + case 0x3: + hp_flags |= MV_HP_ERRATA_50XXB2; + break; + default: + dev_printk(KERN_WARNING, &pdev->dev, + "Applying B2 workarounds to unknown rev\n"); + hp_flags |= MV_HP_ERRATA_50XXB2; + break; } break; case chip_604x: case chip_608x: + hpriv->ops = &mv6xxx_ops; + switch (rev_id) { - case 0x0: - dev_printk(KERN_WARNING, &pdev->dev, - "Applying A1 workarounds to unknown rev 0\n"); - /* fall through */ - case 0x1: - hp_flags |= MV_HP_ERRATA_60X1A1; + case 0x7: + hp_flags |= MV_HP_ERRATA_60X1B2; + break; + case 0x9: + hp_flags |= MV_HP_ERRATA_60X1C0; break; default: dev_printk(KERN_WARNING, &pdev->dev, - "Applying B0 workarounds to future rev\n"); - /* fall through */ - case 0x2: - hp_flags |= MV_HP_ERRATA_60X1B0; + "Applying B2 workarounds to unknown rev\n"); + hp_flags |= MV_HP_ERRATA_60X1B2; break; } break; @@ -1617,7 +1641,7 @@ static int mv_cfg_errata(struct pci_dev *pdev, struct mv_host_priv *hpriv, } /** - * mv_host_init - Perform some early initialization of the host. + * mv_init_host - Perform some early initialization of the host. * @pdev: host PCI device * @probe_ent: early data struct representing the host * @@ -1627,7 +1651,7 @@ static int mv_cfg_errata(struct pci_dev *pdev, struct mv_host_priv *hpriv, * LOCKING: * Inherited from caller. */ -static int mv_host_init(struct pci_dev *pdev, struct ata_probe_ent *probe_ent, +static int mv_init_host(struct pci_dev *pdev, struct ata_probe_ent *probe_ent, unsigned int board_idx) { int rc = 0, n_hc, port, hc; @@ -1635,28 +1659,24 @@ static int mv_host_init(struct pci_dev *pdev, struct ata_probe_ent *probe_ent, void __iomem *port_mmio; struct mv_host_priv *hpriv = probe_ent->private_data; - rc = mv_cfg_errata(pdev, hpriv, board_idx); + /* global interrupt mask */ + writel(0, mmio + HC_MAIN_IRQ_MASK_OFS); + + rc = mv_chip_id(pdev, hpriv, board_idx); if (rc) goto done; n_hc = mv_get_hc_count(probe_ent->host_flags); probe_ent->n_ports = MV_PORTS_PER_HC * n_hc; - if (IS_50XX(hpriv)) { - for (port = 0; port < probe_ent->n_ports; port++) - mv_cfg_signal5(hpriv, port, mmio); - } else { - for (port = 0; port < probe_ent->n_ports; port++) - mv_cfg_signal6(hpriv, port, mmio); - } + for (port = 0; port < probe_ent->n_ports; port++) + hpriv->ops->read_preamp(hpriv, port, mmio); - if ((MV_FLAG_GLBL_SFT_RST & probe_ent->host_flags) && - mv_global_soft_reset(probe_ent->mmio_base)) { - rc = 1; + rc = hpriv->ops->reset_hc(hpriv, mmio); + if (rc) goto done; - } - mv_enable_leds(hpriv, mmio); + hpriv->ops->enable_leds(hpriv, mmio); for (port = 0; port < probe_ent->n_ports; port++) { port_mmio = mv_port_base(mmio, port); @@ -1794,7 +1814,7 @@ static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) probe_ent->private_data = hpriv; /* initialize adapter */ - rc = mv_host_init(pdev, probe_ent, board_idx); + rc = mv_init_host(pdev, probe_ent, board_idx); if (rc) { goto err_out_hpriv; } -- cgit v1.2.3 From 522479fb98c6667f081e75f87e298e413c0b1db8 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Sat, 12 Nov 2005 22:14:02 -0500 Subject: [libata sata_mv] hardware initialization work Implement flash reset and PCI reset on 50xx and 60xx. Implement LED enable on 50xx. --- drivers/scsi/sata_mv.c | 117 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 105 insertions(+), 12 deletions(-) (limited to 'drivers') diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index 4ca4b35d002..180baa53206 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c @@ -50,6 +50,7 @@ enum { MV_PCI_REG_BASE = 0, MV_IRQ_COAL_REG_BASE = 0x18000, /* 6xxx part only */ MV_SATAHC0_REG_BASE = 0x20000, + MV_FLASH_CTL = 0x1046c, MV_GPIO_PORT_CTL = 0x104f0, MV_RESET_CFG = 0x180d8, @@ -87,12 +88,6 @@ enum { ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO), MV_6XXX_FLAGS = MV_FLAG_IRQ_COALESCE, - chip_504x = 0, - chip_508x = 1, - chip_5080 = 2, - chip_604x = 3, - chip_608x = 4, - CRQB_FLAG_READ = (1 << 0), CRQB_TAG_SHIFT = 1, CRQB_CMD_ADDR_SHIFT = 8, @@ -112,8 +107,19 @@ enum { PCI_MASTER_EMPTY = (1 << 3), GLOB_SFT_RST = (1 << 4), - PCI_IRQ_CAUSE_OFS = 0x1d58, - PCI_IRQ_MASK_OFS = 0x1d5c, + MV_PCI_MODE = 0xd00, + MV_PCI_EXP_ROM_BAR_CTL = 0xd2c, + MV_PCI_DISC_TIMER = 0xd04, + MV_PCI_MSI_TRIGGER = 0xc38, + MV_PCI_SERR_MASK = 0xc28, + MV_PCI_XBAR_TMOUT = 0x1d04, + MV_PCI_ERR_LOW_ADDRESS = 0x1d40, + MV_PCI_ERR_HIGH_ADDRESS = 0x1d44, + MV_PCI_ERR_ATTRIBUTE = 0x1d48, + MV_PCI_ERR_COMMAND = 0x1d50, + + PCI_IRQ_CAUSE_OFS = 0x1d58, + PCI_IRQ_MASK_OFS = 0x1d5c, PCI_UNMASK_ALL_IRQS = 0x7fffff, /* bits 22-0 */ HC_MAIN_IRQ_CAUSE_OFS = 0x1d60, @@ -236,6 +242,14 @@ enum { EDMA_RSP_Q_BASE_LO_MASK = 0xffffff00U, }; +enum chip_type { + chip_504x, + chip_508x, + chip_5080, + chip_604x, + chip_608x, +}; + /* Command ReQuest Block: 32B */ struct mv_crqb { u32 sg_addr; @@ -284,6 +298,8 @@ struct mv_hw_ops { void (*read_preamp)(struct mv_host_priv *hpriv, int idx, void __iomem *mmio); int (*reset_hc)(struct mv_host_priv *hpriv, void __iomem *mmio); + void (*reset_flash)(struct mv_host_priv *hpriv, void __iomem *mmio); + void (*reset_bus)(struct pci_dev *pdev, void __iomem *mmio); }; struct mv_host_priv { @@ -311,12 +327,16 @@ static void mv5_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio); static void mv5_read_preamp(struct mv_host_priv *hpriv, int idx, void __iomem *mmio); static int mv5_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio); +static void mv5_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio); +static void mv5_reset_bus(struct pci_dev *pdev, void __iomem *mmio); static void mv6_phy_errata(struct ata_port *ap); static void mv6_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio); static void mv6_read_preamp(struct mv_host_priv *hpriv, int idx, void __iomem *mmio); static int mv6_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio); +static void mv6_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio); +static void mv_reset_pci_bus(struct pci_dev *pdev, void __iomem *mmio); static struct scsi_host_template mv_sht = { .module = THIS_MODULE, @@ -433,6 +453,8 @@ static const struct mv_hw_ops mv5xxx_ops = { .enable_leds = mv5_enable_leds, .read_preamp = mv5_read_preamp, .reset_hc = mv5_reset_hc, + .reset_flash = mv5_reset_flash, + .reset_bus = mv5_reset_bus, }; static const struct mv_hw_ops mv6xxx_ops = { @@ -440,6 +462,8 @@ static const struct mv_hw_ops mv6xxx_ops = { .enable_leds = mv6_enable_leds, .read_preamp = mv6_read_preamp, .reset_hc = mv6_reset_hc, + .reset_flash = mv6_reset_flash, + .reset_bus = mv_reset_pci_bus, }; /* @@ -655,9 +679,45 @@ static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val) } } +#undef ZERO +#define ZERO(reg) writel(0, mmio + (reg)) +static void mv_reset_pci_bus(struct pci_dev *pdev, void __iomem *mmio) +{ + u32 tmp; + + tmp = readl(mmio + MV_PCI_MODE); + tmp &= 0xff00ffff; + writel(tmp, mmio + MV_PCI_MODE); + + ZERO(MV_PCI_DISC_TIMER); + ZERO(MV_PCI_MSI_TRIGGER); + writel(0x000100ff, mmio + MV_PCI_XBAR_TMOUT); + ZERO(HC_MAIN_IRQ_MASK_OFS); + ZERO(MV_PCI_SERR_MASK); + ZERO(PCI_IRQ_CAUSE_OFS); + ZERO(PCI_IRQ_MASK_OFS); + ZERO(MV_PCI_ERR_LOW_ADDRESS); + ZERO(MV_PCI_ERR_HIGH_ADDRESS); + ZERO(MV_PCI_ERR_ATTRIBUTE); + ZERO(MV_PCI_ERR_COMMAND); +} +#undef ZERO + +static void mv6_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio) +{ + u32 tmp; + + mv5_reset_flash(hpriv, mmio); + + tmp = readl(mmio + MV_GPIO_PORT_CTL); + tmp &= 0x3; + tmp |= (1 << 5) | (1 << 6); + writel(tmp, mmio + MV_GPIO_PORT_CTL); +} + /** - * mv_global_soft_reset - Perform the 6xxx global soft reset - * @mmio_base: base address of the HBA + * mv6_reset_hc - Perform the 6xxx global soft reset + * @mmio: base address of the HBA * * This routine only applies to 6xxx parts. * @@ -1273,6 +1333,29 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance, return IRQ_RETVAL(handled); } +static void mv5_reset_bus(struct pci_dev *pdev, void __iomem *mmio) +{ + u8 rev_id; + int early_5080; + + pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id); + + early_5080 = (pdev->device == 0x5080) && (rev_id == 0); + + if (!early_5080) { + u32 tmp = readl(mmio + MV_PCI_EXP_ROM_BAR_CTL); + tmp |= (1 << 0); + writel(tmp, mmio + MV_PCI_EXP_ROM_BAR_CTL); + } + + mv_reset_pci_bus(pdev, mmio); +} + +static void mv5_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio) +{ + writel(0x0fcfffff, mmio + MV_FLASH_CTL); +} + static void mv5_read_preamp(struct mv_host_priv *hpriv, int idx, void __iomem *mmio) { @@ -1281,7 +1364,15 @@ static void mv5_read_preamp(struct mv_host_priv *hpriv, int idx, static void mv5_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio) { - /* FIXME */ + u32 tmp; + + writel(0, mmio + MV_GPIO_PORT_CTL); + + /* FIXME: handle MV_HP_ERRATA_50XXB2 errata */ + + tmp = readl(mmio + MV_PCI_EXP_ROM_BAR_CTL); + tmp |= ~(1 << 0); + writel(tmp, mmio + MV_PCI_EXP_ROM_BAR_CTL); } static void mv5_phy_errata(struct ata_port *ap) @@ -1564,7 +1655,7 @@ static void mv_port_init(struct ata_ioports *port, void __iomem *port_mmio) } static int mv_chip_id(struct pci_dev *pdev, struct mv_host_priv *hpriv, - unsigned int board_idx) + unsigned int board_idx) { u8 rev_id; u32 hp_flags = hpriv->hp_flags; @@ -1676,6 +1767,8 @@ static int mv_init_host(struct pci_dev *pdev, struct ata_probe_ent *probe_ent, if (rc) goto done; + hpriv->ops->reset_flash(hpriv, mmio); + hpriv->ops->reset_bus(pdev, mmio); hpriv->ops->enable_leds(hpriv, mmio); for (port = 0; port < probe_ent->n_ports; port++) { -- cgit v1.2.3 From 101ffae26c23ea928fce6d31a8b4901327d91a15 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Sat, 12 Nov 2005 22:17:49 -0500 Subject: [libata sata_mv] move code around No content changes. Move 60xx code to be closer to other 60xx code. --- drivers/scsi/sata_mv.c | 200 ++++++++++++++++++++++++------------------------- 1 file changed, 100 insertions(+), 100 deletions(-) (limited to 'drivers') diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index 180baa53206..f695d0bbb5c 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c @@ -679,106 +679,6 @@ static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val) } } -#undef ZERO -#define ZERO(reg) writel(0, mmio + (reg)) -static void mv_reset_pci_bus(struct pci_dev *pdev, void __iomem *mmio) -{ - u32 tmp; - - tmp = readl(mmio + MV_PCI_MODE); - tmp &= 0xff00ffff; - writel(tmp, mmio + MV_PCI_MODE); - - ZERO(MV_PCI_DISC_TIMER); - ZERO(MV_PCI_MSI_TRIGGER); - writel(0x000100ff, mmio + MV_PCI_XBAR_TMOUT); - ZERO(HC_MAIN_IRQ_MASK_OFS); - ZERO(MV_PCI_SERR_MASK); - ZERO(PCI_IRQ_CAUSE_OFS); - ZERO(PCI_IRQ_MASK_OFS); - ZERO(MV_PCI_ERR_LOW_ADDRESS); - ZERO(MV_PCI_ERR_HIGH_ADDRESS); - ZERO(MV_PCI_ERR_ATTRIBUTE); - ZERO(MV_PCI_ERR_COMMAND); -} -#undef ZERO - -static void mv6_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio) -{ - u32 tmp; - - mv5_reset_flash(hpriv, mmio); - - tmp = readl(mmio + MV_GPIO_PORT_CTL); - tmp &= 0x3; - tmp |= (1 << 5) | (1 << 6); - writel(tmp, mmio + MV_GPIO_PORT_CTL); -} - -/** - * mv6_reset_hc - Perform the 6xxx global soft reset - * @mmio: base address of the HBA - * - * This routine only applies to 6xxx parts. - * - * LOCKING: - * Inherited from caller. - */ -static int mv6_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio) -{ - void __iomem *reg = mmio + PCI_MAIN_CMD_STS_OFS; - int i, rc = 0; - u32 t; - - /* Following procedure defined in PCI "main command and status - * register" table. - */ - t = readl(reg); - writel(t | STOP_PCI_MASTER, reg); - - for (i = 0; i < 1000; i++) { - udelay(1); - t = readl(reg); - if (PCI_MASTER_EMPTY & t) { - break; - } - } - if (!(PCI_MASTER_EMPTY & t)) { - printk(KERN_ERR DRV_NAME ": PCI master won't flush\n"); - rc = 1; - goto done; - } - - /* set reset */ - i = 5; - do { - writel(t | GLOB_SFT_RST, reg); - t = readl(reg); - udelay(1); - } while (!(GLOB_SFT_RST & t) && (i-- > 0)); - - if (!(GLOB_SFT_RST & t)) { - printk(KERN_ERR DRV_NAME ": can't set global reset\n"); - rc = 1; - goto done; - } - - /* clear reset and *reenable the PCI master* (not mentioned in spec) */ - i = 5; - do { - writel(t & ~(GLOB_SFT_RST | STOP_PCI_MASTER), reg); - t = readl(reg); - udelay(1); - } while ((GLOB_SFT_RST & t) && (i-- > 0)); - - if (GLOB_SFT_RST & t) { - printk(KERN_ERR DRV_NAME ": can't clear global reset\n"); - rc = 1; - } -done: - return rc; -} - /** * mv_host_stop - Host specific cleanup/stop routine. * @host_set: host data structure @@ -1386,6 +1286,106 @@ static int mv5_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio) return 1; } +#undef ZERO +#define ZERO(reg) writel(0, mmio + (reg)) +static void mv_reset_pci_bus(struct pci_dev *pdev, void __iomem *mmio) +{ + u32 tmp; + + tmp = readl(mmio + MV_PCI_MODE); + tmp &= 0xff00ffff; + writel(tmp, mmio + MV_PCI_MODE); + + ZERO(MV_PCI_DISC_TIMER); + ZERO(MV_PCI_MSI_TRIGGER); + writel(0x000100ff, mmio + MV_PCI_XBAR_TMOUT); + ZERO(HC_MAIN_IRQ_MASK_OFS); + ZERO(MV_PCI_SERR_MASK); + ZERO(PCI_IRQ_CAUSE_OFS); + ZERO(PCI_IRQ_MASK_OFS); + ZERO(MV_PCI_ERR_LOW_ADDRESS); + ZERO(MV_PCI_ERR_HIGH_ADDRESS); + ZERO(MV_PCI_ERR_ATTRIBUTE); + ZERO(MV_PCI_ERR_COMMAND); +} +#undef ZERO + +static void mv6_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio) +{ + u32 tmp; + + mv5_reset_flash(hpriv, mmio); + + tmp = readl(mmio + MV_GPIO_PORT_CTL); + tmp &= 0x3; + tmp |= (1 << 5) | (1 << 6); + writel(tmp, mmio + MV_GPIO_PORT_CTL); +} + +/** + * mv6_reset_hc - Perform the 6xxx global soft reset + * @mmio: base address of the HBA + * + * This routine only applies to 6xxx parts. + * + * LOCKING: + * Inherited from caller. + */ +static int mv6_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio) +{ + void __iomem *reg = mmio + PCI_MAIN_CMD_STS_OFS; + int i, rc = 0; + u32 t; + + /* Following procedure defined in PCI "main command and status + * register" table. + */ + t = readl(reg); + writel(t | STOP_PCI_MASTER, reg); + + for (i = 0; i < 1000; i++) { + udelay(1); + t = readl(reg); + if (PCI_MASTER_EMPTY & t) { + break; + } + } + if (!(PCI_MASTER_EMPTY & t)) { + printk(KERN_ERR DRV_NAME ": PCI master won't flush\n"); + rc = 1; + goto done; + } + + /* set reset */ + i = 5; + do { + writel(t | GLOB_SFT_RST, reg); + t = readl(reg); + udelay(1); + } while (!(GLOB_SFT_RST & t) && (i-- > 0)); + + if (!(GLOB_SFT_RST & t)) { + printk(KERN_ERR DRV_NAME ": can't set global reset\n"); + rc = 1; + goto done; + } + + /* clear reset and *reenable the PCI master* (not mentioned in spec) */ + i = 5; + do { + writel(t & ~(GLOB_SFT_RST | STOP_PCI_MASTER), reg); + t = readl(reg); + udelay(1); + } while ((GLOB_SFT_RST & t) && (i-- > 0)); + + if (GLOB_SFT_RST & t) { + printk(KERN_ERR DRV_NAME ": can't clear global reset\n"); + rc = 1; + } +done: + return rc; +} + static void mv6_read_preamp(struct mv_host_priv *hpriv, int idx, void __iomem *mmio) { -- cgit v1.2.3 From 2a47ce06d534692f9bd2bf4e90a20fc9b1054c39 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Sat, 12 Nov 2005 23:05:14 -0500 Subject: [libata sata_mv] call phy fixups during init, as well as phy reset --- drivers/scsi/sata_mv.c | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) (limited to 'drivers') diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index f695d0bbb5c..5defd056fe1 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c @@ -293,7 +293,8 @@ struct mv_port_signal { struct mv_host_priv; struct mv_hw_ops { - void (*phy_errata)(struct ata_port *ap); + void (*phy_errata)(struct mv_host_priv *hpriv, void __iomem *mmio, + unsigned int port); void (*enable_leds)(struct mv_host_priv *hpriv, void __iomem *mmio); void (*read_preamp)(struct mv_host_priv *hpriv, int idx, void __iomem *mmio); @@ -322,7 +323,8 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance, static void mv_eng_timeout(struct ata_port *ap); static int mv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent); -static void mv5_phy_errata(struct ata_port *ap); +static void mv5_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, + unsigned int port); static void mv5_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio); static void mv5_read_preamp(struct mv_host_priv *hpriv, int idx, void __iomem *mmio); @@ -330,7 +332,8 @@ static int mv5_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio); static void mv5_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio); static void mv5_reset_bus(struct pci_dev *pdev, void __iomem *mmio); -static void mv6_phy_errata(struct ata_port *ap); +static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, + unsigned int port); static void mv6_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio); static void mv6_read_preamp(struct mv_host_priv *hpriv, int idx, void __iomem *mmio); @@ -1275,7 +1278,8 @@ static void mv5_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio) writel(tmp, mmio + MV_PCI_EXP_ROM_BAR_CTL); } -static void mv5_phy_errata(struct ata_port *ap) +static void mv5_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, + unsigned int port) { /* FIXME */ } @@ -1411,11 +1415,10 @@ static void mv6_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio) writel(0x00000060, mmio + MV_GPIO_PORT_CTL); } -static void mv6_phy_errata(struct ata_port *ap) +static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *port_mmio, + unsigned int port) { - struct mv_host_priv *hpriv = ap->host_set->private_data; u32 hp_flags = hpriv->hp_flags; - void __iomem *port_mmio = mv_ap_base(ap); int fix_phy_mode2 = hp_flags & (MV_HP_ERRATA_60X1B2 | MV_HP_ERRATA_60X1C0); int fix_phy_mode4 = @@ -1463,8 +1466,8 @@ static void mv6_phy_errata(struct ata_port *ap) m2 = readl(port_mmio + PHY_MODE2); m2 &= ~MV_M2_PREAMP_MASK; - m2 |= hpriv->signal[ap->port_no].amps; - m2 |= hpriv->signal[ap->port_no].pre; + m2 |= hpriv->signal[port].amps; + m2 |= hpriv->signal[port].pre; m2 &= ~(1 << 16); writel(m2, port_mmio + PHY_MODE2); @@ -1509,7 +1512,7 @@ static void mv_phy_reset(struct ata_port *ap) */ writelfl(0, port_mmio + EDMA_CMD_OFS); - hpriv->ops->phy_errata(ap); + hpriv->ops->phy_errata(hpriv, port_mmio, ap->port_no); DPRINTK("S-regs after ATA_RST: SStat 0x%08x SErr 0x%08x " "SCtrl 0x%08x\n", mv_scr_read(ap, SCR_STATUS), @@ -1747,7 +1750,6 @@ static int mv_init_host(struct pci_dev *pdev, struct ata_probe_ent *probe_ent, { int rc = 0, n_hc, port, hc; void __iomem *mmio = probe_ent->mmio_base; - void __iomem *port_mmio; struct mv_host_priv *hpriv = probe_ent->private_data; /* global interrupt mask */ @@ -1772,7 +1774,19 @@ static int mv_init_host(struct pci_dev *pdev, struct ata_probe_ent *probe_ent, hpriv->ops->enable_leds(hpriv, mmio); for (port = 0; port < probe_ent->n_ports; port++) { - port_mmio = mv_port_base(mmio, port); + void __iomem *port_mmio = mv_port_base(mmio, port); + + if (IS_60XX(hpriv)) { + u32 ifctl = readl(port_mmio + SATA_INTERFACE_CTL); + ifctl |= (1 << 12); + writelfl(ifctl, port_mmio + SATA_INTERFACE_CTL); + } + + hpriv->ops->phy_errata(hpriv, port_mmio, port); + } + + for (port = 0; port < probe_ent->n_ports; port++) { + void __iomem *port_mmio = mv_port_base(mmio, port); mv_port_init(&probe_ent->port[port], port_mmio); } -- cgit v1.2.3 From c9d39130123238ac18478a42e25cb7996eacfcc0 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Sun, 13 Nov 2005 17:47:51 -0500 Subject: [libata sata_mv] fix tons of 50XX bugs --- drivers/scsi/sata_mv.c | 301 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 252 insertions(+), 49 deletions(-) (limited to 'drivers') diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index 5defd056fe1..722ab537b7a 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c @@ -158,6 +158,9 @@ enum { PHY_MODE3 = 0x310, PHY_MODE4 = 0x314, PHY_MODE2 = 0x330, + MV5_PHY_MODE = 0x74, + MV5_LT_MODE = 0x30, + MV5_PHY_CTL = 0x0C, SATA_INTERFACE_CTL = 0x050, MV_M2_PREAMP_MASK = 0x7e0, @@ -214,6 +217,7 @@ enum { EDMA_DS = (1 << 1), ATA_RST = (1 << 2), + EDMA_IORDY_TMOUT = 0x34, EDMA_ARB_CFG = 0x38, /* Host private flags (hp_flags) */ @@ -229,6 +233,7 @@ enum { MV_PP_FLAG_EDMA_DS_ACT = (1 << 1), }; +#define IS_50XX(hpriv) ((hpriv)->hp_flags & MV_HP_50XX) #define IS_60XX(hpriv) (((hpriv)->hp_flags & MV_HP_50XX) == 0) enum { @@ -298,7 +303,8 @@ struct mv_hw_ops { void (*enable_leds)(struct mv_host_priv *hpriv, void __iomem *mmio); void (*read_preamp)(struct mv_host_priv *hpriv, int idx, void __iomem *mmio); - int (*reset_hc)(struct mv_host_priv *hpriv, void __iomem *mmio); + int (*reset_hc)(struct mv_host_priv *hpriv, void __iomem *mmio, + unsigned int n_hc); void (*reset_flash)(struct mv_host_priv *hpriv, void __iomem *mmio); void (*reset_bus)(struct pci_dev *pdev, void __iomem *mmio); }; @@ -312,6 +318,8 @@ struct mv_host_priv { static void mv_irq_clear(struct ata_port *ap); static u32 mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in); static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); +static u32 mv5_scr_read(struct ata_port *ap, unsigned int sc_reg_in); +static void mv5_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); static void mv_phy_reset(struct ata_port *ap); static void mv_host_stop(struct ata_host_set *host_set); static int mv_port_start(struct ata_port *ap); @@ -328,7 +336,8 @@ static void mv5_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, static void mv5_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio); static void mv5_read_preamp(struct mv_host_priv *hpriv, int idx, void __iomem *mmio); -static int mv5_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio); +static int mv5_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio, + unsigned int n_hc); static void mv5_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio); static void mv5_reset_bus(struct pci_dev *pdev, void __iomem *mmio); @@ -337,9 +346,13 @@ static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, static void mv6_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio); static void mv6_read_preamp(struct mv_host_priv *hpriv, int idx, void __iomem *mmio); -static int mv6_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio); +static int mv6_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio, + unsigned int n_hc); static void mv6_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio); static void mv_reset_pci_bus(struct pci_dev *pdev, void __iomem *mmio); +static void mv_channel_reset(struct mv_host_priv *hpriv, void __iomem *mmio, + unsigned int port_no); +static void mv_stop_and_reset(struct ata_port *ap); static struct scsi_host_template mv_sht = { .module = THIS_MODULE, @@ -361,7 +374,34 @@ static struct scsi_host_template mv_sht = { .ordered_flush = 1, }; -static const struct ata_port_operations mv_ops = { +static const struct ata_port_operations mv5_ops = { + .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, + + .phy_reset = mv_phy_reset, + + .qc_prep = mv_qc_prep, + .qc_issue = mv_qc_issue, + + .eng_timeout = mv_eng_timeout, + + .irq_handler = mv_interrupt, + .irq_clear = mv_irq_clear, + + .scr_read = mv5_scr_read, + .scr_write = mv5_scr_write, + + .port_start = mv_port_start, + .port_stop = mv_port_stop, + .host_stop = mv_host_stop, +}; + +static const struct ata_port_operations mv6_ops = { .port_disable = ata_port_disable, .tf_load = ata_tf_load, @@ -393,29 +433,29 @@ static struct ata_port_info mv_port_info[] = { .sht = &mv_sht, .host_flags = MV_COMMON_FLAGS, .pio_mask = 0x1f, /* pio0-4 */ - .udma_mask = 0, /* 0x7f (udma0-6 disabled for now) */ - .port_ops = &mv_ops, + .udma_mask = 0x7f, /* udma0-6 */ + .port_ops = &mv5_ops, }, { /* chip_508x */ .sht = &mv_sht, .host_flags = (MV_COMMON_FLAGS | MV_FLAG_DUAL_HC), .pio_mask = 0x1f, /* pio0-4 */ - .udma_mask = 0, /* 0x7f (udma0-6 disabled for now) */ - .port_ops = &mv_ops, + .udma_mask = 0x7f, /* udma0-6 */ + .port_ops = &mv5_ops, }, { /* chip_5080 */ .sht = &mv_sht, .host_flags = (MV_COMMON_FLAGS | MV_FLAG_DUAL_HC), .pio_mask = 0x1f, /* pio0-4 */ - .udma_mask = 0, /* 0x7f (udma0-6 disabled for now) */ - .port_ops = &mv_ops, + .udma_mask = 0x7f, /* udma0-6 */ + .port_ops = &mv5_ops, }, { /* chip_604x */ .sht = &mv_sht, .host_flags = (MV_COMMON_FLAGS | MV_6XXX_FLAGS), .pio_mask = 0x1f, /* pio0-4 */ .udma_mask = 0x7f, /* udma0-6 */ - .port_ops = &mv_ops, + .port_ops = &mv6_ops, }, { /* chip_608x */ .sht = &mv_sht, @@ -423,17 +463,15 @@ static struct ata_port_info mv_port_info[] = { MV_FLAG_DUAL_HC), .pio_mask = 0x1f, /* pio0-4 */ .udma_mask = 0x7f, /* udma0-6 */ - .port_ops = &mv_ops, + .port_ops = &mv6_ops, }, }; static const struct pci_device_id mv_pci_tbl[] = { -#if 0 /* unusably broken right now */ {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5040), 0, 0, chip_504x}, {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5041), 0, 0, chip_504x}, {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5080), 0, 0, chip_5080}, {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5081), 0, 0, chip_508x}, -#endif {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6040), 0, 0, chip_604x}, {PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x6041), 0, 0, chip_604x}, @@ -484,11 +522,27 @@ static inline void __iomem *mv_hc_base(void __iomem *base, unsigned int hc) return (base + MV_SATAHC0_REG_BASE + (hc * MV_SATAHC_REG_SZ)); } +static inline unsigned int mv_hc_from_port(unsigned int port) +{ + return port >> MV_PORT_HC_SHIFT; +} + +static inline unsigned int mv_hardport_from_port(unsigned int port) +{ + return port & MV_PORT_MASK; +} + +static inline void __iomem *mv_hc_base_from_port(void __iomem *base, + unsigned int port) +{ + return mv_hc_base(base, mv_hc_from_port(port)); +} + static inline void __iomem *mv_port_base(void __iomem *base, unsigned int port) { - return (mv_hc_base(base, port >> MV_PORT_HC_SHIFT) + + return mv_hc_base_from_port(base, port) + MV_SATAHC_ARBTR_REG_SZ + - ((port & MV_PORT_MASK) * MV_PORT_REG_SZ)); + (mv_hardport_from_port(port) * MV_PORT_REG_SZ); } static inline void __iomem *mv_ap_base(struct ata_port *ap) @@ -1089,7 +1143,7 @@ static void mv_err_intr(struct ata_port *ap) /* check for fatal here and recover if needed */ if (EDMA_ERR_FATAL & edma_err_cause) { - mv_phy_reset(ap); + mv_stop_and_reset(ap); } } @@ -1236,6 +1290,51 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance, return IRQ_RETVAL(handled); } +static void __iomem *mv5_phy_base(void __iomem *mmio, unsigned int port) +{ + void __iomem *hc_mmio = mv_hc_base_from_port(mmio, port); + unsigned long ofs = (mv_hardport_from_port(port) + 1) * 0x100UL; + + return hc_mmio + ofs; +} + +static unsigned int mv5_scr_offset(unsigned int sc_reg_in) +{ + unsigned int ofs; + + switch (sc_reg_in) { + case SCR_STATUS: + case SCR_ERROR: + case SCR_CONTROL: + ofs = sc_reg_in * sizeof(u32); + break; + default: + ofs = 0xffffffffU; + break; + } + return ofs; +} + +static u32 mv5_scr_read(struct ata_port *ap, unsigned int sc_reg_in) +{ + void __iomem *mmio = mv5_phy_base(ap->host_set->mmio_base, ap->port_no); + unsigned int ofs = mv5_scr_offset(sc_reg_in); + + if (ofs != 0xffffffffU) + return readl(mmio + ofs); + else + return (u32) ofs; +} + +static void mv5_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val) +{ + void __iomem *mmio = mv5_phy_base(ap->host_set->mmio_base, ap->port_no); + unsigned int ofs = mv5_scr_offset(sc_reg_in); + + if (ofs != 0xffffffffU) + writelfl(val, mmio + ofs); +} + static void mv5_reset_bus(struct pci_dev *pdev, void __iomem *mmio) { u8 rev_id; @@ -1262,7 +1361,13 @@ static void mv5_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio) static void mv5_read_preamp(struct mv_host_priv *hpriv, int idx, void __iomem *mmio) { - /* FIXME */ + void __iomem *phy_mmio = mv5_phy_base(mmio, idx); + u32 tmp; + + tmp = readl(phy_mmio + MV5_PHY_MODE); + + hpriv->signal[idx].pre = tmp & 0x1800; /* bits 12:11 */ + hpriv->signal[idx].amps = tmp & 0xe0; /* bits 7:5 */ } static void mv5_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio) @@ -1281,13 +1386,90 @@ static void mv5_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio) static void mv5_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, unsigned int port) { - /* FIXME */ + void __iomem *phy_mmio = mv5_phy_base(mmio, port); + const u32 mask = (1<<12) | (1<<11) | (1<<7) | (1<<6) | (1<<5); + u32 tmp; + int fix_apm_sq = (hpriv->hp_flags & MV_HP_ERRATA_50XXB0); + + if (fix_apm_sq) { + tmp = readl(phy_mmio + MV5_LT_MODE); + tmp |= (1 << 19); + writel(tmp, phy_mmio + MV5_LT_MODE); + + tmp = readl(phy_mmio + MV5_PHY_CTL); + tmp &= ~0x3; + tmp |= 0x1; + writel(tmp, phy_mmio + MV5_PHY_CTL); + } + + tmp = readl(phy_mmio + MV5_PHY_MODE); + tmp &= ~mask; + tmp |= hpriv->signal[port].pre; + tmp |= hpriv->signal[port].amps; + writel(tmp, phy_mmio + MV5_PHY_MODE); +} + + +#undef ZERO +#define ZERO(reg) writel(0, port_mmio + (reg)) +static void mv5_reset_hc_port(struct mv_host_priv *hpriv, void __iomem *mmio, + unsigned int port) +{ + void __iomem *port_mmio = mv_port_base(mmio, port); + + writelfl(EDMA_DS, port_mmio + EDMA_CMD_OFS); + + mv_channel_reset(hpriv, mmio, port); + + ZERO(0x028); /* command */ + writel(0x11f, port_mmio + EDMA_CFG_OFS); + ZERO(0x004); /* timer */ + ZERO(0x008); /* irq err cause */ + ZERO(0x00c); /* irq err mask */ + ZERO(0x010); /* rq bah */ + ZERO(0x014); /* rq inp */ + ZERO(0x018); /* rq outp */ + ZERO(0x01c); /* respq bah */ + ZERO(0x024); /* respq outp */ + ZERO(0x020); /* respq inp */ + ZERO(0x02c); /* test control */ + writel(0xbc, port_mmio + EDMA_IORDY_TMOUT); } +#undef ZERO -static int mv5_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio) +#define ZERO(reg) writel(0, hc_mmio + (reg)) +static void mv5_reset_one_hc(struct mv_host_priv *hpriv, void __iomem *mmio, + unsigned int hc) { - /* FIXME */ - return 1; + void __iomem *hc_mmio = mv_hc_base(mmio, hc); + u32 tmp; + + ZERO(0x00c); + ZERO(0x010); + ZERO(0x014); + ZERO(0x018); + + tmp = readl(hc_mmio + 0x20); + tmp &= 0x1c1c1c1c; + tmp |= 0x03030303; + writel(tmp, hc_mmio + 0x20); +} +#undef ZERO + +static int mv5_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio, + unsigned int n_hc) +{ + unsigned int hc, port; + + for (hc = 0; hc < n_hc; hc++) { + for (port = 0; port < MV_PORTS_PER_HC; port++) + mv5_reset_hc_port(hpriv, mmio, + (hc * MV_PORTS_PER_HC) + port); + + mv5_reset_one_hc(hpriv, mmio, hc); + } + + return 0; } #undef ZERO @@ -1335,7 +1517,8 @@ static void mv6_reset_flash(struct mv_host_priv *hpriv, void __iomem *mmio) * LOCKING: * Inherited from caller. */ -static int mv6_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio) +static int mv6_reset_hc(struct mv_host_priv *hpriv, void __iomem *mmio, + unsigned int n_hc) { void __iomem *reg = mmio + PCI_MAIN_CMD_STS_OFS; int i, rc = 0; @@ -1415,9 +1598,11 @@ static void mv6_enable_leds(struct mv_host_priv *hpriv, void __iomem *mmio) writel(0x00000060, mmio + MV_GPIO_PORT_CTL); } -static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *port_mmio, +static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *mmio, unsigned int port) { + void __iomem *port_mmio = mv_port_base(mmio, port); + u32 hp_flags = hpriv->hp_flags; int fix_phy_mode2 = hp_flags & (MV_HP_ERRATA_60X1B2 | MV_HP_ERRATA_60X1C0); @@ -1473,6 +1658,44 @@ static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *port_mmio, writel(m2, port_mmio + PHY_MODE2); } +static void mv_channel_reset(struct mv_host_priv *hpriv, void __iomem *mmio, + unsigned int port_no) +{ + void __iomem *port_mmio = mv_port_base(mmio, port_no); + + writelfl(ATA_RST, port_mmio + EDMA_CMD_OFS); + + if (IS_60XX(hpriv)) { + u32 ifctl = readl(port_mmio + SATA_INTERFACE_CTL); + ifctl |= (1 << 12) | (1 << 7); + writelfl(ifctl, port_mmio + SATA_INTERFACE_CTL); + } + + udelay(25); /* allow reset propagation */ + + /* Spec never mentions clearing the bit. Marvell's driver does + * clear the bit, however. + */ + writelfl(0, port_mmio + EDMA_CMD_OFS); + + hpriv->ops->phy_errata(hpriv, mmio, port_no); + + if (IS_50XX(hpriv)) + mdelay(1); +} + +static void mv_stop_and_reset(struct ata_port *ap) +{ + struct mv_host_priv *hpriv = ap->host_set->private_data; + void __iomem *mmio = ap->host_set->mmio_base; + + mv_stop_dma(ap); + + mv_channel_reset(hpriv, mmio, ap->port_no); + + mv_phy_reset(ap); +} + /** * mv_phy_reset - Perform eDMA reset followed by COMRESET * @ap: ATA channel to manipulate @@ -1487,7 +1710,6 @@ static void mv6_phy_errata(struct mv_host_priv *hpriv, void __iomem *port_mmio, static void mv_phy_reset(struct ata_port *ap) { struct mv_port_priv *pp = ap->private_data; - struct mv_host_priv *hpriv = ap->host_set->private_data; void __iomem *port_mmio = mv_ap_base(ap); struct ata_taskfile tf; struct ata_device *dev = &ap->device[0]; @@ -1495,25 +1717,6 @@ static void mv_phy_reset(struct ata_port *ap) VPRINTK("ENTER, port %u, mmio 0x%p\n", ap->port_no, port_mmio); - mv_stop_dma(ap); - - writelfl(ATA_RST, port_mmio + EDMA_CMD_OFS); - - if (IS_60XX(hpriv)) { - u32 ifctl = readl(port_mmio + SATA_INTERFACE_CTL); - ifctl |= (1 << 12) | (1 << 7); - writelfl(ifctl, port_mmio + SATA_INTERFACE_CTL); - } - - udelay(25); /* allow reset propagation */ - - /* Spec never mentions clearing the bit. Marvell's driver does - * clear the bit, however. - */ - writelfl(0, port_mmio + EDMA_CMD_OFS); - - hpriv->ops->phy_errata(hpriv, port_mmio, ap->port_no); - DPRINTK("S-regs after ATA_RST: SStat 0x%08x SErr 0x%08x " "SCtrl 0x%08x\n", mv_scr_read(ap, SCR_STATUS), mv_scr_read(ap, SCR_ERROR), mv_scr_read(ap, SCR_CONTROL)); @@ -1589,7 +1792,7 @@ static void mv_eng_timeout(struct ata_port *ap) &qc->scsicmd->cmnd); mv_err_intr(ap); - mv_phy_reset(ap); + mv_stop_and_reset(ap); if (!qc) { printk(KERN_ERR "ata%u: BUG: timeout without command\n", @@ -1765,7 +1968,7 @@ static int mv_init_host(struct pci_dev *pdev, struct ata_probe_ent *probe_ent, for (port = 0; port < probe_ent->n_ports; port++) hpriv->ops->read_preamp(hpriv, port, mmio); - rc = hpriv->ops->reset_hc(hpriv, mmio); + rc = hpriv->ops->reset_hc(hpriv, mmio, n_hc); if (rc) goto done; @@ -1774,15 +1977,15 @@ static int mv_init_host(struct pci_dev *pdev, struct ata_probe_ent *probe_ent, hpriv->ops->enable_leds(hpriv, mmio); for (port = 0; port < probe_ent->n_ports; port++) { - void __iomem *port_mmio = mv_port_base(mmio, port); - if (IS_60XX(hpriv)) { + void __iomem *port_mmio = mv_port_base(mmio, port); + u32 ifctl = readl(port_mmio + SATA_INTERFACE_CTL); ifctl |= (1 << 12); writelfl(ifctl, port_mmio + SATA_INTERFACE_CTL); } - hpriv->ops->phy_errata(hpriv, port_mmio, port); + hpriv->ops->phy_errata(hpriv, mmio, port); } for (port = 0; port < probe_ent->n_ports; port++) { -- cgit v1.2.3 From 47f2bce9021b4974ed33b072ebb8348c8145c946 Mon Sep 17 00:00:00 2001 From: Roland Dreier Date: Tue, 15 Nov 2005 00:19:21 -0800 Subject: [IB] srp: don't post receive if no send buf available Have __srp_get_tx_iu() fail if the target port's request limit will not allow the initiator to post a send. This avoids continuing on and posting a receive, and then failing to post a corresponding send. If that happens, then the initiator will end up with an extra receive posted, and if this happens to much, the receive queue will overflow. Signed-off-by: Roland Dreier --- drivers/infiniband/ulp/srp/ib_srp.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'drivers') diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index a3645303cb9..ee9fe226ae9 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -802,13 +802,21 @@ static int srp_post_recv(struct srp_target_port *target) /* * Must be called with target->scsi_host->host_lock held to protect - * req_lim and tx_head. + * req_lim and tx_head. Lock cannot be dropped between call here and + * call to __srp_post_send(). */ static struct srp_iu *__srp_get_tx_iu(struct srp_target_port *target) { if (target->tx_head - target->tx_tail >= SRP_SQ_SIZE) return NULL; + if (unlikely(target->req_lim < 1)) { + if (printk_ratelimit()) + printk(KERN_DEBUG PFX "Target has req_lim %d\n", + target->req_lim); + return NULL; + } + return target->tx_ring[target->tx_head & SRP_SQ_SIZE]; } @@ -823,11 +831,6 @@ static int __srp_post_send(struct srp_target_port *target, struct ib_send_wr wr, *bad_wr; int ret = 0; - if (target->req_lim < 1) { - printk(KERN_ERR PFX "Target has req_lim %d\n", target->req_lim); - return -EAGAIN; - } - list.addr = iu->dma; list.length = len; list.lkey = target->srp_host->mr->lkey; -- cgit v1.2.3 From cbc5b2bb9e226c2b2b981836d2289912e2ef3c1c Mon Sep 17 00:00:00 2001 From: Roland Dreier Date: Tue, 15 Nov 2005 00:24:23 -0800 Subject: [IB] mthca: don't disable RDMA writes if no responder resources Responder resources are only required to handle RDMA reads and atomic operations, not RDMA writes. So the driver should allow RDMA writes even if responder resources are set to 0. This is especially important for the UC transport -- with the old code, it was impossible to enable RDMA writes for UC QPs. Signed-off-by: Roland Dreier --- drivers/infiniband/hw/mthca/mthca_qp.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'drivers') diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c index 760c418d5bc..5899f0c765b 100644 --- a/drivers/infiniband/hw/mthca/mthca_qp.c +++ b/drivers/infiniband/hw/mthca/mthca_qp.c @@ -730,14 +730,15 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask) } if (attr_mask & IB_QP_ACCESS_FLAGS) { + qp_context->params2 |= + cpu_to_be32(attr->qp_access_flags & IB_ACCESS_REMOTE_WRITE ? + MTHCA_QP_BIT_RWE : 0); + /* - * Only enable RDMA/atomics if we have responder - * resources set to a non-zero value. + * Only enable RDMA reads and atomics if we have + * responder resources set to a non-zero value. */ if (qp->resp_depth) { - qp_context->params2 |= - cpu_to_be32(attr->qp_access_flags & IB_ACCESS_REMOTE_WRITE ? - MTHCA_QP_BIT_RWE : 0); qp_context->params2 |= cpu_to_be32(attr->qp_access_flags & IB_ACCESS_REMOTE_READ ? MTHCA_QP_BIT_RRE : 0); @@ -759,22 +760,19 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask) if (qp->resp_depth && !attr->max_dest_rd_atomic) { /* * Lowering our responder resources to zero. - * Turn off RDMA/atomics as responder. - * (RWE/RRE/RAE in params2 already zero) + * Turn off reads RDMA and atomics as responder. + * (RRE/RAE in params2 already zero) */ - qp_param->opt_param_mask |= cpu_to_be32(MTHCA_QP_OPTPAR_RWE | - MTHCA_QP_OPTPAR_RRE | + qp_param->opt_param_mask |= cpu_to_be32(MTHCA_QP_OPTPAR_RRE | MTHCA_QP_OPTPAR_RAE); } if (!qp->resp_depth && attr->max_dest_rd_atomic) { /* * Increasing our responder resources from - * zero. Turn on RDMA/atomics as appropriate. + * zero. Turn on RDMA reads and atomics as + * appropriate. */ - qp_context->params2 |= - cpu_to_be32(qp->atomic_rd_en & IB_ACCESS_REMOTE_WRITE ? - MTHCA_QP_BIT_RWE : 0); qp_context->params2 |= cpu_to_be32(qp->atomic_rd_en & IB_ACCESS_REMOTE_READ ? MTHCA_QP_BIT_RRE : 0); @@ -782,8 +780,7 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask) cpu_to_be32(qp->atomic_rd_en & IB_ACCESS_REMOTE_ATOMIC ? MTHCA_QP_BIT_RAE : 0); - qp_param->opt_param_mask |= cpu_to_be32(MTHCA_QP_OPTPAR_RWE | - MTHCA_QP_OPTPAR_RRE | + qp_param->opt_param_mask |= cpu_to_be32(MTHCA_QP_OPTPAR_RRE | MTHCA_QP_OPTPAR_RAE); } -- cgit v1.2.3 From d10cb35a876c72b4b6711a366e341a1e4d8aa709 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Wed, 16 Nov 2005 16:56:49 +0900 Subject: [PATCH] sil24: add constants Adds constants for ATAPI support to sata_sil24. This patch is originally from Jeff Garzik . Signed-off-by: Tejun Heo Signed-off-by: Jeff Garzik --- drivers/scsi/sata_sil24.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c index 55e744d6db8..cb1933a3bd5 100644 --- a/drivers/scsi/sata_sil24.c +++ b/drivers/scsi/sata_sil24.c @@ -139,6 +139,7 @@ enum { PORT_CS_DEV_RST = (1 << 1), /* device reset */ PORT_CS_INIT = (1 << 2), /* port initialize */ PORT_CS_IRQ_WOC = (1 << 3), /* interrupt write one to clear */ + PORT_CS_CDB16 = (1 << 5), /* 0=12b cdb, 1=16b cdb */ PORT_CS_RESUME = (1 << 6), /* port resume */ PORT_CS_32BIT_ACTV = (1 << 10), /* 32-bit activation */ PORT_CS_PM_EN = (1 << 13), /* port multiplier enable */ @@ -188,11 +189,29 @@ enum { PORT_CERR_XFR_PCIPERR = 35, /* PSD ecode 11 - PCI prity err during transfer */ PORT_CERR_SENDSERVICE = 36, /* FIS received while sending service */ + /* bits of PRB control field */ + PRB_CTRL_PROTOCOL = (1 << 0), /* override def. ATA protocol */ + PRB_CTRL_PACKET_READ = (1 << 4), /* PACKET cmd read */ + PRB_CTRL_PACKET_WRITE = (1 << 5), /* PACKET cmd write */ + PRB_CTRL_NIEN = (1 << 6), /* Mask completion irq */ + PRB_CTRL_SRST = (1 << 7), /* Soft reset request (ign BSY?) */ + + /* PRB protocol field */ + PRB_PROT_PACKET = (1 << 0), + PRB_PROT_TCQ = (1 << 1), + PRB_PROT_NCQ = (1 << 2), + PRB_PROT_READ = (1 << 3), + PRB_PROT_WRITE = (1 << 4), + PRB_PROT_TRANSPARENT = (1 << 5), + /* * Other constants */ SGE_TRM = (1 << 31), /* Last SGE in chain */ - PRB_SOFT_RST = (1 << 7), /* Soft reset request (ign BSY?) */ + SGE_LNK = (1 << 30), /* linked list + Points to SGT, not SGE */ + SGE_DRD = (1 << 29), /* discard data read (/dev/null) + data address ignored */ /* board id */ BID_SIL3124 = 0, -- cgit v1.2.3 From 75b1f2f865c6e6c6c04e2779750192b8d3d504e8 Mon Sep 17 00:00:00 2001 From: Albert Lee Date: Wed, 16 Nov 2005 17:06:18 +0800 Subject: [PATCH] libata: honor the transfer cycle time speficied by the EIDE device The following code segment is not functional because the transfer cycle time speficied by the EIDE device is later overwritten by ata_timing_quantize(): /* * If the drive is an EIDE drive, it can tell us it needs extended * PIO/MW_DMA cycle timing. */ if (adev->id[ATA_ID_FIELD_VALID] & 2) { /* EIDE drive */ memset(&p, 0, sizeof(p)); (snip) ata_timing_merge(&p, t, t, ATA_TIMING_CYCLE | ATA_TIMING_CYC8B); <== uninitialized "t" is used here } /* * Convert the timing to bus clock counts. */ ata_timing_quantize(s, t, T, UT); <== t is overwritten by quantized s The patch has been submitted for ide-timing.h before: http://marc.theaimsgroup.com/?l=linux-ide&m=110820013425454&w=2 Resubmitted for libata. Changes: - Minor fix to honor the following transfer cycle time speficied by the device - id[65]: Minimum Multiword DMA transfer cycle time per word - id[67]: Minimum PIO transfer cycle time without flow control - id[68]: Minimum PIO transfer cycle time with IORDY Signed-off-by: Albert Lee ======= Signed-off-by: Jeff Garzik --- drivers/scsi/libata-core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index ba1eb8b38e0..bb604dfbdef 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c @@ -1570,11 +1570,13 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed, /* * Find the mode. - */ + */ if (!(s = ata_timing_find_mode(speed))) return -EINVAL; + memcpy(t, s, sizeof(*s)); + /* * If the drive is an EIDE drive, it can tell us it needs extended * PIO/MW_DMA cycle timing. @@ -1595,7 +1597,7 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed, * Convert the timing to bus clock counts. */ - ata_timing_quantize(s, t, T, UT); + ata_timing_quantize(t, t, T, UT); /* * Even in DMA/UDMA modes we still use PIO access for IDENTIFY, S.M.A.R.T -- cgit v1.2.3 From c2cd76ff106b8bd9c0a754c6439c74e86fd2aba7 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Wed, 16 Nov 2005 09:23:30 -0500 Subject: [libata ahci] tone down ATAPI errors ATA devices don't generate many errors, so the preferred method is to printk() when they occur. ATAPI devices generate tons of exceptions during the normal course of operation, so this change skips logging the most common class of errors. --- drivers/scsi/ahci.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'drivers') diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index 894e7113e0b..5386c0d6101 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c @@ -558,23 +558,25 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc) pp->cmd_slot[0].opts |= cpu_to_le32(n_elem << 16); } -static void ahci_intr_error(struct ata_port *ap, u32 irq_stat) +static void ahci_restart_port(struct ata_port *ap, u32 irq_stat) { void __iomem *mmio = ap->host_set->mmio_base; void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no); u32 tmp; int work; - printk(KERN_WARNING "ata%u: port reset, " - "p_is %x is %x pis %x cmd %x tf %x ss %x se %x\n", - ap->id, - irq_stat, - readl(mmio + HOST_IRQ_STAT), - readl(port_mmio + PORT_IRQ_STAT), - readl(port_mmio + PORT_CMD), - readl(port_mmio + PORT_TFDATA), - readl(port_mmio + PORT_SCR_STAT), - readl(port_mmio + PORT_SCR_ERR)); + if ((ap->device[0].class != ATA_DEV_ATAPI) || + ((irq_stat & PORT_IRQ_TF_ERR) == 0)) + printk(KERN_WARNING "ata%u: port reset, " + "p_is %x is %x pis %x cmd %x tf %x ss %x se %x\n", + ap->id, + irq_stat, + readl(mmio + HOST_IRQ_STAT), + readl(port_mmio + PORT_IRQ_STAT), + readl(port_mmio + PORT_CMD), + readl(port_mmio + PORT_TFDATA), + readl(port_mmio + PORT_SCR_STAT), + readl(port_mmio + PORT_SCR_ERR)); /* stop DMA */ tmp = readl(port_mmio + PORT_CMD); @@ -632,7 +634,7 @@ static void ahci_eng_timeout(struct ata_port *ap) printk(KERN_ERR "ata%u: BUG: timeout without command\n", ap->id); } else { - ahci_intr_error(ap, readl(port_mmio + PORT_IRQ_STAT)); + ahci_restart_port(ap, readl(port_mmio + PORT_IRQ_STAT)); /* hack alert! We cannot use the supplied completion * function from inside the ->eh_strategy_handler() thread. @@ -677,7 +679,7 @@ static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc) err_mask = AC_ERR_HOST_BUS; /* command processing has stopped due to error; restart */ - ahci_intr_error(ap, status); + ahci_restart_port(ap, status); if (qc) ata_qc_complete(qc, err_mask); -- cgit v1.2.3 From 7bdd720869ff75700b48b132ee71852615b55808 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Wed, 16 Nov 2005 11:06:59 -0500 Subject: [libata] bump versions --- drivers/scsi/ahci.c | 2 +- drivers/scsi/ata_piix.c | 2 +- drivers/scsi/libata.h | 2 +- drivers/scsi/sata_promise.c | 2 +- drivers/scsi/sata_qstor.c | 2 +- drivers/scsi/sata_svw.c | 2 +- drivers/scsi/sata_sx4.c | 2 +- drivers/scsi/sata_vsc.c | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers') diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c index 5386c0d6101..83467a05dc8 100644 --- a/drivers/scsi/ahci.c +++ b/drivers/scsi/ahci.c @@ -48,7 +48,7 @@ #include #define DRV_NAME "ahci" -#define DRV_VERSION "1.01" +#define DRV_VERSION "1.2" enum { diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c index 855428ff37e..333d69dd84e 100644 --- a/drivers/scsi/ata_piix.c +++ b/drivers/scsi/ata_piix.c @@ -50,7 +50,7 @@ #include #define DRV_NAME "ata_piix" -#define DRV_VERSION "1.04" +#define DRV_VERSION "1.05" enum { PIIX_IOCFG = 0x54, /* IDE I/O configuration register */ diff --git a/drivers/scsi/libata.h b/drivers/scsi/libata.h index 74a84e0ec0a..8ebaa694d18 100644 --- a/drivers/scsi/libata.h +++ b/drivers/scsi/libata.h @@ -29,7 +29,7 @@ #define __LIBATA_H__ #define DRV_NAME "libata" -#define DRV_VERSION "1.12" /* must be exactly four chars */ +#define DRV_VERSION "1.20" /* must be exactly four chars */ struct ata_scsi_args { u16 *id; diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c index 242d906987a..8a8e3e3ef0e 100644 --- a/drivers/scsi/sata_promise.c +++ b/drivers/scsi/sata_promise.c @@ -46,7 +46,7 @@ #include "sata_promise.h" #define DRV_NAME "sata_promise" -#define DRV_VERSION "1.02" +#define DRV_VERSION "1.03" enum { diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c index 4a6d3067d23..a8987f5ff5c 100644 --- a/drivers/scsi/sata_qstor.c +++ b/drivers/scsi/sata_qstor.c @@ -41,7 +41,7 @@ #include #define DRV_NAME "sata_qstor" -#define DRV_VERSION "0.04" +#define DRV_VERSION "0.05" enum { QS_PORTS = 4, diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c index 57e5a9d964c..6e7f7c83a75 100644 --- a/drivers/scsi/sata_svw.c +++ b/drivers/scsi/sata_svw.c @@ -54,7 +54,7 @@ #endif /* CONFIG_PPC_OF */ #define DRV_NAME "sata_svw" -#define DRV_VERSION "1.06" +#define DRV_VERSION "1.07" /* Taskfile registers offsets */ #define K2_SATA_TF_CMD_OFFSET 0x00 diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c index b4bbe48acab..dcc3ad9a9d6 100644 --- a/drivers/scsi/sata_sx4.c +++ b/drivers/scsi/sata_sx4.c @@ -46,7 +46,7 @@ #include "sata_promise.h" #define DRV_NAME "sata_sx4" -#define DRV_VERSION "0.7" +#define DRV_VERSION "0.8" enum { diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c index 77a6e4b9262..fcfa486965b 100644 --- a/drivers/scsi/sata_vsc.c +++ b/drivers/scsi/sata_vsc.c @@ -47,7 +47,7 @@ #include #define DRV_NAME "sata_vsc" -#define DRV_VERSION "1.0" +#define DRV_VERSION "1.1" /* Interrupt register offsets (from chip base address) */ #define VSC_SATA_INT_STAT_OFFSET 0x00 -- cgit v1.2.3 From 1f7bad72c0ed8cf29d13bac81ceeba9e1ac05c66 Mon Sep 17 00:00:00 2001 From: Krzysztof Halasa Date: Fri, 11 Nov 2005 01:10:30 +0100 Subject: [PATCH] Generic HDLC WAN drivers - disable netif_carrier_off() As we are currently unable to fix the problem with carrier and protocol state signaling in net core I've to disable netif_carrier_off() calls used by WAN protocol drivers. The attached patch should make them working again. The remaining netif_carrier_*() calls in hdlc_fr.c are fine as they don't touch the physical device. Signed-off-by: Krzysztof Halasa Signed-off-by: John W. Linville --- drivers/net/wan/hdlc_cisco.c | 6 ++++++ drivers/net/wan/hdlc_fr.c | 4 ++++ drivers/net/wan/hdlc_generic.c | 6 ++++++ 3 files changed, 16 insertions(+) (limited to 'drivers') diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c index a01efa6d5c6..1fd04662c4f 100644 --- a/drivers/net/wan/hdlc_cisco.c +++ b/drivers/net/wan/hdlc_cisco.c @@ -192,7 +192,9 @@ static int cisco_rx(struct sk_buff *skb) "uptime %ud%uh%um%us)\n", dev->name, days, hrs, min, sec); +#if 0 netif_carrier_on(dev); +#endif hdlc->state.cisco.up = 1; } } @@ -225,7 +227,9 @@ static void cisco_timer(unsigned long arg) hdlc->state.cisco.settings.timeout * HZ)) { hdlc->state.cisco.up = 0; printk(KERN_INFO "%s: Link down\n", dev->name); +#if 0 netif_carrier_off(dev); +#endif } cisco_keepalive_send(dev, CISCO_KEEPALIVE_REQ, @@ -261,8 +265,10 @@ static void cisco_stop(struct net_device *dev) { hdlc_device *hdlc = dev_to_hdlc(dev); del_timer_sync(&hdlc->state.cisco.timer); +#if 0 if (netif_carrier_ok(dev)) netif_carrier_off(dev); +#endif hdlc->state.cisco.up = 0; hdlc->state.cisco.request_sent = 0; } diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c index e1601d35dce..523afe17564 100644 --- a/drivers/net/wan/hdlc_fr.c +++ b/drivers/net/wan/hdlc_fr.c @@ -545,8 +545,10 @@ static void fr_set_link_state(int reliable, struct net_device *dev) hdlc->state.fr.reliable = reliable; if (reliable) { +#if 0 if (!netif_carrier_ok(dev)) netif_carrier_on(dev); +#endif hdlc->state.fr.n391cnt = 0; /* Request full status */ hdlc->state.fr.dce_changed = 1; @@ -560,8 +562,10 @@ static void fr_set_link_state(int reliable, struct net_device *dev) } } } else { +#if 0 if (netif_carrier_ok(dev)) netif_carrier_off(dev); +#endif while (pvc) { /* Deactivate all PVCs */ pvc_carrier(0, pvc); diff --git a/drivers/net/wan/hdlc_generic.c b/drivers/net/wan/hdlc_generic.c index cdd4c09c2d9..46cef8f9213 100644 --- a/drivers/net/wan/hdlc_generic.c +++ b/drivers/net/wan/hdlc_generic.c @@ -79,11 +79,13 @@ static void __hdlc_set_carrier_on(struct net_device *dev) hdlc_device *hdlc = dev_to_hdlc(dev); if (hdlc->proto.start) return hdlc->proto.start(dev); +#if 0 #ifdef DEBUG_LINK if (netif_carrier_ok(dev)) printk(KERN_ERR "hdlc_set_carrier_on(): already on\n"); #endif netif_carrier_on(dev); +#endif } @@ -94,11 +96,13 @@ static void __hdlc_set_carrier_off(struct net_device *dev) if (hdlc->proto.stop) return hdlc->proto.stop(dev); +#if 0 #ifdef DEBUG_LINK if (!netif_carrier_ok(dev)) printk(KERN_ERR "hdlc_set_carrier_off(): already off\n"); #endif netif_carrier_off(dev); +#endif } @@ -294,8 +298,10 @@ int register_hdlc_device(struct net_device *dev) if (result != 0) return -EIO; +#if 0 if (netif_carrier_ok(dev)) netif_carrier_off(dev); /* no carrier until DCD goes up */ +#endif return 0; } -- cgit v1.2.3 From 7c8b2eb4c71d5c3d45dbfe0c81fefe81e264e9b3 Mon Sep 17 00:00:00 2001 From: Francois Romieu Date: Wed, 16 Nov 2005 23:44:05 +0100 Subject: r8169: fix printk_ratelimit in the interrupt handler I keep on getting "printk: N messages suppressed" messages. We need to test netif_msg_intr() _before_ running printk_ratelimit(), because the latter updates state. Cc: Jeff Garzik Signed-off-by: Andrew Morton Signed-off-by: Francois Romieu --- drivers/net/r8169.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 159b56a56ef..bda6095f312 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c @@ -2516,7 +2516,7 @@ rtl8169_interrupt(int irq, void *dev_instance, struct pt_regs *regs) } while (boguscnt > 0); if (boguscnt <= 0) { - if (net_ratelimit() && netif_msg_intr(tp)) { + if (netif_msg_intr(tp) && net_ratelimit() ) { printk(KERN_WARNING "%s: Too much work at interrupt!\n", dev->name); } -- cgit v1.2.3 From e53091fae52931a96dfb661f2b78e0a91e5f9978 Mon Sep 17 00:00:00 2001 From: Francois Romieu Date: Wed, 16 Nov 2005 23:44:41 +0100 Subject: r8169: do not abort when the power management capabilities are disabled The capabilities of the 8169 can be disabled but it is hardly a reason to prevent the use the device. The (so far) unusual behavior has been reported on a MIPS platform by Yoichi Yuasa. Spotted-by: Yoichi Yuasa Signed-off-by: Francois Romieu --- drivers/net/r8169.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index bda6095f312..14a76f7cf90 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c @@ -1346,10 +1346,8 @@ rtl8169_init_board(struct pci_dev *pdev, struct net_device **dev_out, } else { if (netif_msg_probe(tp)) { printk(KERN_ERR PFX - "Cannot find PowerManagement capability. " - "Aborting.\n"); + "PowerManagement capability not found.\n"); } - goto err_out_mwi; } /* make sure PCI base addr 1 is MMIO */ -- cgit v1.2.3 From b341e32e5cc1a154cb0ac2f4229c2d040647804b Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Thu, 17 Nov 2005 13:34:57 +1100 Subject: [PATCH] powerpc: Workaround for offb on 64 bits platforms This fixes a problem with offb not parsing addresses properly on 64 bits machines, and thus crashing at boot. The problem is worked around by locating the matching PCI device and using the properly relocated PCI base addresses instead of misparsing the Open Firmware properties. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Paul Mackerras --- drivers/video/offb.c | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) (limited to 'drivers') diff --git a/drivers/video/offb.c b/drivers/video/offb.c index 2c856838694..fe8ba364b3e 100644 --- a/drivers/video/offb.c +++ b/drivers/video/offb.c @@ -325,8 +325,8 @@ static void __init offb_init_nodriver(struct device_node *dp) int *pp, i; unsigned int len; int width = 640, height = 480, depth = 8, pitch; - unsigned *up; - unsigned long address; + unsigned int rsize, *up; + unsigned long address = 0; if ((pp = (int *) get_property(dp, "depth", &len)) != NULL && len == sizeof(int)) @@ -344,10 +344,40 @@ static void __init offb_init_nodriver(struct device_node *dp) pitch = 0x1000; } else pitch = width; - if ((up = (unsigned *) get_property(dp, "address", &len)) != NULL - && len == sizeof(unsigned)) + + rsize = (unsigned long)pitch * (unsigned long)height * + (unsigned long)(depth / 8); + + /* Try to match device to a PCI device in order to get a properly + * translated address rather then trying to decode the open firmware + * stuff in various incorrect ways + */ +#ifdef CONFIG_PCI + /* First try to locate the PCI device if any */ + { + struct pci_dev *pdev = NULL; + + for_each_pci_dev(pdev) { + if (dp == pci_device_to_OF_node(pdev)) + break; + } + if (pdev) { + for (i = 0; i < 6 && address == 0; i++) { + if ((pci_resource_flags(pdev, i) & + IORESOURCE_MEM) && + (pci_resource_len(pdev, i) >= rsize)) + address = pci_resource_start(pdev, i); + } + pci_dev_put(pdev); + } + } +#endif /* CONFIG_PCI */ + + if (address == 0 && + (up = (unsigned *) get_property(dp, "address", &len)) != NULL && + len == sizeof(unsigned)) address = (u_long) * up; - else { + if (address == 0) { for (i = 0; i < dp->n_addrs; ++i) if (dp->addrs[i].size >= pitch * height * depth / 8) -- cgit v1.2.3 From 64f043d80752a8e5f0d55255e7bb9a1a05af206f Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Thu, 17 Nov 2005 10:50:01 -0500 Subject: [libata] add timeout to commands for which we call wait_completion() --- drivers/scsi/libata-core.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index bb604dfbdef..665ae79e1fd 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c @@ -1046,6 +1046,30 @@ static unsigned int ata_pio_modes(const struct ata_device *adev) return modes; } +static int ata_qc_wait_err(struct ata_queued_cmd *qc, + struct completion *wait) +{ + int rc = 0; + + if (wait_for_completion_timeout(wait, 30 * HZ) < 1) { + /* timeout handling */ + unsigned int err_mask = ac_err_mask(ata_chk_status(qc->ap)); + + if (!err_mask) { + printk(KERN_WARNING "ata%u: slow completion (cmd %x)\n", + qc->ap->id, qc->tf.command); + } else { + printk(KERN_WARNING "ata%u: qc timeout (cmd %x)\n", + qc->ap->id, qc->tf.command); + rc = -EIO; + } + + ata_qc_complete(qc, err_mask); + } + + return rc; +} + /** * ata_dev_identify - obtain IDENTIFY x DEVICE page * @ap: port on which device we wish to probe resides @@ -1125,7 +1149,7 @@ retry: if (rc) goto err_out; else - wait_for_completion(&wait); + ata_qc_wait_err(qc, &wait); spin_lock_irqsave(&ap->host_set->lock, flags); ap->ops->tf_read(ap, &qc->tf); @@ -2269,7 +2293,7 @@ static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev) if (rc) ata_port_disable(ap); else - wait_for_completion(&wait); + ata_qc_wait_err(qc, &wait); DPRINTK("EXIT\n"); } @@ -2317,7 +2341,7 @@ static void ata_dev_reread_id(struct ata_port *ap, struct ata_device *dev) if (rc) goto err_out; - wait_for_completion(&wait); + ata_qc_wait_err(qc, &wait); swap_buf_le16(dev->id, ATA_ID_WORDS); @@ -2373,7 +2397,7 @@ static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev) if (rc) ata_port_disable(ap); else - wait_for_completion(&wait); + ata_qc_wait_err(qc, &wait); DPRINTK("EXIT\n"); } -- cgit v1.2.3 From 22374677d18c5eeefd3a283431d312b8c44fef02 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Thu, 17 Nov 2005 10:59:48 -0500 Subject: [libata sata_mv] SATA probe, DMA boundary fixes - DMA boundary was being handled incorrectly. Copied the code from ata_fill_sg(), since Marvell has the same DMA boundary needs. (we can't use ata_fill_sg directly since we have different hardware descriptors) - cleaned up the SATA phy reset code, to deal with various errata --- drivers/scsi/sata_mv.c | 88 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 70 insertions(+), 18 deletions(-) (limited to 'drivers') diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index 722ab537b7a..ee0634da087 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c @@ -321,6 +321,7 @@ static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); static u32 mv5_scr_read(struct ata_port *ap, unsigned int sc_reg_in); static void mv5_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); static void mv_phy_reset(struct ata_port *ap); +static void __mv_phy_reset(struct ata_port *ap, int can_sleep); static void mv_host_stop(struct ata_host_set *host_set); static int mv_port_start(struct ata_port *ap); static void mv_port_stop(struct ata_port *ap); @@ -362,7 +363,7 @@ static struct scsi_host_template mv_sht = { .eh_strategy_handler = ata_scsi_error, .can_queue = MV_USE_Q_DEPTH, .this_id = ATA_SHT_THIS_ID, - .sg_tablesize = MV_MAX_SG_CT, + .sg_tablesize = MV_MAX_SG_CT / 2, .max_sectors = ATA_MAX_SECTORS, .cmd_per_lun = ATA_SHT_CMD_PER_LUN, .emulated = ATA_SHT_EMULATED, @@ -893,20 +894,30 @@ static void mv_fill_sg(struct ata_queued_cmd *qc) struct scatterlist *sg; ata_for_each_sg(sg, qc) { - u32 sg_len; dma_addr_t addr; + u32 sg_len, len, offset; addr = sg_dma_address(sg); sg_len = sg_dma_len(sg); - pp->sg_tbl[i].addr = cpu_to_le32(addr & 0xffffffff); - pp->sg_tbl[i].addr_hi = cpu_to_le32((addr >> 16) >> 16); - assert(0 == (sg_len & ~MV_DMA_BOUNDARY)); - pp->sg_tbl[i].flags_size = cpu_to_le32(sg_len); - if (ata_sg_is_last(sg, qc)) - pp->sg_tbl[i].flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL); + while (sg_len) { + offset = addr & MV_DMA_BOUNDARY; + len = sg_len; + if ((offset + sg_len) > 0x10000) + len = 0x10000 - offset; - i++; + pp->sg_tbl[i].addr = cpu_to_le32(addr & 0xffffffff); + pp->sg_tbl[i].addr_hi = cpu_to_le32((addr >> 16) >> 16); + pp->sg_tbl[i].flags_size = cpu_to_le32(len); + + sg_len -= len; + addr += len; + + if (!sg_len && ata_sg_is_last(sg, qc)) + pp->sg_tbl[i].flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL); + + i++; + } } } @@ -1693,11 +1704,19 @@ static void mv_stop_and_reset(struct ata_port *ap) mv_channel_reset(hpriv, mmio, ap->port_no); - mv_phy_reset(ap); + __mv_phy_reset(ap, 0); +} + +static inline void __msleep(unsigned int msec, int can_sleep) +{ + if (can_sleep) + msleep(msec); + else + mdelay(msec); } /** - * mv_phy_reset - Perform eDMA reset followed by COMRESET + * __mv_phy_reset - Perform eDMA reset followed by COMRESET * @ap: ATA channel to manipulate * * Part of this is taken from __sata_phy_reset and modified to @@ -1707,13 +1726,16 @@ static void mv_stop_and_reset(struct ata_port *ap) * Inherited from caller. This is coded to safe to call at * interrupt level, i.e. it does not sleep. */ -static void mv_phy_reset(struct ata_port *ap) +static void __mv_phy_reset(struct ata_port *ap, int can_sleep) { struct mv_port_priv *pp = ap->private_data; + struct mv_host_priv *hpriv = ap->host_set->private_data; void __iomem *port_mmio = mv_ap_base(ap); struct ata_taskfile tf; struct ata_device *dev = &ap->device[0]; unsigned long timeout; + int retry = 5; + u32 sstatus; VPRINTK("ENTER, port %u, mmio 0x%p\n", ap->port_no, port_mmio); @@ -1721,18 +1743,28 @@ static void mv_phy_reset(struct ata_port *ap) "SCtrl 0x%08x\n", mv_scr_read(ap, SCR_STATUS), mv_scr_read(ap, SCR_ERROR), mv_scr_read(ap, SCR_CONTROL)); - /* proceed to init communications via the scr_control reg */ + /* Issue COMRESET via SControl */ +comreset_retry: scr_write_flush(ap, SCR_CONTROL, 0x301); - mdelay(1); + __msleep(1, can_sleep); + scr_write_flush(ap, SCR_CONTROL, 0x300); - timeout = jiffies + (HZ * 1); + __msleep(20, can_sleep); + + timeout = jiffies + msecs_to_jiffies(200); do { - mdelay(10); - if ((scr_read(ap, SCR_STATUS) & 0xf) != 1) + sstatus = scr_read(ap, SCR_STATUS) & 0x3; + if ((sstatus == 3) || (sstatus == 0)) break; + + __msleep(1, can_sleep); } while (time_before(jiffies, timeout)); - mv_scr_write(ap, SCR_ERROR, mv_scr_read(ap, SCR_ERROR)); + /* work around errata */ + if (IS_60XX(hpriv) && + (sstatus != 0x0) && (sstatus != 0x113) && (sstatus != 0x123) && + (retry-- > 0)) + goto comreset_retry; DPRINTK("S-regs after PHY wake: SStat 0x%08x SErr 0x%08x " "SCtrl 0x%08x\n", mv_scr_read(ap, SCR_STATUS), @@ -1748,6 +1780,21 @@ static void mv_phy_reset(struct ata_port *ap) } ap->cbl = ATA_CBL_SATA; + /* even after SStatus reflects that device is ready, + * it seems to take a while for link to be fully + * established (and thus Status no longer 0x80/0x7F), + * so we poll a bit for that, here. + */ + retry = 20; + while (1) { + u8 drv_stat = ata_check_status(ap); + if ((drv_stat != 0x80) && (drv_stat != 0x7f)) + break; + __msleep(500, can_sleep); + if (retry-- <= 0) + break; + } + tf.lbah = readb((void __iomem *) ap->ioaddr.lbah_addr); tf.lbam = readb((void __iomem *) ap->ioaddr.lbam_addr); tf.lbal = readb((void __iomem *) ap->ioaddr.lbal_addr); @@ -1766,6 +1813,11 @@ static void mv_phy_reset(struct ata_port *ap) VPRINTK("EXIT\n"); } +static void mv_phy_reset(struct ata_port *ap) +{ + __mv_phy_reset(ap, 1); +} + /** * mv_eng_timeout - Routine called by libata when SCSI times out I/O * @ap: ATA channel to manipulate -- cgit v1.2.3 From a2c91a8819e315e9fd1aef3ff57badb6c1be3f80 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Thu, 17 Nov 2005 05:44:44 -0500 Subject: [libata sata_mv] handle lack of hardware nIEN support Handle errata (it was unintentional on this h/w, whereas its intentional on others) whereby the nIEN bit in Device Control is ignored, leading to a situation where a hardware interrupt completes the qc before the polling code has a chance to. This will get fixed The Right Way(tm) once Albert Lee's irq-pio branch is merged, as the more natural PIO method on this hardware is interrupt-driven. --- drivers/scsi/sata_mv.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index ee0634da087..ac184e60797 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c @@ -1219,6 +1219,10 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, handled++; } + if (ap && + (ap->flags & (ATA_FLAG_PORT_DISABLED | ATA_FLAG_NOINTR))) + continue; + err_mask = ac_err_mask(ata_status); shift = port << 1; /* (port * 2) */ @@ -1237,7 +1241,8 @@ static void mv_host_intr(struct ata_host_set *host_set, u32 relevant, VPRINTK("port %u IRQ found for qc, " "ata_status 0x%x\n", port,ata_status); /* mark qc status appropriately */ - ata_qc_complete(qc, err_mask); + if (!(qc->tf.ctl & ATA_NIEN)) + ata_qc_complete(qc, err_mask); } } } -- cgit v1.2.3 From 7d78c887a94067ba218dc71b89d0d7a09415197f Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 17 Nov 2005 15:47:30 +0000 Subject: [DRIVER MODEL] Fix merge clashes with ARM ixp2000 / ixp4xx platforms Signed-off-by: Russell King --- drivers/i2c/busses/i2c-ixp2000.c | 6 ++---- drivers/i2c/busses/i2c-ixp4xx.c | 6 ++---- drivers/mtd/maps/ixp2000.c | 22 +++++++++++----------- 3 files changed, 15 insertions(+), 19 deletions(-) (limited to 'drivers') diff --git a/drivers/i2c/busses/i2c-ixp2000.c b/drivers/i2c/busses/i2c-ixp2000.c index cef024a7d04..cd6f45d186a 100644 --- a/drivers/i2c/busses/i2c-ixp2000.c +++ b/drivers/i2c/busses/i2c-ixp2000.c @@ -36,8 +36,6 @@ #include /* Pick up IXP2000-specific bits */ #include -static struct device_driver ixp2000_i2c_driver; - static inline int ixp2000_scl_pin(void *data) { return ((struct ixp2000_i2c_pins*)data)->scl_pin; @@ -120,7 +118,7 @@ static int ixp2000_i2c_probe(struct platform_device *plat_dev) drv_data->algo_data.timeout = 100; drv_data->adapter.id = I2C_HW_B_IXP2000, - strlcpy(drv_data->adapter.name, ixp2000_i2c_driver.name, + strlcpy(drv_data->adapter.name, plat_dev->dev.driver->name, I2C_NAME_SIZE); drv_data->adapter.algo_data = &drv_data->algo_data, @@ -132,7 +130,7 @@ static int ixp2000_i2c_probe(struct platform_device *plat_dev) gpio_line_set(gpio->sda_pin, 0); if ((err = i2c_bit_add_bus(&drv_data->adapter)) != 0) { - dev_err(dev, "Could not install, error %d\n", err); + dev_err(&plat_dev->dev, "Could not install, error %d\n", err); kfree(drv_data); return err; } diff --git a/drivers/i2c/busses/i2c-ixp4xx.c b/drivers/i2c/busses/i2c-ixp4xx.c index aa36855fa99..e422d8b2d4d 100644 --- a/drivers/i2c/busses/i2c-ixp4xx.c +++ b/drivers/i2c/busses/i2c-ixp4xx.c @@ -35,8 +35,6 @@ #include /* Pick up IXP4xx-specific bits */ -static struct device_driver ixp4xx_i2c_driver; - static inline int ixp4xx_scl_pin(void *data) { return ((struct ixp4xx_i2c_pins*)data)->scl_pin; @@ -128,7 +126,7 @@ static int ixp4xx_i2c_probe(struct platform_device *plat_dev) drv_data->algo_data.timeout = 100; drv_data->adapter.id = I2C_HW_B_IXP4XX; - strlcpy(drv_data->adapter.name, ixp4xx_i2c_driver.name, + strlcpy(drv_data->adapter.name, plat_dev->dev.driver->name, I2C_NAME_SIZE); drv_data->adapter.algo_data = &drv_data->algo_data; @@ -140,7 +138,7 @@ static int ixp4xx_i2c_probe(struct platform_device *plat_dev) gpio_line_set(gpio->sda_pin, 0); if ((err = i2c_bit_add_bus(&drv_data->adapter) != 0)) { - printk(KERN_ERR "ERROR: Could not install %s\n", dev->bus_id); + printk(KERN_ERR "ERROR: Could not install %s\n", plat_dev->dev.bus_id); kfree(drv_data); return err; diff --git a/drivers/mtd/maps/ixp2000.c b/drivers/mtd/maps/ixp2000.c index fc7a78e3173..2c9cc7f37e9 100644 --- a/drivers/mtd/maps/ixp2000.c +++ b/drivers/mtd/maps/ixp2000.c @@ -159,12 +159,12 @@ static int ixp2000_flash_probe(struct platform_device *dev) return -ENODEV; window_size = dev->resource->end - dev->resource->start + 1; - dev_info(_dev, "Probe of IXP2000 flash(%d banks x %dMiB)\n", - ixp_data->nr_banks, ((u32)window_size >> 20)); + dev_info(&dev->dev, "Probe of IXP2000 flash(%d banks x %dMiB)\n", + ixp_data->nr_banks, ((u32)window_size >> 20)); if (plat->width != 1) { - dev_err(_dev, "IXP2000 MTD map only supports 8-bit mode, asking for %d\n", - plat->width * 8); + dev_err(&dev->dev, "IXP2000 MTD map only supports 8-bit mode, asking for %d\n", + plat->width * 8); return -EIO; } @@ -202,7 +202,7 @@ static int ixp2000_flash_probe(struct platform_device *dev) dev->resource->end - dev->resource->start + 1, dev->dev.bus_id); if (!info->res) { - dev_err(_dev, "Could not reserve memory region\n"); + dev_err(&dev->dev, "Could not reserve memory region\n"); err = -ENOMEM; goto Error; } @@ -210,7 +210,7 @@ static int ixp2000_flash_probe(struct platform_device *dev) info->map.map_priv_1 = (unsigned long) ioremap(dev->resource->start, dev->resource->end - dev->resource->start + 1); if (!info->map.map_priv_1) { - dev_err(_dev, "Failed to ioremap flash region\n"); + dev_err(&dev->dev, "Failed to ioremap flash region\n"); err = -EIO; goto Error; } @@ -221,13 +221,13 @@ static int ixp2000_flash_probe(struct platform_device *dev) */ erratum44_workaround = ixp2000_has_broken_slowport(); - dev_info(_dev, "Erratum 44 workaround %s\n", + dev_info(&dev->dev, "Erratum 44 workaround %s\n", erratum44_workaround ? "enabled" : "disabled"); #endif info->mtd = do_map_probe(plat->map_name, &info->map); if (!info->mtd) { - dev_err(_dev, "map_probe failed\n"); + dev_err(&dev->dev, "map_probe failed\n"); err = -ENXIO; goto Error; } @@ -237,7 +237,7 @@ static int ixp2000_flash_probe(struct platform_device *dev) if (err > 0) { err = add_mtd_partitions(info->mtd, info->partitions, err); if(err) - dev_err(_dev, "Could not parse partitions\n"); + dev_err(&dev->dev, "Could not parse partitions\n"); } if (err) @@ -251,8 +251,8 @@ Error: } static struct platform_driver ixp2000_flash_driver = { - .probe = &ixp2000_flash_probe, - .remove = &ixp2000_flash_remove + .probe = ixp2000_flash_probe, + .remove = ixp2000_flash_remove, .driver = { .name = "IXP2000-Flash", }, -- cgit v1.2.3 From 20913a9f6e3ae9a7facf96c7b1299e3875a895a0 Mon Sep 17 00:00:00 2001 From: Andrey Volkov Date: Thu, 17 Nov 2005 16:05:35 +0000 Subject: [DRIVER MODEL] Fix typo in ohci-ppc-soc.c Fix copy-paste bug in ohci-ppc-soc.c(ohci_hcd_ppc_soc_drv_remove) Signed-off-by: Andrey Volkov Signed-off-by: Russell King --- drivers/usb/host/ohci-ppc-soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/usb/host/ohci-ppc-soc.c b/drivers/usb/host/ohci-ppc-soc.c index 18755766e40..2ec6a78bd65 100644 --- a/drivers/usb/host/ohci-ppc-soc.c +++ b/drivers/usb/host/ohci-ppc-soc.c @@ -185,7 +185,7 @@ static int ohci_hcd_ppc_soc_drv_probe(struct platform_device *pdev) static int ohci_hcd_ppc_soc_drv_remove(struct platform_device *pdev) { - struct usb_hcd *hcd = platform_get_drvdata(dev); + struct usb_hcd *hcd = platform_get_drvdata(pdev); usb_hcd_ppc_soc_remove(hcd, pdev); return 0; -- cgit v1.2.3 From 0905780aae58ea69f2dafea9716ee2ea78dbe4e2 Mon Sep 17 00:00:00 2001 From: "Maciej W. Rozycki" Date: Mon, 13 Jun 2005 19:58:50 +0000 Subject: [MIPS] zs.c: Resurrect the deceased zs.c for now. Not that it's meant to be sustained for long, but from time to time it's useful to have some console... Signed-off-by: Maciej W. Rozycki Signed-off-by: Ralf Baechle --- drivers/tc/zs.c | 150 ++++++++++++++++++++++++-------------------------------- drivers/tc/zs.h | 13 +++-- 2 files changed, 70 insertions(+), 93 deletions(-) (limited to 'drivers') diff --git a/drivers/tc/zs.c b/drivers/tc/zs.c index c52af73a251..6756d0fab6f 100644 --- a/drivers/tc/zs.c +++ b/drivers/tc/zs.c @@ -6,7 +6,7 @@ * * DECstation changes * Copyright (C) 1998-2000 Harald Koerfgen - * Copyright (C) 2000, 2001, 2002, 2003, 2004 Maciej W. Rozycki + * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Maciej W. Rozycki * * For the rest of the code the original Copyright applies: * Copyright (C) 1996 Paul Mackerras (Paul.Mackerras@cs.anu.edu.au) @@ -55,6 +55,7 @@ #include #include #include +#include #ifdef CONFIG_SERIAL_DEC_CONSOLE #include #endif @@ -63,7 +64,6 @@ #include #include #include -#include #include #include @@ -128,6 +128,8 @@ static struct zs_parms ds_parms = { #define BUS_PRESENT (DS_BUS_PRESENT) +DEFINE_SPINLOCK(zs_lock); + struct dec_zschannel zs_channels[NUM_CHANNELS]; struct dec_serial zs_soft[NUM_CHANNELS]; int zs_channels_found; @@ -159,8 +161,6 @@ static unsigned char zs_init_regs[16] __initdata = { 0 /* write 15 */ }; -DECLARE_TASK_QUEUE(tq_zs_serial); - static struct tty_driver *serial_driver; /* serial subtype definitions */ @@ -294,8 +294,7 @@ static inline void zs_rtsdtr(struct dec_serial *info, int which, int set) { unsigned long flags; - - save_flags(flags); cli(); + spin_lock_irqsave(&zs_lock, flags); if (info->zs_channel != info->zs_chan_a) { if (set) { info->zs_chan_a->curregs[5] |= (which & (RTS | DTR)); @@ -304,7 +303,7 @@ static inline void zs_rtsdtr(struct dec_serial *info, int which, int set) } write_zsreg(info->zs_chan_a, 5, info->zs_chan_a->curregs[5]); } - restore_flags(flags); + spin_unlock_irqrestore(&zs_lock, flags); } /* Utility routines for the Zilog */ @@ -345,12 +344,10 @@ static inline void rs_recv_clear(struct dec_zschannel *zsc) * This routine is used by the interrupt handler to schedule * processing in the software interrupt portion of the driver. */ -static _INLINE_ void rs_sched_event(struct dec_serial *info, - int event) +static _INLINE_ void rs_sched_event(struct dec_serial *info, int event) { info->event |= 1 << event; - queue_task(&info->tqueue, &tq_zs_serial); - mark_bh(SERIAL_BH); + tasklet_schedule(&info->tlet); } static _INLINE_ void receive_chars(struct dec_serial *info, @@ -497,9 +494,10 @@ static _INLINE_ void status_handle(struct dec_serial *info) /* * This is the serial driver's generic interrupt routine */ -void rs_interrupt(int irq, void *dev_id, struct pt_regs * regs) +static irqreturn_t rs_interrupt(int irq, void *dev_id, struct pt_regs *regs) { struct dec_serial *info = (struct dec_serial *) dev_id; + irqreturn_t status = IRQ_NONE; unsigned char zs_intreg; int shift; @@ -521,6 +519,8 @@ void rs_interrupt(int irq, void *dev_id, struct pt_regs * regs) if ((zs_intreg & CHAN_IRQMASK) == 0) break; + status = IRQ_HANDLED; + if (zs_intreg & CHBRxIP) { receive_chars(info, regs); } @@ -534,6 +534,8 @@ void rs_interrupt(int irq, void *dev_id, struct pt_regs * regs) /* Why do we need this ? */ write_zsreg(info->zs_channel, 0, RES_H_IUS); + + return status; } #ifdef ZS_DEBUG_REGS @@ -578,12 +580,12 @@ static void rs_stop(struct tty_struct *tty) return; #if 1 - save_flags(flags); cli(); + spin_lock_irqsave(&zs_lock, flags); if (info->zs_channel->curregs[5] & TxENAB) { info->zs_channel->curregs[5] &= ~TxENAB; write_zsreg(info->zs_channel, 5, info->zs_channel->curregs[5]); } - restore_flags(flags); + spin_unlock_irqrestore(&zs_lock, flags); #endif } @@ -595,7 +597,7 @@ static void rs_start(struct tty_struct *tty) if (serial_paranoia_check(info, tty->name, "rs_start")) return; - save_flags(flags); cli(); + spin_lock_irqsave(&zs_lock, flags); #if 1 if (info->xmit_cnt && info->xmit_buf && !(info->zs_channel->curregs[5] & TxENAB)) { info->zs_channel->curregs[5] |= TxENAB; @@ -606,7 +608,7 @@ static void rs_start(struct tty_struct *tty) transmit_chars(info); } #endif - restore_flags(flags); + spin_unlock_irqrestore(&zs_lock, flags); } /* @@ -618,12 +620,8 @@ static void rs_start(struct tty_struct *tty) * interrupt driver proper are done; the interrupt driver schedules * them using rs_sched_event(), and they get done here. */ -static void do_serial_bh(void) -{ - run_task_queue(&tq_zs_serial); -} -static void do_softint(void *private_) +static void do_softint(unsigned long private_) { struct dec_serial *info = (struct dec_serial *) private_; struct tty_struct *tty; @@ -634,10 +632,11 @@ static void do_softint(void *private_) if (test_and_clear_bit(RS_EVENT_WRITE_WAKEUP, &info->event)) { tty_wakeup(tty); + wake_up_interruptible(&tty->write_wait); } } -int zs_startup(struct dec_serial * info) +static int zs_startup(struct dec_serial * info) { unsigned long flags; @@ -650,7 +649,7 @@ int zs_startup(struct dec_serial * info) return -ENOMEM; } - save_flags(flags); cli(); + spin_lock_irqsave(&zs_lock, flags); #ifdef SERIAL_DEBUG_OPEN printk("starting up ttyS%d (irq %d)...", info->line, info->irq); @@ -706,7 +705,7 @@ int zs_startup(struct dec_serial * info) info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; info->flags |= ZILOG_INITIALIZED; - restore_flags(flags); + spin_unlock_irqrestore(&zs_lock, flags); return 0; } @@ -726,7 +725,7 @@ static void shutdown(struct dec_serial * info) info->irq); #endif - save_flags(flags); cli(); /* Disable interrupts */ + spin_lock_irqsave(&zs_lock, flags); if (info->xmit_buf) { free_page((unsigned long) info->xmit_buf); @@ -749,7 +748,7 @@ static void shutdown(struct dec_serial * info) set_bit(TTY_IO_ERROR, &info->tty->flags); info->flags &= ~ZILOG_INITIALIZED; - restore_flags(flags); + spin_unlock_irqrestore(&zs_lock, flags); } /* @@ -785,7 +784,7 @@ static void change_speed(struct dec_serial *info) i += 15; } - save_flags(flags); cli(); + spin_lock_irqsave(&zs_lock, flags); info->zs_baud = baud_table[i]; if (info->zs_baud) { brg = BPS_TO_BRG(info->zs_baud, zs_parms->clock/info->clk_divisor); @@ -858,7 +857,7 @@ static void change_speed(struct dec_serial *info) /* Load up the new values */ load_zsregs(info->zs_channel, info->zs_channel->curregs); - restore_flags(flags); + spin_unlock_irqrestore(&zs_lock, flags); } static void rs_flush_chars(struct tty_struct *tty) @@ -874,9 +873,9 @@ static void rs_flush_chars(struct tty_struct *tty) return; /* Enable transmitter */ - save_flags(flags); cli(); + spin_lock_irqsave(&zs_lock, flags); transmit_chars(info); - restore_flags(flags); + spin_unlock_irqrestore(&zs_lock, flags); } static int rs_write(struct tty_struct * tty, @@ -892,26 +891,17 @@ static int rs_write(struct tty_struct * tty, if (!tty || !info->xmit_buf) return 0; - save_flags(flags); while (1) { - cli(); + spin_lock_irqsave(&zs_lock, flags); c = min(count, min(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, SERIAL_XMIT_SIZE - info->xmit_head)); if (c <= 0) break; - if (from_user) { - down(&tmp_buf_sem); - copy_from_user(tmp_buf, buf, c); - c = min(c, min(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, - SERIAL_XMIT_SIZE - info->xmit_head)); - memcpy(info->xmit_buf + info->xmit_head, tmp_buf, c); - up(&tmp_buf_sem); - } else - memcpy(info->xmit_buf + info->xmit_head, buf, c); + memcpy(info->xmit_buf + info->xmit_head, buf, c); info->xmit_head = (info->xmit_head + c) & (SERIAL_XMIT_SIZE-1); info->xmit_cnt += c; - restore_flags(flags); + spin_unlock_irqrestore(&zs_lock, flags); buf += c; count -= c; total += c; @@ -920,7 +910,7 @@ static int rs_write(struct tty_struct * tty, if (info->xmit_cnt && !tty->stopped && !info->tx_stopped && !info->tx_active) transmit_chars(info); - restore_flags(flags); + spin_unlock_irqrestore(&zs_lock, flags); return total; } @@ -952,9 +942,9 @@ static void rs_flush_buffer(struct tty_struct *tty) if (serial_paranoia_check(info, tty->name, "rs_flush_buffer")) return; - cli(); + spin_lock_irq(&zs_lock); info->xmit_cnt = info->xmit_head = info->xmit_tail = 0; - sti(); + spin_unlock_irq(&zs_lock); tty_wakeup(tty); } @@ -982,11 +972,11 @@ static void rs_throttle(struct tty_struct * tty) return; if (I_IXOFF(tty)) { - save_flags(flags); cli(); + spin_lock_irqsave(&zs_lock, flags); info->x_char = STOP_CHAR(tty); if (!info->tx_active) transmit_chars(info); - restore_flags(flags); + spin_unlock_irqrestore(&zs_lock, flags); } if (C_CRTSCTS(tty)) { @@ -1010,7 +1000,7 @@ static void rs_unthrottle(struct tty_struct * tty) return; if (I_IXOFF(tty)) { - save_flags(flags); cli(); + spin_lock_irqsave(&zs_lock, flags); if (info->x_char) info->x_char = 0; else { @@ -1018,7 +1008,7 @@ static void rs_unthrottle(struct tty_struct * tty) if (!info->tx_active) transmit_chars(info); } - restore_flags(flags); + spin_unlock_irqrestore(&zs_lock, flags); } if (C_CRTSCTS(tty)) { @@ -1111,9 +1101,9 @@ static int get_lsr_info(struct dec_serial * info, unsigned int *value) { unsigned char status; - cli(); + spin_lock(&zs_lock); status = read_zsreg(info->zs_channel, 0); - sti(); + spin_unlock_irq(&zs_lock); put_user(status,value); return 0; } @@ -1136,11 +1126,11 @@ static int rs_tiocmget(struct tty_struct *tty, struct file *file) if (info->zs_channel == info->zs_chan_a) result = 0; else { - cli(); + spin_lock(&zs_lock); control = info->zs_chan_a->curregs[5]; status_a = read_zsreg(info->zs_chan_a, 0); status_b = read_zsreg(info->zs_channel, 0); - sti(); + spin_unlock_irq(&zs_lock); result = ((control & RTS) ? TIOCM_RTS: 0) | ((control & DTR) ? TIOCM_DTR: 0) | ((status_b & DCD) ? TIOCM_CAR: 0) @@ -1155,8 +1145,6 @@ static int rs_tiocmset(struct tty_struct *tty, struct file *file, unsigned int set, unsigned int clear) { struct dec_serial * info = (struct dec_serial *)tty->driver_data; - int error; - unsigned int arg, bits; if (info->hook) return -ENODEV; @@ -1170,8 +1158,7 @@ static int rs_tiocmset(struct tty_struct *tty, struct file *file, if (info->zs_channel == info->zs_chan_a) return 0; - get_user(arg, value); - cli(); + spin_lock(&zs_lock); if (set & TIOCM_RTS) info->zs_chan_a->curregs[5] |= RTS; if (set & TIOCM_DTR) @@ -1181,7 +1168,7 @@ static int rs_tiocmset(struct tty_struct *tty, struct file *file, if (clear & TIOCM_DTR) info->zs_chan_a->curregs[5] &= ~DTR; write_zsreg(info->zs_chan_a, 5, info->zs_chan_a->curregs[5]); - sti(); + spin_unlock_irq(&zs_lock); return 0; } @@ -1198,19 +1185,18 @@ static void rs_break(struct tty_struct *tty, int break_state) if (!info->port) return; - save_flags(flags); cli(); + spin_lock_irqsave(&zs_lock, flags); if (break_state == -1) info->zs_channel->curregs[5] |= SND_BRK; else info->zs_channel->curregs[5] &= ~SND_BRK; write_zsreg(info->zs_channel, 5, info->zs_channel->curregs[5]); - restore_flags(flags); + spin_unlock_irqrestore(&zs_lock, flags); } static int rs_ioctl(struct tty_struct *tty, struct file * file, unsigned int cmd, unsigned long arg) { - int error; struct dec_serial * info = (struct dec_serial *)tty->driver_data; if (info->hook) @@ -1287,10 +1273,10 @@ static void rs_close(struct tty_struct *tty, struct file * filp) if (!info || serial_paranoia_check(info, tty->name, "rs_close")) return; - save_flags(flags); cli(); + spin_lock_irqsave(&zs_lock, flags); if (tty_hung_up_p(filp)) { - restore_flags(flags); + spin_unlock_irqrestore(&zs_lock, flags); return; } @@ -1315,7 +1301,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp) info->count = 0; } if (info->count) { - restore_flags(flags); + spin_unlock_irqrestore(&zs_lock, flags); return; } info->flags |= ZILOG_CLOSING; @@ -1358,7 +1344,7 @@ static void rs_close(struct tty_struct *tty, struct file * filp) } info->flags &= ~(ZILOG_NORMAL_ACTIVE|ZILOG_CLOSING); wake_up_interruptible(&info->close_wait); - restore_flags(flags); + spin_unlock_irqrestore(&zs_lock, flags); } /* @@ -1398,7 +1384,7 @@ static void rs_wait_until_sent(struct tty_struct *tty, int timeout) /* * rs_hangup() --- called by tty_hangup() when a hangup is signaled. */ -void rs_hangup(struct tty_struct *tty) +static void rs_hangup(struct tty_struct *tty) { struct dec_serial * info = (struct dec_serial *)tty->driver_data; @@ -1466,16 +1452,16 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, printk("block_til_ready before block: ttyS%d, count = %d\n", info->line, info->count); #endif - cli(); + spin_lock(&zs_lock); if (!tty_hung_up_p(filp)) info->count--; - sti(); + spin_unlock_irq(&zs_lock); info->blocked_open++; while (1) { - cli(); + spin_lock(&zs_lock); if (tty->termios->c_cflag & CBAUD) zs_rtsdtr(info, RTS | DTR, 1); - sti(); + spin_unlock_irq(&zs_lock); set_current_state(TASK_INTERRUPTIBLE); if (tty_hung_up_p(filp) || !(info->flags & ZILOG_INITIALIZED)) { @@ -1523,7 +1509,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, * the IRQ chain. It also performs the serial-specific * initialization for the tty structure. */ -int rs_open(struct tty_struct *tty, struct file * filp) +static int rs_open(struct tty_struct *tty, struct file * filp) { struct dec_serial *info; int retval, line; @@ -1706,7 +1692,7 @@ static void __init probe_sccs(void) } } - save_and_cli(flags); + spin_lock_irqsave(&zs_lock, flags); for (n = 0; n < zs_channels_found; n++) { if (n % 2 == 0) { write_zsreg(zs_soft[n].zs_chan_a, R9, FHWRES); @@ -1716,7 +1702,7 @@ static void __init probe_sccs(void) load_zsregs(zs_soft[n].zs_channel, zs_soft[n].zs_channel->curregs); } - restore_flags(flags); + spin_unlock_irqrestore(&zs_lock, flags); } static struct tty_operations serial_ops = { @@ -1749,9 +1735,6 @@ int __init zs_init(void) if(!BUS_PRESENT) return -ENODEV; - /* Setup base handler, and timer table. */ - init_bh(SERIAL_BH, do_serial_bh); - /* Find out how many Z8530 SCCs we have */ if (zs_chain == 0) probe_sccs(); @@ -1800,8 +1783,7 @@ int __init zs_init(void) info->event = 0; info->count = 0; info->blocked_open = 0; - info->tqueue.routine = do_softint; - info->tqueue.data = info; + tasklet_init(&info->tlet, do_softint, (unsigned long)info); init_waitqueue_head(&info->open_wait); init_waitqueue_head(&info->close_wait); printk("ttyS%02d at 0x%08x (irq = %d) is a Z85C30 SCC\n", @@ -1833,8 +1815,7 @@ int __init zs_init(void) /* * polling I/O routines */ -static int -zs_poll_tx_char(void *handle, unsigned char ch) +static int zs_poll_tx_char(void *handle, unsigned char ch) { struct dec_serial *info = handle; struct dec_zschannel *chan = info->zs_channel; @@ -1857,8 +1838,7 @@ zs_poll_tx_char(void *handle, unsigned char ch) return -ENODEV; } -static int -zs_poll_rx_char(void *handle) +static int zs_poll_rx_char(void *handle) { struct dec_serial *info = handle; struct dec_zschannel *chan = info->zs_channel; @@ -2037,7 +2017,7 @@ static int __init serial_console_setup(struct console *co, char *options) } co->cflag = cflag; - save_and_cli(flags); + spin_lock_irqsave(&zs_lock, flags); /* * Set up the baud rate generator. @@ -2092,7 +2072,7 @@ static int __init serial_console_setup(struct console *co, char *options) zs_soft[co->index].clk_divisor = clk_divisor; zs_soft[co->index].zs_baud = get_zsbaud(&zs_soft[co->index]); - restore_flags(flags); + spin_unlock_irqrestore(&zs_lock, flags); return 0; } @@ -2229,5 +2209,3 @@ void __init zs_kgdb_hook(int tty_num) set_debug_traps(); /* init stub */ } #endif /* ifdef CONFIG_KGDB */ - - diff --git a/drivers/tc/zs.h b/drivers/tc/zs.h index c52edffa604..13512200ceb 100644 --- a/drivers/tc/zs.h +++ b/drivers/tc/zs.h @@ -6,14 +6,14 @@ * * Copyright (C) 1996 Paul Mackerras (Paul.Mackerras@cs.anu.edu.au) * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) - * Copyright (C) 2004 Maciej W. Rozycki + * Copyright (C) 2004, 2005 Maciej W. Rozycki */ #ifndef _DECSERIAL_H #define _DECSERIAL_H #include -#define NUM_ZSREGS 16 +#define NUM_ZSREGS 16 struct serial_struct { int type; @@ -139,8 +139,7 @@ struct dec_serial { int xmit_head; int xmit_tail; int xmit_cnt; - struct tq_struct tqueue; - struct tq_struct tqueue_hangup; + struct tasklet_struct tlet; wait_queue_head_t open_wait; wait_queue_head_t close_wait; }; @@ -282,7 +281,7 @@ struct dec_serial { #define DLC 4 /* Disable Lower Chain */ #define MIE 8 /* Master Interrupt Enable */ #define STATHI 0x10 /* Status high */ -#define SOFTACK 0x20 /* Software Interrupt Acknowledge */ +#define SOFTACK 0x20 /* Software Interrupt Acknowledge */ #define NORESET 0 /* No reset on write to R9 */ #define CHRB 0x40 /* Reset channel B */ #define CHRA 0x80 /* Reset channel A */ @@ -395,8 +394,8 @@ struct dec_serial { /* Read Register 15 (value of WR 15) */ /* Misc macros */ -#define ZS_CLEARERR(channel) (write_zsreg(channel, 0, ERR_RES)) -#define ZS_CLEARFIFO(channel) do { volatile unsigned char garbage; \ +#define ZS_CLEARERR(channel) (write_zsreg(channel, 0, ERR_RES)) +#define ZS_CLEARFIFO(channel) do { volatile unsigned char garbage; \ garbage = read_zsdata(channel); \ garbage = read_zsdata(channel); \ garbage = read_zsdata(channel); \ -- cgit v1.2.3 From 4237f229018ccf937578dee97565a49d712809e8 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Thu, 17 Nov 2005 16:23:50 +0000 Subject: [IDE] Add driver for Sibyte Swarm evaluation board This driver supports the IDE port on the Sibyte Swarm evaluation boards and it's relatives for the BCM1250 family of systems on a chip. Signed-off-by: Ralf Baechle Acked-by: Bartlomiej Zolnierkiewicz --- drivers/ide/Kconfig | 4 + drivers/ide/Makefile | 2 +- drivers/ide/mips/Makefile | 1 + drivers/ide/mips/swarm.c | 201 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 207 insertions(+), 1 deletion(-) create mode 100644 drivers/ide/mips/Makefile create mode 100644 drivers/ide/mips/swarm.c (limited to 'drivers') diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index 42e5b8175cb..ed2bc87f475 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig @@ -787,6 +787,10 @@ config BLK_DEV_IDE_PMAC_BLINK This option enables the use of the sleep LED as a hard drive activity LED. +config BLK_DEV_IDE_SWARM + tristate "IDE for Sibyte evaluation boards" + depends on SIBYTE_SB1xxx_SOC + config BLK_DEV_IDE_AU1XXX bool "IDE for AMD Alchemy Au1200" depends on SOC_AU1200 diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile index cca9c075966..569fae71750 100644 --- a/drivers/ide/Makefile +++ b/drivers/ide/Makefile @@ -48,6 +48,6 @@ obj-$(CONFIG_BLK_DEV_IDECD) += ide-cd.o obj-$(CONFIG_BLK_DEV_IDETAPE) += ide-tape.o obj-$(CONFIG_BLK_DEV_IDEFLOPPY) += ide-floppy.o -obj-$(CONFIG_BLK_DEV_IDE) += legacy/ arm/ +obj-$(CONFIG_BLK_DEV_IDE) += legacy/ arm/ mips/ obj-$(CONFIG_BLK_DEV_HD) += legacy/ obj-$(CONFIG_ETRAX_IDE) += cris/ diff --git a/drivers/ide/mips/Makefile b/drivers/ide/mips/Makefile new file mode 100644 index 00000000000..578e52a5958 --- /dev/null +++ b/drivers/ide/mips/Makefile @@ -0,0 +1 @@ +obj-$(CONFIG_BLK_DEV_IDE_SWARM) += swarm.o diff --git a/drivers/ide/mips/swarm.c b/drivers/ide/mips/swarm.c new file mode 100644 index 00000000000..66f6064f464 --- /dev/null +++ b/drivers/ide/mips/swarm.c @@ -0,0 +1,201 @@ +/* + * Copyright (C) 2001, 2002, 2003 Broadcom Corporation + * Copyright (C) 2004 MontaVista Software Inc. + * Author: Manish Lachwani, mlachwani@mvista.com + * Copyright (C) 2004 MIPS Technologies, Inc. All rights reserved. + * Author: Maciej W. Rozycki + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* + * Derived loosely from ide-pmac.c, so: + * Copyright (C) 1998 Paul Mackerras. + * Copyright (C) 1995-1998 Mark Lord + */ + +/* + * Boards with SiByte processors so far have supported IDE devices via + * the Generic Bus, PCI bus, and built-in PCMCIA interface. In all + * cases, byte-swapping must be avoided for these devices (whereas + * other PCI devices, for example, will require swapping). Any + * SiByte-targetted kernel including IDE support will include this + * file. Probing of a Generic Bus for an IDE device is controlled by + * the definition of "SIBYTE_HAVE_IDE", which is provided by + * for Broadcom boards. + */ + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#define DRV_NAME "ide-swarm" + +static char swarm_ide_string[] = DRV_NAME; + +static struct resource swarm_ide_resource = { + .name = "SWARM GenBus IDE", + .flags = IORESOURCE_MEM, +}; + +static struct platform_device *swarm_ide_dev; + +/* + * swarm_ide_probe - if the board header indicates the existence of + * Generic Bus IDE, allocate a HWIF for it. + */ +static int __devinit swarm_ide_probe(struct device *dev) +{ + ide_hwif_t *hwif; + u8 __iomem *base; + phys_t offset, size; + int i; + + if (!SIBYTE_HAVE_IDE) + return -ENODEV; + + /* Find an empty slot. */ + for (i = 0; i < MAX_HWIFS; i++) + if (!ide_hwifs[i].io_ports[IDE_DATA_OFFSET]) + break; + if (i >= MAX_HWIFS) { + printk(KERN_ERR DRV_NAME ": no free slot for interface\n"); + return -ENOMEM; + } + + hwif = ide_hwifs + i; + + base = ioremap(A_IO_EXT_BASE, 0x800); + offset = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_START_ADDR, IDE_CS)); + size = __raw_readq(base + R_IO_EXT_REG(R_IO_EXT_MULT_SIZE, IDE_CS)); + iounmap(base); + + offset = G_IO_START_ADDR(offset) << S_IO_ADDRBASE; + size = (G_IO_MULT_SIZE(size) + 1) << S_IO_REGSIZE; + if (offset < A_PHYS_GENBUS || offset >= A_PHYS_GENBUS_END) { + printk(KERN_INFO DRV_NAME + ": IDE interface at GenBus disabled\n"); + return -EBUSY; + } + + printk(KERN_INFO DRV_NAME ": IDE interface at GenBus slot %i\n", + IDE_CS); + + swarm_ide_resource.start = offset; + swarm_ide_resource.end = offset + size - 1; + if (request_resource(&iomem_resource, &swarm_ide_resource)) { + printk(KERN_ERR DRV_NAME + ": can't request I/O memory resource\n"); + return -EBUSY; + } + + base = ioremap(offset, size); + + /* Setup MMIO ops. */ + default_hwif_mmiops(hwif); + /* Prevent resource map manipulation. */ + hwif->mmio = 2; + hwif->noprobe = 0; + + for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) + hwif->hw.io_ports[i] = + (unsigned long)(base + ((0x1f0 + i) << 5)); + hwif->hw.io_ports[IDE_CONTROL_OFFSET] = + (unsigned long)(base + (0x3f6 << 5)); + hwif->hw.irq = K_INT_GB_IDE; + + memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports)); + hwif->irq = hwif->hw.irq; + + dev_set_drvdata(dev, hwif); + + return 0; +} + +static struct device_driver swarm_ide_driver = { + .name = swarm_ide_string, + .bus = &platform_bus_type, + .probe = swarm_ide_probe, +}; + +static void swarm_ide_platform_release(struct device *device) +{ + struct platform_device *pldev; + + /* free device */ + pldev = to_platform_device(device); + kfree(pldev); +} + +static int __devinit swarm_ide_init_module(void) +{ + struct platform_device *pldev; + int err; + + printk(KERN_INFO "SWARM IDE driver\n"); + + if (driver_register(&swarm_ide_driver)) { + printk(KERN_ERR "Driver registration failed\n"); + err = -ENODEV; + goto out; + } + + if (!(pldev = kmalloc(sizeof (*pldev), GFP_KERNEL))) { + err = -ENOMEM; + goto out_unregister_driver; + } + + memset (pldev, 0, sizeof (*pldev)); + pldev->name = swarm_ide_string; + pldev->id = 0; + pldev->dev.release = swarm_ide_platform_release; + + if (platform_device_register(pldev)) { + err = -ENODEV; + goto out_free_pldev; + } + + if (!pldev->dev.driver) { + /* + * The driver was not bound to this device, there was + * no hardware at this address. Unregister it, as the + * release fuction will take care of freeing the + * allocated structure + */ + platform_device_unregister (pldev); + } + + swarm_ide_dev = pldev; + + return 0; + +out_free_pldev: + kfree(pldev); + +out_unregister_driver: + driver_unregister(&swarm_ide_driver); +out: + return err; +} + +module_init(swarm_ide_init_module); -- cgit v1.2.3 From efb3442cf1c65747a858476e10f705612383eed1 Mon Sep 17 00:00:00 2001 From: Pekka Enberg Date: Wed, 16 Nov 2005 21:55:05 +0200 Subject: [PATCH] ipw2200: disallow direct scanning when device is down The function ipw_request_direct_scan() should bail out when the device is down. This fixes a lockup caused by wpa_supplicant triggering ipw_request_direct_scan() while the driver was in a middle of a reset due to firmware errors. Thanks to Zilvinas Valinskas for reporting the bug and helping me debug it. Signed-off-by: Pekka Enberg Acked-by: Zhu Yi Signed-off-by: Linus Torvalds --- drivers/net/wireless/ipw2200.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers') diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index b0d195d1721..374b682e4d6 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -8926,6 +8926,10 @@ static int ipw_request_direct_scan(struct ipw_priv *priv, char *essid, struct ipw_scan_request_ext scan; int err = 0, scan_type; + if (!(priv->status & STATUS_INIT) || + (priv->status & STATUS_EXIT_PENDING)) + return 0; + down(&priv->sem); if (priv->status & STATUS_RF_KILL_MASK) { -- cgit v1.2.3 From 3b26b1100e26811e54770abaa221eae140ba840d Mon Sep 17 00:00:00 2001 From: Zhu Yi Date: Thu, 17 Nov 2005 13:58:30 +0800 Subject: [PATCH] ipw2200: fix error log offset calculation This fixes a slab corruption issue in the ipw2200 driver: it essentially multiplied the error log number _twice_ by the size of the error element entry (once explicitly in the code, and once implicitly as part of the regular pointer arithmetic). Cc: Henrik Brix Andersen Cc: Bernard Blackham Cc: Zilvinas Valinskas Cc: Pekka Enberg Signed-off-by: Zhu Yi Signed-off-by: Linus Torvalds -- --- drivers/net/wireless/ipw2200.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 374b682e4d6..5e7c7e944c9 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c @@ -1110,8 +1110,7 @@ static struct ipw_fw_error *ipw_alloc_error_log(struct ipw_priv *priv) error->elem_len = elem_len; error->log_len = log_len; error->elem = (struct ipw_error_elem *)error->payload; - error->log = (struct ipw_event *)(error->elem + - (sizeof(*error->elem) * elem_len)); + error->log = (struct ipw_event *)(error->elem + elem_len); ipw_capture_event_log(priv, log_len, error->log); -- cgit v1.2.3 From 0c2e4b4ff38986e5b6f707d006799bff9663c802 Mon Sep 17 00:00:00 2001 From: Russell King Date: Thu, 17 Nov 2005 16:46:41 +0000 Subject: [ARM] Drivers should not make use of architecture private __ioremap __ioremap is an architecture private interface and must not be used by drivers when the architecture independent interface will do just as well. Switch the ipaq drivers to use the correct interface. Signed-off-by: Russell King --- drivers/mtd/maps/ipaq-flash.c | 6 +++--- drivers/mtd/nand/h1910.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/mtd/maps/ipaq-flash.c b/drivers/mtd/maps/ipaq-flash.c index 35097c9bbf5..b8ccb0a9578 100644 --- a/drivers/mtd/maps/ipaq-flash.c +++ b/drivers/mtd/maps/ipaq-flash.c @@ -246,7 +246,7 @@ int __init ipaq_mtd_init(void) ipaq_map[i].size = h3xxx_max_flash_size; ipaq_map[i].set_vpp = h3xxx_set_vpp; ipaq_map[i].phys = cs_phys[i]; - ipaq_map[i].virt = __ioremap(cs_phys[i], 0x04000000, 0, 1); + ipaq_map[i].virt = ioremap(cs_phys[i], 0x04000000); if (machine_is_h3100 () || machine_is_h1900()) ipaq_map[i].bankwidth = 2; } @@ -280,7 +280,7 @@ int __init ipaq_mtd_init(void) nb_parts = ARRAY_SIZE(jornada_partitions); ipaq_map[0].size = jornada_max_flash_size; ipaq_map[0].set_vpp = jornada56x_set_vpp; - ipaq_map[0].virt = (__u32)__ioremap(0x0, 0x04000000, 0, 1); + ipaq_map[0].virt = (__u32)ioremap(0x0, 0x04000000); } #endif #ifdef CONFIG_SA1100_JORNADA720 @@ -442,7 +442,7 @@ static int __init h1900_special_case(void) ipaq_map[0].size = 0x80000; ipaq_map[0].set_vpp = h3xxx_set_vpp; ipaq_map[0].phys = 0x0; - ipaq_map[0].virt = __ioremap(0x0, 0x04000000, 0, 1); + ipaq_map[0].virt = ioremap(0x0, 0x04000000); ipaq_map[0].bankwidth = 2; printk(KERN_NOTICE "iPAQ flash: probing %d-bit flash bus, window=%lx with JEDEC.\n", ipaq_map[0].bankwidth*8, ipaq_map[0].virt); diff --git a/drivers/mtd/nand/h1910.c b/drivers/mtd/nand/h1910.c index 041e4b3358f..f68f7a99a63 100644 --- a/drivers/mtd/nand/h1910.c +++ b/drivers/mtd/nand/h1910.c @@ -112,7 +112,7 @@ static int __init h1910_init (void) if (!machine_is_h1900()) return -ENODEV; - nandaddr = __ioremap(0x08000000, 0x1000, 0, 1); + nandaddr = ioremap(0x08000000, 0x1000); if (!nandaddr) { printk("Failed to ioremap nand flash.\n"); return -ENOMEM; -- cgit v1.2.3 From 1a7ec1a6a1df63aab9a1fa6174bd704241329805 Mon Sep 17 00:00:00 2001 From: Deepak Saxena Date: Thu, 17 Nov 2005 11:09:53 -0800 Subject: [PATCH] Fix IXP4xx I2C driver build breakage Platform device conversion missed a couple of spots. Signed-off-by: Deepak Saxena Signed-off-by: Linus Torvalds --- drivers/i2c/busses/i2c-ixp4xx.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/i2c/busses/i2c-ixp4xx.c b/drivers/i2c/busses/i2c-ixp4xx.c index aa36855fa99..f87220be3c8 100644 --- a/drivers/i2c/busses/i2c-ixp4xx.c +++ b/drivers/i2c/busses/i2c-ixp4xx.c @@ -35,7 +35,7 @@ #include /* Pick up IXP4xx-specific bits */ -static struct device_driver ixp4xx_i2c_driver; +static struct platform_driver ixp4xx_i2c_driver; static inline int ixp4xx_scl_pin(void *data) { @@ -128,7 +128,7 @@ static int ixp4xx_i2c_probe(struct platform_device *plat_dev) drv_data->algo_data.timeout = 100; drv_data->adapter.id = I2C_HW_B_IXP4XX; - strlcpy(drv_data->adapter.name, ixp4xx_i2c_driver.name, + strlcpy(drv_data->adapter.name, ixp4xx_i2c_driver.driver.name, I2C_NAME_SIZE); drv_data->adapter.algo_data = &drv_data->algo_data; @@ -140,7 +140,8 @@ static int ixp4xx_i2c_probe(struct platform_device *plat_dev) gpio_line_set(gpio->sda_pin, 0); if ((err = i2c_bit_add_bus(&drv_data->adapter) != 0)) { - printk(KERN_ERR "ERROR: Could not install %s\n", dev->bus_id); + printk(KERN_ERR "ERROR: Could not install %s\n", + plat_dev->dev.bus_id); kfree(drv_data); return err; -- cgit v1.2.3 From cca2362c64429283d384df5b4cb948dcd6e8127b Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 17 Nov 2005 09:46:24 -0800 Subject: [PATCH] USB: fix build breakage in dummy_hcd.c Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/gadget/dummy_hcd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index 1e407745c11..c655d46c8ae 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c @@ -944,7 +944,7 @@ static int dummy_udc_suspend (struct platform_device *dev, pm_message_t state) set_link_state (dum); spin_unlock_irq (&dum->lock); - dev->power.power_state = state; + dev->dev.power.power_state = state; usb_hcd_poll_rh_status (dummy_to_hcd (dum)); return 0; } @@ -1904,7 +1904,7 @@ static int dummy_hcd_probe (struct platform_device *dev) struct usb_hcd *hcd; int retval; - dev_info (dev, "%s, driver " DRIVER_VERSION "\n", driver_desc); + dev_info(&dev->dev, "%s, driver " DRIVER_VERSION "\n", driver_desc); hcd = usb_create_hcd (&dummy_hcd, &dev->dev, dev->dev.bus_id); if (!hcd) -- cgit v1.2.3 From 80ed89f6105fd2f35b3b9ee2078f31e1510da71e Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 17 Nov 2005 09:46:28 -0800 Subject: [PATCH] USB Serial: rename ChangeLog.old People are complaining about a .old file in the tree. So rename drivers/usb/serial/ChangeLog.old to ChangeLog.history. Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/serial/ChangeLog.history | 730 +++++++++++++++++++++++++++++++++++ drivers/usb/serial/ChangeLog.old | 730 ----------------------------------- 2 files changed, 730 insertions(+), 730 deletions(-) create mode 100644 drivers/usb/serial/ChangeLog.history delete mode 100644 drivers/usb/serial/ChangeLog.old (limited to 'drivers') diff --git a/drivers/usb/serial/ChangeLog.history b/drivers/usb/serial/ChangeLog.history new file mode 100644 index 00000000000..52c4f7bd7a8 --- /dev/null +++ b/drivers/usb/serial/ChangeLog.history @@ -0,0 +1,730 @@ +This is the contents of some of the drivers/usb/serial/ files that had old +changelog comments. They were quite old, and out of date, and we don't keep +them anymore, so I've put them here, away from the source files, in case +people still care to see them. + +- Greg Kroah-Hartman October 20, 2005 + +----------------------------------------------------------------------- +usb-serial.h Change Log comments: + + (03/26/2002) gkh + removed the port->tty check from port_paranoia_check() due to serial + consoles not having a tty device assigned to them. + + (12/03/2001) gkh + removed active from the port structure. + added documentation to the usb_serial_device_type structure + + (10/10/2001) gkh + added vendor and product to serial structure. Needed to determine device + owner when the device is disconnected. + + (05/30/2001) gkh + added sem to port structure and removed port_lock + + (10/05/2000) gkh + Added interrupt_in_endpointAddress and bulk_in_endpointAddress to help + fix bug with urb->dev not being set properly, now that the usb core + needs it. + + (09/11/2000) gkh + Added usb_serial_debug_data function to help get rid of #DEBUG in the + drivers. + + (08/28/2000) gkh + Added port_lock to port structure. + + (08/08/2000) gkh + Added open_count to port structure. + + (07/23/2000) gkh + Added bulk_out_endpointAddress to port structure. + + (07/19/2000) gkh, pberger, and borchers + Modifications to allow usb-serial drivers to be modules. + +----------------------------------------------------------------------- +usb-serial.c Change Log comments: + + (12/10/2002) gkh + Split the ports off into their own struct device, and added a + usb-serial bus driver. + + (11/19/2002) gkh + removed a few #ifdefs for the generic code and cleaned up the failure + logic in initialization. + + (10/02/2002) gkh + moved the console code to console.c and out of this file. + + (06/05/2002) gkh + moved location of startup() call in serial_probe() until after all + of the port information and endpoints are initialized. This makes + things easier for some drivers. + + (04/10/2002) gkh + added serial_read_proc function which creates a + /proc/tty/driver/usb-serial file. + + (03/27/2002) gkh + Got USB serial console code working properly and merged into the main + version of the tree. Thanks to Randy Dunlap for the initial version + of this code, and for pushing me to finish it up. + The USB serial console works with any usb serial driver device. + + (03/21/2002) gkh + Moved all manipulation of port->open_count into the core. Now the + individual driver's open and close functions are called only when the + first open() and last close() is called. Making the drivers a bit + smaller and simpler. + Fixed a bug if a driver didn't have the owner field set. + + (02/26/2002) gkh + Moved all locking into the main serial_* functions, instead of having + the individual drivers have to grab the port semaphore. This should + reduce races. + Reworked the MOD_INC logic a bit to always increment and decrement, even + if the generic driver is being used. + + (10/10/2001) gkh + usb_serial_disconnect() now sets the serial->dev pointer is to NULL to + help prevent child drivers from accessing the device since it is now + gone. + + (09/13/2001) gkh + Moved generic driver initialize after we have registered with the USB + core. Thanks to Randy Dunlap for pointing this problem out. + + (07/03/2001) gkh + Fixed module paramater size. Thanks to John Brockmeyer for the pointer. + Fixed vendor and product getting defined through the MODULE_PARM macro + if the Generic driver wasn't compiled in. + Fixed problem with generic_shutdown() not being called for drivers that + don't have a shutdown() function. + + (06/06/2001) gkh + added evil hack that is needed for the prolific pl2303 device due to the + crazy way its endpoints are set up. + + (05/30/2001) gkh + switched from using spinlock to a semaphore, which fixes lots of problems. + + (04/08/2001) gb + Identify version on module load. + + 2001_02_05 gkh + Fixed buffer overflows bug with the generic serial driver. Thanks to + Todd Squires for fixing this. + + (01/10/2001) gkh + Fixed bug where the generic serial adaptor grabbed _any_ device that was + offered to it. + + (12/12/2000) gkh + Removed MOD_INC and MOD_DEC from poll and disconnect functions, and + moved them to the serial_open and serial_close functions. + Also fixed bug with there not being a MOD_DEC for the generic driver + (thanks to Gary Brubaker for finding this.) + + (11/29/2000) gkh + Small NULL pointer initialization cleanup which saves a bit of disk image + + (11/01/2000) Adam J. Richter + instead of using idVendor/idProduct pairs, usb serial drivers + now identify their hardware interest with usb_device_id tables, + which they usually have anyhow for use with MODULE_DEVICE_TABLE. + + (10/05/2000) gkh + Fixed bug with urb->dev not being set properly, now that the usb + core needs it. + + (09/11/2000) gkh + Removed DEBUG #ifdefs with call to usb_serial_debug_data + + (08/28/2000) gkh + Added port_lock to port structure. + Added locks for SMP safeness to generic driver + Fixed the ability to open a generic device's port more than once. + + (07/23/2000) gkh + Added bulk_out_endpointAddress to port structure. + + (07/19/2000) gkh, pberger, and borchers + Modifications to allow usb-serial drivers to be modules. + + (07/03/2000) gkh + Added more debugging to serial_ioctl call + + (06/25/2000) gkh + Changed generic_write_bulk_callback to not call wake_up_interruptible + directly, but to have port_softint do it at a safer time. + + (06/23/2000) gkh + Cleaned up debugging statements in a quest to find UHCI timeout bug. + + (05/22/2000) gkh + Changed the makefile, enabling the big CONFIG_USB_SERIAL_SOMTHING to be + removed from the individual device source files. + + (05/03/2000) gkh + Added the Digi Acceleport driver from Al Borchers and Peter Berger. + + (05/02/2000) gkh + Changed devfs and tty register code to work properly now. This was based on + the ACM driver changes by Vojtech Pavlik. + + (04/27/2000) Ryan VanderBijl + Put calls to *_paranoia_checks into one function. + + (04/23/2000) gkh + Fixed bug that Randy Dunlap found for Generic devices with no bulk out ports. + Moved when the startup code printed out the devices that are supported. + + (04/19/2000) gkh + Added driver for ZyXEL omni.net lcd plus ISDN TA + Made startup info message specify which drivers were compiled in. + + (04/03/2000) gkh + Changed the probe process to remove the module unload races. + Changed where the tty layer gets initialized to have devfs work nicer. + Added initial devfs support. + + (03/26/2000) gkh + Split driver up into device specific pieces. + + (03/19/2000) gkh + Fixed oops that could happen when device was removed while a program + was talking to the device. + Removed the static urbs and now all urbs are created and destroyed + dynamically. + Reworked the internal interface. Now everything is based on the + usb_serial_port structure instead of the larger usb_serial structure. + This fixes the bug that a multiport device could not have more than + one port open at one time. + + (03/17/2000) gkh + Added config option for debugging messages. + Added patch for keyspan pda from Brian Warner. + + (03/06/2000) gkh + Added the keyspan pda code from Brian Warner + Moved a bunch of the port specific stuff into its own structure. This + is in anticipation of the true multiport devices (there's a bug if you + try to access more than one port of any multiport device right now) + + (02/21/2000) gkh + Made it so that any serial devices only have to specify which functions + they want to overload from the generic function calls (great, + inheritance in C, in a driver, just what I wanted...) + Added support for set_termios and ioctl function calls. No drivers take + advantage of this yet. + Removed the #ifdef MODULE, now there is no module specific code. + Cleaned up a few comments in usb-serial.h that were wrong (thanks again + to Miles Lott). + Small fix to get_free_serial. + + (02/14/2000) gkh + Removed the Belkin and Peracom functionality from the driver due to + the lack of support from the vendor, and me not wanting people to + accidenatly buy the device, expecting it to work with Linux. + Added read_bulk_callback and write_bulk_callback to the type structure + for the needs of the FTDI and WhiteHEAT driver. + Changed all reverences to FTDI to FTDI_SIO at the request of Bill + Ryder. + Changed the output urb size back to the max endpoint size to make + the ftdi_sio driver have it easier, and due to the fact that it didn't + really increase the speed any. + + (02/11/2000) gkh + Added VISOR_FUNCTION_CONSOLE to the visor startup function. This was a + patch from Miles Lott (milos@insync.net). + Fixed bug with not restoring the minor range that a device grabs, if + the startup function fails (thanks Miles for finding this). + + (02/05/2000) gkh + Added initial framework for the Keyspan PDA serial converter so that + Brian Warner has a place to put his code. + Made the ezusb specific functions generic enough that different + devices can use them (whiteheat and keyspan_pda both need them). + Split out a whole bunch of structure and other stuff to a separate + usb-serial.h file. + Made the Visor connection messages a little more understandable, now + that Miles Lott (milos@insync.net) has gotten the Generic channel to + work. Also made them always show up in the log file. + + (01/25/2000) gkh + Added initial framework for FTDI serial converter so that Bill Ryder + has a place to put his code. + Added the vendor specific info from Handspring. Now we can print out + informational debug messages as well as understand what is happening. + + (01/23/2000) gkh + Fixed problem of crash when trying to open a port that didn't have a + device assigned to it. Made the minor node finding a little smarter, + now it looks to find a continuous space for the new device. + + (01/21/2000) gkh + Fixed bug in visor_startup with patch from Miles Lott (milos@insync.net) + Fixed get_serial_by_minor which was all messed up for multi port + devices. Fixed multi port problem for generic devices. Now the number + of ports is determined by the number of bulk out endpoints for the + generic device. + + (01/19/2000) gkh + Removed lots of cruft that was around from the old (pre urb) driver + interface. + Made the serial_table dynamic. This should save lots of memory when + the number of minor nodes goes up to 256. + Added initial support for devices that have more than one port. + Added more debugging comments for the Visor, and added a needed + set_configuration call. + + (01/17/2000) gkh + Fixed the WhiteHEAT firmware (my processing tool had a bug) + and added new debug loader firmware for it. + Removed the put_char function as it isn't really needed. + Added visor startup commands as found by the Win98 dump. + + (01/13/2000) gkh + Fixed the vendor id for the generic driver to the one I meant it to be. + + (01/12/2000) gkh + Forget the version numbering...that's pretty useless... + Made the driver able to be compiled so that the user can select which + converter they want to use. This allows people who only want the Visor + support to not pay the memory size price of the WhiteHEAT. + Fixed bug where the generic driver (idVendor=0000 and idProduct=0000) + grabbed the root hub. Not good. + + version 0.4.0 (01/10/2000) gkh + Added whiteheat.h containing the firmware for the ConnectTech WhiteHEAT + device. Added startup function to allow firmware to be downloaded to + a device if it needs to be. + Added firmware download logic to the WhiteHEAT device. + Started to add #defines to split up the different drivers for potential + configuration option. + + version 0.3.1 (12/30/99) gkh + Fixed problems with urb for bulk out. + Added initial support for multiple sets of endpoints. This enables + the Handspring Visor to be attached successfully. Only the first + bulk in / bulk out endpoint pair is being used right now. + + version 0.3.0 (12/27/99) gkh + Added initial support for the Handspring Visor based on a patch from + Miles Lott (milos@sneety.insync.net) + Cleaned up the code a bunch and converted over to using urbs only. + + version 0.2.3 (12/21/99) gkh + Added initial support for the Connect Tech WhiteHEAT converter. + Incremented the number of ports in expectation of getting the + WhiteHEAT to work properly (4 ports per connection). + Added notification on insertion and removal of what port the + device is/was connected to (and what kind of device it was). + + version 0.2.2 (12/16/99) gkh + Changed major number to the new allocated number. We're legal now! + + version 0.2.1 (12/14/99) gkh + Fixed bug that happens when device node is opened when there isn't a + device attached to it. Thanks to marek@webdesign.no for noticing this. + + version 0.2.0 (11/10/99) gkh + Split up internals to make it easier to add different types of serial + converters to the code. + Added a "generic" driver that gets it's vendor and product id + from when the module is loaded. Thanks to David E. Nelson (dnelson@jump.net) + for the idea and sample code (from the usb scanner driver.) + Cleared up any licensing questions by releasing it under the GNU GPL. + + version 0.1.2 (10/25/99) gkh + Fixed bug in detecting device. + + version 0.1.1 (10/05/99) gkh + Changed the major number to not conflict with anything else. + + version 0.1 (09/28/99) gkh + Can recognize the two different devices and start up a read from + device when asked to. Writes also work. No control signals yet, this + all is vendor specific data (i.e. no spec), also no control for + different baud rates or other bit settings. + Currently we are using the same devid as the acm driver. This needs + to change. + +----------------------------------------------------------------------- +visor.c Change Log comments: + + (06/03/2003) Judd Montgomery + Added support for module parameter options for untested/unknown + devices. + + (03/09/2003) gkh + Added support for the Sony Clie NZ90V device. Thanks to Martin Brachtl + for the information. + + (03/05/2003) gkh + Think Treo support is now working. + + (04/03/2002) gkh + Added support for the Sony OS 4.1 devices. Thanks to Hiroyuki ARAKI + for the information. + + (03/27/2002) gkh + Removed assumptions that port->tty was always valid (is not true + for usb serial console devices.) + + (03/23/2002) gkh + Added support for the Palm i705 device, thanks to Thomas Riemer + for the information. + + (03/21/2002) gkh + Added support for the Palm m130 device, thanks to Udo Eisenbarth + for the information. + + (02/27/2002) gkh + Reworked the urb handling logic. We have no more pool, but dynamically + allocate the urb and the transfer buffer on the fly. In testing this + does not incure any measurable overhead. This also relies on the fact + that we have proper reference counting logic for urbs. + + (02/21/2002) SilaS + Added initial support for the Palm m515 devices. + + (02/14/2002) gkh + Added support for the Clie S-360 device. + + (12/18/2001) gkh + Added better Clie support for 3.5 devices. Thanks to Geoffrey Levand + for the patch. + + (11/11/2001) gkh + Added support for the m125 devices, and added check to prevent oopses + for Clié devices that lie about the number of ports they have. + + (08/30/2001) gkh + Added support for the Clie devices, both the 3.5 and 4.0 os versions. + Many thanks to Daniel Burke, and Bryan Payne for helping with this. + + (08/23/2001) gkh + fixed a few potential bugs pointed out by Oliver Neukum. + + (05/30/2001) gkh + switched from using spinlock to a semaphore, which fixes lots of problems. + + (05/28/2000) gkh + Added initial support for the Palm m500 and Palm m505 devices. + + (04/08/2001) gb + Identify version on module load. + + (01/21/2000) gkh + Added write_room and chars_in_buffer, as they were previously using the + generic driver versions which is all wrong now that we are using an urb + pool. Thanks to Wolfgang Grandegger for pointing this out to me. + Removed count assignment in the write function, which was not needed anymore + either. Thanks to Al Borchers for pointing this out. + + (12/12/2000) gkh + Moved MOD_DEC to end of visor_close to be nicer, as the final write + message can sleep. + + (11/12/2000) gkh + Fixed bug with data being dropped on the floor by forcing tty->low_latency + to be on. Hopefully this fixes the OHCI issue! + + (11/01/2000) Adam J. Richter + usb_device_id table support + + (10/05/2000) gkh + Fixed bug with urb->dev not being set properly, now that the usb + core needs it. + + (09/11/2000) gkh + Got rid of always calling kmalloc for every urb we wrote out to the + device. + Added visor_read_callback so we can keep track of bytes in and out for + those people who like to know the speed of their device. + Removed DEBUG #ifdefs with call to usb_serial_debug_data + + (09/06/2000) gkh + Fixed oops in visor_exit. Need to uncomment usb_unlink_urb call _after_ + the host controller drivers set urb->dev = NULL when the urb is finished. + + (08/28/2000) gkh + Added locks for SMP safeness. + + (08/08/2000) gkh + Fixed endian problem in visor_startup. + Fixed MOD_INC and MOD_DEC logic and the ability to open a port more + than once. + + (07/23/2000) gkh + Added pool of write urbs to speed up transfers to the visor. + + (07/19/2000) gkh + Added module_init and module_exit functions to handle the fact that this + driver is a loadable module now. + + (07/03/2000) gkh + Added visor_set_ioctl and visor_set_termios functions (they don't do much + of anything, but are good for debugging.) + + (06/25/2000) gkh + Fixed bug in visor_unthrottle that should help with the disconnect in PPP + bug that people have been reporting. + + (06/23/2000) gkh + Cleaned up debugging statements in a quest to find UHCI timeout bug. + + (04/27/2000) Ryan VanderBijl + Fixed memory leak in visor_close + + (03/26/2000) gkh + Split driver up into device specific pieces. + +----------------------------------------------------------------------- +pl2303.c Change Log comments: + + 2002_Mar_26 gkh + allowed driver to work properly if there is no tty assigned to a port + (this happens for serial console devices.) + + 2001_Oct_06 gkh + Added RTS and DTR line control. Thanks to joe@bndlg.de for parts of it. + + 2001_Sep_19 gkh + Added break support. + + 2001_Aug_30 gkh + fixed oops in write_bulk_callback. + + 2001_Aug_28 gkh + reworked buffer logic to be like other usb-serial drivers. Hopefully + removing some reported problems. + + 2001_Jun_06 gkh + finished porting to 2.4 format. + + +----------------------------------------------------------------------- +io_edgeport.c Change Log comments: + + 2003_04_03 al borchers + - fixed a bug (that shows up with dosemu) where the tty struct is + used in a callback after it has been freed + + 2.3 2002_03_08 greg kroah-hartman + - fixed bug when multiple devices were attached at the same time. + + 2.2 2001_11_14 greg kroah-hartman + - fixed bug in edge_close that kept the port from being used more + than once. + - fixed memory leak on device removal. + - fixed potential double free of memory when command urb submitting + failed. + - other small cleanups when the device is removed + + 2.1 2001_07_09 greg kroah-hartman + - added support for TIOCMBIS and TIOCMBIC. + + (04/08/2001) gb + - Identify version on module load. + + 2.0 2001_03_05 greg kroah-hartman + - reworked entire driver to fit properly in with the other usb-serial + drivers. Occasional oopses still happen, but it's a good start. + + 1.2.3 (02/23/2001) greg kroah-hartman + - changed device table to work properly for 2.4.x final format. + - fixed problem with dropping data at high data rates. + + 1.2.2 (11/27/2000) greg kroah-hartman + - cleaned up more NTisms. + - Added device table for 2.4.0-test11 + + 1.2.1 (11/08/2000) greg kroah-hartman + - Started to clean up NTisms. + - Fixed problem with dev field of urb for kernels >= 2.4.0-test9 + + 1.2 (10/17/2000) David Iacovelli + Remove all EPIC code and GPL source + Fix RELEVANT_IFLAG macro to include flow control + changes port configuration changes. + Fix redefinition of SERIAL_MAGIC + Change all timeout values to 5 seconds + Tried to fix the UHCI multiple urb submission, but failed miserably. + it seems to work fine with OHCI. + ( Greg take a look at the #if 0 at end of WriteCmdUsb() we must + find a way to work arount this UHCI bug ) + + 1.1 (10/11/2000) David Iacovelli + Fix XON/XOFF flow control to support both IXON and IXOFF + + 0.9.27 (06/30/2000) David Iacovelli + Added transmit queue and now allocate urb for command writes. + + 0.9.26 (06/29/2000) David Iacovelli + Add support for 80251 based edgeport + + 0.9.25 (06/27/2000) David Iacovelli + Do not close the port if it has multiple opens. + + 0.9.24 (05/26/2000) David Iacovelli + Add IOCTLs to support RXTX and JAVA POS + and first cut at running BlackBox Demo + + 0.9.23 (05/24/2000) David Iacovelli + Add IOCTLs to support RXTX and JAVA POS + + 0.9.22 (05/23/2000) David Iacovelli + fixed bug in enumeration. If epconfig turns on mapping by + path after a device is already plugged in, we now update + the mapping correctly + + 0.9.21 (05/16/2000) David Iacovelli + Added BlockUntilChaseResp() to also wait for txcredits + Updated the way we allocate and handle write URBs + Add debug code to dump buffers + + 0.9.20 (05/01/2000) David Iacovelli + change driver to use usb/tts/ + + 0.9.19 (05/01/2000) David Iacovelli + Update code to compile if DEBUG is off + + 0.9.18 (04/28/2000) David Iacovelli + cleanup and test tty_register with devfs + + 0.9.17 (04/27/2000) greg kroah-hartman + changed tty_register around to be like the way it + was before, but now it works properly with devfs. + + 0.9.16 (04/26/2000) david iacovelli + Fixed bug in GetProductInfo() + + 0.9.15 (04/25/2000) david iacovelli + Updated enumeration + + 0.9.14 (04/24/2000) david iacovelli + Removed all config/status IOCTLS and + converted to using /proc/edgeport + still playing with devfs + + 0.9.13 (04/24/2000) david iacovelli + Removed configuration based on ttyUSB0 + Added support for configuration using /prod/edgeport + first attempt at using devfs (not working yet!) + Added IOCTL to GetProductInfo() + Added support for custom baud rates + Add support for random port numbers + + 0.9.12 (04/18/2000) david iacovelli + added additional configuration IOCTLs + use ttyUSB0 for configuration + + 0.9.11 (04/17/2000) greg kroah-hartman + fixed module initialization race conditions. + made all urbs dynamically allocated. + made driver devfs compatible. now it only registers the tty device + when the device is actually plugged in. + + 0.9.10 (04/13/2000) greg kroah-hartman + added proc interface framework. + + 0.9.9 (04/13/2000) david iacovelli + added enumeration code and ioctls to configure the device + + 0.9.8 (04/12/2000) david iacovelli + Change interrupt read start when device is plugged in + and stop when device is removed + process interrupt reads when all ports are closed + (keep value of rxBytesAvail consistent with the edgeport) + set the USB_BULK_QUEUE flag so that we can shove a bunch + of urbs at once down the pipe + + 0.9.7 (04/10/2000) david iacovelli + start to add enumeration code. + generate serial number for epic devices + add support for kdb + + 0.9.6 (03/30/2000) david iacovelli + add IOCTL to get string, manufacture, and boot descriptors + + 0.9.5 (03/14/2000) greg kroah-hartman + more error checking added to SerialOpen to try to fix UHCI open problem + + 0.9.4 (03/09/2000) greg kroah-hartman + added more error checking to handle oops when data is hanging + around and tty is abruptly closed. + + 0.9.3 (03/09/2000) david iacovelli + Add epic support for xon/xoff chars + play with performance + + 0.9.2 (03/08/2000) greg kroah-hartman + changed most "info" calls to "dbg" + implemented flow control properly in the termios call + + 0.9.1 (03/08/2000) david iacovelli + added EPIC support + enabled bootloader update + + 0.9 (03/08/2000) greg kroah-hartman + Release to IO networks. + Integrated changes that David made + made getting urbs for writing SMP safe + + 0.8 (03/07/2000) greg kroah-hartman + Release to IO networks. + Fixed problems that were seen in code by David. + Now both Edgeport/4 and Edgeport/2 works properly. + Changed most of the functions to use port instead of serial. + + 0.7 (02/27/2000) greg kroah-hartman + Milestone 3 release. + Release to IO Networks + ioctl for waiting on line change implemented. + ioctl for getting statistics implemented. + multiport support working. + lsr and msr registers are now handled properly. + change break now hooked up and working. + support for all known Edgeport devices. + + 0.6 (02/22/2000) greg kroah-hartman + Release to IO networks. + CHASE is implemented correctly when port is closed. + SerialOpen now blocks correctly until port is fully opened. + + 0.5 (02/20/2000) greg kroah-hartman + Release to IO networks. + Known problems: + modem status register changes are not sent on to the user + CHASE is not implemented when the port is closed. + + 0.4 (02/16/2000) greg kroah-hartman + Second cut at the CeBit demo. + Doesn't leak memory on every write to the port + Still small leaks on startup. + Added support for Edgeport/2 and Edgeport/8 + + 0.3 (02/15/2000) greg kroah-hartman + CeBit demo release. + Force the line settings to 4800, 8, 1, e for the demo. + Warning! This version leaks memory like crazy! + + 0.2 (01/30/2000) greg kroah-hartman + Milestone 1 release. + Device is found by USB subsystem, enumerated, fimware is downloaded + and the descriptors are printed to the debug log, config is set, and + green light starts to blink. Open port works, and data can be sent + and received at the default settings of the UART. Loopback connector + and debug log confirms this. + + 0.1 (01/23/2000) greg kroah-hartman + Initial release to help IO Networks try to set up their test system. + Edgeport4 is recognized, firmware is downloaded, config is set so + device blinks green light every 3 sec. Port is bound, but opening, + closing, and sending data do not work properly. + + diff --git a/drivers/usb/serial/ChangeLog.old b/drivers/usb/serial/ChangeLog.old deleted file mode 100644 index c1b279939bb..00000000000 --- a/drivers/usb/serial/ChangeLog.old +++ /dev/null @@ -1,730 +0,0 @@ -This is the contents of some of the drivers/usb/serial/ files that had old -changelog comments. They were quite old, and out of date, and we don't keep -them anymore, so I've put them here, away from the source files, in case -people still care to see them. - -- Greg Kroah-Hartman October 20, 2005 - ------------------------------------------------------------------------ -usb-serial.h Change Log comments: - - (03/26/2002) gkh - removed the port->tty check from port_paranoia_check() due to serial - consoles not having a tty device assigned to them. - - (12/03/2001) gkh - removed active from the port structure. - added documentation to the usb_serial_device_type structure - - (10/10/2001) gkh - added vendor and product to serial structure. Needed to determine device - owner when the device is disconnected. - - (05/30/2001) gkh - added sem to port structure and removed port_lock - - (10/05/2000) gkh - Added interrupt_in_endpointAddress and bulk_in_endpointAddress to help - fix bug with urb->dev not being set properly, now that the usb core - needs it. - - (09/11/2000) gkh - Added usb_serial_debug_data function to help get rid of #DEBUG in the - drivers. - - (08/28/2000) gkh - Added port_lock to port structure. - - (08/08/2000) gkh - Added open_count to port structure. - - (07/23/2000) gkh - Added bulk_out_endpointAddress to port structure. - - (07/19/2000) gkh, pberger, and borchers - Modifications to allow usb-serial drivers to be modules. - ------------------------------------------------------------------------ -usb-serial.c Change Log comments: - - (12/10/2002) gkh - Split the ports off into their own struct device, and added a - usb-serial bus driver. - - (11/19/2002) gkh - removed a few #ifdefs for the generic code and cleaned up the failure - logic in initialization. - - (10/02/2002) gkh - moved the console code to console.c and out of this file. - - (06/05/2002) gkh - moved location of startup() call in serial_probe() until after all - of the port information and endpoints are initialized. This makes - things easier for some drivers. - - (04/10/2002) gkh - added serial_read_proc function which creates a - /proc/tty/driver/usb-serial file. - - (03/27/2002) gkh - Got USB serial console code working properly and merged into the main - version of the tree. Thanks to Randy Dunlap for the initial version - of this code, and for pushing me to finish it up. - The USB serial console works with any usb serial driver device. - - (03/21/2002) gkh - Moved all manipulation of port->open_count into the core. Now the - individual driver's open and close functions are called only when the - first open() and last close() is called. Making the drivers a bit - smaller and simpler. - Fixed a bug if a driver didn't have the owner field set. - - (02/26/2002) gkh - Moved all locking into the main serial_* functions, instead of having - the individual drivers have to grab the port semaphore. This should - reduce races. - Reworked the MOD_INC logic a bit to always increment and decrement, even - if the generic driver is being used. - - (10/10/2001) gkh - usb_serial_disconnect() now sets the serial->dev pointer is to NULL to - help prevent child drivers from accessing the device since it is now - gone. - - (09/13/2001) gkh - Moved generic driver initialize after we have registered with the USB - core. Thanks to Randy Dunlap for pointing this problem out. - - (07/03/2001) gkh - Fixed module paramater size. Thanks to John Brockmeyer for the pointer. - Fixed vendor and product getting defined through the MODULE_PARM macro - if the Generic driver wasn't compiled in. - Fixed problem with generic_shutdown() not being called for drivers that - don't have a shutdown() function. - - (06/06/2001) gkh - added evil hack that is needed for the prolific pl2303 device due to the - crazy way its endpoints are set up. - - (05/30/2001) gkh - switched from using spinlock to a semaphore, which fixes lots of problems. - - (04/08/2001) gb - Identify version on module load. - - 2001_02_05 gkh - Fixed buffer overflows bug with the generic serial driver. Thanks to - Todd Squires for fixing this. - - (01/10/2001) gkh - Fixed bug where the generic serial adaptor grabbed _any_ device that was - offered to it. - - (12/12/2000) gkh - Removed MOD_INC and MOD_DEC from poll and disconnect functions, and - moved them to the serial_open and serial_close functions. - Also fixed bug with there not being a MOD_DEC for the generic driver - (thanks to Gary Brubaker for finding this.) - - (11/29/2000) gkh - Small NULL pointer initialization cleanup which saves a bit of disk image - - (11/01/2000) Adam J. Richter - instead of using idVendor/idProduct pairs, usb serial drivers - now identify their hardware interest with usb_device_id tables, - which they usually have anyhow for use with MODULE_DEVICE_TABLE. - - (10/05/2000) gkh - Fixed bug with urb->dev not being set properly, now that the usb - core needs it. - - (09/11/2000) gkh - Removed DEBUG #ifdefs with call to usb_serial_debug_data - - (08/28/2000) gkh - Added port_lock to port structure. - Added locks for SMP safeness to generic driver - Fixed the ability to open a generic device's port more than once. - - (07/23/2000) gkh - Added bulk_out_endpointAddress to port structure. - - (07/19/2000) gkh, pberger, and borchers - Modifications to allow usb-serial drivers to be modules. - - (07/03/2000) gkh - Added more debugging to serial_ioctl call - - (06/25/2000) gkh - Changed generic_write_bulk_callback to not call wake_up_interruptible - directly, but to have port_softint do it at a safer time. - - (06/23/2000) gkh - Cleaned up debugging statements in a quest to find UHCI timeout bug. - - (05/22/2000) gkh - Changed the makefile, enabling the big CONFIG_USB_SERIAL_SOMTHING to be - removed from the individual device source files. - - (05/03/2000) gkh - Added the Digi Acceleport driver from Al Borchers and Peter Berger. - - (05/02/2000) gkh - Changed devfs and tty register code to work properly now. This was based on - the ACM driver changes by Vojtech Pavlik. - - (04/27/2000) Ryan VanderBijl - Put calls to *_paranoia_checks into one function. - - (04/23/2000) gkh - Fixed bug that Randy Dunlap found for Generic devices with no bulk out ports. - Moved when the startup code printed out the devices that are supported. - - (04/19/2000) gkh - Added driver for ZyXEL omni.net lcd plus ISDN TA - Made startup info message specify which drivers were compiled in. - - (04/03/2000) gkh - Changed the probe process to remove the module unload races. - Changed where the tty layer gets initialized to have devfs work nicer. - Added initial devfs support. - - (03/26/2000) gkh - Split driver up into device specific pieces. - - (03/19/2000) gkh - Fixed oops that could happen when device was removed while a program - was talking to the device. - Removed the static urbs and now all urbs are created and destroyed - dynamically. - Reworked the internal interface. Now everything is based on the - usb_serial_port structure instead of the larger usb_serial structure. - This fixes the bug that a multiport device could not have more than - one port open at one time. - - (03/17/2000) gkh - Added config option for debugging messages. - Added patch for keyspan pda from Brian Warner. - - (03/06/2000) gkh - Added the keyspan pda code from Brian Warner - Moved a bunch of the port specific stuff into its own structure. This - is in anticipation of the true multiport devices (there's a bug if you - try to access more than one port of any multiport device right now) - - (02/21/2000) gkh - Made it so that any serial devices only have to specify which functions - they want to overload from the generic function calls (great, - inheritance in C, in a driver, just what I wanted...) - Added support for set_termios and ioctl function calls. No drivers take - advantage of this yet. - Removed the #ifdef MODULE, now there is no module specific code. - Cleaned up a few comments in usb-serial.h that were wrong (thanks again - to Miles Lott). - Small fix to get_free_serial. - - (02/14/2000) gkh - Removed the Belkin and Peracom functionality from the driver due to - the lack of support from the vendor, and me not wanting people to - accidenatly buy the device, expecting it to work with Linux. - Added read_bulk_callback and write_bulk_callback to the type structure - for the needs of the FTDI and WhiteHEAT driver. - Changed all reverences to FTDI to FTDI_SIO at the request of Bill - Ryder. - Changed the output urb size back to the max endpoint size to make - the ftdi_sio driver have it easier, and due to the fact that it didn't - really increase the speed any. - - (02/11/2000) gkh - Added VISOR_FUNCTION_CONSOLE to the visor startup function. This was a - patch from Miles Lott (milos@insync.net). - Fixed bug with not restoring the minor range that a device grabs, if - the startup function fails (thanks Miles for finding this). - - (02/05/2000) gkh - Added initial framework for the Keyspan PDA serial converter so that - Brian Warner has a place to put his code. - Made the ezusb specific functions generic enough that different - devices can use them (whiteheat and keyspan_pda both need them). - Split out a whole bunch of structure and other stuff to a separate - usb-serial.h file. - Made the Visor connection messages a little more understandable, now - that Miles Lott (milos@insync.net) has gotten the Generic channel to - work. Also made them always show up in the log file. - - (01/25/2000) gkh - Added initial framework for FTDI serial converter so that Bill Ryder - has a place to put his code. - Added the vendor specific info from Handspring. Now we can print out - informational debug messages as well as understand what is happening. - - (01/23/2000) gkh - Fixed problem of crash when trying to open a port that didn't have a - device assigned to it. Made the minor node finding a little smarter, - now it looks to find a continuous space for the new device. - - (01/21/2000) gkh - Fixed bug in visor_startup with patch from Miles Lott (milos@insync.net) - Fixed get_serial_by_minor which was all messed up for multi port - devices. Fixed multi port problem for generic devices. Now the number - of ports is determined by the number of bulk out endpoints for the - generic device. - - (01/19/2000) gkh - Removed lots of cruft that was around from the old (pre urb) driver - interface. - Made the serial_table dynamic. This should save lots of memory when - the number of minor nodes goes up to 256. - Added initial support for devices that have more than one port. - Added more debugging comments for the Visor, and added a needed - set_configuration call. - - (01/17/2000) gkh - Fixed the WhiteHEAT firmware (my processing tool had a bug) - and added new debug loader firmware for it. - Removed the put_char function as it isn't really needed. - Added visor startup commands as found by the Win98 dump. - - (01/13/2000) gkh - Fixed the vendor id for the generic driver to the one I meant it to be. - - (01/12/2000) gkh - Forget the version numbering...that's pretty useless... - Made the driver able to be compiled so that the user can select which - converter they want to use. This allows people who only want the Visor - support to not pay the memory size price of the WhiteHEAT. - Fixed bug where the generic driver (idVendor=0000 and idProduct=0000) - grabbed the root hub. Not good. - - version 0.4.0 (01/10/2000) gkh - Added whiteheat.h containing the firmware for the ConnectTech WhiteHEAT - device. Added startup function to allow firmware to be downloaded to - a device if it needs to be. - Added firmware download logic to the WhiteHEAT device. - Started to add #defines to split up the different drivers for potential - configuration option. - - version 0.3.1 (12/30/99) gkh - Fixed problems with urb for bulk out. - Added initial support for multiple sets of endpoints. This enables - the Handspring Visor to be attached successfully. Only the first - bulk in / bulk out endpoint pair is being used right now. - - version 0.3.0 (12/27/99) gkh - Added initial support for the Handspring Visor based on a patch from - Miles Lott (milos@sneety.insync.net) - Cleaned up the code a bunch and converted over to using urbs only. - - version 0.2.3 (12/21/99) gkh - Added initial support for the Connect Tech WhiteHEAT converter. - Incremented the number of ports in expectation of getting the - WhiteHEAT to work properly (4 ports per connection). - Added notification on insertion and removal of what port the - device is/was connected to (and what kind of device it was). - - version 0.2.2 (12/16/99) gkh - Changed major number to the new allocated number. We're legal now! - - version 0.2.1 (12/14/99) gkh - Fixed bug that happens when device node is opened when there isn't a - device attached to it. Thanks to marek@webdesign.no for noticing this. - - version 0.2.0 (11/10/99) gkh - Split up internals to make it easier to add different types of serial - converters to the code. - Added a "generic" driver that gets it's vendor and product id - from when the module is loaded. Thanks to David E. Nelson (dnelson@jump.net) - for the idea and sample code (from the usb scanner driver.) - Cleared up any licensing questions by releasing it under the GNU GPL. - - version 0.1.2 (10/25/99) gkh - Fixed bug in detecting device. - - version 0.1.1 (10/05/99) gkh - Changed the major number to not conflict with anything else. - - version 0.1 (09/28/99) gkh - Can recognize the two different devices and start up a read from - device when asked to. Writes also work. No control signals yet, this - all is vendor specific data (i.e. no spec), also no control for - different baud rates or other bit settings. - Currently we are using the same devid as the acm driver. This needs - to change. - ------------------------------------------------------------------------ -visor.c Change Log comments: - - (06/03/2003) Judd Montgomery - Added support for module parameter options for untested/unknown - devices. - - (03/09/2003) gkh - Added support for the Sony Clie NZ90V device. Thanks to Martin Brachtl - for the information. - - (03/05/2003) gkh - Think Treo support is now working. - - (04/03/2002) gkh - Added support for the Sony OS 4.1 devices. Thanks to Hiroyuki ARAKI - for the information. - - (03/27/2002) gkh - Removed assumptions that port->tty was always valid (is not true - for usb serial console devices.) - - (03/23/2002) gkh - Added support for the Palm i705 device, thanks to Thomas Riemer - for the information. - - (03/21/2002) gkh - Added support for the Palm m130 device, thanks to Udo Eisenbarth - for the information. - - (02/27/2002) gkh - Reworked the urb handling logic. We have no more pool, but dynamically - allocate the urb and the transfer buffer on the fly. In testing this - does not incure any measurable overhead. This also relies on the fact - that we have proper reference counting logic for urbs. - - (02/21/2002) SilaS - Added initial support for the Palm m515 devices. - - (02/14/2002) gkh - Added support for the Clie S-360 device. - - (12/18/2001) gkh - Added better Clie support for 3.5 devices. Thanks to Geoffrey Levand - for the patch. - - (11/11/2001) gkh - Added support for the m125 devices, and added check to prevent oopses - for Clié devices that lie about the number of ports they have. - - (08/30/2001) gkh - Added support for the Clie devices, both the 3.5 and 4.0 os versions. - Many thanks to Daniel Burke, and Bryan Payne for helping with this. - - (08/23/2001) gkh - fixed a few potential bugs pointed out by Oliver Neukum. - - (05/30/2001) gkh - switched from using spinlock to a semaphore, which fixes lots of problems. - - (05/28/2000) gkh - Added initial support for the Palm m500 and Palm m505 devices. - - (04/08/2001) gb - Identify version on module load. - - (01/21/2000) gkh - Added write_room and chars_in_buffer, as they were previously using the - generic driver versions which is all wrong now that we are using an urb - pool. Thanks to Wolfgang Grandegger for pointing this out to me. - Removed count assignment in the write function, which was not needed anymore - either. Thanks to Al Borchers for pointing this out. - - (12/12/2000) gkh - Moved MOD_DEC to end of visor_close to be nicer, as the final write - message can sleep. - - (11/12/2000) gkh - Fixed bug with data being dropped on the floor by forcing tty->low_latency - to be on. Hopefully this fixes the OHCI issue! - - (11/01/2000) Adam J. Richter - usb_device_id table support - - (10/05/2000) gkh - Fixed bug with urb->dev not being set properly, now that the usb - core needs it. - - (09/11/2000) gkh - Got rid of always calling kmalloc for every urb we wrote out to the - device. - Added visor_read_callback so we can keep track of bytes in and out for - those people who like to know the speed of their device. - Removed DEBUG #ifdefs with call to usb_serial_debug_data - - (09/06/2000) gkh - Fixed oops in visor_exit. Need to uncomment usb_unlink_urb call _after_ - the host controller drivers set urb->dev = NULL when the urb is finished. - - (08/28/2000) gkh - Added locks for SMP safeness. - - (08/08/2000) gkh - Fixed endian problem in visor_startup. - Fixed MOD_INC and MOD_DEC logic and the ability to open a port more - than once. - - (07/23/2000) gkh - Added pool of write urbs to speed up transfers to the visor. - - (07/19/2000) gkh - Added module_init and module_exit functions to handle the fact that this - driver is a loadable module now. - - (07/03/2000) gkh - Added visor_set_ioctl and visor_set_termios functions (they don't do much - of anything, but are good for debugging.) - - (06/25/2000) gkh - Fixed bug in visor_unthrottle that should help with the disconnect in PPP - bug that people have been reporting. - - (06/23/2000) gkh - Cleaned up debugging statements in a quest to find UHCI timeout bug. - - (04/27/2000) Ryan VanderBijl - Fixed memory leak in visor_close - - (03/26/2000) gkh - Split driver up into device specific pieces. - ------------------------------------------------------------------------ -pl2303.c Change Log comments: - - 2002_Mar_26 gkh - allowed driver to work properly if there is no tty assigned to a port - (this happens for serial console devices.) - - 2001_Oct_06 gkh - Added RTS and DTR line control. Thanks to joe@bndlg.de for parts of it. - - 2001_Sep_19 gkh - Added break support. - - 2001_Aug_30 gkh - fixed oops in write_bulk_callback. - - 2001_Aug_28 gkh - reworked buffer logic to be like other usb-serial drivers. Hopefully - removing some reported problems. - - 2001_Jun_06 gkh - finished porting to 2.4 format. - - ------------------------------------------------------------------------ -io_edgeport.c Change Log comments: - - 2003_04_03 al borchers - - fixed a bug (that shows up with dosemu) where the tty struct is - used in a callback after it has been freed - - 2.3 2002_03_08 greg kroah-hartman - - fixed bug when multiple devices were attached at the same time. - - 2.2 2001_11_14 greg kroah-hartman - - fixed bug in edge_close that kept the port from being used more - than once. - - fixed memory leak on device removal. - - fixed potential double free of memory when command urb submitting - failed. - - other small cleanups when the device is removed - - 2.1 2001_07_09 greg kroah-hartman - - added support for TIOCMBIS and TIOCMBIC. - - (04/08/2001) gb - - Identify version on module load. - - 2.0 2001_03_05 greg kroah-hartman - - reworked entire driver to fit properly in with the other usb-serial - drivers. Occasional oopses still happen, but it's a good start. - - 1.2.3 (02/23/2001) greg kroah-hartman - - changed device table to work properly for 2.4.x final format. - - fixed problem with dropping data at high data rates. - - 1.2.2 (11/27/2000) greg kroah-hartman - - cleaned up more NTisms. - - Added device table for 2.4.0-test11 - - 1.2.1 (11/08/2000) greg kroah-hartman - - Started to clean up NTisms. - - Fixed problem with dev field of urb for kernels >= 2.4.0-test9 - - 1.2 (10/17/2000) David Iacovelli - Remove all EPIC code and GPL source - Fix RELEVANT_IFLAG macro to include flow control - changes port configuration changes. - Fix redefinition of SERIAL_MAGIC - Change all timeout values to 5 seconds - Tried to fix the UHCI multiple urb submission, but failed miserably. - it seems to work fine with OHCI. - ( Greg take a look at the #if 0 at end of WriteCmdUsb() we must - find a way to work arount this UHCI bug ) - - 1.1 (10/11/2000) David Iacovelli - Fix XON/XOFF flow control to support both IXON and IXOFF - - 0.9.27 (06/30/2000) David Iacovelli - Added transmit queue and now allocate urb for command writes. - - 0.9.26 (06/29/2000) David Iacovelli - Add support for 80251 based edgeport - - 0.9.25 (06/27/2000) David Iacovelli - Do not close the port if it has multiple opens. - - 0.9.24 (05/26/2000) David Iacovelli - Add IOCTLs to support RXTX and JAVA POS - and first cut at running BlackBox Demo - - 0.9.23 (05/24/2000) David Iacovelli - Add IOCTLs to support RXTX and JAVA POS - - 0.9.22 (05/23/2000) David Iacovelli - fixed bug in enumeration. If epconfig turns on mapping by - path after a device is already plugged in, we now update - the mapping correctly - - 0.9.21 (05/16/2000) David Iacovelli - Added BlockUntilChaseResp() to also wait for txcredits - Updated the way we allocate and handle write URBs - Add debug code to dump buffers - - 0.9.20 (05/01/2000) David Iacovelli - change driver to use usb/tts/ - - 0.9.19 (05/01/2000) David Iacovelli - Update code to compile if DEBUG is off - - 0.9.18 (04/28/2000) David Iacovelli - cleanup and test tty_register with devfs - - 0.9.17 (04/27/2000) greg kroah-hartman - changed tty_register around to be like the way it - was before, but now it works properly with devfs. - - 0.9.16 (04/26/2000) david iacovelli - Fixed bug in GetProductInfo() - - 0.9.15 (04/25/2000) david iacovelli - Updated enumeration - - 0.9.14 (04/24/2000) david iacovelli - Removed all config/status IOCTLS and - converted to using /proc/edgeport - still playing with devfs - - 0.9.13 (04/24/2000) david iacovelli - Removed configuration based on ttyUSB0 - Added support for configuration using /prod/edgeport - first attempt at using devfs (not working yet!) - Added IOCTL to GetProductInfo() - Added support for custom baud rates - Add support for random port numbers - - 0.9.12 (04/18/2000) david iacovelli - added additional configuration IOCTLs - use ttyUSB0 for configuration - - 0.9.11 (04/17/2000) greg kroah-hartman - fixed module initialization race conditions. - made all urbs dynamically allocated. - made driver devfs compatible. now it only registers the tty device - when the device is actually plugged in. - - 0.9.10 (04/13/2000) greg kroah-hartman - added proc interface framework. - - 0.9.9 (04/13/2000) david iacovelli - added enumeration code and ioctls to configure the device - - 0.9.8 (04/12/2000) david iacovelli - Change interrupt read start when device is plugged in - and stop when device is removed - process interrupt reads when all ports are closed - (keep value of rxBytesAvail consistent with the edgeport) - set the USB_BULK_QUEUE flag so that we can shove a bunch - of urbs at once down the pipe - - 0.9.7 (04/10/2000) david iacovelli - start to add enumeration code. - generate serial number for epic devices - add support for kdb - - 0.9.6 (03/30/2000) david iacovelli - add IOCTL to get string, manufacture, and boot descriptors - - 0.9.5 (03/14/2000) greg kroah-hartman - more error checking added to SerialOpen to try to fix UHCI open problem - - 0.9.4 (03/09/2000) greg kroah-hartman - added more error checking to handle oops when data is hanging - around and tty is abruptly closed. - - 0.9.3 (03/09/2000) david iacovelli - Add epic support for xon/xoff chars - play with performance - - 0.9.2 (03/08/2000) greg kroah-hartman - changed most "info" calls to "dbg" - implemented flow control properly in the termios call - - 0.9.1 (03/08/2000) david iacovelli - added EPIC support - enabled bootloader update - - 0.9 (03/08/2000) greg kroah-hartman - Release to IO networks. - Integrated changes that David made - made getting urbs for writing SMP safe - - 0.8 (03/07/2000) greg kroah-hartman - Release to IO networks. - Fixed problems that were seen in code by David. - Now both Edgeport/4 and Edgeport/2 works properly. - Changed most of the functions to use port instead of serial. - - 0.7 (02/27/2000) greg kroah-hartman - Milestone 3 release. - Release to IO Networks - ioctl for waiting on line change implemented. - ioctl for getting statistics implemented. - multiport support working. - lsr and msr registers are now handled properly. - change break now hooked up and working. - support for all known Edgeport devices. - - 0.6 (02/22/2000) greg kroah-hartman - Release to IO networks. - CHASE is implemented correctly when port is closed. - SerialOpen now blocks correctly until port is fully opened. - - 0.5 (02/20/2000) greg kroah-hartman - Release to IO networks. - Known problems: - modem status register changes are not sent on to the user - CHASE is not implemented when the port is closed. - - 0.4 (02/16/2000) greg kroah-hartman - Second cut at the CeBit demo. - Doesn't leak memory on every write to the port - Still small leaks on startup. - Added support for Edgeport/2 and Edgeport/8 - - 0.3 (02/15/2000) greg kroah-hartman - CeBit demo release. - Force the line settings to 4800, 8, 1, e for the demo. - Warning! This version leaks memory like crazy! - - 0.2 (01/30/2000) greg kroah-hartman - Milestone 1 release. - Device is found by USB subsystem, enumerated, fimware is downloaded - and the descriptors are printed to the debug log, config is set, and - green light starts to blink. Open port works, and data can be sent - and received at the default settings of the UART. Loopback connector - and debug log confirms this. - - 0.1 (01/23/2000) greg kroah-hartman - Initial release to help IO Networks try to set up their test system. - Edgeport4 is recognized, firmware is downloaded, config is set so - device blinks green light every 3 sec. Port is bound, but opening, - closing, and sending data do not work properly. - - -- cgit v1.2.3 From 116d75bd4d539309e0e1391e509f852a9cce82a6 Mon Sep 17 00:00:00 2001 From: Ping Cheng Date: Thu, 17 Nov 2005 09:46:33 -0800 Subject: [PATCH] USB: add new wacom devices to usb hid-core list This patch adds support for Graphire4, Cintiq 710, Intuos3 6x11, etc. Signed-off-by: Ping Cheng Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/input/hid-core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'drivers') diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index 79ddce4555a..45f3130fade 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c @@ -1318,6 +1318,7 @@ void hid_init_reports(struct hid_device *hid) #define USB_DEVICE_ID_WACOM_PTU 0x0003 #define USB_DEVICE_ID_WACOM_INTUOS3 0x00B0 #define USB_DEVICE_ID_WACOM_CINTIQ 0x003F +#define USB_DEVICE_ID_WACOM_DTF 0x00C0 #define USB_VENDOR_ID_ACECAD 0x0460 #define USB_DEVICE_ID_ACECAD_FLAIR 0x0004 @@ -1524,6 +1525,9 @@ static struct hid_blacklist { { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 3, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 4, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 5, HID_QUIRK_IGNORE }, + { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 7, HID_QUIRK_IGNORE }, + { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 8, HID_QUIRK_IGNORE }, + { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 9, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 1, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 2, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 3, HID_QUIRK_IGNORE }, @@ -1531,11 +1535,19 @@ static struct hid_blacklist { { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 5, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 7, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_VOLITO, HID_QUIRK_IGNORE }, + { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_VOLITO + 1, HID_QUIRK_IGNORE }, + { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_VOLITO + 2, HID_QUIRK_IGNORE }, + { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_VOLITO + 3, HID_QUIRK_IGNORE }, + { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_VOLITO + 4, HID_QUIRK_IGNORE }, + { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE + 5, HID_QUIRK_IGNORE }, + { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE + 6, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PTU, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 1, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 2, HID_QUIRK_IGNORE }, + { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS3 + 5, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_CINTIQ, HID_QUIRK_IGNORE }, + { USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_DTF, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_4_PHIDGETSERVO_20, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20, HID_QUIRK_IGNORE }, -- cgit v1.2.3 From ebb6f371ac5ce623051c4431c5d0f093462f679b Mon Sep 17 00:00:00 2001 From: Ping Cheng Date: Thu, 17 Nov 2005 09:46:51 -0800 Subject: [PATCH] USB: wacom tablet driver update This patch adds support for Graphire4, Cintiq 710, Intuos3 6x11, etc. and report Device IDs. Signed-off-by: Ping Cheng Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/input/wacom.c | 133 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 110 insertions(+), 23 deletions(-) (limited to 'drivers') diff --git a/drivers/usb/input/wacom.c b/drivers/usb/input/wacom.c index ea0f75773ae..aea1cfae34c 100644 --- a/drivers/usb/input/wacom.c +++ b/drivers/usb/input/wacom.c @@ -52,8 +52,10 @@ * v1.30.1 (pi) - Added Graphire3 support * v1.40 (pc) - Add support for several new devices, fix eraser reporting, ... * v1.43 (pc) - Added support for Cintiq 21UX - - Fixed a Graphire bug - - Merged wacom_intuos3_irq into wacom_intuos_irq + * - Fixed a Graphire bug + * - Merged wacom_intuos3_irq into wacom_intuos_irq + * v1.44 (pc) - Added support for Graphire4, Cintiq 710, Intuos3 6x11, etc. + * - Report Device IDs */ /* @@ -76,7 +78,7 @@ /* * Version Information */ -#define DRIVER_VERSION "v1.43" +#define DRIVER_VERSION "v1.44" #define DRIVER_AUTHOR "Vojtech Pavlik " #define DRIVER_DESC "USB Wacom Graphire and Wacom Intuos tablet driver" #define DRIVER_LICENSE "GPL" @@ -86,10 +88,14 @@ MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE(DRIVER_LICENSE); #define USB_VENDOR_ID_WACOM 0x056a +#define STYLUS_DEVICE_ID 0x02 +#define CURSOR_DEVICE_ID 0x06 +#define ERASER_DEVICE_ID 0x0A enum { PENPARTNER = 0, GRAPHIRE, + G4, PL, INTUOS, INTUOS3, @@ -116,6 +122,7 @@ struct wacom { struct urb *irq; struct wacom_features *features; int tool[2]; + int id[2]; __u32 serial[2]; char phys[32]; }; @@ -136,7 +143,7 @@ static void wacom_pl_irq(struct urb *urb, struct pt_regs *regs) struct wacom *wacom = urb->context; unsigned char *data = wacom->data; struct input_dev *dev = wacom->dev; - int prox, pressure; + int prox, pressure, id; int retval; switch (urb->status) { @@ -163,6 +170,7 @@ static void wacom_pl_irq(struct urb *urb, struct pt_regs *regs) input_regs(dev, regs); + id = ERASER_DEVICE_ID; if (prox) { pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1)); @@ -177,11 +185,15 @@ static void wacom_pl_irq(struct urb *urb, struct pt_regs *regs) * an out of proximity for previous tool then a in for new tool. */ if (!wacom->tool[0]) { - /* Going into proximity select tool */ - wacom->tool[1] = (data[4] & 0x20)? BTN_TOOL_RUBBER : BTN_TOOL_PEN; + /* Eraser bit set for DTF */ + if (data[1] & 0x10) + wacom->tool[1] = BTN_TOOL_RUBBER; + else + /* Going into proximity select tool */ + wacom->tool[1] = (data[4] & 0x20) ? BTN_TOOL_RUBBER : BTN_TOOL_PEN; } else { /* was entered with stylus2 pressed */ - if (wacom->tool[1] == BTN_TOOL_RUBBER && !(data[4] & 0x20) ) { + if (wacom->tool[1] == BTN_TOOL_RUBBER && !(data[4] & 0x20)) { /* report out proximity for previous tool */ input_report_key(dev, wacom->tool[1], 0); input_sync(dev); @@ -192,8 +204,9 @@ static void wacom_pl_irq(struct urb *urb, struct pt_regs *regs) if (wacom->tool[1] != BTN_TOOL_RUBBER) { /* Unknown tool selected default to pen tool */ wacom->tool[1] = BTN_TOOL_PEN; + id = STYLUS_DEVICE_ID; } - input_report_key(dev, wacom->tool[1], prox); /* report in proximity for tool */ + input_report_key(dev, wacom->tool[1], id); /* report in proximity for tool */ input_report_abs(dev, ABS_X, data[3] | (data[2] << 7) | ((data[1] & 0x03) << 14)); input_report_abs(dev, ABS_Y, data[6] | (data[5] << 7) | ((data[4] & 0x03) << 14)); input_report_abs(dev, ABS_PRESSURE, pressure); @@ -250,10 +263,10 @@ static void wacom_ptu_irq(struct urb *urb, struct pt_regs *regs) input_regs(dev, regs); if (data[1] & 0x04) { - input_report_key(dev, BTN_TOOL_RUBBER, data[1] & 0x20); + input_report_key(dev, BTN_TOOL_RUBBER, (data[1] & 0x20) ? ERASER_DEVICE_ID : 0); input_report_key(dev, BTN_TOUCH, data[1] & 0x08); } else { - input_report_key(dev, BTN_TOOL_PEN, data[1] & 0x20); + input_report_key(dev, BTN_TOOL_PEN, (data[1] & 0x20) ? STYLUS_DEVICE_ID : 0); input_report_key(dev, BTN_TOUCH, data[1] & 0x01); } input_report_abs(dev, ABS_X, le16_to_cpu(*(__le16 *) &data[2])); @@ -299,7 +312,7 @@ static void wacom_penpartner_irq(struct urb *urb, struct pt_regs *regs) } input_regs(dev, regs); - input_report_key(dev, BTN_TOOL_PEN, 1); + input_report_key(dev, BTN_TOOL_PEN, STYLUS_DEVICE_ID); input_report_abs(dev, ABS_X, le16_to_cpu(*(__le16 *) &data[1])); input_report_abs(dev, ABS_Y, le16_to_cpu(*(__le16 *) &data[3])); input_report_abs(dev, ABS_PRESSURE, (signed char)data[6] + 127); @@ -319,7 +332,7 @@ static void wacom_graphire_irq(struct urb *urb, struct pt_regs *regs) struct wacom *wacom = urb->context; unsigned char *data = wacom->data; struct input_dev *dev = wacom->dev; - int x, y; + int x, y, id, rw; int retval; switch (urb->status) { @@ -344,6 +357,7 @@ static void wacom_graphire_irq(struct urb *urb, struct pt_regs *regs) input_regs(dev, regs); + id = STYLUS_DEVICE_ID; if (data[1] & 0x10) { /* in prox */ switch ((data[1] >> 5) & 3) { @@ -354,18 +368,27 @@ static void wacom_graphire_irq(struct urb *urb, struct pt_regs *regs) case 1: /* Rubber */ wacom->tool[0] = BTN_TOOL_RUBBER; + id = ERASER_DEVICE_ID; break; case 2: /* Mouse with wheel */ input_report_key(dev, BTN_MIDDLE, data[1] & 0x04); - input_report_rel(dev, REL_WHEEL, (signed char) data[6]); + if (wacom->features->type == G4) { + rw = data[7] & 0x04 ? -(data[7] & 0x03) : (data[7] & 0x03); + input_report_rel(dev, REL_WHEEL, rw); + } else + input_report_rel(dev, REL_WHEEL, (signed char) data[6]); /* fall through */ case 3: /* Mouse without wheel */ wacom->tool[0] = BTN_TOOL_MOUSE; + id = CURSOR_DEVICE_ID; input_report_key(dev, BTN_LEFT, data[1] & 0x01); input_report_key(dev, BTN_RIGHT, data[1] & 0x02); - input_report_abs(dev, ABS_DISTANCE, data[7]); + if (wacom->features->type == G4) + input_report_abs(dev, ABS_DISTANCE, data[6]); + else + input_report_abs(dev, ABS_DISTANCE, data[7]); break; } } @@ -376,16 +399,50 @@ static void wacom_graphire_irq(struct urb *urb, struct pt_regs *regs) input_report_abs(dev, ABS_X, x); input_report_abs(dev, ABS_Y, y); if (wacom->tool[0] != BTN_TOOL_MOUSE) { - input_report_abs(dev, ABS_PRESSURE, le16_to_cpu(*(__le16 *) &data[6])); + input_report_abs(dev, ABS_PRESSURE, data[6] | ((data[7] & 0x01) << 8)); input_report_key(dev, BTN_TOUCH, data[1] & 0x01); input_report_key(dev, BTN_STYLUS, data[1] & 0x02); input_report_key(dev, BTN_STYLUS2, data[1] & 0x04); } } - input_report_key(dev, wacom->tool[0], data[1] & 0x10); + input_report_key(dev, wacom->tool[0], (data[1] & 0x10) ? id : 0); input_sync(dev); + /* send pad data */ + if (wacom->features->type == G4) { + /* fist time sending pad data */ + if (wacom->tool[1] != BTN_TOOL_FINGER) { + wacom->id[1] = 0; + wacom->serial[1] = (data[7] & 0x38) >> 2; + } + if (data[7] & 0xf8) { + input_report_key(dev, BTN_0, (data[7] & 0x40)); + input_report_key(dev, BTN_4, (data[7] & 0x80)); + if (((data[7] & 0x38) >> 2) == (wacom->serial[1] & 0x0e)) + /* alter REL_WHEEL value so X apps can get it */ + wacom->serial[1] += (wacom->serial[1] & 0x01) ? -1 : 1; + else + wacom->serial[1] = (data[7] & 0x38 ) >> 2; + + /* don't alter the value when there is no wheel event */ + if (wacom->serial[1] == 1) + wacom->serial[1] = 0; + rw = wacom->serial[1]; + rw = (rw & 0x08) ? -(rw & 0x07) : (rw & 0x07); + input_report_rel(dev, REL_WHEEL, rw); + wacom->tool[1] = BTN_TOOL_FINGER; + wacom->id[1] = data[7] & 0xf8; + input_report_key(dev, wacom->tool[1], 0xf0); + input_event(dev, EV_MSC, MSC_SERIAL, 0xf0); + } else if (wacom->id[1]) { + wacom->id[1] = 0; + wacom->serial[1] = 0; + input_report_key(dev, wacom->tool[1], 0); + input_event(dev, EV_MSC, MSC_SERIAL, 0xf0); + } + input_sync(dev); + } exit: retval = usb_submit_urb (urb, GFP_ATOMIC); if (retval) @@ -410,7 +467,8 @@ static int wacom_intuos_inout(struct urb *urb) (data[4] << 20) + (data[5] << 12) + (data[6] << 4) + (data[7] >> 4); - switch ((data[2] << 4) | (data[3] >> 4)) { + wacom->id[idx] = (data[2] << 4) | (data[3] >> 4); + switch (wacom->id[idx]) { case 0x812: /* Inking pen */ case 0x801: /* Intuos3 Inking pen */ case 0x012: @@ -458,7 +516,7 @@ static int wacom_intuos_inout(struct urb *urb) default: /* Unknown tool */ wacom->tool[idx] = BTN_TOOL_PEN; } - input_report_key(dev, wacom->tool[idx], 1); + input_report_key(dev, wacom->tool[idx], wacom->id[idx]); input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]); input_sync(dev); return 1; @@ -637,7 +695,7 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs) } } - input_report_key(dev, wacom->tool[idx], 1); + input_report_key(dev, wacom->tool[idx], wacom->id[idx]); input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]); input_sync(dev); @@ -655,6 +713,13 @@ static struct wacom_features wacom_features[] = { { "Wacom Graphire2 5x7", 8, 13918, 10206, 511, 32, GRAPHIRE, wacom_graphire_irq }, { "Wacom Graphire3", 8, 10208, 7424, 511, 32, GRAPHIRE, wacom_graphire_irq }, { "Wacom Graphire3 6x8", 8, 16704, 12064, 511, 32, GRAPHIRE, wacom_graphire_irq }, + { "Wacom Graphire4 4x5", 8, 10208, 7424, 511, 32, G4, wacom_graphire_irq }, + { "Wacom Graphire4 6x8", 8, 16704, 12064, 511, 32, G4, wacom_graphire_irq }, + { "Wacom Volito", 8, 5104, 3712, 511, 32, GRAPHIRE, wacom_graphire_irq }, + { "Wacom PenStation2", 8, 3250, 2320, 255, 32, GRAPHIRE, wacom_graphire_irq }, + { "Wacom Volito2 4x5", 8, 5104, 3712, 511, 32, GRAPHIRE, wacom_graphire_irq }, + { "Wacom Volito2 2x3", 8, 3248, 2320, 511, 32, GRAPHIRE, wacom_graphire_irq }, + { "Wacom PenPartner2", 8, 3250, 2320, 255, 32, GRAPHIRE, wacom_graphire_irq }, { "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 15, INTUOS, wacom_intuos_irq }, { "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_intuos_irq }, { "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 15, INTUOS, wacom_intuos_irq }, @@ -666,16 +731,20 @@ static struct wacom_features wacom_features[] = { { "Wacom PL600SX", 8, 6260, 5016, 255, 32, PL, wacom_pl_irq }, { "Wacom PL550", 8, 6144, 4608, 511, 32, PL, wacom_pl_irq }, { "Wacom PL800", 8, 7220, 5780, 511, 32, PL, wacom_pl_irq }, + { "Wacom PL700", 8, 6758, 5406, 511, 32, PL, wacom_pl_irq }, + { "Wacom PL510", 8, 6282, 4762, 511, 32, PL, wacom_pl_irq }, + { "Wacom PL710", 8, 34080, 27660, 511, 32, PL, wacom_pl_irq }, + { "Wacom DTF720", 8, 6858, 5506, 511, 32, PL, wacom_pl_irq }, + { "Wacom Cintiq Partner",8, 20480, 15360, 511, 32, PL, wacom_ptu_irq }, { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 15, INTUOS, wacom_intuos_irq }, { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_intuos_irq }, { "Wacom Intuos2 9x12", 10, 30480, 24060, 1023, 15, INTUOS, wacom_intuos_irq }, { "Wacom Intuos2 12x12", 10, 30480, 31680, 1023, 15, INTUOS, wacom_intuos_irq }, { "Wacom Intuos2 12x18", 10, 45720, 31680, 1023, 15, INTUOS, wacom_intuos_irq }, - { "Wacom Volito", 8, 5104, 3712, 511, 32, GRAPHIRE, wacom_graphire_irq }, - { "Wacom Cintiq Partner",8, 20480, 15360, 511, 32, PL, wacom_ptu_irq }, { "Wacom Intuos3 4x5", 10, 25400, 20320, 1023, 15, INTUOS3, wacom_intuos_irq }, { "Wacom Intuos3 6x8", 10, 40640, 30480, 1023, 15, INTUOS3, wacom_intuos_irq }, { "Wacom Intuos3 9x12", 10, 60960, 45720, 1023, 15, INTUOS3, wacom_intuos_irq }, + { "Wacom Intuos3 6x11", 10, 54204, 31750, 1023, 15, INTUOS3, wacom_intuos_irq }, { "Wacom Cintiq 21UX", 10, 87200, 65600, 1023, 15, CINTIQ, wacom_intuos_irq }, { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, INTUOS, wacom_intuos_irq }, { } @@ -688,6 +757,13 @@ static struct usb_device_id wacom_ids[] = { { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x12) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x13) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x14) }, + { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x15) }, + { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x16) }, + { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x60) }, + { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x61) }, + { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x62) }, + { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x63) }, + { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x64) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x20) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x21) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x22) }, @@ -699,16 +775,20 @@ static struct usb_device_id wacom_ids[] = { { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x33) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x34) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x35) }, + { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x37) }, + { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x38) }, + { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x39) }, + { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC0) }, + { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x03) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x41) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x42) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x43) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x44) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x45) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x60) }, - { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x03) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB0) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB1) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB2) }, + { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xB5) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x3F) }, { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x47) }, { } @@ -779,6 +859,13 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i input_set_abs_params(input_dev, ABS_PRESSURE, 0, wacom->features->pressure_max, 0, 0); switch (wacom->features->type) { + case G4: + input_dev->evbit[0] |= BIT(EV_MSC); + input_dev->mscbit[0] |= BIT(MSC_SERIAL); + input_dev->keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_FINGER); + input_dev->keybit[LONG(BTN_LEFT)] |= BIT(BTN_0) | BIT(BTN_1) | BIT(BTN_2) | BIT(BTN_3) | BIT(BTN_4) | BIT(BTN_5) | BIT(BTN_6) | BIT(BTN_7); + /* fall through */ + case GRAPHIRE: input_dev->evbit[0] |= BIT(EV_REL); input_dev->relbit[0] |= BIT(REL_WHEEL); -- cgit v1.2.3 From d4ece29d89d424ea045753c639971429faa9ee58 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Thu, 17 Nov 2005 09:46:44 -0800 Subject: [PATCH] USB: fix 'unused variable' warning USB: fix 'unused variable' warning Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/core/message.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 644a3d4f12a..208c6bd83a8 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -1457,12 +1457,11 @@ free_interfaces: */ for (i = 0; i < nintf; ++i) { struct usb_interface *intf = cp->interface[i]; - struct usb_host_interface *alt = intf->cur_altsetting; dev_dbg (&dev->dev, "adding %s (config #%d, interface %d)\n", intf->dev.bus_id, configuration, - alt->desc.bInterfaceNumber); + intf->cur_altsetting->desc.bInterfaceNumber); ret = device_add (&intf->dev); if (ret != 0) { dev_err(&dev->dev, -- cgit v1.2.3 From bc7cb323bab717660830211d50555dedf19e372e Mon Sep 17 00:00:00 2001 From: OGAWA Hirofumi Date: Thu, 17 Nov 2005 09:47:07 -0800 Subject: [PATCH] usbfs: usbfs_dir_inode_operations cleanup Signed-off-by: OGAWA Hirofumi Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/core/inode.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'drivers') diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c index 12f490fdee8..c44bbedec81 100644 --- a/drivers/usb/core/inode.c +++ b/drivers/usb/core/inode.c @@ -46,7 +46,6 @@ static struct super_operations usbfs_ops; static struct file_operations default_file_operations; -static struct inode_operations usbfs_dir_inode_operations; static struct vfsmount *usbfs_mount; static int usbfs_mount_count; /* = 0 */ static int ignore_mount = 0; @@ -262,7 +261,7 @@ static struct inode *usbfs_get_inode (struct super_block *sb, int mode, dev_t de inode->i_fop = &default_file_operations; break; case S_IFDIR: - inode->i_op = &usbfs_dir_inode_operations; + inode->i_op = &simple_dir_inode_operations; inode->i_fop = &simple_dir_operations; /* directory inodes start off with i_nlink == 2 (for "." entry) */ @@ -417,10 +416,6 @@ static struct file_operations default_file_operations = { .llseek = default_file_lseek, }; -static struct inode_operations usbfs_dir_inode_operations = { - .lookup = simple_lookup, -}; - static struct super_operations usbfs_ops = { .statfs = simple_statfs, .drop_inode = generic_delete_inode, -- cgit v1.2.3 From 777da5905e82695d1dd73eee6cfe50bd486d8fe9 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Thu, 17 Nov 2005 09:47:02 -0800 Subject: [PATCH] USB: usbdevfs_ioctl 32bit fix drivers/usb/core/devio.c: In function `proc_ioctl_compat': drivers/usb/core/devio.c:1401: warning: passing arg 1 of `compat_ptr' makes integer from pointer without a cast NFI if this is correct... Cc: Pete Zaitcev Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/core/devio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 942cd437dc4..ec138852848 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c @@ -1392,7 +1392,7 @@ static int proc_ioctl_default(struct dev_state *ps, void __user *arg) } #ifdef CONFIG_COMPAT -static int proc_ioctl_compat(struct dev_state *ps, void __user *arg) +static int proc_ioctl_compat(struct dev_state *ps, compat_uptr_t arg) { struct usbdevfs_ioctl32 __user *uioc; struct usbdevfs_ioctl ctrl; @@ -1511,7 +1511,7 @@ static int usbdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd case USBDEVFS_IOCTL32: snoop(&dev->dev, "%s: IOCTL\n", __FUNCTION__); - ret = proc_ioctl_compat(ps, p); + ret = proc_ioctl_compat(ps, (compat_uptr_t)(long)p); break; #endif -- cgit v1.2.3 From c5dbf868e2bbeea6581f388a09539779c0d61357 Mon Sep 17 00:00:00 2001 From: Pavel Machek Date: Thu, 17 Nov 2005 09:47:11 -0800 Subject: [PATCH] USB: kill unneccessary usb-storage blacklist entries I actually have this device, and kernel reports blacklist entry is no longer neccessary. Signed-off-by: Pavel Machek Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/storage/unusual_devs.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'drivers') diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 9e926a8f211..103364b9930 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h @@ -710,11 +710,6 @@ UNUSUAL_DEV( 0x0686, 0x4017, 0x0001, 0x0001, "DIMAGE E223", US_SC_SCSI, US_PR_DEVICE, NULL, 0 ), -UNUSUAL_DEV( 0x0693, 0x0002, 0x0100, 0x0100, - "Hagiwara", - "FlashGate SmartMedia", - US_SC_SCSI, US_PR_BULK, NULL, 0 ), - UNUSUAL_DEV( 0x0693, 0x0005, 0x0100, 0x0100, "Hagiwara", "Flashgate", -- cgit v1.2.3 From b0ce84d5539de88a1001f9aa3deeaa20fde3d152 Mon Sep 17 00:00:00 2001 From: Josef Balatka Date: Thu, 17 Nov 2005 09:47:24 -0800 Subject: [PATCH] USB: cp2101.c: Jablotron usb serial interface identification Jablotron usb serial interface identification Signed-off-by: Josef Balatka Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/serial/cp2101.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers') diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c index c5334dd89b1..c9787001cf2 100644 --- a/drivers/usb/serial/cp2101.c +++ b/drivers/usb/serial/cp2101.c @@ -60,6 +60,7 @@ static struct usb_device_id id_table [] = { { USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */ { USB_DEVICE(0x10A6, 0xAA26) }, /* Knock-off DCU-11 cable */ { USB_DEVICE(0x10AB, 0x10C5) }, /* Siemens MC60 Cable */ + { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ { } /* Terminating Entry */ }; -- cgit v1.2.3 From c9d00fc148b210aa8cf388d6e1eac187a0e855a6 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Thu, 17 Nov 2005 09:47:28 -0800 Subject: [PATCH] USB: onetouch doesn't suspend yet The onetouch support doesn't suspend correctly (leaves an interrupt URB posted, instead of unlinking it) so for now just disable it when PM is in the air. Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/storage/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig index 1a9679f76f5..c41d64dbb0f 100644 --- a/drivers/usb/storage/Kconfig +++ b/drivers/usb/storage/Kconfig @@ -115,7 +115,7 @@ config USB_STORAGE_JUMPSHOT config USB_STORAGE_ONETOUCH bool "Support OneTouch Button on Maxtor Hard Drives (EXPERIMENTAL)" - depends on USB_STORAGE && INPUT_EVDEV && EXPERIMENTAL + depends on USB_STORAGE && INPUT_EVDEV && EXPERIMENTAL && !PM help Say Y here to include additional code to support the Maxtor OneTouch USB hard drive's onetouch button. -- cgit v1.2.3 From a8310f3b8b713e52d77c56d4b8865685ee40d02a Mon Sep 17 00:00:00 2001 From: Luiz Fernando Capitulino Date: Thu, 17 Nov 2005 09:47:32 -0800 Subject: [PATCH] USB: pl2303: adds new IDs. This patch adds two new Siemens mobiles IDs for the pl2303 driver. Signed-off-by: Luiz Capitulino Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/serial/pl2303.c | 2 ++ drivers/usb/serial/pl2303.h | 2 ++ 2 files changed, 4 insertions(+) (limited to 'drivers') diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 165c119bf10..f6ce321a865 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c @@ -71,7 +71,9 @@ static struct usb_device_id id_table [] = { { USB_DEVICE(SITECOM_VENDOR_ID, SITECOM_PRODUCT_ID) }, { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_ID) }, { USB_DEVICE(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_ID) }, + { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_SX1) }, { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X65) }, + { USB_DEVICE(SIEMENS_VENDOR_ID, SIEMENS_PRODUCT_ID_X75) }, { USB_DEVICE(SYNTECH_VENDOR_ID, SYNTECH_PRODUCT_ID) }, { USB_DEVICE( NOKIA_CA42_VENDOR_ID, NOKIA_CA42_PRODUCT_ID ) }, { } /* Terminating entry */ diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index 7be9644f5a0..21d434d8181 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h @@ -54,7 +54,9 @@ #define SAMSUNG_PRODUCT_ID 0x8001 #define SIEMENS_VENDOR_ID 0x11f5 +#define SIEMENS_PRODUCT_ID_SX1 0x0001 #define SIEMENS_PRODUCT_ID_X65 0x0003 +#define SIEMENS_PRODUCT_ID_X75 0x0004 #define SYNTECH_VENDOR_ID 0x0745 #define SYNTECH_PRODUCT_ID 0x0001 -- cgit v1.2.3 From b8f4c1d6674463e5824eada1ad7ec799276718bd Mon Sep 17 00:00:00 2001 From: Luiz Fernando Capitulino Date: Thu, 17 Nov 2005 09:47:36 -0800 Subject: [PATCH] USB: pl2303: updates pl2303_update_line_status() Updates pl2303_update_line_status() to handle X75 and SX1 Siemens mobiles Signed-off-by: Luiz Capitulino Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/serial/pl2303.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index f6ce321a865..41a45a5025b 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c @@ -813,7 +813,9 @@ static void pl2303_update_line_status(struct usb_serial_port *port, u8 length = UART_STATE; if ((le16_to_cpu(port->serial->dev->descriptor.idVendor) == SIEMENS_VENDOR_ID) && - (le16_to_cpu(port->serial->dev->descriptor.idProduct) == SIEMENS_PRODUCT_ID_X65)) { + (le16_to_cpu(port->serial->dev->descriptor.idProduct) == SIEMENS_PRODUCT_ID_X65 || + le16_to_cpu(port->serial->dev->descriptor.idProduct) == SIEMENS_PRODUCT_ID_SX1 || + le16_to_cpu(port->serial->dev->descriptor.idProduct) == SIEMENS_PRODUCT_ID_X75)) { length = 1; status_idx = 0; } -- cgit v1.2.3 From 9142d59a451731d23539d218c962418acc93283c Mon Sep 17 00:00:00 2001 From: Oliver Neukum Date: Thu, 17 Nov 2005 09:47:41 -0800 Subject: [PATCH] USB: Adapt microtek driver to new scsi features the scsi layer now uses very short sg lists. This breaks the microtek driver. Here is a patch fixes this and some other issues. Signed-off-by: Oliver Neukum Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/image/microtek.c | 35 +++++++++++++++++++++++++++-------- drivers/usb/image/microtek.h | 2 +- 2 files changed, 28 insertions(+), 9 deletions(-) (limited to 'drivers') diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c index 61a2604cce4..950543aa5ac 100644 --- a/drivers/usb/image/microtek.c +++ b/drivers/usb/image/microtek.c @@ -327,6 +327,18 @@ static inline void mts_urb_abort(struct mts_desc* desc) { usb_kill_urb( desc->urb ); } +static int mts_slave_alloc (struct scsi_device *s) +{ + s->inquiry_len = 0x24; + return 0; +} + +static int mts_slave_configure (struct scsi_device *s) +{ + blk_queue_dma_alignment(s->request_queue, (512 - 1)); + return 0; +} + static int mts_scsi_abort (Scsi_Cmnd *srb) { struct mts_desc* desc = (struct mts_desc*)(srb->device->host->hostdata[0]); @@ -411,7 +423,7 @@ static void mts_transfer_done( struct urb *transfer, struct pt_regs *regs ) MTS_INT_INIT(); context->srb->result &= MTS_SCSI_ERR_MASK; - context->srb->result |= (unsigned)context->status<<1; + context->srb->result |= (unsigned)(*context->scsi_status)<<1; mts_transfer_cleanup(transfer); @@ -427,7 +439,7 @@ static void mts_get_status( struct urb *transfer ) mts_int_submit_urb(transfer, usb_rcvbulkpipe(context->instance->usb_dev, context->instance->ep_response), - &context->status, + context->scsi_status, 1, mts_transfer_done ); } @@ -481,7 +493,7 @@ static void mts_command_done( struct urb *transfer, struct pt_regs *regs ) context->data_pipe, context->data, context->data_length, - context->srb->use_sg ? mts_do_sg : mts_data_done); + context->srb->use_sg > 1 ? mts_do_sg : mts_data_done); } else { mts_get_status(transfer); } @@ -627,7 +639,6 @@ int mts_scsi_queuecommand( Scsi_Cmnd *srb, mts_scsi_cmnd_callback callback ) callback(srb); } - out: return err; } @@ -645,6 +656,9 @@ static struct scsi_host_template mts_scsi_host_template = { .cmd_per_lun = 1, .use_clustering = 1, .emulated = 1, + .slave_alloc = mts_slave_alloc, + .slave_configure = mts_slave_configure, + .max_sectors= 256, /* 128 K */ }; struct vendor_product @@ -771,8 +785,8 @@ static int mts_usb_probe(struct usb_interface *intf, MTS_WARNING( "couldn't find an output bulk endpoint. Bailing out.\n" ); return -ENODEV; } - - + + new_desc = kzalloc(sizeof(struct mts_desc), GFP_KERNEL); if (!new_desc) goto out; @@ -781,6 +795,10 @@ static int mts_usb_probe(struct usb_interface *intf, if (!new_desc->urb) goto out_kfree; + new_desc->context.scsi_status = kmalloc(1, GFP_KERNEL); + if (!new_desc->context.scsi_status) + goto out_kfree2; + new_desc->usb_dev = dev; new_desc->usb_intf = intf; init_MUTEX(&new_desc->lock); @@ -817,6 +835,8 @@ static int mts_usb_probe(struct usb_interface *intf, usb_set_intfdata(intf, new_desc); return 0; + out_kfree2: + kfree(new_desc->context.scsi_status); out_free_urb: usb_free_urb(new_desc->urb); out_kfree: @@ -836,6 +856,7 @@ static void mts_usb_disconnect (struct usb_interface *intf) scsi_host_put(desc->host); usb_free_urb(desc->urb); + kfree(desc->context.scsi_status); kfree(desc); } @@ -856,5 +877,3 @@ module_exit(microtek_drv_exit); MODULE_AUTHOR( DRIVER_AUTHOR ); MODULE_DESCRIPTION( DRIVER_DESC ); MODULE_LICENSE("GPL"); - - diff --git a/drivers/usb/image/microtek.h b/drivers/usb/image/microtek.h index 3271deb8c00..926d4bdc674 100644 --- a/drivers/usb/image/microtek.h +++ b/drivers/usb/image/microtek.h @@ -22,7 +22,7 @@ struct mts_transfer_context int data_pipe; int fragment; - u8 status; /* status returned from ep_response after command completion */ + u8 *scsi_status; /* status returned from ep_response after command completion */ }; -- cgit v1.2.3 From 8845add380854ffce5268714a093df8c80b4a6e2 Mon Sep 17 00:00:00 2001 From: Daniel Drake Date: Thu, 17 Nov 2005 09:48:01 -0800 Subject: [PATCH] usb-storage: Fix detection of kodak flash readers in shuttle_usbat driver Peter Favrholdt reported that his Kodak flash device was getting detected as a CDROM, and he helped me track this down to the fact that the device takes a long time (approx 440ms!) to reset. This patch increases the delay to 500ms, which solves the problem. Signed-off-by: Daniel Drake Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/storage/shuttle_usbat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/usb/storage/shuttle_usbat.c b/drivers/usb/storage/shuttle_usbat.c index 33c55a6261b..fea176d7e79 100644 --- a/drivers/usb/storage/shuttle_usbat.c +++ b/drivers/usb/storage/shuttle_usbat.c @@ -853,7 +853,7 @@ static int usbat_identify_device(struct us_data *us, rc = usbat_device_reset(us); if (rc != USB_STOR_TRANSPORT_GOOD) return rc; - msleep(25); + msleep(500); /* * In attempt to distinguish between HP CDRW's and Flash readers, we now -- cgit v1.2.3 From d23b536bb715673ca0ccbdaac2b6ce2c001d06e9 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Thu, 17 Nov 2005 09:47:45 -0800 Subject: [PATCH] USB: fix race in kaweth disconnect this patch from Herbert Xu fixes a race by moving termination of the URBs into close() exclusively. Signed-off-by: Herbert Xu Signed-off-by: Oliver Neukum Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/net/kaweth.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'drivers') diff --git a/drivers/usb/net/kaweth.c b/drivers/usb/net/kaweth.c index 6bef1be6b36..b5776518020 100644 --- a/drivers/usb/net/kaweth.c +++ b/drivers/usb/net/kaweth.c @@ -219,7 +219,6 @@ struct kaweth_device __u32 status; int end; - int removed; int suspend_lowmem_rx; int suspend_lowmem_ctrl; int linkstate; @@ -699,6 +698,7 @@ static int kaweth_close(struct net_device *net) usb_kill_urb(kaweth->irq_urb); usb_kill_urb(kaweth->rx_urb); + usb_kill_urb(kaweth->tx_urb); flush_scheduled_work(); @@ -750,13 +750,6 @@ static int kaweth_start_xmit(struct sk_buff *skb, struct net_device *net) spin_lock(&kaweth->device_lock); - if (kaweth->removed) { - /* our device is undergoing disconnection - we bail out */ - spin_unlock(&kaweth->device_lock); - dev_kfree_skb_irq(skb); - return 0; - } - kaweth_async_set_rx_mode(kaweth); netif_stop_queue(net); @@ -1136,10 +1129,6 @@ static void kaweth_disconnect(struct usb_interface *intf) return; } netdev = kaweth->net; - kaweth->removed = 1; - usb_kill_urb(kaweth->irq_urb); - usb_kill_urb(kaweth->rx_urb); - usb_kill_urb(kaweth->tx_urb); kaweth_dbg("Unregistering net device"); unregister_netdev(netdev); -- cgit v1.2.3 From 058120d70ebb430e27ad55871429028361c5baed Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Thu, 17 Nov 2005 09:47:49 -0800 Subject: [PATCH] usb devio warning fix drivers/usb/core/devio.c: In function `proc_ioctl_compat': drivers/usb/core/devio.c:1401: warning: passing arg 1 of `compat_ptr' makes integer from pointer without a cast Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/core/devio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index ec138852848..b1d6e9af732 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c @@ -1398,7 +1398,7 @@ static int proc_ioctl_compat(struct dev_state *ps, compat_uptr_t arg) struct usbdevfs_ioctl ctrl; u32 udata; - uioc = compat_ptr(arg); + uioc = compat_ptr((long)arg); if (get_user(ctrl.ifno, &uioc->ifno) || get_user(ctrl.ioctl_code, &uioc->ioctl_code) || __get_user(udata, &uioc->data)) -- cgit v1.2.3 From 9465663965fbe7de4e21d090e8eb0cc34b65294f Mon Sep 17 00:00:00 2001 From: Antti Andreimann Date: Thu, 17 Nov 2005 09:47:53 -0800 Subject: [PATCH] USB: Maxtor OneTouch button support for older drives This small patch adds a device ID used by older Maxtor OneTouch drives (the ones with blue face-plate instead of the fancy silver one used in newer models). The button on those drives works well with the current driver. From: Antti Andreimann Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/storage/unusual_devs.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers') diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 103364b9930..0a9858f69a9 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h @@ -1003,6 +1003,11 @@ UNUSUAL_DEV( 0x0c0b, 0xa109, 0x0000, 0xffff, * */ #ifdef CONFIG_USB_STORAGE_ONETOUCH + UNUSUAL_DEV( 0x0d49, 0x7000, 0x0000, 0x9999, + "Maxtor", + "OneTouch External Harddrive", + US_SC_DEVICE, US_PR_DEVICE, onetouch_connect_input, + 0), UNUSUAL_DEV( 0x0d49, 0x7010, 0x0000, 0x9999, "Maxtor", "OneTouch External Harddrive", -- cgit v1.2.3 From 87cf203935a646d5fb00464dc5887292da71d928 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 17 Nov 2005 09:47:57 -0800 Subject: [PATCH] USB: OHCI lh7a404 platform device conversion fixup Fix an error in the OHCI lh7a404 driver after the platform device conversion. Signed-off-by: Richard Purdie Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/host/ohci-lh7a404.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/usb/host/ohci-lh7a404.c b/drivers/usb/host/ohci-lh7a404.c index 081ec3f5cff..3959ccc8833 100644 --- a/drivers/usb/host/ohci-lh7a404.c +++ b/drivers/usb/host/ohci-lh7a404.c @@ -219,7 +219,7 @@ static int ohci_hcd_lh7a404_drv_probe(struct platform_device *pdev) static int ohci_hcd_lh7a404_drv_remove(struct platform_device *pdev) { - struct usb_hcd *hcd = platform_get_drvdata(dev); + struct usb_hcd *hcd = platform_get_drvdata(pdev); usb_hcd_lh7a404_remove(hcd, pdev); return 0; -- cgit v1.2.3 From 654f31189e550cd5924b786487a5d93d9feaada9 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 17 Nov 2005 09:48:09 -0800 Subject: [PATCH] USB: move CONFIG_USB_DEBUG checks into the Makefile This lets us remove a lot of code in the drivers that were all checking the same thing. It also found some bugs in a few of the drivers, which has been fixed up. Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/atm/Makefile | 4 ++++ drivers/usb/atm/usbatm.h | 5 ----- drivers/usb/core/Makefile | 4 ++++ drivers/usb/core/buffer.c | 8 -------- drivers/usb/core/config.c | 5 ----- drivers/usb/core/file.c | 6 ------ drivers/usb/core/hcd-pci.c | 7 ------- drivers/usb/core/hcd.c | 5 ----- drivers/usb/core/hub.c | 5 ----- drivers/usb/core/message.c | 7 ------- drivers/usb/core/notify.c | 6 ------ drivers/usb/core/sysfs.c | 7 ------- drivers/usb/core/urb.c | 6 ------ drivers/usb/core/usb.c | 7 ------- drivers/usb/input/Makefile | 4 ++++ drivers/usb/input/itmtouch.c | 7 ------- drivers/usb/input/keyspan_remote.c | 5 +++-- drivers/usb/input/mtouchusb.c | 7 ------- drivers/usb/input/pid.c | 2 -- drivers/usb/input/touchkitusb.c | 4 ---- drivers/usb/misc/Makefile | 6 +++++- drivers/usb/misc/auerswald.c | 1 - drivers/usb/misc/phidgetservo.c | 3 --- drivers/usb/misc/rio500.c | 2 +- drivers/usb/misc/usbled.c | 3 --- drivers/usb/misc/usbtest.c | 3 --- drivers/usb/misc/uss720.c | 2 -- drivers/usb/net/Makefile | 4 ++++ drivers/usb/net/asix.c | 3 --- drivers/usb/net/cdc_ether.c | 3 --- drivers/usb/net/cdc_subset.c | 3 --- drivers/usb/net/gl620a.c | 3 --- drivers/usb/net/net1080.c | 3 --- drivers/usb/net/pegasus.c | 2 -- drivers/usb/net/plusb.c | 3 --- drivers/usb/net/rndis_host.c | 3 --- drivers/usb/net/usbnet.c | 3 --- drivers/usb/net/zaurus.c | 3 --- 38 files changed, 25 insertions(+), 139 deletions(-) (limited to 'drivers') diff --git a/drivers/usb/atm/Makefile b/drivers/usb/atm/Makefile index 751f297be2e..85099718c68 100644 --- a/drivers/usb/atm/Makefile +++ b/drivers/usb/atm/Makefile @@ -6,3 +6,7 @@ obj-$(CONFIG_USB_CXACRU) += cxacru.o obj-$(CONFIG_USB_SPEEDTOUCH) += speedtch.o obj-$(CONFIG_USB_ATM) += usbatm.o obj-$(CONFIG_USB_XUSBATM) += xusbatm.o + +ifeq ($(CONFIG_USB_DEBUG),y) +EXTRA_CFLAGS += -DDEBUG +endif diff --git a/drivers/usb/atm/usbatm.h b/drivers/usb/atm/usbatm.h index 93664645793..1adacd60d71 100644 --- a/drivers/usb/atm/usbatm.h +++ b/drivers/usb/atm/usbatm.h @@ -27,14 +27,9 @@ #include /* -#define DEBUG #define VERBOSE_DEBUG */ -#if !defined (DEBUG) && defined (CONFIG_USB_DEBUG) -# define DEBUG -#endif - #include #include #include diff --git a/drivers/usb/core/Makefile b/drivers/usb/core/Makefile index dd1c4d2a0c3..86d5c380892 100644 --- a/drivers/usb/core/Makefile +++ b/drivers/usb/core/Makefile @@ -14,3 +14,7 @@ ifeq ($(CONFIG_USB_DEVICEFS),y) endif obj-$(CONFIG_USB) += usbcore.o + +ifeq ($(CONFIG_USB_DEBUG),y) +EXTRA_CFLAGS += -DDEBUG +endif diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c index 57e800ac3ce..419c9943a7c 100644 --- a/drivers/usb/core/buffer.c +++ b/drivers/usb/core/buffer.c @@ -15,14 +15,6 @@ #include #include #include - - -#ifdef CONFIG_USB_DEBUG - #define DEBUG -#else - #undef DEBUG -#endif - #include #include "hcd.h" diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 993019500cc..a9d89c78cc2 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -1,9 +1,4 @@ #include - -#ifdef CONFIG_USB_DEBUG -#define DEBUG -#endif - #include #include #include diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c index e695308095a..37b13368c81 100644 --- a/drivers/usb/core/file.c +++ b/drivers/usb/core/file.c @@ -19,12 +19,6 @@ #include #include #include - -#ifdef CONFIG_USB_DEBUG - #define DEBUG -#else - #undef DEBUG -#endif #include #include "usb.h" diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index 84d9e69329b..7feb829362d 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c @@ -17,13 +17,6 @@ */ #include - -#ifdef CONFIG_USB_DEBUG - #define DEBUG -#else - #undef DEBUG -#endif - #include #include #include diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 6c7ca5b08cd..5e5f65a475a 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -23,11 +23,6 @@ */ #include - -#ifdef CONFIG_USB_DEBUG -#define DEBUG -#endif - #include #include #include diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 256d9f69871..840727948d8 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -9,11 +9,6 @@ */ #include -#ifdef CONFIG_USB_DEBUG - #define DEBUG -#else - #undef DEBUG -#endif #include #include #include diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 208c6bd83a8..fe74f99ca5f 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -3,13 +3,6 @@ */ #include - -#ifdef CONFIG_USB_DEBUG - #define DEBUG -#else - #undef DEBUG -#endif - #include /* for scatterlist macros */ #include #include diff --git a/drivers/usb/core/notify.c b/drivers/usb/core/notify.c index 37da059eced..fbbebab52fb 100644 --- a/drivers/usb/core/notify.c +++ b/drivers/usb/core/notify.c @@ -12,13 +12,7 @@ #include #include #include -#ifdef CONFIG_USB_DEBUG - #define DEBUG -#else - #undef DEBUG -#endif #include - #include "usb.h" diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index edd83e01445..71d881327e8 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c @@ -12,14 +12,7 @@ #include #include - -#ifdef CONFIG_USB_DEBUG - #define DEBUG -#else - #undef DEBUG -#endif #include - #include "usb.h" /* endpoint stuff */ diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index f2a1fed2a80..081796726b9 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c @@ -4,12 +4,6 @@ #include #include #include - -#ifdef CONFIG_USB_DEBUG - #define DEBUG -#else - #undef DEBUG -#endif #include #include "hcd.h" diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 0eefff7bcb3..e197ce9353d 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -22,13 +22,6 @@ */ #include - -#ifdef CONFIG_USB_DEBUG - #define DEBUG -#else - #undef DEBUG -#endif - #include #include #include diff --git a/drivers/usb/input/Makefile b/drivers/usb/input/Makefile index 5e03b93f29f..07cb17db42f 100644 --- a/drivers/usb/input/Makefile +++ b/drivers/usb/input/Makefile @@ -42,3 +42,7 @@ obj-$(CONFIG_USB_ACECAD) += acecad.o obj-$(CONFIG_USB_YEALINK) += yealink.o obj-$(CONFIG_USB_XPAD) += xpad.o obj-$(CONFIG_USB_APPLETOUCH) += appletouch.o + +ifeq ($(CONFIG_USB_DEBUG),y) +EXTRA_CFLAGS += -DDEBUG +endif diff --git a/drivers/usb/input/itmtouch.c b/drivers/usb/input/itmtouch.c index 3b581853cf1..4a50acb39d2 100644 --- a/drivers/usb/input/itmtouch.c +++ b/drivers/usb/input/itmtouch.c @@ -40,13 +40,6 @@ *****************************************************************************/ #include - -#ifdef CONFIG_USB_DEBUG - #define DEBUG -#else - #undef DEBUG -#endif - #include #include #include diff --git a/drivers/usb/input/keyspan_remote.c b/drivers/usb/input/keyspan_remote.c index 5b8d65f62ab..a32cfe51b77 100644 --- a/drivers/usb/input/keyspan_remote.c +++ b/drivers/usb/input/keyspan_remote.c @@ -160,7 +160,8 @@ static int keyspan_load_tester(struct usb_keyspan* dev, int bits_needed) * though so it's not too big a deal */ if (dev->data.pos >= dev->data.len) { - dev_dbg(&dev->udev, "%s - Error ran out of data. pos: %d, len: %d\n", + dev_dbg(&dev->udev->dev, + "%s - Error ran out of data. pos: %d, len: %d\n", __FUNCTION__, dev->data.pos, dev->data.len); return -1; } @@ -306,7 +307,7 @@ static void keyspan_check_data(struct usb_keyspan *remote, struct pt_regs *regs) err("Bad message recieved, no stop bit found.\n"); } - dev_dbg(&remote->udev, + dev_dbg(&remote->udev->dev, "%s found valid message: system: %d, button: %d, toggle: %d\n", __FUNCTION__, message.system, message.button, message.toggle); diff --git a/drivers/usb/input/mtouchusb.c b/drivers/usb/input/mtouchusb.c index 7fce526560c..52cc18cd247 100644 --- a/drivers/usb/input/mtouchusb.c +++ b/drivers/usb/input/mtouchusb.c @@ -40,13 +40,6 @@ *****************************************************************************/ #include - -#ifdef CONFIG_USB_DEBUG - #define DEBUG -#else - #undef DEBUG -#endif - #include #include #include diff --git a/drivers/usb/input/pid.c b/drivers/usb/input/pid.c index dca5ee93a4e..19e015d171a 100644 --- a/drivers/usb/input/pid.c +++ b/drivers/usb/input/pid.c @@ -37,8 +37,6 @@ #include "hid.h" #include "pid.h" -#define DEBUG - #define CHECK_OWNERSHIP(i, hid_pid) \ ((i) < FF_EFFECTS_MAX && i >= 0 && \ test_bit(FF_PID_FLAGS_USED, &hid_pid->effects[(i)].flags) && \ diff --git a/drivers/usb/input/touchkitusb.c b/drivers/usb/input/touchkitusb.c index 0043e6ebcd1..7420c6b8428 100644 --- a/drivers/usb/input/touchkitusb.c +++ b/drivers/usb/input/touchkitusb.c @@ -30,10 +30,6 @@ #include #include #include - -#if !defined(DEBUG) && defined(CONFIG_USB_DEBUG) -#define DEBUG -#endif #include #include diff --git a/drivers/usb/misc/Makefile b/drivers/usb/misc/Makefile index 862e40a8368..6c693bc68e2 100644 --- a/drivers/usb/misc/Makefile +++ b/drivers/usb/misc/Makefile @@ -18,4 +18,8 @@ obj-$(CONFIG_USB_RIO500) += rio500.o obj-$(CONFIG_USB_TEST) += usbtest.o obj-$(CONFIG_USB_USS720) += uss720.o -obj-$(CONFIG_USB_SISUSBVGA) += sisusbvga/ \ No newline at end of file +obj-$(CONFIG_USB_SISUSBVGA) += sisusbvga/ + +ifeq ($(CONFIG_USB_DEBUG),y) +EXTRA_CFLAGS += -DDEBUG +endif diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c index 5f33f7c6488..2a28ceeaa66 100644 --- a/drivers/usb/misc/auerswald.c +++ b/drivers/usb/misc/auerswald.c @@ -30,7 +30,6 @@ #include #include #include -#undef DEBUG /* include debug macros until it's done */ #include /*-------------------------------------------------------------------*/ diff --git a/drivers/usb/misc/phidgetservo.c b/drivers/usb/misc/phidgetservo.c index b84eda631ab..a30d4a6ee82 100644 --- a/drivers/usb/misc/phidgetservo.c +++ b/drivers/usb/misc/phidgetservo.c @@ -26,9 +26,6 @@ */ #include -#ifdef CONFIG_USB_DEBUG -#define DEBUG 1 -#endif #include #include #include diff --git a/drivers/usb/misc/rio500.c b/drivers/usb/misc/rio500.c index 7d02d8ec6b1..9590dbac5d9 100644 --- a/drivers/usb/misc/rio500.c +++ b/drivers/usb/misc/rio500.c @@ -393,7 +393,7 @@ read_rio(struct file *file, char __user *buffer, size_t count, loff_t * ppos) ibuf, this_read, &partial, 8000); - dbg(KERN_DEBUG "read stats: result:%d this_read:%u partial:%u", + dbg("read stats: result:%d this_read:%u partial:%u", result, this_read, partial); if (partial) { diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c index f6ba4c788db..3c93921cb6b 100644 --- a/drivers/usb/misc/usbled.c +++ b/drivers/usb/misc/usbled.c @@ -10,9 +10,6 @@ */ #include -#ifdef CONFIG_USB_DEBUG - #define DEBUG 1 -#endif #include #include #include diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 2997f558159..605a2afe34e 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c @@ -1,7 +1,4 @@ #include -#if !defined (DEBUG) && defined (CONFIG_USB_DEBUG) -# define DEBUG -#endif #include #include #include diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c index 0592cb5e6c4..1cabe7ed91f 100644 --- a/drivers/usb/misc/uss720.c +++ b/drivers/usb/misc/uss720.c @@ -41,8 +41,6 @@ /*****************************************************************************/ -#define DEBUG - #include #include #include diff --git a/drivers/usb/net/Makefile b/drivers/usb/net/Makefile index 222c0495f79..a21e6eaabaf 100644 --- a/drivers/usb/net/Makefile +++ b/drivers/usb/net/Makefile @@ -16,3 +16,7 @@ obj-$(CONFIG_USB_NET_CDC_SUBSET) += cdc_subset.o obj-$(CONFIG_USB_NET_ZAURUS) += zaurus.o obj-$(CONFIG_USB_USBNET) += usbnet.o obj-$(CONFIG_USB_ZD1201) += zd1201.o + +ifeq ($(CONFIG_USB_DEBUG),y) +EXTRA_CFLAGS += -DDEBUG +endif diff --git a/drivers/usb/net/asix.c b/drivers/usb/net/asix.c index 252a34fbb42..542120ef1fd 100644 --- a/drivers/usb/net/asix.c +++ b/drivers/usb/net/asix.c @@ -23,9 +23,6 @@ // #define VERBOSE // more; success messages #include -#ifdef CONFIG_USB_DEBUG -# define DEBUG -#endif #include #include #include diff --git a/drivers/usb/net/cdc_ether.c b/drivers/usb/net/cdc_ether.c index 652b04bbf6a..c008c981862 100644 --- a/drivers/usb/net/cdc_ether.c +++ b/drivers/usb/net/cdc_ether.c @@ -21,9 +21,6 @@ // #define VERBOSE // more; success messages #include -#ifdef CONFIG_USB_DEBUG -# define DEBUG -#endif #include #include #include diff --git a/drivers/usb/net/cdc_subset.c b/drivers/usb/net/cdc_subset.c index f1730b685fd..f05cfb83c82 100644 --- a/drivers/usb/net/cdc_subset.c +++ b/drivers/usb/net/cdc_subset.c @@ -18,9 +18,6 @@ */ #include -#ifdef CONFIG_USB_DEBUG -# define DEBUG -#endif #include #include #include diff --git a/drivers/usb/net/gl620a.c b/drivers/usb/net/gl620a.c index c0f263b202a..2455e9a8567 100644 --- a/drivers/usb/net/gl620a.c +++ b/drivers/usb/net/gl620a.c @@ -22,9 +22,6 @@ // #define VERBOSE // more; success messages #include -#ifdef CONFIG_USB_DEBUG -# define DEBUG -#endif #include #include #include diff --git a/drivers/usb/net/net1080.c b/drivers/usb/net/net1080.c index cee55f8cf64..b3799b1a2b0 100644 --- a/drivers/usb/net/net1080.c +++ b/drivers/usb/net/net1080.c @@ -21,9 +21,6 @@ // #define VERBOSE // more; success messages #include -#ifdef CONFIG_USB_DEBUG -# define DEBUG -#endif #include #include #include diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c index 537eb181d98..683e3df5d60 100644 --- a/drivers/usb/net/pegasus.c +++ b/drivers/usb/net/pegasus.c @@ -28,8 +28,6 @@ * is out of the interrupt routine. */ -#undef DEBUG - #include #include #include diff --git a/drivers/usb/net/plusb.c b/drivers/usb/net/plusb.c index 74c2b3581c7..89856aa0e3b 100644 --- a/drivers/usb/net/plusb.c +++ b/drivers/usb/net/plusb.c @@ -21,9 +21,6 @@ // #define VERBOSE // more; success messages #include -#ifdef CONFIG_USB_DEBUG -# define DEBUG -#endif #include #include #include diff --git a/drivers/usb/net/rndis_host.c b/drivers/usb/net/rndis_host.c index b5a925dc1be..c0ecbab6f6b 100644 --- a/drivers/usb/net/rndis_host.c +++ b/drivers/usb/net/rndis_host.c @@ -21,9 +21,6 @@ // #define VERBOSE // more; success messages #include -#ifdef CONFIG_USB_DEBUG -# define DEBUG -#endif #include #include #include diff --git a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c index 74f05c9c84d..362d6907c9b 100644 --- a/drivers/usb/net/usbnet.c +++ b/drivers/usb/net/usbnet.c @@ -34,9 +34,6 @@ // #define VERBOSE // more; success messages #include -#ifdef CONFIG_USB_DEBUG -# define DEBUG -#endif #include #include #include diff --git a/drivers/usb/net/zaurus.c b/drivers/usb/net/zaurus.c index 5d4b7d55b09..680d13957af 100644 --- a/drivers/usb/net/zaurus.c +++ b/drivers/usb/net/zaurus.c @@ -21,9 +21,6 @@ // #define VERBOSE // more; success messages #include -#ifdef CONFIG_USB_DEBUG -# define DEBUG -#endif #include #include #include -- cgit v1.2.3 From 2d117403ae4006eeeb9037b82e9ecd8b3b043584 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 17 Nov 2005 09:48:13 -0800 Subject: [PATCH] USB: delete the nokia_dku2 driver It was causing too many problems, and this is not the proper type of driver for this device. Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/serial/Kconfig | 9 --- drivers/usb/serial/Makefile | 1 - drivers/usb/serial/nokia_dku2.c | 142 ---------------------------------------- 3 files changed, 152 deletions(-) delete mode 100644 drivers/usb/serial/nokia_dku2.c (limited to 'drivers') diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig index 7b5e8e4ee2b..9438909e87a 100644 --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig @@ -394,15 +394,6 @@ config USB_SERIAL_MCT_U232 To compile this driver as a module, choose M here: the module will be called mct_u232. -config USB_SERIAL_NOKIA_DKU2 - tristate "USB Nokia DKU2 Driver" - depends on USB_SERIAL - help - Say Y here if you want to use a Nokia DKU2 device. - - To compile this driver as a module, choose M here: the - module will be called nokia_dku2. - config USB_SERIAL_PL2303 tristate "USB Prolific 2303 Single Port Serial Driver" depends on USB_SERIAL diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile index 55fd461793b..6c7cdcc99a9 100644 --- a/drivers/usb/serial/Makefile +++ b/drivers/usb/serial/Makefile @@ -31,7 +31,6 @@ obj-$(CONFIG_USB_SERIAL_KEYSPAN_PDA) += keyspan_pda.o obj-$(CONFIG_USB_SERIAL_KLSI) += kl5kusb105.o obj-$(CONFIG_USB_SERIAL_KOBIL_SCT) += kobil_sct.o obj-$(CONFIG_USB_SERIAL_MCT_U232) += mct_u232.o -obj-$(CONFIG_USB_SERIAL_NOKIA_DKU2) += nokia_dku2.o obj-$(CONFIG_USB_SERIAL_OMNINET) += omninet.o obj-$(CONFIG_USB_SERIAL_OPTION) += option.o obj-$(CONFIG_USB_SERIAL_PL2303) += pl2303.o diff --git a/drivers/usb/serial/nokia_dku2.c b/drivers/usb/serial/nokia_dku2.c deleted file mode 100644 index fad01bef3a6..00000000000 --- a/drivers/usb/serial/nokia_dku2.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Nokia DKU2 USB driver - * - * Copyright (C) 2004 - * Author: C Kemp - * - * This program is largely derived from work by the linux-usb group - * and associated source files. Please see the usb/serial files for - * individual credits and copyrights. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * 20.09.2005 - Matthias Blaesing - * Added short name to device structure to make driver load into kernel 2.6.13 - * - * 20.09.2005 - Matthias Blaesing - * Added usb_deregister to exit code - to allow remove and reinsert of module - */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "usb-serial.h" - - -#define NOKIA_VENDOR_ID 0x0421 -#define NOKIA7600_PRODUCT_ID 0x0400 -#define NOKIA6230_PRODUCT_ID 0x040f -#define NOKIA6170_PRODUCT_ID 0x0416 -#define NOKIA6670_PRODUCT_ID 0x041d -#define NOKIA6680_PRODUCT_ID 0x041e -#define NOKIA6230i_PRODUCT_ID 0x0428 - -#define NOKIA_AT_PORT 0x82 -#define NOKIA_FBUS_PORT 0x86 - -/* - * Version Information - */ -#define DRIVER_VERSION "v0.2" -#define DRIVER_AUTHOR "C Kemp" -#define DRIVER_DESC "Nokia DKU2 Driver" - -static struct usb_device_id id_table [] = { - { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA7600_PRODUCT_ID) }, - { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA6230_PRODUCT_ID) }, - { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA6170_PRODUCT_ID) }, - { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA6670_PRODUCT_ID) }, - { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA6680_PRODUCT_ID) }, - { USB_DEVICE(NOKIA_VENDOR_ID, NOKIA6230i_PRODUCT_ID) }, - { } /* Terminating entry */ -}; -MODULE_DEVICE_TABLE(usb, id_table); - -/* The only thing which makes this device different from a generic - * device is that we have to set an alternative configuration to make - * the relevant endpoints available. In 2.6 this is really easy... */ -static int nokia_probe(struct usb_serial *serial, - const struct usb_device_id *id) -{ - int retval = -ENODEV; - - if (serial->interface->altsetting[0].endpoint[0].desc.bEndpointAddress == NOKIA_AT_PORT) { - /* the AT port */ - dev_info(&serial->dev->dev, "Nokia AT Port:\n"); - retval = 0; - } else if (serial->interface->num_altsetting == 2 && - serial->interface->altsetting[1].endpoint[0].desc.bEndpointAddress == NOKIA_FBUS_PORT) { - /* the FBUS port */ - dev_info(&serial->dev->dev, "Nokia FBUS Port:\n"); - usb_set_interface(serial->dev, 10, 1); - retval = 0; - } - - return retval; -} - -static struct usb_driver nokia_driver = { - .owner = THIS_MODULE, - .name = "nokia_dku2", - .probe = usb_serial_probe, - .disconnect = usb_serial_disconnect, - .id_table = id_table, -}; - -static struct usb_serial_driver nokia_serial_driver = { - .driver = { - .owner = THIS_MODULE, - .name = "nokia_dku2", - }, - .description = "Nokia 7600/6230(i)/6170/66x0 DKU2 driver", - .id_table = id_table, - .num_interrupt_in = 1, - .num_bulk_in = 1, - .num_bulk_out = 1, - .num_ports = 1, - .probe = nokia_probe, -}; - -static int __init nokia_init(void) -{ - int retval; - - retval = usb_serial_register(&nokia_serial_driver); - if (retval) - return retval; - - retval = usb_register(&nokia_driver); - if (retval) { - usb_serial_deregister(&nokia_serial_driver); - return retval; - } - - info(DRIVER_VERSION " " DRIVER_AUTHOR); - info(DRIVER_DESC); - - return retval; -} - -static void __exit nokia_exit(void) -{ - usb_deregister(&nokia_driver); - usb_serial_deregister(&nokia_serial_driver); -} - -module_init(nokia_init); -module_exit(nokia_exit); - -MODULE_AUTHOR(DRIVER_AUTHOR); -MODULE_DESCRIPTION(DRIVER_DESC); -MODULE_LICENSE("GPL"); -- cgit v1.2.3 From bb833986674ce1fc1b237b3d81459511ad2df393 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 17 Nov 2005 09:48:18 -0800 Subject: [PATCH] USB: add the anydata usb-serial driver Signed-off-by: Greg Kroah-Hartman Signed-off-by: Linus Torvalds --- drivers/usb/serial/Kconfig | 9 ++++ drivers/usb/serial/Makefile | 1 + drivers/usb/serial/anydata.c | 123 +++++++++++++++++++++++++++++++++++++++++++ drivers/usb/serial/generic.c | 1 + 4 files changed, 134 insertions(+) create mode 100644 drivers/usb/serial/anydata.c (limited to 'drivers') diff --git a/drivers/usb/serial/Kconfig b/drivers/usb/serial/Kconfig index 9438909e87a..14f55fd26a6 100644 --- a/drivers/usb/serial/Kconfig +++ b/drivers/usb/serial/Kconfig @@ -62,6 +62,15 @@ config USB_SERIAL_AIRPRIME To compile this driver as a module, choose M here: the module will be called airprime. +config USB_SERIAL_ANYDATA + tristate "USB AnyData CDMA Wireless Driver" + depends on USB_SERIAL + help + Say Y here if you want to use a AnyData CDMA device. + + To compile this driver as a module, choose M here: the + module will be called anydata. + config USB_SERIAL_BELKIN tristate "USB Belkin and Peracom Single Port Serial Driver" depends on USB_SERIAL diff --git a/drivers/usb/serial/Makefile b/drivers/usb/serial/Makefile index 6c7cdcc99a9..f0b04420cea 100644 --- a/drivers/usb/serial/Makefile +++ b/drivers/usb/serial/Makefile @@ -12,6 +12,7 @@ usbserial-obj-$(CONFIG_USB_EZUSB) += ezusb.o usbserial-objs := usb-serial.o generic.o bus.o $(usbserial-obj-y) obj-$(CONFIG_USB_SERIAL_AIRPRIME) += airprime.o +obj-$(CONFIG_USB_SERIAL_ANYDATA) += anydata.o obj-$(CONFIG_USB_SERIAL_BELKIN) += belkin_sa.o obj-$(CONFIG_USB_SERIAL_CP2101) += cp2101.o obj-$(CONFIG_USB_SERIAL_CYBERJACK) += cyberjack.o diff --git a/drivers/usb/serial/anydata.c b/drivers/usb/serial/anydata.c new file mode 100644 index 00000000000..18022a74a3d --- /dev/null +++ b/drivers/usb/serial/anydata.c @@ -0,0 +1,123 @@ +/* + * AnyData CDMA Serial USB driver + * + * Copyright (C) 2005 Greg Kroah-Hartman + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License version + * 2 as published by the Free Software Foundation. + */ + +#include +#include +#include +#include +#include +#include "usb-serial.h" + +static struct usb_device_id id_table [] = { + { USB_DEVICE(0x16d5, 0x6501) }, /* AirData CDMA device */ + { }, +}; +MODULE_DEVICE_TABLE(usb, id_table); + +/* if overridden by the user, then use their value for the size of the + * read and write urbs */ +static int buffer_size; +static int debug; + +static struct usb_driver anydata_driver = { + .owner = THIS_MODULE, + .name = "anydata", + .probe = usb_serial_probe, + .disconnect = usb_serial_disconnect, + .id_table = id_table, +}; + +static int anydata_open(struct usb_serial_port *port, struct file *filp) +{ + char *buffer; + int result = 0; + + dbg("%s - port %d", __FUNCTION__, port->number); + + if (buffer_size) { + /* override the default buffer sizes */ + buffer = kmalloc(buffer_size, GFP_KERNEL); + if (!buffer) { + dev_err(&port->dev, "%s - out of memory.\n", + __FUNCTION__); + return -ENOMEM; + } + kfree (port->read_urb->transfer_buffer); + port->read_urb->transfer_buffer = buffer; + port->read_urb->transfer_buffer_length = buffer_size; + + buffer = kmalloc(buffer_size, GFP_KERNEL); + if (!buffer) { + dev_err(&port->dev, "%s - out of memory.\n", + __FUNCTION__); + return -ENOMEM; + } + kfree (port->write_urb->transfer_buffer); + port->write_urb->transfer_buffer = buffer; + port->write_urb->transfer_buffer_length = buffer_size; + port->bulk_out_size = buffer_size; + } + + /* Start reading from the device */ + usb_fill_bulk_urb(port->read_urb, port->serial->dev, + usb_rcvbulkpipe(port->serial->dev, + port->bulk_in_endpointAddress), + port->read_urb->transfer_buffer, + port->read_urb->transfer_buffer_length, + usb_serial_generic_write_bulk_callback, port); + result = usb_submit_urb(port->read_urb, GFP_KERNEL); + if (result) + dev_err(&port->dev, + "%s - failed submitting read urb, error %d\n", + __FUNCTION__, result); + + return result; +} + +static struct usb_serial_driver anydata_device = { + .driver = { + .owner = THIS_MODULE, + .name = "anydata", + }, + .id_table = id_table, + .num_interrupt_in = NUM_DONT_CARE, + .num_bulk_in = NUM_DONT_CARE, + .num_bulk_out = NUM_DONT_CARE, + .num_ports = 1, + .open = anydata_open, +}; + +static int __init anydata_init(void) +{ + int retval; + + retval = usb_serial_register(&anydata_device); + if (retval) + return retval; + retval = usb_register(&anydata_driver); + if (retval) + usb_serial_deregister(&anydata_device); + return retval; +} + +static void __exit anydata_exit(void) +{ + usb_deregister(&anydata_driver); + usb_serial_deregister(&anydata_device); +} + +module_init(anydata_init); +module_exit(anydata_exit); +MODULE_LICENSE("GPL"); + +module_param(debug, bool, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(debug, "Debug enabled or not"); +module_param(buffer_size, int, 0); +MODULE_PARM_DESC(buffer_size, "Size of the transfer buffers"); diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 8909208f506..53a47c31cd0 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c @@ -309,6 +309,7 @@ void usb_serial_generic_write_bulk_callback (struct urb *urb, struct pt_regs *re schedule_work(&port->work); } +EXPORT_SYMBOL_GPL(usb_serial_generic_write_bulk_callback); void usb_serial_generic_shutdown (struct usb_serial *serial) { -- cgit v1.2.3 From c2ab64d09815cc4d48347ee3679658f197455a2a Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Thu, 17 Nov 2005 16:28:37 -0500 Subject: [PARISC] Add IRQ affinities This really only adds them for the machines I can check SMP on, which is CPU interrupts and IOSAPIC (so not any of the GSC based machines). With this patch, irqbalanced can be used to maintain irq balancing. Unfortunately, irqbalanced is a bit x86 centric, so it doesn't do an incredibly good job, but it does work. Signed-off-by: James Bottomley Signed-off-by: Kyle McMartin --- drivers/parisc/iosapic.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/parisc/iosapic.c b/drivers/parisc/iosapic.c index a39fbfef789..19657efa8dc 100644 --- a/drivers/parisc/iosapic.c +++ b/drivers/parisc/iosapic.c @@ -700,6 +700,28 @@ static unsigned int iosapic_startup_irq(unsigned int irq) return 0; } +#ifdef CONFIG_SMP +static void iosapic_set_affinity_irq(unsigned int irq, cpumask_t dest) +{ + struct vector_info *vi = iosapic_get_vector(irq); + u32 d0, d1, dummy_d0; + unsigned long flags; + + if (cpu_check_affinity(irq, &dest)) + return; + + vi->txn_addr = txn_affinity_addr(irq, first_cpu(dest)); + + spin_lock_irqsave(&iosapic_lock, flags); + /* d1 contains the destination CPU, so only want to set that + * entry */ + iosapic_rd_irt_entry(vi, &d0, &d1); + iosapic_set_irt_data(vi, &dummy_d0, &d1); + iosapic_wr_irt_entry(vi, d0, d1); + spin_unlock_irqrestore(&iosapic_lock, flags); +} +#endif + static struct hw_interrupt_type iosapic_interrupt_type = { .typename = "IO-SAPIC-level", .startup = iosapic_startup_irq, @@ -708,7 +730,9 @@ static struct hw_interrupt_type iosapic_interrupt_type = { .disable = iosapic_disable_irq, .ack = no_ack_irq, .end = iosapic_end_irq, -// .set_affinity = iosapic_set_affinity_irq, +#ifdef CONFIG_SMP + .set_affinity = iosapic_set_affinity_irq, +#endif }; int iosapic_fixup_irq(void *isi_obj, struct pci_dev *pcidev) -- cgit v1.2.3 From 92495c0ebc99ee00651571cba6939783234f7696 Mon Sep 17 00:00:00 2001 From: Ryan Bradetich Date: Thu, 17 Nov 2005 16:36:52 -0500 Subject: [PARISC] Compile fixups for serial/mux.c This patch does the following: * Fixes compiler warnings. * Replaces a __raw_readl call with the existing macro. Signed-off-by: Ryan Bradetich Signed-off-by: Kyle McMartin --- drivers/serial/mux.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'drivers') diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c index 660bae5ba17..36e3bcb1ebf 100644 --- a/drivers/serial/mux.c +++ b/drivers/serial/mux.c @@ -65,8 +65,8 @@ static struct uart_driver mux_driver = { static struct timer_list mux_timer; -#define UART_PUT_CHAR(p, c) __raw_writel((c), (unsigned long)(p)->membase + IO_DATA_REG_OFFSET) -#define UART_GET_FIFO_CNT(p) __raw_readl((unsigned long)(p)->membase + IO_DCOUNT_REG_OFFSET) +#define UART_PUT_CHAR(p, c) __raw_writel((c), (p)->membase + IO_DATA_REG_OFFSET) +#define UART_GET_FIFO_CNT(p) __raw_readl((p)->membase + IO_DCOUNT_REG_OFFSET) #define GET_MUX_PORTS(iodc_data) ((((iodc_data)[4] & 0xf0) >> 4) * 8) + 8 /** @@ -79,10 +79,7 @@ static struct timer_list mux_timer; */ static unsigned int mux_tx_empty(struct uart_port *port) { - unsigned int cnt = __raw_readl((unsigned long)port->membase - + IO_DCOUNT_REG_OFFSET); - - return cnt ? 0 : TIOCSER_TEMT; + return UART_GET_FIFO_CNT(port) ? 0 : TIOCSER_TEMT; } /** @@ -218,8 +215,7 @@ static void mux_read(struct uart_port *port) __u32 start_count = port->icount.rx; while(1) { - data = __raw_readl((unsigned long)port->membase - + IO_DATA_REG_OFFSET); + data = __raw_readl(port->membase + IO_DATA_REG_OFFSET); if (MUX_STATUS(data)) continue; -- cgit v1.2.3 From a137ce8536f6124c42ac300be01b9b611c7db5a1 Mon Sep 17 00:00:00 2001 From: Ryan Bradetich Date: Thu, 17 Nov 2005 16:38:28 -0500 Subject: [PARISC] Define port->timeout to fix a long msleep in mux.c This commit is in response to a bug reported by Vesa on the irc channel a couple of weeks ago. The bug was that the console would apparently hang (not return) while using the mux console. The root cause of this bug is that bash (with readline support) makes a call to the tcsetattr() glibc function with the argument TCSADRAIN. This causes the serial core in the kernel use the uart_wait_until_sent() to be called. This function verifies the mux transmit queue is empty or calls the msleep_interruptable() with a calculated timeout value that is dependant upon the port->timeout variable. The real problem here is that the port->timeout was not defined so it was defaulted to 0 and the timeout calculation performs the following calculation: char_time = (port->timeout - HZ/50) / port->fifosize; where char_time is an unsigned long. Since the serial Mux does not use interrupts, the msleep_interruptable() function waits until the timeout has been reached ... and when the port->timeout < HZ/50 this timeout will be a long time. (I have validated that the console will eventually return ... but it takes quite a while for this to happen). This patch simply sets the port->timeout on the Mux to HZ/50 to avoid this long timeout period. Signed-off-by: Ryan Bradetich Signed-off-by: Kyle McMartin --- drivers/serial/mux.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'drivers') diff --git a/drivers/serial/mux.c b/drivers/serial/mux.c index 36e3bcb1ebf..7633132a10a 100644 --- a/drivers/serial/mux.c +++ b/drivers/serial/mux.c @@ -477,6 +477,13 @@ static int __init mux_probe(struct parisc_device *dev) port->ops = &mux_pops; port->flags = UPF_BOOT_AUTOCONF; port->line = port_cnt; + + /* The port->timeout needs to match what is present in + * uart_wait_until_sent in serial_core.c. Otherwise + * the time spent in msleep_interruptable will be very + * long, causing the appearance of a console hang. + */ + port->timeout = HZ / 50; spin_lock_init(&port->lock); status = uart_add_one_port(&mux_driver, port); BUG_ON(status); -- cgit v1.2.3 From a39cf72ceb406e152c4682c0b635a96f1439c5ed Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Thu, 17 Nov 2005 16:44:57 -0500 Subject: [PARISC] Make superio.c initialize before any driver needs it Convert superio_init to use PCI_FIXUP_FINAL as ohci_pci being called before superio_probe really makes a mess. superio_init will then fail to register irq 20 (the "SuperIO" irq) and BUG() because ohci_pci has stolen it before superio_fixup_irq can be moved USB to irq 1. Signed-off-by: Kyle McMartin --- drivers/parisc/superio.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'drivers') diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c index bab3bcabcb6..d14888e149b 100644 --- a/drivers/parisc/superio.c +++ b/drivers/parisc/superio.c @@ -24,6 +24,9 @@ * Major changes to get basic interrupt infrastructure working to * hopefully be able to support all SuperIO devices. Currently * works with serial. -- John Marvin + * + * Converted superio_init() to be a PCI_FIXUP_FINAL callee. + * -- Kyle McMartin */ @@ -141,10 +144,10 @@ superio_interrupt(int parent_irq, void *devp, struct pt_regs *regs) } /* Initialize Super I/O device */ - -static void __devinit -superio_init(struct superio_device *sio) +static void +superio_init(struct pci_dev *pcidev) { + struct superio_device *sio = &sio_dev; struct pci_dev *pdev = sio->lio_pdev; u16 word; @@ -160,8 +163,8 @@ superio_init(struct superio_device *sio) /* ...then properly fixup the USB to point at suckyio PIC */ sio->usb_pdev->irq = superio_fixup_irq(sio->usb_pdev); - printk (KERN_INFO "SuperIO: Found NS87560 Legacy I/O device at %s (IRQ %i) \n", - pci_name(pdev),pdev->irq); + printk(KERN_INFO "SuperIO: Found NS87560 Legacy I/O device at %s (IRQ %i) \n", + pci_name(pdev), pdev->irq); pci_read_config_dword (pdev, SIO_SP1BAR, &sio->sp1_base); sio->sp1_base &= ~1; @@ -274,7 +277,7 @@ superio_init(struct superio_device *sio) sio->suckyio_irq_enabled = 1; } - +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87560_LIO, superio_init); static void superio_disable_irq(unsigned int irq) { @@ -452,8 +455,10 @@ static void superio_fixup_pci(struct pci_dev *pdev) DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87415, superio_fixup_pci); -static int __devinit superio_probe(struct pci_dev *dev, const struct pci_device_id *id) +static int __devinit +superio_probe(struct pci_dev *dev, const struct pci_device_id *id) { + struct superio_device *sio = &sio_dev; /* ** superio_probe(00:0e.0) ven 0x100b dev 0x2 sv 0x0 sd 0x0 class 0x1018a @@ -466,7 +471,8 @@ static int __devinit superio_probe(struct pci_dev *dev, const struct pci_device_ dev->subsystem_vendor, dev->subsystem_device, dev->class); - superio_init(&sio_dev); + if (!sio->suckyio_irq_enabled) + BUG(); /* Enabled by PCI_FIXUP_FINAL */ if (dev->device == PCI_DEVICE_ID_NS_87560_LIO) { /* Function 1 */ superio_parport_init(); @@ -481,19 +487,21 @@ static int __devinit superio_probe(struct pci_dev *dev, const struct pci_device_ DBG_INIT("superio_probe: WTF? Fire Extinguisher?\n"); } - /* Let appropriate other driver claim this device. */ + /* Let appropriate other driver claim this device. */ return -ENODEV; } static struct pci_device_id superio_tbl[] = { - { PCI_VENDOR_ID_NS, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87560_LIO) }, + { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87560_USB) }, + { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_87415) }, { 0, } }; static struct pci_driver superio_driver = { - .name = "SuperIO", - .id_table = superio_tbl, - .probe = superio_probe, + .name = "SuperIO", + .id_table = superio_tbl, + .probe = superio_probe, }; static int __init superio_modinit(void) @@ -506,6 +514,5 @@ static void __exit superio_exit(void) pci_unregister_driver(&superio_driver); } - module_init(superio_modinit); module_exit(superio_exit); -- cgit v1.2.3 From f365cfd0d8b6d8fb3583d23d48f54efa88ee8563 Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Fri, 18 Nov 2005 16:41:49 +1100 Subject: offb: Fix compile error on ppc32 systems The code Ben H added needs for things like pci_dev, etc. Signed-off-by: Paul Mackerras --- drivers/video/offb.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers') diff --git a/drivers/video/offb.c b/drivers/video/offb.c index fe8ba364b3e..00d87f5bb7b 100644 --- a/drivers/video/offb.c +++ b/drivers/video/offb.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include -- cgit v1.2.3 From 2203d6ed448ff3b777ee6bb614a53e686b483e5b Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 18 Nov 2005 07:29:51 -0800 Subject: Fix ACPI processor power block initialization Properly clear the memory, and set "pr->flags.power" only if a C2 or deeper state is valid (to make the code match both the comment and previous behaviour). This fixes a boot-time lockup reported by Maneesh Soni when using "maxcpus=1". Acked-by: Maneesh Soni Signed-off-by: Linus Torvalds --- drivers/acpi/processor_idle.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'drivers') diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 573b6a97bb1..70d8a6ec092 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -514,8 +514,6 @@ static int acpi_processor_set_power_policy(struct acpi_processor *pr) static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) { - int i; - ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_fadt"); if (!pr) @@ -524,8 +522,7 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) if (!pr->pblk) return_VALUE(-ENODEV); - for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) - memset(pr->power.states, 0, sizeof(struct acpi_processor_cx)); + memset(pr->power.states, 0, sizeof(pr->power.states)); /* if info is obtained from pblk/fadt, type equals state */ pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; @@ -555,13 +552,9 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr) static int acpi_processor_get_power_info_default_c1(struct acpi_processor *pr) { - int i; - ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1"); - for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) - memset(&(pr->power.states[i]), 0, - sizeof(struct acpi_processor_cx)); + memset(pr->power.states, 0, sizeof(pr->power.states)); /* if info is obtained from pblk/fadt, type equals state */ pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; @@ -873,7 +866,8 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr) for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) { if (pr->power.states[i].valid) { pr->power.count = i; - pr->flags.power = 1; + if (pr->power.states[i].type >= ACPI_STATE_C2) + pr->flags.power = 1; } } -- cgit v1.2.3 From 2463ade2cb78224302998ee3c7dc7d53da88d258 Mon Sep 17 00:00:00 2001 From: Andrey Volkov Date: Fri, 18 Nov 2005 01:10:48 -0800 Subject: [PATCH] Fix copy-paste bug in ohci-ppc-soc.c Fix copy-paste bug in ohci-ppc-soc.c(ohci_hcd_ppc_soc_drv_remove) Signed-off-by: Andrey Volkov Cc: Russell King Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/usb/host/ohci-ppc-soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/usb/host/ohci-ppc-soc.c b/drivers/usb/host/ohci-ppc-soc.c index 18755766e40..2ec6a78bd65 100644 --- a/drivers/usb/host/ohci-ppc-soc.c +++ b/drivers/usb/host/ohci-ppc-soc.c @@ -185,7 +185,7 @@ static int ohci_hcd_ppc_soc_drv_probe(struct platform_device *pdev) static int ohci_hcd_ppc_soc_drv_remove(struct platform_device *pdev) { - struct usb_hcd *hcd = platform_get_drvdata(dev); + struct usb_hcd *hcd = platform_get_drvdata(pdev); usb_hcd_ppc_soc_remove(hcd, pdev); return 0; -- cgit v1.2.3 From 44f080c46e84090daf81b4d142359f8e38d7c5ee Mon Sep 17 00:00:00 2001 From: Matt Domsch Date: Fri, 18 Nov 2005 01:10:54 -0800 Subject: [PATCH] ipmi: missing NULL test for kthread On IPMI systems with BT interfaces, we don't start the kernel thread, so smi_info->thread is NULL. Test for NULL when stopping the thread, because kthread_stop() doesn't, and an oops ensues otherwise. Signed-off-by: Matt Domsch Acked-by: Corey Minyard Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/char/ipmi/ipmi_si_intf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index ea89dca3dbb..01a1f6badb5 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c @@ -2203,7 +2203,7 @@ static void setup_xaction_handlers(struct smi_info *smi_info) static inline void wait_for_timer_and_thread(struct smi_info *smi_info) { - if (smi_info->thread != ERR_PTR(-ENOMEM)) + if (smi_info->thread != NULL && smi_info->thread != ERR_PTR(-ENOMEM)) kthread_stop(smi_info->thread); del_timer_sync(&smi_info->si_timer); } -- cgit v1.2.3 From ba3961152e7016237e15e3dfc18f08c1853d156b Mon Sep 17 00:00:00 2001 From: Kylene Jo Hall Date: Fri, 18 Nov 2005 01:10:57 -0800 Subject: [PATCH] tpm: use flush_scheduled_work() Add the necessary flush_schedule_work calls when canceling the timer. Signed-off-by: Kylene Hall Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/char/tpm/tpm.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers') diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index 0b283d24673..a9be0e8eaea 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c @@ -377,6 +377,7 @@ int tpm_release(struct inode *inode, struct file *file) file->private_data = NULL; chip->num_opens--; del_singleshot_timer_sync(&chip->user_read_timer); + flush_scheduled_work(); atomic_set(&chip->data_pending, 0); put_device(chip->dev); kfree(chip->data_buffer); @@ -428,6 +429,7 @@ ssize_t tpm_read(struct file * file, char __user *buf, int ret_size; del_singleshot_timer_sync(&chip->user_read_timer); + flush_scheduled_work(); ret_size = atomic_read(&chip->data_pending); atomic_set(&chip->data_pending, 0); if (ret_size > 0) { /* relay data */ -- cgit v1.2.3 From 90612b308f2a2cc8aa08fbaf6f7184f5b7b5a855 Mon Sep 17 00:00:00 2001 From: Kylene Jo Hall Date: Fri, 18 Nov 2005 01:10:58 -0800 Subject: [PATCH] tpm: use ioread8 and iowrite8 Use ioread8 and iowrite8 as suggested. Signed-off-by: Kylene Hall Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/char/tpm/tpm_atmel.c | 47 ++++++++++++++++++++++++-------------------- drivers/char/tpm/tpm_atmel.h | 22 +++++++++++---------- 2 files changed, 38 insertions(+), 31 deletions(-) (limited to 'drivers') diff --git a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel.c index deb4b5c8091..ff3654964fe 100644 --- a/drivers/char/tpm/tpm_atmel.c +++ b/drivers/char/tpm/tpm_atmel.c @@ -47,13 +47,12 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count) return -EIO; for (i = 0; i < 6; i++) { - status = atmel_getb(chip, 1); + status = ioread8(chip->vendor->iobase + 1); if ((status & ATML_STATUS_DATA_AVAIL) == 0) { - dev_err(chip->dev, - "error reading header\n"); + dev_err(chip->dev, "error reading header\n"); return -EIO; } - *buf++ = atmel_getb(chip, 0); + *buf++ = ioread8(chip->vendor->iobase); } /* size of the data received */ @@ -64,10 +63,9 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count) dev_err(chip->dev, "Recv size(%d) less than available space\n", size); for (; i < size; i++) { /* clear the waiting data anyway */ - status = atmel_getb(chip, 1); + status = ioread8(chip->vendor->iobase + 1); if ((status & ATML_STATUS_DATA_AVAIL) == 0) { - dev_err(chip->dev, - "error reading data\n"); + dev_err(chip->dev, "error reading data\n"); return -EIO; } } @@ -76,17 +74,17 @@ static int tpm_atml_recv(struct tpm_chip *chip, u8 *buf, size_t count) /* read all the data available */ for (; i < size; i++) { - status = atmel_getb(chip, 1); + status = ioread8(chip->vendor->iobase + 1); if ((status & ATML_STATUS_DATA_AVAIL) == 0) { - dev_err(chip->dev, - "error reading data\n"); + dev_err(chip->dev, "error reading data\n"); return -EIO; } - *buf++ = atmel_getb(chip, 0); + *buf++ = ioread8(chip->vendor->iobase); } /* make sure data available is gone */ - status = atmel_getb(chip, 1); + status = ioread8(chip->vendor->iobase + 1); + if (status & ATML_STATUS_DATA_AVAIL) { dev_err(chip->dev, "data available is stuck\n"); return -EIO; @@ -102,7 +100,7 @@ static int tpm_atml_send(struct tpm_chip *chip, u8 *buf, size_t count) dev_dbg(chip->dev, "tpm_atml_send:\n"); for (i = 0; i < count; i++) { dev_dbg(chip->dev, "%d 0x%x(%d)\n", i, buf[i], buf[i]); - atmel_putb(buf[i], chip, 0); + iowrite8(buf[i], chip->vendor->iobase); } return count; @@ -110,12 +108,12 @@ static int tpm_atml_send(struct tpm_chip *chip, u8 *buf, size_t count) static void tpm_atml_cancel(struct tpm_chip *chip) { - atmel_putb(ATML_STATUS_ABORT, chip, 1); + iowrite8(ATML_STATUS_ABORT, chip->vendor->iobase + 1); } static u8 tpm_atml_status(struct tpm_chip *chip) { - return atmel_getb(chip, 1); + return ioread8(chip->vendor->iobase + 1); } static struct file_operations atmel_ops = { @@ -162,7 +160,8 @@ static void atml_plat_remove(void) if (chip) { if (chip->vendor->have_region) - atmel_release_region(chip->vendor->base, chip->vendor->region_size); + atmel_release_region(chip->vendor->base, + chip->vendor->region_size); atmel_put_base_addr(chip->vendor); tpm_remove_hardware(chip->dev); platform_device_unregister(pdev); @@ -183,14 +182,19 @@ static int __init init_atmel(void) driver_register(&atml_drv); - if (atmel_get_base_addr(&tpm_atmel) != 0) { + if ((tpm_atmel.iobase = atmel_get_base_addr(&tpm_atmel)) == NULL) { rc = -ENODEV; goto err_unreg_drv; } - tpm_atmel.have_region = (atmel_request_region( tpm_atmel.base, tpm_atmel.region_size, "tpm_atmel0") == NULL) ? 0 : 1; + tpm_atmel.have_region = + (atmel_request_region + (tpm_atmel.base, tpm_atmel.region_size, + "tpm_atmel0") == NULL) ? 0 : 1; - if (IS_ERR(pdev = platform_device_register_simple("tpm_atmel", -1, NULL, 0 ))) { + if (IS_ERR + (pdev = + platform_device_register_simple("tpm_atmel", -1, NULL, 0))) { rc = PTR_ERR(pdev); goto err_rel_reg; } @@ -202,9 +206,10 @@ static int __init init_atmel(void) err_unreg_dev: platform_device_unregister(pdev); err_rel_reg: - if (tpm_atmel.have_region) - atmel_release_region(tpm_atmel.base, tpm_atmel.region_size); atmel_put_base_addr(&tpm_atmel); + if (tpm_atmel.have_region) + atmel_release_region(tpm_atmel.base, + tpm_atmel.region_size); err_unreg_drv: driver_unregister(&atml_drv); return rc; diff --git a/drivers/char/tpm/tpm_atmel.h b/drivers/char/tpm/tpm_atmel.h index 3c5b9a8d1c4..d3478aaadd7 100644 --- a/drivers/char/tpm/tpm_atmel.h +++ b/drivers/char/tpm/tpm_atmel.h @@ -27,12 +27,14 @@ #define atmel_putb(val, chip, offset) writeb(val, chip->vendor->iobase + offset) #define atmel_request_region request_mem_region #define atmel_release_region release_mem_region -static inline void atmel_put_base_addr(struct tpm_vendor_specific *vendor) + +static inline void atmel_put_base_addr(struct tpm_vendor_specific + *vendor) { iounmap(vendor->iobase); } -static int atmel_get_base_addr(struct tpm_vendor_specific *vendor) +static void __iomem * atmel_get_base_addr(struct tpm_vendor_specific *vendor) { struct device_node *dn; unsigned long address, size; @@ -44,11 +46,11 @@ static int atmel_get_base_addr(struct tpm_vendor_specific *vendor) dn = of_find_node_by_name(NULL, "tpm"); if (!dn) - return 1; + return NULL; if (!device_is_compatible(dn, "AT97SC3201")) { of_node_put(dn); - return 1; + return NULL; } reg = (unsigned int *) get_property(dn, "reg", ®len); @@ -71,8 +73,7 @@ static int atmel_get_base_addr(struct tpm_vendor_specific *vendor) vendor->base = address; vendor->region_size = size; - vendor->iobase = ioremap(address, size); - return 0; + return ioremap(vendor->base, vendor->region_size); } #else #define atmel_getb(chip, offset) inb(chip->vendor->base + offset) @@ -105,18 +106,19 @@ static int atmel_verify_tpm11(void) return 0; } -static inline void atmel_put_base_addr(struct tpm_vendor_specific *vendor) +static inline void atmel_put_base_addr(struct tpm_vendor_specific + *vendor) { } /* Determine where to talk to device */ -static unsigned long atmel_get_base_addr(struct tpm_vendor_specific +static void __iomem * atmel_get_base_addr(struct tpm_vendor_specific *vendor) { int lo, hi; if (atmel_verify_tpm11() != 0) - return 1; + return NULL; lo = tpm_read_index(TPM_ADDR, TPM_ATMEL_BASE_ADDR_LO); hi = tpm_read_index(TPM_ADDR, TPM_ATMEL_BASE_ADDR_HI); @@ -124,6 +126,6 @@ static unsigned long atmel_get_base_addr(struct tpm_vendor_specific vendor->base = (hi << 8) | lo; vendor->region_size = 2; - return 0; + return ioport_map(vendor->base, vendor->region_size); } #endif -- cgit v1.2.3 From c4b32b8b010d036dc03f77b0ef2a747db0cc3588 Mon Sep 17 00:00:00 2001 From: Kylene Jo Hall Date: Fri, 18 Nov 2005 01:10:59 -0800 Subject: [PATCH] tpm: remove PCI kconfig dependency The driver dependencies on PCI have been removed. This patch clears that up in the Kconfig file Signed-off-by: Kylene Hall Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/char/tpm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig index b58adfe3ed1..a6873bf89ff 100644 --- a/drivers/char/tpm/Kconfig +++ b/drivers/char/tpm/Kconfig @@ -6,7 +6,7 @@ menu "TPM devices" config TCG_TPM tristate "TPM Hardware Support" - depends on EXPERIMENTAL && PCI + depends on EXPERIMENTAL ---help--- If you have a TPM security chip in your system, which implements the Trusted Computing Group's specification, -- cgit v1.2.3 From 34ef75f09f09611b62ae11ae36c3c7b0a6a8a9cb Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Fri, 18 Nov 2005 01:10:59 -0800 Subject: [PATCH] md: don't pass a NULL file* into ->prepare_write() Some filesystems go oops. Signed-off-by: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/md/bitmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index 51315302a85..252d55df964 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c @@ -326,9 +326,9 @@ static int write_page(struct bitmap *bitmap, struct page *page, int wait) } } - ret = page->mapping->a_ops->prepare_write(NULL, page, 0, PAGE_SIZE); + ret = page->mapping->a_ops->prepare_write(bitmap->file, page, 0, PAGE_SIZE); if (!ret) - ret = page->mapping->a_ops->commit_write(NULL, page, 0, + ret = page->mapping->a_ops->commit_write(bitmap->file, page, 0, PAGE_SIZE); if (ret) { unlock_page(page); -- cgit v1.2.3 From c0e485216de80046dd0d448b7cd530dbfc31402f Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Fri, 18 Nov 2005 01:11:01 -0800 Subject: [PATCH] md: fix is_mddev_idle calculation now that disk/sector accounting happens when request completes md needs to monitor the rate of requests to its devices when doing resync/recovery so that it can back-off when there is non-resync IO. It does this by comparing resync IO, which it counts, with total IO which is taken from disk_stats. disk_stats were recently changed to account sectors when a request completes instead of when it is queued. This upsets md's calculations. We could do the sync_io accounting at the end of requests too, but that has problems. If an underlying device is an md array, the accounting will still be done when the request is submitted. This could be changed for some raid levels, but it cannot be changed for raid0 or linear without substantial code changes. So instead, we increase the error that is_mddev_idle allows, up to the maximum amount of resync IO that can be in flight at any time. The calculation is current fragile as each personality as different limits for in-flight resync. This should be fixed up. For now, this simple patch fixes the problem. Increasing the error margin decreases the sensitivity to non-resync IO. To partially compensate for this, the time to wait when non-resync IO is detected is increased so that less steady IO is required to keep the resync at bay. Signed-off-by: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/md/md.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/md/md.c b/drivers/md/md.c index f3fed662f32..78c7418478d 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -3846,11 +3846,20 @@ static int is_mddev_idle(mddev_t *mddev) curr_events = disk_stat_read(disk, sectors[0]) + disk_stat_read(disk, sectors[1]) - atomic_read(&disk->sync_io); - /* Allow some slack between valud of curr_events and last_events, - * as there are some uninteresting races. + /* The difference between curr_events and last_events + * will be affected by any new non-sync IO (making + * curr_events bigger) and any difference in the amount of + * in-flight syncio (making current_events bigger or smaller) + * The amount in-flight is currently limited to + * 32*64K in raid1/10 and 256*PAGE_SIZE in raid5/6 + * which is at most 4096 sectors. + * These numbers are fairly fragile and should be made + * more robust, probably by enforcing the + * 'window size' that md_do_sync sort-of uses. + * * Note: the following is an unsigned comparison. */ - if ((curr_events - rdev->last_events + 32) > 64) { + if ((curr_events - rdev->last_events + 4096) > 8192) { rdev->last_events = curr_events; idle = 0; } @@ -4109,7 +4118,7 @@ static void md_do_sync(mddev_t *mddev) if (currspeed > sysctl_speed_limit_min) { if ((currspeed > sysctl_speed_limit_max) || !is_mddev_idle(mddev)) { - msleep(250); + msleep(500); goto repeat; } } -- cgit v1.2.3 From fc71fe40d2bedcc57d3406bf2050481f8b3441b6 Mon Sep 17 00:00:00 2001 From: Martin Schwidefsky Date: Fri, 18 Nov 2005 01:11:03 -0800 Subject: [PATCH] s390: fix class_device_create calls in 3270 the driver Add the missing NULL argument to the class_device_create calls. Signed-off-by: Martin Schwidefsky Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/s390/char/raw3270.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c index f5b7d360fc1..1026f2bc318 100644 --- a/drivers/s390/char/raw3270.c +++ b/drivers/s390/char/raw3270.c @@ -1179,12 +1179,12 @@ raw3270_create_attributes(struct raw3270 *rp) //FIXME: check return code sysfs_create_group(&rp->cdev->dev.kobj, &raw3270_attr_group); rp->clttydev = - class_device_create(class3270, + class_device_create(class3270, NULL, MKDEV(IBM_TTY3270_MAJOR, rp->minor), &rp->cdev->dev, "tty%s", rp->cdev->dev.bus_id); rp->cltubdev = - class_device_create(class3270, + class_device_create(class3270, NULL, MKDEV(IBM_FS3270_MAJOR, rp->minor), &rp->cdev->dev, "tub%s", rp->cdev->dev.bus_id); -- cgit v1.2.3 From 5d0571d915f3e281f151df9a18a6a0be5a57c4b0 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Thu, 17 Nov 2005 14:02:48 -0500 Subject: [PATCH] smc91x: fix one source of spurious interrupts Not only SMC_ACK_INT(IM_TX_EMPTY_INT) in in smc_hardware_send_pkt) appears to be unnecessary (tested with an SMC91C94 and SMC91C111), but it seems to trigger spurious interrupts on some machines as well. Removed. While at it, let's log any remaining spurious interrupts if any (and clean usage of the max IRQ loop count value). Signed-off-by: Nicolas Pitre Signed-off-by: Jeff Garzik --- drivers/net/smc91x.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index c91e2e81f13..1021108e9a2 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c @@ -154,6 +154,12 @@ MODULE_LICENSE("GPL"); */ #define MEMORY_WAIT_TIME 16 +/* + * The maximum number of processing loops allowed for each call to the + * IRQ handler. + */ +#define MAX_IRQ_LOOPS 8 + /* * This selects whether TX packets are sent one by one to the SMC91x internal * memory and throttled until transmission completes. This may prevent @@ -684,7 +690,6 @@ static void smc_hardware_send_pkt(unsigned long data) /* queue the packet for TX */ SMC_SET_MMU_CMD(MC_ENQUEUE); - SMC_ACK_INT(IM_TX_EMPTY_INT); smc_special_unlock(&lp->lock); dev->trans_start = jiffies; @@ -1305,7 +1310,7 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id, struct pt_regs *regs) SMC_SET_INT_MASK(0); /* set a timeout value, so I don't stay here forever */ - timeout = 8; + timeout = MAX_IRQ_LOOPS; do { status = SMC_GET_INT(); @@ -1372,10 +1377,13 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id, struct pt_regs *regs) /* restore register states */ SMC_SET_PTR(saved_pointer); SMC_SET_INT_MASK(mask); - spin_unlock(&lp->lock); - DBG(3, "%s: Interrupt done (%d loops)\n", dev->name, 8-timeout); + if (timeout == MAX_IRQ_LOOPS) + PRINTK("%s: spurious interrupt (mask = 0x%02x)\n", + dev->name, mask); + DBG(3, "%s: Interrupt done (%d loops)\n", + dev->name, MAX_IRQ_LOOPS - timeout); /* * We return IRQ_HANDLED unconditionally here even if there was -- cgit v1.2.3 From e52542443aa9be15439e9879baf6d41b290e94db Mon Sep 17 00:00:00 2001 From: Russell King Date: Fri, 18 Nov 2005 12:57:55 -0500 Subject: [PATCH] smc91x: fix bank mismatch The smc91x driver relies upon register bank 2 being selected whenever the interrupt handler is called. This isn't always so, especially if we have a link change event during PHY configuration. This results in register bank 0 being selected when the interrupt handler is called, causing the wrong registers to be read for the IRQ mask and status. In turn, this causes us to spin with a permanently asserted IRQ. The patch ensures that smc_phy_configure always exits with register bank 2 selected. Signed-off-by: Russell King Signed-off-by: Nicolas Pitre Signed-off-by: Jeff Garzik --- drivers/net/smc91x.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers') diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index 1021108e9a2..28bf2e69eb5 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c @@ -1212,6 +1212,7 @@ static void smc_phy_configure(void *data) smc_phy_check_media(dev, 1); smc_phy_configure_exit: + SMC_SELECT_BANK(2); spin_unlock_irq(&lp->lock); lp->work_pending = 0; } -- cgit v1.2.3 From 7d1ce682d08625258524d23ef5eb9e7ae261c1d0 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Fri, 18 Nov 2005 14:09:05 +0900 Subject: [PATCH] sil24: add sil24_restart_controller When an error condition is raised by device via D2H FIS or SDB. sil24 controller should be restarted by setting PORT_CS_INIT and waiting until PORT_CS_RDY is asserted instead of resetting the controller. This patch implements sil24_restart_controller for those cases. This patch also makes sure that PORT_CS_RDY is asserted on sil24_reset_controller completion. Signed-off-by: Tejun Heo -- Jeff, delay is reduced to 1us and cnt increased to 10k. My sil3124 turns on PORT_CS_RDY on the second iteration even without any delay. I think 10k * 1us should be more than enough. I tried to convert both restart and reset to use msleep's with work queue, but if we do that, host_set lock should be released after initiating restart or reset, leading to race condition among reset/restart, other interrupts and timeout. Implementing synchronization among those in low-level driver doesn't seem right. Well, reduced timeout should work for the time being. Thanks. Signed-off-by: Jeff Garzik --- drivers/scsi/sata_sil24.c | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c index cb1933a3bd5..a6836a07a9e 100644 --- a/drivers/scsi/sata_sil24.c +++ b/drivers/scsi/sata_sil24.c @@ -486,6 +486,31 @@ static void sil24_irq_clear(struct ata_port *ap) /* unused */ } +static int __sil24_restart_controller(void __iomem *port) +{ + u32 tmp; + int cnt; + + writel(PORT_CS_INIT, port + PORT_CTRL_STAT); + + /* Max ~10ms */ + for (cnt = 0; cnt < 10000; cnt++) { + tmp = readl(port + PORT_CTRL_STAT); + if (tmp & PORT_CS_RDY) + return 0; + udelay(1); + } + + return -1; +} + +static void sil24_restart_controller(struct ata_port *ap) +{ + if (__sil24_restart_controller((void __iomem *)ap->ioaddr.cmd_addr)) + printk(KERN_ERR DRV_NAME + " ata%u: failed to restart controller\n", ap->id); +} + static int __sil24_reset_controller(void __iomem *port) { int cnt; @@ -505,7 +530,11 @@ static int __sil24_reset_controller(void __iomem *port) if (tmp & PORT_CS_DEV_RST) return -1; - return 0; + + if (tmp & PORT_CS_RDY) + return 0; + + return __sil24_restart_controller(port); } static void sil24_reset_controller(struct ata_port *ap) @@ -577,6 +606,7 @@ static void sil24_error_intr(struct ata_port *ap, u32 slot_stat) */ sil24_update_tf(ap); err_mask = ac_err_mask(pp->tf.command); + sil24_restart_controller(ap); } else { /* * Other errors. libata currently doesn't have any @@ -584,12 +614,11 @@ static void sil24_error_intr(struct ata_port *ap, u32 slot_stat) * ATA_ERR. */ err_mask = AC_ERR_OTHER; + sil24_reset_controller(ap); } if (qc) ata_qc_complete(qc, err_mask); - - sil24_reset_controller(ap); } static inline void sil24_host_intr(struct ata_port *ap) -- cgit v1.2.3 From ca45160db70661a006d884df07f82c9b51d27a52 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Fri, 18 Nov 2005 14:14:01 +0900 Subject: [PATCH] sil24: use SRST for phy_reset There seems to be no way to obtain device signature from sil24 after SATA phy reset and SRST is needed anyway for later port multiplier suppport. This patch converts sil24_phy_reset to use SRST instaed. Signed-off-by: Tejun Heo -- Jeff, I didn't remove the 10ms sleep just to be on the safe side. I think we can live with 10ms sleep on SRST. Signed-off-by: Jeff Garzik --- drivers/scsi/sata_sil24.c | 76 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 66 insertions(+), 10 deletions(-) (limited to 'drivers') diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c index a6836a07a9e..59aab163bcd 100644 --- a/drivers/scsi/sata_sil24.c +++ b/drivers/scsi/sata_sil24.c @@ -333,7 +333,7 @@ static struct ata_port_info sil24_port_info[] = { { .sht = &sil24_sht, .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | - ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | + ATA_FLAG_SRST | ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(4), .pio_mask = 0x1f, /* pio0-4 */ .mwdma_mask = 0x07, /* mwdma0-2 */ @@ -344,7 +344,7 @@ static struct ata_port_info sil24_port_info[] = { { .sht = &sil24_sht, .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | - ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | + ATA_FLAG_SRST | ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(2), .pio_mask = 0x1f, /* pio0-4 */ .mwdma_mask = 0x07, /* mwdma0-2 */ @@ -355,7 +355,7 @@ static struct ata_port_info sil24_port_info[] = { { .sht = &sil24_sht, .host_flags = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY | - ATA_FLAG_SATA_RESET | ATA_FLAG_MMIO | + ATA_FLAG_SRST | ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA | SIL24_NPORTS2FLAG(1), .pio_mask = 0x1f, /* pio0-4 */ .mwdma_mask = 0x07, /* mwdma0-2 */ @@ -415,16 +415,72 @@ static void sil24_tf_read(struct ata_port *ap, struct ata_taskfile *tf) *tf = pp->tf; } -static void sil24_phy_reset(struct ata_port *ap) +static int sil24_issue_SRST(struct ata_port *ap) { - __sata_phy_reset(ap); + void __iomem *port = (void __iomem *)ap->ioaddr.cmd_addr; + struct sil24_port_priv *pp = ap->private_data; + struct sil24_prb *prb = &pp->cmd_block[0].prb; + dma_addr_t paddr = pp->cmd_block_dma; + u32 irq_enable, irq_stat; + int cnt; + + /* temporarily turn off IRQs during SRST */ + irq_enable = readl(port + PORT_IRQ_ENABLE_SET); + writel(irq_enable, port + PORT_IRQ_ENABLE_CLR); + /* - * No ATAPI yet. Just unconditionally indicate ATA device. - * If ATAPI device is attached, it will fail ATA_CMD_ID_ATA - * and libata core will ignore the device. + * XXX: Not sure whether the following sleep is needed or not. + * The original driver had it. So.... */ - if (!(ap->flags & ATA_FLAG_PORT_DISABLED)) - ap->device[0].class = ATA_DEV_ATA; + msleep(10); + + prb->ctrl = PRB_CTRL_SRST; + prb->fis[1] = 0; /* no PM yet */ + + writel((u32)paddr, port + PORT_CMD_ACTIVATE); + + for (cnt = 0; cnt < 100; cnt++) { + irq_stat = readl(port + PORT_IRQ_STAT); + writel(irq_stat, port + PORT_IRQ_STAT); /* clear irq */ + + irq_stat >>= PORT_IRQ_RAW_SHIFT; + if (irq_stat & (PORT_IRQ_COMPLETE | PORT_IRQ_ERROR)) + break; + + msleep(1); + } + + /* restore IRQs */ + writel(irq_enable, port + PORT_IRQ_ENABLE_SET); + + if (!(irq_stat & PORT_IRQ_COMPLETE)) + return -1; + + /* update TF */ + sil24_update_tf(ap); + return 0; +} + +static void sil24_phy_reset(struct ata_port *ap) +{ + struct sil24_port_priv *pp = ap->private_data; + + __sata_phy_reset(ap); + if (ap->flags & ATA_FLAG_PORT_DISABLED) + return; + + if (sil24_issue_SRST(ap) < 0) { + printk(KERN_ERR DRV_NAME + " ata%u: SRST failed, disabling port\n", ap->id); + ap->ops->port_disable(ap); + return; + } + + ap->device->class = ata_dev_classify(&pp->tf); + + /* No ATAPI yet */ + if (ap->device->class == ATA_DEV_ATAPI) + ap->ops->port_disable(ap); } static inline void sil24_fill_sg(struct ata_queued_cmd *qc, -- cgit v1.2.3 From 69ad185fa139b8fff2442d89440e382679d51f0f Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Fri, 18 Nov 2005 14:16:45 +0900 Subject: [PATCH] sil24: add ATAPI support This patch implements ATAPI support for sil24 and bumps driver version to 0.23. Signed-off-by: Tejun Heo -- Jeff, it has been converted to use ->dev_config as pointed out. Signed-off-by: Jeff Garzik --- drivers/scsi/sata_sil24.c | 84 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 58 insertions(+), 26 deletions(-) (limited to 'drivers') diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c index 59aab163bcd..340641fa1c6 100644 --- a/drivers/scsi/sata_sil24.c +++ b/drivers/scsi/sata_sil24.c @@ -5,17 +5,6 @@ * * Based on preview driver from Silicon Image. * - * NOTE: No NCQ/ATAPI support yet. The preview driver didn't support - * NCQ nor ATAPI, and, unfortunately, I couldn't find out how to make - * those work. Enabling those shouldn't be difficult. Basic - * structure is all there (in libata-dev tree). If you have any - * information about this hardware, please contact me or linux-ide. - * Info is needed on... - * - * - How to issue tagged commands and turn on sactive on issue accordingly. - * - Where to put an ATAPI command and how to tell the device to send it. - * - How to enable/use 64bit. - * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any @@ -42,7 +31,7 @@ #include #define DRV_NAME "sata_sil24" -#define DRV_VERSION "0.22" /* Silicon Image's preview driver was 0.10 */ +#define DRV_VERSION "0.23" /* * Port request block (PRB) 32 bytes @@ -221,11 +210,22 @@ enum { IRQ_STAT_4PORTS = 0xf, }; -struct sil24_cmd_block { +struct sil24_ata_block { struct sil24_prb prb; struct sil24_sge sge[LIBATA_MAX_PRD]; }; +struct sil24_atapi_block { + struct sil24_prb prb; + u8 cdb[16]; + struct sil24_sge sge[LIBATA_MAX_PRD - 1]; +}; + +union sil24_cmd_block { + struct sil24_ata_block ata; + struct sil24_atapi_block atapi; +}; + /* * ap->private_data * @@ -233,7 +233,7 @@ struct sil24_cmd_block { * here from the previous interrupt. */ struct sil24_port_priv { - struct sil24_cmd_block *cmd_block; /* 32 cmd blocks */ + union sil24_cmd_block *cmd_block; /* 32 cmd blocks */ dma_addr_t cmd_block_dma; /* DMA base addr for them */ struct ata_taskfile tf; /* Cached taskfile registers */ }; @@ -244,6 +244,7 @@ struct sil24_host_priv { void __iomem *port_base; /* port registers (4 * 8192 bytes @BAR2) */ }; +static void sil24_dev_config(struct ata_port *ap, struct ata_device *dev); static u8 sil24_check_status(struct ata_port *ap); static u32 sil24_scr_read(struct ata_port *ap, unsigned sc_reg); static void sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val); @@ -297,6 +298,8 @@ static struct scsi_host_template sil24_sht = { static const struct ata_port_operations sil24_ops = { .port_disable = ata_port_disable, + .dev_config = sil24_dev_config, + .check_status = sil24_check_status, .check_altstatus = sil24_check_status, .dev_select = ata_noop_dev_select, @@ -364,6 +367,16 @@ static struct ata_port_info sil24_port_info[] = { }, }; +static void sil24_dev_config(struct ata_port *ap, struct ata_device *dev) +{ + void __iomem *port = (void __iomem *)ap->ioaddr.cmd_addr; + + if (ap->cdb_len == 16) + writel(PORT_CS_CDB16, port + PORT_CTRL_STAT); + else + writel(PORT_CS_CDB16, port + PORT_CTRL_CLR); +} + static inline void sil24_update_tf(struct ata_port *ap) { struct sil24_port_priv *pp = ap->private_data; @@ -419,7 +432,7 @@ static int sil24_issue_SRST(struct ata_port *ap) { void __iomem *port = (void __iomem *)ap->ioaddr.cmd_addr; struct sil24_port_priv *pp = ap->private_data; - struct sil24_prb *prb = &pp->cmd_block[0].prb; + struct sil24_prb *prb = &pp->cmd_block[0].ata.prb; dma_addr_t paddr = pp->cmd_block_dma; u32 irq_enable, irq_stat; int cnt; @@ -477,16 +490,11 @@ static void sil24_phy_reset(struct ata_port *ap) } ap->device->class = ata_dev_classify(&pp->tf); - - /* No ATAPI yet */ - if (ap->device->class == ATA_DEV_ATAPI) - ap->ops->port_disable(ap); } static inline void sil24_fill_sg(struct ata_queued_cmd *qc, - struct sil24_cmd_block *cb) + struct sil24_sge *sge) { - struct sil24_sge *sge = cb->sge; struct scatterlist *sg; unsigned int idx = 0; @@ -507,23 +515,47 @@ static void sil24_qc_prep(struct ata_queued_cmd *qc) { struct ata_port *ap = qc->ap; struct sil24_port_priv *pp = ap->private_data; - struct sil24_cmd_block *cb = pp->cmd_block + qc->tag; - struct sil24_prb *prb = &cb->prb; + union sil24_cmd_block *cb = pp->cmd_block + qc->tag; + struct sil24_prb *prb; + struct sil24_sge *sge; switch (qc->tf.protocol) { case ATA_PROT_PIO: case ATA_PROT_DMA: case ATA_PROT_NODATA: + prb = &cb->ata.prb; + sge = cb->ata.sge; + prb->ctrl = 0; break; + + case ATA_PROT_ATAPI: + case ATA_PROT_ATAPI_DMA: + case ATA_PROT_ATAPI_NODATA: + prb = &cb->atapi.prb; + sge = cb->atapi.sge; + memset(cb->atapi.cdb, 0, 32); + memcpy(cb->atapi.cdb, qc->cdb, ap->cdb_len); + + if (qc->tf.protocol != ATA_PROT_ATAPI_NODATA) { + if (qc->tf.flags & ATA_TFLAG_WRITE) + prb->ctrl = PRB_CTRL_PACKET_WRITE; + else + prb->ctrl = PRB_CTRL_PACKET_READ; + } else + prb->ctrl = 0; + + break; + default: - /* ATAPI isn't supported yet */ + prb = NULL; /* shut up, gcc */ + sge = NULL; BUG(); } ata_tf_to_fis(&qc->tf, prb->fis, 0); if (qc->flags & ATA_QCFLAG_DMAMAP) - sil24_fill_sg(qc, cb); + sil24_fill_sg(qc, sge); } static int sil24_qc_issue(struct ata_queued_cmd *qc) @@ -750,7 +782,7 @@ static int sil24_port_start(struct ata_port *ap) { struct device *dev = ap->host_set->dev; struct sil24_port_priv *pp; - struct sil24_cmd_block *cb; + union sil24_cmd_block *cb; size_t cb_size = sizeof(*cb); dma_addr_t cb_dma; int rc = -ENOMEM; -- cgit v1.2.3 From c0ab424238ceabcaa3a2948f283bcb94f6979c93 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Fri, 18 Nov 2005 14:22:03 +0900 Subject: [PATCH] sil24: make error_intr less verbose sil24_error_intr logs all error interrupts. ATAPI devices generates many harmless errors which can be ignored and all serious ones are reported via sense data by SCSI layer. Don't log device errors from ATAPI devices. Signed-off-by: Tejun Heo Signed-off-by: Jeff Garzik --- drivers/scsi/sata_sil24.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c index 340641fa1c6..e0d6f194f54 100644 --- a/drivers/scsi/sata_sil24.c +++ b/drivers/scsi/sata_sil24.c @@ -684,9 +684,15 @@ static void sil24_error_intr(struct ata_port *ap, u32 slot_stat) if (serror) writel(serror, port + PORT_SERROR); - printk(KERN_ERR DRV_NAME " ata%u: error interrupt on port%d\n" - " stat=0x%x irq=0x%x cmd_err=%d sstatus=0x%x serror=0x%x\n", - ap->id, ap->port_no, slot_stat, irq_stat, cmd_err, sstatus, serror); + /* + * Don't log ATAPI device errors. They're supposed to happen + * and any serious errors will be logged using sense data by + * the SCSI layer. + */ + if (ap->device[0].class != ATA_DEV_ATAPI || cmd_err > PORT_CERR_SDB) + printk("ata%u: error interrupt on port%d\n" + " stat=0x%x irq=0x%x cmd_err=%d sstatus=0x%x serror=0x%x\n", + ap->id, ap->port_no, slot_stat, irq_stat, cmd_err, sstatus, serror); if (cmd_err == PORT_CERR_DEV || cmd_err == PORT_CERR_SDB) { /* -- cgit v1.2.3 From 2afecc047e9077d8dc9e312b32e944955e71ce53 Mon Sep 17 00:00:00 2001 From: Jesse Brandeburg Date: Mon, 14 Nov 2005 13:15:49 -0800 Subject: [PATCH] e100: re-enable microcode with more useful defaults For the four versions of hardware that we (currently) support microcode download on, the default configuration of our receive interrupt mitigation microcode was too aggressive, and caused unnecessary delays when pinging, and low(er) throughput on single connection latency sensitive performance tests. This code adds microcode support, and sets the defaults to more reasonable settings. It also explains the functionality in the code in more detail. Compile and load tested, shows expected behavior for slight delay of ping packets (1-2ms) when ucode is loaded, and decent interrupt moderation for small packets, while maintaining good throughput. Signed-off-by: Jesse Brandeburg Signed-off-by: Jeff Garzik --- drivers/net/e100.c | 275 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 257 insertions(+), 18 deletions(-) (limited to 'drivers') diff --git a/drivers/net/e100.c b/drivers/net/e100.c index 7a6aeae2c9f..22cd0455670 100644 --- a/drivers/net/e100.c +++ b/drivers/net/e100.c @@ -156,7 +156,7 @@ #define DRV_NAME "e100" #define DRV_EXT "-NAPI" -#define DRV_VERSION "3.4.14-k2"DRV_EXT +#define DRV_VERSION "3.4.14-k4"DRV_EXT #define DRV_DESCRIPTION "Intel(R) PRO/100 Network Driver" #define DRV_COPYRIGHT "Copyright(c) 1999-2005 Intel Corporation" #define PFX DRV_NAME ": " @@ -903,8 +903,8 @@ static void mdio_write(struct net_device *netdev, int addr, int reg, int data) static void e100_get_defaults(struct nic *nic) { - struct param_range rfds = { .min = 16, .max = 256, .count = 64 }; - struct param_range cbs = { .min = 64, .max = 256, .count = 64 }; + struct param_range rfds = { .min = 16, .max = 256, .count = 256 }; + struct param_range cbs = { .min = 64, .max = 256, .count = 128 }; pci_read_config_byte(nic->pdev, PCI_REVISION_ID, &nic->rev_id); /* MAC type is encoded as rev ID; exception: ICH is treated as 82559 */ @@ -1007,25 +1007,264 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb) c[16], c[17], c[18], c[19], c[20], c[21], c[22], c[23]); } +/********************************************************/ +/* Micro code for 8086:1229 Rev 8 */ +/********************************************************/ + +/* Parameter values for the D101M B-step */ +#define D101M_CPUSAVER_TIMER_DWORD 78 +#define D101M_CPUSAVER_BUNDLE_DWORD 65 +#define D101M_CPUSAVER_MIN_SIZE_DWORD 126 + +#define D101M_B_RCVBUNDLE_UCODE \ +{\ +0x00550215, 0xFFFF0437, 0xFFFFFFFF, 0x06A70789, 0xFFFFFFFF, 0x0558FFFF, \ +0x000C0001, 0x00101312, 0x000C0008, 0x00380216, \ +0x0010009C, 0x00204056, 0x002380CC, 0x00380056, \ +0x0010009C, 0x00244C0B, 0x00000800, 0x00124818, \ +0x00380438, 0x00000000, 0x00140000, 0x00380555, \ +0x00308000, 0x00100662, 0x00100561, 0x000E0408, \ +0x00134861, 0x000C0002, 0x00103093, 0x00308000, \ +0x00100624, 0x00100561, 0x000E0408, 0x00100861, \ +0x000C007E, 0x00222C21, 0x000C0002, 0x00103093, \ +0x00380C7A, 0x00080000, 0x00103090, 0x00380C7A, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x0010009C, 0x00244C2D, 0x00010004, 0x00041000, \ +0x003A0437, 0x00044010, 0x0038078A, 0x00000000, \ +0x00100099, 0x00206C7A, 0x0010009C, 0x00244C48, \ +0x00130824, 0x000C0001, 0x00101213, 0x00260C75, \ +0x00041000, 0x00010004, 0x00130826, 0x000C0006, \ +0x002206A8, 0x0013C926, 0x00101313, 0x003806A8, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00080600, 0x00101B10, 0x00050004, 0x00100826, \ +0x00101210, 0x00380C34, 0x00000000, 0x00000000, \ +0x0021155B, 0x00100099, 0x00206559, 0x0010009C, \ +0x00244559, 0x00130836, 0x000C0000, 0x00220C62, \ +0x000C0001, 0x00101B13, 0x00229C0E, 0x00210C0E, \ +0x00226C0E, 0x00216C0E, 0x0022FC0E, 0x00215C0E, \ +0x00214C0E, 0x00380555, 0x00010004, 0x00041000, \ +0x00278C67, 0x00040800, 0x00018100, 0x003A0437, \ +0x00130826, 0x000C0001, 0x00220559, 0x00101313, \ +0x00380559, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00130831, 0x0010090B, 0x00124813, \ +0x000CFF80, 0x002606AB, 0x00041000, 0x00010004, \ +0x003806A8, 0x00000000, 0x00000000, 0x00000000, \ +} + +/********************************************************/ +/* Micro code for 8086:1229 Rev 9 */ +/********************************************************/ + +/* Parameter values for the D101S */ +#define D101S_CPUSAVER_TIMER_DWORD 78 +#define D101S_CPUSAVER_BUNDLE_DWORD 67 +#define D101S_CPUSAVER_MIN_SIZE_DWORD 128 + +#define D101S_RCVBUNDLE_UCODE \ +{\ +0x00550242, 0xFFFF047E, 0xFFFFFFFF, 0x06FF0818, 0xFFFFFFFF, 0x05A6FFFF, \ +0x000C0001, 0x00101312, 0x000C0008, 0x00380243, \ +0x0010009C, 0x00204056, 0x002380D0, 0x00380056, \ +0x0010009C, 0x00244F8B, 0x00000800, 0x00124818, \ +0x0038047F, 0x00000000, 0x00140000, 0x003805A3, \ +0x00308000, 0x00100610, 0x00100561, 0x000E0408, \ +0x00134861, 0x000C0002, 0x00103093, 0x00308000, \ +0x00100624, 0x00100561, 0x000E0408, 0x00100861, \ +0x000C007E, 0x00222FA1, 0x000C0002, 0x00103093, \ +0x00380F90, 0x00080000, 0x00103090, 0x00380F90, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x0010009C, 0x00244FAD, 0x00010004, 0x00041000, \ +0x003A047E, 0x00044010, 0x00380819, 0x00000000, \ +0x00100099, 0x00206FFD, 0x0010009A, 0x0020AFFD, \ +0x0010009C, 0x00244FC8, 0x00130824, 0x000C0001, \ +0x00101213, 0x00260FF7, 0x00041000, 0x00010004, \ +0x00130826, 0x000C0006, 0x00220700, 0x0013C926, \ +0x00101313, 0x00380700, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00080600, 0x00101B10, 0x00050004, 0x00100826, \ +0x00101210, 0x00380FB6, 0x00000000, 0x00000000, \ +0x002115A9, 0x00100099, 0x002065A7, 0x0010009A, \ +0x0020A5A7, 0x0010009C, 0x002445A7, 0x00130836, \ +0x000C0000, 0x00220FE4, 0x000C0001, 0x00101B13, \ +0x00229F8E, 0x00210F8E, 0x00226F8E, 0x00216F8E, \ +0x0022FF8E, 0x00215F8E, 0x00214F8E, 0x003805A3, \ +0x00010004, 0x00041000, 0x00278FE9, 0x00040800, \ +0x00018100, 0x003A047E, 0x00130826, 0x000C0001, \ +0x002205A7, 0x00101313, 0x003805A7, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00130831, \ +0x0010090B, 0x00124813, 0x000CFF80, 0x00260703, \ +0x00041000, 0x00010004, 0x00380700 \ +} + +/********************************************************/ +/* Micro code for the 8086:1229 Rev F/10 */ +/********************************************************/ + +/* Parameter values for the D102 E-step */ +#define D102_E_CPUSAVER_TIMER_DWORD 42 +#define D102_E_CPUSAVER_BUNDLE_DWORD 54 +#define D102_E_CPUSAVER_MIN_SIZE_DWORD 46 + +#define D102_E_RCVBUNDLE_UCODE \ +{\ +0x007D028F, 0x0E4204F9, 0x14ED0C85, 0x14FA14E9, 0x0EF70E36, 0x1FFF1FFF, \ +0x00E014B9, 0x00000000, 0x00000000, 0x00000000, \ +0x00E014BD, 0x00000000, 0x00000000, 0x00000000, \ +0x00E014D5, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00E014C1, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00E014C8, 0x00000000, 0x00000000, 0x00000000, \ +0x00200600, 0x00E014EE, 0x00000000, 0x00000000, \ +0x0030FF80, 0x00940E46, 0x00038200, 0x00102000, \ +0x00E00E43, 0x00000000, 0x00000000, 0x00000000, \ +0x00300006, 0x00E014FB, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00906E41, 0x00800E3C, 0x00E00E39, 0x00000000, \ +0x00906EFD, 0x00900EFD, 0x00E00EF8, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +0x00000000, 0x00000000, 0x00000000, 0x00000000, \ +} + static void e100_load_ucode(struct nic *nic, struct cb *cb, struct sk_buff *skb) { - int i; - static const u32 ucode[UCODE_SIZE] = { - /* NFS packets are misinterpreted as TCO packets and - * incorrectly routed to the BMC over SMBus. This - * microcode patch checks the fragmented IP bit in the - * NFS/UDP header to distinguish between NFS and TCO. */ - 0x0EF70E36, 0x1FFF1FFF, 0x1FFF1FFF, 0x1FFF1FFF, 0x1FFF1FFF, - 0x1FFF1FFF, 0x00906E41, 0x00800E3C, 0x00E00E39, 0x00000000, - 0x00906EFD, 0x00900EFD, 0x00E00EF8, - }; - - if(nic->mac == mac_82551_F || nic->mac == mac_82551_10) { - for(i = 0; i < UCODE_SIZE; i++) +/* *INDENT-OFF* */ + static struct { + u32 ucode[UCODE_SIZE + 1]; + u8 mac; + u8 timer_dword; + u8 bundle_dword; + u8 min_size_dword; + } ucode_opts[] = { + { D101M_B_RCVBUNDLE_UCODE, + mac_82559_D101M, + D101M_CPUSAVER_TIMER_DWORD, + D101M_CPUSAVER_BUNDLE_DWORD, + D101M_CPUSAVER_MIN_SIZE_DWORD }, + { D101S_RCVBUNDLE_UCODE, + mac_82559_D101S, + D101S_CPUSAVER_TIMER_DWORD, + D101S_CPUSAVER_BUNDLE_DWORD, + D101S_CPUSAVER_MIN_SIZE_DWORD }, + { D102_E_RCVBUNDLE_UCODE, + mac_82551_F, + D102_E_CPUSAVER_TIMER_DWORD, + D102_E_CPUSAVER_BUNDLE_DWORD, + D102_E_CPUSAVER_MIN_SIZE_DWORD }, + { D102_E_RCVBUNDLE_UCODE, + mac_82551_10, + D102_E_CPUSAVER_TIMER_DWORD, + D102_E_CPUSAVER_BUNDLE_DWORD, + D102_E_CPUSAVER_MIN_SIZE_DWORD }, + { {0}, 0, 0, 0, 0} + }, *opts; +/* *INDENT-ON* */ + +/************************************************************************* +* CPUSaver parameters +* +* All CPUSaver parameters are 16-bit literals that are part of a +* "move immediate value" instruction. By changing the value of +* the literal in the instruction before the code is loaded, the +* driver can change the algorithm. +* +* INTDELAY - This loads the dead-man timer with its inital value. +* When this timer expires the interrupt is asserted, and the +* timer is reset each time a new packet is received. (see +* BUNDLEMAX below to set the limit on number of chained packets) +* The current default is 0x600 or 1536. Experiments show that +* the value should probably stay within the 0x200 - 0x1000. +* +* BUNDLEMAX - +* This sets the maximum number of frames that will be bundled. In +* some situations, such as the TCP windowing algorithm, it may be +* better to limit the growth of the bundle size than let it go as +* high as it can, because that could cause too much added latency. +* The default is six, because this is the number of packets in the +* default TCP window size. A value of 1 would make CPUSaver indicate +* an interrupt for every frame received. If you do not want to put +* a limit on the bundle size, set this value to xFFFF. +* +* BUNDLESMALL - +* This contains a bit-mask describing the minimum size frame that +* will be bundled. The default masks the lower 7 bits, which means +* that any frame less than 128 bytes in length will not be bundled, +* but will instead immediately generate an interrupt. This does +* not affect the current bundle in any way. Any frame that is 128 +* bytes or large will be bundled normally. This feature is meant +* to provide immediate indication of ACK frames in a TCP environment. +* Customers were seeing poor performance when a machine with CPUSaver +* enabled was sending but not receiving. The delay introduced when +* the ACKs were received was enough to reduce total throughput, because +* the sender would sit idle until the ACK was finally seen. +* +* The current default is 0xFF80, which masks out the lower 7 bits. +* This means that any frame which is x7F (127) bytes or smaller +* will cause an immediate interrupt. Because this value must be a +* bit mask, there are only a few valid values that can be used. To +* turn this feature off, the driver can write the value xFFFF to the +* lower word of this instruction (in the same way that the other +* parameters are used). Likewise, a value of 0xF800 (2047) would +* cause an interrupt to be generated for every frame, because all +* standard Ethernet frames are <= 2047 bytes in length. +*************************************************************************/ + +/* if you wish to disable the ucode functionality, while maintaining the + * workarounds it provides, set the following defines to: + * BUNDLESMALL 0 + * BUNDLEMAX 1 + * INTDELAY 1 + */ +#define BUNDLESMALL 1 +#define BUNDLEMAX (u16)6 +#define INTDELAY (u16)1536 /* 0x600 */ + + /* do not load u-code for ICH devices */ + if (nic->flags & ich) + goto noloaducode; + + /* Search for ucode match against h/w rev_id */ + for (opts = ucode_opts; opts->mac; opts++) { + int i; + u32 *ucode = opts->ucode; + if (nic->mac != opts->mac) + continue; + + /* Insert user-tunable settings */ + ucode[opts->timer_dword] &= 0xFFFF0000; + ucode[opts->timer_dword] |= INTDELAY; + ucode[opts->bundle_dword] &= 0xFFFF0000; + ucode[opts->bundle_dword] |= BUNDLEMAX; + ucode[opts->min_size_dword] &= 0xFFFF0000; + ucode[opts->min_size_dword] |= (BUNDLESMALL) ? 0xFFFF : 0xFF80; + + for (i = 0; i < UCODE_SIZE; i++) cb->u.ucode[i] = cpu_to_le32(ucode[i]); cb->command = cpu_to_le16(cb_ucode); - } else - cb->command = cpu_to_le16(cb_nop); + return; + } + +noloaducode: + cb->command = cpu_to_le16(cb_nop); } static void e100_setup_iaaddr(struct nic *nic, struct cb *cb, -- cgit v1.2.3 From 620d9aa95b7910da07912340971bc2d9b2497382 Mon Sep 17 00:00:00 2001 From: "John W. Linville" Date: Wed, 16 Nov 2005 16:09:53 -0500 Subject: [PATCH] i82593.h: make header comment GPL-compatible Signed-off-by: John W. Linville Signed-off-by: Jeff Garzik --- drivers/net/wireless/i82593.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/net/wireless/i82593.h b/drivers/net/wireless/i82593.h index 33acb8add4d..afac5c7a323 100644 --- a/drivers/net/wireless/i82593.h +++ b/drivers/net/wireless/i82593.h @@ -7,11 +7,16 @@ * * Copyright 1994, Anders Klemets * - * This software may be freely distributed for noncommercial purposes - * as long as this notice is retained. - * * HISTORY * i82593.h,v + * Revision 1.4 2005/11/4 09:15:00 baroniunas + * Modified copyright with permission of author as follows: + * + * "If I82539.H is the only file with my copyright statement + * that is included in the Source Forge project, then you have + * my approval to change the copyright statement to be a GPL + * license, in the way you proposed on October 10." + * * Revision 1.1 1996/07/17 15:23:12 root * Initial revision * -- cgit v1.2.3 From 70f1e002cfaad708ac561bcc6700dc50888999f5 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Sun, 13 Nov 2005 10:13:05 +0000 Subject: [PATCH] IOC3: Replace obsolete PCI API Signed-off-by: Ralf Baechle Signed-off-by: Jeff Garzik --- drivers/net/ioc3-eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c index 6a3129bc15a..9b8295ee06e 100644 --- a/drivers/net/ioc3-eth.c +++ b/drivers/net/ioc3-eth.c @@ -1360,7 +1360,7 @@ static struct pci_driver ioc3_driver = { static int __init ioc3_init_module(void) { - return pci_module_init(&ioc3_driver); + return pci_register_driver(&ioc3_driver); } static void __exit ioc3_cleanup_module(void) -- cgit v1.2.3 From 0c0abbc58011e977921eae9037668452bef80265 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Mon, 14 Nov 2005 00:16:29 +0000 Subject: [PATCH] au1000_eth: Include Signed-off-by: Ralf Baechle The Au1000 ethernet driver references plenty of CONFIG_* symbols. Signed-off-by: Jeff Garzik --- drivers/net/au1000_eth.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers') diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c index 332e9953c55..cd0b1dccfb6 100644 --- a/drivers/net/au1000_eth.c +++ b/drivers/net/au1000_eth.c @@ -32,6 +32,7 @@ * */ +#include #include #include #include -- cgit v1.2.3 From 344547093274c8bdb87becb939e5c8ab009ebfe6 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Mon, 14 Nov 2005 00:19:44 +0000 Subject: [PATCH] SAA9730: Add missing header bits. This header file patch was missing from the recent SAA9730 patch. Signed-off-by: Ralf Baechle Signed-off-by: Jeff Garzik --- drivers/net/saa9730.h | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'drivers') diff --git a/drivers/net/saa9730.h b/drivers/net/saa9730.h index 9e9da6b4080..a7e9d29a86a 100644 --- a/drivers/net/saa9730.h +++ b/drivers/net/saa9730.h @@ -1,6 +1,7 @@ /* - * Carsten Langgaard, carstenl@mips.com - * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved. + * Copyright (C) 2000, 2005 MIPS Technologies, Inc. All rights reserved. + * Authors: Carsten Langgaard + * Maciej W. Rozycki * * ######################################################################## * @@ -265,6 +266,7 @@ /* The SAA9730 (LAN) controller register map, as seen via the PCI-bus. */ #define SAA9730_LAN_REGS_ADDR 0x20400 +#define SAA9730_LAN_REGS_SIZE 0x00400 struct lan_saa9730_regmap { volatile unsigned int TxBuffA; /* 0x20400 */ @@ -309,6 +311,7 @@ typedef volatile struct lan_saa9730_regmap t_lan_saa9730_regmap; /* The SAA9730 (EVM) controller register map, as seen via the PCI-bus. */ #define SAA9730_EVM_REGS_ADDR 0x02000 +#define SAA9730_EVM_REGS_SIZE 0x00400 struct evm_saa9730_regmap { volatile unsigned int InterruptStatus1; /* 0x2000 */ @@ -329,16 +332,32 @@ typedef volatile struct evm_saa9730_regmap t_evm_saa9730_regmap; struct lan_saa9730_private { + /* + * Rx/Tx packet buffers. + * The Rx and Tx packets must be PACKET_SIZE aligned. + */ + void *buffer_start; + unsigned int buffer_size; + + /* + * DMA address of beginning of this object, returned + * by pci_alloc_consistent(). + */ + dma_addr_t dma_addr; + + /* Pointer to the associated pci device structure */ + struct pci_dev *pci_dev; + /* Pointer for the SAA9730 LAN controller register set. */ t_lan_saa9730_regmap *lan_saa9730_regs; /* Pointer to the SAA9730 EVM register. */ t_evm_saa9730_regmap *evm_saa9730_regs; - /* TRUE if the next buffer to write is RxBuffA, FALSE if RxBuffB. */ - unsigned char NextRcvToUseIsA; /* Rcv buffer Index. */ unsigned char NextRcvPacketIndex; + /* Next buffer index. */ + unsigned char NextRcvBufferIndex; /* Index of next packet to use in that buffer. */ unsigned char NextTxmPacketIndex; @@ -353,13 +372,8 @@ struct lan_saa9730_private { unsigned char DmaRcvPackets; unsigned char DmaTxmPackets; - unsigned char RcvAIndex; /* index into RcvBufferSpace[] for Blk A */ - unsigned char RcvBIndex; /* index into RcvBufferSpace[] for Blk B */ - - unsigned int - TxmBuffer[LAN_SAA9730_BUFFERS][LAN_SAA9730_TXM_Q_SIZE]; - unsigned int - RcvBuffer[LAN_SAA9730_BUFFERS][LAN_SAA9730_RCV_Q_SIZE]; + void *TxmBuffer[LAN_SAA9730_BUFFERS][LAN_SAA9730_TXM_Q_SIZE]; + void *RcvBuffer[LAN_SAA9730_BUFFERS][LAN_SAA9730_RCV_Q_SIZE]; unsigned int TxBufferFree[LAN_SAA9730_BUFFERS]; unsigned char PhysicalAddress[LAN_SAA9730_CAM_ENTRIES][6]; -- cgit v1.2.3 From cbf7c42b727826770a44c0a10ef3663da08e64bc Mon Sep 17 00:00:00 2001 From: Roger While Date: Mon, 14 Nov 2005 11:50:46 +0100 Subject: [PATCH] prism54 : Remove extraneous udelay/register read In isl_38xx.c In routine isl38xx_trigger-device Move unnecessary udelay/register read. This is only required when hand-compiling the driver and setting VERBOSE > SHOW_ERROR_MESSAGES Signed-off-by: Roger While Signed-off-by: Jeff Garzik --- drivers/net/wireless/prism54/isl_38xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/net/wireless/prism54/isl_38xx.c b/drivers/net/wireless/prism54/isl_38xx.c index 109a96d9000..23deee69974 100644 --- a/drivers/net/wireless/prism54/isl_38xx.c +++ b/drivers/net/wireless/prism54/isl_38xx.c @@ -164,12 +164,12 @@ isl38xx_trigger_device(int asleep, void __iomem *device_base) /* assert the Wakeup interrupt in the Device Interrupt Register */ isl38xx_w32_flush(device_base, ISL38XX_DEV_INT_WAKEUP, ISL38XX_DEV_INT_REG); + +#if VERBOSE > SHOW_ERROR_MESSAGES udelay(ISL38XX_WRITEIO_DELAY); /* perform another read on the Device Status Register */ reg = readl(device_base + ISL38XX_CTRL_STAT_REG); - -#if VERBOSE > SHOW_ERROR_MESSAGES do_gettimeofday(¤t_time); DEBUG(SHOW_TRACING, "%08li.%08li Device register read %08x\n", current_time.tv_sec, (long)current_time.tv_usec, reg); -- cgit v1.2.3 From c5b42f343d19d0a04782db0dde5b128dd282f95c Mon Sep 17 00:00:00 2001 From: "Gabriel A. Devenyi" Date: Sat, 12 Nov 2005 16:00:46 -0500 Subject: [PATCH] drivers/net/wireless/hermes.c unsigned int comparision hermas_bap_pread, hermes_bap_pwrite, and hermes_bap_pwrite_pad all have a parameter "len" that is declared unsigned, but checked for a value less than zero. Auditing the callers, it is possible for len to be passed a negative value, so len should be an int. Thanks to LinuxICC (http://linuxicc.sf.net) Signed-off-by: Gabriel A. Devenyi Signed-off-by: Jeff Garzik --- drivers/net/wireless/hermes.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/net/wireless/hermes.c b/drivers/net/wireless/hermes.c index 579480dad37..346c6febb03 100644 --- a/drivers/net/wireless/hermes.c +++ b/drivers/net/wireless/hermes.c @@ -398,7 +398,7 @@ static int hermes_bap_seek(hermes_t *hw, int bap, u16 id, u16 offset) * * Returns: < 0 on internal failure (errno), 0 on success, > 0 on error from firmware */ -int hermes_bap_pread(hermes_t *hw, int bap, void *buf, unsigned len, +int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len, u16 id, u16 offset) { int dreg = bap ? HERMES_DATA1 : HERMES_DATA0; @@ -424,7 +424,7 @@ int hermes_bap_pread(hermes_t *hw, int bap, void *buf, unsigned len, * * Returns: < 0 on internal failure (errno), 0 on success, > 0 on error from firmware */ -int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, unsigned len, +int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len, u16 id, u16 offset) { int dreg = bap ? HERMES_DATA1 : HERMES_DATA0; @@ -450,7 +450,7 @@ int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, unsigned len, * * Returns: < 0 on internal failure (errno), 0 on success, > 0 on error from firmware */ -int hermes_bap_pwrite_pad(hermes_t *hw, int bap, const void *buf, unsigned data_len, unsigned len, +int hermes_bap_pwrite_pad(hermes_t *hw, int bap, const void *buf, unsigned data_len, int len, u16 id, u16 offset) { int dreg = bap ? HERMES_DATA1 : HERMES_DATA0; -- cgit v1.2.3 From a7a461b32fdff1e7db42b50db53840e4fa978384 Mon Sep 17 00:00:00 2001 From: "John W. Linville" Date: Mon, 7 Nov 2005 13:24:59 -0500 Subject: [PATCH] fec_8xx: make CONFIG_FEC_8XX depend on CONFIG_8xx Change CONFIG_FEC_8XX to depend on CONFIG_8xx instead of CONFIG_FEC. CONFIG_FEC depends on ColdFire CPUs, which does not apply for the PPC 8xx processors. Signed-off-by: John W. Linville --- drivers/net/fec_8xx/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/net/fec_8xx/Kconfig b/drivers/net/fec_8xx/Kconfig index 94e7a9af870..a84c232395e 100644 --- a/drivers/net/fec_8xx/Kconfig +++ b/drivers/net/fec_8xx/Kconfig @@ -1,6 +1,6 @@ config FEC_8XX tristate "Motorola 8xx FEC driver" - depends on NET_ETHERNET && FEC + depends on NET_ETHERNET && 8xx select MII config FEC_8XX_GENERIC_PHY -- cgit v1.2.3 From eaf8f53bc001d20aa59aa4519b71f11a1cc7f945 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Sat, 12 Nov 2005 12:50:12 -0600 Subject: [PATCH] ipw2100: Fix 'Driver using old /proc/net/wireless...' message ipw2100: Fix 'Driver using old /proc/net/wireless...' message Wireless extensions moved the get_wireless_stats handler from being in net_device into wireless_handler. A prior instance of this patch resolved the issue for the ipw2200. This one fixes it for the ipw2100. Signed-off-by: Benoit Boissinot Signed-off-by: James Ketrenos Signed-off-by: John W. Linville --- drivers/net/wireless/ipw2100.c | 29 ++++++++++++++++++----------- drivers/net/wireless/ipw2100.h | 2 ++ 2 files changed, 20 insertions(+), 11 deletions(-) (limited to 'drivers') diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c index a2e6214169e..77d2a21d4cd 100644 --- a/drivers/net/wireless/ipw2100.c +++ b/drivers/net/wireless/ipw2100.c @@ -6344,7 +6344,8 @@ static struct net_device *ipw2100_alloc_device(struct pci_dev *pci_dev, dev->ethtool_ops = &ipw2100_ethtool_ops; dev->tx_timeout = ipw2100_tx_timeout; dev->wireless_handlers = &ipw2100_wx_handler_def; - dev->get_wireless_stats = ipw2100_wx_wireless_stats; + priv->wireless_data.ieee80211 = priv->ieee; + dev->wireless_data = &priv->wireless_data; dev->set_mac_address = ipw2100_set_address; dev->watchdog_timeo = 3 * HZ; dev->irq = 0; @@ -7178,6 +7179,11 @@ static int ipw2100_wx_get_range(struct net_device *dev, } range->num_frequency = val; + /* Event capability (kernel + driver) */ + range->event_capa[0] = (IW_EVENT_CAPA_K_0 | + IW_EVENT_CAPA_MASK(SIOCGIWAP)); + range->event_capa[1] = IW_EVENT_CAPA_K_1; + IPW_DEBUG_WX("GET Range\n"); return 0; @@ -8446,16 +8452,6 @@ static iw_handler ipw2100_private_handler[] = { #endif /* CONFIG_IPW2100_MONITOR */ }; -static struct iw_handler_def ipw2100_wx_handler_def = { - .standard = ipw2100_wx_handlers, - .num_standard = sizeof(ipw2100_wx_handlers) / sizeof(iw_handler), - .num_private = sizeof(ipw2100_private_handler) / sizeof(iw_handler), - .num_private_args = sizeof(ipw2100_private_args) / - sizeof(struct iw_priv_args), - .private = (iw_handler *) ipw2100_private_handler, - .private_args = (struct iw_priv_args *)ipw2100_private_args, -}; - /* * Get wireless statistics. * Called by /proc/net/wireless @@ -8597,6 +8593,17 @@ static struct iw_statistics *ipw2100_wx_wireless_stats(struct net_device *dev) return (struct iw_statistics *)NULL; } +static struct iw_handler_def ipw2100_wx_handler_def = { + .standard = ipw2100_wx_handlers, + .num_standard = sizeof(ipw2100_wx_handlers) / sizeof(iw_handler), + .num_private = sizeof(ipw2100_private_handler) / sizeof(iw_handler), + .num_private_args = sizeof(ipw2100_private_args) / + sizeof(struct iw_priv_args), + .private = (iw_handler *) ipw2100_private_handler, + .private_args = (struct iw_priv_args *)ipw2100_private_args, + .get_wireless_stats = ipw2100_wx_wireless_stats, +}; + static void ipw2100_wx_event_work(struct ipw2100_priv *priv) { union iwreq_data wrqu; diff --git a/drivers/net/wireless/ipw2100.h b/drivers/net/wireless/ipw2100.h index 140fdf2a0a0..7c65b10bb16 100644 --- a/drivers/net/wireless/ipw2100.h +++ b/drivers/net/wireless/ipw2100.h @@ -571,6 +571,8 @@ struct ipw2100_priv { struct net_device *net_dev; struct iw_statistics wstats; + struct iw_public_data wireless_data; + struct tasklet_struct irq_tasklet; struct workqueue_struct *workqueue; -- cgit v1.2.3 From e2b1be56c5656902744c2b52e8304126a40bb609 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Fri, 18 Nov 2005 14:04:23 -0500 Subject: [libata sata_mv] update copyright, driver version --- drivers/scsi/sata_mv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index ac184e60797..ab7432a5778 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c @@ -2,6 +2,7 @@ * sata_mv.c - Marvell SATA support * * Copyright 2005: EMC Corporation, all rights reserved. + * Copyright 2005 Red Hat, Inc. All rights reserved. * * Please ALWAYS copy linux-ide@vger.kernel.org on emails. * @@ -36,7 +37,7 @@ #include #define DRV_NAME "sata_mv" -#define DRV_VERSION "0.25" +#define DRV_VERSION "0.5" enum { /* BAR's are enumerated in terms of pci_resource_start() terms */ -- cgit v1.2.3 From f7492f17f2123f0f4db5f9e8ba89867a7b352658 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Fri, 18 Nov 2005 15:06:59 -0500 Subject: [wireless hermes] build fix --- drivers/net/wireless/hermes.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/net/wireless/hermes.h b/drivers/net/wireless/hermes.h index a6bd472d75d..7644f72a9f4 100644 --- a/drivers/net/wireless/hermes.h +++ b/drivers/net/wireless/hermes.h @@ -372,12 +372,12 @@ int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0, struct hermes_response *resp); int hermes_allocate(hermes_t *hw, u16 size, u16 *fid); -int hermes_bap_pread(hermes_t *hw, int bap, void *buf, unsigned len, +int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len, u16 id, u16 offset); -int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, unsigned len, +int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len, u16 id, u16 offset); int hermes_bap_pwrite_pad(hermes_t *hw, int bap, const void *buf, - unsigned data_len, unsigned len, u16 id, u16 offset); + unsigned data_len, int len, u16 id, u16 offset); int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned buflen, u16 *length, void *buf); int hermes_write_ltv(hermes_t *hw, int bap, u16 rid, -- cgit v1.2.3 From 15534d3803993345d8db32246ec329d8f83502e1 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Fri, 18 Nov 2005 22:02:44 +0100 Subject: [PATCH 2/3] cciss: bug fix for BIG_PASS_THRU Applications using CCISS_BIG_PASSTHRU complained that the data written was zeros. The problem is that the buffer is being cleared after the user copy, unless the user copy has failed... Correct that logic. Signed-off-by: Mike Miller Signed-off-by: Jens Axboe --- drivers/block/cciss.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index e239a6c2923..33f8341887d 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -1017,10 +1017,11 @@ static int cciss_ioctl(struct inode *inode, struct file *filep, status = -ENOMEM; goto cleanup1; } - if (ioc->Request.Type.Direction == XFER_WRITE && - copy_from_user(buff[sg_used], data_ptr, sz)) { + if (ioc->Request.Type.Direction == XFER_WRITE) { + if (copy_from_user(buff[sg_used], data_ptr, sz)) { status = -ENOMEM; - goto cleanup1; + goto cleanup1; + } } else { memset(buff[sg_used], 0, sz); } -- cgit v1.2.3 From 6f5a0f7c955d3567f800fa36f978758cb5b99aa2 Mon Sep 17 00:00:00 2001 From: mikem Date: Fri, 18 Nov 2005 22:05:36 +0100 Subject: [PATCH 3/3] cciss: add put_disk into cleanup routines Jeff Garzik pointed me to his code to see how to remove a disk from the system _properly_. Well, here it is... Every place we remove disks we are now testing before calling del_gendisk or blk_cleanup_queue and then call put_disk. Signed-off-by: Mike Miller Signed-off-by: Jens Axboe --- drivers/block/cciss.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) (limited to 'drivers') diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 33f8341887d..a9e33db46e6 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c @@ -1139,8 +1139,15 @@ static int revalidate_allvol(ctlr_info_t *host) for(i=0; i< NWD; i++) { struct gendisk *disk = host->gendisk[i]; - if (disk->flags & GENHD_FL_UP) - del_gendisk(disk); + if (disk) { + request_queue_t *q = disk->queue; + + if (disk->flags & GENHD_FL_UP) + del_gendisk(disk); + if (q) + blk_cleanup_queue(q); + put_disk(disk); + } } /* @@ -1454,10 +1461,13 @@ static int deregister_disk(struct gendisk *disk, drive_info_struct *drv, * allows us to delete disk zero but keep the controller registered. */ if (h->gendisk[0] != disk){ - if (disk->flags & GENHD_FL_UP){ - blk_cleanup_queue(disk->queue); - del_gendisk(disk); - drv->queue = NULL; + if (disk) { + request_queue_t *q = disk->queue; + if (disk->flags & GENHD_FL_UP) + del_gendisk(disk); + if (q) + blk_cleanup_queue(q); + put_disk(disk); } } @@ -3226,9 +3236,14 @@ static void __devexit cciss_remove_one (struct pci_dev *pdev) /* remove it from the disk list */ for (j = 0; j < NWD; j++) { struct gendisk *disk = hba[i]->gendisk[j]; - if (disk->flags & GENHD_FL_UP) { - del_gendisk(disk); - blk_cleanup_queue(disk->queue); + if (disk) { + request_queue_t *q = disk->queue; + + if (disk->flags & GENHD_FL_UP) + del_gendisk(disk); + if (q) + blk_cleanup_queue(q); + put_disk(disk); } } -- cgit v1.2.3 From 861e76a8ab7ba64a74c567fa8c4d1d38c4dfdd24 Mon Sep 17 00:00:00 2001 From: Daniel Drake Date: Fri, 18 Nov 2005 22:08:29 +0100 Subject: [PATCH] via82cxxx IDE: remove /proc/via entry This entry adds needless complication to the driver as it requires the use of global variables to be passed into via_get_info(), making things quite ugly when we try and make this driver support multiple controllers simultaneously. This patch removes /proc/via for simplicity. On 10/13/05, Daniel Drake wrote: > Per Bart's suggestion, I've created a user-space app which shows identical > data (and doesn't even rely on the via82cxxx IDE driver). > > http://www.reactivated.net/software/viaideinfo/ > > So, I think we should be clear to drop /proc/ide/via now. Signed-off-by: Daniel Drake Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/via82cxxx.c | 188 -------------------------------------------- 1 file changed, 188 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index a4d099c937f..2fbc215988a 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c @@ -105,181 +105,6 @@ static unsigned int via_80w; static unsigned int via_clock; static char *via_dma[] = { "MWDMA16", "UDMA33", "UDMA66", "UDMA100", "UDMA133" }; -/* - * VIA /proc entry. - */ - -#if defined(DISPLAY_VIA_TIMINGS) && defined(CONFIG_PROC_FS) - -#include -#include - -static u8 via_proc = 0; -static unsigned long via_base; -static struct pci_dev *bmide_dev, *isa_dev; - -static char *via_control3[] = { "No limit", "64", "128", "192" }; - -#define via_print(format, arg...) p += sprintf(p, format "\n" , ## arg) -#define via_print_drive(name, format, arg...)\ - p += sprintf(p, name); for (i = 0; i < 4; i++) p += sprintf(p, format, ## arg); p += sprintf(p, "\n"); - - -/** - * via_get_info - generate via /proc file - * @buffer: buffer for data - * @addr: set to start of data to use - * @offset: current file offset - * @count: size of read - * - * Fills in buffer with the debugging/configuration information for - * the VIA chipset tuning and attached drives - */ - -static int via_get_info(char *buffer, char **addr, off_t offset, int count) -{ - int speed[4], cycle[4], setup[4], active[4], recover[4], den[4], - uen[4], udma[4], umul[4], active8b[4], recover8b[4]; - struct pci_dev *dev = bmide_dev; - unsigned int v, u, i; - int len; - u16 c, w; - u8 t, x; - char *p = buffer; - - via_print("----------VIA BusMastering IDE Configuration" - "----------------"); - - via_print("Driver Version: 3.38"); - via_print("South Bridge: VIA %s", - via_config->name); - - pci_read_config_byte(isa_dev, PCI_REVISION_ID, &t); - pci_read_config_byte(dev, PCI_REVISION_ID, &x); - via_print("Revision: ISA %#x IDE %#x", t, x); - via_print("Highest DMA rate: %s", - via_dma[via_config->flags & VIA_UDMA]); - - via_print("BM-DMA base: %#lx", via_base); - via_print("PCI clock: %d.%dMHz", - via_clock / 1000, via_clock / 100 % 10); - - pci_read_config_byte(dev, VIA_MISC_1, &t); - via_print("Master Read Cycle IRDY: %dws", - (t & 64) >> 6); - via_print("Master Write Cycle IRDY: %dws", - (t & 32) >> 5); - via_print("BM IDE Status Register Read Retry: %s", - (t & 8) ? "yes" : "no"); - - pci_read_config_byte(dev, VIA_MISC_3, &t); - via_print("Max DRDY Pulse Width: %s%s", - via_control3[(t & 0x03)], (t & 0x03) ? " PCI clocks" : ""); - - via_print("-----------------------Primary IDE" - "-------Secondary IDE------"); - via_print("Read DMA FIFO flush: %10s%20s", - (t & 0x80) ? "yes" : "no", (t & 0x40) ? "yes" : "no"); - via_print("End Sector FIFO flush: %10s%20s", - (t & 0x20) ? "yes" : "no", (t & 0x10) ? "yes" : "no"); - - pci_read_config_byte(dev, VIA_IDE_CONFIG, &t); - via_print("Prefetch Buffer: %10s%20s", - (t & 0x80) ? "yes" : "no", (t & 0x20) ? "yes" : "no"); - via_print("Post Write Buffer: %10s%20s", - (t & 0x40) ? "yes" : "no", (t & 0x10) ? "yes" : "no"); - - pci_read_config_byte(dev, VIA_IDE_ENABLE, &t); - via_print("Enabled: %10s%20s", - (t & 0x02) ? "yes" : "no", (t & 0x01) ? "yes" : "no"); - - c = inb(via_base + 0x02) | (inb(via_base + 0x0a) << 8); - via_print("Simplex only: %10s%20s", - (c & 0x80) ? "yes" : "no", (c & 0x8000) ? "yes" : "no"); - - via_print("Cable Type: %10s%20s", - (via_80w & 1) ? "80w" : "40w", (via_80w & 2) ? "80w" : "40w"); - - via_print("-------------------drive0----drive1" - "----drive2----drive3-----"); - - pci_read_config_byte(dev, VIA_ADDRESS_SETUP, &t); - pci_read_config_dword(dev, VIA_DRIVE_TIMING, &v); - pci_read_config_word(dev, VIA_8BIT_TIMING, &w); - - if (via_config->flags & VIA_UDMA) - pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); - else u = 0; - - for (i = 0; i < 4; i++) { - - setup[i] = ((t >> ((3 - i) << 1)) & 0x3) + 1; - recover8b[i] = ((w >> ((1 - (i >> 1)) << 3)) & 0xf) + 1; - active8b[i] = ((w >> (((1 - (i >> 1)) << 3) + 4)) & 0xf) + 1; - active[i] = ((v >> (((3 - i) << 3) + 4)) & 0xf) + 1; - recover[i] = ((v >> ((3 - i) << 3)) & 0xf) + 1; - udma[i] = ((u >> ((3 - i) << 3)) & 0x7) + 2; - umul[i] = ((u >> (((3 - i) & 2) << 3)) & 0x8) ? 1 : 2; - uen[i] = ((u >> ((3 - i) << 3)) & 0x20); - den[i] = (c & ((i & 1) ? 0x40 : 0x20) << ((i & 2) << 2)); - - speed[i] = 2 * via_clock / (active[i] + recover[i]); - cycle[i] = 1000000 * (active[i] + recover[i]) / via_clock; - - if (!uen[i] || !den[i]) - continue; - - switch (via_config->flags & VIA_UDMA) { - - case VIA_UDMA_33: - speed[i] = 2 * via_clock / udma[i]; - cycle[i] = 1000000 * udma[i] / via_clock; - break; - - case VIA_UDMA_66: - speed[i] = 4 * via_clock / (udma[i] * umul[i]); - cycle[i] = 500000 * (udma[i] * umul[i]) / via_clock; - break; - - case VIA_UDMA_100: - speed[i] = 6 * via_clock / udma[i]; - cycle[i] = 333333 * udma[i] / via_clock; - break; - - case VIA_UDMA_133: - speed[i] = 8 * via_clock / udma[i]; - cycle[i] = 250000 * udma[i] / via_clock; - break; - } - } - - via_print_drive("Transfer Mode: ", "%10s", - den[i] ? (uen[i] ? "UDMA" : "DMA") : "PIO"); - - via_print_drive("Address Setup: ", "%8dns", - 1000000 * setup[i] / via_clock); - via_print_drive("Cmd Active: ", "%8dns", - 1000000 * active8b[i] / via_clock); - via_print_drive("Cmd Recovery: ", "%8dns", - 1000000 * recover8b[i] / via_clock); - via_print_drive("Data Active: ", "%8dns", - 1000000 * active[i] / via_clock); - via_print_drive("Data Recovery: ", "%8dns", - 1000000 * recover[i] / via_clock); - via_print_drive("Cycle Time: ", "%8dns", - cycle[i]); - via_print_drive("Transfer Rate: ", "%4d.%dMB/s", - speed[i] / 1000, speed[i] / 100 % 10); - - /* hoping it is less than 4K... */ - len = (p - buffer) - offset; - *addr = buffer + offset; - - return len > count ? count : len; -} - -#endif /* DISPLAY_VIA_TIMINGS && CONFIG_PROC_FS */ - /** * via_set_speed - write timing registers * @dev: PCI device @@ -560,19 +385,6 @@ static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const via_dma[via_config->flags & VIA_UDMA], pci_name(dev)); - /* - * Setup /proc/ide/via entry. - */ - -#if defined(DISPLAY_VIA_TIMINGS) && defined(CONFIG_PROC_FS) - if (!via_proc) { - via_base = pci_resource_start(dev, 4); - bmide_dev = dev; - isa_dev = isa; - ide_pci_create_host_proc("via", via_get_info); - via_proc = 1; - } -#endif /* DISPLAY_VIA_TIMINGS && CONFIG_PROC_FS */ return 0; } -- cgit v1.2.3 From 7462cbff7d4c2dc0d182613fb4e801efb29b90ac Mon Sep 17 00:00:00 2001 From: Daniel Drake Date: Fri, 18 Nov 2005 22:09:45 +0100 Subject: [PATCH] via82cxxx IDE: support multiple controllers Support multiple controllers in the via82cxxx IDE driver. Cable detection and ISA bridge finding have been moved into their own functions. Signed-off-by: Daniel Drake Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/via82cxxx.c | 195 ++++++++++++++++++++++++++------------------ 1 file changed, 117 insertions(+), 78 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index 2fbc215988a..cee2c374cd2 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c @@ -100,11 +100,15 @@ static struct via_isa_bridge { { NULL } }; -static struct via_isa_bridge *via_config; -static unsigned int via_80w; static unsigned int via_clock; static char *via_dma[] = { "MWDMA16", "UDMA33", "UDMA66", "UDMA100", "UDMA133" }; +struct via82cxxx_dev +{ + struct via_isa_bridge *via_config; + unsigned int via_80w; +}; + /** * via_set_speed - write timing registers * @dev: PCI device @@ -114,11 +118,13 @@ static char *via_dma[] = { "MWDMA16", "UDMA33", "UDMA66", "UDMA100", "UDMA133" } * via_set_speed writes timing values to the chipset registers */ -static void via_set_speed(struct pci_dev *dev, u8 dn, struct ide_timing *timing) +static void via_set_speed(ide_hwif_t *hwif, u8 dn, struct ide_timing *timing) { + struct pci_dev *dev = hwif->pci_dev; + struct via82cxxx_dev *vdev = ide_get_hwifdata(hwif); u8 t; - if (~via_config->flags & VIA_BAD_AST) { + if (~vdev->via_config->flags & VIA_BAD_AST) { pci_read_config_byte(dev, VIA_ADDRESS_SETUP, &t); t = (t & ~(3 << ((3 - dn) << 1))) | ((FIT(timing->setup, 1, 4) - 1) << ((3 - dn) << 1)); pci_write_config_byte(dev, VIA_ADDRESS_SETUP, t); @@ -130,7 +136,7 @@ static void via_set_speed(struct pci_dev *dev, u8 dn, struct ide_timing *timing) pci_write_config_byte(dev, VIA_DRIVE_TIMING + (3 - dn), ((FIT(timing->active, 1, 16) - 1) << 4) | (FIT(timing->recover, 1, 16) - 1)); - switch (via_config->flags & VIA_UDMA) { + switch (vdev->via_config->flags & VIA_UDMA) { case VIA_UDMA_33: t = timing->udma ? (0xe0 | (FIT(timing->udma, 2, 5) - 2)) : 0x03; break; case VIA_UDMA_66: t = timing->udma ? (0xe8 | (FIT(timing->udma, 2, 9) - 2)) : 0x0f; break; case VIA_UDMA_100: t = timing->udma ? (0xe0 | (FIT(timing->udma, 2, 9) - 2)) : 0x07; break; @@ -154,6 +160,7 @@ static void via_set_speed(struct pci_dev *dev, u8 dn, struct ide_timing *timing) static int via_set_drive(ide_drive_t *drive, u8 speed) { ide_drive_t *peer = HWIF(drive)->drives + (~drive->dn & 1); + struct via82cxxx_dev *vdev = ide_get_hwifdata(drive->hwif); struct ide_timing t, p; unsigned int T, UT; @@ -162,7 +169,7 @@ static int via_set_drive(ide_drive_t *drive, u8 speed) T = 1000000000 / via_clock; - switch (via_config->flags & VIA_UDMA) { + switch (vdev->via_config->flags & VIA_UDMA) { case VIA_UDMA_33: UT = T; break; case VIA_UDMA_66: UT = T/2; break; case VIA_UDMA_100: UT = T/3; break; @@ -177,7 +184,7 @@ static int via_set_drive(ide_drive_t *drive, u8 speed) ide_timing_merge(&p, &t, &t, IDE_TIMING_8BIT); } - via_set_speed(HWIF(drive)->pci_dev, drive->dn, &t); + via_set_speed(HWIF(drive), drive->dn, &t); if (!drive->init_speed) drive->init_speed = speed; @@ -215,20 +222,41 @@ static void via82cxxx_tune_drive(ide_drive_t *drive, u8 pio) static int via82cxxx_ide_dma_check (ide_drive_t *drive) { - u16 w80 = HWIF(drive)->udma_four; + ide_hwif_t *hwif = HWIF(drive); + struct via82cxxx_dev *vdev = ide_get_hwifdata(hwif); + u16 w80 = hwif->udma_four; u16 speed = ide_find_best_mode(drive, XFER_PIO | XFER_EPIO | XFER_SWDMA | XFER_MWDMA | - (via_config->flags & VIA_UDMA ? XFER_UDMA : 0) | - (w80 && (via_config->flags & VIA_UDMA) >= VIA_UDMA_66 ? XFER_UDMA_66 : 0) | - (w80 && (via_config->flags & VIA_UDMA) >= VIA_UDMA_100 ? XFER_UDMA_100 : 0) | - (w80 && (via_config->flags & VIA_UDMA) >= VIA_UDMA_133 ? XFER_UDMA_133 : 0)); + (vdev->via_config->flags & VIA_UDMA ? XFER_UDMA : 0) | + (w80 && (vdev->via_config->flags & VIA_UDMA) >= VIA_UDMA_66 ? XFER_UDMA_66 : 0) | + (w80 && (vdev->via_config->flags & VIA_UDMA) >= VIA_UDMA_100 ? XFER_UDMA_100 : 0) | + (w80 && (vdev->via_config->flags & VIA_UDMA) >= VIA_UDMA_133 ? XFER_UDMA_133 : 0)); via_set_drive(drive, speed); if (drive->autodma && (speed & XFER_MODE) != XFER_PIO) - return HWIF(drive)->ide_dma_on(drive); - return HWIF(drive)->ide_dma_off_quietly(drive); + return hwif->ide_dma_on(drive); + return hwif->ide_dma_off_quietly(drive); +} + +static struct via_isa_bridge *via_config_find(struct pci_dev **isa) +{ + struct via_isa_bridge *via_config; + u8 t; + + for (via_config = via_isa_bridges; via_config->id; via_config++) + if ((*isa = pci_find_device(PCI_VENDOR_ID_VIA + + !!(via_config->flags & VIA_BAD_ID), + via_config->id, NULL))) { + + pci_read_config_byte(*isa, PCI_REVISION_ID, &t); + if (t >= via_config->rev_min && + t <= via_config->rev_max) + break; + } + + return via_config; } /** @@ -243,82 +271,28 @@ static int via82cxxx_ide_dma_check (ide_drive_t *drive) static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const char *name) { struct pci_dev *isa = NULL; + struct via_isa_bridge *via_config; u8 t, v; unsigned int u; - int i; /* * Find the ISA bridge to see how good the IDE is. */ - - for (via_config = via_isa_bridges; via_config->id; via_config++) - if ((isa = pci_find_device(PCI_VENDOR_ID_VIA + - !!(via_config->flags & VIA_BAD_ID), - via_config->id, NULL))) { - - pci_read_config_byte(isa, PCI_REVISION_ID, &t); - if (t >= via_config->rev_min && - t <= via_config->rev_max) - break; - } - + via_config = via_config_find(&isa); if (!via_config->id) { printk(KERN_WARNING "VP_IDE: Unknown VIA SouthBridge, disabling DMA.\n"); return -ENODEV; } /* - * Check 80-wire cable presence and setup Clk66. + * Setup or disable Clk66 if appropriate */ - switch (via_config->flags & VIA_UDMA) { - - case VIA_UDMA_66: - /* Enable Clk66 */ - pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); - pci_write_config_dword(dev, VIA_UDMA_TIMING, u|0x80008); - for (i = 24; i >= 0; i -= 8) - if (((u >> (i & 16)) & 8) && - ((u >> i) & 0x20) && - (((u >> i) & 7) < 2)) { - /* - * 2x PCI clock and - * UDMA w/ < 3T/cycle - */ - via_80w |= (1 << (1 - (i >> 4))); - } - break; - - case VIA_UDMA_100: - pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); - for (i = 24; i >= 0; i -= 8) - if (((u >> i) & 0x10) || - (((u >> i) & 0x20) && - (((u >> i) & 7) < 4))) { - /* BIOS 80-wire bit or - * UDMA w/ < 60ns/cycle - */ - via_80w |= (1 << (1 - (i >> 4))); - } - break; - - case VIA_UDMA_133: - pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); - for (i = 24; i >= 0; i -= 8) - if (((u >> i) & 0x10) || - (((u >> i) & 0x20) && - (((u >> i) & 7) < 6))) { - /* BIOS 80-wire bit or - * UDMA w/ < 60ns/cycle - */ - via_80w |= (1 << (1 - (i >> 4))); - } - break; - - } - - /* Disable Clk66 */ - if (via_config->flags & VIA_BAD_CLK66) { + if ((via_config->flags & VIA_UDMA) == VIA_UDMA_66) { + /* Enable Clk66 */ + pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); + pci_write_config_dword(dev, VIA_UDMA_TIMING, u|0x80008); + } else if (via_config->flags & VIA_BAD_CLK66) { /* Would cause trouble on 596a and 686 */ pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); pci_write_config_dword(dev, VIA_UDMA_TIMING, u & ~0x80008); @@ -388,10 +362,75 @@ static unsigned int __devinit init_chipset_via82cxxx(struct pci_dev *dev, const return 0; } +/* + * Check and handle 80-wire cable presence + */ +static void __devinit via_cable_detect(struct pci_dev *dev, struct via82cxxx_dev *vdev) +{ + unsigned int u; + int i; + pci_read_config_dword(dev, VIA_UDMA_TIMING, &u); + + switch (vdev->via_config->flags & VIA_UDMA) { + + case VIA_UDMA_66: + for (i = 24; i >= 0; i -= 8) + if (((u >> (i & 16)) & 8) && + ((u >> i) & 0x20) && + (((u >> i) & 7) < 2)) { + /* + * 2x PCI clock and + * UDMA w/ < 3T/cycle + */ + vdev->via_80w |= (1 << (1 - (i >> 4))); + } + break; + + case VIA_UDMA_100: + for (i = 24; i >= 0; i -= 8) + if (((u >> i) & 0x10) || + (((u >> i) & 0x20) && + (((u >> i) & 7) < 4))) { + /* BIOS 80-wire bit or + * UDMA w/ < 60ns/cycle + */ + vdev->via_80w |= (1 << (1 - (i >> 4))); + } + break; + + case VIA_UDMA_133: + for (i = 24; i >= 0; i -= 8) + if (((u >> i) & 0x10) || + (((u >> i) & 0x20) && + (((u >> i) & 7) < 6))) { + /* BIOS 80-wire bit or + * UDMA w/ < 60ns/cycle + */ + vdev->via_80w |= (1 << (1 - (i >> 4))); + } + break; + + } +} + static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) { + struct via82cxxx_dev *vdev = kmalloc(sizeof(struct via82cxxx_dev), + GFP_KERNEL); + struct pci_dev *isa = NULL; int i; + if (vdev == NULL) { + printk(KERN_ERR "VP_IDE: out of memory :(\n"); + return; + } + + memset(vdev, 0, sizeof(struct via82cxxx_dev)); + ide_set_hwifdata(hwif, vdev); + + vdev->via_config = via_config_find(&isa); + via_cable_detect(hwif->pci_dev, vdev); + hwif->autodma = 0; hwif->tuneproc = &via82cxxx_tune_drive; @@ -406,7 +445,7 @@ static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) for (i = 0; i < 2; i++) { hwif->drives[i].io_32bit = 1; - hwif->drives[i].unmask = (via_config->flags & VIA_NO_UNMASK) ? 0 : 1; + hwif->drives[i].unmask = (vdev->via_config->flags & VIA_NO_UNMASK) ? 0 : 1; hwif->drives[i].autotune = 1; hwif->drives[i].dn = hwif->channel * 2 + i; } @@ -420,7 +459,7 @@ static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) hwif->swdma_mask = 0x07; if (!hwif->udma_four) - hwif->udma_four = (via_80w >> hwif->channel) & 1; + hwif->udma_four = (vdev->via_80w >> hwif->channel) & 1; hwif->ide_dma_check = &via82cxxx_ide_dma_check; if (!noautodma) hwif->autodma = 1; -- cgit v1.2.3 From 4ef3b8f4a5c056d5f784725974a530d1a7b4a811 Mon Sep 17 00:00:00 2001 From: Laurent Riffard Date: Fri, 18 Nov 2005 22:15:40 +0100 Subject: [PATCH] ide: remove ide_driver_t.owner field The structure ide_driver_t have a .owner field which is a duplicate of .gendriver.owner field (.gen_driver is a struct device_driver). This patch removes ide_driver_t's owner field. Signed-off-by: Laurent Riffard Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-cd.c | 2 +- drivers/ide/ide-disk.c | 2 +- drivers/ide/ide-floppy.c | 2 +- drivers/ide/ide-tape.c | 2 +- drivers/scsi/ide-scsi.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index c2f47923d17..421b62d900a 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -3328,8 +3328,8 @@ static ide_proc_entry_t idecd_proc[] = { #endif static ide_driver_t ide_cdrom_driver = { - .owner = THIS_MODULE, .gen_driver = { + .owner = THIS_MODULE, .name = "ide-cdrom", .bus = &ide_bus_type, .probe = ide_cd_probe, diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index e827b39e4b3..1a45f75dc9b 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -1089,8 +1089,8 @@ static void ide_device_shutdown(struct device *dev) } static ide_driver_t idedisk_driver = { - .owner = THIS_MODULE, .gen_driver = { + .owner = THIS_MODULE, .name = "ide-disk", .bus = &ide_bus_type, .probe = ide_disk_probe, diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index f615ab75996..94c147b79a4 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -1925,8 +1925,8 @@ static ide_proc_entry_t idefloppy_proc[] = { static int ide_floppy_probe(struct device *); static ide_driver_t idefloppy_driver = { - .owner = THIS_MODULE, .gen_driver = { + .owner = THIS_MODULE, .name = "ide-floppy", .bus = &ide_bus_type, .probe = ide_floppy_probe, diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 0ac7eb8f40d..2069dd693c9 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -4748,8 +4748,8 @@ static ide_proc_entry_t idetape_proc[] = { static int ide_tape_probe(struct device *); static ide_driver_t idetape_driver = { - .owner = THIS_MODULE, .gen_driver = { + .owner = THIS_MODULE, .name = "ide-tape", .bus = &ide_bus_type, .probe = ide_tape_probe, diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index e1960d69fb9..4cb1f3ed910 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c @@ -784,8 +784,8 @@ static ide_proc_entry_t idescsi_proc[] = { #endif static ide_driver_t idescsi_driver = { - .owner = THIS_MODULE, .gen_driver = { + .owner = THIS_MODULE, .name = "ide-scsi", .bus = &ide_bus_type, .probe = ide_scsi_probe, -- cgit v1.2.3 From 305f5167f1e9d832b332933979b6b5e3cc68ce73 Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Fri, 18 Nov 2005 16:17:50 -0500 Subject: [PARISC] Make Serial MUX depend on a specific bus type. Depend on GSC, not PARISC. Machines without GSC don't have a MUX. Signed-off-by: Matthew Wilcox Signed-off-by: Kyle McMartin --- drivers/serial/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index ff36f0c9fda..ad47c1b84c3 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig @@ -507,7 +507,7 @@ config SERIAL_SUNSU_CONSOLE config SERIAL_MUX tristate "Serial MUX support" - depends on PARISC + depends on GSC select SERIAL_CORE default y ---help--- -- cgit v1.2.3 From 41df894007c5607b3892336fd72024c4dfa35bdf Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Fri, 18 Nov 2005 16:18:40 -0500 Subject: [PARISC] Mention PA-RISC in NS87415 help Mention PA-RISC in NS87415 help. PA-RISC [BCJ]xxx0 workstations come with NS87415 integrated for their CD-ROM drives. Signed-off-by: Matthew Wilcox Signed-off-by: Kyle McMartin --- drivers/ide/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index ed2bc87f475..31e649a9ff7 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig @@ -625,7 +625,7 @@ config BLK_DEV_NS87415 tristate "NS87415 chipset support" help This driver adds detection and support for the NS87415 chip - (used in SPARC64, among others). + (used mainly on SPARC64 and PA-RISC machines). Please read the comments at the top of . -- cgit v1.2.3 From cc3f7ca51abb68b6ba0da719f56e33efcc2f450b Mon Sep 17 00:00:00 2001 From: Hanna Linder Date: Fri, 18 Nov 2005 22:19:15 +0100 Subject: [PATCH] alim15x3: replace pci_find_device() with pci_dev_present() From: Hanna Linder The dev returned from pci_find_device() was not used so it can be replaced with pci_dev_present(). Compile tested. Signed-off-by: Hanna Linder Signed-off-by: Maximilian Attems Signed-off-by: Domen Puncer Signed-off-by: Alexey Dobriyan Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/alim15x3.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index 6cf49394a80..ecaab541498 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c @@ -876,9 +876,14 @@ static ide_pci_device_t ali15x3_chipset __devinitdata = { static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_device_id *id) { + static struct pci_device_id ati_rs100[] = { + { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS100) }, + { }, + }; + ide_pci_device_t *d = &ali15x3_chipset; - if(pci_find_device(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS100, NULL)) + if (pci_dev_present(ati_rs100)) printk(KERN_ERR "Warning: ATI Radeon IGP Northbridge is not yet fully tested.\n"); #if defined(CONFIG_SPARC64) -- cgit v1.2.3 From 21b3d1d792af367854e61ee05dd9b2c931b60fed Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Fri, 18 Nov 2005 16:20:10 -0500 Subject: [PARISC] Mark hisax and pcbit ISDN drivers as not for parisc These drivers do not compile on big endian systems, and parisc is big endian. Also mark some as broken on m68k as well. Signed-off-by: Matthew Wilcox Signed-off-by: Kyle McMartin --- drivers/isdn/hisax/Kconfig | 12 ++++++------ drivers/isdn/pcbit/Kconfig | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers') diff --git a/drivers/isdn/hisax/Kconfig b/drivers/isdn/hisax/Kconfig index 801c98f30e5..c82105920d7 100644 --- a/drivers/isdn/hisax/Kconfig +++ b/drivers/isdn/hisax/Kconfig @@ -110,7 +110,7 @@ config HISAX_16_3 config HISAX_TELESPCI bool "Teles PCI" - depends on PCI && (BROKEN || !(SPARC64 || PPC)) + depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K)) help This enables HiSax support for the Teles PCI. See on how to configure it. @@ -238,7 +238,7 @@ config HISAX_MIC config HISAX_NETJET bool "NETjet card" - depends on PCI && (BROKEN || !(SPARC64 || PPC)) + depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K)) help This enables HiSax support for the NetJet from Traverse Technologies. @@ -249,7 +249,7 @@ config HISAX_NETJET config HISAX_NETJET_U bool "NETspider U card" - depends on PCI && (BROKEN || !(SPARC64 || PPC)) + depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K)) help This enables HiSax support for the Netspider U interface ISDN card from Traverse Technologies. @@ -317,7 +317,7 @@ config HISAX_GAZEL config HISAX_HFC_PCI bool "HFC PCI-Bus cards" - depends on PCI && (BROKEN || !(SPARC64 || PPC)) + depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K)) help This enables HiSax support for the HFC-S PCI 2BDS0 based cards. @@ -344,14 +344,14 @@ config HISAX_HFC_SX config HISAX_ENTERNOW_PCI bool "Formula-n enter:now PCI card" - depends on PCI && (BROKEN || !(SPARC64 || PPC)) + depends on PCI && (BROKEN || !(SPARC || PPC || PARISC || M68K)) help This enables HiSax support for the Formula-n enter:now PCI ISDN card. config HISAX_AMD7930 bool "Am7930 (EXPERIMENTAL)" - depends on EXPERIMENTAL && (SPARC32 || SPARC64) + depends on EXPERIMENTAL && SPARC help This enables HiSax support for the AMD7930 chips on some SPARCs. This code is not finished yet. diff --git a/drivers/isdn/pcbit/Kconfig b/drivers/isdn/pcbit/Kconfig index f06997faef1..0933881ab0c 100644 --- a/drivers/isdn/pcbit/Kconfig +++ b/drivers/isdn/pcbit/Kconfig @@ -3,7 +3,7 @@ # config ISDN_DRV_PCBIT tristate "PCBIT-D support" - depends on ISDN_I4L && ISA && (BROKEN || !PPC) + depends on ISDN_I4L && ISA && (BROKEN || X86) help This enables support for the PCBIT ISDN-card. This card is manufactured in Portugal by Octal. For running this card, -- cgit v1.2.3 From 2fefef1828ded4df17cfb51481b9e0782d2b3ce2 Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Fri, 18 Nov 2005 22:22:21 +0100 Subject: [PATCH] alim15x3: use KERN_WARNING Signed-off-by: Alexey Dobriyan Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/alim15x3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index ecaab541498..cf84350efc5 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c @@ -884,7 +884,7 @@ static int __devinit alim15x3_init_one(struct pci_dev *dev, const struct pci_dev ide_pci_device_t *d = &ali15x3_chipset; if (pci_dev_present(ati_rs100)) - printk(KERN_ERR "Warning: ATI Radeon IGP Northbridge is not yet fully tested.\n"); + printk(KERN_WARNING "alim15x3: ATI Radeon IGP Northbridge is not yet fully tested.\n"); #if defined(CONFIG_SPARC64) d->init_hwif = init_hwif_common_ali15x3; -- cgit v1.2.3 From fba51bae8c3797034f497ed68f4ed120a903f941 Mon Sep 17 00:00:00 2001 From: Thibaut VARENE Date: Fri, 18 Nov 2005 22:37:37 +0100 Subject: [PATCH] pmac IDE: don't release empty interfaces From: Thibaut VARENE Cleaning up the hwif without knowing its previous state in pmac.c is a big and potentially dangerous job, and there seems to be no generic code interface that would provide either a way to properly release an hwif or to clean it up. Fixes OOPS for empty PMAC interface and add-on PCI controller. Acked-by: Benjamin Herrenschmidt Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ppc/pmac.c | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 136911a86e8..16b28357885 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c @@ -1401,20 +1401,6 @@ pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) /* We probe the hwif now */ probe_hwif_init(hwif); - /* The code IDE code will have set hwif->present if we have devices attached, - * if we don't, the discard the interface except if we are on a media bay slot - */ - if (!hwif->present && !pmif->mediabay) { - printk(KERN_INFO "ide%d: Bus empty, interface released.\n", - hwif->index); - default_hwif_iops(hwif); - for (i = IDE_DATA_OFFSET; i <= IDE_CONTROL_OFFSET; ++i) - hwif->io_ports[i] = 0; - hwif->chipset = ide_unknown; - hwif->noprobe = 1; - return -ENODEV; - } - return 0; } -- cgit v1.2.3 From ec0fb4bd31e1ef60aa26798f594265a9ad061f21 Mon Sep 17 00:00:00 2001 From: Thibaut VARENE Date: Fri, 18 Nov 2005 22:51:48 +0100 Subject: [PATCH] aec62xxx: remove all dead (#if0'd) code Signed-off-by: Thibaut VARENE Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/aec62xx.c | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c index 52cadc005d7..a21b1e11eef 100644 --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c @@ -65,23 +65,6 @@ static struct chipset_bus_clock_list_entry aec6xxx_34_base [] = { #define BUSCLOCK(D) \ ((struct chipset_bus_clock_list_entry *) pci_get_drvdata((D))) -#if 0 - if (dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) { - (void) pci_read_config_byte(dev, 0x54, &art); - p += sprintf(p, "DMA Mode: %s(%s)", - (c0&0x20)?((art&0x03)?"UDMA":" DMA"):" PIO", - (art&0x02)?"2":(art&0x01)?"1":"0"); - p += sprintf(p, " %s(%s)", - (c0&0x40)?((art&0x0c)?"UDMA":" DMA"):" PIO", - (art&0x08)?"2":(art&0x04)?"1":"0"); - p += sprintf(p, " %s(%s)", - (c1&0x20)?((art&0x30)?"UDMA":" DMA"):" PIO", - (art&0x20)?"2":(art&0x10)?"1":"0"); - p += sprintf(p, " %s(%s)\n", - (c1&0x40)?((art&0xc0)?"UDMA":" DMA"):" PIO", - (art&0x80)?"2":(art&0x40)?"1":"0"); - } else { -#endif /* * TO DO: active tuning and correction of cards without a bios. @@ -112,13 +95,9 @@ static u8 aec62xx_ratemask (ide_drive_t *drive) switch(hwif->pci_dev->device) { case PCI_DEVICE_ID_ARTOP_ATP865: case PCI_DEVICE_ID_ARTOP_ATP865R: -#if 0 - mode = (hwif->INB(hwif->dma_master) & 0x10) ? 4 : 3; -#else mode = (hwif->INB(((hwif->channel) ? hwif->mate->dma_status : hwif->dma_status)) & 0x10) ? 4 : 3; -#endif break; case PCI_DEVICE_ID_ARTOP_ATP860: case PCI_DEVICE_ID_ARTOP_ATP860R: @@ -263,35 +242,9 @@ static int aec62xx_irq_timeout (ide_drive_t *drive) case PCI_DEVICE_ID_ARTOP_ATP865: case PCI_DEVICE_ID_ARTOP_ATP865R: printk(" AEC62XX time out "); -#if 0 - { - int i = 0; - u8 reg49h = 0; - pci_read_config_byte(HWIF(drive)->pci_dev, 0x49, ®49h); - for (i=0;i<256;i++) - pci_write_config_byte(HWIF(drive)->pci_dev, 0x49, reg49h|0x10); - pci_write_config_byte(HWIF(drive)->pci_dev, 0x49, reg49h & ~0x10); - } - return 0; -#endif default: break; } -#if 0 - { - ide_hwif_t *hwif = HWIF(drive); - struct pci_dev *dev = hwif->pci_dev; - u8 tmp1 = 0, tmp2 = 0, mode6 = 0; - - pci_read_config_byte(dev, 0x44, &tmp1); - pci_read_config_byte(dev, 0x45, &tmp2); - printk(" AEC6280 r44=%x r45=%x ",tmp1,tmp2); - mode6 = HWIF(drive)->INB(((hwif->channel) ? - hwif->mate->dma_status : - hwif->dma_status)); - printk(" AEC6280 133=%x ", (mode6 & 0x10)); - } -#endif return 0; } -- cgit v1.2.3 From bf4c796df61c5b3772709bf0fd62296e0ae662d7 Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Fri, 18 Nov 2005 22:55:47 +0100 Subject: [PATCH] siimage: docs urls Signed-off-by: Jeff Garzik Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/siimage.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index 022d244f2eb..f1ca154dd52 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c @@ -6,7 +6,13 @@ * * May be copied or modified under the terms of the GNU General Public License * - * Documentation available under NDA only + * Documentation for CMD680: + * http://gkernel.sourceforge.net/specs/sii/sii-0680a-v1.31.pdf.bz2 + * + * Documentation for SiI 3112: + * http://gkernel.sourceforge.net/specs/sii/3112A_SiI-DS-0095-B2.pdf.bz2 + * + * Errata and other documentation only available under NDA. * * * FAQ Items: -- cgit v1.2.3 From 1e39dead2bfa8023bcdee4f1e5e6c933aff24e20 Mon Sep 17 00:00:00 2001 From: Amit Gud Date: Fri, 18 Nov 2005 23:03:19 +0100 Subject: [PATCH] cs5520: fix return value of cs5520_init_one() From: Amit Gud Patch follows from the suggestions by AC and Felipe W Damasio for fixing the return codes from IDE drivers. [ bart: fix coding style while at it ] Signed-off-by: Amit Gud Signed-off-by: Domen Puncer Signed-off-by: Alexey Dobriyan Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/cs5520.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c index 7dc24682d19..ea3c52cc8ac 100644 --- a/drivers/ide/pci/cs5520.c +++ b/drivers/ide/pci/cs5520.c @@ -222,10 +222,9 @@ static int __devinit cs5520_init_one(struct pci_dev *dev, const struct pci_devic /* We must not grab the entire device, it has 'ISA' space in its BARS too and we will freak out other bits of the kernel */ - if(pci_enable_device_bars(dev, 1<<2)) - { + if (pci_enable_device_bars(dev, 1<<2)) { printk(KERN_WARNING "%s: Unable to enable 55x0.\n", d->name); - return 1; + return -ENODEV; } pci_set_master(dev); if (pci_set_dma_mask(dev, DMA_32BIT_MASK)) { -- cgit v1.2.3 From 48fd0d1fdd357caa2de8cb4ce6af810df7535f43 Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Fri, 18 Nov 2005 14:11:17 -0800 Subject: IB/mthca: Safer max_send_sge/max_recv_sge calculation Calculation of QP capabilities still isn't exactly right in mthca: max_send_sge/max_recv_sge fields returned in create_qp can exceed the handware supported limits. Signed-off-by: Michael S. Tsirkin Signed-off-by: Roland Dreier --- drivers/infiniband/hw/mthca/mthca_qp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c index 5899f0c765b..dd4e13303e9 100644 --- a/drivers/infiniband/hw/mthca/mthca_qp.c +++ b/drivers/infiniband/hw/mthca/mthca_qp.c @@ -918,10 +918,12 @@ static void mthca_adjust_qp_caps(struct mthca_dev *dev, else qp->max_inline_data = max_data_size - MTHCA_INLINE_HEADER_SIZE; - qp->sq.max_gs = max_data_size / sizeof (struct mthca_data_seg); - qp->rq.max_gs = (min(dev->limits.max_desc_sz, 1 << qp->rq.wqe_shift) - - sizeof (struct mthca_next_seg)) / - sizeof (struct mthca_data_seg); + qp->sq.max_gs = min_t(int, dev->limits.max_sg, + max_data_size / sizeof (struct mthca_data_seg)); + qp->rq.max_gs = min_t(int, dev->limits.max_sg, + (min(dev->limits.max_desc_sz, 1 << qp->rq.wqe_shift) - + sizeof (struct mthca_next_seg)) / + sizeof (struct mthca_data_seg)); } /* -- cgit v1.2.3 From c37ea218cb43c67bf1578f5e535fcc3a751018ef Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Fri, 18 Nov 2005 23:11:24 +0100 Subject: [PATCH] ide: make comment match reality Signed-off-by: Ralf Baechle Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/setup-pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index d4f2111d436..7ebf992e8c2 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c @@ -787,7 +787,7 @@ static int pre_init = 1; /* Before first ordered IDE scan */ static LIST_HEAD(ide_pci_drivers); /* - * __ide_register_pci_driver - attach IDE driver + * __ide_pci_register_driver - attach IDE driver * @driver: pci driver * @module: owner module of the driver * -- cgit v1.2.3 From 6593178dd46d64a5bcb0402a4f3acd95b0687abd Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Fri, 18 Nov 2005 23:13:33 +0100 Subject: [PATCH] ide: fix ide_toggle_bounce() to not try to bounce if we have an IOMMU The following patch fixes a crash caused by attempting to bounce buffer when an IDE CD-ROM is used on a machine with an IO-MMU. [At least, this patch fixes things so I can use my IDE CD-ROM behind an ns87415 on a HP PA-RISC workstation.] Signed-off-by: James Bottomley Signed-off-by: Kyle McMartin Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-lib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-lib.c b/drivers/ide/ide-lib.c index b09a6537c7a..41d46dbe6c2 100644 --- a/drivers/ide/ide-lib.c +++ b/drivers/ide/ide-lib.c @@ -410,10 +410,10 @@ void ide_toggle_bounce(ide_drive_t *drive, int on) { u64 addr = BLK_BOUNCE_HIGH; /* dma64_addr_t */ - if (on && drive->media == ide_disk) { - if (!PCI_DMA_BUS_IS_PHYS) - addr = BLK_BOUNCE_ANY; - else if (HWIF(drive)->pci_dev) + if (!PCI_DMA_BUS_IS_PHYS) { + addr = BLK_BOUNCE_ANY; + } else if (on && drive->media == ide_disk) { + if (HWIF(drive)->pci_dev) addr = HWIF(drive)->pci_dev->dma_mask; } -- cgit v1.2.3 From eabc77935d8d2a761c88b9cbb6313bd54b6ddbb3 Mon Sep 17 00:00:00 2001 From: Roland Dreier Date: Fri, 18 Nov 2005 14:18:26 -0800 Subject: IB/umad: make sure write()s have sufficient data Make sure that userspace passes in enough data when sending a MAD. We always copy at least sizeof (struct ib_user_mad) + IB_MGMT_RMPP_HDR bytes from userspace, so anything less is definitely invalid. Also, if the length is less than this limit, it's possible for the second copy_from_user() to get a negative length and trigger a BUG(). Signed-off-by: Roland Dreier --- drivers/infiniband/core/user_mad.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c index 5ea741f47fc..e73f81c2238 100644 --- a/drivers/infiniband/core/user_mad.c +++ b/drivers/infiniband/core/user_mad.c @@ -312,7 +312,7 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf, int ret, length, hdr_len, copy_offset; int rmpp_active = 0; - if (count < sizeof (struct ib_user_mad)) + if (count < sizeof (struct ib_user_mad) + IB_MGMT_RMPP_HDR) return -EINVAL; length = count - sizeof (struct ib_user_mad); -- cgit v1.2.3 From b63d4f0fb80918ab37b6c0ee1adcd49e05c9994c Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 19 Nov 2005 11:10:35 +0000 Subject: [SERIAL] Fix status reporting with PL011 serial driver The receiver status register reports latched error conditions, which must be cleared by writing to it. However, the data register reports unlatched conditions which are associated with the current character. Use the data register to interpret error status rather than the RSR. Signed-off-by: Russell King --- drivers/serial/amba-pl011.c | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) (limited to 'drivers') diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c index 938d185841c..89d7bd3eaee 100644 --- a/drivers/serial/amba-pl011.c +++ b/drivers/serial/amba-pl011.c @@ -49,7 +49,6 @@ #include #include -#include #include #include #include @@ -63,7 +62,8 @@ #define AMBA_ISR_PASS_LIMIT 256 -#define UART_DUMMY_RSR_RX 256 +#define UART_DR_ERROR (UART011_DR_OE|UART011_DR_BE|UART011_DR_PE|UART011_DR_FE) +#define UART_DUMMY_DR_RX (1 << 16) /* * We wrap our port structure around the generic uart_port. @@ -116,7 +116,7 @@ pl011_rx_chars(struct uart_amba_port *uap) #endif { struct tty_struct *tty = uap->port.info->tty; - unsigned int status, ch, flag, rsr, max_count = 256; + unsigned int status, ch, flag, max_count = 256; status = readw(uap->port.membase + UART01x_FR); while ((status & UART01x_FR_RXFE) == 0 && max_count--) { @@ -129,7 +129,7 @@ pl011_rx_chars(struct uart_amba_port *uap) */ } - ch = readw(uap->port.membase + UART01x_DR); + ch = readw(uap->port.membase + UART01x_DR) | UART_DUMMY_DR_RX; flag = TTY_NORMAL; uap->port.icount.rx++; @@ -137,34 +137,33 @@ pl011_rx_chars(struct uart_amba_port *uap) * Note that the error handling code is * out of the main execution path */ - rsr = readw(uap->port.membase + UART01x_RSR) | UART_DUMMY_RSR_RX; - if (unlikely(rsr & UART01x_RSR_ANY)) { - if (rsr & UART01x_RSR_BE) { - rsr &= ~(UART01x_RSR_FE | UART01x_RSR_PE); + if (unlikely(ch & UART_DR_ERROR)) { + if (ch & UART011_DR_BE) { + ch &= ~(UART011_DR_FE | UART011_DR_PE); uap->port.icount.brk++; if (uart_handle_break(&uap->port)) goto ignore_char; - } else if (rsr & UART01x_RSR_PE) + } else if (ch & UART011_DR_PE) uap->port.icount.parity++; - else if (rsr & UART01x_RSR_FE) + else if (ch & UART011_DR_FE) uap->port.icount.frame++; - if (rsr & UART01x_RSR_OE) + if (ch & UART011_DR_OE) uap->port.icount.overrun++; - rsr &= uap->port.read_status_mask; + ch &= uap->port.read_status_mask; - if (rsr & UART01x_RSR_BE) + if (ch & UART011_DR_BE) flag = TTY_BREAK; - else if (rsr & UART01x_RSR_PE) + else if (ch & UART011_DR_PE) flag = TTY_PARITY; - else if (rsr & UART01x_RSR_FE) + else if (ch & UART011_DR_FE) flag = TTY_FRAME; } if (uart_handle_sysrq_char(&uap->port, ch, regs)) goto ignore_char; - uart_insert_char(&uap->port, rsr, UART01x_RSR_OE, ch, flag); + uart_insert_char(&uap->port, ch, UART011_DR_OE, ch, flag); ignore_char: status = readw(uap->port.membase + UART01x_FR); @@ -476,33 +475,33 @@ pl011_set_termios(struct uart_port *port, struct termios *termios, */ uart_update_timeout(port, termios->c_cflag, baud); - port->read_status_mask = UART01x_RSR_OE; + port->read_status_mask = UART011_DR_OE | 255; if (termios->c_iflag & INPCK) - port->read_status_mask |= UART01x_RSR_FE | UART01x_RSR_PE; + port->read_status_mask |= UART011_DR_FE | UART011_DR_PE; if (termios->c_iflag & (BRKINT | PARMRK)) - port->read_status_mask |= UART01x_RSR_BE; + port->read_status_mask |= UART011_DR_BE; /* * Characters to ignore */ port->ignore_status_mask = 0; if (termios->c_iflag & IGNPAR) - port->ignore_status_mask |= UART01x_RSR_FE | UART01x_RSR_PE; + port->ignore_status_mask |= UART011_DR_FE | UART011_DR_PE; if (termios->c_iflag & IGNBRK) { - port->ignore_status_mask |= UART01x_RSR_BE; + port->ignore_status_mask |= UART011_DR_BE; /* * If we're ignoring parity and break indicators, * ignore overruns too (for real raw support). */ if (termios->c_iflag & IGNPAR) - port->ignore_status_mask |= UART01x_RSR_OE; + port->ignore_status_mask |= UART011_DR_OE; } /* * Ignore all characters if CREAD is not set. */ if ((termios->c_cflag & CREAD) == 0) - port->ignore_status_mask |= UART_DUMMY_RSR_RX; + port->ignore_status_mask |= UART_DUMMY_DR_RX; if (UART_ENABLE_MS(port, termios->c_cflag)) pl011_enable_ms(port); -- cgit v1.2.3 From 832f4ede791ae0a96dcbb231ccb181ad7a54bfc2 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 19 Nov 2005 11:26:17 +0000 Subject: [SERIAL] Remove unused variable in sa1100.c Since the spinlock was removed from sa1100_start_tx(), the "flags" variable becomes redundant. Remove it. Signed-off-by: Russell King --- drivers/serial/sa1100.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers') diff --git a/drivers/serial/sa1100.c b/drivers/serial/sa1100.c index 0e3daf6d7b5..25a086458ab 100644 --- a/drivers/serial/sa1100.c +++ b/drivers/serial/sa1100.c @@ -161,7 +161,6 @@ static void sa1100_stop_tx(struct uart_port *port) static void sa1100_start_tx(struct uart_port *port) { struct sa1100_port *sport = (struct sa1100_port *)port; - unsigned long flags; u32 utcr3; utcr3 = UART_GET_UTCR3(sport); -- cgit v1.2.3 From 4f1d774aadfc5a6ed1545dca180f66ab6d0f543d Mon Sep 17 00:00:00 2001 From: Mathias Kretschmer Date: Sat, 19 Nov 2005 21:32:38 +0100 Subject: [PATCH] via82cxxx: add VIA VT6410 IDE support From: Mathias Kretschmer Signed-off-by: Daniel Drake Acked-by: Alan Cox Signed-off-by: Andrew Morton Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/via82cxxx.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/pci/via82cxxx.c b/drivers/ide/pci/via82cxxx.c index cee2c374cd2..7161ce0ef5a 100644 --- a/drivers/ide/pci/via82cxxx.c +++ b/drivers/ide/pci/via82cxxx.c @@ -79,6 +79,7 @@ static struct via_isa_bridge { u8 rev_max; u16 flags; } via_isa_bridges[] = { + { "vt6410", PCI_DEVICE_ID_VIA_6410, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, { "vt8237", PCI_DEVICE_ID_VIA_8237, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, { "vt8235", PCI_DEVICE_ID_VIA_8235, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, { "vt8233a", PCI_DEVICE_ID_VIA_8233A, 0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST }, @@ -467,24 +468,35 @@ static void __devinit init_hwif_via82cxxx(ide_hwif_t *hwif) hwif->drives[1].autodma = hwif->autodma; } -static ide_pci_device_t via82cxxx_chipset __devinitdata = { - .name = "VP_IDE", - .init_chipset = init_chipset_via82cxxx, - .init_hwif = init_hwif_via82cxxx, - .channels = 2, - .autodma = NOAUTODMA, - .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, - .bootable = ON_BOARD, +static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { + { /* 0 */ + .name = "VP_IDE", + .init_chipset = init_chipset_via82cxxx, + .init_hwif = init_hwif_via82cxxx, + .channels = 2, + .autodma = NOAUTODMA, + .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, + .bootable = ON_BOARD + },{ /* 1 */ + .name = "VP_IDE", + .init_chipset = init_chipset_via82cxxx, + .init_hwif = init_hwif_via82cxxx, + .channels = 2, + .autodma = AUTODMA, + .enablebits = {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, + .bootable = ON_BOARD, + } }; static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id) { - return ide_setup_pci_device(dev, &via82cxxx_chipset); + return ide_setup_pci_device(dev, &via82cxxx_chipsets[id->driver_data]); } static struct pci_device_id via_pci_tbl[] = { { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C576_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, + { PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_6410, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1}, { 0, }, }; MODULE_DEVICE_TABLE(pci, via_pci_tbl); -- cgit v1.2.3 From 14351f8e573442e2437d4b177fa10075aaefd5c9 Mon Sep 17 00:00:00 2001 From: Aurelien Jarno Date: Sat, 19 Nov 2005 21:43:45 +0100 Subject: [PATCH] sis5513: enable ATA133 for the SiS965 southbridge Signed-off-by: Aurelien Jarno Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/pci/sis5513.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers') diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index 16b3e2d8bfb..75a2253a3e6 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c @@ -87,6 +87,7 @@ static const struct { u8 chipset_family; u8 flags; } SiSHostChipInfo[] = { + { "SiS965", PCI_DEVICE_ID_SI_965, ATA_133 }, { "SiS745", PCI_DEVICE_ID_SI_745, ATA_100 }, { "SiS735", PCI_DEVICE_ID_SI_735, ATA_100 }, { "SiS733", PCI_DEVICE_ID_SI_733, ATA_100 }, -- cgit v1.2.3 From 071ffcc0f7dd8df871f443be3f5059f05da528e2 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 19 Nov 2005 22:01:35 +0100 Subject: [PATCH] ide: remove unused ide_action_t:ide_next Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-io.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 5275cbb1afe..ecfafcdafea 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c @@ -1629,12 +1629,6 @@ EXPORT_SYMBOL(ide_init_drive_cmd); * for the new rq to be completed. This is VERY DANGEROUS, and is * intended for careful use by the ATAPI tape/cdrom driver code. * - * If action is ide_next, then the rq is queued immediately after - * the currently-being-processed-request (if any), and the function - * returns without waiting for the new rq to be completed. As above, - * This is VERY DANGEROUS, and is intended for careful use by the - * ATAPI tape/cdrom driver code. - * * If action is ide_end, then the rq is queued at the end of the * request queue, and the function returns immediately without waiting * for the new rq to be completed. This is again intended for careful -- cgit v1.2.3 From c0bc113373d94ebd89d0d024421df8aac60ed08a Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 19 Nov 2005 22:04:10 +0100 Subject: [PATCH] ide: remove dead DEBUG_TASKFILE code Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-taskfile.c | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 54f9639c2a8..b3c32c5fef3 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -51,8 +51,6 @@ #include #include -#define DEBUG_TASKFILE 0 /* unset when fixed */ - static void ata_bswap_data (void *buffer, int wcount) { u16 *p = buffer; @@ -765,9 +763,6 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task) ide_hwif_t *hwif = HWIF(drive); task_struct_t *taskfile = (task_struct_t *) task->tfRegister; hob_struct_t *hobfile = (hob_struct_t *) task->hobRegister; -#if DEBUG_TASKFILE - u8 status; -#endif if (task->data_phase == TASKFILE_MULTI_IN || task->data_phase == TASKFILE_MULTI_OUT) { @@ -803,16 +798,6 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task) hwif->OUTB(drive->ctl, IDE_CONTROL_REG); SELECT_MASK(drive, 0); -#if DEBUG_TASKFILE - status = hwif->INB(IDE_STATUS_REG); - if (status & 0x80) { - printk("flagged_taskfile -> Bad status. Status = %02x. wait 100 usec ...\n", status); - udelay(100); - status = hwif->INB(IDE_STATUS_REG); - printk("flagged_taskfile -> Status = %02x\n", status); - } -#endif - if (task->tf_out_flags.b.data) { u16 data = taskfile->data + (hobfile->data << 8); hwif->OUTW(data, IDE_DATA_REG); -- cgit v1.2.3 From e07bc7096424b977e53a16d72ec02645389107ba Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 19 Nov 2005 22:17:55 +0100 Subject: [PATCH] ide: remove dead code from flagged_taskfile() flagged_taskfile() is called from execute_drive_cmd() (the only user) only if args->tf_out_flags.all != 0. Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-taskfile.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index b3c32c5fef3..62ebefd6394 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -773,19 +773,13 @@ ide_startstop_t flagged_taskfile (ide_drive_t *drive, ide_task_t *task) } /* - * (ks) Check taskfile in/out flags. + * (ks) Check taskfile in flags. * If set, then execute as it is defined. * If not set, then define default settings. * The default values are: - * write and read all taskfile registers (except data) - * write and read the hob registers (sector,nsector,lcyl,hcyl) + * read all taskfile registers (except data) + * read the hob registers (sector, nsector, lcyl, hcyl) */ - if (task->tf_out_flags.all == 0) { - task->tf_out_flags.all = IDE_TASKFILE_STD_OUT_FLAGS; - if (drive->addressing == 1) - task->tf_out_flags.all |= (IDE_HOB_STD_OUT_FLAGS << 8); - } - if (task->tf_in_flags.all == 0) { task->tf_in_flags.all = IDE_TASKFILE_STD_IN_FLAGS; if (drive->addressing == 1) -- cgit v1.2.3 From 17514e8a6f1836a5c95b1f18d2bc0493ad732cf0 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 19 Nov 2005 22:24:35 +0100 Subject: [PATCH] ide: add missing __init tags to device drivers Also remove bogus comments for idefloppy_init() and idetape_init(). Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/ide-cd.c | 4 ++-- drivers/ide/ide-disk.c | 2 +- drivers/ide/ide-floppy.c | 5 +---- drivers/ide/ide-tape.c | 5 +---- 4 files changed, 5 insertions(+), 11 deletions(-) (limited to 'drivers') diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 421b62d900a..9455e42abb2 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c @@ -3510,8 +3510,8 @@ static void __exit ide_cdrom_exit(void) { driver_unregister(&ide_cdrom_driver.gen_driver); } - -static int ide_cdrom_init(void) + +static int __init ide_cdrom_init(void) { return driver_register(&ide_cdrom_driver.gen_driver); } diff --git a/drivers/ide/ide-disk.c b/drivers/ide/ide-disk.c index 1a45f75dc9b..f4e3d3527b0 100644 --- a/drivers/ide/ide-disk.c +++ b/drivers/ide/ide-disk.c @@ -1266,7 +1266,7 @@ static void __exit idedisk_exit (void) driver_unregister(&idedisk_driver.gen_driver); } -static int idedisk_init (void) +static int __init idedisk_init(void) { return driver_register(&idedisk_driver.gen_driver); } diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 94c147b79a4..9e293c8063d 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c @@ -2191,10 +2191,7 @@ static void __exit idefloppy_exit (void) driver_unregister(&idefloppy_driver.gen_driver); } -/* - * idefloppy_init will register the driver for each floppy. - */ -static int idefloppy_init (void) +static int __init idefloppy_init(void) { printk("ide-floppy driver " IDEFLOPPY_VERSION "\n"); return driver_register(&idefloppy_driver.gen_driver); diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 2069dd693c9..7d7944ed415 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c @@ -4916,10 +4916,7 @@ static void __exit idetape_exit (void) unregister_chrdev(IDETAPE_MAJOR, "ht"); } -/* - * idetape_init will register the driver for each tape. - */ -static int idetape_init (void) +static int __init idetape_init(void) { int error = 1; idetape_sysfs_class = class_create(THIS_MODULE, "ide_tape"); -- cgit v1.2.3 From 0d4c859734a818721b2d5ac712283ba8f92bd23a Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Sun, 20 Nov 2005 00:49:42 -0500 Subject: Input: atkbd - speed up setting leds/repeat state Changing led state is pretty slow operation; when there are multiple requests coming at a high rate they may interfere with normal typing. Try optimize (skip) changing hardware state when multiple requests are coming back-to-back. Signed-off-by: Dmitry Torokhov --- drivers/input/keyboard/atkbd.c | 99 +++++++++++++++++++++++++++++------------- 1 file changed, 68 insertions(+), 31 deletions(-) (limited to 'drivers') diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index 820c7fd9a60..a0256f8de8e 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c @@ -166,6 +166,9 @@ static unsigned char atkbd_unxlate_table[128] = { #define ATKBD_SPECIAL 248 +#define ATKBD_LED_EVENT_BIT 0 +#define ATKBD_REP_EVENT_BIT 1 + static struct { unsigned char keycode; unsigned char set2; @@ -211,6 +214,10 @@ struct atkbd { unsigned char err_xl; unsigned int last; unsigned long time; + + struct work_struct event_work; + struct semaphore event_sem; + unsigned long event_mask; }; static ssize_t atkbd_attr_show_helper(struct device *dev, char *buf, @@ -424,58 +431,86 @@ out: } /* - * Event callback from the input module. Events that change the state of - * the hardware are processed here. + * atkbd_event_work() is used to complete processing of events that + * can not be processed by input_event() which is often called from + * interrupt context. */ -static int atkbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) +static void atkbd_event_work(void *data) { - struct atkbd *atkbd = dev->private; const short period[32] = { 33, 37, 42, 46, 50, 54, 58, 63, 67, 75, 83, 92, 100, 109, 116, 125, 133, 149, 167, 182, 200, 217, 232, 250, 270, 303, 333, 370, 400, 435, 470, 500 }; const short delay[4] = { 250, 500, 750, 1000 }; + + struct atkbd *atkbd = data; + struct input_dev *dev = atkbd->dev; unsigned char param[2]; int i, j; + down(&atkbd->event_sem); + + if (test_and_clear_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask)) { + param[0] = (test_bit(LED_SCROLLL, dev->led) ? 1 : 0) + | (test_bit(LED_NUML, dev->led) ? 2 : 0) + | (test_bit(LED_CAPSL, dev->led) ? 4 : 0); + ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETLEDS); + + if (atkbd->extra) { + param[0] = 0; + param[1] = (test_bit(LED_COMPOSE, dev->led) ? 0x01 : 0) + | (test_bit(LED_SLEEP, dev->led) ? 0x02 : 0) + | (test_bit(LED_SUSPEND, dev->led) ? 0x04 : 0) + | (test_bit(LED_MISC, dev->led) ? 0x10 : 0) + | (test_bit(LED_MUTE, dev->led) ? 0x20 : 0); + ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_EX_SETLEDS); + } + } + + if (test_and_clear_bit(ATKBD_REP_EVENT_BIT, &atkbd->event_mask)) { + i = j = 0; + while (i < 31 && period[i] < dev->rep[REP_PERIOD]) + i++; + while (j < 3 && delay[j] < dev->rep[REP_DELAY]) + j++; + dev->rep[REP_PERIOD] = period[i]; + dev->rep[REP_DELAY] = delay[j]; + param[0] = i | (j << 5); + ps2_command(&atkbd->ps2dev, param, ATKBD_CMD_SETREP); + } + + up(&atkbd->event_sem); +} + +/* + * Event callback from the input module. Events that change the state of + * the hardware are processed here. If action can not be performed in + * interrupt context it is offloaded to atkbd_event_work. + */ + +static int atkbd_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) +{ + struct atkbd *atkbd = dev->private; + if (!atkbd->write) return -1; switch (type) { case EV_LED: - - param[0] = (test_bit(LED_SCROLLL, dev->led) ? 1 : 0) - | (test_bit(LED_NUML, dev->led) ? 2 : 0) - | (test_bit(LED_CAPSL, dev->led) ? 4 : 0); - ps2_schedule_command(&atkbd->ps2dev, param, ATKBD_CMD_SETLEDS); - - if (atkbd->extra) { - param[0] = 0; - param[1] = (test_bit(LED_COMPOSE, dev->led) ? 0x01 : 0) - | (test_bit(LED_SLEEP, dev->led) ? 0x02 : 0) - | (test_bit(LED_SUSPEND, dev->led) ? 0x04 : 0) - | (test_bit(LED_MISC, dev->led) ? 0x10 : 0) - | (test_bit(LED_MUTE, dev->led) ? 0x20 : 0); - ps2_schedule_command(&atkbd->ps2dev, param, ATKBD_CMD_EX_SETLEDS); - } - + set_bit(ATKBD_LED_EVENT_BIT, &atkbd->event_mask); + wmb(); + schedule_work(&atkbd->event_work); return 0; case EV_REP: - if (atkbd->softrepeat) return 0; - - i = j = 0; - while (i < 31 && period[i] < dev->rep[REP_PERIOD]) - i++; - while (j < 3 && delay[j] < dev->rep[REP_DELAY]) - j++; - dev->rep[REP_PERIOD] = period[i]; - dev->rep[REP_DELAY] = delay[j]; - param[0] = i | (j << 5); - ps2_schedule_command(&atkbd->ps2dev, param, ATKBD_CMD_SETREP); + if (!atkbd->softrepeat) { + set_bit(ATKBD_REP_EVENT_BIT, &atkbd->event_mask); + wmb(); + schedule_work(&atkbd->event_work); + } return 0; } @@ -810,6 +845,8 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv) atkbd->dev = dev; ps2_init(&atkbd->ps2dev, serio); + INIT_WORK(&atkbd->event_work, atkbd_event_work, atkbd); + init_MUTEX(&atkbd->event_sem); switch (serio->id.type) { -- cgit v1.2.3 From 5fc1468029e2a4da90ded1e0e2cdd94fbdf83bac Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Sun, 20 Nov 2005 00:50:06 -0500 Subject: Input: add Wistron driver A driver for laptop buttons using an x86 BIOS interface that is apparently used on quite a few laptops and seems to be originating from Wistron. This driver currently "knows" only about Fujitsu-Siemens Amilo Pro V2000 (i.e. it can detect the laptop using DMI and it contains the keycode->key meaning mapping for this laptop) and Xeron SonicPro X 155G (probably can't be reliably autodetected, requires a module parameter), adding other laptops should be easy. In addition to reporting button presses to the input layer the driver also allows enabling/disabling the embedded wireless NIC (using the "Wifi" button); this is done using the same BIOS interface, so it seems only logical to keep the implementation together. Any flexibility possibly gained by allowing users to remap the function of the "Wifi" button is IMHO not worth it when weighted against the necessity to run an user-space daemon to convert button presses to wifi state changes. Signed-off-by: Miloslav Trmac Signed-off-by: Dmitry Torokhov --- drivers/input/misc/Kconfig | 10 + drivers/input/misc/Makefile | 1 + drivers/input/misc/wistron_btns.c | 443 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 454 insertions(+) create mode 100644 drivers/input/misc/wistron_btns.c (limited to 'drivers') diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index b3eaac1b35b..06e91c856b3 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig @@ -40,6 +40,16 @@ config INPUT_M68K_BEEP tristate "M68k Beeper support" depends on M68K +config INPUT_WISTRON_BTNS + tristate "x86 Wistron laptop button interface" + depends on X86 + help + Say Y here for support of Winstron laptop button interface, used on + laptops of various brands, including Acer and Fujitsu-Siemens. + + To compile this driver as a module, choose M here: the module will + be called wistron_btns. + config INPUT_UINPUT tristate "User level driver support" help diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile index f8d01c69f34..ce44cce0128 100644 --- a/drivers/input/misc/Makefile +++ b/drivers/input/misc/Makefile @@ -9,4 +9,5 @@ obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o obj-$(CONFIG_INPUT_98SPKR) += 98spkr.o obj-$(CONFIG_INPUT_UINPUT) += uinput.o +obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c new file mode 100644 index 00000000000..76d32e365b5 --- /dev/null +++ b/drivers/input/misc/wistron_btns.c @@ -0,0 +1,443 @@ +/* + * Wistron laptop button driver + * Copyright (C) 2005 Miloslav Trmac + * + * You can redistribute and/or modify this program under the terms of the + * GNU General Public License version 2 as published by the Free Software + * Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General + * Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place Suite 330, Boston, MA 02111-1307, USA. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Number of attempts to read data from queue per poll; + * the queue can hold up to 31 entries + */ +#define MAX_POLL_ITERATIONS 64 + +#define POLL_FREQUENCY 10 /* Number of polls per second */ + +#if POLL_FREQUENCY > HZ +#error "POLL_FREQUENCY too high" +#endif + +MODULE_AUTHOR("Miloslav Trmac "); +MODULE_DESCRIPTION("Wistron laptop button driver"); +MODULE_LICENSE("GPL v2"); +MODULE_VERSION("0.1"); + +static int force; /* = 0; */ +module_param(force, bool, 0); +MODULE_PARM_DESC(force, "Load even if computer is not in database"); + +static char *keymap_name; /* = NULL; */ +module_param_named(keymap, keymap_name, charp, 0); +MODULE_PARM_DESC(keymap, "Keymap name, if it can't be autodetected"); + + /* BIOS interface implementation */ + +static void __iomem *bios_entry_point; /* BIOS routine entry point */ +static void __iomem *bios_code_map_base; +static void __iomem *bios_data_map_base; + +static u8 cmos_address; + +struct regs { + u32 eax, ebx, ecx; +}; + +static void call_bios(struct regs *regs) +{ + unsigned long flags; + + preempt_disable(); + local_irq_save(flags); + asm volatile ("pushl %%ebp;" + "movl %7, %%ebp;" + "call *%6;" + "popl %%ebp" + : "=a" (regs->eax), "=b" (regs->ebx), "=c" (regs->ecx) + : "0" (regs->eax), "1" (regs->ebx), "2" (regs->ecx), + "m" (bios_entry_point), "m" (bios_data_map_base) + : "edx", "edi", "esi", "memory"); + local_irq_restore(flags); + preempt_enable(); +} + +static size_t __init locate_wistron_bios(void __iomem *base) +{ + static const unsigned char __initdata signature[] = + { 0x42, 0x21, 0x55, 0x30 }; + size_t offset; + + for (offset = 0; offset < 0x10000; offset += 0x10) { + if (check_signature(base + offset, signature, + sizeof(signature)) != 0) + return offset; + } + return -1; +} + +static int __init map_bios(void) +{ + void __iomem *base; + size_t offset; + u32 entry_point; + + base = ioremap(0xF0000, 0x10000); /* Can't fail */ + offset = locate_wistron_bios(base); + if (offset < 0) { + printk(KERN_ERR "wistron_btns: BIOS entry point not found\n"); + iounmap(base); + return -ENODEV; + } + + entry_point = readl(base + offset + 5); + printk(KERN_DEBUG + "wistron_btns: BIOS signature found at %p, entry point %08X\n", + base + offset, entry_point); + + if (entry_point >= 0xF0000) { + bios_code_map_base = base; + bios_entry_point = bios_code_map_base + (entry_point & 0xFFFF); + } else { + iounmap(base); + bios_code_map_base = ioremap(entry_point & ~0x3FFF, 0x4000); + if (bios_code_map_base == NULL) { + printk(KERN_ERR + "wistron_btns: Can't map BIOS code at %08X\n", + entry_point & ~0x3FFF); + goto err; + } + bios_entry_point = bios_code_map_base + (entry_point & 0x3FFF); + } + /* The Windows driver maps 0x10000 bytes, we keep only one page... */ + bios_data_map_base = ioremap(0x400, 0xc00); + if (bios_data_map_base == NULL) { + printk(KERN_ERR "wistron_btns: Can't map BIOS data\n"); + goto err_code; + } + return 0; + +err_code: + iounmap(bios_code_map_base); +err: + return -ENOMEM; +} + +static void __exit unmap_bios(void) +{ + iounmap(bios_code_map_base); + iounmap(bios_data_map_base); +} + + /* BIOS calls */ + +static u16 bios_pop_queue(void) +{ + struct regs regs; + + memset(®s, 0, sizeof (regs)); + regs.eax = 0x9610; + regs.ebx = 0x061C; + regs.ecx = 0x0000; + call_bios(®s); + + return regs.eax; +} + +static void __init bios_attach(void) +{ + struct regs regs; + + memset(®s, 0, sizeof (regs)); + regs.eax = 0x9610; + regs.ebx = 0x012E; + call_bios(®s); +} + +static void __exit bios_detach(void) +{ + struct regs regs; + + memset(®s, 0, sizeof (regs)); + regs.eax = 0x9610; + regs.ebx = 0x002E; + call_bios(®s); +} + +static u8 __init bios_get_cmos_address(void) +{ + struct regs regs; + + memset(®s, 0, sizeof (regs)); + regs.eax = 0x9610; + regs.ebx = 0x051C; + call_bios(®s); + + return regs.ecx; +} + +static u16 __init bios_wifi_get_default_setting(void) +{ + struct regs regs; + + memset(®s, 0, sizeof (regs)); + regs.eax = 0x9610; + regs.ebx = 0x0235; + call_bios(®s); + + return regs.eax; +} + +static void bios_wifi_set_state(int enable) +{ + struct regs regs; + + memset(®s, 0, sizeof (regs)); + regs.eax = 0x9610; + regs.ebx = enable ? 0x0135 : 0x0035; + call_bios(®s); +} + + /* Hardware database */ + +struct key_entry { + char type; /* See KE_* below */ + u8 code; + unsigned keycode; /* For KE_KEY */ +}; + +enum { KE_END, KE_KEY, KE_WIFI }; + +static const struct key_entry *keymap; /* = NULL; Current key map */ +static int have_wifi; + +static int __init dmi_matched(struct dmi_system_id *dmi) +{ + const struct key_entry *key; + + keymap = dmi->driver_data; + for (key = keymap; key->type != KE_END; key++) { + if (key->type == KE_WIFI) { + have_wifi = 1; + break; + } + } + return 1; +} + +static struct key_entry keymap_empty[] = { + { KE_END, 0 } +}; + +static struct key_entry keymap_fs_amilo_pro_v2000[] = { + { KE_KEY, 0x01, KEY_HELP }, + { KE_KEY, 0x11, KEY_PROG1 }, + { KE_KEY, 0x12, KEY_PROG2 }, + { KE_WIFI, 0x30, 0 }, + { KE_KEY, 0x31, KEY_MAIL }, + { KE_KEY, 0x36, KEY_WWW }, + { KE_END, 0 } +}; + +static struct key_entry keymap_wistron_ms2141[] = { + { KE_KEY, 0x11, KEY_PROG1 }, + { KE_KEY, 0x12, KEY_PROG2 }, + { KE_WIFI, 0x30, 0 }, + { KE_KEY, 0x22, KEY_REWIND }, + { KE_KEY, 0x23, KEY_FORWARD }, + { KE_KEY, 0x24, KEY_PLAYPAUSE }, + { KE_KEY, 0x25, KEY_STOPCD }, + { KE_KEY, 0x31, KEY_MAIL }, + { KE_KEY, 0x36, KEY_WWW }, + { KE_END, 0 } +}; + +/* + * If your machine is not here (which is currently rather likely), please send + * a list of buttons and their key codes (reported when loading this module + * with force=1) and the output of dmidecode to $MODULE_AUTHOR. + */ +static struct dmi_system_id dmi_ids[] = { + { + .callback = dmi_matched, + .ident = "Fujitsu-Siemens Amilo Pro V2000", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), + DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro V2000"), + }, + .driver_data = keymap_fs_amilo_pro_v2000 + }, + { 0, } +}; + +static int __init select_keymap(void) +{ + if (keymap_name != NULL) { + if (strcmp (keymap_name, "1557/MS2141") == 0) + keymap = keymap_wistron_ms2141; + else { + printk(KERN_ERR "wistron_btns: Keymap unknown\n"); + return -EINVAL; + } + } + dmi_check_system(dmi_ids); + if (keymap == NULL) { + if (!force) { + printk(KERN_ERR "wistron_btns: System unknown\n"); + return -ENODEV; + } + keymap = keymap_empty; + } + return 0; +} + + /* Input layer interface */ + +static struct input_dev input_dev = { + .name = "Wistron laptop buttons", +}; + +static void __init setup_input_dev(void) +{ + const struct key_entry *key; + + for (key = keymap; key->type != KE_END; key++) { + if (key->type == KE_KEY) { + input_dev.evbit[LONG(EV_KEY)] = BIT(EV_KEY); + input_dev.keybit[LONG(key->keycode)] + |= BIT(key->keycode); + } + } + + input_register_device(&input_dev); +} + +static void report_key(unsigned keycode) +{ + input_report_key(&input_dev, keycode, 1); + input_sync(&input_dev); + input_report_key(&input_dev, keycode, 0); + input_sync(&input_dev); +} + + /* Driver core */ + +static int wifi_enabled; + +static void poll_bios(unsigned long); + +static struct timer_list poll_timer = TIMER_INITIALIZER(poll_bios, 0, 0); + +static void handle_key(u8 code) +{ + const struct key_entry *key; + + for (key = keymap; key->type != KE_END; key++) { + if (code == key->code) { + switch (key->type) { + case KE_KEY: + report_key(key->keycode); + break; + + case KE_WIFI: + if (have_wifi) { + wifi_enabled = !wifi_enabled; + bios_wifi_set_state(wifi_enabled); + } + break; + + case KE_END: + default: + BUG(); + } + return; + } + } + printk(KERN_NOTICE "wistron_btns: Unknown key code %02X\n", code); +} + +static void poll_bios(unsigned long discard) +{ + u8 qlen; + u16 val; + + for (;;) { + qlen = CMOS_READ(cmos_address); + if (qlen == 0) + break; + val = bios_pop_queue(); + if (val != 0 && !discard) + handle_key((u8)val); + } + + mod_timer(&poll_timer, jiffies + HZ / POLL_FREQUENCY); +} + +static int __init wb_module_init(void) +{ + int err; + + err = select_keymap(); + if (err) + return err; + err = map_bios(); + if (err) + return err; + bios_attach(); + cmos_address = bios_get_cmos_address(); + if (have_wifi) { + switch (bios_wifi_get_default_setting()) { + case 0x01: + wifi_enabled = 0; + break; + + case 0x03: + wifi_enabled = 1; + break; + + default: + have_wifi = 0; + break; + } + if (have_wifi) + bios_wifi_set_state(wifi_enabled); + } + + setup_input_dev(); + + poll_bios(1); /* Flush stale event queue and arm timer */ + + return 0; +} + +static void __exit wb_module_exit(void) +{ + del_timer_sync(&poll_timer); + input_unregister_device(&input_dev); + bios_detach(); + unmap_bios(); +} + +module_init(wb_module_init); +module_exit(wb_module_exit); -- cgit v1.2.3 From e9fb028ea2a0a70dad0f467410418e5ee2af811b Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sun, 20 Nov 2005 00:50:21 -0500 Subject: Input: wistron - disable for x86_64 On x86_64: {standard input}:233: Error: suffix or operands invalid for `push' {standard input}:233: Error: suffix or operands invalid for `pop' Signed-off-by: Andrew Morton Signed-off-by: Dmitry Torokhov --- drivers/input/misc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index 06e91c856b3..07813fc0523 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig @@ -42,7 +42,7 @@ config INPUT_M68K_BEEP config INPUT_WISTRON_BTNS tristate "x86 Wistron laptop button interface" - depends on X86 + depends on X86 && !X86_64 help Say Y here for support of Winstron laptop button interface, used on laptops of various brands, including Acer and Fujitsu-Siemens. -- cgit v1.2.3 From 84b256a66360cedc25eb6e2ac6f167ca9778307b Mon Sep 17 00:00:00 2001 From: Bernhard Rosenkraenzer Date: Sun, 20 Nov 2005 00:50:37 -0500 Subject: Input: wistron - add support for Acer Aspire 1500 notebooks Also fix a potential issue with some notebooks: The current code assumes the response to bios_wifi_get_default_setting is either 1 (disabled) or 3 (enabled), or wifi isn't supported. The BIOS response appears to be a bit field w/ 0x1 indicating hardware presence, 0x2 indicating actiation status, and the other 6 bits being unknown/reserved -- with the patch, these 6 bits are ignored. Signed-off-by: Bernhard Rosenkraenzer Signed-off-by: Andrew Morton Signed-off-by: Dmitry Torokhov --- drivers/input/misc/wistron_btns.c | 79 +++++++++++++++++++++++++++++---------- 1 file changed, 59 insertions(+), 20 deletions(-) (limited to 'drivers') diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c index 76d32e365b5..6d7e865f900 100644 --- a/drivers/input/misc/wistron_btns.c +++ b/drivers/input/misc/wistron_btns.c @@ -1,6 +1,7 @@ /* * Wistron laptop button driver * Copyright (C) 2005 Miloslav Trmac + * Copyright (C) 2005 Bernhard Rosenkraenzer * * You can redistribute and/or modify this program under the terms of the * GNU General Public License version 2 as published by the Free Software @@ -40,6 +41,10 @@ #error "POLL_FREQUENCY too high" #endif +/* BIOS subsystem IDs */ +#define WIFI 0x35 +#define BLUETOOTH 0x34 + MODULE_AUTHOR("Miloslav Trmac "); MODULE_DESCRIPTION("Wistron laptop button driver"); MODULE_LICENSE("GPL v2"); @@ -197,29 +202,29 @@ static u8 __init bios_get_cmos_address(void) return regs.ecx; } -static u16 __init bios_wifi_get_default_setting(void) +static u16 __init bios_get_default_setting(u8 subsys) { struct regs regs; memset(®s, 0, sizeof (regs)); regs.eax = 0x9610; - regs.ebx = 0x0235; + regs.ebx = 0x0200 | subsys; call_bios(®s); return regs.eax; } -static void bios_wifi_set_state(int enable) +static void bios_set_state(u8 subsys, int enable) { struct regs regs; memset(®s, 0, sizeof (regs)); regs.eax = 0x9610; - regs.ebx = enable ? 0x0135 : 0x0035; + regs.ebx = (enable ? 0x0100 : 0x0000) | subsys; call_bios(®s); } - /* Hardware database */ +/* Hardware database */ struct key_entry { char type; /* See KE_* below */ @@ -227,10 +232,11 @@ struct key_entry { unsigned keycode; /* For KE_KEY */ }; -enum { KE_END, KE_KEY, KE_WIFI }; +enum { KE_END, KE_KEY, KE_WIFI, KE_BLUETOOTH }; static const struct key_entry *keymap; /* = NULL; Current key map */ static int have_wifi; +static int have_bluetooth; static int __init dmi_matched(struct dmi_system_id *dmi) { @@ -241,6 +247,9 @@ static int __init dmi_matched(struct dmi_system_id *dmi) if (key->type == KE_WIFI) { have_wifi = 1; break; + } else if (key->type == KE_BLUETOOTH) { + have_bluetooth = 1; + break; } } return 1; @@ -273,6 +282,16 @@ static struct key_entry keymap_wistron_ms2141[] = { { KE_END, 0 } }; +static struct key_entry keymap_acer_aspire_1500[] = { + { KE_KEY, 0x11, KEY_PROG1 }, + { KE_KEY, 0x12, KEY_PROG2 }, + { KE_WIFI, 0x30, 0 }, + { KE_KEY, 0x31, KEY_MAIL }, + { KE_KEY, 0x36, KEY_WWW }, + { KE_BLUETOOTH, 0x44, 0 }, + { KE_END, 0 } +}; + /* * If your machine is not here (which is currently rather likely), please send * a list of buttons and their key codes (reported when loading this module @@ -288,6 +307,15 @@ static struct dmi_system_id dmi_ids[] = { }, .driver_data = keymap_fs_amilo_pro_v2000 }, + { + .callback = dmi_matched, + .ident = "Acer Aspire 1500", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), + DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1500"), + }, + .driver_data = keymap_acer_aspire_1500 + }, { 0, } }; @@ -344,6 +372,7 @@ static void report_key(unsigned keycode) /* Driver core */ static int wifi_enabled; +static int bluetooth_enabled; static void poll_bios(unsigned long); @@ -363,7 +392,14 @@ static void handle_key(u8 code) case KE_WIFI: if (have_wifi) { wifi_enabled = !wifi_enabled; - bios_wifi_set_state(wifi_enabled); + bios_set_state(WIFI, wifi_enabled); + } + break; + + case KE_BLUETOOTH: + if (have_bluetooth) { + bluetooth_enabled = !bluetooth_enabled; + bios_set_state(BLUETOOTH, bluetooth_enabled); } break; @@ -407,21 +443,24 @@ static int __init wb_module_init(void) bios_attach(); cmos_address = bios_get_cmos_address(); if (have_wifi) { - switch (bios_wifi_get_default_setting()) { - case 0x01: - wifi_enabled = 0; - break; - - case 0x03: - wifi_enabled = 1; - break; - - default: + u16 wifi = bios_get_default_setting(WIFI); + if (wifi & 1) + wifi_enabled = (wifi & 2) ? 1 : 0; + else have_wifi = 0; - break; - } + if (have_wifi) - bios_wifi_set_state(wifi_enabled); + bios_set_state(WIFI, wifi_enabled); + } + if (have_bluetooth) { + u16 bt = bios_get_default_setting(BLUETOOTH); + if (bt & 1) + bluetooth_enabled = (bt & 2) ? 1 : 0; + else + have_bluetooth = 0; + + if (have_bluetooth) + bios_set_state(BLUETOOTH, bluetooth_enabled); } setup_input_dev(); -- cgit v1.2.3 From 22a397e2c189dedf857836f2a49542b8aedfeb65 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Sun, 20 Nov 2005 00:50:46 -0500 Subject: Input: wistron - convert to dynamic input_dev allocation Signed-off-by: Dmitry Torokhov --- drivers/input/misc/wistron_btns.c | 53 +++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 16 deletions(-) (limited to 'drivers') diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c index 6d7e865f900..b64798d838a 100644 --- a/drivers/input/misc/wistron_btns.c +++ b/drivers/input/misc/wistron_btns.c @@ -149,7 +149,7 @@ err: return -ENOMEM; } -static void __exit unmap_bios(void) +static inline void unmap_bios(void) { iounmap(bios_code_map_base); iounmap(bios_data_map_base); @@ -180,7 +180,7 @@ static void __init bios_attach(void) call_bios(®s); } -static void __exit bios_detach(void) +static void bios_detach(void) { struct regs regs; @@ -342,31 +342,43 @@ static int __init select_keymap(void) /* Input layer interface */ -static struct input_dev input_dev = { - .name = "Wistron laptop buttons", -}; +static struct input_dev *input_dev; -static void __init setup_input_dev(void) +static int __init setup_input_dev(void) { const struct key_entry *key; + int error; + + input_dev = input_allocate_device(); + if (!input_dev) + return -ENOMEM; + + input_dev->name = "Wistron laptop buttons"; + input_dev->phys = "wistron/input0"; + input_dev->id.bustype = BUS_HOST; for (key = keymap; key->type != KE_END; key++) { if (key->type == KE_KEY) { - input_dev.evbit[LONG(EV_KEY)] = BIT(EV_KEY); - input_dev.keybit[LONG(key->keycode)] - |= BIT(key->keycode); + input_dev->evbit[LONG(EV_KEY)] = BIT(EV_KEY); + set_bit(key->keycode, input_dev->keybit); } } - input_register_device(&input_dev); + error = input_register_device(input_dev); + if (error) { + input_free_device(input_dev); + return error; + } + + return 0; } static void report_key(unsigned keycode) { - input_report_key(&input_dev, keycode, 1); - input_sync(&input_dev); - input_report_key(&input_dev, keycode, 0); - input_sync(&input_dev); + input_report_key(input_dev, keycode, 1); + input_sync(input_dev); + input_report_key(input_dev, keycode, 0); + input_sync(input_dev); } /* Driver core */ @@ -437,11 +449,14 @@ static int __init wb_module_init(void) err = select_keymap(); if (err) return err; + err = map_bios(); if (err) return err; + bios_attach(); cmos_address = bios_get_cmos_address(); + if (have_wifi) { u16 wifi = bios_get_default_setting(WIFI); if (wifi & 1) @@ -452,6 +467,7 @@ static int __init wb_module_init(void) if (have_wifi) bios_set_state(WIFI, wifi_enabled); } + if (have_bluetooth) { u16 bt = bios_get_default_setting(BLUETOOTH); if (bt & 1) @@ -463,7 +479,12 @@ static int __init wb_module_init(void) bios_set_state(BLUETOOTH, bluetooth_enabled); } - setup_input_dev(); + err = setup_input_dev(); + if (err) { + bios_detach(); + unmap_bios(); + return err; + } poll_bios(1); /* Flush stale event queue and arm timer */ @@ -473,7 +494,7 @@ static int __init wb_module_init(void) static void __exit wb_module_exit(void) { del_timer_sync(&poll_timer); - input_unregister_device(&input_dev); + input_unregister_device(input_dev); bios_detach(); unmap_bios(); } -- cgit v1.2.3 From a5b0cc80bc3cc98809c7674bda9928db497f0ebb Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Sun, 20 Nov 2005 00:50:58 -0500 Subject: Input: wistron - add PM support Register wistron-bios as a platform device, restore WIFI and Bluetooth state upon resume. Signed-off-by: Dmitry Torokhov --- drivers/input/misc/wistron_btns.c | 62 +++++++++++++++++++++++++++++++++++---- 1 file changed, 57 insertions(+), 5 deletions(-) (limited to 'drivers') diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c index b64798d838a..3df30130e33 100644 --- a/drivers/input/misc/wistron_btns.c +++ b/drivers/input/misc/wistron_btns.c @@ -2,6 +2,7 @@ * Wistron laptop button driver * Copyright (C) 2005 Miloslav Trmac * Copyright (C) 2005 Bernhard Rosenkraenzer + * Copyright (C) 2005 Dmitry Torokhov * * You can redistribute and/or modify this program under the terms of the * GNU General Public License version 2 as published by the Free Software @@ -28,6 +29,7 @@ #include #include #include +#include /* * Number of attempts to read data from queue per poll; @@ -58,6 +60,8 @@ static char *keymap_name; /* = NULL; */ module_param_named(keymap, keymap_name, charp, 0); MODULE_PARM_DESC(keymap, "Keymap name, if it can't be autodetected"); +static struct platform_device *wistron_device; + /* BIOS interface implementation */ static void __iomem *bios_entry_point; /* BIOS routine entry point */ @@ -356,6 +360,7 @@ static int __init setup_input_dev(void) input_dev->name = "Wistron laptop buttons"; input_dev->phys = "wistron/input0"; input_dev->id.bustype = BUS_HOST; + input_dev->cdev.dev = &wistron_device->dev; for (key = keymap; key->type != KE_END; key++) { if (key->type == KE_KEY) { @@ -442,6 +447,34 @@ static void poll_bios(unsigned long discard) mod_timer(&poll_timer, jiffies + HZ / POLL_FREQUENCY); } +static int wistron_suspend(struct platform_device *dev, pm_message_t state) +{ + del_timer_sync(&poll_timer); + + return 0; +} + +static int wistron_resume(struct platform_device *dev) +{ + if (have_wifi) + bios_set_state(WIFI, wifi_enabled); + + if (have_bluetooth) + bios_set_state(BLUETOOTH, bluetooth_enabled); + + poll_bios(1); + + return 0; +} + +static struct platform_driver wistron_driver = { + .suspend = wistron_suspend, + .resume = wistron_resume, + .driver = { + .name = "wistron-bios", + }, +}; + static int __init wb_module_init(void) { int err; @@ -457,6 +490,16 @@ static int __init wb_module_init(void) bios_attach(); cmos_address = bios_get_cmos_address(); + err = platform_driver_register(&wistron_driver); + if (err) + goto err_detach_bios; + + wistron_device = platform_device_register_simple("wistron-bios", -1, NULL, 0); + if (IS_ERR(wistron_device)) { + err = PTR_ERR(wistron_device); + goto err_unregister_driver; + } + if (have_wifi) { u16 wifi = bios_get_default_setting(WIFI); if (wifi & 1) @@ -480,21 +523,30 @@ static int __init wb_module_init(void) } err = setup_input_dev(); - if (err) { - bios_detach(); - unmap_bios(); - return err; - } + if (err) + goto err_unregister_device; poll_bios(1); /* Flush stale event queue and arm timer */ return 0; + + err_unregister_device: + platform_device_unregister(wistron_device); + err_unregister_driver: + platform_driver_unregister(&wistron_driver); + err_detach_bios: + bios_detach(); + unmap_bios(); + + return err; } static void __exit wb_module_exit(void) { del_timer_sync(&poll_timer); input_unregister_device(input_dev); + platform_device_unregister(wistron_device); + platform_driver_unregister(&wistron_driver); bios_detach(); unmap_bios(); } -- cgit v1.2.3 From e753b650e10af8a040b1081e72088b826bdef72f Mon Sep 17 00:00:00 2001 From: Miloslav Trmac Date: Sun, 20 Nov 2005 00:51:05 -0500 Subject: Input: wistron - disable wifi/bluetooth on suspend Try to save battery power by disabling wifi and bluetooth on suspend. Signed-off-by: Miloslav Trmac Signed-off-by: Dmitry Torokhov --- drivers/input/misc/wistron_btns.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'drivers') diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c index 3df30130e33..49d0416a2a9 100644 --- a/drivers/input/misc/wistron_btns.c +++ b/drivers/input/misc/wistron_btns.c @@ -451,6 +451,12 @@ static int wistron_suspend(struct platform_device *dev, pm_message_t state) { del_timer_sync(&poll_timer); + if (have_wifi) + bios_set_state(WIFI, 0); + + if (have_bluetooth) + bios_set_state(BLUETOOTH, 0); + return 0; } -- cgit v1.2.3 From 29506415a0ff0152cc2928f8fcac724fbbf98651 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Sun, 20 Nov 2005 00:51:22 -0500 Subject: Input: uinput - convert to dynalloc allocation Also introduce proper locking when creating/deleting device. Signed-off-by: Dmitry Torokhov --- drivers/input/misc/uinput.c | 310 +++++++++++++++++++++++--------------------- 1 file changed, 163 insertions(+), 147 deletions(-) (limited to 'drivers') diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c index 948c1cc01bc..71326032213 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c @@ -152,67 +152,62 @@ static int uinput_dev_erase_effect(struct input_dev *dev, int effect_id) return retval; } -static int uinput_create_device(struct uinput_device *udev) +static void uinput_destroy_device(struct uinput_device *udev) { - if (!udev->dev->name) { - printk(KERN_DEBUG "%s: write device info first\n", UINPUT_NAME); - return -EINVAL; + const char *name, *phys; + + if (udev->dev) { + name = udev->dev->name; + phys = udev->dev->phys; + if (udev->state == UIST_CREATED) + input_unregister_device(udev->dev); + else + input_free_device(udev->dev); + kfree(name); + kfree(phys); + udev->dev = NULL; } - udev->dev->event = uinput_dev_event; - udev->dev->upload_effect = uinput_dev_upload_effect; - udev->dev->erase_effect = uinput_dev_erase_effect; - udev->dev->private = udev; - - init_waitqueue_head(&udev->waitq); - - input_register_device(udev->dev); - - set_bit(UIST_CREATED, &udev->state); - - return 0; + udev->state = UIST_NEW_DEVICE; } -static int uinput_destroy_device(struct uinput_device *udev) +static int uinput_create_device(struct uinput_device *udev) { - if (!test_bit(UIST_CREATED, &udev->state)) { - printk(KERN_WARNING "%s: create the device first\n", UINPUT_NAME); + int error; + + if (udev->state != UIST_SETUP_COMPLETE) { + printk(KERN_DEBUG "%s: write device info first\n", UINPUT_NAME); return -EINVAL; } - input_unregister_device(udev->dev); + error = input_register_device(udev->dev); + if (error) { + uinput_destroy_device(udev); + return error; + } - clear_bit(UIST_CREATED, &udev->state); + udev->state = UIST_CREATED; return 0; } static int uinput_open(struct inode *inode, struct file *file) { - struct uinput_device *newdev; - struct input_dev *newinput; + struct uinput_device *newdev; - newdev = kmalloc(sizeof(struct uinput_device), GFP_KERNEL); + newdev = kzalloc(sizeof(struct uinput_device), GFP_KERNEL); if (!newdev) - goto error; - memset(newdev, 0, sizeof(struct uinput_device)); + return -ENOMEM; + + init_MUTEX(&newdev->sem); spin_lock_init(&newdev->requests_lock); init_waitqueue_head(&newdev->requests_waitq); - - newinput = kmalloc(sizeof(struct input_dev), GFP_KERNEL); - if (!newinput) - goto cleanup; - memset(newinput, 0, sizeof(struct input_dev)); - - newdev->dev = newinput; + init_waitqueue_head(&newdev->waitq); + newdev->state = UIST_NEW_DEVICE; file->private_data = newdev; return 0; -cleanup: - kfree(newdev); -error: - return -ENOMEM; } static int uinput_validate_absbits(struct input_dev *dev) @@ -246,34 +241,55 @@ static int uinput_validate_absbits(struct input_dev *dev) return retval; } -static int uinput_alloc_device(struct file *file, const char __user *buffer, size_t count) +static int uinput_allocate_device(struct uinput_device *udev) +{ + udev->dev = input_allocate_device(); + if (!udev->dev) + return -ENOMEM; + + udev->dev->event = uinput_dev_event; + udev->dev->upload_effect = uinput_dev_upload_effect; + udev->dev->erase_effect = uinput_dev_erase_effect; + udev->dev->private = udev; + + return 0; +} + +static int uinput_setup_device(struct uinput_device *udev, const char __user *buffer, size_t count) { struct uinput_user_dev *user_dev; struct input_dev *dev; - struct uinput_device *udev; char *name; int size; int retval; - retval = count; + if (count != sizeof(struct uinput_user_dev)) + return -EINVAL; + + if (!udev->dev) { + retval = uinput_allocate_device(udev); + if (retval) + return retval; + } - udev = file->private_data; dev = udev->dev; user_dev = kmalloc(sizeof(struct uinput_user_dev), GFP_KERNEL); - if (!user_dev) { - retval = -ENOMEM; - goto exit; - } + if (!user_dev) + return -ENOMEM; if (copy_from_user(user_dev, buffer, sizeof(struct uinput_user_dev))) { retval = -EFAULT; goto exit; } - kfree(dev->name); - size = strnlen(user_dev->name, UINPUT_MAX_NAME_SIZE) + 1; + if (!size) { + retval = -EINVAL; + goto exit; + } + + kfree(dev->name); dev->name = name = kmalloc(size, GFP_KERNEL); if (!name) { retval = -ENOMEM; @@ -296,32 +312,50 @@ static int uinput_alloc_device(struct file *file, const char __user *buffer, siz /* check if absmin/absmax/absfuzz/absflat are filled as * told in Documentation/input/input-programming.txt */ if (test_bit(EV_ABS, dev->evbit)) { - int err = uinput_validate_absbits(dev); - if (err < 0) { - retval = err; - kfree(dev->name); - } + retval = uinput_validate_absbits(dev); + if (retval < 0) + goto exit; } -exit: + udev->state = UIST_SETUP_COMPLETE; + retval = count; + + exit: kfree(user_dev); return retval; } +static inline ssize_t uinput_inject_event(struct uinput_device *udev, const char __user *buffer, size_t count) +{ + struct input_event ev; + + if (count != sizeof(struct input_event)) + return -EINVAL; + + if (copy_from_user(&ev, buffer, sizeof(struct input_event))) + return -EFAULT; + + input_event(udev->dev, ev.type, ev.code, ev.value); + + return sizeof(struct input_event); +} + static ssize_t uinput_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) { struct uinput_device *udev = file->private_data; + int retval; - if (test_bit(UIST_CREATED, &udev->state)) { - struct input_event ev; + retval = down_interruptible(&udev->sem); + if (retval) + return retval; + + retval = udev->state == UIST_CREATED ? + uinput_inject_event(udev, buffer, count) : + uinput_setup_device(udev, buffer, count); - if (copy_from_user(&ev, buffer, sizeof(struct input_event))) - return -EFAULT; - input_event(udev->dev, ev.type, ev.code, ev.value); - } else - count = uinput_alloc_device(file, buffer, count); + up(&udev->sem); - return count; + return retval; } static ssize_t uinput_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) @@ -329,28 +363,38 @@ static ssize_t uinput_read(struct file *file, char __user *buffer, size_t count, struct uinput_device *udev = file->private_data; int retval = 0; - if (!test_bit(UIST_CREATED, &udev->state)) + if (udev->state != UIST_CREATED) return -ENODEV; if (udev->head == udev->tail && (file->f_flags & O_NONBLOCK)) return -EAGAIN; retval = wait_event_interruptible(udev->waitq, - udev->head != udev->tail || !test_bit(UIST_CREATED, &udev->state)); + udev->head != udev->tail || udev->state != UIST_CREATED); if (retval) return retval; - if (!test_bit(UIST_CREATED, &udev->state)) - return -ENODEV; + retval = down_interruptible(&udev->sem); + if (retval) + return retval; + + if (udev->state != UIST_CREATED) { + retval = -ENODEV; + goto out; + } - while ((udev->head != udev->tail) && - (retval + sizeof(struct input_event) <= count)) { - if (copy_to_user(buffer + retval, &udev->buff[udev->tail], sizeof(struct input_event))) - return -EFAULT; + while (udev->head != udev->tail && retval + sizeof(struct input_event) <= count) { + if (copy_to_user(buffer + retval, &udev->buff[udev->tail], sizeof(struct input_event))) { + retval = -EFAULT; + goto out; + } udev->tail = (udev->tail + 1) % UINPUT_BUFFER_SIZE; retval += sizeof(struct input_event); } + out: + up(&udev->sem); + return retval; } @@ -366,28 +410,30 @@ static unsigned int uinput_poll(struct file *file, poll_table *wait) return 0; } -static int uinput_burn_device(struct uinput_device *udev) +static int uinput_release(struct inode *inode, struct file *file) { - if (test_bit(UIST_CREATED, &udev->state)) - uinput_destroy_device(udev); + struct uinput_device *udev = file->private_data; - kfree(udev->dev->name); - kfree(udev->dev->phys); - kfree(udev->dev); + uinput_destroy_device(udev); kfree(udev); return 0; } -static int uinput_close(struct inode *inode, struct file *file) +#define uinput_set_bit(_arg, _bit, _max) \ +({ \ + int __ret = 0; \ + if (udev->state == UIST_CREATED) \ + __ret = -EINVAL; \ + else if ((_arg) > (_max)) \ + __ret = -EINVAL; \ + else set_bit((_arg), udev->dev->_bit); \ + __ret; \ +}) + +static long uinput_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { - uinput_burn_device(file->private_data); - return 0; -} - -static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) -{ - int retval = 0; + int retval; struct uinput_device *udev; void __user *p = (void __user *)arg; struct uinput_ff_upload ff_up; @@ -398,19 +444,14 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd udev = file->private_data; - /* device attributes can not be changed after the device is created */ - switch (cmd) { - case UI_SET_EVBIT: - case UI_SET_KEYBIT: - case UI_SET_RELBIT: - case UI_SET_ABSBIT: - case UI_SET_MSCBIT: - case UI_SET_LEDBIT: - case UI_SET_SNDBIT: - case UI_SET_FFBIT: - case UI_SET_PHYS: - if (test_bit(UIST_CREATED, &udev->state)) - return -EINVAL; + retval = down_interruptible(&udev->sem); + if (retval) + return retval; + + if (!udev->dev) { + retval = uinput_allocate_device(udev); + if (retval) + goto out; } switch (cmd) { @@ -419,74 +460,46 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd break; case UI_DEV_DESTROY: - retval = uinput_destroy_device(udev); + uinput_destroy_device(udev); break; case UI_SET_EVBIT: - if (arg > EV_MAX) { - retval = -EINVAL; - break; - } - set_bit(arg, udev->dev->evbit); + retval = uinput_set_bit(arg, evbit, EV_MAX); break; case UI_SET_KEYBIT: - if (arg > KEY_MAX) { - retval = -EINVAL; - break; - } - set_bit(arg, udev->dev->keybit); + retval = uinput_set_bit(arg, keybit, KEY_MAX); break; case UI_SET_RELBIT: - if (arg > REL_MAX) { - retval = -EINVAL; - break; - } - set_bit(arg, udev->dev->relbit); + retval = uinput_set_bit(arg, relbit, REL_MAX); break; case UI_SET_ABSBIT: - if (arg > ABS_MAX) { - retval = -EINVAL; - break; - } - set_bit(arg, udev->dev->absbit); + retval = uinput_set_bit(arg, absbit, ABS_MAX); break; case UI_SET_MSCBIT: - if (arg > MSC_MAX) { - retval = -EINVAL; - break; - } - set_bit(arg, udev->dev->mscbit); + retval = uinput_set_bit(arg, mscbit, MSC_MAX); break; case UI_SET_LEDBIT: - if (arg > LED_MAX) { - retval = -EINVAL; - break; - } - set_bit(arg, udev->dev->ledbit); + retval = uinput_set_bit(arg, ledbit, LED_MAX); break; case UI_SET_SNDBIT: - if (arg > SND_MAX) { - retval = -EINVAL; - break; - } - set_bit(arg, udev->dev->sndbit); + retval = uinput_set_bit(arg, sndbit, SND_MAX); break; case UI_SET_FFBIT: - if (arg > FF_MAX) { - retval = -EINVAL; - break; - } - set_bit(arg, udev->dev->ffbit); + retval = uinput_set_bit(arg, ffbit, FF_MAX); break; case UI_SET_PHYS: + if (udev->state == UIST_CREATED) { + retval = -EINVAL; + goto out; + } length = strnlen_user(p, 1024); if (length <= 0) { retval = -EFAULT; @@ -575,23 +588,26 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd default: retval = -EINVAL; } + + out: + up(&udev->sem); return retval; } static struct file_operations uinput_fops = { - .owner = THIS_MODULE, - .open = uinput_open, - .release = uinput_close, - .read = uinput_read, - .write = uinput_write, - .poll = uinput_poll, - .ioctl = uinput_ioctl, + .owner = THIS_MODULE, + .open = uinput_open, + .release = uinput_release, + .read = uinput_read, + .write = uinput_write, + .poll = uinput_poll, + .unlocked_ioctl = uinput_ioctl, }; static struct miscdevice uinput_misc = { - .fops = &uinput_fops, - .minor = UINPUT_MINOR, - .name = UINPUT_NAME, + .fops = &uinput_fops, + .minor = UINPUT_MINOR, + .name = UINPUT_NAME, }; static int __init uinput_init(void) -- cgit v1.2.3 From 59c7c0377e00a3cbd7b71631177fb92166ceb437 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Sun, 20 Nov 2005 00:51:33 -0500 Subject: Input: uinput - add UI_SET_SWBIT ioctl Signed-off-by: Dmitry Torokhov --- drivers/input/misc/uinput.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers') diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c index 71326032213..4702ade804a 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c @@ -495,6 +495,10 @@ static long uinput_ioctl(struct file *file, unsigned int cmd, unsigned long arg) retval = uinput_set_bit(arg, ffbit, FF_MAX); break; + case UI_SET_SWBIT: + retval = uinput_set_bit(arg, swbit, SW_MAX); + break; + case UI_SET_PHYS: if (udev->state == UIST_CREATED) { retval = -EINVAL; -- cgit v1.2.3 From e597f0c80de7e2ef840b28d111ec532988abc432 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Sun, 20 Nov 2005 00:51:43 -0500 Subject: Input: uinput - don't use "interruptible" in FF code If thread that submitted FF request gets interrupted somehow it will release request structure and ioctl handler will work with freed memory. TO prevent that from happening switch to using wait_for_completion instead of wait_for_completion_interruptible. Signed-off-by: Dmitry Torokhov --- drivers/input/misc/uinput.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'drivers') diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c index 4702ade804a..546ed9b4901 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c @@ -92,24 +92,19 @@ static void uinput_request_done(struct uinput_device *udev, struct uinput_reques { /* Mark slot as available */ udev->requests[request->id] = NULL; - wake_up_interruptible(&udev->requests_waitq); + wake_up(&udev->requests_waitq); complete(&request->done); } static int uinput_request_submit(struct input_dev *dev, struct uinput_request *request) { - int retval; - /* Tell our userspace app about this new request by queueing an input event */ uinput_dev_event(dev, EV_UINPUT, request->code, request->id); /* Wait for the request to complete */ - retval = wait_for_completion_interruptible(&request->done); - if (!retval) - retval = request->retval; - - return retval; + wait_for_completion(&request->done); + return request->retval; } static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *effect) -- cgit v1.2.3 From bd0ef2356cd85d39387be36fdf1f83a40075057f Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Sun, 20 Nov 2005 00:56:31 -0500 Subject: Input: handle failures in input_register_device() Signed-off-by: Dmitry Torokhov --- drivers/input/input.c | 63 +++++++++++++++++++++++++++++---------------------- 1 file changed, 36 insertions(+), 27 deletions(-) (limited to 'drivers') diff --git a/drivers/input/input.c b/drivers/input/input.c index c8ae2bb054e..bdd2a7fc268 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -536,7 +536,7 @@ static struct attribute *input_dev_attrs[] = { NULL }; -static struct attribute_group input_dev_group = { +static struct attribute_group input_dev_attr_group = { .attrs = input_dev_attrs, }; @@ -717,35 +717,14 @@ struct input_dev *input_allocate_device(void) return dev; } -static void input_register_classdevice(struct input_dev *dev) -{ - static atomic_t input_no = ATOMIC_INIT(0); - const char *path; - - __module_get(THIS_MODULE); - - dev->dev = dev->cdev.dev; - - snprintf(dev->cdev.class_id, sizeof(dev->cdev.class_id), - "input%ld", (unsigned long) atomic_inc_return(&input_no) - 1); - - path = kobject_get_path(&dev->cdev.class->subsys.kset.kobj, GFP_KERNEL); - printk(KERN_INFO "input: %s as %s/%s\n", - dev->name ? dev->name : "Unspecified device", - path ? path : "", dev->cdev.class_id); - kfree(path); - - class_device_add(&dev->cdev); - sysfs_create_group(&dev->cdev.kobj, &input_dev_group); - sysfs_create_group(&dev->cdev.kobj, &input_dev_id_attr_group); - sysfs_create_group(&dev->cdev.kobj, &input_dev_caps_attr_group); -} - int input_register_device(struct input_dev *dev) { + static atomic_t input_no = ATOMIC_INIT(0); struct input_handle *handle; struct input_handler *handler; struct input_device_id *id; + const char *path; + int error; if (!dev->dynalloc) { printk(KERN_WARNING "input: device %s is statically allocated, will not register\n" @@ -773,7 +752,32 @@ int input_register_device(struct input_dev *dev) INIT_LIST_HEAD(&dev->h_list); list_add_tail(&dev->node, &input_dev_list); - input_register_classdevice(dev); + dev->cdev.class = &input_class; + snprintf(dev->cdev.class_id, sizeof(dev->cdev.class_id), + "input%ld", (unsigned long) atomic_inc_return(&input_no) - 1); + + error = class_device_add(&dev->cdev); + if (error) + return error; + + error = sysfs_create_group(&dev->cdev.kobj, &input_dev_attr_group); + if (error) + goto fail1; + + error = sysfs_create_group(&dev->cdev.kobj, &input_dev_id_attr_group); + if (error) + goto fail2; + + error = sysfs_create_group(&dev->cdev.kobj, &input_dev_caps_attr_group); + if (error) + goto fail3; + + __module_get(THIS_MODULE); + + path = kobject_get_path(&dev->cdev.kobj, GFP_KERNEL); + printk(KERN_INFO "input: %s as %s\n", + dev->name ? dev->name : "Unspecified device", path ? path : "N/A"); + kfree(path); list_for_each_entry(handler, &input_handler_list, node) if (!handler->blacklist || !input_match_device(handler->blacklist, dev)) @@ -784,6 +788,11 @@ int input_register_device(struct input_dev *dev) input_wakeup_procfs_readers(); return 0; + + fail3: sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group); + fail2: sysfs_remove_group(&dev->cdev.kobj, &input_dev_attr_group); + fail1: class_device_del(&dev->cdev); + return error; } void input_unregister_device(struct input_dev *dev) @@ -805,7 +814,7 @@ void input_unregister_device(struct input_dev *dev) sysfs_remove_group(&dev->cdev.kobj, &input_dev_caps_attr_group); sysfs_remove_group(&dev->cdev.kobj, &input_dev_id_attr_group); - sysfs_remove_group(&dev->cdev.kobj, &input_dev_group); + sysfs_remove_group(&dev->cdev.kobj, &input_dev_attr_group); class_device_unregister(&dev->cdev); input_wakeup_procfs_readers(); -- cgit v1.2.3 From 9e50afd0cb3ff9ee152dbcf8601f5fb7eba5cff8 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Sun, 20 Nov 2005 00:56:43 -0500 Subject: Input: make serio and gameport more swsusp friendly kseriod and kgameportd used to process all pending events before checking for freeze condition. This may cause swsusp to time out while stopping tasks when resuming. Switch to process events one by one to check freeze status more often. Signed-off-by: Dmitry Torokhov --- drivers/input/gameport/gameport.c | 12 +++++++++--- drivers/input/serio/serio.c | 12 +++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) (limited to 'drivers') diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c index 0506934244f..caac6d63d46 100644 --- a/drivers/input/gameport/gameport.c +++ b/drivers/input/gameport/gameport.c @@ -339,14 +339,20 @@ static struct gameport_event *gameport_get_event(void) return event; } -static void gameport_handle_events(void) +static void gameport_handle_event(void) { struct gameport_event *event; struct gameport_driver *gameport_drv; down(&gameport_sem); - while ((event = gameport_get_event())) { + /* + * Note that we handle only one event here to give swsusp + * a chance to freeze kgameportd thread. Gameport events + * should be pretty rare so we are not concerned about + * taking performance hit. + */ + if ((event = gameport_get_event())) { switch (event->type) { case GAMEPORT_REGISTER_PORT: @@ -433,7 +439,7 @@ static struct gameport *gameport_get_pending_child(struct gameport *parent) static int gameport_thread(void *nothing) { do { - gameport_handle_events(); + gameport_handle_event(); wait_event_interruptible(gameport_wait, kthread_should_stop() || !list_empty(&gameport_event_list)); try_to_freeze(); diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index edd15db1771..fbb69ef6a77 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c @@ -269,14 +269,20 @@ static struct serio_event *serio_get_event(void) return event; } -static void serio_handle_events(void) +static void serio_handle_event(void) { struct serio_event *event; struct serio_driver *serio_drv; down(&serio_sem); - while ((event = serio_get_event())) { + /* + * Note that we handle only one event here to give swsusp + * a chance to freeze kseriod thread. Serio events should + * be pretty rare so we are not concerned about taking + * performance hit. + */ + if ((event = serio_get_event())) { switch (event->type) { case SERIO_REGISTER_PORT: @@ -368,7 +374,7 @@ static struct serio *serio_get_pending_child(struct serio *parent) static int serio_thread(void *nothing) { do { - serio_handle_events(); + serio_handle_event(); wait_event_interruptible(serio_wait, kthread_should_stop() || !list_empty(&serio_event_list)); try_to_freeze(); -- cgit v1.2.3 From d271d1c2217b2e9868c32c0437d76b2af3a4b971 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Sun, 20 Nov 2005 00:56:54 -0500 Subject: Fix an OOPS when initializing IR remote on saa7134 Signed-off-by: Dmitry Torokhov --- drivers/media/video/saa7134/saa7134-input.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers') diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index e648cc3bc96..ab75ca5ac35 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -713,6 +713,8 @@ int saa7134_input_init1(struct saa7134_dev *dev) return -ENOMEM; } + ir->dev = input_dev; + /* init hardware-specific stuff */ ir->mask_keycode = mask_keycode; ir->mask_keydown = mask_keydown; -- cgit v1.2.3 From d4892279d786dd11f9d6269b3029ad3340e79597 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Sun, 20 Nov 2005 00:57:02 -0500 Subject: Fix missing initialization in ir-kbd-gpio.c Signed-off-by: Dmitry Torokhov --- drivers/media/video/ir-kbd-gpio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/media/video/ir-kbd-gpio.c b/drivers/media/video/ir-kbd-gpio.c index 5abfc0fbf6d..6345e29e495 100644 --- a/drivers/media/video/ir-kbd-gpio.c +++ b/drivers/media/video/ir-kbd-gpio.c @@ -673,7 +673,6 @@ static int ir_probe(struct device *dev) snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(sub->core->pci)); - ir->sub = sub; ir_input_init(input_dev, &ir->ir, ir_type, ir_codes); input_dev->name = ir->name; input_dev->phys = ir->phys; @@ -688,6 +687,9 @@ static int ir_probe(struct device *dev) } input_dev->cdev.dev = &sub->core->pci->dev; + ir->input = input_dev; + ir->sub = sub; + if (ir->polling) { INIT_WORK(&ir->work, ir_work, ir); init_timer(&ir->timer); @@ -708,7 +710,6 @@ static int ir_probe(struct device *dev) /* all done */ dev_set_drvdata(dev, ir); input_register_device(ir->input); - printk(DEVNAME ": %s detected at %s\n",ir->name,ir->phys); /* the remote isn't as bouncy as a keyboard */ ir->input->rep[REP_DELAY] = repeat_delay; -- cgit v1.2.3 From db93a82fa9d8b4d6e31c227922eaae829253bb88 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Sun, 20 Nov 2005 11:13:29 -0500 Subject: [PATCH] Fix an OOPS is CinergyT2 Fix an OOPS is CinergyT2 driver when registering IR remote Signed-off-by: Dmitry Torokhov Signed-off-by: Linus Torvalds --- drivers/media/dvb/cinergyT2/cinergyT2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/media/dvb/cinergyT2/cinergyT2.c b/drivers/media/dvb/cinergyT2/cinergyT2.c index fb394a0d838..336fc284fa5 100644 --- a/drivers/media/dvb/cinergyT2/cinergyT2.c +++ b/drivers/media/dvb/cinergyT2/cinergyT2.c @@ -772,7 +772,7 @@ static int cinergyt2_register_rc(struct cinergyt2 *cinergyt2) input_dev->name = DRIVER_NAME " remote control"; input_dev->phys = cinergyt2->phys; input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP); - for (i = 0; ARRAY_SIZE(rc_keys); i += 3) + for (i = 0; i < ARRAY_SIZE(rc_keys); i += 3) set_bit(rc_keys[i + 2], input_dev->keybit); input_dev->keycodesize = 0; input_dev->keycodemax = 0; -- cgit v1.2.3