linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: Add Marvell mv64x60 udbg putc/getc functions
@ 2007-05-14 19:52 Dale Farnsworth
  2007-05-15 18:55 ` Mark A. Greer
  0 siblings, 1 reply; 10+ messages in thread
From: Dale Farnsworth @ 2007-05-14 19:52 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Paul Mackerras

[PATCH] powerpc: Add Marvell mv64x60 udbg putc/getc functions

Commit 69331af, "Fixes and cleanups for earlyprintk aka boot console",
resulted in printk output prior to the initialization of the mpsc
console driver not being printed.  That commit causes the mpsc's
CON_PRINTBUFFER flag to be cleared since udbg should have printed
the previous output.

I guess we can no longer ignore udbg. :)

This patch provides udbg_putc() and udbg_getc() functions for the
Marvell mv64x60 chips. These functions are enabled if an mv64x60
port is to be used as the console as determined from the device tree.

Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
---
 arch/powerpc/platforms/embedded6xx/prpmc2800.c |    1 
 arch/powerpc/sysdev/Makefile                   |    3 
 arch/powerpc/sysdev/mv64x60.h                  |    1 
 arch/powerpc/sysdev/mv64x60_udbg.c             |  152 +++++++++++++++
 4 files changed, 156 insertions(+), 1 deletion(-)

Index: linux-2.6-powerpc-df/arch/powerpc/sysdev/mv64x60_udbg.c
===================================================================
--- /dev/null
+++ linux-2.6-powerpc-df/arch/powerpc/sysdev/mv64x60_udbg.c
@@ -0,0 +1,152 @@
+/*
+ * udbg serial input/output routines for the Marvell MV64x60 (Discovery).
+ *
+ * Author: Dale Farnsworth <dale@farnsworth.org>
+ *
+ * 2007 (c) MontaVista Software, Inc.  This file is licensed under
+ * the terms of the GNU General Public License version 2.  This program
+ * is licensed "as is" without any warranty of any kind, whether express
+ * or implied.
+ */
+
+#include <asm/io.h>
+#include <asm/prom.h>
+#include <asm/udbg.h>
+
+#include <sysdev/mv64x60.h>
+
+#define MPSC_0_CR1_OFFSET	0x000c
+
+#define MPSC_0_CR2_OFFSET	0x0010
+#define MPSC_CHR_2_TCS		(1 << 9)
+
+#define MPSC_0_CHR_10_OFFSET	0x0030
+
+#define MPSC_INTR_CAUSE_OFF_0	0x0004
+#define MPSC_INTR_CAUSE_OFF_1	0x000c
+#define MPSC_INTR_CAUSE_RCC	(1<<6)
+
+static void __iomem *mpsc_base;
+static void __iomem *mpsc_intr_cause;
+
+static void mv64x60_udbg_putc(char c)
+{
+	if (c == '\n')
+		mv64x60_udbg_putc('\r');
+
+	while(in_le32(mpsc_base + MPSC_0_CR2_OFFSET) & MPSC_CHR_2_TCS)
+		;
+	out_le32(mpsc_base + MPSC_0_CR1_OFFSET, c);
+	out_le32(mpsc_base + MPSC_0_CR2_OFFSET, MPSC_CHR_2_TCS);
+}
+
+static int mv64x60_udbg_testc(void)
+{
+	return (in_le32(mpsc_intr_cause) & MPSC_INTR_CAUSE_RCC) != 0;
+}
+
+static int mv64x60_udbg_getc(void)
+{
+	int cause = 0;
+	int c;
+
+	while (!mv64x60_udbg_testc())
+		;
+
+	c = in_8(mpsc_base + MPSC_0_CHR_10_OFFSET + 2);
+	out_8(mpsc_base + MPSC_0_CHR_10_OFFSET + 2, c);
+	out_le32(mpsc_intr_cause, cause & ~MPSC_INTR_CAUSE_RCC);
+	return c;
+}
+
+static int mv64x60_udbg_getc_poll(void)
+{
+	if (!mv64x60_udbg_testc())
+		return -1;
+
+	return mv64x60_udbg_getc();
+}
+
+static void mv64x60_udbg_init(void)
+{
+	struct device_node *np, *mpscintr, *stdout = NULL;
+	const char *path;
+	const phandle *ph;
+	struct resource r[2];
+	const int *block_index;
+	int intr_cause_offset;
+	int err;
+
+	path = of_get_property(of_chosen, "linux,stdout-path", NULL);
+	if (!path)
+		return;
+
+	stdout = of_find_node_by_path(path);
+	if (!stdout)
+		return;
+
+	for (np = NULL;
+	     (np = of_find_compatible_node(np, "serial", "marvell,mpsc")); )
+		if (np == stdout)
+			break;
+
+	of_node_put(stdout);
+	if (!np)
+		return;
+
+	block_index = of_get_property(np, "block-index", NULL);
+	if (!block_index)
+		goto error;
+
+	switch (*block_index) {
+	case 0:
+		intr_cause_offset = MPSC_INTR_CAUSE_OFF_0;
+		break;
+	case 1:
+		intr_cause_offset = MPSC_INTR_CAUSE_OFF_1;
+		break;
+	default:
+		goto error;
+	}
+
+	err = of_address_to_resource(np, 0, &r[0]);
+	if (err)
+		goto error;
+
+	ph = of_get_property(np, "mpscintr", NULL);
+	mpscintr = of_find_node_by_phandle(*ph);
+	if (!mpscintr)
+		goto error;
+
+	err = of_address_to_resource(mpscintr, 0, &r[1]);
+	of_node_put(mpscintr);
+	if (err)
+		goto error;
+
+	of_node_put(np);
+
+	mpsc_base = ioremap(r[0].start, r[0].end - r[0].start + 1);
+	if (!mpsc_base)
+		return;
+
+	mpsc_intr_cause = ioremap(r[1].start, r[1].end - r[1].start + 1);
+	if (!mpsc_intr_cause) {
+		iounmap(mpsc_base);
+		return;
+	}
+	mpsc_intr_cause += intr_cause_offset;
+
+	udbg_putc = mv64x60_udbg_putc;
+	udbg_getc = mv64x60_udbg_getc;
+	udbg_getc_poll = mv64x60_udbg_getc_poll;
+
+	return;
+
+error:
+	of_node_put(np);
+}
+
+void mv64x60_init_early(void)
+{
+	mv64x60_udbg_init();
+}
Index: linux-2.6-powerpc-df/arch/powerpc/sysdev/Makefile
===================================================================
--- linux-2.6-powerpc-df.orig/arch/powerpc/sysdev/Makefile
+++ linux-2.6-powerpc-df/arch/powerpc/sysdev/Makefile
@@ -17,7 +17,8 @@ obj-$(CONFIG_FSL_PCIE)		+= fsl_pcie.o
 obj-$(CONFIG_TSI108_BRIDGE)	+= tsi108_pci.o tsi108_dev.o
 obj-$(CONFIG_QUICC_ENGINE)	+= qe_lib/
 mv64x60-$(CONFIG_PCI)		+= mv64x60_pci.o
-obj-$(CONFIG_MV64X60)		+= $(mv64x60-y) mv64x60_pic.o mv64x60_dev.o
+obj-$(CONFIG_MV64X60)		+= $(mv64x60-y) mv64x60_pic.o mv64x60_dev.o \
+				   mv64x60_udbg.o
 
 # contains only the suspend handler for time
 obj-$(CONFIG_PM)		+= timer.o
Index: linux-2.6-powerpc-df/arch/powerpc/platforms/embedded6xx/prpmc2800.c
===================================================================
--- linux-2.6-powerpc-df.orig/arch/powerpc/platforms/embedded6xx/prpmc2800.c
+++ linux-2.6-powerpc-df/arch/powerpc/platforms/embedded6xx/prpmc2800.c
@@ -158,6 +158,7 @@ define_machine(prpmc2800){
 	.name			= prpmc2800_platform_name,
 	.probe			= prpmc2800_probe,
 	.setup_arch		= prpmc2800_setup_arch,
+	.init_early		= mv64x60_init_early,
 	.show_cpuinfo		= prpmc2800_show_cpuinfo,
 	.init_IRQ		= mv64x60_init_irq,
 	.get_irq		= mv64x60_get_irq,
Index: linux-2.6-powerpc-df/arch/powerpc/sysdev/mv64x60.h
===================================================================
--- linux-2.6-powerpc-df.orig/arch/powerpc/sysdev/mv64x60.h
+++ linux-2.6-powerpc-df/arch/powerpc/sysdev/mv64x60.h
@@ -7,5 +7,6 @@ extern void __init mv64x60_init_irq(void
 extern unsigned int mv64x60_get_irq(void);
 
 extern void __init mv64x60_pci_init(void);
+extern void __init mv64x60_init_early(void);
 
 #endif /* __MV64X60_H__ */

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

* Re: [PATCH] powerpc: Add Marvell mv64x60 udbg putc/getc functions
  2007-05-14 19:52 Dale Farnsworth
@ 2007-05-15 18:55 ` Mark A. Greer
  0 siblings, 0 replies; 10+ messages in thread
