LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* RE: custom board MPC8266
From: srinivas.surabhi @ 2005-04-01  6:56 UTC (permalink / raw)
  To: manisha.vj; +Cc: linuxppc-embedded


As per my experience if we set CONIG_SCC_CONSOLE =3Dy the SCC1 will be
used as serial console. Since we have connected serial console to SCC1,
it started working with the above option set.

Rgds
SS

-----Original Message-----
From: linuxppc-embedded-bounces@ozlabs.org
[mailto:linuxppc-embedded-bounces@ozlabs.org] On Behalf Of Manisha
Jagadhane
Sent: Friday, April 01, 2005 11:31 AM
To: Rune Torgersen; linuxppc-embedded@ozlabs.org
Subject: Re: custom board MPC8266

Thanks for the reply.=0D
I have seen the file arch/ppc/8260_io/commproc.c, but there is nowhere
given where to configure the SMC1/SMC2/SCC1/SCC2 as serial console. In
the .config file, whether we have to set CONFIG_SCC_CONSOLE=3Dy option
and in this .config file, is it required to do any configuration to
set SMC1 as serial console?

Please clarify.

Thanking you in advance.

Regards,
Manisha


On Mar 30, 2005 7:57 PM, Rune Torgersen <runet@innovsys.com> wrote:
> If I remember correctly: You have to edit the
> arch/ppc/82xx_io/commproc.c file (I think) to set up which serial port
> is used for console port.
>=0D
> > -----Original Message-----
> > From: linuxppc-embedded-bounces@ozlabs.org
> > [mailto:linuxppc-embedded-bounces@ozlabs.org] On Behalf Of
> > Manisha Jagadhane
> > Sent: Wednesday, March 30, 2005 05:32
> > To: linuxppc-embedded@ozlabs.org
> > Subject: custom board MPC8266
> >
> > Hi,
> >
> > I am using custom board based on MPC8266 processor. I have
> > successfully ported U-Boot 1.1.1 on it. I have used SMC1 as serial
> > port in the board. Does the 2.4.24 kernel version for ppc supports
> > SMC1 as serial console? Which configuration I have to give in the
> > .config file to configure SMC1 as serial console? Which board's
> > defconfig file  shall I take as a reference and which kernel version
> > shall I use?
> >
> > Please help me in this regard.
> >
> > Thanking you in advance.
> >
> > Regards,
> >
> > Manisha.
> > _______________________________________________
> > Linuxppc-embedded mailing list
> > Linuxppc-embedded@ozlabs.org
> > https://ozlabs.org/mailman/listinfo/linuxppc-embedded
> >
> >
>
_______________________________________________
Linuxppc-embedded mailing list
Linuxppc-embedded@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-embedded



Confidentiality Notice=0D

The information contained in this electronic message and any attachments to=
 this message are intended
for the exclusive use of the addressee(s) and may contain confidential or=
 privileged information. If
you are not the intended recipient, please notify the sender at Wipro or=
 Mailadmin@wipro.com immediately
and destroy all copies of this message and any attachments.

^ permalink raw reply

* Re: custom board MPC8266
From: Manisha Jagadhane @ 2005-04-01  6:00 UTC (permalink / raw)
  To: Rune Torgersen, linuxppc-embedded
In-Reply-To: <DCEAAC0833DD314AB0B58112AD99B93B859323@ismail.innsys.innovsys.com>

Thanks for the reply. 
I have seen the file arch/ppc/8260_io/commproc.c, but there is nowhere
given where to configure the SMC1/SMC2/SCC1/SCC2 as serial console. In
the .config file, whether we have to set CONFIG_SCC_CONSOLE=y option
and in this .config file, is it required to do any configuration to
set SMC1 as serial console?

Please clarify.

Thanking you in advance.

Regards,
Manisha


On Mar 30, 2005 7:57 PM, Rune Torgersen <runet@innovsys.com> wrote:
> If I remember correctly: You have to edit the
> arch/ppc/82xx_io/commproc.c file (I think) to set up which serial port
> is used for console port.
> 
> > -----Original Message-----
> > From: linuxppc-embedded-bounces@ozlabs.org
> > [mailto:linuxppc-embedded-bounces@ozlabs.org] On Behalf Of
> > Manisha Jagadhane
> > Sent: Wednesday, March 30, 2005 05:32
> > To: linuxppc-embedded@ozlabs.org
> > Subject: custom board MPC8266
> >
> > Hi,
> >
> > I am using custom board based on MPC8266 processor. I have
> > successfully ported U-Boot 1.1.1 on it. I have used SMC1 as serial
> > port in the board. Does the 2.4.24 kernel version for ppc supports
> > SMC1 as serial console? Which configuration I have to give in the
> > .config file to configure SMC1 as serial console? Which board's
> > defconfig file  shall I take as a reference and which kernel version
> > shall I use?
> >
> > Please help me in this regard.
> >
> > Thanking you in advance.
> >
> > Regards,
> >
> > Manisha.
> > _______________________________________________
> > Linuxppc-embedded mailing list
> > Linuxppc-embedded@ozlabs.org
> > https://ozlabs.org/mailman/listinfo/linuxppc-embedded
> >
> >
>

^ permalink raw reply

* [PATCH] WDT Driver for Book-E [3/3] get rid of PVR. access.
From: Takeharu KATO @ 2005-04-01  4:27 UTC (permalink / raw)
  To: linuxppc-embedded, galak, mporter

Hi,

I fixed the device driver codes for BOOK-E Architecture which I posted before.
This patch get rid of PVR register access in the driver according to
recent fashion.

This patch is written to apply after applying two patches I sent before.

Please apply.

P.S. Kumar, have you tested this driver?
Please notify if there are some problems with the driver.

Regards,

Signed-off-by: Takeharu KATO <kato.takeharu@jp.fujitsu.com>

diff -Naur linux-2.6.11.6.orig/drivers/char/watchdog/booke_wdt.c linux-2.6.11.6/drivers/char/watchdog/booke_wdt.c
--- linux-2.6.11.6.orig/drivers/char/watchdog/booke_wdt.c	2005-04-01 02:55:48.000000000 +0900
+++ linux-2.6.11.6/drivers/char/watchdog/booke_wdt.c	2005-04-01 02:35:00.000000000 +0900
@@ -37,6 +37,7 @@
 #include <asm/reg.h>
 #include <asm/uaccess.h>
 #include <asm/system.h>
+#include <asm/cputable.h>
 #include "booke_wdt.h"

 /* micro seconds per one milli-second(used to calculatewatchdog
@@ -345,7 +346,7 @@
     /* Hardware WDT provided by the processor.
      * So, we set firmware version as processor version number.
      */
