diff mbox

[v2,1/2] fsl/corenet_generic: add a particular initialization for platform

Message ID 1397541229-34383-1-git-send-email-dongsheng.wang@freescale.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Dongsheng Wang April 15, 2014, 5:53 a.m. UTC
From: Wang Dongsheng <dongsheng.wang@freescale.com>

Corenet_generic is a generic platform initialization. Those based on
the corenet_generic board maybe need a particular initialize to
enable/set some IP-Blocks. So add "Fix Generic Initialization" to solve
this kind of special cases.

Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com>
---
*v2*
 1/ Split DIU code.
 2/ make fix.c as a independent driver.

Comments

Scott Wood April 15, 2014, 7:39 p.m. UTC | #1
On Tue, 2014-04-15 at 13:53 +0800, Dongsheng Wang wrote:
> From: Wang Dongsheng <dongsheng.wang@freescale.com>
> 
> Corenet_generic is a generic platform initialization. Those based on
> the corenet_generic board maybe need a particular initialize to
> enable/set some IP-Blocks. So add "Fix Generic Initialization" to solve
> this kind of special cases.

I still don't understand what you mean by "fix".  What are you fixing,
or what is fixed?

There is no need for adding an infrastructure layer here.  Just add a
new piece of code for t104x diu, and have it be called by an appropriate
initfunc.

> Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com>
> ---
> *v2*
>  1/ Split DIU code.
>  2/ make fix.c as a independent driver.
> diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
> index c17aae8..fce2341 100644
> --- a/arch/powerpc/platforms/85xx/Kconfig
> +++ b/arch/powerpc/platforms/85xx/Kconfig
> @@ -269,6 +269,17 @@ config CORENET_GENERIC
>  	  The following boards are supported for both 32bit and 64bit kernel:
>  	    P5020 DS and P5040 DS
>  
> +config FIX_GENERIC_PLATFORM_INIT
> +	bool "Fix Generic Initialization"
> +	depends on CORENET_GENERIC

Why does this depend on CORENET_GENERIC?

> +	default y

No.

-Scott
Dongsheng Wang April 16, 2014, 2:58 a.m. UTC | #2
> -----Original Message-----

> From: Wood Scott-B07421

> Sent: Wednesday, April 16, 2014 3:39 AM

> To: Wang Dongsheng-B40534

> Cc: Jin Zhengxiong-R64188; haokexin@gmail.com; Kushwaha Prabhakar-B32579;

> linuxppc-dev@lists.ozlabs.org

> Subject: Re: [PATCH v2 1/2] fsl/corenet_generic: add a particular initialization

> for platform

> 

> On Tue, 2014-04-15 at 13:53 +0800, Dongsheng Wang wrote:

> > From: Wang Dongsheng <dongsheng.wang@freescale.com>

> >

> > Corenet_generic is a generic platform initialization. Those based on

> > the corenet_generic board maybe need a particular initialize to

> > enable/set some IP-Blocks. So add "Fix Generic Initialization" to solve

> > this kind of special cases.

> 

> I still don't understand what you mean by "fix".  What are you fixing,

> or what is fixed?

> 

> There is no need for adding an infrastructure layer here.  Just add a

> new piece of code for t104x diu, and have it be called by an appropriate

> initfunc.

> 


"fix" is means to handle some boards those based on corenet_generic config file,
But those boards may need some special handle. Perhaps these used to handle
special feature codes not have an appropriate initfunc we cannot *just find*
an appropriate place, if more and more boards need to do this, at that time
maybe *initfunc* looks very complicated. So we need this "fix" layer to deal them.
We need a plan to fix those boards, not just find an initfunc. I thinks "fix"
is the best initfunc to handle those special things.

If "fix" is not clear, did you have a good idear? :)

> > Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com>

> > ---

> > *v2*

> >  1/ Split DIU code.

> >  2/ make fix.c as a independent driver.

> > diff --git a/arch/powerpc/platforms/85xx/Kconfig

> b/arch/powerpc/platforms/85xx/Kconfig

> > index c17aae8..fce2341 100644

> > --- a/arch/powerpc/platforms/85xx/Kconfig

> > +++ b/arch/powerpc/platforms/85xx/Kconfig

> > @@ -269,6 +269,17 @@ config CORENET_GENERIC

> >  	  The following boards are supported for both 32bit and 64bit kernel:

> >  	    P5020 DS and P5040 DS

