Subject: Axon DCR support From: Shaun Wetzstein Enable access to the Axon DCR space. Signed-off-by: Shaun Wetzstein Signed-off-by: Murali Iyer Signed-off-by: Arnd Bergmann Index: linus-2.6/include/asm-powerpc/axon_dcr.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ linus-2.6/include/asm-powerpc/axon_dcr.h 2006-04-21 20:32:07.000000000 +0200 @@ -0,0 +1,44 @@ +/* + * Axon Southbridge support + * + * (C) Copyright IBM Corp. 2006 + * + * Author: Shaun Wetzstein + * + * 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, 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _ASM_POWERPC_AXON_DCR_H +#define _ASM_POWERPC_AXON_DCR_H +#ifdef __KERNEL__ + +#include + +#ifdef CONFIG_AXON_DCR +extern __iomem __be32 * axon_dcr_base; + +static inline unsigned int mfdcr(unsigned int n) +{ + return in_be32(axon_dcr_base + n * 4); +} + +static inline void mtdcr(unsigned int n, unsigned int val) +{ + out_be32(axon_dcr_base + n * 4, val); +} +#endif + +#endif /* __KERNEL__ */ +#endif /* _ASM_POWERPC_AXON_DCR_H */ Index: linus-2.6/arch/powerpc/Kconfig =================================================================== --- linus-2.6.orig/arch/powerpc/Kconfig 2006-04-21 20:31:25.000000000 +0200 +++ linus-2.6/arch/powerpc/Kconfig 2006-04-21 20:32:07.000000000 +0200 @@ -436,6 +436,11 @@ select PPC_OCP default y +config AXON_DCR + depends on PPC_CELL + bool "AXON South Bridge DCR Support" + default y + config IBMVIO depends on PPC_PSERIES || PPC_ISERIES bool Index: linus-2.6/arch/powerpc/platforms/cell/setup.c =================================================================== --- linus-2.6.orig/arch/powerpc/platforms/cell/setup.c 2006-04-21 20:31:57.000000000 +0200 +++ linus-2.6/arch/powerpc/platforms/cell/setup.c 2006-04-21 20:32:07.000000000 +0200 @@ -55,6 +55,7 @@ #include "iommu.h" #include "pervasive.h" #include "axon_ocp.h" +#include "axon_dcr.h" #ifdef DEBUG #define DBG(fmt...) udbg_printf(fmt) @@ -160,6 +161,7 @@ mmio_nvram_init(); axon_ocp_init(); + axon_dcr_init(); } /* Index: linus-2.6/arch/powerpc/platforms/cell/Makefile =================================================================== --- linus-2.6.orig/arch/powerpc/platforms/cell/Makefile 2006-04-21 20:31:25.000000000 +0200 +++ linus-2.6/arch/powerpc/platforms/cell/Makefile 2006-04-21 20:32:07.000000000 +0200 @@ -13,3 +13,4 @@ obj-y += $(spufs-builtin-y) $(spufs-builtin-m) obj-$(CONFIG_PPC_OCP) += axon_ocp.o +obj-$(CONFIG_AXON_DCR) += axon_dcr.o Index: linus-2.6/arch/powerpc/platforms/cell/axon_dcr.c =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ linus-2.6/arch/powerpc/platforms/cell/axon_dcr.c 2006-04-21 20:32:07.000000000 +0200 @@ -0,0 +1,46 @@ +/* + * arch/ppc/platforms/cell/axon_dcr.h + * + * AXON DCR access + * + * (C) Copyright IBM Corp. 2006 + * + * Shaun Wetzstein + * + * 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 +#include + +#include +#include + +#include "axon_dcr.h" + +__iomem __be32 * axon_dcr_base; +EXPORT_SYMBOL(axon_dcr_base); + +void __init axon_dcr_init() +{ + struct device_node * node; + + node = of_find_node_by_name(NULL, "dcr"); + if (node) { + unsigned long * reg; + if ((reg = (unsigned long *)get_property(node, + "reg", NULL)) != NULL) { + axon_dcr_base = ioremap(reg[0], reg[1]); + + if (!axon_dcr_base) + printk(KERN_WARNING + "Axon DCR: unable to map MMIO" + " range %lx, size %lx\n", + reg[0], reg[1]); + } + } +} Index: linus-2.6/arch/powerpc/platforms/cell/axon_dcr.h =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ linus-2.6/arch/powerpc/platforms/cell/axon_dcr.h 2006-04-21 20:32:07.000000000 +0200 @@ -0,0 +1,10 @@ +#ifndef CELL_AXON_DCR_H +#define CELL_AXON_DCR_H + +#ifdef CONFIG_AXON_DCR +extern void axon_dcr_init(void); +#else +static inline axon_dcr_init(void) {} +#endif + +#endif /* CELL_AXON_DCR_H */