Skip to contentSkip to conversation

Board-specific PCI fixups [was: Re: [PATCH 2/2] [POWERPC] 86xx: mpc8610_hpcd: add support for ULI RTC]

RFC PATCH In review Anton Vorontsov 2 participants 7 messages May 8, 2008 – May 16, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Board-specific PCI fixups [was: Re: [PATCH 2/2] [POWERPC] 86xx: mpc8610_hpcd: add support for ULI RTC]

Quoted 7 lines · Kumar Gala
Quoted 4 lines · Anton Vorontsov

The ULI "Super South Bridge" contains ISA bridge to the legacy devices, such as Super IO mouse/keyboard/floppy disk controllers, parallel port, i8259 interrupt controller and so on.

Quoted 8 lines
Quoted 6 lines

On the MPC8610HPCD, i8259 seems to be disabled (mpc8610_hpcd.c confirms this), and other peripherals are not traced out. So we use only RTC.

This patch also adds ULI quirk to make RTC actually work (this quirk differs a bit from the one in the fsl_uli1575.c).

Can we just one quick for both?

Probably yes, but fsl_uli1575 needs some other changes for this.

This series fully tested on MPC8610HPCD, and build-tested for MPC85xxDS and MPC8641HPCN.

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2
#1 lore raw

PATCH 1/3 implement machine specific PCI fixup calls

These are similar to machine_initcalls, but works for the PCI fixups. We need this to apply machine specific fixups for the same PCI devices.

---
 include/asm-powerpc/pci.h |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
include/asm-powerpc/pci.h +16 -0
index a05a942..03fdc58 100644
@@ -224,5 +224,21 @@ extern void pci_resource_to_user(const struct pci_dev *dev, int bar,
 extern void pcibios_do_bus_setup(struct pci_bus *bus);
 extern void pcibios_fixup_of_probed_bus(struct pci_bus *bus);
 
+#define DEFINE_MACHINE_PCIFIXUP(type, mach, vendor, device, hook)        \
+	static void __devinit                                            \
+	__machine_pcifixup_##mach##_##hook(struct pci_dev *dev) {        \
+		if (machine_is(mach))                                    \
+			hook(dev);                                       \
+	}                                                                \
+	DECLARE_PCI_FIXUP_##type(vendor, device,                         \
+				 __machine_pcifixup_##mach##_##hook)
+
+#define MACH_PCI_FIXUP_EARLY(mach, vendor, device, hook) \
+	DEFINE_MACHINE_PCIFIXUP(EARLY, mach, vendor, device, hook)
+#define MACH_PCI_FIXUP_FINAL(mach, vendor, device, hook) \
+	DEFINE_MACHINE_PCIFIXUP(FINAL, mach, vendor, device, hook)
+#define MACH_PCI_FIXUP_HEADER(mach, vendor, device, hook) \
+	DEFINE_MACHINE_PCIFIXUP(HEADER, mach, vendor, device, hook)
+
 #endif	/* __KERNEL__ */
 #endif /* __ASM_POWERPC_PCI_H */
Signature · 1 line
1.5.5.1
#2 lore raw

PATCH 2/3 turn fsl_uli1575 into PCI fixups library

In reply to Anton Vorontsov

With this patch we can choose which ULI fixups we want to apply for the specific boards.

There are no changes to the fixups them selfs.

---
 arch/powerpc/platforms/85xx/mpc85xx_ds.c   |   11 ++-
 arch/powerpc/platforms/86xx/Kconfig        |    1 +
 arch/powerpc/platforms/86xx/mpc8610_hpcd.c |   90 ++-----------------------
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |   12 ++-
 arch/powerpc/platforms/fsl_uli1575.c       |  100 ++++++++++++++++++++++++----
 include/asm-powerpc/fsl_uli1575.h          |   36 ++++++++++
 6 files changed, 145 insertions(+), 105 deletions(-)
 create mode 100644 include/asm-powerpc/fsl_uli1575.h
arch/powerpc/platforms/85xx/mpc85xx_ds.c +8 -3
index dfd8b4a..961a6d7 100644
@@ -29,6 +29,7 @@
 #include <asm/prom.h>
 #include <asm/udbg.h>
 #include <asm/mpic.h>
+#include <asm/fsl_uli1575.h>
 #include <asm/i8259.h>
 
 #include <sysdev/fsl_soc.h>
@@ -114,9 +115,6 @@ void __init mpc85xx_ds_pic_init(void)
 
 #ifdef CONFIG_PCI
 static int primary_phb_addr;
-extern int uses_fsl_uli_m1575;
-extern int uli_exclude_device(struct pci_controller *hose,
-				u_char bus, u_char devfn);
 
 static int mpc85xx_exclude_device(struct pci_controller *hose,
 				   u_char bus, u_char devfn)
