From nobody Sun Feb 8 18:09:29 2026 Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.4]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 00496207A05 for ; Tue, 12 Nov 2024 02:14:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.31.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731377664; cv=none; b=PH+1iQXj8PNAaxAmA86dhzR72bQTJJL6+TBxH8aoRBuA6SAPtphb5dFHLUiin1uyoRhOLUHOm0g2AtHngRxW5IqLJFDgtzYMQOBI0sn8uSB+9uTxq1W+NdJLENpQVmvX/oCMkxWgAJZwSzbnmMiIbCApm5y/aMjofA8w0zs6ZMA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731377664; c=relaxed/simple; bh=a8CS+4iKVPZwY4yDJAqIRsUFGHkrtaKod/CTxjvQQ+4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=NW55UgMNFF/DxjONJXpf+7dqzE1E5KtUObgCIDUe9W4WA0ai8QzJ9ApBQotUW7sacM52IHffRNWui3UuRrlSogkMWtPV22kp0YalWa1wUJ5k3yANnL7gn5dVJ2QYRV5rZWo1pHsOgKCoJxnkrut19XDrYavU/jTAE05wXu+POew= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=oy/O1LNI; arc=none smtp.client-ip=220.197.31.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="oy/O1LNI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=KEMYe TraOJWQraShFMIDQvggJgEr8cplFBUz4DywtUs=; b=oy/O1LNIaqU7tTdOsRuPO Np1e7T1QC+5HwHsa04KvsxoUEZPSJUyPSvADhfR8cDElhz0sj28aVJuAA8fvDZZh +1kseRiMqSR9qnT58qsdc4BHOz54GAVseRKGR8IHj2DDSHKJ6eVZEkzh9vnKdzZw F+qzoQUrrNd5X4MBs7Tc3Q= Received: from localhost.localdomain (unknown [111.48.58.13]) by gzga-smtp-mtada-g0-2 (Coremail) with SMTP id _____wD3_4hwuTJnfZjdGw--.189S3; Tue, 12 Nov 2024 10:12:04 +0800 (CST) From: 412574090@163.com To: sudipm.mukherjee@gmail.com, mpe@ellerman.id.au, davem@davemloft.net, andreas@gaisler.com, James.Bottomley@HansenPartnership.com, deller@gmx.de, dlemoal@kernel.org, cassel@kernel.org, ojeda@kernel.org, edumazet@google.com, martin.petersen@oracle.co, perex@perex.cz, t.sailer@alumni.ethz.ch, andrew+netdev@lunn.ch Cc: linux-kernel@vger.kernel.org, xiongxin@kylinos.cn, weiyufeng Subject: [PATCH v2 1/4] parport: use standard kernel printing functions Date: Tue, 12 Nov 2024 10:11:50 +0800 Message-Id: <20241112021153.18146-2-412574090@163.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241112021153.18146-1-412574090@163.com> References: <20241112021153.18146-1-412574090@163.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wD3_4hwuTJnfZjdGw--.189S3 X-Coremail-Antispam: 1Uf129KBjvJXoW3JF1fGw4UtFWUZFyfWrWUCFg_yoW7XrW8pa 17uFZ3Z39rta17Ar18Aan8uFW5t3W2ka48CFy8K34FvFnrJrWDAw4jkFyvyF15GFy8Xay5 tFs8JFy3Ar47Gw7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jVfOwUUUUU= X-CM-SenderInfo: yursklauqziqqrwthudrp/1tbizQuVAGcyuTAGXQAAsU Content-Type: text/plain; charset="utf-8" From: weiyufeng change printk to standard kernel printing functions. Signed-off-by: weiyufeng --- drivers/net/hamradio/baycom_epp.c | 8 ++++---- drivers/net/hamradio/baycom_par.c | 6 +++--- drivers/parport/parport_pc.c | 12 ++++++------ drivers/parport/procfs.c | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/bayco= m_epp.c index 9e366f275406..1b7fd6d49a96 100644 --- a/drivers/net/hamradio/baycom_epp.c +++ b/drivers/net/hamradio/baycom_epp.c @@ -828,13 +828,13 @@ static int epp_open(struct net_device *dev) } #if 0 if (pp->irq < 0) { - printk(KERN_ERR "%s: parport at 0x%lx has no irq\n", bc_dr= vname, pp->base); + pr_err("%s: parport at 0x%lx has no irq\n", bc_drvname, pp->base); parport_put_port(pp); return -ENXIO; } #endif if ((~pp->modes) & (PARPORT_MODE_TRISTATE | PARPORT_MODE_PCSPP | PARPORT_= MODE_SAFEININT)) { - printk(KERN_ERR "%s: parport at 0x%lx cannot be used\n", + pr_err("%s: parport at 0x%lx cannot be used\n", bc_drvname, pp->base); parport_put_port(pp); return -EIO; @@ -857,11 +857,11 @@ static int epp_open(struct net_device *dev) bc->pdev =3D parport_register_dev_model(pp, dev->name, &par_cb, i); parport_put_port(pp); if (!bc->pdev) { - printk(KERN_ERR "%s: cannot register parport at 0x%lx\n", = bc_drvname, pp->base); + pr_err("%s: cannot register parport at 0x%lx\n", bc_drvname, pp->base); return -ENXIO; } if (parport_claim(bc->pdev)) { - printk(KERN_ERR "%s: parport at 0x%lx busy\n", bc_drvname,= pp->base); + pr_err("%s: parport at 0x%lx busy\n", bc_drvname, pp->base); parport_unregister_device(bc->pdev); return -EBUSY; } diff --git a/drivers/net/hamradio/baycom_par.c b/drivers/net/hamradio/bayco= m_par.c index 00ebc25d0b22..4b57874c2463 100644 --- a/drivers/net/hamradio/baycom_par.c +++ b/drivers/net/hamradio/baycom_par.c @@ -307,12 +307,12 @@ static int par96_open(struct net_device *dev) return -ENXIO; } if (pp->irq < 0) { - printk(KERN_ERR "baycom_par: parport at 0x%lx has no irq\n", pp->base); + pr_err("baycom_par: parport at 0x%lx has no irq\n", pp->base); parport_put_port(pp); return -ENXIO; } if ((~pp->modes) & (PARPORT_MODE_PCSPP | PARPORT_MODE_SAFEININT)) { - printk(KERN_ERR "baycom_par: parport at 0x%lx cannot be used\n", pp->bas= e); + pr_err("baycom_par: parport at 0x%lx cannot be used\n", pp->base); parport_put_port(pp); return -ENXIO; } @@ -339,7 +339,7 @@ static int par96_open(struct net_device *dev) return -ENXIO; } if (parport_claim(bc->pdev)) { - printk(KERN_ERR "baycom_par: parport at 0x%lx busy\n", pp->base); + pr_err("baycom_par: parport at 0x%lx busy\n", pp->base); parport_unregister_device(bc->pdev); return -EBUSY; } diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index f33b5d1ddfc1..609c10d4bc31 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -1609,7 +1609,7 @@ static int parport_ECP_supported(struct parport *pb) =20 priv->fifo_depth =3D i; if (verbose_probing) - printk(KERN_DEBUG "0x%lx: FIFO is %d bytes\n", pb->base, i); + pr_debug("0x%lx: FIFO is %d bytes\n", pb->base, i); =20 /* Find out writeIntrThreshold */ frob_econtrol(pb, 1<<2, 1<<2); @@ -1623,7 +1623,7 @@ static int parport_ECP_supported(struct parport *pb) =20 if (i <=3D priv->fifo_depth) { if (verbose_probing) - printk(KERN_DEBUG "0x%lx: writeIntrThreshold is %d\n", + pr_debug("0x%lx: writeIntrThreshold is %d\n", pb->base, i); } else /* Number of bytes we know we can write if we get an @@ -1676,16 +1676,16 @@ static int parport_ECP_supported(struct parport *pb) priv->pword =3D pword; =20 if (verbose_probing) { - printk(KERN_DEBUG "0x%lx: PWord is %d bits\n", + pr_debug("0x%lx: PWord is %d bits\n", pb->base, 8 * pword); =20 - printk(KERN_DEBUG "0x%lx: Interrupts are ISA-%s\n", + pr_debug("0x%lx: Interrupts are ISA-%s\n", pb->base, config & 0x80 ? "Level" : "Pulses"); =20 configb =3D inb(CONFIGB(pb)); - printk(KERN_DEBUG "0x%lx: ECP port cfgA=3D0x%02x cfgB=3D0x%02x\n", + pr_debug("0x%lx: ECP port cfgA=3D0x%02x cfgB=3D0x%02x\n", pb->base, config, configb); - printk(KERN_DEBUG "0x%lx: ECP settings irq=3D", pb->base); + pr_debug("0x%lx: ECP settings irq=3D", pb->base); if ((configb >> 3) & 0x07) pr_cont("%d", intrline[(configb >> 3) & 0x07]); else diff --git a/drivers/parport/procfs.c b/drivers/parport/procfs.c index 3880460e67f2..3f809fff317b 100644 --- a/drivers/parport/procfs.c +++ b/drivers/parport/procfs.c @@ -128,7 +128,7 @@ static int do_hardware_base_addr(const struct ctl_table= *table, int write, if (write) /* permissions prevent this anyway */ return -EACCES; =20 - len +=3D scnprintf (buffer, sizeof(buffer), "%lu\t%lu\n", port->base, por= t->base_hi); + len +=3D scnprintf(buffer, sizeof(buffer), "%lu\t%lu\n", port->base, port= ->base_hi); =20 if (len > *lenp) len =3D *lenp; --=20 2.25.1 From nobody Sun Feb 8 18:09:29 2026 Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.3]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 520001F81AA for ; Tue, 12 Nov 2024 02:14:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.3 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731377659; cv=none; b=QnMFxUxq1UfK8Mo5uBSjgQmvr7Kgpx+4D445epi1BbBKbjZB4Wut9xD0XRRaHzJD/kRCKvk9+x7gcWgqutrotfGxd47Ue/gs1yfJ4SPDepnmJHPv2x3g4BqBKmaemo3M9H6PZaEv0tpF5wCdDp82dLhUM0e4HweNe041kxsmDBs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731377659; c=relaxed/simple; bh=GoUXh85/ta4X0mC4I+KzAJdDrgfXzCAFi21Dc9QgFMo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cmRgJaoYuty825M/RMb7hWP3OocRrH5ABw/yEsX1Ahs73lOzQaPUBe1K/rioQvNllW0KcGaaBGBNqQ6OKRDsb7ChUyJfhrrqv1SYEV2aBnjG3Gk/NuQOF9VinSo8k/fws4wrDi/B2Nxr0DCO0iUzoB5wdw5v88vs3L+mHIa6H5g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=Y1tt2SVt; arc=none smtp.client-ip=117.135.210.3 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="Y1tt2SVt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=E90ke 3p1bBvvYHkXob+K38hvtEJ1J0q0pJu6+12nWt4=; b=Y1tt2SVtXQac2iSN5+zAS Y0qd1axeIy0w9adHV0hBBx+N797jW3A6Ij/Yyy8c2FVgIa3hA0pqbUwMUCvSCv+d xlTg+Mc/s4aw6uvf/sd8yuRgJRHjVzrr+5eUqWnnnEHbij3wX5vP7crXMkBOPNNK RyNPyN6Xj4ZicQhCa2G08w= Received: from localhost.localdomain (unknown [111.48.58.13]) by gzga-smtp-mtada-g0-2 (Coremail) with SMTP id _____wD3_4hwuTJnfZjdGw--.189S4; Tue, 12 Nov 2024 10:12:07 +0800 (CST) From: 412574090@163.com To: sudipm.mukherjee@gmail.com, mpe@ellerman.id.au, davem@davemloft.net, andreas@gaisler.com, James.Bottomley@HansenPartnership.com, deller@gmx.de, dlemoal@kernel.org, cassel@kernel.org, ojeda@kernel.org, edumazet@google.com, martin.petersen@oracle.co, perex@perex.cz, t.sailer@alumni.ethz.ch, andrew+netdev@lunn.ch Cc: linux-kernel@vger.kernel.org, xiongxin@kylinos.cn, weiyufeng Subject: [PATCH v2 2/4] parport: change struct parport member to iobase Date: Tue, 12 Nov 2024 10:11:51 +0800 Message-Id: <20241112021153.18146-3-412574090@163.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241112021153.18146-1-412574090@163.com> References: <20241112021153.18146-1-412574090@163.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wD3_4hwuTJnfZjdGw--.189S4 X-Coremail-Antispam: 1Uf129KBjvAXoWfAF4fXF43Cr1fJryDAFW7twb_yoW5XF4fAo Z3GryfAasYywn3JF48Grn2qFWxX34ku3Z8CF43Crs8ZasFvw4fGF1xGr47Ka1agw13Gr93 Xa40qw1UAF18ZrW8n29KB7ZKAUJUUUU8529EdanIXcx71UUUUU7v73VFW2AGmfu7bjvjm3 AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjxUVdcfUUUUU X-CM-SenderInfo: yursklauqziqqrwthudrp/1tbizQuVAGcyuTAGXQABsV Content-Type: text/plain; charset="utf-8" From: weiyufeng change struct parport member base and base_hi to iobase and iobase_hi for ioport. because iomem type will be added, in that case,mapbase, mapbase_hi will be added in struct parport. this can distinguish between these two types. Signed-off-by: weiyufeng --- drivers/ata/pata_parport/bpck6.c | 2 +- drivers/ata/pata_parport/pata_parport.c | 2 +- drivers/auxdisplay/ks0108.c | 4 +-- drivers/net/hamradio/baycom_epp.c | 10 +++--- drivers/net/hamradio/baycom_par.c | 6 ++-- drivers/net/plip/plip.c | 2 +- drivers/parport/daisy.c | 2 +- drivers/parport/parport_gsc.c | 8 ++--- drivers/parport/parport_ip32.c | 8 ++--- drivers/parport/parport_mfc3.c | 2 +- drivers/parport/parport_pc.c | 42 ++++++++++++------------- drivers/parport/parport_sunbpp.c | 24 +++++++------- drivers/parport/procfs.c | 2 +- drivers/parport/share.c | 6 ++-- drivers/scsi/imm.c | 8 ++--- drivers/scsi/ppa.c | 10 +++--- include/linux/parport.h | 4 +-- include/linux/parport_pc.h | 18 +++++------ sound/drivers/mts64.c | 6 ++-- sound/drivers/portman2x4.c | 6 ++-- 20 files changed, 85 insertions(+), 87 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bp= ck6.c index 62c2b53325e1..bb681a38be7f 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -394,7 +394,7 @@ static void bpck6_disconnect(struct pi_adapter *pi) static int bpck6_test_port(struct pi_adapter *pi) { dev_dbg(&pi->dev, "PARPORT indicates modes=3D%x for lp=3D0x%lx\n", - pi->pardev->port->modes, pi->pardev->port->base); + pi->pardev->port->modes, pi->pardev->port->iobase); =20 /* look at the parport device to see what modes we can use */ if (pi->pardev->port->modes & PARPORT_MODE_EPP) diff --git a/drivers/ata/pata_parport/pata_parport.c b/drivers/ata/pata_par= port/pata_parport.c index 93ebf566b54e..c2d6ad7e43af 100644 --- a/drivers/ata/pata_parport/pata_parport.c +++ b/drivers/ata/pata_parport/pata_parport.c @@ -539,7 +539,7 @@ static struct pi_adapter *pi_init_one(struct parport *p= arport, =20 pi->delay =3D (delay =3D=3D -1) ? pi->proto->default_delay : delay; pi->mode =3D mode; - pi->port =3D parport->base; + pi->port =3D parport->iobase; =20 par_cb.private =3D pi; pi->pardev =3D parport_register_dev_model(parport, DRV_NAME, &par_cb, id); diff --git a/drivers/auxdisplay/ks0108.c b/drivers/auxdisplay/ks0108.c index 51587f0fdaae..ee046955ac2d 100644 --- a/drivers/auxdisplay/ks0108.c +++ b/drivers/auxdisplay/ks0108.c @@ -112,7 +112,7 @@ static void ks0108_parport_attach(struct parport *port) { struct pardev_cb ks0108_cb; =20 - if (port->base !=3D ks0108_port) + if (port->iobase !=3D ks0108_port) return; =20 memset(&ks0108_cb, 0, sizeof(ks0108_cb)); @@ -140,7 +140,7 @@ static void ks0108_parport_attach(struct parport *port) =20 static void ks0108_parport_detach(struct parport *port) { - if (port->base !=3D ks0108_port) + if (port->iobase !=3D ks0108_port) return; =20 if (!ks0108_pardevice) { diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/bayco= m_epp.c index 1b7fd6d49a96..0b070ee7016a 100644 --- a/drivers/net/hamradio/baycom_epp.c +++ b/drivers/net/hamradio/baycom_epp.c @@ -306,7 +306,7 @@ static int eppconfig(struct baycom_state *bc) bc->cfg.extmodem ? "ext" : "int", bc->cfg.fclk, bc->cfg.bps, (bc->cfg.fclk + 8 * bc->cfg.bps) / (16 * bc->cfg.bps), bc->cfg.loopback ? ",loopback" : ""); - sprintf(portarg, "%ld", bc->pdev->port->base); + sprintf(portarg, "%ld", bc->pdev->port->iobase); printk(KERN_DEBUG "%s: %s -s -p %s -m %s\n", bc_drvname, eppconfig_path, = portarg, modearg); =20 return call_usermodehelper(eppconfig_path, argv, envp, UMH_WAIT_PROC); @@ -828,14 +828,14 @@ static int epp_open(struct net_device *dev) } #if 0 if (pp->irq < 0) { - pr_err("%s: parport at 0x%lx has no irq\n", bc_drvname, pp->base); + pr_err("%s: parport at 0x%lx has no irq\n", bc_drvname, pp->iobase); parport_put_port(pp); return -ENXIO; } #endif if ((~pp->modes) & (PARPORT_MODE_TRISTATE | PARPORT_MODE_PCSPP | PARPORT_= MODE_SAFEININT)) { pr_err("%s: parport at 0x%lx cannot be used\n", - bc_drvname, pp->base); + bc_drvname, pp->iobase); parport_put_port(pp); return -EIO; } @@ -857,11 +857,11 @@ static int epp_open(struct net_device *dev) bc->pdev =3D parport_register_dev_model(pp, dev->name, &par_cb, i); parport_put_port(pp); if (!bc->pdev) { - pr_err("%s: cannot register parport at 0x%lx\n", bc_drvname, pp->base); + pr_err("%s: cannot register parport at 0x%lx\n", bc_drvname, pp->iobase); return -ENXIO; } if (parport_claim(bc->pdev)) { - pr_err("%s: parport at 0x%lx busy\n", bc_drvname, pp->base); + pr_err("%s: parport at 0x%lx busy\n", bc_drvname, pp->iobase); parport_unregister_device(bc->pdev); return -EBUSY; } diff --git a/drivers/net/hamradio/baycom_par.c b/drivers/net/hamradio/bayco= m_par.c index 4b57874c2463..4fc324a28c86 100644 --- a/drivers/net/hamradio/baycom_par.c +++ b/drivers/net/hamradio/baycom_par.c @@ -307,12 +307,12 @@ static int par96_open(struct net_device *dev) return -ENXIO; } if (pp->irq < 0) { - pr_err("baycom_par: parport at 0x%lx has no irq\n", pp->base); + pr_err("baycom_par: parport at 0x%lx has no irq\n", pp->iobase); parport_put_port(pp); return -ENXIO; } if ((~pp->modes) & (PARPORT_MODE_PCSPP | PARPORT_MODE_SAFEININT)) { - pr_err("baycom_par: parport at 0x%lx cannot be used\n", pp->base); + pr_err("baycom_par: parport at 0x%lx cannot be used\n", pp->iobase); parport_put_port(pp); return -ENXIO; } @@ -339,7 +339,7 @@ static int par96_open(struct net_device *dev) return -ENXIO; } if (parport_claim(bc->pdev)) { - pr_err("baycom_par: parport at 0x%lx busy\n", pp->base); + pr_err("baycom_par: parport at 0x%lx busy\n", pp->iobase); parport_unregister_device(bc->pdev); return -EBUSY; } diff --git a/drivers/net/plip/plip.c b/drivers/net/plip/plip.c index d81163bc910a..374eafcec2a3 100644 --- a/drivers/net/plip/plip.c +++ b/drivers/net/plip/plip.c @@ -1286,7 +1286,7 @@ static void plip_attach (struct parport *port) strcpy(dev->name, name); =20 dev->irq =3D port->irq; - dev->base_addr =3D port->base; + dev->base_addr =3D port->iobase; if (port->irq =3D=3D -1) { printk(KERN_INFO "plip: %s has no IRQ. Using IRQ-less mode," "which is fairly inefficient!\n", port->name); diff --git a/drivers/parport/daisy.c b/drivers/parport/daisy.c index 2231dbfd870d..83502170a6ba 100644 --- a/drivers/parport/daisy.c +++ b/drivers/parport/daisy.c @@ -68,7 +68,7 @@ static void add_dev(int devnum, struct parport *port, int= daisy) /* Clone a parport (actually, make an alias). */ static struct parport *clone_parport(struct parport *real, int muxport) { - struct parport *extra =3D parport_register_port(real->base, + struct parport *extra =3D parport_register_port(real->iobase, real->irq, real->dma, real->ops); diff --git a/drivers/parport/parport_gsc.c b/drivers/parport/parport_gsc.c index c7e18382dc01..9490c431bd6c 100644 --- a/drivers/parport/parport_gsc.c +++ b/drivers/parport/parport_gsc.c @@ -249,8 +249,8 @@ static struct parport *parport_gsc_probe_port(unsigned = long base, } priv->ctr =3D 0xc; priv->ctr_writable =3D 0xff; - p->base =3D base; - p->base_hi =3D base_hi; + p->iobase =3D base; + p->iobase_hi =3D base_hi; p->irq =3D irq; p->modes =3D PARPORT_MODE_PCSPP | PARPORT_MODE_SAFEININT; p->ops =3D ops; @@ -272,12 +272,12 @@ static struct parport *parport_gsc_probe_port(unsigne= d long base, } =20 p->dev =3D &padev->dev; - p->base_hi =3D base_hi; + p->iobase_hi =3D base_hi; p->modes =3D tmp.modes; p->size =3D (p->modes & PARPORT_MODE_EPP)?8:3; p->private_data =3D priv; =20 - pr_info("%s: PC-style at 0x%lx", p->name, p->base); + pr_info("%s: PC-style at 0x%lx", p->name, p->iobase); p->irq =3D irq; if (p->irq =3D=3D PARPORT_IRQ_AUTO) { p->irq =3D PARPORT_IRQ_NONE; diff --git a/drivers/parport/parport_ip32.c b/drivers/parport/parport_ip32.c index 0919ed99ba94..44150fe2d0ed 100644 --- a/drivers/parport/parport_ip32.c +++ b/drivers/parport/parport_ip32.c @@ -301,7 +301,7 @@ struct parport_ip32_private { #define __pr_probe(...) \ do { if (verbose_probing) printk(__VA_ARGS__); } while (0) #define pr_probe(p, fmt, ...) \ - __pr_probe(KERN_INFO PPIP32 "0x%lx: " fmt, (p)->base , ##__VA_ARGS__) + __pr_probe(KERN_INFO PPIP32 "0x%lx: " fmt, (p)->iobase, ##__VA_ARGS__) =20 /* * parport_ip32_dump_state - print register status of parport @@ -2038,8 +2038,8 @@ static __init struct parport *parport_ip32_probe_port= (void) err =3D -ENOMEM; goto fail; } - p->base =3D MACE_BASE + offsetof(struct sgi_mace, isa.parallel); - p->base_hi =3D MACE_BASE + offsetof(struct sgi_mace, isa.ecp1284); + p->iobase =3D MACE_BASE + offsetof(struct sgi_mace, isa.parallel); + p->iobase_hi =3D MACE_BASE + offsetof(struct sgi_mace, isa.ecp1284); p->private_data =3D priv; =20 *ops =3D parport_ip32_ops; @@ -2131,7 +2131,7 @@ static __init struct parport *parport_ip32_probe_port= (void) parport_ip32_dump_state(p, "end init", 0); =20 /* Print out what we found */ - pr_info("%s: SGI IP32 at 0x%lx (0x%lx)", p->name, p->base, p->base_hi); + pr_info("%s: SGI IP32 at 0x%lx (0x%lx)", p->name, p->iobase, p->iobase_hi= ); if (p->irq !=3D PARPORT_IRQ_NONE) pr_cont(", irq %d", p->irq); pr_cont(" ["); diff --git a/drivers/parport/parport_mfc3.c b/drivers/parport/parport_mfc3.c index bb1817218d7b..c64b9ca1b604 100644 --- a/drivers/parport/parport_mfc3.c +++ b/drivers/parport/parport_mfc3.c @@ -74,7 +74,7 @@ static struct parport *this_port[MAX_MFC] =3D {NULL, }; static volatile int dummy; /* for trigger readds */ =20 -#define pia(dev) ((struct pia *)(dev->base)) +#define pia(dev) ((struct pia *)(dev->iobase)) static struct parport_operations pp_mfc3_ops; =20 static void mfc3_write_data(struct parport *p, unsigned char data) diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index 609c10d4bc31..160d87449913 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -1380,7 +1380,7 @@ static struct superio_struct *find_superio(struct par= port *p) { int i; for (i =3D 0; i < NR_SUPERIOS; i++) - if (superios[i].io =3D=3D p->base) + if (superios[i].io =3D=3D p->iobase) return &superios[i]; return NULL; } @@ -1448,7 +1448,7 @@ static int parport_SPP_supported(struct parport *pb) /* That didn't work, but the user thinks there's a * port here. */ pr_info("parport 0x%lx (WARNING): CTR: wrote 0x%02x, read 0x%02x\n", - pb->base, w, r); + pb->iobase, w, r); =20 /* Try the data register. The data lines aren't tri-stated at * this stage, so we expect back what we wrote. */ @@ -1467,9 +1467,9 @@ static int parport_SPP_supported(struct parport *pb) /* Didn't work, but the user is convinced this is the * place. */ pr_info("parport 0x%lx (WARNING): DATA: wrote 0x%02x, read 0x%02x\n", - pb->base, w, r); + pb->iobase, w, r); pr_info("parport 0x%lx: You gave this address, but there is probably no = parallel port there!\n", - pb->base); + pb->iobase); } =20 /* It's possible that we can't read the control register or @@ -1609,7 +1609,7 @@ static int parport_ECP_supported(struct parport *pb) =20 priv->fifo_depth =3D i; if (verbose_probing) - pr_debug("0x%lx: FIFO is %d bytes\n", pb->base, i); + pr_debug("0x%lx: FIFO is %d bytes\n", pb->iobase, i); =20 /* Find out writeIntrThreshold */ frob_econtrol(pb, 1<<2, 1<<2); @@ -1624,7 +1624,7 @@ static int parport_ECP_supported(struct parport *pb) if (i <=3D priv->fifo_depth) { if (verbose_probing) pr_debug("0x%lx: writeIntrThreshold is %d\n", - pb->base, i); + pb->iobase, i); } else /* Number of bytes we know we can write if we get an interrupt. */ @@ -1647,7 +1647,7 @@ static int parport_ECP_supported(struct parport *pb) if (i <=3D priv->fifo_depth) { if (verbose_probing) pr_info("0x%lx: readIntrThreshold is %d\n", - pb->base, i); + pb->iobase, i); } else /* Number of bytes we can read if we get an interrupt. */ i =3D 0; @@ -1661,14 +1661,14 @@ static int parport_ECP_supported(struct parport *pb) switch (pword) { case 0: pword =3D 2; - pr_warn("0x%lx: Unsupported pword size!\n", pb->base); + pr_warn("0x%lx: Unsupported pword size!\n", pb->iobase); break; case 2: pword =3D 4; - pr_warn("0x%lx: Unsupported pword size!\n", pb->base); + pr_warn("0x%lx: Unsupported pword size!\n", pb->iobase); break; default: - pr_warn("0x%lx: Unknown implementation ID\n", pb->base); + pr_warn("0x%lx: Unknown implementation ID\n", pb->iobase); fallthrough; /* Assume 1 */ case 1: pword =3D 1; @@ -1677,15 +1677,15 @@ static int parport_ECP_supported(struct parport *pb) =20 if (verbose_probing) { pr_debug("0x%lx: PWord is %d bits\n", - pb->base, 8 * pword); + pb->iobase, 8 * pword); =20 pr_debug("0x%lx: Interrupts are ISA-%s\n", - pb->base, config & 0x80 ? "Level" : "Pulses"); + pb->iobase, config & 0x80 ? "Level" : "Pulses"); =20 configb =3D inb(CONFIGB(pb)); pr_debug("0x%lx: ECP port cfgA=3D0x%02x cfgB=3D0x%02x\n", - pb->base, config, configb); - pr_debug("0x%lx: ECP settings irq=3D", pb->base); + pb->iobase, config, configb); + pr_debug("0x%lx: ECP settings irq=3D", pb->iobase); if ((configb >> 3) & 0x07) pr_cont("%d", intrline[(configb >> 3) & 0x07]); else @@ -2085,7 +2085,7 @@ static struct parport *__parport_pc_probe_port(unsign= ed long int base, priv->port =3D p; =20 p->dev =3D dev; - p->base_hi =3D base_hi; + p->iobase_hi =3D base_hi; p->modes =3D PARPORT_MODE_PCSPP | PARPORT_MODE_SAFEININT; p->private_data =3D priv; =20 @@ -2111,9 +2111,9 @@ static struct parport *__parport_pc_probe_port(unsign= ed long int base, =20 p->size =3D (p->modes & PARPORT_MODE_EPP) ? 8 : 3; =20 - pr_info("%s: PC-style at 0x%lx", p->name, p->base); - if (p->base_hi && priv->ecr) - pr_cont(" (0x%lx)", p->base_hi); + pr_info("%s: PC-style at 0x%lx", p->name, p->iobase); + if (p->iobase_hi && priv->ecr) + pr_cont(" (0x%lx)", p->iobase_hi); if (p->irq =3D=3D PARPORT_IRQ_AUTO) { p->irq =3D PARPORT_IRQ_NONE; parport_irq_probe(p); @@ -2299,11 +2299,11 @@ void parport_pc_unregister_port(struct parport *p) #endif if (p->irq !=3D PARPORT_IRQ_NONE) free_irq(p->irq, p); - release_region(p->base, 3); + release_region(p->iobase, 3); if (p->size > 3) - release_region(p->base + 3, p->size - 3); + release_region(p->iobase + 3, p->size - 3); if (p->modes & PARPORT_MODE_ECP) - release_region(p->base_hi, 3); + release_region(p->iobase_hi, 3); #if defined(CONFIG_PARPORT_PC_FIFO) && defined(HAS_DMA) if (priv->dma_buf) dma_free_coherent(p->physport->dev, PAGE_SIZE, diff --git a/drivers/parport/parport_sunbpp.c b/drivers/parport/parport_sun= bpp.c index 949236a7a27c..c7a56a0b04a0 100644 --- a/drivers/parport/parport_sunbpp.c +++ b/drivers/parport/parport_sunbpp.c @@ -50,7 +50,7 @@ =20 static void parport_sunbpp_disable_irq(struct parport *p) { - struct bpp_regs __iomem *regs =3D (struct bpp_regs __iomem *)p->base; + struct bpp_regs __iomem *regs =3D (struct bpp_regs __iomem *)p->iobase; u32 tmp; =20 tmp =3D sbus_readl(®s->p_csr); @@ -60,7 +60,7 @@ static void parport_sunbpp_disable_irq(struct parport *p) =20 static void parport_sunbpp_enable_irq(struct parport *p) { - struct bpp_regs __iomem *regs =3D (struct bpp_regs __iomem *)p->base; + struct bpp_regs __iomem *regs =3D (struct bpp_regs __iomem *)p->iobase; u32 tmp; =20 tmp =3D sbus_readl(®s->p_csr); @@ -70,7 +70,7 @@ static void parport_sunbpp_enable_irq(struct parport *p) =20 static void parport_sunbpp_write_data(struct parport *p, unsigned char d) { - struct bpp_regs __iomem *regs =3D (struct bpp_regs __iomem *)p->base; + struct bpp_regs __iomem *regs =3D (struct bpp_regs __iomem *)p->iobase; =20 sbus_writeb(d, ®s->p_dr); dprintk((KERN_DEBUG "wrote 0x%x\n", d)); @@ -78,14 +78,14 @@ static void parport_sunbpp_write_data(struct parport *p= , unsigned char d) =20 static unsigned char parport_sunbpp_read_data(struct parport *p) { - struct bpp_regs __iomem *regs =3D (struct bpp_regs __iomem *)p->base; + struct bpp_regs __iomem *regs =3D (struct bpp_regs __iomem *)p->iobase; =20 return sbus_readb(®s->p_dr); } =20 static unsigned char status_sunbpp_to_pc(struct parport *p) { - struct bpp_regs __iomem *regs =3D (struct bpp_regs __iomem *)p->base; + struct bpp_regs __iomem *regs =3D (struct bpp_regs __iomem *)p->iobase; unsigned char bits =3D 0; unsigned char value_tcr =3D sbus_readb(®s->p_tcr); unsigned char value_ir =3D sbus_readb(®s->p_ir); @@ -108,7 +108,7 @@ static unsigned char status_sunbpp_to_pc(struct parport= *p) =20 static unsigned char control_sunbpp_to_pc(struct parport *p) { - struct bpp_regs __iomem *regs =3D (struct bpp_regs __iomem *)p->base; + struct bpp_regs __iomem *regs =3D (struct bpp_regs __iomem *)p->iobase; unsigned char bits =3D 0; unsigned char value_tcr =3D sbus_readb(®s->p_tcr); unsigned char value_or =3D sbus_readb(®s->p_or); @@ -136,7 +136,7 @@ static unsigned char parport_sunbpp_frob_control(struct= parport *p, unsigned char mask, unsigned char val) { - struct bpp_regs __iomem *regs =3D (struct bpp_regs __iomem *)p->base; + struct bpp_regs __iomem *regs =3D (struct bpp_regs __iomem *)p->iobase; unsigned char value_tcr =3D sbus_readb(®s->p_tcr); unsigned char value_or =3D sbus_readb(®s->p_or); =20 @@ -195,7 +195,7 @@ static unsigned char parport_sunbpp_read_status(struct = parport *p) =20 static void parport_sunbpp_data_forward (struct parport *p) { - struct bpp_regs __iomem *regs =3D (struct bpp_regs __iomem *)p->base; + struct bpp_regs __iomem *regs =3D (struct bpp_regs __iomem *)p->iobase; unsigned char value_tcr =3D sbus_readb(®s->p_tcr); =20 dprintk((KERN_DEBUG "forward\n")); @@ -205,7 +205,7 @@ static void parport_sunbpp_data_forward (struct parport= *p) =20 static void parport_sunbpp_data_reverse (struct parport *p) { - struct bpp_regs __iomem *regs =3D (struct bpp_regs __iomem *)p->base; + struct bpp_regs __iomem *regs =3D (struct bpp_regs __iomem *)p->iobase; u8 val =3D sbus_readb(®s->p_tcr); =20 dprintk((KERN_DEBUG "reverse\n")); @@ -308,13 +308,13 @@ static int bpp_probe(struct platform_device *op) =20 parport_sunbpp_enable_irq(p); =20 - regs =3D (struct bpp_regs __iomem *)p->base; + regs =3D (struct bpp_regs __iomem *)p->iobase; =20 value_tcr =3D sbus_readb(®s->p_tcr); value_tcr &=3D ~P_TCR_DIR; sbus_writeb(value_tcr, ®s->p_tcr); =20 - pr_info("%s: sunbpp at 0x%lx\n", p->name, p->base); + pr_info("%s: sunbpp at 0x%lx\n", p->name, p->iobase); =20 dev_set_drvdata(&op->dev, p); =20 @@ -346,7 +346,7 @@ static void bpp_remove(struct platform_device *op) free_irq(p->irq, p); } =20 - of_iounmap(&op->resource[0], (void __iomem *) p->base, p->size); + of_iounmap(&op->resource[0], (void __iomem *) p->iobase, p->size); parport_put_port(p); kfree(ops); =20 diff --git a/drivers/parport/procfs.c b/drivers/parport/procfs.c index 3f809fff317b..5505aba51c3c 100644 --- a/drivers/parport/procfs.c +++ b/drivers/parport/procfs.c @@ -128,7 +128,7 @@ static int do_hardware_base_addr(const struct ctl_table= *table, int write, if (write) /* permissions prevent this anyway */ return -EACCES; =20 - len +=3D scnprintf(buffer, sizeof(buffer), "%lu\t%lu\n", port->base, port= ->base_hi); + len +=3D scnprintf(buffer, sizeof(buffer), "%lu\t%lu\n", port->iobase, po= rt->iobase_hi); =20 if (len > *lenp) len =3D *lenp; diff --git a/drivers/parport/share.c b/drivers/parport/share.c index 427abdf3c4c4..0d44d7a9c88f 100644 --- a/drivers/parport/share.c +++ b/drivers/parport/share.c @@ -7,8 +7,6 @@ * Philip Blundell * Andrea Arcangeli * - * based on work by Grant Guenther - * and Philip Blundell * * Any part of this program may be used in documents licensed under * the GNU Free Documentation License, Version 1.1 or any later version @@ -435,7 +433,7 @@ struct parport *parport_register_port(unsigned long bas= e, int irq, int dma, return NULL; =20 /* Init our structure */ - tmp->base =3D base; + tmp->iobase =3D base; tmp->irq =3D irq; tmp->dma =3D dma; tmp->muxport =3D tmp->daisy =3D tmp->muxsel =3D -1; @@ -931,7 +929,7 @@ struct parport *parport_find_base(unsigned long base) =20 spin_lock(&parportlist_lock); list_for_each_entry(port, &portlist, list) { - if (port->base =3D=3D base) { + if (port->iobase =3D=3D base) { result =3D parport_get_port(port); break; } diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c index 1d4c7310f1a6..e1f4c4916e18 100644 --- a/drivers/scsi/imm.c +++ b/drivers/scsi/imm.c @@ -69,7 +69,7 @@ static DEFINE_SPINLOCK(arbitration_lock); =20 static void got_it(imm_struct *dev) { - dev->base =3D dev->dev->port->base; + dev->base =3D dev->dev->port->iobase; if (dev->cur_cmd) imm_scsi_pointer(dev->cur_cmd)->phase =3D 1; else @@ -1199,8 +1199,8 @@ static int __imm_attach(struct parport *pb) } dev->waiting =3D NULL; finish_wait(&waiting, &wait); - dev->base =3D dev->dev->port->base; - dev->base_hi =3D dev->dev->port->base_hi; + dev->base =3D dev->dev->port->iobase; + dev->base_hi =3D dev->dev->port->iobase_hi; w_ctr(dev->base, 0x0c); =20 /* Done configuration */ @@ -1225,7 +1225,7 @@ static int __imm_attach(struct parport *pb) if (!host) goto out1; host->no_highmem =3D true; - host->io_port =3D pb->base; + host->io_port =3D pb->iobase; host->n_io_port =3D ports; host->dma_channel =3D -1; host->unique_id =3D pb->number; diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c index a06329b47851..6ce4fe9fc5d0 100644 --- a/drivers/scsi/ppa.c +++ b/drivers/scsi/ppa.c @@ -64,7 +64,7 @@ static DEFINE_SPINLOCK(arbitration_lock); =20 static void got_it(ppa_struct *dev) { - dev->base =3D dev->dev->port->base; + dev->base =3D dev->dev->port->iobase; if (dev->cur_cmd) ppa_scsi_pointer(dev->cur_cmd)->phase =3D 1; else @@ -232,7 +232,7 @@ static inline void epp_reset(unsigned short ppb) */ static inline void ecp_sync(ppa_struct *dev) { - int i, ppb_hi =3D dev->dev->port->base_hi; + int i, ppb_hi =3D dev->dev->port->iobase_hi; =20 if (ppb_hi =3D=3D 0) return; @@ -472,7 +472,7 @@ static int ppa_init(ppa_struct *dev) =20 if (autodetect) { int modes =3D dev->dev->port->modes; - int ppb_hi =3D dev->dev->port->base_hi; + int ppb_hi =3D dev->dev->port->iobase_hi; =20 /* Mode detection works up the chain of speed * This avoids a nasty if-then-else-if-... tree @@ -1081,7 +1081,7 @@ static int __ppa_attach(struct parport *pb) } dev->waiting =3D NULL; finish_wait(&waiting, &wait); - dev->base =3D dev->dev->port->base; + dev->base =3D dev->dev->port->iobase; w_ctr(dev->base, 0x0c); =20 /* Done configuration */ @@ -1105,7 +1105,7 @@ static int __ppa_attach(struct parport *pb) if (!host) goto out1; host->no_highmem =3D true; - host->io_port =3D pb->base; + host->io_port =3D pb->iobase; host->n_io_port =3D ports; host->dma_channel =3D -1; host->unique_id =3D pb->number; diff --git a/include/linux/parport.h b/include/linux/parport.h index 464c2ad28039..4e39c400d002 100644 --- a/include/linux/parport.h +++ b/include/linux/parport.h @@ -182,8 +182,8 @@ struct ieee1284_info { =20 /* A parallel port */ struct parport { - unsigned long base; /* base address */ - unsigned long base_hi; /* base address (hi - ECR) */ + unsigned long iobase; /* base address for ioport */ + unsigned long iobase_hi; /* base address (hi - ECR) */ unsigned int size; /* IO extent */ const char *name; unsigned int modes; diff --git a/include/linux/parport_pc.h b/include/linux/parport_pc.h index f1ec5c10c3b3..4d92c831d06a 100644 --- a/include/linux/parport_pc.h +++ b/include/linux/parport_pc.h @@ -6,15 +6,15 @@ =20 /* --- register definitions ------------------------------- */ =20 -#define ECONTROL(p) ((p)->base_hi + 0x2) -#define CONFIGB(p) ((p)->base_hi + 0x1) -#define CONFIGA(p) ((p)->base_hi + 0x0) -#define FIFO(p) ((p)->base_hi + 0x0) -#define EPPDATA(p) ((p)->base + 0x4) -#define EPPADDR(p) ((p)->base + 0x3) -#define CONTROL(p) ((p)->base + 0x2) -#define STATUS(p) ((p)->base + 0x1) -#define DATA(p) ((p)->base + 0x0) +#define ECONTROL(p) ((p)->iobase_hi + 0x2) +#define CONFIGB(p) ((p)->iobase_hi + 0x1) +#define CONFIGA(p) ((p)->iobase_hi + 0x0) +#define FIFO(p) ((p)->iobase_hi + 0x0) +#define EPPDATA(p) ((p)->iobase + 0x4) +#define EPPADDR(p) ((p)->iobase + 0x3) +#define CONTROL(p) ((p)->iobase + 0x2) +#define STATUS(p) ((p)->iobase + 0x1) +#define DATA(p) ((p)->iobase + 0x0) =20 struct parport_pc_private { /* Contents of CTR. */ diff --git a/sound/drivers/mts64.c b/sound/drivers/mts64.c index 6fc255a6754d..fc6033b7118b 100644 --- a/sound/drivers/mts64.c +++ b/sound/drivers/mts64.c @@ -932,7 +932,7 @@ static int snd_mts64_probe(struct platform_device *pdev) strcpy(card->driver, DRIVER_NAME); strcpy(card->shortname, "ESI " CARD_NAME); sprintf(card->longname, "%s at 0x%lx, irq %i",=20 - card->shortname, p->base, p->irq); + card->shortname, p->iobase, p->irq); =20 mts64_cb.private =3D card; /* private */ pardev =3D parport_register_dev_model(p, /* port */ @@ -947,7 +947,7 @@ static int snd_mts64_probe(struct platform_device *pdev) =20 /* claim parport */ if (parport_claim(pardev)) { - dev_dbg(card->dev, "Cannot claim parport 0x%lx\n", pardev->port->base); + dev_dbg(card->dev, "Cannot claim parport 0x%lx\n", pardev->port->iobase); err =3D -EIO; goto free_pardev; } @@ -986,7 +986,7 @@ static int snd_mts64_probe(struct platform_device *pdev) goto __err; } =20 - dev_info(card->dev, "ESI Miditerminal 4140 on 0x%lx\n", p->base); + dev_info(card->dev, "ESI Miditerminal 4140 on 0x%lx\n", p->iobase); return 0; =20 release_pardev: diff --git a/sound/drivers/portman2x4.c b/sound/drivers/portman2x4.c index 54d818d2f53d..1e833feb7907 100644 --- a/sound/drivers/portman2x4.c +++ b/sound/drivers/portman2x4.c @@ -717,7 +717,7 @@ static int snd_portman_probe(struct platform_device *pd= ev) strcpy(card->driver, DRIVER_NAME); strcpy(card->shortname, CARD_NAME); sprintf(card->longname, "%s at 0x%lx, irq %i",=20 - card->shortname, p->base, p->irq); + card->shortname, p->iobase, p->irq); =20 portman_cb.private =3D card; /* private */ pardev =3D parport_register_dev_model(p, /* port */ @@ -732,7 +732,7 @@ static int snd_portman_probe(struct platform_device *pd= ev) =20 /* claim parport */ if (parport_claim(pardev)) { - dev_dbg(card->dev, "Cannot claim parport 0x%lx\n", pardev->port->base); + dev_dbg(card->dev, "Cannot claim parport 0x%lx\n", pardev->port->iobase); err =3D -EIO; goto free_pardev; } @@ -771,7 +771,7 @@ static int snd_portman_probe(struct platform_device *pd= ev) goto __err; } =20 - dev_info(card->dev, "Portman 2x4 on 0x%lx\n", p->base); + dev_info(card->dev, "Portman 2x4 on 0x%lx\n", p->iobase); return 0; =20 release_pardev: --=20 2.25.1 From nobody Sun Feb 8 18:09:29 2026 Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.5]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6AE61204020 for ; Tue, 12 Nov 2024 02:14:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731377659; cv=none; b=ltRt6YzxMJNryBzH4su4zA9QPOCWtFZBKD85VMWwjcHuacansd7Tsy8r4LRRll123Q7qSYLJhCSUeNTQpm+544vX3tvQv3AJmk476BeCz0dfVyB6ek+xgiKBGRvdgLO4RKmQP6Y0VjQXEsZlEds1mweIwVv6zn2zI6Fg/yrnWTY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731377659; c=relaxed/simple; bh=mB6YChzRNUb89kEXrNUMFwEfd1nO9KA8x9mgACv5raA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZwgTstnIJlUTZyvPUiRhGRD6sSIxPEULDYpuMRKKkHPrf2ItHd0l+80B0HJTn4QQKzIebQABSDF3N4oCXdC4T5H3qDXZr1ecO5migLtEnAh0YBBlrF/Gk6w37KjgY6ZE0hiokoKIvIPZXEpCDTqjP+RJCVeekIgLb4eZE8Bb93E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=l9ljt9vU; arc=none smtp.client-ip=117.135.210.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="l9ljt9vU" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=65pDS qkez0ViZ6AbD2cPQF2JYryGHDJ0TXhKb02lB20=; b=l9ljt9vUf2ed+vxSHP1Z6 iolQ9agaBiaSIboW3E/c11vRooqUjl4TYCCDDgciHhkRVZcbuAAvDwytOHr7JLXB nT3jAFe7M6kfGP++voSoiv7C2K0BasP3e3ezSSyLciAV0DRbrMH0wXYITVxtKodz 3wgLUyTdMx7K0WPY2kmVCU= Received: from localhost.localdomain (unknown [111.48.58.13]) by gzga-smtp-mtada-g0-2 (Coremail) with SMTP id _____wD3_4hwuTJnfZjdGw--.189S5; Tue, 12 Nov 2024 10:12:09 +0800 (CST) From: 412574090@163.com To: sudipm.mukherjee@gmail.com, mpe@ellerman.id.au, davem@davemloft.net, andreas@gaisler.com, James.Bottomley@HansenPartnership.com, deller@gmx.de, dlemoal@kernel.org, cassel@kernel.org, ojeda@kernel.org, edumazet@google.com, martin.petersen@oracle.co, perex@perex.cz, t.sailer@alumni.ethz.ch, andrew+netdev@lunn.ch Cc: linux-kernel@vger.kernel.org, xiongxin@kylinos.cn, weiyufeng Subject: [PATCH v2 3/4] parport: add parport_data struct Date: Tue, 12 Nov 2024 10:11:52 +0800 Message-Id: <20241112021153.18146-4-412574090@163.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241112021153.18146-1-412574090@163.com> References: <20241112021153.18146-1-412574090@163.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wD3_4hwuTJnfZjdGw--.189S5 X-Coremail-Antispam: 1Uf129KBjvAXoW3ZF47KF4DWFyUKF43WFyfWFg_yoW8AFWfKo ZxKrWSy34rtw1fJFWrtr1qqFWkZF1xJas8C34fArn8A3srJw4ruFy8Ga1jka17WF4rKr1f Z34UJw4FqFy8try8n29KB7ZKAUJUUUU8529EdanIXcx71UUUUU7v73VFW2AGmfu7bjvjm3 AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjxUVpBTDUUUU X-CM-SenderInfo: yursklauqziqqrwthudrp/xtbBXwSVAGcysvCbkQAAsT Content-Type: text/plain; charset="utf-8" From: weiyufeng add parport_data struct,save iobase,iobase_hi,irq,dma for parport. Signed-off-by: weiyufeng --- arch/powerpc/include/asm/parport.h | 5 +- arch/sparc/include/asm/parport_64.h | 13 +-- drivers/parisc/superio.c | 9 ++- drivers/parport/parport_cs.c | 73 ++++++++--------- drivers/parport/parport_pc.c | 119 +++++++++++++++++----------- drivers/parport/parport_serial.c | 7 +- include/linux/parport.h | 8 ++ include/linux/parport_pc.h | 8 +- 8 files changed, 143 insertions(+), 99 deletions(-) diff --git a/arch/powerpc/include/asm/parport.h b/arch/powerpc/include/asm/= parport.h index 42cc321ed754..9acfa608c531 100644 --- a/arch/powerpc/include/asm/parport.h +++ b/arch/powerpc/include/asm/parport.h @@ -21,6 +21,7 @@ static int parport_pc_find_nonpci_ports (int autoirq, int= autodma) int propsize; int count =3D 0; int virq; + struct parport_data tmp_pdata; =20 for_each_compatible_node(np, "parallel", "pnpPNP,400") { prop =3D of_get_property(np, "reg", &propsize); @@ -32,8 +33,8 @@ static int parport_pc_find_nonpci_ports (int autoirq, int= autodma) if (!virq) continue; =20 - if (parport_pc_probe_port(io1, io2, virq, autodma, NULL, 0) - !=3D NULL) + parport_data_ioport_init(&tmp_pdata, io1, io2, virq, autodma); + if (parport_pc_probe_port(tmp_pdata, NULL, 0) !=3D NULL) count++; } return count; diff --git a/arch/sparc/include/asm/parport_64.h b/arch/sparc/include/asm/p= arport_64.h index 4f530a270760..ff2b7855fbb7 100644 --- a/arch/sparc/include/asm/parport_64.h +++ b/arch/sparc/include/asm/parport_64.h @@ -115,13 +115,14 @@ static int ecpp_probe(struct platform_device *op) unsigned long d_len; struct device_node *parent; struct parport *p; + struct parport_data tmp_pdata; int slot, err; =20 parent =3D op->dev.of_node->parent; if (of_node_name_eq(parent, "dma")) { - p =3D parport_pc_probe_port(base, base + 0x400, - op->archdata.irqs[0], PARPORT_DMA_NOFIFO, - op->dev.parent->parent, 0); + parport_data_ioport_init(&tmp_pdata, base, base + 0x400, + op->archdata.irqs[0], PARPORT_DMA_NOFIFO); + p =3D parport_pc_probe_port(tmp_pdata, op->dev.parent->parent, 0); if (!p) return -ENOMEM; dev_set_drvdata(&op->dev, p); @@ -169,9 +170,9 @@ static int ecpp_probe(struct platform_device *op) ns87303_modify(config, PTR, 0, PTR_LPT_REG_DIR); =20 - p =3D parport_pc_probe_port(base, base + 0x400, - op->archdata.irqs[0], - slot, + parport_data_ioport_init(&tmp_pdata, base, base + 0x400, + op->archdata.irqs[0], slot); + p =3D parport_pc_probe_port(tmp_pdata, op->dev.parent, 0); err =3D -ENOMEM; diff --git a/drivers/parisc/superio.c b/drivers/parisc/superio.c index e973c6893203..ca162c3bbe09 100644 --- a/drivers/parisc/superio.c +++ b/drivers/parisc/superio.c @@ -418,10 +418,11 @@ static void __init superio_serial_init(void) static void __init superio_parport_init(void) { #ifdef CONFIG_PARPORT_PC - if (!parport_pc_probe_port(sio_dev.pp_base, - 0 /*base_hi*/, - PAR_IRQ,=20 - PARPORT_DMA_NONE /* dma */, + struct parport_data tmp_pdata; + + parport_data_ioport_init(&tmp_pdata, sio_dev.pp_base, 0, + PAR_IRQ, PARPORT_DMA_NONE); + if (!parport_pc_probe_port(tmp_pdata, NULL /*struct pci_dev* */, 0 /* shared irq flags */)) =20 diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c index 8e7e3ac4bb87..5b2437f710cc 100644 --- a/drivers/parport/parport_cs.c +++ b/drivers/parport/parport_cs.c @@ -118,42 +118,43 @@ static int parport_config_check(struct pcmcia_device = *p_dev, void *priv_data) =20 static int parport_config(struct pcmcia_device *link) { - parport_info_t *info =3D link->priv; - struct parport *p; - int ret; - - dev_dbg(&link->dev, "parport_config\n"); - - if (epp_mode) - link->config_index |=3D FORCE_EPP_MODE; - - ret =3D pcmcia_loop_config(link, parport_config_check, NULL); - if (ret) - goto failed; - - if (!link->irq) - goto failed; - ret =3D pcmcia_enable_device(link); - if (ret) - goto failed; - - p =3D parport_pc_probe_port(link->resource[0]->start, - link->resource[1]->start, - link->irq, PARPORT_DMA_NONE, - &link->dev, IRQF_SHARED); - if (p =3D=3D NULL) { - pr_notice("parport_cs: parport_pc_probe_port() at 0x%3x, irq %u faile= d\n", - (unsigned int)link->resource[0]->start, link->irq); - goto failed; - } - - p->modes |=3D PARPORT_MODE_PCSPP; - if (epp_mode) - p->modes |=3D PARPORT_MODE_TRISTATE | PARPORT_MODE_EPP; - info->ndev =3D 1; - info->port =3D p; - - return 0; + parport_info_t *info =3D link->priv; + struct parport *p; + struct parport_data tmp_pdata; + int ret; + + dev_dbg(&link->dev, "parport_config\n"); + + if (epp_mode) + link->config_index |=3D FORCE_EPP_MODE; + + ret =3D pcmcia_loop_config(link, parport_config_check, NULL); + if (ret) + goto failed; + + if (!link->irq) + goto failed; + ret =3D pcmcia_enable_device(link); + if (ret) + goto failed; + + parport_data_ioport_init(&tmp_pdata, link->resource[0]->start, + link->resource[1]->start, + link->irq, PARPORT_DMA_NONE); + p =3D parport_pc_probe_port(tmp_pdata, &link->dev, IRQF_SHARED); + if (p =3D=3D NULL) { + pr_notice("parport_cs: parport_pc_probe_port() at 0x%3x, irq %u failed\n= ", + (unsigned int)link->resource[0]->start, link->irq); + goto failed; + } + + p->modes |=3D PARPORT_MODE_PCSPP; + if (epp_mode) + p->modes |=3D PARPORT_MODE_TRISTATE | PARPORT_MODE_EPP; + info->ndev =3D 1; + info->port =3D p; + + return 0; =20 failed: parport_cs_release(link); diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index 160d87449913..b4e959a2d8a1 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -2022,9 +2022,7 @@ static int parport_dma_probe(struct parport *p) static LIST_HEAD(ports_list); static DEFINE_SPINLOCK(ports_lock); =20 -static struct parport *__parport_pc_probe_port(unsigned long int base, - unsigned long int base_hi, - int irq, int dma, +static struct parport *__parport_pc_probe_port(struct parport_data data, struct device *dev, int irqflags, unsigned int mode_mask, @@ -2044,7 +2042,7 @@ static struct parport *__parport_pc_probe_port(unsign= ed long int base, /* We need a physical device to attach to, but none was * provided. Create our own. */ pdev =3D platform_device_register_simple("parport_pc", - base, NULL, 0); + data.iobase, NULL, 0); if (IS_ERR(pdev)) return NULL; dev =3D &pdev->dev; @@ -2052,7 +2050,7 @@ static struct parport *__parport_pc_probe_port(unsign= ed long int base, ret =3D dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(24)); if (ret) { dev_err(dev, "Unable to set coherent dma mask: disabling DMA\n"); - dma =3D PARPORT_DMA_NONE; + data.dma =3D PARPORT_DMA_NONE; } } =20 @@ -2065,13 +2063,17 @@ static struct parport *__parport_pc_probe_port(unsi= gned long int base, goto out2; =20 /* a misnomer, actually - it's allocate and reserve parport number */ - p =3D parport_register_port(base, irq, dma, ops); + p =3D parport_register_port(data.iobase, data.irq, data.dma, ops); if (!p) goto out3; =20 - base_res =3D request_region(base, 3, p->name); - if (!base_res) + if (p->iobase) { + base_res =3D request_region(data.iobase, 3, p->name); + if (!base_res) + goto out4; + } else { goto out4; + } =20 memcpy(ops, &parport_pc_ops, sizeof(struct parport_operations)); priv->ctr =3D 0xc; @@ -2085,18 +2087,18 @@ static struct parport *__parport_pc_probe_port(unsi= gned long int base, priv->port =3D p; =20 p->dev =3D dev; - p->iobase_hi =3D base_hi; + p->iobase_hi =3D data.iobase_hi; p->modes =3D PARPORT_MODE_PCSPP | PARPORT_MODE_SAFEININT; p->private_data =3D priv; =20 - if (base_hi) { - ECR_res =3D request_region(base_hi, 3, p->name); + if (p->iobase_hi) { + ECR_res =3D request_region(data.iobase_hi, 3, p->name); if (ECR_res) parport_ECR_present(p); } =20 - if (base !=3D 0x3bc) { - EPP_res =3D request_region(base+0x3, 5, p->name); + if (p->iobase !=3D 0x3bc) { + EPP_res =3D request_region(data.iobase + 0x3, 5, p->name); if (EPP_res) if (!parport_EPP_supported(p)) parport_ECPEPP_supported(p); @@ -2191,13 +2193,16 @@ do { \ pr_info("%s: irq %d detected\n", p->name, probedirq); =20 /* If No ECP release the ports grabbed above. */ - if (ECR_res && (p->modes & PARPORT_MODE_ECP) =3D=3D 0) { - release_region(base_hi, 3); - ECR_res =3D NULL; + if ((p->modes & PARPORT_MODE_ECP) =3D=3D 0) { + if (p->iobase_hi && ECR_res) { + release_region(p->iobase_hi, 3); + ECR_res =3D NULL; + } } + /* Likewise for EEP ports */ - if (EPP_res && (p->modes & PARPORT_MODE_EPP) =3D=3D 0) { - release_region(base+3, 5); + if (p->iobase && EPP_res && (p->modes & PARPORT_MODE_EPP) =3D=3D 0) { + release_region(p->iobase + 3, 5); EPP_res =3D NULL; } if (p->irq !=3D PARPORT_IRQ_NONE) { @@ -2257,10 +2262,10 @@ do { \ =20 out5: if (ECR_res) - release_region(base_hi, 3); + release_region(p->iobase_hi, 3); if (EPP_res) - release_region(base+0x3, 5); - release_region(base, 3); + release_region(p->iobase + 0x3, 5); + release_region(p->iobase, 3); out4: parport_del_port(p); out3: @@ -2273,14 +2278,24 @@ do { \ return NULL; } =20 -struct parport *parport_pc_probe_port(unsigned long int base, - unsigned long int base_hi, - int irq, int dma, +void parport_data_ioport_init(struct parport_data *tmp_pdata, + unsigned long iobase, + unsigned long iobase_hi, + int irq, int dma) +{ + memset(tmp_pdata, 0, sizeof(struct parport_data)); + tmp_pdata->iobase =3D iobase; + tmp_pdata->iobase_hi =3D iobase_hi; + tmp_pdata->irq =3D irq; + tmp_pdata->dma =3D dma; +} +EXPORT_SYMBOL(parport_data_ioport_init); + +struct parport *parport_pc_probe_port(struct parport_data data, struct device *dev, int irqflags) { - return __parport_pc_probe_port(base, base_hi, irq, dma, - dev, irqflags, 0, 0); + return __parport_pc_probe_port(data, dev, irqflags, 0, 0); } EXPORT_SYMBOL(parport_pc_probe_port); =20 @@ -2325,6 +2340,7 @@ static int sio_ite_8872_probe(struct pci_dev *pdev, i= nt autoirq, int autodma, short inta_addr[6] =3D { 0x2A0, 0x2C0, 0x220, 0x240, 0x1E0 }; u32 ite8872set; u32 ite8872_lpt, ite8872_lpthi; + struct parport_data tmp_pdata; u8 ite8872_irq, type; int irq; int i; @@ -2407,8 +2423,9 @@ static int sio_ite_8872_probe(struct pci_dev *pdev, i= nt autoirq, int autodma, * Release the resource so that parport_pc_probe_port can get it. */ release_region(inta_addr[i], 32); - if (parport_pc_probe_port(ite8872_lpt, ite8872_lpthi, - irq, PARPORT_DMA_NONE, &pdev->dev, 0)) { + parport_data_ioport_init(&tmp_pdata, ite8872_lpt, ite8872_lpthi, irq, + PARPORT_DMA_NONE); + if (parport_pc_probe_port(tmp_pdata, &pdev->dev, 0)) { pr_info("parport_pc: ITE 8872 parallel port: io=3D0x%X", ite8872_lpt); if (irq !=3D PARPORT_IRQ_NONE) @@ -2447,6 +2464,7 @@ static struct parport_pc_via_data via_8231_data =3D { static int sio_via_probe(struct pci_dev *pdev, int autoirq, int autodma, const struct parport_pc_via_data *via) { + struct parport_data tmp_pdata; u8 tmp, tmp2, siofunc; u8 ppcontrol =3D 0; int dma, irq; @@ -2587,7 +2605,8 @@ static int sio_via_probe(struct pci_dev *pdev, int au= toirq, int autodma, } =20 /* finally, do the probe with values obtained */ - if (parport_pc_probe_port(port1, port2, irq, dma, &pdev->dev, 0)) { + parport_data_ioport_init(&tmp_pdata, port1, port2, irq, dma); + if (parport_pc_probe_port(tmp_pdata, &pdev->dev, 0)) { pr_info("parport_pc: VIA parallel port: io=3D0x%X", port1); if (irq !=3D PARPORT_IRQ_NONE) pr_cont(", irq=3D%d", irq); @@ -2868,6 +2887,7 @@ static int parport_pc_pci_probe(struct pci_dev *dev, { int err, count, n, i =3D id->driver_data; struct pci_parport_data *data; + struct parport_data tmp_pdata; =20 if (i < last_sio) /* This is an onboard Super-IO and has already been probed */ @@ -2913,9 +2933,10 @@ static int parport_pc_pci_probe(struct pci_dev *dev, printk(KERN_DEBUG "PCI parallel port detected: %04x:%04x, I/O at %#lx(%= #lx), IRQ %d\n", id->vendor, id->device, io_lo, io_hi, irq); } + parport_data_ioport_init(&tmp_pdata, io_lo, io_hi, + irq, PARPORT_DMA_NONE); data->ports[count] =3D - __parport_pc_probe_port(io_lo, io_hi, irq, - PARPORT_DMA_NONE, &dev->dev, + __parport_pc_probe_port(tmp_pdata, &dev->dev, IRQF_SHARED, cards[i].mode_mask, cards[i].ecr_writable); @@ -3002,35 +3023,35 @@ static int parport_pc_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *id) { struct parport *pdata; - unsigned long io_lo, io_hi; - int dma, irq; + struct parport_data tmp_pdata; =20 + memset(&tmp_pdata, 0, sizeof(struct parport_data)); if (pnp_port_valid(dev, 0) && !(pnp_port_flags(dev, 0) & IORESOURCE_DISABLED)) { - io_lo =3D pnp_port_start(dev, 0); + tmp_pdata.iobase =3D pnp_port_start(dev, 0); } else return -EINVAL; =20 if (pnp_port_valid(dev, 1) && !(pnp_port_flags(dev, 1) & IORESOURCE_DISABLED)) { - io_hi =3D pnp_port_start(dev, 1); + tmp_pdata.iobase_hi =3D pnp_port_start(dev, 1); } else - io_hi =3D 0; + tmp_pdata.iobase_hi =3D 0; =20 if (pnp_irq_valid(dev, 0) && !(pnp_irq_flags(dev, 0) & IORESOURCE_DISABLED)) { - irq =3D pnp_irq(dev, 0); + tmp_pdata.irq =3D pnp_irq(dev, 0); } else - irq =3D PARPORT_IRQ_NONE; + tmp_pdata.irq =3D PARPORT_IRQ_NONE; =20 if (pnp_dma_valid(dev, 0) && !(pnp_dma_flags(dev, 0) & IORESOURCE_DISABLED)) { - dma =3D pnp_dma(dev, 0); + tmp_pdata.dma =3D pnp_dma(dev, 0); } else - dma =3D PARPORT_DMA_NONE; + tmp_pdata.dma =3D PARPORT_DMA_NONE; =20 dev_info(&dev->dev, "reported by %s\n", dev->protocol->name); - pdata =3D parport_pc_probe_port(io_lo, io_hi, irq, dma, &dev->dev, 0); + pdata =3D parport_pc_probe_port(tmp_pdata, &dev->dev, 0); if (pdata =3D=3D NULL) return -ENODEV; =20 @@ -3077,13 +3098,17 @@ static struct platform_driver parport_pc_platform_d= river =3D { static int __attribute__((unused)) parport_pc_find_isa_ports(int autoirq, int autodma) { + struct parport_data tmp_pdata; int count =3D 0; =20 - if (parport_pc_probe_port(0x3bc, 0x7bc, autoirq, autodma, NULL, 0)) + parport_data_ioport_init(&tmp_pdata, 0x3bc, 0x7bc, autoirq, autodma); + if (parport_pc_probe_port(tmp_pdata, NULL, 0)) count++; - if (parport_pc_probe_port(0x378, 0x778, autoirq, autodma, NULL, 0)) + parport_data_ioport_init(&tmp_pdata, 0x378, 0x778, autoirq, autodma); + if (parport_pc_probe_port(tmp_pdata, NULL, 0)) count++; - if (parport_pc_probe_port(0x278, 0x678, autoirq, autodma, NULL, 0)) + parport_data_ioport_init(&tmp_pdata, 0x278, 0x678, autoirq, autodma); + if (parport_pc_probe_port(tmp_pdata, NULL, 0)) count++; =20 return count; @@ -3352,6 +3377,7 @@ __setup("parport_init_mode=3D", parport_init_mode_set= up); =20 static int __init parport_pc_init(void) { + struct parport_data tmp_pdata; int err; =20 if (parse_parport_params()) @@ -3370,8 +3396,9 @@ static int __init parport_pc_init(void) break; if (io_hi[i] =3D=3D PARPORT_IOHI_AUTO) io_hi[i] =3D 0x400 + io[i]; - parport_pc_probe_port(io[i], io_hi[i], - irqval[i], dmaval[i], NULL, 0); + parport_data_ioport_init(&tmp_pdata, io[i], io_hi[i], + irqval[i], dmaval[i]); + parport_pc_probe_port(tmp_pdata, NULL, 0); } } else parport_pc_find_ports(irqval[0], dmaval[0]); diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_ser= ial.c index 3644997a8342..cc6ee3f0ab3e 100644 --- a/drivers/parport/parport_serial.c +++ b/drivers/parport/parport_serial.c @@ -648,6 +648,7 @@ static int parport_register(struct pci_dev *dev, const = struct pci_device_id *id) return -ENODEV; =20 for (n =3D 0; n < card->numports; n++) { + struct parport_data tmp_pdata; struct parport *port; int lo =3D card->addr[n].lo; int hi =3D card->addr[n].hi; @@ -684,8 +685,10 @@ static int parport_register(struct pci_dev *dev, const= struct pci_device_id *id) "PCI parallel port detected: I/O at %#lx(%#lx), IRQ %d\n", io_lo, io_hi, irq); } - port =3D parport_pc_probe_port (io_lo, io_hi, irq, - PARPORT_DMA_NONE, &dev->dev, IRQF_SHARED); + parport_data_ioport_init(&tmp_pdata, io_lo, io_hi, + irq, PARPORT_DMA_NONE); + port =3D parport_pc_probe_port(tmp_pdata, &dev->dev, + IRQF_SHARED); if (port) { priv->port[priv->num_par++] =3D port; success =3D 1; diff --git a/include/linux/parport.h b/include/linux/parport.h index 4e39c400d002..308eadce42dd 100644 --- a/include/linux/parport.h +++ b/include/linux/parport.h @@ -180,6 +180,14 @@ struct ieee1284_info { struct semaphore irq; }; =20 +struct parport_data { + /* for ioport */ + unsigned long iobase; /* base address for ioport */ + unsigned long iobase_hi; /* base address (hi - ECR) */ + int irq; + int dma; +}; + /* A parallel port */ struct parport { unsigned long iobase; /* base address for ioport */ diff --git a/include/linux/parport_pc.h b/include/linux/parport_pc.h index 4d92c831d06a..d6c3f323caa1 100644 --- a/include/linux/parport_pc.h +++ b/include/linux/parport_pc.h @@ -230,11 +230,13 @@ static __inline__ void parport_pc_enable_irq(struct p= arport *p) extern void parport_pc_release_resources(struct parport *p); =20 extern int parport_pc_claim_resources(struct parport *p); +extern void parport_data_ioport_init(struct parport_data *tmp_pdata, + unsigned long iobase, + unsigned long iobase_hi, + int irq, int dma); =20 /* PCMCIA code will want to get us to look at a port. Provide a mechanism= . */ -extern struct parport *parport_pc_probe_port(unsigned long base, - unsigned long base_hi, - int irq, int dma, +extern struct parport *parport_pc_probe_port(struct parport_data data, struct device *dev, int irqflags); extern void parport_pc_unregister_port(struct parport *p); --=20 2.25.1 From nobody Sun Feb 8 18:09:29 2026 Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.2]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E3A7B207A03 for ; Tue, 12 Nov 2024 02:14:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.31.2 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731377666; cv=none; b=uKleofr4LP8XQZ5bdzyqPxyZ93Z7SavhadItWTPuwsEo1IuqGI8b34dZfnOpMT3GeCIkRwAKzvQrujF5phnqSfmHekb/xLJtEIn972L9/NPhPWbOobGi8rWPRAigfEQq6nobcfeBbnZjclzh6JXEvt0m6ZcJ1TItkHMfAtcKzJ0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731377666; c=relaxed/simple; bh=c/ggBBy5qW4OHtVIVj5HjwltHtONKCZ0Tgxa5rv/5Nk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jinW+lwHxCJwO5YMHvMzep39HrjpZwKfm1XLdAAC5hLuhi0QRRN0zqA6upmN1ZHdZoh4XkGq2YY8eXrCxFBR0aPfku/eqkTno+c4ZcYB9H/JbflcrBVvRjIcs8WnL4U2VW8sin2hA3VttQtvbwpOGkl9/IQ2enJNaN74GGIKLII= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=dJlh9xHr; arc=none smtp.client-ip=220.197.31.2 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="dJlh9xHr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=ybCwY niFqIxg2ErBCXc/L0acp6AgpExP+ha5GSVO8A0=; b=dJlh9xHr/D56qfttB4BjY dC0aTBklQCwrDG/uRXHdgWJJd/dmHjyeyimJBULCbkz3rqKCSRjtF7R+3gIITyA6 2jgnNlXO0ORlChwrudXCVDPR1MXIYHQNo3YT/ZmqXuuuknWfODmhnXvuc0Ck+8/w +TEDcF4ZMZBEaGjy15Lqd0= Received: from localhost.localdomain (unknown [111.48.58.13]) by gzga-smtp-mtada-g0-2 (Coremail) with SMTP id _____wD3_4hwuTJnfZjdGw--.189S6; Tue, 12 Nov 2024 10:12:13 +0800 (CST) From: 412574090@163.com To: sudipm.mukherjee@gmail.com, mpe@ellerman.id.au, davem@davemloft.net, andreas@gaisler.com, James.Bottomley@HansenPartnership.com, deller@gmx.de, dlemoal@kernel.org, cassel@kernel.org, ojeda@kernel.org, edumazet@google.com, martin.petersen@oracle.co, perex@perex.cz, t.sailer@alumni.ethz.ch, andrew+netdev@lunn.ch Cc: linux-kernel@vger.kernel.org, xiongxin@kylinos.cn, weiyufeng Subject: [PATCH v2 4/4] parport: add iomem type for parport Date: Tue, 12 Nov 2024 10:11:53 +0800 Message-Id: <20241112021153.18146-5-412574090@163.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241112021153.18146-1-412574090@163.com> References: <20241112021153.18146-1-412574090@163.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wD3_4hwuTJnfZjdGw--.189S6 X-Coremail-Antispam: 1Uf129KBjvAXoWDAFyxCFWfJF4rXr4UCFWxWFg_yoWrAw1xGo Z7trWfJ34rKws3JFy8Kr4DW3ykXw17W3WDCrWSyr4Yv3srAa1vqF1fAFWayw4ftrs8Kr1f X34kWw4YyF18tF1xn29KB7ZKAUJUUUU8529EdanIXcx71UUUUU7v73VFW2AGmfu7bjvjm3 AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjxUIpnQUUUUU X-CM-SenderInfo: yursklauqziqqrwthudrp/xtbBFROVAGcyrpPz6QAAsh Content-Type: text/plain; charset="utf-8" From: weiyufeng Solve the problem of not being able to use LPC and PCIE parallel ports simultaneously on the phytium platform.Optimize lpc and pci parallel port program. add iomem type for parport. In DSDT,LPT recommends the following description: Device (LPT) { Name (_HID, EisaId ("PNP0400") /* Standard LPT Parallel Port */) Name (_UID, Zero) // _UID: Unique ID Name (_DDN, "LPT1") // _DDN: DOS Device Name Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings { Memory32Fixed (ReadWrite, 0x20000378, // Address Base 0x00000008, // Address Length ) IRQNoFlags () {7} }) } Signed-off-by: weiyufeng --- drivers/parport/parport_pc.c | 550 +++++++++++++++++++++-------------- include/linux/parport.h | 18 ++ include/linux/parport_pc.h | 101 +++++-- 3 files changed, 428 insertions(+), 241 deletions(-) diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index b4e959a2d8a1..39925c1bb75b 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c @@ -112,7 +112,7 @@ static void frob_econtrol(struct parport *pb, unsigned = char m, unsigned char new; =20 if (m !=3D 0xff) - ectr =3D inb(ECONTROL(pb)); + ectr =3D parport_pc_readb(pb, ECONTROL(pb)); =20 new =3D (ectr & ~m) ^ v; if (ecr_writable) @@ -121,7 +121,7 @@ static void frob_econtrol(struct parport *pb, unsigned = char m, =20 pr_debug("frob_econtrol(%02x,%02x): %02x -> %02x\n", m, v, ectr, new); =20 - outb(new, ECONTROL(pb)); + parport_pc_writeb(pb, new, ECONTROL(pb)); } =20 static inline void frob_set_mode(struct parport *p, int mode) @@ -150,7 +150,7 @@ static int change_mode(struct parport *p, int m) } =20 /* Bits <7:5> contain the mode. */ - oecr =3D inb(ECONTROL(p)); + oecr =3D parport_pc_readb(p, ECONTROL(p)); mode =3D (oecr >> 5) & 0x7; if (mode =3D=3D m) return 0; @@ -165,7 +165,7 @@ static int change_mode(struct parport *p, int m) case ECR_ECP: /* ECP Parallel Port mode */ /* Busy wait for 200us */ for (counter =3D 0; counter < 40; counter++) { - if (inb(ECONTROL(p)) & 0x01) + if (parport_pc_readb(p, ECONTROL(p)) & 0x01) break; if (signal_pending(current)) break; @@ -173,7 +173,7 @@ static int change_mode(struct parport *p, int m) } =20 /* Poll slowly. */ - while (!(inb(ECONTROL(p)) & 0x01)) { + while (!(parport_pc_readb(p, ECONTROL(p)) & 0x01)) { if (time_after_eq(jiffies, expire)) /* The FIFO is stuck. */ return -EBUSY; @@ -215,8 +215,9 @@ static int clear_epp_timeout(struct parport *pb) /* To clear timeout some chips require double read */ parport_pc_read_status(pb); r =3D parport_pc_read_status(pb); - outb(r | 0x01, STATUS(pb)); /* Some reset by writing 1 */ - outb(r & 0xfe, STATUS(pb)); /* Others by writing 0 */ + parport_pc_writeb(pb, r | 0x01, + STATUS(pb)); /* Some reset by writing 1 */ + parport_pc_writeb(pb, r & 0xfe, STATUS(pb)); /* Others by writing 0 */ r =3D parport_pc_read_status(pb); =20 return !(r & 0x01); @@ -248,7 +249,7 @@ static void parport_pc_save_state(struct parport *p, st= ruct parport_state *s) const struct parport_pc_private *priv =3D p->physport->private_data; s->u.pc.ctr =3D priv->ctr; if (priv->ecr) - s->u.pc.ecr =3D inb(ECONTROL(p)); + s->u.pc.ecr =3D parport_pc_readb(p, ECONTROL(p)); } =20 static void parport_pc_restore_state(struct parport *p, @@ -256,7 +257,7 @@ static void parport_pc_restore_state(struct parport *p, { struct parport_pc_private *priv =3D p->physport->private_data; register unsigned char c =3D s->u.pc.ctr & priv->ctr_writable; - outb(c, CONTROL(p)); + parport_pc_writeb(p, c, CONTROL(p)); priv->ctr =3D c; if (priv->ecr) ECR_WRITE(p, s->u.pc.ecr); @@ -276,26 +277,29 @@ static size_t parport_pc_epp_read_data(struct parport= *port, void *buf, * nFault is 0 if there is at least 1 byte in the Warp's FIFO * pError is 1 if there are 16 bytes in the Warp's FIFO */ - status =3D inb(STATUS(port)); + status =3D parport_pc_readb(port, STATUS(port)); =20 while (!(status & 0x08) && got < length) { if (left >=3D 16 && (status & 0x20) && !(status & 0x08)) { /* can grab 16 bytes from warp fifo */ if (!((long)buf & 0x03)) - insl(EPPDATA(port), buf, 4); + parport_pc_readsl(port, EPPDATA(port), + buf, 4); else - insb(EPPDATA(port), buf, 16); + parport_pc_readsb(port, EPPDATA(port), + buf, 16); buf +=3D 16; got +=3D 16; left -=3D 16; } else { /* grab single byte from the warp fifo */ - *((char *)buf) =3D inb(EPPDATA(port)); + *((char *)buf) =3D parport_pc_readb(port, + EPPDATA(port)); buf++; got++; left--; } - status =3D inb(STATUS(port)); + status =3D parport_pc_readb(port, STATUS(port)); if (status & 0x01) { /* EPP timeout should never occur... */ printk(KERN_DEBUG "%s: EPP timeout occurred while talking to w91284pic= (should not have done)\n", @@ -310,22 +314,24 @@ static size_t parport_pc_epp_read_data(struct parport= *port, void *buf, || flags & PARPORT_EPP_FAST_8)) { if ((flags & PARPORT_EPP_FAST_32) && !(((long)buf | length) & 0x03)) - insl(EPPDATA(port), buf, (length >> 2)); + parport_pc_readsl(port, EPPDATA(port), buf, + (length >> 2)); else if ((flags & PARPORT_EPP_FAST_16) && !(((long)buf | length) & 0x01)) - insw(EPPDATA(port), buf, length >> 1); + parport_pc_readsw(port, EPPDATA(port), buf, + length >> 1); else - insb(EPPDATA(port), buf, length); - if (inb(STATUS(port)) & 0x01) { + parport_pc_readsb(port, EPPDATA(port), buf, length); + if (parport_pc_readb(port, STATUS(port)) & 0x01) { clear_epp_timeout(port); return -EIO; } return length; } for (; got < length; got++) { - *((char *)buf) =3D inb(EPPDATA(port)); + *((char *)buf) =3D parport_pc_readb(port, EPPDATA(port)); buf++; - if (inb(STATUS(port)) & 0x01) { + if (parport_pc_readb(port, STATUS(port)) & 0x01) { /* EPP timeout */ clear_epp_timeout(port); break; @@ -345,22 +351,24 @@ static size_t parport_pc_epp_write_data(struct parpor= t *port, const void *buf, || flags & PARPORT_EPP_FAST_8)) { if ((flags & PARPORT_EPP_FAST_32) && !(((long)buf | length) & 0x03)) - outsl(EPPDATA(port), buf, (length >> 2)); + parport_pc_writesl(port, EPPDATA(port), buf, + (length >> 2)); else if ((flags & PARPORT_EPP_FAST_16) && !(((long)buf | length) & 0x01)) - outsw(EPPDATA(port), buf, length >> 1); + parport_pc_writesw(port, EPPDATA(port), buf, + length >> 1); else - outsb(EPPDATA(port), buf, length); - if (inb(STATUS(port)) & 0x01) { + parport_pc_writesb(port, EPPDATA(port), buf, length); + if (parport_pc_readb(port, STATUS(port)) & 0x01) { clear_epp_timeout(port); return -EIO; } return length; } for (; written < length; written++) { - outb(*((char *)buf), EPPDATA(port)); + parport_pc_writeb(port, *((char *)buf), EPPDATA(port)); buf++; - if (inb(STATUS(port)) & 0x01) { + if (parport_pc_readb(port, STATUS(port)) & 0x01) { clear_epp_timeout(port); break; } @@ -375,17 +383,17 @@ static size_t parport_pc_epp_read_addr(struct parport= *port, void *buf, size_t got =3D 0; =20 if ((flags & PARPORT_EPP_FAST) && (length > 1)) { - insb(EPPADDR(port), buf, length); - if (inb(STATUS(port)) & 0x01) { + parport_pc_readsb(port, EPPADDR(port), buf, length); + if (parport_pc_readb(port, STATUS(port)) & 0x01) { clear_epp_timeout(port); return -EIO; } return length; } for (; got < length; got++) { - *((char *)buf) =3D inb(EPPADDR(port)); + *((char *)buf) =3D parport_pc_readb(port, EPPADDR(port)); buf++; - if (inb(STATUS(port)) & 0x01) { + if (parport_pc_readb(port, STATUS(port)) & 0x01) { clear_epp_timeout(port); break; } @@ -401,17 +409,17 @@ static size_t parport_pc_epp_write_addr(struct parpor= t *port, size_t written =3D 0; =20 if ((flags & PARPORT_EPP_FAST) && (length > 1)) { - outsb(EPPADDR(port), buf, length); - if (inb(STATUS(port)) & 0x01) { + parport_pc_writesb(port, EPPADDR(port), buf, length); + if (parport_pc_readb(port, STATUS(port)) & 0x01) { clear_epp_timeout(port); return -EIO; } return length; } for (; written < length; written++) { - outb(*((char *)buf), EPPADDR(port)); + parport_pc_writeb(port, *((char *)buf), EPPADDR(port)); buf++; - if (inb(STATUS(port)) & 0x01) { + if (parport_pc_readb(port, STATUS(port)) & 0x01) { clear_epp_timeout(port); break; } @@ -504,7 +512,7 @@ static size_t parport_pc_fifo_write_block_pio(struct pa= rport *port, =20 while (left) { unsigned char byte; - unsigned char ecrval =3D inb(ECONTROL(port)); + unsigned char ecrval =3D parport_pc_readb(port, ECONTROL(port)); int i =3D 0; =20 if (need_resched() && time_before(jiffies, expire)) @@ -532,7 +540,7 @@ static size_t parport_pc_fifo_write_block_pio(struct pa= rport *port, printk(KERN_DEBUG "FIFO write timed out\n"); break; } - ecrval =3D inb(ECONTROL(port)); + ecrval =3D parport_pc_readb(port, ECONTROL(port)); if (!(ecrval & (1<<2))) { if (need_resched() && time_before(jiffies, expire)) @@ -554,7 +562,7 @@ static size_t parport_pc_fifo_write_block_pio(struct pa= rport *port, if (ecrval & 0x01) { /* FIFO is empty. Blast it full. */ const int n =3D left < fifo_depth ? left : fifo_depth; - outsb(fifo, bufp, n); + parport_pc_writesb(port, fifo, bufp, n); bufp +=3D n; left -=3D n; =20 @@ -564,13 +572,13 @@ static size_t parport_pc_fifo_write_block_pio(struct = parport *port, continue; } else if (i++ < poll_for) { udelay(10); - ecrval =3D inb(ECONTROL(port)); + ecrval =3D parport_pc_readb(port, ECONTROL(port)); goto poll; } =20 /* Half-full(call me an optimist) */ byte =3D *bufp++; - outb(byte, fifo); + parport_pc_writeb(port, byte, fifo); left--; } dump_parport_state("leave fifo_write_block_pio", port); @@ -662,7 +670,7 @@ static size_t parport_pc_fifo_write_block_dma(struct pa= rport *port, break; } /* Is serviceIntr set? */ - if (!(inb(ECONTROL(port)) & (1<<2))) { + if (!(parport_pc_readb(port, ECONTROL(port)) & (1<<2))) { cond_resched(); =20 goto false_alarm; @@ -767,11 +775,11 @@ static size_t parport_pc_compat_write_block_pio(struc= t parport *port, =20 /* Adjust for the contents of the FIFO. */ for (written -=3D priv->fifo_depth; ; written++) { - if (inb(ECONTROL(port)) & 0x2) { + if (parport_pc_readb(port, ECONTROL(port)) & 0x2) { /* Full up. */ break; } - outb(0, FIFO(port)); + parport_pc_writeb(port, 0, FIFO(port)); } =20 /* Reset the FIFO and return to PS2 mode. */ @@ -862,11 +870,11 @@ static size_t parport_pc_ecp_write_block_pio(struct p= arport *port, =20 /* Adjust for the contents of the FIFO. */ for (written -=3D priv->fifo_depth; ; written++) { - if (inb(ECONTROL(port)) & 0x2) { + if (parport_pc_readb(port, ECONTROL(port)) & 0x2) { /* Full up. */ break; } - outb(0, FIFO(port)); + parport_pc_writeb(port, 0, FIFO(port)); } =20 /* Reset the FIFO and return to PS2 mode. */ @@ -975,21 +983,21 @@ static void show_parconfig_smsc37c669(int io, int key) "ECP", "ECP and EPP" }; =20 - outb(key, io); - outb(key, io); - outb(1, io); - cr1 =3D inb(io + 1); - outb(4, io); - cr4 =3D inb(io + 1); - outb(0x0a, io); - cra =3D inb(io + 1); - outb(0x23, io); - cr23 =3D inb(io + 1); - outb(0x26, io); - cr26 =3D inb(io + 1); - outb(0x27, io); - cr27 =3D inb(io + 1); - outb(0xaa, io); + parport_pc_writeb(NULL, key, io); + parport_pc_writeb(NULL, key, io); + parport_pc_writeb(NULL, 1, io); + cr1 =3D parport_pc_readb(NULL, io + 1); + parport_pc_writeb(NULL, 4, io); + cr4 =3D parport_pc_readb(NULL, io + 1); + parport_pc_writeb(NULL, 0x0a, io); + cra =3D parport_pc_readb(NULL, io + 1); + parport_pc_writeb(NULL, 0x23, io); + cr23 =3D parport_pc_readb(NULL, io + 1); + parport_pc_writeb(NULL, 0x26, io); + cr26 =3D parport_pc_readb(NULL, io + 1); + parport_pc_writeb(NULL, 0x27, io); + cr27 =3D parport_pc_readb(NULL, io + 1); + parport_pc_writeb(NULL, 0xaa, io); =20 if (verbose_probing) { pr_info("SMSC 37c669 LPT Config: cr_1=3D0x%02x, 4=3D0x%02x, A=3D0x%2x, 2= 3=3D0x%02x, 26=3D0x%02x, 27=3D0x%02x\n", @@ -1065,23 +1073,25 @@ static void show_parconfig_winbond(int io, int key) /* The registers are called compatible-PnP because the register layout is modelled after ISA-PnP, the access method is just another ... */ - outb(key, io); - outb(key, io); - outb(0x07, io); /* Register 7: Select Logical Device */ - outb(0x01, io + 1); /* LD1 is Parallel Port */ - outb(0x30, io); - cr30 =3D inb(io + 1); - outb(0x60, io); - cr60 =3D inb(io + 1); - outb(0x61, io); - cr61 =3D inb(io + 1); - outb(0x70, io); - cr70 =3D inb(io + 1); - outb(0x74, io); - cr74 =3D inb(io + 1); - outb(0xf0, io); - crf0 =3D inb(io + 1); - outb(0xaa, io); + parport_pc_writeb(NULL, key, io); + parport_pc_writeb(NULL, key, io); + parport_pc_writeb(NULL, 0x07, io); /* Register 7: + * Select Logical Device + */ + parport_pc_writeb(NULL, 0x01, io + 1); /* LD1 is Parallel Port */ + parport_pc_writeb(NULL, 0x30, io); + cr30 =3D parport_pc_readb(NULL, io + 1); + parport_pc_writeb(NULL, 0x60, io); + cr60 =3D parport_pc_readb(NULL, io + 1); + parport_pc_writeb(NULL, 0x61, io); + cr61 =3D parport_pc_readb(NULL, io + 1); + parport_pc_writeb(NULL, 0x70, io); + cr70 =3D parport_pc_readb(NULL, io + 1); + parport_pc_writeb(NULL, 0x74, io); + cr74 =3D parport_pc_readb(NULL, io + 1); + parport_pc_writeb(NULL, 0xf0, io); + crf0 =3D parport_pc_readb(NULL, io + 1); + parport_pc_writeb(NULL, 0xaa, io); =20 if (verbose_probing) { pr_info("Winbond LPT Config: cr_30=3D%02x 60,61=3D%02x%02x 70=3D%02x 74= =3D%02x, f0=3D%02x\n", @@ -1202,28 +1212,36 @@ static void winbond_check(int io, int key) if (!request_region(io, 3, __func__)) return; =20 - origval =3D inb(io); /* Save original value */ + origval =3D parport_pc_readb(NULL, io); /* Save original value */ =20 /* First probe without key */ - outb(0x20, io); - x_devid =3D inb(io + 1); - outb(0x21, io); - x_devrev =3D inb(io + 1); - outb(0x09, io); - x_oldid =3D inb(io + 1); - - outb(key, io); - outb(key, io); /* Write Magic Sequence to EFER, extended - function enable register */ - outb(0x20, io); /* Write EFIR, extended function index register */ - devid =3D inb(io + 1); /* Read EFDR, extended function data register */ - outb(0x21, io); - devrev =3D inb(io + 1); - outb(0x09, io); - oldid =3D inb(io + 1); - outb(0xaa, io); /* Magic Seal */ - - outb(origval, io); /* in case we poked some entirely different hardware */ + parport_pc_writeb(NULL, 0x20, io); + x_devid =3D parport_pc_readb(NULL, io + 1); + parport_pc_writeb(NULL, 0x21, io); + x_devrev =3D parport_pc_readb(NULL, io + 1); + parport_pc_writeb(NULL, 0x09, io); + x_oldid =3D parport_pc_readb(NULL, io + 1); + + parport_pc_writeb(NULL, key, io); + parport_pc_writeb(NULL, key, io); /* Write Magic Sequence to EFER, + * extended function + * enable register + */ + parport_pc_writeb(NULL, 0x20, io); /* Write EFIR, extended function + * index register + */ + devid =3D parport_pc_readb(NULL, io + 1); /* Read EFDR, extended + * function data register + */ + parport_pc_writeb(NULL, 0x21, io); + devrev =3D parport_pc_readb(NULL, io + 1); + parport_pc_writeb(NULL, 0x09, io); + oldid =3D parport_pc_readb(NULL, io + 1); + parport_pc_writeb(NULL, 0xaa, io); /* Magic Seal */ + + parport_pc_writeb(NULL, origval, io); /* in case we poked some + * entirely different hardware + */ =20 if ((x_devid =3D=3D devid) && (x_devrev =3D=3D devrev) && (x_oldid =3D=3D= oldid)) goto out; /* protection against false positives */ @@ -1240,31 +1258,38 @@ static void winbond_check2(int io, int key) if (!request_region(io, 3, __func__)) return; =20 - origval[0] =3D inb(io); /* Save original values */ - origval[1] =3D inb(io + 1); - origval[2] =3D inb(io + 2); + origval[0] =3D parport_pc_readb(NULL, io); /* Save original values */ + origval[1] =3D parport_pc_readb(NULL, io + 1); + origval[2] =3D parport_pc_readb(NULL, io + 2); =20 /* First probe without the key */ - outb(0x20, io + 2); - x_devid =3D inb(io + 2); - outb(0x21, io + 1); - x_devrev =3D inb(io + 2); - outb(0x09, io + 1); - x_oldid =3D inb(io + 2); - - outb(key, io); /* Write Magic Byte to EFER, extended - function enable register */ - outb(0x20, io + 2); /* Write EFIR, extended function index register */ - devid =3D inb(io + 2); /* Read EFDR, extended function data register */ - outb(0x21, io + 1); - devrev =3D inb(io + 2); - outb(0x09, io + 1); - oldid =3D inb(io + 2); - outb(0xaa, io); /* Magic Seal */ - - outb(origval[0], io); /* in case we poked some entirely different hardwar= e */ - outb(origval[1], io + 1); - outb(origval[2], io + 2); + parport_pc_writeb(NULL, 0x20, io + 2); + x_devid =3D parport_pc_readb(NULL, io + 2); + parport_pc_writeb(NULL, 0x21, io + 1); + x_devrev =3D parport_pc_readb(NULL, io + 2); + parport_pc_writeb(NULL, 0x09, io + 1); + x_oldid =3D parport_pc_readb(NULL, io + 2); + + parport_pc_writeb(NULL, key, io); /* Write Magic Byte to EFER, extended + * function enable register + */ + parport_pc_writeb(NULL, 0x20, io + 2); /* Write EFIR, extended function + * index register + */ + devid =3D parport_pc_readb(NULL, io + 2); /* Read EFDR, extended + * function data register + */ + parport_pc_writeb(NULL, 0x21, io + 1); + devrev =3D parport_pc_readb(NULL, io + 2); + parport_pc_writeb(NULL, 0x09, io + 1); + oldid =3D parport_pc_readb(NULL, io + 2); + parport_pc_writeb(NULL, 0xaa, io); /* Magic Seal */ + + parport_pc_writeb(NULL, origval[0], io); /* in case we poked some + * entirely different hardware + */ + parport_pc_writeb(NULL, origval[1], io + 1); + parport_pc_writeb(NULL, origval[2], io + 2); =20 if (x_devid =3D=3D devid && x_devrev =3D=3D devrev && x_oldid =3D=3D oldi= d) goto out; /* protection against false positives */ @@ -1281,32 +1306,40 @@ static void smsc_check(int io, int key) if (!request_region(io, 3, __func__)) return; =20 - origval =3D inb(io); /* Save original value */ + origval =3D parport_pc_readb(NULL, io); /* Save original value */ =20 /* First probe without the key */ - outb(0x0d, io); - x_oldid =3D inb(io + 1); - outb(0x0e, io); - x_oldrev =3D inb(io + 1); - outb(0x20, io); - x_id =3D inb(io + 1); - outb(0x21, io); - x_rev =3D inb(io + 1); - - outb(key, io); - outb(key, io); /* Write Magic Sequence to EFER, extended - function enable register */ - outb(0x0d, io); /* Write EFIR, extended function index register */ - oldid =3D inb(io + 1); /* Read EFDR, extended function data register */ - outb(0x0e, io); - oldrev =3D inb(io + 1); - outb(0x20, io); - id =3D inb(io + 1); - outb(0x21, io); - rev =3D inb(io + 1); - outb(0xaa, io); /* Magic Seal */ - - outb(origval, io); /* in case we poked some entirely different hardware */ + parport_pc_writeb(NULL, 0x0d, io); + x_oldid =3D parport_pc_readb(NULL, io + 1); + parport_pc_writeb(NULL, 0x0e, io); + x_oldrev =3D parport_pc_readb(NULL, io + 1); + parport_pc_writeb(NULL, 0x20, io); + x_id =3D parport_pc_readb(NULL, io + 1); + parport_pc_writeb(NULL, 0x21, io); + x_rev =3D parport_pc_readb(NULL, io + 1); + + parport_pc_writeb(NULL, key, io); + parport_pc_writeb(NULL, key, io); /* Write Magic Sequence to EFER, + * extended function + * enable register + */ + parport_pc_writeb(NULL, 0x0d, io); /* Write EFIR, extended function + * index register + */ + oldid =3D parport_pc_readb(NULL, io + 1); /* Read EFDR, extended + * function data register + */ + parport_pc_writeb(NULL, 0x0e, io); + oldrev =3D parport_pc_readb(NULL, io + 1); + parport_pc_writeb(NULL, 0x20, io); + id =3D parport_pc_readb(NULL, io + 1); + parport_pc_writeb(NULL, 0x21, io); + rev =3D parport_pc_readb(NULL, io + 1); + parport_pc_writeb(NULL, 0xaa, io); /* Magic Seal */ + + parport_pc_writeb(NULL, origval, io); /* in case we poked some entirely + * different hardware + */ =20 if (x_id =3D=3D id && x_oldrev =3D=3D oldrev && x_oldid =3D=3D oldid && x_rev =3D=3D rev) @@ -1349,28 +1382,28 @@ static void detect_and_report_it87(void) printk(KERN_DEBUG "IT8705 Super-IO detection, now testing port 2E ...\n"= ); if (!request_muxed_region(0x2e, 2, __func__)) return; - origval =3D inb(0x2e); /* Save original value */ - outb(0x87, 0x2e); - outb(0x01, 0x2e); - outb(0x55, 0x2e); - outb(0x55, 0x2e); - outb(0x20, 0x2e); - dev =3D inb(0x2f) << 8; - outb(0x21, 0x2e); - dev |=3D inb(0x2f); + origval =3D parport_pc_readb(NULL, 0x2e); /* Save original value */ + parport_pc_writeb(NULL, 0x87, 0x2e); + parport_pc_writeb(NULL, 0x01, 0x2e); + parport_pc_writeb(NULL, 0x55, 0x2e); + parport_pc_writeb(NULL, 0x55, 0x2e); + parport_pc_writeb(NULL, 0x20, 0x2e); + dev =3D parport_pc_readb(NULL, 0x2f) << 8; + parport_pc_writeb(NULL, 0x21, 0x2e); + dev |=3D parport_pc_readb(NULL, 0x2f); if (dev =3D=3D 0x8712 || dev =3D=3D 0x8705 || dev =3D=3D 0x8715 || dev =3D=3D 0x8716 || dev =3D=3D 0x8718 || dev =3D=3D 0x8726) { pr_info("IT%04X SuperIO detected\n", dev); - outb(0x07, 0x2E); /* Parallel Port */ - outb(0x03, 0x2F); - outb(0xF0, 0x2E); /* BOOT 0x80 off */ - r =3D inb(0x2f); - outb(0xF0, 0x2E); - outb(r | 8, 0x2F); - outb(0x02, 0x2E); /* Lock */ - outb(0x02, 0x2F); + parport_pc_writeb(NULL, 0x07, 0x2E); /* Parallel Port */ + parport_pc_writeb(NULL, 0x03, 0x2F); + parport_pc_writeb(NULL, 0xF0, 0x2E); /* BOOT 0x80 off */ + r =3D parport_pc_readb(NULL, 0x2f); + parport_pc_writeb(NULL, 0xF0, 0x2E); + parport_pc_writeb(NULL, r | 8, 0x2F); + parport_pc_writeb(NULL, 0x02, 0x2E); /* Lock */ + parport_pc_writeb(NULL, 0x02, 0x2F); } else { - outb(origval, 0x2e); /* Oops, sorry to disturb */ + parport_pc_writeb(NULL, origval, 0x2e); } release_region(0x2e, 2); } @@ -1427,19 +1460,19 @@ static int parport_SPP_supported(struct parport *pb) =20 /* Do a simple read-write test to make sure the port exists. */ w =3D 0xc; - outb(w, CONTROL(pb)); + parport_pc_writeb(pb, w, CONTROL(pb)); =20 /* Is there a control register that we can read from? Some * ports don't allow reads, so read_control just returns a * software copy. Some ports _do_ allow reads, so bypass the * software copy here. In addition, some bits aren't * writable. */ - r =3D inb(CONTROL(pb)); + r =3D parport_pc_readb(pb, CONTROL(pb)); if ((r & 0xf) =3D=3D w) { w =3D 0xe; - outb(w, CONTROL(pb)); - r =3D inb(CONTROL(pb)); - outb(0xc, CONTROL(pb)); + parport_pc_writeb(pb, w, CONTROL(pb)); + r =3D parport_pc_readb(pb, CONTROL(pb)); + parport_pc_writeb(pb, 0xc, CONTROL(pb)); if ((r & 0xf) =3D=3D w) return PARPORT_MODE_PCSPP; } @@ -1499,26 +1532,26 @@ static int parport_ECR_present(struct parport *pb) unsigned char r =3D 0xc; =20 if (!priv->ecr_writable) { - outb(r, CONTROL(pb)); - if ((inb(ECONTROL(pb)) & 0x3) =3D=3D (r & 0x3)) { - outb(r ^ 0x2, CONTROL(pb)); /* Toggle bit 1 */ + parport_pc_writeb(pb, r, CONTROL(pb)); + if ((parport_pc_readb(pb, ECONTROL(pb)) & 0x3) =3D=3D (r & 0x3)) { + parport_pc_writeb(pb, r ^ 0x2, CONTROL(pb)); /* Toggle bit 1 */ =20 - r =3D inb(CONTROL(pb)); - if ((inb(ECONTROL(pb)) & 0x2) =3D=3D (r & 0x2)) + r =3D parport_pc_readb(pb, CONTROL(pb)); + if ((parport_pc_readb(pb, ECONTROL(pb)) & 0x2) =3D=3D (r & 0x2)) /* Sure that no ECR register exists */ goto no_reg; } =20 - if ((inb(ECONTROL(pb)) & 0x3) !=3D 0x1) + if ((parport_pc_readb(pb, ECONTROL(pb)) & 0x3) !=3D 0x1) goto no_reg; =20 ECR_WRITE(pb, 0x34); - if (inb(ECONTROL(pb)) !=3D 0x35) + if (parport_pc_readb(pb, ECONTROL(pb)) !=3D 0x35) goto no_reg; } =20 priv->ecr =3D 1; - outb(0xc, CONTROL(pb)); + parport_pc_writeb(pb, 0xc, CONTROL(pb)); =20 /* Go to mode 000 */ frob_set_mode(pb, ECR_SPP); @@ -1526,7 +1559,7 @@ static int parport_ECR_present(struct parport *pb) return 1; =20 no_reg: - outb(0xc, CONTROL(pb)); + parport_pc_writeb(pb, 0xc, CONTROL(pb)); return 0; } =20 @@ -1595,8 +1628,9 @@ static int parport_ECP_supported(struct parport *pb) /* Find out FIFO depth */ ECR_WRITE(pb, ECR_SPP << 5); /* Reset FIFO */ ECR_WRITE(pb, ECR_TST << 5); /* TEST FIFO */ - for (i =3D 0; i < 1024 && !(inb(ECONTROL(pb)) & 0x02); i++) - outb(0xaa, FIFO(pb)); + for (i =3D 0; i < 1024 && !(parport_pc_readb(pb, ECONTROL(pb)) + & 0x02); i++) + parport_pc_writeb(pb, 0xaa, FIFO(pb)); =20 /* * Using LGS chipset it uses ECR register, but @@ -1615,9 +1649,9 @@ static int parport_ECP_supported(struct parport *pb) frob_econtrol(pb, 1<<2, 1<<2); frob_econtrol(pb, 1<<2, 0); for (i =3D 1; i <=3D priv->fifo_depth; i++) { - inb(FIFO(pb)); + parport_pc_readb(pb, FIFO(pb)); udelay(50); - if (inb(ECONTROL(pb)) & (1<<2)) + if (parport_pc_readb(pb, ECONTROL(pb)) & (1<<2)) break; } =20 @@ -1639,8 +1673,8 @@ static int parport_ECP_supported(struct parport *pb) frob_econtrol(pb, 1<<2, 1<<2); frob_econtrol(pb, 1<<2, 0); for (i =3D 1; i <=3D priv->fifo_depth; i++) { - outb(0xaa, FIFO(pb)); - if (inb(ECONTROL(pb)) & (1<<2)) + parport_pc_writeb(pb, 0xaa, FIFO(pb)); + if (parport_pc_readb(pb, ECONTROL(pb)) & (1<<2)) break; } =20 @@ -1656,7 +1690,7 @@ static int parport_ECP_supported(struct parport *pb) =20 ECR_WRITE(pb, ECR_SPP << 5); /* Reset FIFO */ ECR_WRITE(pb, 0xf4); /* Configuration mode */ - config =3D inb(CONFIGA(pb)); + config =3D parport_pc_readb(pb, CONFIGA(pb)); pword =3D (config >> 4) & 0x7; switch (pword) { case 0: @@ -1682,7 +1716,7 @@ static int parport_ECP_supported(struct parport *pb) pr_debug("0x%lx: Interrupts are ISA-%s\n", pb->iobase, config & 0x80 ? "Level" : "Pulses"); =20 - configb =3D inb(CONFIGB(pb)); + configb =3D parport_pc_readb(pb, CONFIGB(pb)); pr_debug("0x%lx: ECP port cfgA=3D0x%02x cfgB=3D0x%02x\n", pb->iobase, config, configb); pr_debug("0x%lx: ECP settings irq=3D", pb->iobase); @@ -1712,7 +1746,7 @@ static int intel_bug_present_check_epp(struct parport= *pb) =20 if (priv->ecr) { /* store value of ECR */ - unsigned char ecr =3D inb(ECONTROL(pb)); + unsigned char ecr =3D parport_pc_readb(pb, ECONTROL(pb)); unsigned char i; for (i =3D 0x00; i < 0x80; i +=3D 0x20) { ECR_WRITE(pb, i); @@ -1753,7 +1787,7 @@ static int parport_ECPPS2_supported(struct parport *p= b) if (!priv->ecr) return 0; =20 - oecr =3D inb(ECONTROL(pb)); + oecr =3D parport_pc_readb(pb, ECONTROL(pb)); ECR_WRITE(pb, ECR_PS2 << 5); result =3D parport_PS2_supported(pb); ECR_WRITE(pb, oecr); @@ -1805,10 +1839,10 @@ static int parport_ECPEPP_supported(struct parport = *pb) if (!priv->ecr) return 0; =20 - oecr =3D inb(ECONTROL(pb)); + oecr =3D parport_pc_readb(pb, ECONTROL(pb)); /* Search for SMC style EPP+ECP mode */ ECR_WRITE(pb, 0x80); - outb(0x04, CONTROL(pb)); + parport_pc_writeb(pb, 0x04, CONTROL(pb)); result =3D parport_EPP_supported(pb); =20 ECR_WRITE(pb, oecr); @@ -1857,14 +1891,14 @@ static int parport_ECPPS2_supported(struct parport = *pb) static int programmable_irq_support(struct parport *pb) { int irq, intrLine; - unsigned char oecr =3D inb(ECONTROL(pb)); + unsigned char oecr =3D parport_pc_readb(pb, ECONTROL(pb)); static const int lookup[8] =3D { PARPORT_IRQ_NONE, 7, 9, 10, 11, 14, 15, 5 }; =20 ECR_WRITE(pb, ECR_CNF << 5); /* Configuration MODE */ =20 - intrLine =3D (inb(CONFIGB(pb)) >> 3) & 0x07; + intrLine =3D (parport_pc_readb(pb, CONFIGB(pb)) >> 3) & 0x07; irq =3D lookup[intrLine]; =20 ECR_WRITE(pb, oecr); @@ -1883,8 +1917,9 @@ static int irq_probe_ECP(struct parport *pb) ECR_WRITE(pb, ECR_TST << 5); =20 /* If Full FIFO sure that writeIntrThreshold is generated */ - for (i =3D 0; i < 1024 && !(inb(ECONTROL(pb)) & 0x02) ; i++) - outb(0xaa, FIFO(pb)); + for (i =3D 0; i < 1024 && !(parport_pc_readb(pb, ECONTROL(pb)) & 0x02); + i++) + parport_pc_writeb(pb, 0xaa, FIFO(pb)); =20 pb->irq =3D probe_irq_off(irqs); ECR_WRITE(pb, ECR_SPP << 5); @@ -1908,7 +1943,7 @@ static int irq_probe_EPP(struct parport *pb) unsigned char oecr; =20 if (pb->modes & PARPORT_MODE_PCECR) - oecr =3D inb(ECONTROL(pb)); + oecr =3D parport_pc_readb(pb, ECONTROL(pb)); =20 irqs =3D probe_irq_on(); =20 @@ -1987,12 +2022,12 @@ static int parport_irq_probe(struct parport *pb) /* Only if chipset conforms to ECP ISA Interface Standard */ static int programmable_dma_support(struct parport *p) { - unsigned char oecr =3D inb(ECONTROL(p)); + unsigned char oecr =3D parport_pc_readb(p, ECONTROL(p)); int dma; =20 frob_set_mode(p, ECR_CNF); =20 - dma =3D inb(CONFIGB(p)) & 0x07; + dma =3D parport_pc_readb(p, CONFIGB(p)) & 0x07; /* 000: Indicates jumpered 8-bit DMA if read-only. 100: Indicates jumpered 16-bit DMA if read-only. */ if ((dma & 0x03) =3D=3D 0) @@ -2067,10 +2102,25 @@ static struct parport *__parport_pc_probe_port(stru= ct parport_data data, if (!p) goto out3; =20 + p->mapbase =3D data.mapbase; + p->mapsize =3D data.mapsize; + if (p->iobase) { - base_res =3D request_region(data.iobase, 3, p->name); + base_res =3D request_region(p->iobase, 3, p->name); if (!base_res) goto out4; + p->iotype =3D PARPORT_IOPORT; + } else if (p->mapbase && p->mapsize >=3D 3) { + if (!request_mem_region(p->mapbase, p->mapsize, + "parport")) { + goto out4; + } + p->membase =3D ioremap(p->mapbase, p->mapsize); + if (!p->membase) { + release_mem_region(p->mapbase, p->mapsize); + goto out4; + } + p->iotype =3D PARPORT_IOMEM; } else { goto out4; } @@ -2087,22 +2137,35 @@ static struct parport *__parport_pc_probe_port(stru= ct parport_data data, priv->port =3D p; =20 p->dev =3D dev; + p->mapbase_hi =3D data.mapbase_hi; + p->mapsize_hi =3D data.mapsize_hi; p->iobase_hi =3D data.iobase_hi; p->modes =3D PARPORT_MODE_PCSPP | PARPORT_MODE_SAFEININT; p->private_data =3D priv; =20 if (p->iobase_hi) { - ECR_res =3D request_region(data.iobase_hi, 3, p->name); + ECR_res =3D request_region(p->iobase_hi, 3, p->name); if (ECR_res) parport_ECR_present(p); + } else if (p->mapbase_hi && (p->mapsize_hi >=3D 3)) { + if (request_mem_region(p->mapbase_hi, p->mapsize_hi, + "parport")) { + p->membase_hi =3D ioremap(p->mapbase_hi, + p->mapsize_hi); + if (!p->membase_hi) + release_mem_region(p->mapbase_hi, + p->mapsize_hi); + else + parport_ECR_present(p); + } } =20 - if (p->iobase !=3D 0x3bc) { - EPP_res =3D request_region(data.iobase + 0x3, 5, p->name); - if (EPP_res) - if (!parport_EPP_supported(p)) - parport_ECPEPP_supported(p); - } + if (p->iobase && (p->iobase !=3D 0x3bc)) + EPP_res =3D request_region(p->iobase + 0x3, 5, p->name); + + if (EPP_res || p->mapsize >=3D 8) + if (!parport_EPP_supported(p)) + parport_ECPEPP_supported(p); if (!parport_SPP_supported(p)) /* No port. */ goto out5; @@ -2113,9 +2176,12 @@ static struct parport *__parport_pc_probe_port(struc= t parport_data data, =20 p->size =3D (p->modes & PARPORT_MODE_EPP) ? 8 : 3; =20 - pr_info("%s: PC-style at 0x%lx", p->name, p->iobase); - if (p->iobase_hi && priv->ecr) - pr_cont(" (0x%lx)", p->iobase_hi); + pr_info("%s: PC-style at 0x%lx", p->name, + is_ioport(p) ? p->iobase : (unsigned long)p->mapbase); + if ((p->iobase_hi || p->membase_hi) && priv->ecr) + pr_cont(" (0x%lx)", + is_ioport(p) ? p->iobase_hi : + (unsigned long)p->mapbase_hi); if (p->irq =3D=3D PARPORT_IRQ_AUTO) { p->irq =3D PARPORT_IRQ_NONE; parport_irq_probe(p); @@ -2197,6 +2263,11 @@ do { \ if (p->iobase_hi && ECR_res) { release_region(p->iobase_hi, 3); ECR_res =3D NULL; + } else if (p->membase_hi) { + iounmap(p->membase_hi); + release_mem_region(p->mapbase_hi, + p->mapsize_hi); + p->membase_hi =3D NULL; } } =20 @@ -2206,6 +2277,8 @@ do { \ EPP_res =3D NULL; } if (p->irq !=3D PARPORT_IRQ_NONE) { + if (!is_ioport(p)) + irqflags |=3D IRQF_SHARED; if (request_irq(p->irq, parport_irq_handler, irqflags, p->name, p)) { pr_warn("%s: irq %d in use, resorting to polled operation\n", @@ -2265,7 +2338,22 @@ do { \ release_region(p->iobase_hi, 3); if (EPP_res) release_region(p->iobase + 0x3, 5); - release_region(p->iobase, 3); + if (is_ioport(p)) + release_region(p->iobase, 3); + else { + iounmap(p->membase); + release_mem_region(p->mapbase, p->mapsize); + p->membase =3D NULL; + if (p->mapbase_hi && p->mapsize_hi >=3D 3) { + if (p->membase_hi) { + iounmap(p->membase_hi); + release_mem_region(p->mapbase_hi, + p->mapsize_hi); + p->membase_hi =3D NULL; + } + } + } + out4: parport_del_port(p); out3: @@ -2314,10 +2402,16 @@ void parport_pc_unregister_port(struct parport *p) #endif if (p->irq !=3D PARPORT_IRQ_NONE) free_irq(p->irq, p); - release_region(p->iobase, 3); - if (p->size > 3) + if (is_ioport(p)) { + release_region(p->iobase, 3); + } else { + iounmap(p->membase); + release_mem_region(p->mapbase, p->mapsize); + p->membase =3D NULL; + } + if (is_ioport(p) && p->size > 3) release_region(p->iobase + 3, p->size - 3); - if (p->modes & PARPORT_MODE_ECP) + if (is_ioport(p) && (p->modes & PARPORT_MODE_ECP)) release_region(p->iobase_hi, 3); #if defined(CONFIG_PARPORT_PC_FIFO) && defined(HAS_DMA) if (priv->dma_buf) @@ -2355,7 +2449,7 @@ static int sio_ite_8872_probe(struct pci_dev *pdev, i= nt autoirq, int autodma, 0xe5000000 | inta_addr[i]); pci_write_config_dword(pdev, 0x78, 0x00000000 | inta_addr[i]); - test =3D inb(inta_addr[i]); + test =3D parport_pc_readb(NULL, inta_addr[i]); if (test !=3D 0xff) break; release_region(inta_addr[i], 32); @@ -2366,7 +2460,7 @@ static int sio_ite_8872_probe(struct pci_dev *pdev, i= nt autoirq, int autodma, return 0; } =20 - type =3D inb(inta_addr[i] + 0x18); + type =3D parport_pc_readb(NULL, inta_addr[i] + 0x18); type &=3D 0x0f; =20 switch (type) { @@ -2513,34 +2607,36 @@ static int sio_via_probe(struct pci_dev *pdev, int = autoirq, int autodma, pci_write_config_byte(pdev, via->via_pci_superio_config_reg, tmp); =20 /* Bits 1-0: Parallel Port Mode / Enable */ - outb(via->viacfg_function, VIA_CONFIG_INDEX); - tmp =3D inb(VIA_CONFIG_DATA); + parport_pc_writeb(NULL, via->viacfg_function, VIA_CONFIG_INDEX); + tmp =3D parport_pc_readb(NULL, VIA_CONFIG_DATA); /* Bit 5: EPP+ECP enable; bit 7: PS/2 bidirectional port enable */ - outb(via->viacfg_parport_control, VIA_CONFIG_INDEX); - tmp2 =3D inb(VIA_CONFIG_DATA); + parport_pc_writeb(NULL, via->viacfg_parport_control, VIA_CONFIG_INDEX); + tmp2 =3D parport_pc_readb(NULL, VIA_CONFIG_DATA); if (siofunc =3D=3D VIA_FUNCTION_PROBE) { siofunc =3D tmp & VIA_FUNCTION_PARPORT_DISABLE; ppcontrol =3D tmp2; } else { tmp &=3D ~VIA_FUNCTION_PARPORT_DISABLE; tmp |=3D siofunc; - outb(via->viacfg_function, VIA_CONFIG_INDEX); - outb(tmp, VIA_CONFIG_DATA); + parport_pc_writeb(NULL, via->viacfg_function, VIA_CONFIG_INDEX); + parport_pc_writeb(NULL, tmp, VIA_CONFIG_DATA); tmp2 &=3D ~(VIA_PARPORT_BIDIR|VIA_PARPORT_ECPEPP); tmp2 |=3D ppcontrol; - outb(via->viacfg_parport_control, VIA_CONFIG_INDEX); - outb(tmp2, VIA_CONFIG_DATA); + parport_pc_writeb(NULL, via->viacfg_parport_control, + VIA_CONFIG_INDEX); + parport_pc_writeb(NULL, tmp2, VIA_CONFIG_DATA); } =20 /* Parallel Port I/O Base Address, bits 9-2 */ - outb(via->viacfg_parport_base, VIA_CONFIG_INDEX); - port1 =3D inb(VIA_CONFIG_DATA) << 2; + parport_pc_writeb(NULL, via->viacfg_parport_base, VIA_CONFIG_INDEX); + port1 =3D parport_pc_readb(NULL, VIA_CONFIG_DATA) << 2; =20 printk(KERN_DEBUG "parport_pc: Current parallel port base: 0x%X\n", port1); if (port1 =3D=3D 0x3BC && have_epp) { - outb(via->viacfg_parport_base, VIA_CONFIG_INDEX); - outb((0x378 >> 2), VIA_CONFIG_DATA); + parport_pc_writeb(NULL, via->viacfg_parport_base, + VIA_CONFIG_INDEX); + parport_pc_writeb(NULL, (0x378 >> 2), VIA_CONFIG_DATA); printk(KERN_DEBUG "parport_pc: Parallel port base changed to 0x378\n"); port1 =3D 0x378; } @@ -3029,12 +3125,20 @@ static int parport_pc_pnp_probe(struct pnp_dev *dev, if (pnp_port_valid(dev, 0) && !(pnp_port_flags(dev, 0) & IORESOURCE_DISABLED)) { tmp_pdata.iobase =3D pnp_port_start(dev, 0); + } else if (pnp_mem_valid(dev, 0) && + !(pnp_mem_flags(dev, 0) & IORESOURCE_DISABLED)) { + tmp_pdata.mapbase =3D pnp_mem_start(dev, 0); + tmp_pdata.mapsize =3D pnp_mem_len(dev, 0); } else return -EINVAL; =20 if (pnp_port_valid(dev, 1) && !(pnp_port_flags(dev, 1) & IORESOURCE_DISABLED)) { tmp_pdata.iobase_hi =3D pnp_port_start(dev, 1); + } else if (pnp_mem_valid(dev, 1) && + !(pnp_mem_flags(dev, 1) & IORESOURCE_DISABLED)) { + tmp_pdata.mapbase_hi =3D pnp_mem_start(dev, 1); + tmp_pdata.mapsize_hi =3D pnp_mem_len(dev, 1); } else tmp_pdata.iobase_hi =3D 0; =20 diff --git a/include/linux/parport.h b/include/linux/parport.h index 308eadce42dd..fe034eb68514 100644 --- a/include/linux/parport.h +++ b/include/linux/parport.h @@ -180,19 +180,37 @@ struct ieee1284_info { struct semaphore irq; }; =20 +#define PARPORT_IOPORT 1 +#define PARPORT_IOMEM 2 + struct parport_data { + unsigned char iotype; /* io access style */ /* for ioport */ unsigned long iobase; /* base address for ioport */ unsigned long iobase_hi; /* base address (hi - ECR) */ + /* for iomem */ + resource_size_t mapbase; /* base address for iomem */ + resource_size_t mapsize; + resource_size_t mapbase_hi; /* base address (hi - ECR) */ + resource_size_t mapsize_hi; int irq; int dma; }; =20 /* A parallel port */ struct parport { + unsigned char iotype; /* io access style */ + /* for ioport */ unsigned long iobase; /* base address for ioport */ unsigned long iobase_hi; /* base address (hi - ECR) */ unsigned int size; /* IO extent */ + /* for iomem */ + resource_size_t mapbase; /* base address for iomem */ + resource_size_t mapsize; + resource_size_t mapbase_hi; /* base address for iomem */ + resource_size_t mapsize_hi; + unsigned char __iomem *membase; /* read/write[bwl] */ + unsigned char __iomem *membase_hi; /* read/write[bwl] */ const char *name; unsigned int modes; int irq; /* interrupt (or -1 for none) */ diff --git a/include/linux/parport_pc.h b/include/linux/parport_pc.h index d6c3f323caa1..b7acf35a5f91 100644 --- a/include/linux/parport_pc.h +++ b/include/linux/parport_pc.h @@ -5,16 +5,20 @@ #include =20 /* --- register definitions ------------------------------- */ - -#define ECONTROL(p) ((p)->iobase_hi + 0x2) -#define CONFIGB(p) ((p)->iobase_hi + 0x1) -#define CONFIGA(p) ((p)->iobase_hi + 0x0) -#define FIFO(p) ((p)->iobase_hi + 0x0) -#define EPPDATA(p) ((p)->iobase + 0x4) -#define EPPADDR(p) ((p)->iobase + 0x3) -#define CONTROL(p) ((p)->iobase + 0x2) -#define STATUS(p) ((p)->iobase + 0x1) -#define DATA(p) ((p)->iobase + 0x0) +#define is_ioport(p) (p =3D=3D NULL || (p)->iotype =3D=3D PARPORT_IOPORT) +#define get_base(p) (is_ioport(p) ? (p)->iobase :\ + (unsigned long)(p)->membase) +#define get_base_hi(p) (is_ioport(p) ? (p)->iobase_hi :\ + (unsigned long)(p)->membase_hi) +#define ECONTROL(p) (get_base_hi(p) + 0x2) +#define CONFIGB(p) (get_base_hi(p) + 0x1) +#define CONFIGA(p) (get_base_hi(p) + 0x0) +#define FIFO(p) (get_base_hi(p) + 0x0) +#define EPPDATA(p) (get_base(p) + 0x4) +#define EPPADDR(p) (get_base(p) + 0x3) +#define CONTROL(p) (get_base(p) + 0x2) +#define STATUS(p) (get_base(p) + 0x1) +#define DATA(p) (get_base(p) + 0x0) =20 struct parport_pc_private { /* Contents of CTR. */ @@ -63,17 +67,78 @@ struct parport_pc_via_data u8 viacfg_parport_base; }; =20 +static inline void parport_pc_writeb(struct parport *p, + unsigned char d, + unsigned long addr) +{ + is_ioport(p) ? outb(d, addr) : writeb(d, (void __iomem *)addr); +} + +static inline void parport_pc_writesb(struct parport *p, + unsigned long addr, const void *buf, + unsigned int count) +{ + is_ioport(p) ? outsb(addr, buf, count) : + writesb((void __iomem *)addr, buf, count); +} + +static inline void parport_pc_writesl(struct parport *p, + unsigned long addr, const void *buf, + unsigned int count) +{ + is_ioport(p) ? outsl(addr, buf, count) : + writesl((void __iomem *)addr, buf, count); +} + +static inline void parport_pc_writesw(struct parport *p, + unsigned long addr, const void *buf, + unsigned int count) +{ + is_ioport(p) ? outsw(addr, buf, count) : + writesw((void __iomem *)addr, buf, count); +} + +static inline unsigned char parport_pc_readb(struct parport *p, + unsigned long addr) +{ + return is_ioport(p) ? inb(addr) : readb((void __iomem *)addr); +} + +static inline void parport_pc_readsb(struct parport *p, + unsigned long addr, void *buf, + unsigned int count) +{ + is_ioport(p) ? insb(addr, buf, count) : + readsb((void __iomem *)addr, buf, count); +} + +static inline void parport_pc_readsl(struct parport *p, + unsigned long addr, void *buf, + unsigned int count) +{ + is_ioport(p) ? insl(addr, buf, count) : + readsl((void __iomem *)addr, buf, count); +} + +static inline void parport_pc_readsw(struct parport *p, + unsigned long addr, void *buf, + unsigned int count) +{ + is_ioport(p) ? insw(addr, buf, count) : + readsw((void __iomem *)addr, buf, count); +} + static __inline__ void parport_pc_write_data(struct parport *p, unsigned c= har d) { #ifdef DEBUG_PARPORT printk (KERN_DEBUG "parport_pc_write_data(%p,0x%02x)\n", p, d); #endif - outb(d, DATA(p)); + parport_pc_writeb(p, d, DATA(p)); } =20 static __inline__ unsigned char parport_pc_read_data(struct parport *p) { - unsigned char val =3D inb (DATA (p)); + unsigned char val =3D parport_pc_readb(p, DATA(p)); #ifdef DEBUG_PARPORT printk (KERN_DEBUG "parport_pc_read_data(%p) =3D 0x%02x\n", p, val); @@ -85,9 +150,9 @@ static __inline__ unsigned char parport_pc_read_data(str= uct parport *p) static inline void dump_parport_state (char *str, struct parport *p) { /* here's hoping that reading these ports won't side-effect anything unde= rneath */ - unsigned char ecr =3D inb (ECONTROL (p)); - unsigned char dcr =3D inb (CONTROL (p)); - unsigned char dsr =3D inb (STATUS (p)); + unsigned char ecr =3D parport_pc_readb(p, ECONTROL(p)); + unsigned char dcr =3D parport_pc_readb(p, CONTROL(p)); + unsigned char dsr =3D parport_pc_readb(p, STATUS(p)); static const char *const ecr_modes[] =3D {"SPP", "PS2", "PPFIFO", "ECP", = "xXx", "yYy", "TST", "CFG"}; const struct parport_pc_private *priv =3D p->physport->private_data; int i; @@ -100,7 +165,7 @@ static inline void dump_parport_state (char *str, struc= t parport *p) if (ecr & 0x01) printk (",f_empty"); for (i=3D0; i<2; i++) { printk ("] dcr(%s)=3D[", i ? "soft" : "hard"); - dcr =3D i ? priv->ctr : inb (CONTROL (p)); + dcr =3D i ? priv->ctr : parport_pc_readb(p, CONTROL(p)); =09 if (dcr & 0x20) { printk ("rev"); @@ -141,7 +206,7 @@ static __inline__ unsigned char __parport_pc_frob_contr= ol (struct parport *p, #endif ctr =3D (ctr & ~mask) ^ val; ctr &=3D priv->ctr_writable; /* only write writable bits. */ - outb (ctr, CONTROL (p)); + parport_pc_writeb(p, ctr, CONTROL(p)); priv->ctr =3D ctr; /* Update soft copy */ return ctr; } @@ -213,7 +278,7 @@ static __inline__ unsigned char parport_pc_frob_control= (struct parport *p, =20 static __inline__ unsigned char parport_pc_read_status(struct parport *p) { - return inb(STATUS(p)); + return parport_pc_readb(p, STATUS(p)); } =20 =20 --=20 2.25.1