LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3] IB/umem: Add hugetlb flag to struct ib_umem
From: Joachim Fenkes @ 2007-09-13 16:15 UTC (permalink / raw)
  To: LinuxPPC-Dev, LKML, OF-General, Roland Dreier, OF-EWG
  Cc: Stefan Roscher, Christoph Raisch
In-Reply-To: <200709131814.13937.fenkes@de.ibm.com>

During ib_umem_get(), determine whether all pages from the memory region are
hugetlb pages and report this in the "hugetlb" field. Low-level driver can
use this information if they need it.

Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com>
---
 drivers/infiniband/core/umem.c |   20 +++++++++++++++++++-
 include/rdma/ib_umem.h         |    1 +
 2 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c
index 664d2fa..2f54e29 100644
--- a/drivers/infiniband/core/umem.c
+++ b/drivers/infiniband/core/umem.c
@@ -37,6 +37,7 @@
 #include <linux/mm.h>
 #include <linux/dma-mapping.h>
 #include <linux/sched.h>
+#include <linux/hugetlb.h>
 
 #include "uverbs.h"
 
@@ -75,6 +76,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
 {
 	struct ib_umem *umem;
 	struct page **page_list;
+	struct vm_area_struct **vma_list;
 	struct ib_umem_chunk *chunk;
 	unsigned long locked;
 	unsigned long lock_limit;
@@ -104,6 +106,9 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
 	 */
 	umem->writable  = !!(access & ~IB_ACCESS_REMOTE_READ);
 
+	/* We assume the memory is from hugetlb until proved otherwise */
+	umem->hugetlb   = 1;
+
 	INIT_LIST_HEAD(&umem->chunk_list);
 
 	page_list = (struct page **) __get_free_page(GFP_KERNEL);
@@ -112,6 +117,14 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
 		return ERR_PTR(-ENOMEM);
 	}
 
+	/*
+	 * if we can't alloc the vma_list, it's not so bad;
+	 * just assume the memory is not hugetlb memory
+	 */
+	vma_list = (struct vm_area_struct **) __get_free_page(GFP_KERNEL);
+	if (!vma_list)
+		umem->hugetlb = 0;
+
 	npages = PAGE_ALIGN(size + umem->offset) >> PAGE_SHIFT;
 
 	down_write(&current->mm->mmap_sem);
@@ -131,7 +144,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
 		ret = get_user_pages(current, current->mm, cur_base,
 				     min_t(int, npages,
 					   PAGE_SIZE / sizeof (struct page *)),
-				     1, !umem->writable, page_list, NULL);
+				     1, !umem->writable, page_list, vma_list);
 
 		if (ret < 0)
 			goto out;
@@ -152,6 +165,9 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr,
 
 			chunk->nents = min_t(int, ret, IB_UMEM_MAX_PAGE_CHUNK);
 			for (i = 0; i < chunk->nents; ++i) {
+				if (vma_list &&
+				    !is_vm_hugetlb_page(vma_list[i + off]))
+					umem->hugetlb = 0;
 				chunk->page_list[i].page   = page_list[i + off];
 				chunk->page_list[i].offset = 0;
 				chunk->page_list[i].length = PAGE_SIZE;
@@ -186,6 +202,8 @@ out:
 		current->mm->locked_vm = locked;
 
 	up_write(&current->mm->mmap_sem);
+	if (vma_list)
+		free_page((unsigned long) vma_list);
 	free_page((unsigned long) page_list);
 
 	return ret < 0 ? ERR_PTR(ret) : umem;
diff --git a/include/rdma/ib_umem.h b/include/rdma/ib_umem.h
index c533d6c..2229842 100644
--- a/include/rdma/ib_umem.h
+++ b/include/rdma/ib_umem.h
@@ -45,6 +45,7 @@ struct ib_umem {
 	int			offset;
 	int			page_size;
 	int                     writable;
+	int                     hugetlb;
 	struct list_head	chunk_list;
 	struct work_struct	work;
 	struct mm_struct       *mm;
-- 
1.5.2

^ permalink raw reply related

* [PATCH 3/3] IB/ehca: Make sure user pages are from hugetlb before using MR large pages
From: Joachim Fenkes @ 2007-09-13 16:16 UTC (permalink / raw)
  To: LinuxPPC-Dev, LKML, OF-General, Roland Dreier, OF-EWG
  Cc: Stefan Roscher, Christoph Raisch
In-Reply-To: <200709131814.13937.fenkes@de.ibm.com>

...because, on virtualized hardware like System p, we can't be sure that the
physical pages behind them are contiguous.

Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com>
---
 drivers/infiniband/hw/ehca/ehca_mrmw.c |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/infiniband/hw/ehca/ehca_mrmw.c b/drivers/infiniband/hw/ehca/ehca_mrmw.c
index 4c8f3b3..4ba8b7c 100644
--- a/drivers/infiniband/hw/ehca/ehca_mrmw.c
+++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c
@@ -51,6 +51,7 @@
 
 #define NUM_CHUNKS(length, chunk_size) \
 	(((length) + (chunk_size - 1)) / (chunk_size))
+
 /* max number of rpages (per hcall register_rpages) */
 #define MAX_RPAGES 512
 
@@ -64,6 +65,11 @@ enum ehca_mr_pgsize {
 	EHCA_MR_PGSIZE16M = 0x1000000L
 };
 
+#define EHCA_MR_PGSHIFT4K  12
+#define EHCA_MR_PGSHIFT64K 16
+#define EHCA_MR_PGSHIFT1M  20
+#define EHCA_MR_PGSHIFT16M 24
+
 static u32 ehca_encode_hwpage_size(u32 pgsize)
 {
 	u32 idx = 0;
@@ -347,17 +353,16 @@ struct ib_mr *ehca_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
 	/* select proper hw_pgsize */
 	if (ehca_mr_largepage &&
 	    (shca->hca_cap_mr_pgsize & HCA_CAP_MR_PGSIZE_16M)) {
-		if (length <= EHCA_MR_PGSIZE4K
-		    && PAGE_SIZE == EHCA_MR_PGSIZE4K)
-			hwpage_size = EHCA_MR_PGSIZE4K;
-		else if (length <= EHCA_MR_PGSIZE64K)
-			hwpage_size = EHCA_MR_PGSIZE64K;
-		else if (length <= EHCA_MR_PGSIZE1M)
-			hwpage_size = EHCA_MR_PGSIZE1M;
-		else
-			hwpage_size = EHCA_MR_PGSIZE16M;
+		int page_shift = PAGE_SHIFT;
+		if (e_mr->umem->hugetlb) {
+			/* determine page_shift, clamp between 4K and 16M */
+			page_shift = (fls64(length - 1) + 3) & ~3;
+			page_shift = min(max(page_shift, EHCA_MR_PGSHIFT4K),
+					 EHCA_MR_PGSHIFT16M);
+		}
+		hwpage_size = 1UL << page_shift;
 	} else
-		hwpage_size = EHCA_MR_PGSIZE4K;
+		hwpage_size = EHCA_MR_PGSIZE4K; /* ehca1 only supports 4k */
 	ehca_dbg(pd->device, "hwpage_size=%lx", hwpage_size);
 
 reg_user_mr_fallback:
-- 
1.5.2

^ permalink raw reply related

* Re: [PATCH 5/5] Add DMA engine driver for Freescale MPC85xxprocessors.
From: Dan Williams @ 2007-09-13 16:25 UTC (permalink / raw)
  To: Zhang Wei-r63237; +Cc: linuxppc-dev, shannon.nelson, paulus, linux-kernel
In-Reply-To: <46B96294322F7D458F9648B60E15112C85D8A5@zch01exm26.fsl.freescale.net>

On 9/13/07, Zhang Wei-r63237 <Wei.Zhang@freescale.com> wrote:
> Hi,
>
> > > +static void fsl_dma_set_src(dma_addr_t addr,
> > > +                           struct dma_async_tx_descriptor
> > *tx, int index)
> > > +{
> >
> > What is index supposed to mean?  It's not used, or documented
> > anywhere than
> > I can see.
>
> I've also got more document here. Hi, Dan, could you give me some
> explanation about this API? :)
>
The index field gets used for multi-source (or multi-dest) operations.
 XOR, for example, is a multi-source operation.  I am preparing a
documentation patch.

[..]

--
Dan

^ permalink raw reply

* Re: Define termios_1 functions for powerpc, s390, avr32 and frv
From: Alan Cox @ 2007-09-13 16:31 UTC (permalink / raw)
  To: Paul Mackerras
  Cc: Michael Neuling, hskinnemoen, heiko.carstens, linux-kernel,
	linuxppc-dev, Alan Cox, akpm, Linus Torvalds, davem
In-Reply-To: <18152.719.316280.579601@cargo.ozlabs.ibm.com>

On Thu, Sep 13, 2007 at 01:16:31AM +1000, Paul Mackerras wrote:
> asm-generic/termios.h).
> 
> Signed-off-by: Paul Mackerras <paulus@samba.org>

Acked-by: Alan Cox <alan@redhat.com>

^ permalink raw reply

* Re: [PATCH] [POWERPC] 85xx: Add basic Uniprocessor MPC8572 DS port
From: Segher Boessenkool @ 2007-09-13 16:53 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev
In-Reply-To: <A78D5AE1-8578-4971-800E-7209258365F1@kernel.crashing.org>

>> What is a "front side cache"?  What exactly does it cache?  If it's
>> a cache for one CPU only, that fact should be shown in the device
>> tree somehow.
>
> Its in front of the memory controllers.  Its not specific to a given 
> CPU.

Ah, I see.  That relationship is implicit in the device tree already,
both this cache controller and that memory controller are child nodes
of the same soc node, so your device tree is fine.

Just for my own understanding, is this a coherent cache?  (I'm too
lazy to read the manual ;-) )


Segher

^ permalink raw reply

* Re: [PATCH] [POWERPC] DTS cleanup
From: Segher Boessenkool @ 2007-09-13 16:56 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev
In-Reply-To: <8FFFBF2E-8255-40FB-836D-AB5B19222DD9@kernel.crashing.org>

>>> * built-in for non-standard buses (ISA, PCI)
>>
>> "built-in" is some weird CHRP property, so yes we don't need it
>> or want it.
>
> Do you suggest we get ride of it from ISA nodes as well?

Yes.  You aren't CHRP so you don't have to follow the CHRP binding.
Of course it is good to copy from that binding where it makes sense,
but how is "built-in" useful to you?

>>> * Fixed ranges on lite5200*
>>
>> This has a problem still:
>>
>>>  		model = "fsl,mpc5200";
>>>  		compatible = "mpc5200";
>>>  		revision = "";			// from bootloader
>>> -		#interrupt-cells = <3>;
>>>  		device_type = "soc";
>>> -		ranges = <0 f0000000 f0010000>;
>>> -		reg = <f0000000 00010000>;
>>> +		ranges = <0 f0000000 0000c000>;
>>> +		reg = <f0000000 0000c000>;
>>
>> That makes "reg" and "ranges" identify an identical address range,
>> which means no subnode can claim any address in that range, so the
>> "ranges" property should go.  Alternatively, the "reg" might be
>> claiming too big a space.
>>
>> Which is it?
>
> Yeah, I think it should be 0x100 for the 'soc' regs on 52xx so I'll 
> set regs to that.

Okido.

Did I say "nice cleanups, thank you!" already?  :-)


