LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: Override timer interrupt
From: Mark A. Greer @ 2007-10-12 21:55 UTC (permalink / raw)
  To: Rune Torgersen; +Cc: linuxppc-dev, linuxppc-embedded
In-Reply-To: <DCEAAC0833DD314AB0B58112AD99B93B037D4C1B@ismail.innsys.innovsys.com>

On Fri, Oct 12, 2007 at 04:39:53PM -0500, Rune Torgersen wrote:
> > From: Mark A. Greer 
> > > Is there an easy way to use something other than the decrementer for
> the
> > > timer interrupt?
> 
> > Check out the clocksource stuff.  It let's you set up numerous clock
> > sources and set the rating of each one.  You can start looking in
> > arch/powerpc/kernel/time.c for example code.
> 
> Thanks I will. 
> Currently our board port lives in /arch/ppc (2.6.18) but I will take a
> look in powerpc.

Okay.  Just an FYI, arch/ppc will evaporate next summer.

Mark

^ permalink raw reply

* [PATCH 3/7] mpc52xx: Update mpc52xx_psc structure with B revision changes
From: Grant Likely @ 2007-10-12 22:25 UTC (permalink / raw)
  To: galak, paulus, linuxppc-dev, tnt
In-Reply-To: <20071012222309.12648.82234.stgit@trillian.cg.shawcable.net>

From: Sylvain Munaut <tnt@246tNt.com>

On the mpc5200b the ccr register is 32 bits wide while on the
mpc5200 it's only 16 bits. It's up to the driver to use the
correct format depending on the chip it's running on.

The 5200b also offers some more registers & status in AC97
mode. Again, if not running on a 5200b the driver should not
use those.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 include/asm-ppc/mpc52xx_psc.h |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/asm-ppc/mpc52xx_psc.h b/include/asm-ppc/mpc52xx_psc.h
index 9d850b2..c82b8d4 100644
--- a/include/asm-ppc/mpc52xx_psc.h
+++ b/include/asm-ppc/mpc52xx_psc.h
@@ -28,6 +28,10 @@
 #define MPC52xx_PSC_MAXNUM	6
 
 /* Programmable Serial Controller (PSC) status register bits */
+#define MPC52xx_PSC_SR_UNEX_RX	0x0001
+#define MPC52xx_PSC_SR_DATA_VAL	0x0002
+#define MPC52xx_PSC_SR_DATA_OVR	0x0004
+#define MPC52xx_PSC_SR_CMDSEND	0x0008
 #define MPC52xx_PSC_SR_CDE	0x0080
 #define MPC52xx_PSC_SR_RXRDY	0x0100
 #define MPC52xx_PSC_SR_RXFULL	0x0200
@@ -132,8 +136,10 @@ struct mpc52xx_psc {
 	u8		reserved5[3];
 	u8		ctlr;		/* PSC + 0x1c */
 	u8		reserved6[3];
-	u16		ccr;		/* PSC + 0x20 */
-	u8		reserved7[14];
+	u32		ccr;		/* PSC + 0x20 */
+	u32		ac97_slots;	/* PSC + 0x24 */
+	u32		ac97_cmd;	/* PSC + 0x28 */
+	u32		ac97_data;	/* PSC + 0x2c */
 	u8		ivr;		/* PSC + 0x30 */
 	u8		reserved8[3];
 	u8		ip;		/* PSC + 0x34 */

^ permalink raw reply related

* [PATCH 1/7] exports rheap symbol to modules
From: Grant Likely @ 2007-10-12 22:25 UTC (permalink / raw)
  To: galak, paulus, linuxppc-dev, tnt
In-Reply-To: <20071012222309.12648.82234.stgit@trillian.cg.shawcable.net>

From: Sylvain Munaut <tnt@246tNt.com>

Theses can be useful in modules too. So we export them.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/powerpc/lib/rheap.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/lib/rheap.c b/arch/powerpc/lib/rheap.c
index ada5b42..22c3b4f 100644
--- a/arch/powerpc/lib/rheap.c
+++ b/arch/powerpc/lib/rheap.c
@@ -15,6 +15,7 @@
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
+#include <linux/module.h>
 #include <linux/mm.h>
 #include <linux/err.h>
 #include <linux/slab.h>
@@ -275,6 +276,7 @@ rh_info_t *rh_create(unsigned int alignment)
 
 	return info;
 }
+EXPORT_SYMBOL_GPL(rh_create);
 
 /*
  * Destroy a dynamically created remote heap.  Deallocate only if the areas
@@ -288,6 +290,7 @@ void rh_destroy(rh_info_t * info)
 	if ((info->flags & RHIF_STATIC_INFO) == 0)
 		kfree(info);
 }
+EXPORT_SYMBOL_GPL(rh_destroy);
 
 /*
  * Initialize in place a remote heap info block.  This is needed to support
@@ -320,6 +323,7 @@ void rh_init(rh_info_t * info, unsigned int alignment, int max_blocks,
 	for (i = 0, blk = block; i < max_blocks; i++, blk++)
 		list_add(&blk->list, &info->empty_list);
 }
+EXPORT_SYMBOL_GPL(rh_init);
 
 /* Attach a free memory region, coalesces regions if adjuscent */
 int rh_attach_region(rh_info_t * info, unsigned long start, int size)
@@ -360,6 +364,7 @@ int rh_attach_region(rh_info_t * info, unsigned long start, int size)
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(rh_attach_region);
 
 /* Detatch given address range, splits free block if needed. */
 unsigned long rh_detach_region(rh_info_t * info, unsigned long start, int size)
@@ -428,6 +433,7 @@ unsigned long rh_detach_region(rh_info_t * info, unsigned long start, int size)
 
 	return s;
 }
+EXPORT_SYMBOL_GPL(rh_detach_region);
 
 /* Allocate a block of memory at the specified alignment.  The value returned
  * is an offset into the buffer initialized by rh_init(), or a negative number
@@ -502,6 +508,7 @@ unsigned long rh_alloc_align(rh_info_t * info, int size, int alignment, const ch
 
 	return start;
 }
+EXPORT_SYMBOL_GPL(rh_alloc_align);
 
 /* Allocate a block of memory at the default alignment.  The value returned is
  * an offset into the buffer initialized by rh_init(), or a negative number if
@@ -511,6 +518,7 @@ unsigned long rh_alloc(rh_info_t * info, int size, const char *owner)
 {
 	return rh_alloc_align(info, size, info->alignment, owner);
 }
+EXPORT_SYMBOL_GPL(rh_alloc);
 
 /* Allocate a block of memory at the given offset, rounded up to the default
  * alignment.  The value returned is an offset into the buffer initialized by
@@ -594,6 +602,7 @@ unsigned long rh_alloc_fixed(rh_info_t * info, unsigned long start, int size, co
 
 	return start;
 }
+EXPORT_SYMBOL_GPL(rh_alloc_fixed);
 
 /* Deallocate the memory previously allocated by one of the rh_alloc functions.
  * The return value is the size of the deallocated block, or a negative number
@@ -626,6 +635,7 @@ int rh_free(rh_info_t * info, unsigned long start)
 
 	return size;
 }
+EXPORT_SYMBOL_GPL(rh_free);
 
 int rh_get_stats(rh_info_t * info, int what, int max_stats, rh_stats_t * stats)
 {
@@ -663,6 +673,7 @@ int rh_get_stats(rh_info_t * info, int what, int max_stats, rh_stats_t * stats)
 
 	return nr;
 }
+EXPORT_SYMBOL_GPL(rh_get_stats);
 
 int rh_set_owner(rh_info_t * info, unsigned long start, const char *owner)
 {
@@ -687,6 +698,7 @@ int rh_set_owner(rh_info_t * info, unsigned long start, const char *owner)
 
 	return size;
 }
+EXPORT_SYMBOL_GPL(rh_set_owner);
 
 void rh_dump(rh_info_t * info)
 {
@@ -722,6 +734,7 @@ void rh_dump(rh_info_t * info)
 		       st[i].size, st[i].owner != NULL ? st[i].owner : "");
 	printk(KERN_INFO "\n");
 }
+EXPORT_SYMBOL_GPL(rh_dump);
 
 void rh_dump_blk(rh_info_t * info, rh_block_t * blk)
 {
@@ -729,3 +742,5 @@ void rh_dump_blk(rh_info_t * info, rh_block_t * blk)
 	       "blk @0x%p: 0x%lx-0x%lx (%u)\n",
 	       blk, blk->start, blk->start + blk->size, blk->size);
 }
+EXPORT_SYMBOL_GPL(rh_dump_blk);
+

^ permalink raw reply related

* [PATCH 5/7] bestcomm: ATA task support
From: Grant Likely @ 2007-10-12 22:25 UTC (permalink / raw)
  To: galak, paulus, linuxppc-dev, tnt
In-Reply-To: <20071012222309.12648.82234.stgit@trillian.cg.shawcable.net>

From: Sylvain Munaut <tnt@246tNt.com>

This is the microcode for the ATA task and the associated
support code.

The microcode itself comes directly from the offical
API (v2.2)

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/powerpc/sysdev/bestcomm/Kconfig         |    7 +
 arch/powerpc/sysdev/bestcomm/Makefile        |    2 
 arch/powerpc/sysdev/bestcomm/ata.c           |  154 ++++++++++++++++++++++++++
 arch/powerpc/sysdev/bestcomm/ata.h           |   37 ++++++
 arch/powerpc/sysdev/bestcomm/bcom_ata_task.c |   67 +++++++++++
 5 files changed, 267 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/sysdev/bestcomm/Kconfig b/arch/powerpc/sysdev/bestcomm/Kconfig
index 3366e24..9d087ce 100644
--- a/arch/powerpc/sysdev/bestcomm/Kconfig
+++ b/arch/powerpc/sysdev/bestcomm/Kconfig
@@ -16,3 +16,10 @@ config PPC_BESTCOMM
 	  If you want to use drivers that require DMA operations,
 	  answer Y or M. Otherwise say N.
 
+config PPC_BESTCOMM_ATA
+	tristate "Bestcomm ATA task support"
+	depends on PPC_BESTCOMM
+	default n
+	help
+	  This option enables the support for the ATA task.
+
diff --git a/arch/powerpc/sysdev/bestcomm/Makefile b/arch/powerpc/sysdev/bestcomm/Makefile
index a24aa06..b7a6a40 100644
--- a/arch/powerpc/sysdev/bestcomm/Makefile
+++ b/arch/powerpc/sysdev/bestcomm/Makefile
@@ -3,6 +3,8 @@
 #
 
 bestcomm-core-objs	:= bestcomm.o sram.o
+bestcomm-ata-objs	:= ata.o bcom_ata_task.o
 
 obj-$(CONFIG_PPC_BESTCOMM)		+= bestcomm-core.o
+obj-$(CONFIG_PPC_BESTCOMM_ATA)		+= bestcomm-ata.o
  
diff --git a/arch/powerpc/sysdev/bestcomm/ata.c b/arch/powerpc/sysdev/bestcomm/ata.c
new file mode 100644
index 0000000..1f5258f
--- /dev/null
+++ b/arch/powerpc/sysdev/bestcomm/ata.c
@@ -0,0 +1,154 @@
+/*
+ * Bestcomm ATA task driver
+ *
+ *
+ * Patterned after bestcomm/fec.c by Dale Farnsworth <dfarnsworth@mvista.com>
+ *                                   2003-2004 (c) MontaVista, Software, Inc.
+ *
+ * Copyright (C) 2006-2007 Sylvain Munaut <tnt@246tNt.com>
+ * Copyright (C) 2006      Freescale - John Rigby
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/types.h>
+#include <asm/io.h>
+
+#include "bestcomm.h"
+#include "bestcomm_priv.h"
+#include "ata.h"
+
+
+/* ======================================================================== */
+/* Task image/var/inc                                                       */
+/* ======================================================================== */
+
+/* ata task image */
+extern u32 bcom_ata_task[];
+
+/* ata task vars that need to be set before enabling the task */
+struct bcom_ata_var {
+	u32 enable;		/* (u16*) address of task's control register */
+	u32 bd_base;		/* (struct bcom_bd*) beginning of ring buffer */
+	u32 bd_last;		/* (struct bcom_bd*) end of ring buffer */
+	u32 bd_start;		/* (struct bcom_bd*) current bd */
+	u32 buffer_size;	/* size of receive buffer */
+};
+
+/* ata task incs that need to be set before enabling the task */
+struct bcom_ata_inc {
+	u16 pad0;
+	s16 incr_bytes;
+	u16 pad1;
+	s16 incr_dst;
+	u16 pad2;
+	s16 incr_src;
+};
+
+
+/* ======================================================================== */
+/* Task support code                                                        */
+/* ======================================================================== */
+
+struct bcom_task *
+bcom_ata_init(int queue_len, int maxbufsize)
+{
+	struct bcom_task *tsk;
+	struct bcom_ata_var *var;
+	struct bcom_ata_inc *inc;
+
+	tsk = bcom_task_alloc(queue_len, sizeof(struct bcom_ata_bd), 0);
+	if (!tsk)
+		return NULL;
+
+	tsk->flags = BCOM_FLAGS_NONE;
+
+	bcom_ata_reset_bd(tsk);
+
+	var = (struct bcom_ata_var *) bcom_task_var(tsk->tasknum);
+	inc = (struct bcom_ata_inc *) bcom_task_inc(tsk->tasknum);
+
+	if (bcom_load_image(tsk->tasknum, bcom_ata_task)) {
+		bcom_task_free(tsk);
+		return NULL;
+	}
+
+	var->enable	= bcom_eng->regs_base +
+				offsetof(struct mpc52xx_sdma, tcr[tsk->tasknum]);
+	var->bd_base	= tsk->bd_pa;
+	var->bd_last	= tsk->bd_pa + ((tsk->num_bd-1) * tsk->bd_size);
+	var->bd_start	= tsk->bd_pa;
+	var->buffer_size = maxbufsize;
+
+	/* Configure some stuff */
+	bcom_set_task_pragma(tsk->tasknum, BCOM_ATA_PRAGMA);
+	bcom_set_task_auto_start(tsk->tasknum, tsk->tasknum);
+
+	out_8(&bcom_eng->regs->ipr[BCOM_INITIATOR_ATA_RX], BCOM_IPR_ATA_RX);
+	out_8(&bcom_eng->regs->ipr[BCOM_INITIATOR_ATA_TX], BCOM_IPR_ATA_TX);
+
+	out_be32(&bcom_eng->regs->IntPend, 1<<tsk->tasknum); /* Clear ints */
+
+	return tsk;
+}
+EXPORT_SYMBOL_GPL(bcom_ata_init);
+
+void bcom_ata_rx_prepare(struct bcom_task *tsk)
+{
+	struct bcom_ata_inc *inc;
+
+	inc = (struct bcom_ata_inc *) bcom_task_inc(tsk->tasknum);
+
+	inc->incr_bytes	= -(s16)sizeof(u32);
+	inc->incr_src	= 0;
+	inc->incr_dst	= sizeof(u32);
+
+	bcom_set_initiator(tsk->tasknum, BCOM_INITIATOR_ATA_RX);
+}
+EXPORT_SYMBOL_GPL(bcom_ata_rx_prepare);
+
+void bcom_ata_tx_prepare(struct bcom_task *tsk)
+{
+	struct bcom_ata_inc *inc;
+
+	inc = (struct bcom_ata_inc *) bcom_task_inc(tsk->tasknum);
+
+	inc->incr_bytes	= -(s16)sizeof(u32);
+	inc->incr_src	= sizeof(u32);
+	inc->incr_dst	= 0;
+
+	bcom_set_initiator(tsk->tasknum, BCOM_INITIATOR_ATA_TX);
+}
+EXPORT_SYMBOL_GPL(bcom_ata_tx_prepare);
+
+void bcom_ata_reset_bd(struct bcom_task *tsk)
+{
+	struct bcom_ata_var *var;
+
+	/* Reset all BD */
+	memset(tsk->bd, 0x00, tsk->num_bd * tsk->bd_size);
+
+	tsk->index = 0;
+	tsk->outdex = 0;
+
+	var = (struct bcom_ata_var *) bcom_task_var(tsk->tasknum);
+	var->bd_start = var->bd_base;
+}
+EXPORT_SYMBOL_GPL(bcom_ata_reset_bd);
+
+void bcom_ata_release(struct bcom_task *tsk)
+{
+	/* Nothing special for the ATA tasks */
+	bcom_task_free(tsk);
+}
+EXPORT_SYMBOL_GPL(bcom_ata_release);
+
+
+MODULE_DESCRIPTION("BestComm ATA task driver");
+MODULE_AUTHOR("John Rigby");
+MODULE_LICENSE("GPL v2");
+
diff --git a/arch/powerpc/sysdev/bestcomm/ata.h b/arch/powerpc/sysdev/bestcomm/ata.h
new file mode 100644
index 0000000..1098276
--- /dev/null
+++ b/arch/powerpc/sysdev/bestcomm/ata.h
@@ -0,0 +1,37 @@
+/*
+ * Header for Bestcomm ATA task driver
+ *
+ *
+ * Copyright (C) 2006 Freescale - John Rigby
+ * Copyright (C) 2006 Sylvain Munaut <tnt@246tNt.com>
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#ifndef __BESTCOMM_ATA_H__
+#define __BESTCOMM_ATA_H__
+
+
+struct bcom_ata_bd {
+	u32	status;
+	u32	dst_pa;
+	u32	src_pa;
+};
+
+extern struct bcom_task *
+bcom_ata_init(int queue_len, int maxbufsize);
+
+extern void
+bcom_ata_rx_prepare(struct bcom_task *tsk);
+
+extern void
+bcom_ata_tx_prepare(struct bcom_task *tsk);
+
+extern void
+bcom_ata_reset_bd(struct bcom_task *tsk);
+
+
+#endif /* __BESTCOMM_ATA_H__ */
+
diff --git a/arch/powerpc/sysdev/bestcomm/bcom_ata_task.c b/arch/powerpc/sysdev/bestcomm/bcom_ata_task.c
new file mode 100644
index 0000000..cc6049a
--- /dev/null
+++ b/arch/powerpc/sysdev/bestcomm/bcom_ata_task.c
@@ -0,0 +1,67 @@
+/*
+ * Bestcomm ATA task microcode
+ *
+ * Copyright (c) 2004 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * Created based on bestcom/code_dma/image_rtos1/dma_image.hex
+ */
+
+#include <asm/types.h>
+
+/*
+ * The header consists of the following fields:
+ *	u32	magic;
+ *	u8	desc_size;
+ *	u8	var_size;
+ *	u8	inc_size;
+ *	u8	first_var;
+ *	u8	reserved[8];
+ *
+ * The size fields contain the number of 32-bit words.
+ */
+
+u32 bcom_ata_task[] = {
+	/* header */
+	0x4243544b,
+	0x0e060709,
+	0x00000000,
+	0x00000000,
+
+	/* Task descriptors */
+	0x8198009b, /* LCD: idx0 = var3; idx0 <= var2; idx0 += inc3 */
+	0x13e00c08, /*   DRD1A: var3 = var1; FN=0 MORE init=31 WS=0 RS=0 */
+	0xb8000264, /*   LCD: idx1 = *idx0, idx2 = var0; idx1 < var9; idx1 += inc4, idx2 += inc4 */
+	0x10000f00, /*     DRD1A: var3 = idx0; FN=0 MORE init=0 WS=0 RS=0 */
+	0x60140002, /*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
+	0x0c8cfc8a, /*     DRD2B1: *idx2 = EU3(); EU3(*idx2,var10)  */
+	0xd8988240, /*   LCDEXT: idx1 = idx1; idx1 > var9; idx1 += inc0 */
+	0xf845e011, /*   LCDEXT: idx2 = *(idx0 + var00000015); ; idx2 += inc2 */
+	0xb845e00a, /*   LCD: idx3 = *(idx0 + var00000019); ; idx3 += inc1 */
+	0x0bfecf90, /*     DRD1A: *idx3 = *idx2; FN=0 TFD init=31 WS=3 RS=3 */
+	0x9898802d, /*   LCD: idx1 = idx1; idx1 once var0; idx1 += inc5 */
+	0x64000005, /*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 INT EXT init=0 WS=0 RS=0 */
+	0x0c0cf849, /*     DRD2B1: *idx0 = EU3(); EU3(idx1,var9)  */
+	0x000001f8, /* NOP */
+
+	/* VAR[9]-VAR[14] */
+	0x40000000,
+	0x7fff7fff,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+	0x00000000,
+
+	/* INC[0]-INC[6] */
+	0x40000000,
+	0xe0000000,
+	0xe0000000,
+	0xa000000c,
+	0x20000000,
+	0x00000000,
+	0x00000000,
+};
+

^ permalink raw reply related

* [PATCH 4/7] bestcomm: core bestcomm support for Freescale MPC5200
From: Grant Likely @ 2007-10-12 22:25 UTC (permalink / raw)
  To: galak, paulus, linuxppc-dev, tnt
In-Reply-To: <20071012222309.12648.82234.stgit@trillian.cg.shawcable.net>

From: Sylvain Munaut <tnt@246tNt.com>

This patch adds support for the core of the BestComm API
for the Freescale MPC5200(b). The BestComm engine is a
microcode-controlled / tasks-based DMA used by several
of the onchip devices.

Setting up the tasks / memory allocation and all common
low level functions are handled by this patch.
The specifics details of each tasks and their microcode
are split-out in separate patches.

This is not the official API, but a much cleaner one.
(hopefully)

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/powerpc/platforms/Kconfig               |    2 
 arch/powerpc/sysdev/Makefile                 |    1 
 arch/powerpc/sysdev/bestcomm/Kconfig         |   18 +
 arch/powerpc/sysdev/bestcomm/Makefile        |    8 
 arch/powerpc/sysdev/bestcomm/bestcomm.c      |  529 ++++++++++++++++++++++++++
 arch/powerpc/sysdev/bestcomm/bestcomm.h      |  129 ++++++
 arch/powerpc/sysdev/bestcomm/bestcomm_priv.h |  325 ++++++++++++++++
 arch/powerpc/sysdev/bestcomm/sram.c          |  177 +++++++++
 arch/powerpc/sysdev/bestcomm/sram.h          |   54 +++
 9 files changed, 1243 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 3724cb4..bdced1e 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -315,4 +315,6 @@ config FSL_ULI1575
 config CPM
 	bool
 
+source "arch/powerpc/sysdev/bestcomm/Kconfig"
+
 endmenu
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index 1a6f564..99a77d7 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -14,6 +14,7 @@ obj-$(CONFIG_FSL_SOC)		+= fsl_soc.o
 obj-$(CONFIG_FSL_PCI)		+= fsl_pci.o
 obj-$(CONFIG_TSI108_BRIDGE)	+= tsi108_pci.o tsi108_dev.o
 obj-$(CONFIG_QUICC_ENGINE)	+= qe_lib/
+obj-$(CONFIG_PPC_BESTCOMM)	+= bestcomm/
 mv64x60-$(CONFIG_PCI)		+= mv64x60_pci.o
 obj-$(CONFIG_MV64X60)		+= $(mv64x60-y) mv64x60_pic.o mv64x60_dev.o \
 				   mv64x60_udbg.o
