Sleep problems with kernels >= 2.6.21 on powerpc

2007-08-25 Thread Rogério Brito
Hi.

Unfortunately, it seems that kernels later than 2.6.21 have problems
letting my powerpc iBook (G3 processor) going to sleep (suspend to
ram).

The userland that I am using is a Debian testing (lenny) and the
default kernel that comes with it is 2.6.22, with some patches applied
and pbbuttonsd (as the daemon for making the machine sleep).

With kernel 2.6.21, from Debian (and other earlier kernels), the
symptoms that I see when I press the power button is that the machine
goes to sleep and the led that indicates that the machine is sleeping
is blinking normally.

If I, on the other hand, use Debian's kernel 2.6.22 or compile my own
kernel with just the necessary parts for my work (version 2.6.23-rc3
taken from kernel.org), then I can't make the machine sleep: when I
press the button, it acts like if I had, in sequence, pressed anything
to wake it up (say, like pressing shift).

I have already grabbed Linus's git tree and I am willing to do some
cycles of "git bisect" to discover the point where it stopped working.

I just thought that others may have seen such behaviour before or, if
not, that being informative about what I see is of use for debugging
this.

I would also appreciate any guidance on this as I wish kernel 2.6.23
to be working again on powerpc machines.

Please, if any tests are required, don't hesitate to ask me and I will
try to whatever is needed to restore the correct behaviour of sleep
with the Linux kernel.

I have copied mailing lists that I think that are relevant. If they
aren't, then please let me know. I would also appreciate if I were
kept on carbon copies as I am only subscribed to debian-powerpc at the
moment.


Regards, Rogério Brito.

P.S.: It unfortunately doesn't matter if I switch to a console or if I
am in X when I press the power button with recent kernels.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH, RFC] linkstation: implement standby