Segher

^ permalink raw reply

* Re: [PATCH v3] [POWERPC] 85xx: Add basic Uniprocessor MPC8572 DS port
From: Segher Boessenkool @ 2007-09-13 17:06 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev
In-Reply-To: <39A1A44F-CD73-4CC1-89DE-608A1041AAF7@kernel.crashing.org>

>>> +		PowerPC,8572@0 {
>>
>> Maybe it would be good to use "PowerPC,e500" instead -- it would
>> make it easier to probe for the actual CPU type, that way.  Not
>> that Linux uses the name/compatible here at all ;-)
>
> I thought about this, not sure what the best solution is.

Since the CPU cores on all these SoCs are identical (well, there
might be a few revisions, or different cache sizes or such -- minor
differences that can be probed for separately), it probably is a
good idea to name them in the tree instead of having each client
have its own table.

Or is there anything about the CPU that can be derived from "8572"
but not from "e500"?

>>> +	soc8572@ffe00000 {
>>
>> You should put an interrupt-parent in here, so you can get rid of
>> it in all the children.
>
> Are interrupt-parent's inherited by child nodes?

A node without "interrupt-parent" uses the regular tree parent for
walking the interrupt "tree".

>> And then there's the pci_bridge thing we're discussing on IRC, of
>> course -- basically, get rid of the pci_bridge pseudo-node, and
>> move the interrupt-map for the south-bridge devices into the
>> south-bridge node.
>
> Leaving the interrupt-map in the PHB because that works and moving it 
> down has issues.

Okay, fair enough.  Are you looking at resolving those kernel issues?


Segher

^ permalink raw reply

* Re: [PATCH 5/5] Add DMA engine driver for Freescale MPC85xx processors.
From: Dan Williams @ 2007-09-13 17:17 UTC (permalink / raw)
  To: Zhang Wei-r63237
  Cc: shannon.nelson, linux-kernel, linuxppc-dev, paulus, timur
In-Reply-To: <46B96294322F7D458F9648B60E15112C85D620@zch01exm26.fsl.freescale.net>

> Hi, Dan,
>
> Does I have followed your new API? :-)
>
[..]
> > > +static struct dma_chan
> > *of_find_dma_chan_by_phandle(phandle phandle)
> > > +{
> > > +       struct device_node *np;
> > > +       struct dma_chan *chan;
> > > +       struct fsl_dma_device *fdev;
> > > +
> > > +       np = of_find_node_by_phandle(phandle);
> > > +       if (!np || !of_device_is_compatible(np->parent, "fsl,dma"))
> > > +               return NULL;
> > > +
> > > +       fdev =
> > dev_get_drvdata(&of_find_device_by_node(np->parent)->dev);
> > > +
> > > +       list_for_each_entry(chan, &fdev->common.channels,
> > device_node)
> > > +               if
> > (to_of_device(to_fsl_chan(chan)->chan_dev)->node == np)
> > > +                       return chan;
> > > +       return NULL;
> > > +}
> > > +EXPORT_SYMBOL(of_find_dma_chan_by_phandle);
> >
> > This routine implies that there is a piece of code somewhere that
> > wants to select which channels it can use.  A similar effect can be
> > achieved by registering a dma_client with the dmaengine interface
> > ('dma_async_client_register').  Then when the client code makes a call
> > to 'dma_async_client_chan_request' it receives a 'dma_event_callback'
> > for each channel in the system.  It will also be asynchronously
> > notified of channels entering and leaving the system.  The goal is to
> > share a common infrastructure for channel management.
> >
>
> It's speacial codes for our processors. Some device need the speacial DMA channel, such as must be DMA channel 0. So I add these codes. Or, is it possible to add a API for the special DMA channel getting?

Timur had mentioned that this is for device tree support, but your
comment makes me think that this is for client support.  This sounds
like a case where you can define a dma_client to find a specific
channel, something like:
http://marc.info/?l=linux-kernel&m=118417229619156&w=2

> > > +
> > > +static int __devinit of_fsl_dma_probe(struct of_device *dev,
> > > +                       const struct of_device_id *match)
> > > +{
> > > +       int err;
> > > +       unsigned int irq;
> > > +       struct fsl_dma_device *fdev;
> > > +
> > > +       fdev = kzalloc(sizeof(struct fsl_dma_device), GFP_KERNEL);
> > > +       if (!fdev) {
> > > +               dev_err(&dev->dev, "No enough memory for 'priv'\n");
> > > +               err = -ENOMEM;
> > > +               goto err;
> > > +       }
> > > +       fdev->dev = &dev->dev;
> > > +       INIT_LIST_HEAD(&fdev->common.channels);
> > > +
> > > +       /* get DMA controller register base */
> > > +       err = of_address_to_resource(dev->node, 0, &fdev->reg);
> > > +       if (err) {
> > > +               dev_err(&dev->dev, "Can't get %s property 'reg'\n",
> > > +                               dev->node->full_name);
> > > +               goto err;
> > > +       }
> > > +
> > > +       dev_info(&dev->dev, "Probe the Freescale DMA driver for %s "
> > > +                       "controller at 0x%08x...\n",
> > > +                       match->compatible, fdev->reg.start);
> > > +       fdev->reg_base = ioremap(fdev->reg.start, fdev->reg.end
> > > +                                               -
> > fdev->reg.start + 1);
> > > +
> > > +       dma_cap_set(DMA_MEMCPY, fdev->common.cap_mask);
> > > +       fdev->common.device_alloc_chan_resources =
> > fsl_dma_alloc_chan_resources;
> > > +       fdev->common.device_free_chan_resources =
> > fsl_dma_free_chan_resources;
> > > +       fdev->common.device_prep_dma_memcpy = fsl_dma_prep_memcpy;
> > > +       fdev->common.device_is_tx_complete = fsl_dma_is_complete;
> > > +       fdev->common.device_issue_pending =
> > fsl_dma_memcpy_issue_pending;
> > > +       fdev->common.device_dependency_added =
> > fsl_dma_dependency_added;
> > > +       fdev->common.dev = &dev->dev;
> > > +
> > If this driver adds:
> >
> > dma_cap_set(DMA_INTERRUPT, fdev->common.cap_mask);
> > fdev->common.device_prep_dma_interrupt = fsl_dma_prep_interrupt;
> >
> > It will be able to take advantage of interrupt triggered callbacks in
> > async_tx.  Without these changes async_tx will poll for the completion
> > of each transaction.
> >
>
> The new API have lacking documents :) I'll make some study here.
>
Yes, I will address that...

> Thanks!
> - zw

Regards,
Dan

^ permalink raw reply

* Re: [PATCH 2/5] [POWERPC] DTS cleanup
From: Segher Boessenkool @ 2007-09-13 17:20 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev
In-Reply-To: <1189666392244-git-send-email-galak@kernel.crashing.org>

> Removed the following cruft from .dts files:
> * 32-bit in cpu node -- doesn't exist in any spec and not used by 
> kernel
> * removed built-in (chrp legacy)
> * Removed #interrupt-cells in places they don't need to be set
> * Fixed ranges on lite5200*
> * Removed clock-frequency from i8259 pic node, not sure where this 
> came from
>
> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>

Acked-by: Segher Boessenkool <segher@kernel.crashing.org>

You also removed "big-endian" from an 8259 node, please put that
in the commit message too.


Segher

^ permalink raw reply

* Patches added to powerpc.git for-2.6.24 branch
From: Paul Mackerras @ 2007-09-13 17:53 UTC (permalink / raw)
  To: linuxppc-dev

David Gibson (2):
      [POWERPC] Move bootwrapper's strchr() and strncmp() from .h to string.S
      [POWERPC] Document and implement an improved flash device binding for powerpc

Geert Uytterhoeven (1):
      [POWERPC] PS3: Add new LV1 error codes

Geoff Levand (1):
      [POWERPC] PS3: Enhance storage probe debug output

Jeremy Kerr (1):
      [POWERPC] PS3: Fix CONFIG_SMP=n, CONFIG_KEXEC=y build

Josh Boyer (6):
      [POWERPC] Remove dtc build cruft from DTS files
      [POWERPC] Fix bus probe on Bamboo board
      [POWERPC] Walnut DTS
      [POWERPC] Walnut defconfig
      [POWERPC] Walnut board support
      [POWERPC] Walnut zImage wrapper

Kumar Gala (3):
      [POWERPC] Remove old includes from arch/ppc
      [POWERPC] Copy over headers from arch/ppc to arch/powerpc that we need
      [POWERPC] Stop include asm-ppc when building ARCH=powerpc for ppc32

Linas Vepstas (4):
      [POWERPC] IOMMU virtual merge is no longer experimental
      [POWERPC] prom_init whitespace cleanup, typo fix
      [POWERPC] prom.c whitespace cleanup
      [POWERPC] setup_64.c and prom.c comment cleanup

Michael Ellerman (5):
      [POWERPC] Add an optional device_node pointer to the irq_host
      [POWERPC] Invert null match behaviour for irq_hosts
      [POWERPC] Provide a default irq_host match, which matches on an exact of_node
      [POWERPC] Initialise hwirq for legacy irqs
      [POWERPC] Export virq mapping via debugfs

Olof Johansson (10):
      [POWERPC] Export new __io{re,un}map_at() symbols
      [POWERPC] pasemi: Add pasemi_pci_getcfgaddr()
      [POWERPC] pasemi: Add workaround for erratum 5945
      [POWERPC] pasemi: Export more SPRs to sysfs when CONFIG_DEBUG_KERNEL=y
      [POWERPC] pasemi: Print more information at machine check
      [POWERPC] pasemi: Move pasemi_idle_init() to late_initcall()
      [POWERPC] Remove unused platform_machine_check()
      [POWERPC] Move lowlevel runlatch calls under cpu feature control
      [POWERPC] Remove warning in arch/powerpc/kernel/sysfs.c
      [POWERPC] Add workaround for MPICs with broken register reads

Scott Wood (5):
      [POWERPC] bootwrapper: flatdevtree fixes
      [POWERPC] bootwrapper: Add strtoull()
      [POWERPC] bootwrapper: Add get_path()
      [POWERPC] bootwrapper: Only print MAC addresses when the node is actually present
      [POWERPC] Check _PAGE_RW and _PAGE_PRESENT on kernel addresses

