[PATCH] powerpc: Add MPC837x PCIE RC mode support

2007-12-19 Thread Li Li
The MPC837x PCIE controller hardware resources are initiated in u-boot.

Merge the MPC837x PCIE code into arch/powerpc/sysdev/fsl_pci.c

The MPC837x PCIE controller`s configure address bit field is uniqe:
bus number: bits 31-24
device number:  bits 23-19
function number:bits 18-16
ext reg number: bits 11-8
reg number: bits 7-2
This controller implements direct configure space access mode via outbound 
window.
Only map first 16M configure space at boot time. Remap the outbound window 
target address when 
want access another 16M configure space.

Add MPC837x PCIE controller specific fixup.

Add flag variant to mpc83xx_add_bridge function.

Signed-off-by: Tony Li [EMAIL PROTECTED]
---
 arch/powerpc/boot/dts/mpc8377_mds.dts |   54 --
 arch/powerpc/boot/dts/mpc8378_mds.dts |   54 --
 arch/powerpc/platforms/83xx/Kconfig   |2 +
 arch/powerpc/platforms/83xx/mpc8313_rdb.c |   10 ++-
 arch/powerpc/platforms/83xx/mpc832x_mds.c |   12 ++-
 arch/powerpc/platforms/83xx/mpc832x_rdb.c |   10 ++-
 arch/powerpc/platforms/83xx/mpc834x_itx.c |   10 ++-
 arch/powerpc/platforms/83xx/mpc834x_mds.c |   10 ++-
 arch/powerpc/platforms/83xx/mpc836x_mds.c |   12 ++-
 arch/powerpc/platforms/83xx/mpc837x_mds.c |   39 +++-
 arch/powerpc/platforms/83xx/mpc83xx.h |6 +-
 arch/powerpc/platforms/83xx/pci.c |   29 --
 arch/powerpc/sysdev/fsl_pci.c |  159 +
 arch/powerpc/sysdev/fsl_pci.h |3 +
 include/asm-powerpc/pci-bridge.h  |1 +
 include/linux/pci_ids.h   |4 +
 16 files changed, 375 insertions(+), 40 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc8377_mds.dts 
b/arch/powerpc/boot/dts/mpc8377_mds.dts
index 4402e39..5b6177a 100644
--- a/arch/powerpc/boot/dts/mpc8377_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8377_mds.dts
@@ -197,14 +197,6 @@
clock = d#100;
};
 
-   serdes2:[EMAIL PROTECTED] {
-   compatible = fsl,serdes;
-   reg = e3100 100;
-   vdd-1v;
-   protocol = pcie;
-   clock = d#100;
-   };
-
/* IPIC
 * interrupts cell = intr #, sense
 * sense values match linux IORESOURCE_IRQ_* defines:
@@ -279,4 +271,50 @@
compatible = fsl,mpc8349-pci;
device_type = pci;
};
+
+   [EMAIL PROTECTED] {
+   interrupt-map-mask = f800 0 0 7;
+   interrupt-map = 
+    0 0 1 ipic 1 8
+    0 0 2 ipic 1 8
+    0 0 3 ipic 1 8
+    0 0 4 ipic 1 8
+   ;
+   interrupt-parent =  ipic ;
+   interrupts = 1 8;
+   bus-range = 0 0;
+   ranges = 0200 0 A800 A800 0 1000
+ 0100 0  B800 0 0080;
+   clock-frequency = 0;
+   #interrupt-cells = 1;
+   #size-cells = 2;
+   #address-cells = 3;
+   reg = e0009000 1000
+  b000 0100;
+   compatible = fsl,mpc8377-pcie;
+   device_type = pci;
+   };
+
+   [EMAIL PROTECTED] {
+   interrupt-map-mask = f800 0 0 7;
+   interrupt-map = 
+    0 0 1 ipic 2 8
+    0 0 2 ipic 2 8
+    0 0 3 ipic 2 8
+    0 0 4 ipic 2 8
+   ;
+   interrupt-parent =  ipic ;
+   interrupts = 2 8;
+   bus-range = 0 0;
+   ranges = 0200 0 C800 C800 0 1000
+ 0100 0  D800 0 0080;
+   clock-frequency = 0;
+   #interrupt-cells = 1;
+   #size-cells = 2;
+   #address-cells = 3;
+   reg = e000a000 1000
+  d000 0100;
+   compatible = fsl,mpc8377-pcie;
+   device_type = pci;
+   };
 };
diff --git a/arch/powerpc/boot/dts/mpc8378_mds.dts 
b/arch/powerpc/boot/dts/mpc8378_mds.dts
index 54171f4..83ad974 100644
--- a/arch/powerpc/boot/dts/mpc8378_mds.dts
+++ b/arch/powerpc/boot/dts/mpc8378_mds.dts
@@ -179,14 +179,6 @@
clock = d#100;
};
 
-   serdes2:[EMAIL PROTECTED] {
-   compatible = fsl,serdes;
-   reg = e3100 100;
-   vdd-1v;
-   protocol = pcie;
-   clock = d#100;
-   };
-
/* IPIC
 * interrupts cell = intr #, sense
 * sense values match linux IORESOURCE_IRQ_* defines:
@@ 

[patch] mpc83xx: Add MPC837x PCIE controller RC mode support

2007-12-19 Thread Li Li
Initial the MPC837x PCIE controller.
Note that configue address bit field is not compatible with PCIE spec 10a.
Just map first 16M pci configure space which corresponding to a bus configure 
space at boot.


Signed-off-by: Tony Li [EMAIL PROTECTED]
---
 Makefile  |   17 ++-
 board/freescale/mpc837xemds/Makefile  |2 +-
 board/freescale/mpc837xemds/mpc837xemds.c |3 +
 board/freescale/mpc837xemds/pci.c |3 +-
 board/freescale/mpc837xemds/pcie.c|   95 +
 cpu/mpc83xx/Makefile  |2 +-
 cpu/mpc83xx/pcie.c|  315 +
 doc/README.mpc837xemds|6 +
 include/asm-ppc/immap_83xx.h  |  119 ++-
 include/configs/MPC837XEMDS.h |   23 ++-
 include/mpc83xx.h |   42 
 include/pci.h |4 +
 12 files changed, 619 insertions(+), 12 deletions(-)
 create mode 100644 board/freescale/mpc837xemds/pcie.c
 create mode 100644 cpu/mpc83xx/pcie.c

diff --git a/Makefile b/Makefile
index f8a038a..5934f77 100644
--- a/Makefile
+++ b/Makefile
@@ -1831,13 +1831,26 @@ MPC8360EMDS_SLAVE_config:   unconfig
@$(MKCONFIG) -a MPC8360EMDS ppc mpc83xx mpc8360emds freescale
 
 MPC837XEMDS_config \
-MPC837XEMDS_HOST_config:   unconfig
+MPC837XEMDS_HOST_config \
+MPC837XEMDS_PCIE_config \
+MPC837XEMDS_PCIE_X2_config:unconfig
@mkdir -p $(obj)include
@echo  $(obj)include/config.h ; \
if [ $(findstring _HOST_,$@) ] ; then \
echo -n ... PCI HOST  ; \
echo #define CONFIG_PCI $(obj)include/config.h ; \
-   fi ;
+   echo #define CONFIG_PQ_MDS_PIB $(obj)include/config.h ; \
+   fi ; \
+   if [ $(findstring _PCIE_,$@) ] ; then\
+   echo -n ... PCIE ; \
+   echo #define CONFIG_PCI $(obj)include/config.h ; \
+   echo #define CONFIG_PCIE $(obj)include/config.h ; \
+   fi; \
+   if [ $(findstring _PCIE_X2_,$@) ] ; then\
+   echo -n _X2 ; \
+   echo #define CONFIG_PCIE_X2 $(obj)include/config.h ; \
+   fi;
+
@$(MKCONFIG) -a MPC837XEMDS ppc mpc83xx mpc837xemds freescale
 
 sbc8349_config:unconfig
diff --git a/board/freescale/mpc837xemds/Makefile 
b/board/freescale/mpc837xemds/Makefile
index 3cffcfb..319ebc2 100644
--- a/board/freescale/mpc837xemds/Makefile
+++ b/board/freescale/mpc837xemds/Makefile
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(BOARD).a
 
-COBJS  := $(BOARD).o pci.o nand.o
+COBJS  := $(BOARD).o pci.o pcie.o nand.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
diff --git a/board/freescale/mpc837xemds/mpc837xemds.c 
b/board/freescale/mpc837xemds/mpc837xemds.c
index 330e0e8..ff6f14a 100644
--- a/board/freescale/mpc837xemds/mpc837xemds.c
+++ b/board/freescale/mpc837xemds/mpc837xemds.c
@@ -48,6 +48,9 @@ int board_early_init_r(void)
 #ifdef CONFIG_PQ_MDS_PIB
pib_init();
 #endif
+#ifdef CONFIG_PCIE
+   pcie_init_board();
+#endif
return 0;
 }
 
diff --git a/board/freescale/mpc837xemds/pci.c 
b/board/freescale/mpc837xemds/pci.c
index ab90979..72e8dcc 100644
--- a/board/freescale/mpc837xemds/pci.c
+++ b/board/freescale/mpc837xemds/pci.c
@@ -59,7 +59,8 @@ void pci_init_board(void)
pci_law[1].ar = LBLAWAR_EN | LBLAWAR_1MB;
 
udelay(2000);
-
+#if defined(CONFIG_PQ_MDS_PIB)
mpc83xx_pci_init(1, reg, 0);
+#endif
 }
 #endif /* CONFIG_PCI */
diff --git a/board/freescale/mpc837xemds/pcie.c 
b/board/freescale/mpc837xemds/pcie.c
new file mode 100644
index 000..474f848
--- /dev/null
+++ b/board/freescale/mpc837xemds/pcie.c
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2007 Freescale Semiconductor, Inc.
+ * Tony Li [EMAIL PROTECTED]
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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 asm/mmu.h
+#include asm/io.h
+#include common.h
+#include mpc83xx.h
+#include pci.h
+#include asm/fsl_serdes.h
+
+#if defined(CONFIG_PCIE)
+static struct pci_region pci_regions_0[] = {
+   {
+   bus_start: CFG_PCIE1_MEM_BASE,
+   phys_start: CFG_PCIE1_MEM_PHYS,
+   size: CFG_PCIE1_MEM_SIZE,
+   flags: PCI_REGION_MEM
+   },
+   {
+   bus_start: CFG_PCIE1_IO_BASE,
+   phys_start: CFG_PCIE1_IO_PHYS,
+   size: CFG_PCIE1_IO_SIZE,
+   flags: PCI_REGION_IO
+   }
+};
+
+static struct pci_region pci_regions_1[] = {
+   {
+   bus_start: CFG_PCIE2_MEM_BASE,
+   phys_start: CFG_PCIE2_MEM_PHYS,
+   size: 

[PATCH 0/2] ps3fb bug fixes for 2.6.24

2007-12-19 Thread Geert Uytterhoeven
Hi Linus, Andrew,

Here are 2 bug fixes for the PS3 Virtual Frame Buffer Device Driver:
  [1] ps3fb: Update for firmware 2.10
  [2] ps3fb: Fix ps3fb free_irq() dev_id

The first one fixes a problem with PS3 firmware 2.10 (released yesterday),
which causes a non-working display.

The second one fixes an incorrect dev_id parameter used with the free_irq()
calls.

Please apply for 2.6.24. Thanks!

With kind regards,
 
Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
 
Phone:+32 (0)2 700 8453 
Fax:  +32 (0)2 700 8622 
E-mail:   [EMAIL PROTECTED] 
Internet: http://www.sony-europe.com/

Sony Network and Software Technology Center Europe  
A division of Sony Service Centre (Europe) N.V. 
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium  
VAT BE 0413.825.160 · RPR Brussels  
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

[PATCH 1/2] ps3fb: Update for firmware 2.10

2007-12-19 Thread Geert Uytterhoeven
From: Geert Uytterhoeven [EMAIL PROTECTED]

ps3fb: Update for firmware 2.10

As of PS3 firmware version 2.10, the GPU command buffer size must be at least 2
MiB large. Since we use only a small part of the GPU command buffer and don't
want to waste precious XDR memory, move the GPU command buffer back to the
start of the XDR memory reserved for ps3fb and let the unused part overlap with
the actual frame buffer.

Signed-off-by: Geert Uytterhoeven [EMAIL PROTECTED]
---
 drivers/video/ps3fb.c |   24 ++--
 1 files changed, 18 insertions(+), 6 deletions(-)

--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -51,7 +51,8 @@
 #define L1GPU_DISPLAY_SYNC_HSYNC   1
 #define L1GPU_DISPLAY_SYNC_VSYNC   2
 
-#define GPU_CMD_BUF_SIZE   (64 * 1024)
+#define GPU_CMD_BUF_SIZE   (2 * 1024 * 1024)
+#define GPU_FB_START   (64 * 1024)
 #define GPU_IOIF   (0x0d00UL)
 #define GPU_ALIGN_UP(x)_ALIGN_UP((x), 64)
 #define GPU_MAX_LINE_LENGTH(65536 - 64)
@@ -406,6 +407,7 @@ static void ps3fb_sync_image(struct devi
if (src_line_length != dst_line_length)
line_length |= (u64)src_line_length  32;
 
+   src_offset += GPU_FB_START;
status = lv1_gpu_context_attribute(ps3fb.context_handle,
   L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT,
   dst_offset, GPU_IOIF + src_offset,
@@ -976,9 +978,8 @@ static int ps3fb_xdr_settings(u64 xdr_lp
 
status = lv1_gpu_context_attribute(ps3fb.context_handle,
   L1GPU_CONTEXT_ATTRIBUTE_FB_SETUP,
-  xdr_lpar + ps3fb.xdr_size,
-  GPU_CMD_BUF_SIZE,
-  GPU_IOIF + ps3fb.xdr_size, 0);
+  xdr_lpar, GPU_CMD_BUF_SIZE,
+  GPU_IOIF, 0);
if (status) {
dev_err(dev,
%s: lv1_gpu_context_attribute FB_SETUP failed: %d\n,
@@ -1061,6 +1062,11 @@ static int __devinit ps3fb_probe(struct 
struct task_struct *task;
unsigned long max_ps3fb_size;
 
+   if (ps3fb_videomemory.size  GPU_CMD_BUF_SIZE) {
+   dev_err(dev-core, %s: Not enough video memory\n, __func__);
+   return -ENOMEM;
+   }
+
status = ps3_open_hv_device(dev);
if (status) {
dev_err(dev-core, %s: ps3_open_hv_device failed\n,
@@ -1131,8 +1137,14 @@ static int __devinit ps3fb_probe(struct 
/* Clear memory to prevent kernel info leakage into userspace */
memset(ps3fb.xdr_ea, 0, ps3fb_videomemory.size);
 
-   /* The GPU command buffer is at the end of video memory */
-   ps3fb.xdr_size = ps3fb_videomemory.size - GPU_CMD_BUF_SIZE;
+   /*
+* The GPU command buffer is at the start of video memory
+* As we don't use the full command buffer, we can put the actual
+* frame buffer at offset GPU_FB_START and save some precious XDR
+* memory
+*/
+   ps3fb.xdr_ea += GPU_FB_START;
+   ps3fb.xdr_size = ps3fb_videomemory.size - GPU_FB_START;
 
retval = ps3fb_xdr_settings(xdr_lpar, dev-core);
if (retval)

With kind regards,
 
Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
 
Phone:+32 (0)2 700 8453 
Fax:  +32 (0)2 700 8622 
E-mail:   [EMAIL PROTECTED] 
Internet: http://www.sony-europe.com/

Sony Network and Software Technology Center Europe  
A division of Sony Service Centre (Europe) N.V. 
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium  
VAT BE 0413.825.160 · RPR Brussels  
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

[PATCH 2/2] ps3fb: Fix ps3fb free_irq() dev_id

2007-12-19 Thread Geert Uytterhoeven
From: Geoff Levand [EMAIL PROTECTED]

The dev_id arg passed to free_irq() must match that passed to
request_irq().

Fixes this PS3 error message: 

  Trying to free already-free IRQ 44

Signed-off-by: Geoff Levand [EMAIL PROTECTED]
Signed-off-by: Geert Uytterhoeven [EMAIL PROTECTED]
---
 drivers/video/ps3fb.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -1212,7 +1212,7 @@ err_fb_dealloc:
 err_framebuffer_release:
framebuffer_release(info);
 err_free_irq:
-   free_irq(ps3fb.irq_no, dev);
+   free_irq(ps3fb.irq_no, dev-core);
ps3_irq_plug_destroy(ps3fb.irq_no);
 err_iounmap_dinfo:
iounmap((u8 __iomem *)ps3fb.dinfo);
@@ -1247,7 +1247,7 @@ static int ps3fb_shutdown(struct ps3_sys
kthread_stop(task);
}
if (ps3fb.irq_no) {
-   free_irq(ps3fb.irq_no, dev);
+   free_irq(ps3fb.irq_no, dev-core);
ps3_irq_plug_destroy(ps3fb.irq_no);
}
iounmap((u8 __iomem *)ps3fb.dinfo);

With kind regards,
 
Geert Uytterhoeven
Software Architect

Sony Network and Software Technology Center Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
 
Phone:+32 (0)2 700 8453 
Fax:  +32 (0)2 700 8622 
E-mail:   [EMAIL PROTECTED] 
Internet: http://www.sony-europe.com/

Sony Network and Software Technology Center Europe  
A division of Sony Service Centre (Europe) N.V. 
Registered office: Technologielaan 7 · B-1840 Londerzeel · Belgium  
VAT BE 0413.825.160 · RPR Brussels  
Fortis Bank Zaventem · Swift GEBABEBB08A · IBAN BE39001382358619___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH] [POWERPC][RFC] MPC8360E-RDK: Device tree and board file

2007-12-19 Thread Anton Vorontsov
On Mon, Dec 17, 2007 at 11:03:04AM -0600, Scott Wood wrote:
 On Mon, Dec 17, 2007 at 04:14:03PM +1100, David Gibson wrote:
[...]
   + ranges = 0 0xe010 0x0010;
   + reg = 0xe010 0x480;
   + /* filled by u-boot */
   + brg-frequency = 0;
   + bus-frequency = 0;
  
  This should probably be clock-frequency, not bus-frequency.  After
  all, it's a bus node, what other sort of frequency would it be.
 
 Actually, it should probably be dropped altogether.

No, we can't drop it. We can replace it by clock-frequency, but
not just drop it, because bus frequency used by at least one driver --
spi_mpc83xx, to calculate proper clocks prescaling value.

As for renaming this property... well, I can rename it, but
bus-frequency is so widely used: bootloaders are depending on this
property, so we'll have to leave legacy code in linux to find
legacy properties... thus RDK will by just some kind of white crow
among others (at first).

Do we really want to rename it after all? It's not a problem per se,
just want to hear some consensus.

 
   + [EMAIL PROTECTED] {
   + device_type = muram;
  
  And this device_type needs to go, too.
 
 Yes, replace it with compatible = fsl,cpm-muram.

cpm? This is QE. I'll name it fsl,qe-muram. If you think it
is fully compatible with cpm, then I'd better add
fsl,qe-muram, fsl,cpm-muram.

   + ranges = 0 0x0001 0xc000;
   +
   + [EMAIL PROTECTED] {
   + reg = 0 0xc000;
 
 compatible = fsl,cpm-muram-data.

ditto.


Thanks,

-- 
Anton Vorontsov
email: [EMAIL PROTECTED]
backup email: [EMAIL PROTECTED]
irc://irc.freenode.net/bd2
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 11/20] [POWERPC] Wire up PCI on Bamboo board

2007-12-19 Thread Valentine Barshak
Benjamin Herrenschmidt wrote:
 This adds the device-tree bits  call to ppc4xx_pci_find_bridges()
 to make PCI work on the Bamboo board
 
 Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
 ---
 
  arch/powerpc/boot/dts/bamboo.dts |   40 
 ++-
  1 file changed, 39 insertions(+), 1 deletion(-)
 
 --- linux-work.orig/arch/powerpc/boot/dts/bamboo.dts  2007-12-10 
 15:56:59.0 +1100
 +++ linux-work/arch/powerpc/boot/dts/bamboo.dts   2007-12-10 
 16:39:51.0 +1100
 @@ -239,10 +239,48 @@
   zmii-channel = 1;
   };
   };
 +
 + PCI0: [EMAIL PROTECTED] {
 + device_type = pci;
 + #interrupt-cells = 1;
 + #size-cells = 2;
 + #address-cells = 3;
 + compatible = ibm,plb440ep-pci, ibm,plb-pci;
 + primary;
 + reg = 0 eec0 8 /* Config space access */
 +0 eed8 4 /* IACK */
 +0 eed8 4 /* Special cycle */
 +0 ef48 40;  /* Internal registers */

Why ef48 here? IIRC, the docs say it should be ef40, while 
ef400040 - ef4f are reserved and can mirror local registers.
Thanks,
Valentine.


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


Re: dtc: Update TODO files

2007-12-19 Thread Jon Loeliger
So, like, the other day David Gibson mumbled:
 This patch makes a bunch of updates to the TODO files for dtc and
 libfdt, some of them rather overdue.

Applied.

jdl

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


Re: [PATCH] [POWERPC][RFC] MPC8360E-RDK: Device tree and board file

2007-12-19 Thread Scott Wood
On Wed, Dec 19, 2007 at 04:05:59PM +0300, Anton Vorontsov wrote:
 No, we can't drop it. We can replace it by clock-frequency, but
 not just drop it, because bus frequency used by at least one driver --
 spi_mpc83xx, to calculate proper clocks prescaling value.

Hmm... maybe it should be using the brg frequency instead?  I'll look at
the documentation to see what the actual clock it's looking for is.

  Yes, replace it with compatible = fsl,cpm-muram.
 
 cpm? This is QE. 

QE, CPM3, whatever.  This isn't the marketing department. :-)

. I'll name it fsl,qe-muram. If you think it
 is fully compatible with cpm, then I'd better add
 fsl,qe-muram, fsl,cpm-muram.

It's just memory, so there's not much to be incompatible.  It's used for
(mostly) the same things on QE and older CPMs, and *should* be matched by
the same code even if it isn't today.

I'm OK with listing both QE and CPM if that's what you want to do,
though.

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


[RFC] [PATCH 1/3] Merge mkimage tool for building uImages

2007-12-19 Thread Josh Boyer
Several platforms require the mkimage tool to generate a uImage file that is
used with U-Boot.  This brings the mkimage tool in-kernel to enable building
those platforms without having mkimage internally provided.

This is currently based off of the version found in U-Boot 1.3.1.

Signed-off-by: Josh Boyer [EMAIL PROTECTED]

---
 scripts/Makefile  |1 
 scripts/mkimage/Makefile  |6 
 scripts/mkimage/crc32.c   |  199 
 scripts/mkimage/mkimage.c |  728 ++
 scripts/mkimage/sha1.c|  413 ++
 scripts/mkimage/sha1.h|  115 +++
 scripts/mkimage/uimage.h  |  161 ++
 7 files changed, 1623 insertions(+)

--- linux-2.6.orig/scripts/Makefile
+++ linux-2.6/scripts/Makefile
@@ -20,6 +20,7 @@ hostprogs-y += unifdef
 
 subdir-$(CONFIG_MODVERSIONS) += genksyms
 subdir-y += mod
+subdir-y += mkimage
 
 # Let clean descend into subdirs
 subdir-+= basic kconfig package
--- /dev/null
+++ linux-2.6/scripts/mkimage/mkimage.c
@@ -0,0 +1,728 @@
+/*
+ * (C) Copyright 2000-2004
+ * DENX Software Engineering
+ * Wolfgang Denk, [EMAIL PROTECTED]
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that 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., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include errno.h
+#include fcntl.h
+#include stdio.h
+#include stdlib.h
+#include string.h
+#include netinet/in.h/* for host / network byte order 
conversions*/
+#include sys/mman.h
+#include sys/stat.h
+#include time.h
+#include unistd.h
+
+#ifndefO_BINARY/* should be define'd on __WIN32__ */
+#define O_BINARY   0
+#endif
+
+#include uimage.h
+
+extern int errno;
+
+#ifndef MAP_FAILED
+#define MAP_FAILED (-1)
+#endif
+
+char *cmdname;
+
+extern unsigned long crc32 (unsigned long crc, const char *buf, unsigned int 
len);
+
+typedef struct table_entry {
+   int val;/* as defined in image.h*/
+   char*sname; /* short (input) name   */
+   char*lname; /* long (output) name   */
+} table_entry_t;
+
+table_entry_t arch_name[] = {
+{  IH_CPU_INVALID, NULL,   Invalid CPU,  },
+{  IH_CPU_ALPHA,   alpha,Alpha,},
+{  IH_CPU_ARM, arm,  ARM,  },
+{  IH_CPU_I386,x86,  Intel x86,},
+{  IH_CPU_IA64,ia64, IA64, },
+{  IH_CPU_M68K,m68k, MC68000,  },
+{  IH_CPU_MICROBLAZE,  microblaze,   MicroBlaze,   },
+{  IH_CPU_MIPS,mips, MIPS, },
+{  IH_CPU_MIPS64,  mips64,   MIPS 64 Bit,  },
+{  IH_CPU_NIOS,nios, NIOS, },
+{  IH_CPU_NIOS2,   nios2,NIOS II,  },
+{  IH_CPU_PPC, ppc,  PowerPC,  },
+{  IH_CPU_S390,s390, IBM S390, },
+{  IH_CPU_SH,  sh,   SuperH,   },
+{  IH_CPU_SPARC,   sparc,SPARC,},
+{  IH_CPU_SPARC64, sparc64,  SPARC 64 Bit, },
+{  IH_CPU_BLACKFIN,blackfin, Blackfin, },
+{  IH_CPU_AVR32,   avr32,AVR32,},
+{  -1, , , },
+};
+
+table_entry_t os_name[] = {
+{  IH_OS_INVALID,  NULL,   Invalid OS,   },
+{  IH_OS_4_4BSD,   4_4bsd,   4_4BSD,   },
+{  IH_OS_ARTOS,artos,ARTOS,},
+{  IH_OS_DELL, dell, Dell, },
+{  IH_OS_ESIX, esix, Esix, },
+{  IH_OS_FREEBSD,  freebsd,  FreeBSD,  },
+{  IH_OS_IRIX, irix, Irix, },
+{  IH_OS_LINUX,linux,Linux,},
+{  IH_OS_LYNXOS,   lynxos,   LynxOS,   },
+{  IH_OS_NCR,  ncr,  NCR,  },
+{  IH_OS_NETBSD,   netbsd,   NetBSD,   },
+{  IH_OS_OPENBSD,  openbsd,  OpenBSD,  },
+{  IH_OS_PSOS, psos, pSOS, },
+{  IH_OS_QNX,  qnx,  QNX,  },
+{  IH_OS_RTEMS,rtems,RTEMS,},

[RFC] [PATCH 3/3] Remove mkuboot.sh script

2007-12-19 Thread Josh Boyer
Now that the mkimage tool is merged into the kernel, we can remove the unused
mkuboot.sh script.

Signed-off-by: Josh Boyer [EMAIL PROTECTED]

---
 scripts/mkuboot.sh |   19 ---
 1 file changed, 19 deletions(-)

--- linux-2.6.orig/scripts/mkuboot.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-
-#
-# Build U-Boot image when `mkimage' tool is available.
-#
-
-MKIMAGE=$(type -path ${CROSS_COMPILE}mkimage)
-
-if [ -z ${MKIMAGE} ]; then
-   MKIMAGE=$(type -path mkimage)
-   if [ -z ${MKIMAGE} ]; then
-   # Doesn't exist
-   echo 'mkimage command not found - U-Boot images will not be 
built' 2
-   exit 0;
-   fi
-fi
-
-# Call mkimage to create U-Boot image
-${MKIMAGE} $@
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[RFC] [PATCH 2/3] Rework arch specific Makefiles to use mkimage

2007-12-19 Thread Josh Boyer
Rework the architecture specific Makefiles to use the in-kernel version
of the mkimage tool.

Signed-off-by: Josh Boyer [EMAIL PROTECTED]

---
 arch/arm/boot/Makefile  |4 ++--
 arch/avr32/boot/images/Makefile |4 ++--
 arch/blackfin/boot/Makefile |4 ++--
 arch/powerpc/boot/Makefile  |8 ++--
 arch/powerpc/boot/wrapper   |2 +-
 arch/ppc/boot/images/Makefile   |4 ++--
 arch/sh/boot/Makefile   |4 ++--
 7 files changed, 17 insertions(+), 13 deletions(-)

--- linux-2.6.orig/arch/arm/boot/Makefile
+++ linux-2.6/arch/arm/boot/Makefile
@@ -11,7 +11,7 @@
 # Copyright (C) 1995-2002 Russell King
 #
 
-MKIMAGE := $(srctree)/scripts/mkuboot.sh
+MKIMAGE := $(srctree)/scripts/mkimage/mkimage
 
 ifneq ($(MACHINE),)
 include $(srctree)/$(MACHINE)/Makefile.boot
@@ -60,7 +60,7 @@ $(obj)/zImage:$(obj)/compressed/vmlinux
 endif
 
 quiet_cmd_uimage = UIMAGE  $@
-  cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A arm -O linux -T
kernel \
+  cmd_uimage = $(MKIMAGE) -A arm -O linux -T kernel \
   -C none -a $(ZRELADDR) -e $(ZRELADDR) \
   -n 'Linux-$(KERNELRELEASE)' -d $ $@
 
--- linux-2.6.orig/arch/avr32/boot/images/Makefile
+++ linux-2.6/arch/avr32/boot/images/Makefile
@@ -6,7 +6,7 @@
 # for more details.
 #
 
-MKIMAGE:= $(srctree)/scripts/mkuboot.sh
+MKIMAGE:= $(srctree)/scripts/mkimage/mkimage
 
 extra-y:= vmlinux.bin vmlinux.gz
 
@@ -18,7 +18,7 @@ $(obj)/vmlinux.gz: $(obj)/vmlinux.bin FO
$(call if_changed,gzip)
 
 quiet_cmd_uimage = UIMAGE $@
-  cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A avr32 -O linux -T
kernel  \
+  cmd_uimage = $(MKIMAGE) -A avr32 -O linux -T kernel  \
-C gzip -a $(CONFIG_LOAD_ADDRESS) -e
$(CONFIG_ENTRY_ADDRESS) \ -n 'Linux-$(KERNELRELEASE)' -d $ $@
 
--- linux-2.6.orig/arch/blackfin/boot/Makefile
+++ linux-2.6/arch/blackfin/boot/Makefile
@@ -6,13 +6,13 @@
 # for more details.
 #
 
-MKIMAGE := $(srctree)/scripts/mkuboot.sh
+MKIMAGE := $(srctree)/scripts/mkimage/mkimage
 
 targets := vmImage
 extra-y += vmlinux.bin vmlinux.gz
 
 quiet_cmd_uimage = UIMAGE  $@
-  cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A $(ARCH) -O linux -T
kernel \
+  cmd_uimage = $(MKIMAGE) -A $(ARCH) -O linux -T kernel \
-C gzip -n 'Linux-$(KERNELRELEASE)' -a
$(CONFIG_BOOT_LOAD) \ -e $(shell $(NM) vmlinux | awk '$$NF ==
__start {print $$1}') \ -d $ $@
--- linux-2.6.orig/arch/ppc/boot/images/Makefile
+++ linux-2.6/arch/ppc/boot/images/Makefile
@@ -2,7 +2,7 @@
 # This dir holds all of the images for PPC machines.
 # Tom Rini January 2001
 
-MKIMAGE:= $(srctree)/scripts/mkuboot.sh
+MKIMAGE:= $(srctree)/scripts/mkimage/mkimage
 
 extra-y:= vmlinux.bin vmlinux.gz
 
@@ -19,7 +19,7 @@ $(obj)/vmlinux.gz: $(obj)/vmlinux.bin FO
$(call if_changed,mygzip)
 
 quiet_cmd_uimage = UIMAGE  $@
-  cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A ppc -O linux -T
kernel \
+  cmd_uimage = $(MKIMAGE) -A ppc -O linux -T kernel \
-C gzip -a  -e  -n
'Linux-$(KERNELRELEASE)' \ -d $ $@
 
--- linux-2.6.orig/arch/sh/boot/Makefile
+++ linux-2.6/arch/sh/boot/Makefile
@@ -8,7 +8,7 @@
 # Copyright (C) 1999 Stuart Menefy
 #
 
-MKIMAGE := $(srctree)/scripts/mkuboot.sh
+MKIMAGE := $(srctree)/scripts/mkimage/mkimage
 
 #
 # Assign safe dummy values if these variables are not defined,
@@ -38,7 +38,7 @@ KERNEL_LOAD   := $(shell /bin/bash -c 'pri
$(CONFIG_ZERO_PAGE_OFFSET)+0x1000]')
 
 quiet_cmd_uimage = UIMAGE  $@
-  cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A sh -O linux -T kernel
\
+  cmd_uimage = $(MKIMAGE) -A sh -O linux -T kernel \
   -C none -a $(KERNEL_LOAD) -e $(KERNEL_LOAD) \
   -n 'Linux-$(KERNELRELEASE)' -d $ $@
 
--- linux-2.6.orig/arch/powerpc/boot/wrapper
+++ linux-2.6/arch/powerpc/boot/wrapper
@@ -259,7 +259,7 @@ coff)
 ;;
 cuboot*)
 gzip -f -9 $ofile
-mkimage -A ppc -O linux -T kernel -C gzip -a $base -e $entry \
+$objbin/mkimage -A ppc -O linux -T kernel -C gzip -a $base -e
$entry \ $uboot_version -d $ofile.gz $ofile
 ;;
 treeboot*)
--- linux-2.6.orig/arch/powerpc/boot/Makefile
+++ linux-2.6/arch/powerpc/boot/Makefile
@@ -123,7 +123,7 @@ extra-y := $(obj)/wrapper.a
$(obj-plat) $(obj)/zImage.lds $(obj)/zImage.coff.lds
$(obj)/zImage.ps3.lds 
 wrapper:=$(srctree)/$(src)/wrapper
-wrapperbits:= $(extra-y) $(addprefix $(obj)/,addnote hack-coff
mktree) \ +wrapperbits  := $(extra-y) $(addprefix $(obj)/,addnote
hack-coff mktree mkimage) \ $(wrapper) FORCE
 
 #
