Re: [PATCH 2/11] celleb: move the base part for celleb support

2008-03-06 Thread Ishizaki Kou
Arnd Bergmann <[EMAIL PROTECTED]> wrote:
> On Wednesday 05 March 2008, Ishizaki Kou wrote:
> > This patch moves the base code for celleb support into platforms/cell/.
> > All files in this patch are used by celleb-beat and celleb-native commonly.
> 
> Moving around the files this way is good, but
> 
> > +++ b/arch/powerpc/platforms/cell/Makefile   2008-03-04 
> > 14:00:28.0  +0900 
> > @@ -26,3 +26,20 @@
> >  ? spufs/
> > 
> >  obj-$(CONFIG_PCI_MSI)  += axon_msi.o
> > +
> > +
> > +# celleb stuff
> > +ifeq ($(CONFIG_PPC_CELLEB),y)
> > +obj-y  += celleb_setup.o \
> > +  celleb_pci.o celleb_scc_epci.o \
> > +  celleb_scc_pciex.o \
> > +  celleb_scc_uhc.o \
> > +  beat.o beat_htab.o beat_hvCall.o 
> > \
> > +  beat_interrupt.o beat_iommu.o \
> > +  io-workarounds.o spider-pci.o
> > +
> > +obj-$(CONFIG_SMP)  += beat_smp.o
> > +obj-$(CONFIG_PPC_UDBG_BEAT)+= beat_udbg.o
> > +obj-$(CONFIG_SERIAL_TXX9)  += celleb_scc_sio.o
> > +obj-$(CONFIG_SPU_BASE) += beat_spu_priv1.o
> > +endif
> 
> This looks like you are referencing files in the Makefile that are moved
> in the later patches. In order to make the git-bisect work correctly
> on the kernel after the patches are applied, I'd suggest either moving
> all files at once, or to modify the Makefile in every step of the way
> so that the kernel still builds.

Thanks for your advice.

I'll split changing the Makefile because the moving patches is too
large to be one patch.

Best regards,
Kou Ishizaki
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 2/2] Add local bus device nodes to MPC837xMDS device trees.

2008-03-06 Thread Segher Boessenkool
> This isn't a problem with this device tree, but it's probably time we
> started establishing some conventional generic names for nand flash
> and board-control devices.
>
> So, to start the ball rolling, I've seen several names for nand flash
> nodes, I'd suggest we standardise on "nand-flash".

What's wrong with the already well-established generic name "flash"?

> I've seen several variants for board control devices (cpld, bcsr,
> fpga, etc.) I suggest we standardise on "board-control"

Fine with me, but it's very vague (hard to avoid though).


Segher

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/5] generic __remove_pages() support

2008-03-06 Thread Yasunori Goto
Hi Badari-san.

> On Thu, 2008-03-06 at 12:54 -0800, Dave Hansen wrote:
> > On Thu, 2008-03-06 at 10:55 -0800, Badari Pulavarty wrote:
> > > +   if (memmap)
> > > +   __kfree_section_memmap(memmap, PAGES_PER_SECTION);
> > > +   return;
> > > +   }
> > > +
> > > +   /*
> > > +* Allocations came from bootmem - how do I free up ?
> > > +*/
> > > +
> > 
> > Shouldn't we figure this one out before merging?
> > 
> > I think we at least need a printk() there.
> 
> I can add a printk(). I am hoping Yasunori Goto has something to
> handle this, before we really merge into mainline.

Ah, yes. 
I'm making patches for around here. I'm sorry for your waiting.

BTW, do you hurry for merging your patch? 
To be honest, I would like to solve not only here
but also some other issues.
But, if you hurry, I'll concentrate to solve only this.

Bye.

-- 
Yasunori Goto 


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 3/4] Emerson KSI8560 device tree

2008-03-06 Thread Olof Johansson
On Fri, Mar 07, 2008 at 11:29:59AM +1100, David Gibson wrote:
> On Thu, Mar 06, 2008 at 06:14:51PM +0300, Alexandr Smirnov wrote:
> > Add device tree file for Emerson KSI8560 board.
> > 
> > Signed-off-by: Alexandr Smirnov <[EMAIL PROTECTED]>
> 
> [snip]
> > +   [EMAIL PROTECTED] {
> > +   #address-cells = <1>;
> > +   #size-cells = <1>;
> > +   device_type = "soc";
> 
> Since this is a new board, is it feasible to require it to have a
> sufficient new u-boot version that we don't require this old
> device_type entry.

Here's a novel idea:

What if the device tree police spent a little more time on fixing up
existing DTS files and booting-without-of.txt, and a little less time
making it as hard as possible for people to get new board ports in?

That way, at least they would be demanding of new submissions what is
documented and already accepted.

Current booting-without-of.txt still claims that /soc should have
device_type "soc".


-Olof
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


CFI_DEF_CFA instruction

2008-03-06 Thread Bai Shuwei
hi,
   all, from the web i find the definition is:
  .cfi_def_cfa defines a rule for computing CFA as: take adress from
register and add offeset to it.

There is a concept CFA i can't understand, what means of the CFA, and this
address point to where?

Best Regards!

Bai Shuwei


-- 
Add: Tianshui South Road 222, Lanzhou, P.R.China
Tel: +86-931-8912025
Zip Code: 73
Email: [EMAIL PROTECTED], [EMAIL PROTECTED]
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH] pasemi_dma: Driver for PA Semi PWRficient on-chip DMA engine

2008-03-06 Thread Olof Johansson
On Fri, Mar 07, 2008 at 11:31:50AM +1100, Stephen Rothwell wrote:
> Hi Olof,
> 
> Just one thing I noticed ...
> 
> On Thu, 6 Mar 2008 17:39:00 -0600 Olof Johansson <[EMAIL PROTECTED]> wrote:
> >
> > +   dma_dev->device_dependency_added = pasemi_dma_dependency_added;
> 
> device_dependency_added is going away in 2.6.26 ...

Thanks, I guess I need to base this on top of both powerpc and the
async-tx git trees and just merge it late.


-Olof
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] The MPC83xx family doesn't support performance monitor instructions

2008-03-06 Thread Jerry Van Baren
Kumar Gala wrote:
> On Mar 5, 2008, at 6:33 PM, Gerald Van Baren wrote:
> 
>> "Errata to MPC8349EA PowerQUICC[tm] II Pro Integrated Host Processor  
>> Family
>> Reference Manual, Rev. 1" (Freescale)
>>
>> Signed-off-by: Gerald Van Baren <[EMAIL PROTECTED]>
>> ---
>>
>> Hi Kumar,
>>
>> Please apply this fix to 2.6.25rc4 if possible.  Without this
>> patch, the PPC_83xx family configuration is broken (will not compile).
> 
> What's the compile issue?  Some of the 83xx family have perf mon so we  
> need to fix the compile issue.
> 
> - k

Hi Kumar,

The mpc8360 and mpc8349 do not have a perfmon register (I don't find it 
at all in the MPC8360RM and the mpc8349 errata I referenced says the 
MPC8349RM is in error).

The result is that the assembler dies with an error.  If the assembler 
didn't die with an error, I presume the kernel would since it is an 
invalid SPR.

   CC  arch/powerpc/kernel/pmc.o
{standard input}: Assembler messages:
{standard input}:7: Error: Unrecognized opcode: `mfpmr'
{standard input}:11: Error: Unrecognized opcode: `mtpmr'
make[1]: *** [arch/powerpc/kernel/pmc.o] Error 1
make: *** [arch/powerpc/kernel] Error 2

This is using ELDK4.1 (also 4.2rc) using the ppc_6xx- version of the 
compiler (which symlinks to powerpc-linux-gcc).

If some of the mpc83xx processors have perfmon registers, we need a more 
granular way of selecting the CONFIG_FSL_EMB_PERFMON option (or a Plan 
B, but I don't know what Plan B would be).

Best regards,
gvb
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] pasemi_dma: Driver for PA Semi PWRficient on-chip DMA engine

2008-03-06 Thread Stephen Rothwell
Hi Olof,

Just one thing I noticed ...

On Thu, 6 Mar 2008 17:39:00 -0600 Olof Johansson <[EMAIL PROTECTED]> wrote:
>
> + dma_dev->device_dependency_added = pasemi_dma_dependency_added;

device_dependency_added is going away in 2.6.26 ...

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/


pgpEQyoj1tvFF.pgp
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH 3/4] Emerson KSI8560 device tree

2008-03-06 Thread David Gibson
On Thu, Mar 06, 2008 at 06:14:51PM +0300, Alexandr Smirnov wrote:
> Add device tree file for Emerson KSI8560 board.
> 
> Signed-off-by: Alexandr Smirnov <[EMAIL PROTECTED]>

[snip]
> + [EMAIL PROTECTED] {
> + #address-cells = <1>;
> + #size-cells = <1>;
> + device_type = "soc";

Since this is a new board, is it feasible to require it to have a
sufficient new u-boot version that we don't require this old
device_type entry.

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 2/2] Add local bus device nodes to MPC837xMDS device trees.

2008-03-06 Thread David Gibson
[snip]
> + [EMAIL PROTECTED],0 {
> + reg = <1 0x0 0x8000>;
> + compatible = "fsl,mpc837xmds-bcsr";
> + };
> +
> + [EMAIL PROTECTED],0 {

This isn't a problem with this device tree, but it's probably time we
started establishing some conventional generic names for nand flash
and board-control devices.

So, to start the ball rolling, I've seen several names for nand flash
nodes, I'd suggest we standardise on "nand-flash".

I've seen several variants for board control devices (cpld, bcsr,
fpga, etc.) I suggest we standardise on "board-control"

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: ARCH=ppc -> ARCH=powerpc : help needed for dts file

2008-03-06 Thread Benjamin Herrenschmidt

On Fri, 2008-03-07 at 01:10 +0100, Philippe De Muyter wrote:
> 
> But I already noticed that the interrupt numbers that the arch/powerpc tree
> uses for the parts that do already work (compact-flash and serials) are
> different from the ones I saw on the running arch/ppc tree.  e.g.,
> the serial lines used irq 26 with the arch/ppc tree and now use 42 with
> the powerpc tree.  For the pci4520, irqs changed from 53, 54 and 55 in the
> arch/ppc kernel to 17, 18 and 19 with the arch/powerpc kernel.
> That's a little bit confusing.
> 
> There must be something hidden in the sources of the openpic driver to
> explain that difference.  Could it be fixed by a setting in the dts-file ?

The interrupt numbers that you see in /proc/interrupts and that drivers
see are "virtual". They have no direct relationship to the hardware
interrupt lines (well, the kernel attempts sometimes at keeping them the
same but not always).

Basially, when the kernel establishes interrupt routing when probing
devices, it gets dynamically assigned numbers and that's what drivers
and /proc/interrupts will see, and internally "binds" them to a given HW
source on a given interrupt controller.

This is done for several reasons, the main ones being that we have to
routinely deal with multiple controllers each having it's own hardware
number space, some systems have very large HW interrupt numbers not
suitable for the irq_desc array, and we reserve virtual numbers 0 as
always invalid and 1...15 for an ISA-type 8259 controller to avoid
problems with x86-oirignated legacy junk that tries to hard code those
numbers. 

There's an compile option to see the mapping between virtual numbers and
HW numbers in debugfs, try enabling debugfs, CONFIG_VIRQ_DEBUG, and
mount debugfs somewhere. You'll see a powerpc/virq_mapping file in there
with the mapping.

Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: ARCH=ppc -> ARCH=powerpc : help needed for dts file

2008-03-06 Thread Philippe De Muyter
Hi Ben,

On Thu, Mar 06, 2008 at 10:46:51AM +1100, Benjamin Herrenschmidt wrote:
> 
> > >>From your .dts, I see you've been doing some swizzling of slots using
> > > interrupts 1...4 ... do that correspond to EXTIRQ 58 ?
> > 
> > No, those correspond to the EXT1-4 that are the other side of the #ifdef 
> > for this board in arch/ppc. :-)
> 
> Yes, that's what I was thinking. So that's what he got wrong in
> his .dts.
> 
> Philippe, you need to fix those numbers so they map your EXTIRQ.
> 
> (that is 1 -> 5, 2 -> 6, etc... )
> 
> And of course you need to make sure you have the right routing to the
> chip. it's funny the way you keep providing all sort of info but -never-
> the one we actually asked for :-)

