mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: William Zhang <william.zhang@broadcom.com>
To: Dan Carpenter <dan.carpenter@linaro.org>, 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,
	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 10:04:46 -0800	[thread overview]
Message-ID: <61f3cc1e-66f4-86d7-659b-9ff1219b4274@broadcom.com> (raw)
In-Reply-To: <4b3f4316-0da4-4fde-a806-7b579948db50@moroto.mountain>

[-- Attachment #1: Type: text/plain, Size: 1883 bytes --]

Hi,

On 01/18/2024 09:36 PM, Dan Carpenter wrote:
> 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().
> 
Yes that's a typo. Fallback to memcpy_fromio when unalgined.  Will 
update the comments in v3. Thanks!

> regards,
> dan carpenter
> 

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4212 bytes --]

  reply	other threads:[~2024-01-19 18:04 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
2024-01-19 18:04     ` William Zhang [this message]
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=61f3cc1e-66f4-86d7-659b-9ff1219b4274@broadcom.com \
    --to=william.zhang@broadcom.com \
    --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=dan.carpenter@linaro.org \
    --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 \
    /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®