LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: removing addr_needs_map in struct dma_mapping_ops
From: FUJITA Tomonori @ 2009-07-23  7:09 UTC (permalink / raw)
  To: beckyb; +Cc: fujita.tomonori, linuxppc-dev, linux-kernel
In-Reply-To: <79B7CF70-0A66-43DA-91ED-3C8638FED141@kernel.crashing.org>

On Wed, 15 Jul 2009 18:59:03 -0500
Becky Bruce <beckyb@kernel.crashing.org> wrote:

> 
> On Jul 13, 2009, at 7:49 PM, FUJITA Tomonori wrote:
> 
> > On Mon, 13 Jul 2009 16:50:43 -0500
> > Becky Bruce <beckyb@kernel.crashing.org> wrote:
> >
> >>> talked about defining something like struct dma_data. Then we could
> >>>
> >>> struct dev_archdata {
> >>>     ...
> >>>
> >>>     struct dma_data *ddata;
> >>> };
> >>>
> >>> or
> >>>
> >>> struct dev_archdata {
> >>>     ...
> >>>
> >>>     struct dma_data ddata;
> >>> };
> >>>
> >>>
> >>> struct dma_data needs dma_direct_offset, iommu_table, dma_base, and
> >>> dma_window_size, anything else?
> >>
> >> IIRC, what we had talked about was simpler - we talked about changing
> >> the current dev_archdata from this:
> >>
> >> struct dev_archdata {
> >>        struct device_node      *of_node;
> >>        struct dma_mapping_ops  *dma_ops;
> >>        void                    *dma_data;
> >> };
> >>
> >> to this:
> >>
> >> struct dev_archdata {
> >> 	struct device_node *of_node;
> >> 	struct dma_mapping_ops *dma_ops;
> >> 	unsigned long long dma_data;
> >> #ifdef CONFIG_SWIOTLB
> >> 	dma_addr_t max_direct_dma_addr;
> >> #endif
> >> };
> >>
> >> Where max_direct_dma_addr is the address beyond which a specific
> >> device must use swiotlb, and dma_data is the offset like it is now
> >> (but wider on 32-bit systems than void *). I believe Ben had  
> >> mentioned
> >> wanting to make the max_direct_dma_addr part conditional so we don't
> >> bloat archdata on platforms that don't ever bounce.
> >
> > Only maximum address is enough? The minimum (dma_window_base_cur in
> > swiotlb_pci_addr_needs_map) is not necessary?
> >
> >
> >> The change to the type of dma_data is actually in preparation for an
> >> optimization I have planned for 64-bit PCI devices (and which  
> >> probably
> >> requires more discussion), so that doesn't need to happen now -  just
> >> leave it as a void *, and I can post a followup patch.
> >>
> >> Let me know if I can help or do any testing - I've been meaning to
> >> look into switching to dma_map_ops for a while now but it hasn't
> >> managed to pop off my todo stack.
> >
> > Ok, how about this? I'm not familiar with POWERPC so I might
> > misunderstand something.
> 
> This is close, but it misses the setup for non-pci devices. We have a  
> bus notifier that we use to set up archdata for those devices -   
> ppc_swiotlb_bus_notify() in arch/powerpc/kernel/dma-swiotlb.c.  It  
> won't cause breakage to not have this set up, because those will fall  
> through to the dma_capable(), but I think we should initialize it  
> anyway (who knows what it will end up used for later....).

You mean that you like to initialize max_direct_dma_addr to zero
explicitly in ppc_swiotlb_bus_notify()?