I did not have that.  The board has been designed, and the original linux
port has been made, by a third-party, and the documentation is scarce :(

> 
> We basically, to help you, need to know for each PCI device connected to
> the SoC, or PCI slot if you have such, which address line is used for
> IDSEL, and to which MPIC interrupt inputs.

Well, i have finally an answer for IDSEL : it is connected to AD18 (18 is
decimal), but we knew that actually, because the chip appears as :00:12.0,
:00:12.1 and :00:12.2 in the kernel messages.

The pci4520 chip does not have pins labelled inta, intb, intc, or intd,
but pins labelled mfunc0, mfunc1 ... mfunc6.
The pci4520 datasheet does not seem very clear to me about the relation
between the mfunc0..6 pins and the inta..d interrupts :(
Luckily, the running linux kernel shows in /proc/interrupts :

 55:  18797   OpenPIC   Level yenta, ide0
 54:  1   OpenPIC   Level yenta
 55: 79   OpenPIC   Level ohci1394

I can thus deduce that each function of the pci4520 chip uses only
one interrupt line.  With the kernel messages at startup, I also
know that the two yenta's are 12.0 and 12.1 and the ohci1394 is 12.2.
I wrote then the following in my dts file :

[EMAIL PROTECTED] {
/*
  f800 masks idsel address line
  07 masks (sub)function number
   7 masks INTA, INTB, INTC or INTD
*/
interrupt-map-mask = ;
interrupt-map = <
/* IDSEL 0x12 func 0 */
9000 0 0 1 &mpic 5 1
9000 0 0 2 &mpic 5 1
9000 0 0 3 &mpic 5 1
9000 0 0 4 &mpic 5 1

/* IDSEL 0x12 func 1 */
9100 0 0 1 &mpic 6 1
9100 0 0 2 &mpic 6 1
9100 0 0 3 &mpic 6 1
9100 0 0 4 &mpic 6 1

/* IDSEL 0x12 func 2 */
9200 0 0 1 &mpic 7 1
9200 0 0 2 &mpic 7 1
9200 0 0 3 &mpic 7 1
9200 0 0 4 &mpic 7 1
>;

And it works :) : my board boots and finds its compact-flash disk.  When
writing this, I realize I may simplify my interrupt-map and write
only one config line per function, thus :

interrupt-map-mask = ;
interrupt-map = <
/* IDSEL 0x12 func 0 */
9000 0 0 0 &mpic 5 1

/* IDSEL 0x12 func 1 */
9100 0 0 0 &mpic 6 1

/* IDSEL 0x12 func 2 */
9200 0 0 0 &mpic 7 1
>;

Maybe you should explain in booting_without_of.txt the relation between
the idsel and the pci device notation used by lspci or the kernel, and
also document the "function" part ?

> 
> Once you have given us that, we'll be able to help.
> 
> It appears that just looking at the arch/ppc code is a bit too messy and
> confusing (and not necessarily right).
> 
> In addition, you will also need to do proper interrupt routing for you
> other devices (RTC, etc...) but we can look at that separately.

That's for tomorrow.

But I already noticed that the interrupt numbers that the arch/powerpc tree
uses for the parts that do already work (compact-flash and serials) are
different from the ones I saw on the running arch/ppc tree.  e.g.,
the serial lines used irq 26 with the arch/ppc tree and now use 42 with
the powerpc tree.  For the pci4520, irqs changed from 53, 54 and 55 in the
arch/ppc kernel to 17, 18 and 19 with the arch/powerpc kernel.
That's a little bit confusing.

There must be something hidden in the sources of the openpic driver to
explain that difference.  Could it be fixed by a setting in the dts-file ?

Thanks for you help

Philippe
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/5] generic __remove_pages() support

2008-03-06 Thread Badari Pulavarty
Here is the latest version, addressing Randy and Dave's comments.

Thanks,
Badari

Generic helper function to remove section mappings and sysfs entries
for the section of the memory we are removing.  offline_pages() correctly 
adjusted zone and marked the pages reserved.

Issue: If mem_map, usemap allocation could come from different places -
kmalloc, vmalloc, alloc_pages or bootmem. There is no easy way
to find and free up bootmem allocations.

Signed-off-by: Badari Pulavarty <[EMAIL PROTECTED]>

---
 include/linux/memory_hotplug.h |6 +++-
 mm/memory_hotplug.c|   55 +
 mm/sparse.c|   45 +++--
 3 files changed, 102 insertions(+), 4 deletions(-)

Index: linux-2.6.25-rc3.save/mm/memory_hotplug.c
===
--- linux-2.6.25-rc3.save.orig/mm/memory_hotplug.c  2008-03-05 
10:44:30.0 -0800
+++ linux-2.6.25-rc3.save/mm/memory_hotplug.c   2008-03-06 15:08:45.0 
-0800
@@ -102,6 +102,21 @@ static int __add_section(struct zone *zo
return register_new_memory(__pfn_to_section(phys_start_pfn));
 }
 
+static int __remove_section(struct zone *zone, struct mem_section *ms)
+{
+   int ret = -EINVAL;
+
+   if (!valid_section(ms))
+   return ret;
+
+   ret = unregister_memory_section(ms);
+   if (ret)
+   return ret;
+
+   sparse_remove_one_section(zone, ms);
+   return 0;
+}
+
 /*
  * Reasonably generic function for adding memory.  It is
  * expected that archs that support memory hotplug will
@@ -135,6 +150,46 @@ int __add_pages(struct zone *zone, unsig
 }
 EXPORT_SYMBOL_GPL(__add_pages);
 
+/**
+ * __remove_pages() - remove sections of pages from a zone
+ * @zone: zone from which pages need to be removed
+ * @phys_start_pfn: starting pageframe (must be aligned to start of a section)
+ * @nr_pages: number of pages to remove (must be multiple of section size)
+ *
+ * Generic helper function to remove section mappings and sysfs entries
+ * for the section of the memory we are removing. Caller needs to make
+ * sure that pages are marked reserved and zones are adjust properly by
+ * calling offline_pages().
+ */
+int __remove_pages(struct zone *zone, unsigned long phys_start_pfn,
+unsigned long nr_pages)
+{
+   unsigned long i, ret = 0;
+   int sections_to_remove;
+   unsigned long flags;
+   struct pglist_data *pgdat = zone->zone_pgdat;
+
+   /*
+* We can only remove entire sections
+*/
+   BUG_ON(phys_start_pfn & ~PAGE_SECTION_MASK);
+   BUG_ON(nr_pages % PAGES_PER_SECTION);
+
+   release_mem_region(phys_start_pfn << PAGE_SHIFT, nr_pages * PAGE_SIZE);
+
+   sections_to_remove = nr_pages / PAGES_PER_SECTION;
+   for (i = 0; i < sections_to_remove; i++) {
+   unsigned long pfn = phys_start_pfn + i*PAGES_PER_SECTION;
+   pgdat_resize_lock(pgdat, &flags);
+   ret = __remove_section(zone, __pfn_to_section(pfn));
+   pgdat_resize_unlock(pgdat, &flags);
+   if (ret)
+   break;
+   }
+   return ret;
+}
+EXPORT_SYMBOL_GPL(__remove_pages);
+
 static void grow_zone_span(struct zone *zone,
unsigned long start_pfn, unsigned long end_pfn)
 {
Index: linux-2.6.25-rc3.save/mm/sparse.c
===
--- linux-2.6.25-rc3.save.orig/mm/sparse.c  2008-03-05 10:44:30.0 
-0800
+++ linux-2.6.25-rc3.save/mm/sparse.c   2008-03-06 15:15:18.0 -0800
@@ -198,12 +198,13 @@ static unsigned long sparse_encode_mem_m
 }
 
 /*
- * We need this if we ever free the mem_maps.  While not implemented yet,
- * this function is included for parity with its sibling.
+ * Decode mem_map from the coded memmap
  */
-static __attribute((unused))
+static
 struct page *sparse_decode_mem_map(unsigned long coded_mem_map, unsigned long 
pnum)
 {
+   /* mask off the extra low bits of information */
+   coded_mem_map &= SECTION_MAP_MASK;
return ((struct page *)coded_mem_map) + section_nr_to_pfn(pnum);
 }
 
@@ -363,6 +364,28 @@ static void __kfree_section_memmap(struc
 }
 #endif /* CONFIG_SPARSEMEM_VMEMMAP */
 
+static void free_section_usemap(struct page *memmap, unsigned long *usemap)
+{
+   if (!usemap)
+   return;
+
+   /*
+* Check to see if allocation came from hot-plug-add
+*/
+   if (PageSlab(virt_to_page(usemap))) {
+   kfree(usemap);
+   if (memmap)
+   __kfree_section_memmap(memmap, PAGES_PER_SECTION);
+   return;
+   }
+
+   /*
+* TODO: Allocations came from bootmem - how do I free up ?
+*/
+   printk(KERN_WARNING "Not freeing up allocations from bootmem "
+   "- leaking memory\n");
+}
+
 /*
  * returns the number of sections whose mem_

[PATCH] pasemi_dma: Driver for PA Semi PWRficient on-chip DMA engine

2008-03-06 Thread Olof Johansson
pasemi_dma: Driver for PA Semi PWRficient on-chip DMA engine

First cut at a dma copy offload driver for PA Semi PWRficient. It uses the
platform-specific functions to allocate channels, etc.

Signed-off-by: Olof Johansson <[EMAIL PROTECTED]>


---

This has some dependencies on other patches currently queued up in the
powerpc git trees for 2.6.26. I'd appreciate reviews and acked-bys, but
it might be easiest to just merge it up the powerpc path due to the
dependencies.


-Olof

diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig
index 27340a7..bbeaf10 100644
--- a/drivers/dma/Kconfig
+++ b/drivers/dma/Kconfig
@@ -54,6 +54,13 @@ config FSL_DMA_SELFTEST
  Enable the self test for each DMA channel. A self test will be
  performed after the channel probed to ensure the DMA works well.
 
+config PASEMI_DMA
+   tristate "PA Semi DMA Engine support"
+   depends on PPC_PASEMI
+   select DMA_ENGINE
+   help
+ Enable support for the DMA Engine on PA Semi PWRficient SoCs
+
 config DMA_ENGINE
bool
 
diff --git a/drivers/dma/Makefile b/drivers/dma/Makefile
index c8036d9..6729959 100644
--- a/drivers/dma/Makefile
+++ b/drivers/dma/Makefile
@@ -4,3 +4,4 @@ obj-$(CONFIG_INTEL_IOATDMA) += ioatdma.o
 ioatdma-objs := ioat.o ioat_dma.o ioat_dca.o
 obj-$(CONFIG_INTEL_IOP_ADMA) += iop-adma.o
 obj-$(CONFIG_FSL_DMA) += fsldma.o
+obj-$(CONFIG_PASEMI_DMA) += pasemi_dma.o
diff --git a/drivers/dma/pasemi_dma.c b/drivers/dma/pasemi_dma.c
new file mode 100644
index 000..844ab11
--- /dev/null
+++ b/drivers/dma/pasemi_dma.c
@@ -0,0 +1,478 @@
+/*
+ * Driver for the PA Semi PWRficient DMA Engine (copy parts)
+ * Copyright (c) 2007,2008 Olof Johansson, PA Semi, Inc
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define MAX_CH 16
+#define MAX_XFER 0x4
+#define RING_SZ8192
+
+struct pasemi_dma_desc {
+   u64 src;
+   u64 dest;
+   dma_addr_t  src_dma;
+   dma_addr_t  dest_dma;
+   size_t len;
+   struct list_head node;
+   int tx_cnt;
+   struct dma_async_tx_descriptor async_tx;
+   struct pasemi_dma_chan *chan;
+};
+
+struct pasemi_dma_chan {
+   struct pasemi_dmachan chan;
+   spinlock_t ring_lock;   /* Protects the ring only */
+   spinlock_t desc_lock;   /* Protects the descriptor list */
+   struct pasemi_dma *dma_dev;
+   struct pasemi_dma_desc *ring_info[RING_SZ]; /* softc */
+   unsigned int   next_to_fill;
+   unsigned int   next_to_clean;
+   struct dma_chancommon;
+   struct list_head   free_desc;
+   intdesc_count;
+   intin_use;
+};
+
+struct pasemi_dma {
+   struct pci_dev *pdev;
+   struct dma_device common;
+   struct pasemi_dma_chan *chans[MAX_CH];
+};
+
+static unsigned int channels = 4;
+module_param(channels, uint, S_IRUGO);
+MODULE_PARM_DESC(channels, "Number of channels for copy (default: 2)");
+
+#define to_pasemi_dma_chan(chan) container_of(chan, struct pasemi_dma_chan, \
+ common)
+#define to_pasemi_dma_desc(lh) container_of(lh, struct pasemi_dma_desc, node)
+#define tx_to_desc_sw(tx) container_of(tx, struct pasemi_dma_desc, async_tx)
+
+static void pasemi_dma_clean(struct pasemi_dma_chan *chan)
+{
+   int old, new, i;
+   unsigned long flags;
+   struct pasemi_dma_desc *desc;
+   spin_lock_irqsave(&chan->desc_lock, flags);
+
+   old = chan->next_to_clean;
+
+   new = *chan->chan.status & PAS_STATUS_PCNT_M;
+   new <<= 2;
+   new &= (RING_SZ-1);
+
+   if (old > new)
+   new += RING_SZ;
+
+   for (i = old; i < new; i += 4) {
+   if (unlikely(chan->chan.ring_virt[i & (RING_SZ-1)] & 
XCT_COPY_O))
+   break;
+   desc = chan->ring_info[i & (RING_SZ-1)];
+   list_add_tail(&desc->node, &chan->free_desc);
+   }
+
+   chan->next_to_clean = i & (RING_SZ-1);
+
+   spin_unlock_irqrestore(&chan->desc_lock, flags);
+}
+
+static int pasemi_dma_intr(int irq, void *data)
+{
+   struct pasemi_dma_chan *chan = data;
+   unsigned int cmdsta;
+
+   cmdsta = pasemi_read_dma_reg(PAS_DMA_TXCHAN_TCMDSTA(chan->chan.chno));

Re: Please pull pasemi.git for-2.6.26 branch

2008-03-06 Thread Olof Johansson
On Fri, Mar 07, 2008 at 09:15:38AM +1100, Paul Mackerras wrote:
> Olof Johansson writes:
> 
> > Please pull from 'for-2.6.26' branch of
> > 
> >   master.kernel.org:/pub/scm/linux/kernel/git/olof/pasemi.git for-2.6.26
> > 
> > to receive the following updates. They have all been posted to the list
> > previously, and had only minor updates to remove a couple of compiler
> > warnings:
> > 
> >  arch/powerpc/platforms/pasemi/dma_lib.c |  144 ++
> >  drivers/net/Makefile|3 
> >  drivers/net/pasemi_mac.c|  324 
> > ++--
> >  drivers/net/pasemi_mac.h|   35 +++
> >  drivers/net/pasemi_mac_ethtool.c|  159 +++
> >  include/asm-powerpc/pasemi_dma.h|   77 +++
> >  6 files changed, 681 insertions(+), 61 deletions(-)
> 
> Is Jeff Garzik OK with those pasemi_mac_* updates going via my tree?

Yes, he explicitly asked for it last week:

http://ozlabs.org/pipermail/linuxppc-dev/2008-February/052227.html


-Olof
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Please pull pasemi.git for-2.6.26 branch

2008-03-06 Thread Paul Mackerras
Olof Johansson writes:

> Please pull from 'for-2.6.26' branch of
> 
>   master.kernel.org:/pub/scm/linux/kernel/git/olof/pasemi.git for-2.6.26
> 
> to receive the following updates. They have all been posted to the list
> previously, and had only minor updates to remove a couple of compiler
> warnings:
> 
>  arch/powerpc/platforms/pasemi/dma_lib.c |  144 ++
>  drivers/net/Makefile|3 
>  drivers/net/pasemi_mac.c|  324 
> ++--
>  drivers/net/pasemi_mac.h|   35 +++
>  drivers/net/pasemi_mac_ethtool.c|  159 +++
>  include/asm-powerpc/pasemi_dma.h|   77 +++
>  6 files changed, 681 insertions(+), 61 deletions(-)

Is Jeff Garzik OK with those pasemi_mac_* updates going via my tree?

Paul.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/5] generic __remove_pages() support

2008-03-06 Thread Badari Pulavarty
On Thu, 2008-03-06 at 12:54 -0800, Dave Hansen wrote:
> On Thu, 2008-03-06 at 10:55 -0800, Badari Pulavarty wrote:
> > +   if (memmap)
> > +   __kfree_section_memmap(memmap, PAGES_PER_SECTION);
> > +   return;
> > +   }
> > +
> > +   /*
> > +* Allocations came from bootmem - how do I free up ?
> > +*/
> > +
> 
> Shouldn't we figure this one out before merging?
> 
> I think we at least need a printk() there.

I can add a printk(). I am hoping Yasunori Goto has something to
handle this, before we really merge into mainline.

Thanks,
Badari

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Please pull pasemi.git for-2.6.26 branch

2008-03-06 Thread Olof Johansson
Hi Paul,

Please pull from 'for-2.6.26' branch of

  master.kernel.org:/pub/scm/linux/kernel/git/olof/pasemi.git for-2.6.26

to receive the following updates. They have all been posted to the list
previously, and had only minor updates to remove a couple of compiler
warnings:

 arch/powerpc/platforms/pasemi/dma_lib.c |  144 ++
 drivers/net/Makefile|3 
 drivers/net/pasemi_mac.c|  324 ++--
 drivers/net/pasemi_mac.h|   35 +++
 drivers/net/pasemi_mac_ethtool.c|  159 +++
 include/asm-powerpc/pasemi_dma.h|   77 +++
 6 files changed, 681 insertions(+), 61 deletions(-)

Olof Johansson (6):
  pasemi_mac: Move RX/TX section enablement to dma_lib
  [POWERPC] pasemi: Add flag management functions to dma_lib
  [POWERPC] pasemi: Add function engine management functions to dma_lib
  pasemi_mac: jumbo frame support
  pasemi_mac: Enable GSO by default
  pasemi_mac: basic ethtool support

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/5] generic __remove_pages() support

2008-03-06 Thread Dave Hansen
On Thu, 2008-03-06 at 10:55 -0800, Badari Pulavarty wrote:
> +   if (memmap)
> +   __kfree_section_memmap(memmap, PAGES_PER_SECTION);
> +   return;
> +   }
> +
> +   /*
> +* Allocations came from bootmem - how do I free up ?
> +*/
> +

Shouldn't we figure this one out before merging?

I think we at least need a printk() there.

-- Dave

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/5] generic __remove_pages() support

2008-03-06 Thread Randy Dunlap
On Thu, 06 Mar 2008 10:55:34 -0800 Badari Pulavarty wrote:

> Generic helper function to remove section mappings and sysfs entries
> for the section of the memory we are removing.  offline_pages() correctly 
> adjusted zone and marked the pages reserved.

Such generic (exported, non-static) interfaces could use some
(kernel-)docs, please.

> Issue: If mem_map, usemap allocation could come from different places -
> kmalloc, vmalloc, alloc_pages or bootmem. There is no easy way
> to find and free up bootmem allocations.
> 
> Signed-off-by: Badari Pulavarty <[EMAIL PROTECTED]>
> 
> ---
>  include/linux/memory_hotplug.h |4 +++
>  mm/memory_hotplug.c|   44 
> +
>  mm/sparse.c|   43 
> +---
>  3 files changed, 88 insertions(+), 3 deletions(-)

> Index: linux-2.6.25-rc2/include/linux/memory_hotplug.h
> ===
> --- linux-2.6.25-rc2.orig/include/linux/memory_hotplug.h  2008-02-27 
> 12:58:17.0 -0800
> +++ linux-2.6.25-rc2/include/linux/memory_hotplug.h   2008-02-27 
> 13:00:04.0 -0800
> @@ -64,6 +65,8 @@ extern int offline_pages(unsigned long, 
>  /* reasonably generic interface to expand the physical pages in a zone  */
>  extern int __add_pages(struct zone *zone, unsigned long start_pfn,
>   unsigned long nr_pages);
> +extern int __remove_pages(struct zone *zone, unsigned long start_pfn,
> + unsigned long nr_pages);
>  
>  /*
>   * Walk thorugh all memory which is registered as resource.

   through :)

---
~Randy
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/2] firewire: endianess fix

2008-03-06 Thread Gabriel Paubert
On Thu, Mar 06, 2008 at 12:26:00AM +0100, Stefan Richter wrote:
> Gabriel Paubert wrote:
> >>>I have a Pismo which I use on a virtually
> >>>daily basis (and about to remove the last remnants of MacOS on it). 
> >>>However I have disabled Firewire because it would not sleep and wake 
> >>>up properly. 
> ...
> >For now I have only tested the new stack with a 6 year old 1.8" disk
> >and everything works, including suspend to RAM. The kernel is 2.6.25-rc4
> >plus additional pull from linux1394-2.6.git: 2.6.25-rc4-00032-g8d36ba4.
> 
> That's great.  Thanks for testing.

The old stack also works. I forgot to mention that with the new
stack (not with the old) there is a message when going to sleep:

firewire_ohci: pci_set_power_state failed with -5

but it is harmless, and if I understand correctly due to the 
fact that the power management on this chip is not implemented 
through capability fields in the PCI configuration space.

Gabriel
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/5] generic __remove_pages() support

2008-03-06 Thread Badari Pulavarty
On Thu, 2008-03-06 at 11:08 -0800, Randy Dunlap wrote:
> On Thu, 06 Mar 2008 10:55:34 -0800 Badari Pulavarty wrote:
> 
> > Generic helper function to remove section mappings and sysfs entries
> > for the section of the memory we are removing.  offline_pages() correctly 
> > adjusted zone and marked the pages reserved.
> 
> Such generic (exported, non-static) interfaces could use some
> (kernel-)docs, please.

Sure. Will do.

> > Issue: If mem_map, usemap allocation could come from different places -
> > kmalloc, vmalloc, alloc_pages or bootmem. There is no easy way
> > to find and free up bootmem allocations.
> > 
> > Signed-off-by: Badari Pulavarty <[EMAIL PROTECTED]>
> > 
> > ---
> >  include/linux/memory_hotplug.h |4 +++
> >  mm/memory_hotplug.c|   44 
> > +
> >  mm/sparse.c|   43 
> > +---
> >  3 files changed, 88 insertions(+), 3 deletions(-)
> 
> > Index: linux-2.6.25-rc2/include/linux/memory_hotplug.h
> > ===
> > --- linux-2.6.25-rc2.orig/include/linux/memory_hotplug.h2008-02-27 
> > 12:58:17.0 -0800
> > +++ linux-2.6.25-rc2/include/linux/memory_hotplug.h 2008-02-27 
> > 13:00:04.0 -0800
> > @@ -64,6 +65,8 @@ extern int offline_pages(unsigned long, 
> >  /* reasonably generic interface to expand the physical pages in a zone  */
> >  extern int __add_pages(struct zone *zone, unsigned long start_pfn,
> > unsigned long nr_pages);
> > +extern int __remove_pages(struct zone *zone, unsigned long start_pfn,
> > +   unsigned long nr_pages);
> >  
> >  /*
> >   * Walk thorugh all memory which is registered as resource.
> 
>through :)

I will fix that.

Thanks,
Badari

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 5/5] [PPC] provide walk_memory_resource() for ppc

2008-03-06 Thread Badari Pulavarty
Provide walk_memory_resource() for ppc64. PPC maintains 
logic memory region mapping in lmb.memory structures. Walk
through these structures and do the callbacks for the
contiguous chunks.

Signed-off-by: Badari Pulavarty <[EMAIL PROTECTED]>
---
 arch/powerpc/mm/mem.c |   30 +++---
 include/linux/lmb.h   |1 +
 lib/lmb.c |   33 +
 3 files changed, 57 insertions(+), 7 deletions(-)

Index: linux-2.6.25-rc3/lib/lmb.c
===
--- linux-2.6.25-rc3.orig/lib/lmb.c 2008-03-05 10:28:55.0 -0800
+++ linux-2.6.25-rc3/lib/lmb.c  2008-03-05 10:34:01.0 -0800
@@ -416,3 +416,36 @@ int __init lmb_is_reserved(u64 addr)
}
return 0;
 }
+
+/*
+ * Given a , find which memory regions belong to this range.
+ * Adjust the request and return a contiguous chunk.
+ */
+int lmb_find(struct lmb_property *res)
+{
+   int i;
+   u64 rstart, rend;
+
+   rstart = res->base;
+   rend = rstart + res->size - 1;
+
+   for (i = 0; i < lmb.memory.cnt; i++) {
+   u64 start = lmb.memory.region[i].base;
+   u64 end = start + lmb.memory.region[i].size - 1;
+
+   if (start > rend)
+   return -1;
+
+   if ((end >= rstart) && (start < rend)) {
+   /* adjust the request */
+   if (rstart < start)
+   rstart = start;
+   if (rend > end)
+   rend = end;
+   res->base = rstart;
+   res->size = rend - rstart + 1;
+   return 0;
+   }
+   }
+   return -1;
+}
Index: linux-2.6.25-rc3/arch/powerpc/mm/mem.c
===
--- linux-2.6.25-rc3.orig/arch/powerpc/mm/mem.c 2008-03-05 10:14:28.0 
-0800
+++ linux-2.6.25-rc3/arch/powerpc/mm/mem.c  2008-03-05 10:32:16.0 
-0800
@@ -148,19 +148,35 @@ out:
 
 /*
  * walk_memory_resource() needs to make sure there is no holes in a given
- * memory range. On PPC64, since this range comes from /sysfs, the range
- * is guaranteed to be valid, non-overlapping and can not contain any
- * holes. By the time we get here (memory add or remove), /proc/device-tree
- * is updated and correct. Only reason we need to check against device-tree
- * would be if we allow user-land to specify a memory range through a
- * system call/ioctl etc. instead of doing offline/online through /sysfs.
+ * memory range. PPC64 does not maintain the memory layout in /proc/iomem.
+ * Instead it maintains it in lmb.memory structures. Walk through the
+ * memory regions, find holes and callback for contiguous regions.
  */
 int
 walk_memory_resource(unsigned long start_pfn, unsigned long nr_pages, void 
*arg,
int (*func)(unsigned long, unsigned long, void *))
 {
-   return  (*func)(start_pfn, nr_pages, arg);
+   struct lmb_property res;
+   unsigned long pfn, len;
+   u64 end;
+   int ret = -1;
+
+   res.base = (u64) start_pfn << PAGE_SHIFT;
+   res.size = (u64) nr_pages << PAGE_SHIFT;
+
+   end = res.base + res.size - 1;
+   while ((res.base < end) && (lmb_find(&res) >= 0)) {
+   pfn = (unsigned long)(res.base >> PAGE_SHIFT);
+   len = (unsigned long)(res.size >> PAGE_SHIFT);
+   ret = (*func)(pfn, len, arg);
+   if (ret)
+   break;
+   res.base += (res.size + 1);
+   res.size = (end - res.base + 1);
+   }
+   return ret;
 }
+EXPORT_SYMBOL_GPL(walk_memory_resource);
 
 #endif /* CONFIG_MEMORY_HOTPLUG */
 
Index: linux-2.6.25-rc3/include/linux/lmb.h
===
--- linux-2.6.25-rc3.orig/include/linux/lmb.h   2008-03-05 10:30:06.0 
-0800
+++ linux-2.6.25-rc3/include/linux/lmb.h2008-03-05 10:33:12.0 
-0800
@@ -52,6 +52,7 @@ extern u64 __init lmb_phys_mem_size(void
 extern u64 __init lmb_end_of_DRAM(void);
 extern void __init lmb_enforce_memory_limit(u64 memory_limit);
 extern int __init lmb_is_reserved(u64 addr);
+extern int lmb_find(struct lmb_property *res);
 
 extern void lmb_dump_all(void);
 


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 4/5] [PPC] update lmb for hotplug memory add/remove

2008-03-06 Thread Badari Pulavarty
ppc kernel maintains information about logical memory blocks in
lmb.memory structure at the boot time. Its not updated for
hotplug memory add/remove. hotplug memory notifier for memory
add/remove now updates lmb.memory.

This information is useful for eHEA driver to find out the memory 
layout and holes.

NOTE: Calls to lmb_add() and lmb_remove() needs to be serialized by 
the caller. In this case blocking_notifier_chain(pSeries_reconfig_chain)
does that.

Signed-off-by: Badari Pulavarty <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/pseries/hotplug-memory.c |   43 +++
 include/linux/lmb.h |3 -
 lib/lmb.c   |   66 
 3 files changed, 102 insertions(+), 10 deletions(-)

Index: linux-2.6.25-rc3/lib/lmb.c
===
--- linux-2.6.25-rc3.orig/lib/lmb.c 2008-03-05 10:44:29.0 -0800
+++ linux-2.6.25-rc3/lib/lmb.c  2008-03-05 10:44:56.0 -0800
@@ -54,14 +54,13 @@ void lmb_dump_all(void)
 #endif /* DEBUG */
 }
 
-static unsigned long __init lmb_addrs_overlap(u64 base1,
-   u64 size1, u64 base2, u64 size2)
+static unsigned long lmb_addrs_overlap(u64 base1, u64 size1, u64 base2,
+   u64 size2)
 {
return ((base1 < (base2+size2)) && (base2 < (base1+size1)));
 }
 