Valentine Barshak (4):
      [POWERPC] PowerPC 440EPx: Sequoia device tree
      [POWERPC] PowerPC 440EPx: Sequoia defconfig
      [POWERPC] PowerPC 440EPx: Sequoia board support
      [POWERPC] PowerPC 440EPx: Sequoia bootwrapper

^ permalink raw reply

* [PATCH] usb: add support for device tree aware EHCI driver
From: Valentine Barshak @ 2007-09-13 17:57 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: linux-usb-devel

Some PowerPC systems have a built-in EHCI controller.
This is a device tree aware version of the EHCI controller driver.
Currently it's been tested on the PowerPC 440EPx Sequoia board.
Other platforms can be added later.
The code is based on the ehci-ppc-soc driver by Stefan Roese <sr@denx.de>.
The of_platform support is based on ohci-ppc-of driver
by Sylvain Munaut <tnt@246tNt.com>.

Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>

---
 drivers/usb/host/Kconfig       |    8 +
 drivers/usb/host/ehci-hcd.c    |   16 ++
 drivers/usb/host/ehci-ppc-of.c |  251 +++++++++++++++++++++++++++++++++++++++++
 drivers/usb/host/ehci.h        |    2 
 4 files changed, 275 insertions(+), 2 deletions(-)

diff -ruN linux-2.6.orig/drivers/usb/host/ehci.h linux-2.6.bld/drivers/usb/host/ehci.h
--- linux-2.6.orig/drivers/usb/host/ehci.h	2007-09-05 22:03:19.000000000 +0400
+++ linux-2.6.bld/drivers/usb/host/ehci.h	2007-09-13 18:50:45.000000000 +0400
@@ -725,7 +725,7 @@
  * definition below can die once the 4xx support is
  * finally ported over.
  */
-#if defined(CONFIG_PPC)
+#if defined(CONFIG_PPC) && !defined(CONFIG_PPC_MERGE)
 #define readl_be(addr)		in_be32((__force unsigned *)addr)
 #define writel_be(val, addr)	out_be32((__force unsigned *)addr, val)
 #endif
diff -ruN linux-2.6.orig/drivers/usb/host/ehci-hcd.c linux-2.6.bld/drivers/usb/host/ehci-hcd.c
--- linux-2.6.orig/drivers/usb/host/ehci-hcd.c	2007-09-05 22:03:19.000000000 +0400
+++ linux-2.6.bld/drivers/usb/host/ehci-hcd.c	2007-09-13 18:53:37.000000000 +0400
@@ -944,11 +944,16 @@
 #define	PS3_SYSTEM_BUS_DRIVER	ps3_ehci_driver
 #endif
 
-#ifdef CONFIG_440EPX
+#if defined(CONFIG_440EPX) && !defined(CONFIG_PPC_MERGE)
 #include "ehci-ppc-soc.c"
 #define	PLATFORM_DRIVER		ehci_ppc_soc_driver
 #endif
 
+#ifdef CONFIG_USB_EHCI_HCD_PPC_OF
+#include "ehci-ppc-of.c"
+#define OF_PLATFORM_DRIVER	ehci_hcd_ppc_of_driver
+#endif
+
 #if !defined(PCI_DRIVER) && !defined(PLATFORM_DRIVER) && \
     !defined(PS3_SYSTEM_BUS_DRIVER)
 #error "missing bus glue for ehci-hcd"
@@ -963,6 +968,12 @@
 		 sizeof(struct ehci_qh), sizeof(struct ehci_qtd),
 		 sizeof(struct ehci_itd), sizeof(struct ehci_sitd));
 
+#ifdef OF_PLATFORM_DRIVER
+	retval = of_register_platform_driver(&OF_PLATFORM_DRIVER);
+	if (retval < 0)
+		return retval;
+#endif
+
 #ifdef PLATFORM_DRIVER
 	retval = platform_driver_register(&PLATFORM_DRIVER);
 	if (retval < 0)
@@ -998,6 +1009,9 @@
 
 static void __exit ehci_hcd_cleanup(void)
 {
+#ifdef OF_PLATFORM_DRIVER
+	of_unregister_platform_driver(&OF_PLATFORM_DRIVER);
+#endif
 #ifdef PLATFORM_DRIVER
 	platform_driver_unregister(&PLATFORM_DRIVER);
 #endif
diff -ruN linux-2.6.orig/drivers/usb/host/ehci-ppc-of.c linux-2.6.bld/drivers/usb/host/ehci-ppc-of.c
--- linux-2.6.orig/drivers/usb/host/ehci-ppc-of.c	1970-01-01 03:00:00.000000000 +0300
+++ linux-2.6.bld/drivers/usb/host/ehci-ppc-of.c	2007-09-13 18:45:02.000000000 +0400
@@ -0,0 +1,253 @@
+/*
+ * EHCI HCD (Host Controller Driver) for USB.
+ *
+ * Bus Glue for PPC On-Chip EHCI driver on the of_platform bus
+ * Tested on AMCC PPC 440EPx
+ *
+ * Valentine Barshak <vbarshak@ru.mvista.com>
+ *
+ * Based on "ehci-ppc-soc.c" by Stefan Roese <sr@denx.de>
+ * and "ohci-ppc-of.c" by Sylvain Munaut <tnt@246tNt.com>
+ *
+ * This file is licenced under the GPL.
+ */
+
+#include <linux/signal.h>
+
+#include <asm/of_platform.h>
+#include <asm/prom.h>
+
+/* called during probe() after chip reset completes */
+static int ehci_ppc_of_setup(struct usb_hcd *hcd)
+{
+	struct ehci_hcd	*ehci = hcd_to_ehci(hcd);
+	int		retval;
+
+	retval = ehci_halt(ehci);
+	if (retval)
+		return retval;
+
+	retval = ehci_init(hcd);
+	if (retval)
+		return retval;
+
+	ehci->sbrn = 0x20;
+	return ehci_reset(ehci);
+}
+
+
+static const struct hc_driver ehci_ppc_of_hc_driver = {
+	.description = hcd_name,
+	.product_desc = "OF EHCI",
+	.hcd_priv_size = sizeof(struct ehci_hcd),
+
+	/*
+	 * generic hardware linkage
+	 */
+	.irq = ehci_irq,
+	.flags = HCD_MEMORY | HCD_USB2,
+
+	/*
+	 * basic lifecycle operations
+	 */
+	.reset = ehci_ppc_of_setup,
+	.start = ehci_run,
+	.stop = ehci_stop,
+	.shutdown = ehci_shutdown,
+
+	/*
+	 * managing i/o requests and associated device resources
+	 */
+	.urb_enqueue = ehci_urb_enqueue,
+	.urb_dequeue = ehci_urb_dequeue,
+	.endpoint_disable = ehci_endpoint_disable,
+
+	/*
+	 * scheduling support
+	 */
+	.get_frame_number = ehci_get_frame,
+
+	/*
+	 * root hub support
+	 */
+	.hub_status_data = ehci_hub_status_data,
+	.hub_control = ehci_hub_control,
+#ifdef	CONFIG_PM
+	.hub_suspend = ehci_hub_suspend,
+	.hub_resume = ehci_hub_resume,
+#endif
+};
+
+
+static int __devinit
+ehci_hcd_ppc_of_probe(struct of_device *op, const struct of_device_id *match)
+{
+	struct device_node *dn = op->node;
+	struct usb_hcd *hcd;
+	struct ehci_hcd	*ehci;
+	struct resource res;
+	int irq;
+
+	int rv;
+	int is_be_desc, is_be_mmio;
+
+	if (usb_disabled())
+		return -ENODEV;
+
+	is_be_desc =
+		of_device_is_compatible(dn, "ehci-bigendian-desc") ||
+		of_device_is_compatible(dn, "ehci-be-desc");
+	is_be_mmio =
+		of_device_is_compatible(dn, "ehci-bigendian-mmio") ||
+		of_device_is_compatible(dn, "ehci-be-mmio");
+
+	dev_dbg(&op->dev, "initializing PPC-OF USB Controller\n");
+
+	rv = of_address_to_resource(dn, 0, &res);
+	if (rv)
+		return rv;
+
+	hcd = usb_create_hcd(&ehci_ppc_of_hc_driver, &op->dev, "PPC-OF USB");
+	if (!hcd)
+		return -ENOMEM;
+
+	hcd->rsrc_start = res.start;
+	hcd->rsrc_len = res.end - res.start + 1;
+
+	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
+		printk(KERN_ERR __FILE__ ": request_mem_region failed\n");
+		rv = -EBUSY;
+		goto err_rmr;
+	}
+
+	irq = irq_of_parse_and_map(dn, 0);
+	if (irq == NO_IRQ) {
+		printk(KERN_ERR __FILE__ ": irq_of_parse_and_map failed\n");
+		rv = -EBUSY;
+		goto err_irq;
+	}
+
+	hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
+	if (!hcd->regs) {
+		printk(KERN_ERR __FILE__ ": ioremap failed\n");
+		rv = -ENOMEM;
+		goto err_ioremap;
+	}
+
+	ehci = hcd_to_ehci(hcd);
+	if (is_be_desc)
+		ehci->big_endian_desc = 1;
+	if (is_be_mmio)
+		ehci->big_endian_mmio = 1;
+
+	ehci->caps = hcd->regs;
+	ehci->regs = hcd->regs + HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase));
+
+	/* cache this readonly data; minimize chip reads */
+	ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
+
+	if (of_device_is_compatible(dn, "ibm,ehci-440epx")) {
+		/*
+		 * 440EPx Errata USBH_3
+		 * Fix: Enable Break Memory Transfer (BMT) in INSNREG3
+		 */
+		out_be32((void *)((ulong)(&ehci->regs->command) + 0x8c), (1 << 0));
+		ehci_dbg(ehci, "Break Memory Transfer (BMT) has beed enabled!\n");
+	}
+
+	rv = usb_add_hcd(hcd, irq, 0);
+	if (rv == 0)
+		return 0;
+
+	iounmap(hcd->regs);
+err_ioremap:
+	irq_dispose_mapping(irq);
+err_irq:
+	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
+err_rmr:
+ 	usb_put_hcd(hcd);
+
+	return rv;
+}
+
+
+static int ehci_hcd_ppc_of_remove(struct of_device *op)
+{
+	struct usb_hcd *hcd = dev_get_drvdata(&op->dev);
+	dev_set_drvdata(&op->dev, NULL);
+
+	dev_dbg(&op->dev, "stopping PPC-OF USB Controller\n");
+
+	usb_remove_hcd(hcd);
+
+	iounmap(hcd->regs);
+	irq_dispose_mapping(hcd->irq);
+	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
+
+	usb_put_hcd(hcd);
+
+	return 0;
+}
+
+
+static int ehci_hcd_ppc_of_shutdown(struct of_device *op)
+{
+	struct usb_hcd *hcd = dev_get_drvdata(&op->dev);
+
+        if (hcd->driver->shutdown)
+                hcd->driver->shutdown(hcd);
+
+	return 0;
+}
+
+
+static struct of_device_id ehci_hcd_ppc_of_match[] = {
+#ifdef CONFIG_USB_EHCI_BIG_ENDIAN_DESC
+	{
+		.name = "usb",
+		.compatible = "ehci-bigendian-desc",
+	},
+	{
+		.name = "usb",
+		.compatible = "ehci-be-desc",
+	},
+#endif
+#ifdef CONFIG_USB_EHCI_BIG_ENDIAN_MMIO
+	{
+		.name = "usb",
+		.compatible = "ehci-bigendian-mmio",
+	},
+	{
+		.name = "usb",
+		.compatible = "ehci-be-mmio",
+	},
+#endif
+	{
+		.name = "usb",
+		.compatible = "ehci-littledian",
+	},
+	{
+		.name = "usb",
+		.compatible = "ehci-le",
+	},
+	{},
+};
+MODULE_DEVICE_TABLE(of, ehci_hcd_ppc_of_match);
+
+
+static struct of_platform_driver ehci_hcd_ppc_of_driver = {
+	.name		= "ppc-of-ehci",
+	.match_table	= ehci_hcd_ppc_of_match,
+	.probe		= ehci_hcd_ppc_of_probe,
+	.remove		= ehci_hcd_ppc_of_remove,
+	.shutdown 	= ehci_hcd_ppc_of_shutdown,
+#ifdef CONFIG_PM
+	/*.suspend	= ehci_hcd_ppc_of_drv_suspend,*/
+	/*.resume	= ehci_hcd_ppc_of_drv_resume,*/
+#endif
+	.driver		= {
+		.name	= "ppc-of-ehci",
+		.owner	= THIS_MODULE,
+	},
+};
+
diff -ruN linux-2.6.orig/drivers/usb/host/Kconfig linux-2.6.bld/drivers/usb/host/Kconfig
--- linux-2.6.orig/drivers/usb/host/Kconfig	2007-09-05 22:03:19.000000000 +0400
+++ linux-2.6.bld/drivers/usb/host/Kconfig	2007-09-13 18:49:03.000000000 +0400
@@ -84,6 +84,14 @@
 	---help---
 	  Variation of ARC USB block used in some Freescale chips.
 