-    ident.firmware_version=mfspr(PVR);
+    ident.firmware_version=cpu_specs[0].pvr_value;
     __booke_wdt_setup_val(WDT_WP,WRC_NONE);
 }
 /**

^ permalink raw reply

* Re: [PATCH] invalid instructions in kernel mode
From: Dan Malek @ 2005-04-01  3:45 UTC (permalink / raw)
  To: Fillod Stephane; +Cc: linuxppc-dev
In-Reply-To: <1CFEB358338412458B21FAA0D78FE86D4F0D25@rennsmail02.eu.thmulti.com>


On Mar 31, 2005, at 2:17 PM, Fillod Stephane wrote:

> What I don't understand, is how the FP load/store operations
> in misc.S can "work" on a system with no FPU and *no* math-emu?

What should happen is to follow the example used by 8xx for
many years.  As I said, when math emulation is disabled, there is
still code that will emulate the load/store FP instructions.  These
instructions are used in may places even if user applications
are compiled without any FP usage.

> Many years? Allow me to doubt it's really used :).

I wrote it in 1998 for the 8xx.  I thought 4xx and e500 used the
same model.  If they don't, they should.

> Though, it does work for 8xx thanks to Soft_emulate_8xx, but doesn't
> for other FPU-less cores when CONFIG_MATH_EMULATION is disabled.

Well, then that should get fixed.

> So here is another patch,

The only patch I'm interested in is making the 4xx and e500 follow the
same path as 8xx.  All of the non-FP cores should work the same way.
The e500 is a special case because it doesn't have a classic FPU but
rather can utilize the SPE for floating point.  Put some thought into 
that.

Thanks.


	-- Dan

^ permalink raw reply

* Linux for the Xilinx Memec V2P20-1152
From: Tracey Bernath @ 2005-04-01  2:33 UTC (permalink / raw)
  To: linuxppc-embedded

Has anyone built an image for the Memec 1152 V2P board?  I downloaded 
the linuxppc bitkeeper, but it seems to want to build an i386 version. 
Havent figured out a config that gets me a useableimage.Can anyone send 
me a config file that compiles?

Thanks
Tracey

^ permalink raw reply

* Re: How to read/write in flash memories (MTD)?
From: Josh Boyer @ 2005-03-31 23:34 UTC (permalink / raw)
  To: Garcia Jérémie; +Cc: linuxppc-dev
In-Reply-To: <D4FDDD1349B5AC46B68FC26AD8AF42D6226B17@exnet.3il.fr>

On Thu, 2005-03-31 at 11:59 +0200, Garcia J=C3=A9r=C3=A9mie wrote:
> L&G,
> Although I'm a newbie in linux kernel development, I'm in charge of adapt=
ing a Montavista LSP to fit our hardware. In our platform, we use 2 AMD fla=
sh memories (AM29LV) in which one we would like to process read/write opera=
tions. So I'm looking for a way to do that. I saw that at compilation time,=
 there is MTD item which seems to be created for that. But I guess activate=
 that will not be enough to reach my objective.

You need to enable MTD with the appropriate chip drivers and either the
MTD character device or the MTD block device (or both).  These will
create /dev/mtdX and /dev/mtdblockX respectively.  If you are using
devfs or sysfs + udev, they should show up in /dev.  Otherwise, you'll
need to use mknod to create them.

> Indeed, we are developping an application (in the user-space) which will =
initiate operation on the 2 flash memories. So, how can I access them from =
my application?
> Please help me cause I'm getting lost in the linux sources....

I'm not sure what kind of operations you mean, but the block and char
devices allow read/write operation.  If you are looking for a filesystem
to run on these devices, take a look at JFFS2.  Cramfs or squashfs can
also be used, but they are read-only.

josh

^ permalink raw reply

* Re: 440EP FPU patch
From: Josh Boyer @ 2005-03-31 23:37 UTC (permalink / raw)
  To: Matt; +Cc: Tom Rini, linuxppc-embedded Linux list
In-Reply-To: <20050331131044.A29501@cox.net>

On Thu, 2005-03-31 at 13:10 -0700, Matt wrote:
> 
> If nobody has time to work on this, then I intend  to put Wade's 440EP
> support in as is (actually, he's planning on resubmitting with some
> additional changes).  When somebody has time, they can redo the patch
> against that.

Do those changes happen to include the MTD driver for the NAND
controller?  Wade, any word on that?

josh

^ permalink raw reply

* [PATCH 2.6.10-rc2] ppc32: Add usb support to IBM stb04xxx platforms (v3)
From: Dale Farnsworth @ 2005-03-31 23:35 UTC (permalink / raw)
  To: linuxppc-embedded

Signed-off-by: Dale Farnsworth <dale@farnsworth.org>

Index: linux-2.5-usb-405/arch/ppc/platforms/4xx/ibmstb4.c
===================================================================
--- linux-2.5-usb-405.orig/arch/ppc/platforms/4xx/ibmstb4.c
+++ linux-2.5-usb-405/arch/ppc/platforms/4xx/ibmstb4.c
@@ -11,6 +11,7 @@
 
 #include <linux/init.h>
 #include <asm/ocp.h>
+#include <asm/ppc4xx_pic.h>
 #include <platforms/4xx/ibmstb4.h>
 
 static struct ocp_func_iic_data ibmstb4_iic0_def = {
@@ -72,12 +73,51 @@
 	  .irq		= IDE0_IRQ,
 	  .pm		= OCP_CPM_NA,
 	},
-	{ .vendor	= OCP_VENDOR_IBM,
-	  .function	= OCP_FUNC_USB,
-	  .paddr	= USB0_BASE,
-	  .irq		= USB0_IRQ,
-	  .pm		= OCP_CPM_NA,
-	},
 	{ .vendor	= OCP_VENDOR_INVALID,
 	}
 };
+
+/* Polarity and triggering settings for internal interrupt sources */
+struct ppc4xx_uic_settings ppc4xx_core_uic_cfg[] __initdata = {
+	{ .polarity 	= 0x7fffff01,
+	  .triggering	= 0x00000000,
+	  .ext_irq_mask	= 0x0000007e,	/* IRQ0 - IRQ5 */
+	}
+};
+
+static struct resource ohci_usb_resources[] = {
+	[0] = {
+		.start	= USB0_BASE,
+		.end	= USB0_BASE + USB0_SIZE - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= USB0_IRQ,
+		.end	= USB0_IRQ,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static u64 dma_mask = 0xffffffffULL;
+
+static struct platform_device ohci_usb_device = {
+	.name		= "ppc-soc-ohci",
+	.id		= 0,
+	.num_resources	= ARRAY_SIZE(ohci_usb_resources),
+	.resource	= ohci_usb_resources,
+	.dev		= {
+		.dma_mask = &dma_mask,
+		.coherent_dma_mask = 0xffffffffULL,
+	}
+};
+
+static struct platform_device *ibmstb4_devs[] __initdata = {
+	&ohci_usb_device,
+};
+
+static int __init
+ibmstb4_platform_add_devices(void)
+{
+	return platform_add_devices(ibmstb4_devs, ARRAY_SIZE(ibmstb4_devs));
+}
+arch_initcall(ibmstb4_platform_add_devices);
Index: linux-2.5-usb-405/arch/ppc/platforms/4xx/ibmstb4.h
===================================================================
--- linux-2.5-usb-405.orig/arch/ppc/platforms/4xx/ibmstb4.h
+++ linux-2.5-usb-405/arch/ppc/platforms/4xx/ibmstb4.h
@@ -73,9 +73,9 @@
 #define OPB0_BASE	0x40000000
 #define GPIO0_BASE	0x40060000
 
+#define USB0_BASE	0x40010000
+#define USB0_SIZE	0xA0
 #define USB0_IRQ	18
-#define USB0_BASE	STB04xxx_MAP_IO_ADDR(0x40010000)
-#define USB0_EXTENT 4096
 
 #define IIC_NUMS 2
 #define UART_NUMS	3
Index: linux-2.5-usb-405/arch/ppc/platforms/4xx/redwood5.c
===================================================================
--- linux-2.5-usb-405.orig/arch/ppc/platforms/4xx/redwood5.c
+++ linux-2.5-usb-405/arch/ppc/platforms/4xx/redwood5.c
@@ -18,6 +18,19 @@
 #include <linux/ioport.h>
 #include <asm/io.h>
 #include <asm/machdep.h>
+#include <asm/ppc4xx_pic.h>
+
+/*
+ * Define external IRQ senses and polarities.
+ */
+unsigned char ppc4xx_uic_ext_irq_cfg[] __initdata = {
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),	/* Ext Int 0 */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),	/* Ext Int 1 */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),	/* Ext Int 2 */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),	/* Ext Int 3 */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),	/* Ext Int 4 */
+	(IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE),	/* Ext Int 5 */
+};
 
 static struct resource smc91x_resources[] = {
 	[0] = {

^ permalink raw reply

* Re: [PATCH 2.6.10-rc2] ppc32: Add usb support to IBM stb04xxx platforms
From: Dale Farnsworth @ 2005-03-31 23:31 UTC (permalink / raw)
  To: linuxppc-embedded
In-Reply-To: <20050331210806.GA5694@gate.ebshome.net>

On Thu, Mar 31, 2005 at 01:08:07PM -0800, Eugene Surovegin wrote:
> Dale, please, don't mess with UIC registers directly, there is a 
> cleaner way to set this up. 
> 
> Take a look at how this is done in other 4xx ports
> (ppc4xx_core_uic_cfg & ppc4xx_uic_ext_irq_cfg).

Thanks for the heads up Eugene.  I'll submit an updated patch shortly.

-Dale

^ permalink raw reply

* Header files for 440?
From: Shawn Jin @ 2005-03-31 23:24 UTC (permalink / raw)
  To: ppcembed

Hi,

Are there any criteria to define things on so many different header
files for 440 family chips? For example, an Ocotea board has the
following header files.

1. <asm/ibm44x.h>
2. <syslib/ibm440gx_common.h>
3. <syslib/ibm44x_common.h>
4. <platforms/4xx/ibm440gx.h>
5. <platforms/4xx/ocotea.h>

I can understand the reasons why there are ibm44x.h, ibm440gx.h, and
ocotea.h. But why do we need to separate ibm44x_common.h from ibm44x.h
and ibm440gx.h from ibm440gx_common.h? Can we just simply combine them
together? It's a little confusing on what definitions and declarations
should be which files.

Is there any guildeline saying what header file should be in
<asm-ppc/*>, <syslib/*>, or <platforms/4xx/*>?

Any explanations?

Thanks,
-Shawn.

^ permalink raw reply

* Re: 440EP FPU patch
From: Kumar Gala @ 2005-03-31 23:10 UTC (permalink / raw)
  To: Tom Rini; +Cc: linuxppc-embedded Linux list
In-Reply-To: <20050331201548.GK25923@smtp.west.cox.net>

I'll try to see if I can build a kernel to use on a pegasos box to test=20=

out the avec side tomorrow.

- kumar

On Mar 31, 2005, at 2:15 PM, Tom Rini wrote:

> On Thu, Mar 31, 2005 at 01:10:44PM -0700, Matt wrote:
>  > On Thu, Mar 31, 2005 at 09:34:21AM -0700, Tom Rini wrote:
>  > > On Thu, Mar 31, 2005 at 09:26:18AM -0700, Wade Farnsworth wrote:
>  > > > On Fri, 2005-03-18 at 12:30, Tom Rini wrote:
>  > > > > On Fri, Mar 18, 2005 at 01:43:11PM -0500, Jason McMullan=20
> wrote:
>  > > > > > On Fri, 2005-03-18 at 10:06 -0600, Kumar Gala wrote:
>  > > > > > > Can you build your patch for the lopec_defconfig and fix=20=

> the errors
> > > > > > > associated with enabling altivec.
>  > > > > > >
> > > > > > > Looks like you need to include asm/offset.h & asm/page.h=20=

> in vector.S,
> > > > > > > however there is another build error after that.
>  > > > > >
> > > > > > Thanks! That also found a linking bug, fixed in this patch..=20=

> Please
> > > > > > double check the call in 'AltiVecUnavalible' in head.S, and=20=

> the re-load
>  > > > > > of 'ctr' at the end of load_up_altivec, as I do not have an=20=

> AltiVec
>  > > > > > machine here.
>  > > > >
> > > > > No dice:
>  > > > > VFS: Mounted root (nfs filesystem) readonly.
>  > > > > Freeing unused kernel memory: 100k init 4k prep
>  > > > > floating point used in kernel (task=3Dc03816b0, pc=3Dc000d664)
> > > > > Doing some objdump'ing, that's the start of load_up_altivec.
> > > >
> > > > Hi Jason and Tom,
>  > > >
> > > > Has there been any more progress on this patch?
>  > >
> > > Sadly no.=A0 We got to the point where it was reliably crashing on =
my
> > > LoPEC (7400), but no time to try and fix it.=A0 The problem should=20=

> show up
>  > > on any classic PPC box..
>  >
> > If nobody has time to work on this, then I intend=A0 to put Wade's=20=

> 440EP
>  > support in as is (actually, he's planning on resubmitting with some
>  > additional changes).=A0 When somebody has time, they can redo the=20=

> patch
> > against that.
>
> That's a good point to bring up.=A0 Jason, do you want to post your
>  current version to the list and we can try and see if we can get it
>  workign right?
>
> --=20
> Tom Rini
>  http://gate.crashing.org/~trini/
> _______________________________________________
> Linuxppc-embedded mailing list
>  Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded

^ permalink raw reply

* Re: [PATCH 2.6.10-rc2] ppc32: Add usb support to IBM stb04xxx platforms
From: Eugene Surovegin @ 2005-03-31 21:08 UTC (permalink / raw)
  To: Dale Farnsworth; +Cc: linuxppc-embedded
In-Reply-To: <20050331204729.GA29785@xyzzy>

On Thu, Mar 31, 2005 at 01:47:30PM -0700, Dale Farnsworth wrote:

[snip]

> ===================================================================
> --- linux-2.5-usb-405.orig/arch/ppc/platforms/4xx/redwood5.c
> +++ linux-2.5-usb-405/arch/ppc/platforms/4xx/redwood5.c
> @@ -52,8 +52,18 @@
>  void __init
>  redwood5_setup_arch(void)
>  {
> +	u32 mask;
> +
>  	ppc4xx_setup_arch();
>  
> +	/*
> +	 * Set up USB interrupt as positive polarity and level-sensitive.
> +	 * Firmware should do this, but apparently does not.
> +	 */
> +	mask = 1 << (31 - USB0_IRQ);
> +	mtdcr(DCRN_UIC_PR(UIC0), mfdcr(DCRN_UIC_PR(UIC0)) | mask);
> +	mtdcr(DCRN_UIC_TR(UIC0), mfdcr(DCRN_UIC_TR(UIC0)) & ~mask);
> +
>  #ifdef CONFIG_DEBUG_BRINGUP
>  	printk("\n");
>  	printk("machine\t: %s\n", PPC4xx_MACHINE_NAME);

Dale, please, don't mess with UIC registers directly, there is a 
cleaner way to set this up. 

Take a look at how this is done in other 4xx ports
(ppc4xx_core_uic_cfg & ppc4xx_uic_ext_irq_cfg).

--
Eugene

^ permalink raw reply

* [PATCH 2.6.10-rc2] ppc32: Add platform data definition used by ohci-ppc-soc.c
From: Dale Farnsworth @ 2005-03-31 20:49 UTC (permalink / raw)
  To: linuxppc-embedded

This structure allows for callbacks into platform-specific code when the
driver is started or stopped.  This file is currently included by
drivers/usb/host/ohci-ppc-soc.c, so it's needed for USB on the stb04xxx,
mpc52xx, and 440EP.

Signed-off-by: Dale Farnsworth <dale@farnsworth.org>

Index: linux-2.5-usb-405/include/asm-ppc/usb.h
===================================================================
--- /dev/null
+++ linux-2.5-usb-405/include/asm-ppc/usb.h
@@ -0,0 +1,13 @@
+/*
+ * ppc/usb.h:
+ *
+ */
+#ifndef _PPC_USB_H
+#define _PPC_USB_H
+
+struct usb_hcd_platform_data {
+	int (*start) (struct platform_device *pdev);
+	void (*stop) (struct platform_device *pdev);
+};
+
+#endif /* !(_PPC_USB_H) */

^ permalink raw reply

* [PATCH 2.6.10-rc2] ppc32: Add usb support to IBM stb04xxx platforms
From: Dale Farnsworth @ 2005-03-31 20:47 UTC (permalink / raw)
  To: linuxppc-embedded

Signed-off-by: Dale Farnsworth <dale@farnsworth.org>

Index: linux-2.5-usb-405/arch/ppc/platforms/4xx/ibmstb4.c
===================================================================
--- linux-2.5-usb-405.orig/arch/ppc/platforms/4xx/ibmstb4.c
+++ linux-2.5-usb-405/arch/ppc/platforms/4xx/ibmstb4.c
@@ -72,12 +72,43 @@
 	  .irq		= IDE0_IRQ,
 	  .pm		= OCP_CPM_NA,
 	},
-	{ .vendor	= OCP_VENDOR_IBM,
-	  .function	= OCP_FUNC_USB,
-	  .paddr	= USB0_BASE,
-	  .irq		= USB0_IRQ,
-	  .pm		= OCP_CPM_NA,
-	},
 	{ .vendor	= OCP_VENDOR_INVALID,
 	}
 };