> > diff --git a/arch/powerpc/include/asm/device.h b/arch/powerpc/ 
> > include/asm/device.h
> > index 7d2277c..0086f8d 100644
> > --- a/arch/powerpc/include/asm/device.h
> > +++ b/arch/powerpc/include/asm/device.h
> > @@ -16,6 +16,9 @@ struct dev_archdata {
> > 	/* DMA operations on that device */
> > 	struct dma_mapping_ops	*dma_ops;
> > 	void			*dma_data;
> > +#ifdef CONFIG_SWIOTLB
> > +	dma_addr_t		max_direct_dma_addr;
> > +#endif
> > };
> >
> > static inline void dev_archdata_set_node(struct dev_archdata *ad,
> > diff --git a/arch/powerpc/include/asm/swiotlb.h b/arch/powerpc/ 
> > include/asm/swiotlb.h
> > index 30891d6..b23a4f1 100644
> > --- a/arch/powerpc/include/asm/swiotlb.h
> > +++ b/arch/powerpc/include/asm/swiotlb.h
> > @@ -24,4 +24,6 @@ static inline void dma_mark_clean(void *addr,  
> > size_t size) {}
> > extern unsigned int ppc_swiotlb_enable;
> > int __init swiotlb_setup_bus_notifier(void);
> >
> > +extern void pci_dma_dev_setup_swiotlb(struct pci_dev *pdev);
> > +
> > #endif /* __ASM_SWIOTLB_H */
> > diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/ 
> > dma-swiotlb.c
> > index 68ccf11..e21359e 100644
> > --- a/arch/powerpc/kernel/dma-swiotlb.c
> > +++ b/arch/powerpc/kernel/dma-swiotlb.c
> > @@ -56,39 +56,16 @@ swiotlb_arch_address_needs_mapping(struct device  
> > *hwdev, dma_addr_t addr,
> > 				   size_t size)
> > {
> > 	struct dma_mapping_ops *dma_ops = get_dma_ops(hwdev);
> > +	struct dev_archdata *sd = &hwdev->archdata;
> >
> > 	BUG_ON(!dma_ops);
> > -	return dma_ops->addr_needs_map(hwdev, addr, size);
> > -}
> 
> You can get rid of the dma_ops stuff here.... it's no longer needed.

Yeah, I'll do later in this patchset that converts POWERPC to use
dma_map_ops structure; this is the first patch of the patchset.


> > - * Determine if an address is reachable by a pci device, or if we  
> > must bounce.
> > - */
> > -static int
> > -swiotlb_pci_addr_needs_map(struct device *hwdev, dma_addr_t addr,  
> > size_t size)
> > -{
> > -	u64 mask = dma_get_mask(hwdev);
> > -	dma_addr_t max;
> > -	struct pci_controller *hose;
> > -	struct pci_dev *pdev = to_pci_dev(hwdev);
> > -
> > -	hose = pci_bus_to_host(pdev->bus);
> > -	max = hose->dma_window_base_cur + hose->dma_window_size;
> > -
> > -	/* check that we're within mapped pci window space */
> > -	if ((addr + size > max) | (addr < hose->dma_window_base_cur))
> > +	if (sd->max_direct_dma_addr && addr + size > sd- 
> > >max_direct_dma_addr)
> > 		return 1;
> >
> > -	return !is_buffer_dma_capable(mask, addr, size);
> > -}
> > -
> > -static int
> > -swiotlb_addr_needs_map(struct device *hwdev, dma_addr_t addr,  
> > size_t size)
> > -{
> > 	return !is_buffer_dma_capable(dma_get_mask(hwdev), addr, size);
> > }
> >
> > -
> > /*
> >  * At the moment, all platforms that use this code only require
> >  * swiotlb to be used if we're operating on HIGHMEM.  Since
> > @@ -104,7 +81,6 @@ struct dma_mapping_ops swiotlb_dma_ops = {
> > 	.dma_supported = swiotlb_dma_supported,
> > 	.map_page = swiotlb_map_page,
> > 	.unmap_page = swiotlb_unmap_page,
> > -	.addr_needs_map = swiotlb_addr_needs_map,
> > 	.sync_single_range_for_cpu = swiotlb_sync_single_range_for_cpu,
> > 	.sync_single_range_for_device = swiotlb_sync_single_range_for_device,
> > 	.sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
> > @@ -119,13 +95,23 @@ struct dma_mapping_ops swiotlb_pci_dma_ops = {
> > 	.dma_supported = swiotlb_dma_supported,
> > 	.map_page = swiotlb_map_page,
> > 	.unmap_page = swiotlb_unmap_page,
> > -	.addr_needs_map = swiotlb_pci_addr_needs_map,
> > 	.sync_single_range_for_cpu = swiotlb_sync_single_range_for_cpu,
> > 	.sync_single_range_for_device = swiotlb_sync_single_range_for_device,
> > 	.sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
> > 	.sync_sg_for_device = swiotlb_sync_sg_for_device
> > };
> >
> > +void pci_dma_dev_setup_swiotlb(struct pci_dev *pdev)
> > +{
> > +	struct pci_controller *hose;
> > +	struct dev_archdata *sd;
> > +
> > +	hose = pci_bus_to_host(pdev->bus);
> > +	sd = &pdev->dev.archdata;
> > +	sd->max_direct_dma_addr =
> > +		hose->dma_window_base_cur + hose->dma_window_size;
> > +}
> > +
> > static int ppc_swiotlb_bus_notify(struct notifier_block *nb,
> > 				  unsigned long action, void *data)
> > {
> > diff --git a/arch/powerpc/platforms/85xx/mpc8536_ds.c b/arch/powerpc/ 
> > platforms/85xx/mpc8536_ds.c
> > index 055ff41..401751b 100644
> > --- a/arch/powerpc/platforms/85xx/mpc8536_ds.c
> > +++ b/arch/powerpc/platforms/85xx/mpc8536_ds.c
> > @@ -136,6 +136,7 @@ define_machine(mpc8536_ds) {
> > 	.init_IRQ		= mpc8536_ds_pic_init,
> > #ifdef CONFIG_PCI
> > 	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
> > +	.pci_dma_dev_setup	= pci_dma_dev_setup_swiotlb,
> > #endif
> > 	.get_irq		= mpic_get_irq,
> > 	.restart		= fsl_rstcr_restart,
> > diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/ 
> > platforms/85xx/mpc85xx_ds.c
> > index 849c0ac..1ba8e38 100644
> > --- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
> > +++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
> > @@ -277,6 +277,7 @@ define_machine(mpc8544_ds) {
> > 	.init_IRQ		= mpc85xx_ds_pic_init,
> > #ifdef CONFIG_PCI
> > 	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
> > +	.pci_dma_dev_setup	= pci_dma_dev_setup_swiotlb,
> > #endif
> > 	.get_irq		= mpic_get_irq,
> > 	.restart		= fsl_rstcr_restart,
> > @@ -291,6 +292,7 @@ define_machine(mpc8572_ds) {
> > 	.init_IRQ		= mpc85xx_ds_pic_init,
> > #ifdef CONFIG_PCI
> > 	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
> > +	.pci_dma_dev_setup	= pci_dma_dev_setup_swiotlb,
> > #endif
> > 	.get_irq		= mpic_get_irq,
> > 	.restart		= fsl_rstcr_restart,
> > @@ -305,6 +307,7 @@ define_machine(p2020_ds) {
> > 	.init_IRQ		= mpc85xx_ds_pic_init,
> > #ifdef CONFIG_PCI
> > 	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
> > +	.pci_dma_dev_setup	= pci_dma_dev_setup_swiotlb,
> > #endif
> > 	.get_irq		= mpic_get_irq,
> > 	.restart		= fsl_rstcr_restart,
> > diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/ 
> > powerpc/platforms/85xx/mpc85xx_mds.c
> > index 60ed9c0..165a2de 100644
> > --- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
> > +++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
> > @@ -356,6 +356,7 @@ define_machine(mpc8568_mds) {
> > 	.progress	= udbg_progress,
> > #ifdef CONFIG_PCI
> > 	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
> > +	.pci_dma_dev_setup	= pci_dma_dev_setup_swiotlb,
> > #endif
> > };
> >
> > @@ -377,5 +378,6 @@ define_machine(mpc8569_mds) {
> > 	.progress	= udbg_progress,
> > #ifdef CONFIG_PCI
> > 	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
> > +	.pci_dma_dev_setup	= pci_dma_dev_setup_swiotlb,
> > #endif
> > };
> > diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/ 
> > powerpc/platforms/86xx/mpc86xx_hpcn.c
> > index 6632702..d1878f3 100644
> > --- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
> > +++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
> > @@ -187,5 +187,6 @@ define_machine(mpc86xx_hpcn) {
> > 	.progress		= udbg_progress,
> > #ifdef CONFIG_PCI
> > 	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
> > +	.pci_dma_dev_setup	= pci_dma_dev_setup_swiotlb,
> > #endif
> > };
> 
> Instead of initializing this here (which has problems if ! 
> CONFIG_SWIOTLB),

Oops, I overlooked it.


> place this in the xxxxx_xxxx_setup_arch function in  
> the same files, which already have an #ifdef CONFIG_SWIOTLB in which  
> this can be embedded.

But the xxxxx_xxxx_setup_arch function doesn't access to each device
so we need to add something like for_each_pci_dev()? You prefer that?


> I'm about to be off-list for a few days but will be happy to help when  
> I'm back next week.

Thanks!

^ permalink raw reply

* Re: [PATCH 2/5] Mechanism to enable use Generic NVRAM driver for different size chips
From: Benjamin Herrenschmidt @ 2009-07-23  7:43 UTC (permalink / raw)
  To: Martyn Welch; +Cc: linuxppc-dev
In-Reply-To: <20090702161224.31202.65236.stgit@ES-J7S4D2J.amer.consind.ge.com>

On Thu, 2009-07-02 at 17:12 +0100, Martyn Welch wrote:
> Remove the reliance on a staticly defined NVRAM size, allowing platforms to support NVRAMs with sizes differing from the standard. A fall back value is provided for platforms not supporting this extension.
> 
> Signed-off-by: Martyn Welch <martyn.welch@gefanuc.com>

What about other archs that use this driver ? They would also need
that new nvram_size() ...

BTW. This patch touches non-arch code so should at least be CCed to lkml

Cheers,
Ben.

> ---
> 
>  arch/powerpc/include/asm/nvram.h |    3 +++
>  arch/powerpc/kernel/setup_32.c   |    8 ++++++++
>  drivers/char/generic_nvram.c     |   27 ++++++++++++++++++++-------
>  3 files changed, 31 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/nvram.h b/arch/powerpc/include/asm/nvram.h
> index efde5ac..71df8b2 100644
> --- a/arch/powerpc/include/asm/nvram.h
> +++ b/arch/powerpc/include/asm/nvram.h
> @@ -107,6 +107,9 @@ extern void	pmac_xpram_write(int xpaddr, u8 data);
>  /* Synchronize NVRAM */
>  extern void	nvram_sync(void);
>  
> +/* Determine NVRAM size */
> +extern ssize_t nvram_size(void);
> +
>  /* Normal access to NVRAM */
>  extern unsigned char nvram_read_byte(int i);
>  extern void nvram_write_byte(unsigned char c, int i);
> diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
> index 1d15424..28f7570 100644
> --- a/arch/powerpc/kernel/setup_32.c
> +++ b/arch/powerpc/kernel/setup_32.c
> @@ -208,6 +208,14 @@ void nvram_write_byte(unsigned char val, int addr)
>  }
>  EXPORT_SYMBOL(nvram_write_byte);
>  
> +ssize_t nvram_size(void)
> +{
> +	if (ppc_md.nvram_size)
> +		return ppc_md.nvram_size();
> +	return -1;
> +}
> +EXPORT_SYMBOL(nvram_size);
> +
>  void nvram_sync(void)
>  {
>  	if (ppc_md.nvram_sync)
> diff --git a/drivers/char/generic_nvram.c b/drivers/char/generic_nvram.c
> index a00869c..e5f71f3 100644
> --- a/drivers/char/generic_nvram.c
> +++ b/drivers/char/generic_nvram.c
> @@ -2,7 +2,7 @@
>   * Generic /dev/nvram driver for architectures providing some
>   * "generic" hooks, that is :
>   *
> - * nvram_read_byte, nvram_write_byte, nvram_sync
> + * nvram_read_byte, nvram_write_byte, nvram_sync, nvram_size
>   *
>   * Note that an additional hook is supported for PowerMac only
>   * for getting the nvram "partition" informations
> @@ -28,6 +28,8 @@
>  
>  #define NVRAM_SIZE	8192
>  
> +static ssize_t nvram_len;
> +
>  static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
>  {
>  	lock_kernel();
> @@ -36,7 +38,7 @@ static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
>  		offset += file->f_pos;
>  		break;
>  	case 2:
> -		offset += NVRAM_SIZE;
> +		offset += nvram_len;
>  		break;
>  	}
>  	if (offset < 0) {
> @@ -56,9 +58,9 @@ static ssize_t read_nvram(struct file *file, char __user *buf,
>  
>  	if (!access_ok(VERIFY_WRITE, buf, count))
>  		return -EFAULT;
> -	if (*ppos >= NVRAM_SIZE)
> +	if (*ppos >= nvram_len)
>  		return 0;
> -	for (i = *ppos; count > 0 && i < NVRAM_SIZE; ++i, ++p, --count)
> +	for (i = *ppos; count > 0 && i < nvram_len; ++i, ++p, --count)
>  		if (__put_user(nvram_read_byte(i), p))
>  			return -EFAULT;
>  	*ppos = i;
> @@ -74,9 +76,9 @@ static ssize_t write_nvram(struct file *file, const char __user *buf,
>  
>  	if (!access_ok(VERIFY_READ, buf, count))
>  		return -EFAULT;
> -	if (*ppos >= NVRAM_SIZE)
> +	if (*ppos >= nvram_len)
>  		return 0;
> -	for (i = *ppos; count > 0 && i < NVRAM_SIZE; ++i, ++p, --count) {
> +	for (i = *ppos; count > 0 && i < nvram_len; ++i, ++p, --count) {
>  		if (__get_user(c, p))
>  			return -EFAULT;
>  		nvram_write_byte(c, i);
> @@ -133,9 +135,20 @@ static struct miscdevice nvram_dev = {
>  
>  int __init nvram_init(void)
>  {
> +	int ret = 0;
> +
>  	printk(KERN_INFO "Generic non-volatile memory driver v%s\n",
>  		NVRAM_VERSION);
> -	return misc_register(&nvram_dev);
> +	ret = misc_register(&nvram_dev);
> +	if (ret != 0)
> +		goto out;
> +
> +	nvram_len = nvram_size();
> +	if (nvram_len < 0)
> +		nvram_len = NVRAM_SIZE;
> +
> +out:
> +	return ret;
>  }
>  
>  void __exit nvram_cleanup(void)

^ permalink raw reply

* Re: [PATCH 0/5] Generic NVRAM support for large MMIO devices
From: Benjamin Herrenschmidt @ 2009-07-23  7:44 UTC (permalink / raw)
  To: Martyn Welch; +Cc: linuxppc-dev
In-Reply-To: <20090702154928.31202.65107.stgit@ES-J7S4D2J.amer.consind.ge.com>

On Thu, 2009-07-02 at 17:12 +0100, Martyn Welch wrote:
> The following series allows the generic NVRAM driver to access MMIO
> based NVRAMs. In addition it enables support for NVRAMs of sizes
> differing from those found on PowerPC Macs (providing a safe
> fallback). Patches are also included to enable support for the NVRAM
> found on the GE Fanuc PPC9A, SBC310 and SBC610.
> 
> If this patch series is unsuitable this late in the day for 2.6.31,
> please concider it for 2.6.32.

No major issue with the series other than the change to the generic
nvram code which needs to not break other architectures :-) Also,
it will probably need to go through Andrew Morton, unless there's
a maintainer for that driver, is there ?

Once you sort out that aspect of the patch series, I'm happy to take
the rest in powerpc.git

Cheers,
Ben.

^ permalink raw reply

* [PATCH] powerpc: update wrapper to point to the new location of dtc
From: Lucian Adrian Grijincu @ 2009-07-23 10:13 UTC (permalink / raw)
  To: linuxppc-dev

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


dtc was moved in 9fffb55f66127b52c937ede5196ebfa0c0d50bce from
arch/powerpc/boot/ to scripts/dtc/

This patch updates the wrapper script to point to the new location of dtc.

Signed-off-by: Lucian Adrian Grijincu <lgrijincu@ixiacom.com>
---
  arch/powerpc/boot/wrapper |    3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)



[-- Attachment #2: 0001-powerpc-update-wrapper-to-point-to-the-new-location-.patch --]
[-- Type: text/x-patch, Size: 572 bytes --]

diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index e964489..c907540 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -46,6 +46,7 @@ CROSS=
 # directory for object and other files used by this script
 object=arch/powerpc/boot
 objbin=$object
+dtc=scripts/dtc/dtc
 
 # directory for working files
 tmpdir=.
@@ -124,7 +125,7 @@ if [ -n "$dts" ]; then
     if [ -z "$dtb" ]; then
 	dtb="$platform.dtb"
     fi
-    $object/dtc -O dtb -o "$dtb" -b 0 "$dts"
+    $dtc -O dtb -o "$dtb" -b 0 "$dts"
 fi
 
 if [ -z "$kernel" ]; then


^ permalink raw reply related

* [PATCH v3 RESEND] net: Rework mdio-ofgpio driver to use of_mdio infrastructure
From: Mark Ware @ 2009-07-23 11:20 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linuxppc-dev
In-Reply-To: <20090722.094059.113003489.davem@davemloft.net>

Changes to the fs_enet driver (aa73832c5a80d6c52c69b18af858d88fa595dd3c) cause kernel crashes when using the mdio-ofgpio driver.
 
This patch replicates similar changes made to the fs_enet mii-bitbang drivers.  It has been tested on a custom mpc8280 based board using an NFS mounted root.
 
Signed-off-by: Mark Ware <mware@elphinstone.net>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
---
 
The only changes in v3 are to the commit message.
Resent due to patch mangling by mail client.
This time for sure...
 
 drivers/net/phy/mdio-gpio.c |   77 ++++++++++++++++++++-----------------------
 1 files changed, 36 insertions(+), 41 deletions(-)
 
diff --git a/drivers/net/phy/mdio-gpio.c b/drivers/net/phy/mdio-gpio.c
index 33984b7..22cdd45 100644
--- a/drivers/net/phy/mdio-gpio.c
+++ b/drivers/net/phy/mdio-gpio.c
@@ -30,6 +30,7 @@
 
 #ifdef CONFIG_OF_GPIO
 #include <linux/of_gpio.h>
+#include <linux/of_mdio.h>
 #include <linux/of_platform.h>
 #endif
 
@@ -81,13 +82,12 @@ static struct mdiobb_ops mdio_gpio_ops = {
 	.get_mdio_data = mdio_get,
 };
 
-static int __devinit mdio_gpio_bus_init(struct device *dev,
+static struct mii_bus * __devinit mdio_gpio_bus_init(struct device *dev,
 					struct mdio_gpio_platform_data *pdata,
 					int bus_id)
 {
 	struct mii_bus *new_bus;
 	struct mdio_gpio_info *bitbang;
-	int ret = -ENOMEM;
 	int i;
 
 	bitbang = kzalloc(sizeof(*bitbang), GFP_KERNEL);
@@ -104,8 +104,6 @@ static int __devinit mdio_gpio_bus_init(struct device *dev,
 
 	new_bus->name = "GPIO Bitbanged MDIO",
 
-	ret = -ENODEV;
-
 	new_bus->phy_mask = pdata->phy_mask;
 	new_bus->irq = pdata->irqs;
 	new_bus->parent = dev;
@@ -129,15 +127,8 @@ static int __devinit mdio_gpio_bus_init(struct device *dev,
 
 	dev_set_drvdata(dev, new_bus);
 
-	ret = mdiobus_register(new_bus);
-	if (ret)
-		goto out_free_all;
-
-	return 0;
+	return new_bus;
 
-out_free_all:
-	dev_set_drvdata(dev, NULL);
-	gpio_free(bitbang->mdio);
 out_free_mdc:
 	gpio_free(bitbang->mdc);
 out_free_bus:
@@ -145,30 +136,47 @@ out_free_bus:
 out_free_bitbang:
 	kfree(bitbang);
 out:
-	return ret;
+	return NULL;
 }
 
-static void __devexit mdio_gpio_bus_destroy(struct device *dev)
+static void __devinit mdio_gpio_bus_deinit(struct device *dev)
 {
 	struct mii_bus *bus = dev_get_drvdata(dev);
 	struct mdio_gpio_info *bitbang = bus->priv;
 
-	mdiobus_unregister(bus);
-	free_mdio_bitbang(bus);
 	dev_set_drvdata(dev, NULL);
-	gpio_free(bitbang->mdc);
 	gpio_free(bitbang->mdio);
+	gpio_free(bitbang->mdc);
+	free_mdio_bitbang(bus);
 	kfree(bitbang);
 }
 
+static void __devexit mdio_gpio_bus_destroy(struct device *dev)
+{
+	struct mii_bus *bus = dev_get_drvdata(dev);
+
+	mdiobus_unregister(bus);
+	mdio_gpio_bus_deinit(dev);
+}
+
 static int __devinit mdio_gpio_probe(struct platform_device *pdev)
 {
 	struct mdio_gpio_platform_data *pdata = pdev->dev.platform_data;
+	struct mii_bus *new_bus;
+	int ret;
 
 	if (!pdata)
 		return -ENODEV;
 
-	return mdio_gpio_bus_init(&pdev->dev, pdata, pdev->id);
+	new_bus = mdio_gpio_bus_init(&pdev->dev, pdata, pdev->id);
+	if (!new_bus)
+		return -ENODEV;
+
+	ret = mdiobus_register(new_bus);
+	if (ret)
+		mdio_gpio_bus_deinit(&pdev->dev);
+
+	return ret;
 }
 
 static int __devexit mdio_gpio_remove(struct platform_device *pdev)
@@ -179,29 +187,12 @@ static int __devexit mdio_gpio_remove(struct platform_device *pdev)
 }
 
 #ifdef CONFIG_OF_GPIO
-static void __devinit add_phy(struct mdio_gpio_platform_data *pdata,
-			      struct device_node *np)
-{
-	const u32 *data;
-	int len, id, irq;
-
-	data = of_get_property(np, "reg", &len);
-	if (!data || len != 4)
-		return;
-
-	id = *data;
-	pdata->phy_mask &= ~(1 << id);
-
-	irq = of_irq_to_resource(np, 0, NULL);
-	if (irq)
-		pdata->irqs[id] = irq;
-}
 
 static int __devinit mdio_ofgpio_probe(struct of_device *ofdev,
                                         const struct of_device_id *match)
 {
-	struct device_node *np = NULL;
 	struct mdio_gpio_platform_data *pdata;
+	struct mii_bus *new_bus;
 	int ret;
 
 	pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
@@ -215,14 +206,18 @@ static int __devinit mdio_ofgpio_probe(struct of_device *ofdev,
 
 	ret = of_get_gpio(ofdev->node, 1);
 	if (ret < 0)
-                goto out_free;
+		goto out_free;
 	pdata->mdio = ret;
 
-	while ((np = of_get_next_child(ofdev->node, np)))
-		if (!strcmp(np->type, "ethernet-phy"))
-			add_phy(pdata, np);
+	new_bus = mdio_gpio_bus_init(&ofdev->dev, pdata, pdata->mdc);
+	if (!new_bus)
+		return -ENODEV;
 
-	return mdio_gpio_bus_init(&ofdev->dev, pdata, pdata->mdc);
+	ret = of_mdiobus_register(new_bus, ofdev->node);
+	if (ret)
+		mdio_gpio_bus_deinit(&ofdev->dev);
+
+	return ret;
 
 out_free:
 	kfree(pdata);
-- 
1.5.6.5

^ permalink raw reply related

* Re: [PATCH 2/5] Mechanism to enable use Generic NVRAM driver for different size chips
From: Martyn Welch @ 2009-07-23 11:31 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <1248334988.3367.77.camel@pasglop>

Benjamin Herrenschmidt wrote:
> On Thu, 2009-07-02 at 17:12 +0100, Martyn Welch wrote:
>   
>> Remove the reliance on a staticly defined NVRAM size, allowing platforms to support NVRAMs with sizes differing from the standard. A fall back value is provided for platforms not supporting this extension.
>>
>> Signed-off-by: Martyn Welch <martyn.welch@gefanuc.com>
>>     
>
> What about other archs that use this driver ? They would also need
> that new nvram_size() ...
>   
I'm fairly confident that this driver is solely used by the PowerPC 
architecture. The config option being set in  arch/powerpc/Kconfig[1]. 
Other than the obvious matches in drivers/char/Makefile[2] and powerpc 
defconfigs, the only other places I can find the option being used are:

* As a requirement for CONFIG_NVRAM on the PowerPC platform in 
drivers/char/Kconfig[3]
* In "include/config/auto.conf" and "include/linux/autoconf.h". Are 
these for generation of generic configs?

Martyn

[1] 
http://git.kernel.org/gitweb.cgi?p=linux/kernel/git/benh/powerpc.git;a=blob;f=arch/powerpc/Kconfig#l145
[2] 
http://git.kernel.org/gitweb.cgi?p=linux/kernel/git/benh/powerpc.git;a=blob;f=drivers/char/Makefile#l83
[3] 
http://git.kernel.org/gitweb.cgi?p=linux/kernel/git/benh/powerpc.git;a=blob;f=drivers/char/Kconfig#l777
> BTW. This patch touches non-arch code so should at least be CCed to lkml
>
> Cheers,
> Ben.
>
>   
>> ---
>>
>>  arch/powerpc/include/asm/nvram.h |    3 +++
>>  arch/powerpc/kernel/setup_32.c   |    8 ++++++++
>>  drivers/char/generic_nvram.c     |   27 ++++++++++++++++++++-------
>>  3 files changed, 31 insertions(+), 7 deletions(-)
>>
>> diff --git a/arch/powerpc/include/asm/nvram.h b/arch/powerpc/include/asm/nvram.h
>> index efde5ac..71df8b2 100644
>> --- a/arch/powerpc/include/asm/nvram.h
>> +++ b/arch/powerpc/include/asm/nvram.h
>> @@ -107,6 +107,9 @@ extern void	pmac_xpram_write(int xpaddr, u8 data);
>>  /* Synchronize NVRAM */
>>  extern void	nvram_sync(void);
>>  
>> +/* Determine NVRAM size */
>> +extern ssize_t nvram_size(void);
>> +
>>  /* Normal access to NVRAM */
>>  extern unsigned char nvram_read_byte(int i);
>>  extern void nvram_write_byte(unsigned char c, int i);
>> diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
>> index 1d15424..28f7570 100644
>> --- a/arch/powerpc/kernel/setup_32.c
>> +++ b/arch/powerpc/kernel/setup_32.c
>> @@ -208,6 +208,14 @@ void nvram_write_byte(unsigned char val, int addr)
>>  }
>>  EXPORT_SYMBOL(nvram_write_byte);
>>  
>> +ssize_t nvram_size(void)
>> +{
>> +	if (ppc_md.nvram_size)
>> +		return ppc_md.nvram_size();
>> +	return -1;
>> +}
>> +EXPORT_SYMBOL(nvram_size);
>> +
>>  void nvram_sync(void)
>>  {
>>  	if (ppc_md.nvram_sync)
>> diff --git a/drivers/char/generic_nvram.c b/drivers/char/generic_nvram.c
>> index a00869c..e5f71f3 100644
>> --- a/drivers/char/generic_nvram.c
>> +++ b/drivers/char/generic_nvram.c
>> @@ -2,7 +2,7 @@
>>   * Generic /dev/nvram driver for architectures providing some
>>   * "generic" hooks, that is :
>>   *
>> - * nvram_read_byte, nvram_write_byte, nvram_sync
>> + * nvram_read_byte, nvram_write_byte, nvram_sync, nvram_size
>>   *
>>   * Note that an additional hook is supported for PowerMac only
>>   * for getting the nvram "partition" informations
>> @@ -28,6 +28,8 @@
>>  
>>  #define NVRAM_SIZE	8192
>>  
>> +static ssize_t nvram_len;
>> +
>>  static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
>>  {
>>  	lock_kernel();
>> @@ -36,7 +38,7 @@ static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
>>  		offset += file->f_pos;
>>  		break;
>>  	case 2:
>> -		offset += NVRAM_SIZE;
>> +		offset += nvram_len;
>>  		break;
>>  	}
>>  	if (offset < 0) {
>> @@ -56,9 +58,9 @@ static ssize_t read_nvram(struct file *file, char __user *buf,
>>  
>>  	if (!access_ok(VERIFY_WRITE, buf, count))
>>  		return -EFAULT;
>> -	if (*ppos >= NVRAM_SIZE)
>> +	if (*ppos >= nvram_len)
>>  		return 0;
>> -	for (i = *ppos; count > 0 && i < NVRAM_SIZE; ++i, ++p, --count)
>> +	for (i = *ppos; count > 0 && i < nvram_len; ++i, ++p, --count)
>>  		if (__put_user(nvram_read_byte(i), p))
>>  			return -EFAULT;
>>  	*ppos = i;
>> @@ -74,9 +76,9 @@ static ssize_t write_nvram(struct file *file, const char __user *buf,
>>  
>>  	if (!access_ok(VERIFY_READ, buf, count))
>>  		return -EFAULT;
>> -	if (*ppos >= NVRAM_SIZE)
>> +	if (*ppos >= nvram_len)
>>  		return 0;
>> -	for (i = *ppos; count > 0 && i < NVRAM_SIZE; ++i, ++p, --count) {
>> +	for (i = *ppos; count > 0 && i < nvram_len; ++i, ++p, --count) {
>>  		if (__get_user(c, p))
>>  			return -EFAULT;
>>  		nvram_write_byte(c, i);
>> @@ -133,9 +135,20 @@ static struct miscdevice nvram_dev = {
>>  
>>  int __init nvram_init(void)
>>  {
>> +	int ret = 0;
>> +
>>  	printk(KERN_INFO "Generic non-volatile memory driver v%s\n",
>>  		NVRAM_VERSION);
>> -	return misc_register(&nvram_dev);
>> +	ret = misc_register(&nvram_dev);
>> +	if (ret != 0)
>> +		goto out;
>> +
>> +	nvram_len = nvram_size();
>> +	if (nvram_len < 0)
>> +		nvram_len = NVRAM_SIZE;
>> +
>> +out:
>> +	return ret;
>>  }
>>  
>>  void __exit nvram_cleanup(void)
>>     
>
>   


-- 
Martyn Welch MEng MPhil MIET (Principal Software Engineer)   T:+44(0)1327322748
GE Fanuc Intelligent Platforms Ltd,        |Registered in England and Wales
Tove Valley Business Park, Towcester,      |(3828642) at 100 Barbirolli Square,
Northants, NN12 6PF, UK T:+44(0)1327359444 |Manchester,M2 3AB  VAT:GB 927559189

^ permalink raw reply

* Re: [PATCH] Hold reference to device_node during EEH event handling
From: Linas Vepstas @ 2009-07-23 14:16 UTC (permalink / raw)
  To: michael; +Cc: Paul Mackerras, linuxppc-dev
In-Reply-To: <1247790973.16836.11.camel@concordia>

2009/7/16 Michael Ellerman <michael@ellerman.id.au>:
> On Thu, 2009-07-16 at 09:33 -0700, Mike Mason wrote:
>> Michael Ellerman wrote:
>> > On Wed, 2009-07-15 at 14:43 -0700, Mike Mason wrote:
>> >> This patch increments the device_node reference counter when an EEH
>> >> error occurs and decrements the counter when the event has been
>> >> handled. =C2=A0This is to prevent the device_node from being released=
 until
>> >> eeh_event_handler() has had a chance to deal with the event. =C2=A0We=
've
>> >> seen cases where the device_node is released too soon when an EEH
>> >> event occurs during a dlpar remove, causing the event handler to
>> >> attempt to access bad memory locations.
>> >>
>> >> Please review and let me know of any concerns.
>> >
>> > Taking a reference sounds sane, but ...
>> >
>> >> Signed-off-by: Mike Mason <mmlnx@us.ibm.com>
>> >>
>> >> --- a/arch/powerpc/platforms/pseries/eeh_event.c =C2=A0 2008-10-09 15=
:13:53.000000000 -0700
>> >> +++ b/arch/powerpc/platforms/pseries/eeh_event.c =C2=A0 2009-07-14 14=
:14:00.000000000 -0700
>> >> @@ -75,6 +75,14 @@ static int eeh_event_handler(void * dumm
>> >> =C2=A0 =C2=A0if (event =3D=3D NULL)
>> >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;
>> >>
>> >> + =C2=A0/* EEH holds a reference to the device_node, so if it
>> >> + =C2=A0 * equals 1 it's no longer valid and the event should
>> >> + =C2=A0 * be ignored */
>> >> + =C2=A0if (atomic_read(&event->dn->kref.refcount) =3D=3D 1) {
>> >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0of_node_put(event->dn);
>> >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;
>> >> + =C2=A0}
>> >
>> > That's really gross :)
>>
>> Agreed. =C2=A0I'll look for another way to determine if device is gone a=
nd
>> the event should be ignored. =C2=A0Suggestions are welcome :-)
>
> Benh and I had a quick chat about it, and were wondering whether what
> you really should be doing is taking a reference to the pci device
> (perhaps as well as the device node).
>
> @@ -140,7 +149,7 @@ int eeh_send_failure_event (struct devic
> =C2=A0 =C2=A0 =C2=A0 =C2=A0if (dev)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pci_dev_get(dev);
>
> - =C2=A0 =C2=A0 =C2=A0 event->dn =3D dn;
> + =C2=A0 =C2=A0 =C2=A0 event->dn =3D of_node_get(dn);
> =C2=A0 =C2=A0 =C2=A0 =C2=A0event->dev =3D dev;
>
> pci devs are refcounted too, see pci_dev_get(), so taking a reference
> there would be the "right" thing to do - otherwise there's no guarantee
> it still exists later, unless there's some other trick in the EEH code.

I thought that the eeh code did pci gets and puts in the right locations,
perhaps I (incorrectly) assumed that this meant that the of_dn use count
never dropped to zero ...

I think my logic was:
-- pci device init does of_node_get
-- pci device shutdown does of_node_put
-- pci device shutdown can never run as long as pci use count is > 0

Thus, explicit of_node_get was usually not needed.

So, for example, see above: I was figuring that the pci_dev_get(dev);
was enough to protect the dn too .. although maybe if dev is null,
then things go wrong ...

--linas

^ permalink raw reply

* Re: [PATCH 7/20] powerpc: Modify some ppc_asm.h macros to accomodate 64-bits Book3E
From: Kumar Gala @ 2009-07-23 14:39 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <20090723055953.B6F57DDD1B@ozlabs.org>


On Jul 23, 2009, at 12:59 AM, Benjamin Herrenschmidt wrote:

> The way I intend to use tophys/tovirt on 64-bit BookE is different
> from the "trick" that we currently play for 32-bit BookE so change
> the condition of definition of these macros to make it so.
>
> Also, make sure we only use rfid and mtmsrd instead of rfi and mtmsr
> for 64-bit server processors, not all 64-bit processors.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---

Acked-by: Kumar Gala <galak@kernel.crashing.org>

- k

^ permalink raw reply

* Re: [PATCH 0/20] powerpc: base 64-bit Book3E processor support
From: Kumar Gala @ 2009-07-23 14:42 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list
In-Reply-To: <1248328938.3367.46.camel@pasglop>


On Jul 23, 2009, at 1:02 AM, Benjamin Herrenschmidt wrote:

> Here is a series of patches that implement some basic support
> for 64-bit Book3E processors that comply to architecture 2.06.
>
> There is no specific processor announced yet. The patches make
> some shortcut which means they currently rely on an implementation
> that supports MMU v2 with support for the "HES" feature (HW entry
> select) and with support for the "TLB reservation" feature. They
> also assume a single unified TLB array. I shouldn't be very hard
> to implement support for other variants of the architecture on
> top of this though.
>
> The current set of patch has no proper support yet for hugetlb,
> nor for "special" interrupt levels (debug, critical and machine
> check). Some minimal support for debug/critical levels is provided
> specifically for the "Debug" interrupt (single step etc...) only
> when it occurs from within user space code.
>
> The intend is to merge these in 2.6.32. They rely on pretty much
> all the other patches I've been posting lately including the
> generic changes to add the virtual address argument to pte_free_tlb.
>

Are these in a git tree/branch.  Makes it a bit easier to test out on  
FSL booke-32 to make sure we didn't break anything.

- k

^ permalink raw reply

* Re: [PATCH 13/20] powerpc: Add SPR definitions for new 64-bit BookE
From: Kumar Gala @ 2009-07-23 14:44 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <20090723055959.0D67DDDD1B@ozlabs.org>


On Jul 23, 2009, at 12:59 AM, Benjamin Herrenschmidt wrote:

> +/* Bit definitions for EPCR */
> +#define SPRN_EPCR_EXTGS		0x80000000
> +#define SPRN_EPCR_DTLBGS	0x40000000
> +#define SPRN_EPCR_ITLBGS	0x20000000
> +#define SPRN_EPCR_DSIGS		0x10000000
> +#define SPRN_EPCR_ISIGS		0x08000000
> +#define SPRN_EPCR_DUVD		0x04000000
> +#define SPRN_EPCR_ICM		0x02000000
> +#define SPRN_EPCR_GICM		0x01000000
> +#define SPRN_EPCR_DGTMI		0x00800000
> +#define SPRN_EPCR_DMIUH		0x00400000
> +
> +

how about adding some comments as to what these fields are called.

- k

^ permalink raw reply

* Re: [PATCH] Support for PCI Express reset type in EEH
From: Linas Vepstas @ 2009-07-23 14:44 UTC (permalink / raw)
  To: Mike Mason; +Cc: linuxppc-dev, Paul Mackerras, Richard Lary, linux-pci
In-Reply-To: <4A5E23D0.9020906@us.ibm.com>

2009/7/15 Mike Mason <mmlnx@us.ibm.com>:
> By default, EEH does what's known as a "hot reset" during error recovery =
of
> a PCI Express device. =C2=A0We've found a case where the device needs a
> "fundamental reset" to recover properly. =C2=A0The current PCI error reco=
very and
> EEH frameworks do not support this distinction.
>
> The attached patch (courtesy of Richard Lary) adds a bit field to pci_dev
> that indicates whether the device requires a fundamental reset during err=
or
> recovery. =C2=A0This bit can be checked by EEH to determine which reset t=
ype is
> required.
>
> This patch supersedes the previously submitted patch that implemented a
> reset type callback.
>
> Please review and let me know of any concerns.

I like this patch a *lot* better .. it is vastly simpler, more direct.


> diff -uNrp a/include/linux/pci.h b/include/linux/pci.h
> --- a/include/linux/pci.h =C2=A0 =C2=A0 =C2=A0 2009-07-13 14:25:37.000000=
000 -0700
> +++ b/include/linux/pci.h =C2=A0 =C2=A0 =C2=A0 2009-07-15 10:25:37.000000=
000 -0700
> @@ -273,6 +273,7 @@ struct pci_dev {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int =C2=A0 =C2=A0ari_enabled:1; =C2=
=A0/* ARI forwarding */
> =C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int =C2=A0 =C2=A0is_managed:1;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int =C2=A0 =C2=A0is_pcie:1;
> + =C2=A0 =C2=A0 =C2=A0 unsigned int =C2=A0 =C2=A0fndmntl_rst_rqd:1; /* De=
v requires fundamental reset
> */
> =C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int =C2=A0 =C2=A0state_saved:1;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int =C2=A0 =C2=A0is_physfn:1;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int =C2=A0 =C2=A0is_virtfn:1;

As Ben points out, the name is awkward.  How about needs_freset ?

Since this affects the entire pci subsystem, it should be documented
properly.  The "pci error recovery" subsystem was designed to be
usable in other architectures, and so the error recovery docs should
take at least a paragraph to describe what this flag means, and when
its supposed to be used.

Providing the docs patch together with the pci.h patch *only* would
probably simplify acceptance by the PCI community.

--linas

^ permalink raw reply

* Re: [PATCH 9/20] powerpc/mm: Call mmu_context_init() from ppc64
From: Kumar Gala @ 2009-07-23 14:48 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <20090723055955.757B4DDD1B@ozlabs.org>


On Jul 23, 2009, at 12:59 AM, Benjamin Herrenschmidt wrote:

> Our 64-bit hash context handling has no init function, but 64-bit  
> Book3E
> will use the common mmu_context_nohash.c code which does, so define an
> empty inline mmu_context_init() for 64-bit server and call it from
> our 64-bit setup_arch()
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>
> arch/powerpc/include/asm/mmu_context.h |    7 ++++++-
> arch/powerpc/kernel/setup_64.c         |    4 ++++
> arch/powerpc/mm/mmu_context_hash64.c   |    1 +
> 3 files changed, 11 insertions(+), 1 deletion(-)


Acked-by: Kumar Gala <galak@kernel.crashing.org>

(w/the assumption the respin will just change the whitespace issue).

- k

^ permalink raw reply

* Re: [PATCH 10/20] powerpc: Clean ifdef usage in copy_thread()
From: Kumar Gala @ 2009-07-23 14:49 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <20090723055956.91CDBDDD1B@ozlabs.org>


On Jul 23, 2009, at 12:59 AM, Benjamin Herrenschmidt wrote:

> Currently, a single ifdef covers SLB related bits and more generic  
> ppc64
> related bits, split this in two separate ifdef's since 64-bit BookE  
> will
> need one but not the other.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>
> arch/powerpc/kernel/process.c |    2 ++
> 1 file changed, 2 insertions(+)


Acked-by: Kumar Gala <galak@kernel.crashing.org>

- k

^ permalink raw reply

* Re: [PATCH 11/20] powerpc: Move definitions of secondary CPU spinloop to header file
From: Kumar Gala @ 2009-07-23 14:51 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <20090723055957.19D28DDD1B@ozlabs.org>


On Jul 23, 2009, at 12:59 AM, Benjamin Herrenschmidt wrote:

> Those definitions are currently declared extern in the .c file where
> they are used, move them to a header file instead.
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> --
>
> arch/powerpc/include/asm/smp.h |    5 +++++
> arch/powerpc/kernel/setup_64.c |    3 ---
> 2 files changed, 5 insertions(+), 3 deletions(-)

Can we not get rid of the externs in:

arch/powerpc/platforms/cell/smp.c:extern void  
generic_secondary_smp_init(unsigned long);
arch/powerpc/platforms/pseries/smp.c:extern void  
generic_secondary_smp_init(unsigned long);

arch/powerpc/kernel/prom_init.c:extern unsigned long  
__secondary_hold_spinloop;

- k

>
>
> --- linux-work.orig/arch/powerpc/include/asm/smp.h	2009-07-22  
> 16:38:32.000000000 +1000
> +++ linux-work/arch/powerpc/include/asm/smp.h	2009-07-22  
> 16:46:59.000000000 +1000
> @@ -148,6 +148,11 @@ extern struct smp_ops_t *smp_ops;
> extern void arch_send_call_function_single_ipi(int cpu);
> extern void arch_send_call_function_ipi(cpumask_t mask);
>
> +#ifdef CONFIG_PPC64
> +extern void generic_secondary_smp_init(void);
> +extern unsigned long __secondary_hold_spinloop;
> +#endif /* CONFIG_PPC64 */
> +
> #endif /* __ASSEMBLY__ */
>
> #endif /* __KERNEL__ */
> Index: linux-work/arch/powerpc/kernel/setup_64.c
> ===================================================================
> --- linux-work.orig/arch/powerpc/kernel/setup_64.c	2009-07-22  
> 16:38:12.000000000 +1000
> +++ linux-work/arch/powerpc/kernel/setup_64.c	2009-07-22  
> 16:46:59.000000000 +1000
> @@ -230,9 +230,6 @@ void early_setup_secondary(void)
> #endif /* CONFIG_SMP */
>
> #if defined(CONFIG_SMP) || defined(CONFIG_KEXEC)
> -extern unsigned long __secondary_hold_spinloop;
> -extern void generic_secondary_smp_init(void);
> -
> void smp_release_cpus(void)
> {
> 	unsigned long *ptr;
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply

* [PATCH] powerpc: Add compat_sys_truncate
From: Chase Douglas @ 2009-07-23 15:12 UTC (permalink / raw)
  To: linuxppc-dev

The truncate syscall has a signed long parameter, so when using a 32- 
bit userspace with a 64-bit kernel the argument is zero-extended  
instead of sign-extended. Adding the compat_sys_truncate function  
fixes the issue.

This was noticed during an LSB truncate test failure. The test was  
checking for the correct error number set when truncate is called with  
a length of -1. The test can be found at:

http://bzr.linuxfoundation.org/lsb/devel/runtime-test?cmd=inventory;rev=stewb%40linux-foundation.org-20090626205411-sfb23cc0tjj7jzgm;path=modules/vsx-pcts/tset/POSIX.os/files/truncate/

Signed-off-by: Chase Douglas <cndougla@linux.vnet.ibm.com>

diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/ 
asm/systbl.h
index 370600c..3cca167 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -95,7 +95,7 @@ SYSCALL(reboot)
SYSX(sys_ni_syscall,compat_sys_old_readdir,sys_old_readdir)
SYSCALL_SPU(mmap)
SYSCALL_SPU(munmap)
-SYSCALL_SPU(truncate)
+COMPAT_SYS_SPU(truncate)
SYSCALL_SPU(ftruncate)
SYSCALL_SPU(fchmod)
SYSCALL_SPU(fchown)
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/ 
sys_ppc32.c
index bb1cfcf..da9a65b 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -343,6 +343,12 @@ off_t ppc32_lseek(unsigned int fd, u32 offset,  
unsigned int origin)
        return sys_lseek(fd, (int)offset, origin);
}

+long compat_sys_truncate(const char __user * path, u32 length)
+{
+       /* sign extend length */
+       return sys_truncate(path, (int)length);
+}
+
/* Note: it is necessary to treat bufsiz as an unsigned int,
  * with the corresponding cast to a signed int to insure that the
  * proper conversion (sign extension) between the register  
representation of a signed int (msr in 32-bit mode)

^ permalink raw reply related

* Re: [PATCH] Support for PCI Express reset type in EEH
From: Richard Lary @ 2009-07-23 15:03 UTC (permalink / raw)
  To: linasvepstas; +Cc: linuxppc-dev, mmlnx, Paul Mackerras, linux-pci
In-Reply-To: <3ae3aa420907230744ya3a9342w4f29e150b3b5658f@mail.gmail.com>

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



Linas Vepstas <linasvepstas@gmail.com> wrote on 07/23/2009 07:44:33 AM:

> 2009/7/15 Mike Mason <mmlnx@us.ibm.com>:
> > By default, EEH does what's known as a "hot reset" during error
recovery of
> > a PCI Express device.  We've found a case where the device needs a
> > "fundamental reset" to recover properly.  The current PCI error
recovery and
> > EEH frameworks do not support this distinction.
> >
> > The attached patch (courtesy of Richard Lary) adds a bit field to
pci_dev
> > that indicates whether the device requires a fundamental reset during
error
> > recovery.  This bit can be checked by EEH to determine which reset type
is
> > required.
> >
> > This patch supersedes the previously submitted patch that implemented a
> > reset type callback.
> >
> > Please review and let me know of any concerns.
>
> I like this patch a *lot* better .. it is vastly simpler, more direct.
>
>
> > diff -uNrp a/include/linux/pci.h b/include/linux/pci.h
> > --- a/include/linux/pci.h       2009-07-13 14:25:37.000000000 -0700
> > +++ b/include/linux/pci.h       2009-07-15 10:25:37.000000000 -0700
> > @@ -273,6 +273,7 @@ struct pci_dev {
> >        unsigned int    ari_enabled:1;  /* ARI forwarding */
> >        unsigned int    is_managed:1;
> >        unsigned int    is_pcie:1;
> > +       unsigned int    fndmntl_rst_rqd:1; /* Dev requires fundamental
reset
> > */
> >        unsigned int    state_saved:1;
> >        unsigned int    is_physfn:1;
> >        unsigned int    is_virtfn:1;
>
> As Ben points out, the name is awkward.  How about needs_freset ?

I have no problem changing the name.

> Since this affects the entire pci subsystem, it should be documented
> properly.  The "pci error recovery" subsystem was designed to be
> usable in other architectures, and so the error recovery docs should
> take at least a paragraph to describe what this flag means, and when
> its supposed to be used.

I will take a stab at updating the docs and post here for comment.

> Providing the docs patch together with the pci.h patch *only* would
> probably simplify acceptance by the PCI community.
>
> --linas

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

^ permalink raw reply

* [PATCH] Add support for the ESTeem 195E (PPC405EP) SBC
From: Solomon Peachy @ 2009-07-23 15:21 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Solomon Peachy

This patch adds support for the ESTeem 195E Hotfoot SBC.  
We've been maintaining this out-of-tree for some time now for
older kernels, but recently I ported it to the new unified powerpc tree
with the intent of pushing it upstream.

The board uses an ancient version of u-boot and a slightly mangled
verison of the oft-abused ppcboot header.

There are several variants of the SBC deployed, single/dual
ethernet/serial, and also 4MB/8MB flash units.  In the interest of
having a single kernel image boot on all boards, the cuboot shim detects
the differences and mangles the DTS tree appropriately.

With the exception of the CF interface that was never populated on
production boards, this code/DTS supports all boardpop options.

Signed-off-by:  Solomon Peachy <solomon@linux-wlan.com>

diff -Naur linux-2.6.30/arch/powerpc/boot/Makefile linux-2.6.30.hotfoot/arch/powerpc/boot/Makefile
--- linux-2.6.30/arch/powerpc/boot/Makefile	2009-06-09 23:05:27.000000000 -0400
+++ linux-2.6.30.hotfoot/arch/powerpc/boot/Makefile	2009-07-07 12:55:18.000000000 -0400
@@ -39,6 +39,7 @@
 
 $(obj)/4xx.o: BOOTCFLAGS += -mcpu=405
 $(obj)/ebony.o: BOOTCFLAGS += -mcpu=405
+$(obj)/cuboot-hotfoot.o: BOOTCFLAGS += -mcpu=405
 $(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=405
 $(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=405
 $(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405
@@ -67,7 +68,7 @@
 		cpm-serial.c stdlib.c mpc52xx-psc.c planetcore.c uartlite.c \
 		fsl-soc.c mpc8xx.c pq2.c
 src-plat := of.c cuboot-52xx.c cuboot-824x.c cuboot-83xx.c cuboot-85xx.c holly.c \
-		cuboot-ebony.c treeboot-ebony.c prpmc2800.c \
+		cuboot-ebony.c cuboot-hotfoot.c treeboot-ebony.c prpmc2800.c \
 		ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c \
 		cuboot-pq2.c cuboot-sequoia.c treeboot-walnut.c \
 		cuboot-bamboo.c cuboot-mpc7448hpc2.c cuboot-taishan.c \
@@ -190,6 +191,7 @@
 
 # Board ports in arch/powerpc/platform/40x/Kconfig
 image-$(CONFIG_EP405)			+= dtbImage.ep405
+image-$(CONFIG_HOTFOOT)			+= cuImage.hotfoot
 image-$(CONFIG_WALNUT)			+= treeImage.walnut
 image-$(CONFIG_ACADIA)			+= cuImage.acadia
 
diff -Naur linux-2.6.30/arch/powerpc/boot/cuboot-hotfoot.c linux-2.6.30.hotfoot/arch/powerpc/boot/cuboot-hotfoot.c
--- linux-2.6.30/arch/powerpc/boot/cuboot-hotfoot.c	1969-12-31 19:00:00.000000000 -0500
+++ linux-2.6.30.hotfoot/arch/powerpc/boot/cuboot-hotfoot.c	2009-07-07 12:55:23.000000000 -0400
@@ -0,0 +1,142 @@
+/*
+ * Old U-boot compatibility for Esteem 195E Hotfoot CPU Board
+ *
+ * Author: Solomon Peachy <solomon@linux-wlan.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#include "ops.h"
+#include "stdio.h"
+#include "reg.h"
+#include "dcr.h"
+#include "4xx.h"
+#include "cuboot.h"
+
+#define TARGET_4xx
+#define TARGET_HOTFOOT
+
+#include "ppcboot.h"
+
+static bd_t bd;
+
+#define NUM_REGS 3
+
+static void hotfoot_fixups(void)
+{
+	u32 uart = mfdcr(DCRN_CPC0_UCR) & 0x7f;
+
+	dt_fixup_memory(bd.bi_memstart, bd.bi_memsize); 
+
+	dt_fixup_cpu_clocks(bd.bi_procfreq, bd.bi_procfreq, 0);
+	dt_fixup_clock("/plb", bd.bi_plb_busfreq);
+	dt_fixup_clock("/plb/opb", bd.bi_opbfreq);
+	dt_fixup_clock("/plb/ebc", bd.bi_pci_busfreq);
+	dt_fixup_clock("/plb/opb/serial@ef600300", bd.bi_procfreq / uart); 
+	dt_fixup_clock("/plb/opb/serial@ef600400", bd.bi_procfreq / uart); 
+	
+	dt_fixup_mac_address_by_alias("ethernet0", bd.bi_enetaddr);
+	dt_fixup_mac_address_by_alias("ethernet1", bd.bi_enet1addr);
+
+	/* Is this a single eth/serial board? */
+	if ((bd.bi_enet1addr[0] == 0) && 
+	    (bd.bi_enet1addr[1] == 0) &&
+	    (bd.bi_enet1addr[2] == 0) &&
+	    (bd.bi_enet1addr[3] == 0) &&
+	    (bd.bi_enet1addr[4] == 0) &&
+	    (bd.bi_enet1addr[5] == 0)) {
+		void *devp;
+
+		printf("Trimming devtree for single eth board\n");
+
+		devp = finddevice("/plb/opb/serial@ef600300");
+		if (!devp)
+			fatal("Can't find node for /plb/opb/serial@ef600300");
+		del_node(devp);
+
+		devp = finddevice("/plb/opb/ethernet@ef600900");
+		if (!devp)
+			fatal("Can't find node for /plb/opb/ethernet@ef600900");
+		del_node(devp);
+	}
+
+	ibm4xx_quiesce_eth((u32 *)0xef600800, (u32 *)0xef600900);
+
+	/* Fix up flash size in fdt for 4M boards. */
+	if (bd.bi_flashsize < 0x800000) {
+		u32 regs[NUM_REGS];
+		void *devp = finddevice("/plb/ebc/nor_flash@0");
+		if (!devp)
+			fatal("Can't find FDT node for nor_flash!??");
+
+		printf("Fixing devtree for 4M Flash\n");
+		
+		/* First fix up the base addresse */
+		getprop(devp, "reg", regs, sizeof(regs));
+		regs[0] = 0;
+		regs[1] = 0xffc00000;
+		regs[2] = 0x00400000;
+		setprop(devp, "reg", regs, sizeof(regs));
+		
+		/* Then the offsets */
+		devp = finddevice("/plb/ebc/nor_flash@0/partition@0");
+		if (!devp)
+			fatal("Can't find FDT node for partition@0");
+		getprop(devp, "reg", regs, 2*sizeof(u32));
+		regs[0] -= 0x400000;
+		setprop(devp, "reg", regs,  2*sizeof(u32));
+
+		devp = finddevice("/plb/ebc/nor_flash@0/partition@1");
+		if (!devp)
+			fatal("Can't find FDT node for partition@1");
+		getprop(devp, "reg", regs, 2*sizeof(u32));
+		regs[0] -= 0x400000;
+		setprop(devp, "reg", regs,  2*sizeof(u32));
+
+		devp = finddevice("/plb/ebc/nor_flash@0/partition@2");
+		if (!devp)
+			fatal("Can't find FDT node for partition@2");
+		getprop(devp, "reg", regs, 2*sizeof(u32));
+		regs[0] -= 0x400000;
+		setprop(devp, "reg", regs,  2*sizeof(u32));
+
+		devp = finddevice("/plb/ebc/nor_flash@0/partition@3");
+		if (!devp)
+			fatal("Can't find FDT node for partition@3");
+		getprop(devp, "reg", regs, 2*sizeof(u32));
+		regs[0] -= 0x400000;
+		setprop(devp, "reg", regs,  2*sizeof(u32));
+
+		devp = finddevice("/plb/ebc/nor_flash@0/partition@4");
+		if (!devp)
+			fatal("Can't find FDT node for partition@4");
+		getprop(devp, "reg", regs, 2*sizeof(u32));
+		regs[0] -= 0x400000;
+		setprop(devp, "reg", regs,  2*sizeof(u32));
+
+		devp = finddevice("/plb/ebc/nor_flash@0/partition@6");
+		if (!devp)
+			fatal("Can't find FDT node for partition@6");
+		getprop(devp, "reg", regs, 2*sizeof(u32));
+		regs[0] -= 0x400000;
+		setprop(devp, "reg", regs,  2*sizeof(u32));
+
+		/* Delete the FeatFS node */
+		devp = finddevice("/plb/ebc/nor_flash@0/partition@5");
+		if (!devp)
+			fatal("Can't find FDT node for partition@5");
+		del_node(devp);
+	}
+}
+
+void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
+		   unsigned long r6, unsigned long r7)
+{
+	CUBOOT_INIT();
+	platform_ops.fixups = hotfoot_fixups;
+        platform_ops.exit = ibm40x_dbcr_reset;
+	fdt_init(_dtb_start);
+	serial_console_init();
+}
diff -Naur linux-2.6.30/arch/powerpc/boot/dts/hotfoot.dts linux-2.6.30.hotfoot/arch/powerpc/boot/dts/hotfoot.dts
--- linux-2.6.30/arch/powerpc/boot/dts/hotfoot.dts	1969-12-31 19:00:00.000000000 -0500
+++ linux-2.6.30.hotfoot/arch/powerpc/boot/dts/hotfoot.dts	2009-07-07 12:55:23.000000000 -0400
@@ -0,0 +1,299 @@
+/*
+ * Device Tree Source for ESTeem 195E Hotfoot
+ *
+ * Copyright 2009 AbsoluteValue Systems <solomon@linux-wlan.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without
+ * any warranty of any kind, whether express or implied.
+ */
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+	model = "est,hotfoot";
+	compatible = "est,hotfoot";
+	dcr-parent = <&{/cpus/cpu@0}>;
+
+	aliases {
+		ethernet0 = &EMAC0;
+		ethernet1 = &EMAC1;
+		serial0 = &UART0;
+		serial1 = &UART1;
+	};
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu@0 {
+			device_type = "cpu";
+			model = "PowerPC,405EP";
+			reg = <0x00000000>;
+			clock-frequency = <0>; /* Filled in by zImage */
+			timebase-frequency = <0>; /* Filled in by zImage */
+			i-cache-line-size = <0x20>;
+			d-cache-line-size = <0x20>;
+			i-cache-size = <0x4000>;
+			d-cache-size = <0x4000>;
+			dcr-controller;
+			dcr-access-method = "native";
+		};
+	};
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x00000000>; /* Filled in by zImage */
+	};
+
+	UIC0: interrupt-controller {
+		compatible = "ibm,uic";
+		interrupt-controller;
+		cell-index = <0>;
+		dcr-reg = <0x0c0 0x009>;
+		#address-cells = <0>;
+		#size-cells = <0>;
+		#interrupt-cells = <2>;
+	};
+
+	plb {
+		compatible = "ibm,plb3";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+		clock-frequency = <0>; /* Filled in by zImage */
+
+		SDRAM0: memory-controller {
+			compatible = "ibm,sdram-405ep";
+			dcr-reg = <0x010 0x002>;
+		};
+
+		MAL: mcmal {
+			compatible = "ibm,mcmal-405ep", "ibm,mcmal";
+			dcr-reg = <0x180 0x062>;
+			num-tx-chans = <4>;
+			num-rx-chans = <2>;
+			interrupt-parent = <&UIC0>;
+			interrupts = <
+				0xb 0x4 /* TXEOB */
+				0xc 0x4 /* RXEOB */
+				0xa 0x4 /* SERR */
+				0xd 0x4 /* TXDE */
+				0xe 0x4 /* RXDE */>;
+		};
+
+		POB0: opb {
+			compatible = "ibm,opb-405ep", "ibm,opb";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0xef600000 0xef600000 0x00a00000>;
+			dcr-reg = <0x0a0 0x005>;
+			clock-frequency = <0>; /* Filled in by zImage */
+
+			/* Hotfoot has UART0/UART1 swapped */
+
+			UART0: serial@ef600400 {
+				device_type = "serial";
+				compatible = "ns16550";
+				reg = <0xef600400 0x00000008>;
+				virtual-reg = <0xef600400>;
+				clock-frequency = <0>; /* Filled in by zImage */
+				current-speed = <0x9600>;
+				interrupt-parent = <&UIC0>;
+				interrupts = <0x1 0x4>;
+			};
+
+			UART1: serial@ef600300 {
+				device_type = "serial";
+				compatible = "ns16550";
+				reg = <0xef600300 0x00000008>;
+				virtual-reg = <0xef600300>;
+				clock-frequency = <0>; /* Filled in by zImage */
+				current-speed = <0x9600>;
+				interrupt-parent = <&UIC0>;
+				interrupts = <0x0 0x4>;
+			};
+
+
+			IIC: i2c@ef600500 {
+				compatible = "ibm,iic-405ep", "ibm,iic";
+				reg = <0xef600500 0x00000011>;
+				interrupt-parent = <&UIC0>;
+				interrupts = <0x2 0x4>;
+
+				rtc@68 {
+				      /* Actually a DS1339 */
+				      compatible = "dallas,ds1307"; 
+				      reg = <0x68>;
+				};
+
+				temp@4a { 
+				      /* Not present on all boards */
+				      compatible = "national,lm75";
+				      reg = <0x4a>;
+				};				
+			};
+
+			GPIO: gpio@ef600700 {
+			        #gpio-cells = <2>;
+				compatible = "ibm,ppc4xx-gpio";
+				reg = <0xef600700 0x00000020>;
+				gpio-controller;
+			};
+
+			gpio-leds {
+			     compatible = "gpio-leds";
+			     status {
+			     	    label = "Status";
+			     	    gpios = <&GPIO 1 0>;
+				    /* linux,default=trigger = ".."; */
+			     };
+			     radiorx {
+			     	    label = "Rx";
+			     	    gpios = <&GPIO 0xe 0>;
+				    /* linux,default=trigger = ".."; */
+			     };
+			};
+
+
+			EMAC0: ethernet@ef600800 {
+				linux,network-index = <0x0>;
+				device_type = "network";
+				compatible = "ibm,emac-405ep", "ibm,emac";
+				interrupt-parent = <&UIC0>;
+				interrupts = <
+					0xf 0x4 /* Ethernet */
+					0x9 0x4 /* Ethernet Wake Up */>;
+				local-mac-address = [000000000000]; /* Filled in by zImage */
+				reg = <0xef600800 0x00000070>;
+				mal-device = <&MAL>;
+				mal-tx-channel = <0>;
+				mal-rx-channel = <0>;
+				cell-index = <0>;
+				max-frame-size = <0x5dc>;
+				rx-fifo-size = <0x1000>;
+				tx-fifo-size = <0x800>;
+				phy-mode = "mii";
+				phy-map = <0x00000000>;
+			};
+
+			EMAC1: ethernet@ef600900 {
+				linux,network-index = <0x1>;
+				device_type = "network";
+				compatible = "ibm,emac-405ep", "ibm,emac";
+				interrupt-parent = <&UIC0>;
+				interrupts = <
+					0x11 0x4 /* Ethernet */
+					0x9 0x4 /* Ethernet Wake Up */>;
+				local-mac-address = [000000000000]; /* Filled in by zImage */
+				reg = <0xef600900 0x00000070>;
+				mal-device = <&MAL>;
+				mal-tx-channel = <2>;
+				mal-rx-channel = <1>;
+				cell-index = <1>;
+				max-frame-size = <0x5dc>;
+				rx-fifo-size = <0x1000>;
+				tx-fifo-size = <0x800>;
+                                mdio-device = <&EMAC0>;
+				phy-mode = "mii";
+				phy-map = <0x0000001>;
+			};
+		};
+
+		EBC0: ebc {
+			compatible = "ibm,ebc-405ep", "ibm,ebc";
+			dcr-reg = <0x012 0x002>;
+			#address-cells = <2>;
+			#size-cells = <1>;
+
+			/* The ranges property is supplied by the bootwrapper
+			 * and is based on the firmware's configuration of the
+			 * EBC bridge
+			 */
+			clock-frequency = <0>; /* Filled in by zImage */
+
+                        nor_flash@0 {
+                                compatible = "cfi-flash";
+                                bank-width = <2>;
+                                reg = <0x0 0xff800000 0x00800000>;
+                                #address-cells = <1>;
+                                #size-cells = <1>;
+
+				/* This mapping is for the 8M flash
+				   4M flash has all ofssets -= 4M,
+				   and FeatFS partition is not present */
+				
+                                partition@0 {
+                                        label = "Bootloader";
+                                        reg = <0x7c0000 0x40000>;
+                                        /* read-only; */
+                                };
+                                partition@1 {
+                                        label = "Env_and_Config_Primary";
+                                        reg = <0x400000 0x10000>;
+                                };
+                                partition@2 {
+                                        label = "Kernel";
+                                        reg = <0x420000 0x100000>;
+                                };
+                                partition@3 {
+                                        label = "Filesystem";
+                                        reg = <0x520000 0x2a0000>;
+                                };
+                                partition@4 {
+                                        label = "Env_and_Config_Secondary";
+                                        reg = <0x410000 0x10000>;
+                                };
+                                partition@5 {
+                                        label = "FeatFS";
+                                        reg = <0x000000 0x400000>;
+                                };
+                                partition@6 {
+                                        label = "Bootloader_Env";
+                                        reg = <0x7d0000 0x10000>;
+                                };
+			};
+		};
+
+                PCI0: pci@ec000000 {
+                        device_type = "pci";
+                        #interrupt-cells = <1>;
+                        #size-cells = <2>;
+                        #address-cells = <3>;
+                        compatible = "ibm,plb405ep-pci", "ibm,plb-pci";
+                        primary;
+                        reg = <0xeec00000 0x00000008    /* Config space access */
+                               0xeed80000 0x00000004    /* IACK */
+                               0xeed80000 0x00000004    /* Special cycle */
+                               0xef480000 0x00000040>;  /* Internal registers */
+
+                        /* Outbound ranges, one memory and one IO,
+                         * later cannot be changed. Chip supports a second
+                         * IO range but we don't use it for now
+                         */
+                        ranges = <0x02000000 0x00000000 0x80000000 0x80000000 0x00000000 0x20000000
+                                  0x01000000 0x00000000 0x00000000 0xe8000000 0x00000000 0x00010000>;
+
+                        /* Inbound 2GB range starting at 0 */
+                        dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x80000000>;
+
+			interrupt-parent = <&UIC0>;
+                        interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
+                        interrupt-map = <
+                                /* IDSEL 3 -- slot1 (optional) 27/29 A/B IRQ2/4 */
+                                0x1800 0x0 0x0 0x1 &UIC0 0x1b 0x8
+                                0x1800 0x0 0x0 0x2 &UIC0 0x1d 0x8
+
+                                /* IDSEL 4 -- slot0, 26/28 A/B IRQ1/3 */
+                                0x2000 0x0 0x0 0x1 &UIC0 0x1a 0x8
+                                0x2000 0x0 0x0 0x2 &UIC0 0x1c 0x8
+                        >;
+                };
+	};
+
+	chosen {
+		linux,stdout-path = &UART0;
+	};
+};
diff -Naur linux-2.6.30/arch/powerpc/boot/ppcboot.h linux-2.6.30.hotfoot/arch/powerpc/boot/ppcboot.h
--- linux-2.6.30/arch/powerpc/boot/ppcboot.h	2009-06-09 23:05:27.000000000 -0400
+++ linux-2.6.30.hotfoot/arch/powerpc/boot/ppcboot.h	2009-07-07 12:55:18.000000000 -0400
@@ -52,6 +52,11 @@
 	unsigned long	bi_bootflags;	/* boot / reboot flag (for LynxOS) */
 	unsigned long	bi_ip_addr;	/* IP Address */
 	unsigned char	bi_enetaddr[6];	/* Ethernet address */
+#if defined(TARGET_HOTFOOT)
+	/* second onboard ethernet port */
+	unsigned char	bi_enet1addr[6];
+#define HAVE_ENET1ADDR
+#endif /* TARGET_HOOTFOOT */
 	unsigned short	bi_ethspeed;	/* Ethernet speed in Mbps */
 	unsigned long	bi_intfreq;	/* Internal Freq, in MHz */
 	unsigned long	bi_busfreq;	/* Bus Freq, in MHz */
@@ -74,6 +79,9 @@
 	unsigned int	bi_pci_busfreq;	/* PCI Bus speed, in Hz */
 	unsigned char	bi_pci_enetaddr[6];	/* PCI Ethernet MAC address */
 #endif
+#if defined(TARGET_HOTFOOT)
+	unsigned int     bi_pllouta_freq;       /* PLL OUTA speed, in Hz */
+#endif
 #if defined(TARGET_HYMOD)
 	hymod_conf_t	bi_hymod_conf;	/* hymod configuration information */
 #endif
@@ -94,6 +102,10 @@
 	unsigned char	bi_enet3addr[6];
 #define HAVE_ENET3ADDR
 #endif
+#if defined(TARGET_HOTFOOT)
+        int             bi_phynum[2];           /* Determines phy mapping */
+        int             bi_phymode[2];          /* Determines phy mode */
+#endif
 #if defined(TARGET_4xx)
 	unsigned int	bi_opbfreq;		/* OB clock in Hz */
 	int		bi_iic_fast[2];		/* Use fast i2c mode */
diff -Naur linux-2.6.30/arch/powerpc/platforms/40x/Kconfig linux-2.6.30.hotfoot/arch/powerpc/platforms/40x/Kconfig
--- linux-2.6.30/arch/powerpc/platforms/40x/Kconfig	2009-06-09 23:05:27.000000000 -0400
+++ linux-2.6.30.hotfoot/arch/powerpc/platforms/40x/Kconfig	2009-07-07 12:55:18.000000000 -0400
@@ -40,6 +40,16 @@
 	help
 	  This option enables support for the Nestal Maschinen HCU4 board.
 
+config HOTFOOT
+        bool "Hotfoot"
+	depends on 40x
+	default n
+	select 405EP
+	select PPC40x_SIMPLE
+	select PCI
+        help
+	 This option enables support for the ESTEEM 195E Hotfoot board.
+
 config KILAUEA
 	bool "Kilauea"
 	depends on 40x
diff -Naur linux-2.6.30/arch/powerpc/platforms/40x/ppc40x_simple.c linux-2.6.30.hotfoot/arch/powerpc/platforms/40x/ppc40x_simple.c
--- linux-2.6.30/arch/powerpc/platforms/40x/ppc40x_simple.c	2009-06-09 23:05:27.000000000 -0400
+++ linux-2.6.30.hotfoot/arch/powerpc/platforms/40x/ppc40x_simple.c	2009-07-07 12:55:18.000000000 -0400
@@ -51,7 +51,8 @@
  * board.c file for it rather than adding it to this list.
  */
 static char *board[] __initdata = {
-	"amcc,acadia"
+	"amcc,acadia",
+	"est,hotfoot"
 };
 
 static int __init ppc40x_probe(void)

^ permalink raw reply

* Re: removing addr_needs_map in struct dma_mapping_ops
From: Kumar Gala @ 2009-07-23 15:44 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: linuxppc-dev, linux-kernel
In-Reply-To: <20090723160855S.fujita.tomonori@lab.ntt.co.jp>


On Jul 23, 2009, at 2:09 AM, FUJITA Tomonori wrote:

>>> diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/
>>> powerpc/platforms/86xx/mpc86xx_hpcn.c
>>> index 6632702..d1878f3 100644
>>> --- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
>>> +++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
>>> @@ -187,5 +187,6 @@ define_machine(mpc86xx_hpcn) {
>>> 	.progress		= udbg_progress,
>>> #ifdef CONFIG_PCI
>>> 	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
>>> +	.pci_dma_dev_setup	= pci_dma_dev_setup_swiotlb,
>>> #endif
>>> };
>>
>> Instead of initializing this here (which has problems if !
>> CONFIG_SWIOTLB),
>
> Oops, I overlooked it.
>
>
>> place this in the xxxxx_xxxx_setup_arch function in
>> the same files, which already have an #ifdef CONFIG_SWIOTLB in which
>> this can be embedded.
>
> But the xxxxx_xxxx_setup_arch function doesn't access to each device
> so we need to add something like for_each_pci_dev()? You prefer that?

No.. I think what we want is:

#ifdef CONFIG_SWIOTLB
         if (lmb_end_of_DRAM() > max) {
                 ppc_swiotlb_enable = 1;
                 set_pci_dma_ops(&swiotlb_pci_dma_ops);
		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
         }
#endif

Buts its been a few days since Becky & I chatted about this and I feel  
like I'm forgetting something.

- k

^ permalink raw reply

* Re: [PATCH 4/20] powerpc/mm: Add opcode definitions for tlbivax and tlbsrx.
From: Kumar Gala @ 2009-07-23 15:55 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <20090723055951.7867DDDD1B@ozlabs.org>


On Jul 23, 2009, at 12:59 AM, Benjamin Herrenschmidt wrote:

> This adds the opcode definitions to ppc-opcode.h for the two  
> instructions
> tlbivax and tlbsrx. as defined by Book3E 2.06
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>
> arch/powerpc/include/asm/ppc-opcode.h |    6 ++++++
> 1 file changed, 6 insertions(+)

Do we really have binutils that don't have tlbivax properly at this  
point?

- k

^ permalink raw reply

* (no subject)
From: Solomon Peachy @ 2009-07-23 14:38 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Solomon Peachy

This patch (against 2.6.30) adds support for the ESTeem 195E Hotfoot
SBC.  We've been maintaining this out-of-tree for some time now for
older kernels, but recently I ported it to the new unified powerpc tree
with the intent of pushing it upstream.

The board uses an ancient version of u-boot and a slightly mangled
verison of the oft-abused ppcboot header.

There are several variants of the SBC deployed, single/dual
ethernet/serial, and also 4MB/8MB flash units.  In the interest of
having a single kernel image boot on all boards, the cuboot shim detects
the differences and mangles the DTS tree appropriately.

With the exception of the CF interface that was never populated on
production boards, this code/DTS supports all boardpop options.

Signed-off-by:  Solomon Peachy <solomon@linux-wlan.com>

diff -Naur linux-2.6.30/arch/powerpc/boot/Makefile linux-2.6.30.hotfoot/arch/powerpc/boot/Makefile
--- linux-2.6.30/arch/powerpc/boot/Makefile	2009-06-09 23:05:27.000000000 -0400
+++ linux-2.6.30.hotfoot/arch/powerpc/boot/Makefile	2009-07-07 12:55:18.000000000 -0400
@@ -39,6 +39,7 @@
 
 $(obj)/4xx.o: BOOTCFLAGS += -mcpu=405
 $(obj)/ebony.o: BOOTCFLAGS += -mcpu=405
+$(obj)/cuboot-hotfoot.o: BOOTCFLAGS += -mcpu=405
 $(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=405
 $(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=405
 $(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405
@@ -67,7 +68,7 @@
 		cpm-serial.c stdlib.c mpc52xx-psc.c planetcore.c uartlite.c \
 		fsl-soc.c mpc8xx.c pq2.c
 src-plat := of.c cuboot-52xx.c cuboot-824x.c cuboot-83xx.c cuboot-85xx.c holly.c \
-		cuboot-ebony.c treeboot-ebony.c prpmc2800.c \
+		cuboot-ebony.c cuboot-hotfoot.c treeboot-ebony.c prpmc2800.c \
 		ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c \
 		cuboot-pq2.c cuboot-sequoia.c treeboot-walnut.c \
 		cuboot-bamboo.c cuboot-mpc7448hpc2.c cuboot-taishan.c \
@@ -190,6 +191,7 @@
 
 # Board ports in arch/powerpc/platform/40x/Kconfig
 image-$(CONFIG_EP405)			+= dtbImage.ep405
+image-$(CONFIG_HOTFOOT)			+= cuImage.hotfoot
 image-$(CONFIG_WALNUT)			+= treeImage.walnut
 image-$(CONFIG_ACADIA)			+= cuImage.acadia
 
diff -Naur linux-2.6.30/arch/powerpc/boot/cuboot-hotfoot.c linux-2.6.30.hotfoot/arch/powerpc/boot/cuboot-hotfoot.c
--- linux-2.6.30/arch/powerpc/boot/cuboot-hotfoot.c	1969-12-31 19:00:00.000000000 -0500
+++ linux-2.6.30.hotfoot/arch/powerpc/boot/cuboot-hotfoot.c	2009-07-07 12:55:23.000000000 -0400
@@ -0,0 +1,142 @@
+/*
+ * Old U-boot compatibility for Esteem 195E Hotfoot CPU Board
+ *
+ * Author: Solomon Peachy <solomon@linux-wlan.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+
+#include "ops.h"
+#include "stdio.h"
+#include "reg.h"
+#include "dcr.h"
+#include "4xx.h"
+#include "cuboot.h"
+
+#define TARGET_4xx
+#define TARGET_HOTFOOT
+
+#include "ppcboot.h"
+
+static bd_t bd;
+
+#define NUM_REGS 3
+
+static void hotfoot_fixups(void)
+{
+	u32 uart = mfdcr(DCRN_CPC0_UCR) & 0x7f;
+
+	dt_fixup_memory(bd.bi_memstart, bd.bi_memsize); 
+
+	dt_fixup_cpu_clocks(bd.bi_procfreq, bd.bi_procfreq, 0);
+	dt_fixup_clock("/plb", bd.bi_plb_busfreq);
+	dt_fixup_clock("/plb/opb", bd.bi_opbfreq);
+	dt_fixup_clock("/plb/ebc", bd.bi_pci_busfreq);
+	dt_fixup_clock("/plb/opb/serial@ef600300", bd.bi_procfreq / uart); 
+	dt_fixup_clock("/plb/opb/serial@ef600400", bd.bi_procfreq / uart); 
+	
+	dt_fixup_mac_address_by_alias("ethernet0", bd.bi_enetaddr);
+	dt_fixup_mac_address_by_alias("ethernet1", bd.bi_enet1addr);
+
+	/* Is this a single eth/serial board? */
+	if ((bd.bi_enet1addr[0] == 0) && 
+	    (bd.bi_enet1addr[1] == 0) &&
+	    (bd.bi_enet1addr[2] == 0) &&
+	    (bd.bi_enet1addr[3] == 0) &&
+	    (bd.bi_enet1addr[4] == 0) &&
+	    (bd.bi_enet1addr[5] == 0)) {
+		void *devp;
+
+		printf("Trimming devtree for single eth board\n");
+
+		devp = finddevice("/plb/opb/serial@ef600300");
+		if (!devp)
+			fatal("Can't find node for /plb/opb/serial@ef600300");
+		del_node(devp);
+
+		devp = finddevice("/plb/opb/ethernet@ef600900");
+		if (!devp)
+			fatal("Can't find node for /plb/opb/ethernet@ef600900");
+		del_node(devp);
+	}
+
+	ibm4xx_quiesce_eth((u32 *)0xef600800, (u32 *)0xef600900);
+
+	/* Fix up flash size in fdt for 4M boards. */
+	if (bd.bi_flashsize < 0x800000) {
+		u32 regs[NUM_REGS];
+		void *devp = finddevice("/plb/ebc/nor_flash@0");
+		if (!devp)
+			fatal("Can't find FDT node for nor_flash!??");
+
+		printf("Fixing devtree for 4M Flash\n");
+		
+		/* First fix up the base addresse */
+		getprop(devp, "reg", regs, sizeof(regs));
+		regs[0] = 0;
+		regs[1] = 0xffc00000;
+		regs[2] = 0x00400000;
+		setprop(devp, "reg", regs, sizeof(regs));
+		
+		/* Then the offsets */
+		devp = finddevice("/plb/ebc/nor_flash@0/partition@0");
+		if (!devp)
+			fatal("Can't find FDT node for partition@0");
+		getprop(devp, "reg", regs, 2*sizeof(u32));
+		regs[0] -= 0x400000;
+		setprop(devp, "reg", regs,  2*sizeof(u32));
+
+		devp = finddevice("/plb/ebc/nor_flash@0/partition@1");
+		if (!devp)
+			fatal("Can't find FDT node for partition@1");
+		getprop(devp, "reg", regs, 2*sizeof(u32));
+		regs[0] -= 0x400000;
+		setprop(devp, "reg", regs,  2*sizeof(u32));
+
+		devp = finddevice("/plb/ebc/nor_flash@0/partition@2");
+		if (!devp)
+			fatal("Can't find FDT node for partition@2");
+		getprop(devp, "reg", regs, 2*sizeof(u32));
+		regs[0] -= 0x400000;
+		setprop(devp, "reg", regs,  2*sizeof(u32));
+
+		devp = finddevice("/plb/ebc/nor_flash@0/partition@3");
+		if (!devp)
+			fatal("Can't find FDT node for partition@3");
+		getprop(devp, "reg", regs, 2*sizeof(u32));
+		regs[0] -= 0x400000;
+		setprop(devp, "reg", regs,  2*sizeof(u32));
+
+		devp = finddevice("/plb/ebc/nor_flash@0/partition@4");
+		if (!devp)
+			fatal("Can't find FDT node for partition@4");
+		getprop(devp, "reg", regs, 2*sizeof(u32));
+		regs[0] -= 0x400000;
+		setprop(devp, "reg", regs,  2*sizeof(u32));
+
+		devp = finddevice("/plb/ebc/nor_flash@0/partition@6");
+		if (!devp)
+			fatal("Can't find FDT node for partition@6");
+		getprop(devp, "reg", regs, 2*sizeof(u32));
+		regs[0] -= 0x400000;
+		setprop(devp, "reg", regs,  2*sizeof(u32));
+
+		/* Delete the FeatFS node */
+		devp = finddevice("/plb/ebc/nor_flash@0/partition@5");
+		if (!devp)
+			fatal("Can't find FDT node for partition@5");
+		del_node(devp);
+	}
+}
+
+void platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
+		   unsigned long r6, unsigned long r7)
+{
+	CUBOOT_INIT();
+	platform_ops.fixups = hotfoot_fixups;
+        platform_ops.exit = ibm40x_dbcr_reset;
+	fdt_init(_dtb_start);
+	serial_console_init();
+}
diff -Naur linux-2.6.30/arch/powerpc/boot/dts/hotfoot.dts linux-2.6.30.hotfoot/arch/powerpc/boot/dts/hotfoot.dts
--- linux-2.6.30/arch/powerpc/boot/dts/hotfoot.dts	1969-12-31 19:00:00.000000000 -0500
+++ linux-2.6.30.hotfoot/arch/powerpc/boot/dts/hotfoot.dts	2009-07-07 12:55:23.000000000 -0400
@@ -0,0 +1,299 @@
+/*
+ * Device Tree Source for ESTeem 195E Hotfoot
+ *
+ * Copyright 2009 AbsoluteValue Systems <solomon@linux-wlan.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without
+ * any warranty of any kind, whether express or implied.
+ */
+
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+	model = "est,hotfoot";
+	compatible = "est,hotfoot";
+	dcr-parent = <&{/cpus/cpu@0}>;
+
+	aliases {
+		ethernet0 = &EMAC0;
+		ethernet1 = &EMAC1;
+		serial0 = &UART0;
+		serial1 = &UART1;
+	};
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu@0 {
+			device_type = "cpu";
+			model = "PowerPC,405EP";
+			reg = <0x00000000>;
+			clock-frequency = <0>; /* Filled in by zImage */
+			timebase-frequency = <0>; /* Filled in by zImage */
+			i-cache-line-size = <0x20>;
+			d-cache-line-size = <0x20>;
+			i-cache-size = <0x4000>;
+			d-cache-size = <0x4000>;
+			dcr-controller;
+			dcr-access-method = "native";
+		};
+	};
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x00000000>; /* Filled in by zImage */
+	};
+
+	UIC0: interrupt-controller {
+		compatible = "ibm,uic";
+		interrupt-controller;
+		cell-index = <0>;
+		dcr-reg = <0x0c0 0x009>;
+		#address-cells = <0>;
+		#size-cells = <0>;
+		#interrupt-cells = <2>;
+	};
+
+	plb {
+		compatible = "ibm,plb3";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+		clock-frequency = <0>; /* Filled in by zImage */
+
+		SDRAM0: memory-controller {
+			compatible = "ibm,sdram-405ep";
+			dcr-reg = <0x010 0x002>;
+		};
+
+		MAL: mcmal {
+			compatible = "ibm,mcmal-405ep", "ibm,mcmal";
+			dcr-reg = <0x180 0x062>;
+			num-tx-chans = <4>;
+			num-rx-chans = <2>;
+			interrupt-parent = <&UIC0>;
+			interrupts = <
+				0xb 0x4 /* TXEOB */
+				0xc 0x4 /* RXEOB */
+				0xa 0x4 /* SERR */
+				0xd 0x4 /* TXDE */
+				0xe 0x4 /* RXDE */>;
+		};
+
+		POB0: opb {
+			compatible = "ibm,opb-405ep", "ibm,opb";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0xef600000 0xef600000 0x00a00000>;
+			dcr-reg = <0x0a0 0x005>;
+			clock-frequency = <0>; /* Filled in by zImage */
+
+			/* Hotfoot has UART0/UART1 swapped */
+
+			UART0: serial@ef600400 {
+				device_type = "serial";
+				compatible = "ns16550";
+				reg = <0xef600400 0x00000008>;
+				virtual-reg = <0xef600400>;
+				clock-frequency = <0>; /* Filled in by zImage */
+				current-speed = <0x9600>;
+				interrupt-parent = <&UIC0>;
+				interrupts = <0x1 0x4>;
+			};
+
+			UART1: serial@ef600300 {
+				device_type = "serial";
+				compatible = "ns16550";
+				reg = <0xef600300 0x00000008>;
+				virtual-reg = <0xef600300>;
+				clock-frequency = <0>; /* Filled in by zImage */
+				current-speed = <0x9600>;
+				interrupt-parent = <&UIC0>;
+				interrupts = <0x0 0x4>;
+			};
+
+
+			IIC: i2c@ef600500 {
+				compatible = "ibm,iic-405ep", "ibm,iic";
+				reg = <0xef600500 0x00000011>;
+				interrupt-parent = <&UIC0>;
+				interrupts = <0x2 0x4>;
+
+				rtc@68 {
+				      /* Actually a DS1339 */
+				      compatible = "dallas,ds1307"; 
+				      reg = <0x68>;
+				};
+
+				temp@4a { 
+				      /* Not present on all boards */
+				      compatible = "national,lm75";
+				      reg = <0x4a>;
+				};				
+			};
+
+			GPIO: gpio@ef600700 {
+			        #gpio-cells = <2>;
+				compatible = "ibm,ppc4xx-gpio";
+				reg = <0xef600700 0x00000020>;
+				gpio-controller;
+			};
+
+			gpio-leds {
+			     compatible = "gpio-leds";
+			     status {
+			     	    label = "Status";
+			     	    gpios = <&GPIO 1 0>;
+				    /* linux,default=trigger = ".."; */
+			     };
+			     radiorx {
+			     	    label = "Rx";
+			     	    gpios = <&GPIO 0xe 0>;
+				    /* linux,default=trigger = ".."; */
+			     };
+			};
+
+
+			EMAC0: ethernet@ef600800 {
+				linux,network-index = <0x0>;
+				device_type = "network";
+				compatible = "ibm,emac-405ep", "ibm,emac";
+				interrupt-parent = <&UIC0>;
+				interrupts = <
+					0xf 0x4 /* Ethernet */
+					0x9 0x4 /* Ethernet Wake Up */>;
+				local-mac-address = [000000000000]; /* Filled in by zImage */
+				reg = <0xef600800 0x00000070>;
+				mal-device = <&MAL>;
+				mal-tx-channel = <0>;
+				mal-rx-channel = <0>;
+				cell-index = <0>;
+				max-frame-size = <0x5dc>;
+				rx-fifo-size = <0x1000>;
+				tx-fifo-size = <0x800>;
+				phy-mode = "mii";
+				phy-map = <0x00000000>;
+			};
+
+			EMAC1: ethernet@ef600900 {
+				linux,network-index = <0x1>;
+				device_type = "network";
+				compatible = "ibm,emac-405ep", "ibm,emac";
+				interrupt-parent = <&UIC0>;
+				interrupts = <
+					0x11 0x4 /* Ethernet */
+					0x9 0x4 /* Ethernet Wake Up */>;
+				local-mac-address = [000000000000]; /* Filled in by zImage */
+				reg = <0xef600900 0x00000070>;
+				mal-device = <&MAL>;
+				mal-tx-channel = <2>;
+				mal-rx-channel = <1>;
+				cell-index = <1>;
+				max-frame-size = <0x5dc>;
+				rx-fifo-size = <0x1000>;
+				tx-fifo-size = <0x800>;
+                                mdio-device = <&EMAC0>;
+				phy-mode = "mii";
+				phy-map = <0x0000001>;
+			};
+		};
+
+		EBC0: ebc {
+			compatible = "ibm,ebc-405ep", "ibm,ebc";
+			dcr-reg = <0x012 0x002>;
+			#address-cells = <2>;
+			#size-cells = <1>;
+
+			/* The ranges property is supplied by the bootwrapper
+			 * and is based on the firmware's configuration of the
+			 * EBC bridge
+			 */
+			clock-frequency = <0>; /* Filled in by zImage */
+
+                        nor_flash@0 {
+                                compatible = "cfi-flash";
+                                bank-width = <2>;
+                                reg = <0x0 0xff800000 0x00800000>;
+                                #address-cells = <1>;
+                                #size-cells = <1>;
+
+				/* This mapping is for the 8M flash
+				   4M flash has all ofssets -= 4M,
+				   and FeatFS partition is not present */
+				
+                                partition@0 {
+                                        label = "Bootloader";
+                                        reg = <0x7c0000 0x40000>;
+                                        /* read-only; */
+                                };
+                                partition@1 {
+                                        label = "Env_and_Config_Primary";
+                                        reg = <0x400000 0x10000>;
+                                };
+                                partition@2 {
+                                        label = "Kernel";
+                                        reg = <0x420000 0x100000>;
+                                };
+                                partition@3 {
+                                        label = "Filesystem";
+                                        reg = <0x520000 0x2a0000>;
+                                };
+                                partition@4 {
+                                        label = "Env_and_Config_Secondary";
+                                        reg = <0x410000 0x10000>;
+                                };
+                                partition@5 {
+                                        label = "FeatFS";
+                                        reg = <0x000000 0x400000>;
+                                };
+                                partition@6 {
+                                        label = "Bootloader_Env";
+                                        reg = <0x7d0000 0x10000>;
+                                };
+			};
+		};
+
+                PCI0: pci@ec000000 {
+                        device_type = "pci";
+                        #interrupt-cells = <1>;
+                        #size-cells = <2>;
+                        #address-cells = <3>;
+                        compatible = "ibm,plb405ep-pci", "ibm,plb-pci";
+                        primary;
+                        reg = <0xeec00000 0x00000008    /* Config space access */
+                               0xeed80000 0x00000004    /* IACK */
+                               0xeed80000 0x00000004    /* Special cycle */
+                               0xef480000 0x00000040>;  /* Internal registers */
+
+                        /* Outbound ranges, one memory and one IO,
+                         * later cannot be changed. Chip supports a second
+                         * IO range but we don't use it for now
+                         */
+                        ranges = <0x02000000 0x00000000 0x80000000 0x80000000 0x00000000 0x20000000
+                                  0x01000000 0x00000000 0x00000000 0xe8000000 0x00000000 0x00010000>;
+
+                        /* Inbound 2GB range starting at 0 */
+                        dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x80000000>;
+
+			interrupt-parent = <&UIC0>;
+                        interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
+                        interrupt-map = <
+                                /* IDSEL 3 -- slot1 (optional) 27/29 A/B IRQ2/4 */
+                                0x1800 0x0 0x0 0x1 &UIC0 0x1b 0x8
+                                0x1800 0x0 0x0 0x2 &UIC0 0x1d 0x8
+
+                                /* IDSEL 4 -- slot0, 26/28 A/B IRQ1/3 */
+                                0x2000 0x0 0x0 0x1 &UIC0 0x1a 0x8
+                                0x2000 0x0 0x0 0x2 &UIC0 0x1c 0x8
+                        >;
+                };
+	};
+
+	chosen {
+		linux,stdout-path = &UART0;
+	};
+};
diff -Naur linux-2.6.30/arch/powerpc/boot/ppcboot.h linux-2.6.30.hotfoot/arch/powerpc/boot/ppcboot.h
--- linux-2.6.30/arch/powerpc/boot/ppcboot.h	2009-06-09 23:05:27.000000000 -0400
+++ linux-2.6.30.hotfoot/arch/powerpc/boot/ppcboot.h	2009-07-07 12:55:18.000000000 -0400
@@ -52,6 +52,11 @@
 	unsigned long	bi_bootflags;	/* boot / reboot flag (for LynxOS) */
 	unsigned long	bi_ip_addr;	/* IP Address */
 	unsigned char	bi_enetaddr[6];	/* Ethernet address */
+#if defined(TARGET_HOTFOOT)
+	/* second onboard ethernet port */
+	unsigned char	bi_enet1addr[6];
+#define HAVE_ENET1ADDR
+#endif /* TARGET_HOOTFOOT */
 	unsigned short	bi_ethspeed;	/* Ethernet speed in Mbps */
 	unsigned long	bi_intfreq;	/* Internal Freq, in MHz */
 	unsigned long	bi_busfreq;	/* Bus Freq, in MHz */
@@ -74,6 +79,9 @@
 	unsigned int	bi_pci_busfreq;	/* PCI Bus speed, in Hz */
 	unsigned char	bi_pci_enetaddr[6];	/* PCI Ethernet MAC address */
 #endif
+#if defined(TARGET_HOTFOOT)
+	unsigned int     bi_pllouta_freq;       /* PLL OUTA speed, in Hz */
+#endif
 #if defined(TARGET_HYMOD)
 	hymod_conf_t	bi_hymod_conf;	/* hymod configuration information */
 #endif
@@ -94,6 +102,10 @@
 	unsigned char	bi_enet3addr[6];
 #define HAVE_ENET3ADDR
 #endif
+#if defined(TARGET_HOTFOOT)
+        int             bi_phynum[2];           /* Determines phy mapping */
+        int             bi_phymode[2];          /* Determines phy mode */
+#endif
 #if defined(TARGET_4xx)
 	unsigned int	bi_opbfreq;		/* OB clock in Hz */
 	int		bi_iic_fast[2];		/* Use fast i2c mode */
diff -Naur linux-2.6.30/arch/powerpc/platforms/40x/Kconfig linux-2.6.30.hotfoot/arch/powerpc/platforms/40x/Kconfig
--- linux-2.6.30/arch/powerpc/platforms/40x/Kconfig	2009-06-09 23:05:27.000000000 -0400
+++ linux-2.6.30.hotfoot/arch/powerpc/platforms/40x/Kconfig	2009-07-07 12:55:18.000000000 -0400
@@ -40,6 +40,16 @@
 	help
 	  This option enables support for the Nestal Maschinen HCU4 board.
 
+config HOTFOOT
+        bool "Hotfoot"
+	depends on 40x
+	default n
+	select 405EP
+	select PPC40x_SIMPLE
+	select PCI
+        help
+	 This option enables support for the ESTEEM 195E Hotfoot board.
+
 config KILAUEA
 	bool "Kilauea"
 	depends on 40x
diff -Naur linux-2.6.30/arch/powerpc/platforms/40x/ppc40x_simple.c linux-2.6.30.hotfoot/arch/powerpc/platforms/40x/ppc40x_simple.c
--- linux-2.6.30/arch/powerpc/platforms/40x/ppc40x_simple.c	2009-06-09 23:05:27.000000000 -0400
+++ linux-2.6.30.hotfoot/arch/powerpc/platforms/40x/ppc40x_simple.c	2009-07-07 12:55:18.000000000 -0400
@@ -51,7 +51,8 @@
  * board.c file for it rather than adding it to this list.
  */
 static char *board[] __initdata = {
-	"amcc,acadia"
+	"amcc,acadia",
+	"est,hotfoot"
 };
 
 static int __init ppc40x_probe(void)

^ permalink raw reply

* Re: [PATCH v3 RESEND] net: Rework mdio-ofgpio driver to use of_mdio infrastructure
From: David Miller @ 2009-07-23 17:56 UTC (permalink / raw)
  To: mware; +Cc: netdev, linuxppc-dev
In-Reply-To: <4A68477B.4090505@elphinstone.net>

From: Mark Ware <mware@elphinstone.net>
Date: Thu, 23 Jul 2009 21:20:27 +1000

> Changes to the fs_enet driver (aa73832c5a80d6c52c69b18af858d88fa595dd3c) cause kernel crashes when using the mdio-ofgpio driver.
>  
> This patch replicates similar changes made to the fs_enet mii-bitbang drivers.  It has been tested on a custom mpc8280 based board using an NFS mounted root.
>  
> Signed-off-by: Mark Ware <mware@elphinstone.net>
> Acked-by: Grant Likely <grant.likely@secretlab.ca>

Applied.

^ permalink raw reply

* [PATCH] powerpc: minor Makefile simplification through use of cc-ifversion
From: Frans Pop @ 2009-07-23 18:57 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: linux-kernel, linux-kbuild

Signed-off-by: Frans Pop <elendil@planet.nl>
---

Change was suggested by Sam Ravnborg; see http://lkml.org/lkml/2009/7/18/15.
Untested.

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index bc35f4e..952a396 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -77,7 +77,7 @@ CPP		= $(CC) -E $(KBUILD_CFLAGS)
 CHECKFLAGS	+= -m$(CONFIG_WORD_SIZE) -D__powerpc__ -D__powerpc$(CONFIG_WORD_SIZE)__
 
 ifeq ($(CONFIG_PPC64),y)
-GCC_BROKEN_VEC	:= $(shell if [ $(call cc-version) -lt 0400 ] ; then echo "y"; fi)
+GCC_BROKEN_VEC	:= $(call cc-ifversion, -lt, 0400, y)
 
 ifeq ($(CONFIG_POWER4_ONLY),y)
 ifeq ($(CONFIG_ALTIVEC),y)

^ permalink raw reply related

* Re: [LTP] msgctl10 fails on Powerpc Linux-2.6.29.6
From: srikanth krishnakar @ 2009-07-23 20:31 UTC (permalink / raw)
  To: Kumar Gala; +Cc: Linuxppc-dev, Ltp-list
In-Reply-To: <13B0CDE8-B974-4CFA-A4B9-8AC4374B4694@kernel.crashing.org>

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

On Thu, Jul 23, 2009 at 6:33 AM, Kumar Gala <galak@kernel.crashing.org>wrote:

>
> On Jul 22, 2009, at 11:32 AM, srikanth krishnakar wrote:
>
>
>>
>> On Wed, Jul 22, 2009 at 9:14 PM, Kumar Gala <galak@kernel.crashing.org>
>> wrote:
>>
>> On Jul 22, 2009, at 10:38 AM, srikanth krishnakar wrote:
>>
>>
>>
>> On Wed, Jul 22, 2009 at 8:52 PM, Kumar Gala <galak@kernel.crashing.org>
>> wrote:
>> I'm not seeing any BUG* in traps.c @ line 904.
>>
>>
>> On Jul 21, 2009, at 4:33 AM, srikanth krishnakar wrote:
>>
>> The LTP test case msgctl10.c fails on linux-2.6.29.6 for PowerPC
>> architecture (ppc440)
>>
>>
>> msgctl10    1  B------------[ cut here ]------------
>> kernel BUG at arch/powerpc/kernel/traps.c:904!
>> Oops: Exception in kernel mode, sig: 5 [#9]
>>
>> I'm not seeing any BUG* in traps.c @ line 904.  Do you have some other
>> patches on top of 2.6.29.6?
>>
>> - k
>>
>>
>> I have LTTng patches on top of linux-2.6.29.6.
>>
>> Does it modify traps.c?  Can you see what the code around line 904 looks
>> like and post that.
>>
>> - k
>>  896
>>  897 #if defined(CONFIG_XILINX_VIRTEX_5_FXT) && defined(CONFIG_PPC_FPU)
>>  898         if (reason & REASON_ILLEGAL) {
>>  899                 if (excep_state < 1) {
>>  900                         excep_state++;
>>  901                         return;
>>  902                 }
>>  903                 /* should never get here */
>>  904                 BUG();
>>  905         }
>>  906 #endif
>>  907
>>  908         /* Try to emulate it if we should. */
>>
>>
> Are you sure this is coming from the LTTng patches?  Which actual patch
> makes this change?
>
> - k
>
Thanks kumar,

I've got the patch out which fixes the issues. But now.. seems there is some
generic issue in PPC440 targets, I am observing that
*remap_file_pages01* and *remap_file_pages02  *test cases from LTP are
failing since *Linux-2.6.24* kernel to *Linux-2.6.30*. If you can give some
pointers that would be greatly appreciated ! Or if you have results for this
on any PPC44x would be helpful.

Arch : PowerPC
Target : Xilinx PowerPC440 virtex5

I've tried to test the cause for this but found that kernel throws error
message of "segmentation fault".

Thanks in Advance.

-Srikant



-- 
"The Good You Do, The Best You GET"

Regards
Srikanth Krishnakar
**********************

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

^ permalink raw reply

* SATA on PowerPC460EX with 2.6.27 kernel
From: Thomas Bachman @ 2009-07-23 20:17 UTC (permalink / raw)
  To: linuxppc-dev

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

We're trying to use the SATA interface on our PowerPC460EX. 
We've applied the following patch:
 
http://markmail.org/message/p5kdgzyneuxzdvjh
 
Our kernel is based on AMCC's "Arches" eval board distro kernel
(2.6.27-rc5), 
and with this patch, we're able to get the SATA interface up and running,
insomuch as 
it can discover our hard disk. Unfortunately, we're not able to mount,
format, or do any 
other functions with the disk. We see the following in our logs:
 
sata-dwc sata-dwc.0: sata_dwc_error_intr SCR_ERROR=0x04050002
intpr=0x00000008 status=0x000000
80 dma_intp=0 pending=-1070221560 issued=4 dma_err_status=0x00000000
ata1: exception Emask 0x30 SAct 0x0 SErr 0x4050002 action 0xe frozen
ata1: SError: { RecovComm PHYRdyChg CommWake DevExch }
scsi 0:0:0:0: Direct-Access     ATA      TOSHIBA MK1216GS RS01 PQ: 0 ANSI: 5
sd 0:0:0:0: [sda] 234441648 512-byte hardware sectors (120034 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support
DPO or FUA
sd 0:0:0:0: [sda] 234441648 512-byte hardware sectors (120034 MB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support
DPO or FUA
ata1.00: exception Emask 0x0 SAct 0x0 SErr 0x0 action 0x6 frozen
ata1.00: cmd c8/00:08:00:00:00/00:00:00:00:00/e0 tag 0 dma 4096 in
         res 40/00:00:00:00:00/00:00:00:00:00/00 Emask 0x4 (timeout)
ata1.00: status: { DRDY }
ata1: link is slow to respond, please be patient (ready=0)
ata1: prereset failed (errno=-16)
ata1: reset failed, giving up
ata1.00: disabled
end_request: I/O error, dev sda, sector 0
Buffer I/O error on device sda, logical block 0
end_request: I/O error, dev sda, sector 0
Buffer I/O error on device sda, logical block 0
 unable to read partition table
sd 0:0:0:0: [sda] Attached SCSI disk
sd 0:0:0:0: Attached scsi generic sg0 type 0
 
 
The disk is a 120GB Toshiba hard drive, 1.5Gbps SATA.
 
I found that someone had a similar problem when going to a newer kernel:
 
http://lists-archives.org/linux-kernel/19814689-about-synopsys-designware-co
res-dwc-sata-host-driver.html
 
Has this been fixed? We weren't sure if this patch ever happened, and if so,
where we could get it. 
 
 
-Thomas Bachman
-Annapolis Micro Systems, Inc.

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

^ permalink raw reply

* FHCI: USB: The use of qe general purpose timer and usb device descriptor read/64, error -110
From: Richard Retanubun @ 2009-07-23 20:56 UTC (permalink / raw)
  To: Linuxppc-dev-mList

Hi,

I am working on Linux-2.6.29.5 on an MPC8360E, trying to make the FHCI USB working.

the output of clocks in u-boot is as follows:

 > Output of u-boot clocks command <
Clock configuration:
   Core:                533.333 MHz
   Coherent System Bus: 266.667 MHz
   QE:                  400  MHz
   BRG:                 200  MHz
   Local Bus Controller:266.667 MHz
   Local Bus:           66.667 MHz
   DDR:                 266.667 MHz
   DDR Secondary:       266.667 MHz
   SEC:                 88.889 MHz
   I2C1:                266.667 MHz
   I2C2:                266.667 MHz

rcm1:~# cat /proc/cpuinfo
processor       : 0
cpu             : e300c1
clock           : 533.333328MHz
revision        : 3.1 (pvr 8083 0031)
bogomips        : 133.12
timebase        : 66666666
platform        : MPC836x
model           : RC8360
Memory          : 512 MB


In the dts, because our cpu_clk and csb_clk is the same as mpc8360_rdk eval platfrom (533.333 MHz and 266.666 MHZ)
I modeled the gtm frame limit timer the same as mpc836x_rdk.dts, namely as follows:

timer@440 {
	compatible = "fsl,mpc8360-qe-gtm",
		     "fsl,qe-gtm", "fsl,gtm";
	reg = <0x440 0x40>;
	interrupts = <12 13 14 15>;
	interrupt-parent = <&qeic>;
	clock-frequency = <166666666>; /* RDK at 533.333 MHz */
	/* clock-frequency = <132000000>; [DISABLED] MDS at 528 MHz */
};

In the fhci-hdc.c code, the timer is used as the "Frame limit timer"

I am wondering how is the clock-frequency = <166666666> derived and what its function is for the fhci-usb driver?

Also, using the timer settings as shown, so far I can only got one USB flash mass-storage device to come up successfully.

The rest of the device will enumerate, but fails like this:

usb 1-1: new full speed USB device using fsl,usb-fhci and address 2
usb 1-1: New USB device found, idVendor=0204, idProduct=6025
usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1: Product: Flash Disk
usb 1-1: Manufacturer: CBM
usb 1-1: SerialNumber: 2519130247661913
usb 1-1: configuration #1 chosen from 1 choice
scsi1 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 2
usb-storage: waiting for device to settle before scanning
usb 1-1: reset full speed USB device using fsl,usb-fhci and address 2
usb 1-1: device descriptor read/64, error -110
usb 1-1: device descriptor read/64, error -110
usb 1-1: USB disconnect, address 2
usb-storage: device scan complete
usb 1-1: new full speed USB device using fsl,usb-fhci and address 3
usb 1-1: device descriptor read/64, error -110
usb 1-1: device descriptor read/64, error -110
hub 1-0:1.0: unable to enumerate USB device on port 1
usb 1-1: new full speed USB device using fsl,usb-fhci and address 5
usb 1-1: device descriptor read/64, error -110
usb 1-1: device descriptor read/64, error -110


 From web-search, the resolution for the usb 1-1: device descriptor read/64, error -110 is usually to modprobe -r ehci-hdc,
however I never enabled ehci driver because the fhci is the only one that works with MPC8360.

If it is indeed a timeout from getting the device information from the flash chip on the USB mass-storage, how can I extend this
timeout to allow for more time?


This is the relevant dmesg output on usb:
=========================================
fsl,usb-fhci e01006c0.usb: assuming board doesn't have speed gpio
fsl,usb-fhci e01006c0.usb: assuming board doesn't have power gpio
fsl,usb-fhci e01006c0.usb: at 0xe10386c0, irq 25
fsl,usb-fhci e01006c0.usb: FHCI HOST Controller
fsl,usb-fhci e01006c0.usb: new USB bus registered, assigned bus number 1
fsl,usb-fhci e01006c0.usb: irq 25, io mem 0x00000000
usb usb1: New USB device found, idVendor=1d6b, idProduct=0001
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: FHCI HOST Controller
usb usb1: Manufacturer: Linux 2.6.29.5-dirty fsl,usb-fhci
usb usb1: SerialNumber: e01006c0.usb
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.

...

usb 1-1: new full speed USB device using fsl,usb-fhci and address 2
usb 1-1: New USB device found, idVendor=0204, idProduct=6025
usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1: Product: Flash Disk
usb 1-1: Manufacturer: CBM
usb 1-1: SerialNumber: 2519130247661913
usb 1-1: configuration #1 chosen from 1 choice
scsi1 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 2
usb-storage: waiting for device to settle before scanning
usb 1-1: reset full speed USB device using fsl,usb-fhci and address 2
usb 1-1: device descriptor read/64, error -110
usb 1-1: device descriptor read/64, error -110
usb 1-1: USB disconnect, address 2
usb-storage: device scan complete
usb 1-1: new full speed USB device using fsl,usb-fhci and address 3
usb 1-1: device descriptor read/64, error -110
usb 1-1: device descriptor read/64, error -110
hub 1-0:1.0: unable to enumerate USB device on port 1
usb 1-1: new full speed USB device using fsl,usb-fhci and address 5
usb 1-1: device descriptor read/64, error -110
usb 1-1: device descriptor read/64, error -110


Thanks for everyone's time

- Richard Retanubun

^ 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