LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 2/3] of: make set_node_proc_entry private to proc_devtree.c
From: Grant Likely @ 2009-12-23 14:48 UTC (permalink / raw)
  To: Jeremy Kerr; +Cc: devicetree-discuss, linuxppc-dev, linux-kernel
In-Reply-To: <1261532718.575722.541804401419.2.gpush@pororo>

On Tue, Dec 22, 2009 at 6:45 PM, Jeremy Kerr <jeremy.kerr@canonical.com> wrote:
> We only need set_node_proc_entry in proc_devtree.c, so move it there.
>
> This fixes the !HAVE_ARCH_DEVTREE_FIXUPS build, as we can't make make
> the definition in linux/of.h conditional on this #define (definitions in
> asm/prom.h can't be exposed to linux/of.h, due to the enforced #include
> ordering).
>
> Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>

A little ugly, but it can probably be refactored and cleaned up later
(like a lot of other things in the merged code).  Otherwise these
three patches look good to me.  I've picked them up into my tree and
I'll push them out soon.

g.

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

^ permalink raw reply

* Re: [PATCH] Make cpu hotplug driver lock part of ppc_md
From: Nathan Fontenot @ 2009-12-23 14:48 UTC (permalink / raw)
  To: michael; +Cc: linuxppc-dev, Andreas Schwab
In-Reply-To: <1261520982.17348.8.camel@concordia>