+
+static struct resource ohci_usb_resources[] = {
+	[0] = {
+		.start	= USB0_BASE,
+		.end	= USB0_BASE + USB0_SIZE - 1,
+		.flags	= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start	= USB0_IRQ,
+		.end	= USB0_IRQ,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static u64 dma_mask = 0xffffffffULL;
+
+static struct platform_device ohci_usb_device = {
+	.name		= "ppc-soc-ohci",
+	.id		= 0,
+	.num_resources	= ARRAY_SIZE(ohci_usb_resources),
+	.resource	= ohci_usb_resources,
+	.dev		= {
+		.dma_mask = &dma_mask,
+		.coherent_dma_mask = 0xffffffffULL,
+	}
+};
+
+static struct platform_device *ibmstb4_devs[] __initdata = {
+	&ohci_usb_device,
+};
+
+static int __init
+ibmstb4_platform_add_devices(void)
+{
+	return platform_add_devices(ibmstb4_devs, ARRAY_SIZE(ibmstb4_devs));
+}
+arch_initcall(ibmstb4_platform_add_devices);
Index: linux-2.5-usb-405/arch/ppc/platforms/4xx/ibmstb4.h
===================================================================
--- linux-2.5-usb-405.orig/arch/ppc/platforms/4xx/ibmstb4.h
+++ linux-2.5-usb-405/arch/ppc/platforms/4xx/ibmstb4.h
@@ -73,9 +73,9 @@
 #define OPB0_BASE	0x40000000
 #define GPIO0_BASE	0x40060000
 
+#define USB0_BASE	0x40010000
+#define USB0_SIZE	0xA0
 #define USB0_IRQ	18
-#define USB0_BASE	STB04xxx_MAP_IO_ADDR(0x40010000)
-#define USB0_EXTENT 4096
 
 #define IIC_NUMS 2
 #define UART_NUMS	3
Index: linux-2.5-usb-405/arch/ppc/platforms/4xx/redwood5.c
===================================================================
--- linux-2.5-usb-405.orig/arch/ppc/platforms/4xx/redwood5.c
+++ linux-2.5-usb-405/arch/ppc/platforms/4xx/redwood5.c
@@ -52,8 +52,18 @@
 void __init
 redwood5_setup_arch(void)
 {
+	u32 mask;
+
 	ppc4xx_setup_arch();
 
+	/*
+	 * Set up USB interrupt as positive polarity and level-sensitive.
+	 * Firmware should do this, but apparently does not.
+	 */
+	mask = 1 << (31 - USB0_IRQ);
+	mtdcr(DCRN_UIC_PR(UIC0), mfdcr(DCRN_UIC_PR(UIC0)) | mask);
+	mtdcr(DCRN_UIC_TR(UIC0), mfdcr(DCRN_UIC_TR(UIC0)) & ~mask);
+
 #ifdef CONFIG_DEBUG_BRINGUP
 	printk("\n");
 	printk("machine\t: %s\n", PPC4xx_MACHINE_NAME);

^ permalink raw reply

* Re: [PATCH 2.6.11.6] CPM2 Timers API
From: Jason McMullan @ 2005-03-31 20:33 UTC (permalink / raw)
  To: linuxppc-embedded
In-Reply-To: <1112298886.3337.14.camel@ad.doubleclick.net>


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

A brown bag error handling and Lindent patch, to be applied in that
order, to my previous CPM timers patch.


-- 
Jason McMullan <jason.mcmullan@timesys.com>
TimeSys Corporation


[-- Attachment #1.2: cpm-timer.brown-bag.patch --]
[-- Type: text/x-patch, Size: 638 bytes --]

--- linux-2.6.patch/arch/ppc/syslib/cpm_timer.c.orig	2005-03-31 14:50:29.000000000 -0500
+++ linux-2.6.patch/arch/ppc/syslib/cpm_timer.c	2005-03-31 15:01:39.417496033 -0500
@@ -114,12 +114,16 @@
 
 	tm->start = (timer_id>>4)&0xf;
 	tm->end   = timer_id & 0xf;
-	if (tm->start > 3)
+	if (tm->start > 3) {
+		kfree(tm);
 		return -EINVAL;
+	}
 
 	if ((tm->end != tm->start) && 
-	    ((tm->start & 1) || (tm->end != (tm->start+1))))
-	    return -EINVAL;
+	    ((tm->start & 1) || (tm->end != (tm->start+1)))) {
+		kfree(tm);
+		return -EINVAL;
+	}
 
 	err = request_resource(&cpm_timer_resource,tm);
 	if (err < 0) {

[-- Attachment #1.3: cpm-timer.lindent.patch --]
[-- Type: text/x-patch, Size: 7152 bytes --]

--- linux-2.6/arch/ppc/syslib/cpm_timer.c	2005-03-31 15:15:59.100629916 -0500
+++ linux-2.6.patch/arch/ppc/syslib/cpm_timer.c	2005-03-31 15:15:38.838272681 -0500
@@ -42,7 +42,7 @@
 static struct resource cpm_timer_resource = {
 	.name = "CPM Timers",
 	.start = 0,
-	.end   = 3,
+	.end = 3,
 };
 
 static struct cpm_timer_s {
@@ -101,52 +101,56 @@
  * Returns 0 on success, -errno on error
  */
 EXPORT_SYMBOL(cpm_timer_alloc);
-int cpm_timer_alloc(int timer_id, cpm_timer_t *ptm)
+int cpm_timer_alloc(int timer_id, cpm_timer_t * ptm)
 {
 	struct resource *tm;
 	int err;
 	uint16_t mask;
-      
-	tm = kmalloc(sizeof(struct resource)+16, GFP_KERNEL);
-	memset(tm,0,sizeof(struct resource)+16);
+
+	tm = kmalloc(sizeof(struct resource) + 16, GFP_KERNEL);
+	memset(tm, 0, sizeof(struct resource) + 16);
 	if (tm == NULL)
 		return -ENOMEM;
 
-	tm->start = (timer_id>>4)&0xf;
-	tm->end   = timer_id & 0xf;
+	tm->start = (timer_id >> 4) & 0xf;
+	tm->end = timer_id & 0xf;
 	if (tm->start > 3) {
 		kfree(tm);
 		return -EINVAL;
 	}
 
-	if ((tm->end != tm->start) && 
-	    ((tm->start & 1) || (tm->end != (tm->start+1)))) {
+	if ((tm->end != tm->start) &&
+	    ((tm->start & 1) || (tm->end != (tm->start + 1)))) {
 		kfree(tm);
 		return -EINVAL;
 	}
 
-	err = request_resource(&cpm_timer_resource,tm);
+	err = request_resource(&cpm_timer_resource, tm);
 	if (err < 0) {
 		kfree(tm);
 		return err;
 	}
 
-	*ptm = (cpm_timer_t)(tm);
+	*ptm = (cpm_timer_t) (tm);
 
 	tm->name = ((void *)tm) + sizeof(struct resource);
 	if (tm->start == tm->end) {
-		sprintf((char *)tm->name,"timer%ld",tm->start+1);
+		sprintf((char *)tm->name, "timer%ld", tm->start + 1);
 	} else {
-		sprintf((char *)tm->name,"timer%ld-%ld",tm->start+1,tm->end+1);
+		sprintf((char *)tm->name, "timer%ld-%ld", tm->start + 1,
+			tm->end + 1);
 	}
 
-	err = request_irq(cpm_timer[tm->end].irq,cpm_timer_irq,SA_INTERRUPT,tm->name,&cpm_timer[tm->end]);
+	err =
+	    request_irq(cpm_timer[tm->end].irq, cpm_timer_irq, SA_INTERRUPT,
+			tm->name, &cpm_timer[tm->end]);
 	if (err < 0) {
-		printk(KERN_ERR "CPM Timer %s: Can't allocate IRQ %d.\n",tm->name,cpm_timer[tm->end].irq);
+		printk(KERN_ERR "CPM Timer %s: Can't allocate IRQ %d.\n",
+		       tm->name, cpm_timer[tm->end].irq);
 	}
 
 	/* Step 1 - enable and stop the timer */
-	mask = (TGCR_RST|TGCR_STP) << (4*((tm->end)&1));
+	mask = (TGCR_RST | TGCR_STP) << (4 * ((tm->end) & 1));
 	if (tm->start < 2) {
 		timer_base->cpmt_tgcr1 |= mask;
 	} else {
@@ -188,7 +192,7 @@
 	uint16_t mask;
 
 	cpm_timer_stop(tm);
-	free_irq(cpm_timer[tm->end].irq,&cpm_timer[tm->end]);
+	free_irq(cpm_timer[tm->end].irq, &cpm_timer[tm->end]);
 	if (tm->start != tm->end) {
 		if (tm->start == 0) {
 			timer_base->cpmt_tgcr1 &= ~(TGCR_CAS << 4);
@@ -199,8 +203,8 @@
 	wmb();
 
 	/* Disable the timer */
-	mask = (TGCR_RST << (4*((tm->start)&1))) |
-	       (TGCR_RST << (4*((tm->end)&1)));
+	mask = (TGCR_RST << (4 * ((tm->start) & 1))) |
+	    (TGCR_RST << (4 * ((tm->end) & 1)));
 	if (tm->start < 2) {
 		timer_base->cpmt_tgcr1 &= ~mask;
 	} else {
@@ -219,7 +223,7 @@
 {
 	uint8_t mask;
 
-	mask = (TGCR_STP << (4*((tm->end)&1)));
+	mask = (TGCR_STP << (4 * ((tm->end) & 1)));
 	if (tm->start < 2) {
 		timer_base->cpmt_tgcr1 |= mask;
 	} else {
@@ -236,7 +240,7 @@
 {
 	uint8_t mask;
 
-	mask = (TGCR_STP << (4*((tm->end)&1)));
+	mask = (TGCR_STP << (4 * ((tm->end) & 1)));
 	if (tm->start < 2) {
 		timer_base->cpmt_tgcr1 &= ~mask;
 	} else {
@@ -256,7 +260,7 @@
 	int mask;
 	int tmr;
 
-	mask = ((TGCR_STP|TGCR_RST) << (4*((tm->end)&1)));
+	mask = ((TGCR_STP | TGCR_RST) << (4 * ((tm->end) & 1)));
 	tmr = *cpm_timer[tm->end].ctrl.tmr;
 
 	if (tm->start < 2) {
@@ -290,9 +294,9 @@
 	/* For the mpc85xx, we're just using core frequency/16
 	 */
 	extern unsigned char __res[];
-	bd_t *bd = (bd_t *)__res;
+	bd_t *bd = (bd_t *) __res;
 
-	return bd->bi_busfreq/1000000*16;
+	return bd->bi_busfreq / 1000000 * 16;
 }
 
 /* Get the timer value, in ticks
@@ -317,7 +321,8 @@
  * You cannot call cpm_timer_free() within that context.
  */
 
-static int cpm_timer_call_common(cpm_timer_t tm, unsigned long ticks, cpm_timer_f func, void *func_data)
+static int cpm_timer_call_common(cpm_timer_t tm, unsigned long ticks,
+				 cpm_timer_f func, void *func_data)
 {
 	if (cpm_timer[tm->start].func != NULL)
 		return -EBUSY;
@@ -347,15 +352,15 @@
 	return 0;
 }
 
-
 /* This is the one-shot timer.
  */
 EXPORT_SYMBOL(cpm_timer_call_once);
-int cpm_timer_call_once(cpm_timer_t tm, unsigned long ticks, cpm_timer_f func, void *func_data)
+int cpm_timer_call_once(cpm_timer_t tm, unsigned long ticks, cpm_timer_f func,
+			void *func_data)
 {
 	int err;
 
-	err = cpm_timer_call_common(tm,ticks,func,func_data);
+	err = cpm_timer_call_common(tm, ticks, func, func_data);
 	if (err < 0)
 		return err;
 
@@ -363,16 +368,16 @@
 
 	return 0;
 }
-	
 
 /* This is the repeat-timer function
  */
 EXPORT_SYMBOL(cpm_timer_call_every);
-int cpm_timer_call_every(cpm_timer_t tm, unsigned long ticks, cpm_timer_f func, void *func_data)
+int cpm_timer_call_every(cpm_timer_t tm, unsigned long ticks, cpm_timer_f func,
+			 void *func_data)
 {
 	int err;
 
-	err = cpm_timer_call_common(tm,ticks,func,func_data);
+	err = cpm_timer_call_common(tm, ticks, func, func_data);
 	if (err < 0)
 		return err;
 
@@ -380,7 +385,7 @@
 
 	return 0;
 }
-	
+
 /* Cancel any pending timer functions
  */
 EXPORT_SYMBOL(cpm_timer_call_none);
@@ -411,10 +416,10 @@
 }
 
 static struct file_operations proc_cpm_timer_operations = {
-	.open		= cpm_timer_open,
-	.read		= seq_read,
-	.llseek		= seq_lseek,
-	.release	= seq_release,
+	.open = cpm_timer_open,
+	.read = seq_read,
+	.llseek = seq_lseek,
+	.release = seq_release,
 };
 
 static int __init cpm_timer_proc_init(void)
@@ -432,13 +437,13 @@
 	remove_proc_entry("cpm-timer", NULL);
 }
 
-#endif /* CONFIG_PROC_FS */
+#endif				/* CONFIG_PROC_FS */
 
 static int __devinit cpm_timer_probe(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	int i;
-	struct resource *res,*irqs;
+	struct resource *res, *irqs;
 
 	if (timer_base != NULL)
 		return -EBUSY;
@@ -448,10 +453,10 @@
 		return -EINVAL;
 
 	irqs = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-	if (res == NULL || ((irqs->end+1)-irqs->start) != 4)
+	if (res == NULL || ((irqs->end + 1) - irqs->start) != 4)
 		return -EINVAL;
 
-	timer_base = ioremap(res->start,sizeof(cpmtimer_cpm2_t));
+	timer_base = ioremap(res->start, sizeof(cpmtimer_cpm2_t));
 	if (timer_base == NULL)
 		return -ENOMEM;
 
@@ -477,8 +482,8 @@
 	CPM_TIMER_D_SETUP(tcn);
 
 	for (i = 0; i < 4; i++) {
-		sprintf(cpm_timer[i].name,"CPM Timer %d",i+1);
-		cpm_timer[i].irq = irqs->start+i;
+		sprintf(cpm_timer[i].name, "CPM Timer %d", i + 1);
+		cpm_timer[i].irq = irqs->start + i;
 	}
 
 #ifdef CONFIG_PROC_FS
@@ -522,5 +527,3 @@
 
 module_init(cpm_timer_init);
 module_exit(cpm_timer_exit);
-
-

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: 440EP FPU patch
From: Tom Rini @ 2005-03-31 20:15 UTC (permalink / raw)
  To: Matt, Jason McMullan; +Cc: linuxppc-embedded Linux list
In-Reply-To: <20050331131044.A29501@cox.net>

On Thu, Mar 31, 2005 at 01:10:44PM -0700, Matt wrote:
> On Thu, Mar 31, 2005 at 09:34:21AM -0700, Tom Rini wrote:
> > On Thu, Mar 31, 2005 at 09:26:18AM -0700, Wade Farnsworth wrote:
> > > On Fri, 2005-03-18 at 12:30, Tom Rini wrote:
> > > > On Fri, Mar 18, 2005 at 01:43:11PM -0500, Jason McMullan wrote:
> > > > > On Fri, 2005-03-18 at 10:06 -0600, Kumar Gala wrote:
> > > > > > Can you build your patch for the lopec_defconfig and fix the errors 
> > > > > > associated with enabling altivec.
> > > > > > 
> > > > > > Looks like you need to include asm/offset.h & asm/page.h in vector.S, 
> > > > > > however there is another build error after that.
> > > > > 
> > > > > Thanks! That also found a linking bug, fixed in this patch.. Please
> > > > > double check the call in 'AltiVecUnavalible' in head.S, and the re-load
> > > > > of 'ctr' at the end of load_up_altivec, as I do not have an AltiVec
> > > > > machine here.
> > > > 
> > > > No dice:
> > > > VFS: Mounted root (nfs filesystem) readonly.
> > > > Freeing unused kernel memory: 100k init 4k prep
> > > > floating point used in kernel (task=c03816b0, pc=c000d664)
> > > > Doing some objdump'ing, that's the start of load_up_altivec.
> > > 
> > > Hi Jason and Tom,
> > > 
> > > Has there been any more progress on this patch?
> > 
> > Sadly no.  We got to the point where it was reliably crashing on my
> > LoPEC (7400), but no time to try and fix it.  The problem should show up
> > on any classic PPC box..
> 
> If nobody has time to work on this, then I intend  to put Wade's 440EP
> support in as is (actually, he's planning on resubmitting with some
> additional changes).  When somebody has time, they can redo the patch
> against that.

That's a good point to bring up.  Jason, do you want to post your
current version to the list and we can try and see if we can get it
workign right?

-- 
Tom Rini
http://gate.crashing.org/~trini/

^ permalink raw reply

* Re: Overcommit (OOM) problem on embedded device (PPChameleon)
From: Martin Egholm Nielsen @ 2005-03-31 20:13 UTC (permalink / raw)
  To: linuxppc-embedded
In-Reply-To: <ORION1DXU7J3Ty2cTBM000000a9@orion1.ariodata.com>

Hi David,

>>>Look in mm/mmap.c and search for overcommit_memory, then do same
>>>in the sources for your redhat kernels.
>>I'll look into RH kernel to see if it isn't like you say :-)
>>>Perhaps there's a patch for it floating around somewhere? ;-)
>>Now, that would be really nice.
>>Though I have no idea of where to look!?
> Here is what I do.  Patch is against BK linuxppc-2.4 version 1.1285
> (2.4.28-pre3) but might work.
Well, the patch goes straight into my 2.4.20 ppc-kernel - but we have to 
wait until tomorrow to see if it does the magic.

> Burns 5% of the RAM but alternatives all seem worse and I never
I can live with that (3%)...

> If you find out why RH works it would be interesting ... perhaps
> there is a better way.
I downloaded the 2.4.20-10 kernel SRPM from RH8 - it contains all the 
patches they apply to the serene 2.4.20 kernel.
There is some stuff regarding introducing the 
"overcommit_memory_accounting" variable from the 2.5 kernel, but I 
haven't looked into it in depth.

I'll try with your patch first :-)

BR,
  Martin Egholm

> #
> # mm/mmap.c
> #   Add pessimistic overcommit mode similar to 2.6 mode 2.
> #   This allows malloc aka sbrk() to actually fail before
> #   process is killed.
> #   Overloaded sysctl_overcommit_memory to be both enable
> #   and ratio to avoid making a new sysctl.
> # 
> diff -Nru a/mm/mmap.c b/mm/mmap.c
> --- a/mm/mmap.c	2005-03-30 07:15:13 -08:00
> +++ b/mm/mmap.c	2005-03-30 07:15:13 -08:00
> @@ -45,9 +45,13 @@
>  	__S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111
>  };
>  
> -int sysctl_overcommit_memory;
> +int sysctl_overcommit_memory = 98;
> +
>  int max_map_count = DEFAULT_MAX_MAP_COUNT;
>  
> +extern unsigned long totalram_pages;
> +extern unsigned long totalhigh_pages;
> +
>  /* Check that a process has enough memory to allocate a
>   * new virtual mapping.
>   */
> @@ -66,7 +70,7 @@
>  	unsigned long free;
>  	
>          /* Sometimes we want to use more memory than we have. */
> -	if (sysctl_overcommit_memory)
> +	if (sysctl_overcommit_memory == 1)
>  	    return 1;
>  
>  	/* The page cache contains buffer pages these days.. */
> @@ -91,7 +95,20 @@
>  	free += (dentry_stat.nr_unused * sizeof(struct dentry)) >>
> PAGE_SHIFT;
>  	free += (inodes_stat.nr_unused * sizeof(struct inode)) >>
> PAGE_SHIFT;
>  
> +	/*
> +	 * Leave the last 3% for root
> +	 */
> +	if (current->euid)
> +		free -= free / 32;
> +
> +	/* Strict mode do not allocate last bit of memory */
> +	if (sysctl_overcommit_memory) {
> +		pages += (totalram_pages - totalhigh_pages)
> +			* (100 - sysctl_overcommit_memory) / 100;
> +	}
> +
>  	return free > pages;
> +
>  }
>  
>  /* Remove one vm structure from the inode's i_mapping address space. */
> 
> 
> 

^ permalink raw reply

* Re: 440EP FPU patch
From: Matt @ 2005-03-31 20:10 UTC (permalink / raw)
  To: Tom Rini; +Cc: linuxppc-embedded Linux list
In-Reply-To: <20050331163420.GI25923@smtp.west.cox.net>

On Thu, Mar 31, 2005 at 09:34:21AM -0700, Tom Rini wrote:
> On Thu, Mar 31, 2005 at 09:26:18AM -0700, Wade Farnsworth wrote:
> > On Fri, 2005-03-18 at 12:30, Tom Rini wrote:
> > > On Fri, Mar 18, 2005 at 01:43:11PM -0500, Jason McMullan wrote:
> > > > On Fri, 2005-03-18 at 10:06 -0600, Kumar Gala wrote:
> > > > > Can you build your patch for the lopec_defconfig and fix the errors 
> > > > > associated with enabling altivec.
> > > > > 
> > > > > Looks like you need to include asm/offset.h & asm/page.h in vector.S, 
> > > > > however there is another build error after that.
> > > > 
> > > > Thanks! That also found a linking bug, fixed in this patch.. Please
> > > > double check the call in 'AltiVecUnavalible' in head.S, and the re-load
> > > > of 'ctr' at the end of load_up_altivec, as I do not have an AltiVec
> > > > machine here.
> > > 
> > > No dice:
> > > VFS: Mounted root (nfs filesystem) readonly.
> > > Freeing unused kernel memory: 100k init 4k prep
> > > floating point used in kernel (task=c03816b0, pc=c000d664)
> > > Doing some objdump'ing, that's the start of load_up_altivec.
> > 
> > Hi Jason and Tom,
> > 
> > Has there been any more progress on this patch?
> 
> Sadly no.  We got to the point where it was reliably crashing on my
> LoPEC (7400), but no time to try and fix it.  The problem should show up
> on any classic PPC box..

If nobody has time to work on this, then I intend  to put Wade's 440EP
support in as is (actually, he's planning on resubmitting with some
additional changes).  When somebody has time, they can redo the patch
against that.

-Matt

^ permalink raw reply

* [PATCH 2.6.11.6] CPM2 Timers API
From: Jason McMullan @ 2005-03-31 19:54 UTC (permalink / raw)
  To: linuxppc-embedded


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

Two patches:

cpm-timer.patch:

	The base timers API for CPM2 timers

cpm-timer.mpc85xx-devices.patch:

	MPC85xx support


-- 
Jason McMullan <jason.mcmullan@timesys.com>
TimeSys Corporation


[-- Attachment #1.2: cpm-timer.mpc85xx-devices.patch --]
[-- Type: text/x-patch, Size: 4739 bytes --]

Description: MPC85xx support for CPM2 timers
Date: Thu Mar 31 14:49:49 EST 2005
Patches: linux-2.6.12-rc1.bk
Signed-Off-By: Jason McMullan <jason.mcmullan@timesys.com>

Difference summary:
 arch/ppc/syslib/mpc85xx_devices.c |   25 +++++++++++++++++++++++++
 arch/ppc/syslib/mpc85xx_sys.c     |   17 ++++++++++-------
 include/asm-ppc/mpc85xx.h         |    1 +
 3 files changed, 36 insertions(+), 7 deletions(-)


diff -urN -X /home/jmcmullan/dontdiff linux-2.6/arch/ppc/syslib/mpc85xx_devices.c linux-2.6.patch/arch/ppc/syslib/mpc85xx_devices.c
--- linux-2.6/arch/ppc/syslib/mpc85xx_devices.c	2005-03-31 14:06:04.000000000 -0500
+++ linux-2.6.patch/arch/ppc/syslib/mpc85xx_devices.c	2005-03-31 14:42:42.000000000 -0500
@@ -19,6 +19,8 @@
 #include <linux/serial_8250.h>
 #include <linux/fsl_devices.h>
 #include <asm/mpc85xx.h>
+#include <asm/cpm2.h>
+#include <asm/immap_cpm2.h>
 #include <asm/irq.h>
 #include <asm/ppc_sys.h>
 
@@ -61,8 +63,14 @@
 		.iotype		= UPIO_MEM,
 		.flags		= UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ,
 	},
+	[2] = {
+		.flags = 0
+	}
 };
 
+#define CPM2_OFFSET(t)	((void *)(&((cpm2_map_t *)NULL)->t)-NULL)
+#define CPM2_END(t)	(CPM2_OFFSET(t)+(sizeof(((cpm2_map_t *)NULL)->t))-1)
+
 struct platform_device ppc_sys_platform_devices[] = {
 	[MPC85xx_TSEC1] = {
 		.name = "fsl-gianfar",
@@ -534,6 +542,23 @@
 			},
 		},
 	},
+	[MPC85xx_CPM_TIMER] = {
+		.name = "fsl-cpm-timer",
+		.id = 0,
+		.num_resources	= 2,
+		.resource = (struct resource[]) {
+			{
+				.start	= CPM2_OFFSET(im_cpmtimer),
+				.end	= CPM2_END(im_cpmtimer),
+				.flags	= IORESOURCE_MEM,
+			},
+			{
+				.start	= SIU_INT_TIMER1,
+				.end	= SIU_INT_TIMER4,
+				.flags	= IORESOURCE_IRQ,
+			},
+		},
+	},
 #endif /* CONFIG_CPM2 */
 };
 
diff -urN -X /home/jmcmullan/dontdiff linux-2.6/arch/ppc/syslib/mpc85xx_sys.c linux-2.6.patch/arch/ppc/syslib/mpc85xx_sys.c
--- linux-2.6/arch/ppc/syslib/mpc85xx_sys.c	2005-03-31 14:06:04.000000000 -0500
+++ linux-2.6.patch/arch/ppc/syslib/mpc85xx_sys.c	2005-03-31 14:46:53.768274801 -0500
@@ -36,7 +36,7 @@
 		.ppc_sys_name	= "8560",
 		.mask 		= 0xFFFF0000,
 		.value 		= 0x80700000,
-		.num_devices	= 19,
+		.num_devices	= 20,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC85xx_TSEC1, MPC85xx_TSEC2, MPC85xx_IIC1,
@@ -46,13 +46,14 @@
 			MPC85xx_CPM_SCC2, MPC85xx_CPM_SCC3, MPC85xx_CPM_SCC4,
 			MPC85xx_CPM_FCC1, MPC85xx_CPM_FCC2, MPC85xx_CPM_FCC3,
 			MPC85xx_CPM_MCC1, MPC85xx_CPM_MCC2,
+			MPC85xx_CPM_TIMER,
 		},
 	},
 	{
 		.ppc_sys_name	= "8541",
 		.mask 		= 0xFFFF0000,
 		.value 		= 0x80720000,
-		.num_devices	= 13,
+		.num_devices	= 14,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC85xx_TSEC1, MPC85xx_TSEC2, MPC85xx_IIC1,
@@ -60,13 +61,14 @@
 			MPC85xx_PERFMON, MPC85xx_DUART,
 			MPC85xx_CPM_SPI, MPC85xx_CPM_I2C,
 			MPC85xx_CPM_FCC1, MPC85xx_CPM_FCC2,
+			MPC85xx_CPM_TIMER,
 		},
 	},
 	{
 		.ppc_sys_name	= "8541E",
 		.mask 		= 0xFFFF0000,
 		.value 		= 0x807A0000,
-		.num_devices	= 14,
+		.num_devices	= 15,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC85xx_TSEC1, MPC85xx_TSEC2, MPC85xx_IIC1,
@@ -74,13 +76,14 @@
 			MPC85xx_PERFMON, MPC85xx_DUART, MPC85xx_SEC2,
 			MPC85xx_CPM_SPI, MPC85xx_CPM_I2C,
 			MPC85xx_CPM_FCC1, MPC85xx_CPM_FCC2,
+			MPC85xx_CPM_TIMER,
 		},
 	},
 	{
 		.ppc_sys_name	= "8555",
 		.mask 		= 0xFFFF0000,
 		.value 		= 0x80710000,
-		.num_devices	= 19,
+		.num_devices	= 20,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC85xx_TSEC1, MPC85xx_TSEC2, MPC85xx_IIC1,
@@ -90,14 +93,14 @@
 			MPC85xx_CPM_SCC2, MPC85xx_CPM_SCC3,
 			MPC85xx_CPM_FCC1, MPC85xx_CPM_FCC2,
 			MPC85xx_CPM_SMC1, MPC85xx_CPM_SMC2,
-			MPC85xx_CPM_USB,
+			MPC85xx_CPM_USB, MPC85xx_CPM_TIMER,
 		},
 	},
 	{
 		.ppc_sys_name	= "8555E",
 		.mask 		= 0xFFFF0000,
 		.value 		= 0x80790000,
-		.num_devices	= 20,
+		.num_devices	= 21,
 		.device_list	= (enum ppc_sys_devices[])
 		{
 			MPC85xx_TSEC1, MPC85xx_TSEC2, MPC85xx_IIC1,
@@ -107,7 +110,7 @@
 			MPC85xx_CPM_SCC2, MPC85xx_CPM_SCC3,
 			MPC85xx_CPM_FCC1, MPC85xx_CPM_FCC2,
 			MPC85xx_CPM_SMC1, MPC85xx_CPM_SMC2,
-			MPC85xx_CPM_USB,
+			MPC85xx_CPM_USB, MPC85xx_CPM_TIMER,
 		},
 	},
 	{	/* default match */
diff -urN -X /home/jmcmullan/dontdiff linux-2.6/include/asm-ppc/mpc85xx.h linux-2.6.patch/include/asm-ppc/mpc85xx.h
--- linux-2.6/include/asm-ppc/mpc85xx.h	2005-03-31 14:17:00.000000000 -0500
+++ linux-2.6.patch/include/asm-ppc/mpc85xx.h	2005-03-31 14:36:06.000000000 -0500
@@ -127,6 +127,7 @@
 	MPC85xx_CPM_MCC2,
 	MPC85xx_CPM_SMC1,
 	MPC85xx_CPM_SMC2,
+	MPC85xx_CPM_TIMER,
 };
 
 #endif /* CONFIG_85xx */

[-- Attachment #1.3: cpm-timer.patch --]
[-- Type: text/x-patch, Size: 16394 bytes --]

Description: CPM2 Timers API
Date: Thu Mar 31 14:49:49 EST 2005
Patches: linux-2.6.12-rc1.bk
Signed-Off-By: Jason McMullan <jason.mcmullan@timesys.com>

Difference summary:
 arch/ppc/Kconfig            |    6 
 arch/ppc/syslib/Makefile    |    1 
 arch/ppc/syslib/cpm_timer.c |  522 ++++++++++++++++++++++++++++++++++++++++++++
 include/asm-ppc/cpm_timer.h |   74 ++++++
 4 files changed, 603 insertions(+)

diff -urN -X /home/jmcmullan/dontdiff linux-2.6/arch/ppc/Kconfig linux-2.6.patch/arch/ppc/Kconfig
--- linux-2.6/arch/ppc/Kconfig	2005-03-31 14:05:48.000000000 -0500
+++ linux-2.6.patch/arch/ppc/Kconfig	2005-03-31 14:50:29.192469198 -0500
@@ -713,6 +713,12 @@
 	  you wish to build a kernel for a machine with a CPM2 coprocessor
 	  on it (826x, 827x, 8560).
 
+config CPM_TIMER
+	tristate "CPM2 Timers"
+	depends on 8260 || 85xx
+	help
+	  Includes kernel support for CPM2 timers
+
 config PPC_CHRP
 	bool
 	depends on PPC_MULTIPLATFORM
diff -urN -X /home/jmcmullan/dontdiff linux-2.6/arch/ppc/syslib/cpm_timer.c linux-2.6.patch/arch/ppc/syslib/cpm_timer.c
--- linux-2.6/arch/ppc/syslib/cpm_timer.c	1969-12-31 19:00:00.000000000 -0500
+++ linux-2.6.patch/arch/ppc/syslib/cpm_timer.c	2005-03-31 14:50:29.217463534 -0500
@@ -0,0 +1,522 @@
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/timer.h>
+#include <linux/ioport.h>
+#include <linux/interrupt.h>
+#include <linux/device.h>
+#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
+
+#include <asm/io.h>
+#include <asm/cpm2.h>
+#include <asm/cpm_timer.h>
+#include <asm/delay.h>
+#include <asm/ppcboot.h>
+
+#define TGCR_CAS	0x8
+#define TGCR_GM		0x8
+#define TGCR_STP	0x2
+#define TGCR_RST	0x1
+
+#define TMR_PS_MASK	0xff00
+#define TMR_CE_MASK	0xffc0
+#define   TMR_CE_DISABLE	0x0000
+#define	  TMR_CE_RISING		0x0040
+#define	  TMR_CE_FALLING	0x0080
+#define	  TMR_CE_BOTH		0x00c0
+#define	TMR_OM		0x0020
+#define TMR_ORI		0x0010
+#define TMR_FRR		0x0008
+#define TMR_ICLK_MASK	0x0006
+#define   TMR_ICLK_CASCADED	0x0000
+#define   TMR_ICLK_INTERNAL	0x0002
+#define   TMR_ICLK_INT_DIV_16	0x0004
+#define	  TMR_ICLK_TIN		0x0006
+#define TMR_GE		0x0001
+
+#define TER_REF		0x0002
+#define TER_CAP		0x0001
+
+/* Timer functions
+ */
+static struct resource cpm_timer_resource = {
+	.name = "CPM Timers",
+	.start = 0,
+	.end   = 3,
+};
+
+static struct cpm_timer_s {
+	char name[16];
+	int irq;
+	struct {
+		volatile uint16_t *tmr;
+		volatile uint16_t *ter;
+	} ctrl;
+	union {
+		struct {
+			volatile uint16_t *trr;
+			volatile uint16_t *tcr;
+			volatile uint16_t *tcn;
+		} r16;
+		struct {
+			volatile uint32_t *trr;
+			volatile uint32_t *tcr;
+			volatile uint32_t *tcn;
+		} r32;
+	} data;
+	cpm_timer_f func;
+	void *func_data;
+	int one_shot;
+	cpm_timer_t tm;
+} cpm_timer[4];
+
+static cpmtimer_cpm2_t *timer_base = NULL;
+
+static irqreturn_t cpm_timer_irq(int irq, void *data, struct pt_regs *regs)
+{
+	struct cpm_timer_s *info = data;
+	cpm_timer_f func;
+	uint16_t events = *info->ctrl.ter;
+	void *func_data;
+
+	func_data = info->func_data;	/* Order is important here! */
+	func = info->func;
+	if (info->func) {
+		func(info->tm, func_data);
+	}
+
+	if (info->one_shot) {
+		*info->ctrl.tmr &= ~TMR_ORI;	/* Disable interrupt */
+		info->func = NULL;
+		info->func_data = NULL;
+	}
+
+	*info->ctrl.ter = events;	/* Clear events */
+
+	return IRQ_HANDLED;
+}
+
+/* Allocate a timer.
+ * Pass a timer id, and a reference to a NULL struct resource *
+ * Returns 0 on success, -errno on error
+ */
+EXPORT_SYMBOL(cpm_timer_alloc);
+int cpm_timer_alloc(int timer_id, cpm_timer_t *ptm)
+{
+	struct resource *tm;
+	int err;
+	uint16_t mask;
+      
+	tm = kmalloc(sizeof(struct resource)+16, GFP_KERNEL);
+	memset(tm,0,sizeof(struct resource)+16);
+	if (tm == NULL)
+		return -ENOMEM;
+
+	tm->start = (timer_id>>4)&0xf;
+	tm->end   = timer_id & 0xf;
+	if (tm->start > 3)
+		return -EINVAL;
+
+	if ((tm->end != tm->start) && 
+	    ((tm->start & 1) || (tm->end != (tm->start+1))))
+	    return -EINVAL;
+
+	err = request_resource(&cpm_timer_resource,tm);
+	if (err < 0) {
+		kfree(tm);
+		return err;
+	}
+
+	*ptm = (cpm_timer_t)(tm);
+
+	tm->name = ((void *)tm) + sizeof(struct resource);
+	if (tm->start == tm->end) {
+		sprintf((char *)tm->name,"timer%ld",tm->start+1);
+	} else {
+		sprintf((char *)tm->name,"timer%ld-%ld",tm->start+1,tm->end+1);
+	}
+
+	err = request_irq(cpm_timer[tm->end].irq,cpm_timer_irq,SA_INTERRUPT,tm->name,&cpm_timer[tm->end]);
+	if (err < 0) {
+		printk(KERN_ERR "CPM Timer %s: Can't allocate IRQ %d.\n",tm->name,cpm_timer[tm->end].irq);
+	}
+
+	/* Step 1 - enable and stop the timer */
+	mask = (TGCR_RST|TGCR_STP) << (4*((tm->end)&1));
+	if (tm->start < 2) {
+		timer_base->cpmt_tgcr1 |= mask;
+	} else {
+		timer_base->cpmt_tgcr2 |= mask;
+	}
+
+	cpm_timer[tm->end].func = NULL;
+
+	*cpm_timer[tm->end].ctrl.tmr = TMR_FRR | TMR_ICLK_INT_DIV_16;
+	if (tm->start != tm->end) {
+		if (tm->start == 0) {
+			timer_base->cpmt_tgcr1 |= (TGCR_CAS << 4);
+		} else if (tm->start == 2) {
+			timer_base->cpmt_tgcr2 |= (TGCR_CAS << 4);
+		}
+		*cpm_timer[tm->start].ctrl.tmr = TMR_FRR | TMR_ICLK_INT_DIV_16;
+	} else {
+		if (tm->start < 2) {
+			timer_base->cpmt_tgcr1 &= ~(TGCR_CAS << 4);
+		} else {
+			timer_base->cpmt_tgcr2 &= ~(TGCR_CAS << 4);
+		}
+	}
+
+	cpm_timer[tm->end].tm = tm;
+
+	cpm_timer_reset(tm);
+
+	return 0;
+}
+
+/* Free timer, using cpm_timer_t from cpm_timer_alloc
+ * cpm_timer_free() will stop the timer, and any cycle or one-shot functions
+ * pending.
+ */
+EXPORT_SYMBOL(cpm_timer_free);
+void cpm_timer_free(cpm_timer_t tm)
+{
+	uint16_t mask;
+
+	cpm_timer_stop(tm);
+	free_irq(cpm_timer[tm->end].irq,&cpm_timer[tm->end]);
+	if (tm->start != tm->end) {
+		if (tm->start == 0) {
+			timer_base->cpmt_tgcr1 &= ~(TGCR_CAS << 4);
+		} else if (tm->start == 2) {
+			timer_base->cpmt_tgcr2 &= ~(TGCR_CAS << 4);
+		}
+	}
+	wmb();
+
+	/* Disable the timer */
+	mask = (TGCR_RST << (4*((tm->start)&1))) |
+	       (TGCR_RST << (4*((tm->end)&1)));
+	if (tm->start < 2) {
+		timer_base->cpmt_tgcr1 &= ~mask;
+	} else {
+		timer_base->cpmt_tgcr2 &= ~mask;
+	}
+	wmb();
+
+	release_resource(tm);
+	kfree(tm);
+}
+
+/* Stop the timer
+ */
+EXPORT_SYMBOL(cpm_timer_stop);
+void cpm_timer_stop(cpm_timer_t tm)
+{
+	uint8_t mask;
+
+	mask = (TGCR_STP << (4*((tm->end)&1)));
+	if (tm->start < 2) {
+		timer_base->cpmt_tgcr1 |= mask;
+	} else {
+		timer_base->cpmt_tgcr2 |= mask;
+	}
+	wmb();
+
+}
+
+/* Start the timer
+ */
+EXPORT_SYMBOL(cpm_timer_start);
+void cpm_timer_start(cpm_timer_t tm)
+{
+	uint8_t mask;
+
+	mask = (TGCR_STP << (4*((tm->end)&1)));
+	if (tm->start < 2) {
+		timer_base->cpmt_tgcr1 &= ~mask;
+	} else {
+		timer_base->cpmt_tgcr2 &= ~mask;
+	}
+	wmb();
+}
+
+/* Reset the timer to 0
+ *
+ * Yes, this code looks rather hokey, but evidently tcn is a write-once
+ * register. 
+ */
+EXPORT_SYMBOL(cpm_timer_reset);
+void cpm_timer_reset(cpm_timer_t tm)
+{
+	int mask;
+	int tmr;
+
+	mask = ((TGCR_STP|TGCR_RST) << (4*((tm->end)&1)));
+	tmr = *cpm_timer[tm->end].ctrl.tmr;
+
+	if (tm->start < 2) {
+		timer_base->cpmt_tgcr1 &= ~mask;
+	} else {
+		timer_base->cpmt_tgcr2 &= ~mask;
+	}
+	wmb();
+
+	if (tm->start == tm->end) {
+		*cpm_timer[tm->start].data.r16.tcn = 0;
+	} else {
+		*cpm_timer[tm->start].data.r32.tcn = 0;
+	}
+	wmb();
+
+	if (tm->start < 2) {
+		timer_base->cpmt_tgcr1 |= mask;
+	} else {
+		timer_base->cpmt_tgcr2 |= mask;
+	}
+	wmb();
+	*cpm_timer[tm->end].ctrl.tmr = tmr;
+}
+
+/* Get the timer resolution, in nanoseconds/tick
+ */
+EXPORT_SYMBOL(cpm_timer_get_resolution);
+unsigned long cpm_timer_get_resolution(cpm_timer_t tm)
+{
+	/* For the mpc85xx, we're just using core frequency/16
+	 */
+	extern unsigned char __res[];
+	bd_t *bd = (bd_t *)__res;
+
+	return bd->bi_busfreq/1000000*16;
+}
+
+/* Get the timer value, in ticks
+ */
+EXPORT_SYMBOL(cpm_timer_get_ticks);
+unsigned long cpm_timer_get_ticks(cpm_timer_t tm)
+{
+	unsigned long ticks;
+
+	rmb();
+	if (tm->end != tm->start)
+		ticks = *cpm_timer[tm->start].data.r32.tcn;
+	else
+		ticks = *cpm_timer[tm->start].data.r16.tcn;
+
+	return ticks;
+}
+
+/* Call a function after so many ticks
+ * The function will be called in interrupt context.
+ *
+ * You cannot call cpm_timer_free() within that context.
+ */
+
+static int cpm_timer_call_common(cpm_timer_t tm, unsigned long ticks, cpm_timer_f func, void *func_data)
+{
+	if (cpm_timer[tm->start].func != NULL)
+		return -EBUSY;
+
+	cpm_timer_reset(tm);
+
+	if (tm->start != tm->end) {
+		*cpm_timer[tm->start].data.r32.trr = ticks;
+	} else {
+		*cpm_timer[tm->start].data.r16.trr = ticks & 0xffff;
+	}
+	wmb();
+
+	cpm_timer[tm->end].func = func;
+	cpm_timer[tm->end].func_data = func_data;
+	wmb();
+
+	*cpm_timer[tm->end].ctrl.tmr |= TMR_ORI;
+	if (tm->start != tm->end) {
+		*cpm_timer[tm->start].ctrl.tmr |= TMR_ORI;
+		*cpm_timer[tm->start].ctrl.ter = 0xffff;
+	}
+	*cpm_timer[tm->end].ctrl.ter = 0xffff;
+
+	wmb();
+
+	return 0;
+}
+
+
+/* This is the one-shot timer.
+ */
+EXPORT_SYMBOL(cpm_timer_call_once);
+int cpm_timer_call_once(cpm_timer_t tm, unsigned long ticks, cpm_timer_f func, void *func_data)
+{
+	int err;
+
+	err = cpm_timer_call_common(tm,ticks,func,func_data);
+	if (err < 0)
+		return err;
+
+	cpm_timer[tm->end].one_shot = 1;
+
+	return 0;
+}
+	
+
+/* This is the repeat-timer function
+ */
+EXPORT_SYMBOL(cpm_timer_call_every);
+int cpm_timer_call_every(cpm_timer_t tm, unsigned long ticks, cpm_timer_f func, void *func_data)
+{
+	int err;
+
+	err = cpm_timer_call_common(tm,ticks,func,func_data);
+	if (err < 0)
+		return err;
+
+	cpm_timer[tm->end].one_shot = 0;
+
+	return 0;
+}
+	
+/* Cancel any pending timer functions
+ */
+EXPORT_SYMBOL(cpm_timer_call_none);
+int cpm_timer_call_none(cpm_timer_t tm)
+{
+	cpm_timer[tm->end].one_shot = 1;
+	wmb();
+	cpm_timer[tm->end].func = NULL;
+	wmb();
+	cpm_timer[tm->end].func_data = NULL;
+	wmb();
+
+	return 0;
+}
+
+#ifdef CONFIG_PROC_FS
+
+extern struct seq_operations resource_op;
+
+static int cpm_timer_open(struct inode *inode, struct file *file)
+{
+	int res = seq_open(file, &resource_op);
+	if (!res) {
+		struct seq_file *m = file->private_data;
+		m->private = &cpm_timer_resource;
+	}
+	return res;
+}
+
+static struct file_operations proc_cpm_timer_operations = {
+	.open		= cpm_timer_open,
+	.read		= seq_read,
+	.llseek		= seq_lseek,
+	.release	= seq_release,
+};
+
+static int __init cpm_timer_proc_init(void)
+{
+	struct proc_dir_entry *entry;
+
+	entry = create_proc_entry("cpm-timer", 0, NULL);
+	if (entry)
+		entry->proc_fops = &proc_cpm_timer_operations;
+	return 0;
+}
+
+static void __exit cpm_timer_proc_exit(void)
+{
+	remove_proc_entry("cpm-timer", NULL);
+}
+
+#endif /* CONFIG_PROC_FS */
+
+static int __devinit cpm_timer_probe(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	int i;
+	struct resource *res,*irqs;
+
+	if (timer_base != NULL)
+		return -EBUSY;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (res == NULL)
+		return -EINVAL;
+
+	irqs = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+	if (res == NULL || ((irqs->end+1)-irqs->start) != 4)
+		return -EINVAL;
+
+	timer_base = ioremap(res->start,sizeof(cpmtimer_cpm2_t));
+	if (timer_base == NULL)
+		return -ENOMEM;
+
+#define CPM_TIMER_C_SETUP(field) do {\
+	cpm_timer[0].ctrl.field = &timer_base->cpmt_##field##1; \
+	cpm_timer[1].ctrl.field = &timer_base->cpmt_##field##2; \
+	cpm_timer[2].ctrl.field = &timer_base->cpmt_##field##3; \
+	cpm_timer[3].ctrl.field = &timer_base->cpmt_##field##4; \
+	} while (0)
+
+#define CPM_TIMER_D_SETUP(field) do {\
+	cpm_timer[0].data.r16.field = &timer_base->cpmt_##field##1; \
+	cpm_timer[1].data.r16.field = &timer_base->cpmt_##field##2; \
+	cpm_timer[2].data.r16.field = &timer_base->cpmt_##field##3; \
+	cpm_timer[3].data.r16.field = &timer_base->cpmt_##field##4; \
+	} while (0)
+
+	CPM_TIMER_C_SETUP(tmr);
+	CPM_TIMER_C_SETUP(ter);
+
+	CPM_TIMER_D_SETUP(trr);
+	CPM_TIMER_D_SETUP(tcr);
+	CPM_TIMER_D_SETUP(tcn);
+
+	for (i = 0; i < 4; i++) {
+		sprintf(cpm_timer[i].name,"CPM Timer %d",i+1);
+		cpm_timer[i].irq = irqs->start+i;
+	}
+
+#ifdef CONFIG_PROC_FS
+	cpm_timer_proc_init();
+#endif
+
+	return 0;
+}
+
+static void __devexit cpm_timer_remove(struct device *dev)
+{
+	iounmap(timer_base);
+#ifdef CONFIG_PROC_FS
+	cpm_timer_proc_exit();
+#endif
+}
+
+static struct device_driver cpm_timer_driver = {
+	.name = "fsl-cpm-timer",
+	.bus = &platform_bus_type,
+	.probe = cpm_timer_probe,
+	.remove = __devexit_p(cpm_timer_remove),
+};
+
+static __init int cpm_timer_init(void)
+{
+	printk(KERN_INFO "cpm-timer: CPM2 Timers\n");
+
+	return driver_register(&cpm_timer_driver);
+}
+
+static __exit void cpm_timer_exit(void)
+{
+	driver_unregister(&cpm_timer_driver);
+}
+
+MODULE_LICENSE("GPL");
+
+MODULE_AUTHOR("Jason McMullan <jason.mcmullan@timesys.com>");
+MODULE_DESCRIPTION("CPM2 timer driver");
+
+module_init(cpm_timer_init);
+module_exit(cpm_timer_exit);
+
+
diff -urN -X /home/jmcmullan/dontdiff linux-2.6/arch/ppc/syslib/Makefile linux-2.6.patch/arch/ppc/syslib/Makefile
--- linux-2.6/arch/ppc/syslib/Makefile	2005-03-31 14:06:03.000000000 -0500
+++ linux-2.6.patch/arch/ppc/syslib/Makefile	2005-03-31 14:50:29.211464894 -0500
@@ -84,6 +84,7 @@
 obj-$(CONFIG_PCI_8260)		+= m8260_pci.o indirect_pci.o
 obj-$(CONFIG_8260_PCI9)		+= m8260_pci_erratum9.o
 obj-$(CONFIG_CPM2)		+= cpm2_common.o cpm2_pic.o
+obj-$(CONFIG_CPM_TIMER)		+= cpm_timer.o
 ifeq ($(CONFIG_PPC_GEN550),y)
 obj-$(CONFIG_KGDB)		+= gen550_kgdb.o gen550_dbg.o
 obj-$(CONFIG_SERIAL_TEXT_DEBUG)	+= gen550_dbg.o
diff -urN -X /home/jmcmullan/dontdiff linux-2.6/include/asm-ppc/cpm_timer.h linux-2.6.patch/include/asm-ppc/cpm_timer.h
--- linux-2.6/include/asm-ppc/cpm_timer.h	1969-12-31 19:00:00.000000000 -0500
+++ linux-2.6.patch/include/asm-ppc/cpm_timer.h	2005-03-31 14:50:29.239458550 -0500
@@ -0,0 +1,74 @@
+/* Generic include file for all CPM timer definitions.
+ */
+#ifndef __ASM_CPM_TIMER_H
+#define __ASM_CPM_TIMER_H
+
+#include <linux/config.h>
+#include <linux/ioport.h>
+
+/* Allocate/utilize timers 
+ * There are four 16-bit timers, which can be chained as two 32-bit timers.
+ */
+#define CPM2_TIMER16_1	0x00
+#define CPM2_TIMER16_2	0x11
+#define CPM2_TIMER16_3	0x22
+#define CPM2_TIMER16_4	0x33
+#define CPM2_TIMER32_1	0x01
+#define CPM2_TIMER32_2	0x23
+
+typedef struct resource *cpm_timer_t;
+typedef void (*cpm_timer_f)(cpm_timer_t tm, void *data);
+
+/* Allocate a timer.
+ * Pass a timer id, and a reference to a NULL struct resource *
+ * Returns 0 on success, -errno on error
+ */
+int cpm_timer_alloc(int timer_id, cpm_timer_t *tm);
+
+/* Free timer, using cpm_timer_t from cpm_timer_alloc
+ * cpm_timer_free() will stop the timer, and any cycle or one-shot functions
+ * pending.
+ */
+void cpm_timer_free(cpm_timer_t tm);
+
+/* Stop the timer
+ */
+void cpm_timer_stop(cpm_timer_t tm);
+
+/* Start the timer
+ */
+void cpm_timer_start(cpm_timer_t tm);
+
+/* Reset the timer to 0
+ */
+void cpm_timer_reset(cpm_timer_t tm);
+
+/* Get the timer resolution, in nanoseconds/tick
+ */
+unsigned long cpm_timer_get_resolution(cpm_timer_t tm);
+
+/* Get the timer value, in ticks
+ */
+unsigned long cpm_timer_get_ticks(cpm_timer_t tm);
+
+/* Call a function after so many ticks
+ * The function will be called in interrupt context.
+ *
+ * You cannot call cpm_timer_free() within that context.
+ */
+
+
+/* This is the one-shot timer.
+ */
+int cpm_timer_call_once(cpm_timer_t tm, unsigned long ticks, cpm_timer_f func, void *data);
+
+/* This is the repeat-timer function
+ */
+int cpm_timer_call_every(cpm_timer_t tm, unsigned long ticks, cpm_timer_f func, void *data);
+
+/* Cancel any pending timer functions
+ */
+int cpm_timer_call_none(cpm_timer_t tm);
+
+
+#endif /* __ASM_CPM_TIMER_H */

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* RE: [PATCH] invalid instructions in kernel mode
From: Fillod Stephane @ 2005-03-31 19:17 UTC (permalink / raw)
  To: Dan Malek; +Cc: linuxppc-dev

Hi Dan,

Please be aware I am no expert in that field, so bear with me :)

Dan Malek wrote:
>> When CPU has no (classic) FPU, and math emulation is disabled,
>> fp instructions are not allowed in kernel mode.
>
>FP Instructions are never allowed in kernel mode regardless of the CPU.
>However, with math emulation disabled and no FPU, we still emulate
>FP load/store operations because they are usually hard coded in
>some of the context save/restore functions of the C library.

What I don't understand, is how the FP load/store operations
in misc.S can "work" on a system with no FPU and *no* math-emu?

>> This bug has been found with crashme (crash01) of LTP, on a e500=20
>> system.
>
>What is the bug?  This patch disables a big feature we have been
>using for many years.  Please take another look at this.

Many years? Allow me to doubt it's really used :). I took a better=20
look, at math-emu/math.c. And then I understood why my previous
patch should not have disabled cvt_fd et al in misc.S.

The fact is, with CONFIG_MATH_EMULATION disabled, make does not enter
the math-emu/ subdir, math.c does not get compiled (so no lfs/etc.
emulation), and  by the way, nobody even call do_mathemu in
traps.c because it's always surrounded with #ifdef
CONFIG_MATH_EMULATION.
Though, it does work for 8xx thanks to Soft_emulate_8xx, but doesn't
for other FPU-less cores when CONFIG_MATH_EMULATION is disabled.

So here is another patch, which hopefully is a better fix,
yet find a solution to my problem. Please comment on it,
as I'm not sure whether ProgramCheckException is right.
Rem: it looks weird to use FP load/store operations when
you do know that you don't have a FPU and CONFIG_MATH_EMULATION
is disabled. Should we do like 8xx, and call directly
the emulation layer? Could we re-use Soft_emulate_8xx() (made generic
without the *_8xx_pte) for the 4xx and e500 ?


Signed-off-by: Stephane Fillod <fillods@gmail.com>=20

--- linux/arch/ppc/Makefile	26 Mar 2005 03:28:39 -0000	1.1.1.2
+++ linux/arch/ppc/Makefile	31 Mar 2005 18:59:25 -0000
@@ -55,10 +55,10 @@
 head-$(CONFIG_POWER4)		+=3D arch/ppc/kernel/idle_power4.o
=20
 core-y				+=3D arch/ppc/kernel/ arch/ppc/platforms/
\
-				   arch/ppc/mm/ arch/ppc/lib/
arch/ppc/syslib/
+				   arch/ppc/mm/ arch/ppc/lib/
arch/ppc/syslib/ \
+				   arch/ppc/math-emu/
 core-$(CONFIG_4xx)		+=3D arch/ppc/platforms/4xx/
 core-$(CONFIG_85xx)		+=3D arch/ppc/platforms/85xx/
-core-$(CONFIG_MATH_EMULATION)	+=3D arch/ppc/math-emu/
 core-$(CONFIG_XMON)		+=3D arch/ppc/xmon/
 core-$(CONFIG_APUS)		+=3D arch/ppc/amiga/
 drivers-$(CONFIG_8xx)		+=3D arch/ppc/8xx_io/
--- linux/arch/ppc/kernel/traps.c	30 Mar 2005 16:25:07 -0000
1.3
+++ linux/arch/ppc/kernel/traps.c	31 Mar 2005 18:59:25 -0000
@@ -540,7 +540,6 @@
 	    return;
 #endif /* CONFIG_ADEOS_CORE */
=20
-#ifdef CONFIG_MATH_EMULATION
 	/* (reason & REASON_ILLEGAL) would be the obvious thing here,
 	 * but there seems to be a hardware bug on the 405GP (RevD)
 	 * that means ESR is sometimes set incorrectly - either to
@@ -552,7 +551,6 @@
 		emulate_single_step(regs);
 		return;
 	}
-#endif /* CONFIG_MATH_EMULATION */
=20
 	if (reason & REASON_FP) {
 		/* IEEE FP exception */
--- linux/arch/ppc/kernel/process.c	26 Mar 2005 03:28:20 -0000
1.1.1.2
+++ linux/arch/ppc/kernel/process.c	31 Mar 2005 18:59:25 -0000
@@ -342,7 +342,7 @@
 	printk("\n");
 #ifdef CONFIG_KALLSYMS
 	/*
-	 * Lookup NIP late so we have the best change of getting the
+	 * Lookup NIP late so we have the best chance of getting the
 	 * above info out without failing
 	 */
 	printk("NIP [%08lx] ", regs->nip);



Thanks for the reply
--=20
Stephane

^ permalink raw reply

* Re: 440EP FPU patch
From: Tom Rini @ 2005-03-31 19:04 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-embedded Linux list
In-Reply-To: <b931159370eb09607fdee4a0f438d57f@freescale.com>

On Thu, Mar 31, 2005 at 12:45:44PM -0600, Kumar Gala wrote:
> Tom,
> 
> On Mar 31, 2005, at 10:34 AM, Tom Rini wrote:
> 
> >On Thu, Mar 31, 2005 at 09:26:18AM -0700, Wade Farnsworth wrote:
> > > On Fri, 2005-03-18 at 12:30, Tom Rini wrote:
> > > > On Fri, Mar 18, 2005 at 01:43:11PM -0500, Jason McMullan wrote:
> > > > > On Fri, 2005-03-18 at 10:06 -0600, Kumar Gala wrote:
> > > > > > Can you build your patch for the lopec_defconfig and fix the 
> >errors
> >> > > > associated with enabling altivec.
> > > > > >
> >> > > > Looks like you need to include asm/offset.h & asm/page.h in 
> >vector.S,
> >> > > > however there is another build error after that.
> > > > >
> >> > > Thanks! That also found a linking bug, fixed in this patch.. 
> >Please
> > > > > double check the call in 'AltiVecUnavalible' in head.S, and the 
> >re-load
> > > > > of 'ctr' at the end of load_up_altivec, as I do not have an 
> >AltiVec
> > > > > machine here.
> > > >
> >> > No dice:
> > > > VFS: Mounted root (nfs filesystem) readonly.
> > > > Freeing unused kernel memory: 100k init 4k prep
> > > > floating point used in kernel (task=c03816b0, pc=c000d664)
> >> > Doing some objdump'ing, that's the start of load_up_altivec.
> >>
> >> Hi Jason and Tom,
> > >
> >> Has there been any more progress on this patch?
> >
> >Sadly no.? We got to the point where it was reliably crashing on my
> >LoPEC (7400), but no time to try and fix it.? The problem should show 
> >up
> > on any classic PPC box..
> 
> Is it crashing on just avec code or everything?

That's a good question.  IIRC, I was using a userspace with an
altivec-using setjmp/longjmp, so it could have been Altivec-specific.
I don't have test kernels w/ the patch handy anymore to verify, sorry.

-- 
Tom Rini
http://gate.crashing.org/~trini/

^ permalink raw reply

* Re: PREP sym53c8xx sym53c8xx brokeness due to 2.6.9-rc1-bk1 introduced residual data patch ...
From: Sven Luther @ 2005-03-31 18:45 UTC (permalink / raw)
  To: Tom Rini; +Cc: linuxppc-dev
In-Reply-To: <20050331142813.GH25923@smtp.west.cox.net>

On Thu, Mar 31, 2005 at 07:28:13AM -0700, Tom Rini wrote:
> On Tue, Mar 29, 2005 at 01:23:55AM +0200, Sven Luther wrote:
> > Hello,
> > 
> > I have been investigating the prep breakage of the sym53c8xx driver on my
> > powerstack II in recent kernels, and traced it to the residual data patch,
> > or more exactly to the whole prep_pci.c/prep_setup.c patches that where
> > introduced between 2.6.9-rc1 and 2.6.9-rc1-bk1. I didn't have time to find
> > more details as the patch is not so small, and seems to do many things, and
> > linux.bkbits.net seems done right now.
> > 
> > Mmm, after a bit more of investigation, the changeset breaking it is :
> > 
> > # This is a BitKeeper generated diff -Nru style patch.
> > #
> > # ChangeSet
> > #   2004/08/16 10:35:18-07:00 trini@kernel.crashing.org
> > #   ppc32: On PReP, use residual data for PCI dev -> IRQ, and use it.
> > #
> > #   Signed-off-by: Leigh Brown <leigh@solinno.co.uk>
> > #   Signed-off-by: Tom Rini <trini@kernel.crashing.org>
> > #
> > # include/asm-ppc/residual.h
> > #   2004/08/16 10:35:09-07:00 trini@kernel.crashing.org +7 -0
> > #   This adds a function to use the residual data to determine the IRQ
> > #   for a given PCI device, and changes prep_pcibios_fixup() to use it.
> > #
> > # arch/ppc/platforms/residual.c
> > #   2004/08/16 10:35:09-07:00 trini@kernel.crashing.org +60 -0
> > #   This adds a function to use the residual data to determine the IRQ
> > #   for a given PCI device, and changes prep_pcibios_fixup() to use it.
> > #
> > # arch/ppc/platforms/prep_pci.c
> > #   2004/08/16 10:35:09-07:00 trini@kernel.crashing.org +37 -23
> > #   This adds a function to use the residual data to determine the IRQ
> > #   for a given PCI device, and changes prep_pcibios_fixup() to use it.
> > 
> > Mmm, i guess this makes sense, since it seems the sym53c8xx doesn'y find its
> > irq anymore or something. Tom Rini, or Leigh Brown, do you have any comments
> > on this one ? 
> 
> Well, we'd need to be certain it's this patch.  If it's this patch, I
> think Leigh was suggesting at the time that the fix would be to fixup
> the residual data with the correct information.

I got through all the changesets one by one, and it is most definitively this
one. i unapply it and it works, i apply it and it breaks.

/me went through a couple hours of binary diff in this way monday evening :/

> But what also went in were changes to specific irq maps, based on what
> fixed a given machine for someone else, so one of those changes could
> also be it.

Nope, it is most definitively the patch above which causes the problem.

I believe the new irq setting method is borked somehow.

Friendly,

Sven Luther

^ permalink raw reply

* Re: 440EP FPU patch
From: Kumar Gala @ 2005-03-31 18:45 UTC (permalink / raw)
  To: Tom Rini; +Cc: linuxppc-embedded Linux list
In-Reply-To: <20050331163420.GI25923@smtp.west.cox.net>

Tom,

On Mar 31, 2005, at 10:34 AM, Tom Rini wrote:

> On Thu, Mar 31, 2005 at 09:26:18AM -0700, Wade Farnsworth wrote:
>  > On Fri, 2005-03-18 at 12:30, Tom Rini wrote:
>  > > On Fri, Mar 18, 2005 at 01:43:11PM -0500, Jason McMullan wrote:
>  > > > On Fri, 2005-03-18 at 10:06 -0600, Kumar Gala wrote:
>  > > > > Can you build your patch for the lopec_defconfig and fix the=20=

> errors
> > > > > associated with enabling altivec.
>  > > > >
> > > > > Looks like you need to include asm/offset.h & asm/page.h in=20
> vector.S,
> > > > > however there is another build error after that.
>  > > >
> > > > Thanks! That also found a linking bug, fixed in this patch..=20
> Please
>  > > > double check the call in 'AltiVecUnavalible' in head.S, and the=20=

> re-load
>  > > > of 'ctr' at the end of load_up_altivec, as I do not have an=20
> AltiVec
>  > > > machine here.
>  > >
> > > No dice:
>  > > VFS: Mounted root (nfs filesystem) readonly.
>  > > Freeing unused kernel memory: 100k init 4k prep
>  > > floating point used in kernel (task=3Dc03816b0, pc=3Dc000d664)
> > > Doing some objdump'ing, that's the start of load_up_altivec.
> >
> > Hi Jason and Tom,
>  >
> > Has there been any more progress on this patch?
>
> Sadly no.=A0 We got to the point where it was reliably crashing on my
> LoPEC (7400), but no time to try and fix it.=A0 The problem should =
show=20
> up
>  on any classic PPC box..

Is it crashing on just avec code or everything?

- kumar

^ permalink raw reply

* Re: [PATCH] invalid instructions in kernel mode
From: Dan Malek @ 2005-03-31 18:15 UTC (permalink / raw)
  To: Fillod Stephane; +Cc: linuxppc-dev
In-Reply-To: <1CFEB358338412458B21FAA0D78FE86D4F0D23@rennsmail02.eu.thmulti.com>


On Mar 31, 2005, at 12:47 PM, Fillod Stephane wrote:

> When CPU has no (classic) FPU, and math emulation is disabled,
> fp instructions are not allowed in kernel mode.

FP Instructions are never allowed in kernel mode regardless of the CPU.
However, with math emulation disabled and no FPU, we still emulate
FP load/store operations because they are usually hard coded in
some of the context save/restore functions of the C library.

> This bug has been found with crashme (crash01) of LTP, on a e500 
> system.

What is the bug?  This patch disables a big feature we have been
using for many years.  Please take another look at this.

Thanks.


	-- Dan

^ permalink raw reply

* [PATCH] invalid instructions in kernel mode
From: Fillod Stephane @ 2005-03-31 17:47 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev

Hi,

When CPU has no (classic) FPU, and math emulation is disabled,
fp instructions are not allowed in kernel mode.
This bug has been found with crashme (crash01) of LTP, on a e500 system.

The patch was made against linux 2.6.11.6.
A trivial typo fix has been appended.

Rem: a CONFIG_PPCFPU define could make life easier.


Signed-off-by: Stephane Fillod <fillods@gmail.com>

--- linux/arch/ppc/kernel/align.c	6 Dec 2004 16:18:11 -0000
1.1.1.1
+++ linux/arch/ppc/kernel/align.c	31 Mar 2005 16:33:25 -0000
@@ -333,10 +333,14 @@
 	}
=20
 	if (flags & F) {
+#if !(defined(CONFIG_4xx) || defined(CONFIG_8xx) ||
defined(CONFIG_E500)) || defined(CONFIG_MATH_EMULATION)
 		preempt_disable();
 		if (regs->msr & MSR_FP)
 			giveup_fpu(current);
 		preempt_enable();
+#else
+		return 0;
+#endif
 	}
=20
 	/* If we read the operand, copy it in, else get register values
*/
@@ -366,6 +370,8 @@
 		}
 		break;
