linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ondrej Zary <linux@zary.sk>
To: Damien Le Moal <damien.lemoal@opensource.wdc.com>,
	Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: Christoph Hellwig <hch@lst.de>,
	Sergey Shtylyov <s.shtylyov@omp.ru>, Jens Axboe <axboe@kernel.dk>,
	Tim Waugh <tim@cyberelk.net>,
	linux-block@vger.kernel.org, linux-parport@lists.infradead.org,
	linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 11/32] parport_pc: add 16-bit and 8-bit fast EPP transfer flags
Date: Tue,  7 Mar 2023 23:46:06 +0100	[thread overview]
Message-ID: <20230307224627.28011-12-linux@zary.sk> (raw)
In-Reply-To: <20230307224627.28011-1-linux@zary.sk>

PARPORT_EPP_FAST flag currently uses 32-bit I/O port access for data
read/write (insl/outsl).
Add PARPORT_EPP_FAST_16 and PARPORT_EPP_FAST_8 that use insw/outsw
and insb/outsb (and PARPORT_EPP_FAST_32 as alias for PARPORT_EPP_FAST).

Signed-off-by: Ondrej Zary <linux@zary.sk>
---
 drivers/parport/parport_pc.c | 20 ++++++++++++++++----
 include/uapi/linux/parport.h |  3 +++
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 5784dc20fb38..eda4e4e6d4e8 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -298,9 +298,15 @@ static size_t parport_pc_epp_read_data(struct parport *port, void *buf,
 		}
 		return got;
 	}
-	if ((flags & PARPORT_EPP_FAST) && (length > 1)) {
-		if (!(((long)buf | length) & 0x03))
+	if ((length > 1) && ((flags & PARPORT_EPP_FAST_32)
+			   || flags & PARPORT_EPP_FAST_16
+			   || flags & PARPORT_EPP_FAST_8)) {
+		if ((flags & PARPORT_EPP_FAST_32)
+		    && !(((long)buf | length) & 0x03))
 			insl(EPPDATA(port), buf, (length >> 2));
+		else if ((flags & PARPORT_EPP_FAST_16)
+			 && !(((long)buf | length) & 0x01))
+			insw(EPPDATA(port), buf, length >> 1);
 		else
 			insb(EPPDATA(port), buf, length);
 		if (inb(STATUS(port)) & 0x01) {
@@ -327,9 +333,15 @@ static size_t parport_pc_epp_write_data(struct parport *port, const void *buf,
 {
 	size_t written = 0;
 
-	if ((flags & PARPORT_EPP_FAST) && (length > 1)) {
-		if (!(((long)buf | length) & 0x03))
+	if ((length > 1) && ((flags & PARPORT_EPP_FAST_32)
+			   || flags & PARPORT_EPP_FAST_16
+			   || flags & PARPORT_EPP_FAST_8)) {
+		if ((flags & PARPORT_EPP_FAST_32)
+		    && !(((long)buf | length) & 0x03))
 			outsl(EPPDATA(port), buf, (length >> 2));
+		else if ((flags & PARPORT_EPP_FAST_16)
+			 && !(((long)buf | length) & 0x01))
+			outsw(EPPDATA(port), buf, length >> 1);
 		else
 			outsb(EPPDATA(port), buf, length);
 		if (inb(STATUS(port)) & 0x01) {
diff --git a/include/uapi/linux/parport.h b/include/uapi/linux/parport.h
index f41388f88dc3..fe93e41fc205 100644
--- a/include/uapi/linux/parport.h
+++ b/include/uapi/linux/parport.h
@@ -90,6 +90,9 @@ typedef enum {
 /* Flags for block transfer operations. */
 #define PARPORT_EPP_FAST		(1<<0) /* Unreliable counts. */
 #define PARPORT_W91284PIC		(1<<1) /* have a Warp9 w91284pic in the device */
+#define PARPORT_EPP_FAST_32		PARPORT_EPP_FAST /* 32-bit EPP transfers */
+#define PARPORT_EPP_FAST_16		(1<<2) /* 16-bit EPP transfers */
+#define PARPORT_EPP_FAST_8		(1<<3) /* 8-bit EPP transfers */
 
 /* The rest is for the kernel only */
 #endif /* _UAPI_PARPORT_H_ */
-- 
Ondrej Zary


  parent reply	other threads:[~2023-03-07 22:47 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07 22:45 [PATCH 00/32] pata_parport-bpck6: rework bpck6 protocol driver Ondrej Zary
2023-03-07 22:45 ` [PATCH 01/32] pata_parport-bpck6: remove useless defines Ondrej Zary
2023-03-08 10:28   ` Sergei Shtylyov
2023-03-07 22:45 ` [PATCH 02/32] pata_parport-bpck6: remove useless range check from read/write_regr Ondrej Zary
2023-03-08 18:03   ` Sergey Shtylyov
2023-03-07 22:45 ` [PATCH 03/32] pata_parport-bpck6: don't cast pi->pardev to struct pardevice * Ondrej Zary
2023-03-08 18:15   ` Sergey Shtylyov
2023-03-07 22:45 ` [PATCH 04/32] pata_parport-bpck6: pass around struct pi_adapter * Ondrej Zary
2023-03-08 20:33   ` Sergey Shtylyov
2023-03-09 20:58     ` Ondrej Zary
2023-03-10 10:19       ` Sergey Shtylyov
2023-03-08 20:34   ` Sergey Shtylyov
2023-03-07 22:46 ` [PATCH 05/32] pata_parport-bpck6: remove lpt_addr from struct ppc_storage Ondrej Zary
2023-03-11 15:43   ` Sergey Shtylyov
2023-03-07 22:46 ` [PATCH 06/32] pata_parport-bpck6: remove ppc_id " Ondrej Zary
2023-03-08 20:41   ` Sergey Shtylyov
2023-03-07 22:46 ` [PATCH 07/32] pata_parport-bpck6: remove org_* " Ondrej Zary
2023-03-08 20:43   ` Sergey Shtylyov
2023-03-07 22:46 ` [PATCH 08/32] pata_parport-bpck6: remove mode " Ondrej Zary
2023-03-11 17:07   ` Sergey Shtylyov
2023-03-07 22:46 ` [PATCH 09/32] pata_parport-bpck6: remove " Ondrej Zary
2023-03-11 19:30   ` Sergey Shtylyov
2023-03-07 22:46 ` [PATCH 10/32] pata_parport-bpck6: remove parallel port bit defines Ondrej Zary
2023-03-07 22:46 ` Ondrej Zary [this message]
2023-03-11 20:09   ` [PATCH 11/32] parport_pc: add 16-bit and 8-bit fast EPP transfer flags Sergey Shtylyov
2023-03-11 20:31     ` Sergey Shtylyov
2023-03-07 22:46 ` [PATCH 12/32] pata_parport-bpck6: use parport access functions instead of port I/O Ondrej Zary
2023-03-07 22:46 ` [PATCH 13/32] pata_parport-bpck6: use parport_frob_control and remove CUR_CTRL Ondrej Zary
2023-03-07 22:46 ` [PATCH 14/32] pata_parport-bpck6: remove PPC_FLAGS Ondrej Zary
2023-03-11 20:12   ` Sergey Shtylyov
2023-03-07 22:46 ` [PATCH 15/32] pata_parport-bpck6: remove ppc6_close Ondrej Zary
2023-03-07 22:46 ` [PATCH 16/32] pata_parport-bpck6: merge ppc6_rd_port into bpck6_read_regr Ondrej Zary
2023-03-07 22:46 ` [PATCH 17/32] pata_parport-bpck6: merge ppc6_wr_port into bpck6_write_regr Ondrej Zary
2023-03-07 22:46 ` [PATCH 18/32] pata_parport-bpck6: merge ppc6_rd_port16_blk into bpck6_read_block Ondrej Zary
2023-03-07 22:46 ` [PATCH 19/32] pata_parport-bpck6: merge ppc6_wr_port16_blk into bpck6_write_block Ondrej Zary
2023-03-07 22:46 ` [PATCH 20/32] pata_parport-bpck6: merge ppc6_rd_data_blk into bpck6_read_block Ondrej Zary
2023-03-07 22:46 ` [PATCH 21/32] pata_parport-bpck6: merge ppc6_wr_data_blk into bpck6_write_block Ondrej Zary
2023-03-07 22:46 ` [PATCH 22/32] pata_parport-bpck6: move ppc6_wait_for_fifo to bpck6.c and rename Ondrej Zary
2023-03-07 22:46 ` [PATCH 23/32] pata_parport-bpck6: move ppc6_wr_extout " Ondrej Zary
2023-03-07 22:46 ` [PATCH 24/32] pata_parport-bpck6: move ppc6_open " Ondrej Zary
2023-03-07 22:46 ` [PATCH 25/32] pata_parport-bpck6: merge ppc6_select into bpck6_open Ondrej Zary
2023-03-07 22:46 ` [PATCH 26/32] pata_parport-bpck6: move ppc6_deselect to bpck6.c and rename Ondrej Zary
2023-03-07 22:46 ` [PATCH 27/32] pata_parport-bpck6: move ppc6_send_cmd " Ondrej Zary
2023-03-07 22:46 ` [PATCH 28/32] pata_parport-bpck6: move ppc6_rd_data_byte " Ondrej Zary
2023-03-07 22:46 ` [PATCH 29/32] pata_parport-bpck6: move ppc6_wr_data_byte " Ondrej Zary
2023-03-07 22:46 ` [PATCH 30/32] pata_parport-bpck6: move defines and mode_map to bpck6.c Ondrej Zary
2023-03-07 22:46 ` [PATCH 31/32] pata_parport-bpck6: delete ppc6lnx.c Ondrej Zary
2023-03-11 20:15   ` Sergey Shtylyov
2023-03-07 22:46 ` [PATCH 32/32] pata_parport-bpck6: reduce indents in bpck6_open Ondrej Zary
2023-03-11 20:00 ` [PATCH 00/32] pata_parport-bpck6: rework bpck6 protocol driver Sergey Shtylyov
2023-03-18 18:55   ` Ondrej Zary
2023-03-19 20:02     ` Sergey Shtylyov
2023-03-22 12:10       ` Ondrej Zary
2023-03-22 22:34         ` Damien Le Moal
2023-03-26  9:08         ` Sudip Mukherjee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230307224627.28011-12-linux@zary.sk \
    --to=linux@zary.sk \
    --cc=axboe@kernel.dk \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parport@lists.infradead.org \
    --cc=s.shtylyov@omp.ru \
    --cc=sudipm.mukherjee@gmail.com \
    --cc=tim@cyberelk.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).