@@ -133,6 +131,13 @@ static int mpc85xx_exclude_device(struct pci_controller *hose,
 
 	return PCIBIOS_SUCCESSFUL;
 }
+
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AL, 0x5249, early_uli5249);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x1575, quirk_uli1575);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5288, quirk_uli5288);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x5249, quirk_final_uli5249);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, 0x1575, quirk_final_uli1575);
 #endif	/* CONFIG_PCI */
 
 /*
arch/powerpc/platforms/86xx/Kconfig +1 -0
index 053f49a..39c02af 100644
@@ -21,6 +21,7 @@ config SBC8641D
 config MPC8610_HPCD
 	bool "Freescale MPC8610 HPCD"
 	select DEFAULT_UIMAGE
+	select FSL_ULI1575
 	help
 	  This option enables support for the MPC8610 HPCD board.
 
arch/powerpc/platforms/86xx/mpc8610_hpcd.c +5 -85

104 lines not on this page · raw message

arch/powerpc/platforms/86xx/mpc86xx_hpcn.c +8 -4
index f13704a..4e1ee2e 100644
@@ -29,6 +29,7 @@
 #include <mm/mmu_decl.h>
 #include <asm/udbg.h>
 #include <asm/i8259.h>
+#include <asm/fsl_uli1575.h>
 
 #include <asm/mpic.h>
 
@@ -107,10 +108,6 @@ mpc86xx_hpcn_init_irq(void)
 }
 
 #ifdef CONFIG_PCI
-extern int uses_fsl_uli_m1575;
-extern int uli_exclude_device(struct pci_controller *hose,
-				u_char bus, u_char devfn);
-
 static int mpc86xx_exclude_device(struct pci_controller *hose,
 				   u_char bus, u_char devfn)
 {
@@ -126,6 +123,13 @@ static int mpc86xx_exclude_device(struct pci_controller *hose,
 
 	return PCIBIOS_SUCCESSFUL;
 }
+
+MACH_PCI_FIXUP_EARLY(mpc86xx_hpcn, PCI_VENDOR_ID_AL, 0x5249, early_uli5249);
+MACH_PCI_FIXUP_HEADER(mpc86xx_hpcn, PCI_VENDOR_ID_AL, 0x1575, quirk_uli1575);
+MACH_PCI_FIXUP_HEADER(mpc86xx_hpcn, PCI_VENDOR_ID_AL, 0x5288, quirk_uli5288);
+MACH_PCI_FIXUP_HEADER(mpc86xx_hpcn, PCI_VENDOR_ID_AL, 0x5229, quirk_uli5229);
+MACH_PCI_FIXUP_FINAL(mpc86xx_hpcn, PCI_VENDOR_ID_AL, 0x5249, quirk_final_uli5249);
+MACH_PCI_FIXUP_FINAL(mpc86xx_hpcn, PCI_VENDOR_ID_AL, 0x1575, quirk_final_uli1575);
 #endif /* CONFIG_PCI */
 
 
arch/powerpc/platforms/fsl_uli1575.c +87 -13

148 lines not on this page · raw message

include/asm-powerpc/fsl_uli1575.h new file +36 -0
new file mode 100644
index 0000000..9755c5c
@@ -0,0 +1,36 @@
+/*
+ * ULI M1575 setup code - specific to Freescale boards
+ *
+ * Copyright (c) 2007 Freescale Semiconductor Inc.
+ * Copyright (c) 2008 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.
+ */
+
+#ifndef __ASM_POWERPC_FSL_ULI1575_H
+#define __ASM_POWERPC_FSL_ULI1575_H
+
+struct pci_controller;
+struct pci_dev;
+
+extern int uses_fsl_uli_m1575;
+extern int uli_exclude_device(struct pci_controller *hose,
+			      u_char bus, u_char devfn);
+
+extern void __devinit early_uli5249(struct pci_dev *dev);
+extern void __devinit quirk_uli1575(struct pci_dev *dev);
+extern void __devinit quirk_final_uli1575(struct pci_dev *dev);
+extern void __devinit quirk_uli5288(struct pci_dev *dev);
+extern void __devinit quirk_uli5229(struct pci_dev *dev);
+extern void __devinit quirk_final_uli5249(struct pci_dev *dev);
+
+extern void __devinit hpcd_quirk_uli1575(struct pci_dev *dev);
+extern void __devinit hpcd_quirk_uli5288(struct pci_dev *dev);
+extern void __devinit hpcd_quirk_uli5229(struct pci_dev *dev);
+extern void __devinit hpcd_final_uli5288(struct pci_dev *dev);
+
+#endif /* __ASM_POWERPC_FSL_ULI1575_H */
Signature · 1 line
1.5.5.1
#3 lore raw

PATCH 3/3 fsl_uli1575: change RTC quirk to work on MPC8610HPCD

In reply to Anton Vorontsov

