]> git.sur5r.net Git - u-boot/commitdiff
ftsmc020: move ftsmc020 static mem controller to driver/mtd
authorMacpaul Lin <macpaul@andestech.com>
Fri, 15 Apr 2011 21:37:11 +0000 (21:37 +0000)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Wed, 27 Apr 2011 17:38:10 +0000 (19:38 +0200)
Move the header file and definitions of ftsmc020
static memory control unit from a320 SoC folder to
"drivers/mtd" folder.

This change will let other SoC which also use ftsmc020
could share the same header file.

Signed-off-by: Macpaul Lin <macpaul@andestech.com>
arch/arm/cpu/arm920t/a320/Makefile
arch/arm/cpu/arm920t/a320/ftsmc020.c [deleted file]
arch/arm/include/asm/arch-a320/ftsmc020.h [deleted file]
board/faraday/a320evb/a320evb.c
drivers/mtd/Makefile
drivers/mtd/ftsmc020.c [new file with mode: 0644]
include/configs/a320evb.h
include/faraday/ftsmc020.h [new file with mode: 0644]

index 31da706e593644f8c5a2e25e9d6e81a0bb955c13..50eb26566593e80a8a08ad2ad0ecf00a22208e82 100644 (file)
@@ -27,7 +27,6 @@ LIB   = $(obj)lib$(SOC).o
 
 SOBJS  += reset.o
 COBJS  += timer.o
-COBJS  += ftsmc020.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))
diff --git a/arch/arm/cpu/arm920t/a320/ftsmc020.c b/arch/arm/cpu/arm920t/a320/ftsmc020.c
deleted file mode 100644 (file)
index 7646537..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * (C) Copyright 2009 Faraday Technology
- * Po-Yu Chuang <ratbert@faraday-tech.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <config.h>
-#include <common.h>
-#include <asm/io.h>
-#include <asm/arch/ftsmc020.h>
-
-struct ftsmc020_config {
-       unsigned int    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)
-{
-       if (bank > 3) {
-               printf("bank # %u invalid\n", bank);
-               return;
-       }
-
-       writel(cfg->config, &smc->bank[bank].cr);
-       writel(cfg->timing, &smc->bank[bank].tpr);
-}
-
-void ftsmc020_init(void)
-{
-       int i;
-
-       for (i = 0; i < ARRAY_SIZE(config); i++)
-               ftsmc020_setup_bank(i, &config[i]);
-}
diff --git a/arch/arm/include/asm/arch-a320/ftsmc020.h b/arch/arm/include/asm/arch-a320/ftsmc020.h
deleted file mode 100644 (file)
index 95d9500..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * (C) Copyright 2009 Faraday Technology
- * Po-Yu Chuang <ratbert@faraday-tech.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/*
- * Static Memory Controller
- */
-#ifndef __FTSMC020_H
-#define __FTSMC020_H
-
-#ifndef __ASSEMBLY__
-
-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 */
-};
-
-void ftsmc020_init(void);
-
-#endif /* __ASSEMBLY__ */
-
-/*
- * Memory Bank Configuration Register
- */
-#define FTSMC020_BANK_ENABLE   (1 << 28)
-#define FTSMC020_BANK_BASE(x)  ((x) & 0x0fff1000)
-
-#define FTSMC020_BANK_WPROT    (1 << 11)
-
-#define FTSMC020_BANK_SIZE_32K (0xb << 4)
-#define FTSMC020_BANK_SIZE_64K (0xc << 4)
-#define FTSMC020_BANK_SIZE_128K        (0xd << 4)
-#define FTSMC020_BANK_SIZE_256K        (0xe << 4)
-#define FTSMC020_BANK_SIZE_512K        (0xf << 4)
-#define FTSMC020_BANK_SIZE_1M  (0x0 << 4)
-#define FTSMC020_BANK_SIZE_2M  (0x1 << 4)
-#define FTSMC020_BANK_SIZE_4M  (0x2 << 4)
-#define FTSMC020_BANK_SIZE_8M  (0x3 << 4)
-#define FTSMC020_BANK_SIZE_16M (0x4 << 4)
-#define FTSMC020_BANK_SIZE_32M (0x5 << 4)
-
-#define FTSMC020_BANK_MBW_8    (0x0 << 0)
-#define FTSMC020_BANK_MBW_16   (0x1 << 0)
-#define FTSMC020_BANK_MBW_32   (0x2 << 0)
-
-/*
- * Memory Bank Timing Parameter Register
- */
-#define FTSMC020_TPR_ETRNA(x)  (((x) & 0xf) << 28)
-#define FTSMC020_TPR_EATI(x)   (((x) & 0xf) << 24)
-#define FTSMC020_TPR_RBE       (1 << 20)
-#define FTSMC020_TPR_AST(x)    (((x) & 0x3) << 18)
-#define FTSMC020_TPR_CTW(x)    (((x) & 0x3) << 16)
-#define FTSMC020_TPR_ATI(x)    (((x) & 0xf) << 12)
-#define FTSMC020_TPR_AT2(x)    (((x) & 0x3) << 8)
-#define FTSMC020_TPR_WTC(x)    (((x) & 0x3) << 6)
-#define FTSMC020_TPR_AHT(x)    (((x) & 0x3) << 4)
-#define FTSMC020_TPR_TRNA(x)   (((x) & 0xf) << 0)
-
-#endif /* __FTSMC020_H */
index b9343e42da67f2d9c6b475294869cfffe08cec83..2578be4f92c469e6eef4ee5f86ed48580244c908 100644 (file)
@@ -21,7 +21,7 @@
 #include <netdev.h>
 #include <asm/io.h>
 
-#include <asm/arch/ftsmc020.h>
+#include <faraday/ftsmc020.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index 999431c3c0df590c7b4dfa6318bdd6b49ffffe88..5a5ecdfe3c691cb5c9d5248cc7608c136cb540d3 100644 (file)
@@ -32,6 +32,7 @@ COBJS-$(CONFIG_HAS_DATAFLASH) += at45.o
 COBJS-$(CONFIG_FLASH_CFI_DRIVER) += cfi_flash.o
 COBJS-$(CONFIG_FLASH_CFI_MTD) += cfi_mtd.o
 COBJS-$(CONFIG_HAS_DATAFLASH) += dataflash.o
+COBJS-$(CONFIG_FTSMC020) += ftsmc020.o
 COBJS-$(CONFIG_FLASH_CFI_LEGACY) += jedec_flash.o
 COBJS-$(CONFIG_MW_EEPROM) += mw_eeprom.o
 COBJS-$(CONFIG_SPEARSMI) += spr_smi.o
diff --git a/drivers/mtd/ftsmc020.c b/drivers/mtd/ftsmc020.c
new file mode 100644 (file)
index 0000000..b027685
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * (C) Copyright 2009 Faraday Technology
+ * Po-Yu Chuang <ratbert@faraday-tech.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <config.h>
+#include <common.h>
+#include <asm/io.h>
+#include <faraday/ftsmc020.h>
+
+struct ftsmc020_config {
+       unsigned int    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)
+{
+       if (bank > 3) {
+               printf("bank # %u invalid\n", bank);
+               return;
+       }
+
+       writel(cfg->config, &smc->bank[bank].cr);
+       writel(cfg->timing, &smc->bank[bank].tpr);
+}
+
+void ftsmc020_init(void)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(config); i++)
+               ftsmc020_setup_bank(i, &config[i]);
+}
index 5373bcb57097b5f6937cc79a366bf7717b68e32e..4b297f0239dd2787cbdb132d475ceaf5c2e5eb38 100644 (file)
  * Static memory controller configuration
  */
 
-#include <asm/arch/ftsmc020.h>
+#define CONFIG_FTSMC020
+#include <faraday/ftsmc020.h>
 
 #define FTSMC020_BANK0_CONFIG  (FTSMC020_BANK_ENABLE             |     \
                                 FTSMC020_BANK_BASE(PHYS_FLASH_1) |     \
        { FTSMC020_BANK0_CONFIG, FTSMC020_BANK0_TIMING, },      \
        { FTSMC020_BANK1_CONFIG, FTSMC020_BANK1_TIMING, },      \
 }
+#endif /* CONFIG_FTSMC020 */
 
 /*-----------------------------------------------------------------------
  * FLASH and environment organization
diff --git a/include/faraday/ftsmc020.h b/include/faraday/ftsmc020.h
new file mode 100644 (file)
index 0000000..95d9500
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * (C) Copyright 2009 Faraday Technology
+ * Po-Yu Chuang <ratbert@faraday-tech.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/*
+ * Static Memory Controller
+ */
+#ifndef __FTSMC020_H
+#define __FTSMC020_H
+
+#ifndef __ASSEMBLY__
+
+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 */
+};
+
+void ftsmc020_init(void);
+
+#endif /* __ASSEMBLY__ */
+
+/*
+ * Memory Bank Configuration Register
+ */
+#define FTSMC020_BANK_ENABLE   (1 << 28)
+#define FTSMC020_BANK_BASE(x)  ((x) & 0x0fff1000)
+
+#define FTSMC020_BANK_WPROT    (1 << 11)
+
+#define FTSMC020_BANK_SIZE_32K (0xb << 4)
+#define FTSMC020_BANK_SIZE_64K (0xc << 4)
+#define FTSMC020_BANK_SIZE_128K        (0xd << 4)
+#define FTSMC020_BANK_SIZE_256K        (0xe << 4)
+#define FTSMC020_BANK_SIZE_512K        (0xf << 4)
+#define FTSMC020_BANK_SIZE_1M  (0x0 << 4)
+#define FTSMC020_BANK_SIZE_2M  (0x1 << 4)
+#define FTSMC020_BANK_SIZE_4M  (0x2 << 4)
+#define FTSMC020_BANK_SIZE_8M  (0x3 << 4)
+#define FTSMC020_BANK_SIZE_16M (0x4 << 4)
+#define FTSMC020_BANK_SIZE_32M (0x5 << 4)
+
+#define FTSMC020_BANK_MBW_8    (0x0 << 0)
+#define FTSMC020_BANK_MBW_16   (0x1 << 0)
+#define FTSMC020_BANK_MBW_32   (0x2 << 0)
+
+/*
+ * Memory Bank Timing Parameter Register
+ */
+#define FTSMC020_TPR_ETRNA(x)  (((x) & 0xf) << 28)
+#define FTSMC020_TPR_EATI(x)   (((x) & 0xf) << 24)
+#define FTSMC020_TPR_RBE       (1 << 20)
+#define FTSMC020_TPR_AST(x)    (((x) & 0x3) << 18)
+#define FTSMC020_TPR_CTW(x)    (((x) & 0x3) << 16)
+#define FTSMC020_TPR_ATI(x)    (((x) & 0xf) << 12)
+#define FTSMC020_TPR_AT2(x)    (((x) & 0x3) << 8)
+#define FTSMC020_TPR_WTC(x)    (((x) & 0x3) << 6)
+#define FTSMC020_TPR_AHT(x)    (((x) & 0x3) << 4)
+#define FTSMC020_TPR_TRNA(x)   (((x) & 0xf) << 0)
+
+#endif /* __FTSMC020_H */