diff mbox

[U-Boot,U-boot] mtd: nand: davinci: add header file for driver definitions

Message ID 1401379122-11469-1-git-send-email-ivan.khoronzhuk@ti.com
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Ivan Khoronzhuk May 29, 2014, 3:58 p.m. UTC
The definitions inside emif_defs.h concern davinci nand driver and
should be in it's header. So create header file for davinci nand
driver and move definitions from emif_defs.h to it.

Acked-by: Vitaly Andrianov <vitalya@ti.com>
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
---
 arch/arm/cpu/armv7/keystone/aemif.c                |  2 +-
 arch/arm/include/asm/arch-keystone/aemif.h         | 16 ++++++++++
 arch/arm/include/asm/arch-keystone/nand_defs.h     | 23 --------------
 drivers/mtd/nand/davinci_nand.c                    |  3 +-
 .../emif_defs.h => drivers/mtd/nand/davinci_nand.h | 35 +++++++++-------------
 5 files changed, 32 insertions(+), 47 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-keystone/aemif.h
 delete mode 100644 arch/arm/include/asm/arch-keystone/nand_defs.h
 rename arch/arm/include/asm/arch-keystone/emif_defs.h => drivers/mtd/nand/davinci_nand.h (57%)

Comments

Murali Karicheri May 29, 2014, 4:13 p.m. UTC | #1
On 5/29/2014 11:58 AM, Ivan Khoronzhuk wrote:
> The definitions inside emif_defs.h concern davinci nand driver and
> should be in it's header. So create header file for davinci nand
> driver and move definitions from emif_defs.h to it.
Ivan,

It is difficult to see what is done here. Can you rename the file in a 
separate patch?
Do it similar to what is done in kernel where aemif driver concerns with 
bus configuration
and nand drivers concerns with NAND part of the EMIF driver.
> Acked-by: Vitaly Andrianov <vitalya@ti.com>
> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
> ---
>   arch/arm/cpu/armv7/keystone/aemif.c                |  2 +-
>   arch/arm/include/asm/arch-keystone/aemif.h         | 16 ++++++++++
>   arch/arm/include/asm/arch-keystone/nand_defs.h     | 23 --------------
>   drivers/mtd/nand/davinci_nand.c                    |  3 +-
>   .../emif_defs.h => drivers/mtd/nand/davinci_nand.h | 35 +++++++++-------------
>   5 files changed, 32 insertions(+), 47 deletions(-)
>   create mode 100644 arch/arm/include/asm/arch-keystone/aemif.h
>   delete mode 100644 arch/arm/include/asm/arch-keystone/nand_defs.h
>   rename arch/arm/include/asm/arch-keystone/emif_defs.h => drivers/mtd/nand/davinci_nand.h (57%)
>
> diff --git a/arch/arm/cpu/armv7/keystone/aemif.c b/arch/arm/cpu/armv7/keystone/aemif.c
> index 9b26886..9ba1549 100644
> --- a/arch/arm/cpu/armv7/keystone/aemif.c
> +++ b/arch/arm/cpu/armv7/keystone/aemif.c
> @@ -10,7 +10,7 @@
>   #include <common.h>
>   #include <asm/io.h>
>   #include <asm/arch/clock.h>
> -#include <asm/arch/emif_defs.h>
> +#include <../drivers/mtd/nand/davinci_nand.h>
>   
>   #define AEMIF_CFG_SELECT_STROBE(v)	((v) ? 1 << 31 : 0)
>   #define AEMIF_CFG_EXTEND_WAIT(v)	((v) ? 1 << 30 : 0)
> diff --git a/arch/arm/include/asm/arch-keystone/aemif.h b/arch/arm/include/asm/arch-keystone/aemif.h
> new file mode 100644
> index 0000000..2dac747
> --- /dev/null
> +++ b/arch/arm/include/asm/arch-keystone/aemif.h
> @@ -0,0 +1,16 @@
> +/*
> + * emif definitions to re-use davinci emif driver on Keystone2
> + *
> + * (C) Copyright 2012-2014
> + *     Texas Instruments Incorporated, <www.ti.com>
> + * (C) Copyright 2007 Sergey Kubushyn <ksi@koi8.net>
> + *
> + * SPDX-License-Identifier:     GPL-2.0+
> + */
> +#ifndef _AEMIF_H_
> +#define _AEMIF_H_
> +
> +#include <asm/arch/hardware.h>
> +
> +
> +#endif
> diff --git a/arch/arm/include/asm/arch-keystone/nand_defs.h b/arch/arm/include/asm/arch-keystone/nand_defs.h
> deleted file mode 100644
> index 58417db..0000000
> --- a/arch/arm/include/asm/arch-keystone/nand_defs.h
> +++ /dev/null
> @@ -1,23 +0,0 @@
> -/*
> - * nand driver definitions to re-use davinci nand driver on Keystone2
> - *
> - * (C) Copyright 2012-2014
> - *     Texas Instruments Incorporated, <www.ti.com>
> - * (C) Copyright 2007 Sergey Kubushyn <ksi@koi8.net>
> - *
> - * SPDX-License-Identifier:     GPL-2.0+
> - */
> -#ifndef _NAND_DEFS_H_
> -#define _NAND_DEFS_H_
> -
> -#include <asm/arch/hardware.h>
> -#include <linux/mtd/nand.h>
> -
> -#define MASK_CLE         0x4000
> -#define	MASK_ALE         0x2000
> -
> -#define NAND_READ_START  0x00
> -#define NAND_READ_END    0x30
> -#define NAND_STATUS      0x70
> -
> -#endif
> diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
> index 75b03a7..bacf1f1 100644
> --- a/drivers/mtd/nand/davinci_nand.c
> +++ b/drivers/mtd/nand/davinci_nand.c
> @@ -32,8 +32,7 @@
>   #include <common.h>
>   #include <asm/io.h>
>   #include <nand.h>
> -#include <asm/arch/nand_defs.h>
> -#include <asm/arch/emif_defs.h>
> +#include "davinci_nand.h"
>   
>   /* Definitions for 4-bit hardware ECC */
>   #define NAND_TIMEOUT			10240
> diff --git a/arch/arm/include/asm/arch-keystone/emif_defs.h b/drivers/mtd/nand/davinci_nand.h
> similarity index 57%
> rename from arch/arm/include/asm/arch-keystone/emif_defs.h
> rename to drivers/mtd/nand/davinci_nand.h
> index a3378aa..db8d896 100644
> --- a/arch/arm/include/asm/arch-keystone/emif_defs.h
> +++ b/drivers/mtd/nand/davinci_nand.h
> @@ -1,16 +1,22 @@
>   /*
> - * emif definitions to re-use davinci emif driver on Keystone2
> + * NAND Flash Driver
>    *
> - * (C) Copyright 2012-2014
> - *     Texas Instruments Incorporated, <www.ti.com>
> - * (C) Copyright 2007 Sergey Kubushyn <ksi@koi8.net>
> + * Copyright (C) 2006-2014 Texas Instruments.
>    *
> - * SPDX-License-Identifier:     GPL-2.0+
> + * Based on Linux DaVinci NAND driver by TI.
>    */
> -#ifndef _EMIF_DEFS_H_
> -#define _EMIF_DEFS_H_
>   
> -#include <asm/arch/hardware.h>
> +#ifndef _DAVINCI_NAND_H_
> +#define _DAVINCI_NAND_H_
> +
> +#include <linux/mtd/nand.h>
> +
> +#define MASK_CLE         	0x4000
> +#define	MASK_ALE         	0x2000
> +
> +#define NAND_READ_START  	0x00
> +#define NAND_READ_END    	0x30
> +#define NAND_STATUS      	0x70
>   
>   struct davinci_emif_regs {
>   	uint32_t	ercsr;
> @@ -57,17 +63,4 @@ struct davinci_emif_regs {
>   #define DAVINCI_NANDFCR_4BIT_ECC_START			(1 << 12)
>   #define DAVINCI_NANDFCR_4BIT_CALC_START			(1 << 13)
>   
> -/* Chip Select setup */
> -#define DAVINCI_ABCR_STROBE_SELECT			(1 << 31)
> -#define DAVINCI_ABCR_EXT_WAIT				(1 << 30)
> -#define DAVINCI_ABCR_WSETUP(n)				((n) << 26)
> -#define DAVINCI_ABCR_WSTROBE(n)				((n) << 20)
> -#define DAVINCI_ABCR_WHOLD(n)				((n) << 17)
> -#define DAVINCI_ABCR_RSETUP(n)				((n) << 13)
> -#define DAVINCI_ABCR_RSTROBE(n)				((n) << 7)
> -#define DAVINCI_ABCR_RHOLD(n)				((n) << 4)
> -#define DAVINCI_ABCR_TA(n)				((n) << 2)
> -#define DAVINCI_ABCR_ASIZE_16BIT			1
> -#define DAVINCI_ABCR_ASIZE_8BIT				0
> -
>   #endif
Ivan Khoronzhuk May 29, 2014, 4:40 p.m. UTC | #2
On 05/29/2014 07:13 PM, Murali Karicheri wrote:
> On 5/29/2014 11:58 AM, Ivan Khoronzhuk wrote:
>> The definitions inside emif_defs.h concern davinci nand driver and
>> should be in it's header. So create header file for davinci nand
>> driver and move definitions from emif_defs.h to it.
> Ivan,
>
> It is difficult to see what is done here. Can you rename the file in a 
> separate patch?
> Do it similar to what is done in kernel where aemif driver concerns 
> with bus configuration
> and nand drivers concerns with NAND part of the EMIF driver.

Yes, you are right.
I think there is no reason to rename it at all, as it'll be deleted in 
the following patch.
I'll hold it as is and remove it in the patch
"[U-boot] [PATCH] ARM: keystone: aemif: move aemif driver to 
drivers/memory/ti-aemif.c"

Thanks.
diff mbox

Patch

diff --git a/arch/arm/cpu/armv7/keystone/aemif.c b/arch/arm/cpu/armv7/keystone/aemif.c
index 9b26886..9ba1549 100644
--- a/arch/arm/cpu/armv7/keystone/aemif.c
+++ b/arch/arm/cpu/armv7/keystone/aemif.c
@@ -10,7 +10,7 @@ 
 #include <common.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
-#include <asm/arch/emif_defs.h>
+#include <../drivers/mtd/nand/davinci_nand.h>
 
 #define AEMIF_CFG_SELECT_STROBE(v)	((v) ? 1 << 31 : 0)
 #define AEMIF_CFG_EXTEND_WAIT(v)	((v) ? 1 << 30 : 0)
diff --git a/arch/arm/include/asm/arch-keystone/aemif.h b/arch/arm/include/asm/arch-keystone/aemif.h
new file mode 100644
index 0000000..2dac747
--- /dev/null
+++ b/arch/arm/include/asm/arch-keystone/aemif.h
@@ -0,0 +1,16 @@ 
+/*
+ * emif definitions to re-use davinci emif driver on Keystone2
+ *
+ * (C) Copyright 2012-2014
+ *     Texas Instruments Incorporated, <www.ti.com>
+ * (C) Copyright 2007 Sergey Kubushyn <ksi@koi8.net>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+#ifndef _AEMIF_H_
+#define _AEMIF_H_
+
+#include <asm/arch/hardware.h>
+
+
+#endif
diff --git a/arch/arm/include/asm/arch-keystone/nand_defs.h b/arch/arm/include/asm/arch-keystone/nand_defs.h
deleted file mode 100644
index 58417db..0000000
--- a/arch/arm/include/asm/arch-keystone/nand_defs.h
+++ /dev/null
@@ -1,23 +0,0 @@ 
-/*
- * nand driver definitions to re-use davinci nand driver on Keystone2
- *
- * (C) Copyright 2012-2014
- *     Texas Instruments Incorporated, <www.ti.com>
- * (C) Copyright 2007 Sergey Kubushyn <ksi@koi8.net>
- *
- * SPDX-License-Identifier:     GPL-2.0+
- */
-#ifndef _NAND_DEFS_H_
-#define _NAND_DEFS_H_
-
-#include <asm/arch/hardware.h>
-#include <linux/mtd/nand.h>
-
-#define MASK_CLE         0x4000
-#define	MASK_ALE         0x2000
-
-#define NAND_READ_START  0x00
-#define NAND_READ_END    0x30
-#define NAND_STATUS      0x70
-
-#endif
diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
index 75b03a7..bacf1f1 100644
--- a/drivers/mtd/nand/davinci_nand.c
+++ b/drivers/mtd/nand/davinci_nand.c
@@ -32,8 +32,7 @@ 
 #include <common.h>
 #include <asm/io.h>
 #include <nand.h>
-#include <asm/arch/nand_defs.h>
-#include <asm/arch/emif_defs.h>
+#include "davinci_nand.h"
 
 /* Definitions for 4-bit hardware ECC */
 #define NAND_TIMEOUT			10240
diff --git a/arch/arm/include/asm/arch-keystone/emif_defs.h b/drivers/mtd/nand/davinci_nand.h
similarity index 57%
rename from arch/arm/include/asm/arch-keystone/emif_defs.h
rename to drivers/mtd/nand/davinci_nand.h
index a3378aa..db8d896 100644
--- a/arch/arm/include/asm/arch-keystone/emif_defs.h
+++ b/drivers/mtd/nand/davinci_nand.h
@@ -1,16 +1,22 @@ 
 /*
- * emif definitions to re-use davinci emif driver on Keystone2
+ * NAND Flash Driver
  *
- * (C) Copyright 2012-2014
- *     Texas Instruments Incorporated, <www.ti.com>
- * (C) Copyright 2007 Sergey Kubushyn <ksi@koi8.net>
+ * Copyright (C) 2006-2014 Texas Instruments.
  *
- * SPDX-License-Identifier:     GPL-2.0+
+ * Based on Linux DaVinci NAND driver by TI.
  */
-#ifndef _EMIF_DEFS_H_
-#define _EMIF_DEFS_H_
 
-#include <asm/arch/hardware.h>
+#ifndef _DAVINCI_NAND_H_
+#define _DAVINCI_NAND_H_
+
+#include <linux/mtd/nand.h>
+
+#define MASK_CLE         	0x4000
+#define	MASK_ALE         	0x2000
+
+#define NAND_READ_START  	0x00
+#define NAND_READ_END    	0x30
+#define NAND_STATUS      	0x70
 
 struct davinci_emif_regs {
 	uint32_t	ercsr;
@@ -57,17 +63,4 @@  struct davinci_emif_regs {
 #define DAVINCI_NANDFCR_4BIT_ECC_START			(1 << 12)
 #define DAVINCI_NANDFCR_4BIT_CALC_START			(1 << 13)
 
-/* Chip Select setup */
-#define DAVINCI_ABCR_STROBE_SELECT			(1 << 31)
-#define DAVINCI_ABCR_EXT_WAIT				(1 << 30)
-#define DAVINCI_ABCR_WSETUP(n)				((n) << 26)
-#define DAVINCI_ABCR_WSTROBE(n)				((n) << 20)
-#define DAVINCI_ABCR_WHOLD(n)				((n) << 17)
-#define DAVINCI_ABCR_RSETUP(n)				((n) << 13)
-#define DAVINCI_ABCR_RSTROBE(n)				((n) << 7)
-#define DAVINCI_ABCR_RHOLD(n)				((n) << 4)
-#define DAVINCI_ABCR_TA(n)				((n) << 2)
-#define DAVINCI_ABCR_ASIZE_16BIT			1
-#define DAVINCI_ABCR_ASIZE_8BIT				0
-
 #endif