From: Mark A. Greer @ 2007-05-15 18:55 UTC (permalink / raw)
  To: Dale Farnsworth; +Cc: linuxppc-dev, Paul Mackerras

On Mon, May 14, 2007 at 12:52:22PM -0700, Dale Farnsworth wrote:
> [PATCH] powerpc: Add Marvell mv64x60 udbg putc/getc functions
> 
> Commit 69331af, "Fixes and cleanups for earlyprintk aka boot console",
> resulted in printk output prior to the initialization of the mpsc
> console driver not being printed.  That commit causes the mpsc's
> CON_PRINTBUFFER flag to be cleared since udbg should have printed
> the previous output.
> 
> I guess we can no longer ignore udbg. :)
> 
> This patch provides udbg_putc() and udbg_getc() functions for the
> Marvell mv64x60 chips. These functions are enabled if an mv64x60
> port is to be used as the console as determined from the device tree.
> 
> Signed-off-by: Dale Farnsworth <dale@farnsworth.org>

Acked-by: Mark A. Greer <mgreer@mvista.com>

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

* [PATCH] powerpc: Add Marvell mv64x60 udbg putc/getc functions
@ 2007-05-23 22:05 Dale Farnsworth
  2007-05-23 23:27 ` Olof Johansson
  2007-06-06  6:06 ` Paul Mackerras
  0 siblings, 2 replies; 10+ messages in thread
