From patchwork Thu Mar 31 13:40:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Macpaul Lin X-Patchwork-Id: 89078 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 5B467B6F7B for ; Fri, 1 Apr 2011 00:43:32 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8DA5C28096; Thu, 31 Mar 2011 15:43:28 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id NBHgTQDOoKDu; Thu, 31 Mar 2011 15:43:28 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D31C02808F; Thu, 31 Mar 2011 15:43:25 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 757C42808F for ; Thu, 31 Mar 2011 15:43:23 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5lggN5bZplEz for ; Thu, 31 Mar 2011 15:43:22 +0200 (CEST) X-Greylist: delayed 446 seconds by postgrey-1.27 at theia; Thu, 31 Mar 2011 15:43:20 CEST X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from clanlab.dyndns.org (unknown [140.119.175.157]) by theia.denx.de (Postfix) with ESMTPS id 067342808D for ; Thu, 31 Mar 2011 15:43:20 +0200 (CEST) Received: by clanlab.dyndns.org (Postfix, from userid 1000) id 3516D38B4637; Thu, 31 Mar 2011 21:40:57 +0800 (CST) From: Macpaul Lin To: u-boot@lists.denx.de, ratbert@faraday-tech.com Date: Thu, 31 Mar 2011 21:40:55 +0800 Message-Id: <1301578855-15613-1-git-send-email-macpaul@andestech.com> X-Mailer: git-send-email 1.7.1 Cc: Macpaul Lin Subject: [U-Boot] [PATCH v2] ftsmc020: enhanced features and unnested structures X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 1. Enhance ftsmc020 according to datasheets. 2. Fix relocation related declaration. Signed-off-by: Macpaul Lin --- 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)