linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] Some Freescale MPC52xx related updates
@ 2005-12-20 20:40 Sylvain Munaut
  2005-12-20 20:40 ` [PATCH 1/9] ppc32: Remove useless file arch/ppc/platforms/mpc5200.c Sylvain Munaut
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: Sylvain Munaut @ 2005-12-20 20:40 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Tom Rini, Sylvain Munaut, Linux PPC Embedded


Hello Andrew & all,


This set of patches contains misc updates that are in my local
tree since sometimes now and I think they're good to go upstream.

They've been posted separatly on the ppc mailing list at some point
and tested by several people. So far I  received no negative feedback.
Most are trivial compile fix, small improvements, ...


Thanks,

	Sylvain Munaut

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/9] ppc32: Remove useless file arch/ppc/platforms/mpc5200.c
  2005-12-20 20:40 [PATCH 0/9] Some Freescale MPC52xx related updates Sylvain Munaut
@ 2005-12-20 20:40 ` Sylvain Munaut
  2005-12-20 20:41 ` [PATCH 2/9] ppc32/serial: Fix compiler errors with GCC 4.x in mpc52xx_uart.c Sylvain Munaut
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Sylvain Munaut @ 2005-12-20 20:40 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Tom Rini, Sylvain Munaut, Linux PPC Embedded

ppc32: Remove useless file arch/ppc/platforms/mpc5200.c

That file is a left-over of the 'old' OCP model that
should have been erased during the change to platform
model but I forgot it ...

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>

---
commit 144f9d12ec7d04b38f83a131c4e544f78d2d47b2
tree 629ebc02993d06ff02b87e2d0effb257ef842328
parent 48ea753075aa15699bd5fac26faa08431aaa697b
author Sylvain Munaut <tnt@246tNt.com> Sat, 17 Dec 2005 23:03:25 +0100
committer Sylvain Munaut <tnt@246tNt.com> Sat, 17 Dec 2005 23:03:25 +0100

 arch/ppc/platforms/mpc5200.c |   53 ------------------------------------------
 1 files changed, 0 insertions(+), 53 deletions(-)

diff --git a/arch/ppc/platforms/mpc5200.c b/arch/ppc/platforms/mpc5200.c
deleted file mode 100644
index a58db43..0000000
--- a/arch/ppc/platforms/mpc5200.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * arch/ppc/platforms/mpc5200.c
- *
- * OCP Definitions for the boards based on MPC5200 processor. Contains
- * definitions for every common peripherals. (Mostly all but PSCs)
- * 
- * Maintainer : Sylvain Munaut <tnt@246tNt.com>
- *
- * Copyright 2004 Sylvain Munaut <tnt@246tNt.com>
- *
- * This file is licensed under the terms of the GNU General Public License
- * version 2. This program is licensed "as is" without any warranty of any
- * kind, whether express or implied.
- */
-
-#include <asm/ocp.h>
-#include <asm/mpc52xx.h>
-
-
-static struct ocp_fs_i2c_data mpc5200_i2c_def = {
-        .flags  = FS_I2C_CLOCK_5200,
-};
-
-
-/* Here is the core_ocp struct.
- * With all the devices common to all board. Even if port multiplexing is
- * not setup for them (if the user don't want them, just don't select the
- * config option). The potentially conflicting devices (like PSCs) goes in
- * board specific file.
- */
-struct ocp_def core_ocp[] = {
-	{
-		.vendor         = OCP_VENDOR_FREESCALE,
-		.function       = OCP_FUNC_IIC,
-		.index          = 0,
-		.paddr          = MPC52xx_I2C1,
-		.irq            = OCP_IRQ_NA,   /* MPC52xx_IRQ_I2C1 - Buggy */
-		.pm             = OCP_CPM_NA,
-		.additions      = &mpc5200_i2c_def,
-	},
-	{
-		.vendor         = OCP_VENDOR_FREESCALE,
-		.function       = OCP_FUNC_IIC,
-		.index          = 1,
-		.paddr          = MPC52xx_I2C2,
-		.irq            = OCP_IRQ_NA,   /* MPC52xx_IRQ_I2C2 - Buggy */
-		.pm             = OCP_CPM_NA,
-		.additions      = &mpc5200_i2c_def,
-	},
-	{	/* Terminating entry */
-		.vendor		= OCP_VENDOR_INVALID
-	}
-};

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/9] ppc32/serial: Fix compiler errors with GCC 4.x in mpc52xx_uart.c
  2005-12-20 20:40 [PATCH 0/9] Some Freescale MPC52xx related updates Sylvain Munaut
  2005-12-20 20:40 ` [PATCH 1/9] ppc32: Remove useless file arch/ppc/platforms/mpc5200.c Sylvain Munaut
@ 2005-12-20 20:41 ` Sylvain Munaut
  2005-12-20 20:41 ` [PATCH 3/9] ppc32/serial: Change mpc52xx_uart.c to use the Low Density Serial port major Sylvain Munaut
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Sylvain Munaut @ 2005-12-20 20:41 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Tom Rini, Sylvain Munaut, Linux PPC Embedded

ppc32/serial: Fix compiler errors with GCC 4.x in mpc52xx_uart.c

Signed-off-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>

---
commit c83b03a94291bdd952c6b1b20ab15981456e8625
tree 81e1121a440a4624a4cd7f112fe44fca438ee140
parent 144f9d12ec7d04b38f83a131c4e544f78d2d47b2
author Sylvain Munaut <tnt@246tNt.com> Sat, 17 Dec 2005 23:12:39 +0100
committer Sylvain Munaut <tnt@246tNt.com> Sat, 17 Dec 2005 23:12:39 +0100

 drivers/serial/mpc52xx_uart.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index b8727d9..4dcf031 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -668,7 +668,7 @@ mpc52xx_console_setup(struct console *co
 }
 
 
-extern struct uart_driver mpc52xx_uart_driver;
+static struct uart_driver mpc52xx_uart_driver;
 
 static struct console mpc52xx_console = {
 	.name	= "ttyS",

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/9] ppc32/serial: Change mpc52xx_uart.c to use the Low Density Serial port major
  2005-12-20 20:40 [PATCH 0/9] Some Freescale MPC52xx related updates Sylvain Munaut
  2005-12-20 20:40 ` [PATCH 1/9] ppc32: Remove useless file arch/ppc/platforms/mpc5200.c Sylvain Munaut
  2005-12-20 20:41 ` [PATCH 2/9] ppc32/serial: Fix compiler errors with GCC 4.x in mpc52xx_uart.c Sylvain Munaut
@ 2005-12-20 20:41 ` Sylvain Munaut
  2005-12-20 20:42 ` [PATCH 4/9] ppc32: Fix static IO mapping for Freescale MPC52xx Sylvain Munaut
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Sylvain Munaut @ 2005-12-20 20:41 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Tom Rini, Sylvain Munaut, Linux PPC Embedded

ppc32/serial: Change mpc52xx_uart.c to use the Low Density Serial port major

Before this patch we were just using the "classic" /dev/ttySx devices.
However when another on the system is loaded that uses those (like drivers
for serial PCMCIA), that creates a conflict for the minors. Therefore, we
now use /dev/ttyPSC[0:5] (note the 0-based numbering !) with some minors
we've been assigned in the "Low Density Serial port major"

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>

---
commit 1661f915e8bd58e52fe3326e038efe74068702e0
tree 04215b96380f2d7d218a223d837b9eabe2f120f4
parent c83b03a94291bdd952c6b1b20ab15981456e8625
author Sylvain Munaut <tnt@246tNt.com> Sat, 17 Dec 2005 23:21:16 +0100
committer Sylvain Munaut <tnt@246tNt.com> Sat, 17 Dec 2005 23:21:16 +0100

 drivers/serial/mpc52xx_uart.c |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c
index 4dcf031..1288d62 100644
--- a/drivers/serial/mpc52xx_uart.c
+++ b/drivers/serial/mpc52xx_uart.c
@@ -37,11 +37,11 @@
  * by the bootloader or in the platform init code.
  *
  * The idx field must be equal to the PSC index ( e.g. 0 for PSC1, 1 for PSC2,
- * and so on). So the PSC1 is mapped to /dev/ttyS0, PSC2 to /dev/ttyS1 and so
- * on. But be warned, it's an ABSOLUTE REQUIREMENT ! This is needed mainly for
- * the console code : without this 1:1 mapping, at early boot time, when we are
- * parsing the kernel args console=ttyS?, we wouldn't know wich PSC it will be
- * mapped to.
+ * and so on). So the PSC1 is mapped to /dev/ttyPSC0, PSC2 to /dev/ttyPSC1 and
+ * so on. But be warned, it's an ABSOLUTE REQUIREMENT ! This is needed mainly
+ * fpr the console code : without this 1:1 mapping, at early boot time, when we
+ * are parsing the kernel args console=ttyPSC?, we wouldn't know wich PSC it
+ * will be mapped to.
  */
 
 #include <linux/config.h>
@@ -65,6 +65,10 @@
 #include <linux/serial_core.h>
 
 
+/* We've been assigned a range on the "Low-density serial ports" major */
+#define SERIAL_PSC_MAJOR	204
+#define SERIAL_PSC_MINOR	148
+
 
 #define ISR_PASS_LIMIT 256	/* Max number of iteration in the interrupt */
 
@@ -671,12 +675,12 @@ mpc52xx_console_setup(struct console *co
 static struct uart_driver mpc52xx_uart_driver;
 
 static struct console mpc52xx_console = {
-	.name	= "ttyS",
+	.name	= "ttyPSC",
 	.write	= mpc52xx_console_write,
 	.device	= uart_console_device,
 	.setup	= mpc52xx_console_setup,
 	.flags	= CON_PRINTBUFFER,
-	.index	= -1,	/* Specified on the cmdline (e.g. console=ttyS0 ) */
+	.index	= -1,	/* Specified on the cmdline (e.g. console=ttyPSC0 ) */
 	.data	= &mpc52xx_uart_driver,
 };
 
@@ -703,10 +707,10 @@ console_initcall(mpc52xx_console_init);
 static struct uart_driver mpc52xx_uart_driver = {
 	.owner		= THIS_MODULE,
 	.driver_name	= "mpc52xx_psc_uart",
-	.dev_name	= "ttyS",
-	.devfs_name	= "ttyS",
-	.major		= TTY_MAJOR,
-	.minor		= 64,
+	.dev_name	= "ttyPSC",
+	.devfs_name	= "ttyPSC",
+	.major		= SERIAL_PSC_MAJOR,
+	.minor		= SERIAL_PSC_MINOR,
 	.nr		= MPC52xx_PSC_MAXNUM,
 	.cons		= MPC52xx_PSC_CONSOLE,
 };

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/9] ppc32: Fix static IO mapping for Freescale MPC52xx
  2005-12-20 20:40 [PATCH 0/9] Some Freescale MPC52xx related updates Sylvain Munaut
                   ` (2 preceding siblings ...)
  2005-12-20 20:41 ` [PATCH 3/9] ppc32/serial: Change mpc52xx_uart.c to use the Low Density Serial port major Sylvain Munaut
@ 2005-12-20 20:42 ` Sylvain Munaut
  2005-12-20 20:42 ` [PATCH 5/9] ppc32: Modify Freescale MPC52xx IRQ mapping to _not_ use irq 0 Sylvain Munaut
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Sylvain Munaut @ 2005-12-20 20:42 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Tom Rini, Sylvain Munaut, Linux PPC Embedded

ppc32: Fix static IO mapping for Freescale MPC52xx

The current iomapping used MBAR_SIZE for the size argument
of io_block_mapping, resulting in a call to setbat with a
size argument of 64k which is invalid.

This patch correct this and maps the whole 0xf0000000->0xffffffff
range so that devices on the local bus are also included in
the BAT mapping.

Thanks to Bernhard Kuhn from Metrowerks for pointing this out.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>

---
commit ae62fed2708efa333d41f7b36893e5fdbd0f6730
tree a1a4da53edb2f235be6658558eeb606a0b2580e9
parent 1661f915e8bd58e52fe3326e038efe74068702e0
author Sylvain Munaut <tnt@246tNt.com> Sun, 18 Dec 2005 11:13:15 +0100
committer Sylvain Munaut <tnt@246tNt.com> Sun, 18 Dec 2005 11:13:15 +0100

 arch/ppc/syslib/mpc52xx_setup.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/ppc/syslib/mpc52xx_setup.c b/arch/ppc/syslib/mpc52xx_setup.c
