[U-Boot] [PATCH v2] ftsmc020: enhanced features and unnested structures
Macpaul Lin
macpaul at andestech.com
Thu Mar 31 15:40:55 CEST 2011
1. Enhance ftsmc020 according to datasheets.
2. Fix relocation related declaration.
Signed-off-by: Macpaul Lin <macpaul at andestech.com>
---
Changes for v2:
- Remove assembly register offsets for support lowlevel_init.S.
- The nested structure of register offsets has been rewrote.
- Fix relocation related declaration.
Note:
This patch should be applied after patch
"[U-Boot,v2,4/4] ftsmc020: move ftsmc020 static mem controller to
driver/mtd"
(/patch/87862/) is applied.
drivers/mtd/ftsmc020.c | 7 +++----
include/faraday/ftsmc020.h | 19 +++++++++++++------
2 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/drivers/mtd/ftsmc020.c b/drivers/mtd/ftsmc020.c
index b027685..ddeb3a4 100644
--- a/drivers/mtd/ftsmc020.c
+++ b/drivers/mtd/ftsmc020.c
@@ -27,12 +27,10 @@ struct ftsmc020_config {
unsigned int timing;
};
-static struct ftsmc020_config config[] = CONFIG_SYS_FTSMC020_CONFIGS;
-
-static struct ftsmc020 *smc = (struct ftsmc020 *)CONFIG_FTSMC020_BASE;
-
static void ftsmc020_setup_bank(unsigned int bank, struct ftsmc020_config *cfg)
{
+ struct ftsmc020 *smc = (struct ftsmc020 *)CONFIG_FTSMC020_BASE;
+
if (bank > 3) {
printf("bank # %u invalid\n", bank);
return;
@@ -44,6 +42,7 @@ static void ftsmc020_setup_bank(unsigned int bank, struct ftsmc020_config *cfg)
void ftsmc020_init(void)
{
+ struct ftsmc020_config config[] = CONFIG_SYS_FTSMC020_CONFIGS;
int i;
for (i = 0; i < ARRAY_SIZE(config); i++)
diff --git a/include/faraday/ftsmc020.h b/include/faraday/ftsmc020.h
index 95d9500..59c6f8e 100644
--- a/include/faraday/ftsmc020.h
+++ b/include/faraday/ftsmc020.h
@@ -25,13 +25,15 @@
#ifndef __ASSEMBLY__
+struct ftsmc020_bank {
+ unsigned int cr;
+ unsigned int tpr;
+};
+
struct ftsmc020 {
- struct {
- unsigned int cr; /* 0x00, 0x08, 0x10, 0x18 */
- unsigned int tpr; /* 0x04, 0x0c, 0x14, 0x1c */
- } bank[4];
- unsigned int pad[8]; /* 0x20 - 0x3c */
- unsigned int ssr; /* 0x40 */
+ struct ftsmc020_bank bank[4]; /* 0x00 - 0x1c */
+ unsigned int pad[8]; /* 0x20 - 0x3c */
+ unsigned int ssr; /* 0x40 */
};
void ftsmc020_init(void);
@@ -46,6 +48,10 @@ void ftsmc020_init(void);
#define FTSMC020_BANK_WPROT (1 << 11)
+#define FTSMC020_BANK_TYPE1 (1 << 10)
+#define FTSMC020_BANK_TYPE2 (1 << 9)
+#define FTSMC020_BANK_TYPE3 (1 << 8)
+
#define FTSMC020_BANK_SIZE_32K (0xb << 4)
#define FTSMC020_BANK_SIZE_64K (0xc << 4)
#define FTSMC020_BANK_SIZE_128K (0xd << 4)
@@ -57,6 +63,7 @@ void ftsmc020_init(void);
#define FTSMC020_BANK_SIZE_8M (0x3 << 4)
#define FTSMC020_BANK_SIZE_16M (0x4 << 4)
#define FTSMC020_BANK_SIZE_32M (0x5 << 4)
+#define FTSMC020_BANK_SIZE_64M (0x6 << 4)
#define FTSMC020_BANK_MBW_8 (0x0 << 0)
#define FTSMC020_BANK_MBW_16 (0x1 << 0)
--
1.7.3.5
More information about the U-Boot
mailing list