> >

> > +config FIX_GENERIC_PLATFORM_INIT

> > +	bool "Fix Generic Initialization"

> > +	depends on CORENET_GENERIC

> 

> Why does this depend on CORENET_GENERIC?

> 


Because CORENET_GENERIC is a multiboards file, This is designed to handle this situation.

> > +	default y

> 

> No.

> 


Why not? This will not increase any redundant operations if there is not any boards need fix.
You can see my fix.c code.

Regards,
-Dongsheng

> -Scott

>
Scott Wood April 16, 2014, 7:36 p.m. UTC | #3
On Tue, 2014-04-15 at 21:58 -0500, Wang Dongsheng-B40534 wrote:
> 
> > -----Original Message-----
> > From: Wood Scott-B07421
> > Sent: Wednesday, April 16, 2014 3:39 AM
> > To: Wang Dongsheng-B40534
> > Cc: Jin Zhengxiong-R64188; haokexin@gmail.com; Kushwaha Prabhakar-B32579;
> > linuxppc-dev@lists.ozlabs.org
> > Subject: Re: [PATCH v2 1/2] fsl/corenet_generic: add a particular initialization
> > for platform
> > 
> > On Tue, 2014-04-15 at 13:53 +0800, Dongsheng Wang wrote:
> > > From: Wang Dongsheng <dongsheng.wang@freescale.com>
> > >
> > > Corenet_generic is a generic platform initialization. Those based on
> > > the corenet_generic board maybe need a particular initialize to
> > > enable/set some IP-Blocks. So add "Fix Generic Initialization" to solve
> > > this kind of special cases.
> > 
> > I still don't understand what you mean by "fix".  What are you fixing,
> > or what is fixed?
> > 
> > There is no need for adding an infrastructure layer here.  Just add a
> > new piece of code for t104x diu, and have it be called by an appropriate
> > initfunc.
> > 
> 
> "fix" is means to handle some boards those based on corenet_generic config file,
> But those boards may need some special handle. Perhaps these used to handle
> special feature codes not have an appropriate initfunc we cannot *just find*
> an appropriate place,

I'm not asking you to "just find" anything.  I'm asking you to add an
initfunc in a standalone file.

> if more and more boards need to do this, at that time maybe *initfunc*
> looks very complicated.

They would each have their own initfunc.  There is no reason to tie this
in with anything else.

> > > --- a/arch/powerpc/platforms/85xx/Kconfig
> > > +++ b/arch/powerpc/platforms/85xx/Kconfig
> > > @@ -269,6 +269,17 @@ config CORENET_GENERIC
> > >  	  The following boards are supported for both 32bit and 64bit kernel:
> > >  	    P5020 DS and P5040 DS
> > >
> > > +config FIX_GENERIC_PLATFORM_INIT
> > > +	bool "Fix Generic Initialization"
> > > +	depends on CORENET_GENERIC
> > 
> > Why does this depend on CORENET_GENERIC?
> > 
> 
> Because CORENET_GENERIC is a multiboards file, This is designed to handle this situation.

This DIU code is going to be just as applicable to a custom T104x board
which may or may not use CORENET_GENERIC.

> > > +	default y
> > 
> > No.
> > 
> 
> Why not? This will not increase any redundant operations if there is not any boards need fix.
> You can see my fix.c code.

default y should not be used for hardware specific code.

-Scott
Dongsheng Wang April 24, 2014, 6:43 a.m. UTC | #4
> -----Original Message-----

> From: Wood Scott-B07421

> Sent: Thursday, April 17, 2014 3:36 AM

> To: Wang Dongsheng-B40534

> Cc: Jin Zhengxiong-R64188; haokexin@gmail.com; Kushwaha Prabhakar-B32579;

> linuxppc-dev@lists.ozlabs.org

> Subject: Re: [PATCH v2 1/2] fsl/corenet_generic: add a particular initialization

> for platform

> 

> On Tue, 2014-04-15 at 21:58 -0500, Wang Dongsheng-B40534 wrote:

> >

> > > -----Original Message-----

> > > From: Wood Scott-B07421

> > > Sent: Wednesday, April 16, 2014 3:39 AM

> > > To: Wang Dongsheng-B40534

> > > Cc: Jin Zhengxiong-R64188; haokexin@gmail.com; Kushwaha

> > > Prabhakar-B32579; linuxppc-dev@lists.ozlabs.org