index bb23745..a4a4b02 100644
--- a/arch/ppc/syslib/mpc52xx_setup.c
+++ b/arch/ppc/syslib/mpc52xx_setup.c
@@ -84,9 +84,11 @@ mpc52xx_set_bat(void)
 void __init
 mpc52xx_map_io(void)
 {
-	/* Here we only map the MBAR */
+	/* Here we map the MBAR and the whole upper zone. MBAR is only
+	   64k but we can't map only 64k with BATs. Map the whole
+	   0xf0000000 range is ok and helps eventual lpb devices placed there */
 	io_block_mapping(
-		MPC52xx_MBAR_VIRT, MPC52xx_MBAR, MPC52xx_MBAR_SIZE, _PAGE_IO);
+		MPC52xx_MBAR_VIRT, MPC52xx_MBAR, 0x10000000, _PAGE_IO);
 }
 
 

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 5/9] ppc32: Modify Freescale MPC52xx IRQ mapping to _not_ use irq 0
  2005-12-20 20:40 [PATCH 0/9] Some Freescale MPC52xx related updates Sylvain Munaut
                   ` (3 preceding siblings ...)
  2005-12-20 20:42 ` [PATCH 4/9] ppc32: Fix static IO mapping for Freescale MPC52xx Sylvain Munaut
@ 2005-12-20 20:42 ` Sylvain Munaut
  2005-12-20 20:43 ` [PATCH 6/9] ppc32: Remove __init qualifier from mpc52xx pci resources fixups Sylvain Munaut
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Sylvain Munaut @ 2005-12-20 20:42 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Tom Rini, Sylvain Munaut, Linux PPC Embedded

ppc32: Modify Freescale MPC52xx IRQ mapping to _not_ use irq 0

AFAIK IRQ number 0 is a perfectly valid IRQ number. But it seems there
are numerous places where it's considered to be invalid or "no irq" value.
Since that value is problematic, the IRQ mapping is changed to not
use it.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>

---
commit 0311bddd40fe347ea69a5659f02e1beb8fe96ea8
tree 16003ab98c67face9c25bdb247e241d88dd596f5
parent ae62fed2708efa333d41f7b36893e5fdbd0f6730
author Sylvain Munaut <tnt@246tNt.com> Sun, 18 Dec 2005 11:20:17 +0100
committer Sylvain Munaut <tnt@246tNt.com> Sun, 18 Dec 2005 11:20:17 +0100

 include/asm-ppc/mpc52xx.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/asm-ppc/mpc52xx.h b/include/asm-ppc/mpc52xx.h
index e5f80c2..04d5630 100644
--- a/include/asm-ppc/mpc52xx.h
+++ b/include/asm-ppc/mpc52xx.h
@@ -107,7 +107,7 @@ enum ppc_sys_devices {
 #define MPC52xx_SDMA_IRQ_NUM	17
 #define MPC52xx_PERP_IRQ_NUM	23
 
-#define MPC52xx_CRIT_IRQ_BASE	0
+#define MPC52xx_CRIT_IRQ_BASE	1
 #define MPC52xx_MAIN_IRQ_BASE	(MPC52xx_CRIT_IRQ_BASE + MPC52xx_CRIT_IRQ_NUM)
 #define MPC52xx_SDMA_IRQ_BASE	(MPC52xx_MAIN_IRQ_BASE + MPC52xx_MAIN_IRQ_NUM)
 #define MPC52xx_PERP_IRQ_BASE	(MPC52xx_SDMA_IRQ_BASE + MPC52xx_SDMA_IRQ_NUM)

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 6/9] ppc32: Remove __init qualifier from mpc52xx pci resources fixups
  2005-12-20 20:40 [PATCH 0/9] Some Freescale MPC52xx related updates Sylvain Munaut
                   ` (4 preceding siblings ...)
  2005-12-20 20:42 ` [PATCH 5/9] ppc32: Modify Freescale MPC52xx IRQ mapping to _not_ use irq 0 Sylvain Munaut
@ 2005-12-20 20:43 ` Sylvain Munaut
  2005-12-20 20:43 ` [PATCH 7/9] ppc32: Fix MPC52xx configuration space access Sylvain Munaut
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Sylvain Munaut @ 2005-12-20 20:43 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Tom Rini, Sylvain Munaut, Linux PPC Embedded

ppc32: Remove __init qualifier from mpc52xx pci resources fixups

The mpc52xx_pci_fixup_resources is not only called at init but also
when there is a pci hotplug like when a cardbus card is plugged in.
So that function is needed after init too.

Thanks to Asier Llano Palacios for reporting this.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>

---
commit 7834134483a1ae663b805714fcd741c1caf41171
tree 56da4218fa2a0bd1541b7743e79415fc48715ba1
parent 0311bddd40fe347ea69a5659f02e1beb8fe96ea8
author Sylvain Munaut <tnt@246tNt.com> Sun, 18 Dec 2005 11:48:56 +0100
committer Sylvain Munaut <tnt@246tNt.com> Sun, 18 Dec 2005 11:48:56 +0100

 arch/ppc/syslib/mpc52xx_pci.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/ppc/syslib/mpc52xx_pci.c b/arch/ppc/syslib/mpc52xx_pci.c