diff --git a/arch/powerpc/sysdev/bestcomm/Kconfig b/arch/powerpc/sysdev/bestcomm/Kconfig
new file mode 100644
index 0000000..3366e24
--- /dev/null
+++ b/arch/powerpc/sysdev/bestcomm/Kconfig
@@ -0,0 +1,18 @@
+#
+# Kconfig options for Bestcomm
+#
+
+config PPC_BESTCOMM
+	tristate "Bestcomm DMA engine support"
+	depends on PPC_MPC52xx
+	default n
+	select PPC_LIB_RHEAP
+	help
+	  BestComm is the name of the communication coprocessor found
+	  on the Freescale MPC5200 family of processor. It's usage is
+	  optionnal for some drivers (like ATA), but required for
+	  others (like FEC).
+
+	  If you want to use drivers that require DMA operations,
+	  answer Y or M. Otherwise say N.
+
diff --git a/arch/powerpc/sysdev/bestcomm/Makefile b/arch/powerpc/sysdev/bestcomm/Makefile
new file mode 100644
index 0000000..a24aa06
--- /dev/null
+++ b/arch/powerpc/sysdev/bestcomm/Makefile
@@ -0,0 +1,8 @@
+#
+# Makefile for BestComm & co
+#
+
+bestcomm-core-objs	:= bestcomm.o sram.o
+
+obj-$(CONFIG_PPC_BESTCOMM)		+= bestcomm-core.o
+ 
diff --git a/arch/powerpc/sysdev/bestcomm/bestcomm.c b/arch/powerpc/sysdev/bestcomm/bestcomm.c
new file mode 100644
index 0000000..7eaa9fa
--- /dev/null
+++ b/arch/powerpc/sysdev/bestcomm/bestcomm.c
@@ -0,0 +1,529 @@
+/*
+ * Driver for MPC52xx processor BestComm peripheral controller
+ *
+ *
+ * Copyright (C) 2006-2007 Sylvain Munaut <tnt@246tNt.com>
+ * Copyright (C) 2005      Varma Electronics Oy,
+ *                         ( by Andrey Volkov <avolkov@varma-el.com> )
+ * Copyright (C) 2003-2004 MontaVista, Software, Inc.
+ *                         ( by Dale Farnsworth <dfarnsworth@mvista.com> )
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/slab.h>
+
+#include <asm/io.h>
+#include <asm/irq.h>
+#include <asm/prom.h>
+#include <asm/mpc52xx.h>
+#include <asm/of_device.h>
+#include <asm/of_platform.h>
+
+#include "sram.h"
+#include "bestcomm_priv.h"
+#include "bestcomm.h"
+
+#define DRIVER_NAME "bestcomm-core"
+
+
+struct bcom_engine *bcom_eng = NULL;
+EXPORT_SYMBOL_GPL(bcom_eng);	/* needed for inline functions */
+
+
+/* ======================================================================== */
+/* Public and private API                                                   */
+/* ======================================================================== */
+
+/* Private API */
+
+struct bcom_task *
+bcom_task_alloc(int bd_count, int bd_size, int priv_size)
+{
+	int i, tasknum = -1;
+	struct bcom_task *tsk;
+
+	/* Get and reserve a task num */
+	spin_lock(&bcom_eng->lock);
+
+	for (i=0; i<BCOM_MAX_TASKS; i++)
+		if (!bcom_eng->tdt[i].stop) {	/* we use stop as a marker */
+			bcom_eng->tdt[i].stop = 0xfffffffful; /* dummy addr */
+			tasknum = i;
+			break;
+		}
+
+	spin_unlock(&bcom_eng->lock);
+
+	if (tasknum < 0)
+		return NULL;
+
+	/* Allocate our structure */
+	tsk = kzalloc(sizeof(struct bcom_task) + priv_size, GFP_KERNEL);
+	if (!tsk)
+		goto error;
+
+	tsk->tasknum = tasknum;
+	if (priv_size)
+		tsk->priv = (void*)tsk + sizeof(struct bcom_task);
+
+	/* Get IRQ of that task */
+	tsk->irq = irq_of_parse_and_map(bcom_eng->ofnode, tsk->tasknum);
+	if (tsk->irq == NO_IRQ)
+		goto error;
+
+	/* Init the BDs, if needed */
+	if (bd_count) {
+		tsk->cookie = kmalloc(sizeof(void*) * bd_count, GFP_KERNEL);
+		if (!tsk->cookie)
+			goto error;
+
+		tsk->bd = bcom_sram_alloc(bd_count * bd_size, 4, &tsk->bd_pa);
+		if (!tsk->bd)
+			goto error;
+		memset(tsk->bd, 0x00, bd_count * bd_size);
+
+		tsk->num_bd = bd_count;
+		tsk->bd_size = bd_size;
+	}
+
+	return tsk;
+
+error:
+	if (tsk) {
+		if (tsk->irq != NO_IRQ)
+			irq_dispose_mapping(tsk->irq);
+		bcom_sram_free(tsk->bd);
+		kfree(tsk->cookie);
+		kfree(tsk);
+	}
+
+	bcom_eng->tdt[tasknum].stop = 0;
+
+	return NULL;
+}
+EXPORT_SYMBOL_GPL(bcom_task_alloc);
+
+void
+bcom_task_free(struct bcom_task *tsk)
+{
+	/* Stop the task */
+	bcom_disable_task(tsk->tasknum);
+
+	/* Clear TDT */
+	bcom_eng->tdt[tsk->tasknum].start = 0;
+	bcom_eng->tdt[tsk->tasknum].stop  = 0;
+
+	/* Free everything */
+	irq_dispose_mapping(tsk->irq);
+	bcom_sram_free(tsk->bd);
+	kfree(tsk->cookie);
+	kfree(tsk);
+}
+EXPORT_SYMBOL_GPL(bcom_task_free);
+
+int
+bcom_load_image(int task, u32 *task_image)
+{
+	struct bcom_task_header *hdr = (struct bcom_task_header *)task_image;
+	struct bcom_tdt *tdt;
+	u32 *desc, *var, *inc;
+	u32 *desc_src, *var_src, *inc_src;
+
+	/* Safety checks */
+	if (hdr->magic != BCOM_TASK_MAGIC) {
+		printk(KERN_ERR DRIVER_NAME
+			": Trying to load invalid microcode\n");
+		return -EINVAL;
+	}
+
+	if ((task < 0) || (task >= BCOM_MAX_TASKS)) {
+		printk(KERN_ERR DRIVER_NAME
+			": Trying to load invalid task %d\n", task);
+		return -EINVAL;
+	}
+
+	/* Initial load or reload */
+	tdt = &bcom_eng->tdt[task];
+
+	if (tdt->start) {
+		desc = bcom_task_desc(task);
+		if (hdr->desc_size != bcom_task_num_descs(task)) {
+			printk(KERN_ERR DRIVER_NAME
+				": Trying to reload wrong task image "
+				"(%d size %d/%d)!\n",
+				task,
+				hdr->desc_size,
+				bcom_task_num_descs(task));
+			return -EINVAL;
+		}
+	} else {
+		phys_addr_t start_pa;
+
+		desc = bcom_sram_alloc(hdr->desc_size * sizeof(u32), 4, &start_pa);
+		if (!desc)
+			return -ENOMEM;
+
+		tdt->start = start_pa;
+		tdt->stop = start_pa + ((hdr->desc_size-1) * sizeof(u32));
+	}
+
+	var = bcom_task_var(task);
+	inc = bcom_task_inc(task);
+
+	/* Clear & copy */
+	memset(var, 0x00, BCOM_VAR_SIZE);
+	memset(inc, 0x00, BCOM_INC_SIZE);
+
+	desc_src = (u32 *)(hdr + 1);
+	var_src = desc_src + hdr->desc_size;
+	inc_src = var_src + hdr->var_size;
+
+	memcpy(desc, desc_src, hdr->desc_size * sizeof(u32));
+	memcpy(var + hdr->first_var, var_src, hdr->var_size * sizeof(u32));
+	memcpy(inc, inc_src, hdr->inc_size * sizeof(u32));
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(bcom_load_image);
+
+void
+bcom_set_initiator(int task, int initiator)
+{
+	int i;
+	int num_descs;
+	u32 *desc;
+	int next_drd_has_initiator;
+
+	bcom_set_tcr_initiator(task, initiator);
+
+	/* Just setting tcr is apparently not enough due to some problem */
+	/* with it. So we just go thru all the microcode and replace in  */
+	/* the DRD directly */
+
+	desc = bcom_task_desc(task);
+	next_drd_has_initiator = 1;
+	num_descs = bcom_task_num_descs(task);
+
+	for (i=0; i<num_descs; i++, desc++) {
+		if (!bcom_desc_is_drd(*desc))
+			continue;
+		if (next_drd_has_initiator)
+			if (bcom_desc_initiator(*desc) != BCOM_INITIATOR_ALWAYS)
+				bcom_set_desc_initiator(desc, initiator);
+		next_drd_has_initiator = !bcom_drd_is_extended(*desc);
+	}
+}
+EXPORT_SYMBOL_GPL(bcom_set_initiator);
+
+void
+bcom_enable(struct bcom_task *tsk)
+{
+	bcom_enable_task(tsk->tasknum);
+}
+EXPORT_SYMBOL_GPL(bcom_enable);
+
+void
+bcom_disable(struct bcom_task *tsk)
+{
+	bcom_disable_task(tsk->tasknum);
+}
+EXPORT_SYMBOL_GPL(bcom_disable);
+
+
+/* ======================================================================== */
+/* Engine init/cleanup                                                      */
+/* ======================================================================== */
+
+/* Function Descriptor table */
+/* this will need to be updated if Freescale changes their task code FDT */
+static u32 fdt_ops[] = {
+	0xa0045670,	/* FDT[48] - load_acc()	  */
+	0x80045670,	/* FDT[49] - unload_acc() */
+	0x21800000,	/* FDT[50] - and()        */
+	0x21e00000,	/* FDT[51] - or()         */
+	0x21500000,	/* FDT[52] - xor()        */
+	0x21400000,	/* FDT[53] - andn()       */
+	0x21500000,	/* FDT[54] - not()        */
+	0x20400000,	/* FDT[55] - add()        */
+	0x20500000,	/* FDT[56] - sub()        */
+	0x20800000,	/* FDT[57] - lsh()        */
+	0x20a00000,	/* FDT[58] - rsh()        */
+	0xc0170000,	/* FDT[59] - crc8()       */
+	0xc0145670,	/* FDT[60] - crc16()      */
+	0xc0345670,	/* FDT[61] - crc32()      */
+	0xa0076540,	/* FDT[62] - endian32()   */
+	0xa0000760,	/* FDT[63] - endian16()   */
+};
+
+
+static int __devinit
+bcom_engine_init(void)
+{
+	int task;
+	phys_addr_t tdt_pa, ctx_pa, var_pa, fdt_pa;
+	unsigned int tdt_size, ctx_size, var_size, fdt_size;
+
+	/* Allocate & clear SRAM zones for FDT, TDTs, contexts and vars/incs */
+	tdt_size = BCOM_MAX_TASKS * sizeof(struct bcom_tdt);
+	ctx_size = BCOM_MAX_TASKS * BCOM_CTX_SIZE;
+	var_size = BCOM_MAX_TASKS * (BCOM_VAR_SIZE + BCOM_INC_SIZE);
+	fdt_size = BCOM_FDT_SIZE;
+
+	bcom_eng->tdt = bcom_sram_alloc(tdt_size, sizeof(u32), &tdt_pa);
+	bcom_eng->ctx = bcom_sram_alloc(ctx_size, BCOM_CTX_ALIGN, &ctx_pa);
+	bcom_eng->var = bcom_sram_alloc(var_size, BCOM_VAR_ALIGN, &var_pa);
+	bcom_eng->fdt = bcom_sram_alloc(fdt_size, BCOM_FDT_ALIGN, &fdt_pa);
+
+	if (!bcom_eng->tdt || !bcom_eng->ctx || !bcom_eng->var || !bcom_eng->fdt) {
+		printk(KERN_ERR "DMA: SRAM alloc failed in engine init !\n");
+
+		bcom_sram_free(bcom_eng->tdt);
+		bcom_sram_free(bcom_eng->ctx);
+		bcom_sram_free(bcom_eng->var);
+		bcom_sram_free(bcom_eng->fdt);
+
+		return -ENOMEM;
+	}
+
+	memset(bcom_eng->tdt, 0x00, tdt_size);
+	memset(bcom_eng->ctx, 0x00, ctx_size);
+	memset(bcom_eng->var, 0x00, var_size);
+	memset(bcom_eng->fdt, 0x00, fdt_size);
+
+	/* Copy the FDT for the EU#3 */
+	memcpy(&bcom_eng->fdt[48], fdt_ops, sizeof(fdt_ops));
+
+	/* Initialize Task base structure */
+	for (task=0; task<BCOM_MAX_TASKS; task++)
+	{
+		out_be16(&bcom_eng->regs->tcr[task], 0);
+		out_8(&bcom_eng->regs->ipr[task], 0);
+
+		bcom_eng->tdt[task].context	= ctx_pa;
+		bcom_eng->tdt[task].var	= var_pa;
+		bcom_eng->tdt[task].fdt	= fdt_pa;
+
+		var_pa += BCOM_VAR_SIZE + BCOM_INC_SIZE;
+		ctx_pa += BCOM_CTX_SIZE;
+	}
+
+	out_be32(&bcom_eng->regs->taskBar, tdt_pa);
+
+	/* Init 'always' initiator */
+	out_8(&bcom_eng->regs->ipr[BCOM_INITIATOR_ALWAYS], BCOM_IPR_ALWAYS);
+
+	/* Disable COMM Bus Prefetch, apparently it's not reliable yet */
+	/* FIXME: This should be done on 5200 and not 5200B ... */
+	out_be16(&bcom_eng->regs->PtdCntrl, in_be16(&bcom_eng->regs->PtdCntrl) | 1);
+
+	/* Init lock */
+	spin_lock_init(&bcom_eng->lock);
+
+	return 0;
+}
+
+static void
+bcom_engine_cleanup(void)
+{
+	int task;
+
+	/* Stop all tasks */
+	for (task=0; task<BCOM_MAX_TASKS; task++)
+	{
+		out_be16(&bcom_eng->regs->tcr[task], 0);
+		out_8(&bcom_eng->regs->ipr[task], 0);
+	}
+
+	out_be32(&bcom_eng->regs->taskBar, 0ul);
+
+	/* Release the SRAM zones */
+	bcom_sram_free(bcom_eng->tdt);
+	bcom_sram_free(bcom_eng->ctx);
+	bcom_sram_free(bcom_eng->var);
+	bcom_sram_free(bcom_eng->fdt);
+}
+
+
+/* ======================================================================== */
+/* OF platform driver                                                       */
+/* ======================================================================== */
+
+static int __devinit
+mpc52xx_bcom_probe(struct of_device *op, const struct of_device_id *match)
+{
+	struct device_node *ofn_bcom, *ofn_sram;
+	struct resource res_bcom;
+
+	int rv;
+
+	/* Inform user we're ok so far */
+	printk(KERN_INFO "DMA: MPC52xx BestComm driver\n");
+
+	/* Get the bestcomm node */
+	ofn_bcom = op->node;
+	of_node_get(ofn_bcom);
+
+	/* Prepare SRAM */
+	ofn_sram = of_find_compatible_node(NULL, "sram", "mpc5200-sram");
+	if (!ofn_sram) {
+		printk(KERN_ERR DRIVER_NAME ": "
+			"No SRAM found in device tree\n");
+		rv = -ENODEV;
+		goto error_ofput;
+	}
+
+	rv = bcom_sram_init(ofn_sram, DRIVER_NAME);
+
+	of_node_put(ofn_sram);
+
+	if (rv) {
+		printk(KERN_ERR DRIVER_NAME ": "
+			"Error in SRAM init\n");
+		goto error_ofput;
+	}
+
+	/* Get a clean struct */
+	bcom_eng = kzalloc(sizeof(struct bcom_engine), GFP_KERNEL);
+	if (!bcom_eng) {
+		printk(KERN_ERR DRIVER_NAME ": "
+			"Can't allocate state structure\n");
+		rv = -ENOMEM;
+		goto error_sramclean;
+	}
+
+	/* Save the node */
+	bcom_eng->ofnode = ofn_bcom;
+
+	/* Get, reserve & map io */
+	if (of_address_to_resource(bcom_eng->ofnode, 0, &res_bcom)) {
+		printk(KERN_ERR DRIVER_NAME ": "
+			"Can't get resource\n");
+		rv = -EINVAL;
+		goto error_sramclean;
+	}
+
+	if (!request_mem_region(res_bcom.start, sizeof(struct mpc52xx_sdma),
+				DRIVER_NAME)) {
+		printk(KERN_ERR DRIVER_NAME ": "
+			"Can't request registers region\n");
+		rv = -EBUSY;
+		goto error_sramclean;
+	}
+
+	bcom_eng->regs_base = res_bcom.start;
+	bcom_eng->regs = ioremap(res_bcom.start, sizeof(struct mpc52xx_sdma));
+	if (!bcom_eng->regs) {
+		printk(KERN_ERR DRIVER_NAME ": "
+			"Can't map registers\n");
+		rv = -ENOMEM;
+		goto error_release;
+	}
+
+	/* Now, do the real init */
+	rv = bcom_engine_init();
+	if (rv)
+		goto error_unmap;
+
+	/* Done ! */
+	printk(KERN_INFO "DMA: MPC52xx BestComm engine @%08lx ok !\n",
+		bcom_eng->regs_base);
+
+	return 0;
+
+	/* Error path */
+error_unmap:
+	iounmap(bcom_eng->regs);
+error_release:
+	release_mem_region(res_bcom.start, sizeof(struct mpc52xx_sdma));
+error_sramclean:
+	bcom_sram_cleanup();
+error_ofput:
+	of_node_put(bcom_eng->ofnode);
+
+	printk(KERN_ERR "DMA: MPC52xx BestComm init failed !\n");
+
+	return rv;
+}
+
+
+static int
+mpc52xx_bcom_remove(struct of_device *op)
+{
+	/* Clean up the engine */
+	bcom_engine_cleanup();
+
+	/* Cleanup SRAM */
+	bcom_sram_cleanup();
+
+	/* Release regs */
+	iounmap(bcom_eng->regs);
+	release_mem_region(bcom_eng->regs_base, sizeof(struct mpc52xx_sdma));
+
+	/* Release the node */
+	of_node_put(bcom_eng->ofnode);
+
+	/* Release memory */
+	kfree(bcom_eng);
+	bcom_eng = NULL;
+
+	return 0;
+}
+
+
+static struct of_device_id mpc52xx_bcom_of_match[] = {
+	{
+		.type		= "dma-controller",
+		.compatible	= "mpc5200-bestcomm",
+	},
+	{},
+};
+
+MODULE_DEVICE_TABLE(of, mpc52xx_bcom_of_match);
+
+
+static struct of_platform_driver mpc52xx_bcom_of_platform_driver = {
+	.owner		= THIS_MODULE,
+	.name		= DRIVER_NAME,
+	.match_table	= mpc52xx_bcom_of_match,
+	.probe		= mpc52xx_bcom_probe,
+	.remove		= mpc52xx_bcom_remove,
+	.driver		= {
+		.name	= DRIVER_NAME,
+		.owner	= THIS_MODULE,
+	},
+};
+
+
+/* ======================================================================== */
+/* Module                                                                   */
+/* ======================================================================== */
+
+static int __init
+mpc52xx_bcom_init(void)
+{
+	return of_register_platform_driver(&mpc52xx_bcom_of_platform_driver);
+}
+
+static void __exit
+mpc52xx_bcom_exit(void)
+{
+	of_unregister_platform_driver(&mpc52xx_bcom_of_platform_driver);
+}
+
+/* If we're not a module, we must make sure everything is setup before  */
+/* anyone tries to use us ... that's why we use subsys_initcall instead */
+/* of module_init. */
+subsys_initcall(mpc52xx_bcom_init);
+module_exit(mpc52xx_bcom_exit);
+
+MODULE_DESCRIPTION("Freescale MPC52xx BestComm DMA");
+MODULE_AUTHOR("Sylvain Munaut <tnt@246tNt.com>");
+MODULE_AUTHOR("Andrey Volkov <avolkov@varma-el.com>");
+MODULE_AUTHOR("Dale Farnsworth <dfarnsworth@mvista.com>");
+MODULE_LICENSE("GPL v2");
+
diff --git a/arch/powerpc/sysdev/bestcomm/bestcomm.h b/arch/powerpc/sysdev/bestcomm/bestcomm.h
new file mode 100644
index 0000000..cacda6b
--- /dev/null
+++ b/arch/powerpc/sysdev/bestcomm/bestcomm.h
@@ -0,0 +1,129 @@
+/*
+ * Public header for the MPC52xx processor BestComm driver
+ *
+ *
+ * Copyright (C) 2006      Sylvain Munaut <tnt@246tNt.com>
+ * Copyright (C) 2005      Varma Electronics Oy,
+ *                         ( by Andrey Volkov <avolkov@varma-el.com> )
+ * Copyright (C) 2003-2004 MontaVista, Software, Inc.
+ *                         ( by Dale Farnsworth <dfarnsworth@mvista.com> )
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#ifndef __BESTCOMM_H__
+#define __BESTCOMM_H__
+
+struct bcom_bd; /* defined later on ... */
+
+
+/* ======================================================================== */
+/* Generic task managment                                                   */
+/* ======================================================================== */
+
+struct bcom_task {
+	unsigned int	tasknum;
+	unsigned int	flags;
+	int		irq;
+
+	struct bcom_bd	*bd;
+	phys_addr_t	bd_pa;
+	void		**cookie;
+	unsigned short	index;
+	unsigned short	outdex;
+	unsigned int	num_bd;
+	unsigned int	bd_size;
+
+	void*		priv;
+};
+
+#define BCOM_FLAGS_NONE         0x00000000ul
+#define BCOM_FLAGS_ENABLE_TASK  (1ul <<  0)
+
+
+extern void bcom_enable(struct bcom_task *tsk);
+extern void bcom_disable(struct bcom_task *tsk);
+
+static inline int
+bcom_get_task_irq(struct bcom_task *tsk) {
+	return tsk->irq;
+}
+
+/* ======================================================================== */
+/* BD based tasks helpers                                                   */
+/* ======================================================================== */
+
+struct bcom_bd {
+	u32	status;
+	u32	data[1];	/* variable, but at least 1 */
+};
+
+#define BCOM_BD_READY	0x40000000ul
+
+static inline int	/* user shouldn't use this ! */
+_bcom_next_index(struct bcom_task *tsk)
+{
+	return ((tsk->index + 1) == tsk->num_bd) ? 0 : tsk->index + 1;
+}
+
+static inline int	/* user shouldn't use this ! */
+_bcom_next_outdex(struct bcom_task *tsk)
+{
+	return ((tsk->outdex + 1) == tsk->num_bd) ? 0 : tsk->outdex + 1;
+}
+
+static inline int
+bcom_queue_empty(struct bcom_task *tsk)
+{
+	return tsk->index == tsk->outdex;
+}
+
+static inline int
+bcom_queue_full(struct bcom_task *tsk)
+{
+	return tsk->outdex == _bcom_next_index(tsk);
+}
+
+static inline int
+bcom_buffer_done(struct bcom_task *tsk)
+{
+	if (bcom_queue_empty(tsk))
+		return 0;
+	return !(tsk->bd[tsk->outdex].status & BCOM_BD_READY);
+}
+
+static inline struct bcom_bd *
+bcom_prepare_next_buffer(struct bcom_task *tsk)
+{
+	tsk->bd[tsk->index].status = 0;	/* cleanup last status */
+	return &tsk->bd[tsk->index];
+}
+
+static inline void
+bcom_submit_next_buffer(struct bcom_task *tsk, void *cookie)
+{
+	tsk->cookie[tsk->index] = cookie;
+	mb();	/* ensure the bd is really up-to-date */
+	tsk->bd[tsk->index].status |= BCOM_BD_READY;
+	tsk->index = _bcom_next_index(tsk);
+	if (tsk->flags & BCOM_FLAGS_ENABLE_TASK)
+		bcom_enable(tsk);
+}
+
+static inline void *
+bcom_retrieve_buffer(struct bcom_task *tsk, u32 *p_status, struct bcom_bd **p_bd)
+{
+	void *cookie = tsk->cookie[tsk->outdex];
+	if (p_status)
+		*p_status = tsk->bd[tsk->outdex].status;
+	if (p_bd)
+		*p_bd = &tsk->bd[tsk->outdex];
+	tsk->outdex = _bcom_next_outdex(tsk);
+	return cookie;
+}
+
+
+#endif /* __BESTCOMM_H__ */
+
diff --git a/arch/powerpc/sysdev/bestcomm/bestcomm_priv.h b/arch/powerpc/sysdev/bestcomm/bestcomm_priv.h
new file mode 100644
index 0000000..37eeb50
--- /dev/null
+++ b/arch/powerpc/sysdev/bestcomm/bestcomm_priv.h
@@ -0,0 +1,325 @@
+/*
+ * Private header for the MPC52xx processor BestComm driver
+ *
+ *
+ * Copyright (C) 2006      Sylvain Munaut <tnt@246tNt.com>
+ * Copyright (C) 2005      Varma Electronics Oy,
+ *                         ( by Andrey Volkov <avolkov@varma-el.com> )
+ * Copyright (C) 2003-2004 MontaVista, Software, Inc.
+ *                         ( by Dale Farnsworth <dfarnsworth@mvista.com> )
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#ifndef __BESTCOMM_PRIV_H__
+#define __BESTCOMM_PRIV_H__
+
+#include <linux/spinlock.h>
+#include <asm/io.h>
+#include <asm/prom.h>
+#include <asm/mpc52xx.h>
+
+#include "sram.h"
+
+
+/* ======================================================================== */
+/* Engine related stuff                                                     */
+/* ======================================================================== */
+
+/* Zones sizes and needed alignments */
+#define BCOM_MAX_TASKS		16
+#define BCOM_MAX_VAR		24
+#define BCOM_MAX_INC		8
+#define BCOM_MAX_FDT		64
+#define BCOM_MAX_CTX		20
+#define BCOM_CTX_SIZE		(BCOM_MAX_CTX * sizeof(u32))
+#define BCOM_CTX_ALIGN		0x100
+#define BCOM_VAR_SIZE		(BCOM_MAX_VAR * sizeof(u32))
+#define BCOM_INC_SIZE		(BCOM_MAX_INC * sizeof(u32))
+#define BCOM_VAR_ALIGN		0x80
+#define BCOM_FDT_SIZE		(BCOM_MAX_FDT * sizeof(u32))
+#define BCOM_FDT_ALIGN		0x100
+
+/* Task Descriptor Table Entry */
+struct bcom_tdt {
+	u32 start;
+	u32 stop;
+	u32 var;
+	u32 fdt;
+	u32 exec_status;	/* used internally by BestComm engine */
+	u32 mvtp;		/* used internally by BestComm engine */
+	u32 context;
+	u32 litbase;
+};
+
+/* This holds all info needed globaly to handle the engine */
+struct bcom_engine {
+	struct device_node		*ofnode;
+	struct mpc52xx_sdma __iomem     *regs;
+	phys_addr_t                      regs_base;
+
+	struct bcom_tdt			*tdt;
+	u32				*ctx;
+	u32				*var;
+	u32				*fdt;
+
+	spinlock_t			lock;
+};
+
+extern struct bcom_engine *bcom_eng;
+
+
+/* ======================================================================== */
+/* Tasks related stuff                                                      */
+/* ======================================================================== */
+
+/* Tasks image header */
+#define BCOM_TASK_MAGIC		0x4243544B	/* 'BCTK' */
+
+struct bcom_task_header {
+	u32	magic;
+	u8	desc_size;	/* the size fields     */
+	u8	var_size;	/* are given in number */
+	u8	inc_size;	/* of 32-bits words    */
+	u8	first_var;
+	u8	reserved[8];
+};
+
+/* Descriptors stucture & co */
+#define BCOM_DESC_NOP		0x000001f8
+#define BCOM_LCD_MASK		0x80000000
+#define BCOM_DRD_EXTENDED	0x40000000
+#define BCOM_DRD_INITIATOR_SHIFT	21
+
+/* Tasks pragma */
+#define BCOM_PRAGMA_BIT_RSV		7	/* reserved pragma bit */
+#define BCOM_PRAGMA_BIT_PRECISE_INC	6	/* increment 0=when possible, */
+						/*           1=iter end */
+#define BCOM_PRAGMA_BIT_RST_ERROR_NO	5	/* don't reset errors on */
+						/* task enable */
+#define BCOM_PRAGMA_BIT_PACK		4	/* pack data enable */
+#define BCOM_PRAGMA_BIT_INTEGER		3	/* data alignment */
+						/* 0=frac(msb), 1=int(lsb) */
+#define BCOM_PRAGMA_BIT_SPECREAD	2	/* XLB speculative read */
+#define BCOM_PRAGMA_BIT_CW		1	/* write line buffer enable */
+#define BCOM_PRAGMA_BIT_RL		0	/* read line buffer enable */
+
+	/* Looks like XLB speculative read generates XLB errors when a buffer
+	 * is at the end of the physical memory. i.e. when accessing the
+	 * lasts words, the engine tries to prefetch the next but there is no
+	 * next ...
+	 */
+#define BCOM_STD_PRAGMA		((0 << BCOM_PRAGMA_BIT_RSV)		| \
+				 (0 << BCOM_PRAGMA_BIT_PRECISE_INC)	| \
+				 (0 << BCOM_PRAGMA_BIT_RST_ERROR_NO)	| \
+				 (0 << BCOM_PRAGMA_BIT_PACK)		| \
+				 (0 << BCOM_PRAGMA_BIT_INTEGER)		| \
+				 (0 << BCOM_PRAGMA_BIT_SPECREAD)	| \
+				 (1 << BCOM_PRAGMA_BIT_CW)		| \
+				 (1 << BCOM_PRAGMA_BIT_RL))
+
+#define BCOM_PCI_PRAGMA		((0 << BCOM_PRAGMA_BIT_RSV)		| \
+				 (0 << BCOM_PRAGMA_BIT_PRECISE_INC)	| \
+				 (0 << BCOM_PRAGMA_BIT_RST_ERROR_NO)	| \
+				 (0 << BCOM_PRAGMA_BIT_PACK)		| \
+				 (1 << BCOM_PRAGMA_BIT_INTEGER)		| \
+				 (0 << BCOM_PRAGMA_BIT_SPECREAD)	| \
+				 (1 << BCOM_PRAGMA_BIT_CW)		| \
+				 (1 << BCOM_PRAGMA_BIT_RL))
+
+#define BCOM_ATA_PRAGMA		BCOM_STD_PRAGMA
+#define BCOM_CRC16_DP_0_PRAGMA	BCOM_STD_PRAGMA
+#define BCOM_CRC16_DP_1_PRAGMA	BCOM_STD_PRAGMA
+#define BCOM_FEC_RX_BD_PRAGMA	BCOM_STD_PRAGMA
+#define BCOM_FEC_TX_BD_PRAGMA	BCOM_STD_PRAGMA
+#define BCOM_GEN_DP_0_PRAGMA	BCOM_STD_PRAGMA
+#define BCOM_GEN_DP_1_PRAGMA	BCOM_STD_PRAGMA
+#define BCOM_GEN_DP_2_PRAGMA	BCOM_STD_PRAGMA
+#define BCOM_GEN_DP_3_PRAGMA	BCOM_STD_PRAGMA
+#define BCOM_GEN_DP_BD_0_PRAGMA	BCOM_STD_PRAGMA
+#define BCOM_GEN_DP_BD_1_PRAGMA	BCOM_STD_PRAGMA
+#define BCOM_GEN_RX_BD_PRAGMA	BCOM_STD_PRAGMA
+#define BCOM_GEN_TX_BD_PRAGMA	BCOM_STD_PRAGMA
+#define BCOM_GEN_LPC_PRAGMA	BCOM_STD_PRAGMA
+#define BCOM_PCI_RX_PRAGMA	BCOM_PCI_PRAGMA
+#define BCOM_PCI_TX_PRAGMA	BCOM_PCI_PRAGMA
+
+/* Initiators number */
+#define BCOM_INITIATOR_ALWAYS	 0
+#define BCOM_INITIATOR_SCTMR_0	 1
+#define BCOM_INITIATOR_SCTMR_1	 2
+#define BCOM_INITIATOR_FEC_RX	 3
+#define BCOM_INITIATOR_FEC_TX	 4
+#define BCOM_INITIATOR_ATA_RX	 5
+#define BCOM_INITIATOR_ATA_TX	 6
+#define BCOM_INITIATOR_SCPCI_RX	 7
+#define BCOM_INITIATOR_SCPCI_TX	 8
+#define BCOM_INITIATOR_PSC3_RX	 9
+#define BCOM_INITIATOR_PSC3_TX	10
+#define BCOM_INITIATOR_PSC2_RX	11
+#define BCOM_INITIATOR_PSC2_TX	12
+#define BCOM_INITIATOR_PSC1_RX	13
+#define BCOM_INITIATOR_PSC1_TX	14
+#define BCOM_INITIATOR_SCTMR_2	15
+#define BCOM_INITIATOR_SCLPC	16
+#define BCOM_INITIATOR_PSC5_RX	17
+#define BCOM_INITIATOR_PSC5_TX	18
+#define BCOM_INITIATOR_PSC4_RX	19
+#define BCOM_INITIATOR_PSC4_TX	20
+#define BCOM_INITIATOR_I2C2_RX	21
+#define BCOM_INITIATOR_I2C2_TX	22
+#define BCOM_INITIATOR_I2C1_RX	23
+#define BCOM_INITIATOR_I2C1_TX	24
+#define BCOM_INITIATOR_PSC6_RX	25
+#define BCOM_INITIATOR_PSC6_TX	26
+#define BCOM_INITIATOR_IRDA_RX	25
+#define BCOM_INITIATOR_IRDA_TX	26
+#define BCOM_INITIATOR_SCTMR_3	27
+#define BCOM_INITIATOR_SCTMR_4	28
+#define BCOM_INITIATOR_SCTMR_5	29
+#define BCOM_INITIATOR_SCTMR_6	30
+#define BCOM_INITIATOR_SCTMR_7	31
+
+/* Initiators priorities */
+#define BCOM_IPR_ALWAYS		7
+#define BCOM_IPR_SCTMR_0	2
+#define BCOM_IPR_SCTMR_1	2
+#define BCOM_IPR_FEC_RX		6
+#define BCOM_IPR_FEC_TX		5
+#define BCOM_IPR_ATA_RX		4
+#define BCOM_IPR_ATA_TX		3
+#define BCOM_IPR_SCPCI_RX	2
+#define BCOM_IPR_SCPCI_TX	2
+#define BCOM_IPR_PSC3_RX	2
+#define BCOM_IPR_PSC3_TX	2
+#define BCOM_IPR_PSC2_RX	2
+#define BCOM_IPR_PSC2_TX	2
+#define BCOM_IPR_PSC1_RX	2
+#define BCOM_IPR_PSC1_TX	2
+#define BCOM_IPR_SCTMR_2	2
+#define BCOM_IPR_SCLPC		2
+#define BCOM_IPR_PSC5_RX	2
+#define BCOM_IPR_PSC5_TX	2
+#define BCOM_IPR_PSC4_RX	2
+#define BCOM_IPR_PSC4_TX	2
+#define BCOM_IPR_I2C2_RX	2
+#define BCOM_IPR_I2C2_TX	2
+#define BCOM_IPR_I2C1_RX	2
+#define BCOM_IPR_I2C1_TX	2
+#define BCOM_IPR_PSC6_RX	2
+#define BCOM_IPR_PSC6_TX	2
+#define BCOM_IPR_IRDA_RX	2
+#define BCOM_IPR_IRDA_TX	2
+#define BCOM_IPR_SCTMR_3	2
+#define BCOM_IPR_SCTMR_4	2
+#define BCOM_IPR_SCTMR_5	2
+#define BCOM_IPR_SCTMR_6	2
+#define BCOM_IPR_SCTMR_7	2
+
+
+/* ======================================================================== */
+/* API                                                                      */
+/* ======================================================================== */
+
+extern struct bcom_task *bcom_task_alloc(int bd_count, int bd_size, int priv_size);
+extern void bcom_task_free(struct bcom_task *tsk);
+
+extern int bcom_load_image(int task, u32 *task_image);
+extern void bcom_set_initiator(int task, int initiator);
+
+
+#define TASK_ENABLE             0x8000
+
+static inline void
+bcom_enable_task(int task)
+{
+        u16 reg;
+        reg = in_be16(&bcom_eng->regs->tcr[task]);
+        out_be16(&bcom_eng->regs->tcr[task],  reg | TASK_ENABLE);
+}
+
+static inline void
+bcom_disable_task(int task)
+{
+        u16 reg = in_be16(&bcom_eng->regs->tcr[task]);
+        out_be16(&bcom_eng->regs->tcr[task], reg & ~TASK_ENABLE);
+}
+
+
+static inline u32 *
+bcom_task_desc(int task)
+{
+	return bcom_sram_pa2va(bcom_eng->tdt[task].start);
+}
+
+static inline int
+bcom_task_num_descs(int task)
+{
+	return (bcom_eng->tdt[task].stop - bcom_eng->tdt[task].start)/sizeof(u32) + 1;
+}
+
+static inline u32 *
+bcom_task_var(int task)
+{
+	return bcom_sram_pa2va(bcom_eng->tdt[task].var);
+}
+
+static inline u32 *
+bcom_task_inc(int task)
+{
+	return &bcom_task_var(task)[BCOM_MAX_VAR];
+}
+
+
+static inline int
+bcom_drd_is_extended(u32 desc)
+{
+	return (desc) & BCOM_DRD_EXTENDED;
+}
+
+static inline int
+bcom_desc_is_drd(u32 desc)
+{
+	return !(desc & BCOM_LCD_MASK) && desc != BCOM_DESC_NOP;
+}
+
+static inline int
+bcom_desc_initiator(u32 desc)
+{
+	return (desc >> BCOM_DRD_INITIATOR_SHIFT) & 0x1f;
+}
+
+static inline void
+bcom_set_desc_initiator(u32 *desc, int initiator)
+{
+	*desc = (*desc & ~(0x1f << BCOM_DRD_INITIATOR_SHIFT)) |
+			((initiator & 0x1f) << BCOM_DRD_INITIATOR_SHIFT);
+}
+
+
+static inline void
+bcom_set_task_pragma(int task, int pragma)
+{
+	u32 *fdt = &bcom_eng->tdt[task].fdt;
+	*fdt = (*fdt & ~0xff) | pragma;
+}
+
+static inline void
+bcom_set_task_auto_start(int task, int next_task)
+{
+	u16 __iomem *tcr = &bcom_eng->regs->tcr[task];
+	out_be16(tcr, (in_be16(tcr) & ~0xff) | 0x00c0 | next_task);
+}
+
+static inline void
+bcom_set_tcr_initiator(int task, int initiator)
+{
+	u16 __iomem *tcr = &bcom_eng->regs->tcr[task];
+	out_be16(tcr, (in_be16(tcr) & ~0x1f00) | ((initiator & 0x1f) << 8));
+}
+
+
+#endif /* __BESTCOMM_PRIV_H__ */
+
diff --git a/arch/powerpc/sysdev/bestcomm/sram.c b/arch/powerpc/sysdev/bestcomm/sram.c
new file mode 100644
index 0000000..a5094d6
--- /dev/null
+++ b/arch/powerpc/sysdev/bestcomm/sram.c
@@ -0,0 +1,177 @@
+/*
+ * Simple memory allocator for on-board SRAM
+ *
+ *
+ * Maintainer : Sylvain Munaut <tnt@246tNt.com>
+ *
+ * Copyright (C) 2005 Sylvain Munaut <tnt@246tNt.com>
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/string.h>
+#include <linux/ioport.h>
+
+#include <asm/io.h>
+#include <asm/mmu.h>
+#include <asm/prom.h>
+
+#include "sram.h"
+
+
+/* Struct keeping our 'state' */
+struct bcom_sram *bcom_sram = NULL;
+EXPORT_SYMBOL_GPL(bcom_sram);	/* needed for inline functions */
+
+
+/* ======================================================================== */
+/* Public API                                                               */
+/* ======================================================================== */
+/* DO NOT USE in interrupts, if needed in irq handler, we should use the
+   _irqsave version of the spin_locks */
+
+int bcom_sram_init(struct device_node *sram_node, char *owner)
+{
+	int rv;
+	const u32 *regaddr_p;
+	u64 regaddr64, size64;
+	unsigned int psize;
+
+	/* Create our state struct */
+	if (bcom_sram) {
+		printk(KERN_ERR "%s: bcom_sram_init: "
+			"Already initialiwed !\n", owner);
+		return -EBUSY;
+	}
+
+	bcom_sram = kmalloc(sizeof(struct bcom_sram), GFP_KERNEL);
+	if (!bcom_sram) {
+		printk(KERN_ERR "%s: bcom_sram_init: "
+			"Couldn't allocate internal state !\n", owner);
+		return -ENOMEM;
+	}
+
+	/* Get address and size of the sram */
+	regaddr_p = of_get_address(sram_node, 0, &size64, NULL);
+	if (!regaddr_p) {
+		printk(KERN_ERR "%s: bcom_sram_init: "
+			"Invalid device node !\n", owner);
+		rv = -EINVAL;
+		goto error_free;
+	}
+
+	regaddr64 = of_translate_address(sram_node, regaddr_p);
+
+	bcom_sram->base_phys = (phys_addr_t) regaddr64;
+	bcom_sram->size = (unsigned int) size64;
+
+	/* Request region */
+	if (!request_mem_region(bcom_sram->base_phys, bcom_sram->size, owner)) {
+		printk(KERN_ERR "%s: bcom_sram_init: "
+			"Couln't request region !\n", owner);
+		rv = -EBUSY;
+		goto error_free;
+	}
+
+	/* Map SRAM */
+		/* sram is not really __iomem */
+	bcom_sram->base_virt = (void*) ioremap(bcom_sram->base_phys, bcom_sram->size);
+
+	if (!bcom_sram->base_virt) {
+		printk(KERN_ERR "%s: bcom_sram_init: "
+			"Map error SRAM zone 0x%08lx (0x%0x)!\n",
+			owner, bcom_sram->base_phys, bcom_sram->size );
+		rv = -ENOMEM;
+		goto error_release;
+	}
+
+	/* Create an rheap (defaults to 32 bits word alignment) */
+	bcom_sram->rh = rh_create(4);
+
+	/* Attach the free zones */
+#if 0
+	/* Currently disabled ... for future use only */
+	reg_addr_p = of_get_property(sram_node, "available", &psize);
+#else
+	regaddr_p = NULL;
+	psize = 0;
+#endif
+
+	if (!regaddr_p || !psize) {
+		/* Attach the whole zone */
+		rh_attach_region(bcom_sram->rh, 0, bcom_sram->size);
+	} else {
+		/* Attach each zone independently */
+		while (psize >= 2 * sizeof(u32)) {
+			phys_addr_t zbase = of_translate_address(sram_node, regaddr_p);
+			rh_attach_region(bcom_sram->rh, zbase - bcom_sram->base_phys, regaddr_p[1]);
+			regaddr_p += 2;
+			psize -= 2 * sizeof(u32);
+		}
+	}
+
+	/* Init our spinlock */
+	spin_lock_init(&bcom_sram->lock);
+
+	return 0;
+
+error_release:
+	release_mem_region(bcom_sram->base_phys, bcom_sram->size);
+error_free:
+	kfree(bcom_sram);
+	bcom_sram = NULL;
+
+	return rv;
+}
+EXPORT_SYMBOL_GPL(bcom_sram_init);
+
+void bcom_sram_cleanup(void)
+{
+	/* Free resources */
+	if (bcom_sram) {
+		rh_destroy(bcom_sram->rh);
+		iounmap((void __iomem *)bcom_sram->base_virt);
+		release_mem_region(bcom_sram->base_phys, bcom_sram->size);
+		kfree(bcom_sram);
+		bcom_sram = NULL;
+	}
+}
+EXPORT_SYMBOL_GPL(bcom_sram_cleanup);
+
+void* bcom_sram_alloc(int size, int align, phys_addr_t *phys)
+{
+	unsigned long offset;
+
+	spin_lock(&bcom_sram->lock);
+	offset = rh_alloc_align(bcom_sram->rh, size, align, NULL);
+	spin_unlock(&bcom_sram->lock);
+
+	if (IS_ERR_VALUE(offset))
+		return NULL;
+
+	*phys = bcom_sram->base_phys + offset;
+	return bcom_sram->base_virt + offset;
+}
+EXPORT_SYMBOL_GPL(bcom_sram_alloc);
+
+void bcom_sram_free(void *ptr)
+{
+	unsigned long offset;
+
+	if (!ptr)
+		return;
+
+	offset = ptr - bcom_sram->base_virt;
+
+	spin_lock(&bcom_sram->lock);
+	rh_free(bcom_sram->rh, offset);
+	spin_unlock(&bcom_sram->lock);
+}
+EXPORT_SYMBOL_GPL(bcom_sram_free);
+
diff --git a/arch/powerpc/sysdev/bestcomm/sram.h b/arch/powerpc/sysdev/bestcomm/sram.h
new file mode 100644
index 0000000..b6d6689
--- /dev/null
+++ b/arch/powerpc/sysdev/bestcomm/sram.h
@@ -0,0 +1,54 @@
+/*
+ * Handling of a sram zone for bestcomm
+ *
+ *
+ * Copyright (C) 2007 Sylvain Munaut <tnt@246tNt.com>
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#ifndef __BESTCOMM_SRAM_H__
+#define __BESTCOMM_SRAM_H__
+
+#include <asm/rheap.h>
+#include <asm/mmu.h>
+#include <linux/spinlock.h>
+
+
+/* Structure used internally */
+	/* The internals are here for the inline functions
+	 * sake, certainly not for the user to mess with !
+	 */
+struct bcom_sram {
+	phys_addr_t		 base_phys;
+	void 			*base_virt;
+	unsigned int		 size;
+	rh_info_t		*rh;
+	spinlock_t		 lock;
+};
+
+extern struct bcom_sram *bcom_sram;
+
+
+/* Public API */
+extern int  bcom_sram_init(struct device_node *sram_node, char *owner);
+extern void bcom_sram_cleanup(void);
+
+extern void* bcom_sram_alloc(int size, int align, phys_addr_t *phys);
+extern void  bcom_sram_free(void *ptr);
+
+static inline phys_addr_t bcom_sram_va2pa(void *va) {
+	return bcom_sram->base_phys +
+		(unsigned long)(va - bcom_sram->base_virt);
+}
+
+static inline void *bcom_sram_pa2va(phys_addr_t pa) {
+	return bcom_sram->base_virt +
+		(unsigned long)(pa - bcom_sram->base_phys);
+}
+
+
+#endif  /* __BESTCOMM_SRAM_H__ */
+

^ permalink raw reply related

* [PATCH 0/7] Respin of Sylvain's bestcomm patches
From: Grant Likely @ 2007-10-12 22:25 UTC (permalink / raw)
  To: galak, paulus, linuxppc-dev, tnt

Paulus/Kumar;

Here's a respin of Sylvain's bestcomm patches.  I've addressed the
outstanding minor issues.  I think this stuff needs to be merged.

Cheers,
g.

--
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply

* [PATCH 2/7] rheap: Changes config mechanism
From: Grant Likely @ 2007-10-12 22:25 UTC (permalink / raw)
  To: galak, paulus, linuxppc-dev, tnt
In-Reply-To: <20071012222309.12648.82234.stgit@trillian.cg.shawcable.net>

From: Sylvain Munaut <tnt@246tNt.com>

Instead of having in the makefile all the option that
requires rheap, we define a configuration symbol
and when needed we make sure it's selected.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/powerpc/Kconfig                   |    4 ++++
 arch/powerpc/lib/Makefile              |    5 +----
 arch/powerpc/platforms/Kconfig         |    2 ++
 arch/powerpc/platforms/Kconfig.cputype |    1 +
 arch/ppc/Kconfig                       |    6 ++++++
 5 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 037664d..8300e6a 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -698,3 +698,7 @@ source "crypto/Kconfig"
 config PPC_CLOCK
 	bool
 	default n
+
+config PPC_LIB_RHEAP
+	bool
+
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 65d492e..4bb023f 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -14,7 +14,6 @@ endif
 
 obj-$(CONFIG_PPC64)	+= copypage_64.o copyuser_64.o \
 			   memcpy_64.o usercopy_64.o mem_64.o string.o
-obj-$(CONFIG_QUICC_ENGINE) += rheap.o
 obj-$(CONFIG_XMON)	+= sstep.o
 obj-$(CONFIG_KPROBES)	+= sstep.o
 obj-$(CONFIG_NOT_COHERENT_CACHE)	+= dma-noncoherent.o
@@ -23,6 +22,4 @@ ifeq ($(CONFIG_PPC64),y)
 obj-$(CONFIG_SMP)	+= locks.o
 endif
 
-# Temporary hack until we have migrated to asm-powerpc
-obj-$(CONFIG_8xx)	+= rheap.o
-obj-$(CONFIG_CPM2)	+= rheap.o
+obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index cc6013f..3724cb4 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -264,6 +264,7 @@ config TAU_AVERAGE
 
 config QUICC_ENGINE
 	bool
+	select PPC_LIB_RHEAP
 	help
 	  The QUICC Engine (QE) is a new generation of communications
 	  coprocessors on Freescale embedded CPUs (akin to CPM in older chips).
@@ -274,6 +275,7 @@ config CPM2
 	bool
 	default n
 	select CPM
+	select PPC_LIB_RHEAP
 	help
 	  The CPM2 (Communications Processor Module) is a coprocessor on
 	  embedded CPUs made by Freescale.  Selecting this option means that
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 4c315be..3c7325e 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -37,6 +37,7 @@ config PPC_8xx
 	select FSL_SOC
 	select 8xx
 	select WANT_DEVICE_TREE
+	select PPC_LIB_RHEAP
 
 config 40x
 	bool "AMCC 40x"
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig
index 20dce46..607925c 100644
--- a/arch/ppc/Kconfig
+++ b/arch/ppc/Kconfig
@@ -102,6 +102,7 @@ config 44x
 
 config 8xx
 	bool "8xx"
+	select PPC_LIB_RHEAP
 
 config E200
 	bool "e200"
@@ -798,6 +799,7 @@ config CPM1
 config CPM2
 	bool
 	depends on 8260 || MPC8560 || MPC8555
+	select PPC_LIB_RHEAP
 	default y
 	help
 	  The CPM2 (Communications Processor Module) is a coprocessor on
@@ -1277,6 +1279,10 @@ config BOOT_LOAD
 config PIN_TLB
 	bool "Pinned Kernel TLBs (860 ONLY)"
 	depends on ADVANCED_OPTIONS && 8xx
+
+config PPC_LIB_RHEAP
+	bool
+
 endmenu
 
 source "net/Kconfig"

^ permalink raw reply related

* [PATCH 7/7] bestcomm: GenBD task support
From: Grant Likely @ 2007-10-12 22:25 UTC (permalink / raw)
  To: galak, paulus, linuxppc-dev, tnt
In-Reply-To: <20071012222309.12648.82234.stgit@trillian.cg.shawcable.net>

From: Sylvain Munaut <tnt@246tNt.com>

This is the microcode for the GenBD task and the associated
support code. This is a generic task that copy data to/from
a hardware FIFO. This is currently locked to 32bits wide
access but could be extended as needed.

The microcode itself comes directly from the offical
API (v2.2)

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/powerpc/sysdev/bestcomm/Kconfig               |    7 +
 arch/powerpc/sysdev/bestcomm/Makefile              |    2 
 arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c |   63 +++++
 arch/powerpc/sysdev/bestcomm/bcom_gen_bd_tx_task.c |   69 +++++
 arch/powerpc/sysdev/bestcomm/gen_bd.c              |  260 ++++++++++++++++++++
 arch/powerpc/sysdev/bestcomm/gen_bd.h              |   48 ++++
 6 files changed, 449 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/sysdev/bestcomm/Kconfig b/arch/powerpc/sysdev/bestcomm/Kconfig
index 831763b..57cc565 100644
--- a/arch/powerpc/sysdev/bestcomm/Kconfig
+++ b/arch/powerpc/sysdev/bestcomm/Kconfig
@@ -30,3 +30,10 @@ config PPC_BESTCOMM_FEC
 	help
 	  This option enables the support for the FEC tasks.
 
+config PPC_BESTCOMM_GEN_BD
+	tristate "Bestcomm GenBD tasks support"
+	depends on PPC_BESTCOMM
+	default n
+	help
+	  This option enables the support for the GenBD tasks.
+
diff --git a/arch/powerpc/sysdev/bestcomm/Makefile b/arch/powerpc/sysdev/bestcomm/Makefile
index 537d174..aed2df2 100644
--- a/arch/powerpc/sysdev/bestcomm/Makefile
+++ b/arch/powerpc/sysdev/bestcomm/Makefile
@@ -5,8 +5,10 @@
 bestcomm-core-objs	:= bestcomm.o sram.o
 bestcomm-ata-objs	:= ata.o bcom_ata_task.o
 bestcomm-fec-objs	:= fec.o bcom_fec_rx_task.o bcom_fec_tx_task.o
+bestcomm-gen-bd-objs	:= gen_bd.o bcom_gen_bd_rx_task.o bcom_gen_bd_tx_task.o
 
 obj-$(CONFIG_PPC_BESTCOMM)		+= bestcomm-core.o
 obj-$(CONFIG_PPC_BESTCOMM_ATA)		+= bestcomm-ata.o
 obj-$(CONFIG_PPC_BESTCOMM_FEC)		+= bestcomm-fec.o
+obj-$(CONFIG_PPC_BESTCOMM_GEN_BD)	+= bestcomm-gen-bd.o
  