2007-08-25 Thread Stephen Rothwell
On Sun, 26 Aug 2007 02:03:49 +0200 (CEST) Guennadi Liakhovetski <[EMAIL 
PROTECTED]> wrote:
>
> +static int ls_pm_enter(suspend_state_t state)
> +{
> + char ier;
> + int ret = 0;
> + u64 tb;
> +
> + if ((ret = mpc10x_suspend(state)) < 0)
> + return ret;
> +
> + /* Get timebase */
> + tb = get_tb();
> +
> + /* put CPU to sleep, re-enabling interrupts */
> + mpc6xx_enter_sleep();
> +
> + local_irq_disable();
> +
> + set_tb(tb >> 32, tb & 0xul);
> +
> +fail:

Unused label?

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


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

[PATCH, RFC] linkstation: implement standby

2007-08-25 Thread Guennadi Liakhovetski
Implement suspend/resume for "mpc10x" compatible fsl host PCI controllers, 
use it for linkstation standby.

Signed-off-by: Guennadi Liakhovetski <[EMAIL PROTECTED]>

---

This requires patches from Scott Wood from this thread: 
http://ozlabs.org/pipermail/linuxppc-dev/2007-July/039109.html and my 
recent patch to implement wakeup from serial ports.

Thanks
Guennadi

 arch/powerpc/platforms/embedded6xx/linkstation.c |   57 +++
 arch/powerpc/sysdev/fsl_soc.c|   44 +
 arch/powerpc/sysdev/fsl_soc.h|6 ++
 include/asm-powerpc/mpc6xx.h |2
 4 files changed, 108 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/embedded6xx/linkstation.c 
b/arch/powerpc/platforms/embedded6xx/linkstation.c
index ab9e3f9..8ee0f0b 100644
--- a/arch/powerpc/platforms/embedded6xx/linkstation.c
+++ b/arch/powerpc/platforms/embedded6xx/linkstation.c
@@ -197,3 +197,60 @@ define_machine(linkstation){
.halt   = linkstation_halt,
.calibrate_decr = generic_calibrate_decr,
 };
+
+#ifdef CONFIG_PM
+
+#include 
+#include 
+
+static int ls_pm_valid(suspend_state_t state)
+{
+   switch (state) {
+   case PM_SUSPEND_STANDBY:
+   return 1;
+   default:
+   return 0;
+   }
+}
+
+static int ls_pm_enter(suspend_state_t state)
+{
+   char ier;
+   int ret = 0;
+   u64 tb;
+
+   if ((ret = mpc10x_suspend(state)) < 0)
+   return ret;
+
+   /* Get timebase */
+   tb = get_tb();
+
+   /* put CPU to sleep, re-enabling interrupts */
+   mpc6xx_enter_sleep();
+
+   local_irq_disable();
+
+   set_tb(tb >> 32, tb & 0xul);
+
+fail:
+   mpc10x_resume(state);
+
+   return ret;
+}
+
+static struct pm_ops ls_pm_ops = {
+   .valid  = ls_pm_valid,
+   .enter  = ls_pm_enter,
+};
+
+static int __init ls_pm_init(void)
+{
+   if (!machine_is(linkstation))
+   return 0;
+
+   pm_set_ops(&ls_pm_ops);
+   return 0;
+}
+
+device_initcall(ls_pm_init);
+#endif
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index 727453d..c0d66df 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -1186,3 +1186,47 @@ err:
 arch_initcall(cpm_smc_uart_of_init);
 
 #endif /* CONFIG_8xx */
+
+#ifdef CONFIG_PM
+#include 
+#include 
+
+#defineMPC10X_LP_REF_EN(1<<12)
+#defineMPC10X_PM   (1<<7)
+#define MPC10X_DOZE(1<<5)
+#defineMPC10X_NAP  (1<<4)
+#defineMPC10X_SLEEP(1<<3)
+
+int mpc10x_suspend(suspend_state_t state)
+{
+   struct pci_dev *bridge;
+   u16 pmcr1;
+
+   bridge = pci_find_slot(0, 0);
+   if (!bridge)
+   return -ENODEV;
+
+   pci_read_config_word(bridge, 0x70, &pmcr1);
+   pmcr1 &= ~(MPC10X_DOZE | MPC10X_NAP);
+   pmcr1 |= MPC10X_PM | MPC10X_SLEEP | MPC10X_LP_REF_EN;
+   pci_write_config_word(bridge, 0x70, pmcr1);
+
+   return 0;
+}
+
+int mpc10x_resume(suspend_state_t state)
+{
+   struct pci_dev *bridge;
+   u16 pmcr1;
+
+   bridge = pci_find_slot(0, 0);
+   if (!bridge)
+   return -ENODEV;
+
+   pci_read_config_word(bridge, 0x70, &pmcr1);
+   pmcr1 &= ~(MPC10X_PM | MPC10X_DOZE | MPC10X_SLEEP | MPC10X_NAP | 
MPC10X_LP_REF_EN);
+   pci_write_config_word(bridge, 0x70, pmcr1);
+
+   return 0;
+}
+#endif
diff --git a/arch/powerpc/sysdev/fsl_soc.h b/arch/powerpc/sysdev/fsl_soc.h
index 04e145b..bcb96cf 100644
--- a/arch/powerpc/sysdev/fsl_soc.h
+++ b/arch/powerpc/sysdev/fsl_soc.h
@@ -8,5 +8,11 @@ extern phys_addr_t get_immrbase(void);
 extern u32 get_brgfreq(void);
 extern u32 get_baudrate(void);
 
+#ifdef CONFIG_PM
+#include 
+extern int mpc10x_suspend(suspend_state_t state);
+extern int mpc10x_resume(suspend_state_t state);
+#endif
+
 #endif
 #endif
diff --git a/include/asm-powerpc/mpc6xx.h b/include/asm-powerpc/mpc6xx.h
index 01a33ed..be86967 100644
--- a/include/asm-powerpc/mpc6xx.h
+++ b/include/asm-powerpc/mpc6xx.h
@@ -1,6 +1,6 @@
 #ifndef __ASM_POWERPC_MPC6xx_H
 #define __ASM_POWERPC_MPC6xx_H
 
-void mpc6xx_enter_sleep(void);
+extern void mpc6xx_enter_sleep(void);
 
 #endif
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] powerpc: linkstation updates

2007-08-25 Thread Guennadi Liakhovetski
1. Fix RTC type - it is a rs5c372a, not rs5c372b
2. Configure both UART interrupts edge-triggered
3. Add a license header to ls_uart.c
4. Check for running on linkstation in a late_initcall() function. Needed 
   for multiplatform builds, even though linkstation doesn't support them 
   yet
5. Remove unneeded #include from linkstation.c

Signed-off-by: Guennadi Liakhovetski <[EMAIL PROTECTED]>

---

Nothing critical - just queue this for .24, please.

Thanks
Guennadi

 boot/dts/kuroboxHD.dts  |4 ++--
 boot/dts/kuroboxHG.dts  |4 ++--
 platforms/embedded6xx/linkstation.c |1 -
 platforms/embedded6xx/ls_uart.c |   14 ++
 4 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/boot/dts/kuroboxHD.dts 
b/arch/powerpc/boot/dts/kuroboxHD.dts
index 1225374..63ba351 100644
--- a/arch/powerpc/boot/dts/kuroboxHD.dts
+++ b/arch/powerpc/boot/dts/kuroboxHD.dts
@@ -72,7 +72,7 @@ build with: "dtc -f -I dts -O dtb -o kuroboxHD.dtb -V 16 
kuroboxHD.dts"
 
[EMAIL PROTECTED] {
device_type = "rtc";
-   compatible = "ricoh,rs5c372b";
+   compatible = "ricoh,rs5c372a";
reg = <32>;
};
};
@@ -83,7 +83,7 @@ build with: "dtc -f -I dts -O dtb -o kuroboxHD.dtb -V 16 
kuroboxHD.dts"
reg = <80004500 8>;
clock-frequency = <5d08d88>;
current-speed = <2580>;
-   interrupts = <9 2>;
+   interrupts = <9 0>;
interrupt-parent = <&mpic>;
};
 
diff --git a/arch/powerpc/boot/dts/kuroboxHG.dts 
b/arch/powerpc/boot/dts/kuroboxHG.dts
index 579aa8b..e8ce0e3 100644
--- a/arch/powerpc/boot/dts/kuroboxHG.dts
+++ b/arch/powerpc/boot/dts/kuroboxHG.dts
@@ -72,7 +72,7 @@ build with: "dtc -f -I dts -O dtb -o kuroboxHG.dtb -V 16 
kuroboxHG.dts"
 
[EMAIL PROTECTED] {
device_type = "rtc";
-   compatible = "ricoh,rs5c372b";
+   compatible = "ricoh,rs5c372a";
reg = <32>;
};
};
@@ -83,7 +83,7 @@ build with: "dtc -f -I dts -O dtb -o kuroboxHG.dtb -V 16 
kuroboxHG.dts"
reg = <80004500 8>;
clock-frequency = <7c044a8>;
current-speed = <2580>;
-   interrupts = <9 2>;
+   interrupts = <9 0>;
interrupt-parent = <&mpic>;
};
 
diff --git a/arch/powerpc/kernel/of_platform.c 
b/arch/powerpc/kernel/of_platform.c
diff --git a/arch/powerpc/platforms/embedded6xx/linkstation.c 
b/arch/powerpc/platforms/embedded6xx/linkstation.c
index ab9e3f9..8ee0f0b 100644
--- a/arch/powerpc/platforms/embedded6xx/linkstation.c
+++ b/arch/powerpc/platforms/embedded6xx/linkstation.c
@@ -11,7 +11,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 
diff --git a/arch/powerpc/platforms/embedded6xx/ls_uart.c 
b/arch/powerpc/platforms/embedded6xx/ls_uart.c
index d0bee9f..0729641 100644
--- a/arch/powerpc/platforms/embedded6xx/ls_uart.c
+++ b/arch/powerpc/platforms/embedded6xx/ls_uart.c
@@ -1,3 +1,14 @@
+/*
+ * AVR power-management chip interface for the Buffalo Linkstation /
+ * Kurobox Platform.
+ *
+ * Author: 2006 (c) G. Liakhovetski
+ *  [EMAIL PROTECTED]
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of
+ * any kind, whether express or implied.
+ */
 #include 
 #include 
 #include 
@@ -106,6 +117,9 @@ static int __init ls_uarts_init(void)
phys_addr_t phys_addr;
int len;
 
+   if (!machine_is(linkstation))
+   return 0;
+
avr = of_find_node_by_path("/soc10x/[EMAIL PROTECTED]");
if (!avr)
return -EINVAL;
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH] bmac: add simple ethtool support for network manager

2007-08-25 Thread Olaf Hering

NetworkManager will not start dhcpd on an interface unless it reports
link-up state via ethtool.

Signed-off-by: Olaf Hering <[EMAIL PROTECTED]>

---
 drivers/net/bmac.c |   13 +
 1 file changed, 13 insertions(+)

--- a/drivers/net/bmac.c
+++ b/drivers/net/bmac.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1246,6 +1247,17 @@ static void bmac_reset_and_enable(struct
}
spin_unlock_irqrestore(&bp->lock, flags);
 }
+static void bmac_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo 
*info)
+{
+   struct bmac_data *bp = netdev_priv(dev);
+   strcpy(info->driver, "bmac");
+   strcpy(info->bus_info, bp->mdev->ofdev.dev.bus_id);
+}
+
+static const struct ethtool_ops bmac_ethtool_ops = {
+   .get_drvinfo= bmac_get_drvinfo,
+   .get_link   = ethtool_op_get_link,
+};
 
 static int __devinit bmac_probe(struct macio_dev *mdev, const struct 
of_device_id *match)
 {
@@ -1311,6 +1323,7 @@ static int __devinit bmac_probe(struct m
 
dev->open = bmac_open;
dev->stop = bmac_close;
+   dev->ethtool_ops = &bmac_ethtool_ops;
dev->hard_start_xmit = bmac_output;
dev->get_stats = bmac_stats;
dev->set_multicast_list = bmac_set_multicast;
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] ucc_geth: kill unused include

2007-08-25 Thread Kumar Gala

On Aug 24, 2007, at 11:37 PM, Jeff Garzik wrote:

> Kumar Gala wrote:
>> The ucc_geth_mii code is based on the gianfar_mii code that use to  
>> include
>> ocp.h.  ucc never need this and it causes issues when we want to kill
>> arch/ppc includes from arch/powerpc.
>> Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
>> ---
>> Jeff, if you issue with this for 2.6.23, I'd prefer to push this via
>> the powerpc.git trees in 2.6.24 as part of a larger cleanup.  Let  
>> me know
>> one way or the other.
>> - k
>>  drivers/net/ucc_geth_mii.c |1 -
>>  1 files changed, 0 insertions(+), 1 deletions(-)
>> diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
>> index 6c257b8..df884f0 100644
>> --- a/drivers/net/ucc_geth_mii.c
>> +++ b/drivers/net/ucc_geth_mii.c
>> @@ -32,7 +32,6 @@
>>  #include 
>>  #include 
>>  #include 
>> -#include 
>>  #include 
>>  #include 
>
> Feel free to push via PPC git

will do.

thanks

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


Git Clone/Fetch Advice

2007-08-25 Thread Jon Loeliger
Folks,

As someone who runs a git server _and_ reads their log files,
I would like to offer a few words of advice about cloning or
fetching git repositories.

First, watch those project path names carefully.  If someone
publishes a "linux-2.6-quux.git" repository, don't call it
the "linux-2.6.git" repository in your clone or fetch request.
And, oddly, don't call it "linux-2.6.quux.git" either! :-)

Second, upgrade your git installation.  I repeatedly see failed
clone requests due to outdated git clients trying to do a clone
or a fetch.  If you _know_ you have the clone path to the project
right, and it still doesn't seem to work, chance are very good
that you are using a git earlier than v1.4.2.  It is now time
to find something v1.5 or better.  1.5.3 is due out Real Soon Now!

I publish a _few_ repositories, and I see maybe 20 or 30 such
failed clone/fetch requests per day.  I hate to imagine what
the failure rate on kernel.org is!

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


Re: [PATCH 2/3] [POWERPC] Add pci node to sequoia dts

2007-08-25 Thread Segher Boessenkool
> + compatible = "ibm, 440epx";

Oh, and shouldn't it be "amcc," anyway?


Segher

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


Re: [PATCH 2/3] [POWERPC] Add pci node to sequoia dts

2007-08-25 Thread Segher Boessenkool
> + pci {
> + reg = <1 eec0 40 1 ef40 40>;  /* phb cfg, phb 
> reg */

First component of reg is the unit address, so: [EMAIL PROTECTED] .

"phb cfg" is how you access PCI configuration space?  It wouldn't
hurt to document that, either in a little binding or just here in
the code.

> + bus-range = <0 0>;

Can't you have subordinate PCI busses?  Or are there no slots :-)

> + /*
> +  * mem is at 8000 set up indirectly
> +  * io is at 0001_e800_
> +  */
> + ranges = <0200 0 8000 1 8000 0 1000
> + 0100 0  1 e800 0 0010>;

Comment doesn't match code for the memory space.  What does "set
up indirectly" mean here?  Oh wait, you want to say that the host
addresses 1_8000_..1_8fff_ are translated to PCI addresses
8000_..8fff_.

What about PCI DMA, is that identity mapped?

> + #interrupt-cells = <1>;
> + #size-cells = <2>;
> + #address-cells = <3>;

The reverse order of these is more conventional.  Not that it
actually matters ;-)

> + compatible = "ibm, 440epx";

Stray space.  And you need to say it is the PCI host, so something
like "ibm,440epx-pci".


Segher

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


[PATCH 3/3] [POWERPC] Add PCI support for AMCC 440EPx (sequoia)

2007-08-25 Thread Vitaly Bordug

In fact, loosely move of arch/ppc bits, though regions are
set up using values from ranges property. This also adds
setup_indirect_pci_noremap() function to handle indirect
PCI without one more ioremap.

Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]>
Signed-off-by: Stefan Roese <[EMAIL PROTECTED]>

