linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc: Generic DCR access
@ 2006-10-03  6:04 Benjamin Herrenschmidt
  2006-10-03 10:45 ` Josh Boyer
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2006-10-03  6:04 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev list

This defines new "generic" access functions for DCRs that can be used
both on platforms with hardware DCR support (4xx processors) and
platforms where the DCRs are memory mapped. The 4xx versions are
implemented inline. The memory mapped versions will be implemented
separately as platforms support for them gets added.

From: Shaun Wetzstein <shaun@us.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Index: linux-cell/include/asm-powerpc/dcr.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux-cell/include/asm-powerpc/dcr.h	2006-09-22 13:25:58.000000000 +1000
@@ -0,0 +1,56 @@
+/*
+ *   Copyright (c) International Business Machines Corp., 2006
+ *
+ *   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.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+ *   the GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program;  if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _ASM_POWERPC_DCR_H
+#define _ASM_POWERPC_DCR_H
+#ifdef __KERNEL__
+
+#include <asm/of_device.h>
+
+#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)
+inline void *dcr_find_controller(struct device_node *node)
+
+{
+	return NULL;
+}
+
+#include <asm/reg.h>
+
+inline u32 dcr_read(void *, int dcr_n)
+{
+	return mfdcr(dcr_n);
+}
+
+inline void dcr_write(void *, int dcr_n, u32 value)
+{
+	mtdcr(dcr_n, value);
+}
+#else /* for systems without mtdcr/mfdcr */
+
+/*
+    given a DCR based device node, search up the dt for the
+    "owning" dcr controller node and return its token
+*/
+extern void *dcr_find_controller(struct device_node *);
+
+extern u32 dcr_read(void *, int);
+extern void dcr_write(void *, int, u32);
+#endif
+
+#endif /* __KERNEL__ */
+#endif /* _ASM_POWERPC_DCR_H */
Index: linux-cell/arch/powerpc/Kconfig
===================================================================
--- linux-cell.orig/arch/powerpc/Kconfig	2006-09-22 13:25:56.000000000 +1000
+++ linux-cell/arch/powerpc/Kconfig	2006-09-22 13:30:25.000000000 +1000
@@ -160,9 +160,11 @@ config PPC_86xx
 
 config 40x
 	bool "AMCC 40x"
+	select PPC_DCR
 
 config 44x
 	bool "AMCC 44x"
+	select PPC_DCR
 
 config 8xx
 	bool "Freescale 8xx"
@@ -424,6 +426,7 @@ config PPC_CELL
 config PPC_CELL_NATIVE
 	bool
 	select PPC_CELL
+	select PPC_DCR
 	default n
 
 config PPC_IBM_CELL_BLADE
@@ -476,6 +479,10 @@ config MPIC_BROKEN_U3
 	depends on PPC_MAPLE
 	default y
 
+config PPC_DCR
+	bool
+	default n
+
 config IBMVIO
 	depends on PPC_PSERIES || PPC_ISERIES
 	bool

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

* Re: [PATCH] powerpc: Generic DCR access
  2006-10-03  6:04 [PATCH] powerpc: Generic DCR access Benjamin Herrenschmidt
@ 2006-10-03 10:45 ` Josh Boyer
  0 siblings, 0 replies; 2+ messages in thread
From: Josh Boyer @ 2006-10-03 10:45 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list, Paul Mackerras

On Tue, 2006-10-03 at 16:04 +1000, Benjamin Herrenschmidt wrote:
> This defines new "generic" access functions for DCRs that can be used
> both on platforms with hardware DCR support (4xx processors) and
> platforms where the DCRs are memory mapped. The 4xx versions are
> implemented inline. The memory mapped versions will be implemented
> separately as platforms support for them gets added.
> 
> From: Shaun Wetzstein <shaun@us.ibm.com>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> 
> Index: linux-cell/include/asm-powerpc/dcr.h
> ===================================================================
> --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> +++ linux-cell/include/asm-powerpc/dcr.h	2006-09-22 13:25:58.000000000 +1000
> @@ -0,0 +1,56 @@
> +/*
> + *   Copyright (c) International Business Machines Corp., 2006
> + *
> + *   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.
> + *
> + *   This program is distributed in the hope that it will be useful,
> + *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
> + *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
> + *   the GNU General Public License for more details.
> + *
> + *   You should have received a copy of the GNU General Public License
> + *   along with this program;  if not, write to the Free Software
> + *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
> + */
> +
> +#ifndef _ASM_POWERPC_DCR_H
> +#define _ASM_POWERPC_DCR_H
> +#ifdef __KERNEL__
> +
> +#include <asm/of_device.h>
> +
> +#if defined(CONFIG_40x) || defined(CONFIG_BOOKE)

I think this should be #if defined(CONFIG_40x) ||  defined(CONFIG_44x).
Or even just #ifdef CONFIG_4xx.  CONFIG_BOOKE also gets set for things
like e500, but those don't have DCRs.

josh

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

end of thread, other threads:[~2006-10-03 10:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-03  6:04 [PATCH] powerpc: Generic DCR access Benjamin Herrenschmidt
2006-10-03 10:45 ` Josh Boyer

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