* Re: linux booting fails on ppc440x5 with SRAM
From: Benjamin Herrenschmidt @ 2009-09-23 21:40 UTC (permalink / raw)
To: Vineeth _; +Cc: linuxppc-dev
In-Reply-To: <a9b543570909230749g5bb9c302wa48f310250068f5b@mail.gmail.com>
On Wed, 2009-09-23 at 20:19 +0530, Vineeth _ wrote:
> I am trying to port linux on IBM powerpc-440x5. I have this board
> which has this processor, a 16MB SRAM sits on location 0x0, uart and a
> flash.I have a simple bootloader which does the following.
> 1. Initialize the processor (as part of it, we Generates the tlbs
> for UART,16MB flash,16MB SRAM)
> 2. Initialize the UART
> 3. Copy the simple-boot linux_image (binary file) from flash to
> 0x400000 location of SRAM.
> 4. Kernel entry to 0x400000
Not sure yet, looks like things are being overwritten during boot.
Interestingly enough, the DEAR value looks like an MSR value..
Hard to tell what's up. You'll have to dig a bit more youself to
figure out how come the kernel's getting that bad pointer.
All I can tell you is that things work fine on 440x5 cores, though
I haven't tested a configuration with so little memory in a while.
Ben.
> zImage starting: loaded at 0x00400000 (sp: 0x004deeb0)
> Allocating 0x1dad84 bytes for kernel ...
> gunzipping (0x00000000 <- 0x0040c000:0x004dd3f1)...done 0x1c31cc bytes
>
> Linux/PowerPC load: console=ttyS0 root=/dev/ram
> Finalizing device tree... flat tree at 0x4eb300
> id mach(): done
> inside skybeam_register_console function
> MMU:enterMMU:hw initMMU:mapinMMU:setioMMU:exitinside
> _setup_arch-begininginside _setup_arch-1inside
> _setup_arch-2setup_arch: bootmemarch: exit<7>Top of RAM: 0x1000000,
> Total RAM: 0x1000000
> Zone PFN ranges:
> DMA 0x00000000 -> 0x00001000
> Normal 0x00001000 -> 0x00001000
> Movable zone start PFN for each node
> early_node_map[1] active PFN ranges
> 0: 0x00000000 -> 0x00001000
> MMU: Allocated 1088 bytes of context maps for 255 contexts
> Built 1 zonelists in Zone order, mobility grouping off. Total pages: 4064
> Kernel command line: console=ttyS0 root=/dev/ram
> Unable to handle kernel paging request for data at address 0x00021000
> Faulting instruction address: 0xc010a7c4
> Oops: Kernel access of bad area, sig: 11 [#1]
> PREEMPT PowerPC 44x Platform
> Modules linked in:
> NIP: c010a7c4 LR: c010dc50 CTR: 00000000
> REGS: c01bfeb0 TRAP: 0300 Not tainted (2.6.30)
> MSR: 00021000 <ME,CE> CR: 24000044 XER: 00000000
> DEAR: 00021000, ESR: 00000000
> TASK = c01a94b8[0] 'swapper' THREAD: c01be000
> GPR00: 00001180 c01bff60 c01a94b8 00021000 00000025 00000008 c0104968 00000000
> GPR08: 2f72616d c0110000 c0155938 c01a0000 22000024 00000000 fffff104 00000000
> GPR16: 00000000 00000000 00000000 00000000 fffffff8 000008b8 c010d758 c0104968
> GPR24: 00001198 00001190 c018a001 c01c5498 000008c0 00001188 00021000 c01c42f0
> NIP [c010a7c4] strchr+0x0/0x3c
> LR [c010dc50] match_token+0x138/0x228
> Call Trace:
> [c01bff60] [c016b99c] 0xc016b99c (unreliable)
> [c01bffa0] [c0104a00] sort_extable+0x28/0x38
> [c01bffb0] [c01938ec] sort_main_extable+0x20/0x30
> [c01bffc0] [c018c734] start_kernel+0x140/0x288
> [c01bfff0] [c0000200] skpinv+0x190/0x1cc
> Instruction dump:
> 7ca903a6 88040000 38a5ffff 38840001 2f800000 98090000 39290001 419e0010
> 4200ffe4 98a90000 4e800020 4e800020 <88030000> 5484063e 7f802000 4d9e0020
> ---[ end trace 31fd0ba7d8756001 ]---
> Kernel panic - not syncing: Attempted to kill the idle task!
> Call Trace:
> [c01bfd90] [c0005d5c] show_stack+0x4c/0x16c (unreliable)
> [c01bfdd0] [c002f17c] panic+0xa0/0x168
> [c01bfe20] [c0032eb8] do_exit+0x61c/0x638
> [c01bfe60] [c000b60c] kernel_bad_stack+0x0/0x4c
> [c01bfe90] [c000f310] bad_page_fault+0x90/0xd8
> [c01bfea0] [c000e184] handle_page_fault+0x7c/0x80
> [c01bff60] [c016b99c] 0xc016b99c
> [c01bffa0] [c0104a00] sort_extable+0x28/0x38
> [c01bffb0] [c01938ec] sort_main_extable+0x20/0x30
> [c01bffc0] [c018c734] start_kernel+0x140/0x288
> [c01bfff0] [c0000200] skpinv+0x190/0x1cc
> Rebooting in 180 seconds..
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
^ permalink raw reply
* Re: [PATCH 2/2] powerpc/44x: Fix xmon single step on PowerPC 44x
From: Benjamin Herrenschmidt @ 2009-09-23 21:34 UTC (permalink / raw)
To: Josh Boyer; +Cc: linuxppc-dev
In-Reply-To: <20090923135156.GH14261@zod.rchland.ibm.com>
On Wed, 2009-09-23 at 09:51 -0400, Josh Boyer wrote:
> Prior to the arch/ppc -> arch/powerpc transition, xmon had support for single
> stepping on 4xx boards. The functionality was lost when arch/ppc was removed.
> This patch restores single step support for 44x boards.
>
> Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
> ---
> arch/powerpc/xmon/xmon.c | 20 +++++++++++++++++++-
> 1 files changed, 19 insertions(+), 1 deletions(-)
>
> diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
> index c6f0a71..fe2ad71 100644
> --- a/arch/powerpc/xmon/xmon.c
> +++ b/arch/powerpc/xmon/xmon.c
> @@ -517,6 +517,15 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
> in_xmon = 0;
> #endif
>
> +#ifdef CONFIG_4xx
> + if ((regs->msr & (MSR_DE)) == (MSR_DE)) {
Why not just if (regs->msr & MSR_DE) ?
> + bp = at_breakpoint(regs->nip);
> + if (bp != NULL) {
> + regs->nip = (unsigned long) &bp->instr[0];
> + atomic_inc(&bp->ref_count);
> + }
> + }
> +#else
Any reason why that couldn't be in CONFIG_BOOKE ?
> if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) == (MSR_IR|MSR_SF)) {
> bp = at_breakpoint(regs->nip);
> if (bp != NULL) {
> @@ -530,7 +539,7 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
> }
> }
> }
> -
> +#endif
> insert_cpu_bpts();
>
> local_irq_restore(flags);
> @@ -894,6 +903,14 @@ cmds(struct pt_regs *excp)
> }
> }
>
> +#ifdef CONFIG_44x
Same comment about BOOKE intead of 44x
> +static int do_step(struct pt_regs *regs)
> +{
> + regs->msr |= MSR_DE;
> + mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR0_IC | DBCR0_IDM);
I'm not sure about setting IDM... Won't that be a problem if you have
an external debugger connected ?
> + return 1;
> +}
> +#else
> /*
> * Step a single instruction.
> * Some instructions we emulate, others we execute with MSR_SE set.
> @@ -924,6 +941,7 @@ static int do_step(struct pt_regs *regs)
> regs->msr |= MSR_SE;
> return 1;
> }
> +#endif
Cheers,
Ben.
> static void bootcmds(void)
> {
^ permalink raw reply
* [PATCH] Fix linking modules against crtsavres.o
From: Yuri Frolov @ 2009-09-23 19:36 UTC (permalink / raw)
To: linuxppc-dev; +Cc: rep.dot.nop, linux-kbuild
[-- Attachment #1.1: Type: text/plain, Size: 249 bytes --]
Hello,
This patch should export crtsavres.o, as suggested in comment# 4 by Olaf
Hering at
http://bugzilla.kernel.org/show_bug.cgi?id=11143.
Otherwise, it's the same as original work done by Bernhard Reutner-Fischer.
Please, consider to apply.
//
[-- Attachment #1.2: Type: text/html, Size: 690 bytes --]
[-- Attachment #2: powerpc-crtsavres-korg.patch --]
[-- Type: text/x-patch, Size: 3597 bytes --]
Fix linking modules against crtsavres.o
Previously we got
CC drivers/char/hw_random/rng-core.mod.o
LD [M] drivers/char/hw_random/rng-core.ko
/there/src/buildroot.git.ppc/build_powerpc_nofpu/staging_dir/usr/bin/powerpc-linux-uclibc-ld: arch/powerpc/lib/crtsavres.o: No such file: No such file or directory
* Makefile (LDFLAGS_MODULE_PREREQ): New variable to hold prerequisite
files for modules.
* arch/powerpc/Makefile: add crtsavres.o to LDFLAGS_MODULE_PREREQ.
* scripts/Makefile.modpost (cmd_as_o_S): Copy from Makefile.build.
(cmd_ld_ko_o): Also link LDFLAGS_MODULE_PREREQ.
Provide rule to build objects from assembler.
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off by: Yuri Frolov <yfrolov@ru.mvista.com>
Makefile | 2 ++
arch/powerpc/Makefile | 2 +-
scripts/Makefile.modpost | 12 ++++++++++--
3 files changed, 13 insertions(+), 3 deletions(-)
diff -urpN -X linux-2.6/Documentation/dontdiff linux-2.6/arch/powerpc/Makefile linux-2.6-powerpc-crtsavres/arch/powerpc/Makefile
--- linux-2.6/arch/powerpc/Makefile 2009-09-17 20:04:31.000000000 +0400
+++ linux-2.6-powerpc-crtsavres/arch/powerpc/Makefile 2009-09-23 22:08:03.000000000 +0400
@@ -93,7 +93,7 @@ else
KBUILD_CFLAGS += $(call cc-option,-mtune=power4)
endif
else
-LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
+LDFLAGS_MODULE_PREREQ += arch/powerpc/lib/crtsavres.o
endif
ifeq ($(CONFIG_TUNE_CELL),y)
diff -urpN -X linux-2.6/Documentation/dontdiff linux-2.6/Makefile linux-2.6-powerpc-crtsavres/Makefile
--- linux-2.6/Makefile 2009-09-17 20:04:30.000000000 +0400
+++ linux-2.6-powerpc-crtsavres/Makefile 2009-09-23 21:41:16.000000000 +0400
@@ -326,6 +326,7 @@ MODFLAGS = -DMODULE
CFLAGS_MODULE = $(MODFLAGS)
AFLAGS_MODULE = $(MODFLAGS)
LDFLAGS_MODULE = -T $(srctree)/scripts/module-common.lds
+LDFLAGS_MODULE_PREREQ =
CFLAGS_KERNEL =
AFLAGS_KERNEL =
CFLAGS_GCOV = -fprofile-arcs -ftest-coverage
@@ -355,6 +356,7 @@ export VERSION PATCHLEVEL SUBLEVEL KERNE
export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE
export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
+export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE LDFLAGS_MODULE_PREREQ CHECK CHECKFLAGS
export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV
diff -urpN -X linux-2.6/Documentation/dontdiff linux-2.6/scripts/Makefile.modpost linux-2.6-powerpc-crtsavres/scripts/Makefile.modpost
--- linux-2.6/scripts/Makefile.modpost 2009-09-17 20:04:42.000000000 +0400
+++ linux-2.6-powerpc-crtsavres/scripts/Makefile.modpost 2009-09-23 22:15:00.000000000 +0400
@@ -122,14 +122,22 @@ quiet_cmd_cc_o_c = CC $@
cmd_cc_o_c = $(CC) $(c_flags) $(CFLAGS_MODULE) \
-c -o $@ $<
-$(modules:.ko=.mod.o): %.mod.o: %.mod.c FORCE
+quiet_cmd_as_o_S = AS $(quiet_modtag) $@
+cmd_as_o_S = $(CC) $(a_flags) $(AFLAGS_MODULE) -c -o $@ $<
+
+$(LDFLAGS_MODULE_PREREQ): %.o: %.S FORCE
+ $(Q)mkdir -p $(dir $@)
+ $(call if_changed_dep,as_o_S)
+
+$(modules:.ko=.mod.o): %.mod.o: %.mod.c $(LDFLAGS_MODULE_PREREQ) FORCE
$(call if_changed_dep,cc_o_c)
targets += $(modules:.ko=.mod.o)
# Step 6), final link of the modules
quiet_cmd_ld_ko_o = LD [M] $@
- cmd_ld_ko_o = $(LD) -r $(LDFLAGS) $(LDFLAGS_MODULE) -o $@ \
+ cmd_ld_ko_o = $(LD) -r $(LDFLAGS) $(LDFLAGS_MODULE_PREREQ) \
+ $(LDFLAGS_MODULE) -o $@ \
$(filter-out FORCE,$^)
$(modules): %.ko :%.o %.mod.o FORCE
^ permalink raw reply
* [PATCH 3/3] powerpc/83xx: Add power management support for MPC8315E-RDB boards
From: Anton Vorontsov @ 2009-09-23 19:01 UTC (permalink / raw)
To: Kumar Gala; +Cc: Scott Wood, linuxppc-dev
In-Reply-To: <20090923190041.GA18944@oksana.dev.rtsoft.ru>
- Add nodes for PMC and GTM controllers. GTM4 can be used as a wakeup
source;
- Add fsl,magic-packet properties to eTSEC nodes, i.e. wake-on-lan
support. Unlike MPC8313 processors, MPC8315 can resume from deep
sleep upon magic packet reception;
- Add proper sleep = <> properties;
- DMA and PCI share a single clock soruce, so put them into "sleep
nexus" node (the same we do for MPC8313E-RDB boards);
- I2C and Encryption core also share a single clock, so do the same:
put i2c and crypto nodes into sleep-nexus.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
arch/powerpc/boot/dts/mpc8315erdb.dts | 264 ++++++++++++++++++++-------------
1 files changed, 161 insertions(+), 103 deletions(-)
diff --git a/arch/powerpc/boot/dts/mpc8315erdb.dts b/arch/powerpc/boot/dts/mpc8315erdb.dts
index 32e10f5..406ebc3 100644
--- a/arch/powerpc/boot/dts/mpc8315erdb.dts
+++ b/arch/powerpc/boot/dts/mpc8315erdb.dts
@@ -109,26 +109,47 @@
reg = <0x200 0x100>;
};
- i2c@3000 {
+ sleep-nexus {
#address-cells = <1>;
- #size-cells = <0>;
- cell-index = <0>;
- compatible = "fsl-i2c";
- reg = <0x3000 0x100>;
- interrupts = <14 0x8>;
- interrupt-parent = <&ipic>;
- dfsrr;
- rtc@68 {
- compatible = "dallas,ds1339";
- reg = <0x68>;
+ #size-cells = <1>;
+ compatible = "simple-bus";
+ sleep = <&pmc 0x03000000>;
+ ranges;
+
+ i2c@3000 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ cell-index = <0>;
+ compatible = "fsl-i2c";
+ reg = <0x3000 0x100>;
+ interrupts = <14 0x8>;
+ interrupt-parent = <&ipic>;
+ dfsrr;
+ rtc@68 {
+ compatible = "dallas,ds1339";
+ reg = <0x68>;
+ };
+
+ mcu_pio: mcu@a {
+ #gpio-cells = <2>;
+ compatible = "fsl,mc9s08qg8-mpc8315erdb",
+ "fsl,mcu-mpc8349emitx";
+ reg = <0x0a>;
+ gpio-controller;
+ };
};
- mcu_pio: mcu@a {
- #gpio-cells = <2>;
- compatible = "fsl,mc9s08qg8-mpc8315erdb",
- "fsl,mcu-mpc8349emitx";
- reg = <0x0a>;
- gpio-controller;
+ crypto@30000 {
+ compatible = "fsl,sec3.3", "fsl,sec3.1", "fsl,sec3.0",
+ "fsl,sec2.4", "fsl,sec2.2", "fsl,sec2.1",
+ "fsl,sec2.0";
+ reg = <0x30000 0x10000>;
+ interrupts = <11 0x8>;
+ interrupt-parent = <&ipic>;
+ fsl,num-channels = <4>;
+ fsl,channel-fifo-len = <24>;
+ fsl,exec-units-mask = <0x97c>;
+ fsl,descriptor-types-mask = <0x3ab0abf>;
};
};
@@ -141,45 +162,6 @@
mode = "cpu";
};
- dma@82a8 {
- #address-cells = <1>;
- #size-cells = <1>;
- compatible = "fsl,mpc8315-dma", "fsl,elo-dma";
- reg = <0x82a8 4>;
- ranges = <0 0x8100 0x1a8>;
- interrupt-parent = <&ipic>;
- interrupts = <71 8>;
- cell-index = <0>;
- dma-channel@0 {
- compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
- reg = <0 0x80>;
- cell-index = <0>;
- interrupt-parent = <&ipic>;
- interrupts = <71 8>;
- };
- dma-channel@80 {
- compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
- reg = <0x80 0x80>;
- cell-index = <1>;
- interrupt-parent = <&ipic>;
- interrupts = <71 8>;
- };
- dma-channel@100 {
- compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
- reg = <0x100 0x80>;
- cell-index = <2>;
- interrupt-parent = <&ipic>;
- interrupts = <71 8>;
- };
- dma-channel@180 {
- compatible = "fsl,mpc8315-dma-channel", "fsl,elo-dma-channel";
- reg = <0x180 0x28>;
- cell-index = <3>;
- interrupt-parent = <&ipic>;
- interrupts = <71 8>;
- };
- };
-
usb@23000 {
compatible = "fsl-usb2-dr";
reg = <0x23000 0x1000>;
@@ -188,6 +170,7 @@
interrupt-parent = <&ipic>;
interrupts = <38 0x8>;
phy_type = "utmi";
+ sleep = <&pmc 0x00c00000>;
};
enet0: ethernet@24000 {
@@ -204,6 +187,8 @@
interrupt-parent = <&ipic>;
tbi-handle = <&tbi0>;
phy-handle = < &phy0 >;
+ sleep = <&pmc 0xc0000000>;
+ fsl,magic-packet;
mdio@520 {
#address-cells = <1>;
@@ -246,6 +231,8 @@
interrupt-parent = <&ipic>;
tbi-handle = <&tbi1>;
phy-handle = < &phy1 >;
+ sleep = <&pmc 0x30000000>;
+ fsl,magic-packet;
mdio@520 {
#address-cells = <1>;
@@ -280,25 +267,13 @@
interrupt-parent = <&ipic>;
};
- crypto@30000 {
- compatible = "fsl,sec3.3", "fsl,sec3.1", "fsl,sec3.0",
- "fsl,sec2.4", "fsl,sec2.2", "fsl,sec2.1",
- "fsl,sec2.0";
- reg = <0x30000 0x10000>;
- interrupts = <11 0x8>;
- interrupt-parent = <&ipic>;
- fsl,num-channels = <4>;
- fsl,channel-fifo-len = <24>;
- fsl,exec-units-mask = <0x97c>;
- fsl,descriptor-types-mask = <0x3ab0abf>;
- };
-
sata@18000 {
compatible = "fsl,mpc8315-sata", "fsl,pq-sata";
reg = <0x18000 0x1000>;
cell-index = <1>;
interrupts = <44 0x8>;
interrupt-parent = <&ipic>;
+ sleep = <&pmc 0x00003000>;
};
sata@19000 {
@@ -307,6 +282,23 @@
cell-index = <2>;
interrupts = <45 0x8>;
interrupt-parent = <&ipic>;
+ sleep = <&pmc 0x00000c00>;
+ };
+
+ gtm1: timer@500 {
+ compatible = "fsl,mpc8315-gtm", "fsl,gtm";
+ reg = <0x500 0x100>;
+ interrupts = <90 8 78 8 84 8 72 8>;
+ interrupt-parent = <&ipic>;
+ clock-frequency = <133333333>;
+ };
+
+ timer@600 {
+ compatible = "fsl,mpc8315-gtm", "fsl,gtm";
+ reg = <0x600 0x100>;
+ interrupts = <91 8 79 8 85 8 73 8>;
+ interrupt-parent = <&ipic>;
+ clock-frequency = <133333333>;
};
/* IPIC
@@ -337,42 +329,106 @@
0x59 0x8>;
interrupt-parent = < &ipic >;
};
+
+ pmc: power@b00 {
+ compatible = "fsl,mpc8315-pmc", "fsl,mpc8313-pmc",
+ "fsl,mpc8349-pmc";
+ reg = <0xb00 0x100 0xa00 0x100>;
+ interrupts = <80 8>;
+ interrupt-parent = <&ipic>;
+ fsl,mpc8313-wakeup-timer = <>m1>;
+ };
};
- pci0: pci@e0008500 {
- interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
- interrupt-map = <
- /* IDSEL 0x0E -mini PCI */
- 0x7000 0x0 0x0 0x1 &ipic 18 0x8
- 0x7000 0x0 0x0 0x2 &ipic 18 0x8
- 0x7000 0x0 0x0 0x3 &ipic 18 0x8
- 0x7000 0x0 0x0 0x4 &ipic 18 0x8
-
- /* IDSEL 0x0F -mini PCI */
- 0x7800 0x0 0x0 0x1 &ipic 17 0x8
- 0x7800 0x0 0x0 0x2 &ipic 17 0x8
- 0x7800 0x0 0x0 0x3 &ipic 17 0x8
- 0x7800 0x0 0x0 0x4 &ipic 17 0x8
-
- /* IDSEL 0x10 - PCI slot */
- 0x8000 0x0 0x0 0x1 &ipic 48 0x8
- 0x8000 0x0 0x0 0x2 &ipic 17 0x8
- 0x8000 0x0 0x0 0x3 &ipic 48 0x8
- 0x8000 0x0 0x0 0x4 &ipic 17 0x8>;
- interrupt-parent = <&ipic>;
- interrupts = <66 0x8>;
- bus-range = <0x0 0x0>;
- ranges = <0x02000000 0 0x90000000 0x90000000 0 0x10000000
- 0x42000000 0 0x80000000 0x80000000 0 0x10000000
- 0x01000000 0 0x00000000 0xe0300000 0 0x00100000>;
- clock-frequency = <66666666>;
- #interrupt-cells = <1>;
- #size-cells = <2>;
- #address-cells = <3>;
- reg = <0xe0008500 0x100 /* internal registers */
- 0xe0008300 0x8>; /* config space access registers */
- compatible = "fsl,mpc8349-pci";
- device_type = "pci";
+ sleep-nexus {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "simple-bus";
+ sleep = <&pmc 0x00010000>;
+ ranges;
+
+ pci0: pci@e0008500 {
+ interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
+ interrupt-map = <
+ /* IDSEL 0x0E -mini PCI */
+ 0x7000 0x0 0x0 0x1 &ipic 18 0x8
+ 0x7000 0x0 0x0 0x2 &ipic 18 0x8
+ 0x7000 0x0 0x0 0x3 &ipic 18 0x8
+ 0x7000 0x0 0x0 0x4 &ipic 18 0x8
+
+ /* IDSEL 0x0F -mini PCI */
+ 0x7800 0x0 0x0 0x1 &ipic 17 0x8
+ 0x7800 0x0 0x0 0x2 &ipic 17 0x8
+ 0x7800 0x0 0x0 0x3 &ipic 17 0x8
+ 0x7800 0x0 0x0 0x4 &ipic 17 0x8
+
+ /* IDSEL 0x10 - PCI slot */
+ 0x8000 0x0 0x0 0x1 &ipic 48 0x8
+ 0x8000 0x0 0x0 0x2 &ipic 17 0x8
+ 0x8000 0x0 0x0 0x3 &ipic 48 0x8
+ 0x8000 0x0 0x0 0x4 &ipic 17 0x8>;
+ interrupt-parent = <&ipic>;
+ interrupts = <66 0x8>;
+ bus-range = <0x0 0x0>;
+ ranges = <0x02000000 0 0x90000000 0x90000000 0 0x10000000
+ 0x42000000 0 0x80000000 0x80000000 0 0x10000000
+ 0x01000000 0 0x00000000 0xe0300000 0 0x00100000>;
+ clock-frequency = <66666666>;
+ #interrupt-cells = <1>;
+ #size-cells = <2>;
+ #address-cells = <3>;
+ reg = <0xe0008500 0x100 /* internal registers */
+ 0xe0008300 0x8>; /* config space access registers */
+ compatible = "fsl,mpc8349-pci";
+ device_type = "pci";
+ };
+
+ dma@e00082a8 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "fsl,mpc8315-dma", "fsl,elo-dma";
+ reg = <0xe00082a8 4>;
+ ranges = <0 0xe0008100 0x1a8>;
+ interrupt-parent = <&ipic>;
+ interrupts = <71 8>;
+ cell-index = <0>;
+
+ dma-channel@0 {
+ compatible = "fsl,mpc8315-dma-channel",
+ "fsl,elo-dma-channel";
+ reg = <0 0x80>;
+ cell-index = <0>;
+ interrupt-parent = <&ipic>;
+ interrupts = <71 8>;
+ };
+
+ dma-channel@80 {
+ compatible = "fsl,mpc8315-dma-channel",
+ "fsl,elo-dma-channel";
+ reg = <0x80 0x80>;
+ cell-index = <1>;
+ interrupt-parent = <&ipic>;
+ interrupts = <71 8>;
+ };
+
+ dma-channel@100 {
+ compatible = "fsl,mpc8315-dma-channel",
+ "fsl,elo-dma-channel";
+ reg = <0x100 0x80>;
+ cell-index = <2>;
+ interrupt-parent = <&ipic>;
+ interrupts = <71 8>;
+ };
+
+ dma-channel@180 {
+ compatible = "fsl,mpc8315-dma-channel",
+ "fsl,elo-dma-channel";
+ reg = <0x180 0x28>;
+ cell-index = <3>;
+ interrupt-parent = <&ipic>;
+ interrupts = <71 8>;
+ };
+ };
};
pci1: pcie@e0009000 {
@@ -390,6 +446,7 @@
0 0 0 2 &ipic 1 8
0 0 0 3 &ipic 1 8
0 0 0 4 &ipic 1 8>;
+ sleep = <&pmc 0x00300000>;
clock-frequency = <0>;
pcie@0 {
@@ -421,6 +478,7 @@
0 0 0 2 &ipic 2 8
0 0 0 3 &ipic 2 8
0 0 0 4 &ipic 2 8>;
+ sleep = <&pmc 0x000c0000>;
clock-frequency = <0>;
pcie@0 {
--
1.6.3.3
^ permalink raw reply related
* [PATCH 2/3] powerpc/83xx/suspend: Save and restore SICRL, SICRH and SCCR
From: Anton Vorontsov @ 2009-09-23 19:01 UTC (permalink / raw)
To: Kumar Gala; +Cc: Scott Wood, linuxppc-dev
In-Reply-To: <20090923190041.GA18944@oksana.dev.rtsoft.ru>
We need to save SICRL, SICRH and SCCR registers on suspend, and restore
them on resume. Otherwise, we lose IO and clocks setup on MPC8315E-RDB
boards when ULPI USB PHY is used (non-POR setup).
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
arch/powerpc/platforms/83xx/suspend.c | 48 +++++++++++++++++++++++++++++++++
1 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
index b0c2619..4380534 100644
--- a/arch/powerpc/platforms/83xx/suspend.c
+++ b/arch/powerpc/platforms/83xx/suspend.c
@@ -32,6 +32,7 @@
#define PMCCR1_NEXT_STATE 0x0C /* Next state for power management */
#define PMCCR1_NEXT_STATE_SHIFT 2
#define PMCCR1_CURR_STATE 0x03 /* Current state for power management*/
+#define IMMR_SYSCR_OFFSET 0x100
#define IMMR_RCW_OFFSET 0x900
#define RCW_PCI_HOST 0x80000000
@@ -78,6 +79,22 @@ struct mpc83xx_clock {
u32 sccr;
};
+struct mpc83xx_syscr {
+ __be32 sgprl;
+ __be32 sgprh;
+ __be32 spridr;
+ __be32 :32;
+ __be32 spcr;
+ __be32 sicrl;
+ __be32 sicrh;
+};
+
+struct mpc83xx_saved {
+ u32 sicrl;
+ u32 sicrh;
+ u32 sccr;
+};
+
struct pmc_type {
int has_deep_sleep;
};
@@ -87,6 +104,8 @@ static int has_deep_sleep, deep_sleeping;
static int pmc_irq;
static struct mpc83xx_pmc __iomem *pmc_regs;
static struct mpc83xx_clock __iomem *clock_regs;
+static struct mpc83xx_syscr __iomem *syscr_regs;
+static struct mpc83xx_saved saved_regs;
static int is_pci_agent, wake_from_pci;
static phys_addr_t immrbase;
static int pci_pm_state;
@@ -137,6 +156,20 @@ static irqreturn_t pmc_irq_handler(int irq, void *dev_id)
return ret;
}
+static void mpc83xx_suspend_restore_regs(void)
+{
+ out_be32(&syscr_regs->sicrl, saved_regs.sicrl);
+ out_be32(&syscr_regs->sicrh, saved_regs.sicrh);
+ out_be32(&clock_regs->sccr, saved_regs.sccr);
+}
+
+static void mpc83xx_suspend_save_regs(void)
+{
+ saved_regs.sicrl = in_be32(&syscr_regs->sicrl);
+ saved_regs.sicrh = in_be32(&syscr_regs->sicrh);
+ saved_regs.sccr = in_be32(&clock_regs->sccr);
+}
+
static int mpc83xx_suspend_enter(suspend_state_t state)
{
int ret = -EAGAIN;
@@ -166,6 +199,8 @@ static int mpc83xx_suspend_enter(suspend_state_t state)
*/
if (deep_sleeping) {
+ mpc83xx_suspend_save_regs();
+
out_be32(&pmc_regs->mask, PMCER_ALL);
out_be32(&pmc_regs->config1,
@@ -179,6 +214,8 @@ static int mpc83xx_suspend_enter(suspend_state_t state)
in_be32(&pmc_regs->config1) & ~PMCCR1_POWER_OFF);
out_be32(&pmc_regs->mask, PMCER_PMCI);
+
+ mpc83xx_suspend_restore_regs();
} else {
out_be32(&pmc_regs->mask, PMCER_PMCI);
@@ -333,12 +370,23 @@ static int pmc_probe(struct of_device *ofdev,
goto out_pmc;
}
+ if (has_deep_sleep) {
+ syscr_regs = ioremap(immrbase + IMMR_SYSCR_OFFSET,
+ sizeof(*syscr_regs));
+ if (!syscr_regs) {
+ ret = -ENOMEM;
+ goto out_syscr;
+ }
+ }
+
if (is_pci_agent)
mpc83xx_set_agent();
suspend_set_ops(&mpc83xx_suspend_ops);
return 0;
+out_syscr:
+ iounmap(clock_regs);
out_pmc:
iounmap(pmc_regs);
out:
--
1.6.3.3
^ permalink raw reply related
* [PATCH 1/3] powerpc/83xx/suspend: Clear deep_sleeping after devices resume
From: Anton Vorontsov @ 2009-09-23 19:01 UTC (permalink / raw)
To: Kumar Gala; +Cc: Scott Wood, linuxppc-dev
In-Reply-To: <20090923190041.GA18944@oksana.dev.rtsoft.ru>
Currently 83xx PMC driver clears deep_sleeping variable very early,
before devices are resumed. This makes fsl_deep_sleep() unusable in
drivers' resume() callback.
Sure, drivers can store fsl_deep_sleep() value on suspend and use
the stored value on resume. But a better solution is to postpone
clearing the deep_sleeping variable, i.e. move it into finish()
callback.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
arch/powerpc/platforms/83xx/suspend.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
index d306f07..b0c2619 100644
--- a/arch/powerpc/platforms/83xx/suspend.c
+++ b/arch/powerpc/platforms/83xx/suspend.c
@@ -194,7 +194,7 @@ out:
return ret;
}
-static void mpc83xx_suspend_finish(void)
+static void mpc83xx_suspend_end(void)
{
deep_sleeping = 0;
}
@@ -278,7 +278,7 @@ static struct platform_suspend_ops mpc83xx_suspend_ops = {
.valid = mpc83xx_suspend_valid,
.begin = mpc83xx_suspend_begin,
.enter = mpc83xx_suspend_enter,
- .finish = mpc83xx_suspend_finish,
+ .end = mpc83xx_suspend_end,
};
static int pmc_probe(struct of_device *ofdev,
--
1.6.3.3
^ permalink raw reply related
* [PATCH 0/3] powerpc/83xx: Sleep and deep sleep support for MPC8315E-RDB
From: Anton Vorontsov @ 2009-09-23 19:00 UTC (permalink / raw)
To: Kumar Gala; +Cc: Scott Wood, linuxppc-dev
Hi all,
Here are some patches to make suspend/resume work on MPC8315E-RDB...
Thanks,
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply
* [PATCH 3/3] USB: ehci-fsl: Add power management support (resume after deep sleep)
From: Anton Vorontsov @ 2009-09-23 18:52 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Jerry Huang, linux-usb, linuxppc-dev, Scott Wood
In-Reply-To: <20090923185158.GA29065@oksana.dev.rtsoft.ru>
EHCI FSL controller preserve its state during sleep mode, so nothing
fancy needs to be done.
Though, during 'deep sleep' mode (as found in MPC831x CPUs) the
controller turns off and needs to be reinitialized upon resume.
This patch adds support for resuming after deep sleep. Based on Dave
Liu and Jerry Huang's work.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
drivers/usb/host/ehci-fsl.c | 88 +++++++++++++++++++++++++++++++++++++++---
1 files changed, 81 insertions(+), 7 deletions(-)
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index 593a7e7..4454f1e 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -1,5 +1,6 @@
/*
- * Copyright (c) 2005 MontaVista Software
+ * Copyright 2005-2009 MontaVista Software, Inc.
+ * Copyright 2008 Freescale Semiconductor, 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
@@ -17,17 +18,18 @@
*
* Ported to 834x by Randy Vinson <rvinson@mvista.com> using code provided
* by Hunter Wu.
+ * Power Management support by Dave Liu <daveliu@freescale.com> and
+ * Jerry Huang <Chang-Ming.Huang@freescale.com>.
*/
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/fsl_devices.h>
#include "ehci-fsl.h"
-/* FIXME: Power Management is un-ported so temporarily disable it */
-#undef CONFIG_PM
-
-
/* configure so an HC device and id are always provided */
/* always called with process context; sleeping is OK */
@@ -285,10 +287,81 @@ static int ehci_fsl_setup(struct usb_hcd *hcd)
return retval;
}
+#ifdef CONFIG_SUSPEND
+struct ehci_fsl {
+ struct ehci_hcd ehci;
+
+ /* Saved USB PHY settings, need to restore after deep sleep. */
+ u32 usb_ctrl;
+};
+
+static struct ehci_fsl *hcd_to_ehci_fsl(struct usb_hcd *hcd)
+{
+ struct ehci_hcd *ehci = hcd_to_ehci(hcd);
+
+ return container_of(ehci, struct ehci_fsl, ehci);
+}
+
+static int ehci_fsl_drv_suspend(struct device *dev)
+{
+ struct usb_hcd *hcd = dev_get_drvdata(dev);
+ struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd);
+ void __iomem *non_ehci = hcd->regs;
+
+ if (!fsl_deep_sleep())
+ return 0;
+
+ ehci_fsl->usb_ctrl = in_be32(non_ehci + FSL_SOC_USB_CTRL);
+ return 0;
+}
+
+static int ehci_fsl_drv_resume(struct device *dev)
+{
+ struct usb_hcd *hcd = dev_get_drvdata(dev);
+ struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd);
+ struct ehci_hcd *ehci = hcd_to_ehci(hcd);
+ void __iomem *non_ehci = hcd->regs;
+ int port_nm;
+
+ if (!fsl_deep_sleep())
+ return 0;
+
+ /* Restore USB PHY settings and enable the controller. */
+ out_be32(non_ehci + FSL_SOC_USB_CTRL, ehci_fsl->usb_ctrl);
+
+ ehci_reset(ehci);
+ ehci_fsl_reinit(ehci);
+
+ /* Power up ports (avoids devices disconnect). */
+ port_nm = HCS_N_PORTS(ehci->hcs_params);
+ while (port_nm--) {
+ u32 port_sc;
+
+ port_sc = ehci_readl(ehci, &ehci->regs->port_status[port_nm]);
+ port_sc |= PORT_POWER;
+ ehci_writel(ehci, port_sc, &ehci->regs->port_status[port_nm]);
+ }
+ mdelay(30);
+
+ return 0;
+}
+
+static struct dev_pm_ops ehci_fsl_pm_ops = {
+ .suspend = ehci_fsl_drv_suspend,
+ .resume = ehci_fsl_drv_resume,
+};
+
+#define EHCI_FSL_PRIV_SIZE sizeof(struct ehci_fsl)
+#define EHCI_FSL_PM_OPS (&ehci_fsl_pm_ops)
+#else
+#define EHCI_FSL_PRIV_SIZE sizeof(struct ehci_hcd)
+#define EHCI_FSL_PM_OPS NULL
+#endif /* CONFIG_SUSPEND */
+
static const struct hc_driver ehci_fsl_hc_driver = {
.description = hcd_name,
.product_desc = "Freescale On-Chip EHCI Host Controller",
- .hcd_priv_size = sizeof(struct ehci_hcd),
+ .hcd_priv_size = EHCI_FSL_PRIV_SIZE,
/*
* generic hardware linkage
@@ -355,6 +428,7 @@ static struct platform_driver ehci_fsl_driver = {
.remove = ehci_fsl_drv_remove,
.shutdown = usb_hcd_platform_shutdown,
.driver = {
- .name = "fsl-ehci",
+ .name = "fsl-ehci",
+ .pm = EHCI_FSL_PM_OPS,
},
};
--
1.6.3.3
^ permalink raw reply related
* [PATCH 2/3] USB: ehci-fsl: Fix sparse warnings
From: Anton Vorontsov @ 2009-09-23 18:52 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Jerry Huang, linux-usb, linuxppc-dev, Scott Wood
In-Reply-To: <20090923185158.GA29065@oksana.dev.rtsoft.ru>
This patch fixes following warnings:
ehci-fsl.c:43:5: warning: symbol 'usb_hcd_fsl_probe' was not declared. Should it be static?
ehci-fsl.c:150:6: warning: symbol 'usb_hcd_fsl_remove' was not declared. Should it be static?
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
drivers/usb/host/ehci-fsl.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index 9911749..593a7e7 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -40,8 +40,8 @@
* Allocates basic resources for this USB host controller.
*
*/
-int usb_hcd_fsl_probe(const struct hc_driver *driver,
- struct platform_device *pdev)
+static int usb_hcd_fsl_probe(const struct hc_driver *driver,
+ struct platform_device *pdev)
{
struct fsl_usb2_platform_data *pdata;
struct usb_hcd *hcd;
@@ -147,7 +147,8 @@ int usb_hcd_fsl_probe(const struct hc_driver *driver,
* Reverses the effect of usb_hcd_fsl_probe().
*
*/
-void usb_hcd_fsl_remove(struct usb_hcd *hcd, struct platform_device *pdev)
+static void usb_hcd_fsl_remove(struct usb_hcd *hcd,
+ struct platform_device *pdev)
{
usb_remove_hcd(hcd);
iounmap(hcd->regs);
--
1.6.3.3
^ permalink raw reply related
* [PATCH 1/3] powerpc/fsl: Make fsl_deep_sleep() usable w/ modules and non-83xx builds
From: Anton Vorontsov @ 2009-09-23 18:52 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Jerry Huang, linux-usb, linuxppc-dev, Scott Wood
In-Reply-To: <20090923185158.GA29065@oksana.dev.rtsoft.ru>
Export is needed for modular builds, and a static inline stub is needed
for non-MPC83xx builds.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
arch/powerpc/platforms/83xx/suspend.c | 1 +
include/linux/fsl_devices.h | 4 ++++
2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
index 08e65fc..d306f07 100644
--- a/arch/powerpc/platforms/83xx/suspend.c
+++ b/arch/powerpc/platforms/83xx/suspend.c
@@ -96,6 +96,7 @@ int fsl_deep_sleep(void)
{
return deep_sleeping;
}
+EXPORT_SYMBOL(fsl_deep_sleep);
static int mpc83xx_change_state(void)
{
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 39fd946..47188d5 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -90,6 +90,10 @@ struct mpc8xx_pcmcia_ops {
* lead to a deep sleep (i.e. power removed from the core,
* instead of just the clock).
*/
+#if defined(CONFIG_PPC_83xx) && defined(CONFIG_SUSPEND)
int fsl_deep_sleep(void);
+#else
+static inline int fsl_deep_sleep(void) { return 0; }
+#endif
#endif /* _FSL_DEVICE_H_ */
--
1.6.3.3
^ permalink raw reply related
* [PATCH 0/3] USB: ehci-fsl: Resume from deep sleep
From: Anton Vorontsov @ 2009-09-23 18:51 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Jerry Huang, linux-usb, linuxppc-dev, Scott Wood
Hi all,
A few patches needed to support FSL EHCI resuming after deep sleep.
Without these patches MPC8315E-RDB boards hang on resume (USB PHY
settings aren't preserved after deep sleep so USB controller becomes
confused on resume, and hangs).
Thanks,
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply
* Re: RFC: delete UART current-speed from 4xx DTS?
From: Josh Boyer @ 2009-09-23 18:15 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Paul Gortmaker, linuxppc-dev
In-Reply-To: <20090916131943.GA14261@zod.rchland.ibm.com>
On Wed, Sep 16, 2009 at 09:19:43AM -0400, Josh Boyer wrote:
>On Wed, Sep 16, 2009 at 07:44:07AM +1000, Benjamin Herrenschmidt wrote:
>>On Tue, 2009-09-15 at 11:32 -0400, Josh Boyer wrote:
>Ok, so I think that is related to what I originally hit.
>
>I played around with removing the current-speed property on canyonlands today,
>and noticed that I would get no console output at all unless I specified a
>baudrate with console=ttyS0,115200. That was sort of contrary to what I found
>with bamboo, so I diffed the configs to see why. Bamboo has udbg enabled and
>hence has legacy_serial builtin, whereas canyonlands just has of_serial.
Correcting myself again, there really isn't any difference from a driver
perspective at a build level. Both Cayonlands and Bamboo have udbg selected.
The difference is that Bamboo has linux,stdout-path specified in the choosen
node and Caynonlands does not. Udbg looks for that, etc etc.
>Alternatively, we could try patching of_serial.c to do the baudrate probe
>as well.
I looked at this. It's rather ugly, because of_serial.c doesn't really do
anything from a hardware perspective. It simply binds to the device nodes
and lets the underlying serial driver do all the hardware handling. We'd
need to have it ioremap, probe, iounmap and that all seems rather silly.
Looking at the 8250 driver, there is a place we could autoprobe it. Something
like the ugly patch below. It would probably need to be wrapped in a CONFIG
option, but you get the idea.
Overall, I'm not sure having either is a requirement for removing the
current-speed properties from the DTS files. The only thing I could see
needing is telling of_serial.c to ignore a current-speed=0 property, as that
seems to be pretty invalid, but what some versions of U-Boot do.
josh
---
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 2209620..0cced56 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -2778,7 +2778,7 @@ serial8250_console_write(struct console *co, const char *s, unsigned int count)
static int __init serial8250_console_setup(struct console *co, char *options)
{
struct uart_port *port;
- int baud = 9600;
+ int baud = 0;
int bits = 8;
int parity = 'n';
int flow = 'n';
@@ -2797,6 +2797,26 @@ static int __init serial8250_console_setup(struct console *co, char *options)
if (options)
uart_parse_options(options, &baud, &parity, &bits, &flow);
+ if (baud == 0) {
+ unsigned char old_lcr, div, pre;
+ struct uart_8250_port *up = (struct uart_8250_port *) port;
+
+ old_lcr = serial_inp(up, UART_LCR);
+ serial_outp(up, UART_LCR, UART_LCR_DLAB);
+ div = serial_dl_read(up);
+ if (serial_inp(up, UART_MCR) & 0x80)
+ pre = 4;
+ else
+ pre = 1;
+
+ serial_outp(up, UART_LCR, old_lcr);
+
+ baud = (port->uartclk / pre) / (div * 16);
+
+ if (baud > (port->uartclk / 16))
+ baud = 9600;
+ }
+
return uart_set_options(port, co, baud, parity, bits, flow);
}
^ permalink raw reply related
* Re: [PATCH] powerpc: Cleanup linker script using new linker script macros.
From: Sam Ravnborg @ 2009-09-23 17:40 UTC (permalink / raw)
To: Tim Abbott; +Cc: linuxppc-dev, Paul Mackerras, linux-kernel
In-Reply-To: <1253632689-24173-2-git-send-email-tabbott@ksplice.com>
On Tue, Sep 22, 2009 at 11:18:09AM -0400, Tim Abbott wrote:
> Signed-off-by: Tim Abbott <tabbott@ksplice.com>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: linuxppc-dev@ozlabs.org
> Cc: Sam Ravnborg <sam@ravnborg.org>
Look good.
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Sam
^ permalink raw reply
* Re: GPIO driver for MPC8313.
From: Johnny Hung @ 2009-09-23 15:20 UTC (permalink / raw)
To: Peter Korsgaard; +Cc: linuxppc-dev, linux-embedded
In-Reply-To: <87r5txrkfz.fsf@macbook.be.48ers.dk>
Many thanks for your help. I will try it.
2009/9/23 Peter Korsgaard <jacmet@sunsite.dk>:
>>>>>> "Johnny" =3D=3D Johnny Hung <johnny.hacking@gmail.com> writes:
>
> =A0Johnny> Thanks, got it. BTW, how to trigger GPIO level in user space
> =A0Johnny> application? I also found
> =A0Johnny> arch/powerpc/platforms/52xx/mpc52xx_gpio.c is a good
> =A0Johnny> example. Any reply is appreciate.
>
> Through sysfs. See 'Sysfs Interface for Userspace' section of
> Documentation/gpio.txt
>
> --
> Bye, Peter Korsgaard
>
^ permalink raw reply
* linux booting fails on ppc440x5 with SRAM
From: Vineeth _ @ 2009-09-23 14:49 UTC (permalink / raw)
To: linuxppc-dev
I am trying to port linux on IBM powerpc-440x5. I have this board
which has this processor, a 16MB SRAM sits on location 0x0, uart and a
flash.I have a simple bootloader which does the following.
1. Initialize the processor (as part of it, we Generates the tlbs
for UART,16MB flash,16MB SRAM)
2. Initialize the UART
3. Copy the simple-boot linux_image (binary file) from flash to
0x400000 location of SRAM.
4. Kernel entry to 0x400000
I also have a device tree structure file (image.dts) which i am
passing while generating the linux image.
It all went through and linux got extracted to the 0x0th location of
SRAM. and started executing.
(plz find the log below)
it always crashed @ "Unable to handle kernel paging request for data
at address 0x0xxxxxxx"
is there anything i have to change in the boot loader or kernel with
respect to the MMU initialization ?
in the kernel code @ /arch/powerpc/kernel/head_44x.s; there is a
comment saying "its trying to invalidate all the TLB entries except
the one it currently working on". Will it make any issues as in our
case we have only one TLB for the entire 16MB sram, which will be the
current working one..
Can someone suggest us some clue or details on this.
Thanks & Regards,
Vineeth
LINUX BOOT LOG
----------------------------------------------------------------------------------------
Initialized the System
Initialized the UART
Copying Linux Image to RAM > !!!!!!!!!!!!!!!!!!!!!!!!!!!
Copying Image Done
-KERNEL ENTRY-
-
zImage starting: loaded at 0x00400000 (sp: 0x004deeb0)
Allocating 0x1dad84 bytes for kernel ...
gunzipping (0x00000000 <- 0x0040c000:0x004dd3f1)...done 0x1c31cc bytes
Linux/PowerPC load: console=ttyS0 root=/dev/ram
Finalizing device tree... flat tree at 0x4eb300
id mach(): done
inside skybeam_register_console function
MMU:enterMMU:hw initMMU:mapinMMU:setioMMU:exitinside
_setup_arch-begininginside _setup_arch-1inside
_setup_arch-2setup_arch: bootmemarch: exit<7>Top of RAM: 0x1000000,
Total RAM: 0x1000000
Zone PFN ranges:
DMA 0x00000000 -> 0x00001000
Normal 0x00001000 -> 0x00001000
Movable zone start PFN for each node
early_node_map[1] active PFN ranges
0: 0x00000000 -> 0x00001000
MMU: Allocated 1088 bytes of context maps for 255 contexts
Built 1 zonelists in Zone order, mobility grouping off. Total pages: 4064
Kernel command line: console=ttyS0 root=/dev/ram
Unable to handle kernel paging request for data at address 0x00021000
Faulting instruction address: 0xc010a7c4
Oops: Kernel access of bad area, sig: 11 [#1]
PREEMPT PowerPC 44x Platform
Modules linked in:
NIP: c010a7c4 LR: c010dc50 CTR: 00000000
REGS: c01bfeb0 TRAP: 0300 Not tainted (2.6.30)
MSR: 00021000 <ME,CE> CR: 24000044 XER: 00000000
DEAR: 00021000, ESR: 00000000
TASK = c01a94b8[0] 'swapper' THREAD: c01be000
GPR00: 00001180 c01bff60 c01a94b8 00021000 00000025 00000008 c0104968 00000000
GPR08: 2f72616d c0110000 c0155938 c01a0000 22000024 00000000 fffff104 00000000
GPR16: 00000000 00000000 00000000 00000000 fffffff8 000008b8 c010d758 c0104968
GPR24: 00001198 00001190 c018a001 c01c5498 000008c0 00001188 00021000 c01c42f0
NIP [c010a7c4] strchr+0x0/0x3c
LR [c010dc50] match_token+0x138/0x228
Call Trace:
[c01bff60] [c016b99c] 0xc016b99c (unreliable)
[c01bffa0] [c0104a00] sort_extable+0x28/0x38
[c01bffb0] [c01938ec] sort_main_extable+0x20/0x30
[c01bffc0] [c018c734] start_kernel+0x140/0x288
[c01bfff0] [c0000200] skpinv+0x190/0x1cc
Instruction dump:
7ca903a6 88040000 38a5ffff 38840001 2f800000 98090000 39290001 419e0010
4200ffe4 98a90000 4e800020 4e800020 <88030000> 5484063e 7f802000 4d9e0020
---[ end trace 31fd0ba7d8756001 ]---
Kernel panic - not syncing: Attempted to kill the idle task!
Call Trace:
[c01bfd90] [c0005d5c] show_stack+0x4c/0x16c (unreliable)
[c01bfdd0] [c002f17c] panic+0xa0/0x168
[c01bfe20] [c0032eb8] do_exit+0x61c/0x638
[c01bfe60] [c000b60c] kernel_bad_stack+0x0/0x4c
[c01bfe90] [c000f310] bad_page_fault+0x90/0xd8
[c01bfea0] [c000e184] handle_page_fault+0x7c/0x80
[c01bff60] [c016b99c] 0xc016b99c
[c01bffa0] [c0104a00] sort_extable+0x28/0x38
[c01bffb0] [c01938ec] sort_main_extable+0x20/0x30
[c01bffc0] [c018c734] start_kernel+0x140/0x288
[c01bfff0] [c0000200] skpinv+0x190/0x1cc
Rebooting in 180 seconds..
^ permalink raw reply
* Re: 2.6.31-git5 kernel boot hangs on powerpc
From: Tejun Heo @ 2009-09-23 14:17 UTC (permalink / raw)
To: Sachin Sant; +Cc: Linux/PPC Development, David Miller
In-Reply-To: <4AB9DD8F.1040305@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 605 bytes --]
Tejun Heo wrote:
>> One workaround i have found for this problem is to disable IPv6.
>> With IPv6 disabled the machine boots OK. Till a reliable solution
>> is available for this issue, i will keep IPv6 disabled in my configs.
>
> I'm think it's most likely caused by some code accessing invalid
> percpu address. I'm currently writing up access validator. Should be
> done in several hours. So, ipv6 it is. I couldn't reproduce your
> problem here. I'll give ipv6 a shot.
Can you please apply the attached patch and see whether anything
interesting shows up in the kernel log?
Thanks.
--
tejun
[-- Attachment #2: pcpu-verify --]
[-- Type: text/plain, Size: 13367 bytes --]
---
arch/ia64/include/asm/sn/arch.h | 4 -
arch/powerpc/mm/stab.c | 4 -
arch/x86/kernel/cpu/cpu_debug.c | 12 ++--
arch/x86/kernel/cpu/perf_event.c | 4 -
include/asm-generic/percpu.h | 23 +++++---
include/linux/percpu-defs.h | 6 ++
include/linux/percpu.h | 7 ++
kernel/softirq.c | 8 +-
lib/Kconfig.debug | 17 +++++
mm/percpu.c | 112 +++++++++++++++++++++++++++++++++++++++
10 files changed, 173 insertions(+), 24 deletions(-)
Index: work/arch/ia64/include/asm/sn/arch.h
===================================================================
--- work.orig/arch/ia64/include/asm/sn/arch.h
+++ work/arch/ia64/include/asm/sn/arch.h
@@ -71,8 +71,8 @@ DECLARE_PER_CPU(struct sn_hub_info_s, __
* Compact node ID to nasid mappings kept in the per-cpu data areas of each
* cpu.
*/
-DECLARE_PER_CPU(short, __sn_cnodeid_to_nasid[MAX_COMPACT_NODES]);
-#define sn_cnodeid_to_nasid (&__get_cpu_var(__sn_cnodeid_to_nasid[0]))
+DECLARE_PER_CPU(short [MAX_COMPACT_NODES], __sn_cnodeid_to_nasid);
+#define sn_cnodeid_to_nasid (&__get_cpu_var(__sn_cnodeid_to_nasid)[0])
extern u8 sn_partition_id;
Index: work/arch/powerpc/mm/stab.c
===================================================================
--- work.orig/arch/powerpc/mm/stab.c
+++ work/arch/powerpc/mm/stab.c
@@ -138,7 +138,7 @@ static int __ste_allocate(unsigned long
if (!is_kernel_addr(ea)) {
offset = __get_cpu_var(stab_cache_ptr);
if (offset < NR_STAB_CACHE_ENTRIES)
- __get_cpu_var(stab_cache[offset++]) = stab_entry;
+ __get_cpu_var(stab_cache)[offset++] = stab_entry;
else
offset = NR_STAB_CACHE_ENTRIES+1;
__get_cpu_var(stab_cache_ptr) = offset;
@@ -185,7 +185,7 @@ void switch_stab(struct task_struct *tsk
int i;
for (i = 0; i < offset; i++) {
- ste = stab + __get_cpu_var(stab_cache[i]);
+ ste = stab + __get_cpu_var(stab_cache)[i];
ste->esid_data = 0; /* invalidate entry */
}
} else {
Index: work/arch/x86/kernel/cpu/cpu_debug.c
===================================================================
--- work.orig/arch/x86/kernel/cpu/cpu_debug.c
+++ work/arch/x86/kernel/cpu/cpu_debug.c
@@ -531,7 +531,7 @@ static int cpu_create_file(unsigned cpu,
/* Already intialized */
if (file == CPU_INDEX_BIT)
- if (per_cpu(cpu_arr[type].init, cpu))
+ if (per_cpu(cpu_arr, cpu)[type].init)
return 0;
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
@@ -543,7 +543,7 @@ static int cpu_create_file(unsigned cpu,
priv->reg = reg;
priv->file = file;
mutex_lock(&cpu_debug_lock);
- per_cpu(priv_arr[type], cpu) = priv;
+ per_cpu(priv_arr, cpu)[type] = priv;
per_cpu(cpu_priv_count, cpu)++;
mutex_unlock(&cpu_debug_lock);
@@ -552,10 +552,10 @@ static int cpu_create_file(unsigned cpu,
dentry, (void *)priv, &cpu_fops);
else {
debugfs_create_file(cpu_base[type].name, S_IRUGO,
- per_cpu(cpu_arr[type].dentry, cpu),
+ per_cpu(cpu_arr, cpu)[type].dentry,
(void *)priv, &cpu_fops);
mutex_lock(&cpu_debug_lock);
- per_cpu(cpu_arr[type].init, cpu) = 1;
+ per_cpu(cpu_arr, cpu)[type].init = 1;
mutex_unlock(&cpu_debug_lock);
}
@@ -615,7 +615,7 @@ static int cpu_init_allreg(unsigned cpu,
if (!is_typeflag_valid(cpu, cpu_base[type].flag))
continue;
cpu_dentry = debugfs_create_dir(cpu_base[type].name, dentry);
- per_cpu(cpu_arr[type].dentry, cpu) = cpu_dentry;
+ per_cpu(cpu_arr, cpu)[type].dentry = cpu_dentry;
if (type < CPU_TSS_BIT)
err = cpu_init_msr(cpu, type, cpu_dentry);
@@ -677,7 +677,7 @@ static void __exit cpu_debug_exit(void)
for (cpu = 0; cpu < nr_cpu_ids; cpu++)
for (i = 0; i < per_cpu(cpu_priv_count, cpu); i++)
- kfree(per_cpu(priv_arr[i], cpu));
+ kfree(per_cpu(priv_arr, cpu)[i]);
}
module_init(cpu_debug_init);
Index: work/arch/x86/kernel/cpu/perf_event.c
===================================================================
--- work.orig/arch/x86/kernel/cpu/perf_event.c
+++ work/arch/x86/kernel/cpu/perf_event.c
@@ -1253,7 +1253,7 @@ x86_perf_event_set_period(struct perf_ev
if (left > x86_pmu.max_period)
left = x86_pmu.max_period;
- per_cpu(pmc_prev_left[idx], smp_processor_id()) = left;
+ per_cpu(pmc_prev_left, smp_processor_id())[idx] = left;
/*
* The hw event starts counting from this event offset,
@@ -1470,7 +1470,7 @@ void perf_event_print_debug(void)
rdmsrl(x86_pmu.eventsel + idx, pmc_ctrl);
rdmsrl(x86_pmu.perfctr + idx, pmc_count);
- prev_left = per_cpu(pmc_prev_left[idx], cpu);
+ prev_left = per_cpu(pmc_prev_left, cpu)[idx];
pr_info("CPU#%d: gen-PMC%d ctrl: %016llx\n",
cpu, idx, pmc_ctrl);
Index: work/include/asm-generic/percpu.h
===================================================================
--- work.orig/include/asm-generic/percpu.h
+++ work/include/asm-generic/percpu.h
@@ -49,13 +49,22 @@ extern unsigned long __per_cpu_offset[NR
* established ways to produce a usable pointer from the percpu variable
* offset.
*/
-#define per_cpu(var, cpu) \
- (*SHIFT_PERCPU_PTR(&per_cpu_var(var), per_cpu_offset(cpu)))
-#define __get_cpu_var(var) \
- (*SHIFT_PERCPU_PTR(&per_cpu_var(var), my_cpu_offset))
-#define __raw_get_cpu_var(var) \
- (*SHIFT_PERCPU_PTR(&per_cpu_var(var), __my_cpu_offset))
-
+#define per_cpu(var, cpu) (*({ \
+ typeof(&per_cpu_var(var)) __pcpu_ptr__ = &per_cpu_var(var); \
+ unsigned int __pcpu_cpu__ = (cpu); \
+ pcpu_verify_access(__pcpu_ptr__, __pcpu_cpu__); \
+ SHIFT_PERCPU_PTR(__pcpu_ptr__, per_cpu_offset(__pcpu_cpu__)); \
+}))
+#define __get_cpu_var(var) (*({ \
+ typeof(&per_cpu_var(var)) __pcpu_ptr__ = &per_cpu_var(var); \
+ pcpu_verify_access(__pcpu_ptr__, NR_CPUS); \
+ SHIFT_PERCPU_PTR(__pcpu_ptr__, my_cpu_offset); \
+}))
+#define __raw_get_cpu_var(var) (*({ \
+ typeof(&per_cpu_var(var)) __pcpu_ptr__ = &per_cpu_var(var); \
+ pcpu_verify_access(__pcpu_ptr__, NR_CPUS); \
+ SHIFT_PERCPU_PTR(__pcpu_ptr__, __my_cpu_offset); \
+}))
#ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA
extern void setup_per_cpu_areas(void);
Index: work/include/linux/percpu-defs.h
===================================================================
--- work.orig/include/linux/percpu-defs.h
+++ work/include/linux/percpu-defs.h
@@ -7,6 +7,12 @@
*/
#define per_cpu_var(var) per_cpu__##var
+#ifdef CONFIG_DEBUG_VERIFY_PER_CPU
+extern void pcpu_verify_access(void *ptr, unsigned int cpu);
+#else
+#define pcpu_verify_access(ptr, cpu) do {} while (0)
+#endif
+
/*
* Base implementations of per-CPU variable declarations and definitions, where
* the section in which the variable is to be placed is provided by the
Index: work/include/linux/percpu.h
===================================================================
--- work.orig/include/linux/percpu.h
+++ work/include/linux/percpu.h
@@ -127,7 +127,12 @@ extern int __init pcpu_page_first_chunk(
* dynamically allocated. Non-atomic access to the current CPU's
* version should probably be combined with get_cpu()/put_cpu().
*/
-#define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu)))
+#define per_cpu_ptr(ptr, cpu) ({ \
+ typeof(ptr) __pcpu_ptr__ = (ptr); \
+ unsigned int __pcpu_cpu__ = (cpu); \
+ pcpu_verify_access(__pcpu_ptr__, __pcpu_cpu__); \
+ SHIFT_PERCPU_PTR(__pcpu_ptr__, per_cpu_offset((__pcpu_cpu__))); \
+})
extern void *__alloc_reserved_percpu(size_t size, size_t align);
Index: work/kernel/softirq.c
===================================================================
--- work.orig/kernel/softirq.c
+++ work/kernel/softirq.c
@@ -560,7 +560,7 @@ EXPORT_PER_CPU_SYMBOL(softirq_work_list)
static void __local_trigger(struct call_single_data *cp, int softirq)
{
- struct list_head *head = &__get_cpu_var(softirq_work_list[softirq]);
+ struct list_head *head = &__get_cpu_var(softirq_work_list)[softirq];
list_add_tail(&cp->list, head);
@@ -656,13 +656,13 @@ static int __cpuinit remote_softirq_cpu_
local_irq_disable();
for (i = 0; i < NR_SOFTIRQS; i++) {
- struct list_head *head = &per_cpu(softirq_work_list[i], cpu);
+ struct list_head *head = &per_cpu(softirq_work_list, cpu)[i];
struct list_head *local_head;
if (list_empty(head))
continue;
- local_head = &__get_cpu_var(softirq_work_list[i]);
+ local_head = &__get_cpu_var(softirq_work_list)[i];
list_splice_init(head, local_head);
raise_softirq_irqoff(i);
}
@@ -688,7 +688,7 @@ void __init softirq_init(void)
per_cpu(tasklet_hi_vec, cpu).tail =
&per_cpu(tasklet_hi_vec, cpu).head;
for (i = 0; i < NR_SOFTIRQS; i++)
- INIT_LIST_HEAD(&per_cpu(softirq_work_list[i], cpu));
+ INIT_LIST_HEAD(&per_cpu(softirq_work_list, cpu)[i]);
}
register_hotcpu_notifier(&remote_softirq_cpu_notifier);
Index: work/lib/Kconfig.debug
===================================================================
--- work.orig/lib/Kconfig.debug
+++ work/lib/Kconfig.debug
@@ -805,6 +805,21 @@ config DEBUG_BLOCK_EXT_DEVT
Say N if you are unsure.
+config DEBUG_VERIFY_PER_CPU
+ bool "Verify per-cpu accesses"
+ depends on DEBUG_KERNEL
+ depends on SMP
+ help
+
+ This option makes percpu access macros to verify the
+ specified processor and percpu variable offset on each
+ access. This helps catching percpu variable access bugs
+ which may cause corruption on unrelated memory region making
+ it very difficult to catch at the cost of making percpu
+ accesses considerably slow.
+
+ Say N if you are unsure.
+
config DEBUG_FORCE_WEAK_PER_CPU
bool "Force weak per-cpu definitions"
depends on DEBUG_KERNEL
@@ -820,6 +835,8 @@ config DEBUG_FORCE_WEAK_PER_CPU
To ensure that generic code follows the above rules, this
option forces all percpu variables to be defined as weak.
+ Say N if you are unsure.
+
config LKDTM
tristate "Linux Kernel Dump Test Tool Module"
depends on DEBUG_KERNEL
Index: work/mm/percpu.c
===================================================================
--- work.orig/mm/percpu.c
+++ work/mm/percpu.c
@@ -1241,6 +1241,118 @@ void free_percpu(void *ptr)
}
EXPORT_SYMBOL_GPL(free_percpu);
+#ifdef CONFIG_DEBUG_VERIFY_PER_CPU
+static struct pcpu_chunk *pcpu_verify_match_chunk(void *addr)
+{
+ void *first_start = pcpu_first_chunk->base_addr;
+ struct pcpu_chunk *chunk;
+ int slot;
+
+ /* is it in the first chunk? */
+ if (addr >= first_start && addr < first_start + pcpu_unit_size) {
+ /* is it in the reserved area? */
+ if (addr < first_start + pcpu_reserved_chunk_limit)
+ return pcpu_reserved_chunk;
+ return pcpu_first_chunk;
+ }
+
+ /* walk each dynamic chunk */
+ for (slot = 0; slot < pcpu_nr_slots; slot++)
+ list_for_each_entry(chunk, &pcpu_slot[slot], list)
+ if (addr >= chunk->base_addr &&
+ addr < chunk->base_addr + pcpu_unit_size)
+ return chunk;
+ return NULL;
+}
+
+void pcpu_verify_access(void *ptr, unsigned int cpu)
+{
+ static bool verifying[NR_CPUS];
+ static int warn_limit = 10;
+ char cbuf[80], obuf[160];
+ void *addr = __pcpu_ptr_to_addr(ptr);
+ bool is_static = false;
+ struct pcpu_chunk *chunk;
+ unsigned long flags;
+ int i, addr_off, off, len, end;
+
+ /* not been initialized yet or whined enough already */
+ if (unlikely(!pcpu_first_chunk || !warn_limit))
+ return;
+
+ /* don't re-enter */
+ preempt_disable();
+ if (verifying[raw_smp_processor_id()]) {
+ preempt_enable_no_resched();
+ return;
+ }
+ verifying[raw_smp_processor_id()] = true;
+
+ cbuf[0] = '\0';
+ obuf[0] = '\0';
+
+ if (unlikely(cpu < NR_CPUS && !cpu_possible(cpu)) && warn_limit)
+ snprintf(cbuf, sizeof(cbuf), "invalid cpu %u", cpu);
+
+ /*
+ * We can enter this function from weird places and have no
+ * way to reliably avoid deadlock. If lock is available, grab
+ * it and verify. If not, just let it go through.
+ */
+ if (!spin_trylock_irqsave(&pcpu_lock, flags))
+ goto out;
+
+ chunk = pcpu_verify_match_chunk(addr);
+ if (!chunk) {
+ snprintf(obuf, sizeof(obuf),
+ "no matching chunk ptr=%p addr=%p", ptr, addr);
+ goto out_unlock;
+ }
+
+ addr_off = addr - chunk->base_addr;
+ if (chunk->base_addr == pcpu_first_chunk->base_addr)
+ if (chunk == pcpu_reserved_chunk || addr_off < -chunk->map[0])
+ is_static = true;
+
+ for (i = 0, off = 0; i < chunk->map_used; i++, off = end) {
+ len = chunk->map[i];
+ end = off + abs(len);
+
+ if (addr_off == off) {
+ if (unlikely(len > 0))
+ snprintf(obuf, sizeof(obuf),
+ "free area accessed ptr=%p addr=%p "
+ "off=%d len=%d", ptr, addr, off, len);
+ break;
+ }
+ if (!is_static && off < addr_off && addr_off < end) {
+ snprintf(obuf, sizeof(obuf),
+ "%sarea accessed in the middle ptr=%p "
+ "addr=%p:%d off=%d len=%d",
+ len > 0 ? "free " : "",
+ ptr, addr, addr_off, off, abs(len));
+ break;
+ }
+ }
+
+out_unlock:
+ spin_unlock_irqrestore(&pcpu_lock, flags);
+out:
+ if (unlikely(cbuf[0] || obuf[0])) {
+ printk(KERN_ERR "PERCPU: %s%s%s\n",
+ cbuf, cbuf[0] ? ", " : "", obuf);
+ dump_stack();
+ if (!--warn_limit)
+ printk(KERN_WARNING "PERCPU: access warning limit "
+ "reached, turning off access validation\n");
+ }
+
+ verifying[raw_smp_processor_id()] = false;
+ preempt_enable_no_resched();
+}
+EXPORT_SYMBOL_GPL(pcpu_verify_access);
+#endif /* CONFIG_DEBUG_VERIFY_PER_CPU */
+
static inline size_t pcpu_calc_fc_sizes(size_t static_size,
size_t reserved_size,
ssize_t *dyn_sizep)
^ permalink raw reply
* [PATCH 2/2] powerpc/44x: Fix xmon single step on PowerPC 44x
From: Josh Boyer @ 2009-09-23 13:51 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <20090923134844.GF14261@zod.rchland.ibm.com>
Prior to the arch/ppc -> arch/powerpc transition, xmon had support for single
stepping on 4xx boards. The functionality was lost when arch/ppc was removed.
This patch restores single step support for 44x boards.
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
---
arch/powerpc/xmon/xmon.c | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index c6f0a71..fe2ad71 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -517,6 +517,15 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
in_xmon = 0;
#endif
+#ifdef CONFIG_4xx
+ if ((regs->msr & (MSR_DE)) == (MSR_DE)) {
+ bp = at_breakpoint(regs->nip);
+ if (bp != NULL) {
+ regs->nip = (unsigned long) &bp->instr[0];
+ atomic_inc(&bp->ref_count);
+ }
+ }
+#else
if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) == (MSR_IR|MSR_SF)) {
bp = at_breakpoint(regs->nip);
if (bp != NULL) {
@@ -530,7 +539,7 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
}
}
}
-
+#endif
insert_cpu_bpts();
local_irq_restore(flags);
@@ -894,6 +903,14 @@ cmds(struct pt_regs *excp)
}
}
+#ifdef CONFIG_44x
+static int do_step(struct pt_regs *regs)
+{
+ regs->msr |= MSR_DE;
+ mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR0_IC | DBCR0_IDM);
+ return 1;
+}
+#else
/*
* Step a single instruction.
* Some instructions we emulate, others we execute with MSR_SE set.
@@ -924,6 +941,7 @@ static int do_step(struct pt_regs *regs)
regs->msr |= MSR_SE;
return 1;
}
+#endif
static void bootcmds(void)
{
--
1.5.5.6
^ permalink raw reply related
* [PATCH 1/2] powerpc/4xx: Fix erroneous xmon warning on PowerPC 4xx
From: Josh Boyer @ 2009-09-23 13:51 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <20090923134844.GF14261@zod.rchland.ibm.com>
The xmon code relies on MSR_RI being non-zero to indicate that an exception
is recoverable. If it is not, it prints a warning message. However, the
PowerPC 4xx cores do not have an MSR_RI bit and this warning is produced for
every xmon event.
This introduces an unrecoverable_excp function to determine if an exception
is recoverable or not. This gets rid of the erroneous warnings on 4xx.
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
---
arch/powerpc/xmon/xmon.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 0e09a45..c6f0a71 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -335,6 +335,16 @@ int cpus_are_in_xmon(void)
}
#endif
+static inline int unrecoverable_excp(struct pt_regs *regs)
+{
+#ifdef CONFIG_4xx
+ /* We have no MSR_RI bit on 4xx, so we simply return false */
+ return 0;
+#else
+ return ((regs->msr & MSR_RI) == 0);
+#endif
+}
+
static int xmon_core(struct pt_regs *regs, int fromipi)
{
int cmd = 0;
@@ -388,7 +398,7 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
bp = NULL;
if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) == (MSR_IR|MSR_SF))
bp = at_breakpoint(regs->nip);
- if (bp || (regs->msr & MSR_RI) == 0)
+ if (bp || unrecoverable_excp(regs))
fromipi = 0;
if (!fromipi) {
@@ -399,7 +409,7 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
cpu, BP_NUM(bp));
xmon_print_symbol(regs->nip, " ", ")\n");
}
- if ((regs->msr & MSR_RI) == 0)
+ if (unrecoverable_excp(regs))
printf("WARNING: exception is not recoverable, "
"can't continue\n");
release_output_lock();
@@ -490,7 +500,7 @@ static int xmon_core(struct pt_regs *regs, int fromipi)
printf("Stopped at breakpoint %x (", BP_NUM(bp));
xmon_print_symbol(regs->nip, " ", ")\n");
}
- if ((regs->msr & MSR_RI) == 0)
+ if (unrecoverable_excp(regs))
printf("WARNING: exception is not recoverable, "
"can't continue\n");
remove_bpts();
--
1.5.5.6
^ permalink raw reply related
* [PATCH 0/2] 4xx xmon fixes
From: Josh Boyer @ 2009-09-23 13:48 UTC (permalink / raw)
To: linuxppc-dev
Hi All,
A couple of simple fixes to improve xmon usage on 4xx boards. I have no idea
if anyone else even uses this, but I find it handy from time to time.
josh
^ permalink raw reply
* Re: powerpc: Move 64bit heap above 1TB on machines with 1TB segments
From: Mel Gorman @ 2009-09-23 12:50 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, Anton Blanchard
In-Reply-To: <1253653702.7103.244.camel@pasglop>
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote on 22/09/2009
22:08:22:
> > Unfortunately, I am not sensitive to issues surrounding 1TB segments or
how
> > they are currently being used. However, as this clearly helps
performance
> > for large amounts of memory, is it worth providing an option to
> > libhugetlbfs to locate 16MB pages above 1TB when they are otherwise
being
> > unused?
>
> AFAIK, that is already the case, at least the kernel will hand out pages
> above 1T preferentially iirc.
>
> There were talks about making huge pages below 1T not even come up
> untily you ask for them with MAP_FIXED, dunno where that went.
>
Confirmed, huge pages are already being placed above the 1TB mark. I hadn't
given thought previously to where hugepages were being placed except within
segment boundaries. The patch works as advertised and doesn't appear to
collide with huge pages in any obvious way as far as I can tell.
^ permalink raw reply
* Re: [PATCH] perf_event, powerpc: Fix compilation after big perf_counter rename
From: Ingo Molnar @ 2009-09-23 12:44 UTC (permalink / raw)
To: Michael Ellerman
Cc: Peter Zijlstra, linux-kernel, linuxppc-dev, Paul Mackerras,
Linus Torvalds, David S. Miller
In-Reply-To: <1253620332.10476.4.camel@concordia>
* Michael Ellerman <michael@ellerman.id.au> wrote:
> On Tue, 2009-09-22 at 18:00 +1000, Benjamin Herrenschmidt wrote:
> > On Tue, 2009-09-22 at 09:28 +0200, Ingo Molnar wrote:
> > >
> > > Nevertheless you are right that i should have caught this particular
> > > PowerPC build bug - i missed it - sorry about that!
> > >
> > Allright. Well, to help in general, we are setting up a build-bot
> > here too that will build -tip HEAD for at least powerpc daily with
> > a few configs too.
>
> Results here:
>
> http://kisskb.ellerman.id.au/kisskb/branch/12/
ok, seems green for today - the two failures are: one a powerpc
toolchain problem it appears, plus a mainline warning.
Btw., for me to be able to notice failures there it would have to email
me automatically if there's any -tip build failures that do not occur
with the upstream branch. Does it have such a feature?
Ingo
^ permalink raw reply
* Re: [PATCH 6/6] P2020DS: Remove sdhci-dma-broken and sdhci-ahb2mag-irq-bypass properties
From: Anton Vorontsov @ 2009-09-23 11:59 UTC (permalink / raw)
To: Gao Guanhua; +Cc: linuxppc-dev, sdhci-devel
In-Reply-To: <1253696892-15262-6-git-send-email-B22826@freescale.com>
On Wed, Sep 23, 2009 at 05:08:12PM +0800, Gao Guanhua wrote:
> The SDHC on P2020DS board use DMA mode by default.
> This patch remove the properties used in PIO mode.
You just added the properties in 3/6 and 4/6, and now you instantly
remove them?
> ---
> arch/powerpc/boot/dts/p2020ds.dts | 2 --
> 1 files changed, 0 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/boot/dts/p2020ds.dts b/arch/powerpc/boot/dts/p2020ds.dts
> index 29989fb..3263397 100644
> --- a/arch/powerpc/boot/dts/p2020ds.dts
> +++ b/arch/powerpc/boot/dts/p2020ds.dts
> @@ -459,8 +459,6 @@
> reg = <0x2e000 0x1000>;
> interrupts = <72 0x2>;
> interrupt-parent = <&mpic>;
> - fsl,sdhci-dma-broken;
> - fsl,sdhci-ahb2mag-irq-bypass;
> fsl,sdhci-adjust-timeout;
> clock-frequency = <0>;
> };
> --
> 1.6.4
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply
* RE: PCI HotPlug and Adding Resources after Linux Boots
From: Morrison, Tom @ 2009-09-23 11:56 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev@ozlabs.org
In-Reply-To: <1253698927.7103.312.camel@pasglop>
Thank you for taking the time in confirming some of the=20
potential strategies I was already thinking about...:-)
I am going to try to pre-allocate some resources for
the specific port/slot/bridge device (because we know
at all times that port #6 (bus #5) is going to have
a FPGA end device associated with it...
Any other thoughts - whenever you can make them - would
be more than welcome!
Tom
>> -----Original Message-----
>> From: Benjamin Herrenschmidt [mailto:benh@kernel.crashing.org]
>> Sent: Wednesday, September 23, 2009 5:42 AM
>> To: Morrison, Tom
>> Cc: linuxppc-dev@ozlabs.org; linux-kernel@vger.kernel.org
>> Subject: Re: PCI HotPlug and Adding Resources after Linux Boots
>>=20
>> On Tue, 2009-09-22 at 15:36 -0400, Morrison, Tom wrote:
>> > I am not exactly sure who to direct this question to (general Linux
>> > kernel or LinuxPPC),
>>=20
>> PCI Hotplug is reasonably arch specific at the moment so I suppose
>> here's is as good as anywhere else to ask :-)
>>=20
>> > so I am directing to both - in hopes that someone will recognize this
>> > problem - and perhaps
>> >
>> > give me some suggestions on how to proceed...
>>=20
>> There's a few things you can do, though I don't have time just right now
>> to give you a detailed answer. I'll try again later.
>>=20
>> In the meantime, some of the answers could be around not using full
>> automatic resource assignment, but instead, pre-initializing the top
>> bridge with some resources that are going to be enough for the device.
>>=20
>> You can also try to get the bridge to re-allocate. There's various funky
>> locking issues with doing that though as long as it's during boot time,
>> it's not too much of a problem.
>>=20
>> There are other more or less hackish ways to do it, but I'll have to
>> give it more thought.
>>=20
>> I'm quite stretched at the moment so if you don't hear back from me in
>> the upcoming few days, don't hesitate to ping me again.
>>=20
>> Cheers,
>> Ben.
>> >
>> > I am running Linux (2.6.23x (and 2.6.27.x)) on a MPC8572 based system.
>>=20
[Morrison, Tom]=20
<snip the rest original msg>
^ permalink raw reply
* Re: [PATCH 3/6] P2020DS: Fixup sdhc to use PIO mode
From: Anton Vorontsov @ 2009-09-23 11:55 UTC (permalink / raw)
To: Gao Guanhua; +Cc: linuxppc-dev, sdhci-devel
In-Reply-To: <1253696892-15262-3-git-send-email-B22826@freescale.com>
On Wed, Sep 23, 2009 at 05:08:09PM +0800, Gao Guanhua wrote:
> The SDHC can not work on DMA mode because of the hardware bug,
> so we set a broken dma flag and use PIO mode. This patch applies
> to Rev1.0.
Signed-off-by line is missing (in all patches).
> ---
> arch/powerpc/boot/dts/p2020ds.dts | 1 +
> drivers/mmc/host/sdhci-of.c | 3 +++
> 2 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/arch/powerpc/boot/dts/p2020ds.dts b/arch/powerpc/boot/dts/p2020ds.dts
> index be449ba..574ad4f 100644
> --- a/arch/powerpc/boot/dts/p2020ds.dts
> +++ b/arch/powerpc/boot/dts/p2020ds.dts
> @@ -459,6 +459,7 @@
> reg = <0x2e000 0x1000>;
> interrupts = <72 0x2>;
> interrupt-parent = <&mpic>;
> + fsl,sdhci-dma-broken;
You might want to update
Documentation/powerpc/dts-bindings/fsl/esdhc.txt
> clock-frequency = <0>;
> };
>
> diff --git a/drivers/mmc/host/sdhci-of.c b/drivers/mmc/host/sdhci-of.c
> index 01ab916..5879483 100644
> --- a/drivers/mmc/host/sdhci-of.c
> +++ b/drivers/mmc/host/sdhci-of.c
> @@ -270,6 +270,9 @@ static int __devinit sdhci_of_probe(struct of_device *ofdev,
> if (sdhci_of_wp_inverted(np))
> host->quirks |= SDHCI_QUIRK_INVERTED_WRITE_PROTECT;
>
> + if (of_get_property(np, "fsl,sdhci-dma-broken", NULL))
> + host->quirks |= SDHCI_QUIRK_BROKEN_DMA;
> +
> clk = of_get_property(np, "clock-frequency", &size);
> if (clk && size == sizeof(*clk) && *clk)
> of_host->clock = *clk;
> --
> 1.6.4
Thanks,
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply
* Re: [PATCH 1/6] sdhci: Enable cache snooping
From: Anton Vorontsov @ 2009-09-23 11:52 UTC (permalink / raw)
To: Gao Guanhua; +Cc: linuxppc-dev, sdhci-devel
In-Reply-To: <1253696892-15262-1-git-send-email-B22826@freescale.com>
On Wed, Sep 23, 2009 at 05:08:07PM +0800, Gao Guanhua wrote:
> This patch enable cache snooping when the sdhc is initialized.
> ---
> drivers/mmc/host/sdhci.c | 3 +++
> drivers/mmc/host/sdhci.h | 4 ++++
> 2 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 288e40b..cc6d45c 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -178,6 +178,9 @@ static void sdhci_init(struct sdhci_host *host)
> {
> sdhci_reset(host, SDHCI_RESET_ALL);
>
> + /* Enable cache snooping */
> + sdhci_writel(host, SDHCI_CACHE_SNOOP, SDHCI_HOST_DMA_CONTROL);
> +
> sdhci_clear_set_irqs(host, SDHCI_INT_ALL_MASK,
> SDHCI_INT_BUS_POWER | SDHCI_INT_DATA_END_BIT |
> SDHCI_INT_DATA_CRC | SDHCI_INT_DATA_TIMEOUT | SDHCI_INT_INDEX |
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index afda7f1..9ee9622 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -176,6 +176,10 @@
> #define SDHCI_SPEC_100 0
> #define SDHCI_SPEC_200 1
>
> +/* 40C DMA control register*/
> +#define SDHCI_HOST_DMA_CONTROL 0x40C
SDHCI Specification doesn't mention this register, it isn't standard.
Plus, we have this register and bit set already in sdhci-of.c:
static int esdhc_enable_dma(struct sdhci_host *host)
{
setbits32(host->ioaddr + ESDHC_DMA_SYSCTL, ESDHC_DMA_SNOOP);
return 0;
}
Do p2020 need this bit set for PIO mode too?
Thanks,
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply
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