---

 arch/powerpc/platforms/44x/44x.h   |   28 
 arch/powerpc/platforms/44x/Makefile|4 +
 arch/powerpc/platforms/44x/ppc440epx-pci.c |  192 
 arch/powerpc/platforms/44x/sequoia.c   |   14 ++
 arch/powerpc/sysdev/indirect_pci.c |   14 ++
 include/asm-powerpc/pci-bridge.h   |2 
 6 files changed, 254 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/platforms/44x/44x.h b/arch/powerpc/platforms/44x/44x.h
index 42eabf8..d3845f9 100644
--- a/arch/powerpc/platforms/44x/44x.h
+++ b/arch/powerpc/platforms/44x/44x.h
@@ -1,8 +1,36 @@
 #ifndef __POWERPC_PLATFORMS_44X_44X_H
 #define __POWERPC_PLATFORMS_44X_44X_H
+#include 
+
+/* PCI support */
+#define PPC4xx_PCI_CFGA_OFFSET 0
+#define PPC4xx_PCI_CFGD_OFFSET 0x4
+
+#define PPC4xx_PCIL0_PMM0LA0x000
+#define PPC4xx_PCIL0_PMM0MA0x004
+#define PPC4xx_PCIL0_PMM0PCILA 0x008
+#define PPC4xx_PCIL0_PMM0PCIHA 0x00C
+#define PPC4xx_PCIL0_PMM1LA0x010
+#define PPC4xx_PCIL0_PMM1MA0x014
+#define PPC4xx_PCIL0_PMM1PCILA 0x018
+#define PPC4xx_PCIL0_PMM1PCIHA 0x01C
+#define PPC4xx_PCIL0_PMM2LA0x020
+#define PPC4xx_PCIL0_PMM2MA0x024
+#define PPC4xx_PCIL0_PMM2PCILA 0x028
+#define PPC4xx_PCIL0_PMM2PCIHA 0x02C
+#define PPC4xx_PCIL0_PTM1MS0x030
+#define PPC4xx_PCIL0_PTM1LA0x034
+#define PPC4xx_PCIL0_PTM2MS0x038
+#define PPC4xx_PCIL0_PTM2LA0x03C
 
 extern u8 as1_readb(volatile u8 __iomem  *addr);
 extern void as1_writeb(u8 data, volatile u8 __iomem *addr);
 extern void ppc44x_reset_system(char *cmd);
 
+#ifdef CONFIG_PCI
+int ppc440epx_exclude_device(struct pci_controller *hose,
+   u_char bus, u_char devfn);
+int ppc440epx_add_bridge(struct device_node *dev);
+#endif
+
 #endif /* __POWERPC_PLATFORMS_44X_44X_H */
diff --git a/arch/powerpc/platforms/44x/Makefile 
b/arch/powerpc/platforms/44x/Makefile
index 10ce674..d2a5278 100644
--- a/arch/powerpc/platforms/44x/Makefile
+++ b/arch/powerpc/platforms/44x/Makefile
@@ -2,3 +2,7 @@ obj-$(CONFIG_44x)   := misc_44x.o
 obj-$(CONFIG_EBONY)+= ebony.o
 obj-$(CONFIG_BAMBOO) += bamboo.o
 obj-$(CONFIG_SEQUOIA)  += sequoia.o
+
+ifeq ($(CONFIG_PCI),y)
+obj-$(CONFIG_440EPX)   += ppc440epx-pci.o
+endif
diff --git a/arch/powerpc/platforms/44x/ppc440epx-pci.c 
b/arch/powerpc/platforms/44x/ppc440epx-pci.c
new file mode 100644
index 000..bd4a352
--- /dev/null
+++ b/arch/powerpc/platforms/44x/ppc440epx-pci.c
@@ -0,0 +1,192 @@
+/*
+ * PPC44x PCI host support
+ *
+ * Vitaly Bordug <[EMAIL PROTECTED]>
+ * Stefan Roese <[EMAIL PROTECTED]>
+ *
+ * Based on arch/ppc sequoia pci bits, that are
+ * Copyright 2006-2007 DENX Software Engineering, Stefan Roese <[EMAIL 
PROTECTED]>
+ *
+ * Based on bamboo.c from Wade Farnsworth <[EMAIL PROTECTED]>
+ *  Copyright 2004 MontaVista Software Inc.
+ *  Copyright 2006 AMCC
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "44x.h"
+
+#undef DEBUG
+
+#ifdef DEBUG
+#define DBG(x...) printk(x)
+#else
+#define DBG(x...)
+#endif
+
+#ifdef CONFIG_PCI
+
+int ppc440epx_exclude_device(struct pci_controller *hose, u_char bus,
+  u_char devfn)
+{
+   if ((bus == hose->first_busno) && PCI_SLOT(devfn) == 0)
+   return PCIBIOS_DEVICE_NOT_FOUND;
+   return PCIBIOS_SUCCESSFUL;
+}
+
+inline void pci_writel(void *pci_reg_base, u32 offset, unsigned int val)
+{
+   writel(val, pci_reg_base + offset);
+}
+
+inline void pci_cfg_out(void *cfg, u32 offset, unsigned int value)
+{
+   out_le32((void *)((u32) cfg + offset), value);
+}
+
+inline u32 pci_cfg_in(void *cfg, u32 offset)
+{
+   return in_le32((void *)((u32) cfg + offset));
+}
+
+static void __init ppc440epx_setup_pci(struct pci_controller *hose,
+void *pci_reg_base, void *pci_cfg_base)
+{
+   unsigned long memory_size, pci_size = 0;
+   phys_addr_t pci_phys_base = 0;
+   phys_addr_t pci_pci_base = 0;
+   int i;
+
+   memory_size = total_memory;
+
+   /*
+* 440EPx has single memory region, we'll use it to configure phb
+*/
+   for (i = 0; i < 3; i++)
+   if (hose->mem_resources[i].sta

[PATCH 2/3] [POWERPC] Add pci node to sequoia dts

2007-08-25 Thread Vitaly Bordug

Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]>
Signed-off-by: Stefan Roese <[EMAIL PROTECTED]>

---

 arch/powerpc/boot/dts/sequoia.dts |   26 ++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/boot/dts/sequoia.dts 
b/arch/powerpc/boot/dts/sequoia.dts
index ef6f41c..8eb258f 100644
--- a/arch/powerpc/boot/dts/sequoia.dts
+++ b/arch/powerpc/boot/dts/sequoia.dts
@@ -92,6 +92,32 @@
#size-cells = <1>;
ranges;
clock-frequency = <0>; /* Filled in by zImage */
+   
+   pci {
+   /* irqs are routed to irq67, dependless of devsel/PIRQx 
*/
+   interrupt-map-mask = <0 0 0 0>;
+   interrupt-map = <0 0 0 0 &UIC2 3 8>;
+
+   interrupt-parent = <&UIC2>;
+   interrupts = <3 8>;
+   
+   bus-range = <0 0>;
+   
+   /* 
+* mem is at 8000 set up indirectly
+* io is at 0001_e800_
+*/
+   ranges = <0200 0 8000 1 8000 0 1000
+   0100 0  1 e800 0 0010>;
+
+   #interrupt-cells = <1>;
+   #size-cells = <2>;
+   #address-cells = <3>;
+
+   reg = <1 eec0 40 1 ef40 40>;  /* phb cfg, phb 
reg */
+   compatible = "ibm, 440epx";
+   device_type = "pci";
+   };
 