From: Dale Farnsworth @ 2007-05-23 22:05 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

Currently, when the Marvell mpsc driver is used as console,
any console output that occurs before the Marvell mpsc driver
is initialized is discarded by the udbg console.

This patch resolves that issue by providing udbg_putc() and
udbg_getc() functions for the Marvell mv64x60 chips. These functions
are enabled if an mv64x60 port is to be used as the console as
determined from the device tree.

Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
Acked-by: Mark A. Greer <mgreer@mvista.com>
---

Paul, this patch is unchanged from the one I posted 10 days ago.
At that time, I saw no discussion, other than Mark's ACK.  I'd 
argue that this is a bugfix, and hope that it could go into 2.6.22.

Thanks.

-Dale

 arch/powerpc/platforms/embedded6xx/prpmc2800.c |    1 
 arch/powerpc/sysdev/Makefile                   |    3 
 arch/powerpc/sysdev/mv64x60.h                  |    1 
 arch/powerpc/sysdev/mv64x60_udbg.c             |  152 +++++++++++++++
 4 files changed, 156 insertions(+), 1 deletion(-)

Index: linux-2.6-powerpc-df/arch/powerpc/sysdev/mv64x60_udbg.c
===================================================================
--- /dev/null
+++ linux-2.6-powerpc-df/arch/powerpc/sysdev/mv64x60_udbg.c
@@ -0,0 +1,152 @@
+/*
+ * udbg serial input/output routines for the Marvell MV64x60 (Discovery).
+ *
+ * Author: Dale Farnsworth <dale@farnsworth.org>
+ *
+ * 2007 (c) MontaVista Software, Inc.  This file is licensed under
+ * the terms of the GNU General Public License version 2.  This program
+ * is licensed "as is" without any warranty of any kind, whether express
+ * or implied.
+ */
+
+#include <asm/io.h>
+#include <asm/prom.h>
+#include <asm/udbg.h>
+
+#include <sysdev/mv64x60.h>
+
+#define MPSC_0_CR1_OFFSET	0x000c
+
+#define MPSC_0_CR2_OFFSET	0x0010
+#define MPSC_CHR_2_TCS		(1 << 9)
+
+#define MPSC_0_CHR_10_OFFSET	0x0030
+
+#define MPSC_INTR_CAUSE_OFF_0	0x0004
+#define MPSC_INTR_CAUSE_OFF_1	0x000c
+#define MPSC_INTR_CAUSE_RCC	(1<<6)
+
+static void __iomem *mpsc_base;
+static void __iomem *mpsc_intr_cause;
+
+static void mv64x60_udbg_putc(char c)
+{
+	if (c == '\n')
+		mv64x60_udbg_putc('\r');
+
+	while(in_le32(mpsc_base + MPSC_0_CR2_OFFSET) & MPSC_CHR_2_TCS)
+		;
+	out_le32(mpsc_base + MPSC_0_CR1_OFFSET, c);
+	out_le32(mpsc_base + MPSC_0_CR2_OFFSET, MPSC_CHR_2_TCS);
+}
+
+static int mv64x60_udbg_testc(void)
+{
+	return (in_le32(mpsc_intr_cause) & MPSC_INTR_CAUSE_RCC) != 0;
+}
+
+static int mv64x60_udbg_getc(void)
+{
+	int cause = 0;
+	int c;
+
+	while (!mv64x60_udbg_testc())
+		;
+
+	c = in_8(mpsc_base + MPSC_0_CHR_10_OFFSET + 2);
+	out_8(mpsc_base + MPSC_0_CHR_10_OFFSET + 2, c);
+	out_le32(mpsc_intr_cause, cause & ~MPSC_INTR_CAUSE_RCC);
+	return c;
+}
+
+static int mv64x60_udbg_getc_poll(void)
+{
+	if (!mv64x60_udbg_testc())
+		return -1;
+
+	return mv64x60_udbg_getc();
+}
+
+static void mv64x60_udbg_init(void)
+{
+	struct device_node *np, *mpscintr, *stdout = NULL;
+	const char *path;
+	const phandle *ph;
+	struct resource r[2];
+	const int *block_index;
+	int intr_cause_offset;
+	int err;
+
+	path = of_get_property(of_chosen, "linux,stdout-path", NULL);
+	if (!path)
+		return;
+
+	stdout = of_find_node_by_path(path);
+	if (!stdout)
+		return;
+
+	for (np = NULL;
+	     (np = of_find_compatible_node(np, "serial", "marvell,mpsc")); )
+		if (np == stdout)
+			break;
+
+	of_node_put(stdout);
+	if (!np)
+		return;
+
+	block_index = of_get_property(np, "block-index", NULL);
+	if (!block_index)
+		goto error;
+
+	switch (*block_index) {
+	case 0:
+		intr_cause_offset = MPSC_INTR_CAUSE_OFF_0;
+		break;
+	case 1:
+		intr_cause_offset = MPSC_INTR_CAUSE_OFF_1;
+		break;
+	default:
+		goto error;
+	}
+
+	err = of_address_to_resource(np, 0, &r[0]);
+	if (err)
+		goto error;
+
+	ph = of_get_property(np, "mpscintr", NULL);
+	mpscintr = of_find_node_by_phandle(*ph);
+	if (!mpscintr)
+		goto error;
+
+	err = of_address_to_resource(mpscintr, 0, &r[1]);
+	of_node_put(mpscintr);
+	if (err)
+		goto error;
+
+	of_node_put(np);
+
+	mpsc_base = ioremap(r[0].start, r[0].end - r[0].start + 1);
+	if (!mpsc_base)
+		return;
+
+	mpsc_intr_cause = ioremap(r[1].start, r[1].end - r[1].start + 1);
+	if (!mpsc_intr_cause) {
+		iounmap(mpsc_base);
+		return;
+	}
+	mpsc_intr_cause += intr_cause_offset;
+
+	udbg_putc = mv64x60_udbg_putc;
+	udbg_getc = mv64x60_udbg_getc;
+	udbg_getc_poll = mv64x60_udbg_getc_poll;
+
+	return;
+
+error:
+	of_node_put(np);
+}
+
+void mv64x60_init_early(void)
+{
+	mv64x60_udbg_init();
+}
Index: linux-2.6-powerpc-df/arch/powerpc/sysdev/Makefile
===================================================================
--- linux-2.6-powerpc-df.orig/arch/powerpc/sysdev/Makefile
+++ linux-2.6-powerpc-df/arch/powerpc/sysdev/Makefile
@@ -17,7 +17,8 @@ obj-$(CONFIG_FSL_PCIE)		+= fsl_pcie.o
 obj-$(CONFIG_TSI108_BRIDGE)	+= tsi108_pci.o tsi108_dev.o
 obj-$(CONFIG_QUICC_ENGINE)	+= qe_lib/
 mv64x60-$(CONFIG_PCI)		+= mv64x60_pci.o
-obj-$(CONFIG_MV64X60)		+= $(mv64x60-y) mv64x60_pic.o mv64x60_dev.o
+obj-$(CONFIG_MV64X60)		+= $(mv64x60-y) mv64x60_pic.o mv64x60_dev.o \
+				   mv64x60_udbg.o
 
 # contains only the suspend handler for time
 obj-$(CONFIG_PM)		+= timer.o
Index: linux-2.6-powerpc-df/arch/powerpc/platforms/embedded6xx/prpmc2800.c
===================================================================
--- linux-2.6-powerpc-df.orig/arch/powerpc/platforms/embedded6xx/prpmc2800.c
+++ linux-2.6-powerpc-df/arch/powerpc/platforms/embedded6xx/prpmc2800.c
@@ -158,6 +158,7 @@ define_machine(prpmc2800){
 	.name			= prpmc2800_platform_name,
 	.probe			= prpmc2800_probe,
 	.setup_arch		= prpmc2800_setup_arch,
+	.init_early		= mv64x60_init_early,
 	.show_cpuinfo		= prpmc2800_show_cpuinfo,
 	.init_IRQ		= mv64x60_init_irq,
 	.get_irq		= mv64x60_get_irq,
Index: linux-2.6-powerpc-df/arch/powerpc/sysdev/mv64x60.h
===================================================================
--- linux-2.6-powerpc-df.orig/arch/powerpc/sysdev/mv64x60.h
+++ linux-2.6-powerpc-df/arch/powerpc/sysdev/mv64x60.h
@@ -7,5 +7,6 @@ extern void __init mv64x60_init_irq(void
 extern unsigned int mv64x60_get_irq(void);
 
 extern void __init mv64x60_pci_init(void);
+extern void __init mv64x60_init_early(void);
 
 #endif /* __MV64X60_H__ */

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

* Re: [PATCH] powerpc: Add Marvell mv64x60 udbg putc/getc functions
  2007-05-23 22:05 [PATCH] powerpc: Add Marvell mv64x60 udbg putc/getc functions Dale Farnsworth
@ 2007-05-23 23:27 ` Olof Johansson
  2007-05-24  0:02   ` Dale Farnsworth
  2007-06-06  6:06 ` Paul Mackerras
  1 sibling, 1 reply; 10+ messages in thread
From: Olof Johansson @ 2007-05-23 23:27 UTC (permalink / raw)
  To: Dale Farnsworth; +Cc: linuxppc-dev, Paul Mackerras

On Wed, May 23, 2007 at 03:05:18PM -0700, Dale Farnsworth wrote:

>  arch/powerpc/platforms/embedded6xx/prpmc2800.c |    1 
>  arch/powerpc/sysdev/Makefile                   |    3 
>  arch/powerpc/sysdev/mv64x60.h                  |    1 
>  arch/powerpc/sysdev/mv64x60_udbg.c             |  152 +++++++++++++++
>  4 files changed, 156 insertions(+), 1 deletion(-)

Is there a reason you're not putting it with the other udbg code, and
not naming it with the same scheme (kernel/udbg_<xxx>)?

Or maybe we should just move the udbg_16550 code to sysdev instead, it's
roots are from ppc64 where we didn't have sysdev.


-Olof

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

* Re: [PATCH] powerpc: Add Marvell mv64x60 udbg putc/getc functions
  2007-05-23 23:27 ` Olof Johansson
@ 2007-05-24  0:02   ` Dale Farnsworth
  2007-05-24  1:53     ` Olof Johansson
  0 siblings, 1 reply; 10+ messages in thread
From: Dale Farnsworth @ 2007-05-24  0:02 UTC (permalink / raw)
  To: Olof Johansson; +Cc: Paul Mackerras, linuxppc-dev

On Wed, May 23, 2007 at 06:27:45PM -0500, Olof Johansson wrote:
> On Wed, May 23, 2007 at 03:05:18PM -0700, Dale Farnsworth wrote:
> 
> >  arch/powerpc/platforms/embedded6xx/prpmc2800.c |    1 
> >  arch/powerpc/sysdev/Makefile                   |    3 
> >  arch/powerpc/sysdev/mv64x60.h                  |    1 
> >  arch/powerpc/sysdev/mv64x60_udbg.c             |  152 +++++++++++++++
> >  4 files changed, 156 insertions(+), 1 deletion(-)
> 
> Is there a reason you're not putting it with the other udbg code, and
> not naming it with the same scheme (kernel/udbg_<xxx>)?

Not really.  I just put it with some other mv64x60 code.

> Or maybe we should just move the udbg_16550 code to sysdev instead, it's
> roots are from ppc64 where we didn't have sysdev.

Shrug.

-Dale

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

* Re: [PATCH] powerpc: Add Marvell mv64x60 udbg putc/getc functions
  2007-05-24  0:02   ` Dale Farnsworth
@ 2007-05-24  1:53     ` Olof Johansson
  0 siblings, 0 replies; 10+ messages in thread
From: Olof Johansson @ 2007-05-24  1:53 UTC (permalink / raw)
  To: Dale Farnsworth; +Cc: linuxppc-dev, Paul Mackerras

On Wed, May 23, 2007 at 05:02:37PM -0700, Dale Farnsworth wrote:
> On Wed, May 23, 2007 at 06:27:45PM -0500, Olof Johansson wrote:
> > On Wed, May 23, 2007 at 03:05:18PM -0700, Dale Farnsworth wrote:
> > 
> > >  arch/powerpc/platforms/embedded6xx/prpmc2800.c |    1 
> > >  arch/powerpc/sysdev/Makefile                   |    3 
> > >  arch/powerpc/sysdev/mv64x60.h                  |    1 
> > >  arch/powerpc/sysdev/mv64x60_udbg.c             |  152 +++++++++++++++
> > >  4 files changed, 156 insertions(+), 1 deletion(-)
> > 
> > Is there a reason you're not putting it with the other udbg code, and
> > not naming it with the same scheme (kernel/udbg_<xxx>)?
> 
> Not really.  I just put it with some other mv64x60 code.
> 
> > Or maybe we should just move the udbg_16550 code to sysdev instead, it's
> > roots are from ppc64 where we didn't have sysdev.
> 
> Shrug.

Yeah, shrug. :)  This shouldn't stop this from going in, it just made
me realize that we should probably move the 16550 stuff.


-Olof

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

* Re: [PATCH] powerpc: Add Marvell mv64x60 udbg putc/getc functions
  2007-05-23 22:05 [PATCH] powerpc: Add Marvell mv64x60 udbg putc/getc functions Dale Farnsworth
  2007-05-23 23:27 ` Olof Johansson
@ 2007-06-06  6:06 ` Paul Mackerras
  2007-06-06 17:29   ` Dale Farnsworth
  1 sibling, 1 reply; 10+ messages in thread
From: Paul Mackerras @ 2007-06-06  6:06 UTC (permalink / raw)
  To: Dale Farnsworth; +Cc: linuxppc-dev

Dale Farnsworth writes:

> Paul, this patch is unchanged from the one I posted 10 days ago.
> At that time, I saw no discussion, other than Mark's ACK.  I'd 
> argue that this is a bugfix, and hope that it could go into 2.6.22.

Um, it seems rather large, and in particular adds a fair bit of
completely new code.  Is there a simpler way of getting to an
acceptable point - e.g. just not use the udbg console on these boards?
If we don't have udbg support for them then the udbg console would
seem a bit pointless, no?

Paul.

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

* Re: [PATCH] powerpc: Add Marvell mv64x60 udbg putc/getc functions
  2007-06-06  6:06 ` Paul Mackerras
@ 2007-06-06 17:29   ` Dale Farnsworth
  2007-06-08  2:15     ` Michael Ellerman
  0 siblings, 1 reply; 10+ messages in thread
From: Dale Farnsworth @ 2007-06-06 17:29 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

On Wed, Jun 06, 2007 at 04:06:05PM +1000, Paul Mackerras wrote:
> Dale Farnsworth writes:
> 
> > Paul, this patch is unchanged from the one I posted 10 days ago.
> > At that time, I saw no discussion, other than Mark's ACK.  I'd 
> > argue that this is a bugfix, and hope that it could go into 2.6.22.
> 
> Um, it seems rather large, and in particular adds a fair bit of
> completely new code.  Is there a simpler way of getting to an
> acceptable point - e.g. just not use the udbg console on these boards?

Yeah, that was the first approach I took.  Unfortunately, currently the
udbg console is included unconditionally on arch/powerpc.  I created the
patch below to conditionalize the use of udbg console.  I thought it a
bit risky for 2.6.22, but I think it's the right approach long term.

> If we don't have udbg support for them then the udbg console would
> seem a bit pointless, no?

There is value in that with the udbg console we do see console output
much earlier.  While there's some new code (I didn't think it was all
that much), the impact is limited to the single platform now using the
mv64x60 console port, the prpmc2800.

-Dale

---------------- begin patch ------------------------
[POWERPC] Make the use of the udbg console conditional

Create a new config variable: PPC_UDBG and make the inclusion
of the udbg console dependent on it.

Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
---
 arch/powerpc/Kconfig                    |    4 ++++
 arch/powerpc/Kconfig.debug              |    1 +
 arch/powerpc/kernel/Makefile            |    3 ++-
 arch/powerpc/platforms/Kconfig          |    2 ++
 arch/powerpc/platforms/iseries/Kconfig  |    1 +
 arch/powerpc/platforms/powermac/Kconfig |    1 +
 include/asm-powerpc/udbg.h              |    9 +++++++++
 7 files changed, 20 insertions(+), 1 deletion(-)

Index: linux-2.6-powerpc-df/arch/powerpc/Kconfig
===================================================================
--- linux-2.6-powerpc-df.orig/arch/powerpc/Kconfig
+++ linux-2.6-powerpc-df/arch/powerpc/Kconfig
@@ -99,9 +99,13 @@ config ARCH_MAY_HAVE_PC_FDC
 config PPC_OF
 	def_bool y
 
+config PPC_UDBG
+	bool
+
 config PPC_UDBG_16550
 	bool
+	select PPC_UDBG
 	default n
 
 config GENERIC_TBSYNC
 	bool