=20
+#if !(defined(CONFIG_4xx) || defined(CONFIG_8xx) ||
defined(CONFIG_E500)) || defined(CONFIG_MATH_EMULATION)
+
 	/* Single-precision FP load and store require conversions... */
 	case LD+F+S:
 		preempt_disable();
@@ -379,6 +385,7 @@
 		cvt_df(&data.d, &data.f, &current->thread.fpscr);
 		preempt_enable();
 		break;
+#endif
 	}
=20
 	if (flags & ST) {
--- linux/arch/ppc/kernel/misc.S	26 Mar 2005 03:28:36 -0000
1.1.1.2
+++ linux/arch/ppc/kernel/misc.S	31 Mar 2005 16:33:25 -0000
@@ -1096,7 +1096,8 @@
  * and exceptions as if the cpu had performed the load or store.
  */
=20
-#if defined(CONFIG_4xx) || defined(CONFIG_E500)
+#if !(defined(CONFIG_4xx) || defined(CONFIG_E500) ||
defined(CONFIG_8xx)) ||  defined(CONFIG_MATH_EMULATION)
+#if defined(CONFIG_4xx) || defined(CONFIG_E500)
 _GLOBAL(cvt_fd)
 	lfs	0,0(r3)
 	stfd	0,0(r4)
@@ -1125,6 +1126,7 @@
 	stfd	0,-4(r5)
 	blr
 #endif
+#endif
=20
 /*
  * Create a kernel thread
--- linux/arch/ppc/kernel/process.c	26 Mar 2005 03:28:20 -0000
1.1.1.2
+++ linux/arch/ppc/kernel/process.c	31 Mar 2005 16:33:25 -0000
@@ -342,7 +342,7 @@
 	printk("\n");
 #ifdef CONFIG_KALLSYMS
 	/*
-	 * Lookup NIP late so we have the best change of getting the
+	 * Lookup NIP late so we have the best chance of getting the
 	 * above info out without failing
 	 */
 	printk("NIP [%08lx] ", regs->nip);


Best Regards,

--=20
Stephane

^ permalink raw reply


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