Michael Ellerman wrote:
> On Tue, 2009-12-22 at 08:45 -0600, Nathan Fontenot wrote:
>> The recently introduced cpu_hotplug_driver_lock used to serialize
>> cpu hotplug operations, namely for the pseries platform, causes a build
>> issue for other platforms.  The base cpu hotplug code attempts
>> to take this lock, but it may not be needed for all platforms.  This patch
>> moves the lock/unlock routines to be part of the ppc_md structure
>> so that platforms needing the lock can take it.  This also makes the
>> previous cpu_hotplug_driver_lock, defined in pseries code, pseries specific.
>>
>> The past failure without this patch was seen when building pmac and may
>> be present in other platform builds.  The error is included below for reference.
>>
>> drivers/built-in.o: In function `.store_online':
>> cpu.c:(.ref.text+0xf5c): undefined reference to `.cpu_hotplug_driver_lock'
>> cpu.c:(.ref.text+0xfc8): undefined reference to `.cpu_hotplug_driver_unlock'
>> make: *** [.tmp_vmlinux1] Error 1
> 
> Why does the pmac code /not/ need a lock? And would it be harmless if it
> was locked too?

The intention of the cpu_hotplug_driver_locks to add additional serialization
during cpu hotplug operations.  For pseries this is used during DLPAR of cpu
operations so that cpu hotplug actions cannot be initiated whiloe a DLPAR
operation is in flight.  For example, during DLPAR add we take the lock while
acquiring the cpu from firmware and updating the device tree with the new
cpu information, after which we hotplug add the cpu to the system.  

There is nothing harmless about taking the lock on all platforms, I was just
trying to avoid taking the lock if the additional serialization is not needed.

> 
> If so, you could just make the mutex available to all powerpc code, and
> rename it, and then we wouldn't need all this jiggery pokery just to
> take & release a lock.

I can make the lock available to all powerpc code and not go through the
ppc_md struct, it makes no difference to me personally.  Of course this would
make all that fun pokery jiggery go away :)

-Nathan

^ permalink raw reply

* Re: Does gpio_to_irq() work for MPC52xx gpios?
From: Bill Gatliff @ 2009-12-23 16:47 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: Linux/PPC Development
In-Reply-To: <87fx72wwpd.fsf@macbook.be.48ers.dk>

Peter Korsgaard wrote:
>
> No (not yet). In Ben's latest pull request there's a patch from me to
> add basic infrastructure for gpio_to_irq(). I've recently added irq
> support to the mpc8xxx driver, but so far nothing has been written for
> 52xx.
>
> http://patchwork.ozlabs.org/patch/41550/
>   

Ok.  I'm taking a look at that code now, planning to adapt it for the
MPC52xx unless someone raises any objections.


b.g.

-- 
Bill Gatliff
bgat@billgatliff.com

^ permalink raw reply

* RE: [PATCH 2/2] Adding PCI-E MSI support for PowerPC 460SX SOC.
From: Tirumala Reddy Marri @ 2009-12-23 17:23 UTC (permalink / raw)
  To: Stefan Roese, linuxppc-dev; +Cc: linuxppc-dev, writetomarri
In-Reply-To: <200912230918.34124.sr@denx.de>

Thanks for the suggestions. I will try remove the extra lines . Add
changes you suggested.
-Marri

-----Original Message-----
From: linuxppc-dev-bounces+tmarri=3Damcc.com@lists.ozlabs.org
[mailto:linuxppc-dev-bounces+tmarri=3Damcc.com@lists.ozlabs.org] On =
Behalf
Of Stefan Roese
Sent: Wednesday, December 23, 2009 12:19 AM
To: linuxppc-dev@lists.ozlabs.org
Cc: linuxppc-dev@ozlabs.org; writetomarri@yahoo.com; Tirumala Reddy
Marri
Subject: Re: [PATCH 2/2] Adding PCI-E MSI support for PowerPC 460SX SOC.

On Wednesday 23 December 2009 08:52:23 tmarri@amcc.com wrote:
> From: Tirumala Marri <tmarri@amcc.com>

Please find some mostly nitpicking comments below.

BTW: Did you already test this on other 4xx platforms, like 440SPe or
405EX?=20
What are your plans here?
=20
> Signed-off-by: Tirumala Marri <tmarri@amcc.com>
> ---
> Kernel version: 2.6.33-rc1
> Testing:
> 	When 460SX configured as root as a end point E1000(Intell
Ethernet card)
> 	was plugged into the one of the PCI-E ports. I was able to run
the traffic
> 	with MSI interrupts.
> ---
>  arch/powerpc/boot/dts/redwood.dts          |   15 ++
>  arch/powerpc/configs/44x/redwood_defconfig |    5 +-
>  arch/powerpc/platforms/44x/Kconfig         |    1 +
>  arch/powerpc/sysdev/Kconfig                |    7 +
>  arch/powerpc/sysdev/Makefile               |    1 +
>  arch/powerpc/sysdev/ppc4xx_msi.c           |  342
>  ++++++++++++++++++++++++++++ arch/powerpc/sysdev/ppc4xx_msi.h
|=20
>   39 ++++
>  7 files changed, 408 insertions(+), 2 deletions(-)
>  create mode 100644 arch/powerpc/sysdev/ppc4xx_msi.c
>  create mode 100644 arch/powerpc/sysdev/ppc4xx_msi.h
>=20
> diff --git a/arch/powerpc/boot/dts/redwood.dts
>  b/arch/powerpc/boot/dts/redwood.dts index 81636c0..412d5f9 100644
> --- a/arch/powerpc/boot/dts/redwood.dts
> +++ b/arch/powerpc/boot/dts/redwood.dts
> @@ -357,6 +357,21 @@
>  				0x0 0x0 0x0 0x3 &UIC3 0xa 0x4 /*
swizzled int C */
>  				0x0 0x0 0x0 0x4 &UIC3 0xb 0x4 /*
swizzled int D */>;
>  		};
> +  		MSI: ppc4xx-msi@400300000 {
> +  			compatible =3D "amcc,ppc4xx-msi", "ppc4xx-msi";

Better use something like this:

  			compatible =3D "amcc,ppc4xx-msi-ppc460sx",
"amcc,ppc4xx-msi";

This way you could check for 460SX specials in the driver if needed.

> +  			reg =3D < 0x4 0x00300000 0x100
> +  				0x4 0x00300000 0x100>;
> +  			sdr-base =3D <0x3B0>;
> +  			interrupts =3D<0 1 2 3>;
> +  			interrupt-parent =3D <&MSI>;
> +  			#interrupt-cells =3D <1>;
> +  			#address-cells =3D <0>;
> +  			#size-cells =3D <0>;
> +  			interrupt-map =3D <0 &UIC0 0xC 1
> +  				1 &UIC0 0x0D 1
> +  				2 &UIC0 0x0E 1
> +  				3 &UIC0 0x0F 1>;
> +  		};
>=20
>  	};
>=20
> diff --git a/arch/powerpc/configs/44x/redwood_defconfig
>  b/arch/powerpc/configs/44x/redwood_defconfig index ed31d4f..5d16c88
100644
> --- a/arch/powerpc/configs/44x/redwood_defconfig
> +++ b/arch/powerpc/configs/44x/redwood_defconfig
> @@ -158,6 +158,7 @@ CONFIG_DEFAULT_AS=3Dy
>  CONFIG_DEFAULT_IOSCHED=3D"anticipatory"
>  # CONFIG_FREEZER is not set
>  CONFIG_PPC4xx_PCI_EXPRESS=3Dy
> +CONFIG_PPC_MSI_BITMAP=3Dy
>=20
>  #
>  # Platform support
> @@ -264,7 +265,7 @@ CONFIG_PCIEPORTBUS=3Dy
>  CONFIG_PCIEAER=3Dy
>  # CONFIG_PCIEASPM is not set
>  CONFIG_ARCH_SUPPORTS_MSI=3Dy
> -# CONFIG_PCI_MSI is not set
> +CONFIG_PCI_MSI=3Dy
>  # CONFIG_PCI_LEGACY is not set
>  # CONFIG_PCI_DEBUG is not set
>  # CONFIG_PCI_STUB is not set
> @@ -1062,7 +1063,7 @@ CONFIG_PRINT_STACK_DEPTH=3D64
>  # CONFIG_DEBUG_PAGEALLOC is not set
>  # CONFIG_CODE_PATCHING_SELFTEST is not set
>  # CONFIG_FTR_FIXUP_SELFTEST is not set
> -# CONFIG_MSI_BITMAP_SELFTEST is not set
> +CONFIG_MSI_BITMAP_SELFTEST=3Dy
>  # CONFIG_XMON is not set
>  # CONFIG_IRQSTACKS is not set
>  # CONFIG_VIRQ_DEBUG is not set
> diff --git a/arch/powerpc/platforms/44x/Kconfig
>  b/arch/powerpc/platforms/44x/Kconfig index 7486bff..9c3b8ca 100644
> --- a/arch/powerpc/platforms/44x/Kconfig
> +++ b/arch/powerpc/platforms/44x/Kconfig
> @@ -126,6 +126,7 @@ config REDWOOD
>  	select 460SX
>  	select PCI
>  	select PPC4xx_PCI_EXPRESS
> +	select PPC4xx_MSI
>  	help
>  	  This option enables support for the AMCC PPC460SX Redwood
board.
>=20
> diff --git a/arch/powerpc/sysdev/Kconfig b/arch/powerpc/sysdev/Kconfig
> index 3965828..c8f1486 100644
> --- a/arch/powerpc/sysdev/Kconfig
> +++ b/arch/powerpc/sysdev/Kconfig
> @@ -7,8 +7,15 @@ config PPC4xx_PCI_EXPRESS
>  	depends on PCI && 4xx
>  	default n
>=20
> +config PPC4xx_MSI
> +	bool
> +	depends on PCI_MSI
> +	depends on PCI && 4xx
> +	default n
> +
>  config PPC_MSI_BITMAP
>  	bool
>  	depends on PCI_MSI
>  	default y if MPIC
>  	default y if FSL_PCI
> +	default y if PPC4xx_MSI
> diff --git a/arch/powerpc/sysdev/Makefile
b/arch/powerpc/sysdev/Makefile
> index 5642924..4c67d2d 100644
> --- a/arch/powerpc/sysdev/Makefile
> +++ b/arch/powerpc/sysdev/Makefile
> @@ -36,6 +36,7 @@ obj-$(CONFIG_PPC_I8259)		+=3D i8259.o
>  obj-$(CONFIG_IPIC)		+=3D ipic.o
>  obj-$(CONFIG_4xx)		+=3D uic.o
>  obj-$(CONFIG_4xx_SOC)		+=3D ppc4xx_soc.o
> +obj-$(CONFIG_PPC4xx_MSI)		+=3D ppc4xx_msi.o
>  obj-$(CONFIG_XILINX_VIRTEX)	+=3D xilinx_intc.o
>  obj-$(CONFIG_XILINX_PCI)	+=3D xilinx_pci.o
>  obj-$(CONFIG_OF_RTC)		+=3D of_rtc.o
> diff --git a/arch/powerpc/sysdev/ppc4xx_msi.c
>  b/arch/powerpc/sysdev/ppc4xx_msi.c new file mode 100644
> index 0000000..3c2ef32
> --- /dev/null
> +++ b/arch/powerpc/sysdev/ppc4xx_msi.c
> @@ -0,0 +1,342 @@
> +/*
> + * Copyright (C) 2009 Applied Micro Circuits corporation.
> + *
> + * Author: Feng Kan <fkan@amcc.com>
> + * 	   Tirumala Marri <tmarri@amcc.com>
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; version 2 of the
> + * License.
> + */
> +#include <linux/irq.h>
> +#include <linux/bootmem.h>
> +#include <linux/pci.h>
> +#include <linux/msi.h>
> +#include <linux/of_platform.h>
> +#include <linux/interrupt.h>
> +#include <linux/device.h>
> +#include <asm/prom.h>
> +#include <asm/hw_irq.h>
> +#include <asm/ppc-pci.h>
> +#include <asm/dcr.h>
> +#include <asm/dcr-regs.h>
> +#include "ppc4xx_msi.h"
> +
> +

Nitpicking: Remove one empty line here.

> +static struct ppc4xx_msi *ppc4xx_msi;
> +
> +struct ppc4xx_msi_feature {
> +	u32 ppc4xx_pic_ip;
> +	u32 msiir_offset;
> +};
> +
> +static int ppc4xx_msi_init_allocator(struct ppc4xx_msi *msi_data)
> +{
> +	int rc;
> +
> +	rc =3D msi_bitmap_alloc(&msi_data->bitmap, NR_MSI_IRQS,
> +				msi_data->irqhost->of_node);
> +	if (rc)
> +		return rc;
> +	rc =3D msi_bitmap_reserve_dt_hwirqs(&msi_data->bitmap);
> +	if (rc < 0) {
> +		msi_bitmap_free(&msi_data->bitmap);
> +		return rc;
> +	}
> +	return 0;
> +}
> +
> +

Nitpicking: Remove one empty line here.

> +static void ppc4xx_msi_cascade(unsigned int irq, struct irq_desc
*desc)
> +{
> +	unsigned int cascade_irq;
> +	struct ppc4xx_msi *msi_data =3D ppc4xx_msi;
> +	int msir_index =3D -1;
> +
> +	raw_spin_lock(&desc->lock);
> +	if (desc->chip->mask_ack) {
> +		desc->chip->mask_ack(irq);
> +	} else {
> +		desc->chip->mask(irq);
> +		desc->chip->ack(irq);
> +	}
> +
> +	if (unlikely(desc->status & IRQ_INPROGRESS))
> +		goto unlock;
> +
> +	msir_index =3D (int)desc->handler_data;
> +
> +	if (msir_index >=3D NR_MSI_IRQS)
> +		cascade_irq =3D NO_IRQ;
> +
> +	desc->status |=3D IRQ_INPROGRESS;
> +
> +	cascade_irq =3D irq_linear_revmap(msi_data->irqhost, msir_index);
> +	if (cascade_irq !=3D NO_IRQ)
> +		generic_handle_irq(cascade_irq);
> +	desc->status &=3D ~IRQ_INPROGRESS;
> +
> +	if (!(desc->status & IRQ_DISABLED) && desc->chip->unmask)
> +		desc->chip->unmask(irq);
> +unlock:
> +	raw_spin_unlock(&desc->lock);
> +}

Nitpicking: Add one empty line here.

> +static void ppc4xx_compose_msi_msg(struct pci_dev *pdev, int hwirq,
> +					struct msi_msg *msg)
> +{
> +	struct ppc4xx_msi *msi_data =3D ppc4xx_msi;
> +
> +	msg->address_lo =3D msi_data->msi_addr_lo;
> +	msg->address_hi =3D msi_data->msi_addr_hi;
> +	msg->data =3D hwirq;
> +}
> +
> +

Nitpicking: Remove one empty line here.

> +int ppc4xx_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
> +{
> +	struct msi_desc *entry;
> +	int rc, hwirq;
> +	unsigned int virq;
> +	struct msi_msg msg;
> +	struct ppc4xx_msi *msi_data =3D ppc4xx_msi;
> +
> +
> +	list_for_each_entry(entry, &dev->msi_list, list) {
> +		hwirq =3D msi_bitmap_alloc_hwirqs(&msi_data->bitmap, 1);
> +		if (hwirq < 0) {
> +			rc =3D hwirq;
> +			dev_err(&dev->dev, "%s: fail allocating msi\
> +					interrupt\n",	__func__);
> +			goto out_free;
> +		}
> +
> +		pr_debug(KERN_INFO"mis is %p\n", msi_data->irqhost);
> +		virq =3D irq_create_mapping(msi_data->irqhost, hwirq);
> +		if (virq =3D=3D NO_IRQ) {
> +			dev_err(&dev->dev, "%s: fail mapping irq\n",
__func__);
> +			rc =3D -ENOSPC;
> +			goto out_free;
> +		}
> +
> +		set_irq_msi(virq, entry);
> +		ppc4xx_compose_msi_msg(dev, hwirq, &msg);
> +		write_msi_msg(virq, &msg);
> +	}
> +
> +	return 0;
> +out_free:
> +	return rc;
> +}
> +
> +void ppc4xx_teardown_msi_irqs(struct pci_dev *dev)
> +{
> +	struct msi_desc *entry;
> +	struct ppc4xx_msi *msi_data =3D ppc4xx_msi;
> +	 dev_dbg(&dev->dev, "PCIE-MSI: tearing down msi irqs\n");
> +
> +	list_for_each_entry(entry, &dev->msi_list, list) {
> +		if (entry->irq =3D=3D NO_IRQ)
> +			continue;
> +		set_irq_msi(entry->irq, NULL);
> +		msi_bitmap_free_hwirqs(&msi_data->bitmap,
> +				       virq_to_hw(entry->irq), 1);
> +		irq_dispose_mapping(entry->irq);
> +

Nitpicking: Remove one empty line here.

> +	}
> +
> +	return;
> +}
> +
> +static int ppc4xx_msi_check_device(struct pci_dev *pdev, int nvec,
int
>  type) +{
> +	pr_debug(KERN_INFO"PCIE-MSI:%s called. vec %x type %d\n",
> +					__func__, nvec, type);
> +	return 0;
> +}
> +
> +/*
> + * We do not need this actually. The MSIR register has been read once
> + * in the cascade interrupt. So, this MSI interrupt has been acked
> +*/
> +static void ppc4xx_msi_end_irq(unsigned int virq)
> +{
> +}
> +
> +

Nitpicking: Remove one empty line here. I'll stop mentioning this here.
Please=20
check the whole file for this.

> +static struct irq_chip ppc4xx_msi_chip =3D {
> +	.mask           =3D mask_msi_irq,
> +	.unmask         =3D unmask_msi_irq,
> +	.ack            =3D ppc4xx_msi_end_irq,
> +	.name       =3D " UIC",
> +};
> +
> +static int ppc4xx_msi_host_map(struct irq_host *h, unsigned int virq,
> +				irq_hw_number_t hw)
> +{
> +	struct irq_chip *chip =3D &ppc4xx_msi_chip;
> +
> +	irq_to_desc(virq)->status |=3D IRQ_TYPE_EDGE_RISING;
> +
> +	set_irq_chip_and_handler(virq, chip, handle_edge_irq);
> +
> +	return 0;
> +}
> +
> +static struct irq_host_ops ppc4xx_msi_host_ops =3D {
> +	.map =3D ppc4xx_msi_host_map,
> +};
> +
> +
> +static int __devinit ppc4xx_msi_probe(struct of_device *dev,
> +					const struct of_device_id
*match)
> +{
> +	struct ppc4xx_msi *msi;
> +	struct resource res, rmsi;
> +	int i, count;
> +	int rc;
> +	int virt_msir;
> +	const u32 *p;
> +	const u32 *sdr_base;
> +	u32 *msi_virt =3D NULL;
> +	dma_addr_t msi_phys;
> +
> +
> +	msi =3D kzalloc(sizeof(struct ppc4xx_msi), GFP_KERNEL);
> +	if (!msi) {
> +		dev_err(&dev->dev, "No memory for MSI structure\n");
> +		rc =3D -ENOMEM;
> +		goto error_out;
> +	}
> +
> +	msi->irqhost =3D irq_alloc_host(dev->node, IRQ_HOST_MAP_LINEAR,
> +				      NR_MSI_IRQS, &ppc4xx_msi_host_ops,
0);
> +	if (msi->irqhost =3D=3D NULL) {
> +		dev_err(&dev->dev, "No memory for MSI irqhost\n");
> +		rc =3D -ENOMEM;
> +		goto error_out;
> +	}
> +
> +
> +	/* Get MSI ranges */
> +	rc =3D of_address_to_resource(dev->node, 0, &rmsi);
> +	if (rc) {
> +		dev_err(&dev->dev, "%s resource error!\n",
> +				dev->node->full_name);
> +		goto error_out;
> +	}
> +
> +
> +	/* Get the MSI reg base */
> +	rc =3D of_address_to_resource(dev->node, 1, &res);
> +	if (rc) {
> +		dev_err(&dev->dev, "%s resource error!\n",
> +				dev->node->full_name);
> +		goto error_out;
> +	}
> +	/* Get the sdr-base */
> +	sdr_base =3D (u32 *)of_get_property(dev->node, "sdr-base", NULL);
> +	if (sdr_base =3D=3D NULL) {
> +		dev_err(&dev->dev, "%s resource error!\n",
> +				dev->node->full_name);
> +		goto error_out;
> +	}
> +	msi->sdr_base =3D *sdr_base;
> +#if  defined(CONFIG_460SX)
> +	mtdcri(SDR0, msi->sdr_base, res.start >> 32);
> +	mtdcri(SDR0, msi->sdr_base + 1, res.start & 0xFFFFFFFF);
> +	msi->msi_regs =3D ioremap(res.start, res.end - res.start + 1);

	msi->msi_regs =3D ioremap(res.start, resource_size(&res));

> +#else
> +	dev_err(&dev->dev, " Invalid Device \n");
> +	goto error_out;
> +#endif

Please don't introduce such a compile-time selection here. You don't
even need=20
it, since the register bases are provided via the device-tree. So just
remove=20
the #if and it's #else part here.

> +	if (!msi->msi_regs) {
> +		dev_err(&dev->dev, "ioremap problem failed\n");
> +		goto error_out;
> +	}
> +	/* MSI region always mapped in 4GB region*/
> +	msi->msi_addr_hi =3D 0x0;
> +	msi_virt =3D dma_alloc_coherent(&dev->dev, 64, &msi_phys,
> +			GFP_KERNEL);
> +	if (msi_virt =3D=3D NULL) {
> +		dev_err(&dev->dev, "No memory for MSI mem space\n");
> +		rc =3D -ENOMEM;
> +		goto error_out;
> +	}
> +	msi->msi_addr_lo =3D (u32)msi_phys;
> +
> +	/* Progam the Interrupt handler Termination addr registers */
> +	out_be32(msi->msi_regs + PEIH_TERMADH, msi->msi_addr_hi);
> +	out_be32(msi->msi_regs + PEIH_TERMADL, msi->msi_addr_lo);
> +
> +	/* Program MSI Expected data and Mask bits */
> +	out_be32(msi->msi_regs + PEIH_MSIED, MSI_DATA_PATTERN);
> +	out_be32(msi->msi_regs + PEIH_MSIMK, MSI_DATA_PATTERN);
> +
> +	msi->irqhost->host_data =3D msi;
> +
> +	if (ppc4xx_msi_init_allocator(msi)) {
> +		dev_err(&dev->dev, "Error allocating MSI bitmap\n");
> +		goto error_out;
> +	}
> +
> +	p =3D of_get_property(dev->node, "interrupts", &count);
> +	if (!p) {
> +		dev_err(&dev->dev, "no interrupts property found on
%s\n",
> +				dev->node->full_name);
> +		rc =3D -ENODEV;
> +		goto error_out;
> +	}
> +	if (count =3D=3D 0) {
> +		dev_err(&dev->dev, "Malformed interrupts property on
%s\n",
> +				dev->node->full_name);
> +		rc =3D -EINVAL;
> +		goto error_out;
> +	}
> +
> +	for (i =3D 0; i < NR_MSI_IRQS; i++) {
> +		virt_msir =3D irq_of_parse_and_map(dev->node, i);
> +		if (virt_msir !=3D NO_IRQ) {
> +			set_irq_data(virt_msir, (void *)i);
> +			set_irq_chained_handler(virt_msir,
ppc4xx_msi_cascade);
> +		}
> +	}
> +
> +	ppc4xx_msi =3D msi;
> +
> +	WARN_ON(ppc_md.setup_msi_irqs);
> +	ppc_md.setup_msi_irqs =3D ppc4xx_setup_msi_irqs;
> +	ppc_md.teardown_msi_irqs =3D ppc4xx_teardown_msi_irqs;
> +	ppc_md.msi_check_device =3D ppc4xx_msi_check_device;
> +	return 0;
> +error_out:
> +	if (msi_virt)
> +		dma_free_coherent(&dev->dev, 64, msi_virt, msi_phys);
> +	kfree(msi);
> +	return rc;
> +}
> +
> +static const struct ppc4xx_msi_feature ppc4xx_msi_feature =3D {
> +	.ppc4xx_pic_ip =3D 0,
> +	.msiir_offset =3D 0x140,
> +};
> +
> +static const struct of_device_id ppc4xx_msi_ids[] =3D {
> +	{
> +		.compatible =3D "amcc,ppc4xx-msi",
> +		.data =3D (void *)&ppc4xx_msi_feature,
> +	},
> +	{}
> +};
> +
> +static struct of_platform_driver ppc4xx_msi_driver =3D {
> +	.name =3D "ppc4xx-msi",
> +	.match_table =3D ppc4xx_msi_ids,
> +	.probe =3D ppc4xx_msi_probe,
> +};
> +
> +static __init int ppc4xx_msi_init(void)
> +{
> +	return of_register_platform_driver(&ppc4xx_msi_driver);
> +}
> +
> +subsys_initcall(ppc4xx_msi_init);
> diff --git a/arch/powerpc/sysdev/ppc4xx_msi.h
>  b/arch/powerpc/sysdev/ppc4xx_msi.h new file mode 100644
> index 0000000..e4ae058
> --- /dev/null
> +++ b/arch/powerpc/sysdev/ppc4xx_msi.h
> @@ -0,0 +1,39 @@
> +/*
> + * Copyright (C) 2009 Applied Micro Circuits Corporation.
> + *
> + * Author: Tirumala Marri <tmarri@amcc.com>
> + * 		Feng Kan <fkan@amcc.com>
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; version 2 of the
> + * License.
> + */
> +#ifndef __PPC4XX_MSI_H__
> +#define __PPC4XX_MSI_H__
> +
> +#include <asm/msi_bitmap.h>
> +
> +#define PEIH_TERMADH    0x00
> +#define PEIH_TERMADL    0x08
> +#define PEIH_MSIED      0x10
> +#define PEIH_MSIMK      0x18
> +#define PEIH_MSIASS     0x20
> +#define PEIH_FLUSH0     0x30
> +#define PEIH_FLUSH1     0x38
> +#define PEIH_CNTRST     0x48
> +
> +#define MSI_DATA_PATTERN   0x44440000
> +
> +struct ppc4xx_msi {
> +	struct irq_host *irqhost;
> +	unsigned long cascade_irq;
> +	u32 msi_addr_lo;
> +	u32 msi_addr_hi;
> +	void __iomem *msi_regs;
> +	u32 feature;
> +	struct msi_bitmap bitmap;
> +	u32 sdr_base;
> +};
> +
> +#define NR_MSI_IRQS 4
> +#endif /* __PPC4XX_MSI_H__ */
>=20

Cheers,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply

* RE: [PATCH 2/2] Adding PCI-E MSI support for PowerPC 460SX SOC.
From: Tirumala Reddy Marri @ 2009-12-23 17:30 UTC (permalink / raw)
  To: Tirumala Reddy Marri, Stefan Roese, linuxppc-dev
  Cc: linuxppc-dev, writetomarri
In-Reply-To: <AC5E1C3367E37D44970B81A6ADD1DA2C08882A65@SDCEXCHANGE01.ad.amcc.com>

BTW once this patch gets in I will add the 405Ex,460Ex and 440Spe
support to the same.

-----Original Message-----
From: linuxppc-dev-bounces+tmarri=3Damcc.com@lists.ozlabs.org
[mailto:linuxppc-dev-bounces+tmarri=3Damcc.com@lists.ozlabs.org] On =
Behalf
Of Tirumala Reddy Marri
Sent: Wednesday, December 23, 2009 9:23 AM
To: Stefan Roese; linuxppc-dev@lists.ozlabs.org
Cc: linuxppc-dev@ozlabs.org; writetomarri@yahoo.com
Subject: RE: [PATCH 2/2] Adding PCI-E MSI support for PowerPC 460SX SOC.

Thanks for the suggestions. I will try remove the extra lines . Add
changes you suggested.
-Marri

-----Original Message-----
From: linuxppc-dev-bounces+tmarri=3Damcc.com@lists.ozlabs.org
[mailto:linuxppc-dev-bounces+tmarri=3Damcc.com@lists.ozlabs.org] On =
Behalf
Of Stefan Roese
Sent: Wednesday, December 23, 2009 12:19 AM
To: linuxppc-dev@lists.ozlabs.org
Cc: linuxppc-dev@ozlabs.org; writetomarri@yahoo.com; Tirumala Reddy
Marri
Subject: Re: [PATCH 2/2] Adding PCI-E MSI support for PowerPC 460SX SOC.

On Wednesday 23 December 2009 08:52:23 tmarri@amcc.com wrote:
> From: Tirumala Marri <tmarri@amcc.com>

Please find some mostly nitpicking comments below.

BTW: Did you already test this on other 4xx platforms, like 440SPe or
405EX?=20
What are your plans here?
=20
> Signed-off-by: Tirumala Marri <tmarri@amcc.com>
> ---
> Kernel version: 2.6.33-rc1
> Testing:
> 	When 460SX configured as root as a end point E1000(Intell
Ethernet card)
> 	was plugged into the one of the PCI-E ports. I was able to run
the traffic
> 	with MSI interrupts.
> ---
>  arch/powerpc/boot/dts/redwood.dts          |   15 ++
>  arch/powerpc/configs/44x/redwood_defconfig |    5 +-
>  arch/powerpc/platforms/44x/Kconfig         |    1 +
>  arch/powerpc/sysdev/Kconfig                |    7 +
>  arch/powerpc/sysdev/Makefile               |    1 +
>  arch/powerpc/sysdev/ppc4xx_msi.c           |  342
>  ++++++++++++++++++++++++++++ arch/powerpc/sysdev/ppc4xx_msi.h
|=20
>   39 ++++
>  7 files changed, 408 insertions(+), 2 deletions(-)
>  create mode 100644 arch/powerpc/sysdev/ppc4xx_msi.c
>  create mode 100644 arch/powerpc/sysdev/ppc4xx_msi.h
>=20
> diff --git a/arch/powerpc/boot/dts/redwood.dts
>  b/arch/powerpc/boot/dts/redwood.dts index 81636c0..412d5f9 100644
> --- a/arch/powerpc/boot/dts/redwood.dts
> +++ b/arch/powerpc/boot/dts/redwood.dts
> @@ -357,6 +357,21 @@
>  				0x0 0x0 0x0 0x3 &UIC3 0xa 0x4 /*
swizzled int C */
>  				0x0 0x0 0x0 0x4 &UIC3 0xb 0x4 /*
swizzled int D */>;
>  		};
> +  		MSI: ppc4xx-msi@400300000 {
> +  			compatible =3D "amcc,ppc4xx-msi", "ppc4xx-msi";

Better use something like this:

  			compatible =3D "amcc,ppc4xx-msi-ppc460sx",
"amcc,ppc4xx-msi";

This way you could check for 460SX specials in the driver if needed.

> +  			reg =3D < 0x4 0x00300000 0x100
> +  				0x4 0x00300000 0x100>;
> +  			sdr-base =3D <0x3B0>;
> +  			interrupts =3D<0 1 2 3>;
> +  			interrupt-parent =3D <&MSI>;
> +  			#interrupt-cells =3D <1>;
> +  			#address-cells =3D <0>;
> +  			#size-cells =3D <0>;
> +  			interrupt-map =3D <0 &UIC0 0xC 1
> +  				1 &UIC0 0x0D 1
> +  				2 &UIC0 0x0E 1
> +  				3 &UIC0 0x0F 1>;
> +  		};
>=20
>  	};
>=20
> diff --git a/arch/powerpc/configs/44x/redwood_defconfig
>  b/arch/powerpc/configs/44x/redwood_defconfig index ed31d4f..5d16c88
100644
> --- a/arch/powerpc/configs/44x/redwood_defconfig
> +++ b/arch/powerpc/configs/44x/redwood_defconfig
> @@ -158,6 +158,7 @@ CONFIG_DEFAULT_AS=3Dy
>  CONFIG_DEFAULT_IOSCHED=3D"anticipatory"
>  # CONFIG_FREEZER is not set
>  CONFIG_PPC4xx_PCI_EXPRESS=3Dy
> +CONFIG_PPC_MSI_BITMAP=3Dy
>=20
>  #
>  # Platform support
> @@ -264,7 +265,7 @@ CONFIG_PCIEPORTBUS=3Dy
>  CONFIG_PCIEAER=3Dy
>  # CONFIG_PCIEASPM is not set
>  CONFIG_ARCH_SUPPORTS_MSI=3Dy
> -# CONFIG_PCI_MSI is not set
> +CONFIG_PCI_MSI=3Dy
>  # CONFIG_PCI_LEGACY is not set
>  # CONFIG_PCI_DEBUG is not set
>  # CONFIG_PCI_STUB is not set
> @@ -1062,7 +1063,7 @@ CONFIG_PRINT_STACK_DEPTH=3D64
>  # CONFIG_DEBUG_PAGEALLOC is not set
>  # CONFIG_CODE_PATCHING_SELFTEST is not set
>  # CONFIG_FTR_FIXUP_SELFTEST is not set
> -# CONFIG_MSI_BITMAP_SELFTEST is not set
> +CONFIG_MSI_BITMAP_SELFTEST=3Dy
>  # CONFIG_XMON is not set
>  # CONFIG_IRQSTACKS is not set
>  # CONFIG_VIRQ_DEBUG is not set
> diff --git a/arch/powerpc/platforms/44x/Kconfig
>  b/arch/powerpc/platforms/44x/Kconfig index 7486bff..9c3b8ca 100644
> --- a/arch/powerpc/platforms/44x/Kconfig
> +++ b/arch/powerpc/platforms/44x/Kconfig
> @@ -126,6 +126,7 @@ config REDWOOD
>  	select 460SX
>  	select PCI
>  	select PPC4xx_PCI_EXPRESS
> +	select PPC4xx_MSI
>  	help
>  	  This option enables support for the AMCC PPC460SX Redwood
board.
>=20
> diff --git a/arch/powerpc/sysdev/Kconfig b/arch/powerpc/sysdev/Kconfig
> index 3965828..c8f1486 100644
> --- a/arch/powerpc/sysdev/Kconfig
> +++ b/arch/powerpc/sysdev/Kconfig
> @@ -7,8 +7,15 @@ config PPC4xx_PCI_EXPRESS
>  	depends on PCI && 4xx
>  	default n
>=20
> +config PPC4xx_MSI
> +	bool
> +	depends on PCI_MSI
> +	depends on PCI && 4xx
> +	default n
> +
>  config PPC_MSI_BITMAP
>  	bool
>  	depends on PCI_MSI
>  	default y if MPIC
>  	default y if FSL_PCI
> +	default y if PPC4xx_MSI
> diff --git a/arch/powerpc/sysdev/Makefile
b/arch/powerpc/sysdev/Makefile
> index 5642924..4c67d2d 100644
> --- a/arch/powerpc/sysdev/Makefile
> +++ b/arch/powerpc/sysdev/Makefile
> @@ -36,6 +36,7 @@ obj-$(CONFIG_PPC_I8259)		+=3D i8259.o
>  obj-$(CONFIG_IPIC)		+=3D ipic.o
>  obj-$(CONFIG_4xx)		+=3D uic.o
>  obj-$(CONFIG_4xx_SOC)		+=3D ppc4xx_soc.o
> +obj-$(CONFIG_PPC4xx_MSI)		+=3D ppc4xx_msi.o
>  obj-$(CONFIG_XILINX_VIRTEX)	+=3D xilinx_intc.o
>  obj-$(CONFIG_XILINX_PCI)	+=3D xilinx_pci.o
>  obj-$(CONFIG_OF_RTC)		+=3D of_rtc.o
> diff --git a/arch/powerpc/sysdev/ppc4xx_msi.c
>  b/arch/powerpc/sysdev/ppc4xx_msi.c new file mode 100644
> index 0000000..3c2ef32
> --- /dev/null
> +++ b/arch/powerpc/sysdev/ppc4xx_msi.c
> @@ -0,0 +1,342 @@
> +/*
> + * Copyright (C) 2009 Applied Micro Circuits corporation.
> + *
> + * Author: Feng Kan <fkan@amcc.com>
> + * 	   Tirumala Marri <tmarri@amcc.com>
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; version 2 of the
> + * License.
> + */
> +#include <linux/irq.h>
> +#include <linux/bootmem.h>
> +#include <linux/pci.h>
> +#include <linux/msi.h>
> +#include <linux/of_platform.h>
> +#include <linux/interrupt.h>
> +#include <linux/device.h>
> +#include <asm/prom.h>
> +#include <asm/hw_irq.h>
> +#include <asm/ppc-pci.h>
> +#include <asm/dcr.h>
> +#include <asm/dcr-regs.h>
> +#include "ppc4xx_msi.h"
> +
> +

Nitpicking: Remove one empty line here.

> +static struct ppc4xx_msi *ppc4xx_msi;
> +
> +struct ppc4xx_msi_feature {
> +	u32 ppc4xx_pic_ip;
> +	u32 msiir_offset;
> +};
> +
> +static int ppc4xx_msi_init_allocator(struct ppc4xx_msi *msi_data)
> +{
> +	int rc;
> +
> +	rc =3D msi_bitmap_alloc(&msi_data->bitmap, NR_MSI_IRQS,
> +				msi_data->irqhost->of_node);
> +	if (rc)
> +		return rc;
> +	rc =3D msi_bitmap_reserve_dt_hwirqs(&msi_data->bitmap);
> +	if (rc < 0) {
> +		msi_bitmap_free(&msi_data->bitmap);
> +		return rc;
> +	}
> +	return 0;
> +}
> +
> +

Nitpicking: Remove one empty line here.

> +static void ppc4xx_msi_cascade(unsigned int irq, struct irq_desc
*desc)
> +{
> +	unsigned int cascade_irq;
> +	struct ppc4xx_msi *msi_data =3D ppc4xx_msi;
> +	int msir_index =3D -1;
> +
> +	raw_spin_lock(&desc->lock);
> +	if (desc->chip->mask_ack) {
> +		desc->chip->mask_ack(irq);
> +	} else {
> +		desc->chip->mask(irq);
> +		desc->chip->ack(irq);
> +	}
> +
> +	if (unlikely(desc->status & IRQ_INPROGRESS))
> +		goto unlock;
> +
> +	msir_index =3D (int)desc->handler_data;
> +
> +	if (msir_index >=3D NR_MSI_IRQS)
> +		cascade_irq =3D NO_IRQ;
> +
> +	desc->status |=3D IRQ_INPROGRESS;
> +
> +	cascade_irq =3D irq_linear_revmap(msi_data->irqhost, msir_index);
> +	if (cascade_irq !=3D NO_IRQ)
> +		generic_handle_irq(cascade_irq);
> +	desc->status &=3D ~IRQ_INPROGRESS;
> +
> +	if (!(desc->status & IRQ_DISABLED) && desc->chip->unmask)
> +		desc->chip->unmask(irq);
> +unlock:
> +	raw_spin_unlock(&desc->lock);
> +}

Nitpicking: Add one empty line here.

> +static void ppc4xx_compose_msi_msg(struct pci_dev *pdev, int hwirq,
> +					struct msi_msg *msg)
> +{
> +	struct ppc4xx_msi *msi_data =3D ppc4xx_msi;
> +
> +	msg->address_lo =3D msi_data->msi_addr_lo;
> +	msg->address_hi =3D msi_data->msi_addr_hi;
> +	msg->data =3D hwirq;
> +}
> +
> +

Nitpicking: Remove one empty line here.

> +int ppc4xx_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
> +{
> +	struct msi_desc *entry;
> +	int rc, hwirq;
> +	unsigned int virq;
> +	struct msi_msg msg;
> +	struct ppc4xx_msi *msi_data =3D ppc4xx_msi;
> +
> +
> +	list_for_each_entry(entry, &dev->msi_list, list) {
> +		hwirq =3D msi_bitmap_alloc_hwirqs(&msi_data->bitmap, 1);
> +		if (hwirq < 0) {
> +			rc =3D hwirq;
> +			dev_err(&dev->dev, "%s: fail allocating msi\
> +					interrupt\n",	__func__);
> +			goto out_free;
> +		}
> +
> +		pr_debug(KERN_INFO"mis is %p\n", msi_data->irqhost);
> +		virq =3D irq_create_mapping(msi_data->irqhost, hwirq);
> +		if (virq =3D=3D NO_IRQ) {
> +			dev_err(&dev->dev, "%s: fail mapping irq\n",
__func__);
> +			rc =3D -ENOSPC;
> +			goto out_free;
> +		}
> +
> +		set_irq_msi(virq, entry);
> +		ppc4xx_compose_msi_msg(dev, hwirq, &msg);
> +		write_msi_msg(virq, &msg);
> +	}
> +
> +	return 0;
> +out_free:
> +	return rc;
> +}
> +
> +void ppc4xx_teardown_msi_irqs(struct pci_dev *dev)
> +{
> +	struct msi_desc *entry;
> +	struct ppc4xx_msi *msi_data =3D ppc4xx_msi;
> +	 dev_dbg(&dev->dev, "PCIE-MSI: tearing down msi irqs\n");
> +
> +	list_for_each_entry(entry, &dev->msi_list, list) {
> +		if (entry->irq =3D=3D NO_IRQ)
> +			continue;
> +		set_irq_msi(entry->irq, NULL);
> +		msi_bitmap_free_hwirqs(&msi_data->bitmap,
> +				       virq_to_hw(entry->irq), 1);
> +		irq_dispose_mapping(entry->irq);
> +

Nitpicking: Remove one empty line here.

> +	}
> +
> +	return;
> +}
> +
> +static int ppc4xx_msi_check_device(struct pci_dev *pdev, int nvec,
int
>  type) +{
> +	pr_debug(KERN_INFO"PCIE-MSI:%s called. vec %x type %d\n",
> +					__func__, nvec, type);
> +	return 0;
> +}
> +
> +/*
> + * We do not need this actually. The MSIR register has been read once
> + * in the cascade interrupt. So, this MSI interrupt has been acked
> +*/
> +static void ppc4xx_msi_end_irq(unsigned int virq)
> +{
> +}
> +
> +

Nitpicking: Remove one empty line here. I'll stop mentioning this here.
Please=20
check the whole file for this.

> +static struct irq_chip ppc4xx_msi_chip =3D {
> +	.mask           =3D mask_msi_irq,
> +	.unmask         =3D unmask_msi_irq,
> +	.ack            =3D ppc4xx_msi_end_irq,
> +	.name       =3D " UIC",
> +};
> +
> +static int ppc4xx_msi_host_map(struct irq_host *h, unsigned int virq,
> +				irq_hw_number_t hw)
> +{
> +	struct irq_chip *chip =3D &ppc4xx_msi_chip;
> +
> +	irq_to_desc(virq)->status |=3D IRQ_TYPE_EDGE_RISING;
> +
> +	set_irq_chip_and_handler(virq, chip, handle_edge_irq);
> +
> +	return 0;
> +}
> +
> +static struct irq_host_ops ppc4xx_msi_host_ops =3D {
> +	.map =3D ppc4xx_msi_host_map,
> +};
> +
> +
> +static int __devinit ppc4xx_msi_probe(struct of_device *dev,
> +					const struct of_device_id
*match)
> +{
> +	struct ppc4xx_msi *msi;
> +	struct resource res, rmsi;
> +	int i, count;
> +	int rc;
> +	int virt_msir;
> +	const u32 *p;
> +	const u32 *sdr_base;
> +	u32 *msi_virt =3D NULL;
> +	dma_addr_t msi_phys;
> +
> +
> +	msi =3D kzalloc(sizeof(struct ppc4xx_msi), GFP_KERNEL);
> +	if (!msi) {
> +		dev_err(&dev->dev, "No memory for MSI structure\n");
> +		rc =3D -ENOMEM;
> +		goto error_out;
> +	}
> +
> +	msi->irqhost =3D irq_alloc_host(dev->node, IRQ_HOST_MAP_LINEAR,
> +				      NR_MSI_IRQS, &ppc4xx_msi_host_ops,
0);
> +	if (msi->irqhost =3D=3D NULL) {
> +		dev_err(&dev->dev, "No memory for MSI irqhost\n");
> +		rc =3D -ENOMEM;
> +		goto error_out;
> +	}
> +
> +
> +	/* Get MSI ranges */
> +	rc =3D of_address_to_resource(dev->node, 0, &rmsi);
> +	if (rc) {
> +		dev_err(&dev->dev, "%s resource error!\n",
> +				dev->node->full_name);
> +		goto error_out;
> +	}
> +
> +
> +	/* Get the MSI reg base */
> +	rc =3D of_address_to_resource(dev->node, 1, &res);
> +	if (rc) {
> +		dev_err(&dev->dev, "%s resource error!\n",
> +				dev->node->full_name);
> +		goto error_out;
> +	}
> +	/* Get the sdr-base */
> +	sdr_base =3D (u32 *)of_get_property(dev->node, "sdr-base", NULL);
> +	if (sdr_base =3D=3D NULL) {
> +		dev_err(&dev->dev, "%s resource error!\n",
> +				dev->node->full_name);
> +		goto error_out;
> +	}
> +	msi->sdr_base =3D *sdr_base;
> +#if  defined(CONFIG_460SX)
> +	mtdcri(SDR0, msi->sdr_base, res.start >> 32);
> +	mtdcri(SDR0, msi->sdr_base + 1, res.start & 0xFFFFFFFF);
> +	msi->msi_regs =3D ioremap(res.start, res.end - res.start + 1);

	msi->msi_regs =3D ioremap(res.start, resource_size(&res));

> +#else
> +	dev_err(&dev->dev, " Invalid Device \n");
> +	goto error_out;
> +#endif

Please don't introduce such a compile-time selection here. You don't
even need=20
it, since the register bases are provided via the device-tree. So just
remove=20
the #if and it's #else part here.

> +	if (!msi->msi_regs) {
> +		dev_err(&dev->dev, "ioremap problem failed\n");
> +		goto error_out;
> +	}
> +	/* MSI region always mapped in 4GB region*/
> +	msi->msi_addr_hi =3D 0x0;
> +	msi_virt =3D dma_alloc_coherent(&dev->dev, 64, &msi_phys,
> +			GFP_KERNEL);
> +	if (msi_virt =3D=3D NULL) {
> +		dev_err(&dev->dev, "No memory for MSI mem space\n");
> +		rc =3D -ENOMEM;
> +		goto error_out;
> +	}
> +	msi->msi_addr_lo =3D (u32)msi_phys;
> +
> +	/* Progam the Interrupt handler Termination addr registers */
> +	out_be32(msi->msi_regs + PEIH_TERMADH, msi->msi_addr_hi);
> +	out_be32(msi->msi_regs + PEIH_TERMADL, msi->msi_addr_lo);
> +
> +	/* Program MSI Expected data and Mask bits */
> +	out_be32(msi->msi_regs + PEIH_MSIED, MSI_DATA_PATTERN);
> +	out_be32(msi->msi_regs + PEIH_MSIMK, MSI_DATA_PATTERN);
> +
> +	msi->irqhost->host_data =3D msi;
> +
> +	if (ppc4xx_msi_init_allocator(msi)) {
> +		dev_err(&dev->dev, "Error allocating MSI bitmap\n");
> +		goto error_out;
> +	}
> +
> +	p =3D of_get_property(dev->node, "interrupts", &count);
> +	if (!p) {
> +		dev_err(&dev->dev, "no interrupts property found on
%s\n",
> +				dev->node->full_name);
> +		rc =3D -ENODEV;
> +		goto error_out;
> +	}
> +	if (count =3D=3D 0) {
> +		dev_err(&dev->dev, "Malformed interrupts property on
%s\n",
> +				dev->node->full_name);
> +		rc =3D -EINVAL;
> +		goto error_out;
> +	}
> +
> +	for (i =3D 0; i < NR_MSI_IRQS; i++) {
> +		virt_msir =3D irq_of_parse_and_map(dev->node, i);
> +		if (virt_msir !=3D NO_IRQ) {
> +			set_irq_data(virt_msir, (void *)i);
> +			set_irq_chained_handler(virt_msir,
ppc4xx_msi_cascade);
> +		}
> +	}
> +
> +	ppc4xx_msi =3D msi;
> +
> +	WARN_ON(ppc_md.setup_msi_irqs);
> +	ppc_md.setup_msi_irqs =3D ppc4xx_setup_msi_irqs;
> +	ppc_md.teardown_msi_irqs =3D ppc4xx_teardown_msi_irqs;
> +	ppc_md.msi_check_device =3D ppc4xx_msi_check_device;
> +	return 0;
> +error_out:
> +	if (msi_virt)
> +		dma_free_coherent(&dev->dev, 64, msi_virt, msi_phys);
> +	kfree(msi);
> +	return rc;
> +}
> +
> +static const struct ppc4xx_msi_feature ppc4xx_msi_feature =3D {
> +	.ppc4xx_pic_ip =3D 0,
> +	.msiir_offset =3D 0x140,
> +};
> +
> +static const struct of_device_id ppc4xx_msi_ids[] =3D {
> +	{
> +		.compatible =3D "amcc,ppc4xx-msi",
> +		.data =3D (void *)&ppc4xx_msi_feature,
> +	},
> +	{}
> +};
> +
> +static struct of_platform_driver ppc4xx_msi_driver =3D {
> +	.name =3D "ppc4xx-msi",
> +	.match_table =3D ppc4xx_msi_ids,
> +	.probe =3D ppc4xx_msi_probe,
> +};
> +
> +static __init int ppc4xx_msi_init(void)
> +{
> +	return of_register_platform_driver(&ppc4xx_msi_driver);
> +}
> +
> +subsys_initcall(ppc4xx_msi_init);
> diff --git a/arch/powerpc/sysdev/ppc4xx_msi.h
>  b/arch/powerpc/sysdev/ppc4xx_msi.h new file mode 100644
> index 0000000..e4ae058
> --- /dev/null
> +++ b/arch/powerpc/sysdev/ppc4xx_msi.h
> @@ -0,0 +1,39 @@
> +/*
> + * Copyright (C) 2009 Applied Micro Circuits Corporation.
> + *
> + * Author: Tirumala Marri <tmarri@amcc.com>
> + * 		Feng Kan <fkan@amcc.com>
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; version 2 of the
> + * License.
> + */
> +#ifndef __PPC4XX_MSI_H__
> +#define __PPC4XX_MSI_H__
> +
> +#include <asm/msi_bitmap.h>
> +
> +#define PEIH_TERMADH    0x00
> +#define PEIH_TERMADL    0x08
> +#define PEIH_MSIED      0x10
> +#define PEIH_MSIMK      0x18
> +#define PEIH_MSIASS     0x20
> +#define PEIH_FLUSH0     0x30
> +#define PEIH_FLUSH1     0x38
> +#define PEIH_CNTRST     0x48
> +
> +#define MSI_DATA_PATTERN   0x44440000
> +
> +struct ppc4xx_msi {
> +	struct irq_host *irqhost;
> +	unsigned long cascade_irq;
> +	u32 msi_addr_lo;
> +	u32 msi_addr_hi;
> +	void __iomem *msi_regs;
> +	u32 feature;
> +	struct msi_bitmap bitmap;
> +	u32 sdr_base;
> +};
> +
> +#define NR_MSI_IRQS 4
> +#endif /* __PPC4XX_MSI_H__ */
>=20

Cheers,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office@denx.de
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply

* ucc_geth broken in 2.6.32 by 864fdf884e82bacbe8ca5e93bd43393a61d2e2b4
From: Lennart Sorensen @ 2009-12-23 17:40 UTC (permalink / raw)
  To: linux-kernel; +Cc: linuxppc-dev, Anton Vorontsov, Len Sorensen, netdev

We use the ucc_geth for 6 ports (4 100Mbit and 2 Gbit ports) on an
mpc8360e.  Up to 2.6.31 this worked fine.  2.6.32 on the other hand
crashes very quickly after boot.

I managed to see the same crash when I was selectively trying to add newer
ucc_geth patches to the 2.6.31 kernel a couple of months ago, and the same
patch that caused a crash then seems suspect.  If I revert the patch the
system runs completely stable.  Amusingly, the excact error message the
patch claims to fix is in fact the error it causes to happen in my case.

So preferably 864fdf884e82bacbe8ca5e93bd43393a61d2e2b4 could be reverted
unless someone can fix it.  I can't even make sense of why it is supposed
to improve anything, it certainly seems like a very unsafe change
to make.  Removing locking and disabling of interrupts before poking at
phy settings and such doesn't seem like a minor change and doesn't seem
that safe either.

Now I must add that I run with the xenomai/adeos-ipipe patches as well,
which do change interrupt handling a little, but so far this has worked
fine with the previous code and only the current code is broken for us.
I could try to build without the patch, although I would loose some major
functionality on the box doing so, and I would not be surprised if it
still fails since I believe I tried that already with 2.6.31+selected
git patches before without xenomai patched in and it still failed,
but I am only about 99% sure of that.

With the patch I get:
NETDEV WATCHDOG: eth2 (ucc_geth): transmit queue 0 timed out
------------[ cut here ]------------
Badness at c02729a8 [verbose debug info unavailable]
NIP: c02729a8 LR: c02729a8 CTR: c01b6088
REGS: c0451c40 TRAP: 0700   Not tainted  (2.6.32-trunk-8360e)
MSR: 00029032 <EE,ME,CE,IR,DR>  CR: 42042024  XER: 20000000
TASK = c041f3e8[0] 'swapper' THREAD: c0450000
GPR00: c02729a8 c0451cf0 c041f3e8 00000045 00002ae9 ffffffff c01b6afc c0422c48
GPR08: c042fde8 00000002 00000003 00010000 22042024 1001af90 1fffd000 00000000
GPR16: 00000000 c038c6d8 00000001 00200200 00000000 c0465eec c0465cec c0465aec
GPR24: c0450000 c04658ec c0423c2c df0e01c0 c0480000 df0e0000 c0423c2c 00000000
NIP [c02729a8] dev_watchdog+0x280/0x290
LR [c02729a8] dev_watchdog+0x280/0x290
Call Trace:
[c0451cf0] [c02729a8] dev_watchdog+0x280/0x290 (unreliable)
[c0451d50] [c00377c4] run_timer_softirq+0x164/0x224
[c0451da0] [c0032a38] __do_softirq+0xb8/0x13c
[c0451df0] [c00065cc] do_softirq+0xa0/0xac
[c0451e00] [c003280c] irq_exit+0x7c/0x9c
[c0451e10] [c00640c4] __ipipe_sync_stage+0x248/0x24c
[c0451e50] [c0064374] ipipe_suspend_domain+0xa0/0xf4
[c0451e70] [c00644a4] __ipipe_walk_pipeline+0xdc/0x120
[c0451e90] [c000af28] __ipipe_handle_irq+0x164/0x168
[c0451ec0] [c000b03c] __ipipe_grab_irq+0x3c/0xa4
[c0451ed0] [c0014814] __ipipe_ret_from_except+0x0/0xc
--- Exception: 501 at cpu_idle+0xe0/0xf0
    LR = cpu_idle+0xe0/0xf0
[c0451f90] [c000970c] cpu_idle+0x68/0xf0 (unreliable)
[c0451fb0] [c0003f30] rest_init+0x5c/0x6c
[c0451fc0] [c03f07ac] start_kernel+0x27c/0x2e0
[c0451ff0] [00003438] 0x3438
Instruction dump:
7d2903a6 4bfffea8 38810008 7fa3eb78 38a00040 4bfe9c81 7fe6fb78 7fa4eb78
7c651b78 3c60c03c 38631774 480b7d2d <0fe00000> 38000001 901c2fb0 4bffff94
warning: `zebra' uses 32-bit capabilities (legacy support in use)
PHY: 0:03 - Link is Up - 1000/Full
PHY: 0:09 - Link is Up - 100/Full
PHY: 0:02 - Link is Up - 100/Full
PHY: 0:0f - Link is Up - 100/Full
PHY: 0:17 - Link is Up - 100/Full