Currently fsl_uli1575.c's RTC quirk reads at ->start, but I got the RTC working on the MPC8610HPCD only when reading at 0xa0100000-0xafffffff, i.e. memory outside of behind-the-bridge devices' assigned regions.

This patch wasn't tested on the MPC85xxDS and MPC8641HPCN boards, I don't have any of these.

---
 arch/powerpc/platforms/86xx/mpc8610_hpcd.c |    1 +
 arch/powerpc/platforms/fsl_uli1575.c       |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)
arch/powerpc/platforms/86xx/mpc8610_hpcd.c +1 -0
index 2fa672b..71dbd9d 100644
@@ -229,6 +229,7 @@ MACH_PCI_FIXUP_HEADER(mpc86xx_hpcd, PCI_VENDOR_ID_AL, 0x1575, hpcd_quirk_uli1575
 MACH_PCI_FIXUP_HEADER(mpc86xx_hpcd, PCI_VENDOR_ID_AL, 0x5288, hpcd_quirk_uli5288);
 MACH_PCI_FIXUP_HEADER(mpc86xx_hpcd, PCI_VENDOR_ID_AL, 0x5229, hpcd_quirk_uli5229);
 MACH_PCI_FIXUP_FINAL(mpc86xx_hpcd, PCI_VENDOR_ID_AL, 0x5288, hpcd_final_uli5288);
+MACH_PCI_FIXUP_FINAL(mpc86xx_hpcd, PCI_VENDOR_ID_AL, 0x5249, quirk_final_uli5249);
 #endif /* CONFIG_PCI */
 
 #if defined(CONFIG_FB_FSL_DIU) || defined(CONFIG_FB_FSL_DIU_MODULE)
arch/powerpc/platforms/fsl_uli1575.c +1 -1
index 63ea4eb..a1b400a 100644
@@ -221,7 +221,7 @@ void __devinit quirk_final_uli5249(struct pci_dev *dev)
 	for (i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
 		if ((bus->resource[i]) &&
 			(bus->resource[i]->flags & IORESOURCE_MEM)) {
-			dummy = ioremap(bus->resource[i]->start, 0x4);
+			dummy = ioremap(bus->resource[i]->end - 3, 0x4);
 			if (dummy) {
 				in_8(dummy);
 				iounmap(dummy);
Signature · 1 line
1.5.5.1
#4 lore raw
In reply to Anton Vorontsov
Quoted 15 lines · Anton Vorontsov
Quoted 14 lines · Kumar Gala
Quoted 10 lines · Anton Vorontsov

The ULI "Super South Bridge" contains ISA bridge to the legacy devices, such as Super IO mouse/keyboard/floppy disk controllers, parallel port, i8259 interrupt controller and so on.

On the MPC8610HPCD, i8259 seems to be disabled (mpc8610_hpcd.c confirms this), and other peripherals are not traced out. So we use only RTC.

This patch also adds ULI quirk to make RTC actually work (this quirk differs a bit from the one in the fsl_uli1575.c).

Quoted 6 lines
Quoted 1 line

Can we just one quick for both?

Probably yes, but fsl_uli1575 needs some other changes for this.

This series fully tested on MPC8610HPCD, and build-tested for MPC85xxDS and MPC8641HPCN.

Are these patches ideal? No comments so far... ;-)

Could we then apply this to the powerpc-next for proper testing?

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2
#5 lore raw

Hi Anton,

This is not me picking on you, I just want to make a general statement.

Quoted 2 lines · On Thu, 15 May 2008 20:20:48 +0400 Anton Vorontsov <[email protected]>…

Could we then apply this to the powerpc-next for proper testing?

We should not do this. powerpc-next feeds into linux-next which is for inter subsystem integration testing. Architecture specific testing should be done before things get to -next.

I am hoping that Paul will run a separate powerpc tree/branch for powerpc wide testing and then migrate stuff form there to powerpc-next when he is happy that things are as good as we can get. This does not mean "perfect". :-)

Signature · 3 lines
Cheers,
Stephen Rothwell                    [email protected]
http://www.canb.auug.org.au/~sfr/
#6 lore raw
Quoted 11 lines · Stephen Rothwell

Hi Anton,

This is not me picking on you, I just want to make a general statement.

Quoted 2 lines · On Thu, 15 May 2008 20:20:48 +0400 Anton Vorontsov <[email protected]>…

Could we then apply this to the powerpc-next for proper testing?

We should not do this. powerpc-next feeds into linux-next which is for inter subsystem integration testing. Architecture specific testing should be done before things get to -next.

Oh.

Quoted 4 lines

I am hoping that Paul will run a separate powerpc tree/branch for powerpc wide testing and then migrate stuff form there to powerpc-next when he is happy that things are as good as we can get. This does not mean "perfect". :-)

Yeah, that would be great.

Thanks,

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2