SDRAM0: sdram {
device_type = "memory-controller";

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


[PATCH 1/3] [POWERPC] Merge 32 and 64 bit pci_process_bridge_OF_ranges() instances

2007-08-25 Thread Vitaly Bordug

We are having 2 different instances of pci_process_bridge_OF_ranges(),
which makes describing 64-bit physical addresses in non PPC64 case
impossible.

This approach inherits pci space parsing, but has a new way to behave
equally good in both 32bit and 64bit environments. Currently validated
with 440EPx (sequoia) and mpc8349-eitx.

Signed-off-by: Vitaly Bordug <[EMAIL PROTECTED]>
Signed-off-by: Stefan Roese <[EMAIL PROTECTED]>

---

 arch/powerpc/kernel/pci-common.c |  159 ++
 arch/powerpc/kernel/pci_32.c |  114 ---
 arch/powerpc/kernel/pci_64.c |   94 --
 include/asm-powerpc/ppc-pci.h|   16 
 4 files changed, 175 insertions(+), 208 deletions(-)

diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 083cfbd..57cd039 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -478,3 +478,162 @@ void pci_resource_to_user(const struct pci_dev *dev, int 
bar,
*start = rsrc->start - offset;
*end = rsrc->end - offset;
 }
+
+void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose,
+   struct device_node *dev, int prim)
+{
+   static unsigned int static_lc_ranges[256];
+   const unsigned int *ranges;
+   unsigned int *lc_ranges;
+   unsigned int pci_space;
+   unsigned long size = 0;
+   int rlen = 0;
+   int orig_rlen, ranges_amnt, i;
+   int memno = 0;
+   struct resource *res;
+   int np, na = of_n_addr_cells(dev);
+   struct ranges_pci64_sz64 *ranges64 = NULL;
+   struct ranges_pci32_sz64 *ranges32 = NULL;
+   phys_addr_t pci_addr, cpu_phys_addr;
+
+   np = na + 5;
+
+   /* From "PCI Binding to 1275"
+* The ranges property is laid out as an array of elements,
+* each of which comprises:
+*   cells 0 - 2:   a PCI address
+*   cells 3 or 3+4:a CPU physical address
+*  (size depending on dev->n_addr_cells)
+*   cells 4+5 or 5+6:  the size of the range
+*/
+   ranges = of_get_property(dev, "ranges", &rlen);
+   if (ranges == NULL)
+   return;
+   /* Sanity check, though hopefully that never happens */
+   if (rlen > sizeof(static_lc_ranges)) {
+   printk(KERN_WARNING "OF ranges property too large !\n");
+   rlen = sizeof(static_lc_ranges);
+   }
+
+   /* Let's work on a copy of the "ranges" property instead
+* of damaging the device-tree image in memory
+*/
+   lc_ranges = static_lc_ranges;
+   memcpy(lc_ranges, ranges, rlen);
+   orig_rlen = rlen;
+
+   ranges = lc_ranges;
+   /* Map ranges to struct according to spec. */
+   if (na >= 2) {
+   ranges64 = (void *)ranges;
+   ranges_amnt = rlen / sizeof(*ranges64);
+   } else {
+   ranges32 = (void *)ranges;
+   ranges_amnt = rlen / sizeof(*ranges32);
+   }
+
+   hose->io_base_phys = 0;
+   for (i = 0; i < ranges_amnt; i++) {
+   res = NULL;
+   if (ranges64) {
+   if (ranges64[i].pci_space == 0)
+   continue;
+
+   pci_space = ranges64[i].pci_space;
+   pci_addr =
+   (u64) ranges64[i].pci_addr[0] << 32 | ranges64[i].
+   pci_addr[1];
+   cpu_phys_addr =
+   of_translate_address(dev, ranges64[i].phys_addr);
+   /*
+* I haven't observed 2 significant size cells in kernel
+* code, so we're accounting only LSB of size part
+* from ranges. -vitb
+*/
+   size = ranges64[i].size[1];
+#ifdef CONFIG_PPC64
+   if (ranges64[i].size[0])
+   size |= ranges64[i].size[0]<<32;
+#endif
+   DBG("Observed: pci %llx phys %llx size %x\n", pci_addr,
+   cpu_phys_addr, size);
+   } else {
+   if (ranges32[i].pci_space == 0)
+   continue;
+
+   pci_space = (unsigned int)ranges32[i].pci_space;
+   pci_addr = (unsigned int)ranges32[i].pci_addr[1];
+   cpu_phys_addr = (unsigned int)ranges32[i].phys_addr[0];
+   size = ranges32[i].size[1];
+
+   DBG("Observed: pci %x phys %x size %x\n",
+   (u32) pci_addr, (u32) cpu_phys_addr, size);
+   }
+
+   switch ((pci_space >> 24) & 0x3) {
+   case 1: /* I/O space */
+#ifdef CONFIG_PPC32
+   /*
+* check from ppc32 pci implementation.
+ 

[PATCH 0/3][POWERPC] Add PCI support for 44xEPx

2007-08-25 Thread Vitaly Bordug
The following series is a port of 440EPx (sequoia) PCI host bridge from
arch/ppc. It was initiated with some inconsistencies observed in pci_32.c
pci ranges parsing, so I've eventually merged pci_32 and pci_64 of
pci_process_bridge_OF_ranges() into one, that should be able to handle
64-bit phys addresses, including fancy 44x 36-bit addressing.

Actual PCI stuff was implemented more as a use-case for the upper, and is
more or less straight port from arch/ppc. It assumes 

[PATCH 0/4] PowerPC 440EPx: Initial Sequoia support take 2

from Valentine applied, and hereby is for for-2.6.24 branch of jwb's tree
(git pull git://git.infradead.org/users/jwboyer/powerpc.git for-2.6.24)

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


[PATCH] atyfb: force 29MHz xtal on G3 PowerBooks

2007-08-25 Thread Olaf Hering

The atyfb does not work on my 233MHz PowerBook with Mach64 LP, when the
kernel is booted from firmware. aty_ld_pll_ct() returns 0x22 and xtal
remains at 14.31818. When booted from MacOS, aty_ld_pll_ct() returns 0x3c
and xtal is changed to 29.498928.
Google indicates that all 4 PowerBook models need the higher value.

Signed-off-by: Olaf Hering <[EMAIL PROTECTED]>

--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -2411,7 +2411,7 @@ static int __devinit aty_init(struct fb_
diff1 = -diff1;
if (diff2 < 0)
diff2 = -diff2;
-   if (diff2 < diff1) {
+   if (diff2 < diff1 || (M64_HAS(G3_PB_1024x768))) {
par->ref_clk_per = 1ULL / 29498928;
xtal = "29.498928";
}
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev