* dtc: Reinstate full old-style reference-to-path for v0 dts files
From: David Gibson @ 2007-12-07 3:38 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev
Commit 7c44c2f9cb1cc2df7aacd13decfc4e64b73d1730 broke backwards
compatibility more badly than I realised. Contrary to what I thought
there are in-kernel, in-use dts files which relied on
references-to-path with paths including a comma, which no longer
compile after that commit.
So, this patch reinstates full support for bare references-to-path in
dts-v0 input. This means there will be some rather surprising lexical
corner cases when using path-expanded references in v0 files. But,
since path-expanded references are new, v0 files shouldn't typically
be using them anyway. If the corner cases cause a problem, you can
always convert to dts-v1 which handles the lexical issues here more
nicely.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Index: dtc/dtc-lexer.l
===================================================================
--- dtc.orig/dtc-lexer.l 2007-12-07 14:22:19.000000000 +1100
+++ dtc/dtc-lexer.l 2007-12-07 14:32:04.000000000 +1100
@@ -27,7 +27,6 @@
PROPNODECHAR [a-zA-Z0-9,._+*#?@-]
PATHCHAR ({PROPNODECHAR}|[/])
-LEGACYPATHCHAR [a-zA-Z0-9_@/]
LABEL [a-zA-Z_][a-zA-Z0-9_]*
%{
@@ -158,7 +157,7 @@ static int dts_version; /* = 0 */
return DT_REF;
}
-<INITIAL>"&/"{LEGACYPATHCHAR}+ { /* old-style path reference */
+<INITIAL>"&/"{PATHCHAR}+ { /* old-style path reference */
yylloc.filenum = srcpos_filenum;
yylloc.first_line = yylineno;
DPRINT("Ref: %s\n", yytext+1);
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* Re: [PATCH 23/25] powerpc: Rework 4xx clock probing in boot wrapper
From: Josh Boyer @ 2007-12-07 3:27 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <20071206080133.D24A9DE136@ozlabs.org>
On Thu, 06 Dec 2007 19:00:22 +1100
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> Index: linux-work/arch/powerpc/boot/reg.h
> ===================================================================
> --- linux-work.orig/arch/powerpc/boot/reg.h 2007-12-03 14:26:09.000000000 +1100
> +++ linux-work/arch/powerpc/boot/reg.h 2007-12-03 14:26:09.000000000 +1100
> @@ -24,6 +24,14 @@ static inline u32 mfpvr(void)
> : "=r" (rval)); rval; })
> #define mtspr(rn, v) asm volatile("mtspr " __stringify(rn) ",%0" : : "r" (v))
>
> +#define __stringify_1(x) #x
> +#define __stringify(x) __stringify_1(x)
> +
> +#define mfspr(rn) ({unsigned long rval; \
> + asm volatile("mfspr %0," __stringify(rn) \
> + : "=r" (rval)); rval; })
> +#define mtspr(rn, v) asm volatile("mtspr " __stringify(rn) ",%0" : : "r" (v))
> +
You felt like duplicating this? It was added in the previous patch. :)
josh
^ permalink raw reply
* Re: [PATCH 21/25] powerpc: Adds decoding of 440SPE memory size to boot wrapper library
From: Josh Boyer @ 2007-12-07 3:22 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <20071206080132.0CCE9DE109@ozlabs.org>
On Thu, 06 Dec 2007 19:00:20 +1100
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> This adds a function to the bootwrapper 4xx library to decode memory
> size on 440SPE processors.
Why did you rename the fixup_memsize function? Could you add that to
the changelog, and perhaps a bit about adding the SDRAM0_{READ,WRITE}
macros.
josh
^ permalink raw reply
* Re: [PATCH 19/25] powerpc: Wire up PCI on Bamboo board
From: Josh Boyer @ 2007-12-07 3:19 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <20071206080130.2B29FDE0BA@ozlabs.org>
On Thu, 06 Dec 2007 19:00:19 +1100
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> This adds the device-tree bits & call to ppc4xx_pci_find_bridges()
> to make PCI work on the Bamboo board
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>
> arch/powerpc/boot/dts/bamboo.dts | 40 ++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 39 insertions(+), 1 deletion(-)
>
> Index: linux-work/arch/powerpc/boot/dts/bamboo.dts
> ===================================================================
> --- linux-work.orig/arch/powerpc/boot/dts/bamboo.dts 2007-11-30 13:40:21.000000000 +1100
> +++ linux-work/arch/powerpc/boot/dts/bamboo.dts 2007-11-30 13:40:45.000000000 +1100
> @@ -239,10 +239,48 @@
> zmii-channel = <1>;
> };
> };
> +
> + PCI0: pci@ec000000 {
> + device_type = "pci";
> + #interrupt-cells = <1>;
> + #size-cells = <2>;
> + #address-cells = <3>;
> + compatible = "ibm,plb440ep-pci", "ibm,plb-pci";
> + primary;
> + reg = <0 eec00000 8 /* Config space access */
> + 0 eed80000 4 /* IACK */
> + 0 eed80000 4 /* Special cycle */
> + 0 ef480000 40>; /* Internal registers */
> +
> + /* Outbound ranges, one memory and one IO,
> + * later cannot be changed. Chip supports a second
> + * IO range but we don't use it for now
> + */
> + ranges = <02000000 0 a0000000 0 a0000000 0 20000000
> + 01000000 0 00000000 0 e8000000 0 00010000>;
> +
> + /* Inbound 2GB range starting at 0 */
> + dma-ranges = <42000000 0 0 0 0 0 80000000>;
> +
> + /* Walnut has all 4 IRQ pins tied together per slot */
Not a Walnut board.
> + interrupt-map-mask = <f800 0 0 0>;
> + interrupt-map = <
> + /* IDSEL 1 */
> + 0800 0 0 0 &UIC0 1c 8
> +
> + /* IDSEL 2 */
> + 1000 0 0 0 &UIC0 1b 8
> +
> + /* IDSEL 3 */
> + 1800 0 0 0 &UIC0 1a 8
> +
> + /* IDSEL 4 */
> + 2000 0 0 0 &UIC0 19 8
> + >;
> + };
> };
>
> chosen {
> linux,stdout-path = "/plb/opb/serial@ef600300";
> - bootargs = "console=ttyS0,115200";
Did you remove that for a reason?
josh
^ permalink raw reply
* Re: [PATCH 18/25] powerpc: Base support for 440GX Taishan eval board
From: Josh Boyer @ 2007-12-07 3:17 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <20071206080129.737E8DE09F@ozlabs.org>
On Thu, 06 Dec 2007 19:00:18 +1100
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> From: Hugh Blemings <hugh@blemings.org>
>
>
> Signed-off-by: Hugh Blemings <hugh@blemings.org>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
> Index: linux-work/arch/powerpc/platforms/44x/Kconfig
> ===================================================================
> --- linux-work.orig/arch/powerpc/platforms/44x/Kconfig 2007-12-03 12:05:58.000000000 +1100
> +++ linux-work/arch/powerpc/platforms/44x/Kconfig 2007-12-03 13:52:59.000000000 +1100
> @@ -22,6 +22,14 @@ config SEQUOIA
> help
> This option enables support for the AMCC PPC440EPX evaluation board.
>
> +config TAISHAN
> + bool "Taishan"
> + depends on 44x
> + default n
> + select 440GX
> + help
> + This option enables support for the IBM PPC440GX "Taishan" evaluation board.
AMCC Taishan board.
> +
> #config LUAN
> # bool "Luan"
> # depends on 44x
> @@ -58,6 +66,10 @@ config 440GP
>
> config 440GX
> bool
> + select IBM_NEW_EMAC_EMAC4
> + select IBM_NEW_EMAC_RGMII
> + select IBM_NEW_EMAC_ZMII #test only
> + select IBM_NEW_EMAC_TAH #test only
>
> config 440SP
> bool
> Index: linux-work/arch/powerpc/platforms/44x/Makefile
> ===================================================================
> --- linux-work.orig/arch/powerpc/platforms/44x/Makefile 2007-12-03 11:48:01.000000000 +1100
> +++ linux-work/arch/powerpc/platforms/44x/Makefile 2007-12-03 13:52:59.000000000 +1100
> @@ -1,4 +1,5 @@
> obj-$(CONFIG_44x) := misc_44x.o
> obj-$(CONFIG_EBONY) += ebony.o
> +obj-$(CONFIG_TAISHAN) += taishan.o
> obj-$(CONFIG_BAMBOO) += bamboo.o
> obj-$(CONFIG_SEQUOIA) += sequoia.o
> Index: linux-work/arch/powerpc/platforms/44x/taishan.c
> ===================================================================
> --- /dev/null 1970-01-01 00:00:00.000000000 +0000
> +++ linux-work/arch/powerpc/platforms/44x/taishan.c 2007-12-03 13:39:01.000000000 +1100
> @@ -0,0 +1,74 @@
> +/*
> + * Taishan board specific routines based off ebony.c code
> + * original copyrights below
> + *
> + * Matt Porter <mporter@kernel.crashing.org>
> + * Copyright 2002-2005 MontaVista Software Inc.
> + *
> + * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
> + * Copyright (c) 2003-2005 Zultys Technologies
> + *
> + * Rewritten and ported to the merged powerpc tree:
> + * Copyright 2007 David Gibson <dwg@au1.ibm.com>, IBM Corporation.
> + *
> + * Modified from ebony.c for taishan:
> + * Copyright 2007 Hugh Blemings <hugh@au.ibm.com>, IBM Corporation.
> + *
> + * 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/init.h>
> +#include <linux/of_platform.h>
> +
> +#include <asm/machdep.h>
> +#include <asm/prom.h>
> +#include <asm/udbg.h>
> +#include <asm/time.h>
> +#include <asm/uic.h>
> +#include <asm/pci-bridge.h>
> +
> +#include "44x.h"
> +
> +static struct of_device_id taishan_of_bus[] = {
> + { .compatible = "ibm,plb4", },
> + { .compatible = "ibm,opb", },
> + { .compatible = "ibm,ebc", },
> + {},
> +};
> +
> +static int __init taishan_device_probe(void)
> +{
> + if (!machine_is(taishan))
> + return 0;
> +
> + of_platform_bus_probe(NULL, taishan_of_bus, NULL);
> +
> + return 0;
> +}
> +device_initcall(taishan_device_probe);
> +
> +/*
> + * Called very early, MMU is off, device-tree isn't unflattened
> + */
> +static int __init taishan_probe(void)
> +{
> + unsigned long root = of_get_flat_dt_root();
> +
> + if (!of_flat_dt_is_compatible(root, "ibm,taishan"))
> + return 0;
amcc,taishan
> +
> + return 1;
> +}
> +
> +define_machine(taishan) {
> + .name = "Taishan",
> + .probe = taishan_probe,
> + .progress = udbg_progress,
> + .init_IRQ = uic_init_tree,
> + .get_irq = uic_get_irq,
> + .restart = ppc44x_reset_system,
> + .calibrate_decr = generic_calibrate_decr,
> +};
> Index: linux-work/arch/powerpc/boot/dts/taishan.dts
> ===================================================================
> --- /dev/null 1970-01-01 00:00:00.000000000 +0000
> +++ linux-work/arch/powerpc/boot/dts/taishan.dts 2007-12-03 13:39:01.000000000 +1100
> @@ -0,0 +1,414 @@
> +/*
> + * Device Tree Source for IBM/AMCC Taishan
> + *
<snip>
> + *
> + * To build:
> + * dtc -I dts -O asm -o taishan.S -b 0 taishan.dts
> + * dtc -I dts -O dtb -o taishan.dtb -b 0 taishan.dts
Remove this please. It's not really needed anymore.
> + */
> +
> +/ {
> + #address-cells = <2>;
> + #size-cells = <1>;
> + model = "ibm,taishan";
> + compatible = "ibm,taishan";
amcc,taishan
> + dcr-parent = <&/cpus/PowerPC,440GX@0>;
> +
> + cpus {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + PowerPC,440GX@0 {
> + device_type = "cpu";
> + reg = <0>;
> + clock-frequency = <2FAF0800>; // 800MHz
> + timebase-frequency = <0>; // Filled in by zImage
> + i-cache-line-size = <32>;
> + d-cache-line-size = <32>;
> + i-cache-size = <8000>; /* 32 kB */
> + d-cache-size = <8000>; /* 32 kB */
> + dcr-controller;
> + dcr-access-method = "native";
> + };
> + };
> +
> + memory {
> + device_type = "memory";
> + reg = <0 0 0>; // Filled in by zImage
> + };
> +
> +
> + UICB0: interrupt-controller-base {
> + compatible = "ibm,uic-440gx", "ibm,uic";
> + interrupt-controller;
> + cell-index = <3>;
> + dcr-reg = <200 009>;
> + #address-cells = <0>;
> + #size-cells = <0>;
> + #interrupt-cells = <2>;
> + };
> +
> +
> + UIC0: interrupt-controller0 {
> + compatible = "ibm,uic-440gx", "ibm,uic"; /* Should be AMCC ? */
This I think is fine as ibm,uic. Unless AMCC actually changed the UIC
to have differences, it was found on the IBM boards first :)
> + interrupt-controller;
> + cell-index = <0>;
> + dcr-reg = <0c0 009>;
> + #address-cells = <0>;
> + #size-cells = <0>;
> + #interrupt-cells = <2>;
> + interrupts = <01 4 00 4>; /* cascade - first non-critical */
> + interrupt-parent = <&UICB0>;
> +
> + };
> +
> + UIC1: interrupt-controller1 {
> + compatible = "ibm,uic-440gx", "ibm,uic";
> + interrupt-controller;
> + cell-index = <1>;
> + dcr-reg = <0d0 009>;
> + #address-cells = <0>;
> + #size-cells = <0>;
> + #interrupt-cells = <2>;
> + interrupts = <03 4 02 4>; /* cascade */
> + interrupt-parent = <&UICB0>;
> + };
> +
> + UIC2: interrupt-controller2 {
> + compatible = "ibm,uic-440gx", "ibm,uic";
> + interrupt-controller;
> + cell-index = <2>; /* was 1 */
> + dcr-reg = <210 009>;
> + #address-cells = <0>;
> + #size-cells = <0>;
> + #interrupt-cells = <2>;
> + interrupts = <05 4 04 4>; /* cascade */
> + interrupt-parent = <&UICB0>;
> + };
> +
> +
> + CPC0: cpc {
> + compatible = "ibm,cpc-440gp";
> + dcr-reg = <0b0 003 0e0 010>;
> + // FIXME: anything else?
> + };
> +
> + plb {
> + compatible = "ibm,plb-440gx", "ibm,plb4";
> + #address-cells = <2>;
> + #size-cells = <1>;
> + ranges;
> + clock-frequency = <9896800>; // 160MHz
> +
> + SDRAM0: memory-controller {
> + compatible = "ibm,sdram-440gp";
> + dcr-reg = <010 2>;
> + // FIXME: anything else?
> + };
> +
> + SRAM0: sram {
> + compatible = "ibm,sram-440gp";
> + dcr-reg = <020 8 00a 1>;
> + };
> +
> + DMA0: dma {
> + // FIXME: ???
> + compatible = "ibm,dma-440gp";
> + dcr-reg = <100 027>;
> + };
> +
> + MAL0: mcmal {
> + compatible = "ibm,mcmal-440gx", "ibm,mcmal2";
> + dcr-reg = <180 62>;
> + num-tx-chans = <4>;
> + num-rx-chans = <4>;
> + interrupt-parent = <&MAL0>;
> + interrupts = <0 1 2 3 4>;
> + #interrupt-cells = <1>;
> + #address-cells = <0>;
> + #size-cells = <0>;
> + interrupt-map = </*TXEOB*/ 0 &UIC0 a 4
> + /*RXEOB*/ 1 &UIC0 b 4
> + /*SERR*/ 2 &UIC1 0 4
> + /*TXDE*/ 3 &UIC1 1 4
> + /*RXDE*/ 4 &UIC1 2 4>;
> + interrupt-map-mask = <ffffffff>;
> + };
> +
> + POB0: opb {
> + compatible = "ibm,opb-440gx", "ibm,opb";
> + #address-cells = <1>;
> + #size-cells = <1>;
> + /* Wish there was a nicer way of specifying a full 32-bit
> + range */
> + ranges = <00000000 1 00000000 80000000
> + 80000000 1 80000000 80000000>;
> + dcr-reg = <090 00b>;
> + interrupt-parent = <&UIC1>;
> + interrupts = <7 4>;
> + clock-frequency = <4C4B400>; // 80MHz
> +
> +
> + /* Put EBC0 back **FIXME** */
Hrm?
> +
> + EBC0: ebc {
> + compatible = "ibm,ebc-440gx", "ibm,ebc";
> + dcr-reg = <012 2>;
> + #address-cells = <2>;
> + #size-cells = <1>;
> + clock-frequency = <4C4B400>; // 80MHz
> + // ranges property is supplied by zImage
> + // based on firmware's configuration of the
> + // EBC bridge
> + interrupts = <5 4>;
> + interrupt-parent = <&UIC1>;
> +
> +// small-flash@0,80000 {
> +// device_type = "rom";
> +// compatible = "direct-mapped";
> +// probe-type = "JEDEC";
> +// bank-width = <1>;
> +// partitions = <0 80000>;
> +// partition-names = "OpenBIOS";
> +// reg = <0 80000 80000>;
> +// };
You can probably just omit the child EBC nodes for now. Adding them
when they're right is pretty easy.
> +
> +// ds1743@1,0 {
> +// /* NVRAM & RTC */
> +// compatible = "ds1743";
> +// reg = <1 0 2000>;
> +// };
> +
> +// large-flash@2,0 {
> +// device_type = "rom";
> +// compatible = "direct-mapped";
> +// probe-type = "JEDEC";
> +// bank-width = <1>;
> +// partitions = <0 380000
> +// 380000 80000>;
> +// partition-names = "fs", "firmware";
> +// reg = <2 0 400000>;
> +// };
> +
> +// ir@3,0 {
> +// reg = <3 0 10>;
> +// };
> +
> +// fpga@7,0 {
> +// compatible = "Ebony-FPGA";
> +// reg = <7 0 10>;
> +// };
> + };
> +
> +
> + PCIX0: pci@20ec00000 {
> + device_type = "pci";
> + #interrupt-cells = <1>;
> + #size-cells = <2>;
> + #address-cells = <3>;
> + compatible = "ibm,plb440gp-pcix", "ibm,plb-pcix";
> + primary;
> + large-inbound-windows;
> + enable-msi-hole;
> + reg = <2 0ec00000 8 /* Config space access */
> + 0 0 0 /* no IACK cycles */
> + 2 0ed00000 4 /* Special cycles */
> + 2 0ec80000 100 /* Internal registers */
> + 2 0ec80100 fc>; /* Internal messaging registers */
> +
> + /* Outbound ranges, one memory and one IO,
> + * later cannot be changed
> + */
> + ranges = <02000000 0 80000000 00000003 80000000 0 80000000
> + 01000000 0 00000000 00000002 08000000 0 00010000>;
> +
> + /* Inbound 2GB range starting at 0 */
> + dma-ranges = <42000000 0 0 0 0 0 80000000>;
> +
> + /* Ebony has all 4 IRQ pins tied together per slot */
This isn't an Ebony board. Does Taishan do the same?
> + interrupt-map-mask = <f800 0 0 7>;
> + interrupt-map = <
> + /* IDSEL 1 */
> + 0800 0 0 1 &UIC0 17 8
> + 0800 0 0 2 &UIC0 18 8
> + 0800 0 0 3 &UIC0 19 8
> + 0800 0 0 4 &UIC0 1a 8
> +
> + /* IDSEL 2 */
> + 1000 0 0 1 &UIC0 18 8
> + 1000 0 0 2 &UIC0 19 8
> + 1000 0 0 3 &UIC0 1a 8
> + 1000 0 0 4 &UIC0 17 8
> + >;
> + };
> + };
> +
> + chosen {
> + linux,stdout-path = "/plb/opb/serial@40000300";
> + };
> +};
josh
^ permalink raw reply
* Re: [PATCH 16/25] powerpc: EP405 boards support for arch/powerpc
From: Josh Boyer @ 2007-12-07 3:05 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <20071206080127.1F2ACDDED0@ozlabs.org>
On Thu, 06 Dec 2007 19:00:15 +1100
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
> Index: linux-work/arch/powerpc/boot/dts/ep405.dts
> ===================================================================
> --- /dev/null 1970-01-01 00:00:00.000000000 +0000
> +++ linux-work/arch/powerpc/boot/dts/ep405.dts 2007-12-03 12:58:45.000000000 +1100
> @@ -0,0 +1,221 @@
> +/*
> + * Device Tree Source for EP405
> + *
> + * Copyright 2007 IBM Corp.
> + * Josh Boyer <jwboyer@linux.vnet.ibm.com>
I still don't think I wrote this ;)
<snip>
> +static struct of_device_id ep405_of_bus[] = {
> + { .compatible = "ibm,plb3", },
> + { .compatible = "ibm,opb", },
> + { .compatible = "ibm,ebc", },
> + {},
> +};
> +
> +static int __init ep405_device_probe(void)
> +{
> + if (!machine_is(ep405))
> + return 0;
> +
> + /* FIXME: do bus probe here */
I should really remove this stupid FIXME from my files so people stop
copying it into theirs ;)
> + of_platform_bus_probe(NULL, ep405_of_bus, NULL);
> +
> + return 0;
> +}
> +device_initcall(ep405_device_probe);
> +
> +static void __init ep405_init_bcsr(void)
> +{
> + const u8 *irq_routing;
> + int i;
> +
> + /* Find the bloody thing & map it */
> + bcsr_node = of_find_compatible_node(NULL, NULL, "ep405-bcsr");
> + if (bcsr_node == NULL) {
> + printk(KERN_ERR "EP405 BCSR not found !\n");
> + return;
> + }
> + bcsr_regs = of_iomap(bcsr_node, 0);
> + if (bcsr_regs == NULL) {
> + printk(KERN_ERR "EP405 BCSR failed to map !\n");
> + return;
> + }
Is there a reason you have bcsr_node and bcsr_regs as static globals
and leave the mapping present? I can't see another use of them outside
of this function, which only gets called once.
> +
> + /* Get the irq-routing property and apply the routing to the CPLD */
> + irq_routing = of_get_property(bcsr_node, "irq-routing", NULL);
> + if (irq_routing == NULL)
> + return;
> + for (i = 0; i < 16; i++) {
> + u8 irq = irq_routing[i];
> + out_8(bcsr_regs + BCSR_XIRQ_SELECT, i);
> + out_8(bcsr_regs + BCSR_XIRQ_ROUTING, irq);
> + }
> + in_8(bcsr_regs + BCSR_XIRQ_SELECT);
> + mb();
> + out_8(bcsr_regs + BCSR_GPIO_IRQ_PAR_CTRL, 0xfe);
> +}
> +
> +static void __init ep405_setup_arch(void)
> +{
> + /* Find & init the BCSR CPLD */
> + ep405_init_bcsr();
> +}
> +
> +static int __init ep405_probe(void)
> +{
> + unsigned long root = of_get_flat_dt_root();
> +
> + if (!of_flat_dt_is_compatible(root, "ep405"))
> + return 0;
> +
> + return 1;
> +}
> +
> +define_machine(ep405) {
> + .name = "EP405",
> + .probe = ep405_probe,
> + .setup_arch = ep405_setup_arch,
> + .progress = udbg_progress,
> + .init_IRQ = uic_init_tree,
> + .get_irq = uic_get_irq,
> + .calibrate_decr = generic_calibrate_decr,
> +};
josh
^ permalink raw reply
* dtc: Convert check for obsolete /chosen property
From: David Gibson @ 2007-12-07 3:06 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev
This converts the test for the obsolete "interrupt-controller"
property in /chosen to the new framework. That was the only thing
left in the old-style check_chosen() function, so that function is
removed, too.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Index: dtc/checks.c
===================================================================
--- dtc.orig/checks.c 2007-12-07 13:46:11.000000000 +1100
+++ dtc/checks.c 2007-12-07 13:53:24.000000000 +1100
@@ -476,6 +476,23 @@ static void check_avoid_default_addr_siz
}
NODE_CHECK(avoid_default_addr_size, NULL, WARN, &addr_size_cells);
+static void check_obsolete_chosen_interrupt_controller(struct check *c,
+ struct node *dt)
+{
+ struct node *chosen;
+ struct property *prop;
+
+ chosen = get_node_by_path(dt, "/chosen");
+ if (!chosen)
+ return;
+
+ prop = get_property(chosen, "interrupt-controller");
+ if (prop)
+ FAIL(c, "/chosen has obsolete \"interrupt-controller\" "
+ "property");
+}
+TREE_CHECK(obsolete_chosen_interrupt_controller, NULL, WARN);
+
static struct check *check_table[] = {
&duplicate_node_names, &duplicate_property_names,
&name_is_string, &name_properties,
@@ -488,6 +505,7 @@ static struct check *check_table[] = {
&addr_size_cells, ®_format, &ranges_format,
&avoid_default_addr_size,
+ &obsolete_chosen_interrupt_controller,
};
int check_semantics(struct node *dt, int outversion, int boot_cpuid_phys);
@@ -715,27 +733,6 @@ static int check_memory(struct node *roo
return ok;
}
-static int check_chosen(struct node *root)
-{
- struct node *chosen;
- struct property *prop;
- int ok = 1;
-
- chosen = get_subnode(root, "chosen");
- if (!chosen)
- return ok;
-
- /* give warning for obsolete interrupt-controller property */
- do {
- if ((prop = get_property(chosen, "interrupt-controller")) != NULL) {
- WARNMSG("%s has obsolete \"%s\" property\n",
- chosen->fullpath, "interrupt-controller");
- }
- } while (0);
-
- return ok;
-}
-
int check_semantics(struct node *dt, int outversion, int boot_cpuid_phys)
{
int ok = 1;
@@ -743,7 +740,6 @@ int check_semantics(struct node *dt, int
ok = ok && check_root(dt);
ok = ok && check_cpus(dt, outversion, boot_cpuid_phys);
ok = ok && check_memory(dt);
- ok = ok && check_chosen(dt);
if (! ok)
return 0;
Index: dtc/tests/obsolete-chosen-interrupt-controller.dts
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ dtc/tests/obsolete-chosen-interrupt-controller.dts 2007-12-07 13:51:34.000000000 +1100
@@ -0,0 +1,13 @@
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ PIC: pic@0 {
+ reg = <0x0 0x10>;
+ interrupt-controller;
+ };
+ chosen {
+ interrupt-controller = <&PIC>;
+ };
+};
Index: dtc/tests/run_tests.sh
===================================================================
--- dtc.orig/tests/run_tests.sh 2007-12-07 13:51:44.000000000 +1100
+++ dtc/tests/run_tests.sh 2007-12-07 13:52:06.000000000 +1100
@@ -173,6 +173,7 @@ dtc_tests () {
run_test dtc-checkfails.sh reg_format ranges_format -- -I dts -O dtb bad-reg-ranges.dts
run_test dtc-checkfails.sh ranges_format -- -I dts -O dtb bad-empty-ranges.dts
run_test dtc-checkfails.sh avoid_default_addr_size -- -I dts -O dtb default-addr-size.dts
+ run_test dtc-checkfails.sh obsolete_chosen_interrupt_controller -- -I dts -O dtb obsolete-chosen-interrupt-controller.dts
}
while getopts "vt:m" ARG ; do
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* dtc: Convert #address-cells and #size-cells related checks
From: David Gibson @ 2007-12-07 3:05 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev
This patch converts checks related to #address-cells and #size-cells
to the new framework. Specifically, it reimplements the check that
"reg" properties have a valid size based on the relevant
#address-cells and #size-cells values. The new implementation uses
the correct default value, unlike the old-style check which assumed
the values were inherited by default.
It also implements a new, similar test for "ranges" properties.
Finally, since relying on the default values of these variables is
considered not-good-practice these days, it implements a "style" check
which will give a warning if the tree ever relies on the default
values (that is if any node with either "reg" or "ranges" appears
under a parent which has no #address-cells or #size-cells property).
Index: dtc/checks.c
===================================================================
--- dtc.orig/checks.c 2007-12-07 12:54:59.000000000 +1100
+++ dtc/checks.c 2007-12-07 13:16:38.000000000 +1100
@@ -355,6 +355,127 @@ CHECK_IS_STRING(device_type_is_string, "
CHECK_IS_STRING(model_is_string, "model", WARN);
CHECK_IS_STRING(status_is_string, "status", WARN);
+static void fixup_addr_size_cells(struct check *c, struct node *dt,
+ struct node *node)
+{
+ struct property *prop;
+
+ node->addr_cells = -1;
+ node->size_cells = -1;
+
+ prop = get_property(node, "#address-cells");
+ if (prop)
+ node->addr_cells = propval_cell(prop);
+
+ prop = get_property(node, "#size-cells");
+ if (prop)
+ node->size_cells = propval_cell(prop);
+}
+CHECK(addr_size_cells, NULL, fixup_addr_size_cells, NULL, NULL, WARN,
+ &address_cells_is_cell, &size_cells_is_cell);
+
+#define node_addr_cells(n) \
+ (((n)->addr_cells == -1) ? 2 : (n)->addr_cells)
+#define node_size_cells(n) \
+ (((n)->size_cells == -1) ? 1 : (n)->size_cells)
+
+static void check_reg_format(struct check *c, struct node *dt,
+ struct node *node)
+{
+ struct property *prop;
+ int addr_cells, size_cells, entrylen;
+
+ prop = get_property(node, "reg");
+ if (!prop)
+ return; /* No "reg", that's fine */
+
+ if (!node->parent) {
+ FAIL(c, "Root node has a \"reg\" property");
+ return;
+ }
+
+ if (prop->val.len == 0)
+ FAIL(c, "\"reg\" property in %s is empty", node->fullpath);
+
+ addr_cells = node_addr_cells(node->parent);
+ size_cells = node_size_cells(node->parent);
+ entrylen = (addr_cells + size_cells) * sizeof(cell_t);
+
+ if ((prop->val.len % entrylen) != 0)
+ FAIL(c, "\"reg\" property in %s has invalid length (%d bytes) "
+ "(#address-cells == %d, #size-cells == %d)",
+ node->fullpath, prop->val.len, addr_cells, size_cells);
+}
+NODE_CHECK(reg_format, NULL, WARN, &addr_size_cells);
+
+static void check_ranges_format(struct check *c, struct node *dt,
+ struct node *node)
+{
+ struct property *prop;
+ int c_addr_cells, p_addr_cells, c_size_cells, p_size_cells, entrylen;
+
+ prop = get_property(node, "ranges");
+ if (!prop)
+ return;
+
+ if (!node->parent) {
+ FAIL(c, "Root node has a \"ranges\" property");
+ return;
+ }
+
+ p_addr_cells = node_addr_cells(node->parent);
+ p_size_cells = node_size_cells(node->parent);
+ c_addr_cells = node_addr_cells(node);
+ c_size_cells = node_size_cells(node);
+ entrylen = (p_addr_cells + c_addr_cells + c_size_cells) * sizeof(cell_t);
+
+ if (prop->val.len == 0) {
+ if (p_addr_cells != c_addr_cells)
+ FAIL(c, "%s has empty \"ranges\" property but its "
+ "#address-cells (%d) differs from %s (%d)",
+ node->fullpath, c_addr_cells, node->parent->fullpath,
+ p_addr_cells);
+ if (p_size_cells != c_size_cells)
+ FAIL(c, "%s has empty \"ranges\" property but its "
+ "#size-cells (%d) differs from %s (%d)",
+ node->fullpath, c_size_cells, node->parent->fullpath,
+ p_size_cells);
+ } else if ((prop->val.len % entrylen) != 0) {
+ FAIL(c, "\"ranges\" property in %s has invalid length (%d bytes) "
+ "(parent #address-cells == %d, child #address-cells == %d, "
+ "#size-cells == %d)", node->fullpath, prop->val.len,
+ p_addr_cells, c_addr_cells, c_size_cells);
+ }
+}
+NODE_CHECK(ranges_format, NULL, WARN, &addr_size_cells);
+
+/*
+ * Style checks
+ */
+static void check_avoid_default_addr_size(struct check *c, struct node *dt,
+ struct node *node)
+{
+ struct property *reg, *ranges;
+
+ if (!node->parent)
+ return; /* Ignore root node */
+
+ reg = get_property(node, "reg");
+ ranges = get_property(node, "ranges");
+
+ if (!reg && !ranges)
+ return;
+
+ if ((node->parent->addr_cells == -1))
+ FAIL(c, "Relying on default #address-cells value for %s",
+ node->fullpath);
+
+ if ((node->parent->size_cells == -1))
+ FAIL(c, "Relying on default #size-cells value for %s",
+ node->fullpath);
+}
+NODE_CHECK(avoid_default_addr_size, NULL, WARN, &addr_size_cells);
+
static struct check *check_table[] = {
&duplicate_node_names, &duplicate_property_names,
&name_is_string, &name_properties,
@@ -363,6 +484,10 @@ static struct check *check_table[] = {
&address_cells_is_cell, &size_cells_is_cell, &interrupt_cells_is_cell,
&device_type_is_string, &model_is_string, &status_is_string,
+
+ &addr_size_cells, ®_format, &ranges_format,
+
+ &avoid_default_addr_size,
};
int check_semantics(struct node *dt, int outversion, int boot_cpuid_phys);
@@ -487,10 +612,6 @@ static int check_root(struct node *root)
int ok = 1;
CHECK_HAVE_STRING(root, "model");
-
- CHECK_HAVE(root, "#address-cells");
- CHECK_HAVE(root, "#size-cells");
-
CHECK_HAVE_WARN(root, "compatible");
return ok;
@@ -509,19 +630,16 @@ static int check_cpus(struct node *root,
return 0;
}
- CHECK_HAVE_WARN(cpus, "#address-cells");
- CHECK_HAVE_WARN(cpus, "#size-cells");
+ if (cpus->addr_cells != 1)
+ DO_ERR("%s has bad #address-cells value %d (should be 1)\n",
+ cpus->fullpath, cpus->addr_cells);
+ if (cpus->size_cells != 0)
+ DO_ERR("%s has bad #size-cells value %d (should be 0)\n",
+ cpus->fullpath, cpus->size_cells);
for_each_child(cpus, cpu) {
CHECK_HAVE_STREQ(cpu, "device_type", "cpu");
- if (cpu->addr_cells != 1)
- DO_ERR("%s has bad #address-cells value %d (should be 1)\n",
- cpu->fullpath, cpu->addr_cells);
- if (cpu->size_cells != 0)
- DO_ERR("%s has bad #size-cells value %d (should be 0)\n",
- cpu->fullpath, cpu->size_cells);
-
CHECK_HAVE_ONECELL(cpu, "reg");
if (prop) {
cell_t unitnum;
@@ -618,47 +736,10 @@ static int check_chosen(struct node *roo
return ok;
}
-static int check_addr_size_reg(struct node *node,
- int p_addr_cells, int p_size_cells)
-{
- int addr_cells = p_addr_cells;
- int size_cells = p_size_cells;
- struct property *prop;
- struct node *child;
- int ok = 1;
-
- node->addr_cells = addr_cells;
- node->size_cells = size_cells;
-
- prop = get_property(node, "reg");
- if (prop) {
- int reg_entry_len = (addr_cells + size_cells) * sizeof(cell_t);
- if ((prop->val.len % reg_entry_len) != 0)
- DO_ERR("\"reg\" property in %s has invalid length (%d bytes) for given #address-cells (%d) and #size-cells (%d)\n",
- node->fullpath, prop->val.len,
- addr_cells, size_cells);
- }
-
- prop = get_property(node, "#address-cells");
- if (prop)
- addr_cells = propval_cell(prop);
-
- prop = get_property(node, "#size-cells");
- if (prop)
- size_cells = propval_cell(prop);
-
- for_each_child(node, child) {
- ok = ok && check_addr_size_reg(child, addr_cells, size_cells);
- }
-
- return ok;
-}
-
int check_semantics(struct node *dt, int outversion, int boot_cpuid_phys)
{
int ok = 1;
- ok = ok && check_addr_size_reg(dt, -1, -1);
ok = ok && check_root(dt);
ok = ok && check_cpus(dt, outversion, boot_cpuid_phys);
ok = ok && check_memory(dt);
Index: dtc/tests/bad-empty-ranges.dts
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ dtc/tests/bad-empty-ranges.dts 2007-12-07 12:56:18.000000000 +1100
@@ -0,0 +1,11 @@
+/dts-v1/;
+
+/ {
+ #address-cells = <2>;
+ #size-cells = <2>;
+ node {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges;
+ };
+};
Index: dtc/tests/bad-reg-ranges.dts
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ dtc/tests/bad-reg-ranges.dts 2007-12-07 12:56:18.000000000 +1100
@@ -0,0 +1,12 @@
+/dts-v1/;
+
+/ {
+ #address-cells = <2>;
+ #size-cells = <2>;
+ node {
+ reg = <0 0>;
+ #address-cells = <1>;
+ #size-cells = <1>;
+ ranges = <0 0 0>;
+ };
+};
Index: dtc/tests/default-addr-size.dts
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ dtc/tests/default-addr-size.dts 2007-12-07 13:20:25.000000000 +1100
@@ -0,0 +1,7 @@
+/dts-v1/;
+
+/ {
+ node {
+ reg = <0 0 0>;
+ };
+};
Index: dtc/tests/run_tests.sh
===================================================================
--- dtc.orig/tests/run_tests.sh 2007-12-07 13:19:14.000000000 +1100
+++ dtc/tests/run_tests.sh 2007-12-07 13:21:22.000000000 +1100
@@ -170,7 +170,9 @@ dtc_tests () {
run_test dtc-checkfails.sh address_cells_is_cell size_cells_is_cell interrupt_cells_is_cell -- -I dts -O dtb bad-ncells.dts
run_test dtc-checkfails.sh device_type_is_string model_is_string status_is_string -- -I dts -O dtb bad-string-props.dts
-
+ run_test dtc-checkfails.sh reg_format ranges_format -- -I dts -O dtb bad-reg-ranges.dts
+ run_test dtc-checkfails.sh ranges_format -- -I dts -O dtb bad-empty-ranges.dts
+ run_test dtc-checkfails.sh avoid_default_addr_size -- -I dts -O dtb default-addr-size.dts
}
while getopts "vt:m" ARG ; do
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* Re: [PATCH 8/25] powerpc: Improve support for 4xx indirect DCRs
From: Josh Boyer @ 2007-12-07 2:19 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <20071206080117.754FEDDE45@ozlabs.org>
On Thu, 06 Dec 2007 19:00:06 +1100
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
> Accessing indirect DCRs is done via a pair of address/data DCRs.
>
> Such accesses are thus inherently racy, vs. interrupts, preemption
> and possibly SMP if 4xx SMP cores are ever used.
>
> This updates the mfdcri/mtdcri macros in dcr-native.h (which were
> so far unused) to use a spinlock.
>
> In addition, add some common definitions to a new dcr-regs.h file.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>
>
> arch/powerpc/sysdev/dcr.c | 1
> include/asm-powerpc/dcr-native.h | 30 +++++++++++-----
> include/asm-powerpc/dcr-regs.h | 72 +++++++++++++++++++++++++++++++++++++++
> include/asm-powerpc/dcr.h | 1
> 4 files changed, 96 insertions(+), 8 deletions(-)
>
> Index: linux-work/arch/powerpc/sysdev/dcr.c
> ===================================================================
> --- linux-work.orig/arch/powerpc/sysdev/dcr.c 2007-11-28 13:34:45.000000000 +1100
> +++ linux-work/arch/powerpc/sysdev/dcr.c 2007-11-28 13:34:48.000000000 +1100
> @@ -139,3 +139,4 @@ void dcr_unmap(dcr_host_t host, unsigned
> EXPORT_SYMBOL_GPL(dcr_unmap);
>
> #endif /* !defined(CONFIG_PPC_DCR_NATIVE) */
> +
Somehow I doubt this single extraneous whitespace addition is really
needed.
> Index: linux-work/include/asm-powerpc/dcr-native.h
> ===================================================================
> --- linux-work.orig/include/asm-powerpc/dcr-native.h 2007-11-28 13:33:51.000000000 +1100
> +++ linux-work/include/asm-powerpc/dcr-native.h 2007-11-28 15:22:22.000000000 +1100
> @@ -22,6 +22,8 @@
> #ifdef __KERNEL__
> #ifndef __ASSEMBLY__
>
> +#include <linux/spinlock.h>
> +
> typedef struct {
> unsigned int base;
> } dcr_host_t;
> @@ -55,18 +57,30 @@ do { \
> } while (0)
>
> /* R/W of indirect DCRs make use of standard naming conventions for DCRs */
> -#define mfdcri(base, reg) \
> -({ \
> - mtdcr(base ## _CFGADDR, base ## _ ## reg); \
> - mfdcr(base ## _CFGDATA); \
> +extern spinlock_t dcr_ind_lock;
> +
> +#define mfdcri(base, reg) \
> +({ \
> + unsigned long flags; \
> + unsigned int val; \
> + spin_lock_irqsave(&dcr_ind_lock, flags); \
> + mtdcr(DCRN_ ## base ## _CONFIG_ADDR, reg); \
> + val = mfdcr(DCRN_ ## base ## _CONFIG_DATA); \
> + spin_unlock_irqrestore(&dcr_ind_lock, flags); \
> + val; \
> })
>
> -#define mtdcri(base, reg, data) \
> -do { \
> - mtdcr(base ## _CFGADDR, base ## _ ## reg); \
> - mtdcr(base ## _CFGDATA, data); \
> +#define mtdcri(base, reg, data) \
> +do { \
> + unsigned long flags; \
> + spin_lock_irqsave(&dcr_ind_lock, flags); \
> + mtdcr(DCRN_ ## base ## _CONFIG_ADDR, reg); \
> + mtdcr(DCRN_ ## base ## _CONFIG_DATA, data); \
> + spin_unlock_irqrestore(&dcr_ind_lock, flags); \
> } while (0)
>
> +
> +
More bogus whitespace.
> #endif /* __ASSEMBLY__ */
> #endif /* __KERNEL__ */
> #endif /* _ASM_POWERPC_DCR_NATIVE_H */
> Index: linux-work/include/asm-powerpc/dcr.h
> ===================================================================
> --- linux-work.orig/include/asm-powerpc/dcr.h 2007-11-28 13:40:13.000000000 +1100
> +++ linux-work/include/asm-powerpc/dcr.h 2007-11-28 13:49:37.000000000 +1100
> @@ -40,6 +40,7 @@ extern unsigned int dcr_resource_len(str
> unsigned int index);
> #endif /* CONFIG_PPC_MERGE */
>
> +
You really like whitespace. Again I don't see anything needed for this
file :)
> #endif /* CONFIG_PPC_DCR */
> #endif /* __KERNEL__ */
> #endif /* _ASM_POWERPC_DCR_H */
> Index: linux-work/include/asm-powerpc/dcr-regs.h
> ===================================================================
> --- /dev/null 1970-01-01 00:00:00.000000000 +0000
> +++ linux-work/include/asm-powerpc/dcr-regs.h 2007-11-28 14:43:25.000000000 +1100
> @@ -0,0 +1,72 @@
> +/*
> + * Common DCR / SDR / CPR register definitions used on various IBM/AMCC
> + * 4xx processors
> + *
> + * Copyright 2007 Benjamin Herrenschmidt, IBM Corp
> + * <benh@kernel.crashing.org>
> + *
> + * Mostly lifted from asm-ppc/ibm4xx.h by
> + *
> + * Copyright (c) 1999 Grant Erickson <grant@lcse.umn.edu>
> + *
> + */
> +
> +#ifndef __DCR_REGS_H__
> +#define __DCR_REGS_H__
> +
> +/*
> + * Most DCRs used for controlling devices such as the MAL, DMA engine,
> + * etc... are obtained for the device tree.
> + *
> + * The definitions in this files are fixed DCRs and indirect DCRs that
> + * are commonly used outside of specific drivers or refer to core
> + * common registers that may occasionally have to be tweaked outside
> + * of the driver main register set
> + */
> +
> +/* CPRs (440GX and 440SP/440SPe) */
> +#define DCRN_CPR0_CONFIG_ADDR 0xc
> +#define DCRN_CPR0_CONFIG_DATA 0xd
> +
> +/* SDRs (440GX and 440SP/440SPe) */
> +#define DCRN_SDR0_CONFIG_ADDR 0xe
> +#define DCRN_SDR0_CONFIG_DATA 0xf
> +
> +#define SDR0_PFC0 0x4100
> +#define SDR0_PFC1 0x4101
> +#define SDR0_PFC1_EPS 0x1c00000
> +#define SDR0_PFC1_EPS_SHIFT 22
> +#define SDR0_PFC1_RMII 0x02000000
> +#define SDR0_MFR 0x4300
> +#define SDR0_MFR_TAH0 0x80000000 /* TAHOE0 Enable */
> +#define SDR0_MFR_TAH1 0x40000000 /* TAHOE1 Enable */
> +#define SDR0_MFR_PCM 0x10000000 /* PPC440GP irq compat mode */
> +#define SDR0_MFR_ECS 0x08000000 /* EMAC int clk */
> +#define SDR0_MFR_T0TXFL 0x00080000
> +#define SDR0_MFR_T0TXFH 0x00040000
> +#define SDR0_MFR_T1TXFL 0x00020000
> +#define SDR0_MFR_T1TXFH 0x00010000
> +#define SDR0_MFR_E0TXFL 0x00008000
> +#define SDR0_MFR_E0TXFH 0x00004000
> +#define SDR0_MFR_E0RXFL 0x00002000
> +#define SDR0_MFR_E0RXFH 0x00001000
> +#define SDR0_MFR_E1TXFL 0x00000800
> +#define SDR0_MFR_E1TXFH 0x00000400
> +#define SDR0_MFR_E1RXFL 0x00000200
> +#define SDR0_MFR_E1RXFH 0x00000100
> +#define SDR0_MFR_E2TXFL 0x00000080
> +#define SDR0_MFR_E2TXFH 0x00000040
> +#define SDR0_MFR_E2RXFL 0x00000020
> +#define SDR0_MFR_E2RXFH 0x00000010
> +#define SDR0_MFR_E3TXFL 0x00000008
> +#define SDR0_MFR_E3TXFH 0x00000004
> +#define SDR0_MFR_E3RXFL 0x00000002
> +#define SDR0_MFR_E3RXFH 0x00000001
> +#define SDR0_UART0 0x0120
> +#define SDR0_UART1 0x0121
> +#define SDR0_UART2 0x0122
> +#define SDR0_UART3 0x0123
> +#define SDR0_CUST0 0x4000
> +
> +
> +#endif /* __DCR_REGS_H__ */
^ permalink raw reply
* Re: [PATCH] add MPC837x MDS board default device tree
From: David Gibson @ 2007-12-07 2:01 UTC (permalink / raw)
To: Li Yang; +Cc: linuxppc-dev
In-Reply-To: <1196851073-11801-1-git-send-email-leoli@freescale.com>
On Wed, Dec 05, 2007 at 06:37:53PM +0800, Li Yang wrote:
> Signed-off-by: Li Yang <leoli@freescale.com>
> ---
> Update SATA nodes; remove serdes nodes; add aliases and labels.
>
> arch/powerpc/boot/dts/mpc8377_mds.dts | 270 +++++++++++++++++++++++++++++++
> arch/powerpc/boot/dts/mpc8378_mds.dts | 256 +++++++++++++++++++++++++++++
> arch/powerpc/boot/dts/mpc8379_mds.dts | 284 +++++++++++++++++++++++++++++++++
> 3 files changed, 810 insertions(+), 0 deletions(-)
> create mode 100644 arch/powerpc/boot/dts/mpc8377_mds.dts
> create mode 100644 arch/powerpc/boot/dts/mpc8378_mds.dts
> create mode 100644 arch/powerpc/boot/dts/mpc8379_mds.dts
>
> diff --git a/arch/powerpc/boot/dts/mpc8377_mds.dts b/arch/powerpc/boot/dts/mpc8377_mds.dts
> new file mode 100644
> index 0000000..919ffd0
> --- /dev/null
> +++ b/arch/powerpc/boot/dts/mpc8377_mds.dts
[snip]
> + aliases {
> + ethernet0 = "/soc@e0000000/ethernet@24000";
> + ethernet1 = "/soc@e0000000/ethernet@25000";
> + serial0 = "/soc@e0000000/serial@4500";
> + serial1 = "/soc@e0000000/serial@4600";
> + pci0 = "/pci@e0008500";
You can use path references for these now.
> + };
> +
> + cpus {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + PowerPC,837x@0 {
This should absolutely not have a "x" in it. Either have an exact
model, or just use "cpu@9" (in which case you can put the model in
"compatible").
[snip]
> + i2c@3000 {
> + device_type = "i2c";
Drop the device_type. No "i2c" device_type class is defined.
[snip]
> + /* phy type (ULPI, UTMI, UTMI_WIDE, SERIAL) */
> + usb@23000 {
> + device_type = "usb";
Drop device_type here too.
> + compatible = "fsl-usb2-dr";
> + reg = <23000 1000>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> + interrupt-parent = < &ipic >;
> + interrupts = <26 8>;
> + phy_type = "utmi_wide";
> + };
> +
> + mdio@24520 {
> + device_type = "mdio";
> + compatible = "gianfar";
Grr... not your fault, but this crap in the gianfar driver where it
uses the same compatible property for the mdio and MAC has to be
fixed.
[snip]
> + serial1:serial@4600 {
Standard style puts a space after the colon.
> + device_type = "serial";
> + compatible = "ns16550";
> + reg = <4600 100>;
> + clock-frequency = <0>;
> + interrupts = <a 8>;
> + interrupt-parent = < &ipic >;
> + };
> +
> + crypto@30000 {
> + model = "SEC3";
> + compatible = "talitos";
This driver, also, needs fixing to recognize a better formatted
compatible property.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply
* Re: MPC85xx DMA drivers, first testing results.
From: Timur Tabi @ 2007-12-07 1:31 UTC (permalink / raw)
To: Clemens Koller; +Cc: linuxppc-dev@ozlabs.org
In-Reply-To: <47586E72.3050106@anagramm.de>
Clemens Koller wrote:
> Hi There!
>
> I just tried to use the fsldma on the mpc8540. It seems to work fine
> here, but I would be glad if somebody can confirm before I move on:
>
> I added the following to my mpc8540ads compatible board's .dts
> (see my comments, where the not yet available documentation
> was unclear):
>
> dma@21000 {
> #address-cells = <1>;
> #size-cells = <1>;
> compatible = "fsl,mpc8540-dma", "fsl,eloplus-dma";
> device-id = <0>;
> reg = <21300 4>; /* DGSR - DMA general status register */
> /* reg = <21000 4>;*/ /* or use offset of DMA machine ??? */
> ranges = <0 21100 200>; /* we have 4 DMA channels at 21100, size=80 each */
> dma-channel@0 {
> compatible = "fsl,mpc8540-dma-channel", "fsl,eloplus-dma-channel";
> device-id = <0>; /* or cell-index ??? */
> reg = <0 80>;
> interrupt-parent = <&mpic>;
> interrupts = <14 2>;
> };
Do this:
dma@21300 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "fsl,mpc8540-dma", "fsl,eloplus-dma";
cell-index = <0>;
reg = <21300 4>; /* DMA general status register */
ranges = <0 21100 200>;
dma-channel@0 {
compatible = "fsl,mpc8540-dma-channel",
"fsl,eloplus-dma-channel";
cell-index = <0>;
reg = <0 80>;
interrupt-parent = <&mpic>;
interrupts = <14 2>;
};
--
Timur Tabi
Linux Kernel Developer @ Freescale
^ permalink raw reply
* Please pull powerpc.git merge branch
From: Paul Mackerras @ 2007-12-07 1:04 UTC (permalink / raw)
To: torvalds; +Cc: linuxppc-dev
Linus,
I have added another commit to my powerpc.git tree merge branch, so
please do:
git pull \
master.kernel.org:/pub/scm/linux/kernel/git/paulus/powerpc.git merge
(the mirroring seems to be slow today).
The diffstat and log below reflect the new commit plus the 4 in my
last pull request.
Thanks,
Paul.
arch/powerpc/configs/bamboo_defconfig | 22 +-
arch/powerpc/configs/cell_defconfig | 176 ++++++++++--------
arch/powerpc/configs/celleb_defconfig | 170 +++++++++--------
arch/powerpc/configs/chrp32_defconfig | 163 +++++++++--------
arch/powerpc/configs/ebony_defconfig | 25 +--
arch/powerpc/configs/ep88xc_defconfig | 92 +++++----
arch/powerpc/configs/g5_defconfig | 150 ++++++++-------
arch/powerpc/configs/holly_defconfig | 136 +++++++-------
arch/powerpc/configs/iseries_defconfig | 123 ++++++------
arch/powerpc/configs/kilauea_defconfig | 79 +++-----
arch/powerpc/configs/linkstation_defconfig | 152 ++++++++-------
arch/powerpc/configs/lite5200_defconfig | 119 ++++++------
arch/powerpc/configs/maple_defconfig | 126 ++++++-------
arch/powerpc/configs/mpc7448_hpc2_defconfig | 137 +++++++-------
arch/powerpc/configs/mpc8272_ads_defconfig | 106 ++++++-----
arch/powerpc/configs/mpc8313_rdb_defconfig | 173 +++++++++---------
arch/powerpc/configs/mpc832x_mds_defconfig | 155 ++++++++--------
arch/powerpc/configs/mpc832x_rdb_defconfig | 167 ++++++++---------
arch/powerpc/configs/mpc834x_itx_defconfig | 156 ++++++++--------
arch/powerpc/configs/mpc834x_itxgp_defconfig | 161 +++++++++-------
arch/powerpc/configs/mpc834x_mds_defconfig | 149 +++++++--------
arch/powerpc/configs/mpc836x_mds_defconfig | 155 ++++++++--------
arch/powerpc/configs/mpc8540_ads_defconfig | 101 +++++-----
arch/powerpc/configs/mpc8544_ds_defconfig | 130 +++++++------
arch/powerpc/configs/mpc8560_ads_defconfig | 104 +++++------
arch/powerpc/configs/mpc8568mds_defconfig | 161 ++++++++--------
arch/powerpc/configs/mpc8572_ds_defconfig | 130 +++++++------
arch/powerpc/configs/mpc85xx_cds_defconfig | 126 ++++++-------
arch/powerpc/configs/mpc8610_hpcd_defconfig | 114 +++++-------
arch/powerpc/configs/mpc8641_hpcn_defconfig | 131 +++++++------
arch/powerpc/configs/mpc866_ads_defconfig | 107 +++++------
arch/powerpc/configs/mpc885_ads_defconfig | 98 +++++-----
arch/powerpc/configs/pasemi_defconfig | 8 +
arch/powerpc/configs/pmac32_defconfig | 217 ++++++++++++++--------
arch/powerpc/configs/ppc64_defconfig | 9 +
arch/powerpc/configs/pq2fads_defconfig | 148 +++++++++------
arch/powerpc/configs/prpmc2800_defconfig | 150 ++++++++-------
arch/powerpc/configs/ps3_defconfig | 177 +++++++++---------
arch/powerpc/configs/pseries_defconfig | 156 +++++++++-------
arch/powerpc/configs/sequoia_defconfig | 111 ++++++-----
arch/powerpc/configs/walnut_defconfig | 22 +-
arch/powerpc/kernel/process.c | 2
arch/ppc/platforms/4xx/xparameters/xparameters.h | 8 +
arch/ppc/syslib/virtex_devices.c | 8 -
include/asm-powerpc/time.h | 8 -
45 files changed, 2662 insertions(+), 2456 deletions(-)
Geoff Levand (1):
[POWERPC] PS3: Update ps3_defconfig
Grant Likely (1):
[POWERPC] virtex bug fix: Use canonical value for AC97 interrupt xparams
Paul Mackerras (1):
[POWERPC] Update defconfigs
Stephen Rothwell (1):
[POWERPC] Update iseries_defconfig
Tony Breeds (1):
[POWERPC] Fix hardware IRQ time accounting problem.
^ permalink raw reply
* Re: [PATCH] pci: Fix bus resource assignment on 32 bits with 64b resources
From: Greg KH @ 2007-12-07 1:00 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, linux-pci, linux-kernel
In-Reply-To: <1196927934.7033.39.camel@pasglop>
On Thu, Dec 06, 2007 at 06:58:54PM +1100, Benjamin Herrenschmidt wrote:
>
> On Wed, 2007-12-05 at 22:39 -0800, Greg KH wrote:
> > > that is it can be either unsigned int, unsigned long or unsigned
> > long
> > > long... and we have no way to reliably printk that.
> >
> > We do this already just fine. Take a look in the kernel, I think we
> > just always cast it to long long to be uniform.
>
> I wanted to avoid that for two reasons:
>
> - casts are fugly
> - it adds support code to cast & handle 64 bits to 32 bits platforms
> that wouldn't normally need it
But that is how we already handle this today, in numerous places in the
kernel for this very type.
So, you can disagree that this is what we need to do, and if so, feel
free to fix up a whole lot of files in the tree :)
thanks,
greg k-h
^ permalink raw reply
* Re: [PATCH 1/5] PowerPC 74xx: Katana Qp device tree
From: Mark A. Greer @ 2007-12-06 23:27 UTC (permalink / raw)
To: David Gibson; +Cc: linuxppc-dev
In-Reply-To: <20071204025032.GH32577@localhost.localdomain>
David, et. al.,
This is a big blob patch of what I've changed for the prpmc2800. It
includes the necessary changes in the kernel which you can probably
ignore but they're there for reference. If you like the dts, then I'll
split the blob up into logical pieces and Andrei can make similar
changes for the Katana Qp.
Let me know what you think.
Mark
---
This patch is based on the latest powerpc.git tree
(44032af0e7d5467b12f998dbf2f1cd23c5324fd5) with the following patches
applied:
http://patchwork.ozlabs.org/linuxppc/patch?id=14339
http://patchwork.ozlabs.org/linuxppc/patch?id=14397
http://patchwork.ozlabs.org/linuxppc/patch?id=14396
http://patchwork.ozlabs.org/linuxppc/patch?id=14631
http://patchwork.ozlabs.org/linuxppc/patch?id=14632
http://patchwork.ozlabs.org/linuxppc/patch?id=14633
http://patchwork.ozlabs.org/linuxppc/patch?id=15007
arch/powerpc/boot/dts/prpmc2800.dts | 320 +++++++--------
arch/powerpc/boot/mpsc.c | 2
arch/powerpc/boot/serial.c | 2
arch/powerpc/platforms/embedded6xx/prpmc2800.c | 4
arch/powerpc/sysdev/mv64x60_dev.c | 29 -
arch/powerpc/sysdev/mv64x60_pci.c | 6
arch/powerpc/sysdev/mv64x60_pic.c | 4
arch/powerpc/sysdev/mv64x60_udbg.c | 4
8 files changed, 181 insertions(+), 190 deletions(-)
diff --git a/arch/powerpc/boot/dts/prpmc2800.dts b/arch/powerpc/boot/dts/prpmc2800.dts
index 24944ca..080130e 100644
--- a/arch/powerpc/boot/dts/prpmc2800.dts
+++ b/arch/powerpc/boot/dts/prpmc2800.dts
@@ -11,6 +11,8 @@
* if it can determine the exact PrPMC type.
*/
+/dts-v1/;
+
/ {
#address-cells = <1>;
#size-cells = <1>;
@@ -25,64 +27,64 @@
PowerPC,7447 {
device_type = "cpu";
reg = <0>;
- clock-frequency = <2bb0b140>; /* Default (733 MHz) */
- bus-frequency = <7f28155>; /* 133.333333 MHz */
- timebase-frequency = <1fca055>; /* 33.333333 MHz */
- i-cache-line-size = <20>;
- d-cache-line-size = <20>;
- i-cache-size = <8000>;
- d-cache-size = <8000>;
+ clock-frequency = <733333333>; /* Default */
+ bus-frequency = <133333333>;
+ timebase-frequency = <33333333>;
+ i-cache-line-size = <0x20>;
+ d-cache-line-size = <0x20>;
+ i-cache-size = <0x8000>;
+ d-cache-size = <0x8000>;
};
};
memory {
device_type = "memory";
- reg = <00000000 20000000>; /* Default (512MB) */
+ reg = <0x00000000 0x20000000>; /* Default (512MB) */
};
mv64x60@f1000000 { /* Marvell Discovery */
#address-cells = <1>;
#size-cells = <1>;
model = "mv64360"; /* Default */
- compatible = "marvell,mv64x60";
- clock-frequency = <7f28155>; /* 133.333333 MHz */
- reg = <f1000000 00010000>;
- virtual-reg = <f1000000>;
- ranges = <88000000 88000000 01000000 /* PCI 0 I/O Space */
- 80000000 80000000 08000000 /* PCI 0 MEM Space */
- a0000000 a0000000 04000000 /* User FLASH */
- 00000000 f1000000 00010000 /* Bridge's regs */
- f2000000 f2000000 00040000>; /* Integrated SRAM */
+ compatible = "marvell,mv64360";
+ clock-frequency = <133333333>;
+ reg = <0xf1000000 0x00010000>;
+ virtual-reg = <0xf1000000>;
+ ranges = <0x88000000 0x88000000 0x01000000 /* PCI 0 I/O Space */
+ 0x80000000 0x80000000 0x08000000 /* PCI 0 MEM Space */
+ 0xa0000000 0xa0000000 0x04000000 /* User FLASH */
+ 0x00000000 0xf1000000 0x00010000 /* Bridge's regs */
+ 0xf2000000 0xf2000000 0x00040000>;/* Integrated SRAM*/
flash@a0000000 {
compatible = "cfi-flash";
- reg = <a0000000 04000000>;
+ reg = <0xa0000000 0x04000000>;
bank-width = <4>;
device-width = <2>;
#address-cells = <1>;
#size-cells = <1>;
fw@0 {
label = "FW Image A";
- reg = <00000000 00100000>;
+ reg = <0x00000000 0x00100000>;
read-only;
};
cfg@100000 {
label = "FW Config Data"; /* RW */
- reg = <00100000 00040000>;
+ reg = <0x00100000 0x00040000>;
};
kernel@140000 {
label = "Kernel Image";
- reg = <00140000 00400000>;
+ reg = <0x00140000 0x00400000>;
read-only;
};
fs@540000 {
label = "Filesystem";
- reg = <00540000 039c0000>;
+ reg = <0x00540000 0x039c0000>;
read-only;
};
fw@3f00000 {
label = "FW Image B";
- reg = <03f00000 00100000>;
+ reg = <0x03f00000 0x00100000>;
read-only;
};
};
@@ -91,171 +93,167 @@
#address-cells = <1>;
#size-cells = <0>;
device_type = "mdio";
- compatible = "marvell,mv64x60-mdio";
- ethernet-phy@1 {
+ compatible = "marvell,mv64360-mdio";
+ phy0: ethernet-phy@1 {
device_type = "ethernet-phy";
compatible = "broadcom,bcm5421";
- interrupts = <4c>; /* GPP 12 */
- interrupt-parent = <&/mv64x60/pic>;
+ interrupts = <76>; /* GPP 12 */
+ interrupt-parent = <&pic>;
reg = <1>;
};
- ethernet-phy@3 {
+ phy1: ethernet-phy@3 {
device_type = "ethernet-phy";
compatible = "broadcom,bcm5421";
- interrupts = <4c>; /* GPP 12 */
- interrupt-parent = <&/mv64x60/pic>;
+ interrupts = <76>; /* GPP 12 */
+ interrupt-parent = <&pic>;
reg = <3>;
};
};
- ethernet@2000 {
- reg = <2000 2000>;
- eth0 {
+ multiethernet@2000 {
+ reg = <0x2000 0x2000>;
+ ethernet@0 {
device_type = "network";
- compatible = "marvell,mv64x60-eth";
- block-index = <0>;
- interrupts = <20>;
- interrupt-parent = <&/mv64x60/pic>;
- phy = <&/mv64x60/mdio/ethernet-phy@1>;
+ compatible = "marvell,mv64360-eth";
+ reg = <0>;
+ interrupts = <32>;
+ interrupt-parent = <&pic>;
+ phy = <&phy0>;
local-mac-address = [ 00 00 00 00 00 00 ];
};
- eth1 {
+ ethernet@1 {
device_type = "network";
- compatible = "marvell,mv64x60-eth";
- block-index = <1>;
- interrupts = <21>;
- interrupt-parent = <&/mv64x60/pic>;
- phy = <&/mv64x60/mdio/ethernet-phy@3>;
+ compatible = "marvell,mv64360-eth";
+ reg = <1>;
+ interrupts = <33>;
+ interrupt-parent = <&pic>;
+ phy = <&phy1>;
local-mac-address = [ 00 00 00 00 00 00 ];
};
};
- sdma@4000 {
- device_type = "dma";
- compatible = "marvell,mv64x60-sdma";
- reg = <4000 c18>;
- virtual-reg = <f1004000>;
+ sdma0: sdma@4000 {
+ compatible = "marvell,mv64360-sdma";
+ reg = <0x4000 0xc18>;
+ virtual-reg = <0xf1004000>;
interrupt-base = <0>;
- interrupts = <24>;
- interrupt-parent = <&/mv64x60/pic>;
+ interrupts = <36>;
+ interrupt-parent = <&pic>;
};
- sdma@6000 {
- device_type = "dma";
- compatible = "marvell,mv64x60-sdma";
- reg = <6000 c18>;
- virtual-reg = <f1006000>;
+ sdma1: sdma@6000 {
+ compatible = "marvell,mv64360-sdma";
+ reg = <0x6000 0xc18>;
+ virtual-reg = <0xf1006000>;
interrupt-base = <0>;
- interrupts = <26>;
- interrupt-parent = <&/mv64x60/pic>;
+ interrupts = <38>;
+ interrupt-parent = <&pic>;
};
- brg@b200 {
- compatible = "marvell,mv64x60-brg";
- reg = <b200 8>;
+ brg0: brg@b200 {
+ compatible = "marvell,mv64360-brg";
+ reg = <0xb200 0x8>;
clock-src = <8>;
- clock-frequency = <7ed6b40>;
- current-speed = <2580>;
+ clock-frequency = <133000000>;
+ current-speed = <9600>;
bcr = <0>;
};
- brg@b208 {
- compatible = "marvell,mv64x60-brg";
- reg = <b208 8>;
+ brg1: brg@b208 {
+ compatible = "marvell,mv64360-brg";
+ reg = <0xb208 0x8>;
clock-src = <8>;
- clock-frequency = <7ed6b40>;
- current-speed = <2580>;
+ clock-frequency = <133000000>;
+ current-speed = <9600>;
bcr = <0>;
};
- cunit@f200 {
- reg = <f200 200>;
+ cunit: cunit@f200 {
+ reg = <0xf200 0x200>;
};
- mpscrouting@b400 {
- reg = <b400 c>;
+ mpscrouting: mpscrouting@b400 {
+ reg = <0xb400 0xc>;
};
- mpscintr@b800 {
- reg = <b800 100>;
- virtual-reg = <f100b800>;
+ mpscintr: mpscintr@b800 {
+ reg = <0xb800 0x100>;
+ virtual-reg = <0xf100b800>;
};
- mpsc@8000 {
+ mpsc0: mpsc@8000 {
device_type = "serial";
- compatible = "marvell,mpsc";
- reg = <8000 38>;
- virtual-reg = <f1008000>;
- sdma = <&/mv64x60/sdma@4000>;
- brg = <&/mv64x60/brg@b200>;
- cunit = <&/mv64x60/cunit@f200>;
- mpscrouting = <&/mv64x60/mpscrouting@b400>;
- mpscintr = <&/mv64x60/mpscintr@b800>;
- block-index = <0>;
- max_idle = <28>;
+ compatible = "marvell,mv64360-mpsc";
+ reg = <0x8000 0x38>;
+ virtual-reg = <0xf1008000>;
+ sdma = <&sdma0>;
+ brg = <&brg0>;
+ cunit = <&cunit>;
+ mpscrouting = <&mpscrouting>;
+ mpscintr = <&mpscintr>;
+ cell-index = <0>;
+ max_idle = <40>;
chr_1 = <0>;
chr_2 = <0>;
chr_10 = <3>;
mpcr = <0>;
- interrupts = <28>;
- interrupt-parent = <&/mv64x60/pic>;
+ interrupts = <40>;
+ interrupt-parent = <&pic>;
};
- mpsc@9000 {
+ mpsc1: mpsc@9000 {
device_type = "serial";
- compatible = "marvell,mpsc";
- reg = <9000 38>;
- virtual-reg = <f1009000>;
- sdma = <&/mv64x60/sdma@6000>;
- brg = <&/mv64x60/brg@b208>;
- cunit = <&/mv64x60/cunit@f200>;
- mpscrouting = <&/mv64x60/mpscrouting@b400>;
- mpscintr = <&/mv64x60/mpscintr@b800>;
- block-index = <1>;
- max_idle = <28>;
+ compatible = "marvell,mv64360-mpsc";
+ reg = <0x9000 0x38>;
+ virtual-reg = <0xf1009000>;
+ sdma = <&sdma1>;
+ brg = <&brg1>;
+ cunit = <&cunit>;
+ mpscrouting = <&mpscrouting>;
+ mpscintr = <&mpscintr>;
+ cell-index = <1>;
+ max_idle = <40>;
chr_1 = <0>;
chr_2 = <0>;
chr_10 = <3>;
mpcr = <0>;
- interrupts = <2a>;
- interrupt-parent = <&/mv64x60/pic>;
+ interrupts = <42>;
+ interrupt-parent = <&pic>;
};
wdt@b410 { /* watchdog timer */
- compatible = "marvell,mv64x60-wdt";
- reg = <b410 8>;
- timeout = <a>; /* wdt timeout in seconds */
+ compatible = "marvell,mv64360-wdt";
+ reg = <0xb410 0x8>;
};
i2c@c000 {
device_type = "i2c";
- compatible = "marvell,mv64x60-i2c";
- reg = <c000 20>;
- virtual-reg = <f100c000>;
+ compatible = "marvell,mv64360-i2c";
+ reg = <0xc000 0x20>;
+ virtual-reg = <0xf100c000>;
freq_m = <8>;
freq_n = <3>;
- timeout = <3e8>; /* 1000 = 1 second */
retries = <1>;
- interrupts = <25>;
- interrupt-parent = <&/mv64x60/pic>;
+ interrupts = <37>;
+ interrupt-parent = <&pic>;
};
- pic {
+ pic: pic@0 {
#interrupt-cells = <1>;
#address-cells = <0>;
- compatible = "marvell,mv64x60-pic";
- reg = <0000 88>;
+ compatible = "marvell,mv64360-pic";
+ reg = <0x0000 0x88>;
interrupt-controller;
};
mpp@f000 {
- compatible = "marvell,mv64x60-mpp";
- reg = <f000 10>;
+ compatible = "marvell,mv64360-mpp";
+ reg = <0xf000 0x10>;
};
gpp@f100 {
- compatible = "marvell,mv64x60-gpp";
- reg = <f100 20>;
+ compatible = "marvell,mv64360-gpp";
+ reg = <0xf100 0x20>;
};
pci@80000000 {
@@ -263,68 +261,70 @@
#size-cells = <2>;
#interrupt-cells = <1>;
device_type = "pci";
- compatible = "marvell,mv64x60-pci";
- reg = <0cf8 8>;
- ranges = <01000000 0 0 88000000 0 01000000
- 02000000 0 80000000 80000000 0 08000000>;
- bus-range = <0 ff>;
- clock-frequency = <3EF1480>;
- interrupt-pci-iack = <0c34>;
- interrupt-parent = <&/mv64x60/pic>;
- interrupt-map-mask = <f800 0 0 7>;
+ compatible = "marvell,mv64360-pci";
+ reg = <0x0cf8 0x8>;
+ ranges = <0x01000000 0x0 0x0
+ 0x88000000 0x0 0x01000000
+ 0x02000000 0x0 0x80000000
+ 0x80000000 0x0 0x08000000>;
+ bus-range = <0x0 0xff>;
+ clock-frequency = <66000000>;
+ interrupt-pci-iack = <0x0c34>;
+ interrupt-parent = <&pic>;
+ interrupt-map-mask = <0xf800 0 0 7>;
interrupt-map = <
/* IDSEL 0x0a */
- 5000 0 0 1 &/mv64x60/pic 50
- 5000 0 0 2 &/mv64x60/pic 51
- 5000 0 0 3 &/mv64x60/pic 5b
- 5000 0 0 4 &/mv64x60/pic 5d
+ 0x5000 0 0 1 &pic 80
+ 0x5000 0 0 2 &pic 81
+ 0x5000 0 0 3 &pic 91
+ 0x5000 0 0 4 &pic 93
/* IDSEL 0x0b */
- 5800 0 0 1 &/mv64x60/pic 5b
- 5800 0 0 2 &/mv64x60/pic 5d
- 5800 0 0 3 &/mv64x60/pic 50
- 5800 0 0 4 &/mv64x60/pic 51
+ 0x5800 0 0 1 &pic 91
+ 0x5800 0 0 2 &pic 93
+ 0x5800 0 0 3 &pic 80
+ 0x5800 0 0 4 &pic 81
/* IDSEL 0x0c */
- 6000 0 0 1 &/mv64x60/pic 5b
- 6000 0 0 2 &/mv64x60/pic 5d
- 6000 0 0 3 &/mv64x60/pic 50
- 6000 0 0 4 &/mv64x60/pic 51
+ 0x6000 0 0 1 &pic 91
+ 0x6000 0 0 2 &pic 93
+ 0x6000 0 0 3 &pic 80
+ 0x6000 0 0 4 &pic 81
/* IDSEL 0x0d */
- 6800 0 0 1 &/mv64x60/pic 5d
- 6800 0 0 2 &/mv64x60/pic 50
- 6800 0 0 3 &/mv64x60/pic 51
- 6800 0 0 4 &/mv64x60/pic 5b
+ 0x6800 0 0 1 &pic 93
+ 0x6800 0 0 2 &pic 80
+ 0x6800 0 0 3 &pic 81
+ 0x6800 0 0 4 &pic 91
>;
};
- cpu-error@0070 {
- compatible = "marvell,mv64x60-cpu-error";
- reg = <0070 10 0128 28>;
- interrupts = <03>;
- interrupt-parent = <&/mv64x60/pic>;
+ cpu-error@70 {
+ compatible = "marvell,mv64360-cpu-error";
+ reg = <0x0070 0x10 0x0128 0x28>;
+ interrupts = <3>;
+ interrupt-parent = <&pic>;
};
- sram-ctrl@0380 {
- compatible = "marvell,mv64x60-sram-ctrl";
- reg = <0380 80>;
- interrupts = <0d>;
- interrupt-parent = <&/mv64x60/pic>;
+ sram-ctrl@380 {
+ compatible = "marvell,mv64360-sram-ctrl";
+ reg = <0x0380 0x80>;
+ interrupts = <13>;
+ interrupt-parent = <&pic>;
};
pci-error@1d40 {
- compatible = "marvell,mv64x60-pci-error";
- reg = <1d40 40 0c28 4>;
- interrupts = <0c>;
- interrupt-parent = <&/mv64x60/pic>;
+ compatible = "marvell,mv64360-pci-error";
+ reg = <0x1d40 0x40 0x0c28 0x4>;
+ interrupts = <12>;
+ interrupt-parent = <&pic>;
};
mem-ctrl@1400 {
- compatible = "marvell,mv64x60-mem-ctrl";
- reg = <1400 60>;
- interrupts = <11>;
- interrupt-parent = <&/mv64x60/pic>;
+ compatible = "marvell,mv64360-mem-ctrl";
+ reg = <0x1400 0x60>;
+ interrupts = <17>;
+ interrupt-parent = <&pic>;
};
};
diff --git a/arch/powerpc/boot/mpsc.c b/arch/powerpc/boot/mpsc.c
index 802ea53..425ad88 100644
--- a/arch/powerpc/boot/mpsc.c
+++ b/arch/powerpc/boot/mpsc.c
@@ -141,7 +141,7 @@ int mpsc_console_init(void *devp, struct serial_console_data *scdp)
if (mpscintr_base == NULL)
goto err_out;
- n = getprop(devp, "block-index", &v, sizeof(v));
+ n = getprop(devp, "cell-index", &v, sizeof(v));
if (n != sizeof(v))
goto err_out;
reg_set = (int)v;
diff --git a/arch/powerpc/boot/serial.c b/arch/powerpc/boot/serial.c
index cafeece..cbcbb20 100644
--- a/arch/powerpc/boot/serial.c
+++ b/arch/powerpc/boot/serial.c
@@ -119,7 +119,7 @@ int serial_console_init(void)
if (dt_is_compatible(devp, "ns16550"))
rc = ns16550_console_init(devp, &serial_cd);
- else if (dt_is_compatible(devp, "marvell,mpsc"))
+ else if (dt_is_compatible(devp, "marvell,mv64360-mpsc"))
rc = mpsc_console_init(devp, &serial_cd);
else if (dt_is_compatible(devp, "fsl,cpm1-scc-uart") ||
dt_is_compatible(devp, "fsl,cpm1-smc-uart") ||
diff --git a/arch/powerpc/platforms/embedded6xx/prpmc2800.c b/arch/powerpc/platforms/embedded6xx/prpmc2800.c
index a01e219..1a1baf9 100644
--- a/arch/powerpc/platforms/embedded6xx/prpmc2800.c
+++ b/arch/powerpc/platforms/embedded6xx/prpmc2800.c
@@ -50,13 +50,13 @@ static void __init prpmc2800_setup_arch(void)
* ioremap mpp and gpp registers in case they are later
* needed by prpmc2800_reset_board().
*/
- np = of_find_compatible_node(NULL, NULL, "marvell,mv64x60-mpp");
+ np = of_find_compatible_node(NULL, NULL, "marvell,mv64360-mpp");
reg = of_get_property(np, "reg", NULL);
paddr = of_translate_address(np, reg);
of_node_put(np);
mv64x60_mpp_reg_base = ioremap(paddr, reg[1]);
- np = of_find_compatible_node(NULL, NULL, "marvell,mv64x60-gpp");
+ np = of_find_compatible_node(NULL, NULL, "marvell,mv64360-gpp");
reg = of_get_property(np, "reg", NULL);
paddr = of_translate_address(np, reg);
of_node_put(np);
diff --git a/arch/powerpc/sysdev/mv64x60_dev.c b/arch/powerpc/sysdev/mv64x60_dev.c
index 304056c..aac28ee 100644
--- a/arch/powerpc/sysdev/mv64x60_dev.c
+++ b/arch/powerpc/sysdev/mv64x60_dev.c
@@ -127,7 +127,7 @@ static int __init mv64x60_mpsc_device_setup(struct device_node *np, int id)
if (err)
return err;
- prop = of_get_property(np, "block-index", NULL);
+ prop = of_get_property(np, "cell-index", NULL);
if (!prop)
return -ENODEV;
port_number = *(int *)prop;
@@ -248,7 +248,7 @@ static int __init mv64x60_eth_device_setup(struct device_node *np, int id)
memset(&pdata, 0, sizeof(pdata));
- prop = of_get_property(np, "block-index", NULL);
+ prop = of_get_property(np, "reg", NULL);
if (!prop)
return -ENODEV;
pdata.port_number = *prop;
@@ -344,6 +344,7 @@ static int __init mv64x60_i2c_device_setup(struct device_node *np, int id)
of_irq_to_resource(np, 0, &r[1]);
memset(&pdata, 0, sizeof(pdata));
+ pdata.timeout = 1000; /* Default: 1 second */
prop = of_get_property(np, "freq_m", NULL);
if (!prop)
@@ -355,12 +356,6 @@ static int __init mv64x60_i2c_device_setup(struct device_node *np, int id)
return -ENODEV;
pdata.freq_n = *prop;
- prop = of_get_property(np, "timeout", NULL);
- if (prop)
- pdata.timeout = *prop;
- else
- pdata.timeout = 1000; /* 1 second */
-
prop = of_get_property(np, "retries", NULL);
if (prop)
pdata.retries = *prop;
@@ -406,11 +401,7 @@ static int __init mv64x60_wdt_device_setup(struct device_node *np, int id)
return err;
memset(&pdata, 0, sizeof(pdata));
-
- prop = of_get_property(np, "timeout", NULL);
- if (!prop)
- return -ENODEV;
- pdata.timeout = *prop;
+ pdata.timeout = 10; /* Default: 10 seconds */
np = of_get_parent(np);
if (!np)
@@ -452,22 +443,22 @@ static int __init mv64x60_device_setup(void)
int err;
id = 0;
- for_each_compatible_node(np, "serial", "marvell,mpsc")
+ for_each_compatible_node(np, "serial", "marvell,mv64360-mpsc")
if ((err = mv64x60_mpsc_device_setup(np, id++)))
goto error;
id = 0;
- for_each_compatible_node(np, "network", "marvell,mv64x60-eth")
+ for_each_compatible_node(np, "network", "marvell,mv64360-eth")
if ((err = mv64x60_eth_device_setup(np, id++)))
goto error;
id = 0;
- for_each_compatible_node(np, "i2c", "marvell,mv64x60-i2c")
+ for_each_compatible_node(np, "i2c", "marvell,mv64360-i2c")
if ((err = mv64x60_i2c_device_setup(np, id++)))
goto error;
/* support up to one watchdog timer */
- np = of_find_compatible_node(np, NULL, "marvell,mv64x60-wdt");
+ np = of_find_compatible_node(np, NULL, "marvell,mv64360-wdt");
if (np) {
if ((err = mv64x60_wdt_device_setup(np, id)))
goto error;
@@ -495,10 +486,10 @@ static int __init mv64x60_add_mpsc_console(void)
if (!np)
goto not_mpsc;
- if (!of_device_is_compatible(np, "marvell,mpsc"))
+ if (!of_device_is_compatible(np, "marvell,mv64360-mpsc"))
goto not_mpsc;
- prop = of_get_property(np, "block-index", NULL);
+ prop = of_get_property(np, "cell-index", NULL);
if (!prop)
goto not_mpsc;
diff --git a/arch/powerpc/sysdev/mv64x60_pci.c b/arch/powerpc/sysdev/mv64x60_pci.c
index d21ab8f..1456015 100644
--- a/arch/powerpc/sysdev/mv64x60_pci.c
+++ b/arch/powerpc/sysdev/mv64x60_pci.c
@@ -86,14 +86,14 @@ static int __init mv64x60_sysfs_init(void)
struct platform_device *pdev;
const unsigned int *prop;
- np = of_find_compatible_node(NULL, NULL, "marvell,mv64x60");
+ np = of_find_compatible_node(NULL, NULL, "marvell,mv64360");
if (!np)
return 0;
prop = of_get_property(np, "hs_reg_valid", NULL);
of_node_put(np);
- pdev = platform_device_register_simple("marvell,mv64x60", 0, NULL, 0);
+ pdev = platform_device_register_simple("marvell,mv64360", 0, NULL, 0);
if (IS_ERR(pdev))
return PTR_ERR(pdev);
@@ -166,6 +166,6 @@ void __init mv64x60_pci_init(void)
{
struct device_node *np;
- for_each_compatible_node(np, "pci", "marvell,mv64x60-pci")
+ for_each_compatible_node(np, "pci", "marvell,mv64360-pci")
mv64x60_add_bridge(np);
}
diff --git a/arch/powerpc/sysdev/mv64x60_pic.c b/arch/powerpc/sysdev/mv64x60_pic.c
index 19e6ef2..2aa4ed0 100644
--- a/arch/powerpc/sysdev/mv64x60_pic.c
+++ b/arch/powerpc/sysdev/mv64x60_pic.c
@@ -238,13 +238,13 @@ void __init mv64x60_init_irq(void)
const unsigned int *reg;
unsigned long flags;
- np = of_find_compatible_node(NULL, NULL, "marvell,mv64x60-gpp");
+ np = of_find_compatible_node(NULL, NULL, "marvell,mv64360-gpp");
reg = of_get_property(np, "reg", &size);
paddr = of_translate_address(np, reg);
mv64x60_gpp_reg_base = ioremap(paddr, reg[1]);
of_node_put(np);
- np = of_find_compatible_node(NULL, NULL, "marvell,mv64x60-pic");
+ np = of_find_compatible_node(NULL, NULL, "marvell,mv64360-pic");
reg = of_get_property(np, "reg", &size);
paddr = of_translate_address(np, reg);
mv64x60_irq_reg_base = ioremap(paddr, reg[1]);
diff --git a/arch/powerpc/sysdev/mv64x60_udbg.c b/arch/powerpc/sysdev/mv64x60_udbg.c
index 35c77c7..2792dc8 100644
--- a/arch/powerpc/sysdev/mv64x60_udbg.c
+++ b/arch/powerpc/sysdev/mv64x60_udbg.c
@@ -85,7 +85,7 @@ static void mv64x60_udbg_init(void)
if (!stdout)
return;
- for_each_compatible_node(np, "serial", "marvell,mpsc") {
+ for_each_compatible_node(np, "serial", "marvell,mv64360-mpsc") {
if (np == stdout)
break;
}
@@ -94,7 +94,7 @@ static void mv64x60_udbg_init(void)
if (!np)
return;
- block_index = of_get_property(np, "block-index", NULL);
+ block_index = of_get_property(np, "cell-index", NULL);
if (!block_index)
goto error;
^ permalink raw reply related
* [PATCH 3/3] [POWERPC] MPC8349E-mITX: Vitesse 7385 PHY is not connected to the MDIO bus
From: Vitaly Bordug @ 2007-12-06 22:51 UTC (permalink / raw)
To: Paul Mackerras; +Cc: netdev, linuxppc-dev
In-Reply-To: <20071206225121.31080.86606.stgit@localhost.localdomain>
...thus use fixed-link to register proper "Fixed PHY"
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>
---
arch/powerpc/boot/dts/mpc8349emitx.dts | 11 ++---------
1 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts b/arch/powerpc/boot/dts/mpc8349emitx.dts
index 5072f6d..877ee6d 100644
--- a/arch/powerpc/boot/dts/mpc8349emitx.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitx.dts
@@ -115,14 +115,6 @@
reg = <1c>;
device_type = "ethernet-phy";
};
-
- /* Vitesse 7385 */
- phy1f: ethernet-phy@1f {
- interrupt-parent = < &ipic >;
- interrupts = <12 8>;
- reg = <1f>;
- device_type = "ethernet-phy";
- };
};
ethernet@24000 {
@@ -159,7 +151,8 @@
local-mac-address = [ 00 00 00 00 00 00 ];
interrupts = <23 8 24 8 25 8>;
interrupt-parent = < &ipic >;
- phy-handle = < &phy1f >;
+ /* Vitesse 7385 isn't on the MDIO bus */
+ fixed-link = <1 1 d#1000 0 0>;
linux,network-index = <1>;
};
^ permalink raw reply related
* [PATCH 2/3] [POWERPC] fsl_soc: add support for gianfar for fixed-link property
From: Vitaly Bordug @ 2007-12-06 22:51 UTC (permalink / raw)
To: Paul Mackerras; +Cc: netdev, linuxppc-dev
In-Reply-To: <20071206225121.31080.86606.stgit@localhost.localdomain>
fixed-link says: register new "Fixed/emulated PHY", i.e. PHY that
not connected to the real MDIO bus.
Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
Documentation/powerpc/booting-without-of.txt | 4 +
arch/powerpc/sysdev/fsl_soc.c | 79 ++++++++++++++++++++------
2 files changed, 66 insertions(+), 17 deletions(-)
diff --git a/Documentation/powerpc/booting-without-of.txt b/Documentation/powerpc/booting-without-of.txt
index e9a3cb1..9dfd308 100644
--- a/Documentation/powerpc/booting-without-of.txt
+++ b/Documentation/powerpc/booting-without-of.txt
@@ -1254,6 +1254,10 @@ platforms are moved over to use the flattened-device-tree model.
services interrupts for this device.
- phy-handle : The phandle for the PHY connected to this ethernet
controller.
+ - fixed-link : <a b c d e> where a is emulated phy id - choose any,
+ but unique to the all specified fixed-links, b is duplex - 0 half,
+ 1 full, c is link speed - d#10/d#100/d#1000, d is pause - 0 no
+ pause, 1 pause, e is asym_pause - 0 no asym_pause, 1 asym_pause.
Recommended properties:
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 3ace747..a008e32 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -24,6 +24,7 @@
#include <linux/platform_device.h>
#include <linux/of_platform.h>
#include <linux/phy.h>
+#include <linux/phy_fixed.h>
#include <linux/spi/spi.h>
#include <linux/fsl_devices.h>
#include <linux/fs_enet_pd.h>
@@ -130,6 +131,37 @@ u32 get_baudrate(void)
EXPORT_SYMBOL(get_baudrate);
#endif /* CONFIG_CPM2 */
+#ifdef CONFIG_FIXED_PHY
+static int __init of_add_fixed_phys(void)
+{
+ int ret;
+ struct device_node *np;
+ u32 *fixed_link;
+ struct fixed_phy_status status = {};
+
+ for_each_node_by_name(np, "ethernet") {
+ fixed_link = (u32 *)of_get_property(np, "fixed-link", NULL);
+ if (!fixed_link)
+ continue;
+
+ status.link = 1;
+ status.duplex = fixed_link[1];
+ status.speed = fixed_link[2];
+ status.pause = fixed_link[3];
+ status.asym_pause = fixed_link[4];
+
+ ret = fixed_phy_add(PHY_POLL, fixed_link[0], &status);
+ if (ret) {
+ of_node_put(np);
+ return ret;
+ }
+ }
+
+ return 0;
+}
+arch_initcall(of_add_fixed_phys);
+#endif /* CONFIG_FIXED_PHY */
+
static int __init gfar_mdio_of_init(void)
{
struct device_node *np;
@@ -193,7 +225,6 @@ static const char *gfar_tx_intr = "tx";
static const char *gfar_rx_intr = "rx";
static const char *gfar_err_intr = "error";
-
static int __init gfar_of_init(void)
{
struct device_node *np;
@@ -277,29 +308,43 @@ static int __init gfar_of_init(void)
gfar_data.interface = PHY_INTERFACE_MODE_MII;
ph = of_get_property(np, "phy-handle", NULL);
- phy = of_find_node_by_phandle(*ph);
+ if (ph == NULL) {
+ u32 *fixed_link;
- if (phy == NULL) {
- ret = -ENODEV;
- goto unreg;
- }
+ fixed_link = (u32 *)of_get_property(np, "fixed-link",
+ NULL);
+ if (!fixed_link) {
+ ret = -ENODEV;
+ goto unreg;
+ }
- mdio = of_get_parent(phy);
+ gfar_data.bus_id = 0;
+ gfar_data.phy_id = fixed_link[0];
+ } else {
+ phy = of_find_node_by_phandle(*ph);
+
+ if (phy == NULL) {
+ ret = -ENODEV;
+ goto unreg;
+ }
+
+ mdio = of_get_parent(phy);
+
+ id = of_get_property(phy, "reg", NULL);
+ ret = of_address_to_resource(mdio, 0, &res);
+ if (ret) {
+ of_node_put(phy);
+ of_node_put(mdio);
+ goto unreg;
+ }
+
+ gfar_data.phy_id = *id;
+ gfar_data.bus_id = res.start;
- id = of_get_property(phy, "reg", NULL);
- ret = of_address_to_resource(mdio, 0, &res);
- if (ret) {
of_node_put(phy);
of_node_put(mdio);
- goto unreg;
}
- gfar_data.phy_id = *id;
- gfar_data.bus_id = res.start;
-
- of_node_put(phy);
- of_node_put(mdio);
-
ret =
platform_device_add_data(gfar_dev, &gfar_data,
sizeof(struct
^ permalink raw reply related
* [PATCH 1/3] [NET] phy/fixed.c: rework to not duplicate PHY layer functionality
From: Vitaly Bordug @ 2007-12-06 22:51 UTC (permalink / raw)
To: Paul Mackerras; +Cc: netdev, linuxppc-dev
With that patch fixed.c now fully emulates MDIO bus, thus no need
to duplicate PHY layer functionality. That, in turn, drastically
simplifies the code, and drops down line count.
As an additional bonus, now there is no need to register MDIO bus
for each PHY, all emulated PHYs placed on the platform fixed MDIO bus.
There is also no more need to pre-allocate PHYs via .config option,
this is all now handled dynamically.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Vitaly Bordug <vitb@kernel.crashing.org>
Acked-by: Jeff Garzik <jeff@garzik.org>
---
drivers/net/phy/Kconfig | 32 +--
drivers/net/phy/fixed.c | 445 +++++++++++++++++----------------------------
include/linux/phy_fixed.h | 51 ++---
3 files changed, 195 insertions(+), 333 deletions(-)
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
index 54b2ba9..7fe03ce 100644
--- a/drivers/net/phy/Kconfig
+++ b/drivers/net/phy/Kconfig
@@ -61,34 +61,12 @@ config ICPLUS_PHY
Currently supports the IP175C PHY.
config FIXED_PHY
- tristate "Drivers for PHY emulation on fixed speed/link"
+ bool "Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs"
---help---
- Adds the driver to PHY layer to cover the boards that do not have any PHY bound,
- but with the ability to manipulate the speed/link in software. The relevant MII
- speed/duplex parameters could be effectively handled in a user-specified function.
- Currently tested with mpc866ads.
-
-config FIXED_MII_10_FDX
- bool "Emulation for 10M Fdx fixed PHY behavior"
- depends on FIXED_PHY
-
-config FIXED_MII_100_FDX
- bool "Emulation for 100M Fdx fixed PHY behavior"
- depends on FIXED_PHY
-
-config FIXED_MII_1000_FDX
- bool "Emulation for 1000M Fdx fixed PHY behavior"
- depends on FIXED_PHY
-
-config FIXED_MII_AMNT
- int "Number of emulated PHYs to allocate "
- depends on FIXED_PHY
- default "1"
- ---help---
- Sometimes it is required to have several independent emulated
- PHYs on the bus (in case of multi-eth but phy-less HW for instance).
- This control will have specified number allocated for each fixed
- PHY type enabled.
+ Adds the platform "fixed" MDIO Bus to cover the boards that use
+ PHYs that are not connected to the real MDIO bus.
+
+ Currently tested with mpc866ads and mpc8349e-mitx.
config MDIO_BITBANG
tristate "Support for bitbanged MDIO buses"
diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c
index 5619182..73b6d39 100644
--- a/drivers/net/phy/fixed.c
+++ b/drivers/net/phy/fixed.c
@@ -1,362 +1,253 @@
/*
- * drivers/net/phy/fixed.c
+ * Fixed MDIO bus (MDIO bus emulation with fixed PHYs)
*
- * Driver for fixed PHYs, when transceiver is able to operate in one fixed mode.
+ * Author: Vitaly Bordug <vbordug@ru.mvista.com>
+ * Anton Vorontsov <avorontsov@ru.mvista.com>
*
- * Author: Vitaly Bordug
- *
- * Copyright (c) 2006 MontaVista Software, Inc.
+ * Copyright (c) 2006-2007 MontaVista Software, 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 <linux/string.h>
-#include <linux/errno.h>
-#include <linux/unistd.h>
-#include <linux/slab.h>
-#include <linux/interrupt.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/skbuff.h>
-#include <linux/spinlock.h>
-#include <linux/mm.h>
#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/list.h>
#include <linux/mii.h>
-#include <linux/ethtool.h>
#include <linux/phy.h>
#include <linux/phy_fixed.h>
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/uaccess.h>
+#define MII_REGS_NUM 29
-/* we need to track the allocated pointers in order to free them on exit */
-static struct fixed_info *fixed_phy_ptrs[CONFIG_FIXED_MII_AMNT*MAX_PHY_AMNT];
-
-/*-----------------------------------------------------------------------------
- * If something weird is required to be done with link/speed,
- * network driver is able to assign a function to implement this.
- * May be useful for PHY's that need to be software-driven.
- *-----------------------------------------------------------------------------*/
-int fixed_mdio_set_link_update(struct phy_device *phydev,
- int (*link_update) (struct net_device *,
- struct fixed_phy_status *))
-{
- struct fixed_info *fixed;
-
- if (link_update == NULL)
- return -EINVAL;
-
- if (phydev) {
- if (phydev->bus) {
- fixed = phydev->bus->priv;
- fixed->link_update = link_update;
- return 0;
- }
- }
- return -EINVAL;
-}
-
-EXPORT_SYMBOL(fixed_mdio_set_link_update);
+struct fixed_mdio_bus {
+ int irqs[PHY_MAX_ADDR];
+ struct mii_bus mii_bus;
+ struct list_head phys;
+};
-struct fixed_info *fixed_mdio_get_phydev (int phydev_ind)
-{
- if (phydev_ind >= MAX_PHY_AMNT)
- return NULL;
- return fixed_phy_ptrs[phydev_ind];
-}
+struct fixed_phy {
+ int id;
+ u16 regs[MII_REGS_NUM];
+ struct phy_device *phydev;
+ struct fixed_phy_status status;
+ int (*link_update)(struct net_device *, struct fixed_phy_status *);
+ struct list_head node;
+};
-EXPORT_SYMBOL(fixed_mdio_get_phydev);
+static struct platform_device *pdev;
+static struct fixed_mdio_bus platform_fmb = {
+ .phys = LIST_HEAD_INIT(platform_fmb.phys),
+};
-/*-----------------------------------------------------------------------------
- * This is used for updating internal mii regs from the status
- *-----------------------------------------------------------------------------*/
-#if defined(CONFIG_FIXED_MII_100_FDX) || defined(CONFIG_FIXED_MII_10_FDX) || defined(CONFIG_FIXED_MII_1000_FDX)
-static int fixed_mdio_update_regs(struct fixed_info *fixed)
+static int fixed_phy_update_regs(struct fixed_phy *fp)
{
- u16 *regs = fixed->regs;
- u16 bmsr = 0;
+ u16 bmsr = BMSR_ANEGCAPABLE;
u16 bmcr = 0;
+ u16 lpagb = 0;
+ u16 lpa = 0;
- if (!regs) {
- printk(KERN_ERR "%s: regs not set up", __FUNCTION__);
- return -EINVAL;
- }
-
- if (fixed->phy_status.link)
- bmsr |= BMSR_LSTATUS;
-
- if (fixed->phy_status.duplex) {
+ if (fp->status.duplex) {
bmcr |= BMCR_FULLDPLX;
- switch (fixed->phy_status.speed) {
+ switch (fp->status.speed) {
+ case 1000:
+ bmsr |= BMSR_ESTATEN;
+ bmcr |= BMCR_SPEED1000;
+ lpagb |= LPA_1000FULL;
+ break;
case 100:
bmsr |= BMSR_100FULL;
bmcr |= BMCR_SPEED100;
+ lpa |= LPA_100FULL;
break;
-
case 10:
bmsr |= BMSR_10FULL;
+ lpa |= LPA_10FULL;
break;
+ default:
+ printk(KERN_WARNING "fixed phy: unknown speed\n");
+ return -EINVAL;
}
} else {
- switch (fixed->phy_status.speed) {
+ switch (fp->status.speed) {
+ case 1000:
+ bmsr |= BMSR_ESTATEN;
+ bmcr |= BMCR_SPEED1000;
+ lpagb |= LPA_1000HALF;
+ break;
case 100:
bmsr |= BMSR_100HALF;
bmcr |= BMCR_SPEED100;
+ lpa |= LPA_100HALF;
break;
-
case 10:
- bmsr |= BMSR_100HALF;
+ bmsr |= BMSR_10HALF;
+ lpa |= LPA_10HALF;
break;
+ default:
+ printk(KERN_WARNING "fixed phy: unknown speed\n");
+ return -EINVAL;
}
}
- regs[MII_BMCR] = bmcr;
- regs[MII_BMSR] = bmsr | 0x800; /*we are always capable of 10 hdx */
+ if (fp->status.link)
+ bmsr |= BMSR_LSTATUS | BMSR_ANEGCOMPLETE;
+
+ if (fp->status.pause)
+ lpa |= LPA_PAUSE_CAP;
+
+ if (fp->status.asym_pause)
+ lpa |= LPA_PAUSE_ASYM;
+
+ fp->regs[MII_PHYSID1] = fp->id >> 16;
+ fp->regs[MII_PHYSID2] = fp->id;
+
+ fp->regs[MII_BMSR] = bmsr;
+ fp->regs[MII_BMCR] = bmcr;
+ fp->regs[MII_LPA] = lpa;
+ fp->regs[MII_STAT1000] = lpagb;
return 0;
}
-static int fixed_mii_read(struct mii_bus *bus, int phy_id, int location)
+static int fixed_mdio_read(struct mii_bus *bus, int phy_id, int reg_num)
{
- struct fixed_info *fixed = bus->priv;
-
- /* if user has registered link update callback, use it */
- if (fixed->phydev)
- if (fixed->phydev->attached_dev) {
- if (fixed->link_update) {
- fixed->link_update(fixed->phydev->attached_dev,
- &fixed->phy_status);
- fixed_mdio_update_regs(fixed);
+ struct fixed_mdio_bus *fmb = container_of(bus, struct fixed_mdio_bus,
+ mii_bus);
+ struct fixed_phy *fp;
+
+ if (reg_num >= MII_REGS_NUM)
+ return -1;
+
+ list_for_each_entry(fp, &fmb->phys, node) {
+ if (fp->id == phy_id) {
+ /* Issue callback if user registered it. */
+ if (fp->link_update) {
+ fp->link_update(fp->phydev->attached_dev,
+ &fp->status);
+ fixed_phy_update_regs(fp);
}
+ return fp->regs[reg_num];
}
+ }
- if ((unsigned int)location >= fixed->regs_num)
- return -1;
- return fixed->regs[location];
+ return 0xFFFF;
}
-static int fixed_mii_write(struct mii_bus *bus, int phy_id, int location,
- u16 val)
+static int fixed_mdio_write(struct mii_bus *bus, int phy_id, int reg_num,
+ u16 val)
{
- /* do nothing for now */
return 0;
}
-static int fixed_mii_reset(struct mii_bus *bus)
+/*
+ * If something weird is required to be done with link/speed,
+ * network driver is able to assign a function to implement this.
+ * May be useful for PHY's that need to be software-driven.
+ */
+int fixed_phy_set_link_update(struct phy_device *phydev,
+ int (*link_update)(struct net_device *,
+ struct fixed_phy_status *))
{
- /*nothing here - no way/need to reset it */
- return 0;
-}
-#endif
+ struct fixed_mdio_bus *fmb = &platform_fmb;
+ struct fixed_phy *fp;
-static int fixed_config_aneg(struct phy_device *phydev)
-{
- /* :TODO:03/13/2006 09:45:37 PM::
- The full autoneg funcionality can be emulated,
- but no need to have anything here for now
- */
- return 0;
-}
+ if (!link_update || !phydev || !phydev->bus)
+ return -EINVAL;
-/*-----------------------------------------------------------------------------
- * the manual bind will do the magic - with phy_id_mask == 0
- * match will never return true...
- *-----------------------------------------------------------------------------*/
-static struct phy_driver fixed_mdio_driver = {
- .name = "Fixed PHY",
-#ifdef CONFIG_FIXED_MII_1000_FDX
- .features = PHY_GBIT_FEATURES,
-#else
- .features = PHY_BASIC_FEATURES,
-#endif
- .config_aneg = fixed_config_aneg,
- .read_status = genphy_read_status,
- .driver = { .owner = THIS_MODULE, },
-};
+ list_for_each_entry(fp, &fmb->phys, node) {
+ if (fp->id == phydev->phy_id) {
+ fp->link_update = link_update;
+ fp->phydev = phydev;
+ return 0;
+ }
+ }
-static void fixed_mdio_release(struct device *dev)
-{
- struct phy_device *phydev = container_of(dev, struct phy_device, dev);
- struct mii_bus *bus = phydev->bus;
- struct fixed_info *fixed = bus->priv;
-
- kfree(phydev);
- kfree(bus->dev);
- kfree(bus);
- kfree(fixed->regs);
- kfree(fixed);
+ return -ENOENT;
}
+EXPORT_SYMBOL_GPL(fixed_phy_set_link_update);
-/*-----------------------------------------------------------------------------
- * This func is used to create all the necessary stuff, bind
- * the fixed phy driver and register all it on the mdio_bus_type.
- * speed is either 10 or 100 or 1000, duplex is boolean.
- * number is used to create multiple fixed PHYs, so that several devices can
- * utilize them simultaneously.
- *
- * The device on mdio bus will look like [bus_id]:[phy_id],
- * bus_id = number
- * phy_id = speed+duplex.
- *-----------------------------------------------------------------------------*/
-#if defined(CONFIG_FIXED_MII_100_FDX) || defined(CONFIG_FIXED_MII_10_FDX) || defined(CONFIG_FIXED_MII_1000_FDX)
-struct fixed_info *fixed_mdio_register_device(
- int bus_id, int speed, int duplex, u8 phy_id)
+int fixed_phy_add(unsigned int irq, int phy_id,
+ struct fixed_phy_status *status)
{
- struct mii_bus *new_bus;
- struct fixed_info *fixed;
- struct phy_device *phydev;
- int err;
+ int ret;
+ struct fixed_mdio_bus *fmb = &platform_fmb;
+ struct fixed_phy *fp;
- struct device *dev = kzalloc(sizeof(struct device), GFP_KERNEL);
+ fp = kzalloc(sizeof(*fp), GFP_KERNEL);
+ if (!fp)
+ return -ENOMEM;
- if (dev == NULL)
- goto err_dev_alloc;
+ memset(fp->regs, 0xFF, sizeof(fp->regs[0]) * MII_REGS_NUM);
- new_bus = kzalloc(sizeof(struct mii_bus), GFP_KERNEL);
+ fmb->irqs[phy_id] = irq;
- if (new_bus == NULL)
- goto err_bus_alloc;
+ fp->id = phy_id;
+ fp->status = *status;
- fixed = kzalloc(sizeof(struct fixed_info), GFP_KERNEL);
+ ret = fixed_phy_update_regs(fp);
+ if (ret)
+ goto err_regs;
- if (fixed == NULL)
- goto err_fixed_alloc;
+ list_add_tail(&fp->node, &fmb->phys);
- fixed->regs = kzalloc(MII_REGS_NUM * sizeof(int), GFP_KERNEL);
- if (NULL == fixed->regs)
- goto err_fixed_regs_alloc;
+ return 0;
- fixed->regs_num = MII_REGS_NUM;
- fixed->phy_status.speed = speed;
- fixed->phy_status.duplex = duplex;
- fixed->phy_status.link = 1;
+err_regs:
+ kfree(fp);
+ return ret;
+}
+EXPORT_SYMBOL_GPL(fixed_phy_add);
- new_bus->name = "Fixed MII Bus";
- new_bus->read = &fixed_mii_read;
- new_bus->write = &fixed_mii_write;
- new_bus->reset = &fixed_mii_reset;
- /*set up workspace */
- fixed_mdio_update_regs(fixed);
- new_bus->priv = fixed;
+static int __init fixed_mdio_bus_init(void)
+{
+ struct fixed_mdio_bus *fmb = &platform_fmb;
+ int ret;
- new_bus->dev = dev;
- dev_set_drvdata(dev, new_bus);
+ pdev = platform_device_register_simple("Fixed MDIO bus", 0, NULL, 0);
+ if (!pdev) {
+ ret = -ENOMEM;
+ goto err_pdev;
+ }
- /* create phy_device and register it on the mdio bus */
- phydev = phy_device_create(new_bus, 0, 0);
- if (phydev == NULL)
- goto err_phy_dev_create;
+ fmb->mii_bus.id = 0;
+ fmb->mii_bus.name = "Fixed MDIO Bus";
+ fmb->mii_bus.dev = &pdev->dev;
+ fmb->mii_bus.read = &fixed_mdio_read;
+ fmb->mii_bus.write = &fixed_mdio_write;
+ fmb->mii_bus.irq = fmb->irqs;
- /*
- * Put the phydev pointer into the fixed pack so that bus read/write
- * code could be able to access for instance attached netdev. Well it
- * doesn't have to do so, only in case of utilizing user-specified
- * link-update...
- */
+ ret = mdiobus_register(&fmb->mii_bus);
+ if (ret)
+ goto err_mdiobus_reg;
- fixed->phydev = phydev;
- phydev->speed = speed;
- phydev->duplex = duplex;
+ return 0;
- phydev->irq = PHY_IGNORE_INTERRUPT;
- phydev->dev.bus = &mdio_bus_type;
+err_mdiobus_reg:
+ platform_device_unregister(pdev);
+err_pdev:
+ return ret;
+}
+module_init(fixed_mdio_bus_init);
- snprintf(phydev->dev.bus_id, BUS_ID_SIZE,
- PHY_ID_FMT, bus_id, phy_id);
+static void __exit fixed_mdio_bus_exit(void)
+{
+ struct fixed_mdio_bus *fmb = &platform_fmb;
+ struct fixed_phy *fp;
- phydev->bus = new_bus;
+ mdiobus_unregister(&fmb->mii_bus);
+ platform_device_unregister(pdev);
- phydev->dev.driver = &fixed_mdio_driver.driver;
- phydev->dev.release = fixed_mdio_release;
- err = phydev->dev.driver->probe(&phydev->dev);
- if (err < 0) {
- printk(KERN_ERR "Phy %s: problems with fixed driver\n",
- phydev->dev.bus_id);
- goto err_out;
- }
- err = device_register(&phydev->dev);
- if (err) {
- printk(KERN_ERR "Phy %s failed to register\n",
- phydev->dev.bus_id);
- goto err_out;
+ list_for_each_entry(fp, &fmb->phys, node) {
+ list_del(&fp->node);
+ kfree(fp);
}
- //phydev->state = PHY_RUNNING; /* make phy go up quick, but in 10Mbit/HDX
- return fixed;
-
-err_out:
- kfree(phydev);
-err_phy_dev_create:
- kfree(fixed->regs);
-err_fixed_regs_alloc:
- kfree(fixed);
-err_fixed_alloc:
- kfree(new_bus);
-err_bus_alloc:
- kfree(dev);
-err_dev_alloc:
-
- return NULL;
-
}
-#endif
+module_exit(fixed_mdio_bus_exit);
-MODULE_DESCRIPTION("Fixed PHY device & driver for PAL");
+MODULE_DESCRIPTION("Fixed MDIO bus (MDIO bus emulation with fixed PHYs)");
MODULE_AUTHOR("Vitaly Bordug");
MODULE_LICENSE("GPL");
-
-static int __init fixed_init(void)
-{
- int cnt = 0;
- int i;
-/* register on the bus... Not expected to be matched
- * with anything there...
- *
- */
- phy_driver_register(&fixed_mdio_driver);
-
-/* We will create several mdio devices here, and will bound the upper
- * driver to them.
- *
- * Then the external software can lookup the phy bus by searching
- * for 0:101, to be connected to the virtual 100M Fdx phy.
- *
- * In case several virtual PHYs required, the bus_id will be in form
- * [num]:[duplex]+[speed], which make it able even to define
- * driver-specific link control callback, if for instance PHY is
- * completely SW-driven.
- */
- for (i=1; i <= CONFIG_FIXED_MII_AMNT; i++) {
-#ifdef CONFIG_FIXED_MII_1000_FDX
- fixed_phy_ptrs[cnt++] = fixed_mdio_register_device(0, 1000, 1, i);
-#endif
-#ifdef CONFIG_FIXED_MII_100_FDX
- fixed_phy_ptrs[cnt++] = fixed_mdio_register_device(1, 100, 1, i);
-#endif
-#ifdef CONFIG_FIXED_MII_10_FDX
- fixed_phy_ptrs[cnt++] = fixed_mdio_register_device(2, 10, 1, i);
-#endif
- }
-
- return 0;
-}
-
-static void __exit fixed_exit(void)
-{
- int i;
-
- phy_driver_unregister(&fixed_mdio_driver);
- for (i=0; i < MAX_PHY_AMNT; i++)
- if ( fixed_phy_ptrs[i] )
- device_unregister(&fixed_phy_ptrs[i]->phydev->dev);
-}
-
-module_init(fixed_init);
-module_exit(fixed_exit);
diff --git a/include/linux/phy_fixed.h b/include/linux/phy_fixed.h
index 04ba70d..509d8f5 100644
--- a/include/linux/phy_fixed.h
+++ b/include/linux/phy_fixed.h
@@ -1,38 +1,31 @@
#ifndef __PHY_FIXED_H
#define __PHY_FIXED_H
-#define MII_REGS_NUM 29
-
-/* max number of virtual phy stuff */
-#define MAX_PHY_AMNT 10
-/*
- The idea is to emulate normal phy behavior by responding with
- pre-defined values to mii BMCR read, so that read_status hook could
- take all the needed info.
-*/
-
struct fixed_phy_status {
- u8 link;
- u16 speed;
- u8 duplex;
+ int link;
+ int speed;
+ int duplex;
+ int pause;
+ int asym_pause;
};
-/*-----------------------------------------------------------------------------
- * Private information hoder for mii_bus
- *-----------------------------------------------------------------------------*/
-struct fixed_info {
- u16 *regs;
- u8 regs_num;
- struct fixed_phy_status phy_status;
- struct phy_device *phydev; /* pointer to the container */
- /* link & speed cb */
- int (*link_update) (struct net_device *, struct fixed_phy_status *);
+#ifdef CONFIG_FIXED_PHY
+extern int fixed_phy_add(unsigned int irq, int phy_id,
+ struct fixed_phy_status *status);
+#else
+static inline int fixed_phy_add(unsigned int irq, int phy_id,
+ struct fixed_phy_status *status)
+{
+ return -ENODEV;
+}
+#endif /* CONFIG_FIXED_PHY */
-};
-
-
-int fixed_mdio_set_link_update(struct phy_device *,
- int (*link_update) (struct net_device *, struct fixed_phy_status *));
-struct fixed_info *fixed_mdio_get_phydev (int phydev_ind);
+/*
+ * This function issued only by fixed_phy-aware drivers, no need
+ * protect it with #ifdef
+ */
+extern int fixed_phy_set_link_update(struct phy_device *phydev,
+ int (*link_update)(struct net_device *,
+ struct fixed_phy_status *));
#endif /* __PHY_FIXED_H */
^ permalink raw reply related
* Re: [PATCH] pci: Fix bus resource assignment on 32 bits with 64b resources
From: Benjamin Herrenschmidt @ 2007-12-06 22:37 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: Greg KH, linux-pci, linux-kernel, linuxppc-dev
In-Reply-To: <20071206081628.GA15868@parisc-linux.org>
> It's been discussed before. Some of the solutions discussed:
>
> - Add something like PRI_RES which can be concatenated into a printk.
> Ugly.
> - Patch gcc to allow user-definable types. I think OpenBSD has a patch
> for this. Then we have to get that patch propagated to all the
> people who compile the kernel. Unappetising.
> - Disable gcc's printk checking, teach sparse to typecheck printk.
> Most people don't run sparse yet.
So you seem to dislike all 3, which one do you dislike the less ?
Cheers,
Ben.
^ permalink raw reply
* [PATCH] [POWERPC] 4xx: Add 405GPr and 405EP support in boot wrapper
From: Matthias Fuchs @ 2007-12-06 22:23 UTC (permalink / raw)
To: linuxppc-dev
This patch adds support for 405GPr processors with optional
new mode strapping. ibm405gp_fixup_clocks() can now be used
for 405GP and 405GPr CPUs.
This is in preparation of porting the cpci405 platform support
from arch/ppc to arch/powerpc.
This patch also adds ibm405ep_fixup_clocks() to support
405EP CPUs from the boot wrapper.
Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
---
arch/powerpc/boot/4xx.c | 81 ++++++++++++++++++++++++++++++++++++++++++----
arch/powerpc/boot/4xx.h | 1 +
arch/powerpc/boot/dcr.h | 5 +++
3 files changed, 80 insertions(+), 7 deletions(-)
diff --git a/arch/powerpc/boot/4xx.c b/arch/powerpc/boot/4xx.c
index 4dc0909..4ac9cb4 100644
--- a/arch/powerpc/boot/4xx.c
+++ b/arch/powerpc/boot/4xx.c
@@ -498,20 +498,45 @@ void ibm405gp_fixup_clocks(unsigned int sys_clk, unsigned int ser_clk)
u32 pllmr = mfdcr(DCRN_CPC0_PLLMR);
u32 cpc0_cr0 = mfdcr(DCRN_405_CPC0_CR0);
u32 cpc0_cr1 = mfdcr(DCRN_405_CPC0_CR1);
+ u32 psr = mfdcr(DCRN_405_CPC0_PSR);
u32 cpu, plb, opb, ebc, tb, uart0, uart1, m;
- u32 fwdv, fbdv, cbdv, opdv, epdv, udiv;
+ u32 fwdv, fwdvb, fbdv, cbdv, opdv, epdv, ppdv, udiv;
fwdv = (8 - ((pllmr & 0xe0000000) >> 29));
fbdv = (pllmr & 0x1e000000) >> 25;
- cbdv = ((pllmr & 0x00060000) >> 17) + 1;
- opdv = ((pllmr & 0x00018000) >> 15) + 1;
- epdv = ((pllmr & 0x00001800) >> 13) + 2;
+ if (fbdv == 0)
+ fbdv = 16;
+ cbdv = ((pllmr & 0x00060000) >> 17) + 1; /* CPU:PLB */
+ opdv = ((pllmr & 0x00018000) >> 15) + 1; /* PLB:OPB */
+ ppdv = ((pllmr & 0x00001800) >> 13) + 1; /* PLB:PCI */
+ epdv = ((pllmr & 0x00001800) >> 11) + 2; /* PLB:EBC */
udiv = ((cpc0_cr0 & 0x3e) >> 1) + 1;
- m = fwdv * fbdv * cbdv;
+ /* check for 405GPr */
+ if ((mfpvr() & 0xfffffff0) == (0x50910951 & 0xfffffff0)) {
+ fwdvb = 8 - (pllmr & 0x00000007);
+ if (!(psr & 0x00001000)) /* PCI async mode enable == 0 */
+ if (psr & 0x00000020) /* New mode enable */
+ m = fwdvb * 2 * ppdv;
+ else
+ m = fwdvb * cbdv * ppdv;
+ else if (psr & 0x00000020) /* New mode enable */
+ if (psr & 0x00000800) /* PerClk synch mode */
+ m = fwdvb * 2 * epdv;
+ else
+ m = fbdv * fwdv;
+ else if (epdv == fbdv)
+ m = fbdv * cbdv * epdv;
+ else
+ m = fbdv * fwdvb * cbdv;
- cpu = sys_clk * m / fwdv;
- plb = cpu / cbdv;
+ cpu = sys_clk * m / fwdv;
+ plb = sys_clk * m / (fwdvb * cbdv);
+ } else {
+ m = fwdv * fbdv * cbdv;
+ cpu = sys_clk * m / fwdv;
+ plb = cpu / cbdv;
+ }
opb = plb / opdv;
ebc = plb / epdv;
@@ -542,3 +567,45 @@ void ibm405gp_fixup_clocks(unsigned int sys_clk, unsigned int ser_clk)
dt_fixup_clock("/plb/opb/serial@ef600400", uart1);
}
+
+void ibm405ep_fixup_clocks(unsigned int sys_clk)
+{
+ u32 pllmr0 = mfdcr(DCRN_CPC0_PLLMR0);
+ u32 pllmr1 = mfdcr(DCRN_CPC0_PLLMR1);
+ u32 cpc0_ucr = mfdcr(DCRN_CPC0_UCR);
+ u32 cpu, plb, opb, ebc, uart0, uart1;
+ u32 fwdva, fwdvb, fbdv, cbdv, opdv, epdv;
+ u32 pllmr0_ccdv, tb, m;
+
+ fwdva = 8 - ((pllmr1 & 0x00070000) >> 16);
+ fwdvb = 8 - ((pllmr1 & 0x00007000) >> 12);
+ fbdv = (pllmr1 & 0x00f00000) >> 20;
+ if (fbdv == 0)
+ fbdv = 16;
+
+ cbdv = ((pllmr0 & 0x00030000) >> 16) + 1; /* CPU:PLB */
+ epdv = ((pllmr0 & 0x00000300) >> 8) + 2; /* PLB:EBC */
+ opdv = ((pllmr0 & 0x00003000) >> 12) + 1; /* PLB:OPB */
+
+ m = fbdv * fwdvb;
+
+ pllmr0_ccdv = ((pllmr0 & 0x00300000) >> 20) + 1;
+ if (pllmr1 & 0x80000000)
+ cpu = sys_clk * m / (fwdva * pllmr0_ccdv);
+ else
+ cpu = sys_clk / pllmr0_ccdv;
+
+ plb = cpu / cbdv;
+ opb = plb / opdv;
+ ebc = plb / epdv;
+ tb = cpu;
+ uart0 = cpu / (cpc0_ucr & 0x0000007f);
+ uart1 = cpu / ((cpc0_ucr & 0x00007f00) >> 8);
+
+ dt_fixup_cpu_clocks(cpu, tb, 0);
+ dt_fixup_clock("/plb", plb);
+ dt_fixup_clock("/plb/opb", opb);
+ dt_fixup_clock("/plb/ebc", ebc);
+ dt_fixup_clock("/plb/opb/serial@ef600300", uart0);
+ dt_fixup_clock("/plb/opb/serial@ef600400", uart1);
+}
diff --git a/arch/powerpc/boot/4xx.h b/arch/powerpc/boot/4xx.h
index fbe0632..2606e64 100644
--- a/arch/powerpc/boot/4xx.h
+++ b/arch/powerpc/boot/4xx.h
@@ -20,6 +20,7 @@ void ibm4xx_quiesce_eth(u32 *emac0, u32 *emac1);
void ibm4xx_fixup_ebc_ranges(const char *ebc);
void ibm405gp_fixup_clocks(unsigned int sys_clk, unsigned int ser_clk);
+void ibm405ep_fixup_clocks(unsigned int sys_clk);
void ibm440gp_fixup_clocks(unsigned int sys_clk, unsigned int ser_clk);
void ibm440ep_fixup_clocks(unsigned int sys_clk, unsigned int ser_clk,
unsigned int tmr_clk);
diff --git a/arch/powerpc/boot/dcr.h b/arch/powerpc/boot/dcr.h
index 0fde9b1..89f736e 100644
--- a/arch/powerpc/boot/dcr.h
+++ b/arch/powerpc/boot/dcr.h
@@ -146,7 +146,12 @@ static const unsigned long sdram_bxcr[] = { SDRAM0_B0CR, SDRAM0_B1CR,
#define DCRN_CPC0_PLLMR 0xb0
#define DCRN_405_CPC0_CR0 0xb1
#define DCRN_405_CPC0_CR1 0xb2
+#define DCRN_405_CPC0_PSR 0xb4
+/* 405EP Clocking/Power Management/Chip Control regs */
+#define DCRN_CPC0_PLLMR0 0xf0
+#define DCRN_CPC0_PLLMR1 0xf4
+#define DCRN_CPC0_UCR 0xf5
/* 440GX Clock control etc */
--
1.5.3.5
^ permalink raw reply related
* Re: [PATCH 11/25] powerpc: 4xx PLB to PCI Express support
From: Benjamin Herrenschmidt @ 2007-12-06 22:21 UTC (permalink / raw)
To: Stefan Roese; +Cc: linuxppc-dev
In-Reply-To: <200712061026.57215.sr@denx.de>
> > +/* Check that the core has been initied and if not, do it */
> > +static int __init ppc4xx_pciex_check_core_init(struct device_node *np)
> > +{
> > + static int core_init;
> > + int count = -ENODEV;
> > +
> > + if (core_init++)
> > + return 0;
> > +
> > +#ifdef CONFIG_44x
> > + if (of_device_is_compatible(np, "ibm,plb-pciex-440speA"))
> > + ppc4xx_pciex_hwops = &ppc440speA_pcie_hwops;
> > + else if (of_device_is_compatible(np, "ibm,plb-pciex-440speB"))
> > + ppc4xx_pciex_hwops = &ppc440speB_pcie_hwops;
>
> We need some runtime detection of the 440SPe revision here. There are boards
> out there (e.g. AMCC Yucca) which can be equipped with both PPC
> revisions. :-(
Ah... crap ! Do you think we should put that in the boot wrapper and
fixup the device-tree or should we put it in the PCIe code proper ?
> > +#endif /* CONFIG_44x */
> > +#ifdef CONFIG_40x
> > + if (of_device_is_compatible(np, "ibm,plb-pciex-405ex"))
> > + ppc4xx_pciex_hwops = &ppc405ex_pcie_hwops;
> > +#endif
>
> Why those #ifdef's? Just code-size reasons, since 40x and 44x will most likely
> never be built into one image?
Code size... I know how keen embedded people are to keep their kernel
small and as of today, you can't build 40x and 44x support in the same
image, so I didn't want to be blamed for adding bloat in that case :-)
Ben.
^ permalink raw reply
* Re: [PATCH v2] qe: add ability to upload QE firmware
From: Timur Tabi @ 2007-12-06 16:12 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev, Arnd Bergmann
In-Reply-To: <7245C82C-BCFC-4E38-8685-8C17B4300341@freescale.com>
Kumar Gala wrote:
> When I wait you come up with a new version.. so I'm waiting to see if v3
> comes out :)
Well, I guess I can't blame you for that. :-)
I think these patches are final:
[PATCH 1/2] qe: add function qe_clock_source (dated 12/3)
[PATCH 2/2] ucc_geth: use rx-clock-name and tx-clock-name device tree properties
(dated 12/3)
[PATCH v2] qe: add ability to upload QE firmware
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply
* MPC85xx DMA drivers, first testing results.
From: Clemens Koller @ 2007-12-06 21:49 UTC (permalink / raw)
To: linuxppc-dev@ozlabs.org
Hi There!
I just tried to use the fsldma on the mpc8540. It seems to work fine
here, but I would be glad if somebody can confirm before I move on:
I added the following to my mpc8540ads compatible board's .dts
(see my comments, where the not yet available documentation
was unclear):
dma@21000 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "fsl,mpc8540-dma", "fsl,eloplus-dma";
device-id = <0>;
reg = <21300 4>; /* DGSR - DMA general status register */
/* reg = <21000 4>;*/ /* or use offset of DMA machine ??? */
ranges = <0 21100 200>; /* we have 4 DMA channels at 21100, size=80 each */
dma-channel@0 {
compatible = "fsl,mpc8540-dma-channel", "fsl,eloplus-dma-channel";
device-id = <0>; /* or cell-index ??? */
reg = <0 80>;
interrupt-parent = <&mpic>;
interrupts = <14 2>;
};
dma-channel@80 { /* or use 0,1,2,3 instead of 0,80,100,180 ??? */
compatible = "fsl,mpc8540-dma-channel", "fsl,eloplus-dma-channel";
device-id = <1>;
reg = <80 80>;
interrupt-parent = <&mpic>;
interrupts = <15 2>;
};
dma-channel@100 {
compatible = "fsl,mpc8540-dma-channel", "fsl,eloplus-dma-channel";
device-id = <2>;
reg = <100 80>;
interrupt-parent = <&mpic>;
interrupts = <16 2>;
};
dma-channel@180 {
compatible = "fsl,mpc8540-dma-channel", "fsl,eloplus-dma-channel";
device-id = <3>;
reg = <180 80>;
interrupt-parent = <&mpic>;
interrupts = <17 2>;
};
};
$ dmesg then says:
of-fsl-dma e0021300.dma: Probe the Freescale DMA driver for fsl,mpc8540-dma controller at 0xe0021300...
of-fsl-dma-channel e0021100.dma-channe: selftest: start...
of-fsl-dma-channel e0021100.dma-channe: selftest: finished, err=0.
of-fsl-dma-channel e0021100.dma-channe: #0 (fsl,mpc8540-dma-channel), irq 21
of-fsl-dma-channel e0021180.dma-channe: selftest: start...
of-fsl-dma-channel e0021180.dma-channe: selftest: finished, err=0.
of-fsl-dma-channel e0021180.dma-channe: #1 (fsl,mpc8540-dma-channel), irq 22
of-fsl-dma-channel e0021200.dma-channe: selftest: start...
of-fsl-dma-channel e0021200.dma-channe: selftest: finished, err=0.
of-fsl-dma-channel e0021200.dma-channe: #2 (fsl,mpc8540-dma-channel), irq 23
of-fsl-dma-channel e0021280.dma-channe: selftest: start...
of-fsl-dma-channel e0021280.dma-channe: selftest: finished, err=0.
of-fsl-dma-channel e0021280.dma-channe: #3 (fsl,mpc8540-dma-channel), irq 24
I added another dev_info() to get at least a glue that the selftest is run.
It looks like dev_info(fsl_chan->dev, ...); seems to be truncated.
I have no idea if interrupts are working well... the callback isn't
used yet.
Otherwise, nice work! :-) I'm looking forward to see this functionality
in mainline.
Regards,
--
Clemens Koller
__________________________________
R&D Imaging Devices
Anagramm GmbH
Rupert-Mayer-Straße 45/1
Linhof Werksgelände
D-81379 München
Tel.089-741518-50
Fax 089-741518-19
http://www.anagramm-technology.com
^ permalink raw reply
* Re: [PATCH 2/2] usb: Remove OHCI useless masking/unmasking of WDH interrupt
From: David Brownell @ 2007-12-06 21:29 UTC (permalink / raw)
To: Greg KH; +Cc: linux-usb-devel, linuxppc-dev
In-Reply-To: <20071125225543.374E0DDF17@ozlabs.org>
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: [PATCH 2/2] usb: Remove OHCI useless masking/unmasking of WDH interrupt
The OHCI driver's IRQ handler, while processing a WDH interrupt, masks
and unmasks it. I believe this is both broken (the write may still be
posted during the donelist processing it's trying to safeguard) and
useless as this IRQ may not be reissued until it's acked (unless this
legacy code is an uncommented workaround for some chip erratum).
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
Worth IMO holding till 2.6.25-early.
--- g26.orig/drivers/usb/host/ohci-hcd.c 2007-12-06 08:42:24.000000000 -0800
+++ g26/drivers/usb/host/ohci-hcd.c 2007-12-06 08:42:29.000000000 -0800
@@ -807,13 +807,9 @@ static irqreturn_t ohci_irq (struct usb_
}
if (ints & OHCI_INTR_WDH) {
- if (HC_IS_RUNNING(hcd->state))
- ohci_writel (ohci, OHCI_INTR_WDH, ®s->intrdisable);
spin_lock (&ohci->lock);
dl_done_list (ohci);
spin_unlock (&ohci->lock);
- if (HC_IS_RUNNING(hcd->state))
- ohci_writel (ohci, OHCI_INTR_WDH, ®s->intrenable);
}
if (quirk_zfmicro(ohci) && (ints & OHCI_INTR_SF)) {
^ permalink raw reply
* Re: [PATCH 1/2] usb: Remove broken optimisation in OHCI IRQ handler
From: David Brownell @ 2007-12-06 21:28 UTC (permalink / raw)
To: Greg KH; +Cc: linux-usb-devel, linuxppc-dev
In-Reply-To: <20071125225542.880F2DDF13@ozlabs.org>
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: [PATCH 1/2] usb: Remove broken optimisation in OHCI IRQ handler
The OHCI IRQ handler has an optimisation that avoids reading some
chip registers when the controller reports that the interrupt was
triggered *only* because completed requests were written into the
controller's "done list" and handed to the host.
This mechanism can't be used on some controllers. Among others, it
fails for the SA1111 and the AMCC 440EP PowerPC processor.
This patch removes the optimisation and makes the code clearer.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
Suitable IMO for 2.6.24 final.
drivers/usb/host/ohci-hcd.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
--- g26.orig/drivers/usb/host/ohci-hcd.c 2007-10-28 17:46:53.000000000 -0700
+++ g26/drivers/usb/host/ohci-hcd.c 2007-12-06 09:29:57.000000000 -0800
@@ -732,24 +732,27 @@ static irqreturn_t ohci_irq (struct usb_
struct ohci_regs __iomem *regs = ohci->regs;
int ints;
- /* we can eliminate a (slow) ohci_readl()
- * if _only_ WDH caused this irq
+ /* Read interrupt status (and flush pending writes). We ignore the
+ * optimization of checking the LSB of hcca->done_head; it doesn't
+ * work on all systems (edge triggering for OHCI can be a factor).
*/
- if ((ohci->hcca->done_head != 0)
- && ! (hc32_to_cpup (ohci, &ohci->hcca->done_head)
- & 0x01)) {
- ints = OHCI_INTR_WDH;
+ ints = ohci_readl(ohci, ®s->intrstatus);
- /* cardbus/... hardware gone before remove() */
- } else if ((ints = ohci_readl (ohci, ®s->intrstatus)) == ~(u32)0) {
+ /* Check for an all 1's result which is a typical consequence
+ * of dead, unclocked, or unplugged (CardBus...) devices
+ */
+ if (ints == ~(u32)0) {
disable (ohci);
ohci_dbg (ohci, "device removed!\n");
return IRQ_HANDLED;
+ }
+
+ /* We only care about interrupts that are enabled */
+ ints &= ohci_readl(ohci, ®s->intrenable);
/* interrupt for some other device? */
- } else if ((ints &= ohci_readl (ohci, ®s->intrenable)) == 0) {
+ if (ints == 0)
return IRQ_NOTMINE;
- }
if (ints & OHCI_INTR_UE) {
// e.g. due to PCI Master/Target Abort
^ permalink raw reply
* [PATCH v3] update xmon slb code.
From: Will Schmidt @ 2007-12-06 21:22 UTC (permalink / raw)
To: Michael Neuling; +Cc: Olof Johansson, linuxppc-dev, Paul Mackerras
In-Reply-To: <17679.1196922288@neuling.org>
[powerpc] update xmon slb code
This adds a bit more detail to the xmon SLB output. When the valid bit is
set, This displays the ESID and VSID values, as well as decoding the
segment size, (1T or 256M) and displaying the LLP bits. This supresses the
output for any slb entries that contain only zeros.
sample output from power6 (1T segment support):
00 c000000008000000 40004f7ca3000500 1T ESID= c00000 VSID= 4f7ca3 LLP:100
01 d000000008000000 4000eb71b0000400 1T ESID= d00000 VSID= eb71b0 LLP: 0
08 0000000018000000 0000c8499f8ccc80 256M ESID= 1 VSID= c8499f8cc LLP: 0
09 00000000f8000000 0000d2c1a8e46c80 256M ESID= f VSID= d2c1a8e46 LLP: 0
10 0000000048000000 0000ca87eab1dc80 256M ESID= 4 VSID= ca87eab1d LLP: 0
43 cf00000008000000 400011b260000500 1T ESID= cf0000 VSID= 11b260 LLP:100
sample output from power5 (notice the non-valid but non-zero entries)
10 0000000008000000 00004fd0e077ac80 256M ESID= 0 VSID= 4fd0e077a LLP: 0
11 00000000f8000000 00005b085830fc80 256M ESID= f VSID= 5b085830f LLP: 0
12 0000000048000000 000052ce99fe6c80 256M ESID= 4 VSID= 52ce99fe6 LLP: 0
13 0000000018000000 000050904ed95c80 256M ESID= 1 VSID= 50904ed95 LLP: 0
14 cf00000008000000 0000d59aca40f500 256M ESID=cf0000000 VSID= d59aca40f LLP:100
15 c000000078000000 000045cb97751500 256M ESID=c00000007 VSID= 45cb97751 LLP:100
Tested on power5 and power6.
Signed-Off-By: Will Schmidt <will_schmidt@vnet.ibm.com>
---
This is a resend.. this latest respin is updated to apply on top of Mikeys slb_mmu_size change.
(earlier Updates made per comments from Olof and Ben and Paul).
This version adds padding around the ESID and VSID fields, and the LLP bits
are displayed too.
Counting bits, the VSID output looks to be as large as 51 bits, which requires
up to 13 spaces. This doesnt count the B field bits which are now masked off
the top end of the VSID output.
I'll try to follow up sometime later with code that will handle decoding page
sizes. I dont have a testcase handy to properly exercise that yet. :-)
---
arch/powerpc/xmon/xmon.c | 29 +++++++++++++++++++++++------
1 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 121b04d..5314db7 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -2539,16 +2539,33 @@ static void xmon_print_symbol(unsigned long address, const char *mid,
static void dump_slb(void)
{
int i;
- unsigned long tmp;
+ unsigned long esid,vsid,valid;
+ unsigned long llp;
printf("SLB contents of cpu %x\n", smp_processor_id());
for (i = 0; i < mmu_slb_size; i++) {
- asm volatile("slbmfee %0,%1" : "=r" (tmp) : "r" (i));
- printf("%02d %016lx ", i, tmp);
-
- asm volatile("slbmfev %0,%1" : "=r" (tmp) : "r" (i));
- printf("%016lx\n", tmp);
+ asm volatile("slbmfee %0,%1" : "=r" (esid) : "r" (i));
+ asm volatile("slbmfev %0,%1" : "=r" (vsid) : "r" (i));
+ valid = (esid & SLB_ESID_V);
+ if (valid | esid | vsid) {
+ printf("%02d %016lx %016lx", i, esid, vsid);
+ if (valid) {
+ llp = vsid & SLB_VSID_LLP;
+ if (vsid & SLB_VSID_B_1T) {
+ printf(" 1T ESID=%9lx VSID=%13lx LLP:%3lx \n",
+ GET_ESID_1T(esid),
+ (vsid & ~SLB_VSID_B) >> SLB_VSID_SHIFT_1T,
+ llp);
+ } else {
+ printf(" 256M ESID=%9lx VSID=%13lx LLP:%3lx \n",
+ GET_ESID(esid),
+ (vsid & ~SLB_VSID_B) >> SLB_VSID_SHIFT,
+ llp);
+ }
+ } else
+ printf("\n");
+ }
}
}
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox