From 5babc86365bd24c6e4c1f8705f8c429f9fa5f48e Mon Sep 17 00:00:00 2001 From: Joe Hershberger Date: Tue, 5 Jun 2012 19:10:22 -0500 Subject: [PATCH] Xilinx: ARM: nand: Move the zynq nand driver to drivers/mtd/nand This drivers should be accesible to other boards based on Zynq Signed-off-by: Joe Hershberger --- arch/arm/include/asm/arch-zynq/nand.h | 25 +++++++++++++++++++ board/xilinx/zynq_common/Makefile | 1 - board/xilinx/zynq_common/board.c | 8 ++++++ drivers/mtd/nand/Makefile | 1 + .../mtd/nand/zynq_nand.c | 5 ++-- .../mtd/nand/zynq_nand.h | 0 include/configs/zynq_ep107.h | 1 + include/configs/zynq_zc770.h | 1 + 8 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 arch/arm/include/asm/arch-zynq/nand.h rename board/xilinx/zynq_common/xilinx_nandps.c => drivers/mtd/nand/zynq_nand.c (99%) rename board/xilinx/zynq_common/xilinx_nand_smc.h => drivers/mtd/nand/zynq_nand.h (100%) diff --git a/arch/arm/include/asm/arch-zynq/nand.h b/arch/arm/include/asm/arch-zynq/nand.h new file mode 100644 index 00000000000..33a7d20425f --- /dev/null +++ b/arch/arm/include/asm/arch-zynq/nand.h @@ -0,0 +1,25 @@ +/* + * Copyright 2012 Joe Hershberger + * + * See file CREDITS for list of people who contributed to this + * project. + * + * 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., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include + +extern int zynq_nand_init(struct nand_chip *nand_chip); diff --git a/board/xilinx/zynq_common/Makefile b/board/xilinx/zynq_common/Makefile index d884920b05d..975d1cc307d 100644 --- a/board/xilinx/zynq_common/Makefile +++ b/board/xilinx/zynq_common/Makefile @@ -35,7 +35,6 @@ COBJS-$(CONFIG_CMD_NET) += xemacps_g.o xemacps_control.o \ xemacps_sinit.o xemacps_bdring.o \ xemacps.o xgmac.o COBJS-$(CONFIG_CMD_SPI) += xilinx_qspi.o xilinx_qspips.o -COBJS-$(CONFIG_CMD_NAND) += xilinx_nandps.o COBJS := $(sort $(COBJS-y)) diff --git a/board/xilinx/zynq_common/board.c b/board/xilinx/zynq_common/board.c index c7d688b6882..6a029fd11c1 100644 --- a/board/xilinx/zynq_common/board.c +++ b/board/xilinx/zynq_common/board.c @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -681,6 +682,13 @@ int board_mmc_init(bd_t *bd) } #endif +#ifdef CONFIG_CMD_NAND +int board_nand_init(struct nand_chip *nand_chip) +{ + return zynq_nand_init(nand_chip); +} +#endif + int dram_init(void) { gd->ram_size = PHYS_SDRAM_1_SIZE; diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile index 8b598f6bfef..a17e75b96dd 100644 --- a/drivers/mtd/nand/Makefile +++ b/drivers/mtd/nand/Makefile @@ -50,6 +50,7 @@ COBJS-$(CONFIG_NAND_S3C64XX) += s3c64xx.o COBJS-$(CONFIG_NAND_SPEAR) += spr_nand.o COBJS-$(CONFIG_NAND_OMAP_GPMC) += omap_gpmc.o COBJS-$(CONFIG_NAND_PLAT) += nand_plat.o +COBJS-$(CONFIG_NAND_ZYNQ) += zynq_nand.o endif COBJS := $(COBJS-y) diff --git a/board/xilinx/zynq_common/xilinx_nandps.c b/drivers/mtd/nand/zynq_nand.c similarity index 99% rename from board/xilinx/zynq_common/xilinx_nandps.c rename to drivers/mtd/nand/zynq_nand.c index 7bdf756bada..48842564b9e 100644 --- a/board/xilinx/zynq_common/xilinx_nandps.c +++ b/drivers/mtd/nand/zynq_nand.c @@ -39,12 +39,13 @@ #include #include +#include #include #include #include #include #include -#include "xilinx_nand_smc.h" +#include "zynq_nand.h" /********** stubs - Make Linux code compile in this environment **************/ #define EIO 5 @@ -985,7 +986,7 @@ static int xnandps_device_ready(struct mtd_info *mtd) #ifdef LINUX_ONLY_NOT_UBOOT static int __init xnandps_probe(struct platform_device *pdev) #else -int board_nand_init(struct nand_chip *nand_chip) +int zynq_nand_init(struct nand_chip *nand_chip) #endif { struct xnandps_info *xnand; diff --git a/board/xilinx/zynq_common/xilinx_nand_smc.h b/drivers/mtd/nand/zynq_nand.h similarity index 100% rename from board/xilinx/zynq_common/xilinx_nand_smc.h rename to drivers/mtd/nand/zynq_nand.h diff --git a/include/configs/zynq_ep107.h b/include/configs/zynq_ep107.h index 11c56839637..4cb64da8412 100644 --- a/include/configs/zynq_ep107.h +++ b/include/configs/zynq_ep107.h @@ -95,6 +95,7 @@ /* * NAND Flash settings */ +#define CONFIG_NAND_ZYNQ #define CONFIG_CMD_NAND #define CONFIG_CMD_NAND_LOCK_UNLOCK #define CONFIG_SYS_MAX_NAND_DEVICE 1 diff --git a/include/configs/zynq_zc770.h b/include/configs/zynq_zc770.h index 602dccccf65..56f5b876c3f 100644 --- a/include/configs/zynq_zc770.h +++ b/include/configs/zynq_zc770.h @@ -134,6 +134,7 @@ * NAND Flash settings */ #if defined(CONFIG_ZC770_XM011) +#define CONFIG_NAND_ZYNQ #define CONFIG_CMD_NAND #define CONFIG_CMD_NAND_LOCK_UNLOCK #define CONFIG_SYS_MAX_NAND_DEVICE 1 -- 2.47.3