index 4ac1908..e6cb3e2 100644
--- a/arch/ppc/syslib/mpc52xx_pci.c
+++ b/arch/ppc/syslib/mpc52xx_pci.c
@@ -151,7 +151,7 @@ mpc52xx_pci_setup(struct mpc52xx_pci __i
 #endif
 }
 
-static void __init
+static void
 mpc52xx_pci_fixup_resources(struct pci_dev *dev)
 {
 	int i;

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 7/9] ppc32: Fix MPC52xx configuration space access
  2005-12-20 20:40 [PATCH 0/9] Some Freescale MPC52xx related updates Sylvain Munaut
                   ` (5 preceding siblings ...)
  2005-12-20 20:43 ` [PATCH 6/9] ppc32: Remove __init qualifier from mpc52xx pci resources fixups Sylvain Munaut
@ 2005-12-20 20:43 ` Sylvain Munaut
  2005-12-20 20:44 ` [PATCH 8/9] ppc32: Fix MPC52xx PCI init in cas the bootloader didn't do it Sylvain Munaut
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Sylvain Munaut @ 2005-12-20 20:43 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Tom Rini, Sylvain Munaut, Linux PPC Embedded

ppc32: Fix MPC52xx configuration space access

This patch takes care of an errata of the MPC5200 by avoiding 32 bits
access in type 1 configuration accesses. All others accesses are still
32 bits wide. It also adds some mb() since the simple out_be(...) are
not sufficient in this case.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>

---
commit 20734ce8dc6fafd40c421bd275712d7bb6124d20
tree e53eeedbe423ecf718313dd2173031d456b4f3e8
parent 7834134483a1ae663b805714fcd741c1caf41171
author Sylvain Munaut <tnt@246tNt.com> Sun, 18 Dec 2005 14:52:51 +0100
committer Sylvain Munaut <tnt@246tNt.com> Sun, 18 Dec 2005 14:52:51 +0100

 arch/ppc/syslib/mpc52xx_pci.c |   81 ++++++++++++++++++++++++++++++++++-------
 1 files changed, 68 insertions(+), 13 deletions(-)

diff --git a/arch/ppc/syslib/mpc52xx_pci.c b/arch/ppc/syslib/mpc52xx_pci.c
index e6cb3e2..2c5e6dd 100644
--- a/arch/ppc/syslib/mpc52xx_pci.c
+++ b/arch/ppc/syslib/mpc52xx_pci.c
@@ -24,6 +24,12 @@
 #include <asm/machdep.h>
 
 
+/* This macro is defined to activate the workaround for the bug
+   435 of the MPC5200 (L25R). With it activated, we don't do any
+   32 bits configuration access during type-1 cycles */
+#define MPC5200_BUG_435_WORKAROUND
+
+
 static int
 mpc52xx_pci_read_config(struct pci_bus *bus, unsigned int devfn,
 				int offset, int len, u32 *val)
@@ -40,17 +46,39 @@ mpc52xx_pci_read_config(struct pci_bus *
 		((bus->number - hose->bus_offset) << 16) |
 		(devfn << 8) |
 		(offset & 0xfc));
+	mb();
 
-	value = in_le32(hose->cfg_data);
+#ifdef MPC5200_BUG_435_WORKAROUND
+	if (bus->number != hose->bus_offset) {
+		switch (len) {
+			case 1:
+				value = in_8(((u8 __iomem *)hose->cfg_data) + (offset & 3));
+				break;
+			case 2:
+				value = in_le16(((u16 __iomem *)hose->cfg_data) + ((offset>>1) & 1));
+				break;
+
+			default:
+				value = in_le16((u16 __iomem *)hose->cfg_data) |
+					(in_le16(((u16 __iomem *)hose->cfg_data) + 1) << 16);
+				break;
+		}
+	}
+	else
+#endif
+	{
+		value = in_le32(hose->cfg_data);
 
-	if (len != 4) {
-		value >>= ((offset & 0x3) << 3);
-		value &= 0xffffffff >> (32 - (len << 3));
+		if (len != 4) {
+			value >>= ((offset & 0x3) << 3);
+			value &= 0xffffffff >> (32 - (len << 3));
+		}
 	}
 
 	*val = value;
 
 	out_be32(hose->cfg_addr, 0);
+	mb();
 
 	return PCIBIOS_SUCCESSFUL;
 }