+config USB_EHCI_HCD_PPC_OF
+	bool "EHCI support for PPC USB controller on OF platform bus"
+	depends on USB_EHCI_HCD && PPC_OF
+	default y
+	---help---
+	  Enables support for the USB controller PowerPC present on the
+	  OpenFirmware platform bus.
+
 config USB_ISP116X_HCD
 	tristate "ISP116X HCD support"
 	depends on USB

^ permalink raw reply

* Re: [PATCH] usb: add support for device tree aware EHCI driver
From: Josh Boyer @ 2007-09-13 18:18 UTC (permalink / raw)
  To: Valentine Barshak; +Cc: linuxppc-dev, linux-usb-devel
In-Reply-To: <20070913175702.GA24682@ru.mvista.com>

On Thu, 13 Sep 2007 21:57:02 +0400
Valentine Barshak <vbarshak@ru.mvista.com> wrote:

> Some PowerPC systems have a built-in EHCI controller.
> This is a device tree aware version of the EHCI controller driver.
> Currently it's been tested on the PowerPC 440EPx Sequoia board.
> Other platforms can be added later.
> The code is based on the ehci-ppc-soc driver by Stefan Roese <sr@denx.de>.
> The of_platform support is based on ohci-ppc-of driver
> by Sylvain Munaut <tnt@246tNt.com>.

Where's the DTS binding for this?  It doesn't exist in the current
sequoia.dts.

josh

^ permalink raw reply

* Re: [PATCH v3] [POWERPC] 85xx: Add basic Uniprocessor MPC8572 DS port
From: Kumar Gala @ 2007-09-13 18:24 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev
In-Reply-To: <b6ecc5c703232a936eab8942de37e8ec@kernel.crashing.org>


On Sep 13, 2007, at 12:06 PM, Segher Boessenkool wrote:

>>>> +		PowerPC,8572@0 {
>>>
>>> Maybe it would be good to use "PowerPC,e500" instead -- it would
>>> make it easier to probe for the actual CPU type, that way.  Not
>>> that Linux uses the name/compatible here at all ;-)
>>
>> I thought about this, not sure what the best solution is.
>
> Since the CPU cores on all these SoCs are identical (well, there
> might be a few revisions, or different cache sizes or such -- minor
> differences that can be probed for separately), it probably is a
> good idea to name them in the tree instead of having each client
> have its own table.
>
> Or is there anything about the CPU that can be derived from "8572"
> but not from "e500"?

Only in so much that we need something that states what the actual  
processor is.

>>>> +	soc8572@ffe00000 {
>>>
>>> You should put an interrupt-parent in here, so you can get rid of
>>> it in all the children.
>>
>> Are interrupt-parent's inherited by child nodes?
>
> A node without "interrupt-parent" uses the regular tree parent for
> walking the interrupt "tree".
>
>>> And then there's the pci_bridge thing we're discussing on IRC, of
>>> course -- basically, get rid of the pci_bridge pseudo-node, and
>>> move the interrupt-map for the south-bridge devices into the
>>> south-bridge node.
>>
>> Leaving the interrupt-map in the PHB because that works and moving  
>> it down has issues.
>
> Okay, fair enough.  Are you looking at resolving those kernel issues?

No.  I've had enough of this device tree foo for a while :)

[I'm happy to test any patches related to this, if someone else comes  
up with them]

- k

^ permalink raw reply

* [PATCH] PowerPC: usb ehci of_platform bindings for Sequoia 440EPx
From: Valentine Barshak @ 2007-09-13 18:24 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <20070913131851.56fcc377@weaponx.rchland.ibm.com>

EHCI OF bindings for PowerPC 440EPx Sequoia.

Signed-off-by: Valentine Barshak <vbarshak@ru.mvista.com>
---
 arch/powerpc/boot/dts/sequoia.dts |    7 +++++++
 1 files changed, 7 insertions(+)

diff -ruN linux-2.6.orig/arch/powerpc/boot/dts/sequoia.dts linux-2.6.bld/arch/powerpc/boot/dts/sequoia.dts
--- linux-2.6.orig/arch/powerpc/boot/dts/sequoia.dts	2007-09-13 20:58:18.000000000 +0400
+++ linux-2.6.bld/arch/powerpc/boot/dts/sequoia.dts	2007-09-13 21:32:49.000000000 +0400
@@ -122,6 +122,13 @@
 			interrupt-map-mask = <ffffffff>;
 		};
 