> > > Subject: Re: [PATCH v2 1/2] fsl/corenet_generic: add a particular

> > > initialization for platform

> > >

> > > On Tue, 2014-04-15 at 13:53 +0800, Dongsheng Wang wrote:

> > > > From: Wang Dongsheng <dongsheng.wang@freescale.com>

> > > >

> > > > Corenet_generic is a generic platform initialization. Those based

> > > > on the corenet_generic board maybe need a particular initialize to

> > > > enable/set some IP-Blocks. So add "Fix Generic Initialization" to

> > > > solve this kind of special cases.

> > >

> > > I still don't understand what you mean by "fix".  What are you

> > > fixing, or what is fixed?

> > >

> > > There is no need for adding an infrastructure layer here.  Just add

> > > a new piece of code for t104x diu, and have it be called by an

> > > appropriate initfunc.

> > >

> >

> > "fix" is means to handle some boards those based on corenet_generic

> > config file, But those boards may need some special handle. Perhaps

> > these used to handle special feature codes not have an appropriate

> > initfunc we cannot *just find* an appropriate place,

> 

> I'm not asking you to "just find" anything.  I'm asking you to add an initfunc

> in a standalone file.

> 

> > if more and more boards need to do this, at that time maybe *initfunc*

> > looks very complicated.

> 

> They would each have their own initfunc.  There is no reason to tie this in with

> anything else.

> 


Sorry, if those platforms are using corenet_generic, I don’t see any standalone file
for initfunc of platform. That's why I'm adding "fix" layer.

BTW, if I missed something about "corenet_generic standalone file" please let me know.

> > > > --- a/arch/powerpc/platforms/85xx/Kconfig

> > > > +++ b/arch/powerpc/platforms/85xx/Kconfig

> > > > @@ -269,6 +269,17 @@ config CORENET_GENERIC

> > > >  	  The following boards are supported for both 32bit and 64bit

> kernel:

> > > >  	    P5020 DS and P5040 DS

> > > >

> > > > +config FIX_GENERIC_PLATFORM_INIT

> > > > +	bool "Fix Generic Initialization"

> > > > +	depends on CORENET_GENERIC

> > >

> > > Why does this depend on CORENET_GENERIC?

> > >

> >

> > Because CORENET_GENERIC is a multiboards file, This is designed to handle this

> situation.

> 

> This DIU code is going to be just as applicable to a custom T104x board which

> may or may not use CORENET_GENERIC.

> 


"fix" is a middle layer, it's not only for T104xrdb-DIU.

> > > > +	default y

> > >

> > > No.

> > >

> >

> > Why not? This will not increase any redundant operations if there is not any

> boards need fix.

> > You can see my fix.c code.

> 

> default y should not be used for hardware specific code.

> 


fix.c and hardware no relationship at all. :), It's just a software layer.

Regards,
-Dongsheng

> -Scott

>
Scott Wood April 24, 2014, 6:46 p.m. UTC | #5
On Thu, 2014-04-24 at 01:43 -0500, Wang Dongsheng-B40534 wrote:
> 
> > -----Original Message-----
> > From: Wood Scott-B07421
> > Sent: Thursday, April 17, 2014 3:36 AM
> > To: Wang Dongsheng-B40534
> > Cc: Jin Zhengxiong-R64188; haokexin@gmail.com; Kushwaha Prabhakar-B32579;
> > linuxppc-dev@lists.ozlabs.org
> > Subject: Re: [PATCH v2 1/2] fsl/corenet_generic: add a particular initialization
> > for platform
> > 
> > On Tue, 2014-04-15 at 21:58 -0500, Wang Dongsheng-B40534 wrote:
> > >
> > > > -----Original Message-----
> > > > From: Wood Scott-B07421
> > > > Sent: Wednesday, April 16, 2014 3:39 AM
> > > > To: Wang Dongsheng-B40534
> > > > Cc: Jin Zhengxiong-R64188; haokexin@gmail.com; Kushwaha
> > > > Prabhakar-B32579; linuxppc-dev@lists.ozlabs.org
> > > > Subject: Re: [PATCH v2 1/2] fsl/corenet_generic: add a particular
> > > > initialization for platform
> > > >
> > > > On Tue, 2014-04-15 at 13:53 +0800, Dongsheng Wang wrote:
> > > > > From: Wang Dongsheng <dongsheng.wang@freescale.com>
> > > > >
> > > > > Corenet_generic is a generic platform initialization. Those based
> > > > > on the corenet_generic board maybe need a particular initialize to
> > > > > enable/set some IP-Blocks. So add "Fix Generic Initialization" to
> > > > > solve this kind of special cases.
> > > >
> > > > I still don't understand what you mean by "fix".  What are you
> > > > fixing, or what is fixed?
> > > >
> > > > There is no need for adding an infrastructure layer here.  Just add
> > > > a new piece of code for t104x diu, and have it be called by an
> > > > appropriate initfunc.
> > > >
> > >
> > > "fix" is means to handle some boards those based on corenet_generic
> > > config file, But those boards may need some special handle. Perhaps
> > > these used to handle special feature codes not have an appropriate
> > > initfunc we cannot *just find* an appropriate place,
> > 
> > I'm not asking you to "just find" anything.  I'm asking you to add an initfunc
> > in a standalone file.
> > 
> > > if more and more boards need to do this, at that time maybe *initfunc*
> > > looks very complicated.
> > 
> > They would each have their own initfunc.  There is no reason to tie this in with
> > anything else.
> > 
> 
> Sorry, if those platforms are using corenet_generic, I don’t see any standalone file
> for initfunc of platform. That's why I'm adding "fix" layer.

It's totally unnecessary.

Just do this:

t104x_diu_init(void)
{
	if (t104x diu not in the device tree)
		return;

	...
}

early_initcall(t104x_diu_init);

> > > > > +config FIX_GENERIC_PLATFORM_INIT
> > > > > +	bool "Fix Generic Initialization"
> > > > > +	depends on CORENET_GENERIC
> > > >
> > > > Why does this depend on CORENET_GENERIC?
> > > >
> > >
> > > Because CORENET_GENERIC is a multiboards file, This is designed to handle this
> > situation.
> > 
> > This DIU code is going to be just as applicable to a custom T104x board which
> > may or may not use CORENET_GENERIC.
> > 
> 
> "fix" is a middle layer, it's not only for T104xrdb-DIU.

My point is a custom t104x board might not use CORENET_GENERIC.

> > > > > +	default y
> > > >
> > > > No.
> > > >
> > >
> > > Why not? This will not increase any redundant operations if there is not any
> > boards need fix.
> > > You can see my fix.c code.
> > 
> > default y should not be used for hardware specific code.
> > 
> 
> fix.c and hardware no relationship at all. :), It's just a software layer.

No relationship to hardware, yet it depends on CORENET_GENERIC, reads a
Freescale-specific SPR, and lives in arch/powerpc/platforms/85xx. :-)

