linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Crispin <john@phrozen.org>
To: Sebastien Decourriere <sebtx452@gmail.com>,
	linux-mtd@lists.infradead.org
Cc: linux-mips@linux-mips.org
Subject: Re: [PATCH] mtd: maps: lantiq-flash: Check if the EBU endianness swap is enabled
Date: Wed, 18 Jan 2017 13:38:58 +0100	[thread overview]
Message-ID: <e5bb2245-a0d0-5b66-2c75-9af26c6ea846@phrozen.org> (raw)
In-Reply-To: <1484741452-27141-1-git-send-email-sebtx452@gmail.com>

Hi Sebastien,

thanks, comments inline

On 18/01/2017 13:10, Sebastien Decourriere wrote:
> The purpose of this patch is to enable the software address endianness
> swapping only when the in SoC EBU endianness swapping is disabled.
> To perform this check, I look at Bit 30 of the EBU_CON_0 register.
> Actually, the driver expects that the in SoC swapping is disabled.
> This is the case with current bootloaders shuch as U-boot. But,
> 
> I have a router which uses a proprietary bootloader which keeps
> the in SoC swapping enabled. The SoC in this router is a vrx200 v1.2.
> In this SoC version, I can keep the in SoC swapping without any problem.
> 
> Signed-off-by: Sebastien Decourriere <sebtx452@gmail.com>
> ---
>  drivers/mtd/maps/lantiq-flash.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mtd/maps/lantiq-flash.c b/drivers/mtd/maps/lantiq-flash.c
> index c8febb3..a091efa 100644
> --- a/drivers/mtd/maps/lantiq-flash.c
> +++ b/drivers/mtd/maps/lantiq-flash.c
> @@ -151,6 +151,11 @@ ltq_mtd_probe(struct platform_device *pdev)
>  	ltq_mtd->map->copy_to = ltq_copy_to;
>  
>  	ltq_mtd->map->map_priv_1 = LTQ_NOR_PROBING;

this line should be dropped

> +	/* We swap the addresses only if the EBU endianness swap is disabled */
> +	if (ltq_ebu_r32(LTQ_EBU_BUSCON0) & BIT(30))

add a define for BIT(30) please and we should really check if this a
v1.2 or newer. if my memory is correct this was a silicon bug inside
v1.0 and v1.1

	John

> +		ltq_mtd->map[i].map_priv_1 = LTQ_NOR_NORMAL;
> +	else
> +		ltq_mtd->map[i].map_priv_1 = LTQ_NOR_PROBING;
>  	ltq_mtd->mtd = do_map_probe("cfi_probe", ltq_mtd->map);
>  	ltq_mtd->map->map_priv_1 = LTQ_NOR_NORMAL;
>  
> @@ -163,8 +168,11 @@ ltq_mtd_probe(struct platform_device *pdev)
>  	mtd_set_of_node(ltq_mtd->mtd, pdev->dev.of_node);
>  
>  	cfi = ltq_mtd->map->fldrv_priv;
> -	cfi->addr_unlock1 ^= 1;
> -	cfi->addr_unlock2 ^= 1;
> +	/* We swap the addresses only if the EBU endianness swap is disabled */
> +	if (!(ltq_ebu_r32(LTQ_EBU_BUSCON0) & BIT(30))) {
> +		cfi->addr_unlock1 ^= 1;
> +		cfi->addr_unlock2 ^= 1;
> +	}
>  
>  	err = mtd_device_register(ltq_mtd->mtd, NULL, 0);
>  	if (err) {
> 

  reply	other threads:[~2017-01-18 12:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-18 12:10 [PATCH] mtd: maps: lantiq-flash: Check if the EBU endianness swap is enabled Sebastien Decourriere
2017-01-18 12:38 ` John Crispin [this message]
2017-01-18 13:48   ` Seb
2017-01-18 13:51     ` John Crispin
2017-01-18 17:12       ` Seb
2017-01-19 10:06 Sebastien Decourriere
2017-01-19 23:50 ` Langer, Thomas
2017-01-20  9:33 Sebastien Decourriere
2017-01-24 17:03 ` Ralf Baechle
2017-01-24 21:32 ` Hauke Mehrtens
2017-01-25  9:04   ` Seb
2017-01-25 16:58     ` Langer, Thomas
2017-01-26 11:02       ` Seb
2017-01-26 16:01         ` Langer, Thomas

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=e5bb2245-a0d0-5b66-2c75-9af26c6ea846@phrozen.org \
    --to=john@phrozen.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=sebtx452@gmail.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;
as well as URLs for NNTP newsgroup(s).