+		usb@e0000300 {
+			compatible = "ibm,ehci-440epx", "ehci-be-desc", "ehci-be-mmio";
+			interrupt-parent = <&UIC0>;
+			interrupts = <1a 4>;
+			reg = <0 e0000300 ff>;
+		};
+
 		POB0: opb {
 		  	compatible = "ibm,opb-440epx", "ibm,opb";
 			#address-cells = <1>;

^ permalink raw reply

* Re: Which 2.6 kernel for MPC5200
From: Jon Smirl @ 2007-09-13 18:42 UTC (permalink / raw)
  To: Grant Likely; +Cc: linuxppc-embedded, Domen Puncer, Babarovic Ivica
In-Reply-To: <fa686aa40709120814h6a73e4a5j5734d086401b0f2d@mail.gmail.com>

On 9/12/07, Grant Likely <grant.likely@secretlab.ca> wrote:
> On 9/12/07, Jon Smirl <jonsmirl@gmail.com> wrote:
> > On 9/12/07, Robert Schwebel <r.schwebel@pengutronix.de> wrote:
> > > We have the OSELAS.BSP patch stack for the PCM030 working ontop of
> > > Linus' git. It still uses an older version of the Bestcom patches, so if
> > > you do some work in that area, please keep me informed about your
> > > progress.
> >
> > What is the best way to proceed? I need to be on current git since we
> > are integrating a wireless driver that is tracking current git and the
> > mac80211 work.
> >
> > I have Phytec (pcm030) and Efika hardware but I don't have a 5200lite.
> > Our prototype hardware uses the pcm030 module on a custom baseboard.
> >
> > The best thing for me would be to get a FEC driver merged. That is the
> > largest piece of code  that is floating around. Getting that merged
> > would give me a stable base to build future patches on.
> >
> > I'd also like to get support for the pcm030 (minus real-time) merged.
> > That isn't a lot of code once FEC is in the kernel.
> >
> > Domen has posted this driver "[RFC PATCH v0.1] net driver: mpc52xx
> > fec". I can work on breaking that up, but I don't have a 5200lite so I
> > will have to port to pcm030. I don't want to start on this if someone
> > else is already doing it.
>
> Sylvain's bestcomm patches need be cleaned up and resubmitted before
> the next merge window opens.  AFAIK, the code is pretty much ready,
> and all the comments have been addressed.  All that is required is the
> final push to tidy the patchset and post to the list one more time.
> Sylvain said that he was going to get this done last weekend, but I
> haven't heard back from him yet.

I just noticed mail from Paul Mackerras
"Patches added to powerpc.git for-2.6.24 branch"

The MPC5200 ones aren't in the list.


> Sylvain, if you need help, please let me know.  I'll happily take on
> the last bit of tidy work if that's what is needed to be finished
> before the merge window.  (And it needs to be ready *before*, not
> during if I'm judging the prevailing winds correctly).
>
> Cheers,
> g.
> >
> > --
> > Jon Smirl
> > jonsmirl@gmail.com
> >
>
>
> --
> Grant Likely, B.Sc., P.Eng.
> Secret Lab Technologies Ltd.
> grant.likely@secretlab.ca
> (403) 399-0195
>


-- 
Jon Smirl
jonsmirl@gmail.com

^ permalink raw reply

* Re: Which 2.6 kernel for MPC5200
From: Jon Smirl @ 2007-09-13 18:48 UTC (permalink / raw)
  To: Domen Puncer; +Cc: Babarovic Ivica, linuxppc-embedded
In-Reply-To: <20070912171520.GE2642@nd47.coderock.org>

On 9/12/07, Domen Puncer <domen.puncer@telargo.com> wrote:
> On 12/09/07 12:16 -0400, Jon Smirl wrote:
> > On 9/12/07, Grant Likely <grant.likely@secretlab.ca> wrote:
> > > On 9/12/07, Jon Smirl <jonsmirl@gmail.com> wrote:
> > > > On 9/12/07, Robert Schwebel <r.schwebel@pengutronix.de> wrote:
> > > > > We have the OSELAS.BSP patch stack for the PCM030 working ontop of
> > > > > Linus' git. It still uses an older version of the Bestcom patches, so if
> > > > > you do some work in that area, please keep me informed about your
> > > > > progress.
> > > >
> > > > What is the best way to proceed? I need to be on current git since we
> > > > are integrating a wireless driver that is tracking current git and the
> > > > mac80211 work.
> > > >
> > > > I have Phytec (pcm030) and Efika hardware but I don't have a 5200lite.
> > > > Our prototype hardware uses the pcm030 module on a custom baseboard.
> > > >
> > > > The best thing for me would be to get a FEC driver merged. That is the
> > > > largest piece of code  that is floating around. Getting that merged
> > > > would give me a stable base to build future patches on.
> > > >
> > > > I'd also like to get support for the pcm030 (minus real-time) merged.
> > > > That isn't a lot of code once FEC is in the kernel.
> > > >
> > > > Domen has posted this driver "[RFC PATCH v0.1] net driver: mpc52xx
> > > > fec". I can work on breaking that up, but I don't have a 5200lite so I
> > > > will have to port to pcm030. I don't want to start on this if someone
> > > > else is already doing it.
> > >
> > > Sylvain's bestcomm patches need be cleaned up and resubmitted before
> > > the next merge window opens.  AFAIK, the code is pretty much ready,
> > > and all the comments have been addressed.  All that is required is the
> > > final push to tidy the patchset and post to the list one more time.
> > > Sylvain said that he was going to get this done last weekend, but I
> > > haven't heard back from him yet.
> > >
> > > Sylvain, if you need help, please let me know.  I'll happily take on
> > > the last bit of tidy work if that's what is needed to be finished
> > > before the merge window.  (And it needs to be ready *before*, not
> > > during if I'm judging the prevailing winds correctly).
> >
> > Is a version of this patch set that has been rebased to current git
> > available? If I have a starting point I can begin working on the
> > pcm030 support. pcm030 already works, it is just out of tree.
>
> I think these patches are "latest":
> http://www.246tnt.com/mpc52xx/dev_full/
> Applying them to -git should not be a problem, I don't remember anything
> tricky, but if you have problems, I can send you patches agains mainline.
>
> BTW. I posted FEC patch v2, which will hopefully be merged.

I just booted your code successfully on current Linus git with a Phytec pcm030.

There is a timeout issue that is probably related to the specific
Ethernet PHY chip used on the pcm030. I'm looking into it now.

[    1.313708] net eth0: attached phy 0 to driver Generic PHY
[    2.320013] Sending DHCP requests ...... timed out!
[   81.968863] IP-Config: Retrying forever (NFS root)...
[   82.477527] net eth0: attached phy 0 to driver Generic PHY
[   83.487809] Sending DHCP requests .<6>PHY: f0003000:00 - Link is Up
- 100/Full
[   86.323795] ., OK
[   88.579802] IP-Config: Got DHCP answer from 192.168.1.200, my
address is 192.168.1.5
[   88.587923] IP-Config: Complete:

>
>
>         Domen
>
> >
> >
> > >
> > > Cheers,
> > > g.
> > > >
> > > > --
> > > > Jon Smirl
> > > > jonsmirl@gmail.com
> > > >
> > >
> > >
> > > --
> > > Grant Likely, B.Sc., P.Eng.
> > > Secret Lab Technologies Ltd.
> > > grant.likely@secretlab.ca
> > > (403) 399-0195
> > >
> >
> >
> > --
> > Jon Smirl
> > jonsmirl@gmail.com
>


-- 
Jon Smirl
jonsmirl@gmail.com

^ permalink raw reply

* Re: [PATCH 1/5] Add Freescale DMA and DMA channel to Documentation/powerpc/booting-without-of.txt file.
From: Segher Boessenkool @ 2007-09-13 18:55 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, Zhang Wei-r63237, paulus, David Gibson
In-Reply-To: <20070913145236.GC32043@ld0162-tx32.am.freescale.net>

>>> What tree are you using?  Commit
>>> 804ace8881d211ac448082e871dd312132393049
>>> in Paul's git tree should have fixed that.
>>
>> Strange, I don't see that commit -- maybe gitweb is broken, or
>> maybe the patch was superseded, or maybe it just disappeared?
>> It's still shown in patchworks with this commit id fwiw.
>
> I see it here:
> http://git.kernel.org/?p=linux/kernel/git/paulus/powerpc.git;a=commit; 
> h=804ace8881d211ac448082e871dd312132393049

Ah okay.  The gitweb search functionality is broken.

Shouldn't this patch have gone to .23?  It's a pretty important
bugfix I think.


Segher

^ permalink raw reply

* Re: [PATCH 1/5] Add Freescale DMA and DMA channel to Documentation/powerpc/booting-without-of.txt file.
From: Scott Wood @ 2007-09-13 18:59 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev, Zhang Wei-r63237, paulus, David Gibson
In-Reply-To: <045c872e8a912921da3259586595c0f3@kernel.crashing.org>

Segher Boessenkool wrote:
>>>> What tree are you using?  Commit
>>>> 804ace8881d211ac448082e871dd312132393049
>>>> in Paul's git tree should have fixed that.
>>>
>>> Strange, I don't see that commit -- maybe gitweb is broken, or
>>> maybe the patch was superseded, or maybe it just disappeared?
>>> It's still shown in patchworks with this commit id fwiw.
>>
>> I see it here:
>> http://git.kernel.org/?p=linux/kernel/git/paulus/powerpc.git;a=commit;h=804ace8881d211ac448082e871dd312132393049 
>>
> 
> Ah okay.  The gitweb search functionality is broken.
> 
> Shouldn't this patch have gone to .23?  It's a pretty important
> bugfix I think.

Probably not, in the absence of a specific failing match that's already 
in .23.  It has the potential to break things that were working by chance.

-Scott

^ permalink raw reply

* U-Boot problems with MPC8272ADS
From: Manil Gaouar @ 2007-09-13 19:55 UTC (permalink / raw)
  To: linuxppc-embedded

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

Hi all,

 

I have a MPC8272ADS evaluation board from Motorolla. I am trying to run
U-Boot and Linux kernel 2.6 on it. I am using the 4.1 ELDK, U-Boot from
the git repos, and Linux kernel 2.6 from git repos.

 

I am burning U-Boot into the flash using a BDI2000.

 

My problem is: 

 

1-       When burning the U-Boot and setting the jumper JP9 in BSCR
everything works fine, I reboot the board and the memory at 0xfff00000
is locked which probably means that U-Boot is running, but I have no
display on my serial link (running cu S0@115200).

2-       When I put the jumper JP6 in memory position the card keeps
resetting and I have a message error if I connect the BDI to the board
saying:

 

- TARGET: processing user reset request

- BDI asserts HRESET

- Reset JTAG controller passed

- Bypass check: 0x00000001 => 0x00000001

- JTAG exists check passed

- COP status is 0x7D

- Check running state failed

- TARGET: Target PVR is 0x80822014

*** TARGET: resetting target failed

# PPC: unexpected response from target

- TARGET: target will be restarted in 10 sec

8272>

 

And it keeps resetting and same message again and again.

 

Here is my BDI CFG file:

 

; bdiGDB configuration file for MPC8272ADS board

; ----------------------------------------------

[INIT]

; init core register

WREG    MSR             0x00001002      ;MSR  : ME,RI

WM32         0x0F010004      0xFFFFFFC3     ;SYPCR: disable watchdog

WM32         0x0F0101A8      0x04700000       ;IMMR : internal space @
0x04700000

WM32         0x04710024       0x100C0000      ;BCR  : Single PQ2, ..

WM32         0x04710c94       0x00000001       ;RMR  : checkstop reset
enable

; init memory controller

 

WM32         0x04710104       0xFF800876      ;OR0: Flash 8MB, CS early
negate, 11 w.s., Timing relax

WM32         0x04710100       0xFF801801      ;BR0: Flash @0xFF800000,
32bit, no parity

WM32         0x0471010C      0xFFFF8010      ;OR1: BCSR 32KB, all types
access, 1 w.s.

WM32         0x04710108       0x04501801       ;BR1: BCSR @0x04500000,
32bit, no parity

WM32         0x04710124       0xFFFF8866      ;OR4: EEPROM 32KB, all
types access, 6 w.s.

WM32         0x04710120       0xC2000801      ;BR4: EEPROM @0xC2000000,
8bit, no parity

; init SDRAM Init (PPC bus)

WM16         0x04710184       0x2800          ;MPTPR: Divide Bus clock
by 41

WM8          0x0471019C      0x13             ;PSRT : Divide MPTPR
output by 20

WM32         0x04710114       0xfe002ec0        ;OR2  : 32MB, 2 banks,
row start at A9, 11 rows

WM32         0x04710110       0x00000041       ;BR2  : SDRAM
@0x00000000, 64bit, no parity

WM32         0x04710190       0x824b36a3       ;PSDMR: Precharge all
banks

WM32         0x04710190       0xaa4b36a3

WM8          0x00000000       0x00             ;Access SDRAM

WM32         0x04710190       0x8a4b36a3       ;PSDMR: CBR Refresh

WM8          0x00000000       0xFF             ;Access SDRAM

WM8          0x00000000       0xFF             ;Access SDRAM

WM8          0x00000000       0xFF             ;Access SDRAM

WM8          0x00000000       0xFF             ;Access SDRAM

WM8          0x00000000       0xFF             ;Access SDRAM

WM8          0x00000000       0xFF             ;Access SDRAM

WM8          0x00000000       0xFF             ;Access SDRAM

WM8          0x00000000       0xFF             ;Access SDRAM

WM32         0x04710190       0x9a4b36a3       ;PSDMR: Mode Set

WM8          0x00000190       0x00             ;Access SDRAM

WM32         0x04710190       0xc24b36a3       ;PSDMR: enable refresh,
normal operation

[TARGET]

CPUTYPE     8272        ;the CPU type

JTAGCLOCK   0           ;use 16 MHz JTAG clock

POWERUP     7000        ;start delay after power-up detected in ms

BOOTADDR    0xfff00100  ;boot address used for start-up break

WORKSPACE   0x04700000            ;workspace in target RAM for fast
download

;MEMDELAY    2000        ;additional memory access delay

 

[HOST]

IP          172.16.0.120

FILE        u-boot.bin

FORMAT      BIN

;FILE        E:\temp\test16k.bin

;FORMAT      BIN 0x04708000

LOAD        MANUAL      ;load code MANUAL or AUTO after reset

DEBUGPORT   2001

PROMPT      8272> ;new prompt for Telnet

;DUMP        /home/solacom/bdi/dump.bin

[FLASH]

CHIPTYPE    I28BX8            ; Flash type

CHIPSIZE    0x200000          ; Single chip size (2 Mbyte)

BUSWIDTH    32                  ; total width for the whole SIMM

WORKSPACE   0x04700000            ;workspace in target RAM for fast
download

FILE        /home/solacom/bdi/1MB_junk.bin

FORMAT      BIN 0xFF800000

ERASE       0xFF800000  ;erase sector  4 of flash SIMM

ERASE       0xFF840000  ;erase sector  5 of flash SIMM

ERASE       0xFF880000  ;erase sector  6 of flash SIMM

ERASE       0xFF8C0000  ;erase sector  7 of flash SIMM

[REGS]

DMM1        0x04700000

FILE        reg8272.def

 

Here are the commands I used to upload the U-Boot:

 

8272>unlock

8272>erase

8272>erase 0xfff00000

8272>prog 0xfff00000 u-boot.bin

The prgrammation goes fine.

When I do a 8272>md 0xfff00000 I have the same data as the beginning of
the u-boot.bin, which means that my upload is correct.

 

Can you help me on this please? My TEXT_BASE is 0xFFF00000 which means
u-boot run from flash, but putting JP9 means running from RAM right?

 

I am confused about this, I've read a tutorial www.jungo.com/openrg/doc/
4.7/installation_guide/pdf/ppc.pdf and followed their steps to start
U-Boot, but I can not see the U_Boot prompt, may be U-Boot is not
running, I have no clue...Can we know when U-Boot is not running without
display?

 

Thx for any help...


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

^ permalink raw reply

* Please pull from for-2.6.24
From: Kumar Gala @ 2007-09-13 20:55 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev

Please pull from 'for-2.6.24' branch of

	master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc.git for-2.6.24

to receive the following updates:

 arch/powerpc/boot/dts/holly.dts                  |    1
 arch/powerpc/boot/dts/kuroboxHD.dts              |    6
 arch/powerpc/boot/dts/kuroboxHG.dts              |    6
 arch/powerpc/boot/dts/lite5200.dts               |   49
 arch/powerpc/boot/dts/lite5200b.dts              |   59
 arch/powerpc/boot/dts/mpc7448hpc2.dts            |   17
 arch/powerpc/boot/dts/mpc8272ads.dts             |    5
 arch/powerpc/boot/dts/mpc8313erdb.dts            |   63
 arch/powerpc/boot/dts/mpc832x_mds.dts            |  122 -
 arch/powerpc/boot/dts/mpc832x_rdb.dts            |   72 -
 arch/powerpc/boot/dts/mpc8349emitx.dts           |   98 -
 arch/powerpc/boot/dts/mpc8349emitxgp.dts         |   47
 arch/powerpc/boot/dts/mpc834x_mds.dts            |  243 +--
 arch/powerpc/boot/dts/mpc836x_mds.dts            |  123 -
 arch/powerpc/boot/dts/mpc8540ads.dts             |  175 +-
 arch/powerpc/boot/dts/mpc8541cds.dts             |  196 +--
 arch/powerpc/boot/dts/mpc8544ds.dts              |  377 +++--
 arch/powerpc/boot/dts/mpc8548cds.dts             |  404 +++---
 arch/powerpc/boot/dts/mpc8555cds.dts             |  196 +--
 arch/powerpc/boot/dts/mpc8560ads.dts             |  185 +-
 arch/powerpc/boot/dts/mpc8568mds.dts             |    4
 arch/powerpc/boot/dts/mpc8572ds.dts              |  404 ++++++
 arch/powerpc/boot/dts/mpc8641_hpcn.dts           |  275 ++--
 arch/powerpc/boot/dts/mpc866ads.dts              |    5
 arch/powerpc/boot/dts/mpc885ads.dts              |    5
 arch/powerpc/boot/dts/prpmc2800.dts              |    1
 arch/powerpc/configs/mpc8544_ds_defconfig        |    2
 arch/powerpc/configs/mpc8572_ds_defconfig        | 1496 +++++++++++++++++++++++
 arch/powerpc/kernel/align.c                      |  250 +++
 arch/powerpc/kernel/cputable.c                   |   23
 arch/powerpc/kernel/entry_32.S                   |    4
 arch/powerpc/kernel/head_32.S                    |   17
 arch/powerpc/kernel/head_40x.S                   |   12
 arch/powerpc/kernel/head_44x.S                   |    6
 arch/powerpc/kernel/head_8xx.S                   |    9
 arch/powerpc/kernel/head_fsl_booke.S             |    6
 arch/powerpc/kernel/process.c                    |   15
 arch/powerpc/kernel/ptrace.c                     |    6
 arch/powerpc/kernel/vmlinux.lds.S                |    2
 arch/powerpc/platforms/83xx/mpc8313_rdb.c        |    2
 arch/powerpc/platforms/83xx/mpc832x_mds.c        |    1
 arch/powerpc/platforms/83xx/mpc832x_rdb.c        |   48
 arch/powerpc/platforms/83xx/mpc834x_itx.c        |    2
 arch/powerpc/platforms/83xx/mpc834x_mds.c        |    2
 arch/powerpc/platforms/83xx/mpc836x_mds.c        |    1
 arch/powerpc/platforms/83xx/mpc83xx.h            |    2
 arch/powerpc/platforms/83xx/pci.c                |    7
 arch/powerpc/platforms/85xx/Kconfig              |    8
 arch/powerpc/platforms/85xx/Makefile             |    2
 arch/powerpc/platforms/85xx/mpc8544_ds.c         |  188 --
 arch/powerpc/platforms/85xx/mpc85xx_ads.c        |   13
 arch/powerpc/platforms/85xx/mpc85xx_cds.c        |   13
 arch/powerpc/platforms/85xx/mpc85xx_ds.c         |  227 +++
 arch/powerpc/platforms/85xx/mpc85xx_mds.c        |   11
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c       |   14
 arch/powerpc/platforms/embedded6xx/linkstation.c |    1
 arch/powerpc/platforms/embedded6xx/ls_uart.c     |   14
 arch/powerpc/sysdev/fsl_pci.c                    |    2
 arch/powerpc/sysdev/fsl_soc.c                    |  114 +
 arch/powerpc/sysdev/fsl_soc.h                    |    7
 drivers/net/ucc_geth_mii.c                       |    1
 drivers/serial/mpc52xx_uart.c                    |    2
 include/asm-powerpc/cputable.h                   |   26
 include/asm-powerpc/immap_86xx.h                 |  151 --
 include/asm-powerpc/io.h                         |   23
 include/asm-powerpc/ppc_asm.h                    |    4
 include/asm-powerpc/qe.h                         |    3
 include/asm-ppc/io.h                             |    3
 include/linux/pci_ids.h                          |    2
 69 files changed, 4049 insertions(+), 1831 deletions(-)

Anton Vorontsov (3):
      [POWERPC] QE: extern par_io_config_pin and par_io_data_set funcs
      [POWERPC] fsl_soc: add support for fsl_spi
      [POWERPC] MPC832x_RDB: Update dts to use SPI1 in QE, register mmc_spi stub

Guennadi Liakhovetski (1):
      [POWERPC] linkstation updates

John Rigby (1):
      [POWERPC] 52xx: Fix mpc52xx_uart_of_assign to use correct index

Jon Loeliger (2):
      [POWERPC] 86xx: Remove unnecessary loops_per_jiffy initialization code.
      [POWERPC] 85xx: Remove unnecessary loops_per_jiffy initialization code.

Kumar Gala (10):
      ucc_geth: kill unused include
      [POWERPC] 85xx: Renamed mpc8544_ds.c to mpc85xx_ds.c
      [POWERPC] 85xx: Clean up from 85xx_ds rename
      [POWERPC] Handle alignment faults on SPE load/store instructions
      [POWERPC] 85xx: Add basic Uniprocessor MPC8572 DS port
      [POWERPC] DTS cleanup
      [POWERPC] Move PCI nodes to be sibilings with SOC nodes
      [POWERPC] 83xx: Removed PCI exclude of PHB
      [POWERPC] Add cpu feature for SPE handling
      [POWERPC] Fix modpost warnings from head*.S on ppc32

Roy Zang (1):
      [POWERPC] Update mpc7448hpc2 device tree to be compatible for tsi109 chip

Scott Wood (2):
      [POWERPC] fsl_soc.c cleanup
      [PPC] Add clrbits8 and setbits8.

Timur Tabi (2):
      [POWERPC] add clrsetbits macros
      [POWERPC] 86xx: Fix definition of global-utilites structure

^ permalink raw reply

* Re: [PATCH] [POWERPC] DTS cleanup
From: Kumar Gala @ 2007-09-13 21:04 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev
In-Reply-To: <39e2f86a62574776183feb82935cd79c@kernel.crashing.org>


On Sep 13, 2007, at 11:56 AM, Segher Boessenkool wrote:

>>>> * built-in for non-standard buses (ISA, PCI)
>>>
>>> "built-in" is some weird CHRP property, so yes we don't need it
>>> or want it.
>>
>> Do you suggest we get ride of it from ISA nodes as well?
>
> Yes.  You aren't CHRP so you don't have to follow the CHRP binding.
> Of course it is good to copy from that binding where it makes sense,
> but how is "built-in" useful to you?
>
>>>> * Fixed ranges on lite5200*
>>>
>>> This has a problem still:
>>>
>>>>  		model = "fsl,mpc5200";
>>>>  		compatible = "mpc5200";
>>>>  		revision = "";			// from bootloader
>>>> -		#interrupt-cells = <3>;
>>>>  		device_type = "soc";
>>>> -		ranges = <0 f0000000 f0010000>;
>>>> -		reg = <f0000000 00010000>;
>>>> +		ranges = <0 f0000000 0000c000>;
>>>> +		reg = <f0000000 0000c000>;
>>>
>>> That makes "reg" and "ranges" identify an identical address range,
>>> which means no subnode can claim any address in that range, so the
>>> "ranges" property should go.  Alternatively, the "reg" might be
>>> claiming too big a space.
>>>
>>> Which is it?
>>
>> Yeah, I think it should be 0x100 for the 'soc' regs on 52xx so  
>> I'll set regs to that.
>
> Okido.
>
> Did I say "nice cleanups, thank you!" already?  :-)

You did, and let me tell you I've had enough of cleaning up the .dts  
for a while :)

Someone really needs to add some macro/preprocessor magic into DTC so  
this is made a lot simpler.

- k

^ permalink raw reply

* [PATCH 00/22] [POWERPC] Patches in for-2.6.24
From: Kumar Gala @ 2007-09-13 21:07 UTC (permalink / raw)
  To: linuxppc-dev

This is the set of patches in:

        master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc.git for-2.6.24

Posted here so everyone knows what's going in.  I've asked Paul to pull this into
his for-2.6.24 branch.

(Sorry for anyone getting duplicates of this, sent to linuxppc@ozlabs not linuxppc-dev@ozlabs)

- k

^ permalink raw reply

* [PATCH 01/22] ucc_geth: kill unused include
From: Kumar Gala @ 2007-09-13 21:07 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <11897176803590-git-send-email-galak@kernel.crashing.org>

The ucc_geth_mii code is based on the gianfar_mii code that use to include
ocp.h.  ucc never need this and it causes issues when we want to kill
arch/ppc includes from arch/powerpc.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
 drivers/net/ucc_geth_mii.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
index 6c257b8..df884f0 100644
--- a/drivers/net/ucc_geth_mii.c
+++ b/drivers/net/ucc_geth_mii.c
@@ -32,7 +32,6 @@
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
-#include <asm/ocp.h>
 #include <linux/crc32.h>
 #include <linux/mii.h>
 #include <linux/phy.h>
-- 
1.5.2.4

^ permalink raw reply related

* [PATCH 02/22] [POWERPC] 85xx: Renamed mpc8544_ds.c to mpc85xx_ds.c
From: Kumar Gala @ 2007-09-13 21:07 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <1189717681533-git-send-email-galak@kernel.crashing.org>

Renamed the mpc8544_ds.c board code to mpc85xx_ds.c to make it more
generic in prep for other boards based on the same platform.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
 arch/powerpc/configs/mpc8544_ds_defconfig |    2 +-
 arch/powerpc/platforms/85xx/Kconfig       |    8 +-
 arch/powerpc/platforms/85xx/Makefile      |    2 +-
 arch/powerpc/platforms/85xx/mpc8544_ds.c  |  188 -----------------------------
 arch/powerpc/platforms/85xx/mpc85xx_ds.c  |  188 +++++++++++++++++++++++++++++
 5 files changed, 194 insertions(+), 194 deletions(-)
 delete mode 100644 arch/powerpc/platforms/85xx/mpc8544_ds.c
 create mode 100644 arch/powerpc/platforms/85xx/mpc85xx_ds.c

diff --git a/arch/powerpc/configs/mpc8544_ds_defconfig b/arch/powerpc/configs/mpc8544_ds_defconfig
index 86582ae..150221f 100644
--- a/arch/powerpc/configs/mpc8544_ds_defconfig
+++ b/arch/powerpc/configs/mpc8544_ds_defconfig
@@ -136,7 +136,7 @@ CONFIG_DEFAULT_IOSCHED="cfq"
 # CONFIG_MPC8560_ADS is not set
 # CONFIG_MPC85xx_CDS is not set
 # CONFIG_MPC85xx_MDS is not set
-CONFIG_MPC8544_DS=y
+CONFIG_MPC85xx_DS=y
 CONFIG_MPC85xx=y
 CONFIG_MPIC=y
 # CONFIG_MPIC_WEIRD is not set
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index f620171..b8476b2 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -29,13 +29,13 @@ config MPC85xx_MDS
 	help
 	  This option enables support for the MPC85xx MDS board
 
-config MPC8544_DS
-	bool "Freescale MPC8544 DS"
+config MPC85xx_DS
+	bool "Freescale MPC85xx DS"
 	select PPC_I8259
 	select DEFAULT_UIMAGE
 	select FSL_ULI1575
 	help
-	  This option enables support for the MPC8544 DS board
+	  This option enables support for the MPC85xx DS (MPC8544 DS) board
 
 endchoice
 
@@ -58,4 +58,4 @@ config MPC85xx
 	select FSL_PCI if PCI
 	select SERIAL_8250_SHARE_IRQ if SERIAL_8250
 	default y if MPC8540_ADS || MPC85xx_CDS || MPC8560_ADS \
-		|| MPC85xx_MDS || MPC8544_DS
+		|| MPC85xx_MDS || MPC85xx_DS
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index d70f2d0..25bd9e2 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -5,5 +5,5 @@ obj-$(CONFIG_PPC_85xx)	+= misc.o
 obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads.o
 obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads.o
 obj-$(CONFIG_MPC85xx_CDS) += mpc85xx_cds.o
-obj-$(CONFIG_MPC8544_DS)  += mpc8544_ds.o
+obj-$(CONFIG_MPC85xx_DS)  += mpc85xx_ds.o
 obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o
diff --git a/arch/powerpc/platforms/85xx/mpc8544_ds.c b/arch/powerpc/platforms/85xx/mpc8544_ds.c
deleted file mode 100644
index 48983bc..0000000
--- a/arch/powerpc/platforms/85xx/mpc8544_ds.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * MPC8544 DS Board Setup
- *
- * Author Xianghua Xiao (x.xiao@freescale.com)
- * Roy Zang <tie-fei.zang@freescale.com>
- * 	- Add PCI/PCI Exprees support
- * Copyright 2007 Freescale Semiconductor Inc.
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- */
-
-#include <linux/stddef.h>
-#include <linux/kernel.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/interrupt.h>
-
-#include <asm/system.h>
-#include <asm/time.h>
-#include <asm/machdep.h>
-#include <asm/pci-bridge.h>
-#include <asm/mpc85xx.h>
-#include <mm/mmu_decl.h>
-#include <asm/prom.h>
-#include <asm/udbg.h>
-#include <asm/mpic.h>
-#include <asm/i8259.h>
-
-#include <sysdev/fsl_soc.h>
-#include <sysdev/fsl_pci.h>
-#include "mpc85xx.h"
-
-#undef DEBUG
-
-#ifdef DEBUG
-#define DBG(fmt, args...) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args)
-#else
-#define DBG(fmt, args...)
-#endif
-
-#ifdef CONFIG_PPC_I8259
-static void mpc8544_8259_cascade(unsigned int irq, struct irq_desc *desc)
-{
-	unsigned int cascade_irq = i8259_irq();
-
-	if (cascade_irq != NO_IRQ) {
-		generic_handle_irq(cascade_irq);
-	}
-	desc->chip->eoi(irq);
-}
-#endif	/* CONFIG_PPC_I8259 */
-
-void __init mpc8544_ds_pic_init(void)
-{
-	struct mpic *mpic;
-	struct resource r;
-	struct device_node *np = NULL;
-#ifdef CONFIG_PPC_I8259
-	struct device_node *cascade_node = NULL;
-	int cascade_irq;
-#endif
-
-	np = of_find_node_by_type(np, "open-pic");
-
-	if (np == NULL) {
-		printk(KERN_ERR "Could not find open-pic node\n");
-		return;
-	}
-
-	if (of_address_to_resource(np, 0, &r)) {
-		printk(KERN_ERR "Failed to map mpic register space\n");
-		of_node_put(np);
-		return;
-	}
-
-	mpic = mpic_alloc(np, r.start,
-			  MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
-			0, 256, " OpenPIC  ");
-	BUG_ON(mpic == NULL);
-
-	mpic_init(mpic);
-
-#ifdef CONFIG_PPC_I8259
-	/* Initialize the i8259 controller */
-	for_each_node_by_type(np, "interrupt-controller")
-	    if (of_device_is_compatible(np, "chrp,iic")) {
-		cascade_node = np;
-		break;
-	}
-
-	if (cascade_node == NULL) {
-		printk(KERN_DEBUG "Could not find i8259 PIC\n");
-		return;
-	}
-
-	cascade_irq = irq_of_parse_and_map(cascade_node, 0);
-	if (cascade_irq == NO_IRQ) {
-		printk(KERN_ERR "Failed to map cascade interrupt\n");
-		return;
-	}
-
-	DBG("mpc8544ds: cascade mapped to irq %d\n", cascade_irq);
-
-	i8259_init(cascade_node, 0);
-	of_node_put(cascade_node);
-
-	set_irq_chained_handler(cascade_irq, mpc8544_8259_cascade);
-#endif	/* CONFIG_PPC_I8259 */
-}
-
-#ifdef CONFIG_PCI
-extern int uses_fsl_uli_m1575;
-extern int uli_exclude_device(struct pci_controller *hose,
-				u_char bus, u_char devfn);
-
-static int mpc85xx_exclude_device(struct pci_controller *hose,
-				   u_char bus, u_char devfn)
-{
-	struct device_node* node;	
-	struct resource rsrc;
-
-	node = (struct device_node *)hose->arch_data;
-	of_address_to_resource(node, 0, &rsrc);
-
-	if ((rsrc.start & 0xfffff) == 0xb000) {
-		return uli_exclude_device(hose, bus, devfn);
-	}
-
-	return PCIBIOS_SUCCESSFUL;
-}
-#endif	/* CONFIG_PCI */
-
-/*
- * Setup the architecture
- */
-static void __init mpc8544_ds_setup_arch(void)
-{
-#ifdef CONFIG_PCI
-	struct device_node *np;
-#endif
-
-	if (ppc_md.progress)
-		ppc_md.progress("mpc8544_ds_setup_arch()", 0);
-
-#ifdef CONFIG_PCI
-	for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) {
-		struct resource rsrc;
-		of_address_to_resource(np, 0, &rsrc);
-		if ((rsrc.start & 0xfffff) == 0xb000)
-			fsl_add_bridge(np, 1);
-		else
-			fsl_add_bridge(np, 0);
-	}
-	uses_fsl_uli_m1575 = 1;
-	ppc_md.pci_exclude_device = mpc85xx_exclude_device;
-#endif
-
-	printk("MPC8544 DS board from Freescale Semiconductor\n");
-}
-
-/*
- * Called very early, device-tree isn't unflattened
- */
-static int __init mpc8544_ds_probe(void)
-{
-	unsigned long root = of_get_flat_dt_root();
-
-	return of_flat_dt_is_compatible(root, "MPC8544DS");
-}
-
-define_machine(mpc8544_ds) {
-	.name			= "MPC8544 DS",
-	.probe			= mpc8544_ds_probe,
-	.setup_arch		= mpc8544_ds_setup_arch,
-	.init_IRQ		= mpc8544_ds_pic_init,
-#ifdef CONFIG_PCI
-	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
-#endif
-	.get_irq		= mpic_get_irq,
-	.restart		= mpc85xx_restart,
-	.calibrate_decr		= generic_calibrate_decr,
-	.progress		= udbg_progress,
-};
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
new file mode 100644
index 0000000..48983bc
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -0,0 +1,188 @@
+/*
+ * MPC8544 DS Board Setup
+ *
+ * Author Xianghua Xiao (x.xiao@freescale.com)
+ * Roy Zang <tie-fei.zang@freescale.com>
+ * 	- Add PCI/PCI Exprees support
+ * Copyright 2007 Freescale Semiconductor Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/stddef.h>
+#include <linux/kernel.h>
+#include <linux/pci.h>
+#include <linux/kdev_t.h>
+#include <linux/delay.h>
+#include <linux/seq_file.h>
+#include <linux/interrupt.h>
+
+#include <asm/system.h>
+#include <asm/time.h>
+#include <asm/machdep.h>
+#include <asm/pci-bridge.h>
+#include <asm/mpc85xx.h>
+#include <mm/mmu_decl.h>
+#include <asm/prom.h>
+#include <asm/udbg.h>
+#include <asm/mpic.h>
+#include <asm/i8259.h>
+
+#include <sysdev/fsl_soc.h>
+#include <sysdev/fsl_pci.h>
+#include "mpc85xx.h"
+
+#undef DEBUG
+
+#ifdef DEBUG
+#define DBG(fmt, args...) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args)
+#else
+#define DBG(fmt, args...)
+#endif
+
+#ifdef CONFIG_PPC_I8259
+static void mpc8544_8259_cascade(unsigned int irq, struct irq_desc *desc)
+{
+	unsigned int cascade_irq = i8259_irq();
+
+	if (cascade_irq != NO_IRQ) {
+		generic_handle_irq(cascade_irq);
+	}
+	desc->chip->eoi(irq);
+}
+#endif	/* CONFIG_PPC_I8259 */
+
+void __init mpc8544_ds_pic_init(void)
+{
+	struct mpic *mpic;
+	struct resource r;
+	struct device_node *np = NULL;
+#ifdef CONFIG_PPC_I8259
+	struct device_node *cascade_node = NULL;
+	int cascade_irq;
+#endif
+
+	np = of_find_node_by_type(np, "open-pic");
+
+	if (np == NULL) {
+		printk(KERN_ERR "Could not find open-pic node\n");
+		return;
+	}
+
+	if (of_address_to_resource(np, 0, &r)) {
+		printk(KERN_ERR "Failed to map mpic register space\n");
+		of_node_put(np);
+		return;
+	}
+
+	mpic = mpic_alloc(np, r.start,
+			  MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
+			0, 256, " OpenPIC  ");
+	BUG_ON(mpic == NULL);
+
+	mpic_init(mpic);
+
+#ifdef CONFIG_PPC_I8259
+	/* Initialize the i8259 controller */
+	for_each_node_by_type(np, "interrupt-controller")
+	    if (of_device_is_compatible(np, "chrp,iic")) {
+		cascade_node = np;
+		break;
+	}
+
+	if (cascade_node == NULL) {
+		printk(KERN_DEBUG "Could not find i8259 PIC\n");
+		return;
+	}
+
+	cascade_irq = irq_of_parse_and_map(cascade_node, 0);
+	if (cascade_irq == NO_IRQ) {
+		printk(KERN_ERR "Failed to map cascade interrupt\n");
+		return;
+	}
+
+	DBG("mpc8544ds: cascade mapped to irq %d\n", cascade_irq);
+
+	i8259_init(cascade_node, 0);
+	of_node_put(cascade_node);
+
+	set_irq_chained_handler(cascade_irq, mpc8544_8259_cascade);
+#endif	/* CONFIG_PPC_I8259 */
+}
+
+#ifdef CONFIG_PCI
+extern int uses_fsl_uli_m1575;
+extern int uli_exclude_device(struct pci_controller *hose,
+				u_char bus, u_char devfn);
+
+static int mpc85xx_exclude_device(struct pci_controller *hose,
+				   u_char bus, u_char devfn)
+{
+	struct device_node* node;	
+	struct resource rsrc;
+
+	node = (struct device_node *)hose->arch_data;
+	of_address_to_resource(node, 0, &rsrc);
+
+	if ((rsrc.start & 0xfffff) == 0xb000) {
+		return uli_exclude_device(hose, bus, devfn);
+	}
+
+	return PCIBIOS_SUCCESSFUL;
+}
+#endif	/* CONFIG_PCI */
+
+/*
+ * Setup the architecture
+ */
+static void __init mpc8544_ds_setup_arch(void)
+{
+#ifdef CONFIG_PCI
+	struct device_node *np;
+#endif
+
+	if (ppc_md.progress)
+		ppc_md.progress("mpc8544_ds_setup_arch()", 0);
+
+#ifdef CONFIG_PCI
+	for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) {
+		struct resource rsrc;
+		of_address_to_resource(np, 0, &rsrc);
+		if ((rsrc.start & 0xfffff) == 0xb000)
+			fsl_add_bridge(np, 1);
+		else
+			fsl_add_bridge(np, 0);
+	}
+	uses_fsl_uli_m1575 = 1;
+	ppc_md.pci_exclude_device = mpc85xx_exclude_device;
+#endif
+
+	printk("MPC8544 DS board from Freescale Semiconductor\n");
+}
+
+/*
+ * Called very early, device-tree isn't unflattened
+ */
+static int __init mpc8544_ds_probe(void)
+{
+	unsigned long root = of_get_flat_dt_root();
+
+	return of_flat_dt_is_compatible(root, "MPC8544DS");
+}
+
+define_machine(mpc8544_ds) {
+	.name			= "MPC8544 DS",
+	.probe			= mpc8544_ds_probe,
+	.setup_arch		= mpc8544_ds_setup_arch,
+	.init_IRQ		= mpc8544_ds_pic_init,
+#ifdef CONFIG_PCI
+	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
+#endif
+	.get_irq		= mpic_get_irq,
+	.restart		= mpc85xx_restart,
+	.calibrate_decr		= generic_calibrate_decr,
+	.progress		= udbg_progress,
+};
-- 
1.5.2.4

^ permalink raw reply related

* [PATCH 03/22] [POWERPC] 85xx: Clean up from 85xx_ds rename
From: Kumar Gala @ 2007-09-13 21:07 UTC (permalink / raw)
  To: linuxppc-dev
In-Reply-To: <1189717683471-git-send-email-galak@kernel.crashing.org>

Renamed functions in 85xx_ds from 8544 to 85xx.

Kept an unique machine def/probe for the MPC8544 DS board to
handle some subtle differences between the future board based
on the DS platform.

Also fixed building w/o CONFIG_PCI and minor whitespace fixes.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
 arch/powerpc/platforms/85xx/mpc85xx_ds.c |   36 ++++++++++++++++++-----------
 1 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index 48983bc..3a5c3c4 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -1,5 +1,5 @@
 /*
- * MPC8544 DS Board Setup
+ * MPC85xx DS Board Setup
  *
  * Author Xianghua Xiao (x.xiao@freescale.com)
  * Roy Zang <tie-fei.zang@freescale.com>
@@ -44,7 +44,7 @@
 #endif
 
 #ifdef CONFIG_PPC_I8259
-static void mpc8544_8259_cascade(unsigned int irq, struct irq_desc *desc)
+static void mpc85xx_8259_cascade(unsigned int irq, struct irq_desc *desc)
 {
 	unsigned int cascade_irq = i8259_irq();
 
@@ -55,7 +55,7 @@ static void mpc8544_8259_cascade(unsigned int irq, struct irq_desc *desc)
 }
 #endif	/* CONFIG_PPC_I8259 */
 