-Scott
Scott Wood April 24, 2014, 6:47 p.m. UTC | #6
On Thu, 2014-04-24 at 13:46 -0500, Scott Wood wrote:
> On Thu, 2014-04-24 at 01:43 -0500, Wang Dongsheng-B40534 wrote:
> > 
> > > -----Original Message-----
> > > From: Wood Scott-B07421
> > > Sent: Thursday, April 17, 2014 3:36 AM
> > > To: Wang Dongsheng-B40534
> > > Cc: Jin Zhengxiong-R64188; haokexin@gmail.com; Kushwaha Prabhakar-B32579;
> > > linuxppc-dev@lists.ozlabs.org
> > > Subject: Re: [PATCH v2 1/2] fsl/corenet_generic: add a particular initialization
> > > for platform
> > > 
> > > On Tue, 2014-04-15 at 21:58 -0500, Wang Dongsheng-B40534 wrote:
> > > >
> > > > > -----Original Message-----
> > > > > From: Wood Scott-B07421
> > > > > Sent: Wednesday, April 16, 2014 3:39 AM
> > > > > To: Wang Dongsheng-B40534
> > > > > Cc: Jin Zhengxiong-R64188; haokexin@gmail.com; Kushwaha
> > > > > Prabhakar-B32579; linuxppc-dev@lists.ozlabs.org
> > > > > Subject: Re: [PATCH v2 1/2] fsl/corenet_generic: add a particular
> > > > > initialization for platform
> > > > >
> > > > > On Tue, 2014-04-15 at 13:53 +0800, Dongsheng Wang wrote:
> > > > > > From: Wang Dongsheng <dongsheng.wang@freescale.com>
> > > > > >
> > > > > > Corenet_generic is a generic platform initialization. Those based
> > > > > > on the corenet_generic board maybe need a particular initialize to
> > > > > > enable/set some IP-Blocks. So add "Fix Generic Initialization" to
> > > > > > solve this kind of special cases.
> > > > >
> > > > > I still don't understand what you mean by "fix".  What are you
> > > > > fixing, or what is fixed?
> > > > >
> > > > > There is no need for adding an infrastructure layer here.  Just add
> > > > > a new piece of code for t104x diu, and have it be called by an
> > > > > appropriate initfunc.
> > > > >
> > > >
> > > > "fix" is means to handle some boards those based on corenet_generic
> > > > config file, But those boards may need some special handle. Perhaps
> > > > these used to handle special feature codes not have an appropriate
> > > > initfunc we cannot *just find* an appropriate place,
> > > 
> > > I'm not asking you to "just find" anything.  I'm asking you to add an initfunc
> > > in a standalone file.
> > > 
> > > > if more and more boards need to do this, at that time maybe *initfunc*
> > > > looks very complicated.
> > > 
> > > They would each have their own initfunc.  There is no reason to tie this in with
> > > anything else.
> > > 
> > 
> > Sorry, if those platforms are using corenet_generic, I don’t see any standalone file
> > for initfunc of platform. That's why I'm adding "fix" layer.
> 
> It's totally unnecessary.
> 
> Just do this:
> 
> t104x_diu_init(void)
> {

s/t104x_diu_init/static void t104x_diu_init/ of course.

-Scott
diff mbox

Patch

diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index c17aae8..fce2341 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -269,6 +269,17 @@  config CORENET_GENERIC
 	  The following boards are supported for both 32bit and 64bit kernel:
 	    P5020 DS and P5040 DS
 
+config FIX_GENERIC_PLATFORM_INIT
+	bool "Fix Generic Initialization"
+	depends on CORENET_GENERIC
+	default y
+	help
+	  This option will create a initialization that is a append initialization
+	  for a particular platfrom. And this particular platform also based on
+	  "Freescale CoreNet Generic".
+
+	  e.g. DIU need a special initialization at T104x platform.
+
 endif # FSL_SOC_BOOKE
 
 config TQM85xx
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index 25cebe7..1162ac7 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -20,6 +20,7 @@  obj-$(CONFIG_P1022_RDK)   += p1022_rdk.o
 obj-$(CONFIG_P1023_RDS)   += p1023_rds.o
 obj-$(CONFIG_TWR_P102x)   += twr_p102x.o
 obj-$(CONFIG_CORENET_GENERIC)   += corenet_generic.o
+obj-$(CONFIG_FIX_GENERIC_PLATFORM_INIT) += fix/
 obj-$(CONFIG_STX_GP3)	  += stx_gp3.o
 obj-$(CONFIG_TQM85xx)	  += tqm85xx.o
 obj-$(CONFIG_SBC8548)     += sbc8548.o
diff --git a/arch/powerpc/platforms/85xx/fix/Makefile b/arch/powerpc/platforms/85xx/fix/Makefile
new file mode 100644
index 0000000..a8e8154
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/fix/Makefile
@@ -0,0 +1 @@ 
+obj-y += fix.o
diff --git a/arch/powerpc/platforms/85xx/fix/fix.c b/arch/powerpc/platforms/85xx/fix/fix.c
new file mode 100644
index 0000000..7b59a52
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/fix/fix.c
@@ -0,0 +1,26 @@ 
+/*
+ * Fix Different Boards Particular Initialization
+ *
+ * Author: Wang Dongsheng <dongsheng.wang@freescale.com>
+ *
+ * Copyright 2014 Freescale Semiconductor Inc.
+ *
+ * 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.
+ */
+
+#include <linux/kernel.h>
+
+#include <asm/mpc85xx.h>
+#include <asm/reg.h>
+#include <asm/reg_booke.h>
+
+#include "fix.h"
+
+static int fix_platform_init(void)
+{
+	return 0;
+}
+early_initcall(fix_platform_init);
diff --git a/arch/powerpc/platforms/85xx/fix/fix.h b/arch/powerpc/platforms/85xx/fix/fix.h
new file mode 100644
index 0000000..5a8c80e3
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/fix/fix.h
@@ -0,0 +1,4 @@ 
+#ifndef __CORENET_GENERIC_FIX_H__
+#define __CORENET_GENERIC_FIX_H__
+
+#endif