From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] CFI: synchronize command offsets with Linux CFI driver
Date: Tue, 11 Dec 2007 15:11:49 +0100 [thread overview]
Message-ID: <200712111511.49605.sr@denx.de> (raw)
In-Reply-To: <20071211125955.GB27980@frozen.semihalf.com>
On Tuesday 11 December 2007, Bartlomiej Sieka wrote:
> Fixes non-working CFI Flash on the Inka4x0 board.
>
> Signed-off-by: Bartlomiej Sieka <tur@semihalf.com>
> ---
> This patch differs from what is being done by the Linux CFI driver in that
> it uses 0x05 as the interface code for x16/x32 chips, per "Common Flash
> Memory Interface Publication 100" dated December 1.
>
> Tested on the following Flash chips:
> x8 (interface 0x00) in 8 bit mode
> x8/x16 (interface 0x02) in 8 bit mode
> x8/x16 (interface 0x02) in 16 bit mode
>
> The patch should be applied on top of commit
> 81b20ccc2d795ae9a1199db5a50ad9c28d1e4d22 in the u-boot-cfi-flash repo.
>
> diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
> index 66754cd..b748a9f 100644
> --- a/drivers/mtd/cfi_flash.c
> +++ b/drivers/mtd/cfi_flash.c
> @@ -1231,9 +1231,26 @@ static int flash_detect_cfi (flash_info_t * info)
> debug ("port %d bits chip %d bits\n",
> info->portwidth << CFI_FLASH_SHIFT_WIDTH,
> info->chipwidth << CFI_FLASH_SHIFT_WIDTH);
> - /* this probably only works if info->interface == FLASH_CFI_X8X16 */
> - info->addr_unlock1 = (info->portwidth == FLASH_CFI_8BIT) ? 0xAAA :
> 0x555; - info->addr_unlock2 = (info->portwidth == FLASH_CFI_8BIT) ?
> 0x555 : 0x2AA; +
> + /* calculate command offsets as in the Linux driver */
> + info->addr_unlock1 = 0x555;
> + info->addr_unlock2 = 0x2aa;
> +
> + /*
> + * modify the unlock address if we are
> + * in compatibility mode
> + */
> + if ( /* x8/x16 in x8 mode */
> + ((info->chipwidth == FLASH_CFI_BY8) &&
> + (info->interface == FLASH_CFI_X8X16)) ||
> + /* x16/x32 in x16 mode */
> + ((info->chipwidth == FLASH_CFI_BY16) &&
> + (info->interface == FLASH_CFI_X16X32)))
> + {
> + info->addr_unlock1 = 0xaaa;
> + info->addr_unlock2 = 0x555;
> + }
> +
Why not like this:
if (((info->chipwidth == FLASH_CFI_BY8) &&
(info->interface == FLASH_CFI_X8X16)) ||
((info->chipwidth == FLASH_CFI_BY16) &&
(info->interface == FLASH_CFI_X16X32))) {
/*
* Compatibility mode:
* x8/x16 in x8 mode or
* x16/x32 in x16 mode
*/
info->addr_unlock1 = 0xaaa;
info->addr_unlock2 = 0x555;
} else {
/* default */
info->addr_unlock1 = 0x555;
info->addr_unlock2 = 0x2aa;
}
Thanks.
Best regards,
Stefan
=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================
next prev parent reply other threads:[~2007-12-11 14:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-11 12:59 [U-Boot-Users] [PATCH] CFI: synchronize command offsets with Linux CFI driver Bartlomiej Sieka
2007-12-11 14:11 ` Stefan Roese [this message]
2007-12-11 14:25 ` Bartlomiej Sieka
2007-12-11 14:37 ` Stefan Roese
2007-12-21 7:58 ` Hoi-Ho Chan
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=200712111511.49605.sr@denx.de \
--to=sr@denx.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox