From: Oleksij Rempel <linux@rempel-privat.de>
To: barebox@lists.infradead.org
Cc: Oleksij Rempel <bug-track@fisher-privat.net>
Subject: [PATCH 1/3] cfi_flash: add shift option for some cfi memory chips
Date: Mon, 22 Apr 2013 10:53:50 +0200 [thread overview]
Message-ID: <1366620830-8574-1-git-send-email-linux@rempel-privat.de> (raw)
From: Oleksij Rempel <bug-track@fisher-privat.net>
Many cfi chips support 16 and 8 bit modes. Most important
difference is use of so called "Q15/A-1" pin. In 16bit mode this
pin is used for data IO. In 8bit mode, it is an address input
which add one more least significant bit (LSB). In this case
we should shift all adresses by one:
For example 0xaa << 1 = 0x154
---
drivers/nor/Kconfig | 8 ++++++++
drivers/nor/cfi_flash.h | 4 ++++
2 files changed, 12 insertions(+)
diff --git a/drivers/nor/Kconfig b/drivers/nor/Kconfig
index c8ce24f..b556b0c 100644
--- a/drivers/nor/Kconfig
+++ b/drivers/nor/Kconfig
@@ -50,6 +50,14 @@ config DRIVER_CFI_BANK_WIDTH_8
If you wish to support CFI devices on a physical bus which is
64 bits wide, say 'Y'.
+config DRIVER_CFI_BANK_SHIFT_1
+ bool "Shift addressspace of flash at one bit"
+ depends on DRIVER_CFI
+ default n
+ help
+ If you have flash with enabled LSB bit, then you
+ wont to enable this function.
+
config CFI_BUFFER_WRITE
bool "use cfi driver with buffer write"
depends on DRIVER_CFI || DRIVER_CFI
diff --git a/drivers/nor/cfi_flash.h b/drivers/nor/cfi_flash.h
index 8f818ba..6c7cac4 100644
--- a/drivers/nor/cfi_flash.h
+++ b/drivers/nor/cfi_flash.h
@@ -295,7 +295,11 @@ static inline u64 flash_read64(void *addr)
*/
static inline uchar *flash_make_addr (struct flash_info *info, flash_sect_t sect, uint offset)
{
+#ifdef CONFIG_DRIVER_CFI_BANK_SHIFT_1
+ return ((uchar *) (info->start[sect] + (offset * info->portwidth << 1)));
+#else
return ((uchar *) (info->start[sect] + (offset * info->portwidth)));
+#endif
}
uchar flash_read_uchar (struct flash_info *info, uint offset);
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2013-04-22 8:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-22 8:53 Oleksij Rempel [this message]
2013-04-22 16:10 ` Sascha Hauer
2013-04-22 16:18 ` Re[2]: " Alexander Shiyan
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=1366620830-8574-1-git-send-email-linux@rempel-privat.de \
--to=linux@rempel-privat.de \
--cc=barebox@lists.infradead.org \
--cc=bug-track@fisher-privat.net \
/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