From patchwork Thu Mar 31 11:18:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Macpaul Lin X-Patchwork-Id: 89071 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 6BD80B6F7B for ; Thu, 31 Mar 2011 22:18:47 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AD2E52808F; Thu, 31 Mar 2011 13:18:45 +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 WiodwwzDySlH; Thu, 31 Mar 2011 13:18:45 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6504428090; Thu, 31 Mar 2011 13:18:43 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 167BD28090 for ; Thu, 31 Mar 2011 13:18:41 +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 e2UtzRfZ8z+u for ; Thu, 31 Mar 2011 13:18:39 +0200 (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 atcpcs01.andestech.com (unknown [118.99.208.106]) by theia.denx.de (Postfix) with ESMTP id 0536E2808F for ; Thu, 31 Mar 2011 13:18:36 +0200 (CEST) Thread-Index: AcvvlV53UjIs2pMKSLyu23TfNKVFVw== Received: from ATCPCS06.andestech.com ([10.0.1.236]) by atcpcs01.andestech.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 31 Mar 2011 19:18:32 +0800 Received: from app01.andestech.com ([10.0.4.31]) by ATCPCS06.andestech.com with Microsoft SMTPSVC(6.0.3790.4675); Thu, 31 Mar 2011 19:18:31 +0800 From: "Macpaul Lin" To: , , , Date: Thu, 31 Mar 2011 19:18:27 +0800 Message-ID: <1301570307-13852-1-git-send-email-macpaul@andestech.com> X-Mailer: git-send-email 1.7.3.5 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4721 Content-class: urn:content-classes:message Importance: normal Priority: normal X-OriginalArrivalTime: 31 Mar 2011 11:18:31.0976 (UTC) FILETIME=[5E330A80:01CBEF95] 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)