All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Jonker <jbx6244@gmail.com>
To: kever.yang@rock-chips.com
Cc: sjg@chromium.org, philipp.tomsich@vrull.eu,
	dario.binacchi@amarulasolutions.com,
	michael@amarulasolutions.com, marex@denx.de,
	u-boot@lists.denx.de
Subject: [PATCH v5 4/8] rockchip: block: blk-uclass: add bounce buffer flag to blk_desc
Date: Wed, 18 Oct 2023 16:01:10 +0200	[thread overview]
Message-ID: <ee332375-8812-8e12-da1c-9973d10a41af@gmail.com> (raw)
In-Reply-To: <7fd0d9d1-2e93-a48b-edfd-6d4fec314a60@gmail.com>

Currently bounce buffer support is enabled for all block devices
when available. Add a flag to blk_desc to enable only on demand.

Signed-off-by: Johan Jonker <jbx6244@gmail.com>
---

Changed V5:
  New patch
---
 drivers/block/blk-uclass.c | 4 ++--
 drivers/scsi/scsi.c        | 4 ++++
 include/blk.h              | 1 +
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c
index 30ad5bbb0024..77066da352a3 100644
--- a/drivers/block/blk-uclass.c
+++ b/drivers/block/blk-uclass.c
@@ -441,7 +441,7 @@ long blk_read(struct udevice *dev, lbaint_t start, lbaint_t blkcnt, void *buf)
 			  start, blkcnt, desc->blksz, buf))
 		return blkcnt;

-	if (IS_ENABLED(CONFIG_BOUNCE_BUFFER)) {
+	if (IS_ENABLED(CONFIG_BOUNCE_BUFFER) && desc->bb) {
 		struct blk_bounce_buffer bbstate = { .dev = dev };
 		int ret;

@@ -478,7 +478,7 @@ long blk_write(struct udevice *dev, lbaint_t start, lbaint_t blkcnt,

 	blkcache_invalidate(desc->uclass_id, desc->devnum);

-	if (IS_ENABLED(CONFIG_BOUNCE_BUFFER)) {
+	if (IS_ENABLED(CONFIG_BOUNCE_BUFFER) && desc->bb) {
 		struct blk_bounce_buffer bbstate = { .dev = dev };
 		int ret;

diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 7411660d465e..779a34bd2f1c 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -459,6 +459,9 @@ static void scsi_init_dev_desc_priv(struct blk_desc *dev_desc)
 	dev_desc->product[0] = 0;
 	dev_desc->revision[0] = 0;
 	dev_desc->removable = false;
+#if IS_ENABLED(CONFIG_BOUNCE_BUFFER)
+	dev_desc->bb = true;
+#endif	/* CONFIG_BOUNCE_BUFFER */
 }

 #if !defined(CONFIG_DM_SCSI)
@@ -606,6 +609,7 @@ static int do_scsi_scan_one(struct udevice *dev, int id, int lun, bool verbose)
 	bdesc->lun = lun;
 	bdesc->removable = bd.removable;
 	bdesc->type = bd.type;
+	bdesc->bb = bd.bb;
 	memcpy(&bdesc->vendor, &bd.vendor, sizeof(bd.vendor));
 	memcpy(&bdesc->product, &bd.product, sizeof(bd.product));
 	memcpy(&bdesc->revision, &bd.revision,	sizeof(bd.revision));
diff --git a/include/blk.h b/include/blk.h
index 76bd5baf9959..7c7cf7f2b102 100644
--- a/include/blk.h
+++ b/include/blk.h
@@ -68,6 +68,7 @@ struct blk_desc {
 	/* device can use 48bit addr (ATA/ATAPI v7) */
 	bool	lba48;
 	unsigned char	atapi;		/* Use ATAPI protocol */
+	unsigned char	bb;		/* Use bounce buffer */
 	lbaint_t	lba;		/* number of blocks */
 	unsigned long	blksz;		/* block size */
 	int		log2blksz;	/* for convenience: log2(blksz) */
--
2.39.2


  parent reply	other threads:[~2023-10-18 14:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-18 13:58 [PATCH v5 0/8] Add rkmtd command Johan Jonker
2023-10-18 14:00 ` [PATCH v5 1/8] mtd: nand: raw: rockchip_nfc: add NAND_SKIP_BBTSCAN option Johan Jonker
2023-10-18 14:00 ` [PATCH v5 2/8] rockchip: dm: prepare rkmtd UCLASS Johan Jonker
2023-10-18 16:09   ` Simon Glass
2023-10-18 14:00 ` [PATCH v5 3/8] rockchip: block: add rkmtd class and drivers Johan Jonker
2023-10-18 14:01 ` Johan Jonker [this message]
2023-10-18 16:10   ` [PATCH v5 4/8] rockchip: block: blk-uclass: add bounce buffer flag to blk_desc Simon Glass
2023-10-23  8:22   ` Kever Yang
2023-10-18 14:01 ` [PATCH v5 5/8] rockchip: cmd: add rkmtd command Johan Jonker
2023-10-18 14:01 ` [PATCH v5 6/8] rockchip: test: dm: add rkmtd test Johan Jonker
2023-10-18 14:02 ` [PATCH v5 7/8] rockchip: doc: add rkmtd.rst Johan Jonker
2023-10-18 14:02 ` [PATCH v5 8/8] rockchip: configs: sandbox: enable rkmtd command Johan Jonker

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=ee332375-8812-8e12-da1c-9973d10a41af@gmail.com \
    --to=jbx6244@gmail.com \
    --cc=dario.binacchi@amarulasolutions.com \
    --cc=kever.yang@rock-chips.com \
    --cc=marex@denx.de \
    --cc=michael@amarulasolutions.com \
    --cc=philipp.tomsich@vrull.eu \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.