diff --git a/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c b/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
new file mode 100644
index 0000000..efee022
--- /dev/null
+++ b/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_rx_task.c
@@ -0,0 +1,63 @@
+/*
+ * Bestcomm GenBD RX task microcode
+ *
+ * Copyright (C) 2006 AppSpec Computer Technologies Corp.
+ *                    Jeff Gibbons <jeff.gibbons@appspec.com>
+ * Copyright (c) 2004 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
+ * on Tue Mar 4 10:14:12 2006 GMT
+ *
+ */
+
+#include <asm/types.h>
+
+/*
+ * The header consists of the following fields:
+ *	u32	magic;
+ *	u8	desc_size;
+ *	u8	var_size;
+ *	u8	inc_size;
+ *	u8	first_var;
+ *	u8	reserved[8];
+ *
+ * The size fields contain the number of 32-bit words.
+ */
+
+u32 bcom_gen_bd_rx_task[] = {
+	/* header */
+	0x4243544b,
+	0x0d020409,
+	0x00000000,
+	0x00000000,
+
+	/* Task descriptors */
+	0x808220da, /* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc3, idx1 += inc2 */
+	0x13e01010, /*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
+	0xb880025b, /*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc3, idx3 += inc3 */
+	0x10001308, /*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
+	0x60140002, /*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
+	0x0cccfcca, /*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
+	0xd9190240, /*   LCDEXT: idx2 = idx2; idx2 > var9; idx2 += inc0 */
+	0xb8c5e009, /*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
+	0x07fecf80, /*     DRD1A: *idx3 = *idx0; FN=0 INT init=31 WS=3 RS=3 */
+	0x99190024, /*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc4 */
+	0x60000005, /*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
+	0x0c4cf889, /*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
+	0x000001f8, /*   NOP */
+
+	/* VAR[9]-VAR[10] */
+	0x40000000,
+	0x7fff7fff,
+
+	/* INC[0]-INC[3] */
+	0x40000000,
+	0xe0000000,
+	0xa0000008,
+	0x20000000,
+};
+
diff --git a/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_tx_task.c b/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_tx_task.c
new file mode 100644
index 0000000..c605aa4
--- /dev/null
+++ b/arch/powerpc/sysdev/bestcomm/bcom_gen_bd_tx_task.c
@@ -0,0 +1,69 @@
+/*
+ * Bestcomm GenBD TX task microcode
+ *
+ * Copyright (C) 2006 AppSpec Computer Technologies Corp.
+ *                    Jeff Gibbons <jeff.gibbons@appspec.com>
+ * Copyright (c) 2004 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * Based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
+ * on Tue Mar 4 10:14:12 2006 GMT
+ *
+ */
+
+#include <asm/types.h>
+
+/*
+ * The header consists of the following fields:
+ *	u32	magic;
+ *	u8	desc_size;
+ *	u8	var_size;
+ *	u8	inc_size;
+ *	u8	first_var;
+ *	u8	reserved[8];
+ *
+ * The size fields contain the number of 32-bit words.
+ */
+
+u32 bcom_gen_bd_tx_task[] = {
+	/* header */
+	0x4243544b,
+	0x0f040609,
+	0x00000000,
+	0x00000000,
+
+	/* Task descriptors */
+	0x800220e3, /* LCD: idx0 = var0, idx1 = var4; idx1 <= var3; idx0 += inc4, idx1 += inc3 */
+	0x13e01010, /*   DRD1A: var4 = var2; FN=0 MORE init=31 WS=0 RS=0 */
+	0xb8808264, /*   LCD: idx2 = *idx1, idx3 = var1; idx2 < var9; idx2 += inc4, idx3 += inc4 */
+	0x10001308, /*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
+	0x60140002, /*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
+	0x0cccfcca, /*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
+	0xd9190300, /*   LCDEXT: idx2 = idx2; idx2 > var12; idx2 += inc0 */
+	0xb8c5e009, /*   LCD: idx3 = *(idx1 + var00000015); ; idx3 += inc1 */
+	0x03fec398, /*     DRD1A: *idx0 = *idx3; FN=0 init=31 WS=3 RS=3 */
+	0x9919826a, /*   LCD: idx2 = idx2, idx3 = idx3; idx2 > var9; idx2 += inc5, idx3 += inc2 */
+	0x0feac398, /*     DRD1A: *idx0 = *idx3; FN=0 TFD INT init=31 WS=1 RS=1 */
+	0x99190036, /*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc6 */
+	0x60000005, /*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
+	0x0c4cf889, /*     DRD2B1: *idx1 = EU3(); EU3(idx2,var9)  */
+	0x000001f8, /*   NOP */
+
+	/* VAR[9]-VAR[12] */
+	0x40000000,
+	0x7fff7fff,
+	0x00000000,
+	0x40000004,
+
+	/* INC[0]-INC[5] */
+	0x40000000,
+	0xe0000000,
+	0xe0000000,
+	0xa0000008,
+	0x20000000,
+	0x4000ffff,
+};
+
diff --git a/arch/powerpc/sysdev/bestcomm/gen_bd.c b/arch/powerpc/sysdev/bestcomm/gen_bd.c
new file mode 100644
index 0000000..8d33eaf
--- /dev/null
+++ b/arch/powerpc/sysdev/bestcomm/gen_bd.c
@@ -0,0 +1,260 @@
+/*
+ * Driver for MPC52xx processor BestComm General Buffer Descriptor
+ *
+ * Copyright (C) 2007 Sylvain Munaut <tnt@246tNt.com>
+ * Copyright (C) 2006 AppSpec Computer Technologies Corp.
+ *                    Jeff Gibbons <jeff.gibbons@appspec.com>
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ */
+
+#include <linux/version.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/types.h>
+#include <asm/errno.h>
+#include <asm/io.h>
+
+#include <asm/mpc52xx.h>
+
+#include "bestcomm.h"
+#include "bestcomm_priv.h"
+#include "gen_bd.h"
+
+
+/* ======================================================================== */
+/* Task image/var/inc                                                       */
+/* ======================================================================== */
+
+/* gen_bd tasks images */
+extern u32 bcom_gen_bd_rx_task[];
+extern u32 bcom_gen_bd_tx_task[];
+
+/* rx task vars that need to be set before enabling the task */
+struct bcom_gen_bd_rx_var {
+	u32 enable;		/* (u16*) address of task's control register */
+	u32 fifo;		/* (u32*) address of gen_bd's fifo */
+	u32 bd_base;		/* (struct bcom_bd*) beginning of ring buffer */
+	u32 bd_last;		/* (struct bcom_bd*) end of ring buffer */
+	u32 bd_start;		/* (struct bcom_bd*) current bd */
+	u32 buffer_size;	/* size of receive buffer */
+};
+
+/* rx task incs that need to be set before enabling the task */
+struct bcom_gen_bd_rx_inc {
+	u16 pad0;
+	s16 incr_bytes;
+	u16 pad1;
+	s16 incr_dst;
+};
+
+/* tx task vars that need to be set before enabling the task */
+struct bcom_gen_bd_tx_var {
+	u32 fifo;		/* (u32*) address of gen_bd's fifo */
+	u32 enable;		/* (u16*) address of task's control register */
+	u32 bd_base;		/* (struct bcom_bd*) beginning of ring buffer */
+	u32 bd_last;		/* (struct bcom_bd*) end of ring buffer */
+	u32 bd_start;		/* (struct bcom_bd*) current bd */
+	u32 buffer_size;	/* set by uCode for each packet */
+};
+
+/* tx task incs that need to be set before enabling the task */
+struct bcom_gen_bd_tx_inc {
+	u16 pad0;
+	s16 incr_bytes;
+	u16 pad1;
+	s16 incr_src;
+	u16 pad2;
+	s16 incr_src_ma;
+};
+
+/* private structure */
+struct bcom_gen_bd_priv {
+	phys_addr_t	fifo;
+	int		initiator;
+	int		ipr;
+	int		maxbufsize;
+};
+
+
+/* ======================================================================== */
+/* Task support code                                                        */
+/* ======================================================================== */
+
+struct bcom_task *
+bcom_gen_bd_rx_init(int queue_len, phys_addr_t fifo,
+			int initiator, int ipr, int maxbufsize)
+{
+	struct bcom_task *tsk;
+	struct bcom_gen_bd_priv *priv;
+
+	tsk = bcom_task_alloc(queue_len, sizeof(struct bcom_gen_bd),
+			sizeof(struct bcom_gen_bd_priv));
+	if (!tsk)
+		return NULL;
+
+	tsk->flags = BCOM_FLAGS_NONE;
+
+	priv = tsk->priv;
+	priv->fifo	= fifo;
+	priv->initiator	= initiator;
+	priv->ipr	= ipr;
+	priv->maxbufsize = maxbufsize;
+
+	if (bcom_gen_bd_rx_reset(tsk)) {
+		bcom_task_free(tsk);
+		return NULL;
+	}
+
+	return tsk;
+}
+EXPORT_SYMBOL_GPL(bcom_gen_bd_rx_init);
+
+int
+bcom_gen_bd_rx_reset(struct bcom_task *tsk)
+{
+	struct bcom_gen_bd_priv *priv = tsk->priv;
+	struct bcom_gen_bd_rx_var *var;
+	struct bcom_gen_bd_rx_inc *inc;
+
+	/* Shutdown the task */
+	bcom_disable_task(tsk->tasknum);
+
+	/* Reset the microcode */
+	var = (struct bcom_gen_bd_rx_var *) bcom_task_var(tsk->tasknum);
+	inc = (struct bcom_gen_bd_rx_inc *) bcom_task_inc(tsk->tasknum);
+
+	if (bcom_load_image(tsk->tasknum, bcom_gen_bd_rx_task))
+		return -1;
+
+	var->enable	= bcom_eng->regs_base +
+				offsetof(struct mpc52xx_sdma, tcr[tsk->tasknum]);
+	var->fifo	= (u32) priv->fifo;
+	var->bd_base	= tsk->bd_pa;
+	var->bd_last	= tsk->bd_pa + ((tsk->num_bd-1) * tsk->bd_size);
+	var->bd_start	= tsk->bd_pa;
+	var->buffer_size = priv->maxbufsize;
+
+	inc->incr_bytes	= -(s16)sizeof(u32);
+	inc->incr_dst	= sizeof(u32);
+
+	/* Reset the BDs */
+	tsk->index = 0;
+	tsk->outdex = 0;
+
+	memset(tsk->bd, 0x00, tsk->num_bd * tsk->bd_size);
+
+	/* Configure some stuff */
+	bcom_set_task_pragma(tsk->tasknum, BCOM_GEN_RX_BD_PRAGMA);
+	bcom_set_task_auto_start(tsk->tasknum, tsk->tasknum);
+
+	out_8(&bcom_eng->regs->ipr[priv->initiator], priv->ipr);
+	bcom_set_initiator(tsk->tasknum, priv->initiator);
+
+	out_be32(&bcom_eng->regs->IntPend, 1<<tsk->tasknum);	/* Clear ints */
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(bcom_gen_bd_rx_reset);
+
+void
+bcom_gen_bd_rx_release(struct bcom_task *tsk)
+{
+	/* Nothing special for the GenBD tasks */
+	bcom_task_free(tsk);
+}
+EXPORT_SYMBOL_GPL(bcom_gen_bd_rx_release);
+
+
+extern struct bcom_task *
+bcom_gen_bd_tx_init(int queue_len, phys_addr_t fifo,
+			int initiator, int ipr)
+{
+	struct bcom_task *tsk;
+	struct bcom_gen_bd_priv *priv;
+
+	tsk = bcom_task_alloc(queue_len, sizeof(struct bcom_gen_bd),
+			sizeof(struct bcom_gen_bd_priv));
+	if (!tsk)
+		return NULL;
+
+	tsk->flags = BCOM_FLAGS_NONE;
+
+	priv = tsk->priv;
+	priv->fifo	= fifo;
+	priv->initiator	= initiator;
+	priv->ipr	= ipr;
+
+	if (bcom_gen_bd_tx_reset(tsk)) {
+		bcom_task_free(tsk);
+		return NULL;
+	}
+
+	return tsk;
+}
+EXPORT_SYMBOL_GPL(bcom_gen_bd_tx_init);
+
+int
+bcom_gen_bd_tx_reset(struct bcom_task *tsk)
+{
+	struct bcom_gen_bd_priv *priv = tsk->priv;
+	struct bcom_gen_bd_tx_var *var;
+	struct bcom_gen_bd_tx_inc *inc;
+
+	/* Shutdown the task */
+	bcom_disable_task(tsk->tasknum);
+
+	/* Reset the microcode */
+	var = (struct bcom_gen_bd_tx_var *) bcom_task_var(tsk->tasknum);
+	inc = (struct bcom_gen_bd_tx_inc *) bcom_task_inc(tsk->tasknum);
+
+	if (bcom_load_image(tsk->tasknum, bcom_gen_bd_tx_task))
+		return -1;
+
+	var->enable	= bcom_eng->regs_base +
+				offsetof(struct mpc52xx_sdma, tcr[tsk->tasknum]);
+	var->fifo	= (u32) priv->fifo;
+	var->bd_base	= tsk->bd_pa;
+	var->bd_last	= tsk->bd_pa + ((tsk->num_bd-1) * tsk->bd_size);
+	var->bd_start	= tsk->bd_pa;
+
+	inc->incr_bytes	= -(s16)sizeof(u32);
+	inc->incr_src	= sizeof(u32);
+	inc->incr_src_ma = sizeof(u8);
+
+	/* Reset the BDs */
+	tsk->index = 0;
+	tsk->outdex = 0;
+
+	memset(tsk->bd, 0x00, tsk->num_bd * tsk->bd_size);
+
+	/* Configure some stuff */
+	bcom_set_task_pragma(tsk->tasknum, BCOM_GEN_TX_BD_PRAGMA);
+	bcom_set_task_auto_start(tsk->tasknum, tsk->tasknum);
+
+	out_8(&bcom_eng->regs->ipr[priv->initiator], priv->ipr);
+	bcom_set_initiator(tsk->tasknum, priv->initiator);
+
+	out_be32(&bcom_eng->regs->IntPend, 1<<tsk->tasknum);	/* Clear ints */
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(bcom_gen_bd_tx_reset);
+
+void
+bcom_gen_bd_tx_release(struct bcom_task *tsk)
+{
+	/* Nothing special for the GenBD tasks */
+	bcom_task_free(tsk);
+}
+EXPORT_SYMBOL_GPL(bcom_gen_bd_tx_release);
+
+
+MODULE_DESCRIPTION("BestComm General Buffer Descriptor tasks driver");
+MODULE_AUTHOR("Jeff Gibbons <jeff.gibbons@appspec.com>");
+MODULE_LICENSE("GPL v2");
+
diff --git a/arch/powerpc/sysdev/bestcomm/gen_bd.h b/arch/powerpc/sysdev/bestcomm/gen_bd.h
new file mode 100644
index 0000000..5b6fa80
--- /dev/null
+++ b/arch/powerpc/sysdev/bestcomm/gen_bd.h
@@ -0,0 +1,48 @@
+/*
+ * Header for Bestcomm General Buffer Descriptor tasks driver
+ *
+ *
+ * Copyright (C) 2007 Sylvain Munaut <tnt@246tNt.com>
+ * Copyright (C) 2006 AppSpec Computer Technologies Corp.
+ *                    Jeff Gibbons <jeff.gibbons@appspec.com>
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ *
+ */
+
+#ifndef __BESTCOMM_GEN_BD_H__
+#define __BESTCOMM_GEN_BD_H__
+
+struct bcom_gen_bd {
+	u32	status;
+	u32	buf_pa;
+};
+
+
+extern struct bcom_task *
+bcom_gen_bd_rx_init(int queue_len, phys_addr_t fifo,
+			int initiator, int ipr, int maxbufsize);
+
+extern int
+bcom_gen_bd_rx_reset(struct bcom_task *tsk);
+
+extern void
+bcom_gen_bd_rx_release(struct bcom_task *tsk);
+
+
+extern struct bcom_task *
+bcom_gen_bd_tx_init(int queue_len, phys_addr_t fifo,
+			int initiator, int ipr);
+
+extern int
+bcom_gen_bd_tx_reset(struct bcom_task *tsk);
+
+extern void
+bcom_gen_bd_tx_release(struct bcom_task *tsk);
+
+
+#endif  /* __BESTCOMM_GEN_BD_H__ */
+

^ permalink raw reply related

* [PATCH 6/7] bestcomm: FEC task support
From: Grant Likely @ 2007-10-12 22:25 UTC (permalink / raw)
  To: galak, paulus, linuxppc-dev, tnt
In-Reply-To: <20071012222309.12648.82234.stgit@trillian.cg.shawcable.net>

From: Sylvain Munaut <tnt@246tNt.com>

This is the microcode for the FEC task and the associated
support code.

The microcode itself comes directly from the offical
API (v2.2)

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/powerpc/sysdev/bestcomm/Kconfig            |    7 +
 arch/powerpc/sysdev/bestcomm/Makefile           |    2 
 arch/powerpc/sysdev/bestcomm/bcom_fec_rx_task.c |   78 +++++++
 arch/powerpc/sysdev/bestcomm/bcom_fec_tx_task.c |   91 ++++++++
 arch/powerpc/sysdev/bestcomm/fec.c              |  270 +++++++++++++++++++++++
 arch/powerpc/sysdev/bestcomm/fec.h              |   48 ++++
 6 files changed, 496 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/sysdev/bestcomm/Kconfig b/arch/powerpc/sysdev/bestcomm/Kconfig
index 9d087ce..831763b 100644
--- a/arch/powerpc/sysdev/bestcomm/Kconfig
+++ b/arch/powerpc/sysdev/bestcomm/Kconfig
@@ -23,3 +23,10 @@ config PPC_BESTCOMM_ATA
 	help
 	  This option enables the support for the ATA task.
 
+config PPC_BESTCOMM_FEC
+	tristate "Bestcomm FEC tasks support"
+	depends on PPC_BESTCOMM
+	default n
+	help
+	  This option enables the support for the FEC tasks.
+
diff --git a/arch/powerpc/sysdev/bestcomm/Makefile b/arch/powerpc/sysdev/bestcomm/Makefile
index b7a6a40..537d174 100644
--- a/arch/powerpc/sysdev/bestcomm/Makefile
+++ b/arch/powerpc/sysdev/bestcomm/Makefile
@@ -4,7 +4,9 @@
 
 bestcomm-core-objs	:= bestcomm.o sram.o
 bestcomm-ata-objs	:= ata.o bcom_ata_task.o
+bestcomm-fec-objs	:= fec.o bcom_fec_rx_task.o bcom_fec_tx_task.o
 
 obj-$(CONFIG_PPC_BESTCOMM)		+= bestcomm-core.o
 obj-$(CONFIG_PPC_BESTCOMM_ATA)		+= bestcomm-ata.o
+obj-$(CONFIG_PPC_BESTCOMM_FEC)		+= bestcomm-fec.o
  
diff --git a/arch/powerpc/sysdev/bestcomm/bcom_fec_rx_task.c b/arch/powerpc/sysdev/bestcomm/bcom_fec_rx_task.c
new file mode 100644
index 0000000..a1ad6a0
--- /dev/null
+++ b/arch/powerpc/sysdev/bestcomm/bcom_fec_rx_task.c
@@ -0,0 +1,78 @@
+/*
+ * Bestcomm FEC RX task microcode
+ *
+ * Copyright (c) 2004 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * Automatically created based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
+ * on Tue Mar 22 11:19:38 2005 GMT
+ */
+
+#include <asm/types.h>
+
+/*
+ * The header consists of the following fields:
+ *	u32	magic;
+ *	u8	desc_size;
+ *	u8	var_size;
+ *	u8	inc_size;
+ *	u8	first_var;
+ *	u8	reserved[8];
+ *
+ * The size fields contain the number of 32-bit words.
+ */
+
+u32 bcom_fec_rx_task[] = {
+	/* header */
+	0x4243544b,
+	0x18060709,
+	0x00000000,
+	0x00000000,
+
+	/* Task descriptors */
+	0x808220e3, /* LCD: idx0 = var1, idx1 = var4; idx1 <= var3; idx0 += inc4, idx1 += inc3 */
+	0x10601010, /*   DRD1A: var4 = var2; FN=0 MORE init=3 WS=0 RS=0 */
+	0xb8800264, /*   LCD: idx2 = *idx1, idx3 = var0; idx2 < var9; idx2 += inc4, idx3 += inc4 */
+	0x10001308, /*     DRD1A: var4 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
+	0x60140002, /*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
+	0x0cccfcca, /*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var10)  */
+	0x80004000, /*   LCDEXT: idx2 = 0x00000000; ; */
+	0xb8c58029, /*   LCD: idx3 = *(idx1 + var00000015); idx3 once var0; idx3 += inc5 */
+	0x60000002, /*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=0 RS=0 */
+	0x088cf8cc, /*     DRD2B1: idx2 = EU3(); EU3(idx3,var12)  */
+	0x991982f2, /*   LCD: idx2 = idx2, idx3 = idx3; idx2 > var11; idx2 += inc6, idx3 += inc2 */
+	0x006acf80, /*     DRD1A: *idx3 = *idx0; FN=0 init=3 WS=1 RS=1 */
+	0x80004000, /*   LCDEXT: idx2 = 0x00000000; ; */
+	0x9999802d, /*   LCD: idx3 = idx3; idx3 once var0; idx3 += inc5 */
+	0x70000002, /*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT MORE init=0 WS=0 RS=0 */
+	0x034cfc4e, /*     DRD2B1: var13 = EU3(); EU3(*idx1,var14)  */
+	0x00008868, /*     DRD1A: idx2 = var13; FN=0 init=0 WS=0 RS=0 */
+	0x99198341, /*   LCD: idx2 = idx2, idx3 = idx3; idx2 > var13; idx2 += inc0, idx3 += inc1 */
+	0x007ecf80, /*     DRD1A: *idx3 = *idx0; FN=0 init=3 WS=3 RS=3 */
+	0x99198272, /*   LCD: idx2 = idx2, idx3 = idx3; idx2 > var9; idx2 += inc6, idx3 += inc2 */
+	0x046acf80, /*     DRD1A: *idx3 = *idx0; FN=0 INT init=3 WS=1 RS=1 */
+	0x9819002d, /*   LCD: idx2 = idx0; idx2 once var0; idx2 += inc5 */
+	0x0060c790, /*     DRD1A: *idx1 = *idx2; FN=0 init=3 WS=0 RS=0 */
+	0x000001f8, /*   NOP */
+
+	/* VAR[9]-VAR[14] */
+	0x40000000,
+	0x7fff7fff,
+	0x00000000,
+	0x00000003,
+	0x40000008,
+	0x43ffffff,
+
+	/* INC[0]-INC[6] */
+	0x40000000,
+	0xe0000000,
+	0xe0000000,
+	0xa0000008,
+	0x20000000,
+	0x00000000,
+	0x4000ffff,
+};
+
diff --git a/arch/powerpc/sysdev/bestcomm/bcom_fec_tx_task.c b/arch/powerpc/sysdev/bestcomm/bcom_fec_tx_task.c
new file mode 100644
index 0000000..b1c495c
--- /dev/null
+++ b/arch/powerpc/sysdev/bestcomm/bcom_fec_tx_task.c
@@ -0,0 +1,91 @@
+/*
+ * Bestcomm FEC TX task microcode
+ *
+ * Copyright (c) 2004 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * Automatically created based on BestCommAPI-2.2/code_dma/image_rtos1/dma_image.hex
+ * on Tue Mar 22 11:19:29 2005 GMT
+ */
+
+#include <asm/types.h>
+
+/*
+ * The header consists of the following fields:
+ *	u32	magic;
+ *	u8	desc_size;
+ *	u8	var_size;
+ *	u8	inc_size;
+ *	u8	first_var;
+ *	u8	reserved[8];
+ *
+ * The size fields contain the number of 32-bit words.
+ */
+
+u32 bcom_fec_tx_task[] = {
+	/* header */
+	0x4243544b,
+	0x2407070d,
+	0x00000000,
+	0x00000000,
+
+	/* Task descriptors */
+	0x8018001b, /* LCD: idx0 = var0; idx0 <= var0; idx0 += inc3 */
+	0x60000005, /*   DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
+	0x01ccfc0d, /*   DRD2B1: var7 = EU3(); EU3(*idx0,var13)  */
+	0x8082a123, /* LCD: idx0 = var1, idx1 = var5; idx1 <= var4; idx0 += inc4, idx1 += inc3 */
+	0x10801418, /*   DRD1A: var5 = var3; FN=0 MORE init=4 WS=0 RS=0 */
+	0xf88103a4, /*   LCDEXT: idx2 = *idx1, idx3 = var2; idx2 < var14; idx2 += inc4, idx3 += inc4 */
+	0x801a6024, /*   LCD: idx4 = var0; ; idx4 += inc4 */
+	0x10001708, /*     DRD1A: var5 = idx1; FN=0 MORE init=0 WS=0 RS=0 */
+	0x60140002, /*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT init=0 WS=2 RS=2 */
+	0x0cccfccf, /*     DRD2B1: *idx3 = EU3(); EU3(*idx3,var15)  */
+	0x991a002c, /*   LCD: idx2 = idx2, idx3 = idx4; idx2 once var0; idx2 += inc5, idx3 += inc4 */
+	0x70000002, /*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT MORE init=0 WS=0 RS=0 */
+	0x024cfc4d, /*     DRD2B1: var9 = EU3(); EU3(*idx1,var13)  */
+	0x60000003, /*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=3 EXT init=0 WS=0 RS=0 */
+	0x0cccf247, /*     DRD2B1: *idx3 = EU3(); EU3(var9,var7)  */
+	0x80004000, /*   LCDEXT: idx2 = 0x00000000; ; */
+	0xb8c80029, /*   LCD: idx3 = *(idx1 + var0000001a); idx3 once var0; idx3 += inc5 */
+	0x70000002, /*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT MORE init=0 WS=0 RS=0 */
+	0x088cf8d1, /*     DRD2B1: idx2 = EU3(); EU3(idx3,var17)  */
+	0x00002f10, /*     DRD1A: var11 = idx2; FN=0 init=0 WS=0 RS=0 */
+	0x99198432, /*   LCD: idx2 = idx2, idx3 = idx3; idx2 > var16; idx2 += inc6, idx3 += inc2 */
+	0x008ac398, /*     DRD1A: *idx0 = *idx3; FN=0 init=4 WS=1 RS=1 */
+	0x80004000, /*   LCDEXT: idx2 = 0x00000000; ; */
+	0x9999802d, /*   LCD: idx3 = idx3; idx3 once var0; idx3 += inc5 */
+	0x70000002, /*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=2 EXT MORE init=0 WS=0 RS=0 */
+	0x048cfc53, /*     DRD2B1: var18 = EU3(); EU3(*idx1,var19)  */
+	0x60000008, /*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=8 EXT init=0 WS=0 RS=0 */
+	0x088cf48b, /*     DRD2B1: idx2 = EU3(); EU3(var18,var11)  */
+	0x99198481, /*   LCD: idx2 = idx2, idx3 = idx3; idx2 > var18; idx2 += inc0, idx3 += inc1 */
+	0x009ec398, /*     DRD1A: *idx0 = *idx3; FN=0 init=4 WS=3 RS=3 */
+	0x991983b2, /*   LCD: idx2 = idx2, idx3 = idx3; idx2 > var14; idx2 += inc6, idx3 += inc2 */
+	0x088ac398, /*     DRD1A: *idx0 = *idx3; FN=0 TFD init=4 WS=1 RS=1 */
+	0x9919002d, /*   LCD: idx2 = idx2; idx2 once var0; idx2 += inc5 */
+	0x60000005, /*     DRD2A: EU0=0 EU1=0 EU2=0 EU3=5 EXT init=0 WS=0 RS=0 */
+	0x0c4cf88e, /*     DRD2B1: *idx1 = EU3(); EU3(idx2,var14)  */
+	0x000001f8, /*   NOP */
+
+	/* VAR[13]-VAR[19] */
+	0x0c000000,
+	0x40000000,
+	0x7fff7fff,
+	0x00000000,
+	0x00000003,
+	0x40000004,
+	0x43ffffff,
+
+	/* INC[0]-INC[6] */
+	0x40000000,
+	0xe0000000,
+	0xe0000000,
+	0xa0000008,
+	0x20000000,
+	0x00000000,
+	0x4000ffff,
+};
+
diff --git a/arch/powerpc/sysdev/bestcomm/fec.c b/arch/powerpc/sysdev/bestcomm/fec.c
new file mode 100644
index 0000000..957a988
--- /dev/null
+++ b/arch/powerpc/sysdev/bestcomm/fec.c
@@ -0,0 +1,270 @@
+/*
+ * Bestcomm FEC tasks driver
+ *
+ *
+ * Copyright (C) 2006-2007 Sylvain Munaut <tnt@246tNt.com>
+ * Copyright (C) 2003-2004 MontaVista, Software, Inc.
+ *                         ( by Dale Farnsworth <dfarnsworth@mvista.com> )
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/types.h>
+#include <asm/io.h>
+
+#include "bestcomm.h"
+#include "bestcomm_priv.h"
+#include "fec.h"
+
+
+/* ======================================================================== */
+/* Task image/var/inc                                                       */
+/* ======================================================================== */
+
+/* fec tasks images */
+extern u32 bcom_fec_rx_task[];
+extern u32 bcom_fec_tx_task[];
+
+/* rx task vars that need to be set before enabling the task */
+struct bcom_fec_rx_var {
+	u32 enable;		/* (u16*) address of task's control register */
+	u32 fifo;		/* (u32*) address of fec's fifo */
+	u32 bd_base;		/* (struct bcom_bd*) beginning of ring buffer */
+	u32 bd_last;		/* (struct bcom_bd*) end of ring buffer */
+	u32 bd_start;		/* (struct bcom_bd*) current bd */
+	u32 buffer_size;	/* size of receive buffer */
+};
+
+/* rx task incs that need to be set before enabling the task */
+struct bcom_fec_rx_inc {
+	u16 pad0;
+	s16 incr_bytes;
+	u16 pad1;
+	s16 incr_dst;
+	u16 pad2;
+	s16 incr_dst_ma;
+};
+
+/* tx task vars that need to be set before enabling the task */
+struct bcom_fec_tx_var {
+	u32 DRD;		/* (u32*) address of self-modified DRD */
+	u32 fifo;		/* (u32*) address of fec's fifo */
+	u32 enable;		/* (u16*) address of task's control register */
+	u32 bd_base;		/* (struct bcom_bd*) beginning of ring buffer */
+	u32 bd_last;		/* (struct bcom_bd*) end of ring buffer */
+	u32 bd_start;		/* (struct bcom_bd*) current bd */
+	u32 buffer_size;	/* set by uCode for each packet */
+};
+
+/* tx task incs that need to be set before enabling the task */
+struct bcom_fec_tx_inc {
+	u16 pad0;
+	s16 incr_bytes;
+	u16 pad1;
+	s16 incr_src;
+	u16 pad2;
+	s16 incr_src_ma;
+};
+
+/* private structure in the task */
+struct bcom_fec_priv {
+	phys_addr_t	fifo;
+	int		maxbufsize;
+};
+
+
+/* ======================================================================== */
+/* Task support code                                                        */
+/* ======================================================================== */
+
+struct bcom_task *
+bcom_fec_rx_init(int queue_len, phys_addr_t fifo, int maxbufsize)
+{
+	struct bcom_task *tsk;
+	struct bcom_fec_priv *priv;
+
+	tsk = bcom_task_alloc(queue_len, sizeof(struct bcom_fec_bd),
+				sizeof(struct bcom_fec_priv));
+	if (!tsk)
+		return NULL;
+
+	tsk->flags = BCOM_FLAGS_NONE;
+
+	priv = tsk->priv;
+	priv->fifo = fifo;
+	priv->maxbufsize = maxbufsize;
+
+	if (bcom_fec_rx_reset(tsk)) {
+		bcom_task_free(tsk);
+		return NULL;
+	}
+
+	return tsk;
+}
+EXPORT_SYMBOL_GPL(bcom_fec_rx_init);
+
+int
+bcom_fec_rx_reset(struct bcom_task *tsk)
+{
+	struct bcom_fec_priv *priv = tsk->priv;
+	struct bcom_fec_rx_var *var;
+	struct bcom_fec_rx_inc *inc;
+
+	/* Shutdown the task */
+	bcom_disable_task(tsk->tasknum);
+
+	/* Reset the microcode */
+	var = (struct bcom_fec_rx_var *) bcom_task_var(tsk->tasknum);
+	inc = (struct bcom_fec_rx_inc *) bcom_task_inc(tsk->tasknum);
+
+	if (bcom_load_image(tsk->tasknum, bcom_fec_rx_task))
+		return -1;
+
+	var->enable	= bcom_eng->regs_base +
+				offsetof(struct mpc52xx_sdma, tcr[tsk->tasknum]);
+	var->fifo	= (u32) priv->fifo;
+	var->bd_base	= tsk->bd_pa;
+	var->bd_last	= tsk->bd_pa + ((tsk->num_bd-1) * tsk->bd_size);
+	var->bd_start	= tsk->bd_pa;
+	var->buffer_size = priv->maxbufsize;
+
+	inc->incr_bytes	= -(s16)sizeof(u32);	/* These should be in the   */
+	inc->incr_dst	= sizeof(u32);		/* task image, but we stick */
+	inc->incr_dst_ma= sizeof(u8);		/* to the official ones     */
+
+	/* Reset the BDs */
+	tsk->index = 0;
+	tsk->outdex = 0;
+
+	memset(tsk->bd, 0x00, tsk->num_bd * tsk->bd_size);
+
+	/* Configure some stuff */
+	bcom_set_task_pragma(tsk->tasknum, BCOM_FEC_RX_BD_PRAGMA);
+	bcom_set_task_auto_start(tsk->tasknum, tsk->tasknum);
+
+	out_8(&bcom_eng->regs->ipr[BCOM_INITIATOR_FEC_RX], BCOM_IPR_FEC_RX);
+
+	out_be32(&bcom_eng->regs->IntPend, 1<<tsk->tasknum);	/* Clear ints */
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(bcom_fec_rx_reset);
+
+void
+bcom_fec_rx_release(struct bcom_task *tsk)
+{
+	/* Nothing special for the FEC tasks */
+	bcom_task_free(tsk);
+}
+EXPORT_SYMBOL_GPL(bcom_fec_rx_release);
+
+
+
+	/* Return 2nd to last DRD */
+	/* This is an ugly hack, but at least it's only done
+	   once at initialization */
+static u32 *self_modified_drd(int tasknum)
+{
+	u32 *desc;
+	int num_descs;
+	int drd_count;
+	int i;
+
+	num_descs = bcom_task_num_descs(tasknum);
+	desc = bcom_task_desc(tasknum) + num_descs - 1;
+	drd_count = 0;
+	for (i=0; i<num_descs; i++, desc--)
+		if (bcom_desc_is_drd(*desc) && ++drd_count == 3)
+			break;
+	return desc;
+}
+
+struct bcom_task *
+bcom_fec_tx_init(int queue_len, phys_addr_t fifo)
+{
+	struct bcom_task *tsk;
+	struct bcom_fec_priv *priv;
+
+	tsk = bcom_task_alloc(queue_len, sizeof(struct bcom_fec_bd),
+				sizeof(struct bcom_fec_priv));
+	if (!tsk)
+		return NULL;
+
+	tsk->flags = BCOM_FLAGS_ENABLE_TASK;
+
+	priv = tsk->priv;
+	priv->fifo = fifo;
+
+	if (bcom_fec_tx_reset(tsk)) {
+		bcom_task_free(tsk);
+		return NULL;
+	}
+
+	return tsk;
+}
+EXPORT_SYMBOL_GPL(bcom_fec_tx_init);
+
+int
+bcom_fec_tx_reset(struct bcom_task *tsk)
+{
+	struct bcom_fec_priv *priv = tsk->priv;
+	struct bcom_fec_tx_var *var;
+	struct bcom_fec_tx_inc *inc;
+
+	/* Shutdown the task */
+	bcom_disable_task(tsk->tasknum);
+
+	/* Reset the microcode */
+	var = (struct bcom_fec_tx_var *) bcom_task_var(tsk->tasknum);
+	inc = (struct bcom_fec_tx_inc *) bcom_task_inc(tsk->tasknum);
+
+	if (bcom_load_image(tsk->tasknum, bcom_fec_tx_task))
+		return -1;
+
+	var->enable	= bcom_eng->regs_base +
+				offsetof(struct mpc52xx_sdma, tcr[tsk->tasknum]);
+	var->fifo	= (u32) priv->fifo;
+	var->DRD	= bcom_sram_va2pa(self_modified_drd(tsk->tasknum));
+	var->bd_base	= tsk->bd_pa;
+	var->bd_last	= tsk->bd_pa + ((tsk->num_bd-1) * tsk->bd_size);
+	var->bd_start	= tsk->bd_pa;
+
+	inc->incr_bytes	= -(s16)sizeof(u32);	/* These should be in the   */
+	inc->incr_src	= sizeof(u32);		/* task image, but we stick */
+	inc->incr_src_ma= sizeof(u8);		/* to the official ones     */
+
+	/* Reset the BDs */
+	tsk->index = 0;
+	tsk->outdex = 0;
+
+	memset(tsk->bd, 0x00, tsk->num_bd * tsk->bd_size);
+
+	/* Configure some stuff */
+	bcom_set_task_pragma(tsk->tasknum, BCOM_FEC_TX_BD_PRAGMA);
+	bcom_set_task_auto_start(tsk->tasknum, tsk->tasknum);
+
+	out_8(&bcom_eng->regs->ipr[BCOM_INITIATOR_FEC_TX], BCOM_IPR_FEC_TX);
+
+	out_be32(&bcom_eng->regs->IntPend, 1<<tsk->tasknum);	/* Clear ints */
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(bcom_fec_tx_reset);
+
+void
+bcom_fec_tx_release(struct bcom_task *tsk)
+{
+	/* Nothing special for the FEC tasks */
+	bcom_task_free(tsk);
+}
+EXPORT_SYMBOL_GPL(bcom_fec_tx_release);
+
+
+MODULE_DESCRIPTION("BestComm FEC tasks driver");
+MODULE_AUTHOR("Dale Farnsworth <dfarnsworth@mvista.com>");
+MODULE_LICENSE("GPL v2");
+
diff --git a/arch/powerpc/sysdev/bestcomm/fec.h b/arch/powerpc/sysdev/bestcomm/fec.h
new file mode 100644
index 0000000..fa880ca
--- /dev/null
+++ b/arch/powerpc/sysdev/bestcomm/fec.h
@@ -0,0 +1,48 @@
+/*
+ * Header for Bestcomm FEC tasks driver
+ *
+ *
+ * Copyright (C) 2006-2007 Sylvain Munaut <tnt@246tNt.com>
+ * Copyright (C) 2003-2004 MontaVista, Software, Inc.
+ *                         ( by Dale Farnsworth <dfarnsworth@mvista.com> )
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#ifndef __BESTCOMM_FEC_H__
+#define __BESTCOMM_FEC_H__
+
+
+struct bcom_fec_bd {
+	u32	status;
+	u32	skb_pa;
+};
+
+#define BCOM_FEC_TX_BD_TFD	0x08000000ul	/* transmit frame done */
+#define BCOM_FEC_TX_BD_INT	0x04000000ul	/* interrupt */
+
+
+extern struct bcom_task *
+bcom_fec_rx_init(int queue_len, phys_addr_t fifo, int maxbufsize);
+
+extern int
+bcom_fec_rx_reset(struct bcom_task *tsk);
+
+extern void
+bcom_fec_rx_release(struct bcom_task *tsk);
+
+
+extern struct bcom_task *
+bcom_fec_tx_init(int queue_len, phys_addr_t fifo);
+
+extern int
+bcom_fec_tx_reset(struct bcom_task *tsk);
+
+extern void
+bcom_fec_tx_release(struct bcom_task *tsk);
+
+
+#endif /* __BESTCOMM_FEC_H__ */
+

^ permalink raw reply related

* RE: Override timer interrupt
From: Benjamin Herrenschmidt @ 2007-10-12 22:58 UTC (permalink / raw)
  To: Rune Torgersen; +Cc: linuxppc-dev, linuxppc-embedded
In-Reply-To: <DCEAAC0833DD314AB0B58112AD99B93B037D4C1B@ismail.innsys.innovsys.com>


On Fri, 2007-10-12 at 16:39 -0500, Rune Torgersen wrote:
> > From: Mark A. Greer 
> > > Is there an easy way to use something other than the decrementer for
> the
> > > timer interrupt?
> 
> > Check out the clocksource stuff.  It let's you set up numerous clock
> > sources and set the rating of each one.  You can start looking in
> > arch/powerpc/kernel/time.c for example code.
> 
> Thanks I will. 
> Currently our board port lives in /arch/ppc (2.6.18) but I will take a
> look in powerpc.

Beware though... there a quite a few bits in there that assume the
timebase is being used as the main timekeeping source, like the vdso.

In fact, I'm not sure what is your problem with the DEC proper as the TB
will be used ultimately and thus it shouldn't drift more than the TB
does. Can your part use an externally clocked TB ?

If not, and you still have a drift despite calibration, you can always
use NTP services to adjust timekeeping.

Ben.
 

^ permalink raw reply

* [PATCH] [POWERPC] ucc_geth: Fix build break introduced by commit 09f75cd7bf13720738e6a196cc0107ce9a5bd5a0
From: Emil Medve @ 2007-10-12 23:26 UTC (permalink / raw)
  To: akpm, jgarzik, leoli, netdev, linuxppc-dev; +Cc: Emil Medve

  CC      drivers/net/ucc_geth.o
drivers/net/ucc_geth.c: In function 'ucc_geth_startup':
drivers/net/ucc_geth.c:2614: warning: assignment makes integer from pointer without a cast
drivers/net/ucc_geth.c:2651: warning: assignment makes integer from pointer without a cast
drivers/net/ucc_geth.c: In function 'ucc_geth_rx':
drivers/net/ucc_geth.c:3483: error: 'dev' undeclared (first use in this function)
drivers/net/ucc_geth.c:3483: error: (Each undeclared identifier is reported only once
drivers/net/ucc_geth.c:3483: error: for each function it appears in.)
make[2]: *** [drivers/net/ucc_geth.o] Error 1

Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
---

Here is a convenient link for the culprit patch: http://git.kernel.org/?p=linux/kernel/git/jgarzik/netdev-2.6.git;a=commit;h=09f75cd7bf13720738e6a196cc0107ce9a5bd5a0

netdev-2.6> scripts/checkpatch.pl 0001-POWERPC-ucc_geth-Fix-build-break-introduced-by-co.patch 
Your patch has no obvious style problems and is ready for submission.

 drivers/net/ucc_geth.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index d00e7d4..c43d4d1 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -63,7 +63,7 @@
 #define UGETH_MSG_DEFAULT	(NETIF_MSG_IFUP << 1 ) - 1
 
 void uec_set_ethtool_ops(struct net_device *netdev);
-	
+
 static DEFINE_SPINLOCK(ugeth_lock);
 
 static struct {
@@ -3480,9 +3480,9 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit
 				dev_kfree_skb_any(skb);
 
 			ugeth->rx_skbuff[rxQ][ugeth->skb_currx[rxQ]] = NULL;
-			dev->stats.rx_dropped++;
+			ugeth->dev->stats.rx_dropped++;
 		} else {
-			dev->stats.rx_packets++;
+			ugeth->dev->stats.rx_packets++;
 			howmany++;
 
 			/* Prep the skb for the packet */
@@ -3491,7 +3491,7 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit
 			/* Tell the skb what kind of packet this is */
 			skb->protocol = eth_type_trans(skb, ugeth->dev);
 
-			dev->stats.rx_bytes += length;
+			ugeth->dev->stats.rx_bytes += length;
 			/* Send the packet up the stack */
 #ifdef CONFIG_UGETH_NAPI
 			netif_receive_skb(skb);
@@ -3506,7 +3506,7 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, u8 rxQ, int rx_work_limit
 		if (!skb) {
 			if (netif_msg_rx_err(ugeth))
 				ugeth_warn("%s: No Rx Data Buffer", __FUNCTION__);
-			dev->stats.rx_dropped++;
+			ugeth->dev->stats.rx_dropped++;
 			break;
 		}
 
-- 
1.5.3.GIT

^ permalink raw reply related

* mpc 860 pot linux 2.6 problem
From: keng_629 @ 2007-10-13  5:58 UTC (permalink / raw)
  To: linuxppc-embedded


[-- Attachment #1.1: Type: text/plain, Size: 468 bytes --]

i have ported linux2.6.23 to mpc860t board use cpm smc1 as serial port.
when i boot my kernel with ramdisk i find it stop after print"Loading Ramdisk to 07e20000, end 07fa4100 ... OK"
i paste the logbuf as follow(include some test info),bootargs=/dev/ram rw. if i set the bootargs=console=ttyCPM0,9600 root=/dev/ram rw my kernel stop at the console setup period.
the appendix is the logbuf wiht DEBUG=1
what is wrong? please give me some advice



keng_629
2007-10-13

[-- Attachment #1.2: Type: text/html, Size: 1166 bytes --]

[-- Attachment #2: mpc860test.txt --]
[-- Type: application/octet-stream, Size: 48789 bytes --]

md 160194
00160194: 67206465 76696365 3a204944 203d2027    g device: ID = '
001601a4: 74747965 32270a3c 373e6b6f 626a6563    ttye2'.<7>kobjec
001601b4: 74207474 7965323a 20726567 69737465    t ttye2: registe
001601c4: 72696e67 2e207061 72656e74 3a207474    ring. parent: tt
001601d4: 792c2073 65743a20 64657669 6365730a    y, set: devices.
001601e4: 3c373e50 4d3a2041 6464696e 6720696e    <7>PM: Adding in
001601f4: 666f2066 6f72204e 6f204275 733a7474    fo for No Bus:tt
00160204: 7965320a 3c373e6b 6f626a65 63745f75    ye2.<7>kobject_u
00160214: 6576656e 745f656e 760a3c37 3e66696c    event_env.<7>fil
00160224: 6c5f6b6f 626a5f70 6174683a 20706174    l_kobj_path: pat
00160234: 68203d20 272f636c 6173732f 7474792f    h = '/class/tty/
00160244: 74747965 32270a3c 373e4445 563a2072    ttye2'.<7>DEV: r
00160254: 65676973 74657269 6e672064 65766963    egistering devic
00160264: 653a2049 44203d20 27747479 6533270a    e: ID = 'ttye3'.
00160274: 3c373e6b 6f626a65 63742074 74796533    <7>kobject ttye3
00160284: 3a207265 67697374 6572696e 672e2070    : registering. p
NDSC860: 
00160294: 6172656e 743a2074 74792c20 7365743a    arent: tty, set:
001602a4: 20646576 69636573 0a3c373e 504d3a20     devices.<7>PM: 
001602b4: 41646469 6e672069 6e666f20 666f7220    Adding info for 
001602c4: 4e6f2042 75733a74 74796533 0a3c373e    No Bus:ttye3.<7>
001602d4: 6b6f626a 6563745f 75657665 6e745f65    kobject_uevent_e
001602e4: 6e760a3c 373e6669 6c6c5f6b 6f626a5f    nv.<7>fill_kobj_
001602f4: 70617468 3a207061 7468203d 20272f63    path: path = '/c
00160304: 6c617373 2f747479 2f747479 6533270a    lass/tty/ttye3'.
00160314: 3c373e44 45563a20 72656769 73746572    <7>DEV: register
00160324: 696e6720 64657669 63653a20 4944203d    ing device: ID =
00160334: 20277474 79653427 0a3c373e 6b6f626a     'ttye4'.<7>kobj
00160344: 65637420 74747965 343a2072 65676973    ect ttye4: regis
00160354: 74657269 6e672e20 70617265 6e743a20    tering. parent: 
00160364: 7474792c 20736574 3a206465 76696365    tty, set: device
00160374: 730a3c37 3e504d3a 20416464 696e6720    s.<7>PM: Adding 
00160384: 696e666f 20666f72 204e6f20 4275733a    info for No Bus:
NDSC860: 
00160394: 74747965 340a3c37 3e6b6f62 6a656374    ttye4.<7>kobject
001603a4: 5f756576 656e745f 656e760a 3c373e66    _uevent_env.<7>f
001603b4: 696c6c5f 6b6f626a 5f706174 683a2070    ill_kobj_path: p
001603c4: 61746820 3d20272f 636c6173 732f7474    ath = '/class/tt
001603d4: 792f7474 79653427 0a3c373e 4445563a    y/ttye4'.<7>DEV:
001603e4: 20726567 69737465 72696e67 20646576     registering dev
001603f4: 6963653a 20494420 3d202774 74796535    ice: ID = 'ttye5
00160404: 270a3c37 3e6b6f62 6a656374 20747479    '.<7>kobject tty
00160414: 65353a20 72656769 73746572 696e672e    e5: registering.
00160424: 20706172 656e743a 20747479 2c207365     parent: tty, se
00160434: 743a2064 65766963 65730a3c 373e504d    t: devices.<7>PM
00160444: 3a204164 64696e67 20696e66 6f20666f    : Adding info fo
00160454: 72204e6f 20427573 3a747479 65350a3c    r No Bus:ttye5.<
00160464: 373e6b6f 626a6563 745f7565 76656e74    7>kobject_uevent
00160474: 5f656e76 0a3c373e 66696c6c 5f6b6f62    _env.<7>fill_kob
00160484: 6a5f7061 74683a20 70617468 203d2027    j_path: path = '
NDSC860: 
00160494: 2f636c61 73732f74 74792f74 74796535    /class/tty/ttye5
001604a4: 270a3c37 3e444556 3a207265 67697374    '.<7>DEV: regist
001604b4: 6572696e 67206465 76696365 3a204944    ering device: ID
001604c4: 203d2027 74747965 36270a3c 373e6b6f     = 'ttye6'.<7>ko
001604d4: 626a6563 74207474 7965363a 20726567    bject ttye6: reg
001604e4: 69737465 72696e67 2e207061 72656e74    istering. parent
001604f4: 3a207474 792c2073 65743a20 64657669    : tty, set: devi
00160504: 6365730a 3c373e50 4d3a2041 6464696e    ces.<7>PM: Addin
00160514: 6720696e 666f2066 6f72204e 6f204275    g info for No Bu
00160524: 733a7474 7965360a 3c373e6b 6f626a65    s:ttye6.<7>kobje
00160534: 63745f75 6576656e 745f656e 760a3c37    ct_uevent_env.<7
00160544: 3e66696c 6c5f6b6f 626a5f70 6174683a    >fill_kobj_path:
00160554: 20706174 68203d20 272f636c 6173732f     path = '/class/
00160564: 7474792f 74747965 36270a3c 373e4445    tty/ttye6'.<7>DE
00160574: 563a2072 65676973 74657269 6e672064    V: registering d
00160584: 65766963 653a2049 44203d20 27747479    evice: ID = 'tty
NDSC860: 
00160594: 6537270a 3c373e6b 6f626a65 63742074    e7'.<7>kobject t
001605a4: 74796537 3a207265 67697374 6572696e    tye7: registerin
001605b4: 672e2070 6172656e 743a2074 74792c20    g. parent: tty, 
001605c4: 7365743a 20646576 69636573 0a3c373e    set: devices.<7>
001605d4: 504d3a20 41646469 6e672069 6e666f20    PM: Adding info 
001605e4: 666f7220 4e6f2042 75733a74 74796537    for No Bus:ttye7
001605f4: 0a3c373e 6b6f626a 6563745f 75657665    .<7>kobject_ueve
00160604: 6e745f65 6e760a3c 373e6669 6c6c5f6b    nt_env.<7>fill_k
00160614: 6f626a5f 70617468 3a207061 7468203d    obj_path: path =
00160624: 20272f63 6c617373 2f747479 2f747479     '/class/tty/tty
00160634: 6537270a 3c373e44 45563a20 72656769    e7'.<7>DEV: regi
00160644: 73746572 696e6720 64657669 63653a20    stering device: 
00160654: 4944203d 20277474 79653827 0a3c373e    ID = 'ttye8'.<7>
00160664: 6b6f626a 65637420 74747965 383a2072    kobject ttye8: r
00160674: 65676973 74657269 6e672e20 70617265    egistering. pare
00160684: 6e743a20 7474792c 20736574 3a206465    nt: tty, set: de
NDSC860: 
00160694: 76696365 730a3c37 3e504d3a 20416464    vices.<7>PM: Add
001606a4: 696e6720 696e666f 20666f72 204e6f20    ing info for No 
001606b4: 4275733a 74747965 380a3c37 3e6b6f62    Bus:ttye8.<7>kob
001606c4: 6a656374 5f756576 656e745f 656e760a    ject_uevent_env.
001606d4: 3c373e66 696c6c5f 6b6f626a 5f706174    <7>fill_kobj_pat
001606e4: 683a2070 61746820 3d20272f 636c6173    h: path = '/clas
001606f4: 732f7474 792f7474 79653827 0a3c373e    s/tty/ttye8'.<7>
00160704: 4445563a 20726567 69737465 72696e67    DEV: registering
00160714: 20646576 6963653a 20494420 3d202774     device: ID = 't
00160724: 74796539 270a3c37 3e6b6f62 6a656374    tye9'.<7>kobject
00160734: 20747479 65393a20 72656769 73746572     ttye9: register
00160744: 696e672e 20706172 656e743a 20747479    ing. parent: tty
00160754: 2c207365 743a2064 65766963 65730a3c    , set: devices.<
00160764: 373e504d 3a204164 64696e67 20696e66    7>PM: Adding inf
00160774: 6f20666f 72204e6f 20427573 3a747479    o for No Bus:tty
00160784: 65390a3c 373e6b6f 626a6563 745f7565    e9.<7>kobject_ue
NDSC860: 
00160794: 76656e74 5f656e76 0a3c373e 66696c6c    vent_env.<7>fill
001607a4: 5f6b6f62 6a5f7061 74683a20 70617468    _kobj_path: path
001607b4: 203d2027 2f636c61 73732f74 74792f74     = '/class/tty/t
001607c4: 74796539 270a3c37 3e444556 3a207265    tye9'.<7>DEV: re
001607d4: 67697374 6572696e 67206465 76696365    gistering device
001607e4: 3a204944 203d2027 74747965 61270a3c    : ID = 'ttyea'.<
001607f4: 373e6b6f 626a6563 74207474 7965613a    7>kobject ttyea:
00160804: 20726567 69737465 72696e67 2e207061     registering. pa
00160814: 72656e74 3a207474 792c2073 65743a20    rent: tty, set: 
00160824: 64657669 6365730a 3c373e50 4d3a2041    devices.<7>PM: A
00160834: 6464696e 6720696e 666f2066 6f72204e    dding info for N
00160844: 6f204275 733a7474 7965610a 3c373e6b    o Bus:ttyea.<7>k
00160854: 6f626a65 63745f75 6576656e 745f656e    object_uevent_en
00160864: 760a3c37 3e66696c 6c5f6b6f 626a5f70    v.<7>fill_kobj_p
00160874: 6174683a 20706174 68203d20 272f636c    ath: path = '/cl
00160884: 6173732f 7474792f 74747965 61270a3c    ass/tty/ttyea'.<
NDSC860: 
00160894: 373e4445 563a2072 65676973 74657269    7>DEV: registeri
001608a4: 6e672064 65766963 653a2049 44203d20    ng device: ID = 
001608b4: 27747479 6562270a 3c373e6b 6f626a65    'ttyeb'.<7>kobje
001608c4: 63742074 74796562 3a207265 67697374    ct ttyeb: regist
001608d4: 6572696e 672e2070 6172656e 743a2074    ering. parent: t
001608e4: 74792c20 7365743a 20646576 69636573    ty, set: devices
001608f4: 0a3c373e 504d3a20 41646469 6e672069    .<7>PM: Adding i
00160904: 6e666f20 666f7220 4e6f2042 75733a74    nfo for No Bus:t
00160914: 74796562 0a3c373e 6b6f626a 6563745f    tyeb.<7>kobject_
00160924: 75657665 6e745f65 6e760a3c 373e6669    uevent_env.<7>fi
00160934: 6c6c5f6b 6f626a5f 70617468 3a207061    ll_kobj_path: pa
00160944: 7468203d 20272f63 6c617373 2f747479    th = '/class/tty
00160954: 2f747479 6562270a 3c373e44 45563a20    /ttyeb'.<7>DEV: 
00160964: 72656769 73746572 696e6720 64657669    registering devi
00160974: 63653a20 4944203d 20277474 79656327    ce: ID = 'ttyec'
00160984: 0a3c373e 6b6f626a 65637420 74747965    .<7>kobject ttye
NDSC860: 
00160994: 633a2072 65676973 74657269 6e672e20    c: registering. 
001609a4: 70617265 6e743a20 7474792c 20736574    parent: tty, set
001609b4: 3a206465 76696365 730a3c37 3e504d3a    : devices.<7>PM:
001609c4: 20416464 696e6720 696e666f 20666f72     Adding info for
001609d4: 204e6f20 4275733a 74747965 630a3c37     No Bus:ttyec.<7
001609e4: 3e6b6f62 6a656374 5f756576 656e745f    >kobject_uevent_
001609f4: 656e760a 3c373e66 696c6c5f 6b6f626a    env.<7>fill_kobj
00160a04: 5f706174 683a2070 61746820 3d20272f    _path: path = '/
00160a14: 636c6173 732f7474 792f7474 79656327    class/tty/ttyec'
00160a24: 0a3c373e 4445563a 20726567 69737465    .<7>DEV: registe
00160a34: 72696e67 20646576 6963653a 20494420    ring device: ID 
00160a44: 3d202774 74796564 270a3c37 3e6b6f62    = 'ttyed'.<7>kob
00160a54: 6a656374 20747479 65643a20 72656769    ject ttyed: regi
00160a64: 73746572 696e672e 20706172 656e743a    stering. parent:
00160a74: 20747479 2c207365 743a2064 65766963     tty, set: devic
00160a84: 65730a3c 373e504d 3a204164 64696e67    es.<7>PM: Adding
NDSC860: 
00160a94: 20696e66 6f20666f 72204e6f 20427573     info for No Bus
00160aa4: 3a747479 65640a3c 373e6b6f 626a6563    :ttyed.<7>kobjec
00160ab4: 745f7565 76656e74 5f656e76 0a3c373e    t_uevent_env.<7>
00160ac4: 66696c6c 5f6b6f62 6a5f7061 74683a20    fill_kobj_path: 
00160ad4: 70617468 203d2027 2f636c61 73732f74    path = '/class/t
00160ae4: 74792f74 74796564 270a3c37 3e444556    ty/ttyed'.<7>DEV
00160af4: 3a207265 67697374 6572696e 67206465    : registering de
00160b04: 76696365 3a204944 203d2027 74747965    vice: ID = 'ttye
00160b14: 65270a3c 373e6b6f 626a6563 74207474    e'.<7>kobject tt
00160b24: 7965653a 20726567 69737465 72696e67    yee: registering
00160b34: 2e207061 72656e74 3a207474 792c2073    . parent: tty, s
00160b44: 65743a20 64657669 6365730a 3c373e50    et: devices.<7>P
00160b54: 4d3a2041 6464696e 6720696e 666f2066    M: Adding info f
00160b64: 6f72204e 6f204275 733a7474 7965650a    or No Bus:ttyee.
00160b74: 3c373e6b 6f626a65 63745f75 6576656e    <7>kobject_ueven
00160b84: 745f656e 760a3c37 3e66696c 6c5f6b6f    t_env.<7>fill_ko
NDSC860: 
00160b94: 626a5f70 6174683a 20706174 68203d20    bj_path: path = 
00160ba4: 272f636c 6173732f 7474792f 74747965    '/class/tty/ttye
00160bb4: 65270a3c 373e4445 563a2072 65676973    e'.<7>DEV: regis
00160bc4: 74657269 6e672064 65766963 653a2049    tering device: I
00160bd4: 44203d20 27747479 6566270a 3c373e6b    D = 'ttyef'.<7>k
00160be4: 6f626a65 63742074 74796566 3a207265    object ttyef: re
00160bf4: 67697374 6572696e 672e2070 6172656e    gistering. paren
00160c04: 743a2074 74792c20 7365743a 20646576    t: tty, set: dev
00160c14: 69636573 0a3c373e 504d3a20 41646469    ices.<7>PM: Addi
00160c24: 6e672069 6e666f20 666f7220 4e6f2042    ng info for No B
00160c34: 75733a74 74796566 0a3c373e 6b6f626a    us:ttyef.<7>kobj
00160c44: 6563745f 75657665 6e745f65 6e760a3c    ect_uevent_env.<
00160c54: 373e6669 6c6c5f6b 6f626a5f 70617468    7>fill_kobj_path
00160c64: 3a207061 7468203d 20272f63 6c617373    : path = '/class
00160c74: 2f747479 2f747479 6566270a 3c363e53    /tty/ttyef'.<6>S
00160c84: 65726961 6c3a2043 504d2064 72697665    erial: CPM drive
NDSC860: 
00160c94: 72202452 65766973 696f6e3a 20302e30    r $Revision: 0.0
00160ca4: 3220240a 3c363e63 706d5f75 6172743a    2 $.<6>cpm_uart:
00160cb4: 20574152 4e494e47 3a206e6f 20554152     WARNING: no UAR
00160cc4: 54206465 76696365 7320666f 756e6420    T devices found 
00160cd4: 6f6e2070 6c617466 6f726d20 62757321    on platform bus!
00160ce4: 0a3c363e 63706d5f 75617274 3a207468    .<6>cpm_uart: th
00160cf4: 65206472 69766572 2077696c 6c206775    e driver will gu
00160d04: 65737320 636f6e66 69677572 6174696f    ess configuratio
00160d14: 6e2c2062 75742074 68697320 6d6f6465    n, but this mode
00160d24: 20697320 6e6f206c 6f6e6765 72207375     is no longer su
00160d34: 70706f72 7465642e 0a3c373e 43504d20    pported..<7>CPM 
00160d44: 75617274 5b2d5d3a 696e6974 20706f72    uart[-]:init por
00160d54: 74646573 630a3c37 3e43504d 20756172    tdesc.<7>CPM uar
00160d64: 745b305d 3a636f6e 6669675f 706f7274    t[0]:config_port
00160d74: 0a3c373e 43504d20 75617274 5b305d3a    .<7>CPM uart[0]:
00160d84: 72657175 65737420 706f7274 0a3c373e    request port.<7>
NDSC860: 
00160d94: 43504d20 75617274 5b305d3a 616c6c6f    CPM uart[0]:allo
00160da4: 63627566 0a3c373e 70696e66 6f2d3e6d    cbuf.<7>pinfo->m
00160db4: 656d5f61 64647220 69732066 66313030    em_addr is ff100
00160dc4: 3030300a 3c373e70 696e666f 2d3e646d    000.<7>pinfo->dm
00160dd4: 615f6164 64722069 73203037 65336130    a_addr is 07e3a0
00160de4: 30300a3c 373e7069 6e666f2d 3e72785f    00.<7>pinfo->rx_
00160df4: 62756620 69732066 66313030 3030300a    buf is ff100000.
00160e04: 3c373e70 696e666f 2d3e7478 5f627566    <7>pinfo->tx_buf
00160e14: 20697320 66663130 30303830 0a3c373e     is ff100080.<7>
00160e24: 70696e66 6f2d3e72 785f6264 5f626173    pinfo->rx_bd_bas
00160e34: 65206973 20666466 66663830 300a3c37    e is fdfff800.<7
00160e44: 3e70696e 666f2d3e 74785f62 645f6261    >pinfo->tx_bd_ba
00160e54: 73652069 73206664 66666638 32300a3c    se is fdfff820.<
00160e64: 373e4350 4d207561 72745b30 5d3a696e    7>CPM uart[0]:in
00160e74: 69746264 0a3c373e 43504d20 75617274    itbd.<7>CPM uart
00160e84: 5b305d3a 696e6974 5f736d63 0a3c373e    [0]:init_smc.<7>
NDSC860: 
00160e94: 43504d20 75617274 5b305d3a 75617274    CPM uart[0]:uart
00160ea4: 5f747970 650a3c36 3e747479 43504d30    _type.<6>ttyCPM0
00160eb4: 20617420 4d4d494f 20307866 66303030     at MMIO 0xff000
00160ec4: 61383020 28697271 203d2032 30292069    a80 (irq = 20) i
00160ed4: 73206120 43504d20 55415254 0a3c373e    s a CPM UART.<7>
00160ee4: 4445563a 20726567 69737465 72696e67    DEV: registering
00160ef4: 20646576 6963653a 20494420 3d202774     device: ID = 't
00160f04: 74794350 4d30270a 3c373e6b 6f626a65    tyCPM0'.<7>kobje
00160f14: 63742074 74794350 4d303a20 72656769    ct ttyCPM0: regi
00160f24: 73746572 696e672e 20706172 656e743a    stering. parent:
00160f34: 20747479 2c207365 743a2064 65766963     tty, set: devic
00160f44: 65730a3c 373e504d 3a204164 64696e67    es.<7>PM: Adding
00160f54: 20696e66 6f20666f 72204e6f 20427573     info for No Bus
00160f64: 3a747479 43504d30 0a3c373e 6b6f626a    :ttyCPM0.<7>kobj
00160f74: 6563745f 75657665 6e745f65 6e760a3c    ect_uevent_env.<
00160f84: 373e6669 6c6c5f6b 6f626a5f 70617468    7>fill_kobj_path
NDSC860: 
00160f94: 3a207061 7468203d 20272f63 6c617373    : path = '/class
00160fa4: 2f747479 2f747479 43504d30 270a3c37    /tty/ttyCPM0'.<7
00160fb4: 3e6b6f62 6a656374 2072616d 303a2072    >kobject ram0: r
00160fc4: 65676973 74657269 6e672e20 70617265    egistering. pare
00160fd4: 6e743a20 3c4e554c 4c3e2c20 7365743a    nt: <NULL>, set:
00160fe4: 20626c6f 636b0a3c 373e6b6f 626a6563     block.<7>kobjec
00160ff4: 7420686f 6c646572 733a2072 65676973    t holders: regis
00161004: 74657269 6e672e20 70617265 6e743a20    tering. parent: 
00161014: 72616d30 2c207365 743a203c 4e554c4c    ram0, set: <NULL
00161024: 3e0a3c37 3e6b6f62 6a656374 5f756576    >.<7>kobject_uev
00161034: 656e745f 656e760a 3c373e6b 6f626a65    ent_env.<7>kobje
00161044: 63742066 696c7465 72206675 6e637469    ct filter functi
00161054: 6f6e2063 61757365 64207468 65206576    on caused the ev
00161064: 656e7420 746f2064 726f7021 0a3c373e    ent to drop!.<7>
00161074: 6b6f626a 65637420 736c6176 65733a20    kobject slaves: 
00161084: 72656769 73746572 696e672e 20706172    registering. par
NDSC860: 
00161094: 656e743a 2072616d 302c2073 65743a20    ent: ram0, set: 
001610a4: 3c4e554c 4c3e0a3c 373e6b6f 626a6563    <NULL>.<7>kobjec
001610b4: 745f7565 76656e74 5f656e76 0a3c373e    t_uevent_env.<7>
001610c4: 6b6f626a 65637420 66696c74 65722066    kobject filter f
001610d4: 756e6374 696f6e20 63617573 65642074    unction caused t
001610e4: 68652065 76656e74 20746f20 64726f70    he event to drop
001610f4: 210a3c37 3e6b6f62 6a656374 5f756576    !.<7>kobject_uev
00161104: 656e745f 656e760a 3c373e66 696c6c5f    ent_env.<7>fill_
00161114: 6b6f626a 5f706174 683a2070 61746820    kobj_path: path 
00161124: 3d20272f 626c6f63 6b2f7261 6d30270a    = '/block/ram0'.
00161134: 3c373e6b 6f626a65 63742072 616d313a    <7>kobject ram1:
00161144: 20726567 69737465 72696e67 2e207061     registering. pa
00161154: 72656e74 3a203c4e 554c4c3e 2c207365    rent: <NULL>, se
00161164: 743a2062 6c6f636b 0a3c373e 6b6f626a    t: block.<7>kobj
00161174: 65637420 686f6c64 6572733a 20726567    ect holders: reg
00161184: 69737465 72696e67 2e207061 72656e74    istering. parent
NDSC860: 
00161194: 3a207261 6d312c20 7365743a 203c4e55    : ram1, set: <NU
001611a4: 4c4c3e0a 3c373e6b 6f626a65 63745f75    LL>.<7>kobject_u
001611b4: 6576656e 745f656e 760a3c37 3e6b6f62    event_env.<7>kob
001611c4: 6a656374 2066696c 74657220 66756e63    ject filter func
001611d4: 74696f6e 20636175 73656420 74686520    tion caused the 
001611e4: 6576656e 7420746f 2064726f 70210a3c    event to drop!.<
001611f4: 373e6b6f 626a6563 7420736c 61766573    7>kobject slaves
00161204: 3a207265 67697374 6572696e 672e2070    : registering. p
00161214: 6172656e 743a2072 616d312c 20736574    arent: ram1, set
00161224: 3a203c4e 554c4c3e 0a3c373e 6b6f626a    : <NULL>.<7>kobj
00161234: 6563745f 75657665 6e745f65 6e760a3c    ect_uevent_env.<
00161244: 373e6b6f 626a6563 74206669 6c746572    7>kobject filter
00161254: 2066756e 6374696f 6e206361 75736564     function caused
00161264: 20746865 20657665 6e742074 6f206472     the event to dr
00161274: 6f70210a 3c373e6b 6f626a65 63745f75    op!.<7>kobject_u
00161284: 6576656e 745f656e 760a3c37 3e66696c    event_env.<7>fil
NDSC860: 
00161294: 6c5f6b6f 626a5f70 6174683a 20706174    l_kobj_path: pat
001612a4: 68203d20 272f626c 6f636b2f 72616d31    h = '/block/ram1
001612b4: 270a3c37 3e6b6f62 6a656374 2072616d    '.<7>kobject ram
001612c4: 323a2072 65676973 74657269 6e672e20    2: registering. 
001612d4: 70617265 6e743a20 3c4e554c 4c3e2c20    parent: <NULL>, 
001612e4: 7365743a 20626c6f 636b0a3c 373e6b6f    set: block.<7>ko
001612f4: 626a6563 7420686f 6c646572 733a2072    bject holders: r
00161304: 65676973 74657269 6e672e20 70617265    egistering. pare
00161314: 6e743a20 72616d32 2c207365 743a203c    nt: ram2, set: <
00161324: 4e554c4c 3e0a3c37 3e6b6f62 6a656374    NULL>.<7>kobject
00161334: 5f756576 656e745f 656e760a 3c373e6b    _uevent_env.<7>k
00161344: 6f626a65 63742066 696c7465 72206675    object filter fu
00161354: 6e637469 6f6e2063 61757365 64207468    nction caused th
00161364: 65206576 656e7420 746f2064 726f7021    e event to drop!
00161374: 0a3c373e 6b6f626a 65637420 736c6176    .<7>kobject slav
00161384: 65733a20 72656769 73746572 696e672e    es: registering.
NDSC860: 
00161394: 20706172 656e743a 2072616d 322c2073     parent: ram2, s
001613a4: 65743a20 3c4e554c 4c3e0a3c 373e6b6f    et: <NULL>.<7>ko
001613b4: 626a6563 745f7565 76656e74 5f656e76    bject_uevent_env
001613c4: 0a3c373e 6b6f626a 65637420 66696c74    .<7>kobject filt
001613d4: 65722066 756e6374 696f6e20 63617573    er function caus
001613e4: 65642074 68652065 76656e74 20746f20    ed the event to 
001613f4: 64726f70 210a3c37 3e6b6f62 6a656374    drop!.<7>kobject
00161404: 5f756576 656e745f 656e760a 3c373e66    _uevent_env.<7>f
00161414: 696c6c5f 6b6f626a 5f706174 683a2070    ill_kobj_path: p
00161424: 61746820 3d20272f 626c6f63 6b2f7261    ath = '/block/ra
00161434: 6d32270a 3c373e6b 6f626a65 63742072    m2'.<7>kobject r
00161444: 616d333a 20726567 69737465 72696e67    am3: registering
00161454: 2e207061 72656e74 3a203c4e 554c4c3e    . parent: <NULL>
00161464: 2c207365 743a2062 6c6f636b 0a3c373e    , set: block.<7>
00161474: 6b6f626a 65637420 686f6c64 6572733a    kobject holders:
00161484: 20726567 69737465 72696e67 2e207061     registering. pa
NDSC860: 
00161494: 72656e74 3a207261 6d332c20 7365743a    rent: ram3, set:
001614a4: 203c4e55 4c4c3e0a 3c373e6b 6f626a65     <NULL>.<7>kobje
001614b4: 63745f75 6576656e 745f656e 760a3c37    ct_uevent_env.<7
001614c4: 3e6b6f62 6a656374 2066696c 74657220    >kobject filter 
001614d4: 66756e63 74696f6e 20636175 73656420    function caused 
001614e4: 74686520 6576656e 7420746f 2064726f    the event to dro
001614f4: 70210a3c 373e6b6f 626a6563 7420736c    p!.<7>kobject sl
00161504: 61766573 3a207265 67697374 6572696e    aves: registerin
00161514: 672e2070 6172656e 743a2072 616d332c    g. parent: ram3,
00161524: 20736574 3a203c4e 554c4c3e 0a3c373e     set: <NULL>.<7>
00161534: 6b6f626a 6563745f 75657665 6e745f65    kobject_uevent_e
00161544: 6e760a3c 373e6b6f 626a6563 74206669    nv.<7>kobject fi
00161554: 6c746572 2066756e 6374696f 6e206361    lter function ca
00161564: 75736564 20746865 20657665 6e742074    used the event t
00161574: 6f206472 6f70210a 3c373e6b 6f626a65    o drop!.<7>kobje
00161584: 63745f75 6576656e 745f656e 760a3c37    ct_uevent_env.<7
NDSC860: 
00161594: 3e66696c 6c5f6b6f 626a5f70 6174683a    >fill_kobj_path:
001615a4: 20706174 68203d20 272f626c 6f636b2f     path = '/block/
001615b4: 72616d33 270a3c37 3e6b6f62 6a656374    ram3'.<7>kobject
001615c4: 2072616d 343a2072 65676973 74657269     ram4: registeri
001615d4: 6e672e20 70617265 6e743a20 3c4e554c    ng. parent: <NUL
001615e4: 4c3e2c20 7365743a 20626c6f 636b0a3c    L>, set: block.<
001615f4: 373e6b6f 626a6563 7420686f 6c646572    7>kobject holder
00161604: 733a2072 65676973 74657269 6e672e20    s: registering. 
00161614: 70617265 6e743a20 72616d34 2c207365    parent: ram4, se
00161624: 743a203c 4e554c4c 3e0a3c37 3e6b6f62    t: <NULL>.<7>kob
00161634: 6a656374 5f756576 656e745f 656e760a    ject_uevent_env.
00161644: 3c373e6b 6f626a65 63742066 696c7465    <7>kobject filte
00161654: 72206675 6e637469 6f6e2063 61757365    r function cause
00161664: 64207468 65206576 656e7420 746f2064    d the event to d
00161674: 726f7021 0a3c373e 6b6f626a 65637420    rop!.<7>kobject 
00161684: 736c6176 65733a20 72656769 73746572    slaves: register
NDSC860: 
00161694: 696e672e 20706172 656e743a 2072616d    ing. parent: ram
001616a4: 342c2073 65743a20 3c4e554c 4c3e0a3c    4, set: <NULL>.<
001616b4: 373e6b6f 626a6563 745f7565 76656e74    7>kobject_uevent
001616c4: 5f656e76 0a3c373e 6b6f626a 65637420    _env.<7>kobject 
001616d4: 66696c74 65722066 756e6374 696f6e20    filter function 
001616e4: 63617573 65642074 68652065 76656e74    caused the event
001616f4: 20746f20 64726f70 210a3c37 3e6b6f62     to drop!.<7>kob
00161704: 6a656374 5f756576 656e745f 656e760a    ject_uevent_env.
00161714: 3c373e66 696c6c5f 6b6f626a 5f706174    <7>fill_kobj_pat
00161724: 683a2070 61746820 3d20272f 626c6f63    h: path = '/bloc
00161734: 6b2f7261 6d34270a 3c373e6b 6f626a65    k/ram4'.<7>kobje
00161744: 63742072 616d353a 20726567 69737465    ct ram5: registe
00161754: 72696e67 2e207061 72656e74 3a203c4e    ring. parent: <N
00161764: 554c4c3e 2c207365 743a2062 6c6f636b    ULL>, set: block
00161774: 0a3c373e 6b6f626a 65637420 686f6c64    .<7>kobject hold
00161784: 6572733a 20726567 69737465 72696e67    ers: registering
NDSC860: 
00161794: 2e207061 72656e74 3a207261 6d352c20    . parent: ram5, 
001617a4: 7365743a 203c4e55 4c4c3e0a 3c373e6b    set: <NULL>.<7>k
001617b4: 6f626a65 63745f75 6576656e 745f656e    object_uevent_en
001617c4: 760a3c37 3e6b6f62 6a656374 2066696c    v.<7>kobject fil
001617d4: 74657220 66756e63 74696f6e 20636175    ter function cau
001617e4: 73656420 74686520 6576656e 7420746f    sed the event to
001617f4: 2064726f 70210a3c 373e6b6f 626a6563     drop!.<7>kobjec
00161804: 7420736c 61766573 3a207265 67697374    t slaves: regist
00161814: 6572696e 672e2070 6172656e 743a2072    ering. parent: r
00161824: 616d352c 20736574 3a203c4e 554c4c3e    am5, set: <NULL>
00161834: 0a3c373e 6b6f626a 6563745f 75657665    .<7>kobject_ueve
00161844: 6e745f65 6e760a3c 373e6b6f 626a6563    nt_env.<7>kobjec
00161854: 74206669 6c746572 2066756e 6374696f    t filter functio
00161864: 6e206361 75736564 20746865 20657665    n caused the eve
00161874: 6e742074 6f206472 6f70210a 3c373e6b    nt to drop!.<7>k
00161884: 6f626a65 63745f75 6576656e 745f656e    object_uevent_en
NDSC860: 
00161894: 760a3c37 3e66696c 6c5f6b6f 626a5f70    v.<7>fill_kobj_p
001618a4: 6174683a 20706174 68203d20 272f626c    ath: path = '/bl
001618b4: 6f636b2f 72616d35 270a3c37 3e6b6f62    ock/ram5'.<7>kob
001618c4: 6a656374 2072616d 363a2072 65676973    ject ram6: regis
001618d4: 74657269 6e672e20 70617265 6e743a20    tering. parent: 
001618e4: 3c4e554c 4c3e2c20 7365743a 20626c6f    <NULL>, set: blo
001618f4: 636b0a3c 373e6b6f 626a6563 7420686f    ck.<7>kobject ho
00161904: 6c646572 733a2072 65676973 74657269    lders: registeri
00161914: 6e672e20 70617265 6e743a20 72616d36    ng. parent: ram6
00161924: 2c207365 743a203c 4e554c4c 3e0a3c37    , set: <NULL>.<7
00161934: 3e6b6f62 6a656374 5f756576 656e745f    >kobject_uevent_
00161944: 656e760a 3c373e6b 6f626a65 63742066    env.<7>kobject f
00161954: 696c7465 72206675 6e637469 6f6e2063    ilter function c
00161964: 61757365 64207468 65206576 656e7420    aused the event 
00161974: 746f2064 726f7021 0a3c373e 6b6f626a    to drop!.<7>kobj
00161984: 65637420 736c6176 65733a20 72656769    ect slaves: regi
NDSC860: 
00161994: 73746572 696e672e 20706172 656e743a    stering. parent:
001619a4: 2072616d 362c2073 65743a20 3c4e554c     ram6, set: <NUL
001619b4: 4c3e0a3c 373e6b6f 626a6563 745f7565    L>.<7>kobject_ue
001619c4: 76656e74 5f656e76 0a3c373e 6b6f626a    vent_env.<7>kobj
001619d4: 65637420 66696c74 65722066 756e6374    ect filter funct
001619e4: 696f6e20 63617573 65642074 68652065    ion caused the e
001619f4: 76656e74 20746f20 64726f70 210a3c37    vent to drop!.<7
00161a04: 3e6b6f62 6a656374 5f756576 656e745f    >kobject_uevent_
00161a14: 656e760a 3c373e66 696c6c5f 6b6f626a    env.<7>fill_kobj
00161a24: 5f706174 683a2070 61746820 3d20272f    _path: path = '/
00161a34: 626c6f63 6b2f7261 6d36270a 3c373e6b    block/ram6'.<7>k
00161a44: 6f626a65 63742072 616d373a 20726567    object ram7: reg
00161a54: 69737465 72696e67 2e207061 72656e74    istering. parent
00161a64: 3a203c4e 554c4c3e 2c207365 743a2062    : <NULL>, set: b
00161a74: 6c6f636b 0a3c373e 6b6f626a 65637420    lock.<7>kobject 
00161a84: 686f6c64 6572733a 20726567 69737465    holders: registe
NDSC860: 
00161a94: 72696e67 2e207061 72656e74 3a207261    ring. parent: ra
00161aa4: 6d372c20 7365743a 203c4e55 4c4c3e0a    m7, set: <NULL>.
00161ab4: 3c373e6b 6f626a65 63745f75 6576656e    <7>kobject_ueven
00161ac4: 745f656e 760a3c37 3e6b6f62 6a656374    t_env.<7>kobject
00161ad4: 2066696c 74657220 66756e63 74696f6e     filter function
00161ae4: 20636175 73656420 74686520 6576656e     caused the even
00161af4: 7420746f 2064726f 70210a3c 373e6b6f    t to drop!.<7>ko
00161b04: 626a6563 7420736c 61766573 3a207265    bject slaves: re
00161b14: 67697374 6572696e 672e2070 6172656e    gistering. paren
00161b24: 743a2072 616d372c 20736574 3a203c4e    t: ram7, set: <N
00161b34: 554c4c3e 0a3c373e 6b6f626a 6563745f    ULL>.<7>kobject_
00161b44: 75657665 6e745f65 6e760a3c 373e6b6f    uevent_env.<7>ko
00161b54: 626a6563 74206669 6c746572 2066756e    bject filter fun
00161b64: 6374696f 6e206361 75736564 20746865    ction caused the
00161b74: 20657665 6e742074 6f206472 6f70210a     event to drop!.
00161b84: 3c373e6b 6f626a65 63745f75 6576656e    <7>kobject_ueven
NDSC860: 
00161b94: 745f656e 760a3c37 3e66696c 6c5f6b6f    t_env.<7>fill_ko
00161ba4: 626a5f70 6174683a 20706174 68203d20    bj_path: path = 
00161bb4: 272f626c 6f636b2f 72616d37 270a3c37    '/block/ram7'.<7
00161bc4: 3e6b6f62 6a656374 2072616d 383a2072    >kobject ram8: r
00161bd4: 65676973 74657269 6e672e20 70617265    egistering. pare
00161be4: 6e743a20 3c4e554c 4c3e2c20 7365743a    nt: <NULL>, set:
00161bf4: 20626c6f 636b0a3c 373e6b6f 626a6563     block.<7>kobjec
00161c04: 7420686f 6c646572 733a2072 65676973    t holders: regis
00161c14: 74657269 6e672e20 70617265 6e743a20    tering. parent: 
00161c24: 72616d38 2c207365 743a203c 4e554c4c    ram8, set: <NULL
00161c34: 3e0a3c37 3e6b6f62 6a656374 5f756576    >.<7>kobject_uev
00161c44: 656e745f 656e760a 3c373e6b 6f626a65    ent_env.<7>kobje
00161c54: 63742066 696c7465 72206675 6e637469    ct filter functi
00161c64: 6f6e2063 61757365 64207468 65206576    on caused the ev
00161c74: 656e7420 746f2064 726f7021 0a3c373e    ent to drop!.<7>
00161c84: 6b6f626a 65637420 736c6176 65733a20    kobject slaves: 
NDSC860: 
00161c94: 72656769 73746572 696e672e 20706172    registering. par
00161ca4: 656e743a 2072616d 382c2073 65743a20    ent: ram8, set: 
00161cb4: 3c4e554c 4c3e0a3c 373e6b6f 626a6563    <NULL>.<7>kobjec
00161cc4: 745f7565 76656e74 5f656e76 0a3c373e    t_uevent_env.<7>
00161cd4: 6b6f626a 65637420 66696c74 65722066    kobject filter f
00161ce4: 756e6374 696f6e20 63617573 65642074    unction caused t
00161cf4: 68652065 76656e74 20746f20 64726f70    he event to drop
00161d04: 210a3c37 3e6b6f62 6a656374 5f756576    !.<7>kobject_uev
00161d14: 656e745f 656e760a 3c373e66 696c6c5f    ent_env.<7>fill_
00161d24: 6b6f626a 5f706174 683a2070 61746820    kobj_path: path 
00161d34: 3d20272f 626c6f63 6b2f7261 6d38270a    = '/block/ram8'.
00161d44: 3c373e6b 6f626a65 63742072 616d393a    <7>kobject ram9:
00161d54: 20726567 69737465 72696e67 2e207061     registering. pa
00161d64: 72656e74 3a203c4e 554c4c3e 2c207365    rent: <NULL>, se
00161d74: 743a2062 6c6f636b 0a3c373e 6b6f626a    t: block.<7>kobj
00161d84: 65637420 686f6c64 6572733a 20726567    ect holders: reg
NDSC860: 
00161d94: 69737465 72696e67 2e207061 72656e74    istering. parent
00161da4: 3a207261 6d392c20 7365743a 203c4e55    : ram9, set: <NU
00161db4: 4c4c3e0a 3c373e6b 6f626a65 63745f75    LL>.<7>kobject_u
00161dc4: 6576656e 745f656e 760a3c37 3e6b6f62    event_env.<7>kob
00161dd4: 6a656374 2066696c 74657220 66756e63    ject filter func
00161de4: 74696f6e 20636175 73656420 74686520    tion caused the 
00161df4: 6576656e 7420746f 2064726f 70210a3c    event to drop!.<
00161e04: 373e6b6f 626a6563 7420736c 61766573    7>kobject slaves
00161e14: 3a207265 67697374 6572696e 672e2070    : registering. p
00161e24: 6172656e 743a2072 616d392c 20736574    arent: ram9, set
00161e34: 3a203c4e 554c4c3e 0a3c373e 6b6f626a    : <NULL>.<7>kobj
00161e44: 6563745f 75657665 6e745f65 6e760a3c    ect_uevent_env.<
00161e54: 373e6b6f 626a6563 74206669 6c746572    7>kobject filter
00161e64: 2066756e 6374696f 6e206361 75736564     function caused
00161e74: 20746865 20657665 6e742074 6f206472     the event to dr
00161e84: 6f70210a 3c373e6b 6f626a65 63745f75    op!.<7>kobject_u
NDSC860: 
00161e94: 6576656e 745f656e 760a3c37 3e66696c    event_env.<7>fil
00161ea4: 6c5f6b6f 626a5f70 6174683a 20706174    l_kobj_path: pat
00161eb4: 68203d20 272f626c 6f636b2f 72616d39    h = '/block/ram9
00161ec4: 270a3c37 3e6b6f62 6a656374 2072616d    '.<7>kobject ram
00161ed4: 31303a20 72656769 73746572 696e672e    10: registering.
00161ee4: 20706172 656e743a 203c4e55 4c4c3e2c     parent: <NULL>,
00161ef4: 20736574 3a20626c 6f636b0a 3c373e6b     set: block.<7>k
00161f04: 6f626a65 63742068 6f6c6465 72733a20    object holders: 
00161f14: 72656769 73746572 696e672e 20706172    registering. par
00161f24: 656e743a 2072616d 31302c20 7365743a    ent: ram10, set:
00161f34: 203c4e55 4c4c3e0a 3c373e6b 6f626a65     <NULL>.<7>kobje
00161f44: 63745f75 6576656e 745f656e 760a3c37    ct_uevent_env.<7
00161f54: 3e6b6f62 6a656374 2066696c 74657220    >kobject filter 
00161f64: 66756e63 74696f6e 20636175 73656420    function caused 
00161f74: 74686520 6576656e 7420746f 2064726f    the event to dro
00161f84: 70210a3c 373e6b6f 626a6563 7420736c    p!.<7>kobject sl
NDSC860: 
00161f94: 61766573 3a207265 67697374 6572696e    aves: registerin
00161fa4: 672e2070 6172656e 743a2072 616d3130    g. parent: ram10
00161fb4: 2c207365 743a203c 4e554c4c 3e0a3c37    , set: <NULL>.<7
00161fc4: 3e6b6f62 6a656374 5f756576 656e745f    >kobject_uevent_
00161fd4: 656e760a 3c373e6b 6f626a65 63742066    env.<7>kobject f
00161fe4: 696c7465 72206675 6e637469 6f6e2063    ilter function c
00161ff4: 61757365 64207468 65206576 656e7420    aused the event 
00162004: 746f2064 726f7021 0a3c373e 6b6f626a    to drop!.<7>kobj
00162014: 6563745f 75657665 6e745f65 6e760a3c    ect_uevent_env.<
00162024: 373e6669 6c6c5f6b 6f626a5f 70617468    7>fill_kobj_path
00162034: 3a207061 7468203d 20272f62 6c6f636b    : path = '/block
00162044: 2f72616d 3130270a 3c373e6b 6f626a65    /ram10'.<7>kobje
00162054: 63742072 616d3131 3a207265 67697374    ct ram11: regist
00162064: 6572696e 672e2070 6172656e 743a203c    ering. parent: <
00162074: 4e554c4c 3e2c2073 65743a20 626c6f63    NULL>, set: bloc
00162084: 6b0a3c37 3e6b6f62 6a656374 20686f6c    k.<7>kobject hol
NDSC860: 
00162094: 64657273 3a207265 67697374 6572696e    ders: registerin
001620a4: 672e2070 6172656e 743a2072 616d3131    g. parent: ram11
001620b4: 2c207365 743a203c 4e554c4c 3e0a3c37    , set: <NULL>.<7
001620c4: 3e6b6f62 6a656374 5f756576 656e745f    >kobject_uevent_
001620d4: 656e760a 3c373e6b 6f626a65 63742066    env.<7>kobject f
001620e4: 696c7465 72206675 6e637469 6f6e2063    ilter function c
001620f4: 61757365 64207468 65206576 656e7420    aused the event 
00162104: 746f2064 726f7021 0a3c373e 6b6f626a    to drop!.<7>kobj
00162114: 65637420 736c6176 65733a20 72656769    ect slaves: regi
00162124: 73746572 696e672e 20706172 656e743a    stering. parent:
00162134: 2072616d 31312c20 7365743a 203c4e55     ram11, set: <NU
00162144: 4c4c3e0a 3c373e6b 6f626a65 63745f75    LL>.<7>kobject_u
00162154: 6576656e 745f656e 760a3c37 3e6b6f62    event_env.<7>kob
00162164: 6a656374 2066696c 74657220 66756e63    ject filter func
00162174: 74696f6e 20636175 73656420 74686520    tion caused the 
00162184: 6576656e 7420746f 2064726f 70210a3c    event to drop!.<
NDSC860: 
00162194: 373e6b6f 626a6563 745f7565 76656e74    7>kobject_uevent
001621a4: 5f656e76 0a3c373e 66696c6c 5f6b6f62    _env.<7>fill_kob
001621b4: 6a5f7061 74683a20 70617468 203d2027    j_path: path = '
001621c4: 2f626c6f 636b2f72 616d3131 270a3c37    /block/ram11'.<7
001621d4: 3e6b6f62 6a656374 2072616d 31323a20    >kobject ram12: 
001621e4: 72656769 73746572 696e672e 20706172    registering. par
001621f4: 656e743a 203c4e55 4c4c3e2c 20736574    ent: <NULL>, set
00162204: 3a20626c 6f636b0a 3c373e6b 6f626a65    : block.<7>kobje
00162214: 63742068 6f6c6465 72733a20 72656769    ct holders: regi
00162224: 73746572 696e672e 20706172 656e743a    stering. parent:
00162234: 2072616d 31322c20 7365743a 203c4e55     ram12, set: <NU
00162244: 4c4c3e0a 3c373e6b 6f626a65 63745f75    LL>.<7>kobject_u
00162254: 6576656e 745f656e 760a3c37 3e6b6f62    event_env.<7>kob
00162264: 6a656374 2066696c 74657220 66756e63    ject filter func
00162274: 74696f6e 20636175 73656420 74686520    tion caused the 
00162284: 6576656e 7420746f 2064726f 70210a3c    event to drop!.<
NDSC860: 
00162294: 373e6b6f 626a6563 7420736c 61766573    7>kobject slaves
001622a4: 3a207265 67697374 6572696e 672e2070    : registering. p
001622b4: 6172656e 743a2072 616d3132 2c207365    arent: ram12, se
001622c4: 743a203c 4e554c4c 3e0a3c37 3e6b6f62    t: <NULL>.<7>kob
001622d4: 6a656374 5f756576 656e745f 656e760a    ject_uevent_env.
001622e4: 3c373e6b 6f626a65 63742066 696c7465    <7>kobject filte
001622f4: 72206675 6e637469 6f6e2063 61757365    r function cause
00162304: 64207468 65206576 656e7420 746f2064    d the event to d
00162314: 726f7021 0a3c373e 6b6f626a 6563745f    rop!.<7>kobject_
00162324: 75657665 6e745f65 6e760a3c 373e6669    uevent_env.<7>fi
00162334: 6c6c5f6b 6f626a5f 70617468 3a207061    ll_kobj_path: pa
00162344: 7468203d 20272f62 6c6f636b 2f72616d    th = '/block/ram
00162354: 3132270a 3c373e6b 6f626a65 63742072    12'.<7>kobject r
00162364: 616d3133 3a207265 67697374 6572696e    am13: registerin
00162374: 672e2070 6172656e 743a203c 4e554c4c    g. parent: <NULL
00162384: 3e2c2073 65743a20 626c6f63 6b0a3c37    >, set: block.<7
NDSC860: 
00162394: 3e6b6f62 6a656374 20686f6c 64657273    >kobject holders
001623a4: 3a207265 67697374 6572696e 672e2070    : registering. p
001623b4: 6172656e 743a2072 616d3133 2c207365    arent: ram13, se
001623c4: 743a203c 4e554c4c 3e0a3c37 3e6b6f62    t: <NULL>.<7>kob
001623d4: 6a656374 5f756576 656e745f 656e760a    ject_uevent_env.
001623e4: 3c373e6b 6f626a65 63742066 696c7465    <7>kobject filte
001623f4: 72206675 6e637469 6f6e2063 61757365    r function cause
00162404: 64207468 65206576 656e7420 746f2064    d the event to d
00162414: 726f7021 0a3c373e 6b6f626a 65637420    rop!.<7>kobject 
00162424: 736c6176 65733a20 72656769 73746572    slaves: register
00162434: 696e672e 20706172 656e743a 2072616d    ing. parent: ram
00162444: 31332c20 7365743a 203c4e55 4c4c3e0a    13, set: <NULL>.
00162454: 3c373e6b 6f626a65 63745f75 6576656e    <7>kobject_ueven
00162464: 745f656e 760a3c37 3e6b6f62 6a656374    t_env.<7>kobject
00162474: 2066696c 74657220 66756e63 74696f6e     filter function
00162484: 20636175 73656420 74686520 6576656e     caused the even
NDSC860: 
00162494: 7420746f 2064726f 70210a3c 373e6b6f    t to drop!.<7>ko
001624a4: 626a6563 745f7565 76656e74 5f656e76    bject_uevent_env
001624b4: 0a3c373e 66696c6c 5f6b6f62 6a5f7061    .<7>fill_kobj_pa
001624c4: 74683a20 70617468 203d2027 2f626c6f    th: path = '/blo
001624d4: 636b2f72 616d3133 270a3c37 3e6b6f62    ck/ram13'.<7>kob
001624e4: 6a656374 2072616d 31343a20 72656769    ject ram14: regi
001624f4: 73746572 696e672e 20706172 656e743a    stering. parent:
00162504: 203c4e55 4c4c3e2c 20736574 3a20626c     <NULL>, set: bl
00162514: 6f636b0a 3c373e6b 6f626a65 63742068    ock.<7>kobject h
00162524: 6f6c6465 72733a20 72656769 73746572    olders: register
00162534: 696e672e 20706172 656e743a 2072616d    ing. parent: ram
00162544: 31342c20 7365743a 203c4e55 4c4c3e0a    14, set: <NULL>.
00162554: 3c373e6b 6f626a65 63745f75 6576656e    <7>kobject_ueven
00162564: 745f656e 760a3c37 3e6b6f62 6a656374    t_env.<7>kobject
00162574: 2066696c 74657220 66756e63 74696f6e     filter function
00162584: 20636175 73656420 74686520 6576656e     caused the even
NDSC860: 
00162594: 7420746f 2064726f 70210a3c 373e6b6f    t to drop!.<7>ko
001625a4: 626a6563 7420736c 61766573 3a207265    bject slaves: re
001625b4: 67697374 6572696e 672e2070 6172656e    gistering. paren
001625c4: 743a2072 616d3134 2c207365 743a203c    t: ram14, set: <
001625d4: 4e554c4c 3e0a3c37 3e6b6f62 6a656374    NULL>.<7>kobject
001625e4: 5f756576 656e745f 656e760a 3c373e6b    _uevent_env.<7>k
001625f4: 6f626a65 63742066 696c7465 72206675    object filter fu
00162604: 6e637469 6f6e2063 61757365 64207468    nction caused th
00162614: 65206576 656e7420 746f2064 726f7021    e event to drop!
00162624: 0a3c373e 6b6f626a 6563745f 75657665    .<7>kobject_ueve
00162634: 6e745f65 6e760a3c 373e6669 6c6c5f6b    nt_env.<7>fill_k
00162644: 6f626a5f 70617468 3a207061 7468203d    obj_path: path =
00162654: 20272f62 6c6f636b 2f72616d 3134270a     '/block/ram14'.
00162664: 3c373e6b 6f626a65 63742072 616d3135    <7>kobject ram15
00162674: 3a207265 67697374 6572696e 672e2070    : registering. p
00162684: 6172656e 743a203c 4e554c4c 3e2c2073    arent: <NULL>, s
NDSC860: 
00162694: 65743a20 626c6f63 6b0a3c37 3e6b6f62    et: block.<7>kob
001626a4: 6a656374 20686f6c 64657273 3a207265    ject holders: re
001626b4: 67697374 6572696e 672e2070 6172656e    gistering. paren
001626c4: 743a2072 616d3135 2c207365 743a203c    t: ram15, set: <
001626d4: 4e554c4c 3e0a3c37 3e6b6f62 6a656374    NULL>.<7>kobject
001626e4: 5f756576 656e745f 656e760a 3c373e6b    _uevent_env.<7>k
001626f4: 6f626a65 63742066 696c7465 72206675    object filter fu
00162704: 6e637469 6f6e2063 61757365 64207468    nction caused th
00162714: 65206576 656e7420 746f2064 726f7021    e event to drop!
00162724: 0a3c373e 6b6f626a 65637420 736c6176    .<7>kobject slav
00162734: 65733a20 72656769 73746572 696e672e    es: registering.
00162744: 20706172 656e743a 2072616d 31352c20     parent: ram15, 
00162754: 7365743a 203c4e55 4c4c3e0a 3c373e6b    set: <NULL>.<7>k
00162764: 6f626a65 63745f75 6576656e 745f656e    object_uevent_en
00162774: 760a3c37 3e6b6f62 6a656374 2066696c    v.<7>kobject fil
00162784: 74657220 66756e63 74696f6e 20636175    ter function cau
NDSC860: 
00162794: 73656420 74686520 6576656e 7420746f    sed the event to
001627a4: 2064726f 70210a3c 373e6b6f 626a6563     drop!.<7>kobjec
001627b4: 745f7565 76656e74 5f656e76 0a3c373e    t_uevent_env.<7>
001627c4: 66696c6c 5f6b6f62 6a5f7061 74683a20    fill_kobj_path: 
001627d4: 70617468 203d2027 2f626c6f 636b2f72    path = '/block/r
001627e4: 616d3135 270a3c34 3e52414d 4449534b    am15'.<4>RAMDISK
001627f4: 20647269 76657220 696e6974 69616c69     driver initiali
00162804: 7a65643a 20313620 52414d20 6469736b    zed: 16 RAM disk
00162814: 73206f66 20383031 324b2073 697a6520    s of 8012K size 
00162824: 31303234 20626c6f 636b7369 7a650a3c    1024 blocksize.<
00162834: 333e6938 3034322e 633a204e 6f20636f    3>i8042.c: No co
00162844: 6e74726f 6c6c6572 20666f75 6e642e0a    ntroller found..
00162854: 3c373e44 45563a20 72656769 73746572    <7>DEV: register
00162864: 696e6720 64657669 63653a20 4944203d    ing device: ID =
00162874: 20276d69 6365270a 3c373e6b 6f626a65     'mice'.<7>kobje
00162884: 6374206d 6963653a 20726567 69737465    ct mice: registe
NDSC860: 
00162894: 72696e67 2e207061 72656e74 3a20696e    ring. parent: in
001628a4: 7075742c 20736574 3a206465 76696365    put, set: device
001628b4: 730a3c37 3e504d3a 20416464 696e6720    s.<7>PM: Adding 
001628c4: 696e666f 20666f72 204e6f20 4275733a    info for No Bus:
001628d4: 6d696365 0a3c373e 6b6f626a 6563745f    mice.<7>kobject_
001628e4: 75657665 6e745f65 6e760a3c 373e6669    uevent_env.<7>fi
001628f4: 6c6c5f6b 6f626a5f 70617468 3a207061    ll_kobj_path: pa
00162904: 7468203d 20272f63 6c617373 2f696e70    th = '/class/inp
00162914: 75742f6d 69636527 0a3c363e 6d696365    ut/mice'.<6>mice
00162924: 3a205053 2f32206d 6f757365 20646576    : PS/2 mouse dev
00162934: 69636520 636f6d6d 6f6e2066 6f722061    ice common for a
00162944: 6c6c206d 6963650a 3c373e62 75732073    ll mice.<7>bus s
00162954: 6572696f 3a206164 64206472 69766572    erio: add driver
00162964: 2061746b 62640a3c 373e6b6f 626a6563     atkbd.<7>kobjec
00162974: 74206174 6b62643a 20726567 69737465    t atkbd: registe
00162984: 72696e67 2e207061 72656e74 3a203c4e    ring. parent: <N
NDSC860: 
00162994: 554c4c3e 2c207365 743a2064 72697665    ULL>, set: drive
001629a4: 72730a3c 373e6b6f 626a6563 745f7565    rs.<7>kobject_ue
001629b4: 76656e74 5f656e76 0a3c373e 66696c6c    vent_env.<7>fill
001629c4: 5f6b6f62 6a5f7061 74683a20 70617468    _kobj_path: path
001629d4: 203d2027 2f627573 2f736572 696f2f64     = '/bus/serio/d
001629e4: 72697665 72732f61 746b6264 270a3c37    rivers/atkbd'.<7
001629f4: 3e6b6f62 6a656374 20647269 76657273    >kobject drivers
00162a04: 3a207265 67697374 6572696e 672e2070    : registering. p
00162a14: 6172656e 743a2061 746b6264 2c207365    arent: atkbd, se
00162a24: 743a203c 4e554c4c 3e0a3c37 3e6b6f62    t: <NULL>.<7>kob
00162a34: 6a656374 5f756576 656e745f 656e760a    ject_uevent_env.
00162a44: 3c373e6b 6f626a65 63742066 696c7465    <7>kobject filte
00162a54: 72206675 6e637469 6f6e2063 61757365    r function cause
00162a64: 64207468 65206576 656e7420 746f2064    d the event to d
00162a74: 726f7021 0a3c373e 62757320 73657269    rop!.<7>bus seri
00162a84: 6f3a2061 64642064 72697665 72207073    o: add driver ps
NDSC860: 
00162a94: 6d6f7573 650a3c37 3e6b6f62 6a656374    mouse.<7>kobject
00162aa4: 2070736d 6f757365 3a207265 67697374     psmouse: regist
00162ab4: 6572696e 672e2070 6172656e 743a203c    ering. parent: <
00162ac4: 4e554c4c 3e2c2073 65743a20 64726976    NULL>, set: driv
00162ad4: 6572730a 3c373e6b 6f626a65 63745f75    ers.<7>kobject_u
00162ae4: 6576656e 745f656e 760a3c37 3e66696c    event_env.<7>fil
00162af4: 6c5f6b6f 626a5f70 6174683a 20706174    l_kobj_path: pat
00162b04: 68203d20 272f6275 732f7365 72696f2f    h = '/bus/serio/
00162b14: 64726976 6572732f 70736d6f 75736527    drivers/psmouse'
00162b24: 0a3c373e 6b6f626a 65637420 64726976    .<7>kobject driv
00162b34: 6572733a 20726567 69737465 72696e67    ers: registering
00162b44: 2e207061 72656e74 3a207073 6d6f7573    . parent: psmous
00162b54: 652c2073 65743a20 3c4e554c 4c3e0a3c    e, set: <NULL>.<
00162b64: 373e6b6f 626a6563 745f7565 76656e74    7>kobject_uevent
00162b74: 5f656e76 0a3c373e 6b6f626a 65637420    _env.<7>kobject 
00162b84: 66696c74 65722066 756e6374 696f6e20    filter function 
NDSC860: 
00162b94: 63617573 65642074 68652065 76656e74    caused the event
00162ba4: 20746f20 64726f70 210a3c37 3e647269     to drop!.<7>dri
00162bb4: 7665725f 70726f62 655f646f 6e653a20    ver_probe_done: 
00162bc4: 70726f62 655f636f 756e7420 3d20300a    probe_count = 0.
00162bd4: 3c353e52 414d4449 534b3a20 436f6d70    <5>RAMDISK: Comp
00162be4: 72657373 65642069 6d616765 20666f75    ressed image fou
00162bf4: 6e642061 7420626c 6f636b20 300a3c34    nd at block 0.<4
00162c04: 3e564653 3a204d6f 756e7465 6420726f    >VFS: Mounted ro
00162c14: 6f742028 65787432 2066696c 65737973    ot (ext2 filesys
00162c24: 74656d29 2e0a3c34 3e467265 65696e67    tem)..<4>Freeing
00162c34: 20756e75 73656420 6b65726e 656c206d     unused kernel m
00162c44: 656d6f72 793a2038 306b2069 6e69740a    emory: 80k init.
00162c54: 3c373e44 45563a20 72656769 73746572    <7>DEV: register
00162c64: 696e6720 64657669 63653a20 4944203d    ing device: ID =
00162c74: 20277663 7331270a 3c373e6b 6f626a65     'vcs1'.<7>kobje
00162c84: 63742076 6373313a 20726567 69737465    ct vcs1: registe
NDSC860: 
00162c94: 72696e67 2e207061 72656e74 3a207663    ring. parent: vc
00162ca4: 2c207365 743a2064 65766963 65730a3c    , set: devices.<
00162cb4: 373e504d 3a204164 64696e67 20696e66    7>PM: Adding inf
00162cc4: 6f20666f 72204e6f 20427573 3a766373    o for No Bus:vcs
00162cd4: 310a3c37 3e6b6f62 6a656374 5f756576    1.<7>kobject_uev
00162ce4: 656e745f 656e760a 3c373e66 696c6c5f    ent_env.<7>fill_
00162cf4: 6b6f626a 5f706174 683a2070 61746820    kobj_path: path 
00162d04: 3d20272f 636c6173 732f7663 2f766373    = '/class/vc/vcs
00162d14: 31270a3c 373e4445 563a2072 65676973    1'.<7>DEV: regis
00162d24: 74657269 6e672064 65766963 653a2049    tering device: I
00162d34: 44203d20 27766373 6131270a 3c373e6b    D = 'vcsa1'.<7>k
00162d44: 6f626a65 63742076 63736131 3a207265    object vcsa1: re
00162d54: 67697374 6572696e 672e2070 6172656e    gistering. paren
00162d64: 743a2076 632c2073 65743a20 64657669    t: vc, set: devi
00162d74: 6365730a 3c373e50 4d3a2041 6464696e    ces.<7>PM: Addin
00162d84: 6720696e 666f2066 6f72204e 6f204275    g info for No Bu
NDSC860: 
00162d94: 733a7663 7361310a 3c373e6b 6f626a65    s:vcsa1.<7>kobje
00162da4: 63745f75 6576656e 745f656e 760a3c37    ct_uevent_env.<7
00162db4: 3e66696c 6c5f6b6f 626a5f70 6174683a    >fill_kobj_path:
00162dc4: 20706174 68203d20 272f636c 6173732f     path = '/class/
00162dd4: 76632f76 63736131 270a3c37 3e444556    vc/vcsa1'.<7>DEV
00162de4: 3a20556e 72656769 73746572 696e6720    : Unregistering 
00162df4: 64657669 63652e20 4944203d 20277663    device. ID = 'vc
00162e04: 7331270a 3c373e50 4d3a2052 656d6f76    s1'.<7>PM: Remov
00162e14: 696e6720 696e666f 20666f72 204e6f20    ing info for No 
00162e24: 4275733a 76637331 0a3c373e 6b6f626a    Bus:vcs1.<7>kobj
00162e34: 6563745f 75657665 6e745f65 6e760a3c    ect_uevent_env.<
00162e44: 373e6669 6c6c5f6b 6f626a5f 70617468    7>fill_kobj_path
00162e54: 3a207061 7468203d 20272f63 6c617373    : path = '/class
00162e64: 2f76632f 76637331 270a3c37 3e737973    /vc/vcs1'.<7>sys
00162e74: 66732076 6373313a 2072656d 6f76696e    fs vcs1: removin
00162e84: 67206469 720a3c37 3e6b6f62 6a656374    g dir.<7>kobject
NDSC860: 

^ permalink raw reply

* Re: 2.6.23-mm1 - build failure with advansys
From: Andrew Morton @ 2007-10-13  6:52 UTC (permalink / raw)
  To: Kamalesh Babulal; +Cc: Matthew Wilcox, linuxppc-dev, linux-kernel
In-Reply-To: <47104D26.7050206@linux.vnet.ibm.com>

On Sat, 13 Oct 2007 10:14:22 +0530 Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> wrote:

> Hi Andrew,
> 
> Another build failure with following message
> 
>   CC      drivers/scsi/advansys.o
> drivers/scsi/advansys.c:71:2: warning: #warning this driver is still not properly converted to the DMA API
> drivers/scsi/advansys.c: In function ‘AdvBuildCarrierFreelist’:
> drivers/scsi/advansys.c:6486: error: implicit declaration of function ‘virt_to_bus’
> drivers/scsi/advansys.c: In function ‘AdvInitAsc3550Driver’:
> drivers/scsi/advansys.c:6974: error: implicit declaration of function ‘bus_to_virt’
> drivers/scsi/advansys.c:6974: warning: cast to pointer from integer of different size
> drivers/scsi/advansys.c:6994: warning: cast to pointer from integer of different size
> drivers/scsi/advansys.c: In function ‘AdvInitAsc38C0800Driver’:
> drivers/scsi/advansys.c:7450: warning: cast to pointer from integer of different size
> drivers/scsi/advansys.c:7471: warning: cast to pointer from integer of different size
> drivers/scsi/advansys.c: In function ‘AdvInitAsc38C1600Driver’:
> drivers/scsi/advansys.c:7939: warning: cast to pointer from integer of different size
> drivers/scsi/advansys.c:7963: warning: cast to pointer from integer of different size
> drivers/scsi/advansys.c: In function ‘adv_isr_callback’:
> drivers/scsi/advansys.c:8175: warning: cast to pointer from integer of different size
> drivers/scsi/advansys.c: In function ‘AdvISR’:
> drivers/scsi/advansys.c:8392: warning: cast to pointer from integer of different size
> drivers/scsi/advansys.c:8412: warning: cast to pointer from integer of different size
> drivers/scsi/advansys.c: In function ‘AdvExeScsiQueue’:
> drivers/scsi/advansys.c:10845: warning: cast to pointer from integer of different size
> make[2]: *** [drivers/scsi/advansys.o] Error 1
> make[1]: *** [drivers/scsi] Error 2
> make: *** [drivers] Error 2
> 
> 
> The functions virt_to_bus and bus_to_virt are begin defined between ifdef CONFIG_PPC32
> but when i compile allyesconfig with ppc64 box,i get this error. This patch removes the
> ifdef.

Please copy the powerpc developers on powerpc patches.

> Signed-off-by : Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
> ---
> --- linux-2.6.23/include/asm-powerpc/io.h       2007-10-12 15:46:14.000000000 +0530
> +++ linux-2.6.23/include/asm-powerpc/~io.h      2007-10-12 15:46:00.000000000 +0530
> @@ -690,7 +690,6 @@ static inline void * phys_to_virt(unsign
>   * drivers (shame shame shame) that use bus_to_virt() and haven't been
>   * fixed yet so I need to define it here.
>   */
> -#ifdef CONFIG_PPC32
>  
>  static inline unsigned long virt_to_bus(volatile void * address)
>  {
> @@ -708,7 +707,6 @@ static inline void * bus_to_virt(unsigne
>  
>  #define page_to_bus(page)      (page_to_phys(page) + PCI_DRAM_OFFSET)
>  
> -#endif /* CONFIG_PPC32 */
>  
>  /* access ports */
>  #define setbits32(_addr, _v) out_be32((_addr), in_be32(_addr) |  (_v))
> 

especially ones like that ;)

Matthew has proposed that advansys should be dependent upon
CONFIG_VIRT_TO_BUS.  I don't think anyone's done a patch yet though.

(Actually, the code which you've altered there should probably be using
CONFIG_VIRT_TO_BUS, too).

^ permalink raw reply

* Re: USB Host Controller MPC875 Linux 2.6
From: Vitaly Bordug @ 2007-10-13 11:18 UTC (permalink / raw)
  To: Henrik Larson; +Cc: linuxppc-embedded
In-Reply-To: <Pine.LNX.4.62.0704291844350.8880@henka.dyndns.org>

[-- Attachment #1: Type: text/plain, Size: 792 bytes --]

Hello Henrik,

On Sun, 29 Apr 2007 19:19:09 +0200 (CEST)
Henrik Larson wrote:

> 
> Hi,
> 
> I have a board with a MPC875 processor with a Linux 2.6.16 kernel and 
> looking for USB support.
> 
> Previous, for the 2.4 kernel, I've used used Brad Parker's 
> m8xxhci driver (with success).
> 
> Does anyone know if there is a Linux 2.6.x USB Host Controller driver
> for MPC875 (or MPC8xx) somewhere ?
> 
Not that I am aware of. Even on 2.4, Brad's driver was not apparent to get to work.
So moving USB host forward never seemed like a worthwhile idea so far.

> 
> Thanks.
> 
> /Henrik
> 
> 
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: I2C support for 8541
From: Vitaly Bordug @ 2007-10-13 13:52 UTC (permalink / raw)
  To: Charles Krinke; +Cc: Randy Brown, Chris Carlson, Kevin Smith, linuxppc-embedded
In-Reply-To: <9F3F0A752CAEBE4FA7E906CC2FBFF57C06A1F9@MERCURY.inside.istor.com>

[-- Attachment #1: Type: text/plain, Size: 938 bytes --]

Hello Charles,

On Mon, 30 Apr 2007 09:25:28 -0700
Charles Krinke wrote:

> Assuming I have the external IRQ's understood, the next issue is the
> hardware clock on our board with the linux-2.6.17.11 kernel. We are
> using a "DS1338U", which is an I2C RTC.
> 
> I am trying to identify the relevant source for the 8541/8555 I2C
> interface in the source base which reads/writes I2MOD, I2ADD, II2BRG,
> I2COM, I2CER & I2CMR.
> 
> I can find a few references to MPC85xx_CPM_I2C in
> ../syslib/mpc85xx_devices.c, but nothing close in drivers/i2c/...
> 
> Can someone help me understand the completeness of the I2C source in the
> 2.6.17.11 kernel, please.
> 

i2c-mpc.c is prolly responsible to care of 8xxx i2c stuff...

HTH
> Charles Krinke
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: [PATCH] cpm: Fix a couple minor issues in cpm_common.c.
From: Vitaly Bordug @ 2007-10-13 13:55 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev
In-Reply-To: <20071012201910.GA8988@loki.buserror.net>

Hello Scott,

On Fri, 12 Oct 2007 15:19:11 -0500
Scott Wood wrote:

> A debugging printk is removed, and a comment is fixed to match
> the code.
> 
> Signed-off-by: Scott Wood <scottwood@freescale.com>
Acked-by: Vitaly Bordug <vbordug@kernel.crashing.com>


-- 
Sincerely, Vitaly

^ permalink raw reply

* [PATCH 0/2] Add support for Apple aluminum USB keyboards
From: Michel Dänzer @ 2007-10-13 14:37 UTC (permalink / raw)
  To: Jiri Kosina
  Cc: linux-input, linuxppc-dev, mactel-linux-devel, linux-usb-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 697 bytes --]

The following series of two patches adds support for Apple aluminum USB
keyboards to the hid and usbhid modules. The first patch contains no functional
change but just renames code identifiers, the second patch adds the actual
support by reusing and extending the existing quirks for Apple laptop USB
keyboards.

There's some things I'm not too sure about and would appreciate suggestions
for, e.g.

* The keycodes generated for the Exposé and Dashboard keys.
* Whether F5 and F6 should be subject to the pb_fn_mode option even though they
  don't have any special engravings.
* I only have an ISO keyboard, so the device IDs for the ANSI and JIS variants
  are guessed from the previous models.

^ permalink raw reply

* [PATCH 1/2] hid: Rename some code identifiers from PowerBook specific to Apple generic.
From: Michel Dänzer @ 2007-10-13 14:37 UTC (permalink / raw)
  To: Jiri Kosina
  Cc: linux-input, linuxppc-dev, mactel-linux-devel, linux-usb-devel
In-Reply-To: <1192286246-11489-1-git-send-email-michel@tungstengraphics.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 12155 bytes --]

Preserve identifiers exposed in build and run time configuration though in
order not to break existing configurations.

This is in preparation for adding support for Apple aluminum USB keyboards.

Signed-off-by: Michel Dänzer <michel@tungstengraphics.com>
---
 drivers/hid/hid-input.c         |   75 ++++++++++++++++++++-------------------
 drivers/hid/usbhid/hid-quirks.c |   26 +++++++-------
 include/linux/hid.h             |    8 ++--
 3 files changed, 55 insertions(+), 54 deletions(-)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index 8edbd30..bcc61bb 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -34,10 +34,10 @@
 #include <linux/hid.h>
 #include <linux/hid-debug.h>
 
-static int hid_pb_fnmode = 1;
-module_param_named(pb_fnmode, hid_pb_fnmode, int, 0644);
+static int hid_apple_fnmode = 1;
+module_param_named(pb_fnmode, hid_apple_fnmode, int, 0644);
 MODULE_PARM_DESC(pb_fnmode,
-		"Mode of fn key on PowerBooks (0 = disabled, 1 = fkeyslast, 2 = fkeysfirst)");
+		"Mode of fn key on Apple keyboards (0 = disabled, 1 = fkeyslast, 2 = fkeysfirst)");
 
 #define unk	KEY_UNKNOWN
 
@@ -94,20 +94,20 @@ struct hidinput_key_translation {
 	u8 flags;
 };
 
-#define POWERBOOK_FLAG_FKEY 0x01
+#define APPLE_FLAG_FKEY 0x01
 
 static struct hidinput_key_translation powerbook_fn_keys[] = {
 	{ KEY_BACKSPACE, KEY_DELETE },
-	{ KEY_F1,       KEY_BRIGHTNESSDOWN,     POWERBOOK_FLAG_FKEY },
-	{ KEY_F2,       KEY_BRIGHTNESSUP,       POWERBOOK_FLAG_FKEY },
-	{ KEY_F3,       KEY_MUTE,               POWERBOOK_FLAG_FKEY },
-	{ KEY_F4,       KEY_VOLUMEDOWN,         POWERBOOK_FLAG_FKEY },
-	{ KEY_F5,       KEY_VOLUMEUP,           POWERBOOK_FLAG_FKEY },
-	{ KEY_F6,       KEY_NUMLOCK,            POWERBOOK_FLAG_FKEY },
-	{ KEY_F7,       KEY_SWITCHVIDEOMODE,    POWERBOOK_FLAG_FKEY },
-	{ KEY_F8,       KEY_KBDILLUMTOGGLE,     POWERBOOK_FLAG_FKEY },
-	{ KEY_F9,       KEY_KBDILLUMDOWN,       POWERBOOK_FLAG_FKEY },
-	{ KEY_F10,      KEY_KBDILLUMUP,         POWERBOOK_FLAG_FKEY },
+	{ KEY_F1,       KEY_BRIGHTNESSDOWN,     APPLE_FLAG_FKEY },
+	{ KEY_F2,       KEY_BRIGHTNESSUP,       APPLE_FLAG_FKEY },
+	{ KEY_F3,       KEY_MUTE,               APPLE_FLAG_FKEY },
+	{ KEY_F4,       KEY_VOLUMEDOWN,         APPLE_FLAG_FKEY },
+	{ KEY_F5,       KEY_VOLUMEUP,           APPLE_FLAG_FKEY },
+	{ KEY_F6,       KEY_NUMLOCK,            APPLE_FLAG_FKEY },
+	{ KEY_F7,       KEY_SWITCHVIDEOMODE,    APPLE_FLAG_FKEY },
+	{ KEY_F8,       KEY_KBDILLUMTOGGLE,     APPLE_FLAG_FKEY },
+	{ KEY_F9,       KEY_KBDILLUMDOWN,       APPLE_FLAG_FKEY },
+	{ KEY_F10,      KEY_KBDILLUMUP,         APPLE_FLAG_FKEY },
 	{ KEY_UP,       KEY_PAGEUP },
 	{ KEY_DOWN,     KEY_PAGEDOWN },
 	{ KEY_LEFT,     KEY_HOME },
@@ -138,7 +138,7 @@ static struct hidinput_key_translation powerbook_numlock_keys[] = {
 	{ }
 };
 
-static struct hidinput_key_translation powerbook_iso_keyboard[] = {
+static struct hidinput_key_translation apple_iso_keyboard[] = {
 	{ KEY_GRAVE,    KEY_102ND },
 	{ KEY_102ND,    KEY_GRAVE },
 	{ }
@@ -156,39 +156,39 @@ static struct hidinput_key_translation *find_translation(struct hidinput_key_tra
 	return NULL;
 }
 
-static int hidinput_pb_event(struct hid_device *hid, struct input_dev *input,
+static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
 		struct hid_usage *usage, __s32 value)
 {
 	struct hidinput_key_translation *trans;
 
 	if (usage->code == KEY_FN) {
-		if (value) hid->quirks |=  HID_QUIRK_POWERBOOK_FN_ON;
-		else       hid->quirks &= ~HID_QUIRK_POWERBOOK_FN_ON;
+		if (value) hid->quirks |=  HID_QUIRK_APPLE_FN_ON;
+		else       hid->quirks &= ~HID_QUIRK_APPLE_FN_ON;
 
 		input_event(input, usage->type, usage->code, value);
 
 		return 1;
 	}
 
-	if (hid_pb_fnmode) {
+	if (hid_apple_fnmode) {
 		int do_translate;
 
 		trans = find_translation(powerbook_fn_keys, usage->code);
 		if (trans) {
-			if (test_bit(usage->code, hid->pb_pressed_fn))
+			if (test_bit(usage->code, hid->apple_pressed_fn))
 				do_translate = 1;
-			else if (trans->flags & POWERBOOK_FLAG_FKEY)
+			else if (trans->flags & APPLE_FLAG_FKEY)
 				do_translate =
-					(hid_pb_fnmode == 2 &&  (hid->quirks & HID_QUIRK_POWERBOOK_FN_ON)) ||
-					(hid_pb_fnmode == 1 && !(hid->quirks & HID_QUIRK_POWERBOOK_FN_ON));
+					(hid_apple_fnmode == 2 &&  (hid->quirks & HID_QUIRK_APPLE_FN_ON)) ||
+					(hid_apple_fnmode == 1 && !(hid->quirks & HID_QUIRK_APPLE_FN_ON));
 			else
-				do_translate = (hid->quirks & HID_QUIRK_POWERBOOK_FN_ON);
+				do_translate = (hid->quirks & HID_QUIRK_APPLE_FN_ON);
 
 			if (do_translate) {
 				if (value)
-					set_bit(usage->code, hid->pb_pressed_fn);
+					set_bit(usage->code, hid->apple_pressed_fn);
 				else
-					clear_bit(usage->code, hid->pb_pressed_fn);
+					clear_bit(usage->code, hid->apple_pressed_fn);
 
 				input_event(input, usage->type, trans->to, value);
 
@@ -213,8 +213,8 @@ static int hidinput_pb_event(struct hid_device *hid, struct input_dev *input,
 		}
 	}
 
-	if (hid->quirks & HID_QUIRK_POWERBOOK_ISO_KEYBOARD) {
-		trans = find_translation(powerbook_iso_keyboard, usage->code);
+	if (hid->quirks & HID_QUIRK_APPLE_ISO_KEYBOARD) {
+		trans = find_translation(apple_iso_keyboard, usage->code);
 		if (trans) {
 			input_event(input, usage->type, trans->to, value);
 			return 1;
@@ -224,7 +224,7 @@ static int hidinput_pb_event(struct hid_device *hid, struct input_dev *input,
 	return 0;
 }
 
-static void hidinput_pb_setup(struct input_dev *input)
+static void hidinput_apple_setup(struct input_dev *input)
 {
 	struct hidinput_key_translation *trans;
 
@@ -237,18 +237,19 @@ static void hidinput_pb_setup(struct input_dev *input)
 	for (trans = powerbook_numlock_keys; trans->from; trans++)
 		set_bit(trans->to, input->keybit);
 
-	for (trans = powerbook_iso_keyboard; trans->from; trans++)
+	for (trans = apple_iso_keyboard; trans->from; trans++)
 		set_bit(trans->to, input->keybit);
 
 }
 #else
-static inline int hidinput_pb_event(struct hid_device *hid, struct input_dev *input,
-		struct hid_usage *usage, __s32 value)
+static inline int hidinput_apple_event(struct hid_device *hid,
+				       struct input_dev *input,
+				       struct hid_usage *usage, __s32 value)
 {
 	return 0;
 }
 
-static inline void hidinput_pb_setup(struct input_dev *input)
+static inline void hidinput_apple_setup(struct input_dev *input)
 {
 }
 #endif
@@ -742,14 +743,14 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
 			}
 			break;
 
-		case HID_UP_CUSTOM: /* Reported on Logitech and Powerbook USB keyboards */
+		case HID_UP_CUSTOM: /* Reported on Logitech and Apple USB keyboards */
 
 			set_bit(EV_REP, input->evbit);
 			switch(usage->hid & HID_USAGE) {
 				case 0x003:
-					/* The fn key on Apple PowerBooks */
+					/* The fn key on Apple USB keyboards */
 					map_key_clear(KEY_FN);
-					hidinput_pb_setup(input);
+					hidinput_apple_setup(input);
 					break;
 
 				default:    goto ignore;
@@ -929,7 +930,7 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct
 		return;
 	}
 
-	if ((hid->quirks & HID_QUIRK_POWERBOOK_HAS_FN) && hidinput_pb_event(hid, input, usage, value))
+	if ((hid->quirks & HID_QUIRK_APPLE_HAS_FN) && hidinput_apple_event(hid, input, usage, value))
 		return;
 
 	if (usage->hat_min < usage->hat_max || usage->hat_dir) {
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 6b21a21..5e4ad65 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -516,19 +516,19 @@ static const struct hid_blacklist {
 
 	{ USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT },
 
-	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
-	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
-	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
-	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},
-	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
-	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
-	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},
-	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
-	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
-	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_POWERBOOK_ISO_KEYBOARD},
-	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
-	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
-	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_POWERBOOK_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
+	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
+	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
+	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
+	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD},
+	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
+	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
+	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD},
+	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER3_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
+	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
+	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD},
+	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
+	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
+	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
 
 	{ USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658, HID_QUIRK_RESET_LEDS },
 	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD, HID_QUIRK_RESET_LEDS },
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 898103b..e03f210 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -263,10 +263,10 @@ struct hid_item {
 #define HID_QUIRK_2WHEEL_MOUSE_HACK_5		0x00000100
 #define HID_QUIRK_2WHEEL_MOUSE_HACK_ON		0x00000200
 #define HID_QUIRK_MIGHTYMOUSE			0x00000400
-#define HID_QUIRK_POWERBOOK_HAS_FN		0x00000800
-#define HID_QUIRK_POWERBOOK_FN_ON		0x00001000
+#define HID_QUIRK_APPLE_HAS_FN			0x00000800
+#define HID_QUIRK_APPLE_FN_ON			0x00001000
 #define HID_QUIRK_INVERT_HWHEEL			0x00002000
-#define HID_QUIRK_POWERBOOK_ISO_KEYBOARD        0x00004000
+#define HID_QUIRK_APPLE_ISO_KEYBOARD		0x00004000
 #define HID_QUIRK_BAD_RELATIVE_KEYS		0x00008000
 #define HID_QUIRK_SKIP_OUTPUT_REPORTS		0x00010000
 #define HID_QUIRK_IGNORE_MOUSE			0x00020000
@@ -459,7 +459,7 @@ struct hid_device {							/* device report descriptor */
 				  struct hid_usage *, __s32);
 	void (*hiddev_report_event) (struct hid_device *, struct hid_report *);
 #ifdef CONFIG_USB_HIDINPUT_POWERBOOK
-	unsigned long pb_pressed_fn[NBITS(KEY_MAX)];
+	unsigned long apple_pressed_fn[NBITS(KEY_MAX)];
 	unsigned long pb_pressed_numlock[NBITS(KEY_MAX)];
 #endif
 };
-- 
1.5.3.4

^ permalink raw reply related

* [PATCH 2/2] hid: Add support for Apple aluminum USB keyboards.
From: Michel Dänzer @ 2007-10-13 14:37 UTC (permalink / raw)
  To: Jiri Kosina
  Cc: linux-input, linuxppc-dev, mactel-linux-devel, linux-usb-devel
In-Reply-To: <1192286246-11489-2-git-send-email-michel@tungstengraphics.com>

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 4566 bytes --]

Reuse the existing quirks for Apple laptop USB keyboards.

Signed-off-by: Michel Dänzer <michel@tungstengraphics.com>
---
 drivers/hid/hid-input.c         |   24 +++++++++++++++++++++++-
 drivers/hid/usbhid/Kconfig      |    5 +++--
 drivers/hid/usbhid/hid-quirks.c |    6 ++++++
 3 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
index bcc61bb..cae98c2 100644
--- a/drivers/hid/hid-input.c
+++ b/drivers/hid/hid-input.c
@@ -96,6 +96,22 @@ struct hidinput_key_translation {
 
 #define APPLE_FLAG_FKEY 0x01
 
+static struct hidinput_key_translation apple_fn_keys[] = {
+	{ KEY_F1,       KEY_BRIGHTNESSDOWN,     APPLE_FLAG_FKEY },
+	{ KEY_F2,       KEY_BRIGHTNESSUP,       APPLE_FLAG_FKEY },
+	{ KEY_F3,       KEY_CYCLEWINDOWS,       APPLE_FLAG_FKEY }, /* Exposé */
+	{ KEY_F4,       KEY_FN_F4,              APPLE_FLAG_FKEY }, /* Dashboard */
+	{ KEY_F5,       KEY_FN_F5 },
+	{ KEY_F6,       KEY_FN_F6 },
+	{ KEY_F7,       KEY_BACK,               APPLE_FLAG_FKEY },
+	{ KEY_F8,       KEY_PLAYPAUSE,          APPLE_FLAG_FKEY },
+	{ KEY_F9,       KEY_FORWARD,            APPLE_FLAG_FKEY },
+	{ KEY_F10,      KEY_MUTE,               APPLE_FLAG_FKEY },
+	{ KEY_F11,      KEY_VOLUMEDOWN,         APPLE_FLAG_FKEY },
+	{ KEY_F12,      KEY_VOLUMEUP,           APPLE_FLAG_FKEY },
+	{ }
+};
+
 static struct hidinput_key_translation powerbook_fn_keys[] = {
 	{ KEY_BACKSPACE, KEY_DELETE },
 	{ KEY_F1,       KEY_BRIGHTNESSDOWN,     APPLE_FLAG_FKEY },
@@ -173,7 +189,10 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
 	if (hid_apple_fnmode) {
 		int do_translate;
 
-		trans = find_translation(powerbook_fn_keys, usage->code);
+		trans = find_translation((hid->product < 0x220 ||
+					  hid->product >= 0x300) ?
+					 powerbook_fn_keys : apple_fn_keys,
+					 usage->code);
 		if (trans) {
 			if (test_bit(usage->code, hid->apple_pressed_fn))
 				do_translate = 1;
@@ -231,6 +250,9 @@ static void hidinput_apple_setup(struct input_dev *input)
 	set_bit(KEY_NUMLOCK, input->keybit);
 
 	/* Enable all needed keys */
+	for (trans = apple_fn_keys; trans->from; trans++)
+		set_bit(trans->to, input->keybit);
+
 	for (trans = powerbook_fn_keys; trans->from; trans++)
 		set_bit(trans->to, input->keybit);
 
diff --git a/drivers/hid/usbhid/Kconfig b/drivers/hid/usbhid/Kconfig
index 1b4b572..74d7ff7 100644
--- a/drivers/hid/usbhid/Kconfig
+++ b/drivers/hid/usbhid/Kconfig
@@ -25,12 +25,13 @@ comment "Input core support is needed for USB HID input layer or HIDBP support"
 	depends on USB_HID && INPUT=n
 
 config USB_HIDINPUT_POWERBOOK
-	bool "Enable support for iBook/PowerBook/MacBook/MacBookPro special keys"
+	bool "Enable support for Apple laptop/aluminum USB special keys"
 	default n
 	depends on USB_HID
 	help
 	  Say Y here if you want support for the special keys (Fn, Numlock) on
-	  Apple iBooks, PowerBooks, MacBooks and MacBook Pros.
+	  Apple iBooks, PowerBooks, MacBooks, MacBook Pros and aluminum USB
+	  keyboards.
 
 	  If unsure, say N.
 
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 5e4ad65..8a469fd 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -59,6 +59,9 @@
 #define USB_DEVICE_ID_APPLE_GEYSER4_ANSI	0x021a
 #define USB_DEVICE_ID_APPLE_GEYSER4_ISO	0x021b
 #define USB_DEVICE_ID_APPLE_GEYSER4_JIS	0x021c
+#define USB_DEVICE_ID_APPLE_ALU_ANSI	0x0220
+#define USB_DEVICE_ID_APPLE_ALU_ISO	0x0221
+#define USB_DEVICE_ID_APPLE_ALU_JIS	0x0222
 #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY	0x030a
 #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY	0x030b
 
@@ -527,6 +530,9 @@ static const struct hid_blacklist {
 	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ANSI, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
 	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE | HID_QUIRK_APPLE_ISO_KEYBOARD},
 	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_JIS, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
+	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI, HID_QUIRK_APPLE_HAS_FN },
+	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_APPLE_ISO_KEYBOARD },
+	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS, HID_QUIRK_APPLE_HAS_FN },
 	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
 	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY, HID_QUIRK_APPLE_HAS_FN | HID_QUIRK_IGNORE_MOUSE },
 
-- 
1.5.3.4

^ permalink raw reply related

* [PATCH] missing includes in arch/powerpc/platforms/52xx/lite5200.c
From: Al Viro @ 2007-10-13 18:40 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linuxppc-dev, linux-kernel

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c
index 0caa3d9..774f249 100644
--- a/arch/powerpc/platforms/52xx/lite5200.c
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -18,6 +18,8 @@
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/of.h>
+#include <linux/root_dev.h>
+#include <linux/initrd.h>
 #include <asm/time.h>
 #include <asm/io.h>
 #include <asm/machdep.h>

^ permalink raw reply related

* Re: [PATCH] missing includes in arch/powerpc/platforms/52xx/lite5200.c
From: Grant Likely @ 2007-10-13 20:35 UTC (permalink / raw)
  To: Al Viro; +Cc: linuxppc-dev, Linus Torvalds, linux-kernel
In-Reply-To: <20071013184008.GL8181@ftp.linux.org.uk>

On 10/13/07, Al Viro <viro@ftp.linux.org.uk> wrote:
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Nak, this patch should be used to fix it instead.  A change to
lite5200 got dropped during merging.

http://patchwork.ozlabs.org/linuxppc/patch?id=14077

Cheers,
g.

> ---
> diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c
> index 0caa3d9..774f249 100644
> --- a/arch/powerpc/platforms/52xx/lite5200.c
> +++ b/arch/powerpc/platforms/52xx/lite5200.c
> @@ -18,6 +18,8 @@
>  #include <linux/init.h>
>  #include <linux/pci.h>
>  #include <linux/of.h>
> +#include <linux/root_dev.h>
> +#include <linux/initrd.h>
>  #include <asm/time.h>
>  #include <asm/io.h>
>  #include <asm/machdep.h>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
>


-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195

^ permalink raw reply

* Re: [PATCH] missing includes in arch/powerpc/platforms/52xx/lite5200.c
From: Al Viro @ 2007-10-13 20:47 UTC (permalink / raw)
  To: Grant Likely; +Cc: linuxppc-dev, Linus Torvalds, linux-kernel
In-Reply-To: <fa686aa40710131335y710cf6edy59a46d365b1d6d67@mail.gmail.com>

On Sat, Oct 13, 2007 at 02:35:26PM -0600, Grant Likely wrote:
> On 10/13/07, Al Viro <viro@ftp.linux.org.uk> wrote:
> > Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> 
> Nak, this patch should be used to fix it instead.  A change to
> lite5200 got dropped during merging.
> 
> http://patchwork.ozlabs.org/linuxppc/patch?id=14077

Fine by me.

^ permalink raw reply

* [PATCH] [POWERPC] i2c: adds support for i2c bus on 8xx
From: Jochen Friedrich @ 2007-10-13 21:41 UTC (permalink / raw)
  To: linuxppc-embedded@ozlabs.org; +Cc: Carsten Juttner

[-- Attachment #1: Type: text/plain, Size: 1288 bytes --]

Using the port of 2.4 code from Vitaly Bordug <vitb@kernel.crashing.org>
and the actual algorithm used by the i2c driver of the DBox code on
cvs.tuxboc.org from Tmbinc, Gillem (htoa@gmx.net). Renamed
i2c-algo-8xx.c to i2c-algo-cpm.c and i2c-rpx.c to i2c-8xx-of.c. Added
original i2c-rpx.c as i2c-8xx.c for pre-OF (arch ppc) devices.

Signed-off-by: Jochen Friedrich <jochen@scram.de>
---
This can be pulled from git://git.bocc.de/dbox2.git i2c

 arch/powerpc/platforms/8xx/mpc885ads_setup.c |    6 +
 arch/powerpc/sysdev/fsl_soc.c                |   15 +
 drivers/i2c/algos/Kconfig                    |   12 +
 drivers/i2c/algos/Makefile                   |    1 +
 drivers/i2c/algos/i2c-algo-cpm.c             |  562 ++++++++++++++++++++++++++
 drivers/i2c/busses/Kconfig                   |   16 +
 drivers/i2c/busses/Makefile                  |    2 +
 drivers/i2c/busses/i2c-8xx-of.c              |  170 ++++++++
 drivers/i2c/busses/i2c-8xx.c                 |  105 +++++
 include/linux/i2c-algo-cpm.h                 |   34 ++
 10 files changed, 923 insertions(+), 0 deletions(-)
 create mode 100644 drivers/i2c/algos/i2c-algo-cpm.c
 create mode 100644 drivers/i2c/busses/i2c-8xx-of.c
 create mode 100644 drivers/i2c/busses/i2c-8xx.c
 create mode 100644 include/linux/i2c-algo-cpm.h

[-- Attachment #2: b654609590d9aa07d46749783b2cf01eba5f422b.diff --]
[-- Type: text/x-patch, Size: 26775 bytes --]

diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
index 2cf1b6a..ecc81ba 100644
--- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c
+++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c
@@ -175,6 +175,12 @@ static void __init init_ioports(void)
 
 	/* Set FEC1 and FEC2 to MII mode */
 	clrbits32(&mpc8xx_immr->im_cpm.cp_cptr, 0x00000180);
+
+#ifdef CONFIG_I2C_8XX_OF
+	setbits32(&mpc8xx_immr->im_cpm.cp_pbpar, 0x00000030);
+	setbits32(&mpc8xx_immr->im_cpm.cp_pbdir, 0x00000030);
+	setbits16(&mpc8xx_immr->im_cpm.cp_pbodr, 0x0030);
+#endif
 }
 
 static void __init mpc885ads_setup_arch(void)
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 3ace747..0fda67c 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -28,6 +28,7 @@
 #include <linux/fsl_devices.h>
 #include <linux/fs_enet_pd.h>
 #include <linux/fs_uart_pd.h>
+#include <linux/of_platform.h>
 
 #include <asm/system.h>
 #include <asm/atomic.h>
@@ -1210,6 +1211,20 @@ err:
 
 arch_initcall(cpm_smc_uart_of_init);
 
+static int __init fsl_i2c_cpm_of_init(void)
+{
+	struct device_node *np = NULL;
+	/*
+	 * Register all the devices which type is "i2c-cpm"
+	 */
+	while ((np = of_find_compatible_node(np, "i2c", "fsl,i2c-cpm")) != NULL)
+		of_platform_device_create(np, "fsl-i2c-cpm", NULL);
+	return 0;
+}
+
+arch_initcall(fsl_i2c_cpm_of_init);
+
+
 #endif /* CONFIG_8xx */
 #endif /* CONFIG_PPC_CPM_NEW_BINDING */
 
diff --git a/drivers/i2c/algos/Kconfig b/drivers/i2c/algos/Kconfig
index 014dfa5..2419051 100644
--- a/drivers/i2c/algos/Kconfig
+++ b/drivers/i2c/algos/Kconfig
@@ -14,6 +14,18 @@ config I2C_ALGOBIT
 	  This support is also available as a module.  If so, the module 
 	  will be called i2c-algo-bit.
 
+config I2C_ALGOCPM
+	tristate "I2C MPC8xx CPM and MPC8260 CPM2 interfaces"
+	depends on ( 8xx || 8260 ) && I2C
+	help
+	  CPM I2C Algorithm, supports the CPM I2C interface for mpc8xx 
+	  and mpc8260 CPUs. Say Y if you own a CPU of this class and wish
+	  to use the I2C interface and say Y to the specific driver for the
+	  particular CPU.
+
+	  This support is also available as a module.  If so, the module
+	  will be called i2c-algo-cpm.
+
 config I2C_ALGOPCF
 	tristate "I2C PCF 8584 interfaces"
 	help
diff --git a/drivers/i2c/algos/Makefile b/drivers/i2c/algos/Makefile
index cac1051..b5fe28c 100644
--- a/drivers/i2c/algos/Makefile
+++ b/drivers/i2c/algos/Makefile
@@ -6,6 +6,7 @@ obj-$(CONFIG_I2C_ALGOBIT)	+= i2c-algo-bit.o
 obj-$(CONFIG_I2C_ALGOPCF)	+= i2c-algo-pcf.o
 obj-$(CONFIG_I2C_ALGOPCA)	+= i2c-algo-pca.o
 obj-$(CONFIG_I2C_ALGO_SGI)	+= i2c-algo-sgi.o
+obj-$(CONFIG_I2C_ALGOCPM)	+= i2c-algo-cpm.o
 
 ifeq ($(CONFIG_I2C_DEBUG_ALGO),y)
 EXTRA_CFLAGS += -DDEBUG
diff --git a/drivers/i2c/algos/i2c-algo-cpm.c b/drivers/i2c/algos/i2c-algo-cpm.c
new file mode 100644
index 0000000..e287f1a
--- /dev/null
+++ b/drivers/i2c/algos/i2c-algo-cpm.c
@@ -0,0 +1,562 @@
+/*
+ * i2c-algo-cpm.c i2x driver algorithms for MPC8XX CPM and MPC8260 CPM2
+ * Copyright (c) 1999 Dan Malek (dmalek@jlc.net).
+ *
+    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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * moved into proper i2c interface; separated out platform specific
+ * parts into i2c-8xx.c
+ * Brad Parker (brad@heeltoe.com)
+ *
+ * Parts from dbox2_i2c.c (cvs.tuxbox.org)
+ * (C) 2000-2001 Tmbinc, Gillem (htoa@gmx.net)
+ *
+ * (C) 2007 Montavista Software, Inc.
+ * Vitaly Bordug <vitb@kernel.crashing.org>
+ *
+ * (C) 2007 Jochen Friedrich <jochen@scram.de>
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/delay.h>
+#include <linux/slab.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/errno.h>
+#include <linux/sched.h>
+#include <linux/i2c.h>
+#include <linux/i2c-algo-cpm.h>
+#include <linux/io.h>
+#include <linux/time.h>
+#include <linux/dma-mapping.h>
+#include <asm/mpc8xx.h>
+
+/* Try to define this if you have an older CPU (earlier than rev D4) */
+#undef	I2C_CHIP_ERRATA
+
+static int cpm_debug = 1;
+#ifdef DEBUG
+module_param(cpm_debug, int, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(cpm_debug, "debug level - 0 off; 1 normal");
+#endif
+
+static irqreturn_t cpm_iic_interrupt(int irq, void *dev_id)
+{
+	struct i2c_adapter *adap;
+	struct i2c_algo_cpm_data *cpm;
+	i2c8xx_t *i2c;
+	int i;
+
+	adap = (struct i2c_adapter *) dev_id;
+	cpm = adap->algo_data;
+	i2c = cpm->i2c;
+
+	/* Clear interrupt.
+	 */
+	i = in_8(&i2c->i2c_i2cer);
+	out_8(&i2c->i2c_i2cer, i);
+
+	if (cpm_debug)
+		dev_dbg(&adap->dev, "Interrupt: %x\n", i);
+
+	/* Get 'me going again.
+	 */
+	wake_up_interruptible(&cpm->iic_wait);
+
+	return IRQ_HANDLED;
+}
+
+static int cpm_iic_init(struct i2c_adapter *adap)
+{
+	struct i2c_algo_cpm_data *cpm = adap->algo_data;
+	iic_t *iip = cpm->iip;
+	i2c8xx_t *i2c = cpm->i2c;
+	unsigned char brg;
+	int ret, i;
+
+	if (cpm_debug)
+		dev_dbg(&adap->dev, "cpm_iic_init()\n");
+
+	ret = 0;
+	init_waitqueue_head(&cpm->iic_wait);
+	mutex_init(&cpm->iic_mutex);
+	/* Initialize the parameter ram.
+	 * We need to make sure many things are initialized to zero,
+	 * especially in the case of a microcode patch.
+	 */
+	out_be32(&iip->iic_rstate, 0);
+	out_be32(&iip->iic_rdp, 0);
+	out_be16(&iip->iic_rbptr, 0);
+	out_be16(&iip->iic_rbc, 0);
+	out_be32(&iip->iic_rxtmp, 0);
+	out_be32(&iip->iic_tstate, 0);
+	out_be32(&iip->iic_tdp, 0);
+	out_be16(&iip->iic_tbptr, 0);
+	out_be16(&iip->iic_tbc, 0);
+	out_be32(&iip->iic_txtmp, 0);
+
+	/* Set up the IIC parameters in the parameter ram.
+	 */
+	out_be16(&iip->iic_tbase, cpm->dp_addr);
+	out_be16(&iip->iic_rbase, cpm->dp_addr + sizeof(cbd_t) * CPM_MAXBD);
+
+	if (cpm_debug) {
+		dev_dbg(&adap->dev, "iip %p, dp_addr 0x%x\n", cpm->iip,
+			cpm->dp_addr);
+		dev_dbg(&adap->dev, "iic_tbase %d, iic_rbase %d\n",
+			in_be16(&iip->iic_tbase), in_be16(&iip->iic_rbase));
+	}
+
+	out_8(&iip->iic_tfcr, SMC_EB);
+	out_8(&iip->iic_rfcr, SMC_EB);
+
+	/* Set maximum receive size.
+	 */
+	out_be16(&iip->iic_mrblr, CPM_MAX_READ);
+
+	/* Initialize Tx/Rx parameters.
+	 */
+	if (cpm->reloc == 0) {
+		cpm8xx_t *cp = cpm->cp;
+		int res;
+
+		u16 v = mk_cr_cmd(CPM_CR_CH_I2C, CPM_CR_INIT_TRX) | CPM_CR_FLG;
+
+		out_be16(&cp->cp_cpcr, v);
+		res = wait_event_timeout(cpm->iic_wait,
+					 !(in_be16(&cp->cp_cpcr) & CPM_CR_FLG),
+					 HZ * 10);
+		if (!res)
+			return -EIO;
+
+	} else {
+		iip->iic_rbptr = iip->iic_rbase;
+		iip->iic_tbptr = iip->iic_tbase;
+		iip->iic_rstate = 0;
+		iip->iic_tstate = 0;
+	}
+
+	/* Select an arbitrary address.  Just make sure it is unique.
+	 */
+	out_8(&i2c->i2c_i2add, 0xfe);
+
+	/* Make clock run at 60 kHz.
+	 */
+	/* brg = ppc_proc_freq / (32 * 2 * 60000) - 3; */
+	brg = 7;
+	out_8(&i2c->i2c_i2brg, brg);
+
+	out_8(&i2c->i2c_i2mod, 0x00);
+	out_8(&i2c->i2c_i2com, 0x01);	/* Master mode */
+
+	/* Disable interrupts.
+	 */
+	out_8(&i2c->i2c_i2cmr, 0);
+	out_8(&i2c->i2c_i2cer, 0xff);
+
+	/* Allocate TX and RX buffers */
+	for (i = 0; i < CPM_MAXBD; i++) {
+		cpm->rxbuf[i] = (unsigned char *)dma_alloc_coherent(
+			NULL, CPM_MAX_READ + 1, &cpm->rxdma[i], GFP_KERNEL);
+		if (!cpm->rxbuf[i]) {
+			ret = -ENOMEM;
+			goto out;
+		}
+		cpm->txbuf[i] = (unsigned char *)dma_alloc_coherent(
+			NULL, CPM_MAX_READ + 1, &cpm->txdma[i], GFP_KERNEL);
+		if (!cpm->txbuf[i]) {
+			ret = -ENOMEM;
+			goto out;
+		}
+	}
+
+	/* Install interrupt handler.
+	 */
+	if (request_irq(cpm->irq, cpm_iic_interrupt, 0, "8xx_i2c", adap)) {
+		ret = -EIO;
+		goto out;
+	}
+
+	return 0;
+out:
+	for (i = 0; i < CPM_MAXBD; i++) {
+		if (cpm->rxbuf[i]) dma_free_coherent(NULL, CPM_MAX_READ + 1,
+			cpm->rxbuf[i], cpm->rxdma[i]);
+		if (cpm->txbuf[i]) dma_free_coherent(NULL, CPM_MAX_READ + 1,
+			cpm->txbuf[i], cpm->txdma[i]);
+	}
+	return ret;
+}
+
+static int cpm_iic_shutdown(struct i2c_adapter *adap)
+{
+	struct i2c_algo_cpm_data *cpm = adap->algo_data;
+	int i;
+
+	i2c8xx_t *i2c = cpm->i2c;
+
+	/* Shut down IIC.
+	 */
+	out_8(&i2c->i2c_i2mod, in_8(&i2c->i2c_i2mod) | ~1);
+	out_8(&i2c->i2c_i2cmr, 0);
+	out_8(&i2c->i2c_i2cer, 0xff);
+
+	for (i = 0; i < CPM_MAXBD; i++) {
+		if (cpm->rxbuf[i]) dma_free_coherent(NULL, CPM_MAX_READ + 1,
+			cpm->rxbuf[i], cpm->rxdma[i]);
+		if (cpm->txbuf[i]) dma_free_coherent(NULL, CPM_MAX_READ + 1,
+			cpm->txbuf[i], cpm->txdma[i]);
+	}
+
+	free_irq(cpm->irq, adap);
+
+	return (0);
+}
+
+static void cpm_reset_iic_params(struct i2c_algo_cpm_data *cpm)
+{
+	iic_t *iip = cpm->iip;
+
+	out_be16(&iip->iic_tbase, cpm->dp_addr);
+	out_be16(&iip->iic_rbase, cpm->dp_addr + sizeof(cbd_t) * CPM_MAXBD);
+
+	out_8(&iip->iic_tfcr, SMC_EB);
+	out_8(&iip->iic_rfcr, SMC_EB);
+
+	out_be16(&iip->iic_mrblr, CPM_MAX_READ);
+
+	out_be32(&iip->iic_rstate, 0);
+	out_be32(&iip->iic_rdp, 0);
+	out_be16(&iip->iic_rbptr, in_be16(&iip->iic_rbase));
+	out_be16(&iip->iic_rbc, 0);
+	out_be32(&iip->iic_rxtmp, 0);
+	out_be32(&iip->iic_tstate, 0);
+	out_be32(&iip->iic_tdp, 0);
+	out_be16(&iip->iic_tbptr, in_be16(&iip->iic_tbase));
+	out_be16(&iip->iic_tbc, 0);
+	out_be32(&iip->iic_txtmp, 0);
+}
+
+#define BD_SC_NAK		((ushort)0x0004) /* NAK - did not respond */
+#define BD_SC_OV		((ushort)0x0002) /* OV - receive overrun */
+#define CPM_CR_CLOSE_RXBD	((ushort)0x0007)
+
+static void force_close(struct i2c_adapter *adap)
+{
+	struct i2c_algo_cpm_data *cpm = adap->algo_data;
+	i2c8xx_t *i2c = cpm->i2c;
+	if (cpm->reloc == 0) {	/* micro code disabled */
+		cpm8xx_t *cp = cpm->cp;
+		u16 v =
+		    mk_cr_cmd(CPM_CR_CH_I2C, CPM_CR_CLOSE_RXBD) | CPM_CR_FLG;
+
+		if (cpm_debug)
+			printk(KERN_INFO "force_close()\n");
+
+		out_be16(&cp->cp_cpcr, v);
+		wait_event_timeout(cpm->iic_wait,
+				   !(in_be16(&cp->cp_cpcr) & CPM_CR_FLG),
+				   HZ * 5);
+	}
+	out_8(&i2c->i2c_i2cmr, 0x00);	/* Disable all interrupts */
+	out_8(&i2c->i2c_i2cer, 0xff);
+}
+
+static void cpm_parse_message(struct i2c_adapter *adap, struct i2c_msg *pmsg,
+	int num, int tx, int rx)
+{
+	cbd_t *tbdf, *rbdf;
+	u_char addr;
+	u_char *tb;
+	u_char *rb;
+	struct i2c_algo_cpm_data *cpm = adap->algo_data;
+	iic_t *iip = cpm->iip;
+	int i;
+
+	tbdf = (cbd_t *) cpm_dpram_addr(in_be16(&iip->iic_tbase));
+	rbdf = (cbd_t *) cpm_dpram_addr(in_be16(&iip->iic_rbase));
+
+	addr = pmsg->addr << 1;
+	if (pmsg->flags & I2C_M_RD)
+		addr |= 1;
+	if (pmsg->flags & I2C_M_REV_DIR_ADDR)
+		addr ^= 1;
+
+	tb = cpm->txbuf[tx];
+	rb = cpm->rxbuf[rx];
+
+	/* Align read buffer */
+	rb = (u_char *) (((uint) rb + 1) & ~1);
+
+	if (pmsg->flags & I2C_M_RD) {
+		/* To read, we need an empty buffer of the proper length.
+		 * All that is used is the first byte for address, the remainder
+		 * is just used for timing (and doesn't really have to exist).
+		 */
+		tb[0] = addr;		/* Device address byte w/rw flag */
+
+		if (cpm_debug)
+			dev_dbg(&adap->dev, "cpm_iic_read(abyte=0x%x)\n", addr);
+		tbdf[tx].cbd_bufaddr = cpm->txdma[tx];
+		if (pmsg->len == 0)
+			tbdf[tx].cbd_datlen = 2;
+		else
+			tbdf[tx].cbd_datlen = pmsg->len + 1;
+		tbdf[tx].cbd_sc = 0;
+		if (!(pmsg->flags & I2C_M_NOSTART))
+			tbdf[tx].cbd_sc |= BD_IIC_START;
+		if (tx + 1 == num)
+			tbdf[tx].cbd_sc |= BD_SC_LAST | BD_SC_WRAP;
+
+		rbdf[rx].cbd_datlen = 0;
+		rbdf[rx].cbd_bufaddr = cpm->rxdma[rx];
+		rbdf[rx].cbd_sc = BD_SC_EMPTY | BD_SC_INTRPT;
+		if (rx + 1 == CPM_MAXBD)
+			tbdf[rx].cbd_sc |= BD_SC_WRAP;
+
+		tbdf[tx].cbd_sc |= BD_SC_READY;
+	} else {
+		tb[0] = addr;		/* Device address byte w/rw flag */
+		for (i = 0; i < pmsg->len; i++)
+			tb[i+1] = pmsg->buf[i];
+
+		if (cpm_debug)
+			dev_dbg(&adap->dev, "cpm_iic_write(abyte=0x%x)\n",
+				addr);
+		tbdf[tx].cbd_bufaddr = cpm->txdma[tx];
+		if (pmsg->len == 0)
+			tbdf[tx].cbd_datlen = 2;
+		else
+			tbdf[tx].cbd_datlen = pmsg->len + 1;
+		tbdf[tx].cbd_sc = 0;
+		if (!(pmsg->flags & I2C_M_NOSTART))
+			tbdf[tx].cbd_sc |= BD_IIC_START;
+		if (tx + 1 == num)
+			tbdf[tx].cbd_sc |= BD_SC_LAST | BD_SC_WRAP;
+		tbdf[tx].cbd_sc |= BD_SC_READY | BD_SC_INTRPT;
+		dev_dbg(&adap->dev, "tx sc %d %04x\n",
+			tx, tbdf[tx].cbd_sc);
+	}
+}
+
+static int cpm_check_message(struct i2c_adapter *adap, struct i2c_msg *pmsg,
+	int tx, int rx)
+{
+	cbd_t *tbdf, *rbdf;
+	u_char *tb;
+	u_char *rb;
+	struct i2c_algo_cpm_data *cpm = adap->algo_data;
+	iic_t *iip = cpm->iip;
+	int i;
+
+	tbdf = (cbd_t *) cpm_dpram_addr(in_be16(&iip->iic_tbase));
+	rbdf = (cbd_t *) cpm_dpram_addr(in_be16(&iip->iic_rbase));
+
+	tb = cpm->txbuf[tx];
+	rb = cpm->rxbuf[rx];
+
+	/* Align read buffer */
+	rb = (u_char *) (((uint) rb + 1) & ~1);
+
+	if (pmsg->flags & I2C_M_RD) {
+		if (cpm_debug)
+			dev_dbg(&adap->dev, "rx sc %04x, rx sc %04x\n",
+				tbdf[tx].cbd_sc, rbdf[rx].cbd_sc);
+		if (tbdf[tx].cbd_sc & BD_SC_NAK) {
+			if (cpm_debug)
+				dev_dbg(&adap->dev, "IIC read; no ack\n");
+			if (pmsg->flags & I2C_M_IGNORE_NAK)
+				return 0;
+			else
+				return -EREMOTEIO;
+		}
+		if (rbdf[rx].cbd_sc & BD_SC_EMPTY) {
+			if (cpm_debug) {
+				dev_dbg(&adap->dev,
+					"IIC read; complete but rbuf empty\n");
+			}
+			return -EREMOTEIO;
+		}
+		if (rbdf[rx].cbd_sc & BD_SC_OV) {
+			if (cpm_debug)
+				dev_dbg(&adap->dev, "IIC read; Overrun\n");
+			return -EREMOTEIO;
+		}
+		for (i = 0; i < pmsg->len; i++)
+			pmsg->buf[i] = rb[i];
+	} else {
+		if (cpm_debug)
+			dev_dbg(&adap->dev, "tx sc %d %04x\n",
+				tx, tbdf[tx].cbd_sc);
+		if (tbdf[tx].cbd_sc & BD_SC_NAK) {
+			if (cpm_debug)
+				dev_dbg(&adap->dev, "IIC write; no ack\n");
+			if (pmsg->flags & I2C_M_IGNORE_NAK)
+				return 0;
+			else
+				return -EIO;
+		}
+	}
+	return 0;
+}
+
+static int cpm_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
+{
+	struct i2c_algo_cpm_data *cpm = adap->algo_data;
+	i2c8xx_t *i2c = cpm->i2c;
+	iic_t *iip = cpm->iip;
+	struct i2c_msg *pmsg, *rmsg;
+	int ret, i;
+	int tptr;
+	int rptr;
+	cbd_t *tbdf, *rbdf;
+
+	if (num > CPM_MAXBD)
+		return -EREMOTEIO;
+
+	/* Check if we have any oversized READ requests */
+	for (i = 0; i < num; i++) {
+		pmsg = &msgs[i];
+		if (pmsg->len >= CPM_MAX_READ)
+			return -EREMOTEIO;
+	}
+
+	mutex_lock(&cpm->iic_mutex);
+
+	/* check for and use a microcode relocation patch */
+	if (cpm->reloc)
+		cpm_reset_iic_params(cpm);
+
+	/* Reset to use first buffer */
+	out_be16(&iip->iic_rbptr, in_be16(&iip->iic_rbase));
+	out_be16(&iip->iic_tbptr, in_be16(&iip->iic_tbase));
+
+	tbdf = (cbd_t *) cpm_dpram_addr(in_be16(&iip->iic_tbase));
+	rbdf = (cbd_t *) cpm_dpram_addr(in_be16(&iip->iic_rbase));
+
+	tptr = 0;
+	rptr = 0;
+
+	while (tptr < num) {
+		pmsg = &msgs[tptr];
+		if (cpm_debug)
+			dev_dbg(&adap->dev, "i2c-algo-cpm.o: "
+				"R: %d T: %d\n",
+				rptr, tptr);
+
+		cpm_parse_message(adap, pmsg, num, tptr, rptr);
+		if (pmsg->flags & I2C_M_RD)
+			rptr++;
+		tptr++;
+	}
+	/* Start transfer now */
+	/* Chip bug, set enable here */
+	out_8(&i2c->i2c_i2cmr, 0x13);	/* Enable some interupts */
+	out_8(&i2c->i2c_i2cer, 0xff);
+	out_8(&i2c->i2c_i2mod, in_8(&i2c->i2c_i2mod) | 1);	/* Enable */
+	/* Begin transmission */
+	out_8(&i2c->i2c_i2com, in_8(&i2c->i2c_i2com) | 0x80);
+
+	tptr = 0;
+	rptr = 0;
+
+	while (tptr < num) {
+		/* Check for outstanding messages */
+		dev_dbg(&adap->dev, "test ready.\n");
+		if (!(tbdf[tptr].cbd_sc & BD_SC_READY)) {
+			dev_dbg(&adap->dev, "ready.\n");
+			rmsg = &msgs[tptr];
+			ret = cpm_check_message(adap, rmsg, tptr, rptr);
+			tptr++;
+			if (rmsg->flags & I2C_M_RD)
+				rptr++;
+			if (ret) {
+				force_close(adap);
+				mutex_unlock(&cpm->iic_mutex);
+				return -EREMOTEIO;
+			}
+		} else {
+			dev_dbg(&adap->dev, "not ready.\n");
+			ret = wait_event_interruptible_timeout(cpm->iic_wait,
+				!(tbdf[tptr].cbd_sc & BD_SC_READY), 1 * HZ);
+			if (ret == 0) {
+				force_close(adap);
+				if (cpm_debug)
+					dev_dbg(&adap->dev,
+						"IIC read: timeout!\n");
+				mutex_unlock(&cpm->iic_mutex);
+				return -EREMOTEIO;
+			}
+		}
+	}
+#ifdef I2C_CHIP_ERRATA
+	/* Chip errata, clear enable. This is not needed on rev D4 CPUs.
+	   Disabling I2C too early may cause too short stop condition */
+	udelay(4);
+	out_8(&i2c->i2c_i2mod, in_8(&i2c->i2c_i2mod) | ~1);
+#endif
+	mutex_unlock(&cpm->iic_mutex);
+	return (num);
+}
+
+static u32 cpm_func(struct i2c_adapter *adap)
+{
+	return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
+}
+
+/* -----exported algorithm data: -------------------------------------	*/
+
+static struct i2c_algorithm cpm_algo = {
+	.master_xfer = cpm_xfer,
+	.functionality = cpm_func,
+};
+
+/*
+ * registering functions to load algorithms at runtime
+ */
+int i2c_cpm_add_bus(struct i2c_adapter *adap)
+{
+	int res;
+
+	if (cpm_debug)
+		dev_dbg(&adap->dev,
+			"i2c-algo-cpm.o: hw routines for %s registered.\n",
+			adap->name);
+
+	/* register new adapter to i2c module... */
+
+	adap->algo = &cpm_algo;
+
+	res = cpm_iic_init(adap);
+
+	if (res)
+		return res;
+
+	return i2c_add_adapter(adap);
+}
+EXPORT_SYMBOL(i2c_cpm_add_bus);
+
+int i2c_cpm_del_bus(struct i2c_adapter *adap)
+{
+	i2c_del_adapter(adap);
+
+	return cpm_iic_shutdown(adap);
+}
+EXPORT_SYMBOL(i2c_cpm_del_bus);
+
+MODULE_AUTHOR("Brad Parker <brad@heeltoe.com>");
+MODULE_DESCRIPTION("I2C-Bus CPM algorithm");
+MODULE_LICENSE("GPL");
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 9f3a4cd..1dcc294 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -4,6 +4,22 @@
 
 menu "I2C Hardware Bus support"
 
+config I2C_8XX
+	tristate "MPC8xx CPM oldstyle (no OF)"
+	depends on 8xx && I2C && !OF
+	select I2C_ALGOCPM
+	help
+	  This supports the use of the I2C interface on Freescale MPC8xx
+	  processors.
+
+config I2C_8XX_OF
+	tristate "MPC8xx CPM with Open Firmware"
+	depends on 8xx && I2C && OF
+	select I2C_ALGOCPM
+	help
+	  This supports the use of the I2C interface on Freescale MPC8xx
+	  processors.
+
 config I2C_ALI1535
 	tristate "ALI 1535"
 	depends on PCI
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
index 5b752e4..586e263 100644
--- a/drivers/i2c/busses/Makefile
+++ b/drivers/i2c/busses/Makefile
@@ -2,6 +2,8 @@
 # Makefile for the i2c bus drivers.
 #
 
+obj-$(CONFIG_I2C_8XX)		+= i2c-8xx.o
+obj-$(CONFIG_I2C_8XX_OF)	+= i2c-8xx-of.o
 obj-$(CONFIG_I2C_ALI1535)	+= i2c-ali1535.o
 obj-$(CONFIG_I2C_ALI1563)	+= i2c-ali1563.o
 obj-$(CONFIG_I2C_ALI15X3)	+= i2c-ali15x3.o
diff --git a/drivers/i2c/busses/i2c-8xx-of.c b/drivers/i2c/busses/i2c-8xx-of.c
new file mode 100644
index 0000000..f2e87bd
--- /dev/null
+++ b/drivers/i2c/busses/i2c-8xx-of.c
@@ -0,0 +1,170 @@
+/*
+ * Embedded Planet RPX Lite MPC8xx CPM I2C interface.
+ * Copyright (c) 1999 Dan Malek (dmalek@jlc.net).
+ *
+ * moved into proper i2c interface;
+ * Brad Parker (brad@heeltoe.com)
+ *
+ * (C) 2007 Montavista Software, Inc.
+ * Vitaly Bordug <vitb@kernel.crashing.org>
+ *
+ * RPX lite specific parts of the i2c interface
+ * Update:  There actually isn't anything RPXLite-specific about this module.
+ * This should work for most any 8xx board.  The console messages have been
+ * changed to eliminate RPXLite references.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/stddef.h>
+#include <linux/platform_device.h>
+#include <linux/i2c.h>
+#include <linux/i2c-algo-cpm.h>
+#include <linux/of_device.h>
+#include <linux/of_platform.h>
+#include <asm/mpc8xx.h>
+#include <asm/commproc.h>
+#include <asm/fs_pd.h>
+
+
+struct m8xx_i2c {
+	char *base;
+	struct of_device *ofdev;
+	struct i2c_adapter adap;
+	struct i2c_algo_cpm_data *algo_8xx;
+};
+
+static struct i2c_algo_cpm_data m8xx_data;
+
+static const struct i2c_adapter m8xx_ops = {
+	.owner		= THIS_MODULE,
+	.name		= "i2c-8xx-of",
+	.id		= I2C_HW_MPC8XX_EPON,
+	.algo_data	= &m8xx_data,
+	.dev.parent	= &platform_bus,
+	.class		= I2C_CLASS_HWMON,
+};
+
+static int m8xx_iic_init(struct m8xx_i2c *i2c)
+{
+	cpm8xx_t *cp;
+	struct resource r;
+	struct i2c_algo_cpm_data *data = i2c->algo_8xx;
+	struct of_device *ofdev = i2c->ofdev;
+	struct device_node *np = ofdev->node;
+
+	/* Pointer to Communication Processor
+	 */
+	cp = (cpm8xx_t *)immr_map(im_cpm);
+	data->cp = cp;
+
+	data->irq = irq_of_parse_and_map(np, 0);
+	if (data->irq < 0)
+		return -EINVAL;
+
+	if (of_address_to_resource(np, 1, &r))
+		return -EINVAL;
+
+	data->iip = ioremap(r.start, r.end - r.start + 1);
+	if (data->iip == NULL)
+		return -EINVAL;
+
+	/* Check for and use a microcode relocation patch.
+	 */
+	data->reloc = data->iip->iic_rpbase;
+	if (data->reloc)
+		data->iip = (iic_t *)&cp->cp_dpmem[data->iip->iic_rpbase];
+
+	if (of_address_to_resource(np, 0, &r))
+		return -EINVAL;
+
+	data->i2c = ioremap(r.start, r.end - r.start + 1);
+	if (data->i2c == NULL)
+		return -EINVAL;
+
+	/* Allocate space for two transmit and two receive buffer
+	 * descriptors in the DP ram.
+	 */
+	data->dp_addr = cpm_dpalloc(sizeof(cbd_t) * 4, 8);
+	if (!data->dp_addr)
+		return -ENOMEM;
+
+	return 0;
+}
+
+static int i2c_8xx_probe(struct of_device *ofdev,
+			 const struct of_device_id *match)
+{
+	int result;
+	struct m8xx_i2c *i2c;
+
+	i2c = kzalloc(sizeof(*i2c), GFP_KERNEL);
+	if (!i2c)
+		return -ENOMEM;
+
+	i2c->ofdev = ofdev;
+	i2c->algo_8xx = &m8xx_data;
+
+	m8xx_iic_init(i2c);
+
+	dev_set_drvdata(&ofdev->dev, i2c);
+
+	i2c->adap = m8xx_ops;
+	i2c_set_adapdata(&i2c->adap, i2c);
+	i2c->adap.dev.parent = &ofdev->dev;
+
+	result = i2c_cpm_add_bus(&i2c->adap);
+	if (result < 0) {
+		printk(KERN_ERR "i2c-8xx-of: Unable to register with I2C\n");
+		kfree(i2c);
+	}
+
+	return result;
+}
+
+static int i2c_8xx_remove(struct of_device *ofdev)
+{
+	struct m8xx_i2c *i2c = dev_get_drvdata(&ofdev->dev);
+
+	i2c_cpm_del_bus(&i2c->adap);
+	dev_set_drvdata(&ofdev->dev, NULL);
+
+	kfree(i2c);
+	return 0;
+}
+
+static struct of_device_id i2c_8xx_match[] = {
+	{
+		.type = "i2c",
+		.compatible = "fsl,i2c-cpm",
+	},
+	{},
+};
+
+MODULE_DEVICE_TABLE(of, i2c_8xx_match);
+
+static struct of_platform_driver i2c_8xx_driver = {
+	.name		= "fsl-i2c-cpm",
+	.match_table	= i2c_8xx_match,
+	.probe		= i2c_8xx_probe,
+	.remove		= i2c_8xx_remove,
+};
+
+static int __init i2c_8xx_init(void)
+{
+	return of_register_platform_driver(&i2c_8xx_driver);
+}
+
+static void __exit i2c_8xx_exit(void)
+{
+	of_unregister_platform_driver(&i2c_8xx_driver);
+}
+
+module_init(i2c_8xx_init);
+module_exit(i2c_8xx_exit);
+
+MODULE_AUTHOR("Dan Malek <dmalek@jlc.net>");
+MODULE_DESCRIPTION("I2C-Bus adapter routines for MPC8xx boards");
+MODULE_LICENSE("GPL");
diff --git a/drivers/i2c/busses/i2c-8xx.c b/drivers/i2c/busses/i2c-8xx.c
new file mode 100644
index 0000000..0e2fa56
--- /dev/null
+++ b/drivers/i2c/busses/i2c-8xx.c
@@ -0,0 +1,105 @@
+/*
+ * Embedded Planet RPX Lite MPC8xx CPM I2C interface.
+ * Copyright (c) 1999 Dan Malek (dmalek@jlc.net).
+ *
+ * moved into proper i2c interface;
+ * Brad Parker (brad@heeltoe.com)
+ *
+ * RPX lite specific parts of the i2c interface
+ * Update:  There actually isn't anything RPXLite-specific about this module.
+ * This should work for most any 8xx board.  The console messages have been
+ * changed to eliminate RPXLite references.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/stddef.h>
+#include <linux/i2c.h>
+#include <linux/i2c-algo-cpm.h>
+#include <linux/platform_device.h>
+#include <linux/irq.h>
+#include <linux/io.h>
+#include <asm/mpc8xx.h>
+#include <asm/commproc.h>
+
+static int
+m8xx_iic_init(struct i2c_algo_cpm_data *data)
+{
+	cpm8xx_t *cp;
+	immap_t *immap;
+
+	immap = (immap_t *)IMAP_ADDR;	/* and to internal registers */
+	/* Get pointer to Communication Processor */
+	cp = (cpm8xx_t *)&immap->im_cpm;
+
+	data->iip = (iic_t *)&cp->cp_dparam[PROFF_IIC];
+
+	/* Check for and use a microcode relocation patch.
+	*/
+	data->reloc = in_be16(&data->iip->iic_rpbase);
+	if (data->reloc)
+		data->iip = (iic_t *)&cp->cp_dpmem[data->reloc];
+
+	data->i2c = (i2c8xx_t *)&(immap->im_i2c);
+	data->cp = cp;
+
+	/* Initialize Port B IIC pins.
+	*/
+	setbits32(&cp->cp_pbpar, 0x00000030);
+	setbits32(&cp->cp_pbdir, 0x00000030);
+	setbits16(&cp->cp_pbodr, 0x00000030);
+
+	/* Allocate space for transmit and receive buffer
+	 * descriptors in the DP ram.
+	 */
+	data->dp_addr = cpm_dpalloc(sizeof(cbd_t) * 2 * CPM_MAXBD, 8);
+	if (!data->dp_addr)
+		return -ENOMEM;
+
+	return 0;
+}
+
+static struct i2c_algo_cpm_data m8xx_data = {
+	.irq = CPM_IRQ_OFFSET + CPMVEC_I2C,
+};
+
+static struct i2c_adapter m8xx_ops = {
+	.owner		= THIS_MODULE,
+	.name		= "m8xx",
+	.id		= I2C_HW_MPC8XX_EPON,
+	.algo_data	= &m8xx_data,
+	.dev.parent	= &platform_bus,
+	.class		= I2C_CLASS_HWMON,
+};
+
+int __init i2c_8xx_init(void)
+{
+	int ret;
+
+	printk(KERN_INFO "i2c-8xx: i2c MPC8xx driver\n");
+
+	/* reset hardware to sane state */
+	ret = m8xx_iic_init(&m8xx_data);
+	if (ret)
+		return ret;
+
+	if (i2c_cpm_add_bus(&m8xx_ops) < 0) {
+		printk(KERN_ERR "i2c-8xx: Unable to register with I2C\n");
+		return -ENODEV;
+	}
+
+	return 0;
+}
+
+void __exit i2c_8xx_exit(void)
+{
+	i2c_cpm_del_bus(&m8xx_ops);
+}
+
+module_init(i2c_8xx_init);
+module_exit(i2c_8xx_exit);
+
+MODULE_AUTHOR("Dan Malek <dmalek@jlc.net>");
+MODULE_DESCRIPTION("I2C-Bus adapter routines for MPC8xx boards");
+MODULE_LICENSE("GPL");
diff --git a/include/linux/i2c-algo-cpm.h b/include/linux/i2c-algo-cpm.h
new file mode 100644
index 0000000..2192b7d
--- /dev/null
+++ b/include/linux/i2c-algo-cpm.h
@@ -0,0 +1,34 @@
+/* ------------------------------------------------------------------------- */
+/* i2c-algo-cpm.h i2c driver algorithms for MPX8XX CPM or MPC8250 CPM2       */
+/* ------------------------------------------------------------------------- */
+
+#ifndef I2C_ALGO_CPM_H
+#define I2C_ALGO_CPM_H
+
+#include <linux/i2c.h>
+#include <asm/8xx_immap.h>
+#include <asm/commproc.h>
+
+#define CPM_MAX_READ    513
+#define CPM_MAXBD       4
+
+struct i2c_algo_cpm_data {
+	uint dp_addr;
+	int reloc;
+	int irq;
+	i2c8xx_t *i2c;
+	iic_t *iip;
+	cpm8xx_t *cp;
+	wait_queue_head_t iic_wait;
+	struct mutex iic_mutex; /* Protects I2C CPM */
+	u_char *txbuf[CPM_MAXBD];
+	u_char *rxbuf[CPM_MAXBD];
+	u32 txdma[CPM_MAXBD];
+	u32 rxdma[CPM_MAXBD];
+};
+
+extern int i2c_cpm_add_bus(struct i2c_adapter *);
+extern int i2c_cpm_del_bus(struct i2c_adapter *);
+
+#endif /* I2C_ALGO_CPM_H */
+


^ permalink raw reply related

* [PATCH 0/2] Compile error fixes
From: Grant Likely @ 2007-10-14  4:13 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linuxppc-dev, linux-kernel, Al Viro

Linus,

Here are two fixes which should go in immediately.  The first is change
to lite5200 which got lost when it was merged.  The second is a
brown-paper-bag typo.

Cheers,
g.

--
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply

* [PATCH 1/2] Lite5200 shouldn't mess with ROOT_DEV
From: Grant Likely @ 2007-10-14  4:13 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linuxppc-dev, linux-kernel, Al Viro
In-Reply-To: <20071014040705.17867.42969.stgit@trillian.cg.shawcable.net>

From: Grant Likely <grant.likely@secretlab.ca>

There is no good reason for board platform code to mess with the ROOT_DEV.
Remove it from all in-tree platforms except powermac

This is a follow on to commit 745e1027751acbc1f14f8bbef378b491242b9c83.
The original patch had this change to lite5200.c, but it got dropped in
the psycho madness that is the 2.6.24 merge window.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
---

 arch/powerpc/platforms/52xx/lite5200.c |   12 ------------
 1 files changed, 0 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c
index 0caa3d9..a0b4934 100644
--- a/arch/powerpc/platforms/52xx/lite5200.c
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -156,18 +156,6 @@ static void __init lite5200_setup_arch(void)
 		of_node_put(np);
 	}
 #endif
-
-#ifdef CONFIG_BLK_DEV_INITRD
-	if (initrd_start)
-		ROOT_DEV = Root_RAM0;
-	else
-#endif
-#ifdef  CONFIG_ROOT_NFS
-		ROOT_DEV = Root_NFS;
-#else
-		ROOT_DEV = Root_HDA1;
-#endif
-
 }
 
 /*

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox