* [PATCH v2 1/7] dt: introduce of_get_child_by_name to get child node by name.
From: Srinivas KANDAGATLA @ 2012-09-14 8:17 UTC (permalink / raw)
To: davem, robherring2, bergner, devicetree-discuss
Cc: jassi.brar, srinivas.kandagatla, afleming, netdev, linuxppc-dev
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
This patch introduces of_get_child_by_name function to get a child node
by its name in a given parent node.
Without this patch each driver code has to iterate the parent and do
a string compare, However having of_get_child_by_name libary function would
avoid code duplication, errors and is more convenient.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
---
drivers/of/base.c | 25 +++++++++++++++++++++++++
include/linux/of.h | 2 ++
2 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index d4a1c9a..7391f8a 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -391,6 +391,31 @@ struct device_node *of_get_next_available_child(const struct device_node *node,
EXPORT_SYMBOL(of_get_next_available_child);
/**
+ * of_get_child_by_name - Find the child node by name for a given parent
+ * @node: parent node
+ * @name: child name to look for.
+ *
+ * This function looks for child node for given matching name
+ *
+ * Returns a node pointer if found, with refcount incremented, use
+ * of_node_put() on it when done.
+ * Returns NULL if node is not found.
+ */
+
+struct device_node *of_get_child_by_name(const struct device_node *node,
+ const char *name)
+{
+ struct device_node *child;
+
+ for_each_child_of_node(node, child)
+ if (child->name && (of_node_cmp(child->name, name) == 0)
+ && of_node_get(child))
+ break;
+ return child;
+}
+EXPORT_SYMBOL(of_get_child_by_name);
+
+/**
* of_find_node_by_path - Find a node matching a full OF path
* @path: The full path to match
*
diff --git a/include/linux/of.h b/include/linux/of.h
index 1b11632..7b8e3cd 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -192,6 +192,8 @@ extern struct device_node *of_get_next_child(const struct device_node *node,
struct device_node *prev);
extern struct device_node *of_get_next_available_child(
const struct device_node *node, struct device_node *prev);
+extern struct device_node *of_get_child_by_name(const struct device_node *node,
+ const char *name);
#define for_each_child_of_node(parent, child) \
for (child = of_get_next_child(parent, NULL); child != NULL; \
--
1.7.0.4
^ permalink raw reply related
* [PATCH v2 0/7] Introduce of_get_child_by_name.
From: Srinivas KANDAGATLA @ 2012-09-14 8:17 UTC (permalink / raw)
To: davem, robherring2, bergner, devicetree-discuss
Cc: jassi.brar, srinivas.kandagatla, afleming, netdev, linuxppc-dev
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
This patch series introduces of_get_child_by_name function to get a
child node by its name in a given parent node and also removes code
duplication in some of the existing driver code by using of_get_child_by_name.
Normally if a driver want to get a child node it would iterate all the nodes
of parent and compare its name and then get it.
This use case is becoming common as device trees are used more, so moving this
functionality to a libary function makes sense.
Having of_get_child_by_name libary function would avoid code duplication,
errors and is more convenient.
Changes from v1:
-rename of_get_child to of_get_child_by_name.
-remove read lock in of_get_child_by_name.
-make use of of_get_child_by_name in the existing kernel code.
Srinivas Kandagatla (7):
dt: introduce of_get_child_by_name to get child node by name.
dt/powerpc: Use of_get_child_by_name to get a named child.
dt/powerpc/powernv: Use of_get_child_by_name to get a named child.
dt/powerpc/sysdev: Use of_get_child_by_name to get a named child.
dt/net/fsl_pq_mdio: Use of_get_child_by_name to get a named child.
dt/s3c64xx/spi: Use of_get_child_by_name to get a named child.
dt/tty/opal: Use of_get_child_by_name to get a named child.
arch/powerpc/kernel/prom.c | 5 +----
arch/powerpc/platforms/powernv/opal.c | 6 ++----
arch/powerpc/sysdev/qe_lib/qe.c | 5 +----
drivers/net/ethernet/freescale/fsl_pq_mdio.c | 5 +----
drivers/of/base.c | 25 +++++++++++++++++++++++++
drivers/spi/spi-s3c64xx.c | 4 +---
drivers/tty/hvc/hvc_opal.c | 9 ++-------
include/linux/of.h | 2 ++
8 files changed, 35 insertions(+), 26 deletions(-)
^ permalink raw reply
* [PATCH v2 3/7] dt/powerpc/powernv: Use of_get_child_by_name to get a named child.
From: Srinivas KANDAGATLA @ 2012-09-14 8:19 UTC (permalink / raw)
To: benh; +Cc: robherring2, devicetree-discuss, linuxppc-dev,
srinivas.kandagatla
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
As follow-up to "dt: introduce of_get_child_by_name to get child node by
name." patch, This patch removes some of the code duplication in the
driver by replacing it with of_get_child_by_name instead.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
---
arch/powerpc/platforms/powernv/opal.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index aaa0dba..6dfb8af 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -294,11 +294,9 @@ static int __init opal_init(void)
consoles = of_node_get(opal_node);
/* Register serial ports */
- for_each_child_of_node(consoles, np) {
- if (strcmp(np->name, "serial"))
- continue;
+ np = of_get_child_by_name(consoles, "serial");
+ if (np)
of_platform_device_create(np, NULL, NULL);
- }
of_node_put(consoles);
/* Find all OPAL interrupts and request them */
--
1.7.0.4
^ permalink raw reply related
* Re: [PATCH] powerpc: Add an xmon command to dump one or all pacas
From: Michael Ellerman @ 2012-09-14 8:59 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <1347602637-18683-1-git-send-email-michael@ellerman.id.au>
On Fri, 2012-09-14 at 16:03 +1000, Michael Ellerman wrote:
> This was originally motivated by a desire to see the mapping between
> logical and hardware cpu numbers.
Thanks to everyone who reminded me that the paca is 64-bit only :)
New patch on the way.
cheers
^ permalink raw reply
* [PATCH] powerpc: Add a powerpc implementation of SHA-1
From: Michael Ellerman @ 2012-09-14 9:00 UTC (permalink / raw)
To: linuxppc-dev
This patch adds a crypto driver which provides a powerpc accelerated
implementation of SHA-1, accelerated in that it is written in asm.
Original patch by Paul, minor fixups for upstream by moi.
Lightly tested on 64-bit with the test program here:
http://michael.ellerman.id.au/files/junkcode/sha1test.c
Seems to work, and is "not slower" than the generic version.
Needs testing on 32-bit.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
arch/powerpc/Makefile | 1 +
arch/powerpc/crypto/Makefile | 9 ++
arch/powerpc/crypto/sha1-powerpc-asm.S | 179 ++++++++++++++++++++++++++++++++
arch/powerpc/crypto/sha1.c | 157 ++++++++++++++++++++++++++++
crypto/Kconfig | 7 ++
5 files changed, 353 insertions(+)
create mode 100644 arch/powerpc/crypto/Makefile
create mode 100644 arch/powerpc/crypto/sha1-powerpc-asm.S
create mode 100644 arch/powerpc/crypto/sha1.c
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 159e94f..277880d 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -143,6 +143,7 @@ core-y += arch/powerpc/kernel/ \
arch/powerpc/sysdev/ \
arch/powerpc/platforms/ \
arch/powerpc/math-emu/ \
+ arch/powerpc/crypto/ \
arch/powerpc/net/
core-$(CONFIG_XMON) += arch/powerpc/xmon/
core-$(CONFIG_KVM) += arch/powerpc/kvm/
diff --git a/arch/powerpc/crypto/Makefile b/arch/powerpc/crypto/Makefile
new file mode 100644
index 0000000..2926fb9
--- /dev/null
+++ b/arch/powerpc/crypto/Makefile
@@ -0,0 +1,9 @@
+#
+# powerpc/crypto/Makefile
+#
+# Arch-specific CryptoAPI modules.
+#
+
+obj-$(CONFIG_CRYPTO_SHA1_PPC) += sha1-powerpc.o
+
+sha1-powerpc-y := sha1-powerpc-asm.o sha1.o
diff --git a/arch/powerpc/crypto/sha1-powerpc-asm.S b/arch/powerpc/crypto/sha1-powerpc-asm.S
new file mode 100644
index 0000000..a5f8264
--- /dev/null
+++ b/arch/powerpc/crypto/sha1-powerpc-asm.S
@@ -0,0 +1,179 @@
+/*
+ * SHA-1 implementation for PowerPC.
+ *
+ * Copyright (C) 2005 Paul Mackerras <paulus@samba.org>
+ */
+
+#include <asm/ppc_asm.h>
+#include <asm/asm-offsets.h>
+
+/*
+ * We roll the registers for T, A, B, C, D, E around on each
+ * iteration; T on iteration t is A on iteration t+1, and so on.
+ * We use registers 7 - 12 for this.
+ */
+#define RT(t) ((((t)+5)%6)+7)
+#define RA(t) ((((t)+4)%6)+7)
+#define RB(t) ((((t)+3)%6)+7)
+#define RC(t) ((((t)+2)%6)+7)
+#define RD(t) ((((t)+1)%6)+7)
+#define RE(t) ((((t)+0)%6)+7)
+
+/* We use registers 16 - 31 for the W values */
+#define W(t) (((t)%16)+16)
+
+#define LOADW(t) \
+ lwz W(t),(t)*4(r4)
+
+#define STEPD0_LOAD(t) \
+ andc r0,RD(t),RB(t); \
+ and r6,RB(t),RC(t); \
+ rotlwi RT(t),RA(t),5; \
+ or r6,r6,r0; \
+ add r0,RE(t),r15; \
+ add RT(t),RT(t),r6; \
+ add r14,r0,W(t); \
+ lwz W((t)+4),((t)+4)*4(r4); \
+ rotlwi RB(t),RB(t),30; \
+ add RT(t),RT(t),r14
+
+#define STEPD0_UPDATE(t) \
+ and r6,RB(t),RC(t); \
+ andc r0,RD(t),RB(t); \
+ rotlwi RT(t),RA(t),5; \
+ rotlwi RB(t),RB(t),30; \
+ or r6,r6,r0; \
+ add r0,RE(t),r15; \
+ xor r5,W((t)+4-3),W((t)+4-8); \
+ add RT(t),RT(t),r6; \
+ xor W((t)+4),W((t)+4-16),W((t)+4-14); \
+ add r0,r0,W(t); \
+ xor W((t)+4),W((t)+4),r5; \
+ add RT(t),RT(t),r0; \
+ rotlwi W((t)+4),W((t)+4),1
+
+#define STEPD1(t) \
+ xor r6,RB(t),RC(t); \
+ rotlwi RT(t),RA(t),5; \
+ rotlwi RB(t),RB(t),30; \
+ xor r6,r6,RD(t); \
+ add r0,RE(t),r15; \
+ add RT(t),RT(t),r6; \
+ add r0,r0,W(t); \
+ add RT(t),RT(t),r0
+
+#define STEPD1_UPDATE(t) \
+ xor r6,RB(t),RC(t); \
+ rotlwi RT(t),RA(t),5; \
+ rotlwi RB(t),RB(t),30; \
+ xor r6,r6,RD(t); \
+ add r0,RE(t),r15; \
+ xor r5,W((t)+4-3),W((t)+4-8); \
+ add RT(t),RT(t),r6; \
+ xor W((t)+4),W((t)+4-16),W((t)+4-14); \
+ add r0,r0,W(t); \
+ xor W((t)+4),W((t)+4),r5; \
+ add RT(t),RT(t),r0; \
+ rotlwi W((t)+4),W((t)+4),1
+
+#define STEPD2_UPDATE(t) \
+ and r6,RB(t),RC(t); \
+ and r0,RB(t),RD(t); \
+ rotlwi RT(t),RA(t),5; \
+ or r6,r6,r0; \
+ rotlwi RB(t),RB(t),30; \
+ and r0,RC(t),RD(t); \
+ xor r5,W((t)+4-3),W((t)+4-8); \
+ or r6,r6,r0; \
+ xor W((t)+4),W((t)+4-16),W((t)+4-14); \
+ add r0,RE(t),r15; \
+ add RT(t),RT(t),r6; \
+ add r0,r0,W(t); \
+ xor W((t)+4),W((t)+4),r5; \
+ add RT(t),RT(t),r0; \
+ rotlwi W((t)+4),W((t)+4),1
+
+#define STEP0LD4(t) \
+ STEPD0_LOAD(t); \
+ STEPD0_LOAD((t)+1); \
+ STEPD0_LOAD((t)+2); \
+ STEPD0_LOAD((t)+3)
+
+#define STEPUP4(t, fn) \
+ STEP##fn##_UPDATE(t); \
+ STEP##fn##_UPDATE((t)+1); \
+ STEP##fn##_UPDATE((t)+2); \
+ STEP##fn##_UPDATE((t)+3)
+
+#define STEPUP20(t, fn) \
+ STEPUP4(t, fn); \
+ STEPUP4((t)+4, fn); \
+ STEPUP4((t)+8, fn); \
+ STEPUP4((t)+12, fn); \
+ STEPUP4((t)+16, fn)
+
+_GLOBAL(powerpc_sha_transform)
+ PPC_STLU r1,-STACKFRAMESIZE(r1)
+ SAVE_8GPRS(14, r1)
+ SAVE_10GPRS(22, r1)
+
+ /* Load up A - E */
+ lwz RA(0),0(r3) /* A */
+ lwz RB(0),4(r3) /* B */
+ lwz RC(0),8(r3) /* C */
+ lwz RD(0),12(r3) /* D */
+ lwz RE(0),16(r3) /* E */
+
+ LOADW(0)
+ LOADW(1)
+ LOADW(2)
+ LOADW(3)
+
+ lis r15,0x5a82 /* K0-19 */
+ ori r15,r15,0x7999
+ STEP0LD4(0)
+ STEP0LD4(4)
+ STEP0LD4(8)
+ STEPUP4(12, D0)
+ STEPUP4(16, D0)
+
+ lis r15,0x6ed9 /* K20-39 */
+ ori r15,r15,0xeba1
+ STEPUP20(20, D1)
+
+ lis r15,0x8f1b /* K40-59 */
+ ori r15,r15,0xbcdc
+ STEPUP20(40, D2)
+
+ lis r15,0xca62 /* K60-79 */
+ ori r15,r15,0xc1d6
+ STEPUP4(60, D1)
+ STEPUP4(64, D1)
+ STEPUP4(68, D1)
+ STEPUP4(72, D1)
+ lwz r20,16(r3)
+ STEPD1(76)
+ lwz r19,12(r3)
+ STEPD1(77)
+ lwz r18,8(r3)
+ STEPD1(78)
+ lwz r17,4(r3)
+ STEPD1(79)
+
+ lwz r16,0(r3)
+ add r20,RE(80),r20
+ add RD(0),RD(80),r19
+ add RC(0),RC(80),r18
+ add RB(0),RB(80),r17
+ add RA(0),RA(80),r16
+ mr RE(0),r20
+ stw RA(0),0(r3)
+ stw RB(0),4(r3)
+ stw RC(0),8(r3)
+ stw RD(0),12(r3)
+ stw RE(0),16(r3)
+
+ REST_8GPRS(14, r1)
+ REST_10GPRS(22, r1)
+ addi r1,r1,STACKFRAMESIZE
+ blr
diff --git a/arch/powerpc/crypto/sha1.c b/arch/powerpc/crypto/sha1.c
new file mode 100644
index 0000000..f9e8b94
--- /dev/null
+++ b/arch/powerpc/crypto/sha1.c
@@ -0,0 +1,157 @@
+/*
+ * Cryptographic API.
+ *
+ * powerpc implementation of the SHA1 Secure Hash Algorithm.
+ *
+ * Derived from cryptoapi implementation, adapted for in-place
+ * scatterlist interface.
+ *
+ * Derived from "crypto/sha1.c"
+ * Copyright (c) Alan Smithee.
+ * Copyright (c) Andrew McDonald <andrew@mcdonald.org.uk>
+ * Copyright (c) Jean-Francois Dive <jef@linuxbe.org>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ */
+#include <crypto/internal/hash.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/mm.h>
+#include <linux/cryptohash.h>
+#include <linux/types.h>
+#include <crypto/sha.h>
+#include <asm/byteorder.h>
+
+extern void powerpc_sha_transform(u32 *state, const u8 *src, u32 *temp);
+
+static int sha1_init(struct shash_desc *desc)
+{
+ struct sha1_state *sctx = shash_desc_ctx(desc);
+
+ *sctx = (struct sha1_state){
+ .state = { SHA1_H0, SHA1_H1, SHA1_H2, SHA1_H3, SHA1_H4 },
+ };
+
+ return 0;
+}
+
+static int sha1_update(struct shash_desc *desc, const u8 *data,
+ unsigned int len)
+{
+ struct sha1_state *sctx = shash_desc_ctx(desc);
+ unsigned int partial, done;
+ const u8 *src;
+
+ partial = sctx->count & 0x3f;
+ sctx->count += len;
+ done = 0;
+ src = data;
+
+ if ((partial + len) > 63) {
+ u32 temp[SHA_WORKSPACE_WORDS];
+
+ if (partial) {
+ done = -partial;
+ memcpy(sctx->buffer + partial, data, done + 64);
+ src = sctx->buffer;
+ }
+
+ do {
+ powerpc_sha_transform(sctx->state, src, temp);
+ done += 64;
+ src = data + done;
+ } while (done + 63 < len);
+
+ memset(temp, 0, sizeof(temp));
+ partial = 0;
+ }
+ memcpy(sctx->buffer + partial, src, len - done);
+
+ return 0;
+}
+
+
+/* Add padding and return the message digest. */
+static int sha1_final(struct shash_desc *desc, u8 *out)
+{
+ struct sha1_state *sctx = shash_desc_ctx(desc);
+ __be32 *dst = (__be32 *)out;
+ u32 i, index, padlen;
+ __be64 bits;
+ static const u8 padding[64] = { 0x80, };
+
+ bits = cpu_to_be64(sctx->count << 3);
+
+ /* Pad out to 56 mod 64 */
+ index = sctx->count & 0x3f;
+ padlen = (index < 56) ? (56 - index) : ((64+56) - index);
+ sha1_update(desc, padding, padlen);
+
+ /* Append length */
+ sha1_update(desc, (const u8 *)&bits, sizeof(bits));
+
+ /* Store state in digest */
+ for (i = 0; i < 5; i++)
+ dst[i] = cpu_to_be32(sctx->state[i]);
+
+ /* Wipe context */
+ memset(sctx, 0, sizeof *sctx);
+
+ return 0;
+}
+
+static int sha1_export(struct shash_desc *desc, void *out)
+{
+ struct sha1_state *sctx = shash_desc_ctx(desc);
+
+ memcpy(out, sctx, sizeof(*sctx));
+ return 0;
+}
+
+static int sha1_import(struct shash_desc *desc, const void *in)
+{
+ struct sha1_state *sctx = shash_desc_ctx(desc);
+
+ memcpy(sctx, in, sizeof(*sctx));
+ return 0;
+}
+
+static struct shash_alg alg = {
+ .digestsize = SHA1_DIGEST_SIZE,
+ .init = sha1_init,
+ .update = sha1_update,
+ .final = sha1_final,
+ .export = sha1_export,
+ .import = sha1_import,
+ .descsize = sizeof(struct sha1_state),
+ .statesize = sizeof(struct sha1_state),
+ .base = {
+ .cra_name = "sha1",
+ .cra_driver_name= "sha1-powerpc",
+ .cra_flags = CRYPTO_ALG_TYPE_SHASH,
+ .cra_blocksize = SHA1_BLOCK_SIZE,
+ .cra_module = THIS_MODULE,
+ }
+};
+
+static int __init sha1_powerpc_mod_init(void)
+{
+ return crypto_register_shash(&alg);
+}
+
+static void __exit sha1_powerpc_mod_fini(void)
+{
+ crypto_unregister_shash(&alg);
+}
+
+module_init(sha1_powerpc_mod_init);
+module_exit(sha1_powerpc_mod_fini);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm");
+
+MODULE_ALIAS("sha1-powerpc");
diff --git a/crypto/Kconfig b/crypto/Kconfig
index a323805..777f150 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -433,6 +433,13 @@ config CRYPTO_SHA1_SSSE3
using Supplemental SSE3 (SSSE3) instructions or Advanced Vector
Extensions (AVX), when available.
+config CRYPTO_SHA1_PPC
+ tristate "SHA1 digest algorithm (powerpc)"
+ depends on PPC
+ help
+ This is the powerpc hardware accelerated implementation of the
+ SHA-1 secure hash standard (FIPS 180-1/DFIPS 180-2).
+
config CRYPTO_SHA256
tristate "SHA224 and SHA256 digest algorithm"
select CRYPTO_HASH
--
1.7.9.5
^ permalink raw reply related
* [PATCH] powerpc: Add an xmon command to dump one or all pacas
From: Michael Ellerman @ 2012-09-14 9:01 UTC (permalink / raw)
To: linuxppc-dev
This was originally motivated by a desire to see the mapping between
logical and hardware cpu numbers.
But it seemed that it made more sense to just add a command to dump
(most of) the paca.
With no arguments "dp" will dump the paca for the current cpu.
It also takes an argument, eg. "dp 3" which is the logical cpu number
in hex. This form does not check if the cpu is possible, but displays
the paca regardless, as well as the cpu's state in the possible, present
and online masks.
Thirdly, "dpa" will display the paca for all possible cpus. If there are
no possible cpus, like early in boot, it will tell you that.
Sample output, number in brackets is the offset into the struct:
2:mon> dp 3
paca for cpu 0x3 @ c00000000ff20a80:
possible = yes
present = yes
online = yes
lock_token = 0x8000 (0x8)
paca_index = 0x3 (0xa)
kernel_toc = 0xc00000000144f990 (0x10)
kernelbase = 0xc000000000000000 (0x18)
kernel_msr = 0xb000000000001032 (0x20)
stab_real = 0x0 (0x28)
stab_addr = 0x0 (0x30)
emergency_sp = 0xc00000003ffe4000 (0x38)
data_offset = 0xa40000 (0x40)
hw_cpu_id = 0x9 (0x50)
cpu_start = 0x1 (0x52)
kexec_state = 0x0 (0x53)
__current = 0xc00000007e568680 (0x218)
kstack = 0xc00000007e5a3e30 (0x220)
stab_rr = 0x1a (0x228)
saved_r1 = 0xc00000007e7cb450 (0x230)
trap_save = 0x0 (0x240)
soft_enabled = 0x0 (0x242)
irq_happened = 0x0 (0x243)
io_sync = 0x0 (0x244)
irq_work_pending = 0x0 (0x245)
nap_state_lost = 0x0 (0x246)
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
v3: Fix 32-bit build :}
v2: Fix macro per sfr's comments. Change dp to show current cpu's paca,
and add dpa to show all.
---
arch/powerpc/xmon/xmon.c | 105 +++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 104 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 9b49c65..d5ae12b 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -202,7 +202,13 @@ Commands:\n\
di dump instructions\n\
df dump float values\n\
dd dump double values\n\
- dl dump the kernel log buffer\n\
+ dl dump the kernel log buffer\n"
+#ifdef CONFIG_PPC64
+ "\
+ dp[#] dump paca for current cpu, or cpu #\n\
+ dpa dump paca for all possible cpus\n"
+#endif
+ "\
dr dump stream of raw bytes\n\
e print exception information\n\
f flush cache\n\
@@ -2009,6 +2015,95 @@ static void xmon_rawdump (unsigned long adrs, long ndump)
printf("\n");
}
+#ifdef CONFIG_PPC64
+static void dump_one_paca(int cpu)
+{
+ struct paca_struct *p;
+
+ if (setjmp(bus_error_jmp) != 0) {
+ printf("*** Error dumping paca for cpu 0x%x!\n", cpu);
+ return;
+ }
+
+ catch_memory_errors = 1;
+ sync();
+
+ p = &paca[cpu];
+
+ printf("paca for cpu 0x%x @ %p:\n", cpu, p);
+
+ printf(" %-*s = %s\n", 16, "possible", cpu_possible(cpu) ? "yes" : "no");
+ printf(" %-*s = %s\n", 16, "present", cpu_present(cpu) ? "yes" : "no");
+ printf(" %-*s = %s\n", 16, "online", cpu_online(cpu) ? "yes" : "no");
+
+#define DUMP(paca, name, format) \
+ printf(" %-*s = %#-*"format"\t(0x%lx)\n", 16, #name, 18, paca->name, \
+ offsetof(struct paca_struct, name));
+
+ DUMP(p, lock_token, "x");
+ DUMP(p, paca_index, "x");
+ DUMP(p, kernel_toc, "lx");
+ DUMP(p, kernelbase, "lx");
+ DUMP(p, kernel_msr, "lx");
+#ifdef CONFIG_PPC_STD_MMU_64
+ DUMP(p, stab_real, "lx");
+ DUMP(p, stab_addr, "lx");
+#endif
+ DUMP(p, emergency_sp, "p");
+ DUMP(p, data_offset, "lx");
+ DUMP(p, hw_cpu_id, "x");
+ DUMP(p, cpu_start, "x");
+ DUMP(p, kexec_state, "x");
+ DUMP(p, __current, "p");
+ DUMP(p, kstack, "lx");
+ DUMP(p, stab_rr, "lx");
+ DUMP(p, saved_r1, "lx");
+ DUMP(p, trap_save, "x");
+ DUMP(p, soft_enabled, "x");
+ DUMP(p, irq_happened, "x");
+ DUMP(p, io_sync, "x");
+ DUMP(p, irq_work_pending, "x");
+ DUMP(p, nap_state_lost, "x");
+
+#undef DUMP
+
+ catch_memory_errors = 0;
+ sync();
+}
+
+static void dump_all_pacas(void)
+{
+ int cpu;
+
+ if (num_possible_cpus() == 0) {
+ printf("No possible cpus, use 'dp #' to dump individual cpus\n");
+ return;
+ }
+
+ for_each_possible_cpu(cpu)
+ dump_one_paca(cpu);
+}
+
+static void dump_pacas(void)
+{
+ unsigned long num;
+ int c;
+
+ c = inchar();
+ if (c == 'a') {
+ dump_all_pacas();
+ return;
+ }
+
+ termch = c; /* Put c back, it wasn't 'a' */
+
+ if (scanhex(&num))
+ dump_one_paca(num);
+ else
+ dump_one_paca(xmon_owner);
+}
+#endif
+
#define isxdigit(c) (('0' <= (c) && (c) <= '9') \
|| ('a' <= (c) && (c) <= 'f') \
|| ('A' <= (c) && (c) <= 'F'))
@@ -2018,6 +2113,14 @@ dump(void)
int c;
c = inchar();
+
+#ifdef CONFIG_PPC64
+ if (c == 'p') {
+ dump_pacas();
+ return;
+ }
+#endif
+
if ((isxdigit(c) && c != 'f' && c != 'd') || c == '\n')
termch = c;
scanhex((void *)&adrs);
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH 1/7] powerpc/52xx: define FSL_SOC
From: agust @ 2012-09-14 9:31 UTC (permalink / raw)
To: Eric Millbrandt; +Cc: alsa-devel, Mark Brown, linuxppc-dev, Liam Girdwood
In-Reply-To: <1347572596-37540-2-git-send-email-emillbrandt@dekaresearch.com>
Eric Millbrandt <emillbrandt@dekaresearch.com> wrote:
> mpc52xx socs need to have FSL_SOC defined to build their drivers
> (i2c-mpc, ASoC)
No, i2c-mpc depends on PPC only. And FSL_SOC enables code we do not
use on mpc52xx. For ASoC please see comment below.
> Signed-off-by: Eric Millbrandt <emillbrandt@dekaresearch.com>
>
> diff --git a/arch/powerpc/platforms/52xx/Kconfig
> b/arch/powerpc/platforms/52xx/Kconfig
> index 90f4496..fb35944 100644
> --- a/arch/powerpc/platforms/52xx/Kconfig
> +++ b/arch/powerpc/platforms/52xx/Kconfig
> @@ -1,6 +1,7 @@
> config PPC_MPC52xx
> bool "52xx-based boards"
> depends on 6xx
> + select FSL_SOC
Better use:
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index d701330..4563b28 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -6,7 +6,7 @@ config SND_SOC_FSL_UTILS
menuconfig SND_POWERPC_SOC
tristate "SoC Audio for Freescale PowerPC CPUs"
- depends on FSL_SOC
+ depends on FSL_SOC || PPC_MPC52xx
help
Say Y or M if you want to add support for codecs attached to
the PowerPC CPUs.
Thanks,
Anatolij
^ permalink raw reply related
* [PATCH v2 4/7] dt/powerpc/sysdev: Use of_get_child_by_name to get a named child.
From: Srinivas KANDAGATLA @ 2012-09-14 8:19 UTC (permalink / raw)
To: benh; +Cc: robherring2, devicetree-discuss, linuxppc-dev,
srinivas.kandagatla
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
As follow-up to "dt: introduce of_get_child_by_name to get child node by
name." patch, This patch removes some of the code duplication in the
driver by replacing it with of_get_child_by_name instead.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
---
arch/powerpc/sysdev/qe_lib/qe.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index b043675..fd1c15d 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -568,10 +568,7 @@ struct qe_firmware_info *qe_get_firmware_info(void)
}
/* Find the 'firmware' child node */
- for_each_child_of_node(qe, fw) {
- if (strcmp(fw->name, "firmware") == 0)
- break;
- }
+ fw = of_get_child_by_name(qe "firmware");
of_node_put(qe);
--
1.7.0.4
^ permalink raw reply related
* Re: [PATCH 2/3] powerpc/esdhc: add property to disable the CMD23
From: Kumar Gala @ 2012-09-14 12:40 UTC (permalink / raw)
To: Huang Changming-R66093
Cc: linux-mmc@vger.kernel.org, Chris Ball,
linuxppc-dev@lists.ozlabs.org list, Anton Vorontsov
In-Reply-To: <110EED8CC96DFC488B7E717A2027A27C179C7E@039-SN1MPN1-002.039d.mgd.msft.net>
>>>>>=20
>>>>>> -----Original Message-----
>>>>>> From: Chris Ball [mailto:cjb@laptop.org]
>>>>>> Sent: Wednesday, September 12, 2012 4:59 AM
>>>>>> To: Kumar Gala
>>>>>> Cc: Huang Changming-R66093; linuxppc-dev@lists.ozlabs.org list;
>>>>>> linux- mmc@vger.kernel.org; Anton Vorontsov
>>>>>> Subject: Re: [PATCH 2/3] powerpc/esdhc: add property to disable =
the
>>>>>> CMD23
>>>>>>=20
>>>>>> Hi,
>>>>>>=20
>>>>>> On Tue, Sep 11 2012, Kumar Gala wrote:
>>>>>>> thanks for the info. Do you know what's required on controller
>>>>>>> side to handle cards that support CMD23?
>>>>>>>=20
>>>>>>> I'm trying to figure out if older controller's on FSL SoCs are
>>>>>>> missing some feature to allow CMD23 to work (vs Auto-CMD23).
>>>>>>=20
>>>>>> It seems plausible that it's just not implemented on these
>> controllers.
>>>>>> It's a little strange, since the command's been specified for so
>>>>>> long and we haven't seen any other controllers with problems. =
The
>>>>>> patch would be correct if this is true.
>>>>>>=20
>>>>>=20
>>>>> I didn't find any description about it, but after testing on FSL
>>>> silicones, I got this result:
>>>>> Some silicones support this command, and some silicones don't
>>>>> support
>>>> it, which will cause I/O error.
>>>>=20
>>>> Can you list out which SoCs support it and which don't. Having =
this
>>>> list will be useful in understanding which controller versions
>> supported it.
>>>>=20
>>> P1020, p1021, p1022, p1024, p1015 and p4080 can't support it.
>>> Mpc8536, p2020, and the other current DPAA silicon (e.g. p5020, =
p3041)
>> support it.
>>=20
>> Based on this, why don't we use the HOSTVER register to detect =
instead of
>> device tree:
>>=20
>>=20
>> #define FSL_SDHC_VER_1_0 0x00
>> #define FSL_SDHC_VER_1_1 0x01
>> #define FSL_SDHC_VER_2_0 0x10
>> #define FSL_SDHC_VER_2_1 0x11
>> #define FSL_SDHC_VER_2_2 0x12
>> #define FSL_SDHC_VER_2_3 0x13
>>=20
>> unsigned int vendor_version;
>>=20
>> vendor_version =3D sdhci_readw(host, SDHCI_HOST_VERSION); =
vendor_version =3D
>> (vendor_version & SDHCI_VENDOR_VER_MASK) >> SDHCI_VENDOR_VER_SHIFT;
>>=20
>> if ((vendor_version =3D=3D FSL_SDHC_VER_1_1) || (vendor_version =3D=3D
>> FSL_SDHC_VER_2_2))
>> host->quirks2 |=3D SDHCI_QUIRK2_HOST_NO_CMD23;
>>=20
>=20
> I once thought about it, but if the future silicon does not support =
this feature,
> then we continue to modify these codes for new silicon?
Yes, but it seems extremely unlikely that future versions of the =
controller will remove this feature now that it exists.
- k=
^ permalink raw reply
* Re: [PATCH v2 4/7] dt/powerpc/sysdev: Use of_get_child_by_name to get a named child.
From: Rob Herring @ 2012-09-14 13:05 UTC (permalink / raw)
To: Srinivas KANDAGATLA; +Cc: devicetree-discuss, linuxppc-dev
In-Reply-To: <1347610764-20227-1-git-send-email-srinivas.kandagatla@st.com>
On 09/14/2012 03:19 AM, Srinivas KANDAGATLA wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
>
> As follow-up to "dt: introduce of_get_child_by_name to get child node by
> name." patch, This patch removes some of the code duplication in the
> driver by replacing it with of_get_child_by_name instead.
>
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
> ---
> arch/powerpc/sysdev/qe_lib/qe.c | 5 +----
> 1 files changed, 1 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
> index b043675..fd1c15d 100644
> --- a/arch/powerpc/sysdev/qe_lib/qe.c
> +++ b/arch/powerpc/sysdev/qe_lib/qe.c
> @@ -568,10 +568,7 @@ struct qe_firmware_info *qe_get_firmware_info(void)
> }
>
> /* Find the 'firmware' child node */
> - for_each_child_of_node(qe, fw) {
> - if (strcmp(fw->name, "firmware") == 0)
> - break;
> - }
> + fw = of_get_child_by_name(qe "firmware");
Missing comma.
>
> of_node_put(qe);
>
>
^ permalink raw reply
* Re: [PATCH v2 2/7] dt/powerpc: Use of_get_child_by_name to get a named child.
From: Rob Herring @ 2012-09-14 13:06 UTC (permalink / raw)
To: Srinivas KANDAGATLA; +Cc: bergner, devicetree-discuss, linuxppc-dev
In-Reply-To: <1347610724-20152-1-git-send-email-srinivas.kandagatla@st.com>
On 09/14/2012 03:18 AM, Srinivas KANDAGATLA wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
>
> As follow-up to "dt: introduce of_get_child_by_name to get child node by
> name." patch, This patch removes some of the code duplication in the
> driver by replacing it with of_get_child_by_name instead.
>
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
> ---
> arch/powerpc/kernel/prom.c | 5 +----
> 1 files changed, 1 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index f191bf0..80e5b6c 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -735,7 +735,6 @@ void __init early_init_devtree(void *params)
> */
> struct device_node *of_find_next_cache_node(struct device_node *np)
> {
> - struct device_node *child;
> const phandle *handle;
>
> handle = of_get_property(np, "l2-cache", NULL);
> @@ -749,9 +748,7 @@ struct device_node *of_find_next_cache_node(struct device_node *np)
> * beneath CPU nodes.
> */
> if (!strcmp(np->type, "cpu"))
> - for_each_child_of_node(np, child)
> - if (!strcmp(child->type, "cache"))
name and type are not the same thing.
Rob
> - return child;
> + return of_get_child_by_name(np, "cache");
>
> return NULL;
> }
>
^ permalink raw reply
* Re: [PATCH v2 2/7] dt/powerpc: Use of_get_child_by_name to get a named child.
From: Srinivas KANDAGATLA @ 2012-09-14 13:15 UTC (permalink / raw)
To: Rob Herring; +Cc: bergner, devicetree-discuss, linuxppc-dev
In-Reply-To: <50532BEC.70201@gmail.com>
My bad...
Will skip this patch in next patch-set...
On 14/09/12 14:06, Rob Herring wrote:
> On 09/14/2012 03:18 AM, Srinivas KANDAGATLA wrote:
>> From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
>>
>> As follow-up to "dt: introduce of_get_child_by_name to get child node by
>> name." patch, This patch removes some of the code duplication in the
>> driver by replacing it with of_get_child_by_name instead.
>>
>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
>> ---
>> arch/powerpc/kernel/prom.c | 5 +----
>> 1 files changed, 1 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
>> index f191bf0..80e5b6c 100644
>> --- a/arch/powerpc/kernel/prom.c
>> +++ b/arch/powerpc/kernel/prom.c
>> @@ -735,7 +735,6 @@ void __init early_init_devtree(void *params)
>> */
>> struct device_node *of_find_next_cache_node(struct device_node *np)
>> {
>> - struct device_node *child;
>> const phandle *handle;
>>
>> handle = of_get_property(np, "l2-cache", NULL);
>> @@ -749,9 +748,7 @@ struct device_node *of_find_next_cache_node(struct device_node *np)
>> * beneath CPU nodes.
>> */
>> if (!strcmp(np->type, "cpu"))
>> - for_each_child_of_node(np, child)
>> - if (!strcmp(child->type, "cache"))
> name and type are not the same thing.
>
> Rob
>
>> - return child;
>> + return of_get_child_by_name(np, "cache");
>>
>> return NULL;
>> }
>>
>
>
^ permalink raw reply
* Re: [PATCH v2 4/7] dt/powerpc/sysdev: Use of_get_child_by_name to get a named child.
From: Srinivas KANDAGATLA @ 2012-09-14 13:15 UTC (permalink / raw)
To: Rob Herring; +Cc: devicetree-discuss, linuxppc-dev
In-Reply-To: <50532BB0.3090502@gmail.com>
Thanks for pointing the typo..
On 14/09/12 14:05, Rob Herring wrote:
> On 09/14/2012 03:19 AM, Srinivas KANDAGATLA wrote:
>> From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
>>
>> As follow-up to "dt: introduce of_get_child_by_name to get child node by
>> name." patch, This patch removes some of the code duplication in the
>> driver by replacing it with of_get_child_by_name instead.
>>
>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
>> ---
>> arch/powerpc/sysdev/qe_lib/qe.c | 5 +----
>> 1 files changed, 1 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
>> index b043675..fd1c15d 100644
>> --- a/arch/powerpc/sysdev/qe_lib/qe.c
>> +++ b/arch/powerpc/sysdev/qe_lib/qe.c
>> @@ -568,10 +568,7 @@ struct qe_firmware_info *qe_get_firmware_info(void)
>> }
>>
>> /* Find the 'firmware' child node */
>> - for_each_child_of_node(qe, fw) {
>> - if (strcmp(fw->name, "firmware") == 0)
>> - break;
>> - }
>> + fw = of_get_child_by_name(qe "firmware");
> Missing comma.
>
>>
>> of_node_put(qe);
>>
>>
>
>
^ permalink raw reply
* Re: [PATCH] i2c-mpc: Wait for STOP to hit the bus
From: Joakim Tjernlund @ 2012-09-14 14:21 UTC (permalink / raw)
To: Wolfram Sang; +Cc: linuxppc-dev, linux-i2c
In-Reply-To: <20120914140234.GH2630@pengutronix.de>
Wolfram Sang <w.sang@pengutronix.de> wrote on 2012/09/14 16:02:34:
>
> On Thu, Aug 30, 2012 at 12:40:04PM +0200, Joakim Tjernlund wrote:
> > mpc_i2c_stop() only initiates STOP but does not wait for it to
> > hit the I2C bus. This is a problem when using I2C devices which
> > uses fairly long clock stretching just before STOP if you also
> > have an i2c-mux which may switch to another bus before STOP has
> > been processed.
> >
> > Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
>
> Patch didn't apply, because it was a p0-patch. Checkpatch would have
> warned you.
Bugger, it is my git config setting:
[diff]
noprefix = true
I always forget to remove that one before generating patches, I will have to remove it.
>
> Fixed that and applied to -next, thanks!
Thanks
^ permalink raw reply
* Re: [PATCH] i2c-mpc: Wait for STOP to hit the bus
From: Wolfram Sang @ 2012-09-14 14:02 UTC (permalink / raw)
To: Joakim Tjernlund; +Cc: linuxppc-dev, linux-i2c
In-Reply-To: <1346323204-19210-1-git-send-email-Joakim.Tjernlund@transmode.se>
[-- Attachment #1: Type: text/plain, Size: 711 bytes --]
On Thu, Aug 30, 2012 at 12:40:04PM +0200, Joakim Tjernlund wrote:
> mpc_i2c_stop() only initiates STOP but does not wait for it to
> hit the I2C bus. This is a problem when using I2C devices which
> uses fairly long clock stretching just before STOP if you also
> have an i2c-mux which may switch to another bus before STOP has
> been processed.
>
> Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Patch didn't apply, because it was a p0-patch. Checkpatch would have
warned you.
Fixed that and applied to -next, thanks!
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply
* RE: [PATCH 1/7] powerpc/52xx: define FSL_SOC
From: Eric Millbrandt @ 2012-09-14 14:45 UTC (permalink / raw)
To: 'agust@denx.de'
Cc: alsa-devel@alsa-project.org, Mark Brown,
linuxppc-dev@lists.ozlabs.org, Liam Girdwood
In-Reply-To: <20120914113100.119048xeot7zcym8@webmail.mnet-online.de>
On 2012-09-14 agust@denx.de wrote:
> Eric Millbrandt <emillbrandt@dekaresearch.com> wrote:
>
...
>
> Better use:
>
> diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig index
> d701330..4563b28 100644
> --- a/sound/soc/fsl/Kconfig
> +++ b/sound/soc/fsl/Kconfig
> @@ -6,7 +6,7 @@ config SND_SOC_FSL_UTILS
>
> menuconfig SND_POWERPC_SOC
> tristate "SoC Audio for Freescale PowerPC CPUs"
> - depends on FSL_SOC
> + depends on FSL_SOC || PPC_MPC52xx
> help
> Say Y or M if you want to add support for codecs attached to
> the PowerPC CPUs.
> Thanks,
>
> Anatolij
>
Looks good to me, I will do this instead. Thanks.
Eric
-DISCLAIMER: an automatically appended disclaimer may follow. By posting-
-to a public e-mail mailing list I hereby grant permission to distribute-
-and copy this message.-
This e-mail and the information, including any attachments, it contains are=
intended to be a confidential communication only to the person or entity t=
o whom it is addressed and may contain information that is privileged. If t=
he reader of this message is not the intended recipient, you are hereby not=
ified that any dissemination, distribution or copying of this communication=
is strictly prohibited. If you have received this communication in error, =
please immediately notify the sender and destroy the original message.
Thank you.
Please consider the environment before printing this email.
^ permalink raw reply
* [PATCH] rapidio: fix kerneldoc warnings after DMA support was added
From: Alexandre Bounine @ 2012-09-14 17:11 UTC (permalink / raw)
To: Andrew Morton, linux-kernel, linuxppc-dev
Cc: Alexandre Bounine, Robert P. J. Day
Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Reported-by: Robert P. J. Day <rpjday@crashcourse.ca>
Cc: Robert P. J. Day <rpjday@crashcourse.ca>
---
include/linux/rio.h | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/include/linux/rio.h b/include/linux/rio.h
index 1a7b6c7..ba382f2 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -236,6 +236,7 @@ enum rio_phy_type {
* @phys_efptr: RIO port extended features pointer
* @name: Port name string
* @priv: Master port private data
+ * @dma: DMA device associated with mport
*/
struct rio_mport {
struct list_head dbells; /* list of doorbell events */
@@ -404,7 +405,7 @@ union rio_pw_msg {
#ifdef CONFIG_RAPIDIO_DMA_ENGINE
-/**
+/*
* enum rio_write_type - RIO write transaction types used in DMA transfers
*
* Note: RapidIO specification defines write (NWRITE) and
--
1.7.8.4
^ permalink raw reply related
* Re: [PATCH] edac/85xx: fix error handle of mpc85xx_mc_err_probe
From: Shaun Ruffell @ 2012-09-14 18:21 UTC (permalink / raw)
To: Shaohui Xie; +Cc: avorontsov, linux-kernel, akpm, linuxppc-dev, linux-edac
In-Reply-To: <1347533729-5893-1-git-send-email-Shaohui.Xie@freescale.com>
On Thu, Sep 13, 2012 at 06:55:29PM +0800, Shaohui Xie wrote:
> Error handle in case of DDR ECC off is wrong, sysfs entries have not been
> created, so edac_mc_free which frees a mci instance should not be called.
> Also, free mci's memory in this case.
Jus FYI: I ran into the same error in edac_mc_free() which I
resolved in a slightly different way in some patches I sent
previously. [1]
[1] https://lkml.org/lkml/2012/9/14/475
Cheers,
Shaun
^ permalink raw reply
* Re: [PATCH v2 3/7] dt/powerpc/powernv: Use of_get_child_by_name to get a named child.
From: Michael Ellerman @ 2012-09-17 2:07 UTC (permalink / raw)
To: Srinivas KANDAGATLA; +Cc: devicetree-discuss, robherring2, linuxppc-dev
In-Reply-To: <1347610743-20189-1-git-send-email-srinivas.kandagatla@st.com>
On Fri, 2012-09-14 at 09:19 +0100, Srinivas KANDAGATLA wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
>
> As follow-up to "dt: introduce of_get_child_by_name to get child node by
> name." patch, This patch removes some of the code duplication in the
> driver by replacing it with of_get_child_by_name instead.
>
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
> ---
> arch/powerpc/platforms/powernv/opal.c | 6 ++----
> 1 files changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
> index aaa0dba..6dfb8af 100644
> --- a/arch/powerpc/platforms/powernv/opal.c
> +++ b/arch/powerpc/platforms/powernv/opal.c
> @@ -294,11 +294,9 @@ static int __init opal_init(void)
> consoles = of_node_get(opal_node);
>
> /* Register serial ports */
> - for_each_child_of_node(consoles, np) {
> - if (strcmp(np->name, "serial"))
> - continue;
> + np = of_get_child_by_name(consoles, "serial");
> + if (np)
> of_platform_device_create(np, NULL, NULL);
> - }
> of_node_put(consoles);
You've introduced a refcounting bug here.
The return value of of_get_child_by_name() has its refcount elevated
(via of_node_get()), so you have to drop that reference with
of_node_put().
The old code was safe because it only used np inside the loop, and the
loop logic deals with dropping the refcount for you.
And yes of_platform_device_create() takes a reference for itself.
cheers
^ permalink raw reply
* RE: [PATCH V10] powerpc/fsl-pci: Unify pci/pcie initialization code
From: Jia Hongtao-B38951 @ 2012-09-17 2:12 UTC (permalink / raw)
To: Kumar Gala
Cc: Wood Scott-B07421, linuxppc-dev@lists.ozlabs.org, Li Yang-R58472
In-Reply-To: <A3F539F8-4264-4823-97F1-AA6E028799B5@kernel.crashing.org>
> -----Original Message-----
> From: Kumar Gala [mailto:galak@kernel.crashing.org]
> Sent: Thursday, September 13, 2012 4:20 AM
> To: Jia Hongtao-B38951
> Cc: linuxppc-dev@lists.ozlabs.org; Li Yang-R58472; Wood Scott-B07421
> Subject: Re: [PATCH V10] powerpc/fsl-pci: Unify pci/pcie initialization
> code
>=20
>=20
> On Aug 28, 2012, at 2:44 AM, Jia Hongtao wrote:
>=20
> > We unified the Freescale pci/pcie initialization by changing the
> > fsl_pci to a platform driver. In previous PCI code architecture the
> > initialization routine is called at board_setup_arch stage. Now the
> > initialization is done in probe function which is architectural
> > better. Also It's convenient for adding PM support for PCI controller
> in later patch.
> >
> > Now we registered pci controllers as platform devices. So we combine
> > two initialization code as one platform driver.
> >
> > Signed-off-by: Jia Hongtao <B38951@freescale.com>
> > Signed-off-by: Li Yang <leoli@freescale.com>
> > Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
> > ---
> > Changes for V10:
> > * Just update comments for mpc85xx_cds_pci_assign_primary
> >
> > arch/powerpc/platforms/85xx/common.c | 10 +++
> > arch/powerpc/platforms/85xx/corenet_ds.c | 34 ++--------
> > arch/powerpc/platforms/85xx/ge_imp3a.c | 62 ++++++-----------
> > arch/powerpc/platforms/85xx/mpc8536_ds.c | 36 +---------
> > arch/powerpc/platforms/85xx/mpc85xx_ads.c | 11 +--
> > arch/powerpc/platforms/85xx/mpc85xx_cds.c | 44 +++++++++----
> > arch/powerpc/platforms/85xx/mpc85xx_ds.c | 14 ++--
> > arch/powerpc/platforms/85xx/mpc85xx_mds.c | 40 ++---------
> > arch/powerpc/platforms/85xx/mpc85xx_rdb.c | 30 +++-----
> > arch/powerpc/platforms/85xx/p1010rdb.c | 14 +---
> > arch/powerpc/platforms/85xx/p1022_ds.c | 36 +---------
> > arch/powerpc/platforms/85xx/p1022_rdk.c | 36 +---------
> > arch/powerpc/platforms/85xx/p1023_rds.c | 9 +--
> > arch/powerpc/platforms/85xx/p2041_rdb.c | 2 +-
> > arch/powerpc/platforms/85xx/p3041_ds.c | 2 +-
> > arch/powerpc/platforms/85xx/p4080_ds.c | 2 +-
> > arch/powerpc/platforms/85xx/p5020_ds.c | 2 +-
> > arch/powerpc/platforms/85xx/p5040_ds.c | 2 +-
> > arch/powerpc/platforms/85xx/qemu_e500.c | 4 +-
> > arch/powerpc/platforms/85xx/sbc8548.c | 21 +-----
> > arch/powerpc/platforms/85xx/socrates.c | 11 +---
> > arch/powerpc/platforms/85xx/stx_gp3.c | 13 +---
> > arch/powerpc/platforms/85xx/tqm85xx.c | 21 +-----
> > arch/powerpc/platforms/85xx/xes_mpc85xx.c | 56 ++-------------
> > arch/powerpc/platforms/86xx/gef_ppc9a.c | 12 +--
> > arch/powerpc/platforms/86xx/gef_sbc310.c | 13 +---
> > arch/powerpc/platforms/86xx/gef_sbc610.c | 12 +--
> > arch/powerpc/platforms/86xx/mpc8610_hpcd.c | 21 ++----
> > arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 42 ++----------
> > arch/powerpc/platforms/86xx/sbc8641d.c | 14 +---
> > arch/powerpc/sysdev/fsl_pci.c | 102 +++++++++++++++++----
> -------
> > arch/powerpc/sysdev/fsl_pci.h | 15 +++-
> > drivers/edac/mpc85xx_edac.c | 43 +++---------
> > 33 files changed, 249 insertions(+), 537 deletions(-)
>=20
> applied to next
>=20
> - k
Thanks.
I will sent PM patch for PCI soon.
- Hongtao.
^ permalink raw reply
* Re: [PATCH v2 3/7] dt/powerpc/powernv: Use of_get_child_by_name to get a named child.
From: Srinivas KANDAGATLA @ 2012-09-17 7:31 UTC (permalink / raw)
To: Michael Ellerman; +Cc: devicetree-discuss, robherring2, linuxppc-dev
In-Reply-To: <1347847668.28674.3.camel@concordia>
On 17/09/12 03:07, Michael Ellerman wrote:
> On Fri, 2012-09-14 at 09:19 +0100, Srinivas KANDAGATLA wrote:
>> From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
>>
>> As follow-up to "dt: introduce of_get_child_by_name to get child node by
>> name." patch, This patch removes some of the code duplication in the
>> driver by replacing it with of_get_child_by_name instead.
>>
>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
>> ---
>> arch/powerpc/platforms/powernv/opal.c | 6 ++----
>> 1 files changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
>> index aaa0dba..6dfb8af 100644
>> --- a/arch/powerpc/platforms/powernv/opal.c
>> +++ b/arch/powerpc/platforms/powernv/opal.c
>> @@ -294,11 +294,9 @@ static int __init opal_init(void)
>> consoles = of_node_get(opal_node);
>>
>> /* Register serial ports */
>> - for_each_child_of_node(consoles, np) {
>> - if (strcmp(np->name, "serial"))
>> - continue;
>> + np = of_get_child_by_name(consoles, "serial");
>> + if (np)
>> of_platform_device_create(np, NULL, NULL);
>> - }
>> of_node_put(consoles);
> You've introduced a refcounting bug here.
>
> The return value of of_get_child_by_name() has its refcount elevated
> (via of_node_get()), so you have to drop that reference with
> of_node_put().
I agree..
Will take care of it in v3 patch-series.
> The old code was safe because it only used np inside the loop, and the
> loop logic deals with dropping the refcount for you.
>
> And yes of_platform_device_create() takes a reference for itself.
>
> cheers
>
>
>
^ permalink raw reply
* [PATCH v3 0/5] Introduce of_get_child_by_name.
From: Srinivas KANDAGATLA @ 2012-09-17 8:57 UTC (permalink / raw)
To: robherring2, bergner, devicetree-discuss
Cc: kgene.kim, srinivas.kandagatla, afleming, ben-linux, netdev,
linuxppc-dev
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
This patch series introduces of_get_child_by_name function to get a
child node by its name in a given parent node and also removes code
duplication in some of the existing driver code by using of_get_child_by_name.
Normally if a driver want to get a child node it would iterate all the nodes
of parent and compare its name and then get it.
This use case is becoming common as device trees are used more, so moving this
functionality to a libary function makes sense.
Having of_get_child_by_name libary function would avoid code duplication,
errors, proper reference counting and is more convenient.
Changes from v2:
- Fixed typo errors.
- Removed bogus patches which used "type" instead of "name"
- Fixed reference counting in follow-up patches.
Changes from v1:
-rename of_get_child to of_get_child_by_name.
-remove read lock in of_get_child_by_name.
-make use of of_get_child_by_name in the existing kernel code.
Srinivas Kandagatla (5):
dt: introduce of_get_child_by_name to get child node by name.
dt/powerpc/powernv: Use of_get_child_by_name to get a named child.
dt/powerpc/sysdev: Use of_get_child_by_name to get a named child.
dt/s3c64xx/spi: Use of_get_child_by_name to get a named child.
dt/tty/opal: Use of_get_child_by_name to get a named child.
arch/powerpc/platforms/powernv/opal.c | 6 +++---
arch/powerpc/sysdev/qe_lib/qe.c | 5 +----
drivers/of/base.c | 25 +++++++++++++++++++++++++
drivers/spi/spi-s3c64xx.c | 7 ++++---
drivers/tty/hvc/hvc_opal.c | 9 ++-------
include/linux/of.h | 2 ++
6 files changed, 37 insertions(+), 17 deletions(-)
^ permalink raw reply
* [PATCH v3 1/5] dt: introduce of_get_child_by_name to get child node by name.
From: Srinivas KANDAGATLA @ 2012-09-17 8:57 UTC (permalink / raw)
To: robherring2, bergner, devicetree-discuss
Cc: jassi.brar, srinivas.kandagatla, afleming, netdev, linuxppc-dev
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
This patch introduces of_get_child_by_name function to get a child node
by its name in a given parent node.
Without this patch each driver code has to iterate the parent and do
a string compare, However having of_get_child_by_name libary function would
avoid code duplication, errors and is more convenient.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
---
drivers/of/base.c | 25 +++++++++++++++++++++++++
include/linux/of.h | 2 ++
2 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/drivers/of/base.c b/drivers/of/base.c
index d4a1c9a..7391f8a 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -391,6 +391,31 @@ struct device_node *of_get_next_available_child(const struct device_node *node,
EXPORT_SYMBOL(of_get_next_available_child);
/**
+ * of_get_child_by_name - Find the child node by name for a given parent
+ * @node: parent node
+ * @name: child name to look for.
+ *
+ * This function looks for child node for given matching name
+ *
+ * Returns a node pointer if found, with refcount incremented, use
+ * of_node_put() on it when done.
+ * Returns NULL if node is not found.
+ */
+
+struct device_node *of_get_child_by_name(const struct device_node *node,
+ const char *name)
+{
+ struct device_node *child;
+
+ for_each_child_of_node(node, child)
+ if (child->name && (of_node_cmp(child->name, name) == 0)
+ && of_node_get(child))
+ break;
+ return child;
+}
+EXPORT_SYMBOL(of_get_child_by_name);
+
+/**
* of_find_node_by_path - Find a node matching a full OF path
* @path: The full path to match
*
diff --git a/include/linux/of.h b/include/linux/of.h
index 1b11632..7b8e3cd 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -192,6 +192,8 @@ extern struct device_node *of_get_next_child(const struct device_node *node,
struct device_node *prev);
extern struct device_node *of_get_next_available_child(
const struct device_node *node, struct device_node *prev);
+extern struct device_node *of_get_child_by_name(const struct device_node *node,
+ const char *name);
#define for_each_child_of_node(parent, child) \
for (child = of_get_next_child(parent, NULL); child != NULL; \
--
1.7.0.4
^ permalink raw reply related
* [PATCH v3 2/5] dt/powerpc/powernv: Use of_get_child_by_name to get a named child.
From: Srinivas KANDAGATLA @ 2012-09-17 8:57 UTC (permalink / raw)
To: benh; +Cc: robherring2, devicetree-discuss, linuxppc-dev,
srinivas.kandagatla
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
As follow-up to "dt: introduce of_get_child_by_name to get child node by
name." patch, This patch removes some of the code duplication in the
driver by replacing it with of_get_child_by_name instead.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
---
arch/powerpc/platforms/powernv/opal.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index aaa0dba..fc7ae70 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -294,9 +294,9 @@ static int __init opal_init(void)
consoles = of_node_get(opal_node);
/* Register serial ports */
- for_each_child_of_node(consoles, np) {
- if (strcmp(np->name, "serial"))
- continue;
+ np = of_get_child_by_name(consoles, "serial");
+ if (np) {
+ of_node_put(np);
of_platform_device_create(np, NULL, NULL);
}
of_node_put(consoles);
--
1.7.0.4
^ permalink raw reply related
* [PATCH v3 3/5] dt/powerpc/sysdev: Use of_get_child_by_name to get a named child.
From: Srinivas KANDAGATLA @ 2012-09-17 8:57 UTC (permalink / raw)
To: benh; +Cc: robherring2, devicetree-discuss, linuxppc-dev,
srinivas.kandagatla
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
As follow-up to "dt: introduce of_get_child_by_name to get child node by
name." patch, This patch removes some of the code duplication in the
driver by replacing it with of_get_child_by_name instead.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
---
arch/powerpc/sysdev/qe_lib/qe.c | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index b043675..d094e51 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -568,10 +568,7 @@ struct qe_firmware_info *qe_get_firmware_info(void)
}
/* Find the 'firmware' child node */
- for_each_child_of_node(qe, fw) {
- if (strcmp(fw->name, "firmware") == 0)
- break;
- }
+ fw = of_get_child_by_name(qe, "firmware");
of_node_put(qe);
--
1.7.0.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox