MIPS: BCM947xx support
Subsystems (2)
PATCH 2/4 MIPS: BCM947xx support
The patch below against 2.6.23-rc1-mm2 adds support for BCM947xx CPUs. It originally comes from the OpenWrt patches.
arch/mips/bcm947xx/irq.c +63 -0
@@ -0,0 +1,63 @@ +/* +* Copyright (C) 2004 Florian Schirmer <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <linux/errno.h> +#include <linux/init.h> +#include <linux/interrupt.h> +#include <linux/irq.h> +#include <linux/module.h> +#include <linux/smp.h> +#include <linux/types.h> + +#include <asm/cpu.h> +#include <asm/io.h> +#include <asm/irq.h> +#include <asm/irq_cpu.h> + +void plat_irq_dispatch (void ) +{ +u32 cause; + + cause =read_c0_cause () &read_c0_status () &CAUSEF_IP ; + +clear_c0_status (cause); + +if (cause &CAUSEF_IP7 ) +do_IRQ (7 ); +if (cause &CAUSEF_IP2 ) +do_IRQ (2 ); +if (cause &CAUSEF_IP3 ) +do_IRQ (3 ); +if (cause &CAUSEF_IP4 ) +do_IRQ (4 ); +if (cause &CAUSEF_IP5 ) +do_IRQ (5 ); +if (cause &CAUSEF_IP6 ) +do_IRQ (6 ); +} + +void __init arch_init_irq (void ) +{ +mips_cpu_irq_init (); +}
arch/mips/bcm947xx/prom.c +58 -0
58 lines not on this page · raw message
arch/mips/bcm947xx/setup.c +106 -0
106 lines not on this page · raw message
arch/mips/bcm947xx/time.c +62 -0
62 lines not on this page · raw message
arch/mips/bcm947xx/Makefile +6 -0
@@ -0,0 +1,6 @@ +# +# Makefile for the BCM947xx specific kernel interface routines +# under Linux. +# + +obj-y := irq.o prom.o setup.o time.o
Signature · 4 lines
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net
Quoted 195 lines · Aurelien Jarno
The patch below against 2.6.23-rc1-mm2 adds support for BCM947xx CPUs. It originally comes from the OpenWrt patches.
Cc Michael Buesch <[email protected]>Cc Waldemar Brodkorb <[email protected]>Cc Felix Fietkau <[email protected]>Cc Florian Schirmer <[email protected]>Signed-off-by Aurelien Jarno <[email protected]>arch/mips/bcm947xx/irq.c +63
-0@@ -0,0 +1,63 @@ +/* +* Copyright (C) 2004 Florian Schirmer <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <linux/errno.h> +#include <linux/init.h> +#include <linux/interrupt.h> +#include <linux/irq.h> +#include <linux/module.h> +#include <linux/smp.h> +#include <linux/types.h> + +#include <asm/cpu.h> +#include <asm/io.h> +#include <asm/irq.h> +#include <asm/irq_cpu.h> + +void plat_irq_dispatch (void ) +{ +u32 cause; + + cause =read_c0_cause () &read_c0_status () &CAUSEF_IP ; + +clear_c0_status (cause); + +if (cause &CAUSEF_IP7 ) +do_IRQ (7 ); +if (cause &CAUSEF_IP2 ) +do_IRQ (2 ); +if (cause &CAUSEF_IP3 ) +do_IRQ (3 ); +if (cause &CAUSEF_IP4 ) +do_IRQ (4 ); +if (cause &CAUSEF_IP5 ) +do_IRQ (5 ); +if (cause &CAUSEF_IP6 ) +do_IRQ (6 ); +} + +void __init arch_init_irq (void ) +{ +mips_cpu_irq_init (); +}arch/mips/bcm947xx/prom.c +58
-0@@ -0,0 +1,58 @@ +/* +* Copyright (C) 2004 Florian Schirmer <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <linux/init.h> +#include <linux/mm.h> +#include <linux/sched.h> +#include <linux/bootmem.h> + +#include <asm/addrspace.h> +#include <asm/bootinfo.h> +#include <asm/pmon.h> + +const char *get_system_type (void ) +{ +return "Broadcom BCM947xx" ; +} + +void __init prom_init (void ) +{ +unsigned long mem; + + mips_machgroup =MACH_GROUP_BRCM ; + mips_machtype =MACH_BCM947XX ; + +/* Figure out memory size by finding aliases */ +for (mem = (1 <<20 ); mem < (128 <<20 ); mem += (1 <<20 )) { +if (*(unsigned long *)((unsigned long )(prom_init) + mem) == + *(unsigned long *)(prom_init)) +break ; + } + +add_memory_region (0 , mem,BOOT_MEM_RAM ); +} + +void __init prom_free_prom_memory (void ) +{ +}arch/mips/bcm947xx/setup.c +56
-0@@ -0,0 +1,106 @@ +/* +* Copyright (C) 2004 Florian Schirmer <[email protected]> +* Copyright (C) 2005 Waldemar Brodkorb <[email protected]> +* Copyright (C) 2006 Felix Fietkau <[email protected]> +* Copyright (C) 2006 Michael Buesch <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <linux/init.h> +#include <linux/types.h> +#include <linux/tty.h> +#include <linux/serial.h> +#include <linux/serial_core.h> +#include <linux/serial_reg.h> +#include <linux/serial_8250.h> +#include <asm/bootinfo.h> +#include <asm/time.h> +#include <asm/reboot.h> +#include <linux/pm.h> +#include <linux/ssb/ssb.h> + +extern void bcm947xx_pci_init (void ); +extern void bcm947xx_time_init (void ); + +struct ssb_bus ssb; + +static void bcm947xx_machine_restart (char *command) +{ +printk (KERN_ALERT "Please stand by while rebooting the system...\n" ); +local_irq_disable (); +/* Set the watchdog timer to reset immediately */ +ssb_chipco_watchdog_timer_set (&ssb.chipco,1 ); +while (1 ) +cpu_relax (); +} + +static void bcm947xx_machine_halt (void )
arch/mips/bcm947xx/setup.c line 66
Quoted 10 lines
arch/mips/bcm947xx/setup.c +10
-0+{ +/* Disable interrupts and watchdog and spin forever */ +local_irq_disable (); +ssb_chipco_watchdog_timer_set (&ssb.chipco,0 ); +while (1 ) +cpu_relax (); +} + +static int bcm947xx_get_invariants (struct ssb_bus *bus,struct ssb_init_invariants *iv) +{
No reading of NVRAM, yet?
arch/mips/bcm947xx/setup.c line 78
Quoted 12 lines
arch/mips/bcm947xx/setup.c +12
-0+return 0 ; +} + +void __init plat_mem_setup (void ) +{ +int i, err; +struct ssb_mipscore *mcore; + + err =ssb_bus_ssbbus_register (&ssb,SSB_ENUM_BASE , bcm947xx_get_invariants); +if (err) { +const char *msg ="Failed to initialize SSB bus (err %d)\n" ; +panic (msg, err);
We don't need the msg variable anymore.
Quoted 97 lines
arch/mips/bcm947xx/setup.c +28
-0+ } + mcore = &ssb.mipscore; + +#ifdef CONFIG_SERIAL_8250 +for (i =0 ; i < mcore->nr_serial_ports; i++) { +struct ssb_serial_port *port = &(mcore->serial_ports[i]); +struct uart_port s; + +memset (&s,0 ,sizeof (s)); + s.line = i; + s.membase = port->regs; + s.irq = port->irq +2 ; + s.uartclk = port->baud_base; + s.flags =UPF_BOOT_AUTOCONF |UPF_SHARE_IRQ ; + s.iotype =SERIAL_IO_MEM ; + s.regshift = port->reg_shift; + +early_serial_setup (&s); + } +#endif + + _machine_restart = bcm947xx_machine_restart; + _machine_halt = bcm947xx_machine_halt; + pm_power_off = bcm947xx_machine_halt; + board_time_init = bcm947xx_time_init; +} + +EXPORT_SYMBOL (ssb);arch/mips/bcm947xx/time.c +62
-0@@ -0,0 +1,62 @@ +/* +* Copyright (C) 2004 Florian Schirmer <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <linux/init.h> +#include <linux/kernel.h> +#include <linux/sched.h> +#include <linux/serial_reg.h> +#include <linux/interrupt.h> +#include <linux/ssb/ssb.h> +#include <asm/addrspace.h> +#include <asm/io.h> +#include <asm/time.h> + +extern struct ssb_bus ssb; + +void __init +bcm947xx_time_init (void ) +{ +unsigned long hz; + +/* +* Use deterministic values for initial counter interrupt +* so that calibrate delay avoids encountering a counter wrap. +*/ +write_c0_count (0 ); +write_c0_compare (0xffff ); + + hz =ssb_cpu_clock (&ssb.mipscore) /2 ; +if (!hz) + hz =100000000 ; + +/* Set MIPS counter frequency for fixed_rate_gettimeoffset() */ + mips_hpt_frequency = hz; +} + +void __init +plat_timer_setup (struct irqaction *irq) +{ +/* Enable the timer interrupt */ +setup_irq (7 , irq); +}
arch/mips/bcm947xx/Makefile line 6
Quoted 6 lines
arch/mips/bcm947xx/Makefile +6
-0@@ -0,0 +1,6 @@ +# +# Makefile for the BCM947xx specific kernel interface routines +# under Linux. +# + +obj-y := irq.o prom.o setup.o time.o
The patch, except the tiny comments above is
Quoted 9 lines · Michael Buesch
Quoted 8 lines · Aurelien Jarno
The patch below against 2.6.23-rc1-mm2 adds support for BCM947xx CPUs. It originally comes from the OpenWrt patches.
Cc Michael Buesch <[email protected]>Cc Waldemar Brodkorb <[email protected]>Cc Felix Fietkau <[email protected]>Cc Florian Schirmer <[email protected]>Signed-off-by Aurelien Jarno <[email protected]>
[snip]
Quoted 3 lines
Quoted 3 lines
arch/mips/bcm947xx/setup.c +0
-0@@ -0,0 +1,106 @@
[snip]
Quoted 5 lines
Quoted 5 lines
arch/mips/bcm947xx/setup.c +5
-0+static void bcm947xx_machine_halt (void ) +{ +/* Disable interrupts and watchdog and spin forever */ +local_irq_disable (); +ssb_chipco_watchdog_timer_set (&ssb.chipco,0 );
Quoted 8 lines
arch/mips/bcm947xx/setup.c line 66
Quoted 6 lines
arch/mips/bcm947xx/setup.c +6
-0+while (1 ) +cpu_relax (); +} + +static int bcm947xx_get_invariants (struct ssb_bus *bus,struct ssb_init_invariants *iv) +{No reading of NVRAM, yet?
This requires CFE support, and this part is still a bit problematic now. There are already CFE files for SiByte support, and I think it's not a good idea to have too different implementations.
I will add a comment here;
Quoted 6 lines
Quoted 6 lines
arch/mips/bcm947xx/setup.c +6
-0+return 0 ; +} + +void __init plat_mem_setup (void ) +{ +int i, err;
Quoted 8 lines
arch/mips/bcm947xx/setup.c line 78
Quoted 6 lines
arch/mips/bcm947xx/setup.c +6
-0+struct ssb_mipscore *mcore; + + err =ssb_bus_ssbbus_register (&ssb,SSB_ENUM_BASE , bcm947xx_get_invariants); +if (err) { +const char *msg ="Failed to initialize SSB bus (err %d)\n" ; +panic (msg, err);We don't need the msg variable anymore.
I will fix that.
Signature · 4 lines
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net
Quoted 33 lines · Aurelien Jarno
Quoted 9 lines · Michael Buesch
Quoted 8 lines · Aurelien Jarno
The patch below against 2.6.23-rc1-mm2 adds support for BCM947xx CPUs. It originally comes from the OpenWrt patches.
Cc Michael Buesch <[email protected]>Cc Waldemar Brodkorb <[email protected]>Cc Felix Fietkau <[email protected]>Cc Florian Schirmer <[email protected]>Signed-off-by Aurelien Jarno <[email protected]>[snip]
Quoted 3 lines
Quoted 3 lines
arch/mips/bcm947xx/setup.c +0
-0@@ -0,0 +1,106 @@[snip]
Quoted 5 lines
Quoted 5 lines
arch/mips/bcm947xx/setup.c +5
-0+static void bcm947xx_machine_halt (void ) +{ +/* Disable interrupts and watchdog and spin forever */ +local_irq_disable (); +ssb_chipco_watchdog_timer_set (&ssb.chipco,0 );Quoted 8 lines
arch/mips/bcm947xx/setup.c line 66
Quoted 6 lines
arch/mips/bcm947xx/setup.c +6
-0+while (1 ) +cpu_relax (); +} + +static int bcm947xx_get_invariants (struct ssb_bus *bus,struct ssb_init_invariants *iv) +{No reading of NVRAM, yet?
Quoted 3 lines
This requires CFE support, and this part is still a bit problematic now. There are already CFE files for SiByte support, and I think it's not a good idea to have too different implementations.
Yep, I forgot about that. My CFE stuff should probably partly get merged into the existing CFE stuff, if neeeded.
So let's leave this out for now.
Quoted 20 lines
I will add a comment here;
Quoted 6 lines
Quoted 6 lines
arch/mips/bcm947xx/setup.c +6
-0+return 0 ; +} + +void __init plat_mem_setup (void ) +{ +int i, err;Quoted 8 lines
arch/mips/bcm947xx/setup.c line 78
Quoted 6 lines
arch/mips/bcm947xx/setup.c +6
-0+struct ssb_mipscore *mcore; + + err =ssb_bus_ssbbus_register (&ssb,SSB_ENUM_BASE , bcm947xx_get_invariants); +if (err) { +const char *msg ="Failed to initialize SSB bus (err %d)\n" ; +panic (msg, err);We don't need the msg variable anymore.
I will fix that.
PATCH 2/4 MIPS: BCM947xx support (v2)
The patch below against 2.6.23-rc1-mm2 adds support for BCM947xx CPUs. It originally comes from the OpenWrt patches.
arch/mips/bcm947xx/irq.c +63 -0
@@ -0,0 +1,63 @@ +/* +* Copyright (C) 2004 Florian Schirmer <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <linux/errno.h> +#include <linux/init.h> +#include <linux/interrupt.h> +#include <linux/irq.h> +#include <linux/module.h> +#include <linux/smp.h> +#include <linux/types.h> + +#include <asm/cpu.h> +#include <asm/io.h> +#include <asm/irq.h> +#include <asm/irq_cpu.h> + +void plat_irq_dispatch (void ) +{ +u32 cause; + + cause =read_c0_cause () &read_c0_status () &CAUSEF_IP ; + +clear_c0_status (cause); + +if (cause &CAUSEF_IP7 ) +do_IRQ (7 ); +if (cause &CAUSEF_IP2 ) +do_IRQ (2 ); +if (cause &CAUSEF_IP3 ) +do_IRQ (3 ); +if (cause &CAUSEF_IP4 ) +do_IRQ (4 ); +if (cause &CAUSEF_IP5 ) +do_IRQ (5 ); +if (cause &CAUSEF_IP6 ) +do_IRQ (6 ); +} + +void __init arch_init_irq (void ) +{ +mips_cpu_irq_init (); +}
arch/mips/bcm947xx/Makefile +6 -0
@@ -0,0 +1,6 @@ +# +# Makefile for the BCM947xx specific kernel interface routines +# under Linux. +# + +obj-y := irq.o prom.o setup.o time.o
arch/mips/bcm947xx/prom.c +58 -0
58 lines not on this page · raw message
arch/mips/bcm947xx/setup.c +108 -0
108 lines not on this page · raw message
arch/mips/bcm947xx/time.c +62 -0
62 lines not on this page · raw message
Signature · 4 lines
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net
Re: [PATCH -mm 2/4] MIPS: BCM947xx support (v2)
Quoted 8 lines · Aurelien Jarno
The patch below against 2.6.23-rc1-mm2 adds support for BCM947xx CPUs. It originally comes from the OpenWrt patches.
Cc Michael Buesch <[email protected]>Cc Waldemar Brodkorb <[email protected]>Cc Felix Fietkau <[email protected]>Cc Florian Schirmer <[email protected]>Signed-off-by Aurelien Jarno <[email protected]>
Quoted 314 lines
arch/mips/bcm947xx/irq.c +63
-0@@ -0,0 +1,63 @@ +/* +* Copyright (C) 2004 Florian Schirmer <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <linux/errno.h> +#include <linux/init.h> +#include <linux/interrupt.h> +#include <linux/irq.h> +#include <linux/module.h> +#include <linux/smp.h> +#include <linux/types.h> + +#include <asm/cpu.h> +#include <asm/io.h> +#include <asm/irq.h> +#include <asm/irq_cpu.h> + +void plat_irq_dispatch (void ) +{ +u32 cause; + + cause =read_c0_cause () &read_c0_status () &CAUSEF_IP ; + +clear_c0_status (cause); + +if (cause &CAUSEF_IP7 ) +do_IRQ (7 ); +if (cause &CAUSEF_IP2 ) +do_IRQ (2 ); +if (cause &CAUSEF_IP3 ) +do_IRQ (3 ); +if (cause &CAUSEF_IP4 ) +do_IRQ (4 ); +if (cause &CAUSEF_IP5 ) +do_IRQ (5 ); +if (cause &CAUSEF_IP6 ) +do_IRQ (6 ); +} + +void __init arch_init_irq (void ) +{ +mips_cpu_irq_init (); +}arch/mips/bcm947xx/Makefile +6
-0@@ -0,0 +1,6 @@ +# +# Makefile for the BCM947xx specific kernel interface routines +# under Linux. +# + +obj-y := irq.o prom.o setup.o time.oarch/mips/bcm947xx/prom.c +58
-0@@ -0,0 +1,58 @@ +/* +* Copyright (C) 2004 Florian Schirmer <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <linux/init.h> +#include <linux/mm.h> +#include <linux/sched.h> +#include <linux/bootmem.h> + +#include <asm/addrspace.h> +#include <asm/bootinfo.h> +#include <asm/pmon.h> + +const char *get_system_type (void ) +{ +return "Broadcom BCM947xx" ; +} + +void __init prom_init (void ) +{ +unsigned long mem; + + mips_machgroup =MACH_GROUP_BRCM ; + mips_machtype =MACH_BCM947XX ; + +/* Figure out memory size by finding aliases */ +for (mem = (1 <<20 ); mem < (128 <<20 ); mem += (1 <<20 )) { +if (*(unsigned long *)((unsigned long )(prom_init) + mem) == + *(unsigned long *)(prom_init)) +break ; + } + +add_memory_region (0 , mem,BOOT_MEM_RAM ); +} + +void __init prom_free_prom_memory (void ) +{ +}arch/mips/bcm947xx/setup.c +108
-0@@ -0,0 +1,108 @@ +/* +* Copyright (C) 2004 Florian Schirmer <[email protected]> +* Copyright (C) 2005 Waldemar Brodkorb <[email protected]> +* Copyright (C) 2006 Felix Fietkau <[email protected]> +* Copyright (C) 2006 Michael Buesch <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <linux/init.h> +#include <linux/types.h> +#include <linux/tty.h> +#include <linux/serial.h> +#include <linux/serial_core.h> +#include <linux/serial_reg.h> +#include <linux/serial_8250.h> +#include <asm/bootinfo.h> +#include <asm/time.h> +#include <asm/reboot.h> +#include <linux/pm.h> +#include <linux/ssb/ssb.h> + +extern void bcm947xx_pci_init (void ); +extern void bcm947xx_time_init (void ); + +struct ssb_bus ssb; + +static void bcm947xx_machine_restart (char *command) +{ +printk (KERN_ALERT "Please stand by while rebooting the system...\n" ); +local_irq_disable (); +/* Set the watchdog timer to reset immediately */ +ssb_chipco_watchdog_timer_set (&ssb.chipco,1 ); +while (1 ) +cpu_relax (); +} + +static void bcm947xx_machine_halt (void ) +{ +/* Disable interrupts and watchdog and spin forever */ +local_irq_disable (); +ssb_chipco_watchdog_timer_set (&ssb.chipco,0 ); +while (1 ) +cpu_relax (); +} + +static int bcm947xx_get_invariants (struct ssb_bus *bus,struct ssb_init_invariants *iv) +{ +/* TODO: fill ssb_init_invariants using boardtype/boardrev +* CFE environment variables. +*/ + +return 0 ; +} + +void __init plat_mem_setup (void ) +{ +int i, err; +struct ssb_mipscore *mcore; + + err =ssb_bus_ssbbus_register (&ssb,SSB_ENUM_BASE , bcm947xx_get_invariants); +if (err) +panic ("Failed to initialize SSB bus (err %d)\n" , err); + mcore = &ssb.mipscore; + +#ifdef CONFIG_SERIAL_8250 +for (i =0 ; i < mcore->nr_serial_ports; i++) { +struct ssb_serial_port *port = &(mcore->serial_ports[i]); +struct uart_port s; + +memset (&s,0 ,sizeof (s)); + s.line = i; + s.membase = port->regs; + s.irq = port->irq +2 ; + s.uartclk = port->baud_base; + s.flags =UPF_BOOT_AUTOCONF |UPF_SHARE_IRQ ; + s.iotype =SERIAL_IO_MEM ; + s.regshift = port->reg_shift; + +early_serial_setup (&s); + } +#endif + + _machine_restart = bcm947xx_machine_restart; + _machine_halt = bcm947xx_machine_halt; + pm_power_off = bcm947xx_machine_halt; + board_time_init = bcm947xx_time_init; +} + +EXPORT_SYMBOL (ssb);arch/mips/bcm947xx/time.c +62
-0@@ -0,0 +1,62 @@ +/* +* Copyright (C) 2004 Florian Schirmer <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <linux/init.h> +#include <linux/kernel.h> +#include <linux/sched.h> +#include <linux/serial_reg.h> +#include <linux/interrupt.h> +#include <linux/ssb/ssb.h> +#include <asm/addrspace.h> +#include <asm/io.h> +#include <asm/time.h> + +extern struct ssb_bus ssb; + +void __init +bcm947xx_time_init (void ) +{ +unsigned long hz; + +/* +* Use deterministic values for initial counter interrupt +* so that calibrate delay avoids encountering a counter wrap. +*/ +write_c0_count (0 ); +write_c0_compare (0xffff ); + + hz =ssb_cpu_clock (&ssb.mipscore) /2 ; +if (!hz) + hz =100000000 ; + +/* Set MIPS counter frequency for fixed_rate_gettimeoffset() */ + mips_hpt_frequency = hz; +} + +void __init +plat_timer_setup (struct irqaction *irq) +{ +/* Enable the timer interrupt */ +setup_irq (7 , irq); +}
Re: [PATCH -mm 2/4] MIPS: BCM947xx support (v2)
In reply to Aurelien JarnoHi,
Quoted 9 lines · Aurelien Jarno
The patch below against 2.6.23-rc1-mm2 adds support for BCM947xx CPUs. It originally comes from the OpenWrt patches.
Cc Michael Buesch <[email protected]>Cc Waldemar Brodkorb <[email protected]>Cc Felix Fietkau <[email protected]>Cc Florian Schirmer <[email protected]>Signed-off-by Aurelien Jarno <[email protected]>
I'm not sure whether it's a good idea to export a symbol named "ssb". Maybe bcm47xx_ssb would be a better name? I've no idea what the general rule on exporting symbols is though. Otherwise:
Best,
Florian
Quoted 314 lines
arch/mips/bcm947xx/irq.c +63
-0@@ -0,0 +1,63 @@ +/* +* Copyright (C) 2004 Florian Schirmer <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <linux/errno.h> +#include <linux/init.h> +#include <linux/interrupt.h> +#include <linux/irq.h> +#include <linux/module.h> +#include <linux/smp.h> +#include <linux/types.h> + +#include <asm/cpu.h> +#include <asm/io.h> +#include <asm/irq.h> +#include <asm/irq_cpu.h> + +void plat_irq_dispatch (void ) +{ +u32 cause; + + cause =read_c0_cause () &read_c0_status () &CAUSEF_IP ; + +clear_c0_status (cause); + +if (cause &CAUSEF_IP7 ) +do_IRQ (7 ); +if (cause &CAUSEF_IP2 ) +do_IRQ (2 ); +if (cause &CAUSEF_IP3 ) +do_IRQ (3 ); +if (cause &CAUSEF_IP4 ) +do_IRQ (4 ); +if (cause &CAUSEF_IP5 ) +do_IRQ (5 ); +if (cause &CAUSEF_IP6 ) +do_IRQ (6 ); +} + +void __init arch_init_irq (void ) +{ +mips_cpu_irq_init (); +}arch/mips/bcm947xx/Makefile +6
-0@@ -0,0 +1,6 @@ +# +# Makefile for the BCM947xx specific kernel interface routines +# under Linux. +# + +obj-y := irq.o prom.o setup.o time.oarch/mips/bcm947xx/prom.c +58
-0@@ -0,0 +1,58 @@ +/* +* Copyright (C) 2004 Florian Schirmer <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <linux/init.h> +#include <linux/mm.h> +#include <linux/sched.h> +#include <linux/bootmem.h> + +#include <asm/addrspace.h> +#include <asm/bootinfo.h> +#include <asm/pmon.h> + +const char *get_system_type (void ) +{ +return "Broadcom BCM947xx" ; +} + +void __init prom_init (void ) +{ +unsigned long mem; + + mips_machgroup =MACH_GROUP_BRCM ; + mips_machtype =MACH_BCM947XX ; + +/* Figure out memory size by finding aliases */ +for (mem = (1 <<20 ); mem < (128 <<20 ); mem += (1 <<20 )) { +if (*(unsigned long *)((unsigned long )(prom_init) + mem) == + *(unsigned long *)(prom_init)) +break ; + } + +add_memory_region (0 , mem,BOOT_MEM_RAM ); +} + +void __init prom_free_prom_memory (void ) +{ +}arch/mips/bcm947xx/setup.c +108
-0@@ -0,0 +1,108 @@ +/* +* Copyright (C) 2004 Florian Schirmer <[email protected]> +* Copyright (C) 2005 Waldemar Brodkorb <[email protected]> +* Copyright (C) 2006 Felix Fietkau <[email protected]> +* Copyright (C) 2006 Michael Buesch <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <linux/init.h> +#include <linux/types.h> +#include <linux/tty.h> +#include <linux/serial.h> +#include <linux/serial_core.h> +#include <linux/serial_reg.h> +#include <linux/serial_8250.h> +#include <asm/bootinfo.h> +#include <asm/time.h> +#include <asm/reboot.h> +#include <linux/pm.h> +#include <linux/ssb/ssb.h> + +extern void bcm947xx_pci_init (void ); +extern void bcm947xx_time_init (void ); + +struct ssb_bus ssb; + +static void bcm947xx_machine_restart (char *command) +{ +printk (KERN_ALERT "Please stand by while rebooting the system...\n" ); +local_irq_disable (); +/* Set the watchdog timer to reset immediately */ +ssb_chipco_watchdog_timer_set (&ssb.chipco,1 ); +while (1 ) +cpu_relax (); +} + +static void bcm947xx_machine_halt (void ) +{ +/* Disable interrupts and watchdog and spin forever */ +local_irq_disable (); +ssb_chipco_watchdog_timer_set (&ssb.chipco,0 ); +while (1 ) +cpu_relax (); +} + +static int bcm947xx_get_invariants (struct ssb_bus *bus,struct ssb_init_invariants *iv) +{ +/* TODO: fill ssb_init_invariants using boardtype/boardrev +* CFE environment variables. +*/ + +return 0 ; +} + +void __init plat_mem_setup (void ) +{ +int i, err; +struct ssb_mipscore *mcore; + + err =ssb_bus_ssbbus_register (&ssb,SSB_ENUM_BASE , bcm947xx_get_invariants); +if (err) +panic ("Failed to initialize SSB bus (err %d)\n" , err); + mcore = &ssb.mipscore; + +#ifdef CONFIG_SERIAL_8250 +for (i =0 ; i < mcore->nr_serial_ports; i++) { +struct ssb_serial_port *port = &(mcore->serial_ports[i]); +struct uart_port s; + +memset (&s,0 ,sizeof (s)); + s.line = i; + s.membase = port->regs; + s.irq = port->irq +2 ; + s.uartclk = port->baud_base; + s.flags =UPF_BOOT_AUTOCONF |UPF_SHARE_IRQ ; + s.iotype =SERIAL_IO_MEM ; + s.regshift = port->reg_shift; + +early_serial_setup (&s); + } +#endif + + _machine_restart = bcm947xx_machine_restart; + _machine_halt = bcm947xx_machine_halt; + pm_power_off = bcm947xx_machine_halt; + board_time_init = bcm947xx_time_init; +} + +EXPORT_SYMBOL (ssb);arch/mips/bcm947xx/time.c +62
-0@@ -0,0 +1,62 @@ +/* +* Copyright (C) 2004 Florian Schirmer <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <linux/init.h> +#include <linux/kernel.h> +#include <linux/sched.h> +#include <linux/serial_reg.h> +#include <linux/interrupt.h> +#include <linux/ssb/ssb.h> +#include <asm/addrspace.h> +#include <asm/io.h> +#include <asm/time.h> + +extern struct ssb_bus ssb; + +void __init +bcm947xx_time_init (void ) +{ +unsigned long hz; + +/* +* Use deterministic values for initial counter interrupt +* so that calibrate delay avoids encountering a counter wrap. +*/ +write_c0_count (0 ); +write_c0_compare (0xffff ); + + hz =ssb_cpu_clock (&ssb.mipscore) /2 ; +if (!hz) + hz =100000000 ; + +/* Set MIPS counter frequency for fixed_rate_gettimeoffset() */ + mips_hpt_frequency = hz; +} + +void __init +plat_timer_setup (struct irqaction *irq) +{ +/* Enable the timer interrupt */ +setup_irq (7 , irq); +}
Re: [PATCH -mm 2/4] MIPS: BCM947xx support (v2)
Quoted 13 lines · Florian Schirmer
Hi,
Quoted 9 lines · Aurelien Jarno
The patch below against 2.6.23-rc1-mm2 adds support for BCM947xx CPUs. It originally comes from the OpenWrt patches.
Cc Michael Buesch <[email protected]>Cc Waldemar Brodkorb <[email protected]>Cc Felix Fietkau <[email protected]>Cc Florian Schirmer <[email protected]>Signed-off-by Aurelien Jarno <[email protected]>
Quoted 3 lines
I'm not sure whether it's a good idea to export a symbol named "ssb". Maybe
bcm47xx_ssbwould be a better name? I've no idea what the general rule on exporting symbols is though. Otherwise:
I don't not either, but looking in other parts of the kernel it seems it is done the other way, ie ssb_bcm947xx would be the correct name.
I will send an updated patch.
Signature · 4 lines
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net
Re: [PATCH -mm 2/4] MIPS: BCM947xx support (v2)
In reply to Aurelien JarnoQuoted 2 lines · On Mon, 6 Aug 2007 21:17:12 +0200 Aurelien Jarno <[email protected]> wrote:
The patch below against 2.6.23-rc1-mm2 adds support for BCM947xx CPUs. It originally comes from the OpenWrt patches.
<snip>
Quoted 37 lines
arch/mips/bcm947xx/prom.c +34
-0@@ -0,0 +1,58 @@ +/* +* Copyright (C) 2004 Florian Schirmer <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <linux/init.h> +#include <linux/mm.h> +#include <linux/sched.h> +#include <linux/bootmem.h> + +#include <asm/addrspace.h> +#include <asm/bootinfo.h> +#include <asm/pmon.h> + +const char *get_system_type (void )
arch/mips/bcm947xx/prom.c line 44
Quoted 10 lines
arch/mips/bcm947xx/prom.c +10
-0+{ +return "Broadcom BCM947xx" ; +} + +void __init prom_init (void ) +{ +unsigned long mem; + + mips_machgroup =MACH_GROUP_BRCM ; + mips_machtype =MACH_BCM947XX ;
If you don't have a plan using mips_machgroup/mips_machtype, it is not a must.
Yoichi
Re: [PATCH -mm 2/4] MIPS: BCM947xx support (v2)
Quoted 48 lines · Yoichi Yuasa
Quoted 2 lines · On Mon, 6 Aug 2007 21:17:12 +0200 Aurelien Jarno <[email protected]> wrote:
The patch below against 2.6.23-rc1-mm2 adds support for BCM947xx CPUs. It originally comes from the OpenWrt patches.
<snip>
Quoted 42 lines
arch/mips/bcm947xx/prom.c +39
-0@@ -0,0 +1,58 @@ +/* +* Copyright (C) 2004 Florian Schirmer <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <linux/init.h> +#include <linux/mm.h> +#include <linux/sched.h> +#include <linux/bootmem.h> + +#include <asm/addrspace.h> +#include <asm/bootinfo.h> +#include <asm/pmon.h> + +const char *get_system_type (void ) +{ +return "Broadcom BCM947xx" ; +} + +void __init prom_init (void )
Quoted 8 lines
arch/mips/bcm947xx/prom.c line 44
Quoted 5 lines
arch/mips/bcm947xx/prom.c +5
-0+{ +unsigned long mem; + + mips_machgroup =MACH_GROUP_BRCM ; + mips_machtype =MACH_BCM947XX ;If you don't have a plan using mips_machgroup/mips_machtype, it is not a must.
It is not used in other parts of the code, so we can remove that part. I will update my patch.
Signature · 4 lines
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net
Re: [PATCH -mm 2/4] MIPS: BCM947xx support (v2)
In reply to Yoichi YuasaQuoted 48 lines · Yoichi Yuasa
Quoted 2 lines · On Mon, 6 Aug 2007 21:17:12 +0200 Aurelien Jarno <[email protected]> wrote:
The patch below against 2.6.23-rc1-mm2 adds support for BCM947xx CPUs. It originally comes from the OpenWrt patches.
<snip>
Quoted 42 lines
arch/mips/bcm947xx/prom.c +39
-0@@ -0,0 +1,58 @@ +/* +* Copyright (C) 2004 Florian Schirmer <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <linux/init.h> +#include <linux/mm.h> +#include <linux/sched.h> +#include <linux/bootmem.h> + +#include <asm/addrspace.h> +#include <asm/bootinfo.h> +#include <asm/pmon.h> + +const char *get_system_type (void ) +{ +return "Broadcom BCM947xx" ; +} + +void __init prom_init (void )
Quoted 8 lines
arch/mips/bcm947xx/prom.c line 44
Quoted 5 lines
arch/mips/bcm947xx/prom.c +5
-0+{ +unsigned long mem; + + mips_machgroup =MACH_GROUP_BRCM ; + mips_machtype =MACH_BCM947XX ;If you don't have a plan using mips_machgroup/mips_machtype, it is not a must.
It is not used in other parts of the code, so we can remove that part. I will update my patch.
Signature · 4 lines
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net
Re: [PATCH -mm 2/4] MIPS: BCM947xx support (v2)
In reply to Yoichi YuasaQuoted 48 lines · Yoichi Yuasa
Quoted 2 lines · On Mon, 6 Aug 2007 21:17:12 +0200 Aurelien Jarno <[email protected]> wrote:
The patch below against 2.6.23-rc1-mm2 adds support for BCM947xx CPUs. It originally comes from the OpenWrt patches.
<snip>
Quoted 42 lines
arch/mips/bcm947xx/prom.c +39
-0@@ -0,0 +1,58 @@ +/* +* Copyright (C) 2004 Florian Schirmer <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <linux/init.h> +#include <linux/mm.h> +#include <linux/sched.h> +#include <linux/bootmem.h> + +#include <asm/addrspace.h> +#include <asm/bootinfo.h> +#include <asm/pmon.h> + +const char *get_system_type (void ) +{ +return "Broadcom BCM947xx" ; +} + +void __init prom_init (void )
Quoted 8 lines
arch/mips/bcm947xx/prom.c line 44
Quoted 5 lines
arch/mips/bcm947xx/prom.c +5
-0+{ +unsigned long mem; + + mips_machgroup =MACH_GROUP_BRCM ; + mips_machtype =MACH_BCM947XX ;If you don't have a plan using mips_machgroup/mips_machtype, it is not a must.
It is not used in other parts of the code, so we can remove that part. I will update my patch.
Signature · 4 lines
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net
PATCH 2/4 MIPS: BCM947xx support (v3)
In reply to Yoichi YuasaThe patch below against 2.6.23-rc1-mm2 adds support for BCM947xx CPUs. It originally comes from the OpenWrt patches.
arch/mips/bcm947xx/irq.c +63 -0
@@ -0,0 +1,63 @@ +/* +* Copyright (C) 2004 Florian Schirmer <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <linux/errno.h> +#include <linux/init.h> +#include <linux/interrupt.h> +#include <linux/irq.h> +#include <linux/module.h> +#include <linux/smp.h> +#include <linux/types.h> + +#include <asm/cpu.h> +#include <asm/io.h> +#include <asm/irq.h> +#include <asm/irq_cpu.h> + +void plat_irq_dispatch (void ) +{ +u32 cause; + + cause =read_c0_cause () &read_c0_status () &CAUSEF_IP ; + +clear_c0_status (cause); + +if (cause &CAUSEF_IP7 ) +do_IRQ (7 ); +if (cause &CAUSEF_IP2 ) +do_IRQ (2 ); +if (cause &CAUSEF_IP3 ) +do_IRQ (3 ); +if (cause &CAUSEF_IP4 ) +do_IRQ (4 ); +if (cause &CAUSEF_IP5 ) +do_IRQ (5 ); +if (cause &CAUSEF_IP6 ) +do_IRQ (6 ); +} + +void __init arch_init_irq (void ) +{ +mips_cpu_irq_init (); +}
arch/mips/bcm947xx/Makefile +6 -0
@@ -0,0 +1,6 @@ +# +# Makefile for the BCM947xx specific kernel interface routines +# under Linux. +# + +obj-y := irq.o prom.o setup.o time.o
arch/mips/bcm947xx/prom.c +55 -0
55 lines not on this page · raw message
arch/mips/bcm947xx/setup.c +108 -0
108 lines not on this page · raw message
arch/mips/bcm947xx/time.c +62 -0
62 lines not on this page · raw message
Signature · 4 lines
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net
Re: [PATCH -mm 2/4] MIPS: BCM947xx support (v3)
arch/mips/bcm947xx/irq.c
Quoted 10 lines · On Tue, 7 Aug 2007 14:16:38 +0200 Aurelien Jarno <[email protected]> wrote:
The patch below against 2.6.23-rc1-mm2 adds support for BCM947xx CPUs. It originally comes from the OpenWrt patches.
Cc Michael Buesch <[email protected]>Cc Felix Fietkau <[email protected]>Cc Florian Schirmer <[email protected]>Signed-off-by Aurelien Jarno <[email protected]>arch/mips/bcm947xx/irq.c +0
-0
It's a MIPS patch. I can merge it, I guess, if Ralf is OK with that.
Quoted 25 lines
...
arch/mips/bcm947xx/irq.c +23
-0+void __init plat_mem_setup (void ) +{ +int i, err; +struct ssb_mipscore *mcore; + + err =ssb_bus_ssbbus_register (&ssb_bcm947xx,SSB_ENUM_BASE , bcm947xx_get_invariants); +if (err) +panic ("Failed to initialize SSB bus (err %d)\n" , err); + mcore = &ssb_bcm947xx.mipscore; + +#ifdef CONFIG_SERIAL_8250 +for (i =0 ; i < mcore->nr_serial_ports; i++) { +struct ssb_serial_port *port = &(mcore->serial_ports[i]); +struct uart_port s; + +memset (&s,0 ,sizeof (s)); + s.line = i; + s.membase = port->regs; + s.irq = port->irq +2 ; + s.uartclk = port->baud_base; + s.flags =UPF_BOOT_AUTOCONF |UPF_SHARE_IRQ ; + s.iotype =SERIAL_IO_MEM ; + s.regshift = port->reg_shift;
arch/mips/bcm947xx/irq.c
Quoted 10 lines
arch/mips/bcm947xx/irq.c +10
-0+ + early_serial_setup(&s); + } +#endif + + _machine_restart = bcm947xx_machine_restart; + _machine_halt = bcm947xx_machine_halt; + pm_power_off = bcm947xx_machine_halt; + board_time_init = bcm947xx_time_init; +}
Won't this break if CONFIG_SERIAL_8250=m?
Quoted 29 lines
arch/mips/bcm947xx/irq.c +1
-0+EXPORT_SYMBOL (ssb_bcm947xx);arch/mips/bcm947xx/time.c +25
-0@@ -0,0 +1,62 @@ +/* +* Copyright (C) 2004 Florian Schirmer <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <linux/init.h>
arch/mips/bcm947xx/time.c line 35
Quoted 10 lines
arch/mips/bcm947xx/time.c +10
-0+#include <linux/kernel.h> +#include <linux/sched.h> +#include <linux/serial_reg.h> +#include <linux/interrupt.h> +#include <linux/ssb/ssb.h> +#include <asm/addrspace.h> +#include <asm/io.h> +#include <asm/time.h> + +extern struct ssb_bus ssb_bcm947xx;
No. Please, never ever put extern declarations in C files. Find a suitable header file for it.
We have scripts/checkpatch.pl which will tell you this (and a lot of other stuff too). Please incorporate checkpatch into your workflow.
Quoted 26 lines
arch/mips/bcm947xx/time.c +26
-0+void __init +bcm947xx_time_init (void ) +{ +unsigned long hz; + +/* +* Use deterministic values for initial counter interrupt +* so that calibrate delay avoids encountering a counter wrap. +*/ +write_c0_count (0 ); +write_c0_compare (0xffff ); + + hz =ssb_cpu_clock (&ssb_bcm947xx.mipscore) /2 ; +if (!hz) + hz =100000000 ; + +/* Set MIPS counter frequency for fixed_rate_gettimeoffset() */ + mips_hpt_frequency = hz; +} + +void __init +plat_timer_setup (struct irqaction *irq) +{ +/* Enable the timer interrupt */ +setup_irq (7 , irq); +}
cover MIPS BCM947xx CPUs support
Hi,
Thanks a lot for all your comments. You will find in the next mails a new version of the BCM947xx patches which include fixes for your comments. The big changes concerns the serial driver which now uses a platform driver for the configuration. This fixes the case where CONFIG_SERIAL_8250=m.
Given the current mess wrt SSB patches, I don't ask them to be merged now, but if would be nice if you can review them. Thanks.
Regards,
Aurelien
The following series of patches add basic support for the BCM947xx CPUs. CFE support still needs work and thus is not included in those patches, so the command line has to be included in the kernel. Everything else is fully functional and the resulting kernel works fine on a Netgear WGT634U.
Patch #1: MIPS: Detect BCM947xx CPUs
Patch #2: MIPS: BCM947xx support
Patch #3: MIPS: Add BCM947XX to Kconfig
Patch #4: MIPS: Add BCM947xx to Makefile
Signature · 4 lines
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net
RFC PATCH 1/4 MIPS: Detect BCM947xx CPUs
The patch below against 2.6.23-rc1-mm2 adds a few constants for BCM947xx CPUs and detect them in cpu-probe.c and tlbex.c. Note that the BCM4710 does not support the wait instruction, this is not a mistake in the code.
This part is not dependent of other patches (though useless without them), and could already be merged in the current linux-mips git tree.
arch/mips/kernel/cpu-probe.c +20 -0
@@ -159,6 +159,7 @@case CPU_5KC :case CPU_25KF :case CPU_PR4450 : +case CPU_BCM3302 : cpu_wait = r4k_wait;break ;
@@ -786,6 +787,22 @@ } +static inline void cpu_probe_broadcom (struct cpuinfo_mips *c) +{ +decode_configs (c); +switch (c->processor_id &0xff00 ) { +case PRID_IMP_BCM3302 : + c->cputype =CPU_BCM3302 ; +break ; +case PRID_IMP_BCM4710 : + c->cputype =CPU_BCM4710 ; +break ; +default : + c->cputype =CPU_UNKNOWN ; +break ; + } +} +__init void cpu_probe (void ) {struct cpuinfo_mips *c = ¤t_cpu_data;
@@ -808,6 +825,9 @@case PRID_COMP_SIBYTE :cpu_probe_sibyte (c);break ; +case PRID_COMP_BROADCOM : +cpu_probe_broadcom (c); +break ;case PRID_COMP_SANDCRAFT :cpu_probe_sandcraft (c);break ;
arch/mips/kernel/proc.c +2 -0
@@ -82,6 +82,8 @@ [CPU_VR4181] = "NEC VR4181", [CPU_VR4181A] = "NEC VR4181A", [CPU_SR71000] = "Sandcraft SR71000", + [CPU_BCM3302] = "Broadcom BCM3302", + [CPU_BCM4710] = "Broadcom BCM4710", [CPU_PR4450] = "Philips PR4450", [CPU_LOONGSON2] = "ICT Loongson-2", };
arch/mips/mm/tlbex.c +2 -0
@@ -893,6 +893,8 @@case CPU_4KSC :case CPU_20KC :case CPU_25KF : +case CPU_BCM3302 : +case CPU_BCM4710 :case CPU_LOONGSON2 :tlbw (p);break ;
include/asm-mips/bootinfo.h +6 -0
@@ -221,6 +221,12 @@#define MACH_GROUP_WINDRIVER 28/* Windriver boards */ #define MACH_WRPPMC 1 +/* +* Valid machtype for group Broadcom +*/ +#define MACH_GROUP_BRCM 23/* Broadcom */ +#define MACH_BCM947XX 1/* Broadcom BCM947xx */ +#define CL_SIZE COMMAND_LINE_SIZEconst char *get_system_type (void );
include/asm-mips/cpu.h +10 -2
@@ -106,6 +106,13 @@#define PRID_IMP_SR71000 0x0400/* +* These are the PRID's for when 23:16 == PRID_COMP_BROADCOM +*/ + +#define PRID_IMP_BCM4710 0x4000 +#define PRID_IMP_BCM3302 0x9000 + +/* * Definitions for 7:0 on legacy processors */
@@ -217,8 +224,9 @@#define CPU_R14000 64#define CPU_LOONGSON1 65#define CPU_LOONGSON2 66 - -#define CPU_LAST 66 +#define CPU_BCM3302 67 +#define CPU_BCM4710 68 +#define CPU_LAST 68/* * ISA Level encodings
Signature · 4 lines
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net
RFC PATCH 2/4 MIPS: BCM947xx support
In reply to Aurelien JarnoThe patch below against 2.6.23-rc1-mm2 adds support for BCM947xx CPUs. It originally comes from the OpenWrt patches.
arch/mips/bcm947xx/irq.c +55 -0
@@ -0,0 +1,55 @@ +/* +* Copyright (C) 2004 Florian Schirmer <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED +* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN +* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +* +* You should have received a copy of the GNU General Public License along +* with this program; if not, write to the Free Software Foundation, Inc., +* 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <linux/types.h> +#include <linux/interrupt.h> +#include <linux/irq.h> +#include <asm/irq_cpu.h> + +void plat_irq_dispatch (void ) +{ +u32 cause; + + cause =read_c0_cause () &read_c0_status () &CAUSEF_IP ; + +clear_c0_status (cause); + +if (cause &CAUSEF_IP7 ) +do_IRQ (7 ); +if (cause &CAUSEF_IP2 ) +do_IRQ (2 ); +if (cause &CAUSEF_IP3 ) +do_IRQ (3 ); +if (cause &CAUSEF_IP4 ) +do_IRQ (4 ); +if (cause &CAUSEF_IP5 ) +do_IRQ (5 ); +if (cause &CAUSEF_IP6 ) +do_IRQ (6 ); +} + +void __init arch_init_irq (void ) +{ +mips_cpu_irq_init (); +}
arch/mips/bcm947xx/Makefile +6 -0
@@ -0,0 +1,6 @@ +# +# Makefile for the BCM947xx specific kernel interface routines +# under Linux. +# + +obj-y := irq.o prom.o serial.o setup.o time.o
arch/mips/bcm947xx/prom.c +49 -0
49 lines not on this page · raw message
arch/mips/bcm947xx/serial.c +52 -0
52 lines not on this page · raw message
arch/mips/bcm947xx/setup.c +79 -0
79 lines not on this page · raw message
arch/mips/bcm947xx/time.c +56 -0
56 lines not on this page · raw message
include/asm-mips/mach-bcm947xx/bcm947xx.h +27 -0
@@ -0,0 +1,27 @@ +/* +* Copyright (C) 2007 Aurelien Jarno <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version 2 +* of the License, or (at your option) any later version. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifndef __ASM_BCM947XX_H +#define __ASM_BCM947XX_H + +/* SSB bus */ +extern struct ssb_bus ssb_bcm947xx; + +extern void bcm947xx_time_init (void ); + +#endif /* __ASM_BCM947XX_H */
Signature · 4 lines
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net
arch/mips/bcm947xx/setup.c line 35
Quoted 2 lines · On Thursday 09 August 2007 02:44:30 Aurelien Jarno wrote:
arch/mips/bcm947xx/setup.c +2
-0+struct ssb_bus ssb_bcm947xx; +EXPORT_SYMBOL (ssb_bcm947xx);
Huh, which module does need this internal structure?
Signature · 1 line
Greetings Michael.
Quoted 6 lines · Michael Buesch
arch/mips/bcm947xx/setup.c line 35
Quoted 2 lines · On Thursday 09 August 2007 02:44:30 Aurelien Jarno wrote:
arch/mips/bcm947xx/setup.c +2
-0+struct ssb_bus ssb_bcm947xx; +EXPORT_SYMBOL (ssb_bcm947xx);Huh, which module does need this internal structure?
This is needed for mtd mappings. The size and the location of the flash is taken from this structure.
Signature · 4 lines
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net
Quoted 11 lines · On Thursday 09 August 2007 12:38:43 Aurelien Jarno wrote:
Quoted 6 lines · Michael Buesch
arch/mips/bcm947xx/setup.c line 35
Quoted 2 lines · On Thursday 09 August 2007 02:44:30 Aurelien Jarno wrote:
arch/mips/bcm947xx/setup.c +2
-0+struct ssb_bus ssb_bcm947xx; +EXPORT_SYMBOL (ssb_bcm947xx);Huh, which module does need this internal structure?
This is needed for mtd mappings. The size and the location of the flash is taken from this structure.
So mtd is compiled as a module? Really? From where is it loaded, if not from flash?
Signature · 1 line
Greetings Michael.
Quoted 7 lines · Michael Buesch
Quoted 6 lines · On Thursday 09 August 2007 12:38:43 Aurelien Jarno wrote:
Quoted 5 lines · Michael Buesch
arch/mips/bcm947xx/setup.c line 35
Quoted 2 lines · On Thursday 09 August 2007 02:44:30 Aurelien Jarno wrote:
arch/mips/bcm947xx/setup.c +2
-0+struct ssb_bus ssb_bcm947xx; +EXPORT_SYMBOL (ssb_bcm947xx);Huh, which module does need this internal structure?
Quoted 7 lines
Quoted 3 lines
This is needed for mtd mappings. The size and the location of the flash is taken from this structure.
So mtd is compiled as a module? Really? From where is it loaded, if not from flash?
Well you don't have to compile it as a module, but you can. Then you can load it from the hard drive.
Signature · 4 lines
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net
Quoted 12 lines · On Thursday 09 August 2007 13:26:40 Aurelien Jarno wrote:
Quoted 11 lines · Michael Buesch
Quoted 9 lines · On Thursday 09 August 2007 12:38:43 Aurelien Jarno wrote:
Quoted 5 lines · Michael Buesch
arch/mips/bcm947xx/setup.c line 35
Quoted 2 lines · On Thursday 09 August 2007 02:44:30 Aurelien Jarno wrote:
arch/mips/bcm947xx/setup.c +2
-0+struct ssb_bus ssb_bcm947xx; +EXPORT_SYMBOL (ssb_bcm947xx);Huh, which module does need this internal structure?
This is needed for mtd mappings. The size and the location of the flash is taken from this structure.
Quoted 6 lines
Quoted 3 lines
So mtd is compiled as a module? Really? From where is it loaded, if not from flash?
Well you don't have to compile it as a module, but you can. Then you can load it from the hard drive.
Ah, ok. I see. Acked.
Signature · 1 line
Greetings Michael.
PATCH 3/4 RFC: Add BCM947XX to Kconfig
In reply to Aurelien JarnoThe patch below against 2.6.23-rc1-mm2 adds a BCM947XX option to Kconfig.
arch/mips/Kconfig +14 -0
@@ -67,6 +67,20 @@ note that a kernel built with this option selected will not be able to run on normal units. +config BCM947XX + bool "BCM947xx based boards" + select DMA_NONCOHERENT + select HW_HAS_PCI + select IRQ_CPU + select SYS_HAS_CPU_MIPS32_R1 + select SYS_SUPPORTS_32BIT_KERNEL + select SYS_SUPPORTS_LITTLE_ENDIAN + select SSB + select SSB_DRIVER_MIPS + select GENERIC_GPIO + help + Support for BCM947xx based boards + config MIPS_COBALT bool "Cobalt Server" select DMA_NONCOHERENT
drivers/ssb/Kconfig +1 -0
@@ -67,6 +67,7 @@ config SSB_PCICORE_HOSTMODE bool "Hostmode support for SSB PCI core" depends on SSB_DRIVER_PCICORE && SSB_DRIVER_MIPS + default y if BCM947XX help PCIcore hostmode operation (external PCI bus).
Signature · 4 lines
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net
Re: [PATCH 3/4] RFC: Add BCM947XX to Kconfig
Quoted 34 lines · On Thu, 9 Aug 2007 02:45:14 +0200 Aurelien Jarno <[email protected]> wrote:
The patch below against 2.6.23-rc1-mm2 adds a BCM947XX option to
Kconfig.Cc Michael Buesch <[email protected]>Cc Felix Fietkau <[email protected]>Cc Florian Schirmer <[email protected]>Signed-off-by Aurelien Jarno <[email protected]>arch/mips/Kconfig +14
-0@@ -67,6 +67,20 @@ note that a kernel built with this option selected will not be able to run on normal units. +config BCM947XX + bool "BCM947xx based boards" + select DMA_NONCOHERENT + select HW_HAS_PCI + select IRQ_CPU + select SYS_HAS_CPU_MIPS32_R1 + select SYS_SUPPORTS_32BIT_KERNEL + select SYS_SUPPORTS_LITTLE_ENDIAN + select SSB + select SSB_DRIVER_MIPS + select GENERIC_GPIO + help + Support for BCM947xx based boards + config MIPS_COBALT bool "Cobalt Server" select DMA_NONCOHERENT
drivers/ssb/Kconfig line 72
Quoted 6 lines
drivers/ssb/Kconfig +1
-0@@ -67,6 +67,7 @@ config SSB_PCICORE_HOSTMODE bool "Hostmode support for SSB PCI core" depends on SSB_DRIVER_PCICORE && SSB_DRIVER_MIPS + default y if BCM947XX help PCIcore hostmode operation (external PCI bus).
I'll consider these to be MIPS patches, so I'll spam Ralf with them.
I dropped the second hunk here, as Ralf has no drivers/ssb. This will need to be wired up in some later patch, once these various trees all end up in the same place, presumably Linus's tree.
RFC PATCH 4/4 MIPS: Add BCM947xx to Makefile
In reply to Aurelien JarnoThe patch below against 2.6.23-rc1-mm2 adds BCM947xx to arch/mips/Makefile.
arch/mips/Makefile +7 -0
@@ -549,6 +549,13 @@ load-$(CONFIG_SIBYTE_BIGSUR) := 0xffffffff80100000 # +# Broadcom BCM947XX boards +# +core-$(CONFIG_BCM947XX) += arch/mips/bcm947xx/ +cflags-$(CONFIG_BCM947XX) += -Iinclude/asm-mips/mach-bcm947xx +load-$(CONFIG_BCM947XX) := 0xffffffff80001000 + +# # SNI RM # core-$(CONFIG_SNI_RM) += arch/mips/sni/
Signature · 4 lines
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net