-void __init mpc8544_ds_pic_init(void)
+void __init mpc85xx_ds_pic_init(void)
 {
 	struct mpic *mpic;
 	struct resource r;
@@ -104,16 +104,17 @@ void __init mpc8544_ds_pic_init(void)
 		return;
 	}
 
-	DBG("mpc8544ds: cascade mapped to irq %d\n", cascade_irq);
+	DBG("mpc85xxds: cascade mapped to irq %d\n", cascade_irq);
 
 	i8259_init(cascade_node, 0);
 	of_node_put(cascade_node);
 
-	set_irq_chained_handler(cascade_irq, mpc8544_8259_cascade);
+	set_irq_chained_handler(cascade_irq, mpc85xx_8259_cascade);
 #endif	/* CONFIG_PPC_I8259 */
 }
 
 #ifdef CONFIG_PCI
+static int primary_phb_addr;
 extern int uses_fsl_uli_m1575;
 extern int uli_exclude_device(struct pci_controller *hose,
 				u_char bus, u_char devfn);
@@ -121,13 +122,13 @@ extern int uli_exclude_device(struct pci_controller *hose,
 static int mpc85xx_exclude_device(struct pci_controller *hose,
 				   u_char bus, u_char devfn)
 {
-	struct device_node* node;	
+	struct device_node* node;
 	struct resource rsrc;
 
 	node = (struct device_node *)hose->arch_data;
 	of_address_to_resource(node, 0, &rsrc);
 
-	if ((rsrc.start & 0xfffff) == 0xb000) {
+	if ((rsrc.start & 0xfffff) == primary_phb_addr) {
 		return uli_exclude_device(hose, bus, devfn);
 	}
 
@@ -138,20 +139,20 @@ static int mpc85xx_exclude_device(struct pci_controller *hose,
 /*
  * Setup the architecture
  */
-static void __init mpc8544_ds_setup_arch(void)
+static void __init mpc85xx_ds_setup_arch(void)
 {
 #ifdef CONFIG_PCI
 	struct device_node *np;
 #endif
 
 	if (ppc_md.progress)
-		ppc_md.progress("mpc8544_ds_setup_arch()", 0);
+		ppc_md.progress("mpc85xx_ds_setup_arch()", 0);
 
 #ifdef CONFIG_PCI
 	for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) {
 		struct resource rsrc;
 		of_address_to_resource(np, 0, &rsrc);
-		if ((rsrc.start & 0xfffff) == 0xb000)
+		if ((rsrc.start & 0xfffff) == primary_phb_addr)
 			fsl_add_bridge(np, 1);
 		else
 			fsl_add_bridge(np, 0);
@@ -160,7 +161,7 @@ static void __init mpc8544_ds_setup_arch(void)
 	ppc_md.pci_exclude_device = mpc85xx_exclude_device;
 #endif
 
-	printk("MPC8544 DS board from Freescale Semiconductor\n");
+	printk("MPC85xx DS board from Freescale Semiconductor\n");
 }
 
 /*
@@ -170,14 +171,21 @@ static int __init mpc8544_ds_probe(void)
 {
 	unsigned long root = of_get_flat_dt_root();
 
-	return of_flat_dt_is_compatible(root, "MPC8544DS");
+	if (of_flat_dt_is_compatible(root, "MPC8544DS")) {
+#ifdef CONFIG_PCI
+		primary_phb_addr = 0xb000;
+#endif
+		return 1;
+	} else {
+		return 0;
+	}
 }
 
 define_machine(mpc8544_ds) {
 	.name			= "MPC8544 DS",
 	.probe			= mpc8544_ds_probe,
-	.setup_arch		= mpc8544_ds_setup_arch,
-	.init_IRQ		= mpc8544_ds_pic_init,
+	.setup_arch		= mpc85xx_ds_setup_arch,
+	.init_IRQ		= mpc85xx_ds_pic_init,
 #ifdef CONFIG_PCI
 	.pcibios_fixup_bus	= fsl_pcibios_fixup_bus,
 #endif
-- 
1.5.2.4

^ permalink raw reply related


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