@@ -197,6 +197,7 @@ dts = $(if $(shell echo $(CONFIG_DEVICE_
 endif
 endif
 
+
 # Don't put the ramdisk on the pattern rule; when its missing make
will try # the pattern rule with less dependencies that also matches
(even with the # hard dependency listed).
@@ -246,9 

Linux on Freescale e200

2007-12-19 Thread Per-Erik Johansson
Hi

I'm wondering if someone has ever tried to get Linux running on a
Freescale e200 core?
I found a patch to the Linux kernel from back in 2005:
(http://linux.derkeiler.com/Mailing-Lists/Kernel/2005-06/5731.html)
And it is listed as a processor type in Linux-2.6.23.11
I know that there has been some confusion about e200 and e500 cores, old
e200 renamed to e500, but from what I understand the e200 core now listed
in the kernel is the one currently being used in MPC55xx

I'm having a MPC5554, e200z6 core, that I'm supposed to get Linux running
on (master thesis) and any pointers and tips are appreciated.
Just finished porting/tweaking the Redboot boot loader, and I'm now moving
on to the Linux (porting?) part.

Cheers
 Per-Erik

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


Re: Linux on Freescale e200

2007-12-19 Thread Kumar Gala

On Dec 19, 2007, at 7:56 AM, Per-Erik Johansson wrote:

 Hi

 I'm wondering if someone has ever tried to get Linux running on a
 Freescale e200 core?
 I found a patch to the Linux kernel from back in 2005:
 (http://linux.derkeiler.com/Mailing-Lists/Kernel/2005-06/5731.html)
 And it is listed as a processor type in Linux-2.6.23.11
 I know that there has been some confusion about e200 and e500 cores,  
 old
 e200 renamed to e500, but from what I understand the e200 core now  
 listed
 in the kernel is the one currently being used in MPC55xx

 I'm having a MPC5554, e200z6 core, that I'm supposed to get Linux  
 running
 on (master thesis) and any pointers and tips are appreciated.
 Just finished porting/tweaking the Redboot boot loader, and I'm now  
 moving
 on to the Linux (porting?) part.

I'd suggest looking at getting u-boot running instead since that's we  
use on the majority of freescale PPCs.

We did a port a while back to the e200.. so most of the basic bits  
should be there.  There might be some bit rot from its like of usage.

What peripheral set are you looking to get working on the 5554?

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


[PATCH 0/4] device_type/compatible cleanups

2007-12-19 Thread Anton Vorontsov
Hi all,

Here are few cleanups purposed by David Gibson and Scott Wood:
http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048388.html

Patches are well split and bisect-able.

Scott, I didn't add fsl,cpm-muram stuff, it just doesn't make
sense now: qe and cpm anyway using different code base.

Thanks,

-- 
Anton Vorontsov
email: [EMAIL PROTECTED]
backup email: [EMAIL PROTECTED]
irc://irc.freenode.net/bd2
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 11/20] [POWERPC] Wire up PCI on Bamboo board

2007-12-19 Thread Benjamin Herrenschmidt

On Wed, 2007-12-19 at 16:34 +0300, Valentine Barshak wrote:

  --- linux-work.orig/arch/powerpc/boot/dts/bamboo.dts2007-12-10 
  15:56:59.0 +1100
  +++ linux-work/arch/powerpc/boot/dts/bamboo.dts 2007-12-10 
  16:39:51.0 +1100
  @@ -239,10 +239,48 @@
  zmii-channel = 1;
  };
  };
  +
  +   PCI0: [EMAIL PROTECTED] {
  +   device_type = pci;
  +   #interrupt-cells = 1;
  +   #size-cells = 2;
  +   #address-cells = 3;
  +   compatible = ibm,plb440ep-pci, ibm,plb-pci;
  +   primary;
  +   reg = 0 eec0 8 /* Config space access */
  +  0 eed8 4 /* IACK */
  +  0 eed8 4 /* Special cycle */
  +  0 ef48 40;  /* Internal registers */
 
 Why ef48 here? IIRC, the docs say it should be ef40, while 
 ef400040 - ef4f are reserved and can mirror local registers.

Dunno... probably a typo, though it worked :-) I'll fix it up.

Ben.


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


Re: [PATCH 0/4] device_type/compatible cleanups

2007-12-19 Thread Scott Wood
Anton Vorontsov wrote:
 Scott, I didn't add fsl,cpm-muram stuff, it just doesn't make
 sense now: qe and cpm anyway using different code base.

That should change.

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


[PATCH 1/4] [POWERPC] qe_lib and users: get rid of device_type and model

2007-12-19 Thread Anton Vorontsov
Now we're searching for fsl,qe, fsl,qe-muram, fsl,qe-muram-data.

Per http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048388.html

Signed-off-by: Anton Vorontsov [EMAIL PROTECTED]
---
 arch/powerpc/boot/dts/mpc832x_mds.dts |6 +++---
 arch/powerpc/boot/dts/mpc832x_rdb.dts |6 +++---
 arch/powerpc/boot/dts/mpc836x_mds.dts |6 +++---
 arch/powerpc/boot/dts/mpc8568mds.dts  |6 +++---
 arch/powerpc/sysdev/fsl_soc.c |2 +-
 arch/powerpc/sysdev/qe_lib/qe.c   |7 ---
 6 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts 
b/arch/powerpc/boot/dts/mpc832x_mds.dts
index 26ac467..ef8cd1e 100644
--- a/arch/powerpc/boot/dts/mpc832x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
@@ -175,18 +175,18 @@
[EMAIL PROTECTED] {
#address-cells = 1;
#size-cells = 1;
-   device_type = qe;
-   model = QE;
+   compatible = fsl,qe;
ranges = 0 e010 0010;
reg = e010 480;
brg-frequency = 0;
bus-frequency = BCD3D80;
 
[EMAIL PROTECTED] {
-   device_type = muram;
+   compatible = fsl,qe-muram;
ranges = 0 0001 4000;
 
[EMAIL PROTECTED] {
+   compatible = fsl,qe-muram-data;
reg = 0 4000;
};
};
diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts 
b/arch/powerpc/boot/dts/mpc832x_rdb.dts
index 10ff7aa..7c4f028 100644
--- a/arch/powerpc/boot/dts/mpc832x_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts
@@ -165,18 +165,18 @@
[EMAIL PROTECTED] {
#address-cells = 1;
#size-cells = 1;
-   device_type = qe;
-   model = QE;
+   compatible = fsl,qe;
ranges = 0 e010 0010;
reg = e010 480;
brg-frequency = 0;
bus-frequency = BCD3D80;
 
[EMAIL PROTECTED] {
-   device_type = muram;
+   compatible = fsl,qe-muram;
ranges = 0 0001 4000;
 
[EMAIL PROTECTED] {
+   compatible = fsl,qe-muram-data;
reg = 0 4000;
};
};
diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts 
b/arch/powerpc/boot/dts/mpc836x_mds.dts
index fd841b2..5c73786 100644
--- a/arch/powerpc/boot/dts/mpc836x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
@@ -206,18 +206,18 @@
[EMAIL PROTECTED] {
#address-cells = 1;
#size-cells = 1;
-   device_type = qe;
-   model = QE;
+   compatible = fsl,qe;
ranges = 0 e010 0010;
reg = e010 480;
brg-frequency = 0;
bus-frequency = 179A7B00;
 
[EMAIL PROTECTED] {
-   device_type = muram;
+   device_type = fsl,qe-muram;
ranges = 0 0001 c000;
 
[EMAIL PROTECTED]
+   device_type = fsl,qe-muram-data;
reg = 0 c000;
};
};
diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts 
b/arch/powerpc/boot/dts/mpc8568mds.dts
index 5818a7c..7ad4b9f 100644
--- a/arch/powerpc/boot/dts/mpc8568mds.dts
+++ b/arch/powerpc/boot/dts/mpc8568mds.dts
@@ -283,18 +283,18 @@
[EMAIL PROTECTED] {
#address-cells = 1;
#size-cells = 1;
-   device_type = qe;
-   model = QE;
+   compatible = fsl,qe;
ranges = 0 e008 0004;
reg = e008 480;
brg-frequency = 0;
bus-frequency = 179A7B00;
 
[EMAIL PROTECTED] {
-   device_type = muram;
+   compatible = fsl,qe-muram;
ranges = 0 0001 c000;
 
[EMAIL PROTECTED]
+   compatible = fsl,qe-muram-data;
reg = 0 c000;
};
};
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 4baad80..044dd7f 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -1226,7 +1226,7 @@ int __init fsl_spi_init(struct spi_board_info 
*board_infos,
const u32 *sysclk;
 
/* SPI controller is either clocked from QE or SoC clock */
-   np = of_find_node_by_type(NULL, qe);
+   np = of_find_compatible_node(NULL, NULL, fsl,qe);
if (!np)
np = of_find_node_by_type(NULL, soc);
 
diff 

[PATCH 2/4] [POWERPC][NET] ucc_geth_mii and users: get rid of device_type

2007-12-19 Thread Anton Vorontsov
device_type property is bogus, better use proper compatible property.

Also change compatible to fsl,ucc-mdio.

Per http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048388.html

Signed-off-by: Anton Vorontsov [EMAIL PROTECTED]
---
 arch/powerpc/boot/dts/mpc832x_mds.dts |3 +--
 arch/powerpc/boot/dts/mpc832x_rdb.dts |3 +--
 arch/powerpc/boot/dts/mpc836x_mds.dts |3 +--
 arch/powerpc/boot/dts/mpc8568mds.dts  |2 +-
 drivers/net/ucc_geth_mii.c|3 +--
 5 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts 
b/arch/powerpc/boot/dts/mpc832x_mds.dts
index ef8cd1e..97757ed 100644
--- a/arch/powerpc/boot/dts/mpc832x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
@@ -254,8 +254,7 @@
#address-cells = 1;
#size-cells = 0;
reg = 2320 18;
-   device_type = mdio;
-   compatible = ucc_geth_phy;
+   compatible = fsl,ucc-mdio;
 
phy3: [EMAIL PROTECTED] {
interrupt-parent =  ipic ;
diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts 
b/arch/powerpc/boot/dts/mpc832x_rdb.dts
index 7c4f028..b1c73f1 100644
--- a/arch/powerpc/boot/dts/mpc832x_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts
@@ -235,8 +235,7 @@
#address-cells = 1;
#size-cells = 0;
reg = 3120 18;
-   device_type = mdio;
-   compatible = ucc_geth_phy;
+   compatible = fsl,ucc-mdio;
 
phy00:[EMAIL PROTECTED] {
interrupt-parent = pic;
diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts 
b/arch/powerpc/boot/dts/mpc836x_mds.dts
index 5c73786..330212d 100644
--- a/arch/powerpc/boot/dts/mpc836x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
@@ -287,8 +287,7 @@
#address-cells = 1;
#size-cells = 0;
reg = 2120 18;
-   device_type = mdio;
-   compatible = ucc_geth_phy;
+   compatible = fsl,ucc-mdio;
 
phy0: [EMAIL PROTECTED] {
interrupt-parent =  ipic ;
diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts 
b/arch/powerpc/boot/dts/mpc8568mds.dts
index 7ad4b9f..c00aec9 100644
--- a/arch/powerpc/boot/dts/mpc8568mds.dts
+++ b/arch/powerpc/boot/dts/mpc8568mds.dts
@@ -355,7 +355,7 @@
#address-cells = 1;
#size-cells = 0;
reg = 2120 18;
-   compatible = ucc_geth_phy;
+   compatible = fsl,ucc-mdio;
 
/* These are the same PHYs as on
 * gianfar's MDIO bus */
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
index df884f0..de8ba1f 100644
--- a/drivers/net/ucc_geth_mii.c
+++ b/drivers/net/ucc_geth_mii.c
@@ -253,8 +253,7 @@ int uec_mdio_remove(struct of_device *ofdev)
 
 static struct of_device_id uec_mdio_match[] = {
{
-   .type = mdio,
-   .compatible = ucc_geth_phy,
+   .compatible = fsl,ucc-mdio,
},
{},
 };
-- 
1.5.2.2

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


[PATCH 3/4] [POWERPC][SPI] use brg-frequency for SPI in QE

2007-12-19 Thread Anton Vorontsov
In case of QE we can use brg-frequency (which is qeclk/2).
Thus no need to divide sysclk in the spi_mpc83xx.

Signed-off-by: Anton Vorontsov [EMAIL PROTECTED]
---
 arch/powerpc/sysdev/fsl_soc.c |   18 +++---
 drivers/spi/spi_mpc83xx.c |6 +-
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 044dd7f..3cf84d0 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -1227,15 +1227,19 @@ int __init fsl_spi_init(struct spi_board_info 
*board_infos,
 
/* SPI controller is either clocked from QE or SoC clock */
np = of_find_compatible_node(NULL, NULL, fsl,qe);
-   if (!np)
+   if (np) {
+   sysclk = of_get_property(np, brg-frequency, NULL);
+   if (!sysclk)
+   return -ENODEV;
+   } else {
np = of_find_node_by_type(NULL, soc);
+   if (!np)
+   return -ENODEV;
 
-   if (!np)
-   return -ENODEV;
-
-   sysclk = of_get_property(np, bus-frequency, NULL);
-   if (!sysclk)
-   return -ENODEV;
+   sysclk = of_get_property(np, bus-frequency, NULL);
+   if (!sysclk)
+   return -ENODEV;
+   }
 
for (np = NULL, i = 1;
 (np = of_find_compatible_node(np, spi, fsl_spi)) != NULL;
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
index 4580b9c..04f7cd9 100644
--- a/drivers/spi/spi_mpc83xx.c
+++ b/drivers/spi/spi_mpc83xx.c
@@ -436,11 +436,7 @@ static int __init mpc83xx_spi_probe(struct platform_device 
*dev)
mpc83xx_spi-qe_mode = pdata-qe_mode;
mpc83xx_spi-get_rx = mpc83xx_spi_rx_buf_u8;
mpc83xx_spi-get_tx = mpc83xx_spi_tx_buf_u8;
-
-   if (mpc83xx_spi-qe_mode)
-   mpc83xx_spi-spibrg = pdata-sysclk / 2;
-   else
-   mpc83xx_spi-spibrg = pdata-sysclk;
+   mpc83xx_spi-spibrg = pdata-sysclk;
 
mpc83xx_spi-rx_shift = 0;
mpc83xx_spi-tx_shift = 0;
-- 
1.5.2.2

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


[PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = spi

2007-12-19 Thread Anton Vorontsov
Also rename fsl_spi to fsl,spi.

Per http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048388.html

Signed-off-by: Anton Vorontsov [EMAIL PROTECTED]
---
 arch/powerpc/boot/dts/mpc8313erdb.dts|3 +--
 arch/powerpc/boot/dts/mpc832x_mds.dts|6 ++
 arch/powerpc/boot/dts/mpc832x_rdb.dts|6 ++
 arch/powerpc/boot/dts/mpc8349emitx.dts   |3 +--
 arch/powerpc/boot/dts/mpc8349emitxgp.dts |3 +--
 arch/powerpc/boot/dts/mpc834x_mds.dts|3 +--
 arch/powerpc/boot/dts/mpc836x_mds.dts|6 ++
 arch/powerpc/boot/dts/mpc8568mds.dts |6 ++
 arch/powerpc/sysdev/fsl_soc.c|2 +-
 9 files changed, 13 insertions(+), 25 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc8313erdb.dts 
b/arch/powerpc/boot/dts/mpc8313erdb.dts
index c5b6665..127cf57 100644
--- a/arch/powerpc/boot/dts/mpc8313erdb.dts
+++ b/arch/powerpc/boot/dts/mpc8313erdb.dts
@@ -82,8 +82,7 @@
};
 
[EMAIL PROTECTED] {
-   device_type = spi;
-   compatible = fsl_spi;
+   compatible = fsl,spi;
reg = 7000 1000;
interrupts = 10 8;
interrupt-parent =  ipic ;
diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts 
b/arch/powerpc/boot/dts/mpc832x_mds.dts
index 97757ed..517e433 100644
--- a/arch/powerpc/boot/dts/mpc832x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
@@ -192,8 +192,7 @@
};
 
[EMAIL PROTECTED] {
-   device_type = spi;
-   compatible = fsl_spi;
+   compatible = fsl,spi;
reg = 4c0 40;
interrupts = 2;
interrupt-parent =  qeic ;
@@ -201,8 +200,7 @@
};
 
[EMAIL PROTECTED] {
-   device_type = spi;
-   compatible = fsl_spi;
+   compatible = fsl,spi;
reg = 500 40;
interrupts = 1;
interrupt-parent =  qeic ;
diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts 
b/arch/powerpc/boot/dts/mpc832x_rdb.dts
index b1c73f1..a229fab 100644
--- a/arch/powerpc/boot/dts/mpc832x_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts
@@ -182,8 +182,7 @@
};
 
[EMAIL PROTECTED] {
-   device_type = spi;
-   compatible = fsl_spi;
+   compatible = fsl,spi;
reg = 4c0 40;
interrupts = 2;
interrupt-parent = qeic;
@@ -191,8 +190,7 @@
};
 
[EMAIL PROTECTED] {
-   device_type = spi;
-   compatible = fsl_spi;
+   compatible = fsl,spi;
reg = 500 40;
interrupts = 1;
interrupt-parent = qeic;
diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts 
b/arch/powerpc/boot/dts/mpc8349emitx.dts
index e354f26..b89dbbf 100644
--- a/arch/powerpc/boot/dts/mpc8349emitx.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitx.dts
@@ -82,8 +82,7 @@
};
 
[EMAIL PROTECTED] {
-   device_type = spi;
-   compatible = fsl_spi;
+   compatible = fsl,spi;
reg = 7000 1000;
interrupts = 10 8;
interrupt-parent =  ipic ;
diff --git a/arch/powerpc/boot/dts/mpc8349emitxgp.dts 
b/arch/powerpc/boot/dts/mpc8349emitxgp.dts
index ebdf0b7..123c34e 100644
--- a/arch/powerpc/boot/dts/mpc8349emitxgp.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitxgp.dts
@@ -80,8 +80,7 @@
};
 
[EMAIL PROTECTED] {
-   device_type = spi;
-   compatible = fsl_spi;
+   compatible = fsl,spi;
reg = 7000 1000;
interrupts = 10 8;
interrupt-parent =  ipic ;
diff --git a/arch/powerpc/boot/dts/mpc834x_mds.dts 
b/arch/powerpc/boot/dts/mpc834x_mds.dts
index 0ba13eb..eb532f3 100644
--- a/arch/powerpc/boot/dts/mpc834x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc834x_mds.dts
@@ -93,8 +93,7 @@
};
 
[EMAIL PROTECTED] {
-   device_type = spi;
-   compatible = fsl_spi;
+   compatible = fsl,spi;
reg = 7000 1000;
interrupts = 10 8;
interrupt-parent =  ipic ;
diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts 
b/arch/powerpc/boot/dts/mpc836x_mds.dts
index 330212d..decbafe 100644
--- a/arch/powerpc/boot/dts/mpc836x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
@@ -223,8 +223,7 @@
};
 
[EMAIL 

Re: [PATCH 0/4] device_type/compatible cleanups

2007-12-19 Thread Anton Vorontsov
On Wed, Dec 19, 2007 at 02:34:28PM -0600, Scott Wood wrote:
 Anton Vorontsov wrote:
 Scott, I didn't add fsl,cpm-muram stuff, it just doesn't make
 sense now: qe and cpm anyway using different code base.
 
 That should change.

Sure. When that will change, then it will be sane to change the users,
I think. ;-) Not the vice versa.

-- 
Anton Vorontsov
email: [EMAIL PROTECTED]
backup email: [EMAIL PROTECTED]
irc://irc.freenode.net/bd2
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = spi

2007-12-19 Thread Kumar Gala

On Dec 19, 2007, at 2:38 PM, Anton Vorontsov wrote:

 Also rename fsl_spi to fsl,spi.

 Per http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048388.html

 Signed-off-by: Anton Vorontsov [EMAIL PROTECTED]
 ---
 arch/powerpc/boot/dts/mpc8313erdb.dts|3 +--
 arch/powerpc/boot/dts/mpc832x_mds.dts|6 ++
 arch/powerpc/boot/dts/mpc832x_rdb.dts|6 ++
 arch/powerpc/boot/dts/mpc8349emitx.dts   |3 +--
 arch/powerpc/boot/dts/mpc8349emitxgp.dts |3 +--
 arch/powerpc/boot/dts/mpc834x_mds.dts|3 +--
 arch/powerpc/boot/dts/mpc836x_mds.dts|6 ++
 arch/powerpc/boot/dts/mpc8568mds.dts |6 ++
 arch/powerpc/sysdev/fsl_soc.c|2 +-
 9 files changed, 13 insertions(+), 25 deletions(-)


can you add cell-index as well.

- k

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


Re: [PATCH] [POWERPC][RFC] MPC8360E-RDK: Device tree and board file

2007-12-19 Thread Anton Vorontsov
On Mon, Dec 17, 2007 at 11:03:04AM -0600, Scott Wood wrote:
 On Mon, Dec 17, 2007 at 04:14:03PM +1100, David Gibson wrote:
   + [EMAIL PROTECTED] {
   + device_type = crypto;
   + model = SEC2;
   + compatible = talitos;
  
  This device_type/compatible/model stuff is also crap, although I
  suspect it needs to be fixed in the driver, as gianfar (finally) was.

Thanks everyone for the review! I did cleanups you suggested, and now
this patch depends on [PATCH 0/4] device_type/compatible cleanups
series.


Meanwhile added PCI and NOR flash support w/o partitions.

I still undecided on partitioning. 512KB u-boot, 128KB dtb, 2MB kernel,
4MB ramdisk, and less than 2MB for rootfs? Maybe get rid of rootfs on
the NOR flash and let kernel be 3MB? Personally, I tend to not inculcate
partition map into the dts at all.

How about that version?

- - - -
From: Anton Vorontsov [EMAIL PROTECTED]

[POWERPC] MPC8360E-RDK: Device tree and board file

This is new board made by Freescale Semiconductor Inc. and
Logic Product Development.

Currently supported:
1. UEC1,2,7,4
2. I2C
3. SPI
4. NS16550 serial
5. PCI and miniPCI
6. Intel NOR StrataFlash X16 64Mbit PC28F640P30T85

Not supported so far:
1. StMICRO NAND512W3A2BN6E, 512 Mbit (supported with FSL UPM patches)
2. QE SCCs (slow UCCs, used as an UARTs)
3. ADC AD7843
4. FHCI USB
5. Graphics controller, Fujitsu MB86277

Signed-off-by: Anton Vorontsov [EMAIL PROTECTED]
---
 arch/powerpc/boot/dts/mpc836x_rdk.dts |  328 +
 arch/powerpc/platforms/83xx/Kconfig   |   11 +-
 arch/powerpc/platforms/83xx/Makefile  |1 +
 arch/powerpc/platforms/83xx/mpc836x_rdk.c |  118 +++
 4 files changed, 457 insertions(+), 1 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/mpc836x_rdk.dts
 create mode 100644 arch/powerpc/platforms/83xx/mpc836x_rdk.c

diff --git a/arch/powerpc/boot/dts/mpc836x_rdk.dts 
b/arch/powerpc/boot/dts/mpc836x_rdk.dts
new file mode 100644
index 000..1d0c014
--- /dev/null
+++ b/arch/powerpc/boot/dts/mpc836x_rdk.dts
@@ -0,0 +1,328 @@
+/*
+ * MPC8360E RDK Device Tree Source
+ *
+ * Copyright 2006 Freescale Semiconductor Inc.
+ * Copyright 2007 MontaVista Software, Inc.
+ *   Anton Vorontsov [EMAIL PROTECTED]
+ *
+ * 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.
+ */
+
+/dts-v1/;
+
+/ {
+   #address-cells = 1;
+   #size-cells = 1;
+   compatible = MPC8360ERDK, MPC836xRDK, MPC83xxRDK;
+   model = MPC8360RDK;
+
+   aliases {
+   serial0 = serial0;
+   serial1 = serial1;
+   ethernet0 = enet0;
+   ethernet1 = enet1;
+   ethernet2 = enet2;
+   ethernet3 = enet3;
+   pci0 = pci0;
+   };
+
+   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 = 32768;
+   i-cache-size = 32768;
+   /* filled by u-boot */
+   timebase-frequency = 0; 
+   bus-frequency = 0;
+   clock-frequency = 0;
+   };
+   };
+
+   [EMAIL PROTECTED] {
+   #address-cells = 1;
+   #size-cells = 1;
+   device_type = soc;
+   ranges = 0 0xe000 0x0010;
+   reg = 0xe000 0x0200;
+   /* filled by u-boot */
+   bus-frequency = 0;
+
+   [EMAIL PROTECTED] {
+   compatible = mpc83xx_wdt;
+   reg = 0x200 0x100;
+   };
+
+   [EMAIL PROTECTED] {
+   #address-cells = 1;
+   #size-cells = 0;
+   cell-index = 0;
+   compatible = fsl-i2c;
+   reg = 0x3000 0x100;
+   interrupts = 14 8;
+   interrupt-parent = ipic;
+   dfsrr;
+   };
+
+   [EMAIL PROTECTED] {
+   #address-cells = 1;
+   #size-cells = 0;
+   cell-index = 1;
+   compatible = fsl-i2c;
+   reg = 0x3100 0x100;
+   interrupts = 16 8;
+   interrupt-parent = ipic;
+   dfsrr;
+   };
+
+   serial0: [EMAIL PROTECTED] {
+   device_type = serial;
+   compatible = ns16550;
+ 

Re: [PATCH 3/4] [POWERPC][SPI] use brg-frequency for SPI in QE

2007-12-19 Thread Scott Wood
Anton Vorontsov wrote:
 diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
 index 044dd7f..3cf84d0 100644
 --- a/arch/powerpc/sysdev/fsl_soc.c
 +++ b/arch/powerpc/sysdev/fsl_soc.c
 @@ -1227,15 +1227,19 @@ int __init fsl_spi_init(struct spi_board_info 
 *board_infos,
  
   /* SPI controller is either clocked from QE or SoC clock */
   np = of_find_compatible_node(NULL, NULL, fsl,qe);
 - if (!np)
 + if (np) {
 + sysclk = of_get_property(np, brg-frequency, NULL);
 + if (!sysclk)
 + return -ENODEV;
 + } else {

You should use get_brgfreq() instead (and fix the legacy match to find 
qe as well as soc nodes).

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


Re: [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = spi

2007-12-19 Thread Anton Vorontsov
On Wed, Dec 19, 2007 at 02:54:09PM -0600, Kumar Gala wrote:
 
 On Dec 19, 2007, at 2:38 PM, Anton Vorontsov wrote:
 
 Also rename fsl_spi to fsl,spi.
 
 Per http://ozlabs.org/pipermail/linuxppc-dev/2007-December/048388.html
 
 Signed-off-by: Anton Vorontsov [EMAIL PROTECTED]
 ---
 arch/powerpc/boot/dts/mpc8313erdb.dts|3 +--
 arch/powerpc/boot/dts/mpc832x_mds.dts|6 ++
 arch/powerpc/boot/dts/mpc832x_rdb.dts|6 ++
 arch/powerpc/boot/dts/mpc8349emitx.dts   |3 +--
 arch/powerpc/boot/dts/mpc8349emitxgp.dts |3 +--
 arch/powerpc/boot/dts/mpc834x_mds.dts|3 +--
 arch/powerpc/boot/dts/mpc836x_mds.dts|6 ++
 arch/powerpc/boot/dts/mpc8568mds.dts |6 ++
 arch/powerpc/sysdev/fsl_soc.c|2 +-
 9 files changed, 13 insertions(+), 25 deletions(-)
 
 
 can you add cell-index as well.

Sure. Will do tomorrow since here is night already. ;-)

Thanks,

-- 
Anton Vorontsov
email: [EMAIL PROTECTED]
backup email: [EMAIL PROTECTED]
irc://irc.freenode.net/bd2
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = spi

2007-12-19 Thread Timur Tabi
Anton Vorontsov wrote:

 diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
 index 3cf84d0..91bac51 100644
 --- a/arch/powerpc/sysdev/fsl_soc.c
 +++ b/arch/powerpc/sysdev/fsl_soc.c
 @@ -1242,7 +1242,7 @@ int __init fsl_spi_init(struct spi_board_info 
 *board_infos,
   }
  
   for (np = NULL, i = 1;
 -  (np = of_find_compatible_node(np, spi, fsl_spi)) != NULL;
 +  (np = of_find_compatible_node(np, NULL, fsl,spi)) != NULL;

Can you keep the original code around to look for older device trees that are 
wrong?  Backwards compatibility is important.  I don't want to have to update 
the device tree just because I update the kernel.

-- 
Timur Tabi
Linux kernel developer at Freescale
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 0/4] device_type/compatible cleanups

2007-12-19 Thread Scott Wood
Anton Vorontsov wrote:
 On Wed, Dec 19, 2007 at 02:34:28PM -0600, Scott Wood wrote:
 Anton Vorontsov wrote:
 Scott, I didn't add fsl,cpm-muram stuff, it just doesn't make
 sense now: qe and cpm anyway using different code base.
 That should change.
 
 Sure. When that will change, then it will be sane to change the users,
 I think. ;-) Not the vice versa.

The device tree should describe the hardware, not the degree of 
unnecessary code forking/duplication currently present in Linux.

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


Re: [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = spi

2007-12-19 Thread Anton Vorontsov
On Wed, Dec 19, 2007 at 03:04:51PM -0600, Timur Tabi wrote:
 Anton Vorontsov wrote:
 
 diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
 index 3cf84d0..91bac51 100644
 --- a/arch/powerpc/sysdev/fsl_soc.c
 +++ b/arch/powerpc/sysdev/fsl_soc.c
 @@ -1242,7 +1242,7 @@ int __init fsl_spi_init(struct spi_board_info 
 *board_infos,
  }
  
  for (np = NULL, i = 1;
 - (np = of_find_compatible_node(np, spi, fsl_spi)) != NULL;
 + (np = of_find_compatible_node(np, NULL, fsl,spi)) != NULL;
 
 Can you keep the original code around to look for older device trees that 
 are wrong?  Backwards compatibility is important.  I don't want to have to 
 update the device tree just because I update the kernel.

I though about it. Is your device tree source out of tree? Otherwise
it should be trivial to upgrade the dtb, instead of producing cruft in
the kernel. I vote for less legacy code, but lets see what others will
say. So far count is 1:1. ;-)

Thanks,

-- 
Anton Vorontsov
email: [EMAIL PROTECTED]
backup email: [EMAIL PROTECTED]
irc://irc.freenode.net/bd2
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = spi

2007-12-19 Thread Timur Tabi
Anton Vorontsov wrote:

 I though about it. Is your device tree source out of tree? Otherwise
 it should be trivial to upgrade the dtb, instead of producing cruft in
 the kernel. I vote for less legacy code, but lets see what others will
 say. So far count is 1:1. ;-)

I just want a transition period.  Whenever I write code that works with changes 
in the device tree, I always maintain compatibility with the older versions, 
and 
I was under the impression that this is policy.  If you update the device tree, 
you should update the kernel.  The converse, however, should not be true.

It would be really annoying if you had to swap out your device tree if you want 
to work with different kernel versions.

Maybe if the device tree compiler were part of the kernel, and every time you 
built the kernel it also built the dtb, I could accept locking the device tree 
and kernel versions.

-- 
Timur Tabi
Linux kernel developer at Freescale
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = spi

2007-12-19 Thread Grant Likely
On 12/19/07, Anton Vorontsov [EMAIL PROTECTED] wrote:
 On Wed, Dec 19, 2007 at 03:04:51PM -0600, Timur Tabi wrote:
  Anton Vorontsov wrote:
 
  diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
  index 3cf84d0..91bac51 100644
  --- a/arch/powerpc/sysdev/fsl_soc.c
  +++ b/arch/powerpc/sysdev/fsl_soc.c
  @@ -1242,7 +1242,7 @@ int __init fsl_spi_init(struct spi_board_info
  *board_infos,
   }
  
   for (np = NULL, i = 1;
  - (np = of_find_compatible_node(np, spi, fsl_spi)) != NULL;
  + (np = of_find_compatible_node(np, NULL, fsl,spi)) != NULL;
 
  Can you keep the original code around to look for older device trees that
  are wrong?  Backwards compatibility is important.  I don't want to have to
  update the device tree just because I update the kernel.

 I though about it. Is your device tree source out of tree? Otherwise
 it should be trivial to upgrade the dtb, instead of producing cruft in
 the kernel. I vote for less legacy code, but lets see what others will
 say. So far count is 1:1. ;-)

I agree with Timur.  Please keep the test for the older names.  Some
platforms have the dtb in the same sector as u-boot, making it more
dangerous to reflash.

g.

 --
 Anton Vorontsov
 email: [EMAIL PROTECTED]
 backup email: [EMAIL PROTECTED]
 irc://irc.freenode.net/bd2
 ___
 Linuxppc-dev mailing list
 Linuxppc-dev@ozlabs.org
 https://ozlabs.org/mailman/listinfo/linuxppc-dev



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[EMAIL PROTECTED]
(403) 399-0195
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH v2] powerpc: add hugepagesz boot-time parameter

2007-12-19 Thread Jon Tollefson
Paul, please include this in 2.6.25 if there are no objections.

This patch adds the hugepagesz boot-time parameter for ppc64.  It lets
one pick the size for huge pages. The choices available are 64K and 16M
when the base page size is 4k. It defaults to 16M (previously the only
only choice) if nothing or an invalid choice is specified.

Tested 64K huge pages successfully with the libhugetlbfs 1.2.

Changes from v1:
disallow 64K huge pages when base page size is 64K since we can't
distinguish between
base and huge pages when doing a hash_page()
collapsed pmd_offset and pmd_alloc to inline calls to simplify the
main code
removed printing of the huge page size in mm/hugetlb.c since this
information is already
   available in /proc/meminfo and leaves the remaining changes all
powerpc specific

Signed-off-by: Jon Tollefson [EMAIL PROTECTED]
---

diff --git a/Documentation/kernel-parameters.txt 
b/Documentation/kernel-parameters.txt
index 33121d6..2fc1fb8 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -685,6 +685,7 @@ and is between 256 and 4096 characters. It is defined in 
the file
See Documentation/isdn/README.HiSax.
 
hugepages=  [HW,X86-32,IA-64] Maximal number of HugeTLB pages.
+   hugepagesz= [HW,IA-64,PPC] The size of the HugeTLB pages.
 
i8042.direct[HW] Put keyboard port into non-translated mode
i8042.dumbkbd   [HW] Pretend that controller can only read data from
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index cbbd8b0..9326a69 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -369,18 +369,11 @@ static void __init htab_init_page_sizes(void)
 * on what is available
 */
if (mmu_psize_defs[MMU_PAGE_16M].shift)
-   mmu_huge_psize = MMU_PAGE_16M;
+   set_huge_psize(MMU_PAGE_16M);
/* With 4k/4level pagetables, we can't (for now) cope with a
 * huge page size  PMD_SIZE */
else if (mmu_psize_defs[MMU_PAGE_1M].shift)
-   mmu_huge_psize = MMU_PAGE_1M;
-
-   /* Calculate HPAGE_SHIFT and sanity check it */
-   if (mmu_psize_defs[mmu_huge_psize].shift  MIN_HUGEPTE_SHIFT 
-   mmu_psize_defs[mmu_huge_psize].shift  SID_SHIFT)
-   HPAGE_SHIFT = mmu_psize_defs[mmu_huge_psize].shift;
-   else
-   HPAGE_SHIFT = 0; /* No huge pages dude ! */
+   set_huge_psize(MMU_PAGE_1M);
 #endif /* CONFIG_HUGETLB_PAGE */
 }
 
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index 71efb38..3099e48 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -24,18 +24,17 @@
 #include asm/cputable.h
 #include asm/spu.h
 
+#define HPAGE_SHIFT_64K16
+#define HPAGE_SHIFT_16M24
+
 #define NUM_LOW_AREAS  (0x1UL  SID_SHIFT)
 #define NUM_HIGH_AREAS (PGTABLE_RANGE  HTLB_AREA_SHIFT)
 
-#ifdef CONFIG_PPC_64K_PAGES
-#define HUGEPTE_INDEX_SIZE (PMD_SHIFT-HPAGE_SHIFT)
-#else
-#define HUGEPTE_INDEX_SIZE (PUD_SHIFT-HPAGE_SHIFT)
-#endif
-#define PTRS_PER_HUGEPTE   (1  HUGEPTE_INDEX_SIZE)
-#define HUGEPTE_TABLE_SIZE (sizeof(pte_t)  HUGEPTE_INDEX_SIZE)
+unsigned int hugepte_shift;
+#define PTRS_PER_HUGEPTE   (1  hugepte_shift)
+#define HUGEPTE_TABLE_SIZE (sizeof(pte_t)  hugepte_shift)
 
-#define HUGEPD_SHIFT   (HPAGE_SHIFT + HUGEPTE_INDEX_SIZE)
+#define HUGEPD_SHIFT   (HPAGE_SHIFT + hugepte_shift)
 #define HUGEPD_SIZE(1UL  HUGEPD_SHIFT)
 #define HUGEPD_MASK(~(HUGEPD_SIZE-1))
 
@@ -82,11 +81,31 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t 
*hpdp,
return 0;
 }
 
+#ifndef CONFIG_PPC_64K_PAGES
+static inline
+pmd_t *hpmd_offset(pud_t *pud, unsigned long addr)
+{
+   if (HPAGE_SHIFT == HPAGE_SHIFT_64K)
+   return pmd_offset(pud, addr);
+   else
+   return (pmd_t *) pud;
+}
+static inline
+pmd_t *hpmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long addr)
+{
+   if (HPAGE_SHIFT == HPAGE_SHIFT_64K)
+   return pmd_alloc(mm, pud, addr);
+   else
+   return (pmd_t *) pud;
+}
+#endif
+
 /* Modelled after find_linux_pte() */
 pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
 {
pgd_t *pg;
pud_t *pu;
+   pmd_t *pm;
 
BUG_ON(get_slice_psize(mm, addr) != mmu_huge_psize);
 
@@ -96,14 +115,9 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long 
addr)
if (!pgd_none(*pg)) {
pu = pud_offset(pg, addr);
if (!pud_none(*pu)) {
-#ifdef CONFIG_PPC_64K_PAGES
-   pmd_t *pm;
-   pm = pmd_offset(pu, addr);
+   pm = hpmd_offset(pu, addr);
if (!pmd_none(*pm))
return hugepte_offset((hugepd_t *)pm, addr);
-#else
-

Oops: Kernel access of bad area

2007-12-19 Thread Christian Kujau
Hi,

I started some x11 application (here: firefox) through an ssh connection 
on a remote host and it crashed somehow. OK, no biggie, killed the 
application and be done with it. However, I noticed that the load of the 
machine is now constantly at 7. It's an iBook G4, has nothing to do, 
disks, cpu, netwokr is idle and load is usually  1. Now it's not
slow to work or anyhow sluggish, but only the load is at 7 after the 
application crashed. When I looked into dmesg I saw:

[84983.750977] Unable to handle kernel paging request for data at address 
0x4815d000
[84983.751046] Faulting instruction address: 0xc0012090
[84983.751157] Oops: Kernel access of bad area, sig: 11 [#1]
[84983.751178] PREEMPT PowerMac
[84983.751214] Modules linked in: nls_iso8859_15 nls_cp850 vfat fat isofs 
nls_base zlib_inflate radeon drm snd_powermac snd_pcm snd_timer snd soundcore 
snd_page_alloc fuse firewire_ohci firewire_core crc_itu_t ide_cd cdrom ssb 
bcm43xx rng_core ieee80211softmac uninorth_agp ieee80211 ieee80211_crypt agpgart
[84983.751750] NIP: c0012090 LR: c00165fc CTR: 0080
[84983.751786] REGS: cea65b30 TRAP: 0300   Not tainted  (2.6.24-rc5)
[84983.751805] MSR: 9032 EE,ME,IR,DR  CR: 24822282  XER: 
[84983.751946] DAR: 4815d000, DSISR: 4000
[84983.751965] TASK = ee372670[9138] 'firefox-bin' THREAD: cea64000
[84983.751984] GPR00: e62b3a00 cea65be0 ee372670 4815d000 0080 1bc0c181 
4815d000 
[84983.752148] GPR08: 00010008 e62b3a00  c045f000 24822288 1002ea3c 
cea67690 ce954000
[84983.752315] GPR16: c042 c03f6400 cea65cac cea65ca8 c044 ce974480 
c07d7180 ceba2280
[84983.752468] GPR24: e62b3a00 e62b3a50 4815d000 0574 ceba2280 4815d000 
1bc0c181 c07d7180
[84983.752665] NIP [c0012090] __flush_dcache_icache+0x14/0x40
[84983.752716] LR [c00165fc] update_mmu_cache+0x11c/0x120
[...]

This is the first time that this happened on this iBook, and it was not 
reproducible so far (well, it happened just a few minutes ago). Is this 
something to worry about? Or should I file this under well, shit 
happens? Btw, this 2.6.24-rc5 is from Linus' -git tree (15.12.2007).

Details and .config: http://nerdbynature.de/bits/2.6.24-rc5/

Thanks,
Christian.
-- 
BOFH excuse #281:

The co-locator cannot verify the frame-relay gateway to the ISDN server.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [0/3] Add RapidIO support to powerpc architecture with memory mapping

2007-12-19 Thread Randy Vinson
Zhang Wei wrote:
 Hi,
 
 Those patches add RapidIO support to powerpc archiecture with
 memory mapping as below:
 
 [1/3] Copy the arch/ppc RapidIO support to arch/powerpc
 [2/3] Make the arch/powerpc RapidIO support workable with of-device
   and add memory mapping support.
Patch 2/3 seems to have gone missing. Was it sent?

Randy V.

 [3/3] Add the memory mapping support to rionet driver.
 
 Best Regards,
 Zhang Wei
 
 
 ___
 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 3/4] [POWERPC][SPI] use brg-frequency for SPI in QE

2007-12-19 Thread Stephen Rothwell
On Wed, 19 Dec 2007 23:38:05 +0300 Anton Vorontsov [EMAIL PROTECTED] wrote:

 +++ b/arch/powerpc/sysdev/fsl_soc.c
 @@ -1227,15 +1227,19 @@ int __init fsl_spi_init(struct spi_board_info 
 *board_infos,
  
   /* SPI controller is either clocked from QE or SoC clock */
   np = of_find_compatible_node(NULL, NULL, fsl,qe);
 - if (!np)
 + if (np) {
 + sysclk = of_get_property(np, brg-frequency, NULL);
 + if (!sysclk)
 + return -ENODEV;

You need an of_node_put(np) in the failing case.

 + } else {
   np = of_find_node_by_type(NULL, soc);
 + if (!np)
 + return -ENODEV;
  
 - if (!np)
 - return -ENODEV;
 -
 - sysclk = of_get_property(np, bus-frequency, NULL);
 - if (!sysclk)
 - return -ENODEV;
 + sysclk = of_get_property(np, bus-frequency, NULL);
 + if (!sysclk)
 + return -ENODEV;

And again.

 + }
  
   for (np = NULL, i = 1;

There should be an of_node_put(np) before this as well.

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


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

Re: [PATCH 4/4] [POWERPC] fsl_spi_init and users: stop using device_type = spi

2007-12-19 Thread Olof Johansson
On Thu, Dec 20, 2007 at 12:12:50AM +0300, Anton Vorontsov wrote:

 I though about it. Is your device tree source out of tree? Otherwise
 it should be trivial to upgrade the dtb, instead of producing cruft in
 the kernel. I vote for less legacy code, but lets see what others will
 say. So far count is 1:1. ;-)

It's not just that. kexec:ing a new kernel from an older that has the
old device tree breaks if you don't consider older device trees. Or you
might have an old firmware with a flashed device tree that you need to
keep compatibility with.

You should either fix up the broken (not latest and greatest) device
trees in the wrapper before using them, or make sure that your code is
still compatible with the old trees.

The fact that the device tree source code is distributed with the kernel
isn't an excuse to break backwards compatibility with older versions.


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


RE: hangs after Freeing unused kernel memory

2007-12-19 Thread Siva Prasad
Hi Linas,

I found it hard way. You are correct. I am just loosing the console, and
all the programs are executing fine. I could put a printk in execve and
see all the programs executing (printk's work fine).

I am using a PowerPC based system with my own kernel and initrd (not
RedHat system). Can you please elaborate on what exactly you are
suggesting me to do. Are you trying to copy /dev/files from build
machine to the ramdisk? I am confused.

Further, I could not find /dev/hv* files in any of the systems. What are
they for?

You also mentioned about tweaking initrd and udev. Appreciate some help
with this console loosing. 

Thanks in advance for your help.

- Siva


-Original Message-
From: Linas Vepstas [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 19, 2007 9:52 AM
To: Siva Prasad
Cc: [EMAIL PROTECTED]; linuxppc-dev@ozlabs.org
Subject: Re: hangs after Freeing unused kernel memory

On Thu, Nov 15, 2007 at 04:00:09PM -0800, Siva Prasad wrote:
 Hi,
 
 This sounds like a familiar problem, but could not get answers in
posts
 that came up in google search.
 
 My system hangs after printing the message Freeing unused kernel
 memory. It should execute init after that, but not sure what exactly
is
 happening. Appreciate if some one can throw few ideas to try out.

It might not be a hang, it might be simply that you loose the console.
If this is a redhat system, and you didn't tweak initrd and udev just 
right, this can happen.

Try doing this:

  mount --bind / /mnt
  cp -a /dev/null /mnt/dev
  cp -a /dev/console /mnt/dev
  cp -a /dev/hv* /mnt/dev
  umount /mnt

 Seems it is actually hanging when it makes the call 
 run_init_process(ramdisk_execute_command) in init/main.c

Then again, your initrd might be corrupted.

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


RE: [0/3] Add RapidIO support to powerpc architecture with memory mapping

2007-12-19 Thread Zhang Wei
I've sent it... Oops, it's be blocked by big size.  

Thanks! I'll resend it.

Cheers!
Wei

 -Original Message-
 From: Randy Vinson [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, December 20, 2007 6:52 AM
 To: Zhang Wei
 Cc: linuxppc-dev@ozlabs.org
 Subject: Re: [0/3] Add RapidIO support to powerpc 
 architecture with memory mapping
 
 Zhang Wei wrote:
  Hi,
  
  Those patches add RapidIO support to powerpc archiecture with
  memory mapping as below:
  
  [1/3] Copy the arch/ppc RapidIO support to arch/powerpc
  [2/3] Make the arch/powerpc RapidIO support workable with of-device
and add memory mapping support.
 Patch 2/3 seems to have gone missing. Was it sent?
 
 Randy V.
 
  [3/3] Add the memory mapping support to rionet driver.
  
  Best Regards,
  Zhang Wei
  
  
  ___
  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


[PATCH 0/19] [POWERPC] PCI updates merges

2007-12-19 Thread Benjamin Herrenschmidt
This serie of patches converts the 32 bits PCI code to use the generic
pci_assign_unassigned_resources() instead of its own assignment code
which was unable to deal with unassigned PCI-PCI bridges among
other issues.

It then merges the resource fixup and allocation code between 32 and
64 bits (mostly making 64 bits use the 32 bits code with a few fixups),
hopefully fixing the longstanding issue that not setting pci_probe_only
on ppc64 would generally not work.

We also add flags to control the behaviour of the PCI code, such as
letting some platforms force a full re-assignment (similar to what
pci-auto used to provide in arch/ppc) and remove a whole bunch of
hackish code that is made obsolete by that change.

32 bits platforms with 64 bits resources support will also need my
separate patch to fix the generic setup-bus.c for that situation.

Finally, I also merge the implementations of pcibios_enable_device()
and fixup the PowerMac code that used hooks in that area in ways
that don't work anymore and cleans up a few PowerMac related bits
and pieces.

Note that this wasn't properly tested with hotplug on pSeries as I
have been unable to get it working for other reasons. If there is
a problem there, we'll attempt to fix it with additional patches.

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


[PATCH 1/19] [POWERPC] pci32: remove bogus alignment message

2007-12-19 Thread Benjamin Herrenschmidt
There's a stale  bogus piece of code in 32 bits PCI code that
complains about ISA related alignment issues. Just remove it.

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---

 arch/powerpc/kernel/pci_32.c |6 --
 1 file changed, 6 deletions(-)

--- linux-merge.orig/arch/powerpc/kernel/pci_32.c   2007-12-14 
15:49:01.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci_32.c2007-12-14 15:49:27.0 
+1100
@@ -199,12 +199,6 @@ void pcibios_align_resource(void *data, 
if (res-flags  IORESOURCE_IO) {
resource_size_t start = res-start;
 
-   if (size  0x100) {
-   printk(KERN_ERR PCI: I/O Region %s/%d too large
-   (%lld bytes)\n, pci_name(dev),
-  dev-resource - res, (unsigned long long)size);
-   }
-
if (start  0x300) {
start = (start + 0x3ff)  ~0x3ff;
res-start = start;
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 2/19] [POWERPC] pci32: use generic pci_assign_unassign_resources

2007-12-19 Thread Benjamin Herrenschmidt
This makes the 32 bits PowerPC PCI code use the generic code to assign
resources to devices that had unassigned or conflicting resources.

This allow to remove the local implementation that was incomplete and
could not assign for example a PCI-PCI bridge from scratch, which is
needed on various embedded platforms.

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---

 arch/powerpc/kernel/pci_32.c |  191 +++
 1 file changed, 17 insertions(+), 174 deletions(-)

--- linux-merge.orig/arch/powerpc/kernel/pci_32.c   2007-12-14 
15:49:27.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci_32.c2007-12-14 15:49:27.0 
+1100
@@ -37,10 +37,6 @@ int pcibios_assign_bus_offset = 1;
 
 void pcibios_make_OF_bus_map(void);
 
-static int pci_relocate_bridge_resource(struct pci_bus *bus, int i);
-static int probe_resource(struct pci_bus *parent, struct resource *pr,
- struct resource *res, struct resource **conflict);
-static void update_bridge_base(struct pci_bus *bus, int i);
 static void pcibios_fixup_resources(struct pci_dev* dev);
 static void fixup_broken_pcnet32(struct pci_dev* dev);
 static int reparent_resources(struct resource *parent, struct resource *res);
@@ -134,7 +130,7 @@ pcibios_fixup_resources(struct pci_dev *
if (offset != 0) {
res-start = (res-start + offset)  mask;
res-end = (res-end + offset)  mask;
-   DBG(Fixup res %d (%lx) of dev %s: %llx - %llx\n,
+   DBG(PCI: Fixup res %d (0x%lx) of dev %s: %llx - 
%llx\n,
i, res-flags, pci_name(dev),
(u64)res-start - offset, (u64)res-start);
}
@@ -267,9 +263,12 @@ pcibios_allocate_bus_resources(struct li
}
}
 
-   DBG(PCI: bridge rsrc %llx..%llx (%lx), parent %p\n,
+   DBG(PCI: dev %s (bus 0x%02x) bridge rsrc %d: 
%016llx..%016llx 
+   (f:0x%08lx), parent %p\n,
+   bus-self ? pci_name(bus-self) : PHB, 
bus-number, i,
(u64)res-start, (u64)res-end, res-flags, pr);
-   if (pr) {
+
+   if (pr  !(pr-flags  IORESOURCE_UNSET)) {
if (request_resource(pr, res) == 0)
continue;
/*
@@ -280,10 +279,11 @@ pcibios_allocate_bus_resources(struct li
if (reparent_resources(pr, res) == 0)
continue;
}
-   printk(KERN_ERR PCI: Cannot allocate resource region 
-  %d of PCI bridge %d\n, i, bus-number);
-   if (pci_relocate_bridge_resource(bus, i))
-   bus-resource[i] = NULL;
+   printk(KERN_WARNING
+  PCI: Cannot allocate resource region 
+  %d of PCI bridge %d, will remap\n,
+  i, bus-number);
+   res-flags |= IORESOURCE_UNSET;
}
pcibios_allocate_bus_resources(bus-children);
}
@@ -324,112 +324,6 @@ reparent_resources(struct resource *pare
return 0;
 }
 
-/*
- * A bridge has been allocated a range which is outside the range
- * of its parent bridge, so it needs to be moved.
- */
-static int __init
-pci_relocate_bridge_resource(struct pci_bus *bus, int i)
-{
-   struct resource *res, *pr, *conflict;
-   resource_size_t try, size;
-   struct pci_bus *parent = bus-parent;
-   int j;
-
-   if (parent == NULL) {
-   /* shouldn't ever happen */
-   printk(KERN_ERR PCI: can't move host bridge resource\n);
-   return -1;
-   }
-   res = bus-resource[i];
-   if (res == NULL)
-   return -1;
-   pr = NULL;
-   for (j = 0; j  4; j++) {
-   struct resource *r = parent-resource[j];
-   if (!r)
-   continue;
-   if ((res-flags ^ r-flags)  (IORESOURCE_IO | IORESOURCE_MEM))
-   continue;
-   if (!((res-flags ^ r-flags)  IORESOURCE_PREFETCH)) {
-   pr = r;
-   break;
-   }
-   if (res-flags  IORESOURCE_PREFETCH)
-   pr = r;
-   }
-   if (pr == NULL)
-   return -1;
-   size = res-end - res-start;
-   if (pr-start  pr-end || size  pr-end - pr-start)
-   return -1;
-   try = pr-end;
-   for (;;) {
-   res-start = try - size;
-   res-end = try;
-   if (probe_resource(bus-parent, pr, res, conflict) == 0)
-   break;
-

[PATCH 3/19] [POWERPC] pci32: Remove PowerMac P2P bridge IO hack

2007-12-19 Thread Benjamin Herrenschmidt
The 32 bits PowerPC PCI code has a hack for use by some PowerMacs
to try to re-open PCI-PCI bridge IO resources that were closed
by the firmware. This is no longer necessary as the generic code
will now do that for us.

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---

 arch/powerpc/kernel/pci_32.c |  215 ---
 1 file changed, 1 insertion(+), 214 deletions(-)

--- linux-merge.orig/arch/powerpc/kernel/pci_32.c   2007-12-14 
15:49:27.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci_32.c2007-12-14 15:49:28.0 
+1100
@@ -711,217 +711,6 @@ void pcibios_make_OF_bus_map(void)
 }
 #endif /* CONFIG_PPC_OF */
 
-#ifdef CONFIG_PPC_PMAC
-/*
- * This set of routines checks for PCI-PCI bridges that have closed
- * IO resources and have child devices. It tries to re-open an IO
- * window on them.
- *
- * This is a _temporary_ fix to workaround a problem with Apple's OF
- * closing IO windows on P2P bridges when the OF drivers of cards
- * below this bridge don't claim any IO range (typically ATI or
- * Adaptec).
- *
- * A more complete fix would be to use drivers/pci/setup-bus.c, which
- * involves a working pcibios_fixup_pbus_ranges(), some more care about
- * ordering when creating the host bus resources, and maybe a few more
- * minor tweaks
- */
-
-/* Initialize bridges with base/limit values we have collected */
-static void __init
-do_update_p2p_io_resource(struct pci_bus *bus, int enable_vga)
-{
-   struct pci_dev *bridge = bus-self;
-   struct pci_controller* hose = (struct pci_controller *)bridge-sysdata;
-   u32 l;
-   u16 w;
-   struct resource res;
-
-   if (bus-resource[0] == NULL)
-   return;
-   res = *(bus-resource[0]);
-
-   DBG(Remapping Bus %d, bridge: %s\n, bus-number, pci_name(bridge));
-   res.start -= ((unsigned long) hose-io_base_virt - isa_io_base);
-   res.end -= ((unsigned long) hose-io_base_virt - isa_io_base);
-   DBG(  IO window: %016llx-%016llx\n, res.start, res.end);
-
-   /* Set up the top and bottom of the PCI I/O segment for this bus. */
-   pci_read_config_dword(bridge, PCI_IO_BASE, l);
-   l = 0x000f;
-   l |= (res.start  8)  0x00f0;
-   l |= res.end  0xf000;
-   pci_write_config_dword(bridge, PCI_IO_BASE, l);
-
-   if ((l  PCI_IO_RANGE_TYPE_MASK) == PCI_IO_RANGE_TYPE_32) {
-   l = (res.start  16) | (res.end  0x);
-   pci_write_config_dword(bridge, PCI_IO_BASE_UPPER16, l);
-   }
-
-   pci_read_config_word(bridge, PCI_COMMAND, w);
-   w |= PCI_COMMAND_IO;
-   pci_write_config_word(bridge, PCI_COMMAND, w);
-
-#if 0 /* Enabling this causes XFree 4.2.0 to hang during PCI probe */
-   if (enable_vga) {
-   pci_read_config_word(bridge, PCI_BRIDGE_CONTROL, w);
-   w |= PCI_BRIDGE_CTL_VGA;
-   pci_write_config_word(bridge, PCI_BRIDGE_CONTROL, w);
-   }
-#endif
-}
-
-/* This function is pretty basic and actually quite broken for the
- * general case, it's enough for us right now though. It's supposed
- * to tell us if we need to open an IO range at all or not and what
- * size.
- */
-static int __init
-check_for_io_childs(struct pci_bus *bus, struct resource* res, int *found_vga)
-{
-   struct pci_dev *dev;
-   int i;
-   int rc = 0;
-
-#define push_end(res, mask) do {   \
-   BUG_ON((mask+1)  mask);\
-   res-end = (res-end + mask) | mask;\
-} while (0)
-
-   list_for_each_entry(dev, bus-devices, bus_list) {
-   u16 class = dev-class  8;
-
-   if (class == PCI_CLASS_DISPLAY_VGA ||
-   class == PCI_CLASS_NOT_DEFINED_VGA)
-   *found_vga = 1;
-   if (class  8 == PCI_BASE_CLASS_BRIDGE  dev-subordinate)
-   rc |= check_for_io_childs(dev-subordinate, res, 
found_vga);
-   if (class == PCI_CLASS_BRIDGE_CARDBUS)
-   push_end(res, 0xfff);
-
-   for (i=0; iPCI_NUM_RESOURCES; i++) {
-   struct resource *r;
-   unsigned long r_size;
-
-   if (dev-class  8 == PCI_CLASS_BRIDGE_PCI
-i = PCI_BRIDGE_RESOURCES)
-   continue;
-   r = dev-resource[i];
-   r_size = r-end - r-start;
-   if (r_size  0xfff)
-   r_size = 0xfff;
-   if (r-flags  IORESOURCE_IO  (r_size) != 0) {
-   rc = 1;
-   push_end(res, r_size);
-   }
-   }
-   }
-
-   return rc;
-}
-
-/* Here we scan all P2P bridges of a given level that have a closed
- * IO window. Note that the test for the presence of a VGA card should
- * be improved to take into account already configured P2P bridges,

[PATCH 4/19] [POWERPC] pci32: Add flags modifying the PCI code behaviour

2007-12-19 Thread Benjamin Herrenschmidt
This adds to the 32 bits PCI code some flags, replacing the old
pci_assign_all_busses global, that allow to control various
aspects of the PCI probing, such as whether to re-assign all
resources or not, or to not try to assign anything at all.

This also adds the flag x86 already has to avoid ISA alignment
on bridges that don't have ISA forwarding enabled (no legacy
devices on the top level bus) and sets it for PowerMacs.

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---

 arch/powerpc/kernel/pci_32.c  |   42 --
 arch/powerpc/kernel/pci_64.c  |1 
 arch/powerpc/kernel/rtas_pci.c|6 ++--
 arch/powerpc/platforms/52xx/mpc52xx_pci.c |2 -
 arch/powerpc/platforms/82xx/pq2.c |2 -
 arch/powerpc/platforms/83xx/pci.c |2 -
 arch/powerpc/platforms/chrp/pci.c |2 -
 arch/powerpc/platforms/powermac/pci.c |7 +++--
 arch/powerpc/sysdev/fsl_pci.c |2 -
 arch/powerpc/sysdev/grackle.c |2 -
 include/asm-powerpc/pci-bridge.h  |   20 ++
 include/asm-powerpc/pci.h |9 --
 12 files changed, 75 insertions(+), 22 deletions(-)

--- linux-merge.orig/arch/powerpc/kernel/pci_32.c   2007-12-14 
15:49:28.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci_32.c2007-12-14 15:49:29.0 
+1100
@@ -35,6 +35,9 @@ unsigned long isa_io_base = 0;
 unsigned long pci_dram_offset = 0;
 int pcibios_assign_bus_offset = 1;
 
+/* Default PCI flags is 0 */
+unsigned int ppc_pci_flags;
+
 void pcibios_make_OF_bus_map(void);
 
 static void pcibios_fixup_resources(struct pci_dev* dev);
@@ -48,7 +51,7 @@ static u8* pci_to_OF_bus_map;
 /* By default, we don't re-assign bus numbers. We do this only on
  * some pmacs
  */
-int pci_assign_all_buses;
+static int pci_assign_all_buses;
 
 LIST_HEAD(hose_list);
 
@@ -174,6 +177,14 @@ void pcibios_bus_to_resource(struct pci_
 }
 EXPORT_SYMBOL(pcibios_bus_to_resource);
 
+static int skip_isa_ioresource_align(struct pci_dev *dev)
+{
+   if ((ppc_pci_flags  PPC_PCI_CAN_SKIP_ISA_ALIGN) 
+   !(dev-bus-bridge_ctl  PCI_BRIDGE_CTL_ISA))
+   return 1;
+   return 0;
+}
+
 /*
  * We need to avoid collisions with `mirrored' VGA ports
  * and other strange ISA hardware, so we always want the
@@ -195,6 +206,8 @@ void pcibios_align_resource(void *data, 
if (res-flags  IORESOURCE_IO) {
resource_size_t start = res-start;
 
+   if (skip_isa_ioresource_align(dev))
+   return;
if (start  0x300) {
start = (start + 0x3ff)  ~0x3ff;
res-start = start;
@@ -251,8 +264,13 @@ pcibios_allocate_bus_resources(struct li
continue;
if (bus-parent == NULL)
pr = (res-flags  IORESOURCE_IO)?
-   ioport_resource: iomem_resource;
+   ioport_resource : iomem_resource;
else {
+   /* Don't bother with non-root busses when
+* re-assigning all resources.
+*/
+   if (ppc_pci_flags  PPC_PCI_REASSIGN_ALL_RSRC)
+   continue;
pr = pci_find_parent_resource(bus-self, res);
if (pr == res) {
/* this happens when the generic PCI
@@ -720,6 +738,9 @@ pcibios_init(void)
 
printk(KERN_INFO PCI: Probing PCI hardware\n);
 
+   if (ppc_pci_flags  PPC_PCI_REASSIGN_ALL_BUS)
+   pci_assign_all_buses = 1;
+
/* Scan all of the recorded PCI controllers.  */
list_for_each_entry_safe(hose, tmp, hose_list, list_node) {
if (pci_assign_all_buses)
@@ -746,13 +767,18 @@ pcibios_init(void)
if (ppc_md.pcibios_fixup)
ppc_md.pcibios_fixup();
 
-   /* Allocate and assign resources */
+   /* Allocate and assign resources. If we re-assign everything, then
+* we skip the allocate phase
+*/
pcibios_allocate_bus_resources(pci_root_buses);
-   pcibios_allocate_resources(0);
-   pcibios_allocate_resources(1);
-
-   DBG(PCI: Assigning unassigned resouces...\n);
-   pci_assign_unassigned_resources();
+   if (!(ppc_pci_flags  PPC_PCI_REASSIGN_ALL_RSRC)) {
+   pcibios_allocate_resources(0);
+   pcibios_allocate_resources(1);
+   }
+   if (!(ppc_pci_flags  PPC_PCI_PROBE_ONLY)) {
+   DBG(PCI: Assigning unassigned resouces...\n);
+   pci_assign_unassigned_resources();
+   }
 
/* Call machine dependent post-init code */
if (ppc_md.pcibios_after_init)
Index: linux-merge/arch/powerpc/kernel/pci_64.c

[PATCH 5/19] [POWERPC] pci32: Remove obsolete PowerMac bus number hack

2007-12-19 Thread Benjamin Herrenschmidt
The 32 bits PCI code carries an old hack that was only useful for G5
machines. Nowdays, the 32 bits kernel doesn't support any of those
machines anymore so the hack is basically never used, remove it.

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---

 arch/powerpc/kernel/pci_32.c |   11 ---
 1 file changed, 11 deletions(-)

--- linux-merge.orig/arch/powerpc/kernel/pci_32.c   2007-12-14 
15:49:29.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci_32.c2007-12-14 15:49:29.0 
+1100
@@ -922,17 +922,6 @@ long sys_pciconfig_iobase(long which, un
struct pci_controller* hose;
long result = -EOPNOTSUPP;
 
-   /* Argh ! Please forgive me for that hack, but that's the
-* simplest way to get existing XFree to not lockup on some
-* G5 machines... So when something asks for bus 0 io base
-* (bus 0 is HT root), we return the AGP one instead.
-*/
-#ifdef CONFIG_PPC_PMAC
-   if (machine_is(powermac)  machine_is_compatible(MacRISC4))
-   if (bus == 0)
-   bus = 0xf0;
-#endif /* CONFIG_PPC_PMAC */
-
hose = pci_bus_to_hose(bus);
if (!hose)
return -ENODEV;
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 6/19] [POWERPC] pci32: Add platform option to enable /proc PCI domains

2007-12-19 Thread Benjamin Herrenschmidt
This adds flags the platforms can use to enable domain numbers
in /proc/bus/pci.

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---

 arch/powerpc/kernel/pci-common.c |   16 
 arch/powerpc/kernel/pci_64.c |8 
 include/asm-powerpc/pci-bridge.h |5 +
 include/asm-powerpc/pci.h|   14 --
 4 files changed, 25 insertions(+), 18 deletions(-)

--- linux-merge.orig/arch/powerpc/kernel/pci-common.c   2007-12-14 
15:49:00.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci-common.c2007-12-14 
15:49:30.0 +1100
@@ -639,3 +639,19 @@ void __devinit pci_process_bridge_OF_ran
hose-mem_resources[memno-1] = tmp;
}
 }
+
+/* Decide whether to display the domain number in /proc */
+int pci_proc_domain(struct pci_bus *bus)
+{
+   struct pci_controller *hose = pci_bus_to_host(bus);
+#ifdef CONFIG_PPC64
+   return hose-buid != 0;
+#else
+   if (!(ppc_pci_flags  PPC_PCI_ENABLE_PROC_DOMAINS))
+   return 0;
+   if (ppc_pci_flags  PPC_PCI_COMPAT_DOMAIN_0)
+   return hose-global_number != 0;
+   return 1;
+#endif
+}
+
Index: linux-merge/arch/powerpc/kernel/pci_64.c
===
--- linux-merge.orig/arch/powerpc/kernel/pci_64.c   2007-12-14 
15:49:29.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci_64.c2007-12-14 15:49:30.0 
+1100
@@ -570,14 +570,6 @@ int pcibios_enable_device(struct pci_dev
return 0;
 }
 
-/* Decide whether to display the domain number in /proc */
-int pci_proc_domain(struct pci_bus *bus)
-{
-   struct pci_controller *hose = pci_bus_to_host(bus);
-   return hose-buid != 0;
-}
-
-
 #ifdef CONFIG_HOTPLUG
 
 int pcibios_unmap_io_space(struct pci_bus *bus)
Index: linux-merge/include/asm-powerpc/pci-bridge.h
===
--- linux-merge.orig/include/asm-powerpc/pci-bridge.h   2007-12-14 
15:49:29.0 +1100
+++ linux-merge/include/asm-powerpc/pci-bridge.h2007-12-14 
15:49:30.0 +1100
@@ -30,6 +30,11 @@ enum {
 * ISA forwarding enabled
 */
PPC_PCI_CAN_SKIP_ISA_ALIGN  = 0x0008,
+
+   /* Enable domain numbers in /proc */
+   PPC_PCI_ENABLE_PROC_DOMAINS = 0x0010,
+   /* ... except for domain 0 */
+   PPC_PCI_COMPAT_DOMAIN_0 = 0x0020,
 };
 
 
Index: linux-merge/include/asm-powerpc/pci.h
===
--- linux-merge.orig/include/asm-powerpc/pci.h  2007-12-14 15:49:29.0 
+1100
+++ linux-merge/include/asm-powerpc/pci.h   2007-12-14 15:49:30.0 
+1100
@@ -98,9 +98,6 @@ static inline void pci_dma_burst_advice(
 #define get_pci_dma_ops()  NULL
 #endif
 
-/* Decide whether to display the domain number in /proc */
-extern int pci_proc_domain(struct pci_bus *bus);
-
 #else /* 32-bit */
 
 #ifdef CONFIG_PCI
@@ -112,17 +109,14 @@ static inline void pci_dma_burst_advice(
*strategy_parameter = ~0UL;
 }
 #endif
-
-/* Set the name of the bus as it appears in /proc/bus/pci */
-static inline int pci_proc_domain(struct pci_bus *bus)
-{
-   return 0;
-}
-
 #endif /* CONFIG_PPC64 */
 
 extern int pci_domain_nr(struct pci_bus *bus);
 
+/* Decide whether to display the domain number in /proc */
+extern int pci_proc_domain(struct pci_bus *bus);
+
+
 struct vm_area_struct;
 /* Map a range of PCI memory or I/O space for a device into user space */
 int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma,
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 7/19] [POWERPC] Merge pcibios_resource_to_bus/bus_to_resource

2007-12-19 Thread Benjamin Herrenschmidt
This merges the PowerPC 32 and 64 bits version of pcibios_resource_to_bus
and pcibios_bus_to_resource().

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---

 arch/powerpc/kernel/pci-common.c |   36 +
 arch/powerpc/kernel/pci_32.c |   32 -
 arch/powerpc/kernel/pci_64.c |   42 ---
 3 files changed, 36 insertions(+), 74 deletions(-)

--- linux-merge.orig/arch/powerpc/kernel/pci-common.c   2007-12-14 
15:49:30.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci-common.c2007-12-14 
15:49:31.0 +1100
@@ -655,3 +655,39 @@ int pci_proc_domain(struct pci_bus *bus)
 #endif
 }
 
+void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region 
*region,
+struct resource *res)
+{
+   resource_size_t offset = 0, mask = (resource_size_t)-1;
+   struct pci_controller *hose = pci_bus_to_host(dev-bus);
+
+   if (!hose)
+   return;
+   if (res-flags  IORESOURCE_IO) {
+   offset = (unsigned long)hose-io_base_virt - _IO_BASE;
+   mask = 0xu;
+   } else if (res-flags  IORESOURCE_MEM)
+   offset = hose-pci_mem_offset;
+
+   region-start = (res-start - offset)  mask;
+   region-end = (res-end - offset)  mask;
+}
+EXPORT_SYMBOL(pcibios_resource_to_bus);
+
+void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
+struct pci_bus_region *region)
+{
+   resource_size_t offset = 0, mask = (resource_size_t)-1;
+   struct pci_controller *hose = pci_bus_to_host(dev-bus);
+
+   if (!hose)
+   return;
+   if (res-flags  IORESOURCE_IO) {
+   offset = (unsigned long)hose-io_base_virt - _IO_BASE;
+   mask = 0xu;
+   } else if (res-flags  IORESOURCE_MEM)
+   offset = hose-pci_mem_offset;
+   res-start = (region-start + offset)  mask;
+   res-end = (region-end + offset)  mask;
+}
+EXPORT_SYMBOL(pcibios_bus_to_resource);
Index: linux-merge/arch/powerpc/kernel/pci_32.c
===
--- linux-merge.orig/arch/powerpc/kernel/pci_32.c   2007-12-14 
15:49:29.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci_32.c2007-12-14 15:49:31.0 
+1100
@@ -145,38 +145,6 @@ pcibios_fixup_resources(struct pci_dev *
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID,   PCI_ANY_ID, 
pcibios_fixup_resources);
 
-void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region 
*region,
-   struct resource *res)
-{
-   resource_size_t offset = 0, mask = (resource_size_t)-1;
-   struct pci_controller *hose = dev-sysdata;
-
-   if (hose  res-flags  IORESOURCE_IO) {
-   offset = (unsigned long)hose-io_base_virt - isa_io_base;
-   mask = 0xu;
-   } else if (hose  res-flags  IORESOURCE_MEM)
-   offset = hose-pci_mem_offset;
-   region-start = (res-start - offset)  mask;
-   region-end = (res-end - offset)  mask;
-}
-EXPORT_SYMBOL(pcibios_resource_to_bus);
-
-void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
-struct pci_bus_region *region)
-{
-   resource_size_t offset = 0, mask = (resource_size_t)-1;
-   struct pci_controller *hose = dev-sysdata;
-
-   if (hose  res-flags  IORESOURCE_IO) {
-   offset = (unsigned long)hose-io_base_virt - isa_io_base;
-   mask = 0xu;
-   } else if (hose  res-flags  IORESOURCE_MEM)
-   offset = hose-pci_mem_offset;
-   res-start = (region-start + offset)  mask;
-   res-end = (region-end + offset)  mask;
-}
-EXPORT_SYMBOL(pcibios_bus_to_resource);
-
 static int skip_isa_ioresource_align(struct pci_dev *dev)
 {
if ((ppc_pci_flags  PPC_PCI_CAN_SKIP_ISA_ALIGN) 
Index: linux-merge/arch/powerpc/kernel/pci_64.c
===
--- linux-merge.orig/arch/powerpc/kernel/pci_64.c   2007-12-14 
15:49:30.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci_64.c2007-12-14 15:49:31.0 
+1100
@@ -77,48 +77,6 @@ static void fixup_broken_pcnet32(struct 
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TRIDENT, PCI_ANY_ID, 
fixup_broken_pcnet32);
 
-void  pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region 
*region,
- struct resource *res)
-{
-   unsigned long offset = 0;
-   struct pci_controller *hose = pci_bus_to_host(dev-bus);
-
-   if (!hose)
-   return;
-
-   if (res-flags  IORESOURCE_IO)
-   offset = (unsigned long)hose-io_base_virt - _IO_BASE;
-
-   if (res-flags  IORESOURCE_MEM)
-   offset = hose-pci_mem_offset;
-
-   region-start = res-start - offset;
-   region-end = res-end - offset;
-}
-
-void 

[PATCH 8/19] [POWERPC] Merge PCI resource fixups

2007-12-19 Thread Benjamin Herrenschmidt
The PCI code in 32 and 64 bits fixes up resources differently.

32 bits uses a header quirk plus handles bridges in pcibios_fixup_bus()
while 64 bits does things in various places depending on whether you
are using OF probing, using PCI hotplug, etc...

This merges those by basically using the 32 bits approach for both,
with various tweaks to make 64 bits work with the new approach.

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---

 arch/powerpc/kernel/pci-common.c   |  130 +
 arch/powerpc/kernel/pci_32.c   |   83 --
 arch/powerpc/kernel/pci_64.c   |  104 +++
 arch/powerpc/platforms/pseries/pci_dlpar.c |   14 +--
 drivers/pci/hotplug/rpadlpar_core.c|2 
 include/asm-powerpc/machdep.h  |   14 +--
 include/asm-powerpc/pci-bridge.h   |2 
 include/asm-powerpc/pci.h  |6 -
 8 files changed, 167 insertions(+), 188 deletions(-)

--- linux-merge.orig/arch/powerpc/kernel/pci-common.c   2007-12-14 
15:49:31.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci-common.c2007-12-14 
15:49:31.0 +1100
@@ -691,3 +691,133 @@ void pcibios_bus_to_resource(struct pci_
res-end = (region-end + offset)  mask;
 }
 EXPORT_SYMBOL(pcibios_bus_to_resource);
+
+/* Fixup a bus resource into a linux resource */
+static void __devinit fixup_resource(struct resource *res, struct pci_dev *dev)
+{
+   struct pci_controller *hose = pci_bus_to_host(dev-bus);
+   resource_size_t offset = 0, mask = (resource_size_t)-1;
+
+   if (res-flags  IORESOURCE_IO) {
+   offset = (unsigned long)hose-io_base_virt - _IO_BASE;
+   mask = 0xu;
+   } else if (res-flags  IORESOURCE_MEM)
+   offset = hose-pci_mem_offset;
+
+   res-start = (res-start + offset)  mask;
+   res-end = (res-end + offset)  mask;
+
+   pr_debug(PCI:%s%016llx-%016llx\n,
+pci_name(dev),
+(unsigned long long)res-start,
+(unsigned long long)res-end);
+}
+
+
+/* This header fixup will do the resource fixup for all devices as they are
+ * probed, but not for bridge ranges
+ */
+static void __devinit pcibios_fixup_resources(struct pci_dev *dev)
+{
+   struct pci_controller *hose = pci_bus_to_host(dev-bus);
+   int i;
+
+   if (!hose) {
+   printk(KERN_ERR No host bridge for PCI dev %s !\n,
+  pci_name(dev));
+   return;
+   }
+   for (i = 0; i  DEVICE_COUNT_RESOURCE; i++) {
+   struct resource *res = dev-resource + i;
+   if (!res-flags)
+   continue;
+   if (res-end == 0x) {
+   pr_debug(PCI:%s Resource %d %016llx-%016llx [%x] is 
unassigned\n,
+pci_name(dev), i,
+(unsigned long long)res-start,
+(unsigned long long)res-end,
+(unsigned int)res-flags);
+   res-end -= res-start;
+   res-start = 0;
+   res-flags |= IORESOURCE_UNSET;
+   continue;
+   }
+
+   pr_debug(PCI:%s Resource %d %016llx-%016llx [%x] fixup...\n,
+pci_name(dev), i,
+(unsigned long long)res-start,\
+(unsigned long long)res-end,
+(unsigned int)res-flags);
+
+   fixup_resource(res, dev);
+   }
+
+   /* Call machine specific resource fixup */
+   if (ppc_md.pcibios_fixup_resources)
+   ppc_md.pcibios_fixup_resources(dev);
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources);
+
+static void __devinit __pcibios_fixup_bus(struct pci_bus *bus)
+{
+   struct pci_dev *dev = bus-self;
+
+   pr_debug(PCI: Fixup bus %d (%s)\n, bus-number, dev ? pci_name(dev) : 
PHB);
+
+   /* Fixup PCI-PCI bridges. Host bridges are handled separately, for
+* now differently between 32 and 64 bits.
+*/
+   if (dev != NULL) {
+   struct resource *res;
+   int i;
+
+   for (i = 0; i  PCI_BUS_NUM_RESOURCES; ++i) {
+   if ((res = bus-resource[i]) == NULL)
+   continue;
+   if (!res-flags || bus-self-transparent)
+   continue;
+
+   pr_debug(PCI:%s Bus rsrc %d %016llx-%016llx [%x] 
fixup...\n,
+pci_name(dev), i,
+(unsigned long long)res-start,\
+(unsigned long long)res-end,
+(unsigned int)res-flags);
+
+   fixup_resource(res, dev);
+   }
+   }
+
+   /* Additional setup that 

[PATCH 9/19] [POWERPC] Merge PCI resource allocation assignment

2007-12-19 Thread Benjamin Herrenschmidt
The 32 bits PCI code now uses the generic code for assigning unassigned
resources and an algorithm similar to x86 for claiming existing ones.

This works far better than the 64 bits code which basically can only
claim existing ones (pci_probe_only=1) or would fall appart completely.

This merges them so that the new 32 bits implementation is used for both.

64 bits now gets the new PCI flags for controlling the behaviour, though
the old pci_probe_only global is still there for now to be cleared if you
want to.

I kept a pcibios_claim_one_bus() function mostly based on the old 64
bits code for use by the DLPAR hotplug. This will have to be cleaned
up, thought I hope it will work in the meantime.

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---

 arch/powerpc/kernel/pci-common.c  |  292 ++
 arch/powerpc/kernel/pci_32.c  |  246 
 arch/powerpc/kernel/pci_64.c  |  118 +
 arch/powerpc/platforms/powermac/pci.c |3 
 include/asm-powerpc/pci.h |8 
 5 files changed, 311 insertions(+), 356 deletions(-)

--- linux-merge.orig/arch/powerpc/kernel/pci-common.c   2007-12-14 
15:49:31.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci-common.c2007-12-14 
15:49:32.0 +1100
@@ -53,6 +53,8 @@ static int global_phb_number; /* Global
 /* ISA Memory physical address */
 resource_size_t isa_mem_base;
 
+/* Default PCI flags is 0 */
+unsigned int ppc_pci_flags;
 
 struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
 {
@@ -821,3 +823,293 @@ void __devinit pcibios_fixup_of_probed_b
 {
__pcibios_fixup_bus(bus);
 }
+
+static int skip_isa_ioresource_align(struct pci_dev *dev)
+{
+   if ((ppc_pci_flags  PPC_PCI_CAN_SKIP_ISA_ALIGN) 
+   !(dev-bus-bridge_ctl  PCI_BRIDGE_CTL_ISA))
+   return 1;
+   return 0;
+}
+
+/*
+ * We need to avoid collisions with `mirrored' VGA ports
+ * and other strange ISA hardware, so we always want the
+ * addresses to be allocated in the 0x000-0x0ff region
+ * modulo 0x400.
+ *
+ * Why? Because some silly external IO cards only decode
+ * the low 10 bits of the IO address. The 0x00-0xff region
+ * is reserved for motherboard devices that decode all 16
+ * bits, so it's ok to allocate at, say, 0x2800-0x28ff,
+ * but we want to try to avoid allocating at 0x2900-0x2bff
+ * which might have be mirrored at 0x0100-0x03ff..
+ */
+void pcibios_align_resource(void *data, struct resource *res,
+   resource_size_t size, resource_size_t align)
+{
+   struct pci_dev *dev = data;
+
+   if (res-flags  IORESOURCE_IO) {
+   resource_size_t start = res-start;
+
+   if (skip_isa_ioresource_align(dev))
+   return;
+   if (start  0x300) {
+   start = (start + 0x3ff)  ~0x3ff;
+   res-start = start;
+   }
+   }
+}
+EXPORT_SYMBOL(pcibios_align_resource);
+
+/*
+ * Reparent resource children of pr that conflict with res
+ * under res, and make res replace those children.
+ */
+static int __init reparent_resources(struct resource *parent,
+struct resource *res)
+{
+   struct resource *p, **pp;
+   struct resource **firstpp = NULL;
+
+   for (pp = parent-child; (p = *pp) != NULL; pp = p-sibling) {
+   if (p-end  res-start)
+   continue;
+   if (res-end  p-start)
+   break;
+   if (p-start  res-start || p-end  res-end)
+   return -1;  /* not completely contained */
+   if (firstpp == NULL)
+   firstpp = pp;
+   }
+   if (firstpp == NULL)
+   return -1;  /* didn't find any conflicting entries? */
+   res-parent = parent;
+   res-child = *firstpp;
+   res-sibling = *pp;
+   *firstpp = res;
+   *pp = NULL;
+   for (p = res-child; p != NULL; p = p-sibling) {
+   p-parent = res;
+   DBG(KERN_INFO PCI: reparented %s [%llx..%llx] under %s\n,
+   p-name,
+   (unsigned long long)p-start,
+   (unsigned long long)p-end, res-name);
+   }
+   return 0;
+}
+
+/*
+ *  Handle resources of PCI devices.  If the world were perfect, we could
+ *  just allocate all the resource regions and do nothing more.  It isn't.
+ *  On the other hand, we cannot just re-allocate all devices, as it would
+ *  require us to know lots of host bridge internals.  So we attempt to
+ *  keep as much of the original configuration as possible, but tweak it
+ *  when it's found to be wrong.
+ *
+ *  Known BIOS problems we have to work around:
+ * - I/O or memory regions not configured
+ * - regions configured, but not enabled in the command register
+ * - bogus I/O addresses above 64K used
+ * - expansion ROMs 

[PATCH 10/19] [POWERPC] fix iSeries PCI resource management

2007-12-19 Thread Benjamin Herrenschmidt
The way iSeries manages PCI IO and Memory resources is a bit strange
and is based on overriding the content of those resources with home
cooked ones afterward.

This changes it a bit to better integrate with the new resource handling
so that the virtual tokens that iSeries replaces resources with are
done from the proper per-device fixup hook, and bridge resources are
set to enclose that token space. This fixes various things such as
the output of /proc/iomem  ioports, among others. The patch also fixup
various boot messages as well.

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---
 
 arch/powerpc/kernel/pci-common.c   |   16 
 arch/powerpc/kernel/pci_64.c   |   19 -
 arch/powerpc/platforms/iseries/pci.c   |  123 +
 arch/powerpc/platforms/iseries/pci.h   |4 +
 arch/powerpc/platforms/iseries/setup.c |   37 +
 5 files changed, 121 insertions(+), 78 deletions(-)

--- linux-merge.orig/arch/powerpc/kernel/pci-common.c   2007-12-14 
15:49:32.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci-common.c2007-12-14 
15:49:33.0 +1100
@@ -190,6 +190,20 @@ int pci_read_irq_line(struct pci_dev *pc
struct of_irq oirq;
unsigned int virq;
 
+   /* The current device-tree that iSeries generates from the HV
+* PCI informations doesn't contain proper interrupt routing,
+* and all the fallback would do is print out crap, so we
+* don't attempt to resolve the interrupts here at all, some
+* iSeries specific fixup does it.
+*
+* In the long run, we will hopefully fix the generated device-tree
+* instead.
+*/
+#ifdef CONFIG_PPC_ISERIES
+   if (firmware_has_feature(FW_FEATURE_ISERIES))
+   return -1;
+#endif
+
DBG(Try to map irq for %s...\n, pci_name(pci_dev));
 
 #ifdef DEBUG
@@ -946,7 +960,7 @@ static void __init pcibios_allocate_bus_
|| res-start  res-end)
continue;
if (bus-parent == NULL)
-   pr = (res-flags  IORESOURCE_IO)?
+   pr = (res-flags  IORESOURCE_IO) ?
ioport_resource : iomem_resource;
else {
/* Don't bother with non-root busses when
Index: linux-merge/arch/powerpc/kernel/pci_64.c
===
--- linux-merge.orig/arch/powerpc/kernel/pci_64.c   2007-12-14 
15:49:32.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci_64.c2007-12-14 15:49:33.0 
+1100
@@ -343,7 +343,7 @@ void __devinit scan_phb(struct pci_contr
int i, mode;
struct resource *res;
 
-   DBG(Scanning PHB %s\n, node ? node-full_name : NO NAME);
+   DBG(PCI: Scanning PHB %s\n, node ? node-full_name : NO NAME);
 
/* Create an empty bus for the toplevel */
bus = pci_create_bus(hose-parent, hose-first_busno, hose-ops, node);
@@ -359,9 +359,22 @@ void __devinit scan_phb(struct pci_contr
pcibios_map_io_space(bus);
 
/* Wire up PHB bus resources */
-   bus-resource[0] = res = hose-io_resource;
-   for (i = 0; i  3; ++i)
+   if (hose-io_resource.flags) {
+   DBG(PCI: PHB IO resource= %016lx-%016lx [%lx]\n,
+   hose-io_resource.start, hose-io_resource.end,
+   hose-io_resource.flags);
+   bus-resource[0] = res = hose-io_resource;
+   }
+   for (i = 0; i  3; ++i) {
+   DBG(PCI: PHB MEM resource %d = %016lx-%016lx [%lx]\n, i,
+   hose-mem_resources[i].start,
+   hose-mem_resources[i].end,
+   hose-mem_resources[i].flags);
bus-resource[i+1] = hose-mem_resources[i];
+   }
+   DBG(PCI: PHB MEM offset = %016lx\n, hose-pci_mem_offset);
+   DBG(PCI: PHB IO  offset = %08lx\n,
+   (unsigned long)hose-io_base_virt - _IO_BASE);
 
/* Get probe mode and perform scan */
mode = PCI_PROBE_NORMAL;
Index: linux-merge/arch/powerpc/platforms/iseries/pci.c
===
--- linux-merge.orig/arch/powerpc/platforms/iseries/pci.c   2007-12-14 
15:48:59.0 +1100
+++ linux-merge/arch/powerpc/platforms/iseries/pci.c2007-12-14 
15:49:33.0 +1100
@@ -20,6 +20,9 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
+
+#undef DEBUG
+
 #include linux/kernel.h
 #include linux/list.h
 #include linux/string.h
@@ -58,6 +61,7 @@ static int limit_pci_retries = 1; /* Set
 #define IOMM_TABLE_MAX_ENTRIES 1024
 #define IOMM_TABLE_ENTRY_SIZE  0x0040UL
 #define BASE_IO_MEMORY 0xE000UL
+#define END_IO_MEMORY  0xEFFFUL
 
 static 

[PATCH 11/19] [POWERPC] Updates/fixes to 32 bits pcibios_enable_device()

2007-12-19 Thread Benjamin Herrenschmidt
Our implementation of pcibios_enable_device() incorrectly ignores
the mask argument and always checks that all resources have been
allocated which isn't the right thing to do anymore.

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---

 arch/powerpc/kernel/pci_32.c |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

--- linux-merge.orig/arch/powerpc/kernel/pci_32.c   2007-12-14 
15:49:32.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci_32.c2007-12-14 15:49:33.0 
+1100
@@ -530,10 +530,16 @@ int pcibios_enable_device(struct pci_dev

pci_read_config_word(dev, PCI_COMMAND, cmd);
old_cmd = cmd;
-   for (idx=0; idx6; idx++) {
+   for (idx = 0; idx  PCI_NUM_RESOURCES; idx++) {
+   /* Only set up the requested stuff */
+   if (!(mask  (1  idx)))
+   continue;
r = dev-resource[idx];
+   if (!(r-flags  (IORESOURCE_IO | IORESOURCE_MEM)))
+   continue;
if (r-flags  IORESOURCE_UNSET) {
-   printk(KERN_ERR PCI: Device %s not available because 
of resource collisions\n, pci_name(dev));
+   printk(KERN_ERR PCI: Device %s not available because
+   of resource collisions\n, pci_name(dev));
return -EINVAL;
}
if (r-flags  IORESOURCE_IO)
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 12/19] [POWERPC] Merge 32 and 64 bits pcibios_enable_device

2007-12-19 Thread Benjamin Herrenschmidt
This merge the two implementations, based on the previously
fixed up 32 bits one. The pcibios_enable_device_hook in ppc_md
is now available for ppc64 use. Also remove the new unused
initial parameter from it and fixup users.

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---

 arch/powerpc/kernel/pci-common.c   |   38 +
 arch/powerpc/kernel/pci_32.c   |   37 
 arch/powerpc/kernel/pci_64.c   |   30 --
 arch/powerpc/platforms/powermac/pci.c  |   22 ---
 arch/powerpc/platforms/powermac/pmac.h |2 -
 include/asm-powerpc/machdep.h  |   10 +++-
 6 files changed, 53 insertions(+), 86 deletions(-)

--- linux-merge.orig/arch/powerpc/kernel/pci-common.c   2007-12-14 
15:49:33.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci-common.c2007-12-14 
15:49:34.0 +1100
@@ -1127,3 +1127,41 @@ void __devinit pcibios_claim_one_bus(str
 }
 EXPORT_SYMBOL_GPL(pcibios_claim_one_bus);
 #endif /* CONFIG_HOTPLUG */
+
+int pcibios_enable_device(struct pci_dev *dev, int mask)
+{
+   u16 cmd, old_cmd;
+   int idx;
+   struct resource *r;
+
+   if (ppc_md.pcibios_enable_device_hook)
+   if (ppc_md.pcibios_enable_device_hook(dev))
+   return -EINVAL;
+
+   pci_read_config_word(dev, PCI_COMMAND, cmd);
+   old_cmd = cmd;
+   for (idx = 0; idx  PCI_NUM_RESOURCES; idx++) {
+   /* Only set up the requested stuff */
+   if (!(mask  (1  idx)))
+   continue;
+   r = dev-resource[idx];
+   if (!(r-flags  (IORESOURCE_IO | IORESOURCE_MEM)))
+   continue;
+   if (r-flags  IORESOURCE_UNSET) {
+   printk(KERN_ERR PCI: Device %s not available because
+   of resource collisions\n, pci_name(dev));
+   return -EINVAL;
+   }
+   if (r-flags  IORESOURCE_IO)
+   cmd |= PCI_COMMAND_IO;
+   if (r-flags  IORESOURCE_MEM)
+   cmd |= PCI_COMMAND_MEMORY;
+   }
+   if (cmd != old_cmd) {
+   printk(PCI: Enabling device %s (%04x - %04x)\n,
+  pci_name(dev), old_cmd, cmd);
+   pci_write_config_word(dev, PCI_COMMAND, cmd);
+   }
+   return 0;
+}
+
Index: linux-merge/include/asm-powerpc/machdep.h
===
--- linux-merge.orig/include/asm-powerpc/machdep.h  2007-12-14 
15:49:31.0 +1100
+++ linux-merge/include/asm-powerpc/machdep.h   2007-12-14 15:49:34.0 
+1100
@@ -204,12 +204,6 @@ struct machdep_calls {
/*
 * optional PCI hooks
 */
-
-   /* Called when pci_enable_device() is called (initial=0) or
-* when a device with no assigned resource is found (initial=1).
-* Returns 0 to allow assignment/enabling of the device. */
-   int  (*pcibios_enable_device_hook)(struct pci_dev *, int initial);
-
/* Called in indirect_* to avoid touching devices */
int (*pci_exclude_device)(struct pci_controller *, unsigned char, 
unsigned char);
 
@@ -225,6 +219,10 @@ struct machdep_calls {
/* Called for each PCI bus in the system when it's probed */
void (*pcibios_fixup_bus)(struct pci_bus *);
 
+   /* Called when pci_enable_device() is called. Returns 0 to
+* allow assignment/enabling of the device. */
+   int  (*pcibios_enable_device_hook)(struct pci_dev *);
+
/* Called to shutdown machine specific hardware not already controlled
 * by other drivers.
 */
Index: linux-merge/arch/powerpc/kernel/pci_32.c
===
--- linux-merge.orig/arch/powerpc/kernel/pci_32.c   2007-12-14 
15:49:33.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci_32.c2007-12-14 15:49:34.0 
+1100
@@ -518,43 +518,6 @@ pcibios_update_irq(struct pci_dev *dev, 
/* XXX FIXME - update OF device tree node interrupt property */
 }
 
-int pcibios_enable_device(struct pci_dev *dev, int mask)
-{
-   u16 cmd, old_cmd;
-   int idx;
-   struct resource *r;
-
-   if (ppc_md.pcibios_enable_device_hook)
-   if (ppc_md.pcibios_enable_device_hook(dev, 0))
-   return -EINVAL;
-   
-   pci_read_config_word(dev, PCI_COMMAND, cmd);
-   old_cmd = cmd;
-   for (idx = 0; idx  PCI_NUM_RESOURCES; idx++) {
-   /* Only set up the requested stuff */
-   if (!(mask  (1  idx)))
-   continue;
-   r = dev-resource[idx];
-   if (!(r-flags  (IORESOURCE_IO | IORESOURCE_MEM)))
-   continue;
-   if (r-flags  IORESOURCE_UNSET) {
-   printk(KERN_ERR PCI: Device %s not 

[PATCH 13/19] [POWERPC] Fixup powermac enable device hook

2007-12-19 Thread Benjamin Herrenschmidt
Powermac's use of the pcibios_enable_device_hook() got slightly
broken by the recent PCI merge in that it won't be called for
the initial case of assigning resources to a previously
unassigned device. This was an abuse of that hook anyway, so
instead we now use a header quirk.

While at it, we move a #ifdef CONFIG_PPC32 to enclose more code
that is only ever used on 32 bits.

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---

 arch/powerpc/platforms/powermac/pci.c |   18 ++
 1 file changed, 14 insertions(+), 4 deletions(-)

--- linux-merge.orig/arch/powerpc/platforms/powermac/pci.c  2007-12-14 
15:49:34.0 +1100
+++ linux-merge/arch/powerpc/platforms/powermac/pci.c   2007-12-14 
15:49:34.0 +1100
@@ -1058,6 +1058,7 @@ void __init pmac_pci_init(void)
 #endif
 }
 
+#ifdef CONFIG_PPC32
 int pmac_pci_enable_device_hook(struct pci_dev *dev)
 {
struct device_node* node;
@@ -1106,7 +1107,6 @@ int pmac_pci_enable_device_hook(struct p
 * bridge and we must not, for example, enable MWI or set the
 * cache line size on them.
 */
-#ifdef CONFIG_PPC32
if (updatecfg) {
u16 cmd;
 
@@ -1118,12 +1118,23 @@ int pmac_pci_enable_device_hook(struct p
 
pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE,
  L1_CACHE_BYTES  2);
-#endif
}
 
return 0;
 }
 
+void __devinit pmac_pci_fixup_ohci(struct pci_dev *dev)
+{
+   struct device_node *node = pci_device_to_OF_node(dev);
+
+   /* We don't want to assign resources to USB controllers
+* absent from the OF tree (iBook second controller)
+*/
+   if (dev-class == PCI_CLASS_SERIAL_USB_OHCI  !node)
+   dev-resource[0].flags = 0;
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_APPLE, PCI_ANY_ID, pmac_pci_fixup_ohci);
+
 /* We power down some devices after they have been probed. They'll
  * be powered back on later on
  */
@@ -1171,7 +1182,6 @@ void __init pmac_pcibios_after_init(void
of_node_put(nd);
 }
 
-#ifdef CONFIG_PPC32
 void pmac_pci_fixup_cardbus(struct pci_dev* dev)
 {
if (!machine_is(powermac))
@@ -1259,7 +1269,7 @@ void pmac_pci_fixup_pciata(struct pci_de
}
 }
 DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, pmac_pci_fixup_pciata);
-#endif
+#endif /* CONFIG_PPC32 */
 
 /*
  * Disable second function on K2-SATA, it's broken
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 14/19] [POWERPC] Clear pci_probe_only on 64 bits PowerMac

2007-12-19 Thread Benjamin Herrenschmidt
It should now be safe to re-assign unassigned resources on 64 bits PowerMac
machines (G5s). This clears pci_probe_only on those.

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---

 arch/powerpc/platforms/powermac/pci.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- linux-merge.orig/arch/powerpc/platforms/powermac/pci.c  2007-12-14 
15:49:34.0 +1100
+++ linux-merge/arch/powerpc/platforms/powermac/pci.c   2007-12-14 
15:49:35.0 +1100
@@ -1041,8 +1041,8 @@ void __init pmac_pci_init(void)
}
/* pmac_check_ht_link(); */
 
-   /* Tell pci.c to not use the common resource allocation mechanism */
-   pci_probe_only = 1;
+   /* We can allocate missing resources if any */
+   pci_probe_only = 0;
 
 #else /* CONFIG_PPC64 */
init_p2pbridge();
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 15/19] [POWERPC] Various fixes to pcibios_enable_device()

2007-12-19 Thread Benjamin Herrenschmidt
Our implementation of pcibios_enable_device() has a couple of problems.

One is that it should not check IORESOURCE_UNSET, as this might be
left dangling after resource assignment (shouldn't but there are
bugs), but instead, we make it check resource-parent which should
be a reliable indication that the resource has been successfully
claimed (it's in the resource tree).

Then, we also need to skip ROM resources that haven't been enabled
as x86 does.

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---

 arch/powerpc/kernel/pci-common.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

--- linux-merge.orig/arch/powerpc/kernel/pci-common.c   2007-12-14 
15:49:34.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci-common.c2007-12-14 
15:49:36.0 +1100
@@ -1147,7 +1147,10 @@ int pcibios_enable_device(struct pci_dev
r = dev-resource[idx];
if (!(r-flags  (IORESOURCE_IO | IORESOURCE_MEM)))
continue;
-   if (r-flags  IORESOURCE_UNSET) {
+   if ((idx == PCI_ROM_RESOURCE) 
+   (!(r-flags  IORESOURCE_ROM_ENABLE)))
+   continue;
+   if (r-parent == NULL) {
printk(KERN_ERR PCI: Device %s not available because
of resource collisions\n, pci_name(dev));
return -EINVAL;
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 16/19] [POWERPC] Enable self-view of the HT host bridge on PowerMac G5

2007-12-19 Thread Benjamin Herrenschmidt
This enables the PCI code to see the device that represents the
HT host bridge on the PowerMac G5.

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---

 arch/powerpc/platforms/powermac/pci.c   |   54 
 arch/powerpc/platforms/powermac/setup.c |4 +-
 2 files changed, 38 insertions(+), 20 deletions(-)

--- linux-merge.orig/arch/powerpc/platforms/powermac/pci.c  2007-12-19 
15:47:23.0 +1100
+++ linux-merge/arch/powerpc/platforms/powermac/pci.c   2007-12-19 
15:50:46.0 +1100
@@ -314,10 +314,13 @@ static int u3_ht_skip_device(struct pci_
 
/* We only allow config cycles to devices that are in OF device-tree
 * as we are apparently having some weird things going on with some
-* revs of K2 on recent G5s
+* revs of K2 on recent G5s, except for the host bridge itself, which
+* is missing from the tree but we know we can probe.
 */
if (bus-self)
busdn = pci_device_to_OF_node(bus-self);
+   else if (devfn == 0)
+   return 0;
else
busdn = hose-dn;
for (dn = busdn-child; dn; dn = dn-sibling)
@@ -344,14 +347,15 @@ static int u3_ht_skip_device(struct pci_
+ (((unsigned int)bus)  16) \
+ 0x0100UL)
 
-static volatile void __iomem *u3_ht_cfg_access(struct pci_controller* hose,
-u8 bus, u8 devfn, u8 offset)
+static void __iomem *u3_ht_cfg_access(struct pci_controller *hose, u8 bus,
+ u8 devfn, u8 offset, int *swap)
 {
+   *swap = 1;
if (bus == hose-first_busno) {
-   /* For now, we don't self probe U3 HT bridge */
-   if (PCI_SLOT(devfn) == 0)
-   return NULL;
-   return hose-cfg_data + U3_HT_CFA0(devfn, offset);
+   if (devfn != 0)
+   return hose-cfg_data + U3_HT_CFA0(devfn, offset);
+   *swap = 0;
+   return ((void __iomem *)hose-cfg_addr) + (offset  2);
} else
return hose-cfg_data + U3_HT_CFA1(bus, devfn, offset);
 }
@@ -360,14 +364,15 @@ static int u3_ht_read_config(struct pci_
int offset, int len, u32 *val)
 {
struct pci_controller *hose;
-   volatile void __iomem *addr;
+   void __iomem *addr;
+   int swap;
 
hose = pci_bus_to_host(bus);
if (hose == NULL)
return PCIBIOS_DEVICE_NOT_FOUND;
if (offset = 0x100)
return  PCIBIOS_BAD_REGISTER_NUMBER;
-   addr = u3_ht_cfg_access(hose, bus-number, devfn, offset);
+   addr = u3_ht_cfg_access(hose, bus-number, devfn, offset, swap);
if (!addr)
return PCIBIOS_DEVICE_NOT_FOUND;
 
@@ -397,10 +402,10 @@ static int u3_ht_read_config(struct pci_
*val = in_8(addr);
break;
case 2:
-   *val = in_le16(addr);
+   *val = swap ? in_le16(addr) : in_be16(addr);
break;
default:
-   *val = in_le32(addr);
+   *val = swap ? in_le32(addr) : in_be32(addr);
break;
}
return PCIBIOS_SUCCESSFUL;
@@ -410,14 +415,15 @@ static int u3_ht_write_config(struct pci
 int offset, int len, u32 val)
 {
struct pci_controller *hose;
-   volatile void __iomem *addr;
+   void __iomem *addr;
+   int swap;
 
hose = pci_bus_to_host(bus);
if (hose == NULL)
return PCIBIOS_DEVICE_NOT_FOUND;
if (offset = 0x100)
return  PCIBIOS_BAD_REGISTER_NUMBER;
-   addr = u3_ht_cfg_access(hose, bus-number, devfn, offset);
+   addr = u3_ht_cfg_access(hose, bus-number, devfn, offset, swap);
if (!addr)
return PCIBIOS_DEVICE_NOT_FOUND;
 
@@ -439,10 +445,10 @@ static int u3_ht_write_config(struct pci
out_8(addr, val);
break;
case 2:
-   out_le16(addr, val);
+   swap ? out_le16(addr, val) : out_be16(addr, val);
break;
default:
-   out_le32((u32 __iomem *)addr, val);
+   swap ? out_le32(addr, val) : out_be32(addr, val);
break;
}
return PCIBIOS_SUCCESSFUL;
@@ -780,16 +786,26 @@ static void __init setup_u3_ht(struct pc
 {
struct device_node *np = hose-dn;
struct pci_controller *other = NULL;
+   struct resource cfg_res, self_res;
int i, cur;
 
 
hose-ops = u3_ht_pci_ops;
 
-   /* We hard code the address because of the different size of
-* the reg address cell, we shall fix that by killing struct
-* reg_property and using some accessor functions instead
+   /* Get base addresses from OF tree
+*/
+   if (of_address_to_resource(np, 0, cfg_res) ||
+   

[PATCH 17/19] [POWERPC] Improve resource setup of PowerMac G5 HT bridge

2007-12-19 Thread Benjamin Herrenschmidt
The device node for the HT bridge on G5s doesn't contain useful ranges.

We used to give it a bunch of the known PCI space and then punch a hole
in it based on where the AGP or PCIe region was. This reworks it to
use the actual register in the bridge that controls the decoding instead.

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---

 arch/powerpc/platforms/powermac/pci.c |  146 +++---
 1 file changed, 66 insertions(+), 80 deletions(-)

--- linux-merge.orig/arch/powerpc/platforms/powermac/pci.c  2007-12-19 
15:53:00.0 +1100
+++ linux-merge/arch/powerpc/platforms/powermac/pci.c   2007-12-19 
15:55:29.0 +1100
@@ -40,8 +40,6 @@
 static int has_uninorth;
 #ifdef CONFIG_PPC64
 static struct pci_controller *u3_agp;
-static struct pci_controller *u4_pcie;
-static struct pci_controller *u3_ht;
 #else
 static int has_second_ohare;
 #endif /* CONFIG_PPC64 */
@@ -779,16 +777,50 @@ static void __init setup_u4_pcie(struct 
 */
hose-first_busno = 0x00;
hose-last_busno = 0xff;
-   u4_pcie = hose;
+}
+
+static void __init parse_region_decode(struct pci_controller *hose,
+  u32 decode)
+{
+   unsigned long base, end, next = -1;
+   int i, cur = -1;
+
+   /* Iterate through all bits. We ignore the last bit as this region is
+* reserved for the ROM among other niceties
+*/
+   for (i = 0; i  31; i++) {
+   if ((decode  (0x8000  i)) == 0)
+   continue;
+   if (i  16) {
+   base = 0xf000 | (((u32)i)  24);
+   end = base + 0x00ff;
+   } else {
+   base = ((u32)i-16)  28;
+   end = base + 0x0fff;
+   }
+   if (base != next) {
+   if (++cur = 3) {
+   printk(KERN_WARNING PCI: Too many ranges !\n);
+   break;
+   }
+   hose-mem_resources[cur].flags = IORESOURCE_MEM;
+   hose-mem_resources[cur].name = hose-dn-full_name;
+   hose-mem_resources[cur].start = base;
+   hose-mem_resources[cur].end = end;
+   DBG(  %d: 0x%08lx-0x%08lx\n, cur, base, end);
+   } else {
+   DBG(   :   -0x%08lx\n, end);
+   hose-mem_resources[cur].end = end;
+   }
+   next = end + 1;
+   }
 }
 
 static void __init setup_u3_ht(struct pci_controller* hose)
 {
struct device_node *np = hose-dn;
-   struct pci_controller *other = NULL;
struct resource cfg_res, self_res;
-   int i, cur;
-
+   u32 decode;
 
hose-ops = u3_ht_pci_ops;
 
@@ -808,12 +840,9 @@ static void __init setup_u3_ht(struct pc
 self_res.end - self_res.start + 1);
 
/*
-* /ht node doesn't expose a ranges property, so we remove
-* regions that have been allocated to AGP. So far, this version of
-* the code doesn't assign any of the 0xfxxx fine memory regions
-* to /ht. We need to fix that sooner or later by either parsing all
-* child ranges properties or figuring out the U3 address space
-* decoding logic and then read its configuration register (if any).
+* /ht node doesn't expose a ranges property, we read the register
+* that controls the decoding logic and use that for memory regions.
+* The IO region is hard coded since it is fixed in HW as well.
 */
hose-io_base_phys = 0xf400;
hose-pci_io_size = 0x0040;
@@ -824,76 +853,33 @@ static void __init setup_u3_ht(struct pc
hose-pci_mem_offset = 0;
hose-first_busno = 0;
hose-last_busno = 0xef;
-   hose-mem_resources[0].name = np-full_name;
-   hose-mem_resources[0].start = 0x8000;
-   hose-mem_resources[0].end = 0xefff;
-   hose-mem_resources[0].flags = IORESOURCE_MEM;
-
-   u3_ht = hose;
-
-   if (u3_agp != NULL)
-   other = u3_agp;
-   else if (u4_pcie != NULL)
-   other = u4_pcie;
 
-   if (other == NULL) {
-   DBG(U3/4 has no AGP/PCIE, using full resource range\n);
-   return;
-   }
+   /* Note: fix offset when cfg_addr becomes a void * */
+   decode = in_be32(hose-cfg_addr + 0x80);
 
-   /* Fixup bus range vs. PCIE */
-   if (u4_pcie)
-   hose-last_busno = u4_pcie-first_busno - 1;
-
-   /* We remove the AGP resources from the resources allocated to HT,
-* that is we create holes. However, that code does assumptions
-* that so far happen to be true (cross fingers...), typically that
-* resources in the AGP node are properly ordered
-*/
-   cur = 0;
-   for (i=0; i3; i++) {
-  

[PATCH 18/19] [POWERPC] Fixup skipping of PowerMac PCI-PCI bridge closed resources

2007-12-19 Thread Benjamin Herrenschmidt
Apple firmware has a strange way to close bridge resources by setting
them to some bogus values that overlap RAM (strangely, I haven't seen it
conflicting with DMA so far...). This explicitely closes them to avoid
problems. Previously, they would be closed as a consequence of failing
to be allocated, but this makes it more explicit, and thus the log
message is more explicit too.

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---

 arch/powerpc/kernel/pci-common.c |   22 ++
 1 file changed, 22 insertions(+)

--- linux-merge.orig/arch/powerpc/kernel/pci-common.c   2007-12-19 
15:47:23.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci-common.c2007-12-19 
15:58:59.0 +1100
@@ -776,6 +776,7 @@ DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI
 
 static void __devinit __pcibios_fixup_bus(struct pci_bus *bus)
 {
+   struct pci_controller *hose = pci_bus_to_host(bus);
struct pci_dev *dev = bus-self;
 
pr_debug(PCI: Fixup bus %d (%s)\n, bus-number, dev ? pci_name(dev) : 
PHB);
@@ -793,6 +794,27 @@ static void __devinit __pcibios_fixup_bu
if (!res-flags || bus-self-transparent)
continue;
 
+   /* On PowerMac, Apple leaves bridge windows open over
+* an inaccessible region of memory space (0...f)
+* which is somewhat bogus, but that's what they think
+* means disabled...
+*
+* We clear those to force them to be reallocated later
+*
+* We detect such regions by the fact that the base is
+* equal to the pci_mem_offset of the host bridge and
+* their size is smaller than 1M.
+*/
+   if (res-start == hose-pci_mem_offset 
+   res-end  0x10) {
+   printk(KERN_INFO
+  PCI: Closing bogus Apple Firmware
+   region %d on bus 0x%02x\n,
+  i, bus-number);
+   res-flags = 0;
+   continue;
+   }
+
pr_debug(PCI:%s Bus rsrc %d %016llx-%016llx [%x] 
fixup...\n,
 pci_name(dev), i,
 (unsigned long long)res-start,\
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 19/19] [POWERPC] Disable PCI IO/Mem on a device when resources can't be allocated

2007-12-19 Thread Benjamin Herrenschmidt
This patch changes the PowerPC PCI code to disable IO and/or Memory
decoding on a PCI device when a resource of that type failed to be
allocated. This is done to avoid having unallocated dangling BARs enabled
that might try to decode on top of other devices.

If a proper resource is assigned later on, then pci_enable_device()
will take care of re-enabling decoding.

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---

 arch/powerpc/kernel/pci-common.c |   13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

--- linux-merge.orig/arch/powerpc/kernel/pci-common.c   2007-12-20 
14:51:19.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci-common.c2007-12-20 
14:51:20.0 +1100
@@ -1034,7 +1034,7 @@ clear_resource:
}
 }
 
-static inline void __devinit alloc_resource(struct pci_dev *dev, int idx)
+static inline int __devinit alloc_resource(struct pci_dev *dev, int idx)
 {
struct resource *pr, *r = dev-resource[idx];
 
@@ -1058,7 +1058,10 @@ static inline void __devinit alloc_resou
r-flags |= IORESOURCE_UNSET;
r-end -= r-start;
r-start = 0;
+
+   return -EBUSY;
}
+   return 0;
 }
 
 static void __init pcibios_allocate_resources(int pass)
@@ -1080,8 +1083,12 @@ static void __init pcibios_allocate_reso
disabled = !(command  PCI_COMMAND_IO);
else
disabled = !(command  PCI_COMMAND_MEMORY);
-   if (pass == disabled)
-   alloc_resource(dev, idx);
+   if (pass == disabled  alloc_resource(dev, idx)) {
+   command = ~(r-flags  (IORESOURCE_IO |
+IORESOURCE_MEM));
+   pci_write_config_word(dev,
+ PCI_COMMAND, command);
+   }
}
if (pass)
continue;
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] ASoC drivers for the Freescale MPC8610 SoC

2007-12-19 Thread Olof Johansson
Hi,

This is a fairly substantial driver to get through, but here are some
initial comments on some of the simpler stuff:


On Wed, Dec 19, 2007 at 06:03:09PM -0600, Timur Tabi wrote:
 This patch adds ALSA SoC device drivers for the Freescale MPC8610 SoC
 and the MPC8610-HPCD reference board.

[...]

 diff --git a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c 
 b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
 index 6390895..6e1bde3 100644
 --- a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
 +++ b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
 @@ -34,9 +34,27 @@
  
  #include asm/mpic.h
  
 +#include asm/of_platform.h
  #include sysdev/fsl_pci.h
  #include sysdev/fsl_soc.h
  
 +static struct of_device_id mpc8610_ids[] = {
 + { .type = soc, },
 + {}

Please scan based on compatible instead of device_type.

 diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
 new file mode 100644
 index 000..4a5bbd2
 --- /dev/null
 +++ b/sound/soc/fsl/Kconfig
 @@ -0,0 +1,21 @@
 +menu ALSA SoC audio for Freescale SOCs
 +
 +config SND_SOC_MPC8610
 + bool ALSA SoC support for the MPC8610 SOC
 + depends on SND_SOC # MPC8610_HPCD
 + default y #if MPC8610
 + help
 +   Say Y if you want to add support for codecs attached to the SSI
 +  device on an MPC8610.

Don't default configs to 'y'. Also, what's with the commented-out
dependencies and if?

 +config SND_SOC_MPC8610_HPCD
 + # ALSA SoC support for Freescale MPC8610HPCD
 + bool ALSA SoC support for the Freescale MPC8610 HPCD board
 + depends on SND_SOC_MPC8610
 + select SND_SOC_CS4270
 + select SND_SOC_CS4270_VD33_ERRATA
 + default y #if MPC8610_HPCD
 + help
 +   Say Y if you want to enable audio on the Freescale MPC8610 HPCD.

Same here w.r.t. defaults and dependencies.

 diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
 new file mode 100644
 index 000..6b86be0
 --- /dev/null
 +++ b/sound/soc/fsl/fsl_dma.c
 @@ -0,0 +1,819 @@
 +/*
 + * Freescale DMA ALSA SoC PCM driver
 + *
 + * Author: Timur Tabi [EMAIL PROTECTED]
 + *
 + * Copyright 2007 Freescale Semiconductor, 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.
 + *
 + * This driver implements ASoC support for the Elo DMA controller, which is
 + * the DMA controller on Freescale 83xx, 85xx, and 86xx SOCs. In ALSA terms,
 + * the PCM driver is what handles the DMA buffer.
 + */
 +
 +#include linux/module.h
 +#include linux/init.h
 +#include linux/platform_device.h
 +#include linux/dma-mapping.h
 +#include linux/interrupt.h
 +#include linux/delay.h
 +
 +#include sound/driver.h
 +#include sound/core.h
 +#include sound/pcm.h
 +#include sound/pcm_params.h
 +#include sound/soc.h
 +
 +#include asm/io.h
 +
 +#include fsl_dma.h
 +
 +/*
 + * The formats that the DMA controller supports, which is anything
 + * that is 8, 16, or 32 bits.
 + */
 +#define FSLDMA_PCM_FORMATS (SNDRV_PCM_FMTBIT_S8  | \
 + SNDRV_PCM_FMTBIT_U8 | \
 + SNDRV_PCM_FMTBIT_S16_LE | \
 + SNDRV_PCM_FMTBIT_S16_BE | \
 + SNDRV_PCM_FMTBIT_U16_LE | \
 + SNDRV_PCM_FMTBIT_U16_BE | \
 + SNDRV_PCM_FMTBIT_S24_LE | \
 + SNDRV_PCM_FMTBIT_S24_BE | \
 + SNDRV_PCM_FMTBIT_U24_LE | \
 + SNDRV_PCM_FMTBIT_U24_BE | \
 + SNDRV_PCM_FMTBIT_S32_LE | \
 + SNDRV_PCM_FMTBIT_S32_BE | \
 + SNDRV_PCM_FMTBIT_U32_LE | \
 + SNDRV_PCM_FMTBIT_U32_BE)
 +
 +#define FSLDMA_PCM_RATES (SNDRV_PCM_RATE_5512 | SNDRV_PCM_RATE_8000_192000 | 
 \
 +   SNDRV_PCM_RATE_CONTINUOUS)
 +
 +/* DMA global data.  This structure is used by fsl_dma_open() to determine
 + * which DMA channels to assign to a substream.  Unfortunately, ASoC V1 does
 + * not allow the machine driver to provide this information to the PCM
 + * driver in advance, and there's no way to differentiate between the two
 + * DMA controllers.  So for now, this driver only supports one SSI device
 + * using two DMA channels.  We cannot support multiple DMA devices.
 + *
 + * ssi_stx_phys: bus address of SSI STX register
 + * ssi_srx_phys: bus address of SSI SRX register
 + * dma_channel: pointer to the DMA channel's registers
 + * irq: IRQ for this DMA channel
 + * assigned: set to 1 if that DMA channel is assigned to a substream
 + */

This goes for the whole patch: You've got good documentation, but it's
not in docbook format. Please reformat it since it should be a pretty
simple thing to do.

 +/*
 + * Initialize this PCM driver.
 + *
 + * This function is called when the codec driver calls snd_soc_new_pcms(),
 + * once for each .dai_link in the 

[PATCH] [POWERPC] Fix for via-pmu based backlight control

2007-12-19 Thread Benjamin Herrenschmidt
This patch fixes a few issues with via-pmu based backlight control.

First, it fixes a sign problem with the setup of the backlight
curve since the values there -can- (and will) go negative.

Then, it reworks the interaction between this and the via-pmu sleep
code to properly restore backlight on wakeup from sleep.

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---

 drivers/macintosh/via-pmu-backlight.c |   48 --
 drivers/macintosh/via-pmu.c   |   26 +++---
 include/linux/pmu.h   |2 +
 3 files changed, 42 insertions(+), 34 deletions(-)

--- linux-merge.orig/drivers/macintosh/via-pmu-backlight.c  2007-12-20 
11:54:57.0 +1100
+++ linux-merge/drivers/macintosh/via-pmu-backlight.c   2007-12-20 
12:49:04.0 +1100
@@ -22,7 +22,7 @@ static u8 bl_curve[FB_BACKLIGHT_LEVELS];
 
 static void pmu_backlight_init_curve(u8 off, u8 min, u8 max)
 {
-   unsigned int i, flat, count, range = (max - min);
+   int i, flat, count, range = (max - min);
 
bl_curve[0] = off;
 
@@ -68,17 +68,11 @@ static int pmu_backlight_get_level_brigh
return pmulevel;
 }
 
-static int pmu_backlight_update_status(struct backlight_device *bd)
+static int __pmu_backlight_update_status(struct backlight_device *bd)
 {
struct adb_request req;
-   unsigned long flags;
int level = bd-props.brightness;
 
-   spin_lock_irqsave(pmu_backlight_lock, flags);
-
-   /* Don't update brightness when sleeping */
-   if (sleeping)
-   goto out;
 
if (bd-props.power != FB_BLANK_UNBLANK ||
bd-props.fb_blank != FB_BLANK_UNBLANK)
@@ -99,12 +93,23 @@ static int pmu_backlight_update_status(s
pmu_wait_complete(req);
}
 
-out:
-   spin_unlock_irqrestore(pmu_backlight_lock, flags);
-
return 0;
 }
 
+static int pmu_backlight_update_status(struct backlight_device *bd)
+{
+   unsigned long flags;
+   int rc = 0;
+
+   spin_lock_irqsave(pmu_backlight_lock, flags);
+   /* Don't update brightness when sleeping */
+   if (!sleeping)
+   rc = __pmu_backlight_update_status(bd);
+   spin_unlock_irqrestore(pmu_backlight_lock, flags);
+   return rc;
+}
+
+
 static int pmu_backlight_get_brightness(struct backlight_device *bd)
 {
return bd-props.brightness;
@@ -123,6 +128,16 @@ void pmu_backlight_set_sleep(int sleep)
 
spin_lock_irqsave(pmu_backlight_lock, flags);
sleeping = sleep;
+   if (pmac_backlight) {
+   if (sleep) {
+   struct adb_request req;
+
+   pmu_request(req, NULL, 2, PMU_POWER_CTRL,
+   PMU_POW_BACKLIGHT | PMU_POW_OFF);
+   pmu_wait_complete(req);
+   } else
+   __pmu_backlight_update_status(pmac_backlight);
+   }
spin_unlock_irqrestore(pmu_backlight_lock, flags);
 }
 #endif /* CONFIG_PM */
@@ -148,8 +163,8 @@ void __init pmu_backlight_init()
 
bd = backlight_device_register(name, NULL, NULL, pmu_backlight_data);
if (IS_ERR(bd)) {
-   printk(pmubl: Backlight registration failed\n);
-   goto error;
+   printk(KERN_ERR PMU Backlight registration failed\n);
+   return;
}
bd-props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
pmu_backlight_init_curve(0x7F, 0x46, 0x0E);
@@ -171,10 +186,5 @@ void __init pmu_backlight_init()
bd-props.power = FB_BLANK_UNBLANK;
backlight_update_status(bd);
 
-   printk(pmubl: Backlight initialized (%s)\n, name);
-
-   return;
-
-error:
-   return;
+   printk(KERN_INFO PMU Backlight initialized (%s)\n, name);
 }
Index: linux-merge/drivers/macintosh/via-pmu.c
===
--- linux-merge.orig/drivers/macintosh/via-pmu.c2007-12-20 
12:11:12.0 +1100
+++ linux-merge/drivers/macintosh/via-pmu.c 2007-12-20 12:12:46.0 
+1100
@@ -1758,8 +1758,6 @@ restore_via_state(void)
out_8(via[IER], IER_SET | SR_INT | CB1_INT);
 }
 
-extern void pmu_backlight_set_sleep(int sleep);
-
 #defineGRACKLE_PM  (17)
 #define GRACKLE_DOZE   (15)
 #defineGRACKLE_NAP (14)
@@ -2176,11 +2174,6 @@ pmu_release(struct inode *inode, struct 
  */
 void arch_suspend_disable_irqs(void)
 {
-#ifdef CONFIG_PMAC_BACKLIGHT
-   /* Tell backlight code not to muck around with the chip anymore */
-   pmu_backlight_set_sleep(1);
-#endif
-
/* Call platform functions marked on sleep */
pmac_pfunc_i2c_suspend();
pmac_pfunc_base_suspend();
@@ -2236,11 +2229,6 @@ static int powerbook_sleep(suspend_state
 
mdelay(100);
 
-#ifdef CONFIG_PMAC_BACKLIGHT
-   /* Tell backlight code it can use the chip again */
-   pmu_backlight_set_sleep(0);
-#endif
-
return 0;
 }
 
@@ -2493,10 +2481,15 @@ 

[PATCH] [POWERPC] Fix PCI IRQ fallback code to not map IRQ 0

2007-12-19 Thread Benjamin Herrenschmidt
The PCI IRQ code has a fallback when the device-tree parsing fails, that
tries to map the interrupt indicated by PCI_INTERRUPT_LINE if the firmware
set something in there. This is a bit fragile but has proven useful in some
cases so far. However, it's causing us to incorrectly try to map interrupt 0
on various setups, so let's prevent that case, as none of the cases where
the fallback is legit should have an IRQ 0.

Signed-off-by: Benjamin Herrenschmidt [EMAIL PROTECTED]
---

 arch/powerpc/kernel/pci-common.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- linux-merge.orig/arch/powerpc/kernel/pci-common.c   2007-12-14 
15:49:36.0 +1100
+++ linux-merge/arch/powerpc/kernel/pci-common.c2007-12-14 
15:49:36.0 +1100
@@ -225,10 +225,11 @@ int pci_read_irq_line(struct pci_dev *pc
if (pin == 0)
return -1;
if (pci_read_config_byte(pci_dev, PCI_INTERRUPT_LINE, line) ||
-   line == 0xff) {
+   line == 0xff || line == 0) {
return -1;
}
-   DBG( - no map ! Using irq line %d from PCI config\n, line);
+   DBG( - no map ! Using line %d (pin %d) from PCI config\n,
+   line, pin);
 
virq = irq_create_mapping(NULL, line);
if (virq != NO_IRQ)
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH v2] powerpc: add hugepagesz boot-time parameter

2007-12-19 Thread David Gibson
On Wed, Dec 19, 2007 at 04:35:47PM -0600, Jon Tollefson wrote:
 Paul, please include this in 2.6.25 if there are no objections.
 
 This patch adds the hugepagesz boot-time parameter for ppc64.  It lets
 one pick the size for huge pages. The choices available are 64K and 16M
 when the base page size is 4k. It defaults to 16M (previously the only
 only choice) if nothing or an invalid choice is specified.
 
 Tested 64K huge pages successfully with the libhugetlbfs 1.2.
 
 Changes from v1:
 disallow 64K huge pages when base page size is 64K since we can't
 distinguish between
 base and huge pages when doing a hash_page()
 collapsed pmd_offset and pmd_alloc to inline calls to simplify the
 main code
 removed printing of the huge page size in mm/hugetlb.c since this
 information is already
available in /proc/meminfo and leaves the remaining changes all
 powerpc specific

[snip]
 @@ -82,11 +81,31 @@ static int __hugepte_alloc(struct mm_struct *mm, hugepd_t 
 *hpdp,
   return 0;
  }
  
 +#ifndef CONFIG_PPC_64K_PAGES
 +static inline
 +pmd_t *hpmd_offset(pud_t *pud, unsigned long addr)
 +{
 + if (HPAGE_SHIFT == HPAGE_SHIFT_64K)
 + return pmd_offset(pud, addr);
 + else
 + return (pmd_t *) pud;
 +}
 +static inline
 +pmd_t *hpmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long addr)
 +{
 + if (HPAGE_SHIFT == HPAGE_SHIFT_64K)
 + return pmd_alloc(mm, pud, addr);
 + else
 + return (pmd_t *) pud;
 +}
 +#endif
 +

I'm baffled by this section of code; I can't see how it can work
properly with 64k base page size.  hpmd_offset() and hpmd_alloc() are
only defined if the base page size is 4k, but they appear to be used
unconditionally in huge_pte_offset() and huge_pte_alloc() (since you
remove the #ifdef that was there).

  /* Modelled after find_linux_pte() */
  pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
  {
   pgd_t *pg;
   pud_t *pu;
 + pmd_t *pm;
  
   BUG_ON(get_slice_psize(mm, addr) != mmu_huge_psize);
  
 @@ -96,14 +115,9 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned 
 long addr)
   if (!pgd_none(*pg)) {
   pu = pud_offset(pg, addr);
   if (!pud_none(*pu)) {
 -#ifdef CONFIG_PPC_64K_PAGES
 - pmd_t *pm;
 - pm = pmd_offset(pu, addr);
 + pm = hpmd_offset(pu, addr);
   if (!pmd_none(*pm))
   return hugepte_offset((hugepd_t *)pm, addr);
 -#else
 - return hugepte_offset((hugepd_t *)pu, addr);
 -#endif
   }
   }
  
 @@ -114,6 +128,7 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long 
 addr)
  {
   pgd_t *pg;
   pud_t *pu;
 + pmd_t *pm;
   hugepd_t *hpdp = NULL;
  
   BUG_ON(get_slice_psize(mm, addr) != mmu_huge_psize);
 @@ -124,14 +139,9 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned 
 long addr)
   pu = pud_alloc(mm, pg, addr);
  
   if (pu) {
 -#ifdef CONFIG_PPC_64K_PAGES
 - pmd_t *pm;
 - pm = pmd_alloc(mm, pu, addr);
 + pm = hpmd_alloc(mm, pu, addr);
   if (pm)
   hpdp = (hugepd_t *)pm;
 -#else
 - hpdp = (hugepd_t *)pu;
 -#endif
   }
  
   if (! hpdp)

[snip]
 diff --git a/include/asm-powerpc/pgtable.h b/include/asm-powerpc/pgtable.h
 index d18ffe7..66ff7e5 100644
 --- a/include/asm-powerpc/pgtable.h
 +++ b/include/asm-powerpc/pgtable.h
 @@ -37,6 +37,12 @@ extern void paging_init(void);
  #define io_remap_pfn_range(vma, vaddr, pfn, size, prot)  \
   remap_pfn_range(vma, vaddr, pfn, size, prot)
  
 +/* Base page size affects how we walk hugetlb page tables */
 +#ifdef CONFIG_PPC_64K_PAGES
 +#define hpmd_offset(pud, addr)   pmd_offset(pud, addr)
 +#define hpmd_alloc(mm, pud, addr)pmd_alloc(mm, pud, addr)
 +#endif

These functions are only used in hugetlbpage.c, I don't see any reason
they should go in the header file.

-- 
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


[PATCH 3/5] Clean up error returns

2007-12-19 Thread Jon Smirl
Return errors that were being ignored in the mpc-i2c driver

Signed-off-by: Jon Smirl [EMAIL PROTECTED]
---

 drivers/i2c/busses/i2c-mpc.c |   30 +-
 1 files changed, 17 insertions(+), 13 deletions(-)


diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index d8de4ac..7c35a8f 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -180,7 +180,7 @@ static void mpc_i2c_stop(struct mpc_i2c *i2c)
 static int mpc_write(struct mpc_i2c *i2c, int target,
 const u8 * data, int length, int restart)
 {
-   int i;
+   int i, result;
unsigned timeout = i2c-adap.timeout;
u32 flags = restart ? CCR_RSTA : 0;
 
@@ -192,15 +192,17 @@ static int mpc_write(struct mpc_i2c *i2c, int target,
/* Write target byte */
writeb((target  1), i2c-base + MPC_I2C_DR);
 
-   if (i2c_wait(i2c, timeout, 1)  0)
-   return -1;
+   result = i2c_wait(i2c, timeout, 1);
+   if (result  0)
+   return result;
 
for (i = 0; i  length; i++) {
/* Write data byte */
writeb(data[i], i2c-base + MPC_I2C_DR);
 
-   if (i2c_wait(i2c, timeout, 1)  0)
-   return -1;
+   result = i2c_wait(i2c, timeout, 1);
+   if (result  0)
+   return result;
}
 
return 0;
@@ -210,7 +212,7 @@ static int mpc_read(struct mpc_i2c *i2c, int target,
u8 * data, int length, int restart)
 {
unsigned timeout = i2c-adap.timeout;
-   int i;
+   int i, result;
u32 flags = restart ? CCR_RSTA : 0;
 
/* Start with MEN */
@@ -221,8 +223,9 @@ static int mpc_read(struct mpc_i2c *i2c, int target,
/* Write target address byte - this time with the read flag set */
writeb((target  1) | 1, i2c-base + MPC_I2C_DR);
 
-   if (i2c_wait(i2c, timeout, 1)  0)
-   return -1;
+   result = i2c_wait(i2c, timeout, 1);
+   if (result  0)
+   return result;
 
if (length) {
if (length == 1)
@@ -234,8 +237,9 @@ static int mpc_read(struct mpc_i2c *i2c, int target,
}
 
for (i = 0; i  length; i++) {
-   if (i2c_wait(i2c, timeout, 0)  0)
-   return -1;
+   result = i2c_wait(i2c, timeout, 0);
+   if (result  0)
+   return result;
 
/* Generate txack on next to last byte */
if (i == length - 2)
@@ -321,9 +325,9 @@ static int fsl_i2c_probe(struct platform_device *pdev)
 
pdata = (struct fsl_i2c_platform_data *) pdev-dev.platform_data;
 
-   if (!(i2c = kzalloc(sizeof(*i2c), GFP_KERNEL))) {
+   i2c = kzalloc(sizeof(*i2c), GFP_KERNEL);
+   if (!i2c)
return -ENOMEM;
-   }
 
i2c-irq = platform_get_irq(pdev, 0);
if (i2c-irq  0) {
@@ -381,7 +385,7 @@ static int fsl_i2c_remove(struct platform_device *pdev)
i2c_del_adapter(i2c-adap);
platform_set_drvdata(pdev, NULL);
 
-   if (i2c-irq != 0)
+   if (i2c-irq != NO_IRQ)
free_irq(i2c-irq, i2c);
 
iounmap(i2c-base);

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


[PATCH 0/5] Version 17, series to add device tree naming to i2c

2007-12-19 Thread Jon Smirl
Since copying i2c-mpc.c to maintain support for the ppc architecture seems to 
be an issue; instead rework i2c-mpc.c to use CONFIG_PPC_MERGE #ifdefs to 
support both the ppc and powerpc architecture. When ppc is deleted in six 
months these #ifdefs will need to be removed.

Another rework of the i2c for powerpc device tree patch. This version 
implements standard alias naming only on the powerpc platform and only for the 
device tree names. The old naming mechanism of i2c_client.name,driver_name is 
left in place and not changed for non-powerpc platforms. This patch is fully 
capable of dynamically loading the i2c modules. You can modprobe in the i2c-mpc 
driver and the i2c modules described in the device tree will be automatically 
loaded. Modules also work if compiled in.

The follow on patch to module-init-tools is also needed since the i2c subsystem 
has never implemented dynamic loading.

The following series implements standard linux module aliasing for i2c modules 
on arch=powerpc. It then converts the mpc i2c driver from being a platform 
driver to an open firmware one. I2C device names are picked up from the device 
tree. Module aliasing is used to translate from device tree names into to linux 
kernel names. Several i2c drivers are updated to use the new aliasing. 

--
Jon Smirl
[EMAIL PROTECTED] 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 5/5] Convert pfc8563 i2c driver from old style to new style

2007-12-19 Thread Jon Smirl
Convert pfc8563 i2c driver from old style to new style. The
driver is also modified to support device tree names via the
i2c mod alias mechanism.

Signed-off-by: Jon Smirl [EMAIL PROTECTED]
---

 drivers/rtc/rtc-pcf8563.c |  107 +++--
 1 files changed, 27 insertions(+), 80 deletions(-)


diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c
index 0242d80..e1ea2a0 100644
--- a/drivers/rtc/rtc-pcf8563.c
+++ b/drivers/rtc/rtc-pcf8563.c
@@ -25,10 +25,6 @@
  * located at 0x51 will pass the validation routine due to
  * the way the registers are implemented.
  */
-static unsigned short normal_i2c[] = { I2C_CLIENT_END };
-
-/* Module parameters */
-I2C_CLIENT_INSMOD;
 
 #define PCF8563_REG_ST10x00 /* status */
 #define PCF8563_REG_ST20x01
@@ -72,9 +68,6 @@ struct pcf8563 {
int c_polarity; /* 0: MO_C=1 means 19xx, otherwise MO_C=1 means 20xx */
 };
 
-static int pcf8563_probe(struct i2c_adapter *adapter, int address, int kind);
-static int pcf8563_detach(struct i2c_client *client);
-
 /*
  * In the routines that deal directly with the pcf8563 hardware, we use
  * rtc_time -- month 0-11, hour 0-23, yr = calendar year-epoch.
@@ -257,98 +250,52 @@ static const struct rtc_class_ops pcf8563_rtc_ops = {
.set_time   = pcf8563_rtc_set_time,
 };
 
-static int pcf8563_attach(struct i2c_adapter *adapter)
+static int pcf8563_remove(struct i2c_client *client)
 {
-   return i2c_probe(adapter, addr_data, pcf8563_probe);
+   struct rtc_device *rtc = i2c_get_clientdata(client);
+
+   if (rtc)
+   rtc_device_unregister(rtc);
+
+   return 0;
 }
 
+static struct i2c_device_id pcf8563_id[] = {
+   OF_I2C_ID(philips,pcf8563, 0)
+   OF_I2C_ID(epson,rtc8564, 0)
+   {},
+};
+MODULE_DEVICE_TABLE(i2c, pcf8563_id);
+
+static int pcf8563_probe(struct i2c_client *client, const struct i2c_device_id 
*id);
+
 static struct i2c_driver pcf8563_driver = {
.driver = {
-   .name   = pcf8563,
+   .name   = rtc-pcf8563,
},
.id = I2C_DRIVERID_PCF8563,
-   .attach_adapter = pcf8563_attach,
-   .detach_client  = pcf8563_detach,
+   .probe = pcf8563_probe,
+   .remove = pcf8563_remove,
+   .id_table   = pcf8563_id,
 };
 
-static int pcf8563_probe(struct i2c_adapter *adapter, int address, int kind)
+static int pcf8563_probe(struct i2c_client *client, const struct i2c_device_id 
*id)
 {
-   struct pcf8563 *pcf8563;
-   struct i2c_client *client;
+   int result;
struct rtc_device *rtc;
 
-   int err = 0;
-
-   dev_dbg(adapter-dev, %s\n, __FUNCTION__);
-
-   if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) {
-   err = -ENODEV;
-   goto exit;
-   }
-
-   if (!(pcf8563 = kzalloc(sizeof(struct pcf8563), GFP_KERNEL))) {
-   err = -ENOMEM;
-   goto exit;
-   }
-
-   client = pcf8563-client;
-   client-addr = address;
-   client-driver = pcf8563_driver;
-   client-adapter = adapter;
-
-   strlcpy(client-name, pcf8563_driver.driver.name, I2C_NAME_SIZE);
-
-   /* Verify the chip is really an PCF8563 */
-   if (kind  0) {
-   if (pcf8563_validate_client(client)  0) {
-   err = -ENODEV;
-   goto exit_kfree;
-   }
-   }
-
-   /* Inform the i2c layer */
-   if ((err = i2c_attach_client(client)))
-   goto exit_kfree;
-
-   dev_info(client-dev, chip found, driver version  DRV_VERSION \n);
+   result = pcf8563_validate_client(client);
+   if (result)
+   return result;
 
rtc = rtc_device_register(pcf8563_driver.driver.name, client-dev,
pcf8563_rtc_ops, THIS_MODULE);
-
-   if (IS_ERR(rtc)) {
-   err = PTR_ERR(rtc);
-   goto exit_detach;
-   }
+   if (IS_ERR(rtc))
+   return PTR_ERR(rtc);
 
i2c_set_clientdata(client, rtc);
 
return 0;
-
-exit_detach:
-   i2c_detach_client(client);
-
-exit_kfree:
-   kfree(pcf8563);
-
-exit:
-   return err;
-}
-
-static int pcf8563_detach(struct i2c_client *client)
-{
-   struct pcf8563 *pcf8563 = container_of(client, struct pcf8563, client);
-   int err;
-   struct rtc_device *rtc = i2c_get_clientdata(client);
-
-   if (rtc)
-   rtc_device_unregister(rtc);
-
-   if ((err = i2c_detach_client(client)))
-   return err;
-
-   kfree(pcf8563);
-
-   return 0;
 }
 
 static int __init pcf8563_init(void)

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


[PATCH 2/5] Modify several rtc drivers to use the alias names list property of i2c

2007-12-19 Thread Jon Smirl
This patch modifies the ds1307, ds1374, and rs5c372 i2c drivers to support
device tree names using the new i2c mod alias support

Signed-off-by: Jon Smirl [EMAIL PROTECTED]
---

 arch/powerpc/sysdev/fsl_soc.c |   44 
 drivers/rtc/rtc-ds1307.c  |   20 +-
 drivers/rtc/rtc-ds1374.c  |9 ++
 drivers/rtc/rtc-m41t80.c  |   57 -
 drivers/rtc/rtc-rs5c372.c |   16 ++--
 5 files changed, 85 insertions(+), 61 deletions(-)


diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 3ace747..268638a 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -320,48 +320,12 @@ arch_initcall(gfar_of_init);
 
 #ifdef CONFIG_I2C_BOARDINFO
 #include linux/i2c.h
-struct i2c_driver_device {
-   char*of_device;
-   char*i2c_driver;
-   char*i2c_type;
-};
-
-static struct i2c_driver_device i2c_devices[] __initdata = {
-   {ricoh,rs5c372a, rtc-rs5c372, rs5c372a,},
-   {ricoh,rs5c372b, rtc-rs5c372, rs5c372b,},
-   {ricoh,rv5c386,  rtc-rs5c372, rv5c386,},
-   {ricoh,rv5c387a, rtc-rs5c372, rv5c387a,},
-   {dallas,ds1307,  rtc-ds1307,  ds1307,},
-   {dallas,ds1337,  rtc-ds1307,  ds1337,},
-   {dallas,ds1338,  rtc-ds1307,  ds1338,},
-   {dallas,ds1339,  rtc-ds1307,  ds1339,},
-   {dallas,ds1340,  rtc-ds1307,  ds1340,},
-   {stm,m41t00, rtc-ds1307,  m41t00},
-   {dallas,ds1374,  rtc-ds1374,  rtc-ds1374,},
-};
-
-static int __init of_find_i2c_driver(struct device_node *node,
-struct i2c_board_info *info)
-{
-   int i;
-
-   for (i = 0; i  ARRAY_SIZE(i2c_devices); i++) {
-   if (!of_device_is_compatible(node, i2c_devices[i].of_device))
-   continue;
-   if (strlcpy(info-driver_name, i2c_devices[i].i2c_driver,
-   KOBJ_NAME_LEN) = KOBJ_NAME_LEN ||
-   strlcpy(info-type, i2c_devices[i].i2c_type,
-   I2C_NAME_SIZE) = I2C_NAME_SIZE)
-   return -ENOMEM;
-   return 0;
-   }
-   return -ENODEV;
-}
 
 static void __init of_register_i2c_devices(struct device_node *adap_node,
   int bus_num)
 {
struct device_node *node = NULL;
+   const char *compatible;
 
while ((node = of_get_next_child(adap_node, node))) {
struct i2c_board_info info = {};
@@ -378,8 +342,12 @@ static void __init of_register_i2c_devices(struct 
device_node *adap_node,
if (info.irq == NO_IRQ)
info.irq = -1;
 
-   if (of_find_i2c_driver(node, info)  0)
+   compatible = of_get_property(node, compatible, len);
+   if (!compatible) {
+   printk(KERN_WARNING i2c-mpc.c: invalid entry, missing 
compatible attribute\n);
continue;
+   }
+   strncpy(info.driver_name, compatible, sizeof(info.driver_name));
 
info.addr = *addr;
 
diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index bc1c7fe..d4874ff 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -139,6 +139,17 @@ static inline const struct chip_desc *find_chip(const char 
*s)
return NULL;
 }
 
+static struct i2c_device_id ds1307_id[] = {
+   OF_I2C_ID(dallas,ds1307, ds_1307)
+   OF_I2C_ID(dallas,ds1337, ds_1337)
+   OF_I2C_ID(dallas,ds1338, ds_1338)
+   OF_I2C_ID(dallas,ds1339, ds_1339)
+   OF_I2C_ID(dallas,ds1340, ds_1340)
+   OF_I2C_ID(stm,m41t00, m41t00)
+   {},
+};
+MODULE_DEVICE_TABLE(i2c, ds1307_id);
+
 static int ds1307_get_time(struct device *dev, struct rtc_time *t)
 {
struct ds1307   *ds1307 = dev_get_drvdata(dev);
@@ -326,7 +337,7 @@ static struct bin_attribute nvram = {
 
 static struct i2c_driver ds1307_driver;
 
-static int __devinit ds1307_probe(struct i2c_client *client)
+static int __devinit ds1307_probe(struct i2c_client *client, const struct 
i2c_device_id *id)
 {
struct ds1307   *ds1307;
int err = -ENODEV;
@@ -334,7 +345,11 @@ static int __devinit ds1307_probe(struct i2c_client 
*client)
const struct chip_desc  *chip;
struct i2c_adapter  *adapter = to_i2c_adapter(client-dev.parent);
 
-   chip = find_chip(client-name);
+   if (id)
+   chip = chips[id-driver_data];
+   else
+   chip = find_chip(client-name);
+
if (!chip) {
dev_err(client-dev, unknown chip type '%s'\n,
client-name);
@@ -537,6 +552,7 @@ static struct i2c_driver ds1307_driver = {
},
.probe  = ds1307_probe,
.remove = __devexit_p(ds1307_remove),
+   .id_table   = ds1307_id,
 };
 
 static int __init ds1307_init(void)
diff --git 

[PATCH 1/5] Implement module aliasing for i2c to translate from device tree names

2007-12-19 Thread Jon Smirl
This patch allows new style i2c chip drivers to have alias names using
the official kernel aliasing system and MODULE_DEVICE_TABLE(). I've
tested it on PowerPC and x86. This change is required for PowerPC
device tree support.

Signed-off-by: Jon Smirl [EMAIL PROTECTED]
---

 drivers/i2c/i2c-core.c  |   32 ++--
 include/linux/i2c.h |9 -
 include/linux/mod_devicetable.h |   20 
 scripts/mod/file2alias.c|   19 +++
 4 files changed, 69 insertions(+), 11 deletions(-)


diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index b5e13e4..fce06fd 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -47,10 +47,25 @@ static DEFINE_IDR(i2c_adapter_idr);
 
 /* - */
 
-static int i2c_device_match(struct device *dev, struct device_driver *drv)
+static const struct i2c_device_id *i2c_device_match(const struct i2c_device_id 
*id, struct i2c_client *client)
+{
+   /* only powerpc drivers implement the id_table,
+* it is empty on other platforms */
+   if (id) {
+   while (id-name[0]) {
+   if (strcmp(client-driver_name, id-name) == 0)
+   return id;
+   id++;
+   }
+   }
+   return NULL;
+}
+
+static int i2c_bus_match(struct device *dev, struct device_driver *drv)
 {
struct i2c_client   *client = to_i2c_client(dev);
struct i2c_driver   *driver = to_i2c_driver(drv);
+   const struct i2c_device_id *found_id;
 
/* make legacy i2c drivers bypass driver model probing entirely;
 * such drivers scan each i2c adapter/bus themselves.
@@ -58,9 +73,11 @@ static int i2c_device_match(struct device *dev, struct 
device_driver *drv)
if (!is_newstyle_driver(driver))
return 0;
 
-   /* new style drivers use the same kind of driver matching policy
-* as platform devices or SPI:  compare device and driver IDs.
-*/
+   /* match on an id table if there is one */
+   found_id = i2c_device_match(driver-id_table, client);
+   if (found_id)
+   return 1;
+
return strcmp(client-driver_name, drv-name) == 0;
 }
 
@@ -89,12 +106,15 @@ static int i2c_device_probe(struct device *dev)
 {
struct i2c_client   *client = to_i2c_client(dev);
struct i2c_driver   *driver = to_i2c_driver(dev-driver);
+   const struct i2c_device_id *id;
 
if (!driver-probe)
return -ENODEV;
client-driver = driver;
dev_dbg(dev, probe\n);
-   return driver-probe(client);
+
+   id = i2c_device_match(driver-id_table, client);
+   return driver-probe(client, id);
 }
 
 static int i2c_device_remove(struct device *dev)
@@ -189,7 +209,7 @@ static struct device_attribute i2c_dev_attrs[] = {
 static struct bus_type i2c_bus_type = {
.name   = i2c,
.dev_attrs  = i2c_dev_attrs,
-   .match  = i2c_device_match,
+   .match  = i2c_bus_match,
.uevent = i2c_device_uevent,
.probe  = i2c_device_probe,
.remove = i2c_device_remove,
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index a100c9f..49fc682 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -126,7 +126,7 @@ struct i2c_driver {
 * With the driver model, device enumeration is NEVER done by drivers;
 * it's done by infrastructure.  (NEW STYLE DRIVERS ONLY)
 */
-   int (*probe)(struct i2c_client *);
+   int (*probe)(struct i2c_client *, const struct i2c_device_id *id);
int (*remove)(struct i2c_client *);
 
/* driver model interfaces that don't relate to enumeration  */
@@ -141,11 +141,10 @@ struct i2c_driver {
 
struct device_driver driver;
struct list_head list;
+   struct i2c_device_id *id_table;
 };
 #define to_i2c_driver(d) container_of(d, struct i2c_driver, driver)
 
-#define I2C_NAME_SIZE  20
-
 /**
  * struct i2c_client - represent an I2C slave device
  * @flags: I2C_CLIENT_TEN indicates the device uses a ten bit chip address;
@@ -179,7 +178,7 @@ struct i2c_client {
/* to the client*/
struct device dev;  /* the device structure */
int irq;/* irq issued by device (or -1) */
-   char driver_name[KOBJ_NAME_LEN];
+   char driver_name[I2C_NAME_SIZE];
struct list_head list;
struct completion released;
 };
@@ -223,7 +222,7 @@ static inline void i2c_set_clientdata (struct i2c_client 
*dev, void *data)
  * with the adapter already known.
  */
 struct i2c_board_info {
-   chardriver_name[KOBJ_NAME_LEN];
+   chardriver_name[I2C_NAME_SIZE];
chartype[I2C_NAME_SIZE];

[PATCH 4/5] Convert PowerPC MPC i2c to of_platform_driver from platform_driver

2007-12-19 Thread Jon Smirl
Convert MPC i2c driver from being a platform_driver to an open firmware 
version. Error returns were improved. Routine names were changed from fsl_ to 
mpc_ to make them match the file name.

Signed-off-by: Jon Smirl [EMAIL PROTECTED]
---

 arch/powerpc/sysdev/fsl_soc.c |   96 --
 drivers/i2c/busses/i2c-mpc.c  |  183 -
 2 files changed, 180 insertions(+), 99 deletions(-)


diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 268638a..d6ef264 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -318,102 +318,6 @@ err:
 
 arch_initcall(gfar_of_init);
 
-#ifdef CONFIG_I2C_BOARDINFO
-#include linux/i2c.h
-
-static void __init of_register_i2c_devices(struct device_node *adap_node,
-  int bus_num)
-{
-   struct device_node *node = NULL;
-   const char *compatible;
-
-   while ((node = of_get_next_child(adap_node, node))) {
-   struct i2c_board_info info = {};
-   const u32 *addr;
-   int len;
-
-   addr = of_get_property(node, reg, len);
-   if (!addr || len  sizeof(int) || *addr  (1  10) - 1) {
-   printk(KERN_WARNING fsl_soc.c: invalid i2c device 
entry\n);
-   continue;
-   }
-
-   info.irq = irq_of_parse_and_map(node, 0);
-   if (info.irq == NO_IRQ)
-   info.irq = -1;
-
-   compatible = of_get_property(node, compatible, len);
-   if (!compatible) {
-   printk(KERN_WARNING i2c-mpc.c: invalid entry, missing 
compatible attribute\n);
-   continue;
-   }
-   strncpy(info.driver_name, compatible, sizeof(info.driver_name));
-
-   info.addr = *addr;
-
-   i2c_register_board_info(bus_num, info, 1);
-   }
-}
-
-static int __init fsl_i2c_of_init(void)
-{
-   struct device_node *np;
-   unsigned int i;
-   struct platform_device *i2c_dev;
-   int ret;
-
-   for (np = NULL, i = 0;
-(np = of_find_compatible_node(np, i2c, fsl-i2c)) != NULL;
-i++) {
-   struct resource r[2];
-   struct fsl_i2c_platform_data i2c_data;
-   const unsigned char *flags = NULL;
-
-   memset(r, 0, sizeof(r));
-   memset(i2c_data, 0, sizeof(i2c_data));
-
-   ret = of_address_to_resource(np, 0, r[0]);
-   if (ret)
-   goto err;
-
-   of_irq_to_resource(np, 0, r[1]);
-
-   i2c_dev = platform_device_register_simple(fsl-i2c, i, r, 2);
-   if (IS_ERR(i2c_dev)) {
-   ret = PTR_ERR(i2c_dev);
-   goto err;
-   }
-
-   i2c_data.device_flags = 0;
-   flags = of_get_property(np, dfsrr, NULL);
-   if (flags)
-   i2c_data.device_flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
-
-   flags = of_get_property(np, fsl5200-clocking, NULL);
-   if (flags)
-   i2c_data.device_flags |= FSL_I2C_DEV_CLOCK_5200;
-
-   ret =
-   platform_device_add_data(i2c_dev, i2c_data,
-sizeof(struct
-   fsl_i2c_platform_data));
-   if (ret)
-   goto unreg;
-
-   of_register_i2c_devices(np, i);
-   }
-
-   return 0;
-
-unreg:
-   platform_device_unregister(i2c_dev);
-err:
-   return ret;
-}
-
-arch_initcall(fsl_i2c_of_init);
-#endif
-
 #ifdef CONFIG_PPC_83xx
 static int __init mpc83xx_wdt_init(void)
 {
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index 7c35a8f..4f2e7ea 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -17,7 +17,7 @@
 #include linux/module.h
 #include linux/sched.h
 #include linux/init.h
-#include linux/platform_device.h
+#include linux/of_platform.h
 
 #include asm/io.h
 #include linux/fsl_devices.h
@@ -25,13 +25,13 @@
 #include linux/interrupt.h
 #include linux/delay.h
 
-#define MPC_I2C_ADDR  0x00
+#define DRV_NAME mpc-i2c
+
 #define MPC_I2C_FDR0x04
 #define MPC_I2C_CR 0x08
 #define MPC_I2C_SR 0x0c
 #define MPC_I2C_DR 0x10
 #define MPC_I2C_DFSRR 0x14
-#define MPC_I2C_REGION 0x20
 
 #define CCR_MEN  0x80
 #define CCR_MIEN 0x40
@@ -316,6 +316,181 @@ static struct i2c_adapter mpc_ops = {
.retries = 1
 };
 
+struct i2c_driver_device {
+   char*of_device;
+   char*i2c_driver;
+   char*i2c_type;
+};
+
+#ifdef CONFIG_PPC_MERGE
+
+static void of_register_i2c_devices(struct i2c_adapter *adap, struct 
device_node *adap_node)
+{
+   struct device_node *node = NULL;
+
+   while ((node = of_get_next_child(adap_node, node))) {
+  

Re: [PATCH 4/5] Convert PowerPC MPC i2c to of_platform_driver from platform_driver

2007-12-19 Thread David Gibson
On Wed, Dec 19, 2007 at 11:41:44PM -0500, Jon Smirl wrote:
 Convert MPC i2c driver from being a platform_driver to an open
 firmware version. Error returns were improved. Routine names were
 changed from fsl_ to mpc_ to make them match the file name.

In discussions BenH and I have had, we've actually concluded that
moving this from platform drivers to of_platform drives is not
actually a good idea.

In fact we're planning to move away from of_platform devices and
drivers and instead develop a framework for instantiating platform
devices or i2c devices or whatever devices from the device tree nodes.

-- 
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


tiny login

2007-12-19 Thread pjmaiya
hi,
I am using tiny login provided by montavista. Binaries already obtained from 
tool provided from montavista.We are able to add only 10 users. But I need to 
add more than 10 users.
I have already downloaded free open source for tinylogin (tinylogin-1.4). Can 
we modifiy this source code of this version and support users more than 10??
If yes, can somebody inform step to build tiny login and installation method.

thanx in advance
pjmaiya___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH 4/5] Convert PowerPC MPC i2c to of_platform_driver from platform_driver

2007-12-19 Thread Olof Johansson
On Thu, Dec 20, 2007 at 04:16:18PM +1100, David Gibson wrote:
 On Wed, Dec 19, 2007 at 11:41:44PM -0500, Jon Smirl wrote:
  Convert MPC i2c driver from being a platform_driver to an open
  firmware version. Error returns were improved. Routine names were
  changed from fsl_ to mpc_ to make them match the file name.
 
 In discussions BenH and I have had, we've actually concluded that
 moving this from platform drivers to of_platform drives is not
 actually a good idea.
 
 In fact we're planning to move away from of_platform devices and
 drivers and instead develop a framework for instantiating platform
 devices or i2c devices or whatever devices from the device tree nodes.

There's been talk about that for a long time. Whenever that framework
is done, all the other drivers that have been converted (or written)
must/can be converted back as well.

Meanwhile, this should go in so those of us who can make use of the
other improvements the series brings can make use of them.


Thanks,

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


Re: [PATCH 4/5] Convert PowerPC MPC i2c to of_platform_driver from platform_driver

2007-12-19 Thread Stefan Roese
On Thursday 20 December 2007, David Gibson wrote:
 On Wed, Dec 19, 2007 at 11:41:44PM -0500, Jon Smirl wrote:
  Convert MPC i2c driver from being a platform_driver to an open
  firmware version. Error returns were improved. Routine names were
  changed from fsl_ to mpc_ to make them match the file name.

 In discussions BenH and I have had, we've actually concluded that
 moving this from platform drivers to of_platform drives is not
 actually a good idea.

 In fact we're planning to move away from of_platform devices and
 drivers and instead develop a framework for instantiating platform
 devices or i2c devices or whatever devices from the device tree nodes.

Now that is interesting news. I like this idea.

But what should be done to support the still missing devices in the 4xx 
arch/powerpc tree, like I2C, NAND etc.? Should we wait with those driver till 
this framework is available?

Thanks.

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


[PATCH] [RFC] Xilinx SystemACE: Add media hotplug support

2007-12-19 Thread Grant Likely
From: Grant Likely [EMAIL PROTECTED]

Please review and comment.  This patch works in my setup, but I haven't
tested exhaustively yet.  I also need to fixup the documentation to
reflect new states before I request this patch to be merged.

Question for the block layer experts:  I'm using add_disk()/del_gendisk()
functions to inform the kernel of media insertion and removal events.  Is
this the best way to do this?  I looked at the .media_changed and
.revalidate_disk hooks, but it doesn't seem like they offer the driver
any way to notify the kernel of media removal (as opposed to the kernel
asking the driver)

Cheers,
g.
---

 drivers/block/xsysace.c |  265 ++-
 1 files changed, 189 insertions(+), 76 deletions(-)

diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c
index 0cdc868..9b3df96 100644
--- a/drivers/block/xsysace.c
+++ b/drivers/block/xsysace.c
@@ -53,7 +53,7 @@
  *The request method in particular schedules the tasklet when a new
  *request has been indicated by the block layer.  Once started, the
  *FSM proceeds as far as it can processing the request until it
- *needs on a hardware event.  At this point, it must yield execution.
+ *needs a hardware event.  At this point, it must yield execution.
  *
  *A state has two options when yielding execution:
  *1. ace_fsm_yield()
@@ -71,7 +71,8 @@
  *Additionally, the driver maintains a kernel timer which can process
  *the FSM.  If the FSM gets stalled, typically due to a missed
  *interrupt, then the kernel timer will expire and the driver can
- *continue where it left off.
+ *continue where it left off.  The stall timer is also used to watch
+ *for media removal/insertion events.
  *
  * To Do:
  *- Add FPGA configuration control interface.
@@ -90,6 +91,7 @@
 #include linux/slab.h
 #include linux/blkdev.h
 #include linux/hdreg.h
+#include linux/workqueue.h
 #include linux/platform_device.h
 #if defined(CONFIG_OF)
 #include linux/of_device.h
@@ -170,17 +172,18 @@ struct ace_reg_ops;
 struct ace_device {
/* driver state data */
int id;
-   int media_change;
int users;
struct list_head list;
 
/* finite state machine data */
struct tasklet_struct fsm_tasklet;
+   struct work_struct fsm_worker;
uint fsm_task;  /* Current activity (ACE_TASK_*) */
uint fsm_state; /* Current state (ACE_FSM_STATE_*) */
uint fsm_continue_flag; /* cleared to exit FSM mainloop */
uint fsm_iter_num;
struct timer_list stall_timer;
+   int stall_count;
 
/* Transfer state/result, use for both id and block request */
struct request *req;/* request being processed */
@@ -189,7 +192,6 @@ struct ace_device {
int data_result;/* Result of transfer; 0 := success */
 
int id_req_count;   /* count of id requests */
-   int id_result;
struct completion id_completion;/* used when id req finishes */
int in_irq;
 
@@ -212,6 +214,7 @@ struct ace_device {
 };
 
 static int ace_major;
+struct workqueue_struct *ace_workqueue;
 
 /* -
  * Low level register access
@@ -429,21 +432,24 @@ void ace_fix_driveid(struct hd_driveid *id)
 #define ACE_TASK_IDENTIFY  1
 #define ACE_TASK_READ  2
 #define ACE_TASK_WRITE 3
-#define ACE_FSM_NUM_TASKS  4
+#define ACE_NUM_TASKS  4
 
 /* FSM state definitions */
-#define ACE_FSM_STATE_IDLE   0
-#define ACE_FSM_STATE_REQ_LOCK   1
-#define ACE_FSM_STATE_WAIT_LOCK  2
-#define ACE_FSM_STATE_WAIT_CFREADY   3
-#define ACE_FSM_STATE_IDENTIFY_PREPARE   4
-#define ACE_FSM_STATE_IDENTIFY_TRANSFER  5
-#define ACE_FSM_STATE_IDENTIFY_COMPLETE  6
-#define ACE_FSM_STATE_REQ_PREPARE7
-#define ACE_FSM_STATE_REQ_TRANSFER   8
-#define ACE_FSM_STATE_REQ_COMPLETE   9
-#define ACE_FSM_STATE_ERROR 10
-#define ACE_FSM_NUM_STATES  11
+#define ACE_FSM_STATE_NO_MEDIA   0
+#define ACE_FSM_STATE_KICKSTART  1
+#define ACE_FSM_STATE_IDLE   2
+#define ACE_FSM_STATE_REQ_LOCK   3
+#define ACE_FSM_STATE_WAIT_LOCK  4
+#define ACE_FSM_STATE_WAIT_CFREADY   5
+#define ACE_FSM_STATE_IDENTIFY_PREPARE   6
+#define ACE_FSM_STATE_IDENTIFY_TRANSFER  7
+#define ACE_FSM_STATE_IDENTIFY_COMPLETE  8
+#define ACE_FSM_STATE_REQ_PREPARE9
+#define ACE_FSM_STATE_REQ_TRANSFER  10
+#define ACE_FSM_STATE_REQ_COMPLETE  11
+#define ACE_FSM_STATE_INVALIDATE_MEDIA  12
+#define ACE_FSM_STATE_MEDIA_DISABLED13
+#define ACE_FSM_NUM_STATES  14
 
 /* Set flag to exit FSM loop and reschedule tasklet */
 static inline void ace_fsm_yield(struct ace_device *ace)
@@ -490,18 +496,53 @@ static void ace_fsm_dostate(struct ace_device *ace)
ace-fsm_state, ace-id_req_count);
 #endif
 
+   /* Before 

Re: [PATCH] [RFC] Xilinx SystemACE: Add media hotplug support

2007-12-19 Thread Grant Likely
On 12/19/07, Grant Likely [EMAIL PROTECTED] wrote:
 From: Grant Likely [EMAIL PROTECTED]

 Please review and comment.  This patch works in my setup, but I haven't
 tested exhaustively yet.  I also need to fixup the documentation to
 reflect new states before I request this patch to be merged.

 Question for the block layer experts:  I'm using add_disk()/del_gendisk()
 functions to inform the kernel of media insertion and removal events.  Is
 this the best way to do this?  I looked at the .media_changed and
 .revalidate_disk hooks, but it doesn't seem like they offer the driver
 any way to notify the kernel of media removal (as opposed to the kernel
 asking the driver)

Heh, actually I *know* I'm doing the wrong thing; but I'm hoping I've
got better chances of getting steered in the right direction if I
start by throwing code out there.  Currently this patch handles
insertion/removal just fine if nothing is mounted, but gets stuck if
the disk is in use.  How do I get the kernel to cancel all pending
requests when deregistering the device?

Thanks,
g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[EMAIL PROTECTED]
(403) 399-0195
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev