mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: dregan@broadcom.com
Cc: dregan@mail.com, miquel.raynal@bootlin.com, richard@nod.at,
	vigneshr@ti.com, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org,
	computersforpeace@gmail.com, kdasu.kdev@gmail.com,
	linux-mtd@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, joel.peshkin@broadcom.com,
	tomer.yacoby@broadcom.com, dan.beygelman@broadcom.com,
	william.zhang@broadcom.com, anand.gore@broadcom.com,
	kursad.oney@broadcom.com, florian.fainelli@broadcom.com,
	rafal@milecki.pl, bcm-kernel-feedback-list@broadcom.com,
	andre.przywara@arm.com, baruch@tkos.co.il,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 05/10] mtd: rawnand: brcmnand: Add BCMBCA read data bus interface
Date: Fri, 19 Jan 2024 08:36:21 +0300	[thread overview]
Message-ID: <4b3f4316-0da4-4fde-a806-7b579948db50@moroto.mountain> (raw)
In-Reply-To: <20240118195356.133391-6-dregan@broadcom.com>

On Thu, Jan 18, 2024 at 11:53:51AM -0800, dregan@broadcom.com wrote:
> diff --git a/drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c b/drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c
> index 3e2f3b79788d..e97e13ae246c 100644
> --- a/drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c
> +++ b/drivers/mtd/nand/raw/brcmnand/bcmbca_nand.c
> @@ -26,6 +26,18 @@ enum {
>  	BCMBCA_CTLRDY		= BIT(4),
>  };
>  
> +#if defined(CONFIG_ARM64)
> +#define ALIGN_REQ		8
> +#else
> +#define ALIGN_REQ		4
> +#endif
> +
> +static inline bool bcmbca_nand_is_buf_aligned(void *flash_cache,  void *buffer)
> +{
> +	return IS_ALIGNED((uintptr_t)buffer, ALIGN_REQ) &&
> +				IS_ALIGNED((uintptr_t)flash_cache, ALIGN_REQ);
> +}
> +
>  static bool bcmbca_nand_intc_ack(struct brcmnand_soc *soc)
>  {
>  	struct bcmbca_nand_soc *priv =
> @@ -56,6 +68,20 @@ static void bcmbca_nand_intc_set(struct brcmnand_soc *soc, bool en)
>  	brcmnand_writel(val, mmio);
>  }
>  
> +static void bcmbca_read_data_bus(struct brcmnand_soc *soc,
> +				 void __iomem *flash_cache,  u32 *buffer, int fc_words)
> +{
> +	/*
> +	 * memcpy can do unaligned aligned access depending on source
> +	 * and dest address, which is incompatible with nand cache. Fallback
> +	 * to the memcpy for io version
> +	 */
> +	if (bcmbca_nand_is_buf_aligned((void *)flash_cache, buffer))
> +		memcpy((void *)buffer, (void *)flash_cache, fc_words * 4);
> +	else
> +		memcpy_fromio((void *)buffer, flash_cache, fc_words * 4);
> +}

This comment is confusing or maybe the if statement is reversed...
We're falling back to memcpy_fromio() for the unaligned accesses but the
comment says we're falling back to memcpy().

regards,
dan carpenter


  reply	other threads:[~2024-01-19  5:36 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-18 19:53 [PATCH v2 00/10] mtd: rawnand: brcmnand: driver and doc updates dregan
2024-01-18 19:53 ` [PATCH v2 01/10] dt-bindings: mtd: brcmnand: Updates for bcmbca SoCs dregan
2024-01-19 17:12   ` Conor Dooley
2024-01-19 18:36     ` William Zhang
2024-01-22 11:48   ` Jonas Gorski
2024-01-22 17:33     ` William Zhang
2024-01-23 10:34       ` Jonas Gorski
2024-01-23 19:24         ` William Zhang
2024-01-22 18:57   ` Rafał Miłecki
2024-01-22 23:47     ` William Zhang
2024-01-18 19:53 ` [PATCH v2 02/10] ARM: dts: broadcom: bcmbca: Add NAND controller node dregan
2024-01-18 19:53 ` [PATCH v2 03/10] arm64: " dregan
2024-01-18 19:53 ` [PATCH v2 04/10] mtd: rawnand: brcmnand: Rename bcm63138 nand driver dregan
2024-01-18 19:53 ` [PATCH v2 05/10] mtd: rawnand: brcmnand: Add BCMBCA read data bus interface dregan
2024-01-19  5:36   ` Dan Carpenter [this message]
2024-01-19 18:04     ` William Zhang
2024-01-18 19:53 ` [PATCH v2 06/10] mtd: rawnand: brcmnand: Add support for getting ecc setting from strap dregan
2024-01-18 19:53 ` [PATCH v2 07/10] mtd: rawnand: brcmnand: Support write protection setting from dts dregan
2024-01-18 19:53 ` [PATCH v2 08/10] mtd: rawnand: brcmnand: exec_op helper functions return type fixes dregan
2024-01-18 19:53 ` [PATCH v2 09/10] mtd: rawnand: brcmnand: update log level messages dregan
2024-01-18 19:53 ` [PATCH v2 10/10] mtd: rawnand: brcmnand: allow for on-die ecc dregan

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=4b3f4316-0da4-4fde-a806-7b579948db50@moroto.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=anand.gore@broadcom.com \
    --cc=andre.przywara@arm.com \
    --cc=baruch@tkos.co.il \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=computersforpeace@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=dan.beygelman@broadcom.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dregan@broadcom.com \
    --cc=dregan@mail.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=joel.peshkin@broadcom.com \
    --cc=kdasu.kdev@gmail.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kursad.oney@broadcom.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=rafal@milecki.pl \
    --cc=richard@nod.at \
    --cc=robh+dt@kernel.org \
    --cc=tomer.yacoby@broadcom.com \
    --cc=vigneshr@ti.com \
    --cc=william.zhang@broadcom.com \
    /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

all inboxes | Powered by JetHome®