[U-Boot] [PATCH v2] ftsmc020: enhanced features and unnested structures

1. Enhance ftsmc020 according to datasheets. 2. Fix relocation related declaration.
Signed-off-by: Macpaul Lin macpaul@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)

Dear "Macpaul Lin",
In message 1301570307-13852-1-git-send-email-macpaul@andestech.com you wrote:
- Enhance ftsmc020 according to datasheets.
- Fix relocation related declaration.
Signed-off-by: Macpaul Lin macpaul@andestech.com
...
CONFIDENTIALITY NOTICE:
This e-mail (and its attachments) may contain confidential and legally privileged information or information protected from disclosure. If you
...
Message ignored as instructed.
Best regards,
Wolfgang Denk

Avoid relocation problem by fix global declaration.
Signed-off-by: Macpaul Lin macpaul@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. Changes for v3: - Split this patch into 3 different patches according to Wolfgang's suggestion - Fix gloable declarations to avoid problem in relocation. - Un-nested the register structure. - Add missing definitions in header according to datasheet.
drivers/mtd/ftsmc020.c | 7 +++---- 1 files changed, 3 insertions(+), 4 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++)

Dear Macpaul Lin,
In message 1304324251-15293-1-git-send-email-macpaul@andestech.com you wrote:
Avoid relocation problem by fix global declaration.
Signed-off-by: Macpaul Lin macpaul@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.
Changes for v3:
- Split this patch into 3 different patches according to Wolfgang's suggestion
- Fix gloable declarations to avoid problem in relocation.
- Un-nested the register structure.
- Add missing definitions in header according to datasheet.
drivers/mtd/ftsmc020.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

Un-nestted the register structure in ftsmc020.h
Signed-off-by: Macpaul Lin macpaul@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. Changes for v3: - Split this patch into 3 different patches according to Wolfgang's suggestion - Fix gloable declarations to avoid problem in relocation. - Un-nested the register structure. - Add missing definitions in header according to datasheet.
include/faraday/ftsmc020.h | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/include/faraday/ftsmc020.h b/include/faraday/ftsmc020.h index a0c8689..0a3d5a2 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);

Dear Macpaul Lin,
In message 1304324251-15293-2-git-send-email-macpaul@andestech.com you wrote:
Un-nestted the register structure in ftsmc020.h
Signed-off-by: Macpaul Lin macpaul@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.
Changes for v3:
- Split this patch into 3 different patches according to Wolfgang's suggestion
- Fix gloable declarations to avoid problem in relocation.
- Un-nested the register structure.
- Add missing definitions in header according to datasheet.
include/faraday/ftsmc020.h | 14 ++++++++------ 1 files changed, 8 insertions(+), 6 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

Add missing definitions in header file according to datasheet.
Signed-off-by: Macpaul Lin macpaul@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. Changes for v3: - Split this patch into 3 different patches according to Wolfgang's suggestion - Fix gloable declarations to avoid problem in relocation. - Un-nested the register structure. - Add missing definitions in header according to datasheet.
include/faraday/ftsmc020.h | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/include/faraday/ftsmc020.h b/include/faraday/ftsmc020.h index 0a3d5a2..d381938 100644 --- a/include/faraday/ftsmc020.h +++ b/include/faraday/ftsmc020.h @@ -48,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) @@ -59,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)

Dear Macpaul Lin,
In message 1304324251-15293-3-git-send-email-macpaul@andestech.com you wrote:
Add missing definitions in header file according to datasheet.
Signed-off-by: Macpaul Lin macpaul@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.
Changes for v3:
- Split this patch into 3 different patches according to Wolfgang's suggestion
- Fix gloable declarations to avoid problem in relocation.
- Un-nested the register structure.
- Add missing definitions in header according to datasheet.
include/faraday/ftsmc020.h | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
participants (2)
-
Macpaul Lin
-
Wolfgang Denk