When reverted I get a stable running system with no errors.

Which port happens to fail first varies, but one always does and then
the system almost always crashes soon after.

-- 
Len Sorensen

^ permalink raw reply

* Re: ucc_geth broken in 2.6.32 by 864fdf884e82bacbe8ca5e93bd43393a61d2e2b4
From: Anton Vorontsov @ 2009-12-23 18:04 UTC (permalink / raw)
  To: Lennart Sorensen; +Cc: linuxppc-dev, linux-kernel, netdev
In-Reply-To: <20091223174019.GB762@caffeine.csclub.uwaterloo.ca>

On Wed, Dec 23, 2009 at 12:40:19PM -0500, Lennart Sorensen wrote:
> We use the ucc_geth for 6 ports (4 100Mbit and 2 Gbit ports) on an
> mpc8360e.  Up to 2.6.31 this worked fine.  2.6.32 on the other hand
> crashes very quickly after boot.

Hm. Just curious, what CPU revision you use? So that I could try
to reproduce the issue... I have MPC8360E-MDS boards, rev 2.0 and
rev rev 2.1 CPUs, Marvell PHYs. I also have MPC8360E-RDK (rev 2.1).
And I didn't see any issues with this patch.

> I managed to see the same crash when I was selectively trying to add newer
> ucc_geth patches to the 2.6.31 kernel a couple of months ago, and the same
> patch that caused a crash then seems suspect.  If I revert the patch the
> system runs completely stable.  Amusingly, the excact error message the
> patch claims to fix is in fact the error it causes to happen in my case.
> 
> So preferably 864fdf884e82bacbe8ca5e93bd43393a61d2e2b4 could be reverted

I don't see any point in reverting, because it will surely break my boards.
So, we need to fix this, not just hide.

> unless someone can fix it.

Well, I'm ready to help you with debugging.

> Now I must add that I run with the xenomai/adeos-ipipe patches as well,
> which do change interrupt handling a little,

It could be that it takes too long to stop the UCC, and xenomai
makes the timings worse, so the watchdog triggers.

Can you try the following patch?

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index afaf088..2f73e3f 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -1563,6 +1563,8 @@ static int ugeth_disable(struct ucc_geth_private *ugeth, enum comm_dir mode)
 
 static void ugeth_quiesce(struct ucc_geth_private *ugeth)
 {
+	netif_device_detach(ugeth->ndev);
+
 	/* Wait for and prevent any further xmits. */
 	netif_tx_disable(ugeth->ndev);
 
@@ -1577,7 +1579,7 @@ static void ugeth_activate(struct ucc_geth_private *ugeth)
 {
 	napi_enable(&ugeth->napi);
 	enable_irq(ugeth->ug_info->uf_info.irq);
-	netif_tx_wake_all_queues(ugeth->ndev);
+	netif_device_attach(ugeth->ndev);
 }
 
 /* Called every time the controller might need to be made

^ permalink raw reply related

* Problem setting up pktgen
From: Sivaguru Perambalam @ 2009-12-23 19:01 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <12604cb0912231058k58589125s14cfbf5e287c9fe2@mail.gmail.com>

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

>
>
> Hello ,
>
> I want to use pktgen to do some UDP tests .
> So I figured out that pktgen is built in the kernel I am using (2.6.32) and
> tried to use the bash script given in the internet .
>
> Script :
>
> #! /bin/sh
> rmmod pktgen
> cd /usr/src/kernels/linux-2.6.32/net/core
> insmod pktgen.ko
>
> PGDEV=/proc/net/pktgen/pg0
>  function pgset() {
>     local result
>     echo $1 > $PGDEV
>    result=`cat $PGDEV | fgrep "Result: OK:"`
>     if [ "$result" = "" ]; then
>          cat $PGDEV | fgrep Result:
>     fi
> }
>
> function pg() {
>     echo inject > $PGDEV
>     cat $PGDEV
> }
>
> pgset "odev eth0"
> pgset "dst 1.1.1.3"
>
>
> I get the following error message :
>
> ./ipg: line 11: /proc/net/pktgen/pg0: No such file or directory
> cat: /proc/net/pktgen/pg0: No such file or directory
> cat: /proc/net/pktgen/pg0: No such file or directory
> ./ipg: line 11: /proc/net/pktgen/pg0: No such file or directory
> cat: /proc/net/pktgen/pg0: No such file or directory
> cat: /proc/net/pktgen/pg0: No such file or directory
>
> I am running this as the 'root' user.
> I don't understand how exactly pktgen is informed about
> the Ethernet interfaces on the system.
>
> This is what I get for  ls /proc/net/pktgen/ ,
> kpktgend_0  kpktgend_1  kpktgend_2  kpktgend_3  kpktgend_4  kpktgend_5
>  kpktgend_6  kpktgend_7  pgctrl
>
>
> Please let me know , what is going wrong.
>
> Thanks !
>
>
>
>
>

[-- Attachment #2: Type: text/html, Size: 2273 bytes --]

^ permalink raw reply

* xmon & SCSI ATA devices
From: gshan @ 2009-12-24  7:34 UTC (permalink / raw)
  To: linuxppc-dev

Hello,

xmon and SCSI SATA device driver were installed on my system. When I invoked
xmon explicitly for kernel debugging, there're probably pending SCSI 
requests issued.
So those SCSI requests complained timeout when I quited from xmon. I want to
find a way to suspend SCSI device before invoking xmon and resume that 
before
quiting from xmon. Anybody knew there is a way to do this?

Thanks,
Gavin

^ permalink raw reply

* Re: ucc_geth broken in 2.6.32 by 864fdf884e82bacbe8ca5e93bd43393a61d2e2b4
From: Lennart Sorensen @ 2009-12-23 20:09 UTC (permalink / raw)
  To: Anton Vorontsov; +Cc: linuxppc-dev, netdev, linux-kernel, Lennart Sorensen
In-Reply-To: <20091223180415.GA12987@oksana.dev.rtsoft.ru>

On Wed, Dec 23, 2009 at 09:04:15PM +0300, Anton Vorontsov wrote:
> On Wed, Dec 23, 2009 at 12:40:19PM -0500, Lennart Sorensen wrote:
> > We use the ucc_geth for 6 ports (4 100Mbit and 2 Gbit ports) on an
> > mpc8360e.  Up to 2.6.31 this worked fine.  2.6.32 on the other hand
> > crashes very quickly after boot.
> 
> Hm. Just curious, what CPU revision you use? So that I could try
> to reproduce the issue... I have MPC8360E-MDS boards, rev 2.0 and
> rev rev 2.1 CPUs, Marvell PHYs. I also have MPC8360E-RDK (rev 2.1).
> And I didn't see any issues with this patch.

Hmm, I have an MDS around, so I could probably try and see if it is
reproduceable there.

CPU:   e300c1, MPC8360EA, Rev: 2.1 at 533.333 MHz, CSB: 266.667 MHz
BOARD: 12-86-0016-001 [00000000]                                   
UPMA:  Configured for Compact Flash PIO Mode                        
I2C:   ready                                                       
SPI:   ready                                                       
DRAM:  512 MB                                                      
MTEST: Testing data bus                                            
MTEST: Testing address bus                                         
MTEST: PASS                                                        
BCSR:  Ver A000B                                                   
FLASH: 32 MB

The PHY we use is KSZ8001LS for the 100Mbit ports, and on the port
that usually fails first is a marvel 88E1111 running fixed gigabit link
(converts to serdes before connecting to a switch chip).

I am actually surprised this code should matter at all given out of the
6 ethernet ports only two actually go to external ports, the rest are
fixed link.

If relevant here are some chunks from the dtb related to ethernet:

        aliases {
                ethernet0 = &enet0;
                ethernet1 = &enet1;
                ethernet2 = &enet2;
                ethernet3 = &enet3;
                ethernet4 = &enet4;
                ethernet5 = &enet5;
                serial0 = &serial0;
                serial1 = &serial1;
        };

                mdio {
                        compatible = "virtual,mdio-gpio";
                        #address-cells = <1>;
                        #size-cells = <0>;
                        /* MDC = PG6 MDIO = PG7 */
                        gpios = <&qe_pio_g 6 0 &qe_pio_g 7 0>;

                        phy0: ethernet-phy@00 {
                                reg = <0x18>;
                                device_type = "ethernet-phy";
                        };
                        phy1: ethernet-phy@01 {
                                reg = <0x06>;
                                device_type = "ethernet-phy";
                        };
                        phy2: ethernet-phy@02 {
                                reg = <0x0F>;
                                device_type = "ethernet-phy";
                        };
                        phy3: ethernet-phy@03 {
                                reg = <0x17>;
                                device_type = "ethernet-phy";
                        };
                };

                /* UCC5 Linux fe-cm-1 */
                enet0: ethernet@2400 {
                        device_type = "network";
                        compatible = "ucc_geth";
                        cell-index = <0x5>;
                        reg = <0x2400 0x200>;
                        interrupts = <0x28>;
                        interrupt-parent = <&qeic>;
                        local-mac-address = [ 00 00 00 00 00 00 ]; /* [U-BOOT] */
                        rx-clock-name = "clk16";
                        tx-clock-name = "clk14";
                        phy-handle = <&phy2>;
                        phy-connection-type = "mii";
                        pio-handle = <&ucc5>;
                };
                /* UCC 6 Linux fe-em-1 */
                enet1: ethernet@3400 {
                        device_type = "network";
                        compatible = "ucc_geth";
                        cell-index = <0x6>;
                        reg = <0x3400 0x200>;
                        interrupts = <0x29>;
                        interrupt-parent = <&qeic>;
                        local-mac-address = [ 00 00 00 00 00 00 ]; /* [U-BOOT] */
                        rx-clock-name = "clk7";
                        tx-clock-name = "clk8";
                        phy-handle = <&phy3>;
                        phy-connection-type = "mii";
                        pio-handle = <&ucc6>;
                };
                /* UCC 1 & 3  1000BT Data Plane dp0 */
                enet2: ethernet@2000 {
                        device_type = "network";
                        compatible = "ucc_geth";
                        cell-index = <0x1>;
                        reg = <0x2000 0x200>;
                        interrupts = <0x20>;
                        interrupt-parent = <&qeic>;
                        local-mac-address = [ 00 00 00 00 00 00 ]; /* [U-BOOT] */
                        rx-clock-name = "none";
                        tx-clock-name = "clk9";
                        fixed-link = <0x03 1 1000 0 0>; /* P3 on data plane switch on SM */
                        phy-connection-type = "gmii";
                        pio-handle = <&ucc1>;
                };
                /* UCC 7 100BT Data Plane dp1 */
                enet3: ethernet@2600 {
                        device_type = "network";
                        compatible = "ucc_geth";
                        cell-index = <0x7>;
                        reg = <0x2600 0x200>;
                        interrupts = <0x2a>;
                        interrupt-parent = <&qeic>;
                        local-mac-address = [ 00 00 00 00 00 00 ]; /* [U-BOOT] */
                        rx-clock-name = "clk20";
                        tx-clock-name = "clk19";
                        fixed-link = <0x02 1 100 0 0>; /* P2 on data-plane switch on SM */
                        phy-connection-type = "mii";
                        pio-handle = <&ucc7>;
                };
                /* UCC 2 & 4 1000 BT Control Plane cp0 */
                enet4: ethernet@3000 {
                        device_type = "network";
                        compatible = "ucc_geth";
                        cell-index = <0x2>;
                        reg = <0x3000 0x200>;
                        interrupts = <0x21>;
                        interrupt-parent = <&qeic>;
                        local-mac-address = [ 00 00 00 00 00 00 ]; /* [U-BOOT] */
                        rx-clock-name = "none";
                        tx-clock-name = "clk4";
                        tx-thread-num = <2>; /* Reduced to allow all enet to come up */
                        fixed-link = <10 1 1000 0 0>; /* P10 on control-plane switch on CM */
                        phy-connection-type = "gmii";
                        pio-handle = <&ucc2>;
                };
                /* UCC 8 100 BT Control Plane cp1 */
                enet5: ethernet@3600 {
                        device_type = "network";
                        compatible = "ucc_geth";
                        cell-index = <0x8>;
                        reg = <0x3600 0x200>;
                        interrupts = <0x2b>;
                        interrupt-parent = <&qeic>;
                        local-mac-address = [ 00 00 00 00 00 00 ]; /* [U-BOOT] */
                        rx-clock-name = "clk5";
                        tx-clock-name = "clk21";
                        fixed-link = <9 1 100 0 0>; /* P9 on control-plane switch on CM */
                        phy-connection-type = "mii";
                        pio-handle = <&ucc8>;
                };

> I don't see any point in reverting, because it will surely break my boards.
> So, we need to fix this, not just hide.

I agree with that.

> > unless someone can fix it.
> 
> Well, I'm ready to help you with debugging.

Excellent.

> > Now I must add that I run with the xenomai/adeos-ipipe patches as well,
> > which do change interrupt handling a little,
> 
> It could be that it takes too long to stop the UCC, and xenomai
> makes the timings worse, so the watchdog triggers.
> 
> Can you try the following patch?

Sure thing.

> diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
> index afaf088..2f73e3f 100644
> --- a/drivers/net/ucc_geth.c
> +++ b/drivers/net/ucc_geth.c
> @@ -1563,6 +1563,8 @@ static int ugeth_disable(struct ucc_geth_private *ugeth, enum comm_dir mode)
>  
>  static void ugeth_quiesce(struct ucc_geth_private *ugeth)
>  {
> +	netif_device_detach(ugeth->ndev);
> +
>  	/* Wait for and prevent any further xmits. */
>  	netif_tx_disable(ugeth->ndev);
>  
> @@ -1577,7 +1579,7 @@ static void ugeth_activate(struct ucc_geth_private *ugeth)
>  {
>  	napi_enable(&ugeth->napi);
>  	enable_irq(ugeth->ug_info->uf_info.irq);
> -	netif_tx_wake_all_queues(ugeth->ndev);
> +	netif_device_attach(ugeth->ndev);
>  }
>  
>  /* Called every time the controller might need to be made

So there result is:

Unable to handle kernel paging request for data at address 0x00000058
Faulting instruction address: 0xc024f2fc
Oops: Kernel access of bad area, sig: 11 [#1]
RC8360 CM
Modules linked in: rclibapi xeno_native max6369_wdt ucc_geth_driver spi_mpc8xxx ltc4215 lm75
NIP: c024f2fc LR: e30aa0a4 CTR: c024f2e8
REGS: df857ca0 TRAP: 0300   Not tainted  (2.6.32-trunk-8360e)
MSR: 00009032 <EE,ME,IR,DR>  CR: 44042088  XER: 00000000
DAR: 00000058, DSISR: 20000000
TASK = df848c90[4] 'events/0' THREAD: df856000
GPR00: e30aa0a4 df857d50 df848c90 00000000 00000640 00000001 c0428df4 dfa40b80
GPR08: 000000c8 e30ad2b8 df084360 c024f2e8 44042082 1001af90 e30ad2b8 00000000
GPR16: 00000048 00000001 00000000 00000000 df08436c df08440c 00000190 df08455c
GPR24: df0844ec df0842c0 df084000 180005ea dfa40b80 00000000 df0842c0 00000000
NIP [c024f2fc] skb_recycle_check+0x14/0x100
LR [e30aa0a4] ucc_geth_poll+0xd8/0x4e0 [ucc_geth_driver]
Call Trace:
[df857d50] [c000b03c] __ipipe_grab_irq+0x3c/0xa4 (unreliable)
[df857d60] [e30aa0a4] ucc_geth_poll+0xd8/0x4e0 [ucc_geth_driver]
[df857dd0] [c0258cf8] net_rx_action+0xf8/0x1b8
[df857e10] [c0032a38] __do_softirq+0xb8/0x13c
[df857e60] [c00065cc] do_softirq+0xa0/0xac
[df857e70] [c003280c] irq_exit+0x7c/0x9c
[df857e80] [c000b1f4] __ipipe_do_IRQ+0x50/0x68
[df857ea0] [c0064098] __ipipe_sync_stage+0x21c/0x24c
[df857ee0] [c0064a4c] __ipipe_unstall_root+0x5c/0x60
[df857ef0] [c005fb4c] enable_irq+0x88/0xc4
[df857f10] [e30a73d0] adjust_link+0x1fc/0x2f0 [ucc_geth_driver]
[df857f40] [c0209c0c] phy_state_machine+0x3a4/0x610
[df857f60] [c003fec4] worker_thread+0x124/0x1a4
[df857fc0] [c0044310] kthread+0x78/0x7c
[df857ff0] [c0013c30] kernel_thread+0x4c/0x68
Instruction dump:
4e800020 4800fcb5 4bffff50 4802782d 4bffffc8 48076dd9 4bffff6c 9421fff0
7c0802a6 93e1000c 7c7f1b78 90010014 <80030058> 2f800000 409e00cc 81630068
Kernel panic - not syncing: Fatal exception in interrupt
Rebooting in 180 seconds..

So it seems as soon as it touched the phy settings, it blew up.

Now perhaps the ipipe interrupt handling code changes the behaviour
enough that it makes the spinlock_irqsave necesary and that is why it
worked before.  Maybe ipipe is doing something wrong, given ipipe only
supports 2.6.30 for powerpc and I personally ported it to 2.6.31 and
then 2.6.32.  Everything else works fine though as long as I revert this
particular patch.

-- 
Len Sorensen

^ permalink raw reply

* Re: ucc_geth broken in 2.6.32 by 864fdf884e82bacbe8ca5e93bd43393a61d2e2b4
From: Lennart Sorensen @ 2009-12-23 20:15 UTC (permalink / raw)
  To: Lennart Sorensen; +Cc: linuxppc-dev, Anton Vorontsov, linux-kernel, netdev
In-Reply-To: <20091223200948.GF760@caffeine.csclub.uwaterloo.ca>

On Wed, Dec 23, 2009 at 03:09:48PM -0500, Lennart Sorensen wrote:
> On Wed, Dec 23, 2009 at 09:04:15PM +0300, Anton Vorontsov wrote:
> > On Wed, Dec 23, 2009 at 12:40:19PM -0500, Lennart Sorensen wrote:
> > > We use the ucc_geth for 6 ports (4 100Mbit and 2 Gbit ports) on an
> > > mpc8360e.  Up to 2.6.31 this worked fine.  2.6.32 on the other hand
> > > crashes very quickly after boot.
> > 
> > Hm. Just curious, what CPU revision you use? So that I could try
> > to reproduce the issue... I have MPC8360E-MDS boards, rev 2.0 and
> > rev rev 2.1 CPUs, Marvell PHYs. I also have MPC8360E-RDK (rev 2.1).
> > And I didn't see any issues with this patch.
> 
> Hmm, I have an MDS around, so I could probably try and see if it is
> reproduceable there.
> 
> CPU:   e300c1, MPC8360EA, Rev: 2.1 at 533.333 MHz, CSB: 266.667 MHz
> BOARD: 12-86-0016-001 [00000000]                                   
> UPMA:  Configured for Compact Flash PIO Mode                        
> I2C:   ready                                                       
> SPI:   ready                                                       
> DRAM:  512 MB                                                      
> MTEST: Testing data bus                                            
> MTEST: Testing address bus                                         
> MTEST: PASS                                                        
> BCSR:  Ver A000B                                                   
> FLASH: 32 MB
> 
> The PHY we use is KSZ8001LS for the 100Mbit ports, and on the port
> that usually fails first is a marvel 88E1111 running fixed gigabit link
> (converts to serdes before connecting to a switch chip).
> 
> I am actually surprised this code should matter at all given out of the
> 6 ethernet ports only two actually go to external ports, the rest are
> fixed link.
> 
> If relevant here are some chunks from the dtb related to ethernet:
> 
>         aliases {
>                 ethernet0 = &enet0;
>                 ethernet1 = &enet1;
>                 ethernet2 = &enet2;
>                 ethernet3 = &enet3;
>                 ethernet4 = &enet4;
>                 ethernet5 = &enet5;
>                 serial0 = &serial0;
>                 serial1 = &serial1;
>         };
> 
>                 mdio {
>                         compatible = "virtual,mdio-gpio";
>                         #address-cells = <1>;
>                         #size-cells = <0>;
>                         /* MDC = PG6 MDIO = PG7 */
>                         gpios = <&qe_pio_g 6 0 &qe_pio_g 7 0>;
> 
>                         phy0: ethernet-phy@00 {
>                                 reg = <0x18>;
>                                 device_type = "ethernet-phy";
>                         };
>                         phy1: ethernet-phy@01 {
>                                 reg = <0x06>;
>                                 device_type = "ethernet-phy";
>                         };
>                         phy2: ethernet-phy@02 {
>                                 reg = <0x0F>;
>                                 device_type = "ethernet-phy";
>                         };
>                         phy3: ethernet-phy@03 {
>                                 reg = <0x17>;
>                                 device_type = "ethernet-phy";
>                         };
>                 };
> 
>                 /* UCC5 Linux fe-cm-1 */
>                 enet0: ethernet@2400 {
>                         device_type = "network";
>                         compatible = "ucc_geth";
>                         cell-index = <0x5>;
>                         reg = <0x2400 0x200>;
>                         interrupts = <0x28>;
>                         interrupt-parent = <&qeic>;
>                         local-mac-address = [ 00 00 00 00 00 00 ]; /* [U-BOOT] */
>                         rx-clock-name = "clk16";
>                         tx-clock-name = "clk14";
>                         phy-handle = <&phy2>;
>                         phy-connection-type = "mii";
>                         pio-handle = <&ucc5>;
>                 };
>                 /* UCC 6 Linux fe-em-1 */
>                 enet1: ethernet@3400 {
>                         device_type = "network";
>                         compatible = "ucc_geth";
>                         cell-index = <0x6>;
>                         reg = <0x3400 0x200>;
>                         interrupts = <0x29>;
>                         interrupt-parent = <&qeic>;
>                         local-mac-address = [ 00 00 00 00 00 00 ]; /* [U-BOOT] */
>                         rx-clock-name = "clk7";
>                         tx-clock-name = "clk8";
>                         phy-handle = <&phy3>;
>                         phy-connection-type = "mii";
>                         pio-handle = <&ucc6>;
>                 };
>                 /* UCC 1 & 3  1000BT Data Plane dp0 */
>                 enet2: ethernet@2000 {
>                         device_type = "network";
>                         compatible = "ucc_geth";
>                         cell-index = <0x1>;
>                         reg = <0x2000 0x200>;
>                         interrupts = <0x20>;
>                         interrupt-parent = <&qeic>;
>                         local-mac-address = [ 00 00 00 00 00 00 ]; /* [U-BOOT] */
>                         rx-clock-name = "none";
>                         tx-clock-name = "clk9";
>                         fixed-link = <0x03 1 1000 0 0>; /* P3 on data plane switch on SM */
>                         phy-connection-type = "gmii";
>                         pio-handle = <&ucc1>;
>                 };
>                 /* UCC 7 100BT Data Plane dp1 */
>                 enet3: ethernet@2600 {
>                         device_type = "network";
>                         compatible = "ucc_geth";
>                         cell-index = <0x7>;
>                         reg = <0x2600 0x200>;
>                         interrupts = <0x2a>;
>                         interrupt-parent = <&qeic>;
>                         local-mac-address = [ 00 00 00 00 00 00 ]; /* [U-BOOT] */
>                         rx-clock-name = "clk20";
>                         tx-clock-name = "clk19";
>                         fixed-link = <0x02 1 100 0 0>; /* P2 on data-plane switch on SM */
>                         phy-connection-type = "mii";
>                         pio-handle = <&ucc7>;
>                 };
>                 /* UCC 2 & 4 1000 BT Control Plane cp0 */
>                 enet4: ethernet@3000 {
>                         device_type = "network";
>                         compatible = "ucc_geth";
>                         cell-index = <0x2>;
>                         reg = <0x3000 0x200>;
>                         interrupts = <0x21>;
>                         interrupt-parent = <&qeic>;
>                         local-mac-address = [ 00 00 00 00 00 00 ]; /* [U-BOOT] */
>                         rx-clock-name = "none";
>                         tx-clock-name = "clk4";
>                         tx-thread-num = <2>; /* Reduced to allow all enet to come up */
>                         fixed-link = <10 1 1000 0 0>; /* P10 on control-plane switch on CM */
>                         phy-connection-type = "gmii";
>                         pio-handle = <&ucc2>;
>                 };
>                 /* UCC 8 100 BT Control Plane cp1 */
>                 enet5: ethernet@3600 {
>                         device_type = "network";
>                         compatible = "ucc_geth";
>                         cell-index = <0x8>;
>                         reg = <0x3600 0x200>;
>                         interrupts = <0x2b>;
>                         interrupt-parent = <&qeic>;
>                         local-mac-address = [ 00 00 00 00 00 00 ]; /* [U-BOOT] */
>                         rx-clock-name = "clk5";
>                         tx-clock-name = "clk21";
>                         fixed-link = <9 1 100 0 0>; /* P9 on control-plane switch on CM */
>                         phy-connection-type = "mii";
>                         pio-handle = <&ucc8>;
>                 };
> 
> > I don't see any point in reverting, because it will surely break my boards.
> > So, we need to fix this, not just hide.
> 
> I agree with that.
> 
> > > unless someone can fix it.
> > 
> > Well, I'm ready to help you with debugging.
> 
> Excellent.
> 
> > > Now I must add that I run with the xenomai/adeos-ipipe patches as well,
> > > which do change interrupt handling a little,
> > 
> > It could be that it takes too long to stop the UCC, and xenomai
> > makes the timings worse, so the watchdog triggers.
> > 
> > Can you try the following patch?
> 
> Sure thing.
> 
> > diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
> > index afaf088..2f73e3f 100644
> > --- a/drivers/net/ucc_geth.c
> > +++ b/drivers/net/ucc_geth.c
> > @@ -1563,6 +1563,8 @@ static int ugeth_disable(struct ucc_geth_private *ugeth, enum comm_dir mode)
> >  
> >  static void ugeth_quiesce(struct ucc_geth_private *ugeth)
> >  {
> > +	netif_device_detach(ugeth->ndev);
> > +
> >  	/* Wait for and prevent any further xmits. */
> >  	netif_tx_disable(ugeth->ndev);
> >  
> > @@ -1577,7 +1579,7 @@ static void ugeth_activate(struct ucc_geth_private *ugeth)
> >  {
> >  	napi_enable(&ugeth->napi);
> >  	enable_irq(ugeth->ug_info->uf_info.irq);
> > -	netif_tx_wake_all_queues(ugeth->ndev);
> > +	netif_device_attach(ugeth->ndev);
> >  }
> >  
> >  /* Called every time the controller might need to be made
> 
> So there result is:
> 
> Unable to handle kernel paging request for data at address 0x00000058
> Faulting instruction address: 0xc024f2fc
> Oops: Kernel access of bad area, sig: 11 [#1]
> RC8360 CM
> Modules linked in: rclibapi xeno_native max6369_wdt ucc_geth_driver spi_mpc8xxx ltc4215 lm75
> NIP: c024f2fc LR: e30aa0a4 CTR: c024f2e8
> REGS: df857ca0 TRAP: 0300   Not tainted  (2.6.32-trunk-8360e)
> MSR: 00009032 <EE,ME,IR,DR>  CR: 44042088  XER: 00000000
> DAR: 00000058, DSISR: 20000000
> TASK = df848c90[4] 'events/0' THREAD: df856000
> GPR00: e30aa0a4 df857d50 df848c90 00000000 00000640 00000001 c0428df4 dfa40b80
> GPR08: 000000c8 e30ad2b8 df084360 c024f2e8 44042082 1001af90 e30ad2b8 00000000
> GPR16: 00000048 00000001 00000000 00000000 df08436c df08440c 00000190 df08455c
> GPR24: df0844ec df0842c0 df084000 180005ea dfa40b80 00000000 df0842c0 00000000
> NIP [c024f2fc] skb_recycle_check+0x14/0x100
> LR [e30aa0a4] ucc_geth_poll+0xd8/0x4e0 [ucc_geth_driver]
> Call Trace:
> [df857d50] [c000b03c] __ipipe_grab_irq+0x3c/0xa4 (unreliable)
> [df857d60] [e30aa0a4] ucc_geth_poll+0xd8/0x4e0 [ucc_geth_driver]
> [df857dd0] [c0258cf8] net_rx_action+0xf8/0x1b8
> [df857e10] [c0032a38] __do_softirq+0xb8/0x13c
> [df857e60] [c00065cc] do_softirq+0xa0/0xac
> [df857e70] [c003280c] irq_exit+0x7c/0x9c
> [df857e80] [c000b1f4] __ipipe_do_IRQ+0x50/0x68
> [df857ea0] [c0064098] __ipipe_sync_stage+0x21c/0x24c
> [df857ee0] [c0064a4c] __ipipe_unstall_root+0x5c/0x60
> [df857ef0] [c005fb4c] enable_irq+0x88/0xc4
> [df857f10] [e30a73d0] adjust_link+0x1fc/0x2f0 [ucc_geth_driver]
> [df857f40] [c0209c0c] phy_state_machine+0x3a4/0x610
> [df857f60] [c003fec4] worker_thread+0x124/0x1a4
> [df857fc0] [c0044310] kthread+0x78/0x7c
> [df857ff0] [c0013c30] kernel_thread+0x4c/0x68
> Instruction dump:
> 4e800020 4800fcb5 4bffff50 4802782d 4bffffc8 48076dd9 4bffff6c 9421fff0
> 7c0802a6 93e1000c 7c7f1b78 90010014 <80030058> 2f800000 409e00cc 81630068
> Kernel panic - not syncing: Fatal exception in interrupt
> Rebooting in 180 seconds..
> 
> So it seems as soon as it touched the phy settings, it blew up.
> 
> Now perhaps the ipipe interrupt handling code changes the behaviour
> enough that it makes the spinlock_irqsave necesary and that is why it
> worked before.  Maybe ipipe is doing something wrong, given ipipe only
> supports 2.6.30 for powerpc and I personally ported it to 2.6.31 and
> then 2.6.32.  Everything else works fine though as long as I revert this
> particular patch.

Oh and I will be off on vacation for about a week by tomorrow, so if I
don't fix it today, I will be a bit slow at getting back to you
on this.  Not that it is bothering any real users yet (they are using
2.6.30 for now).

-- 
Len Sorensen

^ permalink raw reply

* Re: [PATCH 10/13] mac68k: start CUDA early, take 2
From: Geert Uytterhoeven @ 2009-12-23 20:15 UTC (permalink / raw)
  To: Finn Thain; +Cc: linux-m68k, linuxppc-dev
In-Reply-To: <alpine.OSX.2.00.0911171715450.371@silk.local>

On Tue, Nov 17, 2009 at 10:03, Finn Thain <fthain@telegraphics.com.au> wrot=
e:
> The valkyriefb driver needs the CUDA to work in order to set the video
> mode at boot. So initialise the device earlier, and bring the m68k code
> closer to the powermac code.
>
> Take 2 was changed as per Benjamin Herrenschmidt's review.

Ben, OK for you?

> Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
>
> ---
> =C2=A0arch/m68k/mac/config.c =C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A06 +++
> =C2=A0drivers/macintosh/adb.c =C2=A0 =C2=A0 =C2=A0| =C2=A0 =C2=A06 ++-
> =C2=A0drivers/macintosh/via-cuda.c | =C2=A0 74 +++++++++++++++++++++++---=
-----------------
> =C2=A03 files changed, 51 insertions(+), 35 deletions(-)
>
> Index: linux-2.6.31/arch/m68k/mac/config.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-2.6.31.orig/arch/m68k/mac/config.c =C2=A0 =C2=A02009-11-17 17:1=
1:47.000000000 +1100
> +++ linux-2.6.31/arch/m68k/mac/config.c 2009-11-17 17:11:47.000000000 +11=
00
> @@ -23,6 +23,8 @@
> =C2=A0#include <linux/init.h>
> =C2=A0#include <linux/vt_kern.h>
> =C2=A0#include <linux/platform_device.h>
> +#include <linux/adb.h>
> +#include <linux/cuda.h>
>
> =C2=A0#define BOOTINFO_COMPAT_1_0
> =C2=A0#include <asm/setup.h>
> @@ -889,6 +891,10 @@ static void __init mac_identify(void)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0oss_init();
> =C2=A0 =C2=A0 =C2=A0 =C2=A0psc_init();
> =C2=A0 =C2=A0 =C2=A0 =C2=A0baboon_init();
> +
> +#ifdef CONFIG_ADB_CUDA
> + =C2=A0 =C2=A0 =C2=A0 find_via_cuda();
> +#endif
> =C2=A0}
>
> =C2=A0static void __init mac_report_hardware(void)
> Index: linux-2.6.31/drivers/macintosh/via-cuda.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-2.6.31.orig/drivers/macintosh/via-cuda.c =C2=A0 =C2=A0 =C2=A020=
09-11-17 17:07:58.000000000 +1100
> +++ linux-2.6.31/drivers/macintosh/via-cuda.c =C2=A0 2009-11-17 17:11:47.=
000000000 +1100
> @@ -89,7 +89,6 @@ static int cuda_fully_inited;
>
> =C2=A0#ifdef CONFIG_ADB
> =C2=A0static int cuda_probe(void);
> -static int cuda_init(void);
> =C2=A0static int cuda_send_request(struct adb_request *req, int sync);
> =C2=A0static int cuda_adb_autopoll(int devs);
> =C2=A0static int cuda_reset_adb_bus(void);
> @@ -107,17 +106,42 @@ int cuda_request(struct adb_request *req
>
> =C2=A0#ifdef CONFIG_ADB
> =C2=A0struct adb_driver via_cuda_driver =3D {
> - =C2=A0 =C2=A0 =C2=A0 "CUDA",
> - =C2=A0 =C2=A0 =C2=A0 cuda_probe,
> - =C2=A0 =C2=A0 =C2=A0 cuda_init,
> - =C2=A0 =C2=A0 =C2=A0 cuda_send_request,
> - =C2=A0 =C2=A0 =C2=A0 cuda_adb_autopoll,
> - =C2=A0 =C2=A0 =C2=A0 cuda_poll,
> - =C2=A0 =C2=A0 =C2=A0 cuda_reset_adb_bus
> + =C2=A0 =C2=A0 =C2=A0 .name =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D "CUDA",
> + =C2=A0 =C2=A0 =C2=A0 .probe =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D cuda_probe,
> + =C2=A0 =C2=A0 =C2=A0 .send_request =3D cuda_send_request,
> + =C2=A0 =C2=A0 =C2=A0 .autopoll =C2=A0 =C2=A0 =3D cuda_adb_autopoll,
> + =C2=A0 =C2=A0 =C2=A0 .poll =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D cuda_poll,
> + =C2=A0 =C2=A0 =C2=A0 .reset_bus =C2=A0 =C2=A0=3D cuda_reset_adb_bus,
> =C2=A0};
> =C2=A0#endif /* CONFIG_ADB */
>
> -#ifdef CONFIG_PPC
> +#ifdef CONFIG_MAC
> +int __init find_via_cuda(void)
> +{
> + =C2=A0 =C2=A0struct adb_request req;
> + =C2=A0 =C2=A0int err;
> +
> + =C2=A0 =C2=A0if (macintosh_config->adb_type !=3D MAC_ADB_CUDA)
> + =C2=A0 =C2=A0 =C2=A0 return 0;
> +
> + =C2=A0 =C2=A0via =3D via1;
> + =C2=A0 =C2=A0cuda_state =3D idle;
> +
> + =C2=A0 =C2=A0err =3D cuda_init_via();
> + =C2=A0 =C2=A0if (err) {
> + =C2=A0 =C2=A0 =C2=A0 printk(KERN_ERR "cuda_init_via() failed\n");
> + =C2=A0 =C2=A0 =C2=A0 via =3D NULL;
> + =C2=A0 =C2=A0 =C2=A0 return 0;
> + =C2=A0 =C2=A0}
> +
> + =C2=A0 =C2=A0/* enable autopoll */
> + =C2=A0 =C2=A0cuda_request(&req, NULL, 3, CUDA_PACKET, CUDA_AUTOPOLL, 1)=
;
> + =C2=A0 =C2=A0while (!req.complete)
> + =C2=A0 =C2=A0 =C2=A0 cuda_poll();
> +
> + =C2=A0 =C2=A0return 1;
> +}
> +#else
> =C2=A0int __init find_via_cuda(void)
> =C2=A0{
> =C2=A0 =C2=A0 struct adb_request req;
> @@ -175,7 +199,7 @@ int __init find_via_cuda(void)
> =C2=A0 =C2=A0 vias =3D NULL;
> =C2=A0 =C2=A0 return 0;
> =C2=A0}
> -#endif /* CONFIG_PPC */
> +#endif /* !defined CONFIG_MAC */
>
> =C2=A0static int __init via_cuda_start(void)
> =C2=A0{
> @@ -184,14 +208,14 @@ static int __init via_cuda_start(void)
>
> =C2=A0#ifdef CONFIG_MAC
> =C2=A0 =C2=A0 cuda_irq =3D IRQ_MAC_ADB;
> -#else /* CONFIG_MAC */
> +#else
> =C2=A0 =C2=A0 cuda_irq =3D irq_of_parse_and_map(vias, 0);
> =C2=A0 =C2=A0 if (cuda_irq =3D=3D NO_IRQ) {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0printk(KERN_ERR "via-cuda: can't map interrupt=
s for %s\n",
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 vias->full_name);
> =C2=A0 =C2=A0 =C2=A0 =C2=A0return -ENODEV;
> =C2=A0 =C2=A0 }
> -#endif /* CONFIG_MAC */
> +#endif
>
> =C2=A0 =C2=A0 if (request_irq(cuda_irq, cuda_interrupt, 0, "ADB", cuda_in=
terrupt)) {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0printk(KERN_ERR "via-cuda: can't request irq %=
d\n", cuda_irq);
> @@ -216,28 +240,10 @@ cuda_probe(void)
> =C2=A0#else
> =C2=A0 =C2=A0 if (macintosh_config->adb_type !=3D MAC_ADB_CUDA)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0return -ENODEV;
> - =C2=A0 =C2=A0via =3D via1;
> =C2=A0#endif
> - =C2=A0 =C2=A0return 0;
> -}
> -
> -static int __init
> -cuda_init(void)
> -{
> -#ifdef CONFIG_PPC
> =C2=A0 =C2=A0 if (via =3D=3D NULL)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0return -ENODEV;
> =C2=A0 =C2=A0 return 0;
> -#else
> - =C2=A0 =C2=A0int err =3D cuda_init_via();
> - =C2=A0 =C2=A0if (err) {
> - =C2=A0 =C2=A0 =C2=A0 printk(KERN_ERR "cuda_init_via() failed\n");
> - =C2=A0 =C2=A0 =C2=A0 return -ENODEV;
> - =C2=A0 =C2=A0}
> - =C2=A0 =C2=A0out_8(&via[IER], IER_SET|SR_INT); /* enable interrupt from=
 SR */
> -
> - =C2=A0 =C2=A0return via_cuda_start();
> -#endif
> =C2=A0}
> =C2=A0#endif /* CONFIG_ADB */
>
> @@ -430,9 +436,11 @@ cuda_poll(void)
> =C2=A0 =C2=A0 /* cuda_interrupt only takes a normal lock, we disable
> =C2=A0 =C2=A0 =C2=A0* interrupts here to avoid re-entering and thus deadl=
ocking.
> =C2=A0 =C2=A0 =C2=A0*/
> - =C2=A0 =C2=A0disable_irq(cuda_irq);
> + =C2=A0 =C2=A0if (cuda_irq)
> + =C2=A0 =C2=A0 =C2=A0 disable_irq(cuda_irq);
> =C2=A0 =C2=A0 cuda_interrupt(0, NULL);
> - =C2=A0 =C2=A0enable_irq(cuda_irq);
> + =C2=A0 =C2=A0if (cuda_irq)
> + =C2=A0 =C2=A0 =C2=A0 enable_irq(cuda_irq);
> =C2=A0}
>
> =C2=A0static irqreturn_t
> @@ -446,7 +454,7 @@ cuda_interrupt(int irq, void *arg)
>
> =C2=A0 =C2=A0 spin_lock(&cuda_lock);
>
> - =C2=A0 =C2=A0/* On powermacs, this handler is registered for the VIA IR=
Q. But it uses
> + =C2=A0 =C2=A0/* On powermacs, this handler is registered for the VIA IR=
Q. But they use
> =C2=A0 =C2=A0 =C2=A0* just the shift register IRQ -- other VIA interrupt =
sources are disabled.
> =C2=A0 =C2=A0 =C2=A0* On m68k macs, the VIA IRQ sources are dispatched in=
dividually. Unless
> =C2=A0 =C2=A0 =C2=A0* we are polling, the shift register IRQ flag has alr=
eady been cleared.
> Index: linux-2.6.31/drivers/macintosh/adb.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-2.6.31.orig/drivers/macintosh/adb.c =C2=A0 2009-11-17 17:07:58.=
000000000 +1100
> +++ linux-2.6.31/drivers/macintosh/adb.c =C2=A0 =C2=A0 =C2=A0 =C2=A02009-=
11-17 17:11:47.000000000 +1100
> @@ -317,9 +317,11 @@ static int __init adb_init(void)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0break;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
> =C2=A0 =C2=A0 =C2=A0 =C2=A0}
> - =C2=A0 =C2=A0 =C2=A0 if ((adb_controller =3D=3D NULL) || adb_controller=
->init()) {
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 printk(KERN_WARNING "W=
arning: no ADB interface detected\n");
> + =C2=A0 =C2=A0 =C2=A0 if (adb_controller !=3D NULL && adb_controller->in=
it &&
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 adb_controller->init())
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0adb_controller =3D=
 NULL;
> + =C2=A0 =C2=A0 =C2=A0 if (adb_controller =3D=3D NULL) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 printk(KERN_WARNING "W=
arning: no ADB interface detected\n");
> =C2=A0 =C2=A0 =C2=A0 =C2=A0} else {
> =C2=A0#ifdef CONFIG_PPC
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (machine_is_com=
patible("AAPL,PowerBook1998") ||
>



--=20
Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k=
.org

In personal conversations with technical people, I call myself a hacker. Bu=
t
when I'm talking to journalists I just say "programmer" or something like t=
hat.
							    -- Linus Torvalds

^ permalink raw reply

* Re: [PATCH 1/2] pmac-zilog: add platform driver
From: Geert Uytterhoeven @ 2009-12-23 20:16 UTC (permalink / raw)
  To: Finn Thain; +Cc: linux-m68k, linuxppc-dev
In-Reply-To: <alpine.OSX.2.00.0911171657290.371@silk.local>

On Tue, Nov 17, 2009 at 10:04, Finn Thain <fthain@telegraphics.com.au> wrot=
e:
> Add platform driver to the pmac-zilog driver for mac 68k, putting the
> powermac-specific bits inside #ifdef CONFIG_PPC_PMAC.

Ben, OK for you?

> This patch should be applied after "[PATCH 3/13] pmac-zilog: cleanup". It
> renders obsolete the version in "[PATCH 4/13] pmac-zilog, mac68k: replace
> mac68k SCC code with platform".
>
> Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
>
> ---
> =C2=A0arch/m68k/configs/mac_defconfig =C2=A0 | =C2=A0 =C2=A05 +
> =C2=A0arch/m68k/configs/multi_defconfig | =C2=A0 =C2=A05 +
> =C2=A0drivers/serial/Kconfig =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =
=C2=A0 12 +-
> =C2=A0drivers/serial/pmac_zilog.c =C2=A0 =C2=A0 =C2=A0 | =C2=A0159 ++++++=
+++++++++++++++++++++++++++-----
> =C2=A0drivers/serial/pmac_zilog.h =C2=A0 =C2=A0 =C2=A0 | =C2=A0 14 +++
> =C2=A05 files changed, 169 insertions(+), 26 deletions(-)
>
> Index: linux-2.6.31/drivers/serial/Kconfig
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-2.6.31.orig/drivers/serial/Kconfig =C2=A0 =C2=A02009-11-17 17:0=
5:27.000000000 +1100
> +++ linux-2.6.31/drivers/serial/Kconfig 2009-11-17 17:07:38.000000000 +11=
00
> @@ -1079,12 +1079,12 @@ config SERIAL_68360
> =C2=A0 =C2=A0 =C2=A0 =C2=A0default y
>
> =C2=A0config SERIAL_PMACZILOG
> - =C2=A0 =C2=A0 =C2=A0 tristate "PowerMac z85c30 ESCC support"
> - =C2=A0 =C2=A0 =C2=A0 depends on PPC_OF && PPC_PMAC
> + =C2=A0 =C2=A0 =C2=A0 tristate "Mac or PowerMac z85c30 ESCC support"
> + =C2=A0 =C2=A0 =C2=A0 depends on (M68K && MAC) || (PPC_OF && PPC_PMAC)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0select SERIAL_CORE
> =C2=A0 =C2=A0 =C2=A0 =C2=A0help
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0This driver supports the Zilog z85C30 s=
erial ports found on
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 PowerMac machines.
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 (Power)Mac machines.
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Say Y or M if you want to be able to th=
ese serial ports.
>
> =C2=A0config SERIAL_PMACZILOG_TTYS
> @@ -1109,16 +1109,16 @@ config SERIAL_PMACZILOG_TTYS
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0unable to use the 8250 module for PCMCI=
A or other 16C550-style
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0UARTs.
>
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 Say N unless you need the z85c30 ports on y=
our powermac
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 Say N unless you need the z85c30 ports on y=
our (Power)Mac
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0to appear as /dev/ttySn.
>
> =C2=A0config SERIAL_PMACZILOG_CONSOLE
> - =C2=A0 =C2=A0 =C2=A0 bool "Console on PowerMac z85c30 serial port"
> + =C2=A0 =C2=A0 =C2=A0 bool "Console on Mac or PowerMac z85c30 serial por=
t"
> =C2=A0 =C2=A0 =C2=A0 =C2=A0depends on SERIAL_PMACZILOG=3Dy
> =C2=A0 =C2=A0 =C2=A0 =C2=A0select SERIAL_CORE_CONSOLE
> =C2=A0 =C2=A0 =C2=A0 =C2=A0help
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0If you would like to be able to use the=
 z85c30 serial port
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 on your PowerMac as the console, you can do=
 so by answering
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 on your (Power)Mac as the console, you can =
do so by answering
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Y to this option.
>
> =C2=A0config SERIAL_LH7A40X
> Index: linux-2.6.31/arch/m68k/configs/mac_defconfig
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-2.6.31.orig/arch/m68k/configs/mac_defconfig =C2=A0 2009-11-17 1=
7:07:29.000000000 +1100
> +++ linux-2.6.31/arch/m68k/configs/mac_defconfig =C2=A0 =C2=A0 =C2=A0 =C2=
=A02009-11-17 17:07:38.000000000 +1100
> @@ -701,6 +701,11 @@ CONFIG_VT_HW_CONSOLE_BINDING=3Dy
> =C2=A0#
> =C2=A0# Non-8250 serial port support
> =C2=A0#
> +CONFIG_SERIAL_CORE=3Dy
> +CONFIG_SERIAL_CORE_CONSOLE=3Dy
> +CONFIG_SERIAL_PMACZILOG=3Dy
> +CONFIG_SERIAL_PMACZILOG_TTYS=3Dy
> +CONFIG_SERIAL_PMACZILOG_CONSOLE=3Dy
> =C2=A0CONFIG_UNIX98_PTYS=3Dy
> =C2=A0# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
> =C2=A0CONFIG_LEGACY_PTYS=3Dy
> Index: linux-2.6.31/arch/m68k/configs/multi_defconfig
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-2.6.31.orig/arch/m68k/configs/multi_defconfig 2009-11-17 17:07:=
29.000000000 +1100
> +++ linux-2.6.31/arch/m68k/configs/multi_defconfig =C2=A0 =C2=A0 =C2=A020=
09-11-17 17:07:38.000000000 +1100
> @@ -822,6 +822,11 @@ CONFIG_A2232=3Dy
> =C2=A0#
> =C2=A0# Non-8250 serial port support
> =C2=A0#
> +CONFIG_SERIAL_CORE=3Dy
> +CONFIG_SERIAL_CORE_CONSOLE=3Dy
> +CONFIG_SERIAL_PMACZILOG=3Dy
> +CONFIG_SERIAL_PMACZILOG_TTYS=3Dy
> +CONFIG_SERIAL_PMACZILOG_CONSOLE=3Dy
> =C2=A0CONFIG_UNIX98_PTYS=3Dy
> =C2=A0# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
> =C2=A0CONFIG_LEGACY_PTYS=3Dy
> Index: linux-2.6.31/drivers/serial/pmac_zilog.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-2.6.31.orig/drivers/serial/pmac_zilog.c =C2=A0 =C2=A0 =C2=A0 20=
09-11-17 17:07:28.000000000 +1100
> +++ linux-2.6.31/drivers/serial/pmac_zilog.c =C2=A0 =C2=A02009-11-17 17:0=
7:38.000000000 +1100
> @@ -63,11 +63,18 @@
> =C2=A0#include <asm/sections.h>
> =C2=A0#include <asm/io.h>
> =C2=A0#include <asm/irq.h>
> +
> +#ifdef CONFIG_PPC_PMAC
> =C2=A0#include <asm/prom.h>
> =C2=A0#include <asm/machdep.h>
> =C2=A0#include <asm/pmac_feature.h>
> =C2=A0#include <asm/dbdma.h>
> =C2=A0#include <asm/macio.h>
> +#else
> +#include <linux/platform_device.h>
> +#include <asm/macints.h>
> +#define machine_is_compatible(x) (0)
> +#endif
>
> =C2=A0#if defined (CONFIG_SERIAL_PMACZILOG_CONSOLE) && defined(CONFIG_MAG=
IC_SYSRQ)
> =C2=A0#define SUPPORT_SYSRQ
> @@ -83,11 +90,9 @@
>
> =C2=A0static char version[] __initdata =3D "pmac_zilog: 0.6 (Benjamin Her=
renschmidt <benh@kernel.crashing.org>)";
> =C2=A0MODULE_AUTHOR("Benjamin Herrenschmidt <benh@kernel.crashing.org>");
> -MODULE_DESCRIPTION("Driver for the PowerMac serial ports.");
> +MODULE_DESCRIPTION("Driver for the Mac and PowerMac serial ports.");
> =C2=A0MODULE_LICENSE("GPL");
>
> -#define PWRDBG(fmt, arg...) =C2=A0 =C2=A0printk(KERN_DEBUG fmt , ## arg)
> -
> =C2=A0#ifdef CONFIG_SERIAL_PMACZILOG_TTYS
> =C2=A0#define PMACZILOG_MAJOR =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0TTY_MAJOR
> =C2=A0#define PMACZILOG_MINOR =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A064
> @@ -341,7 +346,7 @@ static struct tty_struct *pmz_receive_ch
> =C2=A0 =C2=A0 =C2=A0 =C2=A0uap->curregs[R1] &=3D ~(EXT_INT_ENAB | TxINT_E=
NAB | RxINT_MASK);
> =C2=A0 =C2=A0 =C2=A0 =C2=A0write_zsreg(uap, R1, uap->curregs[R1]);
> =C2=A0 =C2=A0 =C2=A0 =C2=A0zssync(uap);
> - =C2=A0 =C2=A0 =C2=A0 dev_err(&uap->dev->ofdev.dev, "pmz: rx irq flood !=
\n");
> + =C2=A0 =C2=A0 =C2=A0 pmz_error("pmz: rx irq flood !\n");
> =C2=A0 =C2=A0 =C2=A0 =C2=A0return tty;
> =C2=A0}
>
> @@ -746,6 +751,8 @@ static void pmz_break_ctl(struct uart_po
> =C2=A0 =C2=A0 =C2=A0 =C2=A0spin_unlock_irqrestore(&port->lock, flags);
> =C2=A0}
>
> +#ifdef CONFIG_PPC_PMAC
> +
> =C2=A0/*
> =C2=A0* Turn power on or off to the SCC and associated stuff
> =C2=A0* (port drivers, modem, IR port, etc.)
> @@ -781,6 +788,15 @@ static int pmz_set_scc_power(struct uart
> =C2=A0 =C2=A0 =C2=A0 =C2=A0return delay;
> =C2=A0}
>
> +#else
> +
> +static int pmz_set_scc_power(struct uart_pmac_port *uap, int state)
> +{
> + =C2=A0 =C2=A0 =C2=A0 return 0;
> +}
> +
> +#endif /* !CONFIG_PPC_PMAC */
> +
> =C2=A0/*
> =C2=A0* FixZeroBug....Works around a bug in the SCC receving channel.
> =C2=A0* Inspired from Darwin code, 15 Sept. 2000 =C2=A0-DanM
> @@ -943,9 +959,9 @@ static int pmz_startup(struct uart_port
> =C2=A0 =C2=A0 =C2=A0 =C2=A0}
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0pmz_get_port_A(uap)->flags |=3D PMACZILOG_FLAG=
_IS_IRQ_ON;
> - =C2=A0 =C2=A0 =C2=A0 if (request_irq(uap->port.irq, pmz_interrupt, IRQF=
_SHARED, "PowerMac Zilog", uap)) {
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 dev_err(&uap->dev->ofd=
ev.dev,
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 "Unable to register zs interrupt handler.\n");
> + =C2=A0 =C2=A0 =C2=A0 if (request_irq(uap->port.irq, pmz_interrupt, IRQF=
_SHARED,
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 "SCC", uap)) {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pmz_error("Unable to r=
egister zs interrupt handler.\n");
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pmz_set_scc_power(=
uap, 0);
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0mutex_unlock(&pmz_=
irq_mutex);
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -ENXIO;
> @@ -1185,7 +1201,7 @@ static void pmz_irda_setup(struct uart_p
> =C2=A0 =C2=A0 =C2=A0 =C2=A0while ((read_zsreg(uap, R0) & Tx_BUF_EMP) =3D=
=3D 0
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 || (read_zsreg(uap, R1) =
& ALL_SNT) =3D=3D 0) {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (--t <=3D 0) {
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 dev_err(&uap->dev->ofdev.dev, "transmitter didn't drain\n");
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 pmz_error("transmitter didn't drain\n");
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0return;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0udelay(10);
> @@ -1201,7 +1217,7 @@ static void pmz_irda_setup(struct uart_p
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0read_zsdata(uap);
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0mdelay(10);
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (--t <=3D 0) {
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 dev_err(&uap->dev->ofdev.dev, "receiver didn't drain\n");
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 pmz_error("receiver didn't drain\n");
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0return;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
> =C2=A0 =C2=A0 =C2=A0 =C2=A0}
> @@ -1222,8 +1238,7 @@ static void pmz_irda_setup(struct uart_p
> =C2=A0 =C2=A0 =C2=A0 =C2=A0t =3D 5000;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0while ((read_zsreg(uap, R0) & Rx_CH_AV) =3D=3D=
 0) {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (--t <=3D 0) {
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 dev_err(&uap->dev->ofdev.dev,
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "irda_setup timed out on get_version byt=
e\n");
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 pmz_error("irda_setup timed out on get_version byte\n");
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0goto out;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0udelay(10);
> @@ -1231,8 +1246,7 @@ static void pmz_irda_setup(struct uart_p
> =C2=A0 =C2=A0 =C2=A0 =C2=A0version =3D read_zsdata(uap);
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0if (version < 4) {
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 dev_info(&uap->dev->of=
dev.dev, "IrDA: dongle version %d not supported\n",
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0version);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pmz_info("IrDA: dongle=
 version %d not supported\n", version);
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0goto out;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0}
>
> @@ -1241,19 +1255,17 @@ static void pmz_irda_setup(struct uart_p
> =C2=A0 =C2=A0 =C2=A0 =C2=A0t =3D 5000;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0while ((read_zsreg(uap, R0) & Rx_CH_AV) =3D=3D=
 0) {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (--t <=3D 0) {
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 dev_err(&uap->dev->ofdev.dev,
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "irda_setup timed out on speed mode byte=
\n");
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 pmz_error("irda_setup timed out on speed mode byte\n");
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0goto out;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0udelay(10);
> =C2=A0 =C2=A0 =C2=A0 =C2=A0}
> =C2=A0 =C2=A0 =C2=A0 =C2=A0t =3D read_zsdata(uap);
> =C2=A0 =C2=A0 =C2=A0 =C2=A0if (t !=3D cmdbyte)
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 dev_err(&uap->dev->ofd=
ev.dev,
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 "irda_setup speed mode byte =3D %x (%x)\n", t, cmdbyte);
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 pmz_error("irda_setup =
speed mode byte =3D %x (%x)\n", t, cmdbyte);
>
> - =C2=A0 =C2=A0 =C2=A0 dev_info(&uap->dev->ofdev.dev, "IrDA setup for %ld=
 bps, dongle version: %d\n",
> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*baud, version);
> + =C2=A0 =C2=A0 =C2=A0 pmz_info("IrDA setup for %ld bps, dongle version: =
%d\n",
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*baud, version);
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0(void)read_zsdata(uap);
> =C2=A0 =C2=A0 =C2=A0 =C2=A0(void)read_zsdata(uap);
> @@ -1402,7 +1414,7 @@ static void pmz_poll_put_char(struct uar
> =C2=A0 =C2=A0 =C2=A0 =C2=A0write_zsdata(uap, c);
> =C2=A0}
>
> -#endif
> +#endif /* CONFIG_CONSOLE_POLL */
>
> =C2=A0static struct uart_ops pmz_pops =3D {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0.tx_empty =C2=A0 =C2=A0 =C2=A0 =3D =C2=A0 =C2=
=A0 =C2=A0 pmz_tx_empty,
> @@ -1427,6 +1439,8 @@ static struct uart_ops pmz_pops =3D {
> =C2=A0#endif
> =C2=A0};
>
> +#ifdef CONFIG_PPC_PMAC
> +
> =C2=A0/*
> =C2=A0* Setup one port structure after probing, HW is down at this point,
> =C2=A0* Unlike sunzilog, we don't need to pre-init the spinlock as we don=
't
> @@ -1823,6 +1837,88 @@ next:
> =C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;
> =C2=A0}
>
> +#else
> +
> +extern struct platform_device scc_a_pdev, scc_b_pdev;
> +
> +static int __init pmz_init_port(struct uart_pmac_port *uap)
> +{
> + =C2=A0 =C2=A0 =C2=A0 struct resource *r_ports;
> + =C2=A0 =C2=A0 =C2=A0 int irq;
> +
> + =C2=A0 =C2=A0 =C2=A0 r_ports =3D platform_get_resource(uap->node, IORES=
OURCE_MEM, 0);
> + =C2=A0 =C2=A0 =C2=A0 irq =3D platform_get_irq(uap->node, 0);
> + =C2=A0 =C2=A0 =C2=A0 if (!r_ports || !irq)
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -ENODEV;
> +
> + =C2=A0 =C2=A0 =C2=A0 uap->port.mapbase =C2=A0=3D r_ports->start;
> + =C2=A0 =C2=A0 =C2=A0 uap->port.membase =C2=A0=3D (unsigned char __iomem=
 *) r_ports->start;
> + =C2=A0 =C2=A0 =C2=A0 uap->port.iotype =C2=A0 =3D UPIO_MEM;
> + =C2=A0 =C2=A0 =C2=A0 uap->port.irq =C2=A0 =C2=A0 =C2=A0=3D irq;
> + =C2=A0 =C2=A0 =C2=A0 uap->port.uartclk =C2=A0=3D ZS_CLOCK;
> + =C2=A0 =C2=A0 =C2=A0 uap->port.fifosize =3D 1;
> + =C2=A0 =C2=A0 =C2=A0 uap->port.ops =C2=A0 =C2=A0 =C2=A0=3D &pmz_pops;
> + =C2=A0 =C2=A0 =C2=A0 uap->port.type =C2=A0 =C2=A0 =3D PORT_PMAC_ZILOG;
> + =C2=A0 =C2=A0 =C2=A0 uap->port.flags =C2=A0 =C2=A0=3D 0;
> +
> + =C2=A0 =C2=A0 =C2=A0 uap->control_reg =C2=A0 =3D uap->port.membase;
> + =C2=A0 =C2=A0 =C2=A0 uap->data_reg =C2=A0 =C2=A0 =C2=A0=3D uap->control=
_reg + 4;
> + =C2=A0 =C2=A0 =C2=A0 uap->port_type =C2=A0 =C2=A0 =3D 0;
> +
> + =C2=A0 =C2=A0 =C2=A0 pmz_convert_to_zs(uap, CS8, 0, 9600);
> +
> + =C2=A0 =C2=A0 =C2=A0 return 0;
> +}
> +
> +static int __init pmz_probe(void)
> +{
> + =C2=A0 =C2=A0 =C2=A0 int err;
> +
> + =C2=A0 =C2=A0 =C2=A0 pmz_ports_count =3D 0;
> +
> + =C2=A0 =C2=A0 =C2=A0 pmz_ports[0].mate =C2=A0 =C2=A0 =C2=A0=3D &pmz_por=
ts[1];
> + =C2=A0 =C2=A0 =C2=A0 pmz_ports[0].port.line =3D 0;
> + =C2=A0 =C2=A0 =C2=A0 pmz_ports[0].flags =C2=A0 =C2=A0 =3D PMACZILOG_FLA=
G_IS_CHANNEL_A;
> + =C2=A0 =C2=A0 =C2=A0 pmz_ports[0].node =C2=A0 =C2=A0 =C2=A0=3D &scc_a_p=
dev;
> + =C2=A0 =C2=A0 =C2=A0 err =3D pmz_init_port(&pmz_ports[0]);
> + =C2=A0 =C2=A0 =C2=A0 if (err)
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return err;
> + =C2=A0 =C2=A0 =C2=A0 pmz_ports_count++;
> +
> + =C2=A0 =C2=A0 =C2=A0 pmz_ports[1].mate =C2=A0 =C2=A0 =C2=A0=3D &pmz_por=
ts[0];
> + =C2=A0 =C2=A0 =C2=A0 pmz_ports[1].port.line =3D 1;
> + =C2=A0 =C2=A0 =C2=A0 pmz_ports[1].flags =C2=A0 =C2=A0 =3D 0;
> + =C2=A0 =C2=A0 =C2=A0 pmz_ports[1].node =C2=A0 =C2=A0 =C2=A0=3D &scc_b_p=
dev;
> + =C2=A0 =C2=A0 =C2=A0 err =3D pmz_init_port(&pmz_ports[1]);
> + =C2=A0 =C2=A0 =C2=A0 if (err)
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return err;
> + =C2=A0 =C2=A0 =C2=A0 pmz_ports_count++;
> +
> + =C2=A0 =C2=A0 =C2=A0 return 0;
> +}
> +
> +static void pmz_dispose_port(struct uart_pmac_port *uap)
> +{
> + =C2=A0 =C2=A0 =C2=A0 memset(uap, 0, sizeof(struct uart_pmac_port));
> +}
> +
> +static int pmz_attach(struct platform_device *pdev)
> +{
> + =C2=A0 =C2=A0 =C2=A0 int i;
> +
> + =C2=A0 =C2=A0 =C2=A0 for (i =3D 0; i < pmz_ports_count; i++)
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (pmz_ports[i].node =
=3D=3D pdev)
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 return 0;
> + =C2=A0 =C2=A0 =C2=A0 return -ENODEV;
> +}
> +
> +static int pmz_detach(struct platform_device *pdev)
> +{
> + =C2=A0 =C2=A0 =C2=A0 return 0;
> +}
> +
> +#endif /* !CONFIG_PPC_PMAC */
> +
> =C2=A0#ifdef CONFIG_SERIAL_PMACZILOG_CONSOLE
>
> =C2=A0static void pmz_console_write(struct console *con, const char *s, u=
nsigned int count);
> @@ -1883,6 +1979,8 @@ err_out:
> =C2=A0 =C2=A0 =C2=A0 =C2=A0return rc;
> =C2=A0}
>
> +#ifdef CONFIG_PPC_PMAC
> +
> =C2=A0static struct of_device_id pmz_match[] =3D
> =C2=A0{
> =C2=A0 =C2=A0 =C2=A0 =C2=A0{
> @@ -1904,6 +2002,19 @@ static struct macio_driver pmz_driver =3D
> =C2=A0 =C2=A0 =C2=A0 =C2=A0.resume =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D pmz_re=
sume,
> =C2=A0};
>
> +#else
> +
> +static struct platform_driver pmz_driver =3D {
> + =C2=A0 =C2=A0 =C2=A0 .probe =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=3D pmz_a=
ttach,
> + =C2=A0 =C2=A0 =C2=A0 .remove =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D __devexit_=
p(pmz_detach),
> + =C2=A0 =C2=A0 =C2=A0 .driver =C2=A0 =C2=A0 =C2=A0 =C2=A0 =3D {
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .name =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =3D "scc",
> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 .owner =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0=3D THIS_MODULE,
> + =C2=A0 =C2=A0 =C2=A0 },
> +};
> +
> +#endif /* !CONFIG_PPC_PMAC */
> +
> =C2=A0static int __init init_pmz(void)
> =C2=A0{
> =C2=A0 =C2=A0 =C2=A0 =C2=A0int rc, i;
> @@ -1942,15 +2053,23 @@ static int __init init_pmz(void)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0/*
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 * Then we register the macio driver itself
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 */
> +#ifdef CONFIG_PPC_PMAC
> =C2=A0 =C2=A0 =C2=A0 =C2=A0return macio_register_driver(&pmz_driver);
> +#else
> + =C2=A0 =C2=A0 =C2=A0 return platform_driver_register(&pmz_driver);
> +#endif
> =C2=A0}
>
> =C2=A0static void __exit exit_pmz(void)
> =C2=A0{
> =C2=A0 =C2=A0 =C2=A0 =C2=A0int i;
>
> +#ifdef CONFIG_PPC_PMAC
> =C2=A0 =C2=A0 =C2=A0 =C2=A0/* Get rid of macio-driver (detach from macio)=
 */
> =C2=A0 =C2=A0 =C2=A0 =C2=A0macio_unregister_driver(&pmz_driver);
> +#else
> + =C2=A0 =C2=A0 =C2=A0 platform_driver_unregister(&pmz_driver);
> +#endif
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0for (i =3D 0; i < pmz_ports_count; i++) {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0struct uart_pmac_p=
ort *uport =3D &pmz_ports[i];
> Index: linux-2.6.31/drivers/serial/pmac_zilog.h
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-2.6.31.orig/drivers/serial/pmac_zilog.h =C2=A0 =C2=A0 =C2=A0 20=
09-11-17 17:07:28.000000000 +1100
> +++ linux-2.6.31/drivers/serial/pmac_zilog.h =C2=A0 =C2=A02009-11-17 17:0=
7:38.000000000 +1100
> @@ -1,7 +1,15 @@
> =C2=A0#ifndef __PMAC_ZILOG_H__
> =C2=A0#define __PMAC_ZILOG_H__
>
> +#ifdef CONFIG_PPC_PMAC
> =C2=A0#define pmz_debug(fmt, arg...) dev_dbg(&uap->dev->ofdev.dev, fmt, #=
# arg)
> +#define pmz_error(fmt, arg...) dev_err(&uap->dev->ofdev.dev, fmt, ## arg=
)
> +#define pmz_info(fmt, arg...) =C2=A0dev_info(&uap->dev->ofdev.dev, fmt, =
## arg)
> +#else
> +#define pmz_debug(fmt, arg...) do { } while (0)
> +#define pmz_error(fmt, arg...) printk(KERN_ERR fmt, ## arg)
> +#define pmz_info(fmt, arg...) =C2=A0printk(KERN_INFO fmt, ## arg)
> +#endif
>
> =C2=A0/*
> =C2=A0* At most 2 ESCCs with 2 ports each
> @@ -17,6 +25,7 @@ struct uart_pmac_port {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0struct uart_port =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0port;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0struct uart_pmac_port =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 *mate;
>
> +#ifdef CONFIG_PPC_PMAC
> =C2=A0 =C2=A0 =C2=A0 =C2=A0/* macio_dev for the escc holding this port (m=
aybe be null on
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 * early inited port)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 */
> @@ -25,6 +34,9 @@ struct uart_pmac_port {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 * of "escc" node (ie. ch-a or ch-b)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 */
> =C2=A0 =C2=A0 =C2=A0 =C2=A0struct device_node =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0*node;
> +#else
> + =C2=A0 =C2=A0 =C2=A0 struct platform_device =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0*node;
> +#endif
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0/* Port type as obtained from device tree (IRD=
A, modem, ...) */
> =C2=A0 =C2=A0 =C2=A0 =C2=A0int =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 port_type;
> @@ -55,10 +67,12 @@ struct uart_pmac_port {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0volatile u8 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 __iomem *control_reg;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0volatile u8 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 __iomem *data_reg;
>
> +#ifdef CONFIG_PPC_PMAC
> =C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0tx_dma_irq;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0rx_dma_irq;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0volatile struct dbdma_regs =C2=A0 =C2=A0 =C2=
=A0__iomem *tx_dma_regs;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0volatile struct dbdma_regs =C2=A0 =C2=A0 =C2=
=A0__iomem *rx_dma_regs;
> +#endif
>
> =C2=A0 =C2=A0 =C2=A0 =C2=A0struct ktermios =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 termios_cache;
> =C2=A0};
> --
> To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at =C2=A0http://vger.kernel.org/majordomo-info.html
>



--=20
Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k=
.org

In personal conversations with technical people, I call myself a hacker. Bu=
t
when I'm talking to journalists I just say "programmer" or something like t=
hat.
							    -- Linus Torvalds

^ permalink raw reply

* Re: ucc_geth broken in 2.6.32 by 864fdf884e82bacbe8ca5e93bd43393a61d2e2b4
From: Anton Vorontsov @ 2009-12-23 20:22 UTC (permalink / raw)
  To: Lennart Sorensen; +Cc: linuxppc-dev, linux-kernel, netdev
In-Reply-To: <20091223200948.GF760@caffeine.csclub.uwaterloo.ca>

On Wed, Dec 23, 2009 at 03:09:48PM -0500, Lennart Sorensen wrote:
[...]
> So there result is:
> 
> Unable to handle kernel paging request for data at address 0x00000058
> Faulting instruction address: 0xc024f2fc
> Oops: Kernel access of bad area, sig: 11 [#1]
> RC8360 CM
> Modules linked in: rclibapi xeno_native max6369_wdt ucc_geth_driver spi_mpc8xxx ltc4215 lm75
> NIP: c024f2fc LR: e30aa0a4 CTR: c024f2e8
> REGS: df857ca0 TRAP: 0300   Not tainted  (2.6.32-trunk-8360e)
> MSR: 00009032 <EE,ME,IR,DR>  CR: 44042088  XER: 00000000
> DAR: 00000058, DSISR: 20000000
> TASK = df848c90[4] 'events/0' THREAD: df856000
> GPR00: e30aa0a4 df857d50 df848c90 00000000 00000640 00000001 c0428df4 dfa40b80
> GPR08: 000000c8 e30ad2b8 df084360 c024f2e8 44042082 1001af90 e30ad2b8 00000000
> GPR16: 00000048 00000001 00000000 00000000 df08436c df08440c 00000190 df08455c
> GPR24: df0844ec df0842c0 df084000 180005ea dfa40b80 00000000 df0842c0 00000000
> NIP [c024f2fc] skb_recycle_check+0x14/0x100
> LR [e30aa0a4] ucc_geth_poll+0xd8/0x4e0 [ucc_geth_driver]
> Call Trace:
> [df857d50] [c000b03c] __ipipe_grab_irq+0x3c/0xa4 (unreliable)
> [df857d60] [e30aa0a4] ucc_geth_poll+0xd8/0x4e0 [ucc_geth_driver]

This I can reproduce. It seems it's a long standing bug that
becomes easily reproducible with quiesce/activate sequence.
The driver doesn't handle empty queue correctly, i.e. it ignores
the empty queue check if netdev queue is stopped, which makes no
sense.

Can you try this patch in addition to previous (i.e. both should
be applied)?

Thanks!

diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
index 2f73e3f..b22de51 100644
--- a/drivers/net/ucc_geth.c
+++ b/drivers/net/ucc_geth.c
@@ -3275,7 +3275,7 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
 		/* Handle the transmitted buffer and release */
 		/* the BD to be used with the current frame  */
 
-		if ((bd == ugeth->txBd[txQ]) && (netif_queue_stopped(dev) == 0))
+		if (bd == ugeth->txBd[txQ]) /* queue empty? */
 			break;
 
 		dev->stats.tx_packets++;

^ permalink raw reply related

* Re: Does gpio_to_irq() work for MPC52xx gpios?
From: Bill Gatliff @ 2009-12-23 20:39 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: Linux/PPC Development
In-Reply-To: <4B3249AA.50405@billgatliff.com>

Bill Gatliff wrote:
> Peter Korsgaard wrote:
>   
>> No (not yet). In Ben's latest pull request there's a patch from me to
>> add basic infrastructure for gpio_to_irq(). I've recently added irq
>> support to the mpc8xxx driver, but so far nothing has been written for
>> 52xx.
>>
>> http://patchwork.ozlabs.org/patch/41550/
>>   
>>     
>
> Ok.  I'm taking a look at that code now, planning to adapt it for the
> MPC52xx unless someone raises any objections.
>   

Ok, working on this now.  I'm pretty far along, but I'm stopped at what
I think is a device tree source file problem.

I have an external device that generates two interrupt outputs.  One of
them is connected to IRQ2, the other to GPIO_WKUP_7.  I'm describing the
device like this:

    ...
    soc5200@f0000000 {
        #address-cells = <1>;
        #size-cells = <1>;
        compatible = "fsl,mpc5200b-immr","simple-bus";
        ranges = <0 0xf0000000 0x0000c000>;
        reg = <0xf0000000 0x00000100>;
        bus-frequency = <0>;        // from bootloader
        system-frequency = <0>;        // from bootloader
    ...
        mpc5200_pic: interrupt-controller@500 {
            // 5200 interrupts are encoded into two levels;
            interrupt-controller;
            gpio-controller;
            #interrupt-cells = <3>;
            #address-cells = <0>;
            #size-cells = <0>;
            compatible = "fsl,mpc5200b-pic","fsl,mpc5200-pic";
            reg = <0x500 0x80>;
            interrupts = < 0 0 3  1 1 3  2 2 2  3 3 2 >;
        };
        gpio_wkup: gpio@c00 {
            compatible = "fsl,mpc5200b-gpio-wkup","fsl,mpc5200-gpio-wkup";
            #gpio-cells = <2>;
            #interrupt-cells = <2>;
            #address-cells = <0>;
            #size-cells = <0>;
            reg = <0xc00 0x40>;
            interrupts = <1 8 0  0 3 0>;
            interrupt-parent = <&mpc5200_pic>;
            gpio-controller;
            interrupt-controller;
        };
    ...
    };
    ...
    system {
        compatible = "simple-bus";

        rotary-encoder {
            compatible = "linux,rotary-encoder","rotary-encoder";
            interrupts = <&mpc5200_pic 2 3  &gpio_wkup 0 0>;
            //interrupts = <&mpc5200_pic 2 3>;
            //gpios = <&gpio_wkup 0 0>;
            type = <1>;
            val-ccw = <0x4a>;
            val-cw = <78>;
        };
    };

When I use the "gpios" property instead of the above, I get a useful
gpio number and I can see the signal using sys/class/gpio.  And I also
know the hardware is working because an ancient, pre-device-tree kernel
is working fine.  :)

The problem is that I'm not getting a valid number out for the second
interrupt specification, presumably because the dts compiler doesn't
have any idea how to generate the data--- and I have no idea how to fix
that.

I captured some dmesg information which shows the problem.  The first
line is for IRQ2, which is correct.  The second is for GPIO_WKUP_7,
which the kernel chokes on:

...
irq: irq_create_mapping(0xcf814000,
0x42)                                         
irq: -> using host
@cf814000                                                      
  alloc irq_desc for 66 on node
0                                                 
  alloc kstat_irqs on node
0                                                      
mpc52xx_irqhost_map: External IRQ2 virq=42, hw=42.
type=8                         
irq: irq 66 on host /soc5200@f0000000/interrupt-controller@500 mapped to
virtual irq
66                                                                              

mpc52xx_extirq_set_type: irq=42. l2=2
flow_type=8                                 
linux,rotary-encoder rotary-encoder.3: irq[0] 66 gpio[0] -2  <- my
driver's output, the "magic number" was 66
return 0, l1=4,
l2=0                                                              
irq: irq_create_mapping(0xcf814000,
0x0)                                          
irq: -> using host
@cf814000                                                      
  alloc irq_desc for 16 on node
0                                                 
  alloc kstat_irqs on node
0                                                      
mpc52xx_irqhost_map: External IRQ0 virq=10, hw=0.
type=8                          
irq: irq 0 on host /soc5200@f0000000/interrupt-controller@500 mapped to
virtual irq
16                                                                               

mpc52xx_extirq_set_type: irq=0. l2=0
flow_type=8                                  
linux,rotary-encoder rotary-encoder.3: irq[1] 16 gpio[1] -2         <-
my driver's "magic number" was 16
...


The device tree has the magic number "66" for IRQ2, which
mpc52xx_irqhost_map gets right.  But it doesn't know what to do with the
magic number "16" that's fed to it from the other interrupt
specification.  And I don't yet, either...  :)

Any ideas?  Basically, what I think this boils down to is somewhere I
need to translate that 16 to yet another virtual number for the
demultiplexed interrupt descriptor.  But I'm getting a little lost in
the virtual-ness of everything!


b.g.

-- 
Bill Gatliff
bgat@billgatliff.com

^ permalink raw reply

* Re: ucc_geth broken in 2.6.32 by 864fdf884e82bacbe8ca5e93bd43393a61d2e2b4
From: Lennart Sorensen @ 2009-12-23 22:10 UTC (permalink / raw)
  To: Anton Vorontsov; +Cc: linuxppc-dev, netdev, linux-kernel, Lennart Sorensen
In-Reply-To: <20091223202226.GA8185@oksana.dev.rtsoft.ru>

On Wed, Dec 23, 2009 at 11:22:26PM +0300, Anton Vorontsov wrote:
> On Wed, Dec 23, 2009 at 03:09:48PM -0500, Lennart Sorensen wrote:
> [...]
> > So there result is:
> > 
> > Unable to handle kernel paging request for data at address 0x00000058
> > Faulting instruction address: 0xc024f2fc
> > Oops: Kernel access of bad area, sig: 11 [#1]
> > RC8360 CM
> > Modules linked in: rclibapi xeno_native max6369_wdt ucc_geth_driver spi_mpc8xxx ltc4215 lm75
> > NIP: c024f2fc LR: e30aa0a4 CTR: c024f2e8
> > REGS: df857ca0 TRAP: 0300   Not tainted  (2.6.32-trunk-8360e)
> > MSR: 00009032 <EE,ME,IR,DR>  CR: 44042088  XER: 00000000
> > DAR: 00000058, DSISR: 20000000
> > TASK = df848c90[4] 'events/0' THREAD: df856000
> > GPR00: e30aa0a4 df857d50 df848c90 00000000 00000640 00000001 c0428df4 dfa40b80
> > GPR08: 000000c8 e30ad2b8 df084360 c024f2e8 44042082 1001af90 e30ad2b8 00000000
> > GPR16: 00000048 00000001 00000000 00000000 df08436c df08440c 00000190 df08455c
> > GPR24: df0844ec df0842c0 df084000 180005ea dfa40b80 00000000 df0842c0 00000000
> > NIP [c024f2fc] skb_recycle_check+0x14/0x100
> > LR [e30aa0a4] ucc_geth_poll+0xd8/0x4e0 [ucc_geth_driver]
> > Call Trace:
> > [df857d50] [c000b03c] __ipipe_grab_irq+0x3c/0xa4 (unreliable)
> > [df857d60] [e30aa0a4] ucc_geth_poll+0xd8/0x4e0 [ucc_geth_driver]
> 
> This I can reproduce. It seems it's a long standing bug that
> becomes easily reproducible with quiesce/activate sequence.
> The driver doesn't handle empty queue correctly, i.e. it ignores
> the empty queue check if netdev queue is stopped, which makes no
> sense.
> 
> Can you try this patch in addition to previous (i.e. both should
> be applied)?
> 
> Thanks!
> 
> diff --git a/drivers/net/ucc_geth.c b/drivers/net/ucc_geth.c
> index 2f73e3f..b22de51 100644
> --- a/drivers/net/ucc_geth.c
> +++ b/drivers/net/ucc_geth.c
> @@ -3275,7 +3275,7 @@ static int ucc_geth_tx(struct net_device *dev, u8 txQ)
>  		/* Handle the transmitted buffer and release */
>  		/* the BD to be used with the current frame  */
>  
> -		if ((bd == ugeth->txBd[txQ]) && (netif_queue_stopped(dev) == 0))
> +		if (bd == ugeth->txBd[txQ]) /* queue empty? */
>  			break;
>  
>  		dev->stats.tx_packets++;

That seems to be it.  It works now.  No more crashes.

Those two patches together seem to do the trick.  I really hope they
can go into 2.6.32-stable then, since this is a regression over 2.6.31
and is hopefully an obvious fix.

Now if only my mdio-gpio bitbang one line fix would be accepted.

-- 
Len Sorensen

^ permalink raw reply

* Re: ucc_geth broken in 2.6.32 by 864fdf884e82bacbe8ca5e93bd43393a61d2e2b4
From: Anton Vorontsov @ 2009-12-23 22:21 UTC (permalink / raw)
  To: Lennart Sorensen; +Cc: linuxppc-dev, linux-kernel, netdev
In-Reply-To: <20091223221047.GH760@caffeine.csclub.uwaterloo.ca>

On Wed, Dec 23, 2009 at 05:10:47PM -0500, Lennart Sorensen wrote:
[...]
> That seems to be it.  It works now.  No more crashes.
> Those two patches together seem to do the trick.

Great!

> I really hope they
> can go into 2.6.32-stable then, since this is a regression over 2.6.31
> and is hopefully an obvious fix.

Yep, will try to get them there.

Thanks a lot for helping to track this down,

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply

* Re: ucc_geth broken in 2.6.32 by 864fdf884e82bacbe8ca5e93bd43393a61d2e2b4
From: Lennart Sorensen @ 2009-12-23 22:23 UTC (permalink / raw)
  To: Anton Vorontsov; +Cc: linuxppc-dev, netdev, linux-kernel, Lennart Sorensen
In-Reply-To: <20091223222116.GA851@oksana.dev.rtsoft.ru>

On Thu, Dec 24, 2009 at 01:21:16AM +0300, Anton Vorontsov wrote:
> On Wed, Dec 23, 2009 at 05:10:47PM -0500, Lennart Sorensen wrote:
> [...]
> > That seems to be it.  It works now.  No more crashes.
> > Those two patches together seem to do the trick.
> 
> Great!
> 
> > I really hope they
> > can go into 2.6.32-stable then, since this is a regression over 2.6.31
> > and is hopefully an obvious fix.
> 
> Yep, will try to get them there.
> 
> Thanks a lot for helping to track this down,

Thanks for fixing it so fast.  I only knew that patch broke it, not why
it broke it.

-- 
Len Sorensen

^ permalink raw reply

* Re: [PATCH] Make cpu hotplug driver lock part of ppc_md
From: Michael Ellerman @ 2009-12-23 22:29 UTC (permalink / raw)
  To: Nathan Fontenot; +Cc: linuxppc-dev, Andreas Schwab
In-Reply-To: <4B322DD6.60801@austin.ibm.com>

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

On Wed, 2009-12-23 at 08:48 -0600, Nathan Fontenot wrote:
> Michael Ellerman wrote:
> > On Tue, 2009-12-22 at 08:45 -0600, Nathan Fontenot wrote:
> >> The recently introduced cpu_hotplug_driver_lock used to serialize
> >> cpu hotplug operations, namely for the pseries platform, causes a build
> >> issue for other platforms.  The base cpu hotplug code attempts
> >> to take this lock, but it may not be needed for all platforms.  This patch
> >> moves the lock/unlock routines to be part of the ppc_md structure
> >> so that platforms needing the lock can take it.  This also makes the
> >> previous cpu_hotplug_driver_lock, defined in pseries code, pseries specific.
> >>
> >> The past failure without this patch was seen when building pmac and may
> >> be present in other platform builds.  The error is included below for reference.
> >>
> >> drivers/built-in.o: In function `.store_online':
> >> cpu.c:(.ref.text+0xf5c): undefined reference to `.cpu_hotplug_driver_lock'
> >> cpu.c:(.ref.text+0xfc8): undefined reference to `.cpu_hotplug_driver_unlock'
> >> make: *** [.tmp_vmlinux1] Error 1
> > 
> > Why does the pmac code /not/ need a lock? And would it be harmless if it
> > was locked too?
> 
> The intention of the cpu_hotplug_driver_locks to add additional serialization
> during cpu hotplug operations.  For pseries this is used during DLPAR of cpu
> operations so that cpu hotplug actions cannot be initiated whiloe a DLPAR
> operation is in flight.  For example, during DLPAR add we take the lock while
> acquiring the cpu from firmware and updating the device tree with the new
> cpu information, after which we hotplug add the cpu to the system.  

Right.

> There is nothing harmless about taking the lock on all platforms, I was just
> trying to avoid taking the lock if the additional serialization is not needed.

"nothing harmless" :)

But I think I know what you mean.

> > 
> > If so, you could just make the mutex available to all powerpc code, and
> > rename it, and then we wouldn't need all this jiggery pokery just to
> > take & release a lock.
> 
> I can make the lock available to all powerpc code and not go through the
> ppc_md struct, it makes no difference to me personally.  Of course this would
> make all that fun pokery jiggery go away :)

I think that would be a nicer result. Sure it adds an extra lock/unlock
on other platforms, but I think that's thoroughly insignificant compared
to a cpu hotplug.

Of course Ben might disagree with me ;)

cheers


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

^ permalink raw reply

* Re: [HELP] BAD interrupts
From: Michael Ellerman @ 2009-12-23 22:43 UTC (permalink / raw)
  To: Kumar Gopalpet-B05799; +Cc: netdev, linuxppc-dev
In-Reply-To: <9F4C7D19E8361D4C94921B95BE08B81BA09038@zin33exm22.fsl.freescale.net>

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

On Wed, 2009-12-23 at 19:41 +0530, Kumar Gopalpet-B05799 wrote:
> Hi all,
>  
> I am trying linux 2.6.32-rc3 in SMP mode. I am seeing a lot of BAD
> interrupts when I do a "cat  /proc/interrupts".
>  
> I am running a forwarding application b/w two ethernet ports (ethernet
> uses gianfar driver).
>  
> Has any one observed these BAD interrupts ? If so, can someone help me
> in understanding why these interrupts come and how to resolve it ?

You'll need to tell us what platform you're running on.

The BAD interrupts come from ppc_spurious_interrupts. It's a count of
the number of times we entered do_IRQ() (ie. took an external
interrupt), but when we asked the interrupt controller which irq it was,
the interrupt controller said there was no irq.

Depending on your interrupt controller that might happen sometimes for
valid reasons. Or it might indicate something is setup wrong.

cheers


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

^ permalink raw reply

* Re: [HELP] BAD interrupts
From: gshan @ 2009-12-24 11:46 UTC (permalink / raw)
  To: michael; +Cc: netdev, linuxppc-dev, Kumar Gopalpet-B05799
In-Reply-To: <1261608230.3401.16.camel@concordia>

Michael Ellerman wrote:
> On Wed, 2009-12-23 at 19:41 +0530, Kumar Gopalpet-B05799 wrote:
>   
>> Hi all,
>>  
>> I am trying linux 2.6.32-rc3 in SMP mode. I am seeing a lot of BAD
>> interrupts when I do a "cat  /proc/interrupts".
>>  
>> I am running a forwarding application b/w two ethernet ports (ethernet
>> uses gianfar driver).
>>  
>> Has any one observed these BAD interrupts ? If so, can someone help me
>> in understanding why these interrupts come and how to resolve it ?
>>     
>
> You'll need to tell us what platform you're running on.
>
> The BAD interrupts come from ppc_spurious_interrupts. It's a count of
> the number of times we entered do_IRQ() (ie. took an external
> interrupt), but when we asked the interrupt controller which irq it was,
> the interrupt controller said there was no irq.
>
> Depending on your interrupt controller that might happen sometimes for
> valid reasons. Or it might indicate something is setup wrong.
>
> cheers
>   
I think it will help to show us your /proc/interrupts so that how you 
suffered
from bad interrupts.

^ permalink raw reply

* Re: Does gpio_to_irq() work for MPC52xx gpios?
From: Bill Gatliff @ 2009-12-24  5:38 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: Linux/PPC Development
In-Reply-To: <4B327FEC.9030801@billgatliff.com>

Guys:


Ok, I have gpio_to_irq() more-or-less showing signs of life for the
MPC5200.  But I'm having some trouble using it the way I want to.

Recall that I have a rotary encoder that's tied to IRQ2 and
GPIO_WKUP_7.  I want to be able to describe it something like this:

    rotary-encoder {
        compatible = "linux,rotary-encoder","rotary-encoder";
        interrupts = <&mpc5200_pic 2 3 &gpio_wkup 0 1>; // "IRQ2 on the
MPC5200 PIC,
                                                                                               
// and pin 0 on GPIO_WKUP"
        type = <1>; // what event signal to generate
        val-ccw = <0x4a>; // what code to use for counter-clockwise rotation
        val-cw = <78>; // what code to use for clockwise rotation
    };

I've had some limited success with this, but not for any good reason. 
It turns out that the explanation for why I was getting a valid number
for the first interrupt specification was because the device tree
compiler was assuming that the interrupt-parent was the mpc5200_pic; my
reference to the node in that list was utterly meaningless.  The dtc
also appears to have ignored the &gpio_wkup word, and interpreted the
following zero as being the zero-th interrupt channel in the
mpc5200_pic.  Or something like that.  Clearly, I don't understand the
device tree syntax at all yet.

Anyway, when I change the statement to this:

    rotary-encoder {
        compatible = "linux,rotary-encoder","rotary-encoder";
        interrupt-parent = <&gpio_wkup>;
        interrupts = <0 0>;
        type = <1>;
        val-ccw = <0x4a>;
        val-cw = <78>;
        };

... then the magic number that the dtc comes up with is causing my new
chained interrupt handler for the gpio_wkup peripheral to come alive. 
(Of course it doesn't actually work yet, but that's not the point!)

So here's my question: does the device tree compiler/syntax limit you to
only one interrupt parent?

I think the answer is no, because what I'm trying to do doesn't seem
that much different from how one specifies GPIO pins coming from
different controllers.

Any suggestions?


b.g.

-- 
Bill Gatliff
bgat@billgatliff.com

^ permalink raw reply

* Re: Does gpio_to_irq() work for MPC52xx gpios?
From: Bill Gatliff @ 2009-12-24  6:52 UTC (permalink / raw)
  To: Peter Korsgaard; +Cc: Linux/PPC Development
In-Reply-To: <4B32FE43.1030905@billgatliff.com>

Bill Gatliff wrote:
> Guys:
>
>
> Ok, I have gpio_to_irq() more-or-less showing signs of life for the
> MPC5200.  But I'm having some trouble using it the way I want to.
>   

I think I've got the idea all of a sudden.

In order to describe the inputs to my rotary encoder using the syntax I
want, I have to implement something similar to of_get_gpio_flags(), right?


b.g.

-- 
Bill Gatliff
bgat@billgatliff.com

^ permalink raw reply

* [PATCH 2/2] Adding PCI-E MSI support for PowerPC 460SX SOC.
From: tmarri @ 2009-12-24  7:28 UTC (permalink / raw)
  To: jwboyer, linuxppc-dev; +Cc: linuxppc-dev, writetomarri, tmarri

From: Tirumala Marri <tmarri@amcc.com>


Signed-off-by: Tirumala Marri <tmarri@amcc.com>
---
	When 460SX configured as root as a end point E1000(Intell Ethernet card)
	was plugged into the one of the PCI-E ports. I was able to run the traffic
	with MSI interrupts.
---
 arch/powerpc/boot/dts/redwood.dts          |   15 ++
 arch/powerpc/configs/44x/redwood_defconfig |    5 +-
 arch/powerpc/platforms/44x/Kconfig         |    1 +
 arch/powerpc/sysdev/Kconfig                |    7 +
 arch/powerpc/sysdev/Makefile               |    1 +
 arch/powerpc/sysdev/ppc4xx_msi.c           |  333 ++++++++++++++++++++++++++++
 arch/powerpc/sysdev/ppc4xx_msi.h           |   39 ++++
 7 files changed, 399 insertions(+), 2 deletions(-)
 create mode 100644 arch/powerpc/sysdev/ppc4xx_msi.c
 create mode 100644 arch/powerpc/sysdev/ppc4xx_msi.h

diff --git a/arch/powerpc/boot/dts/redwood.dts b/arch/powerpc/boot/dts/redwood.dts
index 81636c0..6c20faf 100644
--- a/arch/powerpc/boot/dts/redwood.dts
+++ b/arch/powerpc/boot/dts/redwood.dts
@@ -357,6 +357,21 @@
 				0x0 0x0 0x0 0x3 &UIC3 0xa 0x4 /* swizzled int C */
 				0x0 0x0 0x0 0x4 &UIC3 0xb 0x4 /* swizzled int D */>;
 		};
+  		MSI: ppc4xx-msi@400300000 {
+  			compatible = "amcc,ppc4xx-460sx-msi", "ppc4xx-msi";
+  			reg = < 0x4 0x00300000 0x100
+  				0x4 0x00300000 0x100>;
+  			sdr-base = <0x3B0>;
+  			interrupts =<0 1 2 3>;
+  			interrupt-parent = <&MSI>;
+  			#interrupt-cells = <1>;
+  			#address-cells = <0>;
+  			#size-cells = <0>;
+  			interrupt-map = <0 &UIC0 0xC 1
+  				1 &UIC0 0x0D 1
+  				2 &UIC0 0x0E 1
+  				3 &UIC0 0x0F 1>;
+  		};
 
 	};
 
diff --git a/arch/powerpc/configs/44x/redwood_defconfig b/arch/powerpc/configs/44x/redwood_defconfig
index ed31d4f..5d16c88 100644
--- a/arch/powerpc/configs/44x/redwood_defconfig
+++ b/arch/powerpc/configs/44x/redwood_defconfig
@@ -158,6 +158,7 @@ CONFIG_DEFAULT_AS=y
 CONFIG_DEFAULT_IOSCHED="anticipatory"
 # CONFIG_FREEZER is not set
 CONFIG_PPC4xx_PCI_EXPRESS=y
+CONFIG_PPC_MSI_BITMAP=y
 
 #
 # Platform support
@@ -264,7 +265,7 @@ CONFIG_PCIEPORTBUS=y
 CONFIG_PCIEAER=y
 # CONFIG_PCIEASPM is not set
 CONFIG_ARCH_SUPPORTS_MSI=y
-# CONFIG_PCI_MSI is not set
+CONFIG_PCI_MSI=y
 # CONFIG_PCI_LEGACY is not set
 # CONFIG_PCI_DEBUG is not set
 # CONFIG_PCI_STUB is not set
@@ -1062,7 +1063,7 @@ CONFIG_PRINT_STACK_DEPTH=64
 # CONFIG_DEBUG_PAGEALLOC is not set
 # CONFIG_CODE_PATCHING_SELFTEST is not set
 # CONFIG_FTR_FIXUP_SELFTEST is not set
-# CONFIG_MSI_BITMAP_SELFTEST is not set
+CONFIG_MSI_BITMAP_SELFTEST=y
 # CONFIG_XMON is not set
 # CONFIG_IRQSTACKS is not set
 # CONFIG_VIRQ_DEBUG is not set
diff --git a/arch/powerpc/platforms/44x/Kconfig b/arch/powerpc/platforms/44x/Kconfig
index 7486bff..9c3b8ca 100644
--- a/arch/powerpc/platforms/44x/Kconfig
+++ b/arch/powerpc/platforms/44x/Kconfig
@@ -126,6 +126,7 @@ config REDWOOD
 	select 460SX
 	select PCI
 	select PPC4xx_PCI_EXPRESS
+	select PPC4xx_MSI
 	help
 	  This option enables support for the AMCC PPC460SX Redwood board.
 
diff --git a/arch/powerpc/sysdev/Kconfig b/arch/powerpc/sysdev/Kconfig
index 3965828..c8f1486 100644
--- a/arch/powerpc/sysdev/Kconfig
+++ b/arch/powerpc/sysdev/Kconfig
@@ -7,8 +7,15 @@ config PPC4xx_PCI_EXPRESS
 	depends on PCI && 4xx
 	default n
 
+config PPC4xx_MSI
+	bool
+	depends on PCI_MSI
+	depends on PCI && 4xx
+	default n
+
 config PPC_MSI_BITMAP
 	bool
 	depends on PCI_MSI
 	default y if MPIC
 	default y if FSL_PCI
+	default y if PPC4xx_MSI
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index 5642924..4c67d2d 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -36,6 +36,7 @@ obj-$(CONFIG_PPC_I8259)		+= i8259.o
 obj-$(CONFIG_IPIC)		+= ipic.o
 obj-$(CONFIG_4xx)		+= uic.o
 obj-$(CONFIG_4xx_SOC)		+= ppc4xx_soc.o
+obj-$(CONFIG_PPC4xx_MSI)		+= ppc4xx_msi.o
 obj-$(CONFIG_XILINX_VIRTEX)	+= xilinx_intc.o
 obj-$(CONFIG_XILINX_PCI)	+= xilinx_pci.o
 obj-$(CONFIG_OF_RTC)		+= of_rtc.o
diff --git a/arch/powerpc/sysdev/ppc4xx_msi.c b/arch/powerpc/sysdev/ppc4xx_msi.c
new file mode 100644
index 0000000..44b8962
--- /dev/null
+++ b/arch/powerpc/sysdev/ppc4xx_msi.c
@@ -0,0 +1,333 @@
+/*
+ * Copyright (C) 2009 Applied Micro Circuits corporation.
+ *
+ * Author: Tirumala Marri <tmarri@amcc.com>
+ * 	   Feng Kan <fkan@amcc.com>
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2 of the
+ * License.
+ */
+#include <linux/irq.h>
+#include <linux/bootmem.h>
+#include <linux/pci.h>
+#include <linux/msi.h>
+#include <linux/of_platform.h>
+#include <linux/interrupt.h>
+#include <linux/device.h>
+#include <asm/prom.h>
+#include <asm/hw_irq.h>
+#include <asm/ppc-pci.h>
+#include <asm/dcr.h>
+#include <asm/dcr-regs.h>
+#include "ppc4xx_msi.h"
+
+static struct ppc4xx_msi *ppc4xx_msi;
+
+struct ppc4xx_msi_feature {
+	u32 ppc4xx_pic_ip;
+	u32 msiir_offset;
+};
+
+static int ppc4xx_msi_init_allocator(struct ppc4xx_msi *msi_data)
+{
+	int rc;
+
+	rc = msi_bitmap_alloc(&msi_data->bitmap, NR_MSI_IRQS,
+				msi_data->irqhost->of_node);
+	if (rc)
+		return rc;
+	rc = msi_bitmap_reserve_dt_hwirqs(&msi_data->bitmap);
+	if (rc < 0) {
+		msi_bitmap_free(&msi_data->bitmap);
+		return rc;
+	}
+	return 0;
+}
+
+static void ppc4xx_msi_cascade(unsigned int irq, struct irq_desc *desc)
+{
+	unsigned int cascade_irq;
+	struct ppc4xx_msi *msi_data = ppc4xx_msi;
+	int msir_index = -1;
+
+	raw_spin_lock(&desc->lock);
+	if (desc->chip->mask_ack) {
+		desc->chip->mask_ack(irq);
+	} else {
+		desc->chip->mask(irq);
+		desc->chip->ack(irq);
+	}
+
+	if (unlikely(desc->status & IRQ_INPROGRESS))
+		goto unlock;
+
+	msir_index = (int)desc->handler_data;
+
+	if (msir_index >= NR_MSI_IRQS)
+		cascade_irq = NO_IRQ;
+
+	desc->status |= IRQ_INPROGRESS;
+
+	cascade_irq = irq_linear_revmap(msi_data->irqhost, msir_index);
+	if (cascade_irq != NO_IRQ)
+		generic_handle_irq(cascade_irq);
+	desc->status &= ~IRQ_INPROGRESS;
+
+	if (!(desc->status & IRQ_DISABLED) && desc->chip->unmask)
+		desc->chip->unmask(irq);
+unlock:
+	raw_spin_unlock(&desc->lock);
+}
+
+static void ppc4xx_compose_msi_msg(struct pci_dev *pdev, int hwirq,
+					struct msi_msg *msg)
+{
+	struct ppc4xx_msi *msi_data = ppc4xx_msi;
+
+	msg->address_lo = msi_data->msi_addr_lo;
+	msg->address_hi = msi_data->msi_addr_hi;
+	msg->data = hwirq;
+}
+
+int ppc4xx_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
+{
+	struct msi_desc *entry;
+	int rc, hwirq;
+	unsigned int virq;
+	struct msi_msg msg;
+	struct ppc4xx_msi *msi_data = ppc4xx_msi;
+
+
+	list_for_each_entry(entry, &dev->msi_list, list) {
+		hwirq = msi_bitmap_alloc_hwirqs(&msi_data->bitmap, 1);
+		if (hwirq < 0) {
+			rc = hwirq;
+			dev_err(&dev->dev, "%s: fail allocating msi\
+					interrupt\n",	__func__);
+			goto out_free;
+		}
+
+		pr_debug(KERN_INFO"mis is %p\n", msi_data->irqhost);
+		virq = irq_create_mapping(msi_data->irqhost, hwirq);
+		if (virq == NO_IRQ) {
+			dev_err(&dev->dev, "%s: fail mapping irq\n", __func__);
+			rc = -ENOSPC;
+			goto out_free;
+		}
+
+		set_irq_msi(virq, entry);
+		ppc4xx_compose_msi_msg(dev, hwirq, &msg);
+		write_msi_msg(virq, &msg);
+	}
+
+	return 0;
+out_free:
+	return rc;
+}
+
+void ppc4xx_teardown_msi_irqs(struct pci_dev *dev)
+{
+	struct msi_desc *entry;
+	struct ppc4xx_msi *msi_data = ppc4xx_msi;
+	 dev_dbg(&dev->dev, "PCIE-MSI: tearing down msi irqs\n");
+
+	list_for_each_entry(entry, &dev->msi_list, list) {
+		if (entry->irq == NO_IRQ)
+			continue;
+		set_irq_msi(entry->irq, NULL);
+		msi_bitmap_free_hwirqs(&msi_data->bitmap,
+				       virq_to_hw(entry->irq), 1);
+		irq_dispose_mapping(entry->irq);
+
+	}
+
+	return;
+}
+
+static int ppc4xx_msi_check_device(struct pci_dev *pdev, int nvec, int type)
+{
+	pr_debug(KERN_INFO"PCIE-MSI:%s called. vec %x type %d\n",
+					__func__, nvec, type);
+	return 0;
+}
+
+/*
+ * We do not need this actually. The MSIR register has been read once
+ * in the cascade interrupt. So, this MSI interrupt has been acked
+*/
+static void ppc4xx_msi_end_irq(unsigned int virq)
+{
+}
+
+static struct irq_chip ppc4xx_msi_chip = {
+	.mask           = mask_msi_irq,
+	.unmask         = unmask_msi_irq,
+	.ack            = ppc4xx_msi_end_irq,
+	.name       = " UIC",
+};
+
+static int ppc4xx_msi_host_map(struct irq_host *h, unsigned int virq,
+				irq_hw_number_t hw)
+{
+	struct irq_chip *chip = &ppc4xx_msi_chip;
+
+	irq_to_desc(virq)->status |= IRQ_TYPE_EDGE_RISING;
+
+	set_irq_chip_and_handler(virq, chip, handle_edge_irq);
+
+	return 0;
+}
+
+static struct irq_host_ops ppc4xx_msi_host_ops = {
+	.map = ppc4xx_msi_host_map,
+};
+
+static int __devinit ppc4xx_msi_probe(struct of_device *dev,
+					const struct of_device_id *match)
+{
+	struct ppc4xx_msi *msi;
+	struct resource res, rmsi;
+	int i, count;
+	int rc;
+	int virt_msir;
+	const u32 *p;
+	const u32 *sdr_base;
+	u32 *msi_virt = NULL;
+	dma_addr_t msi_phys;
+
+
+	msi = kzalloc(sizeof(struct ppc4xx_msi), GFP_KERNEL);
+	if (!msi) {
+		dev_err(&dev->dev, "No memory for MSI structure\n");
+		rc = -ENOMEM;
+		goto error_out;
+	}
+
+	msi->irqhost = irq_alloc_host(dev->node, IRQ_HOST_MAP_LINEAR,
+				      NR_MSI_IRQS, &ppc4xx_msi_host_ops, 0);
+	if (msi->irqhost == NULL) {
+		dev_err(&dev->dev, "No memory for MSI irqhost\n");
+		rc = -ENOMEM;
+		goto error_out;
+	}
+
+
+	/* Get MSI ranges */
+	rc = of_address_to_resource(dev->node, 0, &rmsi);
+	if (rc) {
+		dev_err(&dev->dev, "%s resource error!\n",
+				dev->node->full_name);
+		goto error_out;
+	}
+
+
+	/* Get the MSI reg base */
+	rc = of_address_to_resource(dev->node, 1, &res);
+	if (rc) {
+		dev_err(&dev->dev, "%s resource error!\n",
+				dev->node->full_name);
+		goto error_out;
+	}
+	/* Get the sdr-base */
+	sdr_base = (u32 *)of_get_property(dev->node, "sdr-base", NULL);
+	if (sdr_base == NULL) {
+		dev_err(&dev->dev, "%s resource error!\n",
+				dev->node->full_name);
+		goto error_out;
+	}
+	msi->sdr_base = *sdr_base;
+	mtdcri(SDR0, msi->sdr_base, res.start >> 32);
+	mtdcri(SDR0, msi->sdr_base + 1, res.start & 0xFFFFFFFF);
+	msi->msi_regs = ioremap(res.start, res.end - res.start + 1);
+	if (!msi->msi_regs) {
+		dev_err(&dev->dev, "ioremap problem failed\n");
+		goto error_out;
+	}
+	/* MSI region always mapped in 4GB region*/
+	msi->msi_addr_hi = 0x0;
+	msi_virt = dma_alloc_coherent(&dev->dev, 64, &msi_phys,
+			GFP_KERNEL);
+	if (msi_virt == NULL) {
+		dev_err(&dev->dev, "No memory for MSI mem space\n");
+		rc = -ENOMEM;
+		goto error_out;
+	}
+	msi->msi_addr_lo = (u32)msi_phys;
+
+	/* Progam the Interrupt handler Termination addr registers */
+	out_be32(msi->msi_regs + PEIH_TERMADH, msi->msi_addr_hi);
+	out_be32(msi->msi_regs + PEIH_TERMADL, msi->msi_addr_lo);
+
+	/* Program MSI Expected data and Mask bits */
+	out_be32(msi->msi_regs + PEIH_MSIED, MSI_DATA_PATTERN);
+	out_be32(msi->msi_regs + PEIH_MSIMK, MSI_DATA_PATTERN);
+
+	msi->irqhost->host_data = msi;
+
+	if (ppc4xx_msi_init_allocator(msi)) {
+		dev_err(&dev->dev, "Error allocating MSI bitmap\n");
+		goto error_out;
+	}
+
+	p = of_get_property(dev->node, "interrupts", &count);
+	if (!p) {
+		dev_err(&dev->dev, "no interrupts property found on %s\n",
+				dev->node->full_name);
+		rc = -ENODEV;
+		goto error_out;
+	}
+	if (count == 0) {
+		dev_err(&dev->dev, "Malformed interrupts property on %s\n",
+				dev->node->full_name);
+		rc = -EINVAL;
+		goto error_out;
+	}
+
+	for (i = 0; i < NR_MSI_IRQS; i++) {
+		virt_msir = irq_of_parse_and_map(dev->node, i);
+		if (virt_msir != NO_IRQ) {
+			set_irq_data(virt_msir, (void *)i);
+			set_irq_chained_handler(virt_msir, ppc4xx_msi_cascade);
+		}
+	}
+
+	ppc4xx_msi = msi;
+
+	WARN_ON(ppc_md.setup_msi_irqs);
+	ppc_md.setup_msi_irqs = ppc4xx_setup_msi_irqs;
+	ppc_md.teardown_msi_irqs = ppc4xx_teardown_msi_irqs;
+	ppc_md.msi_check_device = ppc4xx_msi_check_device;
+	return 0;
+error_out:
+	if (msi_virt)
+		dma_free_coherent(&dev->dev, 64, msi_virt, msi_phys);
+	kfree(msi);
+	return rc;
+}
+
+static const struct ppc4xx_msi_feature ppc4xx_msi_feature = {
+	.ppc4xx_pic_ip = 0,
+	.msiir_offset = 0x140,
+};
+
+static const struct of_device_id ppc4xx_msi_ids[] = {
+	{
+		.compatible = "amcc,ppc4xx-msi",
+		.data = (void *)&ppc4xx_msi_feature,
+	},
+	{}
+};
+
+static struct of_platform_driver ppc4xx_msi_driver = {
+	.name = "ppc4xx-msi",
+	.match_table = ppc4xx_msi_ids,
+	.probe = ppc4xx_msi_probe,
+};
+
+static __init int ppc4xx_msi_init(void)
+{
+	return of_register_platform_driver(&ppc4xx_msi_driver);
+}
+
+subsys_initcall(ppc4xx_msi_init);
diff --git a/arch/powerpc/sysdev/ppc4xx_msi.h b/arch/powerpc/sysdev/ppc4xx_msi.h
new file mode 100644
index 0000000..e4ae058
--- /dev/null
+++ b/arch/powerpc/sysdev/ppc4xx_msi.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2009 Applied Micro Circuits Corporation.
+ *
+ * Author: Tirumala Marri <tmarri@amcc.com>
+ * 		Feng Kan <fkan@amcc.com>
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2 of the
+ * License.
+ */
+#ifndef __PPC4XX_MSI_H__
+#define __PPC4XX_MSI_H__
+
+#include <asm/msi_bitmap.h>
+
+#define PEIH_TERMADH    0x00
+#define PEIH_TERMADL    0x08
+#define PEIH_MSIED      0x10
+#define PEIH_MSIMK      0x18
+#define PEIH_MSIASS     0x20
+#define PEIH_FLUSH0     0x30
+#define PEIH_FLUSH1     0x38
+#define PEIH_CNTRST     0x48
+
+#define MSI_DATA_PATTERN   0x44440000
+
+struct ppc4xx_msi {
+	struct irq_host *irqhost;
+	unsigned long cascade_irq;
+	u32 msi_addr_lo;
+	u32 msi_addr_hi;
+	void __iomem *msi_regs;
+	u32 feature;
+	struct msi_bitmap bitmap;
+	u32 sdr_base;
+};
+
+#define NR_MSI_IRQS 4
+#endif /* __PPC4XX_MSI_H__ */
-- 
1.6.1.rc3

^ permalink raw reply related

* RE: [HELP] BAD interrupts
From: Kumar Gopalpet-B05799 @ 2009-12-24 10:45 UTC (permalink / raw)
  To: gshan, michael, avorontsov; +Cc: netdev, linuxppc-dev
In-Reply-To: <4B335491.1020203@alcatel-lucent.com>

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

 

>-----Original Message-----
>From: gshan [mailto:gshan@alcatel-lucent.com] 
>Sent: Thursday, December 24, 2009 5:16 PM
>To: michael@ellerman.id.au
>Cc: Kumar Gopalpet-B05799; netdev@vger.kernel.org; 
>linuxppc-dev@lists.ozlabs.org
>Subject: Re: [HELP] BAD interrupts
>
>Michael Ellerman wrote:
>> On Wed, 2009-12-23 at 19:41 +0530, Kumar Gopalpet-B05799 wrote:
>>   
>>> Hi all,
>>>  
>>> I am trying linux 2.6.32-rc3 in SMP mode. I am seeing a lot of BAD 
>>> interrupts when I do a "cat  /proc/interrupts".
>>>  
>>> I am running a forwarding application b/w two ethernet ports 
>>> (ethernet uses gianfar driver).
>>>  
>>> Has any one observed these BAD interrupts ? If so, can someone help 
>>> me in understanding why these interrupts come and how to 
>resolve it ?
>>>     
>>
>> You'll need to tell us what platform you're running on.
>>
>> The BAD interrupts come from ppc_spurious_interrupts. It's a 
>count of 
>> the number of times we entered do_IRQ() (ie. took an external 
>> interrupt), but when we asked the interrupt controller which irq it 
>> was, the interrupt controller said there was no irq.
>>
>> Depending on your interrupt controller that might happen 
>sometimes for 
>> valid reasons. Or it might indicate something is setup wrong.
>>
>> cheers
>>   
>I think it will help to show us your /proc/interrupts so that 
>how you suffered from bad interrupts.
>

I am running linux-2.6.29 in SMP mode on P2020RDB ( ruuning at
1200/600/667). The test scenario forwarding 
application and is a bidirectioanl flow between eth0 & eth2.

Attached is the complete log of the test scenario.

I also noted another observation that when all the interrupts are mapped
to a single core, the BAD interrupts stop coming.

--

Thanks
Sandeep 


[-- Attachment #2: smp_log_bad_intrs.txt --]
[-- Type: text/plain, Size: 27221 bytes --]

tftp 1000000 etsec2/uImage_alpha
Speed: 1000, full duplex
Using eTSEC1 device
TFTP from server 10.232.134.194; our IP address is 10.232.133.188
Filename 'etsec2/uImage_alpha'.
Load address: 0x1000000
Loading: *\b#################################################################
	 #################################################################
	 ###################################################
done
Bytes transferred = 2654090 (287f8a hex)
=> tftp 2000000 etsec2/rf\b \bootfs_alpha
Speed: 1000, full duplex
Using eTSEC1 device
TFTP from server 10.232.134.194; our IP address is 10.232.133.188
Filename 'etsec2/rootfs_alpha'.
Load address: 0x2000000
Loading: *\b#################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #####
done
Bytes transferred = 26776875 (198952b hex)
=> tftp c00000 etsec2/p2020alpha.dtb
Speed: 1000, full duplex
Using eTSEC1 device
TFTP from server 10.232.134.194; our IP address is 10.232.133.188
Filename 'etsec2/p2020alpha.dtb'.
Load address: 0xc00000
Loading: *\b#
done
Bytes transferred = 10579 (2953 hex)
=> bootm 1000000 2000000 c00000
WARNING: adjusting available memory to 30000000
## Booting kernel from Legacy Image at 01000000 ...
   Image Name:   Linux-2.6.29
   Created:      2009-07-03   9:42:06 UTC
   Image Type:   PowerPC Linux Kernel Image (gzip compressed)
   Data Size:    2654026 Bytes =  2.5 MB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 02000000 ...
   Image Name:   uboot ext2 ramdisk rootfs
   Created:      2009-07-04   8:24:27 UTC
   Image Type:   PowerPC Linux RAMDisk Image (gzip compressed)
   Data Size:    26776811 Bytes = 25.5 MB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 00c00000
   Booting using the fdt blob at 0xc00000
   Uncompressing Kernel Image ... OK
   Loading Ramdisk to 2e676000, end 2ffff4eb ... OK
Using P2020 RDB machine description
Memory CAM mapping: CAM0=256Mb, CAM1=256Mb, CAM2=256Mb residual: 256Mb
Linux version 2.6.29 (dipen@uTeam3.ap.freescale.net) (gcc version 4.3.2 (GCC) ) #1 SMP Fri Jul 3 15:11:50 IST 2009
Found initrd at 0xee676000:0xeffff4eb
CPU maps initialized for 1 thread per core
console [udbg0] enabled
setup_arch: bootmem
mpc85xx_rdb_setup_arch()
Found FSL PCI host bridge at 0x00000000ffe09000. Firmware bus number: 0->255
PCI host bridge /pcie@ffe09000  ranges:
 MEM 0x00000000a0000000..0x00000000bfffffff -> 0x00000000a0000000 
  IO 0x00000000ffc30000..0x00000000ffc3ffff -> 0x0000000000000000
Found FSL PCI host bridge at 0x00000000ffe0a000. Firmware bus number: 0->255
PCI host bridge /pcie@ffe0a000  ranges:
 MEM 0x00000000c0000000..0x00000000dfffffff -> 0x00000000c0000000 
  IO 0x00000000ffc20000..0x00000000ffc2ffff -> 0x0000000000000000
MPC85xx RDB board from Freescale Semiconductor
arch: exit
Zone PFN ranges:
  DMA      0x00000000 -> 0x00030000
  Normal   0x00030000 -> 0x00030000
  HighMem  0x00030000 -> 0x00040000
Movable zone start PFN for each node
early_node_map[1] active PFN ranges
    0: 0x00000000 -> 0x00040000
MMU: Allocated 1088 bytes of context maps for 255 contexts
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 260096
Kernel command line: root=/dev/ram rw console=ttyS0,115200 ramdisk_size=275000 cache-sram-size=0x10000
mpic: Setting up MPIC " OpenPIC  " version 1.2 at ffe40000, max 2 CPUs
mpic: ISU size: 256, shift: 8, mask: ff
mpic: Initializing for 256 sources
PID hash table entries: 4096 (order: 12, 16384 bytes)
clocksource: timebase mult[3555555] shift[22] registered
Console: colour dummy device 80x25
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
Memory: 1007184k/1048576k available (5180k kernel code, 40848k reserved, 164k data, 134k bss, 216k init)
SLUB: Genslabs=12, HWalign=32, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
Calibrating delay loop... 149.50 BogoMIPS (lpj=299008)
Mount-cache hash table entries: 512
mpic: requesting IPIs ... 
Processor 1 found.
Brought up 2 CPUs
net_namespace: 732 bytes
NET: Registered protocol family 16
             
PCI: Probing PCI hardware
pci 0000:00:00.0: ignoring class b20 (doesn't match header type 01)
pci 0000:00:00.0: PME# supported from D0 D1 D2 D3hot D3cold
pci 0000:00:00.0: PME# disabled
pci 0001:02:00.0: ignoring class b20 (doesn't match header type 01)
pci 0001:02:00.0: PME# supported from D0 D1 D2 D3hot D3cold
pci 0001:02:00.0: PME# disabled
pci 0000:00:00.0: not setting up bridge for bus 0000:01
pci 0000:00:00.0: enabling device (0106 -> 0107)
pci 0001:02:00.0: not setting up bridge for bus 0001:03
pci 0001:02:00.0: enabling device (0106 -> 0107)
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Freescale Elo / Elo Plus DMA driver
NET: Registered protocol family 2
IP route cache hash table entries: 32768 (order: 5, 131072 bytes)
TCP established hash table entries: 131072 (order: 8, 1048576 bytes)
TCP bind hash table entries: 65536 (order: 7, 524288 bytes)
TCP: Hash tables configured (established 131072 bind 65536)
TCP reno registered
NET: Registered protocol family 1
checking if image is initramfs...it isn't (no cpio magic); looks like an initrd
Freeing initrd memory: 26149k freed
fsl-elo-dma ffe0c300.dma: Probe the Freescale DMA driver for fsl,eloplus-dma controller at ffe0c300...
fsl-elo-dma ffe0c300.dma: #0 (fsl,eloplus-dma-channel), irq 76
fsl-elo-dma ffe0c300.dma: #1 (fsl,eloplus-dma-channel), irq 77
fsl-elo-dma ffe0c300.dma: #2 (fsl,eloplus-dma-channel), irq 78
fsl-elo-dma ffe0c300.dma: #3 (fsl,eloplus-dma-channel), irq 79
fsl-elo-dma ffe21300.dma: Probe the Freescale DMA driver for fsl,eloplus-dma controller at ffe21300...
fsl-elo-dma ffe21300.dma: #0 (fsl,eloplus-dma-channel), irq 20
fsl-elo-dma ffe21300.dma: #1 (fsl,eloplus-dma-channel), irq 21
fsl-elo-dma ffe21300.dma: #2 (fsl,eloplus-dma-channel), irq 22
fsl-elo-dma ffe21300.dma: #3 (fsl,eloplus-dma-channel), irq 23
audit: initializing netlink socket (disabled)
type=2000 audit(2.388:1): initialized
highmem bounce pool size: 64 pages
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
NTFS driver 2.1.29 [Flags: R/O].
JFFS2 version 2.2. (NAND) (SUMMARY)  © 2001-2006 Red Hat, Inc.
JFFS2: default compression mode: priority
msgmni has been set to 1507
alg: No test for stdrng (krng)
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
Generic non-volatile memory driver v1.1
Serial: 8250/16550 driver, 2 ports, IRQ sharing enabled
serial8250.0: ttyS0 at MMIO 0xffe04500 (irq = 42) is a 16550A
console handover: boot [udbg0] -> real [ttyS0]
serial8250.0: ttyS1 at MMIO 0xffe04600 (irq = 42) is a 16550A
brd: module loaded
loop: module loaded
nbd: registered device at major 43
e1000e: Intel(R) PRO/1000 Network Driver - 0.3.3.3-k6
e1000e: Copyright (c) 1999-2008 Intel Corporation.
Gianfar MII Bus: probed
Gianfar MII Bus: probed
eth0 (fsl-gianfar): not using net_device_ops yet
eth0: Gianfar Ethernet Controller Version 1.4-skbr1.1.4, 00:04:9f:0c:05:00
eth0: MTU = 1500 (frame size=1524, truesize=1800)
eth0: Running with NAPI enabled
eth0: 128/128 RX/TX BD ring size
eth1 (fsl-gianfar): not using net_device_ops yet
eth1: Gianfar Ethernet Controller Version 1.4-skbr1.1.4, 00:04:9f:0c:05:01
eth1: MTU = 1500 (frame size=1524, truesize=1800)
eth1: Running with NAPI enabled
eth1: 128/128 RX/TX BD ring size
eth2 (fsl-gianfar): not using net_device_ops yet
eth2: Gianfar Ethernet Controller Version 1.4-skbr1.1.4, 00:04:9f:0c:05:02
eth2: MTU = 1500 (frame size=1524, truesize=1800)
eth2: Running with NAPI enabled
eth2: 128/128 RX/TX BD ring size
Fixed MDIO Bus: probed
st: Version 20081215, fixed bufsize 32768, s/g segs 256
Driver 'st' needs updating - please use bus_type methods
Driver 'sd' needs updating - please use bus_type methods
Driver 'sr' needs updating - please use bus_type methods
ef000000.nor: Found 1 x16 devices at 0x0 in 16-bit bank
 Amd/Fujitsu Extended Query Table at 0x0040
ef000000.nor: CFI does not contain boot bank location. Assuming top.
number of CFI chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
RedBoot partition parsing not available
Creating 5 MTD partitions on "ef000000.nor":
0x000000000000-0x000000040000 : "NOR (RO) Vitesse-7385 Firmware"
ftl_cs: FTL header not found.
0x000000040000-0x000000080000 : "NOR (RO) DTB Image"
ftl_cs: FTL header not found.
0x000000080000-0x000000400000 : "NOR (RO) Linux Kernel Image"
ftl_cs: FTL header not found.
0x000000400000-0x000000f00000 : "NOR (RW) JFFS2 Root File System"
ftl_cs: FTL header not found.
0x000000f00000-0x000001000000 : "NOR (RO) U-Boot Image"
ftl_cs: FTL header not found.
NAND device: Manufacturer ID: 0xec, Chip ID: 0x75 (Samsung NAND 32MiB 3,3V 8-bit)
RedBoot partition parsing not available
Creating 6 MTD partitions on "ffa00000.flash":
0x000000000000-0x000000080000 : "NAND (RO) U-Boot Image"
ftl_cs: FTL header not found.
0x000000080000-0x000000100000 : "NAND (RO) DTB Image"
ftl_cs: FTL header not found.
0x000000100000-0x000000500000 : "NAND (RO) Linux Kernel Image"
ftl_cs: FTL header not found.
0x000000500000-0x000000900000 : "NAND (RO) Compressed RFS Image"
ftl_cs: FTL header not found.
0x000000900000-0x000001000000 : "NAND (RW) JFFS2 Root File System"
ftl_cs: FTL header not found.
0x000001000000-0x000002000000 : "NAND (RW) Writable User area"
ftl_cs: FTL header not found.
eLBC NAND device at 0xffa00000, bank 1
fsl_m25p80 spi28672.0: s25sl128b (0 Kbytes)
Creating 5 MTD partitions on "SPIFLASH0":
0x000000000000-0x000000080000 : "SPI (RO) U-Boot Image"
ftl_cs: FTL header not found.
0x000000080000-0x000000100000 : "SPI (RO) DTB Image"
ftl_cs: FTL header not found.
0x000000100000-0x000000500000 : "SPI (RO) Linux Kernel Image"
ftl_cs: FTL header not found.
0x000000500000-0x000000900000 : "SPI (RO) Compressed RFS Image"
ftl_cs: FTL header not found.
0x000000900000-0x000001000000 : "SPI (RW) JFFS2 RFS"
ftl_cs: FTL header not found.
ffe07000.spi: Freescale eSPI Controller driver at 0xf210a000 (irq = 59)
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
fsl-ehci fsl-ehci.0: Freescale On-Chip EHCI Host Controller
fsl-ehci fsl-ehci.0: new USB bus registered, assigned bus number 1
fsl-ehci fsl-ehci.0: irq 28, io base 0xffe22000
fsl-ehci fsl-ehci.0: USB 2.0 started, EHCI 1.00
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
i2c /dev entries driver
rtc-ds1307 0-0068: rtc core: registered ds1339 as rtc0
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
esdhc: Freescale Enhanced Secure Digital Host Controller driver
mmc0: ESDHC at 0xffe2e000 irq 72 PIO
talitos ffe30000.crypto: hwrng
alg: No test for authenc(hmac(sha1),cbc(aes)) (authenc-hmac-sha1-cbc-aes-talitos)
talitos ffe30000.crypto: authenc-hmac-sha1-cbc-aes-talitos
alg: No test for authenc(hmac(sha1),cbc(des3_ede)) (authenc-hmac-sha1-cbc-3des-talitos)
talitos ffe30000.crypto: authenc-hmac-sha1-cbc-3des-talitos
alg: No test for authenc(hmac(sha256),cbc(aes)) (authenc-hmac-sha256-cbc-aes-talitos)
talitos ffe30000.crypto: authenc-hmac-sha256-cbc-aes-talitos
alg: No test for authenc(hmac(sha256),cbc(des3_ede)) (authenc-hmac-sha256-cbc-3des-talitos)
talitos ffe30000.crypto: authenc-hmac-sha256-cbc-3des-talitos
alg: No test for authenc(hmac(md5),cbc(aes)) (authenc-hmac-md5-cbc-aes-talitos)
talitos ffe30000.crypto: authenc-hmac-md5-cbc-aes-talitos
alg: No test for authenc(hmac(md5),cbc(des3_ede)) (authenc-hmac-md5-cbc-3des-talitos)
talitos ffe30000.crypto: authenc-hmac-md5-cbc-3des-talitos
IPv4 over IPv4 tunneling driver
GRE over IPv4 tunneling driver
TCP cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 10
IPv6 over IPv4 tunneling driver
NET: Registered protocol family 17
NET: Registered protocol family 15
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
rtc-ds1307 0-0068: setting system clock to 2009-07-01 10:24:20 UTC (1246443860)
RAMDISK: Compressed image found at block 0
VFS: Mounted root (ext2 filesystem) on device 1:0.
Freeing unused kernel memory: 216k init
Mounting /proc and /sys 
Setting the hostname to P2020RDB
Mounting filesystems
mount: sysfs already mounted or /sys busy
mount: according to mtab, /sys is already mounted on /sys
Starting syslogd and klogd
Running sysctl
Setting up networking on loopback device: 
Setting up networking on eth0: ADDRCONF(NETDEV_UP): eth0: link is not ready

Adding static route for default gateway to 192.168.0.1: 
Setting nameserver to 192.168.0.1 in /etc/resolv.conf: 
SettingADDRCONF(NETDEV_UP): eth1: link is not ready
 up networking on eth1: 
Adding static route for default gateway to 192.168.1.1: 
Setting nameserver to 192.168.1.1 in /etc/resolv.conf: 
SettingADDRCONF(NETDEV_UP): eth2: link is not ready
 up networking on eth2: 
Adding static route for default gateway to 192.168.2.1: 
Starting inetd: 
Starting the port mapper: 
Generating keys for the dropbear ssh server: 
Will output 1024 bit rsa secret key to '/etc/dropbear/dropbear_rsa_host_key'
Generating key, this may take a while...
Public key portion is:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgwC8sk4V/7x6e0hJOjBdcGmUx26QQfpVdxT1z9itBPZf/bdfogKI5OHEfCPU2Tc+ZYNtrPXIgYvrML5I5z/WQL7QNgOx0/Vv
woNbxHLXj5UmirIJ6kNKlyUisPyZNU54XQjKCTpK7GjcGvUFgQMqv2HqWMfFV9XmytvXJgkhyg0jxox7 root@P2020RDB
Fingerprint: md5 2d:50:46:59:d1:92:72:1f:07:cf:e4:b6:14:6c:86:f3
Starting the dropbear ssh server: 
Starting the boa webserver: 
Please set the system time using
    date <mmddhhmnyyyy>
    /sbin/hwclock -w
PHY: 0:01 - Link is Up - 1000/Full
ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready


        Welcome to Freescale Semiconductor Embedded Linux Environment

!!!!! WARNING !!!!!!!

The default password for the root account is: root
please change this password using the 'passwd' command
and then edit this message (/etc/issue) to remove this message

P2020RDB login: PHY: mdio0@520:01 - Link is Up - 1000/Full
ADDRCONF(NETDEV_CHANGE): eth2: link becomes ready
root
Password: 
[root@P2020RDB /root]# ifco\b\b\b\b[root@P2020RDB /root]# ifconfig eth0 down
[root@P2020RDB /root]# [root@P2020RDB /root]# ifconfig eth0 down\b\b\b\b\b\b down 1 down down
[root@P2020RDB /root]# [root@P2020RDB /root]# ifconfig eth1 down\b\b\b\b\b\b down 2 down down
[root@P2020RDB /root]# 
[root@P2020RDB /root]# 
[root@P2020RDB /root]# ifco\b\b\b\b[root@P2020RDB /root]# ifconfig eth0 192.168.1.2 netmask 255.255.255.0
[root@P2020RDB /root]# PHY: 0:01 - Link is Up - 1000/Full

[root@P2020RDB /root]# ifcoe\b \b\b\b\b\b[root@P2020RDB /root]# ifconfig t\b \beyh\b \b\b \bth2 192.168.2.2 netmask 255.255.255.0
[root@P2020RDB /root]# PHY: mdio0@520:01 - Link is Up - 1000/Full

[root@P2020RDB /root]# ifco\b\b\b\b[root@P2020RDB /root]# ifconfig eth\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \b\b \beccho 1 > /p\b\b[root@P2020RDB /root]# eccho 1 > /proc/sy[root@P2020RDB /root]# eccho 1 > /proc/sys/n[root@P2020RDB /root]# eccho 1 > /proc/sys/net/ip[root@P2020RDB /root]# eccho 1 > /proc/sys/net/ipv4[root@P2020RDB /root]# eccho 1 > /proc/sys/net/ipv4/ip_f[root@P2020RDB /root]# eccho 1 > /proc/sys/net/ipv4/ip_forward 
-sh: eccho: not found
[root@P2020RDB /root]# echo 1 > /p\b\b[root@P2020RDB /root]# echo 1 > /proc/sy[root@P2020RDB /root]# echo 1 > /proc/sys/n[root@P2020RDB /root]# echo 1 > /proc/sys/net/ip[root@P2020RDB /root]# echo 1 > /proc/sys/net/ipv4[root@P2020RDB /root]# echo 1 > /proc/sys/net/ipv4/ip_f[root@P2020RDB /root]# echo 1 > /proc/sys/net/ipv4/ip_forward 
[root@P2020RDB /root]# 
[root@P2020RDB /root]# 
[root@P2020RDB /root]# pn\b \bing 192.168.1.1
PING 192.168.1.1 (192.168.1.1): 56 data bytes
64 bytes from 192.168.1.1: seq=0 ttl=255 time=2.590 ms
64 bytes from 192.168.1.1: seq=1 ttl=255 time=0.090 ms

--- 192.168.1.1 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.090/1.340/2.590 ms
[root@P2020RDB /root]# 
[root@P2020RDB /root]# 
[root@P2020RDB /root]# ping 192.168.2.1
PING 192.168.2.1 (192.168.2.1): 56 data bytes
64 bytes from 192.168.2.1: seq=0 ttl=255 time=3.502 ms

--- 192.168.2.1 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 3.502/3.502/3.502 ms
[root@P2020RDB /root]# arp
gateway2 (192.168.2.1) at 00:00:08:00:00:01 [ether]  on eth2
gateway1 (192.168.1.1) at 00:00:07:00:00:01 [ether]  on eth0
[root@P2020RDB /root]# arp -s 192.168.2.1 00:00:08:00:00:01
[root@P2020RDB /root]# arp -s 192.1681.\b \b\b \b.1.1 00:00:07:00:00:01
[root@P2020RDB /root]# 
[root@P2020RDB /root]# 
[root@P2020RDB /root]# 
[root@P2020RDB /root]# arp 
gateway2 (192.168.2.1) at 00:00:08:00:00:01 [ether] PERM on eth2
gateway1 (192.168.1.1) at 00:00:07:00:00:01 [ether] PERM on eth0
[root@P2020RDB /root]# ifco\b\b\b\b[root@P2020RDB /root]# ifconfig 
eth0      Link encap:Ethernet  HWaddr 00:04:9F:0C:05:00  
          inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5 errors:0 dropped:0 overruns:0 frame:0
          TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:426 (426.0 B)  TX bytes:1146 (1.1 KiB)
          Base address:0x2000 

eth2      Link encap:Ethernet  HWaddr 00:04:9F:0C:05:02  
          inet addr:192.168.2.2  Bcast:192.168.2.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:318 (318.0 B)  TX bytes:1048 (1.0 KiB)
          Base address:0xa000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

[root@P2020RDB /root]# cat /p\b\b[root@P2020RDB /root]# cat /proc/in[root@P2020RDB /root]# cat /proc/interrupts 
           CPU0       CPU1       
 19:        648          0   OpenPIC   Level     fsl-elbc
 20:          0          0   OpenPIC   Level     fsldma-channel
 21:          0          0   OpenPIC   Level     fsldma-channel
 22:          0          0   OpenPIC   Level     fsldma-channel
 23:          0          0   OpenPIC   Level     fsldma-channel
 28:          0          0   OpenPIC   Level     ehci_hcd:usb1
 29:         13          0   OpenPIC   Level     eth0_tx
 30:          0          4   OpenPIC   Level     eth0_rx
 31:          0         12   OpenPIC   Level     eth2_tx
 32:          4          0   OpenPIC   Level     eth2_rx
 33:          0          0   OpenPIC   Level     eth2_er
 34:          0          0   OpenPIC   Level     eth0_er
 42:       1049          0   OpenPIC   Level     serial
 43:          0         29   OpenPIC   Level     i2c-mpc, i2c-mpc
 45:          0          0   OpenPIC   Level     talitos
 59:          0       2494   OpenPIC   Level     fsl_espi
 72:         12          0   OpenPIC   Level     esdhc:slot0
 76:          0          0   OpenPIC   Level     fsldma-channel
 77:          0          0   OpenPIC   Level     fsldma-channel
 78:          0          0   OpenPIC   Level     fsldma-channel
 79:          0          0   OpenPIC   Level     fsldma-channel
251:          0          0   OpenPIC   Edge      ipi call function
252:       1253       1387   OpenPIC   Edge      ipi reschedule
253:        427        390   OpenPIC   Edge      ipi call function single
BAD:          1
[root@P2020RDB /root]# PHY: mdio0@520:01 - Link is Down
PHY: mdio0@520:01 - Link is Up - 1000/Full

[root@P2020RDB /root]# cat /p\b\b[root@P2020RDB /root]# cat /proc/in[root@P2020RDB /root]# cat /proc/interrupts 
           CPU0       CPU1       
 19:        648          0   OpenPIC   Level     fsl-elbc
 20:          0          0   OpenPIC   Level     fsldma-channel
 21:          0          0   OpenPIC   Level     fsldma-channel
 22:          0          0   OpenPIC   Level     fsldma-channel
 23:          0          0   OpenPIC   Level     fsldma-channel
 28:          0          0   OpenPIC   Level     ehci_hcd:usb1
 29:      56328          0   OpenPIC   Level     eth0_tx
 30:          0    5553282   OpenPIC   Level     eth0_rx
 31:          0      43413   OpenPIC   Level     eth2_tx
 32:    5709572          0   OpenPIC   Level     eth2_rx
 33:          0          0   OpenPIC   Level     eth2_er
 34:          0          0   OpenPIC   Level     eth0_er
 42:       1179          0   OpenPIC   Level     serial
 43:          0         29   OpenPIC   Level     i2c-mpc, i2c-mpc
 45:          0          0   OpenPIC   Level     talitos
 59:          0       2494   OpenPIC   Level     fsl_espi
 72:         12          0   OpenPIC   Level     esdhc:slot0
 76:          0          0   OpenPIC   Level     fsldma-channel
 77:          0          0   OpenPIC   Level     fsldma-channel
 78:          0          0   OpenPIC   Level     fsldma-channel
 79:          0          0   OpenPIC   Level     fsldma-channel
251:          0          0   OpenPIC   Edge      ipi call function
252:       1254       1389   OpenPIC   Edge      ipi reschedule
253:        427        406   OpenPIC   Edge      ipi call function single
BAD:      36172
[root@P2020RDB /root]# uname -a
Linux P2020RDB 2.6.29 #1 SMP Fri Jul 3 15:11:50 IST 2009 ppc unknown
[root@P2020RDB /root]# cat /p\b\b[root@P2020RDB /root]# cat /proc/in[root@P2020RDB /root]# cat /proc/interrupts 
           CPU0       CPU1       
 19:        648          0   OpenPIC   Level     fsl-elbc
 20:          0          0   OpenPIC   Level     fsldma-channel
 21:          0          0   OpenPIC   Level     fsldma-channel
 22:          0          0   OpenPIC   Level     fsldma-channel
 23:          0          0   OpenPIC   Level     fsldma-channel
 28:          0          0   OpenPIC   Level     ehci_hcd:usb1
 29:      56328          0   OpenPIC   Level     eth0_tx
 30:          0    5553282   OpenPIC   Level     eth0_rx
 31:          0      43413   OpenPIC   Level     eth2_tx
 32:    5709572          0   OpenPIC   Level     eth2_rx
 33:          0          0   OpenPIC   Level     eth2_er
 34:          0          0   OpenPIC   Level     eth0_er
 42:       1329          0   OpenPIC   Level     serial
 43:          0         29   OpenPIC   Level     i2c-mpc, i2c-mpc
 45:          0          0   OpenPIC   Level     talitos
 59:          0       2494   OpenPIC   Level     fsl_espi
 72:         12          0   OpenPIC   Level     esdhc:slot0
 76:          0          0   OpenPIC   Level     fsldma-channel
 77:          0          0   OpenPIC   Level     fsldma-channel
 78:          0          0   OpenPIC   Level     fsldma-channel
 79:          0          0   OpenPIC   Level     fsldma-channel
251:          0          0   OpenPIC   Edge      ipi call function
252:       1256       1391   OpenPIC   Edge      ipi reschedule
253:        427        439   OpenPIC   Edge      ipi call function single
BAD:      36172
[root@P2020RDB /root]# ifco\b\b\b\b[root@P2020RDB /root]# ifconfig 
eth0      Link encap:Ethernet  HWaddr 00:04:9F:0C:05:00  
          inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8928576 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8928586 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:625000396 (596.0 MiB)  TX bytes:535715406 (510.8 MiB)
          Base address:0x2000 

eth2      Link encap:Ethernet  HWaddr 00:04:9F:0C:05:02  
          inet addr:192.168.2.2  Bcast:192.168.2.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8928575 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8928585 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:625000288 (596.0 MiB)  TX bytes:535715308 (510.8 MiB)
          Base address:0xa000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

[root@P2020RDB /root]# 

^ 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