-static long __init lmb_addrs_adjacent(u64 base1, u64 size1,
-   u64 base2, u64 size2)
+static long lmb_addrs_adjacent(u64 base1, u64 size1, u64 base2, u64 size2)
 {
if (base2 == base1 + size1)
return 1;
@@ -71,7 +70,7 @@ static long __init lmb_addrs_adjacent(u6
return 0;
 }
 
-static long __init lmb_regions_adjacent(struct lmb_region *rgn,
+static long lmb_regions_adjacent(struct lmb_region *rgn,
unsigned long r1, unsigned long r2)
 {
u64 base1 = rgn->region[r1].base;
@@ -82,7 +81,7 @@ static long __init lmb_regions_adjacent(
return lmb_addrs_adjacent(base1, size1, base2, size2);
 }
 
-static void __init lmb_remove_region(struct lmb_region *rgn, unsigned long r)
+static void lmb_remove_region(struct lmb_region *rgn, unsigned long r)
 {
unsigned long i;
 
@@ -94,7 +93,7 @@ static void __init lmb_remove_region(str
 }
 
 /* Assumption: base addr of region 1 < base addr of region 2 */
-static void __init lmb_coalesce_regions(struct lmb_region *rgn,
+static void lmb_coalesce_regions(struct lmb_region *rgn,
unsigned long r1, unsigned long r2)
 {
rgn->region[r1].size += rgn->region[r2].size;
@@ -129,7 +128,7 @@ void __init lmb_analyze(void)
 }
 
 /* This routine called with relocation disabled. */
-static long __init lmb_add_region(struct lmb_region *rgn, u64 base, u64 size)
+static long lmb_add_region(struct lmb_region *rgn, u64 base, u64 size)
 {
unsigned long coalesced = 0;
long adjacent, i;
@@ -195,7 +194,7 @@ static long __init lmb_add_region(struct
 }
 
 /* This routine may be called with relocation disabled. */
-long __init lmb_add(u64 base, u64 size)
+long lmb_add(u64 base, u64 size)
 {
struct lmb_region *_rgn = &(lmb.memory);
 
@@ -207,6 +206,55 @@ long __init lmb_add(u64 base, u64 size)
 
 }
 
+long lmb_remove(u64 base, u64 size)
+{
+   struct lmb_region *rgn = &(lmb.memory);
+   u64 rgnbegin, rgnend;
+   u64 end = base + size;
+   int i;
+
+   rgnbegin = rgnend = 0; /* supress gcc warnings */
+
+   /* Find the region where (base, size) belongs to */
+   for (i=0; i < rgn->cnt; i++) {
+   rgnbegin = rgn->region[i].base;
+   rgnend = rgnbegin + rgn->region[i].size;
+
+   if ((rgnbegin <= base) && (end <= rgnend))
+   break;
+   }
+
+   /* Didn't find the region */
+   if (i == rgn->cnt)
+   return -1;
+
+   /* Check to see if we are removing entire region */
+   if ((rgnbegin == base) && (rgnend == end)) {
+   lmb_remove_region(rgn, i);
+   return 0;
+   }
+
+   /* Check to see if region is matching at the front */
+   if (rgnbegin == base) {
+   rgn->region[i].base = end;
+   rgn->region[i].size -= size;
+   return 0;
+   }
+
+   /* Check to see if the region is matching at the end */
+   if (rgnend == end) {
+   rgn->region[i].size -= size;
+   return 0;
+   }
+
+   /*
+* We need to split the entry -  adjust the current one to the
+* beginging of the hole and add the region after hole.
+*/
+   rgn->region[i].size = base - rgn->region[i].base;
+   return lmb_add_region(rgn, end, rgnend - end);
+}
+
 long __init lmb_reserve(u64 base, u64 size)
 {
struct lmb_region *_rgn = &(lmb.reserved);
Index: linux-2.6.25-rc3/arch/powerpc/platforms/pseries/hotplug-memory.c
===
--- linux-2.6.25-rc3.orig/a

[PATCH 3/5] [PPC] hotplug memory notifications for ppc

2008-03-06 Thread Badari Pulavarty
Hotplug memory notifier for ppc64. This gets invoked by writing
the device-node that needs to be removed to /proc/ppc64/ofdt.
We need to adjust the sections and remove sysfs entries by
calling __remove_pages(). Then call arch specific code to
get rid of htab mappings for the section of memory.

Signed-off-by: Badari Pulavarty <[EMAIL PROTECTED]>
Reviewed-by: Michael Ellerman <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/pseries/Makefile |1 
 arch/powerpc/platforms/pseries/hotplug-memory.c |   98 
 2 files changed, 99 insertions(+)

Index: linux-2.6.25-rc2/arch/powerpc/platforms/pseries/hotplug-memory.c
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux-2.6.25-rc2/arch/powerpc/platforms/pseries/hotplug-memory.c
2008-02-29 09:25:14.0 -0800
@@ -0,0 +1,98 @@
+/*
+ * pseries Memory Hotplug infrastructure.
+ *
+ * Copyright (C) 2008 Badari Pulavarty, IBM Corporation
+ *
+ *  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 
+#include 
+#include 
+#include 
+
+static int pseries_remove_memory(struct device_node *np)
+{
+   const char *type;
+   const unsigned int *my_index;
+   const unsigned int *regs;
+   u64 start_pfn, start;
+   struct zone *zone;
+   int ret = -EINVAL;
+
+   /*
+* Check to see if we are actually removing memory
+*/
+   type = of_get_property(np, "device_type", NULL);
+   if (type == NULL || strcmp(type, "memory") != 0)
+   return 0;
+
+   /*
+* Find the memory index and size of the removing section
+*/
+   my_index = of_get_property(np, "ibm,my-drc-index", NULL);
+   if (!my_index)
+   return ret;
+
+   regs = of_get_property(np, "reg", NULL);
+   if (!regs)
+   return ret;
+
+   start_pfn = section_nr_to_pfn(*my_index & 0x);
+   zone = page_zone(pfn_to_page(start_pfn));
+
+   /*
+* Remove section mappings and sysfs entries for the
+* section of the memory we are removing.
+*
+* NOTE: Ideally, this should be done in generic code like
+* remove_memory(). But remove_memory() gets called by writing
+* to sysfs "state" file and we can't remove sysfs entries
+* while writing to it. So we have to defer it to here.
+*/
+   ret = __remove_pages(zone, start_pfn, regs[3] >> PAGE_SHIFT);
+   if (ret)
+   return ret;
+
+   /*
+* Remove htab bolted mappings for this section of memory
+*/
+   start = (unsigned long)__va(start_pfn << PAGE_SHIFT);
+   ret = remove_section_mapping(start, start + regs[3]);
+   return ret;
+}
+
+static int pseries_memory_notifier(struct notifier_block *nb,
+   unsigned long action, void *node)
+{
+   int err = NOTIFY_OK;
+
+   switch (action) {
+   case PSERIES_RECONFIG_ADD:
+   break;
+   case PSERIES_RECONFIG_REMOVE:
+   if (pseries_remove_memory(node))
+   err = NOTIFY_BAD;
+   break;
+   default:
+   err = NOTIFY_DONE;
+   break;
+   }
+   return err;
+}
+
+static struct notifier_block pseries_mem_nb = {
+   .notifier_call = pseries_memory_notifier,
+};
+
+static int __init pseries_memory_hotplug_init(void)
+{
+   if (firmware_has_feature(FW_FEATURE_LPAR))
+   pSeries_reconfig_notifier_register(&pseries_mem_nb);
+
+   return 0;
+}
+machine_device_initcall(pseries, pseries_memory_hotplug_init);
Index: linux-2.6.25-rc2/arch/powerpc/platforms/pseries/Makefile
===
--- linux-2.6.25-rc2.orig/arch/powerpc/platforms/pseries/Makefile   
2008-02-28 08:15:53.0 -0800
+++ linux-2.6.25-rc2/arch/powerpc/platforms/pseries/Makefile2008-02-28 
08:17:57.0 -0800
@@ -14,6 +14,7 @@ obj-$(CONFIG_PCI) += pci.o pci_dlpar.o
 obj-$(CONFIG_PCI_MSI)  += msi.o
 
 obj-$(CONFIG_HOTPLUG_CPU)  += hotplug-cpu.o
+obj-$(CONFIG_MEMORY_HOTPLUG)   += hotplug-memory.o
 
 obj-$(CONFIG_HVC_CONSOLE)  += hvconsole.o
 obj-$(CONFIG_HVCS) += hvcserver.o


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 2/5] [PPC] htab_remove_mapping() error handling

2008-03-06 Thread Badari Pulavarty
If the sub-arch doesn't support hpte_removebolted(), gracefully
return failure rather than success.

Signed-off-by: Badari Pulavarty <[EMAIL PROTECTED]>
---
 arch/powerpc/mm/hash_utils_64.c |   14 +-
 include/asm-powerpc/sparsemem.h |2 +-
 2 files changed, 10 insertions(+), 6 deletions(-)

Index: linux-2.6.25-rc3/arch/powerpc/mm/hash_utils_64.c
===
--- linux-2.6.25-rc3.orig/arch/powerpc/mm/hash_utils_64.c   2008-03-05 
10:14:28.0 -0800
+++ linux-2.6.25-rc3/arch/powerpc/mm/hash_utils_64.c2008-03-05 
10:18:55.0 -0800
@@ -192,7 +192,7 @@ int htab_bolt_mapping(unsigned long vsta
return ret < 0 ? ret : 0;
 }
 
-static void htab_remove_mapping(unsigned long vstart, unsigned long vend,
+static int htab_remove_mapping(unsigned long vstart, unsigned long vend,
  int psize, int ssize)
 {
unsigned long vaddr;
@@ -202,12 +202,15 @@ static void htab_remove_mapping(unsigned
step = 1 << shift;
 
if (!ppc_md.hpte_removebolted) {
-   printk("Sub-arch doesn't implement hpte_removebolted\n");
-   return;
+   printk(KERN_WARNING "Sub-arch doesn't implement "
+   "hpte_removebolted\n");
+   return -EINVAL;
}
 
for (vaddr = vstart; vaddr < vend; vaddr += step)
ppc_md.hpte_removebolted(vaddr, psize, ssize);
+
+   return 0;
 }
 
 static int __init htab_dt_scan_seg_sizes(unsigned long node,
@@ -449,9 +452,10 @@ void create_section_mapping(unsigned lon
mmu_linear_psize, mmu_kernel_ssize));
 }
 
-void remove_section_mapping(unsigned long start, unsigned long end)
+int remove_section_mapping(unsigned long start, unsigned long end)
 {
-   htab_remove_mapping(start, end, mmu_linear_psize, mmu_kernel_ssize);
+   return htab_remove_mapping(start, end, mmu_linear_psize,
+   mmu_kernel_ssize);
 }
 #endif /* CONFIG_MEMORY_HOTPLUG */
 
Index: linux-2.6.25-rc3/include/asm-powerpc/sparsemem.h
===
--- linux-2.6.25-rc3.orig/include/asm-powerpc/sparsemem.h   2008-03-05 
10:14:31.0 -0800
+++ linux-2.6.25-rc3/include/asm-powerpc/sparsemem.h2008-03-05 
10:19:09.0 -0800
@@ -15,7 +15,7 @@
 
 #ifdef CONFIG_MEMORY_HOTPLUG
 extern void create_section_mapping(unsigned long start, unsigned long end);
-extern void remove_section_mapping(unsigned long start, unsigned long end);
+extern int remove_section_mapping(unsigned long start, unsigned long end);
 #ifdef CONFIG_NUMA
 extern int hot_add_scn_to_nid(unsigned long scn_addr);
 #else


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 1/5] generic __remove_pages() support

2008-03-06 Thread Badari Pulavarty
Generic helper function to remove section mappings and sysfs entries
for the section of the memory we are removing.  offline_pages() correctly 
adjusted zone and marked the pages reserved.

Issue: If mem_map, usemap allocation could come from different places -
kmalloc, vmalloc, alloc_pages or bootmem. There is no easy way
to find and free up bootmem allocations.

Signed-off-by: Badari Pulavarty <[EMAIL PROTECTED]>

---
 include/linux/memory_hotplug.h |4 +++
 mm/memory_hotplug.c|   44 +
 mm/sparse.c|   43 +---
 3 files changed, 88 insertions(+), 3 deletions(-)

Index: linux-2.6.25-rc2/mm/memory_hotplug.c
===
--- linux-2.6.25-rc2.orig/mm/memory_hotplug.c   2008-02-27 12:58:17.0 
-0800
+++ linux-2.6.25-rc2/mm/memory_hotplug.c2008-02-27 16:06:50.0 
-0800
@@ -102,6 +102,21 @@ static int __add_section(struct zone *zo
return register_new_memory(__pfn_to_section(phys_start_pfn));
 }
 
+static int __remove_section(struct zone *zone, struct mem_section *ms)
+{
+   int ret = -EINVAL;
+
+   if (!valid_section(ms))
+   return ret;
+
+   ret = unregister_memory_section(ms);
+   if (ret)
+   return ret;
+
+   sparse_remove_one_section(zone, ms);
+   return 0;
+}
+
 /*
  * Reasonably generic function for adding memory.  It is
  * expected that archs that support memory hotplug will
@@ -135,6 +150,35 @@ int __add_pages(struct zone *zone, unsig
 }
 EXPORT_SYMBOL_GPL(__add_pages);
 
+int __remove_pages(struct zone *zone, unsigned long phys_start_pfn,
+unsigned long nr_pages)
+{
+   unsigned long i, ret = 0;
+   int sections_to_remove;
+   unsigned long flags;
+   struct pglist_data *pgdat = zone->zone_pgdat;
+
+   /*
+* We can only remove entire sections
+*/
+   BUG_ON(phys_start_pfn & ~PAGE_SECTION_MASK);
+   BUG_ON(nr_pages % PAGES_PER_SECTION);
+
+   release_mem_region(phys_start_pfn << PAGE_SHIFT, nr_pages * PAGE_SIZE);
+
+   sections_to_remove = nr_pages / PAGES_PER_SECTION;
+   for (i = 0; i < sections_to_remove; i++) {
+   unsigned long pfn = phys_start_pfn + i*PAGES_PER_SECTION;
+   pgdat_resize_lock(pgdat, &flags);
+   ret = __remove_section(zone, __pfn_to_section(pfn));
+   pgdat_resize_unlock(pgdat, &flags);
+   if (ret)
+   break;
+   }
+   return ret;
+}
+EXPORT_SYMBOL_GPL(__remove_pages);
+
 static void grow_zone_span(struct zone *zone,
unsigned long start_pfn, unsigned long end_pfn)
 {
Index: linux-2.6.25-rc2/mm/sparse.c
===
--- linux-2.6.25-rc2.orig/mm/sparse.c   2008-02-15 12:57:20.0 -0800
+++ linux-2.6.25-rc2/mm/sparse.c2008-02-27 13:02:51.0 -0800
@@ -198,12 +198,13 @@ static unsigned long sparse_encode_mem_m
 }
 
 /*
- * We need this if we ever free the mem_maps.  While not implemented yet,
- * this function is included for parity with its sibling.
+ * Decode mem_map from the coded memmap
  */
-static __attribute((unused))
+static
 struct page *sparse_decode_mem_map(unsigned long coded_mem_map, unsigned long 
pnum)
 {
+   /* mask off the extra low bits of information */
+   coded_mem_map &= SECTION_MAP_MASK;
return ((struct page *)coded_mem_map) + section_nr_to_pfn(pnum);
 }
 
@@ -363,6 +364,26 @@ static void __kfree_section_memmap(struc
 }
 #endif /* CONFIG_SPARSEMEM_VMEMMAP */
 
+static void free_section_usemap(struct page *memmap, unsigned long *usemap)
+{
+   if (!usemap)
+   return;
+
+   /*
+* Check to see if allocation came from hot-plug-add
+*/
+   if (PageSlab(virt_to_page(usemap))) {
+   kfree(usemap);
+   if (memmap)
+   __kfree_section_memmap(memmap, PAGES_PER_SECTION);
+   return;
+   }
+
+   /*
+* Allocations came from bootmem - how do I free up ?
+*/
+}
+
 /*
  * returns the number of sections whose mem_maps were properly
  * set.  If this is <=0, then that means that the passed-in
@@ -415,4 +436,20 @@ out:
}
return ret;
 }
+
+void sparse_remove_one_section(struct zone *zone, struct mem_section *ms)
+{
+   struct page *memmap = NULL;
+   unsigned long *usemap = NULL;
+
+   if (ms->section_mem_map) {
+   usemap = ms->pageblock_flags;
+   memmap = sparse_decode_mem_map(ms->section_mem_map,
+   __section_nr(ms));
+   ms->section_mem_map = 0;
+   ms->pageblock_flags = NULL;
+   }
+
+   free_section_usemap(memmap, usemap);
+}
 #endif
Index: linux-2.6.25-rc2/include/linux/memory_hotplug.h
===

[PATCH 0/5] 2.6.25-rc3-mm1 hotplug memory remove updates

2008-03-06 Thread Badari Pulavarty
Hi Andrew & Paul,

Here are the updates for hotplug memory remove. Most changes are
PPC specific, but I would like these to be included in next -mm 
for easy testing and review, before including in Paul's tree.

eHEA driver folks are verifying if the exported interface
walk_memory_resource() is good enough for their needs. And also,
we are verifying the code on x86_64. Once that is done, we may
be able to cleanup some of the code (make remove_memory() arch
generic).

We still have an issue with not being able to free up the allocations
that came from bootmem. Yasunori Goto wants to clean up that code.

[PATCH 1/5] generic __remove_pages() support
[PATCH 2/5] [PPC] htab_remove_mapping() error handling
[PATCH 3/5] [PPC] hotplug memory notifications for ppc
[PATCH 4/5] [PPC] update lmb for hotplug memory add/remove
[PATCH 5/5] [PPC] provide walk_memory_resource() for ppc

Testing: All the patches are tested on p-series LPAR configuration,
writing to /sysfs & /proc, through DLPAR tools and through HMC. 
Testing on x86_64 needs more work.

Thanks,
Badari

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [patch 4/6] ARM: move bridge enable out of pcibios_enable_resources()

2008-03-06 Thread Russell King - ARM Linux
On Wed, Feb 27, 2008 at 05:04:41PM -0700, Bjorn Helgaas wrote:
> Move bridge enable from pcibios_enable_resources() to
> platform_pci_enable_device() so the former matches other
> architectures and can be shared.
> 
> Signed-off-by: Bjorn Helgaas <[EMAIL PROTECTED]>
> 
> Index: work6/arch/arm/kernel/bios32.c
> ===
> --- work6.orig/arch/arm/kernel/bios32.c   2008-02-27 11:25:29.0 
> -0700
> +++ work6/arch/arm/kernel/bios32.c2008-02-27 11:55:59.0 -0700
> @@ -683,15 +683,32 @@
>   cmd |= PCI_COMMAND_MEMORY;
>   }
>  
> + if (cmd != old_cmd) {
> + printk("PCI: enabling device %s (%04x -> %04x)\n",
> +pci_name(dev), old_cmd, cmd);

Should be dev_info().

Apart from that...

Acked-by: Russell King <[EMAIL PROTECTED]>
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [POWERPC] 8xx: fix swap

2008-03-06 Thread Scott Wood
On Thu, Mar 06, 2008 at 09:56:58AM -0600, Kumar Gala wrote:
> On Mar 6, 2008, at 4:53 AM, Vitaly Bordug wrote:
> > arch/powerpc/kernel/head_8xx.S  |   30 ++ 
> > +++-
> > include/asm-powerpc/pgtable-ppc32.h |8 
> > 2 files changed, 29 insertions(+), 9 deletions(-)
> 
> do we need similar fixes to arch/ppc ?

Yes, a patch was posted a while ago.

-Scott
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [POWERPC] 8xx: fix swap

2008-03-06 Thread Segher Boessenkool
> do we need similar fixes to arch/ppc ?

Do we care?

arch/ppc needs many fixes, when you have implemented all of that, you
get a clone of arch/powerpc ;-)


Segher

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [POWERPC] 8xx: fix swap

2008-03-06 Thread Vitaly Bordug
On Thu, 6 Mar 2008 09:56:58 -0600
Kumar Gala wrote:

> 
> On Mar 6, 2008, at 4:53 AM, Vitaly Bordug wrote:
> 
> > This makes swap routines operate correctly on the ppc_8xx based  
> > machines.
> > Code has been revalidated on mpc885ads (8M sdram) with recent  
> > kernel. Based
> > on patch from Yuri Tikhonov <[EMAIL PROTECTED]> to do the same on
> > arch/ ppc
> > instance.
> >
> > Recent kernel's size makes swap feature very important on
> > low-memory platforms,
> > those are actually non-operable without it.
> >
> > Signed-off-by: Yuri Tikhonov <[EMAIL PROTECTED]>
> > Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]>
> > ---
> >
> > arch/powerpc/kernel/head_8xx.S  |   30
> > ++ +++-
> > include/asm-powerpc/pgtable-ppc32.h |8 
> > 2 files changed, 29 insertions(+), 9 deletions(-)
> 
> do we need similar fixes to arch/ppc ?
> 
there's patch from Yuri that does it for ppc/ - I guess you may just pick it up 
and place to your tree.

-- 
Sincerely, Vitaly
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [POWERPC] 8xx: fix swap

2008-03-06 Thread Kumar Gala

On Mar 6, 2008, at 4:53 AM, Vitaly Bordug wrote:

> This makes swap routines operate correctly on the ppc_8xx based  
> machines.
> Code has been revalidated on mpc885ads (8M sdram) with recent  
> kernel. Based
> on patch from Yuri Tikhonov <[EMAIL PROTECTED]> to do the same on arch/ 
> ppc
> instance.
>
> Recent kernel's size makes swap feature very important on low-memory  
> platforms,
> those are actually non-operable without it.
>
> Signed-off-by: Yuri Tikhonov <[EMAIL PROTECTED]>
> Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]>
> ---
>
> arch/powerpc/kernel/head_8xx.S  |   30 ++ 
> +++-
> include/asm-powerpc/pgtable-ppc32.h |8 
> 2 files changed, 29 insertions(+), 9 deletions(-)

do we need similar fixes to arch/ppc ?

- k
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] PPC: in celleb_show_cpuinfo() convert strncpy(x, y, sizeof(x)) to strlcpy

2008-03-06 Thread Segher Boessenkool
> This patch was not yet tested. Please confirm it's right.
> ---
> strncpy does not append '\0' if the length of the source string equals
> the size parameter, strlcpy does.

strlcpy() doesn't fill the rest of the array with zeroes, strncpy()
does.  This could matter (information leak, for example), although
I doubt it does here.

> - strncpy(celleb_machine_type, ptr, sizeof(celleb_machine_type));
> + strlcpy(celleb_machine_type, ptr, sizeof(celleb_machine_type));
>   celleb_machine_type[sizeof(celleb_machine_type)-1] = 0;

That last statement makes the strncpy() case always zero-terminated,
so this patch isn't necessary.  Oh, and neither the old nor the new
code handles the case where the string doesn't fit (other than just
cutting it short); is that the wanted behaviour?


Segher

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [patch 4/6] ARM: move bridge enable out of pcibios_enable_resources()

2008-03-06 Thread Bjorn Helgaas
On Thursday 06 March 2008 08:06:40 am Russell King - ARM Linux wrote:
> On Wed, Feb 27, 2008 at 05:04:41PM -0700, Bjorn Helgaas wrote:
> > Move bridge enable from pcibios_enable_resources() to
> > platform_pci_enable_device() so the former matches other
> > architectures and can be shared.
> > 
> > Signed-off-by: Bjorn Helgaas <[EMAIL PROTECTED]>
> > 
> > Index: work6/arch/arm/kernel/bios32.c
> > ===
> > --- work6.orig/arch/arm/kernel/bios32.c 2008-02-27 11:25:29.0 
> > -0700
> > +++ work6/arch/arm/kernel/bios32.c  2008-02-27 11:55:59.0 -0700
> > @@ -683,15 +683,32 @@
> > cmd |= PCI_COMMAND_MEMORY;
> > }
> >  
> > +   if (cmd != old_cmd) {
> > +   printk("PCI: enabling device %s (%04x -> %04x)\n",
> > +  pci_name(dev), old_cmd, cmd);
> 
> Should be dev_info().
> 
> Apart from that...
> 
> Acked-by: Russell King <[EMAIL PROTECTED]>

I fixed that in the v3 patch that Greg KH put in his tree.

Thanks,
  Bjorn
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 1/4] Emerson KSI8560 base support

2008-03-06 Thread Alexandr Smirnov
The KSI8560 is a single compact, mid-, or full-size Advanced Mezzanine Card
(AdvancedMC™) based on the Freescale™ Semiconductor MPC8560 PowerQUICC III™
microprocessor. This product will serve in data and signaling applications such
as signaling gateways (SGW) and softswitch signaling interface cards.

The board has altera maxii CPLD, that is used to obtain and manage board
configuration. Also there are two SCC UART serial consoles and FCC ethernet,
that is routed to the front panel, while other ethernet controlers (TSEC's) are
routed to the backplane.

Signed-off-by: Alexandr Smirnov <[EMAIL PROTECTED]>

 arch/powerpc/platforms/85xx/Kconfig   |7
 arch/powerpc/platforms/85xx/Makefile  |1
 arch/powerpc/platforms/85xx/ksi8560.c |  257 ++
 3 files changed, 265 insertions(+)

diff --git a/arch/powerpc/platforms/85xx/Kconfig 
b/arch/powerpc/platforms/85xx/Kconfig
index 7e76ddb..28bc6e5 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -46,6 +46,13 @@ config MPC85xx_DS
help
  This option enables support for the MPC85xx DS (MPC8544 DS) board
 
+config KSI8560
+bool "Emerson KSI8560"
+select PPC_CPM_NEW_BINDING
+select DEFAULT_UIMAGE
+help
+  This option enables support for the Emerson KSI8560 board
+
 config STX_GP3
bool "Silicon Turnkey Express GP3"
help
diff --git a/arch/powerpc/platforms/85xx/Makefile 
b/arch/powerpc/platforms/85xx/Makefile
index cb7af4e..6cea185 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -10,3 +10,4 @@ obj-$(CONFIG_STX_GP3)   += stx_gp3.o
 obj-$(CONFIG_TQM85xx)+= tqm85xx.o
 obj-$(CONFIG_SBC8560) += sbc8560.o
 obj-$(CONFIG_SBC8548) += sbc8548.o
+obj-$(CONFIG_KSI8560)+= ksi8560.o
diff --git a/arch/powerpc/platforms/85xx/ksi8560.c 
b/arch/powerpc/platforms/85xx/ksi8560.c
new file mode 100644
index 000..b3b8194
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/ksi8560.c
@@ -0,0 +1,257 @@
+/*
+ * Board setup routines for the Emerson KSI8560
+ *
+ * Author: Alexandr Smirnov <[EMAIL PROTECTED]>
+ *
+ * Based on mpc85xx_ads.c maintained by Kumar Gala
+ *
+ * 2008 (c) MontaVista, Software, Inc.  This file is licensed under
+ * the terms of the GNU General Public License version 2.  This program
+ * is licensed "as is" without any warranty of any kind, whether express
+ * or implied.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+
+#define KSI8560_CPLD_HVR   0x04 /* Hardware Version Register */
+#define KSI8560_CPLD_PVR   0x08 /* PLD Version Register */
+#define KSI8560_CPLD_RCR1  0x30 /* Reset Command Register 1 */
+
+#define KSI8560_CPLD_RCR1_CPUHR0x80 /* CPU Hard Reset */
+
+static void __iomem *cpld_base = NULL;
+
+static void machine_restart(char *cmd)
+{
+   if (cpld_base)
+   out_8(cpld_base + KSI8560_CPLD_RCR1, KSI8560_CPLD_RCR1_CPUHR);
+   else
+   printk(KERN_ERR "Can't find CPLD base, hang forever\n");
+
+   for (;;);
+}
+
+static void cpm2_cascade(unsigned int irq, struct irq_desc *desc)
+{
+   int cascade_irq;
+
+   while ((cascade_irq = cpm2_get_irq()) >= 0)
+   generic_handle_irq(cascade_irq);
+
+   desc->chip->eoi(irq);
+}
+
+static void __init ksi8560_pic_init(void)
+{
+   struct mpic *mpic;
+   struct resource r;
+   struct device_node *np;
+#ifdef CONFIG_CPM2
+   int irq;
+#endif
+
+   np = of_find_node_by_type(NULL, "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 "Could not 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);
+   of_node_put(np);
+
+   mpic_init(mpic);
+
+#ifdef CONFIG_CPM2
+   /* Setup CPM2 PIC */
+   np = of_find_compatible_node(NULL, NULL, "fsl,cpm2-pic");
+   if (np == NULL) {
+   printk(KERN_ERR "PIC init: can not find fsl,cpm2-pic node\n");
+   return;
+   }
+   irq = irq_of_parse_and_map(np, 0);
+
+   cpm2_pic_init(np);
+   of_node_put(np);
+   set_irq_chained_handler(irq, cpm2_cascade);
+
+   setup_irq(0, NULL);
+#endif
+}
+
+#ifdef CONFIG_CPM2
+/*
+ * Setup I/O ports
+ */
+struct cpm_pin {
+   int port, pin, flags;
+};
+
+static struct cpm_pin __initdata ksi8560_pins[] = {
+   /* SCC1 */
+   {3, 29, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
+   {3

[PATCH 3/4] Emerson KSI8560 device tree

2008-03-06 Thread Alexandr Smirnov
Add device tree file for Emerson KSI8560 board.

Signed-off-by: Alexandr Smirnov <[EMAIL PROTECTED]>

 b/arch/powerpc/boot/dts/ksi8560.dts |  264 
 1 file changed, 264 insertions(+)


diff --git a/arch/powerpc/boot/dts/ksi8560.dts 
b/arch/powerpc/boot/dts/ksi8560.dts
new file mode 100644
index 000..78d26f4
--- /dev/null
+++ b/arch/powerpc/boot/dts/ksi8560.dts
@@ -0,0 +1,264 @@
+/*
+ * Device Tree Source for Emerson KSI8560
+ *
+ * Author: Alexandr Smirnov <[EMAIL PROTECTED]>
+ *
+ * Based on mpc8560ads.dts
+ *
+ * 2008 (c) MontaVista, Software, Inc.  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/;
+
+/ {
+   model = "KSI8560";
+   compatible = "emerson,KSI8560";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   aliases {
+   ethernet0 = &enet0;
+   ethernet1 = &enet1;
+   ethernet2 = &enet2;
+   };
+
+   cpus {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   PowerPC,[EMAIL PROTECTED] {
+   device_type = "cpu";
+   reg = <0>;
+   d-cache-line-size = <32>;
+   i-cache-line-size = <32>;
+   d-cache-size = <0x8000>;/* L1, 32K */
+   i-cache-size = <0x8000>;/* L1, 32K */
+   timebase-frequency = <0>;   /* From U-boot 
*/
+   bus-frequency = <0>;/* From U-boot 
*/
+   clock-frequency = <0>;  /* From U-boot 
*/
+   };
+   };
+
+   memory {
+   device_type = "memory";
+   reg = <0x 0x1000>;  /* Fixed by 
bootwrapper */
+   };
+
+   [EMAIL PROTECTED] {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   device_type = "soc";
+   ranges = <0x 0xfdf0 0x0010>;
+   bus-frequency = <0>;/* Fixed by 
bootwrapper */
+
+   [EMAIL PROTECTED] {
+   compatible = "fsl,8540-memory-controller";
+   reg = <0x2000 0x1000>;
+   interrupt-parent = <&MPIC>;
+   interrupts = <0x12 0x2>;
+   };
+
+   [EMAIL PROTECTED] {
+   compatible = "fsl,8540-l2-cache-controller";
+   reg = <0x2 0x1000>;
+   cache-line-size = <0x20>;   /* 32 bytes */
+   cache-size = <0x4>; /* L2, 256K */
+   interrupt-parent = <&MPIC>;
+   interrupts = <0x10 0x2>;
+   };
+
+   [EMAIL PROTECTED] {
+   compatible = "fsl-i2c";
+   reg = <0x3000 0x100>;
+   interrupts = <0x2b 0x2>;
+   interrupt-parent = <&MPIC>;
+   dfsrr;
+   };
+
+   [EMAIL PROTECTED] { /* For 
TSECs */
+   #address-cells = <1>;
+   #size-cells = <0>;
+   compatible = "fsl,gianfar-mdio";
+   reg = <0x24520 0x20>;
+
+   PHY1: [EMAIL PROTECTED] {
+   interrupt-parent = <&MPIC>;
+   reg = <0x1>;
+   device_type = "ethernet-phy";
+   };
+
+   PHY2: [EMAIL PROTECTED] {
+   interrupt-parent = <&MPIC>;
+   reg = <0x2>;
+   device_type = "ethernet-phy";
+   };
+   };
+
+   enet0: [EMAIL PROTECTED] {
+   device_type = "network";
+   model = "TSEC";
+   compatible = "gianfar";
+   reg = <0x24000 0x1000>;
+   /* Mac address filled in by bootwrapper */
+   local-mac-address = [ 00 00 00 00 00 00 ];
+   interrupts = <0x1d 0x2 0x1e 0x2 0x22 0x2>;
+   interrupt-parent = <&MPIC>;
+   phy-handle = <&PHY1>;
+   };
+
+   enet1: [EMAIL PROTECTED] {
+   device_type = "network";
+   model = "TSEC";
+   compatible = "gianfar";
+   reg = <0x25000 0x1000>;
+   /* Mac address filled in by bootwrapper */
+   local-mac-address = [ 00 00 00 00 00 00 ];
+  

[PATCH] PowerPC 4xx: Use dcri_clrset() for PCIe indirect dcr read/modify/write access

2008-03-06 Thread Valentine Barshak
Use dcri_clrset() for PCIe SDR0 read/modify/write access.

Signed-off-by: Valentine Barshak <[EMAIL PROTECTED]>
---
 arch/powerpc/sysdev/ppc4xx_pci.c |   13 +
 1 files changed, 5 insertions(+), 8 deletions(-)

diff -pruN linux-2.6.orig/arch/powerpc/sysdev/ppc4xx_pci.c 
linux-2.6/arch/powerpc/sysdev/ppc4xx_pci.c
--- linux-2.6.orig/arch/powerpc/sysdev/ppc4xx_pci.c 2008-03-06 
14:39:46.0 +0300
+++ linux-2.6/arch/powerpc/sysdev/ppc4xx_pci.c  2008-03-06 17:20:16.0 
+0300
@@ -645,7 +645,7 @@ static int __init ppc440spe_pciex_core_i
int time_out = 20;
 
/* Set PLL clock receiver to LVPECL */
-   mtdcri(SDR0, PESDR0_PLLLCT1, mfdcri(SDR0, PESDR0_PLLLCT1) | 1 << 28);
+   dcri_clrset(SDR0, PESDR0_PLLLCT1, 0, 1 << 28);
 
/* Shouldn't we do all the calibration stuff etc... here ? */
if (ppc440spe_pciex_check_reset(np))
@@ -659,8 +659,7 @@ static int __init ppc440spe_pciex_core_i
}
 
/* De-assert reset of PCIe PLL, wait for lock */
-   mtdcri(SDR0, PESDR0_PLLLCT1,
-  mfdcri(SDR0, PESDR0_PLLLCT1) & ~(1 << 24));
+   dcri_clrset(SDR0, PESDR0_PLLLCT1, 1 << 24, 0);
udelay(3);
 
while (time_out) {
@@ -712,9 +711,8 @@ static int ppc440spe_pciex_init_port_hw(
mtdcri(SDR0, port->sdr_base + PESDRn_440SPE_HSSL7SET1,
   0x3500);
}
-   val = mfdcri(SDR0, port->sdr_base + PESDRn_RCSSET);
-   mtdcri(SDR0, port->sdr_base + PESDRn_RCSSET,
-  (val & ~(1 << 24 | 1 << 16)) | 1 << 12);
+   dcri_clrset(SDR0, port->sdr_base + PESDRn_RCSSET,
+   (1 << 24) | (1 << 16), 1 << 12);
 
return 0;
 }
@@ -1042,8 +1040,7 @@ static int __init ppc4xx_pciex_port_init
port->link = 0;
}
 
-   mtdcri(SDR0, port->sdr_base + PESDRn_RCSSET,
-  mfdcri(SDR0, port->sdr_base + PESDRn_RCSSET) | 1 << 20);
+   dcri_clrset(SDR0, port->sdr_base + PESDRn_RCSSET, 0, 1 << 20);
msleep(100);
 
return 0;
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Realtime ethernet

2008-03-06 Thread Mehlan, Markus (Ritter Elektronik)
Hello,

who knows a solution for realtime ethernet with
 an actual kernel (> 2.6.23)?

Best regards,
Markus 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] PowerPC 4xx: Use dcri_clrset() for PCIe indirect dcr read/modify/write access

2008-03-06 Thread Valentine Barshak
Oops, sorry, please discard this one.
There's a typo in it. The fixed patch is coming right away.
Thanks.
Valentine.

Valentine Barshak wrote:
> Use dcri_clrset() for PCIe SDR0 read/modify/write access.
> 
> Signed-off-by: Valentine Barshak <[EMAIL PROTECTED]>
> ---
>  arch/powerpc/sysdev/ppc4xx_pci.c |   11 ---
>  1 files changed, 4 insertions(+), 7 deletions(-)
> 
> diff -pruN linux-2.6.orig/arch/powerpc/sysdev/ppc4xx_pci.c 
> linux-2.6/arch/powerpc/sysdev/ppc4xx_pci.c
> --- linux-2.6.orig/arch/powerpc/sysdev/ppc4xx_pci.c   2008-03-06 
> 14:39:46.0 +0300
> +++ linux-2.6/arch/powerpc/sysdev/ppc4xx_pci.c2008-03-06 
> 14:52:02.0 +0300
> @@ -645,7 +645,7 @@ static int __init ppc440spe_pciex_core_i
>   int time_out = 20;
>  
>   /* Set PLL clock receiver to LVPECL */
> - mtdcri(SDR0, PESDR0_PLLLCT1, mfdcri(SDR0, PESDR0_PLLLCT1) | 1 << 28);
> + dcri_clrset(SDR0, PESDR0_PLLLCT1, 0, 1 << 28);
>  
>   /* Shouldn't we do all the calibration stuff etc... here ? */
>   if (ppc440spe_pciex_check_reset(np))
> @@ -659,8 +659,7 @@ static int __init ppc440spe_pciex_core_i
>   }
>  
>   /* De-assert reset of PCIe PLL, wait for lock */
> - mtdcri(SDR0, PESDR0_PLLLCT1,
> -mfdcri(SDR0, PESDR0_PLLLCT1) & ~(1 << 24));
> + dcri_clrset(SDR0, PESDR0_PLLLCT1, 1 << 24, 0);
>   udelay(3);
>  
>   while (time_out) {
> @@ -712,9 +711,8 @@ static int ppc440spe_pciex_init_port_hw(
>   mtdcri(SDR0, port->sdr_base + PESDRn_440SPE_HSSL7SET1,
>  0x3500);
>   }
> - val = mfdcri(SDR0, port->sdr_base + PESDRn_RCSSET);
>   mtdcri(SDR0, port->sdr_base + PESDRn_RCSSET,
> -(val & ~(1 << 24 | 1 << 16)) | 1 << 12);
> + (1 << 24) | (1 << 16), 1 << 12);
>  
>   return 0;
>  }
> @@ -1042,8 +1040,7 @@ static int __init ppc4xx_pciex_port_init
>   port->link = 0;
>   }
>  
> - mtdcri(SDR0, port->sdr_base + PESDRn_RCSSET,
> -mfdcri(SDR0, port->sdr_base + PESDRn_RCSSET) | 1 << 20);
> + dcri_clrset(SDR0, port->sdr_base + PESDRn_RCSSET, 0, 1 << 20);
>   msleep(100);
>  
>   return 0;
> ___
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] The MPC83xx family doesn't support performance monitor instructions

2008-03-06 Thread Kumar Gala

On Mar 5, 2008, at 6:33 PM, Gerald Van Baren wrote:

> "Errata to MPC8349EA PowerQUICC[tm] II Pro Integrated Host Processor  
> Family
> Reference Manual, Rev. 1" (Freescale)
>
> Signed-off-by: Gerald Van Baren <[EMAIL PROTECTED]>
> ---
>
> Hi Kumar,
>
> Please apply this fix to 2.6.25rc4 if possible.  Without this
> patch, the PPC_83xx family configuration is broken (will not compile).

What's the compile issue?  Some of the 83xx family have perf mon so we  
need to fix the compile issue.

- k
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] PowerPC 4xx: Use dcri_clrset() for PCIe indirect dcr read/modify/write access

2008-03-06 Thread Valentine Barshak
Use dcri_clrset() for PCIe SDR0 read/modify/write access.

Signed-off-by: Valentine Barshak <[EMAIL PROTECTED]>
---
 arch/powerpc/sysdev/ppc4xx_pci.c |   11 ---
 1 files changed, 4 insertions(+), 7 deletions(-)

diff -pruN linux-2.6.orig/arch/powerpc/sysdev/ppc4xx_pci.c 
linux-2.6/arch/powerpc/sysdev/ppc4xx_pci.c
--- linux-2.6.orig/arch/powerpc/sysdev/ppc4xx_pci.c 2008-03-06 
14:39:46.0 +0300
+++ linux-2.6/arch/powerpc/sysdev/ppc4xx_pci.c  2008-03-06 14:52:02.0 
+0300
@@ -645,7 +645,7 @@ static int __init ppc440spe_pciex_core_i
int time_out = 20;
 
/* Set PLL clock receiver to LVPECL */
-   mtdcri(SDR0, PESDR0_PLLLCT1, mfdcri(SDR0, PESDR0_PLLLCT1) | 1 << 28);
+   dcri_clrset(SDR0, PESDR0_PLLLCT1, 0, 1 << 28);
 
/* Shouldn't we do all the calibration stuff etc... here ? */
if (ppc440spe_pciex_check_reset(np))
@@ -659,8 +659,7 @@ static int __init ppc440spe_pciex_core_i
}
 
/* De-assert reset of PCIe PLL, wait for lock */
-   mtdcri(SDR0, PESDR0_PLLLCT1,
-  mfdcri(SDR0, PESDR0_PLLLCT1) & ~(1 << 24));
+   dcri_clrset(SDR0, PESDR0_PLLLCT1, 1 << 24, 0);
udelay(3);
 
while (time_out) {
@@ -712,9 +711,8 @@ static int ppc440spe_pciex_init_port_hw(
mtdcri(SDR0, port->sdr_base + PESDRn_440SPE_HSSL7SET1,
   0x3500);
}
-   val = mfdcri(SDR0, port->sdr_base + PESDRn_RCSSET);
mtdcri(SDR0, port->sdr_base + PESDRn_RCSSET,
-  (val & ~(1 << 24 | 1 << 16)) | 1 << 12);
+   (1 << 24) | (1 << 16), 1 << 12);
 
return 0;
 }
@@ -1042,8 +1040,7 @@ static int __init ppc4xx_pciex_port_init
port->link = 0;
}
 
-   mtdcri(SDR0, port->sdr_base + PESDRn_RCSSET,
-  mfdcri(SDR0, port->sdr_base + PESDRn_RCSSET) | 1 << 20);
+   dcri_clrset(SDR0, port->sdr_base + PESDRn_RCSSET, 0, 1 << 20);
msleep(100);
 
return 0;
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 2/2] ibm_newemac: PowerPC 440EP/440GR EMAC PHY clock workaround

2008-03-06 Thread Valentine Barshak
This patch adds ibm_newemac PHY clock workaround for 440EP/440GR EMAC
attached to a PHY which doesn't generate RX clock if there is no link.
The code is based on the previous ibm_emac driver stuff. The 440EP/440GR
allows controlling each EMAC clock separately as opposed to global clock
selection for 440GX.

Signed-off-by: Valentine Barshak <[EMAIL PROTECTED]>
---
 drivers/net/ibm_newemac/core.c |   34 --
 drivers/net/ibm_newemac/core.h |6 +-
 2 files changed, 37 insertions(+), 3 deletions(-)

diff -pruN linux-2.6.orig/drivers/net/ibm_newemac/core.c 
linux-2.6/drivers/net/ibm_newemac/core.c
--- linux-2.6.orig/drivers/net/ibm_newemac/core.c   2008-02-26 
16:32:33.0 +0300
+++ linux-2.6/drivers/net/ibm_newemac/core.c2008-02-26 16:37:52.0 
+0300
@@ -129,10 +129,29 @@ static struct device_node *emac_boot_lis
 static inline void emac_report_timeout_error(struct emac_instance *dev,
 const char *error)
 {
-   if (net_ratelimit())
+   if (emac_has_feature(dev, EMAC_FTR_440GX_PHY_CLK_FIX |
+ EMAC_FTR_440EP_PHY_CLK_FIX))
+   DBG(dev, "%s" NL, error);
+   else if (net_ratelimit())
printk(KERN_ERR "%s: %s\n", dev->ndev->name, error);
 }
 
+/* EMAC PHY clock workaround:
+ * 440EP/440GR has more sane SDR0_MFR register implementation than 440GX,
+ * which allows controlling each EMAC clock
+ */
+static inline void emac_rx_clk_tx(struct emac_instance *dev)
+{
+   if (emac_has_feature(dev, EMAC_FTR_440EP_PHY_CLK_FIX))
+   dcri_clrset(SDR0, SDR0_MFR, 0, SDR0_MFR_ECS >> dev->cell_index);
+}
+
+static inline void emac_rx_clk_default(struct emac_instance *dev)
+{
+   if (emac_has_feature(dev, EMAC_FTR_440EP_PHY_CLK_FIX))
+   dcri_clrset(SDR0, SDR0_MFR, SDR0_MFR_ECS >> dev->cell_index, 0);
+}
+
 /* PHY polling intervals */
 #define PHY_POLL_LINK_ON   HZ
 #define PHY_POLL_LINK_OFF  (HZ / 5)
@@ -1089,9 +1112,11 @@ static int emac_open(struct net_device *
int link_poll_interval;
if (dev->phy.def->ops->poll_link(&dev->phy)) {
dev->phy.def->ops->read_link(&dev->phy);
+   emac_rx_clk_default(dev);
netif_carrier_on(dev->ndev);
link_poll_interval = PHY_POLL_LINK_ON;
} else {
+   emac_rx_clk_tx(dev);
netif_carrier_off(dev->ndev);
link_poll_interval = PHY_POLL_LINK_OFF;
}
@@ -1169,6 +1194,7 @@ static void emac_link_timer(struct work_
 
if (dev->phy.def->ops->poll_link(&dev->phy)) {
if (!netif_carrier_ok(dev->ndev)) {
+   emac_rx_clk_default(dev);
/* Get new link parameters */
dev->phy.def->ops->read_link(&dev->phy);
 
@@ -1181,6 +1207,7 @@ static void emac_link_timer(struct work_
link_poll_interval = PHY_POLL_LINK_ON;
} else {
if (netif_carrier_ok(dev->ndev)) {
+   emac_rx_clk_tx(dev);
netif_carrier_off(dev->ndev);
netif_tx_disable(dev->ndev);
emac_reinitialize(dev);
@@ -2325,9 +2352,12 @@ static int __devinit emac_init_phy(struc
dev->phy.mdio_read = emac_mdio_read;
dev->phy.mdio_write = emac_mdio_write;
 
-   /* Enable internal clock source */
+   /* EMAC PHY clock workaround */
if (emac_has_feature(dev, EMAC_FTR_440GX_PHY_CLK_FIX))
+   /* Enable internal clock source */
dcri_clrset(SDR0, SDR0_MFR, 0, SDR0_MFR_ECS);
+   else
+   emac_rx_clk_tx(dev);
 
/* Configure EMAC with defaults so we can at least use MDIO
 * This is needed mostly for 440GX
@@ -2495,6 +2525,10 @@ static int __devinit emac_init_config(st
dev->features |= EMAC_FTR_EMAC4;
if (of_device_is_compatible(np, "ibm,emac-440gx"))
dev->features |= EMAC_FTR_440GX_PHY_CLK_FIX;
+   } else {
+   if (of_device_is_compatible(np, "ibm,emac-440ep") ||
+   of_device_is_compatible(np, "ibm,emac-440gr"))
+   dev->features |= EMAC_FTR_440EP_PHY_CLK_FIX;
}
 
/* Fixup some feature bits based on the device tree */
diff -pruN linux-2.6.orig/drivers/net/ibm_newemac/core.h 
linux-2.6/drivers/net/ibm_newemac/core.h
--- linux-2.6.orig/drivers/net/ibm_newemac/core.h   2008-02-26 
16:32:33.0 +0300
+++ linux-2.6/drivers/net/ibm_newemac/core.h2008-02-26 16:37:52.0 
+0300
@@ -305,6 +305,10 @@ struct emac_instance {
  * Set if we need phy clock workaround for 440gx
  */
 #define EMAC_FTR_440GX_PHY_CLK_FIX 0x0080
+/*
+ * Set if we need phy clock workaround for 440ep or 440gr
+ */
+#define EMAC_FTR_440EP_PHY_

[PATCH 1/2] ibm_newemac: PowerPC 440GX EMAC PHY clock workaround

2008-03-06 Thread Valentine Barshak
The PowerPC 440GX Taishan board fails to reset EMAC3 (reset timeout error)
if there's no link. Because of that it fails to find PHY chip. The older 
ibm_emac
driver had a workaround for that: the EMAC_CLK_INTERNAL/EMAC_CLK_EXTERNAL 
macros,
which toggle the Ethernet Clock Select bit in the SDR0_MFR register. This patch
does the same for "ibm,emac-440gx" compatible chips. The workaround forces
clock on -all- EMACs, so we select clock under global emac_phy_map_lock.

Signed-off-by: Valentine Barshak <[EMAIL PROTECTED]>
---
 drivers/net/ibm_newemac/core.c |   16 +++-
 drivers/net/ibm_newemac/core.h |8 ++--
 2 files changed, 21 insertions(+), 3 deletions(-)

diff -pruN linux-2.6.orig/drivers/net/ibm_newemac/core.c 
linux-2.6/drivers/net/ibm_newemac/core.c
--- linux-2.6.orig/drivers/net/ibm_newemac/core.c   2008-02-22 
19:56:26.0 +0300
+++ linux-2.6/drivers/net/ibm_newemac/core.c2008-02-22 20:38:47.0 
+0300
@@ -43,6 +43,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include "core.h"
 
@@ -2323,6 +2325,10 @@ static int __devinit emac_init_phy(struc
dev->phy.mdio_read = emac_mdio_read;
dev->phy.mdio_write = emac_mdio_write;
 
+   /* Enable internal clock source */
+   if (emac_has_feature(dev, EMAC_FTR_440GX_PHY_CLK_FIX))
+   dcri_clrset(SDR0, SDR0_MFR, 0, SDR0_MFR_ECS);
+
/* Configure EMAC with defaults so we can at least use MDIO
 * This is needed mostly for 440GX
 */
@@ -2355,6 +2361,11 @@ static int __devinit emac_init_phy(struc
if (!emac_mii_phy_probe(&dev->phy, i))
break;
}
+
+   /* Enable external clock source */
+   if (emac_has_feature(dev, EMAC_FTR_440GX_PHY_CLK_FIX))
+   dcri_clrset(SDR0, SDR0_MFR, SDR0_MFR_ECS, 0);
+
mutex_unlock(&emac_phy_map_lock);
if (i == 0x20) {
printk(KERN_WARNING "%s: can't find PHY!\n", np->full_name);
@@ -2480,8 +2491,11 @@ static int __devinit emac_init_config(st
}
 
/* Check EMAC version */
-   if (of_device_is_compatible(np, "ibm,emac4"))
+   if (of_device_is_compatible(np, "ibm,emac4")) {
dev->features |= EMAC_FTR_EMAC4;
+   if (of_device_is_compatible(np, "ibm,emac-440gx"))
+   dev->features |= EMAC_FTR_440GX_PHY_CLK_FIX;
+   }
 
/* Fixup some feature bits based on the device tree */
if (of_get_property(np, "has-inverted-stacr-oc", NULL))
diff -pruN linux-2.6.orig/drivers/net/ibm_newemac/core.h 
linux-2.6/drivers/net/ibm_newemac/core.h
--- linux-2.6.orig/drivers/net/ibm_newemac/core.h   2008-02-21 
16:45:36.0 +0300
+++ linux-2.6/drivers/net/ibm_newemac/core.h2008-02-22 19:57:44.0 
+0300
@@ -301,6 +301,10 @@ struct emac_instance {
  * Set if we have new type STACR with STAOPC
  */
 #define EMAC_FTR_HAS_NEW_STACR 0x0040
+/*
+ * Set if we need phy clock workaround for 440gx
+ */
+#define EMAC_FTR_440GX_PHY_CLK_FIX 0x0080
 
 
 /* Right now, we don't quite handle the always/possible masks on the
@@ -312,8 +316,8 @@ enum {
 
EMAC_FTRS_POSSIBLE  =
 #ifdef CONFIG_IBM_NEW_EMAC_EMAC4
-   EMAC_FTR_EMAC4  | EMAC_FTR_HAS_NEW_STACR|
-   EMAC_FTR_STACR_OC_INVERT|
+   EMAC_FTR_EMAC4 | EMAC_FTR_HAS_NEW_STACR |
+   EMAC_FTR_STACR_OC_INVERT | EMAC_FTR_440GX_PHY_CLK_FIX |
 #endif
 #ifdef CONFIG_IBM_NEW_EMAC_TAH
EMAC_FTR_HAS_TAH|
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] PPC: in celleb_show_cpuinfo() convert strncpy(x, y, sizeof(x)) to strlcpy

2008-03-06 Thread Roel Kluin
Roel Kluin wrote:
> This patch was not yet tested. Please confirm it's right.

was too quick with the send button. the batch below is probably better
---
strncpy does not append '\0' if the length of the source string equals
the size parameter, strlcpy does.

Signed-off-by: Roel Kluin <[EMAIL PROTECTED]>
---
diff --git a/arch/powerpc/platforms/celleb/setup.c 
b/arch/powerpc/platforms/celleb/setup.c
index f27ae1e..cbe09d9 100644
--- a/arch/powerpc/platforms/celleb/setup.c
+++ b/arch/powerpc/platforms/celleb/setup.c
@@ -81,8 +81,7 @@ static void celleb_show_cpuinfo(struct seq_file *m)
 
 static int __init celleb_machine_type_hack(char *ptr)
 {
-   strncpy(celleb_machine_type, ptr, sizeof(celleb_machine_type));
-   celleb_machine_type[sizeof(celleb_machine_type)-1] = 0;
+   strlcpy(celleb_machine_type, ptr, sizeof(celleb_machine_type));
return 0;
 }
 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] PPC: in celleb_show_cpuinfo() convert strncpy(x, y, sizeof(x)) to strlcpy

2008-03-06 Thread Roel Kluin
This patch was not yet tested. Please confirm it's right.
---
strncpy does not append '\0' if the length of the source string equals
the size parameter, strlcpy does.

Signed-off-by: Roel Kluin <[EMAIL PROTECTED]>
---
diff --git a/arch/powerpc/platforms/celleb/setup.c 
b/arch/powerpc/platforms/celleb/setup.c
index f27ae1e..d70fc53 100644
--- a/arch/powerpc/platforms/celleb/setup.c
+++ b/arch/powerpc/platforms/celleb/setup.c
@@ -81,7 +81,7 @@ static void celleb_show_cpuinfo(struct seq_file *m)
 
 static int __init celleb_machine_type_hack(char *ptr)
 {
-   strncpy(celleb_machine_type, ptr, sizeof(celleb_machine_type));
+   strlcpy(celleb_machine_type, ptr, sizeof(celleb_machine_type));
celleb_machine_type[sizeof(celleb_machine_type)-1] = 0;
return 0;
 }
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] PowerPC 4xx: Add dcri_clrset() for locked read/modify/write functionality

2008-03-06 Thread Benjamin Herrenschmidt

On Thu, 2008-03-06 at 14:31 +0300, Valentine Barshak wrote:
> Josh Boyer wrote:
> > On Thu, 06 Mar 2008 11:06:18 +1100
> > Benjamin Herrenschmidt <[EMAIL PROTECTED]> wrote:
> > 
> >> On Wed, 2008-03-05 at 21:38 +0300, Valentine Barshak wrote:
> >>> This adds dcri_clrset() macro which does read/modify/write
> >>> on indirect dcr registers while holding indirect dcr lock.
> >>>
> >>> Signed-off-by: Valentine Barshak <[EMAIL PROTECTED]>
> >> Acked-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
> > 
> > Indeed, looks good.  Valentine, are you going to rework your EMAC patch
> > to use this?
> > 
> > josh
> 
> Yes, I was going to update the pcie stuff and rework the emac patches.

The PCIe stuff is less of an issue as it happens early during boot,
there should be no race there, but it's still a good idea in the long
run. The EMAC bits look more like that kind of stuff we should have
ready asap for linux-next.

Cheers,
Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[POWERPC] 8xx: fix swap

2008-03-06 Thread Vitaly Bordug
This makes swap routines operate correctly on the ppc_8xx based machines.
Code has been revalidated on mpc885ads (8M sdram) with recent kernel. Based
on patch from Yuri Tikhonov <[EMAIL PROTECTED]> to do the same on arch/ppc
instance.

Recent kernel's size makes swap feature very important on low-memory platforms,
those are actually non-operable without it.

Signed-off-by: Yuri Tikhonov <[EMAIL PROTECTED]>
Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]>
---

 arch/powerpc/kernel/head_8xx.S  |   30 +-
 include/asm-powerpc/pgtable-ppc32.h |8 
 2 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
index f745839..3c9452d 100644
--- a/arch/powerpc/kernel/head_8xx.S
+++ b/arch/powerpc/kernel/head_8xx.S
@@ -332,8 +332,18 @@ InstructionTLBMiss:
mfspr   r11, SPRN_MD_TWC/* and get the pte address */
lwz r10, 0(r11) /* Get the pte */
 
+#ifdef CONFIG_SWAP
+   /* do not set the _PAGE_ACCESSED bit of a non-present page */
+   andi.   r11, r10, _PAGE_PRESENT
+   beq 4f
+   ori r10, r10, _PAGE_ACCESSED
+   mfspr   r11, SPRN_MD_TWC/* get the pte address again */
+   stw r10, 0(r11)
+4:
+#else
ori r10, r10, _PAGE_ACCESSED
stw r10, 0(r11)
+#endif
 
/* The Linux PTE won't go exactly into the MMU TLB.
 * Software indicator bits 21, 22 and 28 must be clear.
@@ -398,8 +408,17 @@ DataStoreTLBMiss:
DO_8xx_CPU6(0x3b80, r3)
mtspr   SPRN_MD_TWC, r11
 
-   mfspr   r11, SPRN_MD_TWC/* get the pte address again */
+#ifdef CONFIG_SWAP
+   /* do not set the _PAGE_ACCESSED bit of a non-present page */
+   andi.   r11, r10, _PAGE_PRESENT
+   beq 4f
ori r10, r10, _PAGE_ACCESSED
+4:
+   /* and update pte in table */
+#else
+   ori r10, r10, _PAGE_ACCESSED
+#endif
+   mfspr   r11, SPRN_MD_TWC/* get the pte address again */
stw r10, 0(r11)
 
/* The Linux PTE won't go exactly into the MMU TLB.
@@ -507,7 +526,16 @@ DataTLBError:
 
/* Update 'changed', among others.
*/
+#ifdef CONFIG_SWAP
+   ori r10, r10, _PAGE_DIRTY|_PAGE_HWWRITE
+   /* do not set the _PAGE_ACCESSED bit of a non-present page */
+   andi.   r11, r10, _PAGE_PRESENT
+   beq 4f
+   ori r10, r10, _PAGE_ACCESSED
+4:
+#else
ori r10, r10, _PAGE_DIRTY|_PAGE_ACCESSED|_PAGE_HWWRITE
+#endif
mfspr   r11, SPRN_MD_TWC/* Get pte address again */
stw r10, 0(r11) /* and update pte in table */
 
diff --git a/include/asm-powerpc/pgtable-ppc32.h 
b/include/asm-powerpc/pgtable-ppc32.h
index d1332bb..2c79f55 100644
--- a/include/asm-powerpc/pgtable-ppc32.h
+++ b/include/asm-powerpc/pgtable-ppc32.h
@@ -339,14 +339,6 @@ extern int icache_44x_need_flush;
 #define _PMD_PAGE_MASK 0x000c
 #define _PMD_PAGE_8M   0x000c
 
-/*
- * The 8xx TLB miss handler allegedly sets _PAGE_ACCESSED in the PTE
- * for an address even if _PAGE_PRESENT is not set, as a performance
- * optimization.  This is a bug if you ever want to use swap unless
- * _PAGE_ACCESSED is 2, which it isn't, or unless you have 8xx-specific
- * definitions for __swp_entry etc. below, which would be gross.
- *  -- paulus
- */
 #define _PTE_NONE_MASK _PAGE_ACCESSED
 
 #else /* CONFIG_6xx */


-- 
Sincerely, 
Vitaly
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 1/2] fix wrong USB phy type in mpc837xmds dts

2008-03-06 Thread Li Yang
Due to chip constraint MPC837x USB DR module can only use
ULPI and serial PHY interfaces.  The patch fixes the wrong
type in dts.

Signed-off-by: Li Yang <[EMAIL PROTECTED]>
---
 arch/powerpc/boot/dts/mpc8377_mds.dts |4 ++--
 arch/powerpc/boot/dts/mpc8378_mds.dts |4 ++--
 arch/powerpc/boot/dts/mpc8379_mds.dts |4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc8377_mds.dts 
b/arch/powerpc/boot/dts/mpc8377_mds.dts
index a3637ff..677a061 100644
--- a/arch/powerpc/boot/dts/mpc8377_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8377_mds.dts
@@ -91,7 +91,6 @@
mode = "cpu";
};
 
-   /* phy type (ULPI, UTMI, UTMI_WIDE, SERIAL) */
[EMAIL PROTECTED] {
compatible = "fsl-usb2-dr";
reg = <0x23000 0x1000>;
@@ -99,7 +98,8 @@
#size-cells = <0>;
interrupt-parent = <&ipic>;
interrupts = <38 0x8>;
-   phy_type = "utmi_wide";
+   dr_mode = "host";
+   phy_type = "ulpi";
};
 
[EMAIL PROTECTED] {
diff --git a/arch/powerpc/boot/dts/mpc8378_mds.dts 
b/arch/powerpc/boot/dts/mpc8378_mds.dts
index 533e9b0..3f9e9fe 100644
--- a/arch/powerpc/boot/dts/mpc8378_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8378_mds.dts
@@ -91,7 +91,6 @@
mode = "cpu";
};
 
-   /* phy type (ULPI, UTMI, UTMI_WIDE, SERIAL) */
[EMAIL PROTECTED] {
compatible = "fsl-usb2-dr";
reg = <0x23000 0x1000>;
@@ -99,7 +98,8 @@
#size-cells = <0>;
interrupt-parent = <&ipic>;
interrupts = <38 0x8>;
-   phy_type = "utmi_wide";
+   dr_mode = "host";
+   phy_type = "ulpi";
};
 
[EMAIL PROTECTED] {
diff --git a/arch/powerpc/boot/dts/mpc8379_mds.dts 
b/arch/powerpc/boot/dts/mpc8379_mds.dts
index c270685..36c1c13 100644
--- a/arch/powerpc/boot/dts/mpc8379_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8379_mds.dts
@@ -91,7 +91,6 @@
mode = "cpu";
};
 
-   /* phy type (ULPI, UTMI, UTMI_WIDE, SERIAL) */
[EMAIL PROTECTED] {
compatible = "fsl-usb2-dr";
reg = <0x23000 0x1000>;
@@ -99,7 +98,8 @@
#size-cells = <0>;
interrupt-parent = <&ipic>;
interrupts = <38 0x8>;
-   phy_type = "utmi_wide";
+   dr_mode = "host";
+   phy_type = "ulpi";
};
 
[EMAIL PROTECTED] {
-- 
1.5.4.rc4

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] PowerPC 4xx: Add dcri_clrset() for locked read/modify/write functionality

2008-03-06 Thread Valentine Barshak
Josh Boyer wrote:
> On Thu, 06 Mar 2008 11:06:18 +1100
> Benjamin Herrenschmidt <[EMAIL PROTECTED]> wrote:
> 
>> On Wed, 2008-03-05 at 21:38 +0300, Valentine Barshak wrote:
>>> This adds dcri_clrset() macro which does read/modify/write
>>> on indirect dcr registers while holding indirect dcr lock.
>>>
>>> Signed-off-by: Valentine Barshak <[EMAIL PROTECTED]>
>> Acked-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
> 
> Indeed, looks good.  Valentine, are you going to rework your EMAC patch
> to use this?
> 
> josh

Yes, I was going to update the pcie stuff and rework the emac patches.

Thanks,
Valentine.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 2/2] Add local bus device nodes to MPC837xMDS device trees.

2008-03-06 Thread Li Yang
Signed-off-by: Li Yang <[EMAIL PROTECTED]>
---
 arch/powerpc/boot/dts/mpc8377_mds.dts |   66 +
 arch/powerpc/boot/dts/mpc8378_mds.dts |   66 +
 arch/powerpc/boot/dts/mpc8379_mds.dts |   66 +
 arch/powerpc/platforms/83xx/mpc837x_mds.c |8 +--
 4 files changed, 201 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc8377_mds.dts 
b/arch/powerpc/boot/dts/mpc8377_mds.dts
index 677a061..3aac8b7 100644
--- a/arch/powerpc/boot/dts/mpc8377_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8377_mds.dts
@@ -47,6 +47,72 @@
reg = <0x 0x2000>;  // 512MB at 0
};
 
+   [EMAIL PROTECTED] {
+   #address-cells = <2>;
+   #size-cells = <1>;
+   compatible = "fsl,mpc8377-elbc", "fsl,elbc", "simple-bus";
+   reg = <0xe0005000 0x1000>;
+   interrupts = <77 0x8>;
+   interrupt-parent = <&ipic>;
+
+   // booting from NOR flash
+   ranges = <0 0x0 0xfe00 0x0200
+ 1 0x0 0xf800 0x8000
+ 3 0x0 0xe060 0x8000>;
+
+   [EMAIL PROTECTED],0 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "cfi-flash";
+   reg = <0 0x0 0x200>;
+   bank-width = <2>;
+   device-width = <1>;
+
+   [EMAIL PROTECTED] {
+   reg = <0x0 0x10>;
+   read-only;
+   };
+
+   [EMAIL PROTECTED] {
+   reg = <0x10 0x80>;
+   };
+
+   [EMAIL PROTECTED] {
+   reg = <0x1d0 0x20>;
+   };
+
+   [EMAIL PROTECTED] {
+   reg = <0x1f0 0x10>;
+   };
+   };
+
+   [EMAIL PROTECTED],0 {
+   reg = <1 0x0 0x8000>;
+   compatible = "fsl,mpc837xmds-bcsr";
+   };
+
+   [EMAIL PROTECTED],0 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "fsl,mpc8377-fcm-nand",
+"fsl,elbc-fcm-nand";
+   reg = <3 0x0 0x8000>;
+
+   [EMAIL PROTECTED] {
+   reg = <0x0 0x10>;
+   read-only;
+   };
+
+   [EMAIL PROTECTED] {
+   reg = <0x10 0x30>;
+   };
+
+   [EMAIL PROTECTED] {
+   reg = <0x40 0x1c0>;
+   };
+   };
+   };
+
[EMAIL PROTECTED] {
#address-cells = <1>;
#size-cells = <1>;
diff --git a/arch/powerpc/boot/dts/mpc8378_mds.dts 
b/arch/powerpc/boot/dts/mpc8378_mds.dts
index 3f9e9fe..2496e19 100644
--- a/arch/powerpc/boot/dts/mpc8378_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8378_mds.dts
@@ -47,6 +47,72 @@
reg = <0x 0x2000>;  // 512MB at 0
};
 
+   [EMAIL PROTECTED] {
+   #address-cells = <2>;
+   #size-cells = <1>;
+   compatible = "fsl,mpc8378-elbc", "fsl,elbc", "simple-bus";
+   reg = <0xe0005000 0x1000>;
+   interrupts = <77 0x8>;
+   interrupt-parent = <&ipic>;
+
+   // booting from NOR flash
+   ranges = <0 0x0 0xfe00 0x0200
+ 1 0x0 0xf800 0x8000
+ 3 0x0 0xe060 0x8000>;
+
+   [EMAIL PROTECTED],0 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   compatible = "cfi-flash";
+   reg = <0 0x0 0x200>;
+   bank-width = <2>;
+   device-width = <1>;
+
+   [EMAIL PROTECTED] {
+   reg = <0x0 0x10>;
+   read-only;
+   };
+
+   [EMAIL PROTECTED] {
+   reg = <0x10 0x80>;
+   };
+
+   [EMAIL PROTECTED] {
+   reg = <0x1d0 0x20>;
+   };
+
+   [EMAIL PROTECTED] {
+   reg = <0x1f0 0x10>;
+   };
+   };
+
+   [EMAIL PROTECTED],0 {
+   reg = <1 0x0 0x8000>;
+   compatible = "fsl,mpc837xmds-bcsr";
+