* [PATCH v2 02/10] crypto: nx - fix limits to sg lists for AES-ECB
From: Marcelo Cerri @ 2013-08-29 14:36 UTC (permalink / raw)
To: herbert; +Cc: Marcelo Cerri, linuxppc-dev, linux-kernel, linux-crypto
In-Reply-To: <1377787000-4966-1-git-send-email-mhcerri@linux.vnet.ibm.com>
This patch updates the nx-aes-ecb implementation to perform several
hyper calls if needed in order to always respect the length limits for
scatter/gather lists.
Two different limits are considered:
- "ibm,max-sg-len": maximum number of bytes of each scatter/gather
list.
- "ibm,max-sync-cop":
- The total number of bytes that a scatter/gather list can hold.
- The maximum number of elements that a scatter/gather list can have.
Reviewed-by: Joy Latten <jmlatten@linux.vnet.ibm.com>
Signed-off-by: Marcelo Cerri <mhcerri@linux.vnet.ibm.com>
---
drivers/crypto/nx/nx-aes-ecb.c | 48 ++++++++++++++++++++++++++----------------
1 file changed, 30 insertions(+), 18 deletions(-)
diff --git a/drivers/crypto/nx/nx-aes-ecb.c b/drivers/crypto/nx/nx-aes-ecb.c
index fe0d803..85a8d23 100644
--- a/drivers/crypto/nx/nx-aes-ecb.c
+++ b/drivers/crypto/nx/nx-aes-ecb.c
@@ -71,37 +71,49 @@ static int ecb_aes_nx_crypt(struct blkcipher_desc *desc,
struct nx_crypto_ctx *nx_ctx = crypto_blkcipher_ctx(desc->tfm);
struct nx_csbcpb *csbcpb = nx_ctx->csbcpb;
unsigned long irq_flags;
+ unsigned int processed = 0, to_process;
+ u32 max_sg_len;
int rc;
spin_lock_irqsave(&nx_ctx->lock, irq_flags);
- if (nbytes > nx_ctx->ap->databytelen) {
- rc = -EINVAL;
- goto out;
- }
+ max_sg_len = min_t(u32, nx_driver.of.max_sg_len/sizeof(struct nx_sg),
+ nx_ctx->ap->sglen);
if (enc)
NX_CPB_FDM(csbcpb) |= NX_FDM_ENDE_ENCRYPT;
else
NX_CPB_FDM(csbcpb) &= ~NX_FDM_ENDE_ENCRYPT;
- rc = nx_build_sg_lists(nx_ctx, desc, dst, src, nbytes, 0, NULL);
- if (rc)
- goto out;
+ do {
+ to_process = min_t(u64, nbytes - processed,
+ nx_ctx->ap->databytelen);
+ to_process = min_t(u64, to_process,
+ NX_PAGE_SIZE * (max_sg_len - 1));
+ to_process = to_process & ~(AES_BLOCK_SIZE - 1);
- if (!nx_ctx->op.inlen || !nx_ctx->op.outlen) {
- rc = -EINVAL;
- goto out;
- }
+ rc = nx_build_sg_lists(nx_ctx, desc, dst, src, to_process,
+ processed, NULL);
+ if (rc)
+ goto out;
- rc = nx_hcall_sync(nx_ctx, &nx_ctx->op,
- desc->flags & CRYPTO_TFM_REQ_MAY_SLEEP);
- if (rc)
- goto out;
+ if (!nx_ctx->op.inlen || !nx_ctx->op.outlen) {
+ rc = -EINVAL;
+ goto out;
+ }
+
+ rc = nx_hcall_sync(nx_ctx, &nx_ctx->op,
+ desc->flags & CRYPTO_TFM_REQ_MAY_SLEEP);
+ if (rc)
+ goto out;
+
+ atomic_inc(&(nx_ctx->stats->aes_ops));
+ atomic64_add(csbcpb->csb.processed_byte_count,
+ &(nx_ctx->stats->aes_bytes));
+
+ processed += to_process;
+ } while (processed < nbytes);
- atomic_inc(&(nx_ctx->stats->aes_ops));
- atomic64_add(csbcpb->csb.processed_byte_count,
- &(nx_ctx->stats->aes_bytes));
out:
spin_unlock_irqrestore(&nx_ctx->lock, irq_flags);
return rc;
--
1.7.12
^ permalink raw reply related
* [PATCH v2 01/10] crypto: nx - add offset to nx_build_sg_lists()
From: Marcelo Cerri @ 2013-08-29 14:36 UTC (permalink / raw)
To: herbert; +Cc: Marcelo Cerri, linuxppc-dev, linux-kernel, linux-crypto
In-Reply-To: <1377787000-4966-1-git-send-email-mhcerri@linux.vnet.ibm.com>
This patch includes one more parameter to nx_build_sg_lists() to skip
the given number of bytes from beginning of each sg list.
This is needed in order to implement the fixes for the AES modes to make
them able to process larger chunks of data.
Reviewed-by: Joy Latten <jmlatten@linux.vnet.ibm.com>
Signed-off-by: Marcelo Cerri <mhcerri@linux.vnet.ibm.com>
---
drivers/crypto/nx/nx-aes-cbc.c | 2 +-
drivers/crypto/nx/nx-aes-ccm.c | 4 ++--
drivers/crypto/nx/nx-aes-ctr.c | 2 +-
drivers/crypto/nx/nx-aes-ecb.c | 2 +-
drivers/crypto/nx/nx-aes-gcm.c | 2 +-
drivers/crypto/nx/nx.c | 9 +++++++--
drivers/crypto/nx/nx.h | 2 +-
7 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/drivers/crypto/nx/nx-aes-cbc.c b/drivers/crypto/nx/nx-aes-cbc.c
index 7c0237d..a9e76c6 100644
--- a/drivers/crypto/nx/nx-aes-cbc.c
+++ b/drivers/crypto/nx/nx-aes-cbc.c
@@ -85,7 +85,7 @@ static int cbc_aes_nx_crypt(struct blkcipher_desc *desc,
else
NX_CPB_FDM(csbcpb) &= ~NX_FDM_ENDE_ENCRYPT;
- rc = nx_build_sg_lists(nx_ctx, desc, dst, src, nbytes,
+ rc = nx_build_sg_lists(nx_ctx, desc, dst, src, nbytes, 0,
csbcpb->cpb.aes_cbc.iv);
if (rc)
goto out;
diff --git a/drivers/crypto/nx/nx-aes-ccm.c b/drivers/crypto/nx/nx-aes-ccm.c
index 39d4224..666a35b 100644
--- a/drivers/crypto/nx/nx-aes-ccm.c
+++ b/drivers/crypto/nx/nx-aes-ccm.c
@@ -293,7 +293,7 @@ static int ccm_nx_decrypt(struct aead_request *req,
if (rc)
goto out;
- rc = nx_build_sg_lists(nx_ctx, desc, req->dst, req->src, nbytes,
+ rc = nx_build_sg_lists(nx_ctx, desc, req->dst, req->src, nbytes, 0,
csbcpb->cpb.aes_ccm.iv_or_ctr);
if (rc)
goto out;
@@ -339,7 +339,7 @@ static int ccm_nx_encrypt(struct aead_request *req,
if (rc)
goto out;
- rc = nx_build_sg_lists(nx_ctx, desc, req->dst, req->src, nbytes,
+ rc = nx_build_sg_lists(nx_ctx, desc, req->dst, req->src, nbytes, 0,
csbcpb->cpb.aes_ccm.iv_or_ctr);
if (rc)
goto out;
diff --git a/drivers/crypto/nx/nx-aes-ctr.c b/drivers/crypto/nx/nx-aes-ctr.c
index 762611b..80dee8d 100644
--- a/drivers/crypto/nx/nx-aes-ctr.c
+++ b/drivers/crypto/nx/nx-aes-ctr.c
@@ -98,7 +98,7 @@ static int ctr_aes_nx_crypt(struct blkcipher_desc *desc,
goto out;
}
- rc = nx_build_sg_lists(nx_ctx, desc, dst, src, nbytes,
+ rc = nx_build_sg_lists(nx_ctx, desc, dst, src, nbytes, 0,
csbcpb->cpb.aes_ctr.iv);
if (rc)
goto out;
diff --git a/drivers/crypto/nx/nx-aes-ecb.c b/drivers/crypto/nx/nx-aes-ecb.c
index 77dbe08..fe0d803 100644
--- a/drivers/crypto/nx/nx-aes-ecb.c
+++ b/drivers/crypto/nx/nx-aes-ecb.c
@@ -85,7 +85,7 @@ static int ecb_aes_nx_crypt(struct blkcipher_desc *desc,
else
NX_CPB_FDM(csbcpb) &= ~NX_FDM_ENDE_ENCRYPT;
- rc = nx_build_sg_lists(nx_ctx, desc, dst, src, nbytes, NULL);
+ rc = nx_build_sg_lists(nx_ctx, desc, dst, src, nbytes, 0, NULL);
if (rc)
goto out;
diff --git a/drivers/crypto/nx/nx-aes-gcm.c b/drivers/crypto/nx/nx-aes-gcm.c
index 74feee1..c2d6f76 100644
--- a/drivers/crypto/nx/nx-aes-gcm.c
+++ b/drivers/crypto/nx/nx-aes-gcm.c
@@ -226,7 +226,7 @@ static int gcm_aes_nx_crypt(struct aead_request *req, int enc)
csbcpb->cpb.aes_gcm.bit_length_data = nbytes * 8;
- rc = nx_build_sg_lists(nx_ctx, &desc, req->dst, req->src, nbytes,
+ rc = nx_build_sg_lists(nx_ctx, &desc, req->dst, req->src, nbytes, 0,
csbcpb->cpb.aes_gcm.iv_or_cnt);
if (rc)
goto out;
diff --git a/drivers/crypto/nx/nx.c b/drivers/crypto/nx/nx.c
index bdf4990..5533fe3 100644
--- a/drivers/crypto/nx/nx.c
+++ b/drivers/crypto/nx/nx.c
@@ -211,6 +211,8 @@ struct nx_sg *nx_walk_and_build(struct nx_sg *nx_dst,
* @dst: destination scatterlist
* @src: source scatterlist
* @nbytes: length of data described in the scatterlists
+ * @offset: number of bytes to fast-forward past at the beginning of
+ * scatterlists.
* @iv: destination for the iv data, if the algorithm requires it
*
* This is common code shared by all the AES algorithms. It uses the block
@@ -222,6 +224,7 @@ int nx_build_sg_lists(struct nx_crypto_ctx *nx_ctx,
struct scatterlist *dst,
struct scatterlist *src,
unsigned int nbytes,
+ unsigned int offset,
u8 *iv)
{
struct nx_sg *nx_insg = nx_ctx->in_sg;
@@ -230,8 +233,10 @@ int nx_build_sg_lists(struct nx_crypto_ctx *nx_ctx,
if (iv)
memcpy(iv, desc->info, AES_BLOCK_SIZE);
- nx_insg = nx_walk_and_build(nx_insg, nx_ctx->ap->sglen, src, 0, nbytes);
- nx_outsg = nx_walk_and_build(nx_outsg, nx_ctx->ap->sglen, dst, 0, nbytes);
+ nx_insg = nx_walk_and_build(nx_insg, nx_ctx->ap->sglen, src,
+ offset, nbytes);
+ nx_outsg = nx_walk_and_build(nx_outsg, nx_ctx->ap->sglen, dst,
+ offset, nbytes);
/* these lengths should be negative, which will indicate to phyp that
* the input and output parameters are scatterlists, not linear
diff --git a/drivers/crypto/nx/nx.h b/drivers/crypto/nx/nx.h
index 14bb97f..befda07 100644
--- a/drivers/crypto/nx/nx.h
+++ b/drivers/crypto/nx/nx.h
@@ -156,7 +156,7 @@ int nx_hcall_sync(struct nx_crypto_ctx *ctx, struct vio_pfo_op *op,
struct nx_sg *nx_build_sg_list(struct nx_sg *, u8 *, unsigned int, u32);
int nx_build_sg_lists(struct nx_crypto_ctx *, struct blkcipher_desc *,
struct scatterlist *, struct scatterlist *, unsigned int,
- u8 *);
+ unsigned int, u8 *);
struct nx_sg *nx_walk_and_build(struct nx_sg *, unsigned int,
struct scatterlist *, unsigned int,
unsigned int);
--
1.7.12
^ permalink raw reply related
* [PATCH v2 00/10] Series of fixes for NX driver
From: Marcelo Cerri @ 2013-08-29 14:36 UTC (permalink / raw)
To: herbert; +Cc: Marcelo Cerri, linuxppc-dev, linux-kernel, linux-crypto
This series of patches contains fixes in several algorithms implemented
by the NX driver. The patches can be separated in three different
categories:
- Changes to split the data in several hyper calls to respect the
limits of data that the co-processador can handle. This affects
all AES modes.
- Fixes in how the driver handle zero length messages. This affects
XCBC and GCM.
- Fixes for SHA-2 when chunks bigger than the block size are provided.
v2:
- Fixed conflict.
Fionnuala Gunter (2):
crypto: nx - fix limits to sg lists for AES-XCBC
crypto: nx - fix limits to sg lists for AES-CCM
Marcelo Cerri (8):
crypto: nx - add offset to nx_build_sg_lists()
crypto: nx - fix limits to sg lists for AES-ECB
crypto: nx - fix limits to sg lists for AES-CBC
crypto: nx - fix limits to sg lists for AES-CTR
crypto: nx - fix limits to sg lists for AES-GCM
crypto: nx - fix XCBC for zero length messages
crypto: nx - fix GCM for zero length messages
crypto: nx - fix SHA-2 for chunks bigger than block size
drivers/crypto/nx/nx-aes-cbc.c | 50 ++++---
drivers/crypto/nx/nx-aes-ccm.c | 297 +++++++++++++++++++++++++++++-----------
drivers/crypto/nx/nx-aes-ctr.c | 50 ++++---
drivers/crypto/nx/nx-aes-ecb.c | 48 ++++---
drivers/crypto/nx/nx-aes-gcm.c | 292 ++++++++++++++++++++++++++++++---------
drivers/crypto/nx/nx-aes-xcbc.c | 191 +++++++++++++++++++-------
drivers/crypto/nx/nx-sha256.c | 2 +-
drivers/crypto/nx/nx-sha512.c | 2 +-
drivers/crypto/nx/nx.c | 9 +-
drivers/crypto/nx/nx.h | 2 +-
10 files changed, 683 insertions(+), 260 deletions(-)
--
1.7.12
^ permalink raw reply
* Re: [PATCH 03/10] crypto: nx - fix limits to sg lists for AES-CBC
From: Marcelo Cerri @ 2013-08-29 14:32 UTC (permalink / raw)
To: Herbert Xu; +Cc: linuxppc-dev, linux-kernel, linux-crypto
In-Reply-To: <20130829044221.GA25208@gondor.apana.org.au>
On Thu, Aug 29, 2013 at 02:42:22PM +1000, Herbert Xu wrote:
> On Fri, Aug 23, 2013 at 05:01:07PM -0300, Marcelo Cerri wrote:
> > This patch updates the nx-aes-cbc implementation to perform several
> > hyper calls if needed in order to always respect the length limits for
> > scatter/gather lists.
> >
> > Two different limits are considered:
> >
> > - "ibm,max-sg-len": maximum number of bytes of each scatter/gather
> > list.
> >
> > - "ibm,max-sync-cop":
> > - The total number of bytes that a scatter/gather list can hold.
> > - The maximum number of elements that a scatter/gather list can have.
> >
> > Reviewed-by: Joy Latten <jmlatten@linux.vnet.ibm.com>
> > Signed-off-by: Marcelo Cerri <mhcerri@linux.vnet.ibm.com>
>
> This patch does not apply against the current cryptodev tree.
>
> Please regenerate your pathces.
Sorry for this. I'm sending a v2 series without conflicts.
>
> Thanks,
> --
> Email: Herbert Xu <herbert@gondor.apana.org.au>
> Home Page: http://gondor.apana.org.au/~herbert/
> PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
> --
> To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* Re: [PATCH V2] powerpc: Convert out of line __arch_hweight to inline
From: Madhavan Srinivasan @ 2013-08-29 12:20 UTC (permalink / raw)
To: benh; +Cc: linuxppc-dev, Madhavan Srinivasan, anton
In-Reply-To: <1375874338-30709-1-git-send-email-maddy@linux.vnet.ibm.com>
Hi Ben
On Wednesday 07 August 2013 04:48 PM, Madhavan Srinivasan wrote:
> Patch attempts to improve the performace of __arch_hweight functions by
> making them inline instead of current out of line implementation.
>
> Testcase is to disable/enable SMT on a large (192 thread) POWER7 lpar.
> Program used for SMT disable/enable is "ppc64_cpu" with "--smt=[off/on]"
> option. Here are the perf output. In this case, __arch_hweight64 is
> called by __bitmap_weight.
>
> Without patch (ppc64_cpu --smt=off):
>
> 17.60% ppc64_cpu [kernel.kallsyms] [k] .deactivate_slab
> ....
> 4.85% ppc64_cpu [kernel.kallsyms] [k] .__bitmap_weight
> ....
> 1.36% ppc64_cpu [kernel.kallsyms] [k] .__disable_runtime
> 1.29% ppc64_cpu [kernel.kallsyms] [k] .__arch_hweight64
>
>
> With patch (ppc64_cpu --smt=off):
>
> 17.29% ppc64_cpu [kernel.kallsyms] [k] .deactivate_slab
> ....
> 3.71% ppc64_cpu [kernel.kallsyms] [k] .__bitmap_weight
> 3.26% ppc64_cpu [kernel.kallsyms] [k] .build_overlap_sched_groups
> ....
>
> Without patch (ppc64_cpu --smt=on):
>
> 8.35% ppc64_cpu [kernel.kallsyms] [k] .strlen
> 7.00% ppc64_cpu [kernel.kallsyms] [k] .memset
> 6.78% ppc64_cpu [kernel.kallsyms] [k] .__bitmap_weight
> 4.23% ppc64_cpu [kernel.kallsyms] [k] .deactivate_slab
> ....
> 1.58% ppc64_cpu [kernel.kallsyms] [k] .refresh_zone_stat_thresholds
> 1.57% ppc64_cpu [kernel.kallsyms] [k] .__arch_hweight64
> 1.54% ppc64_cpu [kernel.kallsyms] [k] .__enable_runtime
> ....
>
> With patch (ppc64_cpu --smt=on):
>
> 9.44% ppc64_cpu [kernel.kallsyms] [k] .strlen
> 6.43% ppc64_cpu [kernel.kallsyms] [k] .memset
> 5.48% ppc64_cpu [kernel.kallsyms] [k] .__bitmap_weight
> 4.59% ppc64_cpu [kernel.kallsyms] [k] .insert_entry
> 4.29% ppc64_cpu [kernel.kallsyms] [k] .deactivate_slab
> ....
>
> Patch changes v2:
>
> 1. Removed the arch/powerpc/lib/hweight_64.S file.
>
> Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Any question or suggestion for this patch.
> ---
> arch/powerpc/include/asm/bitops.h | 130 ++++++++++++++++++++++++++++++++-
> arch/powerpc/include/asm/ppc-opcode.h | 6 ++
> arch/powerpc/lib/Makefile | 2 +-
> arch/powerpc/lib/hweight_64.S | 110 ----------------------------
> 4 files changed, 133 insertions(+), 115 deletions(-)
> delete mode 100644 arch/powerpc/lib/hweight_64.S
>
> diff --git a/arch/powerpc/include/asm/bitops.h b/arch/powerpc/include/asm/bitops.h
> index 910194e..136fe6a 100644
> --- a/arch/powerpc/include/asm/bitops.h
> +++ b/arch/powerpc/include/asm/bitops.h
> @@ -43,8 +43,10 @@
> #endif
>
> #include <linux/compiler.h>
> +#include <linux/types.h>
> #include <asm/asm-compat.h>
> #include <asm/synch.h>
> +#include <asm/cputable.h>
>
> /*
> * clear_bit doesn't imply a memory barrier
> @@ -263,10 +265,130 @@ static __inline__ int fls64(__u64 x)
> #endif /* __powerpc64__ */
>
> #ifdef CONFIG_PPC64
> -unsigned int __arch_hweight8(unsigned int w);
> -unsigned int __arch_hweight16(unsigned int w);
> -unsigned int __arch_hweight32(unsigned int w);
> -unsigned long __arch_hweight64(__u64 w);
> +
> +static inline unsigned int __arch_hweight8(unsigned int w)
> +{
> + unsigned int register iop asm("r3") = w;
> + unsigned int register tmp asm("r4");
> + __asm__ __volatile__ (
> + stringify_in_c(BEGIN_FTR_SECTION)
> + "bl .__sw_hweight8;"
> + "nop;"
> + stringify_in_c(FTR_SECTION_ELSE)
> + PPC_POPCNTB_M(%1,%2) ";"
> + "clrldi %0,%1,64-8;"
> + stringify_in_c(ALT_FTR_SECTION_END_IFCLR((%3)))
> + : "=r" (iop), "=r" (tmp)
> + : "r" (iop), "i" (CPU_FTR_POPCNTB)
> + : "r0", "r1", "r5", "r6", "r7", "r8", "r9",
> + "r10", "r11", "r12", "r13", "r31", "lr", "cr0", "xer");
> +
> + return iop;
> +}
> +
> +static inline unsigned int __arch_hweight16(unsigned int w)
> +{
> + unsigned int register iop asm("r3") = w;
> + unsigned int register tmp asm("r4");
> + __asm__ __volatile__ (
> + stringify_in_c(BEGIN_FTR_SECTION)
> + "bl .__sw_hweight16;"
> + "nop;"
> + "nop;"
> + "nop;"
> + "nop;"
> + stringify_in_c(FTR_SECTION_ELSE)
> + stringify_in_c(BEGIN_FTR_SECTION_NESTED(50))
> + PPC_POPCNTB_M(%0,%2) ";"
> + "srdi %1,%0,8;"
> + "add %0,%1,%0;"
> + "clrldi %0,%0,64-8;"
> + stringify_in_c(FTR_SECTION_ELSE_NESTED(50))
> + "clrlwi %0,%2,16;"
> + PPC_POPCNTW_M(%1,%0) ";"
> + "clrldi %0,%1,64-8;"
> + stringify_in_c(ALT_FTR_SECTION_END_NESTED_IFCLR(%4,50))
> + stringify_in_c(ALT_FTR_SECTION_END_IFCLR((%3)))
> + : "=r" (iop), "=r" (tmp)
> + : "r" (iop), "i" (CPU_FTR_POPCNTB), "i" (CPU_FTR_POPCNTD)
> + : "r0", "r1", "r5", "r6", "r7", "r8", "r9",
> + "r10", "r11", "r12", "r13", "r31", "lr", "cr0", "xer");
> +
> + return iop;
> +}
> +
> +static inline unsigned int __arch_hweight32(unsigned int w)
> +{
> + unsigned int register iop asm("r3") = w;
> + unsigned int register tmp asm("r4");
> + __asm__ __volatile__ (
> + stringify_in_c(BEGIN_FTR_SECTION)
> + "bl .__sw_hweight32;"
> + "nop;"
> + "nop;"
> + "nop;"
> + "nop;"
> + "nop;"
> + "nop;"
> + stringify_in_c(FTR_SECTION_ELSE)
> + stringify_in_c(BEGIN_FTR_SECTION_NESTED(51))
> + PPC_POPCNTB_M(%0,%2) ";"
> + "srdi %1,%0,16;"
> + "add %0,%1,%0;"
> + "srdi %1,%0,8;"
> + "add %0,%1,%0;"
> + "clrldi %0,%0,64-8;"
> + stringify_in_c(FTR_SECTION_ELSE_NESTED(51))
> + PPC_POPCNTW_M(%1,%2) ";"
> + "clrldi %0,%1,64-8;"
> + stringify_in_c(ALT_FTR_SECTION_END_NESTED_IFCLR(%4,51))
> + stringify_in_c(ALT_FTR_SECTION_END_IFCLR((%3)))
> + : "=r" (iop), "=r" (tmp)
> + : "r" (iop), "i" (CPU_FTR_POPCNTB), "i" (CPU_FTR_POPCNTD)
> + : "r0", "r1", "r5", "r6", "r7", "r8", "r9",
> + "r10", "r11", "r12", "r13", "r31", "lr", "cr0", "xer");
> +
> + return iop;
> +}
> +
> +static inline __u64 __arch_hweight64(__u64 w)
> +{
> + __u64 register iop asm("r3") = w;
> + __u64 register tmp asm("r4");
> + __asm__ __volatile__ (
> + stringify_in_c(BEGIN_FTR_SECTION)
> + "bl .__sw_hweight64;"
> + "nop;"
> + "nop;"
> + "nop;"
> + "nop;"
> + "nop;"
> + "nop;"
> + "nop;"
> + "nop;"
> + stringify_in_c(FTR_SECTION_ELSE)
> + stringify_in_c(BEGIN_FTR_SECTION_NESTED(52))
> + PPC_POPCNTB_M(%0,%2) ";"
> + "srdi %1,%0,32;"
> + "add %0,%1,%0;"
> + "srdi %1,%0,16;"
> + "add %0,%1,%0;"
> + "srdi %1,%0,8;"
> + "add %0,%1,%0;"
> + "clrldi %0,%0,64-8;"
> + stringify_in_c(FTR_SECTION_ELSE_NESTED(52))
> + PPC_POPCNTD_M(%1,%2) ";"
> + "clrldi %0,%1,64-8;"
> + stringify_in_c(ALT_FTR_SECTION_END_NESTED_IFCLR(%4,52))
> + stringify_in_c(ALT_FTR_SECTION_END_IFCLR((%3)))
> + : "=r" (iop), "=r" (tmp)
> + : "r" (iop), "i" (CPU_FTR_POPCNTB), "i" (CPU_FTR_POPCNTD)
> + : "r0", "r1", "r5", "r6", "r7", "r8", "r9",
> + "r10", "r11", "r12", "r13", "r31", "lr", "cr0", "xer");
> +
> + return iop;
> +}
> +
> #include <asm-generic/bitops/const_hweight.h>
> #else
> #include <asm-generic/bitops/hweight.h>
> diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
> index eccfc16..fc8767a 100644
> --- a/arch/powerpc/include/asm/ppc-opcode.h
> +++ b/arch/powerpc/include/asm/ppc-opcode.h
> @@ -245,6 +245,12 @@
> __PPC_RA(a) | __PPC_RS(s))
> #define PPC_POPCNTW(a, s) stringify_in_c(.long PPC_INST_POPCNTW | \
> __PPC_RA(a) | __PPC_RS(s))
> +#define PPC_POPCNTB_M(a, s) stringify_in_c(.long PPC_INST_POPCNTB | \
> + ___PPC_RA(a) | ___PPC_RS(s))
> +#define PPC_POPCNTD_M(a, s) stringify_in_c(.long PPC_INST_POPCNTD | \
> + ___PPC_RA(a) | ___PPC_RS(s))
> +#define PPC_POPCNTW_M(a, s) stringify_in_c(.long PPC_INST_POPCNTW | \
> + ___PPC_RA(a) | ___PPC_RS(s))
> #define PPC_RFCI stringify_in_c(.long PPC_INST_RFCI)
> #define PPC_RFDI stringify_in_c(.long PPC_INST_RFDI)
> #define PPC_RFMCI stringify_in_c(.long PPC_INST_RFMCI)
> diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
> index 4504332..66f553d 100644
> --- a/arch/powerpc/lib/Makefile
> +++ b/arch/powerpc/lib/Makefile
> @@ -16,7 +16,7 @@ obj-$(CONFIG_HAS_IOMEM) += devres.o
>
> obj-$(CONFIG_PPC64) += copypage_64.o copyuser_64.o \
> memcpy_64.o usercopy_64.o mem_64.o string.o \
> - checksum_wrappers_64.o hweight_64.o \
> + checksum_wrappers_64.o \
> copyuser_power7.o string_64.o copypage_power7.o \
> memcpy_power7.o
> obj-$(CONFIG_PPC_EMULATE_SSTEP) += sstep.o ldstfp.o
> diff --git a/arch/powerpc/lib/hweight_64.S b/arch/powerpc/lib/hweight_64.S
> deleted file mode 100644
> index 9b96ff2..0000000
> --- a/arch/powerpc/lib/hweight_64.S
> +++ /dev/null
> @@ -1,110 +0,0 @@
> -/*
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation; either version 2 of the License, or
> - * (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
> - *
> - * Copyright (C) IBM Corporation, 2010
> - *
> - * Author: Anton Blanchard <anton@au.ibm.com>
> - */
> -#include <asm/processor.h>
> -#include <asm/ppc_asm.h>
> -
> -/* Note: This code relies on -mminimal-toc */
> -
> -_GLOBAL(__arch_hweight8)
> -BEGIN_FTR_SECTION
> - b .__sw_hweight8
> - nop
> - nop
> -FTR_SECTION_ELSE
> - PPC_POPCNTB(R3,R3)
> - clrldi r3,r3,64-8
> - blr
> -ALT_FTR_SECTION_END_IFCLR(CPU_FTR_POPCNTB)
> -
> -_GLOBAL(__arch_hweight16)
> -BEGIN_FTR_SECTION
> - b .__sw_hweight16
> - nop
> - nop
> - nop
> - nop
> -FTR_SECTION_ELSE
> - BEGIN_FTR_SECTION_NESTED(50)
> - PPC_POPCNTB(R3,R3)
> - srdi r4,r3,8
> - add r3,r4,r3
> - clrldi r3,r3,64-8
> - blr
> - FTR_SECTION_ELSE_NESTED(50)
> - clrlwi r3,r3,16
> - PPC_POPCNTW(R3,R3)
> - clrldi r3,r3,64-8
> - blr
> - ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_POPCNTD, 50)
> -ALT_FTR_SECTION_END_IFCLR(CPU_FTR_POPCNTB)
> -
> -_GLOBAL(__arch_hweight32)
> -BEGIN_FTR_SECTION
> - b .__sw_hweight32
> - nop
> - nop
> - nop
> - nop
> - nop
> - nop
> -FTR_SECTION_ELSE
> - BEGIN_FTR_SECTION_NESTED(51)
> - PPC_POPCNTB(R3,R3)
> - srdi r4,r3,16
> - add r3,r4,r3
> - srdi r4,r3,8
> - add r3,r4,r3
> - clrldi r3,r3,64-8
> - blr
> - FTR_SECTION_ELSE_NESTED(51)
> - PPC_POPCNTW(R3,R3)
> - clrldi r3,r3,64-8
> - blr
> - ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_POPCNTD, 51)
> -ALT_FTR_SECTION_END_IFCLR(CPU_FTR_POPCNTB)
> -
> -_GLOBAL(__arch_hweight64)
> -BEGIN_FTR_SECTION
> - b .__sw_hweight64
> - nop
> - nop
> - nop
> - nop
> - nop
> - nop
> - nop
> - nop
> -FTR_SECTION_ELSE
> - BEGIN_FTR_SECTION_NESTED(52)
> - PPC_POPCNTB(R3,R3)
> - srdi r4,r3,32
> - add r3,r4,r3
> - srdi r4,r3,16
> - add r3,r4,r3
> - srdi r4,r3,8
> - add r3,r4,r3
> - clrldi r3,r3,64-8
> - blr
> - FTR_SECTION_ELSE_NESTED(52)
> - PPC_POPCNTD(R3,R3)
> - clrldi r3,r3,64-8
> - blr
> - ALT_FTR_SECTION_END_NESTED_IFCLR(CPU_FTR_POPCNTD, 52)
> -ALT_FTR_SECTION_END_IFCLR(CPU_FTR_POPCNTB)
>
^ permalink raw reply
* Re: [PATCH -next] ASoC: fsl_spdif: remove redundant dev_err call in fsl_spdif_probe()
From: Mark Brown @ 2013-08-29 12:18 UTC (permalink / raw)
To: Wei Yongjun
Cc: devicetree, alsa-devel, lgirdwood, tiwai, timur, rob.herring,
perex, yongjun_wei, grant.likely, linuxppc-dev
In-Reply-To: <CAPgLHd8kBPX2RjLJ3FeXSFpiZjvGyaUM4nmoU0wEVMM7zjfWBA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 272 bytes --]
On Thu, Aug 29, 2013 at 08:00:05AM +0800, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> There is a error message within devm_ioremap_resource
> already, so remove the dev_err call to avoid redundant
> error message.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH v12] ASoC: fsl: Add S/PDIF machine driver
From: Mark Brown @ 2013-08-29 12:15 UTC (permalink / raw)
To: Nicolin Chen
Cc: mark.rutland, devicetree, alsa-devel, lars, swarren, s.hauer,
tomasz.figa, rob.herring, p.zabel, shawn.guo, linuxppc-dev
In-Reply-To: <1377662686-31696-1-git-send-email-b42378@freescale.com>
[-- Attachment #1: Type: text/plain, Size: 245 bytes --]
On Wed, Aug 28, 2013 at 12:04:46PM +0800, Nicolin Chen wrote:
> This patch implements a device-tree-only machine driver for Freescale
> i.MX series Soc. It works with spdif_transmitter/spdif_receiver and
> fsl_spdif.c drivers.
Applied, thanks.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [RFC PATCH v2 3/4] powerpc: refactor of_get_cpu_node to support other architectures
From: Lorenzo Pieralisi @ 2013-08-29 9:50 UTC (permalink / raw)
To: Grant Likely
Cc: Mark Rutland, devicetree@vger.kernel.org, Michal Simek,
Jonas Bonn, linux-pm@vger.kernel.org, Sudeep KarkadaNagesha,
Tomasz Figa, rob.herring@calxeda.com,
linux-kernel@vger.kernel.org, Rafael J. Wysocki, Rob Herring,
linuxppc-dev@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org
In-Reply-To: <20130828194638.AB78E3E0A6F@localhost>
On Wed, Aug 28, 2013 at 08:46:38PM +0100, Grant Likely wrote:
> On Thu, 22 Aug 2013 14:59:30 +0100, Mark Rutland <mark.rutland@arm.com> w=
rote:
> > On Mon, Aug 19, 2013 at 02:56:10PM +0100, Sudeep KarkadaNagesha wrote:
> > > On 19/08/13 14:02, Rob Herring wrote:
> > > > On 08/19/2013 05:19 AM, Mark Rutland wrote:
> > > >> On Sat, Aug 17, 2013 at 11:09:36PM +0100, Benjamin Herrenschmidt w=
rote:
> > > >>> On Sat, 2013-08-17 at 12:50 +0200, Tomasz Figa wrote:
> > > >>>> I wonder how would this handle uniprocessor ARM (pre-v7) cores, =
for
> > > >>>> which=20
> > > >>>> the updated bindings[1] define #address-cells =3D <0> and so no =
reg=20
> > > >>>> property.
> > > >>>>
> > > >>>> [1] - http://thread.gmane.org/gmane.linux.ports.arm.kernel/26079=
5
> > > >>>
> > > >>> Why did you do that in the binding ? That sounds like looking to =
create
> > > >>> problems ...=20
> > > >>>
> > > >>> Traditionally, UP setups just used "0" as the "reg" property on o=
ther
> > > >>> architectures, why do differently ?
> > > >>
> > > >> The decision was taken because we defined our reg property to refe=
r to
> > > >> the MPIDR register's Aff{2,1,0} bitfields, and on UP cores before =
v7
> > > >> there's no MPIDR register at all. Given there can only be a single=
CPU
> > > >> in that case, describing a register that wasn't present didn't see=
m
> > > >> necessary or helpful.
> > > >=20
> > > > What exactly reg represents is up to the binding definition, but it
> > > > still should be present IMO. I don't see any issue with it being
> > > > different for pre-v7.
> > > >=20
> > > Yes it's better to have 'reg' with value 0 than not having it.
> > > Otherwise this generic of_get_cpu_node implementation would need some
> > > _hack_ to handle that case.
> >=20
> > I'm not sure that having some code to handle a difference in standard
> > between two architectures is a hack. If anything, I'd argue encoding a
> > reg of 0 that corresponds to a nonexistent MPIDR value (given that's
> > what the reg property is defined to map to on ARM) is more of a hack ;)
> >=20
> > I'm not averse to having a reg value of 0 for this case, but given that
> > there are existing devicetrees without it, requiring a reg property wil=
l
> > break compatibility with them.
>=20
> Then special cases those device trees, but you changing existing
> convention really needs to be avoided. The referenced documentation
> change is brand new, so we're not stuck with it.
I have no problem with changing the bindings and forcing:
#address-cells =3D <1>;
reg =3D <0>;
for UP predating v7, my big worry is related to in-kernel dts that we
already patched to follow the #address-cells =3D <0> rule (and we had to
do it since we got asked that question multiple times on the public
lists).
What do you mean by "special case those device trees" ? I have not
planned to patch them again, unless we really consider that a necessary
evil.
Thanks,
Lorenzo
^ permalink raw reply
* [PATCH] powerpc/scom: Use "devspec" rather than "path" in debugfs entries
From: Benjamin Herrenschmidt @ 2013-08-29 7:25 UTC (permalink / raw)
To: linuxppc-dev
This is the traditional name for device-tree path, used in sysfs,
do the same for the XSCOM debugfs files.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
arch/powerpc/sysdev/scom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/sysdev/scom.c b/arch/powerpc/sysdev/scom.c
index cb20d54..3963d99 100644
--- a/arch/powerpc/sysdev/scom.c
+++ b/arch/powerpc/sysdev/scom.c
@@ -180,7 +180,7 @@ static int scom_debug_init_one(struct dentry *root, struct device_node *dn,
debugfs_create_file("addr", 0600, dir, ent, &scom_addr_fops);
debugfs_create_file("value", 0600, dir, ent, &scom_val_fops);
- debugfs_create_blob("path", 0400, dir, &ent->blob);
+ debugfs_create_blob("devspec", 0400, dir, &ent->blob);
return 0;
}
^ permalink raw reply related
* [PATCH] powerpc/scom: CONFIG_SCOM_DEBUGFS should depend on CONFIG_DEBUG_FS
From: Benjamin Herrenschmidt @ 2013-08-29 6:58 UTC (permalink / raw)
To: linuxppc-dev
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
arch/powerpc/sysdev/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/sysdev/Kconfig b/arch/powerpc/sysdev/Kconfig
index ab4cb54..13ec968 100644
--- a/arch/powerpc/sysdev/Kconfig
+++ b/arch/powerpc/sysdev/Kconfig
@@ -28,7 +28,7 @@ config PPC_SCOM
config SCOM_DEBUGFS
bool "Expose SCOM controllers via debugfs"
- depends on PPC_SCOM
+ depends on PPC_SCOM && DEBUG_FS
default n
config GE_FPGA
^ permalink raw reply related
* [PATCH] powerpc/powernv: Add scom support under OPALv3
From: Benjamin Herrenschmidt @ 2013-08-29 6:57 UTC (permalink / raw)
To: linuxppc-dev
OPAL v3 provides interfaces to access the chips XSCOM, expose
this via the existing scom infrastructure.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
arch/powerpc/platforms/powernv/Kconfig | 1 +
arch/powerpc/platforms/powernv/Makefile | 1 +
arch/powerpc/platforms/powernv/opal-xscom.c | 105 ++++++++++++++++++++++++++++
3 files changed, 107 insertions(+)
create mode 100644 arch/powerpc/platforms/powernv/opal-xscom.c
diff --git a/arch/powerpc/platforms/powernv/Kconfig b/arch/powerpc/platforms/powernv/Kconfig
index 6fae5eb..7f39da0 100644
--- a/arch/powerpc/platforms/powernv/Kconfig
+++ b/arch/powerpc/platforms/powernv/Kconfig
@@ -9,6 +9,7 @@ config PPC_POWERNV
select EPAPR_BOOT
select PPC_INDIRECT_PIO
select PPC_UDBG_16550
+ select PPC_SCOM
default y
config POWERNV_MSI
diff --git a/arch/powerpc/platforms/powernv/Makefile b/arch/powerpc/platforms/powernv/Makefile
index 300c437..02dc1f5 100644
--- a/arch/powerpc/platforms/powernv/Makefile
+++ b/arch/powerpc/platforms/powernv/Makefile
@@ -4,3 +4,4 @@ obj-y += opal-rtc.o opal-nvram.o opal-lpc.o
obj-$(CONFIG_SMP) += smp.o
obj-$(CONFIG_PCI) += pci.o pci-p5ioc2.o pci-ioda.o
obj-$(CONFIG_EEH) += eeh-ioda.o eeh-powernv.o
+obj-$(CONFIG_PPC_SCOM) += opal-xscom.o
diff --git a/arch/powerpc/platforms/powernv/opal-xscom.c b/arch/powerpc/platforms/powernv/opal-xscom.c
new file mode 100644
index 0000000..3ed5c64
--- /dev/null
+++ b/arch/powerpc/platforms/powernv/opal-xscom.c
@@ -0,0 +1,105 @@
+/*
+ * PowerNV LPC bus handling.
+ *
+ * Copyright 2013 IBM Corp.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include <linux/kernel.h>
+#include <linux/of.h>
+#include <linux/bug.h>
+#include <linux/gfp.h>
+#include <linux/slab.h>
+
+#include <asm/machdep.h>
+#include <asm/firmware.h>
+#include <asm/opal.h>
+#include <asm/scom.h>
+
+/*
+ * We could probably fit that inside the scom_map_t
+ * which is a void* after all but it's really too ugly
+ * so let's kmalloc it for now
+ */
+struct opal_scom_map {
+ uint32_t chip;
+ uint32_t addr;
+};
+
+static scom_map_t opal_scom_map(struct device_node *dev, u64 reg, u64 count)
+{
+ struct opal_scom_map *m;
+ const __be32 *gcid;
+
+ if (!of_get_property(dev, "scom-controller", NULL)) {
+ pr_err("%s: device %s is not a SCOM controller\n",
+ __func__, dev->full_name);
+ return SCOM_MAP_INVALID;
+ }
+ gcid = of_get_property(dev, "ibm,chip-id", NULL);
+ if (!gcid) {
+ pr_err("%s: device %s has no ibm,chip-id\n",
+ __func__, dev->full_name);
+ return SCOM_MAP_INVALID;
+ }
+ m = kmalloc(sizeof(struct opal_scom_map), GFP_KERNEL);
+ if (!m)
+ return NULL;
+ m->chip = be32_to_cpup(gcid);
+ m->addr = reg;
+
+ return (scom_map_t)m;
+}
+
+static void opal_scom_unmap(scom_map_t map)
+{
+ kfree(map);
+}
+
+static int opal_xscom_err_xlate(int64_t rc)
+{
+ switch(rc) {
+ case 0:
+ return 0;
+ /* Add more translations if necessary */
+ default:
+ return -EIO;
+ }
+}
+
+static int opal_scom_read(scom_map_t map, u32 reg, u64 *value)
+{
+ struct opal_scom_map *m = map;
+ int64_t rc;
+
+ rc = opal_xscom_read(m->chip, m->addr + reg, (uint64_t *)__pa(value));
+ return opal_xscom_err_xlate(rc);
+}
+
+static int opal_scom_write(scom_map_t map, u32 reg, u64 value)
+{
+ struct opal_scom_map *m = map;
+ int64_t rc;
+
+ rc = opal_xscom_write(m->chip, m->addr + reg, value);
+ return opal_xscom_err_xlate(rc);
+}
+
+static const struct scom_controller opal_scom_controller = {
+ .map = opal_scom_map,
+ .unmap = opal_scom_unmap,
+ .read = opal_scom_read,
+ .write = opal_scom_write
+};
+
+static int opal_xscom_init(void)
+{
+ if (firmware_has_feature(FW_FEATURE_OPALv3))
+ scom_init(&opal_scom_controller);
+ return 0;
+}
+arch_initcall(opal_xscom_init);
^ permalink raw reply related
* [PATCH] powerpc/scom: Create debugfs files using ibm,chip-id if available
From: Benjamin Herrenschmidt @ 2013-08-29 6:56 UTC (permalink / raw)
To: linuxppc-dev
When creating the debugfs scom files, use "ibm,chip-id" as the scom%d
index rather than a simple made up number when possible.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
arch/powerpc/sysdev/scom.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/sysdev/scom.c b/arch/powerpc/sysdev/scom.c
index 413622d..cb20d54 100644
--- a/arch/powerpc/sysdev/scom.c
+++ b/arch/powerpc/sysdev/scom.c
@@ -196,8 +196,13 @@ static int scom_debug_init(void)
return -1;
i = rc = 0;
- for_each_node_with_property(dn, "scom-controller")
- rc |= scom_debug_init_one(root, dn, i++);
+ for_each_node_with_property(dn, "scom-controller") {
+ int id = of_get_ibm_chip_id(dn);
+ if (id == -1)
+ id = i;
+ rc |= scom_debug_init_one(root, dn, id);
+ i++;
+ }
return rc;
}
^ permalink raw reply related
* [PATCH] powerpc/scom: Add support for "reg" property
From: Benjamin Herrenschmidt @ 2013-08-29 6:56 UTC (permalink / raw)
To: linuxppc-dev
When devices are direct children of a scom controller node, they
should be able to use the normal "reg" property instead of "scom-reg".
In that case, they also use #address-cells rather than #scom-cells
to indicate the size of an entry.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
arch/powerpc/sysdev/scom.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/sysdev/scom.c b/arch/powerpc/sysdev/scom.c
index 10f1d9e..413622d 100644
--- a/arch/powerpc/sysdev/scom.c
+++ b/arch/powerpc/sysdev/scom.c
@@ -53,7 +53,7 @@ scom_map_t scom_map_device(struct device_node *dev, int index)
{
struct device_node *parent;
unsigned int cells, size;
- const u32 *prop;
+ const __be32 *prop, *sprop;
u64 reg, cnt;
scom_map_t ret;
@@ -62,12 +62,24 @@ scom_map_t scom_map_device(struct device_node *dev, int index)
if (parent == NULL)
return 0;
- prop = of_get_property(parent, "#scom-cells", NULL);
- cells = prop ? *prop : 1;
-
+ /*
+ * We support "scom-reg" properties for adding scom registers
+ * to a random device-tree node with an explicit scom-parent
+ *
+ * We also support the simple "reg" property if the device is
+ * a direct child of a scom controller.
+ *
+ * In case both exist, "scom-reg" takes precedence.
+ */
prop = of_get_property(dev, "scom-reg", &size);
+ sprop = of_get_property(parent, "#scom-cells", NULL);
+ if (!prop && parent == dev->parent) {
+ prop = of_get_property(dev, "reg", &size);
+ sprop = of_get_property(parent, "#address-cells", NULL);
+ }
if (!prop)
- return 0;
+ return NULL;
+ cells = sprop ? be32_to_cpup(sprop) : 1;
size >>= 2;
if (index >= (size / (2*cells)))
^ permalink raw reply related
* [PATCH] powerpc/scom: Change scom_read() and scom_write() to return errors
From: Benjamin Herrenschmidt @ 2013-08-29 6:55 UTC (permalink / raw)
To: linuxppc-dev
scom_read() now returns the read value via a pointer argument and
both functions return an int error code
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
arch/powerpc/include/asm/scom.h | 23 +++++++++++++++++------
arch/powerpc/platforms/wsp/scom_smp.c | 18 +++++++++++++-----
arch/powerpc/platforms/wsp/scom_wsp.c | 12 ++++++++----
arch/powerpc/platforms/wsp/wsp.c | 13 +++++++------
arch/powerpc/sysdev/scom.c | 3 +--
5 files changed, 46 insertions(+), 23 deletions(-)
diff --git a/arch/powerpc/include/asm/scom.h b/arch/powerpc/include/asm/scom.h
index 0cabfd7..07dcdcf 100644
--- a/arch/powerpc/include/asm/scom.h
+++ b/arch/powerpc/include/asm/scom.h
@@ -54,8 +54,8 @@ struct scom_controller {
scom_map_t (*map)(struct device_node *ctrl_dev, u64 reg, u64 count);
void (*unmap)(scom_map_t map);
- u64 (*read)(scom_map_t map, u32 reg);
- void (*write)(scom_map_t map, u32 reg, u64 value);
+ int (*read)(scom_map_t map, u32 reg, u64 *value);
+ int (*write)(scom_map_t map, u32 reg, u64 value);
};
extern const struct scom_controller *scom_controller;
@@ -133,10 +133,18 @@ static inline void scom_unmap(scom_map_t map)
* scom_read - Read a SCOM register
* @map: Result of scom_map
* @reg: Register index within that map
+ * @value: Updated with the value read
+ *
+ * Returns 0 (success) or a negative error code
*/
-static inline u64 scom_read(scom_map_t map, u32 reg)
+static inline int scom_read(scom_map_t map, u32 reg, u64 *value)
{
- return scom_controller->read(map, reg);
+ int rc;
+
+ rc = scom_controller->read(map, reg, value);
+ if (rc)
+ *value = 0xfffffffffffffffful;
+ return rc;
}
/**
@@ -144,12 +152,15 @@ static inline u64 scom_read(scom_map_t map, u32 reg)
* @map: Result of scom_map
* @reg: Register index within that map
* @value: Value to write
+ *
+ * Returns 0 (success) or a negative error code
*/
-static inline void scom_write(scom_map_t map, u32 reg, u64 value)
+static inline int scom_write(scom_map_t map, u32 reg, u64 value)
{
- scom_controller->write(map, reg, value);
+ return scom_controller->write(map, reg, value);
}
+
#endif /* CONFIG_PPC_SCOM */
#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
diff --git a/arch/powerpc/platforms/wsp/scom_smp.c b/arch/powerpc/platforms/wsp/scom_smp.c
index b56b70a..268bc89 100644
--- a/arch/powerpc/platforms/wsp/scom_smp.c
+++ b/arch/powerpc/platforms/wsp/scom_smp.c
@@ -116,7 +116,14 @@ static int a2_scom_ram(scom_map_t scom, int thread, u32 insn, int extmask)
scom_write(scom, SCOM_RAMIC, cmd);
- while (!((val = scom_read(scom, SCOM_RAMC)) & mask)) {
+ for (;;) {
+ if (scom_read(scom, SCOM_RAMC, &val) != 0) {
+ pr_err("SCOM error on instruction 0x%08x, thread %d\n",
+ insn, thread);
+ return -1;
+ }
+ if (val & mask)
+ break;
pr_devel("Waiting on RAMC = 0x%llx\n", val);
if (++n == 3) {
pr_err("RAMC timeout on instruction 0x%08x, thread %d\n",
@@ -151,9 +158,7 @@ static int a2_scom_getgpr(scom_map_t scom, int thread, int gpr, int alt,
if (rc)
return rc;
- *out_gpr = scom_read(scom, SCOM_RAMD);
-
- return 0;
+ return scom_read(scom, SCOM_RAMD, out_gpr);
}
static int a2_scom_getspr(scom_map_t scom, int thread, int spr, u64 *out_spr)
@@ -353,7 +358,10 @@ int a2_scom_startup_cpu(unsigned int lcpu, int thr_idx, struct device_node *np)
pr_devel("Bringing up CPU%d using SCOM...\n", lcpu);
- pccr0 = scom_read(scom, SCOM_PCCR0);
+ if (scom_read(scom, SCOM_PCCR0, &pccr0) != 0) {
+ printk(KERN_ERR "XSCOM failure readng PCCR0 on CPU%d\n", lcpu);
+ return -1;
+ }
scom_write(scom, SCOM_PCCR0, pccr0 | SCOM_PCCR0_ENABLE_DEBUG |
SCOM_PCCR0_ENABLE_RAM);
diff --git a/arch/powerpc/platforms/wsp/scom_wsp.c b/arch/powerpc/platforms/wsp/scom_wsp.c
index 4052e22..54172c4 100644
--- a/arch/powerpc/platforms/wsp/scom_wsp.c
+++ b/arch/powerpc/platforms/wsp/scom_wsp.c
@@ -50,18 +50,22 @@ static void wsp_scom_unmap(scom_map_t map)
iounmap((void *)map);
}
-static u64 wsp_scom_read(scom_map_t map, u32 reg)
+static int wsp_scom_read(scom_map_t map, u32 reg, u64 *value)
{
u64 __iomem *addr = (u64 __iomem *)map;
- return in_be64(addr + reg);
+ *value = in_be64(addr + reg);
+
+ return 0;
}
-static void wsp_scom_write(scom_map_t map, u32 reg, u64 value)
+static int wsp_scom_write(scom_map_t map, u32 reg, u64 value)
{
u64 __iomem *addr = (u64 __iomem *)map;
- return out_be64(addr + reg, value);
+ out_be64(addr + reg, value);
+
+ return 0;
}
static const struct scom_controller wsp_scom_controller = {
diff --git a/arch/powerpc/platforms/wsp/wsp.c b/arch/powerpc/platforms/wsp/wsp.c
index d25cc96..ddb6efe 100644
--- a/arch/powerpc/platforms/wsp/wsp.c
+++ b/arch/powerpc/platforms/wsp/wsp.c
@@ -89,6 +89,7 @@ void wsp_halt(void)
struct device_node *dn;
struct device_node *mine;
struct device_node *me;
+ int rc;
me = of_get_cpu_node(smp_processor_id(), NULL);
mine = scom_find_parent(me);
@@ -101,15 +102,15 @@ void wsp_halt(void)
/* read-modify-write it so the HW probe does not get
* confused */
- val = scom_read(m, 0);
- val |= 1;
- scom_write(m, 0, val);
+ rc = scom_read(m, 0, &val);
+ if (rc == 0)
+ scom_write(m, 0, val | 1);
scom_unmap(m);
}
m = scom_map(mine, 0, 1);
- val = scom_read(m, 0);
- val |= 1;
- scom_write(m, 0, val);
+ rc = scom_read(m, 0, &val);
+ if (rc == 0)
+ scom_write(m, 0, val | 1);
/* should never return */
scom_unmap(m);
}
diff --git a/arch/powerpc/sysdev/scom.c b/arch/powerpc/sysdev/scom.c
index 9193e12..10f1d9e 100644
--- a/arch/powerpc/sysdev/scom.c
+++ b/arch/powerpc/sysdev/scom.c
@@ -137,8 +137,7 @@ static int scom_val_get(void *data, u64 *val)
if (!scom_map_ok(ent->map))
return -EFAULT;
- *val = scom_read(ent->map, 0);
- return 0;
+ return scom_read(ent->map, 0, val);
}
DEFINE_SIMPLE_ATTRIBUTE(scom_val_fops, scom_val_get, scom_val_set,
"0x%llx\n");
^ permalink raw reply related
* [PATCH] powerpc: Enable /dev/port when isa_io_special is set
From: Benjamin Herrenschmidt @ 2013-08-29 6:55 UTC (permalink / raw)
To: linuxppc-dev
isa_io_special is set when the platform provides a "special"
implementation of inX/outX via some FW interface for example.
Such a platform doesn't need an ISA bridge on PCI, and so /dev/port
should be made available even if one isn't present.
This makes the LPC bus IOs accessible via /dev/port on PowerNV Power8
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
arch/powerpc/include/asm/io.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index 5a64757..edcc209 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -21,7 +21,7 @@ extern struct pci_dev *isa_bridge_pcidev;
/*
* has legacy ISA devices ?
*/
-#define arch_has_dev_port() (isa_bridge_pcidev != NULL)
+#define arch_has_dev_port() (isa_bridge_pcidev != NULL || isa_io_special)
#endif
#include <linux/device.h>
^ permalink raw reply related
* Re: [PATCH 03/10] crypto: nx - fix limits to sg lists for AES-CBC
From: Herbert Xu @ 2013-08-29 4:42 UTC (permalink / raw)
To: Marcelo Cerri; +Cc: linuxppc-dev, linux-kernel, linux-crypto
In-Reply-To: <1377288074-18998-4-git-send-email-mhcerri@linux.vnet.ibm.com>
On Fri, Aug 23, 2013 at 05:01:07PM -0300, Marcelo Cerri wrote:
> This patch updates the nx-aes-cbc implementation to perform several
> hyper calls if needed in order to always respect the length limits for
> scatter/gather lists.
>
> Two different limits are considered:
>
> - "ibm,max-sg-len": maximum number of bytes of each scatter/gather
> list.
>
> - "ibm,max-sync-cop":
> - The total number of bytes that a scatter/gather list can hold.
> - The maximum number of elements that a scatter/gather list can have.
>
> Reviewed-by: Joy Latten <jmlatten@linux.vnet.ibm.com>
> Signed-off-by: Marcelo Cerri <mhcerri@linux.vnet.ibm.com>
This patch does not apply against the current cryptodev tree.
Please regenerate your pathces.
Thanks,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* [PATCH] Powerpc/eSDCH: Specify voltage for T4240QDS
From: Haijun Zhang @ 2013-08-29 3:31 UTC (permalink / raw)
To: linuxppc-dev, galak; +Cc: scottwood, Haijun Zhang, X.Xie
Freescale T4240QDS reference board has extra voltage shifters added
to allow 3.3V operation, so add 3.3v voltage support for T4240QDS.
1.8v and 3.3v is recommand for eMMC and SDHC card.
Signed-off-by: Haijun Zhang <haijun.zhang@freescale.com>
---
arch/powerpc/boot/dts/t4240qds.dts | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/powerpc/boot/dts/t4240qds.dts b/arch/powerpc/boot/dts/t4240qds.dts
index 0555976..eb3c3de 100644
--- a/arch/powerpc/boot/dts/t4240qds.dts
+++ b/arch/powerpc/boot/dts/t4240qds.dts
@@ -148,6 +148,10 @@
interrupts = <0x1 0x1 0 0>;
};
};
+
+ sdhc@114000 {
+ voltage-ranges = <1800 1800 3300 3300>;
+ };
};
pci0: pcie@ffe240000 {
--
1.8.0
^ permalink raw reply related
* Re: [PATCH v8 2/3] DMA: Freescale: Add new 8-channel DMA engine device tree nodes
From: Hongbo Zhang @ 2013-08-29 2:46 UTC (permalink / raw)
To: Mark Rutland
Cc: devicetree@vger.kernel.org, ian.campbell@citrix.com, Pawel Moll,
swarren@wwwdotorg.org, vinod.koul@intel.com,
linux-kernel@vger.kernel.org, rob.herring@calxeda.com,
djbw@fb.com, linuxppc-dev@lists.ozlabs.org
In-Reply-To: <20130828125153.GC10250@e106331-lin.cambridge.arm.com>
On 08/28/2013 08:51 PM, Mark Rutland wrote:
> On Wed, Aug 28, 2013 at 07:54:01AM +0100, Hongbo Zhang wrote:
>> On 08/27/2013 07:35 PM, Mark Rutland wrote:
>>> On Tue, Aug 27, 2013 at 11:42:02AM +0100, hongbo.zhang@freescale.com wrote:
>>>> From: Hongbo Zhang <hongbo.zhang@freescale.com>
>>>>
>>>> Freescale QorIQ T4 and B4 introduce new 8-channel DMA engines, this patch adds
>>>> the device tree nodes for them.
>>>>
>>>> Signed-off-by: Hongbo Zhang <hongbo.zhang@freescale.com>
>>>> ---
>>>> .../devicetree/bindings/powerpc/fsl/dma.txt | 66 ++++++++++++++++
>>>> arch/powerpc/boot/dts/fsl/b4si-post.dtsi | 4 +-
>>>> arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi | 81 ++++++++++++++++++++
>>>> arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi | 81 ++++++++++++++++++++
>>>> arch/powerpc/boot/dts/fsl/t4240si-post.dtsi | 4 +-
>>>> 5 files changed, 232 insertions(+), 4 deletions(-)
>>>> create mode 100644 arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi
>>>> create mode 100644 arch/powerpc/boot/dts/fsl/elo3-dma-1.dtsi
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/powerpc/fsl/dma.txt b/Documentation/devicetree/bindings/powerpc/fsl/dma.txt
>>>> index ddf17af..10fd031 100644
>>>> --- a/Documentation/devicetree/bindings/powerpc/fsl/dma.txt
>>>> +++ b/Documentation/devicetree/bindings/powerpc/fsl/dma.txt
>>>> @@ -126,6 +126,72 @@ Example:
>>>> };
>>>> };
>>>>
>>>> +** Freescale Elo3 DMA Controller
>>>> + This is EloPlus controller with 8 channels, used in Freescale Txxx and Bxxx
>>>> + series chips, such as t1040, t4240, b4860.
>>>> +
>>>> +Required properties:
>>>> +
>>>> +- compatible : must include "fsl,elo3-dma"
>>>> +- reg : <registers specifier for DMA general status reg>
>>>> +- ranges : describes the mapping between the address space of the
>>>> + DMA channels and the address space of the DMA controller
>>>> +
>>>> +- DMA channel nodes:
>>>> + - compatible : must include "fsl,eloplus-dma-channel"
>>>> + - reg : <registers specifier for channel>
>>>> + - interrupts : <interrupt specifier for DMA channel IRQ>
>>>> + - interrupt-parent : optional, if needed for interrupt mapping
>>>> +
>>>> +Example:
>>>> +dma@100300 {
>>>> + #address-cells = <1>;
>>>> + #size-cells = <1>;
>>>> + compatible = "fsl,elo3-dma";
>>>> + reg = <0x100300 0x4 0x100600 0x4>;
>>> Is that one reg entry where #size-cells=2 and #address-cells=2?
>>>
>>> That's what the binding implies (given it only describes a single reg
>>> entry).
>>>
>>> if it's two entries, we should make that explicit (both in the binding
>>> and example):
>>>
>>> reg = <0x100300 0x4>,
>>> <0x100600 0x4>;
>> Yes they are two entries, I will change it this way.
> Ok. Could you make sure you document what the two reg entries correspond
> to? That's not clear from "<registers specifier for channel>".
Yes I am sure, we have reg for DMA controller and also reg for each DMA
channel.
these two reg entries are "registers specifier for DMA general status
reg", not "registers specifier for channel"
because this is an 8-channel DMA controller, we have two general status
registers (vs. one status register for 4-chanel DMA controller previously )
>>>> + ranges = <0x0 0x100100 0x500>;
>>> If it is one reg entry then the example ranges property isn't big enough
>>> to contain the parent-bus-address.
>> They are two reg entries, so the range is big enough.
> Ok.
>
>>>> + dma-channel@0 {
>>>> + compatible = "fsl,eloplus-dma-channel";
>>>> + reg = <0x0 0x80>;
>>>> + interrupts = <28 2 0 0>;
>>>> + };
>>>> + dma-channel@80 {
>>>> + compatible = "fsl,eloplus-dma-channel";
>>>> + reg = <0x80 0x80>;
>>>> + interrupts = <29 2 0 0>;
>>>> + };
>>>> + dma-channel@100 {
>>>> + compatible = "fsl,eloplus-dma-channel";
>>>> + reg = <0x100 0x80>;
>>>> + interrupts = <30 2 0 0>;
>>>> + };
>>>> + dma-channel@180 {
>>>> + compatible = "fsl,eloplus-dma-channel";
>>>> + reg = <0x180 0x80>;
>>>> + interrupts = <31 2 0 0>;
>>>> + };
>>>> + dma-channel@300 {
>>>> + compatible = "fsl,eloplus-dma-channel";
>>>> + reg = <0x300 0x80>;
>>>> + interrupts = <76 2 0 0>;
>>>> + };
>>>> + dma-channel@380 {
>>>> + compatible = "fsl,eloplus-dma-channel";
>>>> + reg = <0x380 0x80>;
>>>> + interrupts = <77 2 0 0>;
>>>> + };
>>>> + dma-channel@400 {
>>>> + compatible = "fsl,eloplus-dma-channel";
>>>> + reg = <0x400 0x80>;
>>>> + interrupts = <78 2 0 0>;
>>>> + };
>>>> + dma-channel@480 {
>>>> + compatible = "fsl,eloplus-dma-channel";
>>>> + reg = <0x480 0x80>;
>>>> + interrupts = <79 2 0 0>;
>>>> + };
>>>> +};
>>>> +
>>>> Note on DMA channel compatible properties: The compatible property must say
>>>> "fsl,elo-dma-channel" or "fsl,eloplus-dma-channel" to be used by the Elo DMA
>>>> driver (fsldma). Any DMA channel used by fsldma cannot be used by another
>>>> diff --git a/arch/powerpc/boot/dts/fsl/b4si-post.dtsi b/arch/powerpc/boot/dts/fsl/b4si-post.dtsi
>>>> index 7399154..ea53ea1 100644
>>>> --- a/arch/powerpc/boot/dts/fsl/b4si-post.dtsi
>>>> +++ b/arch/powerpc/boot/dts/fsl/b4si-post.dtsi
>>>> @@ -223,13 +223,13 @@
>>>> reg = <0xe2000 0x1000>;
>>>> };
>>>>
>>>> -/include/ "qoriq-dma-0.dtsi"
>>>> +/include/ "elo3-dma-0.dtsi"
>>>> dma@100300 {
>>>> fsl,iommu-parent = <&pamu0>;
>>>> fsl,liodn-reg = <&guts 0x580>; /* DMA1LIODNR */
>>>> };
>>>>
>>>> -/include/ "qoriq-dma-1.dtsi"
>>>> +/include/ "elo3-dma-1.dtsi"
>>>> dma@101300 {
>>>> fsl,iommu-parent = <&pamu0>;
>>>> fsl,liodn-reg = <&guts 0x584>; /* DMA2LIODNR */
>>>> diff --git a/arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi b/arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi
>>>> new file mode 100644
>>>> index 0000000..69a3277
>>>> --- /dev/null
>>>> +++ b/arch/powerpc/boot/dts/fsl/elo3-dma-0.dtsi
>>>> @@ -0,0 +1,81 @@
>>>> +/*
>>>> + * QorIQ DMA device tree stub [ controller @ offset 0x100000 ]
>>> Copy-pasted?
>>>
>>> Presumably should be "Elo3 DMA devicetree stub", or similar?
>>>
>>> Similarly for elo3-dma-1.dtsi.
>> Yes copy-pasted, but QorIQ isn't wrong, it is name of Freescale series
>> chips.
>> To be more specific, I'd like to use "QorIQ Elo3 DMA devicetree stub"
> That sounds good to me.
>
> Cheers,
> Mark.
>
^ permalink raw reply
* [PATCH -next] ASoC: fsl_spdif: remove redundant dev_err call in fsl_spdif_probe()
From: Wei Yongjun @ 2013-08-29 0:00 UTC (permalink / raw)
To: timur, lgirdwood, broonie, perex, tiwai, grant.likely,
rob.herring
Cc: devicetree, yongjun_wei, linuxppc-dev, alsa-devel
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
There is a error message within devm_ioremap_resource
already, so remove the dev_err call to avoid redundant
error message.
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
sound/soc/fsl/fsl_spdif.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c
index a9798aa..e93dc0d 100644
--- a/sound/soc/fsl/fsl_spdif.c
+++ b/sound/soc/fsl/fsl_spdif.c
@@ -1113,10 +1113,8 @@ static int fsl_spdif_probe(struct platform_device *pdev)
}
regs = devm_ioremap_resource(&pdev->dev, res);
- if (IS_ERR(regs)) {
- dev_err(&pdev->dev, "could not map device resources\n");
+ if (IS_ERR(regs))
return PTR_ERR(regs);
- }
spdif_priv->regmap = devm_regmap_init_mmio_clk(&pdev->dev,
"core", regs, &fsl_spdif_regmap_config);
^ permalink raw reply related
* Re: [PATCH v4 09/31] powerpc/fsl-pci: improve clock API use
From: Benjamin Herrenschmidt @ 2013-08-28 22:10 UTC (permalink / raw)
To: Gerhard Sittig
Cc: Paul Mackerras, Anatolij Gustschin, linuxppc-dev,
linux-arm-kernel
In-Reply-To: <20130828155944.GA30987@book.gsilab.sittig.org>
On Wed, 2013-08-28 at 17:59 +0200, Gerhard Sittig wrote:
> On Wed, Aug 28, 2013 at 14:08 +0200, Gerhard Sittig wrote:
> >
> > [ re-created the Cc: list, this is about the PCI clock exclusively ]
>
> I just noticed by coincidence that the message which I received
> back from the linuxppc-dev ML appeared to have dropped Benjamin
> Herrenschmidt and Kumar Gala from the Cc: list -- while they do
> appear in the header of the message that I have sent and I can't
> see what might have caused the loss of information. :-O
Don't bother with me. I haven't had the bandwidth to look at that
at all. I'll leave Anatolij the responsibility here :-)
Cheers,
Ben.
> Do you want me to re-send the message for the benefit of
> potential followups, or is it OK that you receive the message via
> the list but potentially without the Cc: attribute?
>
> The message was mostly "for your information" and contained a
> status update, while no action is required or problems need to
> get resolved.
>
>
> virtually yours
> Gerhard Sittig
^ permalink raw reply
* Re: [RFC PATCH v2 3/4] powerpc: refactor of_get_cpu_node to support other architectures
From: Grant Likely @ 2013-08-28 19:46 UTC (permalink / raw)
To: Mark Rutland, Sudeep KarkadaNagesha
Cc: Jonas Bonn, devicetree@vger.kernel.org, Michal Simek,
Lorenzo Pieralisi, linux-pm@vger.kernel.org, Tomasz Figa,
rob.herring@calxeda.com, linux-kernel@vger.kernel.org,
Rafael J. Wysocki, Rob Herring, linuxppc-dev@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org
In-Reply-To: <20130822135930.GC23152@e106331-lin.cambridge.arm.com>
On Thu, 22 Aug 2013 14:59:30 +0100, Mark Rutland <mark.rutland@arm.com> wrote:
> On Mon, Aug 19, 2013 at 02:56:10PM +0100, Sudeep KarkadaNagesha wrote:
> > On 19/08/13 14:02, Rob Herring wrote:
> > > On 08/19/2013 05:19 AM, Mark Rutland wrote:
> > >> On Sat, Aug 17, 2013 at 11:09:36PM +0100, Benjamin Herrenschmidt wrote:
> > >>> On Sat, 2013-08-17 at 12:50 +0200, Tomasz Figa wrote:
> > >>>> I wonder how would this handle uniprocessor ARM (pre-v7) cores, for
> > >>>> which
> > >>>> the updated bindings[1] define #address-cells = <0> and so no reg
> > >>>> property.
> > >>>>
> > >>>> [1] - http://thread.gmane.org/gmane.linux.ports.arm.kernel/260795
> > >>>
> > >>> Why did you do that in the binding ? That sounds like looking to create
> > >>> problems ...
> > >>>
> > >>> Traditionally, UP setups just used "0" as the "reg" property on other
> > >>> architectures, why do differently ?
> > >>
> > >> The decision was taken because we defined our reg property to refer to
> > >> the MPIDR register's Aff{2,1,0} bitfields, and on UP cores before v7
> > >> there's no MPIDR register at all. Given there can only be a single CPU
> > >> in that case, describing a register that wasn't present didn't seem
> > >> necessary or helpful.
> > >
> > > What exactly reg represents is up to the binding definition, but it
> > > still should be present IMO. I don't see any issue with it being
> > > different for pre-v7.
> > >
> > Yes it's better to have 'reg' with value 0 than not having it.
> > Otherwise this generic of_get_cpu_node implementation would need some
> > _hack_ to handle that case.
>
> I'm not sure that having some code to handle a difference in standard
> between two architectures is a hack. If anything, I'd argue encoding a
> reg of 0 that corresponds to a nonexistent MPIDR value (given that's
> what the reg property is defined to map to on ARM) is more of a hack ;)
>
> I'm not averse to having a reg value of 0 for this case, but given that
> there are existing devicetrees without it, requiring a reg property will
> break compatibility with them.
Then special cases those device trees, but you changing existing
convention really needs to be avoided. The referenced documentation
change is brand new, so we're not stuck with it.
g.
^ permalink raw reply
* Re: [PATCH V3] i2c: move of helpers into the core
From: Grant Likely @ 2013-08-28 19:24 UTC (permalink / raw)
To: Wolfram Sang, linux-i2c
Cc: devel, devicetree, davinci-linux-open-source, linux-samsung-soc,
alsa-devel, linux-doc, Wolfram Sang, linux-kernel, dri-devel,
linux-acpi, linux-tegra, linux-omap, linuxppc-dev,
linux-arm-kernel, linux-media
In-Reply-To: <1377187217-31820-1-git-send-email-wsa@the-dreams.de>
On Thu, 22 Aug 2013 18:00:14 +0200, Wolfram Sang <wsa@the-dreams.de> wrote:
> I2C of helpers used to live in of_i2c.c but experience (from SPI) shows
> that it is much cleaner to have this in the core. This also removes a
> circular dependency between the helpers and the core, and so we can
> finally register child nodes in the core instead of doing this manually
> in each driver. So, fix the drivers and documentation, too.
>
> Acked-by: Rob Herring <rob.herring@calxeda.com>
> Reviewed-by: Felipe Balbi <balbi@ti.com>
> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Tested-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Acked-by: Grant Likely <grant.likely@linaro.org>
> ---
>
> V2->V3: Was trying to be too smart by only fixing includes needed.
> Took a more general approach this time, converting of_i2c.h
> to i2c.h in case i2c.h was not already there. Otherwise
> remove it. Improved my build scripts and no build failures,
> no complaints from buildbot as well.
>
>
> Documentation/acpi/enumeration.txt | 1 -
> arch/powerpc/platforms/44x/warp.c | 1 -
> drivers/gpu/drm/tilcdc/tilcdc_slave.c | 1 -
> drivers/gpu/drm/tilcdc/tilcdc_tfp410.c | 1 -
> drivers/gpu/host1x/drm/output.c | 2 +-
> drivers/i2c/busses/i2c-at91.c | 3 -
> drivers/i2c/busses/i2c-cpm.c | 6 --
> drivers/i2c/busses/i2c-davinci.c | 2 -
> drivers/i2c/busses/i2c-designware-platdrv.c | 2 -
> drivers/i2c/busses/i2c-gpio.c | 3 -
> drivers/i2c/busses/i2c-i801.c | 2 -
> drivers/i2c/busses/i2c-ibm_iic.c | 4 -
> drivers/i2c/busses/i2c-imx.c | 3 -
> drivers/i2c/busses/i2c-mpc.c | 2 -
> drivers/i2c/busses/i2c-mv64xxx.c | 3 -
> drivers/i2c/busses/i2c-mxs.c | 3 -
> drivers/i2c/busses/i2c-nomadik.c | 3 -
> drivers/i2c/busses/i2c-ocores.c | 3 -
> drivers/i2c/busses/i2c-octeon.c | 3 -
> drivers/i2c/busses/i2c-omap.c | 3 -
> drivers/i2c/busses/i2c-pnx.c | 3 -
> drivers/i2c/busses/i2c-powermac.c | 9 +-
> drivers/i2c/busses/i2c-pxa.c | 2 -
> drivers/i2c/busses/i2c-s3c2410.c | 2 -
> drivers/i2c/busses/i2c-sh_mobile.c | 2 -
> drivers/i2c/busses/i2c-sirf.c | 3 -
> drivers/i2c/busses/i2c-stu300.c | 2 -
> drivers/i2c/busses/i2c-tegra.c | 3 -
> drivers/i2c/busses/i2c-versatile.c | 2 -
> drivers/i2c/busses/i2c-wmt.c | 3 -
> drivers/i2c/busses/i2c-xiic.c | 3 -
> drivers/i2c/i2c-core.c | 109 +++++++++++++++++++++-
> drivers/i2c/i2c-mux.c | 3 -
> drivers/i2c/muxes/i2c-arb-gpio-challenge.c | 1 -
> drivers/i2c/muxes/i2c-mux-gpio.c | 1 -
> drivers/i2c/muxes/i2c-mux-pinctrl.c | 1 -
> drivers/media/platform/exynos4-is/fimc-is-i2c.c | 4 +-
> drivers/media/platform/exynos4-is/fimc-is.c | 2 +-
> drivers/media/platform/exynos4-is/media-dev.c | 1 -
> drivers/of/Kconfig | 6 --
> drivers/of/Makefile | 1 -
> drivers/of/of_i2c.c | 114 -----------------------
> drivers/staging/imx-drm/imx-tve.c | 2 +-
> include/linux/i2c.h | 20 ++++
> include/linux/of_i2c.h | 46 ---------
> sound/soc/fsl/imx-sgtl5000.c | 2 +-
> sound/soc/fsl/imx-wm8962.c | 2 +-
> 47 files changed, 138 insertions(+), 262 deletions(-)
> delete mode 100644 drivers/of/of_i2c.c
> delete mode 100644 include/linux/of_i2c.h
>
> diff --git a/Documentation/acpi/enumeration.txt b/Documentation/acpi/enumeration.txt
> index d9be7a9..958266e 100644
> --- a/Documentation/acpi/enumeration.txt
> +++ b/Documentation/acpi/enumeration.txt
> @@ -238,7 +238,6 @@ An I2C bus (controller) driver does:
> if (ret)
> /* handle error */
>
> - of_i2c_register_devices(adapter);
> /* Enumerate the slave devices behind this bus via ACPI */
> acpi_i2c_register_devices(adapter);
>
> diff --git a/arch/powerpc/platforms/44x/warp.c b/arch/powerpc/platforms/44x/warp.c
> index 4cfa499..534574a 100644
> --- a/arch/powerpc/platforms/44x/warp.c
> +++ b/arch/powerpc/platforms/44x/warp.c
> @@ -16,7 +16,6 @@
> #include <linux/interrupt.h>
> #include <linux/delay.h>
> #include <linux/of_gpio.h>
> -#include <linux/of_i2c.h>
> #include <linux/slab.h>
> #include <linux/export.h>
>
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_slave.c b/drivers/gpu/drm/tilcdc/tilcdc_slave.c
> index dfffaf0..a19f657 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_slave.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_slave.c
> @@ -16,7 +16,6 @@
> */
>
> #include <linux/i2c.h>
> -#include <linux/of_i2c.h>
> #include <linux/pinctrl/pinmux.h>
> #include <linux/pinctrl/consumer.h>
> #include <drm/drm_encoder_slave.h>
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
> index 925c7cd..c38b56b 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
> @@ -16,7 +16,6 @@
> */
>
> #include <linux/i2c.h>
> -#include <linux/of_i2c.h>
> #include <linux/gpio.h>
> #include <linux/of_gpio.h>
> #include <linux/pinctrl/pinmux.h>
> diff --git a/drivers/gpu/host1x/drm/output.c b/drivers/gpu/host1x/drm/output.c
> index 8140fc6..137ae81 100644
> --- a/drivers/gpu/host1x/drm/output.c
> +++ b/drivers/gpu/host1x/drm/output.c
> @@ -9,7 +9,7 @@
>
> #include <linux/module.h>
> #include <linux/of_gpio.h>
> -#include <linux/of_i2c.h>
> +#include <linux/i2c.h>
>
> #include "drm.h"
>
> diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
> index 6bb839b..fd05930 100644
> --- a/drivers/i2c/busses/i2c-at91.c
> +++ b/drivers/i2c/busses/i2c-at91.c
> @@ -28,7 +28,6 @@
> #include <linux/module.h>
> #include <linux/of.h>
> #include <linux/of_device.h>
> -#include <linux/of_i2c.h>
> #include <linux/platform_device.h>
> #include <linux/slab.h>
> #include <linux/platform_data/dma-atmel.h>
> @@ -775,8 +774,6 @@ static int at91_twi_probe(struct platform_device *pdev)
> return rc;
> }
>
> - of_i2c_register_devices(&dev->adapter);
> -
> dev_info(dev->dev, "AT91 i2c bus driver.\n");
> return 0;
> }
> diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
> index 2e1f7eb..b2b8aa9 100644
> --- a/drivers/i2c/busses/i2c-cpm.c
> +++ b/drivers/i2c/busses/i2c-cpm.c
> @@ -42,7 +42,6 @@
> #include <linux/dma-mapping.h>
> #include <linux/of_device.h>
> #include <linux/of_platform.h>
> -#include <linux/of_i2c.h>
> #include <sysdev/fsl_soc.h>
> #include <asm/cpm.h>
>
> @@ -681,11 +680,6 @@ static int cpm_i2c_probe(struct platform_device *ofdev)
> dev_dbg(&ofdev->dev, "hw routines for %s registered.\n",
> cpm->adap.name);
>
> - /*
> - * register OF I2C devices
> - */
> - of_i2c_register_devices(&cpm->adap);
> -
> return 0;
> out_shut:
> cpm_i2c_shutdown(cpm);
> diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
> index fa55605..62be3b3 100644
> --- a/drivers/i2c/busses/i2c-davinci.c
> +++ b/drivers/i2c/busses/i2c-davinci.c
> @@ -38,7 +38,6 @@
> #include <linux/slab.h>
> #include <linux/cpufreq.h>
> #include <linux/gpio.h>
> -#include <linux/of_i2c.h>
> #include <linux/of_device.h>
>
> #include <mach/hardware.h>
> @@ -728,7 +727,6 @@ static int davinci_i2c_probe(struct platform_device *pdev)
> dev_err(&pdev->dev, "failure adding adapter\n");
> goto err_unuse_clocks;
> }
> - of_i2c_register_devices(adap);
>
> return 0;
>
> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
> index 4c5fada..27ea436 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -35,7 +35,6 @@
> #include <linux/err.h>
> #include <linux/interrupt.h>
> #include <linux/of.h>
> -#include <linux/of_i2c.h>
> #include <linux/platform_device.h>
> #include <linux/pm.h>
> #include <linux/pm_runtime.h>
> @@ -172,7 +171,6 @@ static int dw_i2c_probe(struct platform_device *pdev)
> dev_err(&pdev->dev, "failure adding adapter\n");
> return r;
> }
> - of_i2c_register_devices(adap);
> acpi_i2c_register_devices(adap);
>
> pm_runtime_set_autosuspend_delay(&pdev->dev, 1000);
> diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
> index bc6e139..e5da9fe 100644
> --- a/drivers/i2c/busses/i2c-gpio.c
> +++ b/drivers/i2c/busses/i2c-gpio.c
> @@ -16,7 +16,6 @@
> #include <linux/platform_device.h>
> #include <linux/gpio.h>
> #include <linux/of_gpio.h>
> -#include <linux/of_i2c.h>
>
> struct i2c_gpio_private_data {
> struct i2c_adapter adap;
> @@ -224,8 +223,6 @@ static int i2c_gpio_probe(struct platform_device *pdev)
> if (ret)
> goto err_add_bus;
>
> - of_i2c_register_devices(adap);
> -
> platform_set_drvdata(pdev, priv);
>
> dev_info(&pdev->dev, "using pins %u (SDA) and %u (SCL%s)\n",
> diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
> index 4ebceed..4296d17 100644
> --- a/drivers/i2c/busses/i2c-i801.c
> +++ b/drivers/i2c/busses/i2c-i801.c
> @@ -87,7 +87,6 @@
> #include <linux/slab.h>
> #include <linux/wait.h>
> #include <linux/err.h>
> -#include <linux/of_i2c.h>
>
> #if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \
> defined CONFIG_DMI
> @@ -1230,7 +1229,6 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
> goto exit_free_irq;
> }
>
> - of_i2c_register_devices(&priv->adapter);
> i801_probe_optional_slaves(priv);
> /* We ignore errors - multiplexing is optional */
> i801_add_mux(priv);
> diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
> index 973f516..ff3caa0 100644
> --- a/drivers/i2c/busses/i2c-ibm_iic.c
> +++ b/drivers/i2c/busses/i2c-ibm_iic.c
> @@ -42,7 +42,6 @@
> #include <linux/io.h>
> #include <linux/i2c.h>
> #include <linux/of_platform.h>
> -#include <linux/of_i2c.h>
>
> #include "i2c-ibm_iic.h"
>
> @@ -759,9 +758,6 @@ static int iic_probe(struct platform_device *ofdev)
> dev_info(&ofdev->dev, "using %s mode\n",
> dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)");
>
> - /* Now register all the child nodes */
> - of_i2c_register_devices(adap);
> -
> return 0;
>
> error_cleanup:
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index e242797..bbbea6b 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -50,7 +50,6 @@
> #include <linux/slab.h>
> #include <linux/of.h>
> #include <linux/of_device.h>
> -#include <linux/of_i2c.h>
> #include <linux/platform_data/i2c-imx.h>
>
> /** Defines ********************************************************************
> @@ -570,8 +569,6 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
> return ret;
> }
>
> - of_i2c_register_devices(&i2c_imx->adapter);
> -
> /* Set up platform driver data */
> platform_set_drvdata(pdev, i2c_imx);
>
> diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
> index 7607dc0..9f2513d 100644
> --- a/drivers/i2c/busses/i2c-mpc.c
> +++ b/drivers/i2c/busses/i2c-mpc.c
> @@ -18,7 +18,6 @@
> #include <linux/sched.h>
> #include <linux/init.h>
> #include <linux/of_platform.h>
> -#include <linux/of_i2c.h>
> #include <linux/slab.h>
>
> #include <linux/io.h>
> @@ -691,7 +690,6 @@ static int fsl_i2c_probe(struct platform_device *op)
> dev_err(i2c->dev, "failed to add adapter\n");
> goto fail_add;
> }
> - of_i2c_register_devices(&i2c->adap);
>
> return result;
>
> diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
> index b1f42bf..8220322 100644
> --- a/drivers/i2c/busses/i2c-mv64xxx.c
> +++ b/drivers/i2c/busses/i2c-mv64xxx.c
> @@ -21,7 +21,6 @@
> #include <linux/of.h>
> #include <linux/of_device.h>
> #include <linux/of_irq.h>
> -#include <linux/of_i2c.h>
> #include <linux/clk.h>
> #include <linux/err.h>
>
> @@ -689,8 +688,6 @@ mv64xxx_i2c_probe(struct platform_device *pd)
> goto exit_free_irq;
> }
>
> - of_i2c_register_devices(&drv_data->adapter);
> -
> return 0;
>
> exit_free_irq:
> diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
> index df8ff5a..62ed07d 100644
> --- a/drivers/i2c/busses/i2c-mxs.c
> +++ b/drivers/i2c/busses/i2c-mxs.c
> @@ -27,7 +27,6 @@
> #include <linux/stmp_device.h>
> #include <linux/of.h>
> #include <linux/of_device.h>
> -#include <linux/of_i2c.h>
> #include <linux/dma-mapping.h>
> #include <linux/dmaengine.h>
>
> @@ -701,8 +700,6 @@ static int mxs_i2c_probe(struct platform_device *pdev)
> return err;
> }
>
> - of_i2c_register_devices(adap);
> -
> return 0;
> }
>
> diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
> index 512dfe6..519df17 100644
> --- a/drivers/i2c/busses/i2c-nomadik.c
> +++ b/drivers/i2c/busses/i2c-nomadik.c
> @@ -24,7 +24,6 @@
> #include <linux/pm_runtime.h>
> #include <linux/platform_data/i2c-nomadik.h>
> #include <linux/of.h>
> -#include <linux/of_i2c.h>
> #include <linux/pinctrl/consumer.h>
>
> #define DRIVER_NAME "nmk-i2c"
> @@ -1045,8 +1044,6 @@ static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id)
> goto err_add_adap;
> }
>
> - of_i2c_register_devices(adap);
> -
> pm_runtime_put(&adev->dev);
>
> return 0;
> diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
> index 0e1f824..0a52b78 100644
> --- a/drivers/i2c/busses/i2c-ocores.c
> +++ b/drivers/i2c/busses/i2c-ocores.c
> @@ -24,7 +24,6 @@
> #include <linux/i2c-ocores.h>
> #include <linux/slab.h>
> #include <linux/io.h>
> -#include <linux/of_i2c.h>
> #include <linux/log2.h>
>
> struct ocores_i2c {
> @@ -435,8 +434,6 @@ static int ocores_i2c_probe(struct platform_device *pdev)
> if (pdata) {
> for (i = 0; i < pdata->num_devices; i++)
> i2c_new_device(&i2c->adap, pdata->devices + i);
> - } else {
> - of_i2c_register_devices(&i2c->adap);
> }
>
> return 0;
> diff --git a/drivers/i2c/busses/i2c-octeon.c b/drivers/i2c/busses/i2c-octeon.c
> index 956fe32..b929ba2 100644
> --- a/drivers/i2c/busses/i2c-octeon.c
> +++ b/drivers/i2c/busses/i2c-octeon.c
> @@ -15,7 +15,6 @@
> #include <linux/interrupt.h>
> #include <linux/kernel.h>
> #include <linux/module.h>
> -#include <linux/of_i2c.h>
> #include <linux/delay.h>
> #include <linux/sched.h>
> #include <linux/slab.h>
> @@ -599,8 +598,6 @@ static int octeon_i2c_probe(struct platform_device *pdev)
> }
> dev_info(i2c->dev, "version %s\n", DRV_VERSION);
>
> - of_i2c_register_devices(&i2c->adap);
> -
> return 0;
>
> out:
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 142b694d..a9f0f80 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -38,7 +38,6 @@
> #include <linux/clk.h>
> #include <linux/io.h>
> #include <linux/of.h>
> -#include <linux/of_i2c.h>
> #include <linux/of_device.h>
> #include <linux/slab.h>
> #include <linux/i2c-omap.h>
> @@ -1245,8 +1244,6 @@ omap_i2c_probe(struct platform_device *pdev)
> dev_info(dev->dev, "bus %d rev%d.%d at %d kHz\n", adap->nr,
> major, minor, dev->speed);
>
> - of_i2c_register_devices(adap);
> -
> pm_runtime_mark_last_busy(dev->dev);
> pm_runtime_put_autosuspend(dev->dev);
>
> diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
> index 5f39c6d..7b57d67 100644
> --- a/drivers/i2c/busses/i2c-pnx.c
> +++ b/drivers/i2c/busses/i2c-pnx.c
> @@ -23,7 +23,6 @@
> #include <linux/err.h>
> #include <linux/clk.h>
> #include <linux/slab.h>
> -#include <linux/of_i2c.h>
>
> #define I2C_PNX_TIMEOUT_DEFAULT 10 /* msec */
> #define I2C_PNX_SPEED_KHZ_DEFAULT 100
> @@ -741,8 +740,6 @@ static int i2c_pnx_probe(struct platform_device *pdev)
> goto out_irq;
> }
>
> - of_i2c_register_devices(&alg_data->adapter);
> -
> dev_dbg(&pdev->dev, "%s: Master at %#8x, irq %d.\n",
> alg_data->adapter.name, res->start, alg_data->irq);
>
> diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c
> index 8dc90da..1010f2e 100644
> --- a/drivers/i2c/busses/i2c-powermac.c
> +++ b/drivers/i2c/busses/i2c-powermac.c
> @@ -440,7 +440,9 @@ static int i2c_powermac_probe(struct platform_device *dev)
> adapter->algo = &i2c_powermac_algorithm;
> i2c_set_adapdata(adapter, bus);
> adapter->dev.parent = &dev->dev;
> - adapter->dev.of_node = dev->dev.of_node;
> +
> + /* Clear of_node to skip automatic registration of i2c child nodes */
> + adapter->dev.of_node = NULL;
> rc = i2c_add_adapter(adapter);
> if (rc) {
> printk(KERN_ERR "i2c-powermac: Adapter %s registration "
> @@ -450,9 +452,8 @@ static int i2c_powermac_probe(struct platform_device *dev)
>
> printk(KERN_INFO "PowerMac i2c bus %s registered\n", adapter->name);
>
> - /* Cannot use of_i2c_register_devices() due to Apple device-tree
> - * funkyness
> - */
> + /* Use custom child registration due to Apple device-tree funkyness */
> + adapter->dev.of_node = dev->dev.of_node;
> i2c_powermac_register_devices(adapter, bus);
>
> return rc;
> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
> index fbafed2..bc65014 100644
> --- a/drivers/i2c/busses/i2c-pxa.c
> +++ b/drivers/i2c/busses/i2c-pxa.c
> @@ -31,7 +31,6 @@
> #include <linux/i2c-pxa.h>
> #include <linux/of.h>
> #include <linux/of_device.h>
> -#include <linux/of_i2c.h>
> #include <linux/platform_device.h>
> #include <linux/err.h>
> #include <linux/clk.h>
> @@ -1185,7 +1184,6 @@ static int i2c_pxa_probe(struct platform_device *dev)
> printk(KERN_INFO "I2C: Failed to add bus\n");
> goto eadapt;
> }
> - of_i2c_register_devices(&i2c->adap);
>
> platform_set_drvdata(dev, i2c);
>
> diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
> index cab1c91..643426e 100644
> --- a/drivers/i2c/busses/i2c-s3c2410.c
> +++ b/drivers/i2c/busses/i2c-s3c2410.c
> @@ -36,7 +36,6 @@
> #include <linux/cpufreq.h>
> #include <linux/slab.h>
> #include <linux/io.h>
> -#include <linux/of_i2c.h>
> #include <linux/of_gpio.h>
> #include <linux/pinctrl/consumer.h>
>
> @@ -1154,7 +1153,6 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
> return ret;
> }
>
> - of_i2c_register_devices(&i2c->adap);
> platform_set_drvdata(pdev, i2c);
>
> pm_runtime_enable(&pdev->dev);
> diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
> index debf745..aa1268f 100644
> --- a/drivers/i2c/busses/i2c-sh_mobile.c
> +++ b/drivers/i2c/busses/i2c-sh_mobile.c
> @@ -27,7 +27,6 @@
> #include <linux/platform_device.h>
> #include <linux/interrupt.h>
> #include <linux/i2c.h>
> -#include <linux/of_i2c.h>
> #include <linux/err.h>
> #include <linux/pm_runtime.h>
> #include <linux/clk.h>
> @@ -758,7 +757,6 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
> "I2C adapter %d with bus speed %lu Hz (L/H=%x/%x)\n",
> adap->nr, pd->bus_speed, pd->iccl, pd->icch);
>
> - of_i2c_register_devices(adap);
> return 0;
>
> err_all:
> diff --git a/drivers/i2c/busses/i2c-sirf.c b/drivers/i2c/busses/i2c-sirf.c
> index a63c7d5..0ff22e2 100644
> --- a/drivers/i2c/busses/i2c-sirf.c
> +++ b/drivers/i2c/busses/i2c-sirf.c
> @@ -12,7 +12,6 @@
> #include <linux/slab.h>
> #include <linux/platform_device.h>
> #include <linux/i2c.h>
> -#include <linux/of_i2c.h>
> #include <linux/clk.h>
> #include <linux/err.h>
> #include <linux/io.h>
> @@ -366,8 +365,6 @@ static int i2c_sirfsoc_probe(struct platform_device *pdev)
>
> clk_disable(clk);
>
> - of_i2c_register_devices(adap);
> -
> dev_info(&pdev->dev, " I2C adapter ready to operate\n");
>
> return 0;
> diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c
> index d1a6b20..047546c 100644
> --- a/drivers/i2c/busses/i2c-stu300.c
> +++ b/drivers/i2c/busses/i2c-stu300.c
> @@ -17,7 +17,6 @@
> #include <linux/clk.h>
> #include <linux/io.h>
> #include <linux/slab.h>
> -#include <linux/of_i2c.h>
>
> /* the name of this kernel module */
> #define NAME "stu300"
> @@ -936,7 +935,6 @@ stu300_probe(struct platform_device *pdev)
> platform_set_drvdata(pdev, dev);
> dev_info(&pdev->dev, "ST DDC I2C @ %p, irq %d\n",
> dev->virtbase, dev->irq);
> - of_i2c_register_devices(adap);
>
> return 0;
> }
> diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
> index 9aa1b60..c457cb4 100644
> --- a/drivers/i2c/busses/i2c-tegra.c
> +++ b/drivers/i2c/busses/i2c-tegra.c
> @@ -25,7 +25,6 @@
> #include <linux/interrupt.h>
> #include <linux/delay.h>
> #include <linux/slab.h>
> -#include <linux/of_i2c.h>
> #include <linux/of_device.h>
> #include <linux/module.h>
> #include <linux/clk/tegra.h>
> @@ -802,8 +801,6 @@ static int tegra_i2c_probe(struct platform_device *pdev)
> return ret;
> }
>
> - of_i2c_register_devices(&i2c_dev->adapter);
> -
> return 0;
> }
>
> diff --git a/drivers/i2c/busses/i2c-versatile.c b/drivers/i2c/busses/i2c-versatile.c
> index f3a8790..6bb3a89 100644
> --- a/drivers/i2c/busses/i2c-versatile.c
> +++ b/drivers/i2c/busses/i2c-versatile.c
> @@ -16,7 +16,6 @@
> #include <linux/platform_device.h>
> #include <linux/slab.h>
> #include <linux/io.h>
> -#include <linux/of_i2c.h>
>
> #define I2C_CONTROL 0x00
> #define I2C_CONTROLS 0x00
> @@ -108,7 +107,6 @@ static int i2c_versatile_probe(struct platform_device *dev)
> ret = i2c_bit_add_numbered_bus(&i2c->adap);
> if (ret >= 0) {
> platform_set_drvdata(dev, i2c);
> - of_i2c_register_devices(&i2c->adap);
> return 0;
> }
>
> diff --git a/drivers/i2c/busses/i2c-wmt.c b/drivers/i2c/busses/i2c-wmt.c
> index baaa7d1..c65da3d 100644
> --- a/drivers/i2c/busses/i2c-wmt.c
> +++ b/drivers/i2c/busses/i2c-wmt.c
> @@ -21,7 +21,6 @@
> #include <linux/module.h>
> #include <linux/of.h>
> #include <linux/of_address.h>
> -#include <linux/of_i2c.h>
> #include <linux/of_irq.h>
> #include <linux/platform_device.h>
>
> @@ -439,8 +438,6 @@ static int wmt_i2c_probe(struct platform_device *pdev)
>
> platform_set_drvdata(pdev, i2c_dev);
>
> - of_i2c_register_devices(adap);
> -
> return 0;
> }
>
> diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
> index 3d0f052..8823db7 100644
> --- a/drivers/i2c/busses/i2c-xiic.c
> +++ b/drivers/i2c/busses/i2c-xiic.c
> @@ -40,7 +40,6 @@
> #include <linux/i2c-xiic.h>
> #include <linux/io.h>
> #include <linux/slab.h>
> -#include <linux/of_i2c.h>
>
> #define DRIVER_NAME "xiic-i2c"
>
> @@ -752,8 +751,6 @@ static int xiic_i2c_probe(struct platform_device *pdev)
> i2c_new_device(&i2c->adap, pdata->devices + i);
> }
>
> - of_i2c_register_devices(&i2c->adap);
> -
> return 0;
>
> add_adapter_failed:
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index f32ca29..08ebd78 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -23,7 +23,11 @@
> SMBus 2.0 support by Mark Studebaker <mdsxyz123@yahoo.com> and
> Jean Delvare <khali@linux-fr.org>
> Mux support by Rodolfo Giometti <giometti@enneenne.com> and
> - Michael Lawnick <michael.lawnick.ext@nsn.com> */
> + Michael Lawnick <michael.lawnick.ext@nsn.com>
> + OF support is copyright (c) 2008 Jochen Friedrich <jochen@scram.de>
> + (based on a previous patch from Jon Smirl <jonsmirl@gmail.com>) and
> + (c) 2013 Wolfram Sang <wsa@the-dreams.de>
> + */
>
> #include <linux/module.h>
> #include <linux/kernel.h>
> @@ -35,7 +39,9 @@
> #include <linux/init.h>
> #include <linux/idr.h>
> #include <linux/mutex.h>
> +#include <linux/of.h>
> #include <linux/of_device.h>
> +#include <linux/of_irq.h>
> #include <linux/completion.h>
> #include <linux/hardirq.h>
> #include <linux/irqflags.h>
> @@ -954,6 +960,104 @@ static void i2c_scan_static_board_info(struct i2c_adapter *adapter)
> up_read(&__i2c_board_lock);
> }
>
> +/* OF support code */
> +
> +#if IS_ENABLED(CONFIG_OF)
> +static void of_i2c_register_devices(struct i2c_adapter *adap)
> +{
> + void *result;
> + struct device_node *node;
> +
> + /* Only register child devices if the adapter has a node pointer set */
> + if (!adap->dev.of_node)
> + return;
> +
> + dev_dbg(&adap->dev, "of_i2c: walking child nodes\n");
> +
> + for_each_available_child_of_node(adap->dev.of_node, node) {
> + struct i2c_board_info info = {};
> + struct dev_archdata dev_ad = {};
> + const __be32 *addr;
> + int len;
> +
> + dev_dbg(&adap->dev, "of_i2c: register %s\n", node->full_name);
> +
> + if (of_modalias_node(node, info.type, sizeof(info.type)) < 0) {
> + dev_err(&adap->dev, "of_i2c: modalias failure on %s\n",
> + node->full_name);
> + continue;
> + }
> +
> + addr = of_get_property(node, "reg", &len);
> + if (!addr || (len < sizeof(int))) {
> + dev_err(&adap->dev, "of_i2c: invalid reg on %s\n",
> + node->full_name);
> + continue;
> + }
> +
> + info.addr = be32_to_cpup(addr);
> + if (info.addr > (1 << 10) - 1) {
> + dev_err(&adap->dev, "of_i2c: invalid addr=%x on %s\n",
> + info.addr, node->full_name);
> + continue;
> + }
> +
> + info.irq = irq_of_parse_and_map(node, 0);
> + info.of_node = of_node_get(node);
> + info.archdata = &dev_ad;
> +
> + if (of_get_property(node, "wakeup-source", NULL))
> + info.flags |= I2C_CLIENT_WAKE;
> +
> + request_module("%s%s", I2C_MODULE_PREFIX, info.type);
> +
> + result = i2c_new_device(adap, &info);
> + if (result == NULL) {
> + dev_err(&adap->dev, "of_i2c: Failure registering %s\n",
> + node->full_name);
> + of_node_put(node);
> + irq_dispose_mapping(info.irq);
> + continue;
> + }
> + }
> +}
> +
> +static int of_dev_node_match(struct device *dev, void *data)
> +{
> + return dev->of_node == data;
> +}
> +
> +/* must call put_device() when done with returned i2c_client device */
> +struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
> +{
> + struct device *dev;
> +
> + dev = bus_find_device(&i2c_bus_type, NULL, node,
> + of_dev_node_match);
> + if (!dev)
> + return NULL;
> +
> + return i2c_verify_client(dev);
> +}
> +EXPORT_SYMBOL(of_find_i2c_device_by_node);
> +
> +/* must call put_device() when done with returned i2c_adapter device */
> +struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node)
> +{
> + struct device *dev;
> +
> + dev = bus_find_device(&i2c_bus_type, NULL, node,
> + of_dev_node_match);
> + if (!dev)
> + return NULL;
> +
> + return i2c_verify_adapter(dev);
> +}
> +EXPORT_SYMBOL(of_find_i2c_adapter_by_node);
> +#else
> +static void of_i2c_register_devices(struct i2c_adapter *adap) { }
> +#endif /* CONFIG_OF */
> +
> static int i2c_do_add_adapter(struct i2c_driver *driver,
> struct i2c_adapter *adap)
> {
> @@ -1058,6 +1162,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
>
> exit_recovery:
> /* create pre-declared device nodes */
> + of_i2c_register_devices(adap);
> +
> if (adap->nr < __i2c_first_dynamic_bus_num)
> i2c_scan_static_board_info(adap);
>
> @@ -1282,7 +1388,6 @@ void i2c_del_adapter(struct i2c_adapter *adap)
> }
> EXPORT_SYMBOL(i2c_del_adapter);
>
> -
> /* ------------------------------------------------------------------------- */
>
> int i2c_for_each_dev(void *data, int (*fn)(struct device *, void *))
> diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c
> index 7409ebb..797e311 100644
> --- a/drivers/i2c/i2c-mux.c
> +++ b/drivers/i2c/i2c-mux.c
> @@ -25,7 +25,6 @@
> #include <linux/i2c.h>
> #include <linux/i2c-mux.h>
> #include <linux/of.h>
> -#include <linux/of_i2c.h>
>
> /* multiplexer per channel data */
> struct i2c_mux_priv {
> @@ -185,8 +184,6 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent,
> dev_info(&parent->dev, "Added multiplexed i2c bus %d\n",
> i2c_adapter_id(&priv->adap));
>
> - of_i2c_register_devices(&priv->adap);
> -
> return &priv->adap;
> }
> EXPORT_SYMBOL_GPL(i2c_add_mux_adapter);
> diff --git a/drivers/i2c/muxes/i2c-arb-gpio-challenge.c b/drivers/i2c/muxes/i2c-arb-gpio-challenge.c
> index 210b6f7..b901638 100644
> --- a/drivers/i2c/muxes/i2c-arb-gpio-challenge.c
> +++ b/drivers/i2c/muxes/i2c-arb-gpio-challenge.c
> @@ -21,7 +21,6 @@
> #include <linux/i2c-mux.h>
> #include <linux/init.h>
> #include <linux/module.h>
> -#include <linux/of_i2c.h>
> #include <linux/of_gpio.h>
> #include <linux/platform_device.h>
> #include <linux/slab.h>
> diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c
> index 5a0ce00..128a981 100644
> --- a/drivers/i2c/muxes/i2c-mux-gpio.c
> +++ b/drivers/i2c/muxes/i2c-mux-gpio.c
> @@ -16,7 +16,6 @@
> #include <linux/module.h>
> #include <linux/slab.h>
> #include <linux/gpio.h>
> -#include <linux/of_i2c.h>
> #include <linux/of_gpio.h>
>
> struct gpiomux {
> diff --git a/drivers/i2c/muxes/i2c-mux-pinctrl.c b/drivers/i2c/muxes/i2c-mux-pinctrl.c
> index a43c0ce..859a6d2 100644
> --- a/drivers/i2c/muxes/i2c-mux-pinctrl.c
> +++ b/drivers/i2c/muxes/i2c-mux-pinctrl.c
> @@ -20,7 +20,6 @@
> #include <linux/i2c-mux.h>
> #include <linux/init.h>
> #include <linux/module.h>
> -#include <linux/of_i2c.h>
> #include <linux/pinctrl/consumer.h>
> #include <linux/i2c-mux-pinctrl.h>
> #include <linux/platform_device.h>
> diff --git a/drivers/media/platform/exynos4-is/fimc-is-i2c.c b/drivers/media/platform/exynos4-is/fimc-is-i2c.c
> index 617a798..9930556 100644
> --- a/drivers/media/platform/exynos4-is/fimc-is-i2c.c
> +++ b/drivers/media/platform/exynos4-is/fimc-is-i2c.c
> @@ -12,7 +12,7 @@
>
> #include <linux/clk.h>
> #include <linux/module.h>
> -#include <linux/of_i2c.h>
> +#include <linux/i2c.h>
> #include <linux/platform_device.h>
> #include <linux/pm_runtime.h>
> #include <linux/slab.h>
> @@ -67,8 +67,6 @@ static int fimc_is_i2c_probe(struct platform_device *pdev)
> pm_runtime_enable(&pdev->dev);
> pm_runtime_enable(&i2c_adap->dev);
>
> - of_i2c_register_devices(i2c_adap);
> -
> return 0;
> }
>
> diff --git a/drivers/media/platform/exynos4-is/fimc-is.c b/drivers/media/platform/exynos4-is/fimc-is.c
> index 967f6a9..2276fdc 100644
> --- a/drivers/media/platform/exynos4-is/fimc-is.c
> +++ b/drivers/media/platform/exynos4-is/fimc-is.c
> @@ -21,7 +21,7 @@
> #include <linux/interrupt.h>
> #include <linux/kernel.h>
> #include <linux/module.h>
> -#include <linux/of_i2c.h>
> +#include <linux/i2c.h>
> #include <linux/of_irq.h>
> #include <linux/of_address.h>
> #include <linux/of_platform.h>
> diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c
> index 19f556c..f8c66b4 100644
> --- a/drivers/media/platform/exynos4-is/media-dev.c
> +++ b/drivers/media/platform/exynos4-is/media-dev.c
> @@ -20,7 +20,6 @@
> #include <linux/of.h>
> #include <linux/of_platform.h>
> #include <linux/of_device.h>
> -#include <linux/of_i2c.h>
> #include <linux/platform_device.h>
> #include <linux/pm_runtime.h>
> #include <linux/types.h>
> diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
> index 80e5c13..78cc760 100644
> --- a/drivers/of/Kconfig
> +++ b/drivers/of/Kconfig
> @@ -48,12 +48,6 @@ config OF_IRQ
> def_bool y
> depends on !SPARC
>
> -config OF_I2C
> - def_tristate I2C
> - depends on I2C
> - help
> - OpenFirmware I2C accessors
> -
> config OF_NET
> depends on NETDEVICES
> def_bool y
> diff --git a/drivers/of/Makefile b/drivers/of/Makefile
> index 1f9c0c4..efd0510 100644
> --- a/drivers/of/Makefile
> +++ b/drivers/of/Makefile
> @@ -3,7 +3,6 @@ obj-$(CONFIG_OF_FLATTREE) += fdt.o
> obj-$(CONFIG_OF_PROMTREE) += pdt.o
> obj-$(CONFIG_OF_ADDRESS) += address.o
> obj-$(CONFIG_OF_IRQ) += irq.o
> -obj-$(CONFIG_OF_I2C) += of_i2c.o
> obj-$(CONFIG_OF_NET) += of_net.o
> obj-$(CONFIG_OF_SELFTEST) += selftest.o
> obj-$(CONFIG_OF_MDIO) += of_mdio.o
> diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c
> deleted file mode 100644
> index b667264..0000000
> --- a/drivers/of/of_i2c.c
> +++ /dev/null
> @@ -1,114 +0,0 @@
> -/*
> - * OF helpers for the I2C API
> - *
> - * Copyright (c) 2008 Jochen Friedrich <jochen@scram.de>
> - *
> - * Based on a previous patch from Jon Smirl <jonsmirl@gmail.com>
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License as published by
> - * the Free Software Foundation; either version 2 of the License, or
> - * (at your option) any later version.
> - */
> -
> -#include <linux/i2c.h>
> -#include <linux/irq.h>
> -#include <linux/of.h>
> -#include <linux/of_i2c.h>
> -#include <linux/of_irq.h>
> -#include <linux/module.h>
> -
> -void of_i2c_register_devices(struct i2c_adapter *adap)
> -{
> - void *result;
> - struct device_node *node;
> -
> - /* Only register child devices if the adapter has a node pointer set */
> - if (!adap->dev.of_node)
> - return;
> -
> - dev_dbg(&adap->dev, "of_i2c: walking child nodes\n");
> -
> - for_each_available_child_of_node(adap->dev.of_node, node) {
> - struct i2c_board_info info = {};
> - struct dev_archdata dev_ad = {};
> - const __be32 *addr;
> - int len;
> -
> - dev_dbg(&adap->dev, "of_i2c: register %s\n", node->full_name);
> -
> - if (of_modalias_node(node, info.type, sizeof(info.type)) < 0) {
> - dev_err(&adap->dev, "of_i2c: modalias failure on %s\n",
> - node->full_name);
> - continue;
> - }
> -
> - addr = of_get_property(node, "reg", &len);
> - if (!addr || (len < sizeof(int))) {
> - dev_err(&adap->dev, "of_i2c: invalid reg on %s\n",
> - node->full_name);
> - continue;
> - }
> -
> - info.addr = be32_to_cpup(addr);
> - if (info.addr > (1 << 10) - 1) {
> - dev_err(&adap->dev, "of_i2c: invalid addr=%x on %s\n",
> - info.addr, node->full_name);
> - continue;
> - }
> -
> - info.irq = irq_of_parse_and_map(node, 0);
> - info.of_node = of_node_get(node);
> - info.archdata = &dev_ad;
> -
> - if (of_get_property(node, "wakeup-source", NULL))
> - info.flags |= I2C_CLIENT_WAKE;
> -
> - request_module("%s%s", I2C_MODULE_PREFIX, info.type);
> -
> - result = i2c_new_device(adap, &info);
> - if (result == NULL) {
> - dev_err(&adap->dev, "of_i2c: Failure registering %s\n",
> - node->full_name);
> - of_node_put(node);
> - irq_dispose_mapping(info.irq);
> - continue;
> - }
> - }
> -}
> -EXPORT_SYMBOL(of_i2c_register_devices);
> -
> -static int of_dev_node_match(struct device *dev, void *data)
> -{
> - return dev->of_node == data;
> -}
> -
> -/* must call put_device() when done with returned i2c_client device */
> -struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
> -{
> - struct device *dev;
> -
> - dev = bus_find_device(&i2c_bus_type, NULL, node,
> - of_dev_node_match);
> - if (!dev)
> - return NULL;
> -
> - return i2c_verify_client(dev);
> -}
> -EXPORT_SYMBOL(of_find_i2c_device_by_node);
> -
> -/* must call put_device() when done with returned i2c_adapter device */
> -struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node)
> -{
> - struct device *dev;
> -
> - dev = bus_find_device(&i2c_bus_type, NULL, node,
> - of_dev_node_match);
> - if (!dev)
> - return NULL;
> -
> - return i2c_verify_adapter(dev);
> -}
> -EXPORT_SYMBOL(of_find_i2c_adapter_by_node);
> -
> -MODULE_LICENSE("GPL");
> diff --git a/drivers/staging/imx-drm/imx-tve.c b/drivers/staging/imx-drm/imx-tve.c
> index a56797d..2d76fd4 100644
> --- a/drivers/staging/imx-drm/imx-tve.c
> +++ b/drivers/staging/imx-drm/imx-tve.c
> @@ -21,7 +21,7 @@
> #include <linux/clk.h>
> #include <linux/clk-provider.h>
> #include <linux/module.h>
> -#include <linux/of_i2c.h>
> +#include <linux/i2c.h>
> #include <linux/regmap.h>
> #include <linux/regulator/consumer.h>
> #include <linux/spinlock.h>
> diff --git a/include/linux/i2c.h b/include/linux/i2c.h
> index e988fa9..2189189 100644
> --- a/include/linux/i2c.h
> +++ b/include/linux/i2c.h
> @@ -542,6 +542,26 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap)
>
> #endif /* I2C */
>
> +#if IS_ENABLED(CONFIG_OF)
> +/* must call put_device() when done with returned i2c_client device */
> +extern struct i2c_client *of_find_i2c_device_by_node(struct device_node *node);
> +
> +/* must call put_device() when done with returned i2c_adapter device */
> +extern struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node);
> +
> +#else
> +
> +static inline struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
> +{
> + return NULL;
> +}
> +
> +static inline struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node *node)
> +{
> + return NULL;
> +}
> +#endif /* CONFIG_OF */
> +
> #if IS_ENABLED(CONFIG_ACPI_I2C)
> extern void acpi_i2c_register_devices(struct i2c_adapter *adap);
> #else
> diff --git a/include/linux/of_i2c.h b/include/linux/of_i2c.h
> deleted file mode 100644
> index cfb545c..0000000
> --- a/include/linux/of_i2c.h
> +++ /dev/null
> @@ -1,46 +0,0 @@
> -/*
> - * Generic I2C API implementation for PowerPC.
> - *
> - * Copyright (c) 2008 Jochen Friedrich <jochen@scram.de>
> - *
> - * 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.
> - */
> -
> -#ifndef __LINUX_OF_I2C_H
> -#define __LINUX_OF_I2C_H
> -
> -#if defined(CONFIG_OF_I2C) || defined(CONFIG_OF_I2C_MODULE)
> -#include <linux/i2c.h>
> -
> -extern void of_i2c_register_devices(struct i2c_adapter *adap);
> -
> -/* must call put_device() when done with returned i2c_client device */
> -extern struct i2c_client *of_find_i2c_device_by_node(struct device_node *node);
> -
> -/* must call put_device() when done with returned i2c_adapter device */
> -extern struct i2c_adapter *of_find_i2c_adapter_by_node(
> - struct device_node *node);
> -
> -#else
> -static inline void of_i2c_register_devices(struct i2c_adapter *adap)
> -{
> - return;
> -}
> -
> -static inline struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
> -{
> - return NULL;
> -}
> -
> -/* must call put_device() when done with returned i2c_adapter device */
> -static inline struct i2c_adapter *of_find_i2c_adapter_by_node(
> - struct device_node *node)
> -{
> - return NULL;
> -}
> -#endif /* CONFIG_OF_I2C */
> -
> -#endif /* __LINUX_OF_I2C_H */
> diff --git a/sound/soc/fsl/imx-sgtl5000.c b/sound/soc/fsl/imx-sgtl5000.c
> index 3f726e4..f2fbde9 100644
> --- a/sound/soc/fsl/imx-sgtl5000.c
> +++ b/sound/soc/fsl/imx-sgtl5000.c
> @@ -13,7 +13,7 @@
> #include <linux/module.h>
> #include <linux/of.h>
> #include <linux/of_platform.h>
> -#include <linux/of_i2c.h>
> +#include <linux/i2c.h>
> #include <linux/clk.h>
> #include <sound/soc.h>
>
> diff --git a/sound/soc/fsl/imx-wm8962.c b/sound/soc/fsl/imx-wm8962.c
> index 52a36a9..9fd7a65 100644
> --- a/sound/soc/fsl/imx-wm8962.c
> +++ b/sound/soc/fsl/imx-wm8962.c
> @@ -15,7 +15,7 @@
>
> #include <linux/module.h>
> #include <linux/of_platform.h>
> -#include <linux/of_i2c.h>
> +#include <linux/i2c.h>
> #include <linux/slab.h>
> #include <linux/clk.h>
> #include <sound/soc.h>
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply
* Re: [PATCH v4 09/31] powerpc/fsl-pci: improve clock API use
From: Gerhard Sittig @ 2013-08-28 15:59 UTC (permalink / raw)
To: linuxppc-dev, Anatolij Gustschin, linux-arm-kernel,
Benjamin Herrenschmidt, Paul Mackerras, Kumar Gala
In-Reply-To: <20130828120827.GB26379@book.gsilab.sittig.org>
On Wed, Aug 28, 2013 at 14:08 +0200, Gerhard Sittig wrote:
>
> [ re-created the Cc: list, this is about the PCI clock exclusively ]
I just noticed by coincidence that the message which I received
back from the linuxppc-dev ML appeared to have dropped Benjamin
Herrenschmidt and Kumar Gala from the Cc: list -- while they do
appear in the header of the message that I have sent and I can't
see what might have caused the loss of information. :-O
Do you want me to re-send the message for the benefit of
potential followups, or is it OK that you receive the message via
the list but potentially without the Cc: attribute?
The message was mostly "for your information" and contained a
status update, while no action is required or problems need to
get resolved.
virtually yours
Gerhard Sittig
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office@denx.de
^ permalink raw reply
* Re: [PATCH] KVM: PPC: Book3S PR: return appropriate error when allocation fails
From: Alexander Graf @ 2013-08-28 14:26 UTC (permalink / raw)
To: Thadeu Lima de Souza Cascardo
Cc: Gleb Natapov, kvm, linux-kernel, kvm-ppc, Paul Mackerras,
Paolo Bonzini, linuxppc-dev
In-Reply-To: <1374073829-28246-1-git-send-email-cascardo@linux.vnet.ibm.com>
On 17.07.2013, at 17:10, Thadeu Lima de Souza Cascardo wrote:
> err was overwritten by a previous function call, and checked to be 0. If
> the following page allocation fails, 0 is going to be returned instead
> of -ENOMEM.
>
> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
Thanks, applied to kvm-ppc-queue.
Alex
^ permalink raw reply
* Re: [PATCH] arch: powerpc: kvm: add signed type cast for comparation
From: Alexander Graf @ 2013-08-28 14:24 UTC (permalink / raw)
To: Chen Gang
Cc: Gleb Natapov, kvm, kvm-ppc, Paul Mackerras, pbonzini,
linuxppc-dev@lists.ozlabs.org
In-Reply-To: <51FF3D0B.6050609@asianux.com>
On 05.08.2013, at 07:50, Chen Gang wrote:
> On 08/05/2013 12:34 PM, Paul Mackerras wrote:
>> On Mon, Jul 22, 2013 at 02:32:35PM +0800, Chen Gang wrote:
>>>> 'rmls' is 'unsigned long', lpcr_rmls() will return negative number when
>>>> failure occurs, so it need a type cast for comparing.
>>>>
>>>> 'lpid' is 'unsigned long', kvmppc_alloc_lpid() return negative number
>>>> when failure occurs, so it need a type cast for comparing.
>>>>
>>>>
>>>> Signed-off-by: Chen Gang <gang.chen@asianux.com>
>> Looks right, thanks.
>>
>> Acked-by: Paul Mackerras <paulus@samba.org>
>>
>>
>
> Thank you very much.
Thanks, applied to kvm-ppc-queue.
Alex
^ 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