@@ -71,21 +99,48 @@ mpc52xx_pci_write_config(struct pci_bus 
 		((bus->number - hose->bus_offset) << 16) |
 		(devfn << 8) |
 		(offset & 0xfc));
+	mb();
 
-	if (len != 4) {
-		value = in_le32(hose->cfg_data);
+#ifdef MPC5200_BUG_435_WORKAROUND
+	if (bus->number != hose->bus_offset) {
+		switch (len) {
+			case 1:
+				out_8(((u8 __iomem *)hose->cfg_data) +
+					(offset & 3), val);
+				break;
+			case 2:
+				out_le16(((u16 __iomem *)hose->cfg_data) +
+					((offset>>1) & 1), val);
+				break;
+
+			default:
+				out_le16((u16 __iomem *)hose->cfg_data,
+					(u16)val);
+				out_le16(((u16 __iomem *)hose->cfg_data) + 1,
+					(u16)(val>>16));
+				break;
+		}
+	}
+	else
+#endif
+	{
+		if (len != 4) {
+			value = in_le32(hose->cfg_data);
+
+			offset = (offset & 0x3) << 3;
+			mask = (0xffffffff >> (32 - (len << 3)));
+			mask <<= offset;
 
-		offset = (offset & 0x3) << 3;
-		mask = (0xffffffff >> (32 - (len << 3)));
-		mask <<= offset;
+			value &= ~mask;
+			val = value | ((val << offset) & mask);
+		}
 
-		value &= ~mask;
-		val = value | ((val << offset) & mask);
+		out_le32(hose->cfg_data, val);
 	}
-
-	out_le32(hose->cfg_data, val);
+	mb();
 
 	out_be32(hose->cfg_addr, 0);
+	mb();
 
 	return PCIBIOS_SUCCESSFUL;
 }

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 8/9] ppc32: Fix MPC52xx PCI init in cas the bootloader didn't do it
  2005-12-20 20:40 [PATCH 0/9] Some Freescale MPC52xx related updates Sylvain Munaut
                   ` (6 preceding siblings ...)
  2005-12-20 20:43 ` [PATCH 7/9] ppc32: Fix MPC52xx configuration space access Sylvain Munaut
