Patchwork [U-Boot,v1,6/6] Driver/IFC: Move Freescale IFC driver to a common driver

login
register
mail settings
Submitter York Sun
Date Oct. 31, 2013, 2:07 a.m.
Message ID <1383185235-4693-7-git-send-email-yorksun@freescale.com>
Download mbox | patch
Permalink /patch/287381/
State Superseded
Delegated to: York Sun
Headers show

Comments

York Sun - Oct. 31, 2013, 2:07 a.m.
Freescale IFC controller has been used for mpc8xxx. It will be used
for ARM-based SoC as well. This patch moves the driver to driver/mtd
and fix the header file includes.

Signed-off-by: York Sun <yorksun@freescale.com>
---
 arch/powerpc/cpu/mpc85xx/cpu.c                     |    2 +-
 arch/powerpc/cpu/mpc85xx/spl_minimal.c             |    2 +-
 arch/powerpc/cpu/mpc8xxx/Makefile                  |    1 -
 arch/powerpc/include/asm/immap_85xx.h              |    2 +-
 board/freescale/bsc9132qds/bsc9132qds.c            |    2 +-
 board/freescale/c29xpcie/c29xpcie.c                |    2 +-
 board/freescale/p1010rdb/p1010rdb.c                |    2 +-
 drivers/mtd/Makefile                               |    1 +
 .../powerpc/cpu/mpc8xxx => drivers/mtd}/fsl_ifc.c  |    2 +-
 drivers/mtd/nand/fsl_ifc_nand.c                    |    2 +-
 drivers/mtd/nand/fsl_ifc_spl.c                     |    2 +-
 {arch/powerpc/include/asm => include}/fsl_ifc.h    |    6 +++---
 12 files changed, 13 insertions(+), 13 deletions(-)
 rename {arch/powerpc/cpu/mpc8xxx => drivers/mtd}/fsl_ifc.c (99%)
 rename {arch/powerpc/include/asm => include}/fsl_ifc.h (99%)
Prabhakar Kushwaha - Oct. 31, 2013, 3:27 a.m.
On 10/31/2013 7:37 AM, York Sun wrote:
> Freescale IFC controller has been used for mpc8xxx. It will be used
> for ARM-based SoC as well. This patch moves the driver to driver/mtd
> and fix the header file includes.
>
> Signed-off-by: York Sun <yorksun@freescale.com>
>
Thanks York for this patch.  This was pending from long time.

This patch moves fsl_ifc.c from powerpc to driver/mtd
I am not sure having 2 files for IFC controller in driver/mtd/ is 
correct. Although fsl_ifc.c is for IFC Controller(NOR, NAND machine) and 
fsl_ifc_nand.c is only for IFC - NAND machine.
I am asking this question as same changes will be applicable in Linux also.

Also,
We have to move changes of arch/powerpc/cpu/mpc85xx/speed.c to fsl_ifc.c 
.  This will make a IFC driver generic.

As this patch has impact on all IFC platforms,  has this been tested on 
few platforms?

Thanks,
Prabhakar
Scott Wood - Nov. 9, 2013, 12:44 a.m.
On Thu, 2013-10-31 at 08:57 +0530, Prabhakar Kushwaha wrote:
> On 10/31/2013 7:37 AM, York Sun wrote:
> > Freescale IFC controller has been used for mpc8xxx. It will be used
> > for ARM-based SoC as well. This patch moves the driver to driver/mtd
> > and fix the header file includes.
> >
> > Signed-off-by: York Sun <yorksun@freescale.com>
> >
> Thanks York for this patch.  This was pending from long time.
> 
> This patch moves fsl_ifc.c from powerpc to driver/mtd
> I am not sure having 2 files for IFC controller in driver/mtd/ is 
> correct. Although fsl_ifc.c is for IFC Controller(NOR, NAND machine) and 
> fsl_ifc_nand.c is only for IFC - NAND machine.
> I am asking this question as same changes will be applicable in Linux also.
> 
> Also,
> We have to move changes of arch/powerpc/cpu/mpc85xx/speed.c to fsl_ifc.c 
> .  This will make a IFC driver generic.
> 
> As this patch has impact on all IFC platforms,  has this been tested on 
> few platforms?

I'm not sure that drivers/mtd is the right place for it as it doesn't
expose an mtd interface.

-Scott
Prabhakar Kushwaha - Nov. 9, 2013, 12:52 a.m.
On 11/9/2013 6:14 AM, Scott Wood wrote:
> On Thu, 2013-10-31 at 08:57 +0530, Prabhakar Kushwaha wrote:
>> On 10/31/2013 7:37 AM, York Sun wrote:
>>> Freescale IFC controller has been used for mpc8xxx. It will be used
>>> for ARM-based SoC as well. This patch moves the driver to driver/mtd
>>> and fix the header file includes.
>>>
>>> Signed-off-by: York Sun <yorksun@freescale.com>
>>>
>> Thanks York for this patch.  This was pending from long time.
>>
>> This patch moves fsl_ifc.c from powerpc to driver/mtd
>> I am not sure having 2 files for IFC controller in driver/mtd/ is
>> correct. Although fsl_ifc.c is for IFC Controller(NOR, NAND machine) and
>> fsl_ifc_nand.c is only for IFC - NAND machine.
>> I am asking this question as same changes will be applicable in Linux also.
>>
>> Also,
>> We have to move changes of arch/powerpc/cpu/mpc85xx/speed.c to fsl_ifc.c
>> .  This will make a IFC driver generic.
>>
>> As this patch has impact on all IFC platforms,  has this been tested on
>> few platforms?
> I'm not sure that drivers/mtd is the right place for it as it doesn't
> expose an mtd interface.
>
>

Yes Scott, I am also agree with you. But we are not sure about the right 
place for it.
one suggestion, may we merge fsl_ifc in fsl_ifc_nand.c & fsl_ifc_spl.c?

Please advice

Regards,
Prabhakar
Scott Wood - Nov. 9, 2013, 1 a.m.
On Sat, 2013-11-09 at 06:22 +0530, Prabhakar Kushwaha wrote:
> On 11/9/2013 6:14 AM, Scott Wood wrote:
> > On Thu, 2013-10-31 at 08:57 +0530, Prabhakar Kushwaha wrote:
> >> On 10/31/2013 7:37 AM, York Sun wrote:
> >>> Freescale IFC controller has been used for mpc8xxx. It will be used
> >>> for ARM-based SoC as well. This patch moves the driver to driver/mtd
> >>> and fix the header file includes.
> >>>
> >>> Signed-off-by: York Sun <yorksun@freescale.com>
> >>>
> >> Thanks York for this patch.  This was pending from long time.
> >>
> >> This patch moves fsl_ifc.c from powerpc to driver/mtd
> >> I am not sure having 2 files for IFC controller in driver/mtd/ is
> >> correct. Although fsl_ifc.c is for IFC Controller(NOR, NAND machine) and
> >> fsl_ifc_nand.c is only for IFC - NAND machine.
> >> I am asking this question as same changes will be applicable in Linux also.
> >>
> >> Also,
> >> We have to move changes of arch/powerpc/cpu/mpc85xx/speed.c to fsl_ifc.c
> >> .  This will make a IFC driver generic.
> >>
> >> As this patch has impact on all IFC platforms,  has this been tested on
> >> few platforms?
> > I'm not sure that drivers/mtd is the right place for it as it doesn't
> > expose an mtd interface.
> >
> >
> 
> Yes Scott, I am also agree with you. But we are not sure about the right 
> place for it.

This is similar to the question of where to put CPM/QE code.  A place
will need to be identified for glue code that doesn't fit cleanly into
an existing subsystem.  drivers/misc is probably the right place, though
IIRC on the Linux side the drivers/misc maintainer was generally opposed
to its existence and pushed back on new things being added to it.

> one suggestion, may we merge fsl_ifc in fsl_ifc_nand.c & fsl_ifc_spl.c?

No.

-Scott
Prabhakar Kushwaha - Nov. 11, 2013, 11:13 a.m.
On 11/9/2013 6:30 AM, Scott Wood wrote:
> On Sat, 2013-11-09 at 06:22 +0530, Prabhakar Kushwaha wrote:
>> On 11/9/2013 6:14 AM, Scott Wood wrote:
>>> On Thu, 2013-10-31 at 08:57 +0530, Prabhakar Kushwaha wrote:
>>>> On 10/31/2013 7:37 AM, York Sun wrote:
>>>>> Freescale IFC controller has been used for mpc8xxx. It will be used
>>>>> for ARM-based SoC as well. This patch moves the driver to driver/mtd
>>>>> and fix the header file includes.
>>>>>
>>>>> Signed-off-by: York Sun <yorksun@freescale.com>
>>>>>
>>>> Thanks York for this patch.  This was pending from long time.
>>>>
>>>> This patch moves fsl_ifc.c from powerpc to driver/mtd
>>>> I am not sure having 2 files for IFC controller in driver/mtd/ is
>>>> correct. Although fsl_ifc.c is for IFC Controller(NOR, NAND machine) and
>>>> fsl_ifc_nand.c is only for IFC - NAND machine.
>>>> I am asking this question as same changes will be applicable in Linux also.
>>>>
>>>> Also,
>>>> We have to move changes of arch/powerpc/cpu/mpc85xx/speed.c to fsl_ifc.c
>>>> .  This will make a IFC driver generic.
>>>>
>>>> As this patch has impact on all IFC platforms,  has this been tested on
>>>> few platforms?
>>> I'm not sure that drivers/mtd is the right place for it as it doesn't
>>> expose an mtd interface.
>>>
>>>
>> Yes Scott, I am also agree with you. But we are not sure about the right
>> place for it.
> This is similar to the question of where to put CPM/QE code.  A place
> will need to be identified for glue code that doesn't fit cleanly into
> an existing subsystem.  drivers/misc is probably the right place, though
> IIRC on the Linux side the drivers/misc maintainer was generally opposed
> to its existence and pushed back on new things being added to it.

looks like putting fsl_ifc.c in driver/mtd is not good way of handle it.
I should sent on RFC of putting this in driver/misc for Linux and see 
the response. May be I get a better solution there.

Regards,
Prabhakar

Patch

diff --git a/arch/powerpc/cpu/mpc85xx/cpu.c b/arch/powerpc/cpu/mpc85xx/cpu.c
index b5a0242..3e99b07 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu.c
@@ -17,7 +17,7 @@ 
 #include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/mmu.h>
-#include <asm/fsl_ifc.h>
+#include <fsl_ifc.h>
 #include <asm/fsl_law.h>
 #include <asm/fsl_lbc.h>
 #include <post.h>
diff --git a/arch/powerpc/cpu/mpc85xx/spl_minimal.c b/arch/powerpc/cpu/mpc85xx/spl_minimal.c
index 199b33e..9e4c6c9 100644
--- a/arch/powerpc/cpu/mpc85xx/spl_minimal.c
+++ b/arch/powerpc/cpu/mpc85xx/spl_minimal.c
@@ -7,7 +7,7 @@ 
 #include <common.h>
 #include <asm/processor.h>
 #include <asm/global_data.h>
-#include <asm/fsl_ifc.h>
+#include <fsl_ifc.h>
 #include <asm/io.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/powerpc/cpu/mpc8xxx/Makefile b/arch/powerpc/cpu/mpc8xxx/Makefile
index 3dc8e05..3e8a4eb 100644
--- a/arch/powerpc/cpu/mpc8xxx/Makefile
+++ b/arch/powerpc/cpu/mpc8xxx/Makefile
@@ -29,7 +29,6 @@  COBJS-y	+= cpu.o
 endif
 
 COBJS-$(CONFIG_OF_LIBFDT) += fdt.o
-COBJS-$(CONFIG_FSL_IFC) += fsl_ifc.o
 COBJS-$(CONFIG_FSL_LBC) += fsl_lbc.o
 COBJS-$(CONFIG_SYS_SRIO) += srio.o
 COBJS-$(CONFIG_FSL_LAW) += law.o
diff --git a/arch/powerpc/include/asm/immap_85xx.h b/arch/powerpc/include/asm/immap_85xx.h
index b451f2a..0f9cdae 100644
--- a/arch/powerpc/include/asm/immap_85xx.h
+++ b/arch/powerpc/include/asm/immap_85xx.h
@@ -15,7 +15,7 @@ 
 #include <asm/types.h>
 #include <asm/fsl_dma.h>
 #include <asm/fsl_i2c.h>
-#include <asm/fsl_ifc.h>
+#include <fsl_ifc.h>
 #include <asm/fsl_lbc.h>
 #include <asm/fsl_fman.h>
 #include <fsl_immap.h>
diff --git a/board/freescale/bsc9132qds/bsc9132qds.c b/board/freescale/bsc9132qds/bsc9132qds.c
index c1ebcf8..9377280 100644
--- a/board/freescale/bsc9132qds/bsc9132qds.c
+++ b/board/freescale/bsc9132qds/bsc9132qds.c
@@ -17,7 +17,7 @@ 
 #include <tsec.h>
 #include <mmc.h>
 #include <netdev.h>
-#include <asm/fsl_ifc.h>
+#include <fsl_ifc.h>
 #include <hwconfig.h>
 #include <i2c.h>
 #include <fsl_ddr_sdram.h>
diff --git a/board/freescale/c29xpcie/c29xpcie.c b/board/freescale/c29xpcie/c29xpcie.c
index 48c4b30..f964d61 100644
--- a/board/freescale/c29xpcie/c29xpcie.c
+++ b/board/freescale/c29xpcie/c29xpcie.c
@@ -18,7 +18,7 @@ 
 #include <mmc.h>
 #include <netdev.h>
 #include <pci.h>
-#include <asm/fsl_ifc.h>
+#include <fsl_ifc.h>
 #include <asm/fsl_pci.h>
 
 #include "cpld.h"
diff --git a/board/freescale/p1010rdb/p1010rdb.c b/board/freescale/p1010rdb/p1010rdb.c
index e940d22..62caf67 100644
--- a/board/freescale/p1010rdb/p1010rdb.c
+++ b/board/freescale/p1010rdb/p1010rdb.c
@@ -19,7 +19,7 @@ 
 #include <netdev.h>
 #include <pci.h>
 #include <asm/fsl_serdes.h>
-#include <asm/fsl_ifc.h>
+#include <fsl_ifc.h>
 #include <asm/fsl_pci.h>
 #include <hwconfig.h>
 #include <i2c.h>
diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
index d2c3bda..c75bb4d 100644
--- a/drivers/mtd/Makefile
+++ b/drivers/mtd/Makefile
@@ -22,6 +22,7 @@  COBJS-$(CONFIG_FTSMC020) += ftsmc020.o
 COBJS-$(CONFIG_FLASH_CFI_LEGACY) += jedec_flash.o
 COBJS-$(CONFIG_MW_EEPROM) += mw_eeprom.o
 COBJS-$(CONFIG_ST_SMI) += st_smi.o
+COBJS-$(CONFIG_FSL_IFC) += fsl_ifc.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
diff --git a/arch/powerpc/cpu/mpc8xxx/fsl_ifc.c b/drivers/mtd/fsl_ifc.c
similarity index 99%
rename from arch/powerpc/cpu/mpc8xxx/fsl_ifc.c
rename to drivers/mtd/fsl_ifc.c
index 2d0fb43..507c4de 100644
--- a/arch/powerpc/cpu/mpc8xxx/fsl_ifc.c
+++ b/drivers/mtd/fsl_ifc.c
@@ -6,7 +6,7 @@ 
  */
 
 #include <common.h>
-#include <asm/fsl_ifc.h>
+#include <fsl_ifc.h>
 
 void print_ifc_regs(void)
 {
diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c
index 98a09c0..3b845b9 100644
--- a/drivers/mtd/nand/fsl_ifc_nand.c
+++ b/drivers/mtd/nand/fsl_ifc_nand.c
@@ -17,7 +17,7 @@ 
 
 #include <asm/io.h>
 #include <asm/errno.h>
-#include <asm/fsl_ifc.h>
+#include <fsl_ifc.h>
 
 #define FSL_IFC_V1_1_0	0x01010000
 #define MAX_BANKS	4
diff --git a/drivers/mtd/nand/fsl_ifc_spl.c b/drivers/mtd/nand/fsl_ifc_spl.c
index d462265..3c8278d 100644
--- a/drivers/mtd/nand/fsl_ifc_spl.c
+++ b/drivers/mtd/nand/fsl_ifc_spl.c
@@ -9,7 +9,7 @@ 
 
 #include <common.h>
 #include <asm/io.h>
-#include <asm/fsl_ifc.h>
+#include <fsl_ifc.h>
 #include <linux/mtd/nand.h>
 
 static inline int is_blank(uchar *addr, int page_size)
diff --git a/arch/powerpc/include/asm/fsl_ifc.h b/include/fsl_ifc.h
similarity index 99%
rename from arch/powerpc/include/asm/fsl_ifc.h
rename to include/fsl_ifc.h
index a945e4b..3e9b01b 100644
--- a/arch/powerpc/include/asm/fsl_ifc.h
+++ b/include/fsl_ifc.h
@@ -5,8 +5,8 @@ 
  * SPDX-License-Identifier:	GPL-2.0+
  */
 
-#ifndef __ASM_PPC_FSL_IFC_H
-#define __ASM_PPC_FSL_IFC_H
+#ifndef __FSL_IFC_H
+#define __FSL_IFC_H
 
 #ifdef CONFIG_FSL_IFC
 #include <config.h>
@@ -983,4 +983,4 @@  struct fsl_ifc {
 #endif /* CONFIG_FSL_IFC */
 
 #endif /* __ASSEMBLY__ */
-#endif /* __ASM_PPC_FSL_IFC_H */
+#endif /* __FSL_IFC_H */