Index: linux-2.6-powerpc-df/arch/powerpc/Kconfig.debug
===================================================================
--- linux-2.6-powerpc-df.orig/arch/powerpc/Kconfig.debug
+++ linux-2.6-powerpc-df/arch/powerpc/Kconfig.debug
@@ -135,6 +135,7 @@ config BDI_SWITCH
 config BOOTX_TEXT
 	bool "Support for early boot text console (BootX or OpenFirmware only)"
 	depends PPC_OF
+	select PPC_UDBG
 	help
 	  Say Y here to see progress messages from the boot firmware in text
 	  mode. Requires either BootX or Open Firmware.
Index: linux-2.6-powerpc-df/arch/powerpc/kernel/Makefile
===================================================================
--- linux-2.6-powerpc-df.orig/arch/powerpc/kernel/Makefile
+++ linux-2.6-powerpc-df/arch/powerpc/kernel/Makefile
@@ -52,7 +52,8 @@ extra-$(CONFIG_8xx)		:= head_8xx.o
 extra-y				+= vmlinux.lds
 
 obj-y				+= time.o prom.o traps.o setup-common.o \
-				   udbg.o misc.o io.o
+				   misc.o io.o
+obj-$(CONFIG_PPC_UDBG)		+= udbg.o
 obj-$(CONFIG_PPC32)		+= entry_32.o setup_32.o misc_32.o
 obj-$(CONFIG_PPC64)		+= misc_64.o dma_64.o iommu.o
 obj-$(CONFIG_PPC_MULTIPLATFORM)	+= prom_init.o
Index: linux-2.6-powerpc-df/arch/powerpc/platforms/Kconfig
===================================================================
--- linux-2.6-powerpc-df.orig/arch/powerpc/platforms/Kconfig
+++ linux-2.6-powerpc-df/arch/powerpc/platforms/Kconfig
@@ -61,6 +61,7 @@ config UDBG_RTAS_CONSOLE
 config PPC_UDBG_BEAT
 	bool "BEAT based debug console"
 	depends on PPC_CELLEB
+	select PPC_UDBG
 	default n
 
 config XICS
@@ -87,6 +88,7 @@ config U3_DART
 
 config PPC_RTAS
 	bool
+	select PPC_UDBG
 	default n
 
 config RTAS_ERROR_LOGGING
Index: linux-2.6-powerpc-df/include/asm-powerpc/udbg.h
===================================================================
--- linux-2.6-powerpc-df.orig/include/asm-powerpc/udbg.h
+++ linux-2.6-powerpc-df/include/asm-powerpc/udbg.h
@@ -11,6 +11,8 @@
 #define _ASM_POWERPC_UDBG_H
 #ifdef __KERNEL__
 
+#ifdef CONFIG_PPC_UDBG
+
 #include <linux/compiler.h>
 #include <linux/init.h>
 
@@ -49,5 +51,12 @@ extern void __init udbg_init_debug_beat(
 extern void __init udbg_init_btext(void);
 extern void __init udbg_init_44x_as1(void);
 
+#else
+
+#define udbg_early_init()
+#define register_early_udbg_console()
+
+#endif /* CONFIG_PPC_UDBG */
+
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_UDBG_H */
Index: linux-2.6-powerpc-df/arch/powerpc/platforms/iseries/Kconfig
===================================================================
--- linux-2.6-powerpc-df.orig/arch/powerpc/platforms/iseries/Kconfig
+++ linux-2.6-powerpc-df/arch/powerpc/platforms/iseries/Kconfig
@@ -2,6 +2,7 @@ config PPC_ISERIES
 	bool "IBM Legacy iSeries"
 	depends on PPC_MULTIPLATFORM && PPC64
 	select PPC_INDIRECT_IO
+	select PPC_UDBG
 
 menu "iSeries device drivers"
 	depends on PPC_ISERIES
Index: linux-2.6-powerpc-df/arch/powerpc/platforms/powermac/Kconfig
===================================================================
--- linux-2.6-powerpc-df.orig/arch/powerpc/platforms/powermac/Kconfig
+++ linux-2.6-powerpc-df/arch/powerpc/platforms/powermac/Kconfig
@@ -5,6 +5,7 @@ config PPC_PMAC
 	select PPC_INDIRECT_PCI if PPC32
 	select PPC_MPC106 if PPC32
 	select PPC_NATIVE
+	select PPC_UDBG
 	default y
 
 config PPC_PMAC64

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

* Re: [PATCH] powerpc: Add Marvell mv64x60 udbg putc/getc functions
  2007-06-06 17:29   ` Dale Farnsworth
@ 2007-06-08  2:15     ` Michael Ellerman
  2007-06-08 17:20       ` Dale Farnsworth
  0 siblings, 1 reply; 10+ messages in thread
From: Michael Ellerman @ 2007-06-08  2:15 UTC (permalink / raw)
  To: Dale Farnsworth; +Cc: linuxppc-dev, Paul Mackerras

[-- Attachment #1: Type: text/plain, Size: 1749 bytes --]

On Wed, 2007-06-06 at 10:29 -0700, Dale Farnsworth wrote:
> On Wed, Jun 06, 2007 at 04:06:05PM +1000, Paul Mackerras wrote:
> > Dale Farnsworth writes:
> > 
> > > Paul, this patch is unchanged from the one I posted 10 days ago.
> > > At that time, I saw no discussion, other than Mark's ACK.  I'd 
> > > argue that this is a bugfix, and hope that it could go into 2.6.22.
> > 
> > Um, it seems rather large, and in particular adds a fair bit of
> > completely new code.  Is there a simpler way of getting to an
> > acceptable point - e.g. just not use the udbg console on these boards?
> 
> Yeah, that was the first approach I took.  Unfortunately, currently the
> udbg console is included unconditionally on arch/powerpc.  I created the
> patch below to conditionalize the use of udbg console.  I thought it a
> bit risky for 2.6.22, but I think it's the right approach long term.
> 
> > If we don't have udbg support for them then the udbg console would
> > seem a bit pointless, no?
> 
> There is value in that with the udbg console we do see console output
> much earlier.  While there's some new code (I didn't think it was all
> that much), the impact is limited to the single platform now using the
> mv64x60 console port, the prpmc2800.

You don't select PPC_UDBG for any of the cell platforms, which AFAICT
means you'll break early debugging on those.

I think you should be able to do this in terms of
CONFIG_PPC_EARLY_DEBUG, which already exists.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [PATCH] powerpc: Add Marvell mv64x60 udbg putc/getc functions
  2007-06-08  2:15     ` Michael Ellerman
@ 2007-06-08 17:20       ` Dale Farnsworth
  0 siblings, 0 replies; 10+ messages in thread
From: Dale Farnsworth @ 2007-06-08 17:20 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, Paul Mackerras

On Fri, Jun 08, 2007 at 12:15:15PM +1000, Michael Ellerman wrote:
> On Wed, 2007-06-06 at 10:29 -0700, Dale Farnsworth wrote:
> > On Wed, Jun 06, 2007 at 04:06:05PM +1000, Paul Mackerras wrote:
> > > Dale Farnsworth writes:
> > > 
> > > > Paul, this patch is unchanged from the one I posted 10 days ago.
> > > > At that time, I saw no discussion, other than Mark's ACK.  I'd 
> > > > argue that this is a bugfix, and hope that it could go into 2.6.22.
> > > 
> > > Um, it seems rather large, and in particular adds a fair bit of
> > > completely new code.  Is there a simpler way of getting to an
> > > acceptable point - e.g. just not use the udbg console on these boards?
> > 
> > Yeah, that was the first approach I took.  Unfortunately, currently the
> > udbg console is included unconditionally on arch/powerpc.  I created the
> > patch below to conditionalize the use of udbg console.  I thought it a
> > bit risky for 2.6.22, but I think it's the right approach long term.
> > 
> > > If we don't have udbg support for them then the udbg console would
> > > seem a bit pointless, no?
> > 
> > There is value in that with the udbg console we do see console output
> > much earlier.  While there's some new code (I didn't think it was all
> > that much), the impact is limited to the single platform now using the
> > mv64x60 console port, the prpmc2800.
> 
> You don't select PPC_UDBG for any of the cell platforms, which AFAICT
> means you'll break early debugging on those.

Actually, I do select PPC_UDBG for PPC_IBM_CELL_BLADE (via
PPC_UDBG_16550) and for PPC_CELLEB (via PPC_UDBG_BEAT).  I couldn't
figure out which console PPC_PS3 uses, but that support is noted as
incomplete, so I didn't spend much time researching it.

Still, it's difficult to be sure I caught them all; that's why I
decided to defer the patch until the next merge window.

> I think you should be able to do this in terms of
> CONFIG_PPC_EARLY_DEBUG, which already exists.

Nope.  Many platforms use the udbg console early on without enabling
CONFIG_PPC_EARLY_DEBUG.

-Dale

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

end of thread, other threads:[~2007-06-08 17:20 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-23 22:05 [PATCH] powerpc: Add Marvell mv64x60 udbg putc/getc functions Dale Farnsworth
2007-05-23 23:27 ` Olof Johansson
2007-05-24  0:02   ` Dale Farnsworth
2007-05-24  1:53     ` Olof Johansson
2007-06-06  6:06 ` Paul Mackerras
2007-06-06 17:29   ` Dale Farnsworth
2007-06-08  2:15     ` Michael Ellerman
2007-06-08 17:20       ` Dale Farnsworth
  -- strict thread matches above, loose matches on Subject: below --
2007-05-14 19:52 Dale Farnsworth
2007-05-15 18:55 ` Mark A. Greer

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).