@ 2005-12-20 20:44 ` Sylvain Munaut
  2005-12-20 20:44 ` [PATCH 9/9] ppc32: Allows compilation of a MPC52xx kernel without PCI Sylvain Munaut
  2005-12-20 20:54 ` [PATCH 0/9] Some Freescale MPC52xx related updates Kumar Gala
  9 siblings, 0 replies; 12+ messages in thread
From: Sylvain Munaut @ 2005-12-20 20:44 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Tom Rini, Sylvain Munaut, Linux PPC Embedded

ppc32: Fix MPC52xx PCI init in cas the bootloader didn't do it

We were counting on the bootloader to init some stuff, like get
the bus out of reset and enable accesses.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>

---
commit ebf0598ce7564d4c1db16d995e609923bbb2eba8
tree 3ba738b8bf64ebe609c5f8301f87b55d25c2d9fd
parent 20734ce8dc6fafd40c421bd275712d7bb6124d20
author Sylvain Munaut <tnt@246tNt.com> Sun, 18 Dec 2005 20:09:13 +0100
committer Sylvain Munaut <tnt@246tNt.com> Sun, 18 Dec 2005 20:09:13 +0100

 arch/ppc/syslib/mpc52xx_pci.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/ppc/syslib/mpc52xx_pci.c b/arch/ppc/syslib/mpc52xx_pci.c
index 2c5e6dd..313c96e 100644
--- a/arch/ppc/syslib/mpc52xx_pci.c
+++ b/arch/ppc/syslib/mpc52xx_pci.c
@@ -154,9 +154,12 @@ static struct pci_ops mpc52xx_pci_ops = 
 static void __init
 mpc52xx_pci_setup(struct mpc52xx_pci __iomem *pci_regs)
 {
+	u32 tmp;
 
 	/* Setup control regs */
-		/* Nothing to do afaik */
+	tmp = in_be32(&pci_regs->scr);
+	tmp |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
+	out_be32(&pci_regs->scr, tmp);
 
 	/* Setup windows */
 	out_be32(&pci_regs->iw0btar, MPC52xx_PCI_IWBTAR_TRANSLATION(
@@ -197,13 +200,12 @@ mpc52xx_pci_setup(struct mpc52xx_pci __i
 	/* Not necessary and can be a bad thing if for example the bootloader
 	   is displaying a splash screen or ... Just left here for
 	   documentation purpose if anyone need it */
-#if 0
-	u32 tmp;
 	tmp = in_be32(&pci_regs->gscr);
+#if 0
 	out_be32(&pci_regs->gscr, tmp | MPC52xx_PCI_GSCR_PR);
 	udelay(50);
-	out_be32(&pci_regs->gscr, tmp);
 #endif
+	out_be32(&pci_regs->gscr, tmp & ~MPC52xx_PCI_GSCR_PR);
 }
 
 static void

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 9/9] ppc32: Allows compilation of a MPC52xx kernel without PCI
  2005-12-20 20:40 [PATCH 0/9] Some Freescale MPC52xx related updates Sylvain Munaut
                   ` (7 preceding siblings ...)
  2005-12-20 20:44 ` [PATCH 8/9] ppc32: Fix MPC52xx PCI init in cas the bootloader didn't do it Sylvain Munaut
@ 2005-12-20 20:44 ` Sylvain Munaut
  2005-12-20 20:54 ` [PATCH 0/9] Some Freescale MPC52xx related updates Kumar Gala
  9 siblings, 0 replies; 12+ messages in thread
From: Sylvain Munaut @ 2005-12-20 20:44 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Tom Rini, Sylvain Munaut, Linux PPC Embedded

ppc32: Allows compilation of a MPC52xx kernel without PCI

Some custom cards might not need PCI, without this patch,
compilation fails.

Signed-off-by: Roger Blofeld <blofeldus@yahoo.com>
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>

---
commit 181a39c878aab09ba95bfd9396e8c7d7004f4c4e
tree 42106141a8a50c521a8d169bb6b364d78401e15d
parent ebf0598ce7564d4c1db16d995e609923bbb2eba8
author Sylvain Munaut <tnt@246tNt.com> Sun, 18 Dec 2005 21:27:54 +0100
committer Sylvain Munaut <tnt@246tNt.com> Sun, 18 Dec 2005 21:27:54 +0100

 arch/ppc/platforms/lite5200.c |    2 ++
 include/asm-ppc/io.h          |    2 ++
 include/asm-ppc/mpc52xx.h     |   11 +++++++++++
 3 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/arch/ppc/platforms/lite5200.c b/arch/ppc/platforms/lite5200.c
index d44cc99..7ed52dc 100644
--- a/arch/ppc/platforms/lite5200.c
+++ b/arch/ppc/platforms/lite5200.c
@@ -196,8 +196,10 @@ platform_init(unsigned long r3, unsigned
 	mpc52xx_set_bat();
 
 	/* No ISA bus by default */
+#ifdef CONFIG_PCI
 	isa_io_base		= 0;
 	isa_mem_base		= 0;
+#endif
 
 	/* Powersave */
 	/* This is provided as an example on how to do it. But you
diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h
index 84ac6e2..df9cf6e 100644
--- a/include/asm-ppc/io.h
+++ b/include/asm-ppc/io.h
@@ -27,6 +27,8 @@
 
 #if defined(CONFIG_4xx)
 #include <asm/ibm4xx.h>
+#elif defined(CONFIG_PPC_MPC52xx)
+#include <asm/mpc52xx.h>
 #elif defined(CONFIG_8xx)
 #include <asm/mpc8xx.h>
 #elif defined(CONFIG_8260)
diff --git a/include/asm-ppc/mpc52xx.h b/include/asm-ppc/mpc52xx.h
index 04d5630..a055e07 100644
--- a/include/asm-ppc/mpc52xx.h
+++ b/include/asm-ppc/mpc52xx.h
@@ -29,6 +29,17 @@ struct pt_regs;
 #endif /* __ASSEMBLY__ */
 
 
+#ifdef CONFIG_PCI
+#define _IO_BASE	isa_io_base
+#define _ISA_MEM_BASE	isa_mem_base
+#define PCI_DRAM_OFFSET	pci_dram_offset
+#else
+#define _IO_BASE	0
+#define _ISA_MEM_BASE	0
+#define PCI_DRAM_OFFSET	0
+#endif
+
+
 /* ======================================================================== */
 /* PPC Sys devices definition                                               */
 /* ======================================================================== */

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/9] Some Freescale MPC52xx related updates
  2005-12-20 20:40 [PATCH 0/9] Some Freescale MPC52xx related updates Sylvain Munaut
                   ` (8 preceding siblings ...)
  2005-12-20 20:44 ` [PATCH 9/9] ppc32: Allows compilation of a MPC52xx kernel without PCI Sylvain Munaut
@ 2005-12-20 20:54 ` Kumar Gala
  2005-12-20 21:36   ` Sylvain Munaut
  9 siblings, 1 reply; 12+ messages in thread
From: Kumar Gala @ 2005-12-20 20:54 UTC (permalink / raw)
  To: Sylvain Munaut; +Cc: Andrew Morton, Tom Rini, Linux PPC Embedded

> Hello Andrew & all,
> 
> 
> This set of patches contains misc updates that are in my local
> tree since sometimes now and I think they're good to go upstream.
> 
> They've been posted separatly on the ppc mailing list at some point
> and tested by several people. So far I  received no negative feedback.
> Most are trivial compile fix, small improvements, ...
> 
> 
> Thanks,
> 
> 	Sylvain Munaut

Sylvain, its been a while.  We have started to a powerpc.git tree that 
Paul is maintaining rather than forwarding patches to Andrew.

So you may want to let Paul know about these 52xx patches for him to queue 
them up in the powerpc.git tree.

- kumar

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/9] Some Freescale MPC52xx related updates
  2005-12-20 20:54 ` [PATCH 0/9] Some Freescale MPC52xx related updates Kumar Gala
@ 2005-12-20 21:36   ` Sylvain Munaut
  0 siblings, 0 replies; 12+ messages in thread
From: Sylvain Munaut @ 2005-12-20 21:36 UTC (permalink / raw)
  To: Kumar Gala; +Cc: Andrew Morton, Tom Rini, Linux PPC Embedded

Kumar Gala wrote:
>>Hello Andrew & all,
>>
>>
>>This set of patches contains misc updates that are in my local
>>tree since sometimes now and I think they're good to go upstream.
>>
>>They've been posted separatly on the ppc mailing list at some point
>>and tested by several people. So far I  received no negative feedback.
>>Most are trivial compile fix, small improvements, ...
>>
>>
>>Thanks,
>>
>>	Sylvain Munaut
> 
> 
> Sylvain, its been a while.

Yes, indeed ... I'm trying to catch up.


> We have started to a powerpc.git tree that 
> Paul is maintaining rather than forwarding patches to Andrew.
> 
> So you may want to let Paul know about these 52xx patches for him to queue 
> them up in the powerpc.git tree.

I knew it ... I can't seem to get it right the first time each time I
miss something when pushing patches ...

I'll send the patch series to Paul right now.


	Sylvain

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2005-12-20 21:38 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-20 20:40 [PATCH 0/9] Some Freescale MPC52xx related updates Sylvain Munaut
2005-12-20 20:40 ` [PATCH 1/9] ppc32: Remove useless file arch/ppc/platforms/mpc5200.c Sylvain Munaut
2005-12-20 20:41 ` [PATCH 2/9] ppc32/serial: Fix compiler errors with GCC 4.x in mpc52xx_uart.c Sylvain Munaut
2005-12-20 20:41 ` [PATCH 3/9] ppc32/serial: Change mpc52xx_uart.c to use the Low Density Serial port major Sylvain Munaut
2005-12-20 20:42 ` [PATCH 4/9] ppc32: Fix static IO mapping for Freescale MPC52xx Sylvain Munaut
2005-12-20 20:42 ` [PATCH 5/9] ppc32: Modify Freescale MPC52xx IRQ mapping to _not_ use irq 0 Sylvain Munaut
2005-12-20 20:43 ` [PATCH 6/9] ppc32: Remove __init qualifier from mpc52xx pci resources fixups Sylvain Munaut
2005-12-20 20:43 ` [PATCH 7/9] ppc32: Fix MPC52xx configuration space access Sylvain Munaut
2005-12-20 20:44 ` [PATCH 8/9] ppc32: Fix MPC52xx PCI init in cas the bootloader didn't do it Sylvain Munaut
2005-12-20 20:44 ` [PATCH 9/9] ppc32: Allows compilation of a MPC52xx kernel without PCI Sylvain Munaut
2005-12-20 20:54 ` [PATCH 0/9] Some Freescale MPC52xx related updates Kumar Gala
2005-12-20 21:36   ` Sylvain Munaut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).