linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/83xx: add support for mpc8306
@ 2015-03-28 16:59 Filip Brozovic
  2015-03-31 17:54 ` Scott Wood
  0 siblings, 1 reply; 4+ messages in thread
From: Filip Brozovic @ 2015-03-28 16:59 UTC (permalink / raw)
  To: scottwood; +Cc: galak, benh, linuxppc-dev, linux-kernel, Filip Brozovic

Add chip specific initialization for the MPC8306.

Signed-off-by: Filip Brozovic <fbrozovic@gmail.com>
---
 arch/powerpc/platforms/83xx/Kconfig   |  8 ++++++++
 arch/powerpc/platforms/83xx/mpc83xx.h |  4 ++++
 arch/powerpc/platforms/83xx/usb.c     | 14 +++++++++++---
 arch/powerpc/platforms/Kconfig        | 10 ++++++++++
 arch/powerpc/sysdev/qe_lib/qe.c       | 15 ++++++++++-----
 drivers/gpio/Kconfig                  |  6 +++---
 6 files changed, 46 insertions(+), 11 deletions(-)

diff --git a/arch/powerpc/platforms/83xx/Kconfig b/arch/powerpc/platforms/83xx/Kconfig
index 2bdc8c8..904991d 100644
--- a/arch/powerpc/platforms/83xx/Kconfig
+++ b/arch/powerpc/platforms/83xx/Kconfig
@@ -113,6 +113,14 @@ config KMETER1
 
 endif
 
+# used for gpio
+config PPC_MPC830x
+	bool
+	select ARCH_WANT_OPTIONAL_GPIOLIB
+
+config PPC_MPC8306
+	bool
+
 # used for usb & gpio
 config PPC_MPC831x
 	bool
diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/platforms/83xx/mpc83xx.h
index 0cf74d7..4f21fb9 100644
--- a/arch/powerpc/platforms/83xx/mpc83xx.h
+++ b/arch/powerpc/platforms/83xx/mpc83xx.h
@@ -21,6 +21,8 @@
 
 /* system i/o configuration register low */
 #define MPC83XX_SICRL_OFFS         0x114
+#define MPC8306_SICRL_USB_MASK     0x003C0000
+#define MPC8306_SICRL_USB_ULPI     0x00000000
 #define MPC834X_SICRL_USB_MASK     0x60000000
 #define MPC834X_SICRL_USB0         0x20000000
 #define MPC834X_SICRL_USB1         0x40000000
@@ -35,6 +37,8 @@
 
 /* system i/o configuration register high */
 #define MPC83XX_SICRH_OFFS         0x118
+#define MPC8306_SICRH_USB_MASK     0x0F00F300
+#define MPC8306_SICRH_USB_ULPI     0x00000000
 #define MPC8308_SICRH_USB_MASK     0x000c0000
 #define MPC8308_SICRH_USB_ULPI     0x00040000
 #define MPC834X_SICRH_USB_UTMI     0x00020000
diff --git a/arch/powerpc/platforms/83xx/usb.c b/arch/powerpc/platforms/83xx/usb.c
index 5c31d82..a9db44b 100644
--- a/arch/powerpc/platforms/83xx/usb.c
+++ b/arch/powerpc/platforms/83xx/usb.c
@@ -99,7 +99,7 @@ int mpc834x_usb_cfg(void)
 }
 #endif /* CONFIG_PPC_MPC834x */
 
-#ifdef CONFIG_PPC_MPC831x
+#if defined(CONFIG_PPC_MPC8306) || defined(CONFIG_PPC_MPC831x)
 int mpc831x_usb_cfg(void)
 {
 	u32 temp;
@@ -128,6 +128,7 @@ int mpc831x_usb_cfg(void)
 	/* Configure clock */
 	immr_node = of_get_parent(np);
 	if (immr_node && (of_device_is_compatible(immr_node, "fsl,mpc8315-immr") ||
+			of_device_is_compatible(immr_node, "fsl,mpc8306-immr") ||
 			of_device_is_compatible(immr_node, "fsl,mpc8308-immr")))
 		clrsetbits_be32(immap + MPC83XX_SCCR_OFFS,
 		                MPC8315_SCCR_USB_MASK,
@@ -139,7 +140,14 @@ int mpc831x_usb_cfg(void)
 
 	/* Configure pin mux for ULPI.  There is no pin mux for UTMI */
 	if (prop && !strcmp(prop, "ulpi")) {
-		if (of_device_is_compatible(immr_node, "fsl,mpc8308-immr")) {
+		if (of_device_is_compatible(immr_node, "fsl,mpc8306-immr")) {
+			clrsetbits_be32(immap + MPC83XX_SICRL_OFFS,
+					MPC8306_SICRL_USB_MASK,
+					MPC8306_SICRL_USB_ULPI);
+			clrsetbits_be32(immap + MPC83XX_SICRH_OFFS,
+					MPC8306_SICRH_USB_MASK,
+					MPC8306_SICRH_USB_ULPI);
+		} else if (of_device_is_compatible(immr_node, "fsl,mpc8308-immr")) {
 			clrsetbits_be32(immap + MPC83XX_SICRH_OFFS,
 					MPC8308_SICRH_USB_MASK,
 					MPC8308_SICRH_USB_ULPI);
@@ -210,7 +218,7 @@ out:
 	of_node_put(np);
 	return ret;
 }
-#endif /* CONFIG_PPC_MPC831x */
+#endif /* CONFIG_PPC_MPC8306 || CONFIG_PPC_MPC831x */
 
 #ifdef CONFIG_PPC_MPC837x
 int mpc837x_usb_cfg(void)
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 391b3f6..ecb7cad 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -296,6 +296,16 @@ config QE_GPIO
 	  Say Y here if you're going to use hardware that connects to the
 	  QE GPIOs.
 
+config QE_8306
+	bool "MPC8306 QE support"
+	depends on QUICC_ENGINE
+	default y if PPC_MPC8306
+	help
+	  The QUICC Engine in the MPC8306 does not support all SNUM threads.
+
+	  Say Y here only if you wish to build a kernel for a machine with an
+	  MPC8306.
+
 config CPM2
 	bool "Enable support for the CPM2 (Communications Processor Module)"
 	depends on (FSL_SOC_BOOKE && PPC32) || 8260
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index c2518cd..f967ff6 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -278,12 +278,17 @@ static void qe_snums_init(void)
 		0xF4, 0xF5, 0xFC, 0xFD,
 	};
 	static const u8 snum_init_46[] = {
+#if !defined(CONFIG_QE_8306)
 		0x04, 0x05, 0x0C, 0x0D, 0x14, 0x15, 0x1C, 0x1D,
-		0x24, 0x25, 0x2C, 0x2D, 0x34, 0x35, 0x88, 0x89,
-		0x98, 0x99, 0xA8, 0xA9, 0xB8, 0xB9, 0xC8, 0xC9,
-		0xD8, 0xD9, 0xE8, 0xE9, 0x08, 0x09, 0x18, 0x19,
-		0x28, 0x29, 0x38, 0x39, 0x48, 0x49, 0x58, 0x59,
-		0x68, 0x69, 0x78, 0x79, 0x80, 0x81,
+		0x24, 0x25, 0x2C, 0x2D, 0x34, 0x35,
+#endif
+		0x88, 0x89, 0x98, 0x99, 0xA8, 0xA9, 0xB8, 0xB9,
+		0xC8, 0xC9, 0xD8, 0xD9, 0xE8, 0xE9,
+#if !defined(CONFIG_QE_8306)
+		0x08, 0x09, 0x18, 0x19, 0x28, 0x29, 0x38, 0x39,
+		0x48, 0x49, 0x58, 0x59, 0x68, 0x69, 0x78, 0x79,
+		0x80, 0x81,
+#endif
 	};
 	static const u8 *snum_init;
 
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index c1e2ca3..4c60e7f 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -217,11 +217,11 @@ config GPIO_MPC5200
 
 config GPIO_MPC8XXX
 	bool "MPC512x/MPC8xxx GPIO support"
-	depends on PPC_MPC512x || PPC_MPC831x || PPC_MPC834x || PPC_MPC837x || \
-		   FSL_SOC_BOOKE || PPC_86xx
+	depends on PPC_MPC512x || PPC_MPC830x || PPC_MPC831x || PPC_MPC834x || \
+		   PPC_MPC837x || FSL_SOC_BOOKE || PPC_86xx
 	help
 	  Say Y here if you're going to use hardware that connects to the
-	  MPC512x/831x/834x/837x/8572/8610 GPIOs.
+	  MPC512x/830x/831x/834x/837x/8572/8610 GPIOs.
 
 config GPIO_MSM_V1
 	tristate "Qualcomm MSM GPIO v1"
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/83xx: add support for mpc8306
  2015-03-28 16:59 [PATCH] powerpc/83xx: add support for mpc8306 Filip Brozovic
@ 2015-03-31 17:54 ` Scott Wood
  2015-03-31 19:58   ` Filip Brozović
  0 siblings, 1 reply; 4+ messages in thread
From: Scott Wood @ 2015-03-31 17:54 UTC (permalink / raw)
  To: Filip Brozovic; +Cc: galak, benh, linuxppc-dev, linux-kernel

On Sat, 2015-03-28 at 17:59 +0100, Filip Brozovic wrote:
> diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
> index c2518cd..f967ff6 100644
> --- a/arch/powerpc/sysdev/qe_lib/qe.c
> +++ b/arch/powerpc/sysdev/qe_lib/qe.c
> @@ -278,12 +278,17 @@ static void qe_snums_init(void)
>  		0xF4, 0xF5, 0xFC, 0xFD,
>  	};
>  	static const u8 snum_init_46[] = {
> +#if !defined(CONFIG_QE_8306)
>  		0x04, 0x05, 0x0C, 0x0D, 0x14, 0x15, 0x1C, 0x1D,
> -		0x24, 0x25, 0x2C, 0x2D, 0x34, 0x35, 0x88, 0x89,
> -		0x98, 0x99, 0xA8, 0xA9, 0xB8, 0xB9, 0xC8, 0xC9,
> -		0xD8, 0xD9, 0xE8, 0xE9, 0x08, 0x09, 0x18, 0x19,
> -		0x28, 0x29, 0x38, 0x39, 0x48, 0x49, 0x58, 0x59,
> -		0x68, 0x69, 0x78, 0x79, 0x80, 0x81,
> +		0x24, 0x25, 0x2C, 0x2D, 0x34, 0x35,
> +#endif
> +		0x88, 0x89, 0x98, 0x99, 0xA8, 0xA9, 0xB8, 0xB9,
> +		0xC8, 0xC9, 0xD8, 0xD9, 0xE8, 0xE9,
> +#if !defined(CONFIG_QE_8306)
> +		0x08, 0x09, 0x18, 0x19, 0x28, 0x29, 0x38, 0x39,
> +		0x48, 0x49, 0x58, 0x59, 0x68, 0x69, 0x78, 0x79,
> +		0x80, 0x81,
> +#endif
>  	};
>  	static const u8 *snum_init;

This breaks multiplatform support.  You need to determine this at
runtime.

-Scott



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/83xx: add support for mpc8306
  2015-03-31 17:54 ` Scott Wood
@ 2015-03-31 19:58   ` Filip Brozović
  2015-04-02 23:50     ` Scott Wood
  0 siblings, 1 reply; 4+ messages in thread
From: Filip Brozović @ 2015-03-31 19:58 UTC (permalink / raw)
  To: Scott Wood; +Cc: galak, benh, linuxppc-dev, linux-kernel

On 3/31/2015 7:54 PM, Scott Wood wrote:
> This breaks multiplatform support.  You need to determine this at
> runtime.

Understood, but I'm unsure of how to do this exactly. Would it be 
appropriate to define another array, snum_init_14, with the SNUM values 
for the MPC8306 QE, change the minimum number of SNUMs in 
qe_get_num_of_snums() to 14 and set the correct values this way? In that 
case, compatibility with other platforms would be kept intact, and the 
QE device tree node for MPC8306 (and MPC8309) boards would just have to 
have the fsl,qe-num-snums property set to 14 in order for the driver to 
set the correct values.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/83xx: add support for mpc8306
  2015-03-31 19:58   ` Filip Brozović
@ 2015-04-02 23:50     ` Scott Wood
  0 siblings, 0 replies; 4+ messages in thread
From: Scott Wood @ 2015-04-02 23:50 UTC (permalink / raw)
  To: Filip Brozović; +Cc: galak, benh, linuxppc-dev, linux-kernel

On Tue, 2015-03-31 at 21:58 +0200, Filip Brozović wrote:
> On 3/31/2015 7:54 PM, Scott Wood wrote:
> > This breaks multiplatform support.  You need to determine this at
> > runtime.
> 
> Understood, but I'm unsure of how to do this exactly. Would it be 
> appropriate to define another array, snum_init_14, with the SNUM values 
> for the MPC8306 QE, change the minimum number of SNUMs in 
> qe_get_num_of_snums() to 14 and set the correct values this way? In that 
> case, compatibility with other platforms would be kept intact, and the 
> QE device tree node for MPC8306 (and MPC8309) boards would just have to 
> have the fsl,qe-num-snums property set to 14 in order for the driver to 
> set the correct values.

Yes.

-Scott



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-04-02 23:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-28 16:59 [PATCH] powerpc/83xx: add support for mpc8306 Filip Brozovic
2015-03-31 17:54 ` Scott Wood
2015-03-31 19:58   ` Filip Brozović
2015-04-02 23:50     ` Scott Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).