Skip to contentSkip to conversation

Fix RTC for MPC8572DS and support RTC on MPC8610HPCD

PATCH Applied Anton Vorontsov 2 participants 8 messages Jun 11, 2008 – Jul 28, 2008

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

cover Fix RTC for MPC8572DS and support RTC on MPC8610HPCD

Hello Kumar,

The previous series scattered a bit, so I gathered it again.

I've found MPC8572DS board to test RTC quirk changes that I've made for MPC8610HPCD, and it appears that without the change RTC does not work on MPC8572DS, too.

So, the first patch actually fixes it for MPC8572DS, and also makes RTC work on MPC8610HPCD. I still can't test the patch on MPC8641HPCD and MPC8544DS (no boards handy), but I don't believe that the change could break these boards.

I also dropped MACH_PCI_FIXUP_*() approach, and did just machine_is()s inside the fixups. I think this looks better... as far as possible for the board specific fixups. :-)

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

PATCH 1/4 powerpc: fsl_uli1575: fix RTC quirk to work on MPC8572DS and MPC8610HPCD

This patch fixes RTC on MPC8572DS boards: dummy read helps only when reading at the end of the bridge's memory (i.e. outside of behind the bridge devices' assigned regions).

With this change the quirk also makes RTC work on MPC8610HPCD, so it's unlikely that this will break MPC8641HPCN or MPC8544DS boards.

---
 arch/powerpc/platforms/fsl_uli1575.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/powerpc/platforms/fsl_uli1575.c +1 -1
index afc9141..756561c 100644
@@ -221,7 +221,7 @@ static 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.4
#3 lore raw

PATCH 2/4 powerpc/85xx/86xx: some refactoring for fsl_uli1575 code

In reply to Anton Vorontsov

- Get rid of uses_fsl_uli_m1575, it does not scale for all cases. Instead, let's explicitly use machine_is() for each fixup.
- Factor out MPC8610HPCD quirks to fsl_uli1575, and protect them with machine_is(). One step closer to multiplatform kernels.
- Actually use fsl_uli1575 on MPC8610HPCD, so RTC quirk will be applied.
- RTC quirk applies to all boards though, so no machine_is() checks.

---
 arch/powerpc/platforms/85xx/mpc85xx_ds.c   |    2 -
 arch/powerpc/platforms/86xx/Kconfig        |    1 +
 arch/powerpc/platforms/86xx/mpc8610_hpcd.c |   87 ---------------------
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    2 -
 arch/powerpc/platforms/fsl_uli1575.c       |  115 ++++++++++++++++++++++++++--
 5 files changed, 108 insertions(+), 99 deletions(-)
arch/powerpc/platforms/85xx/mpc85xx_ds.c +0 -2
index b010dc9..f21e7a6 100644
@@ -115,7 +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);
 
@@ -161,7 +160,6 @@ static void __init mpc85xx_ds_setup_arch(void)
 		}
 	}
 
-	uses_fsl_uli_m1575 = 1;
 	ppc_md.pci_exclude_device = mpc85xx_exclude_device;
 #endif
 
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 +0 -87

93 lines not on this page · raw message

arch/powerpc/platforms/86xx/mpc86xx_hpcn.c +0 -2
index f13704a..22ce0f3 100644
@@ -107,7 +107,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);
 
@@ -149,7 +148,6 @@ mpc86xx_hpcn_setup_arch(void)
 			fsl_add_bridge(np, 0);
 	}
 
-	uses_fsl_uli_m1575 = 1;
 	ppc_md.pci_exclude_device = mpc86xx_exclude_device;
 
 #endif
arch/powerpc/platforms/fsl_uli1575.c +107 -8

156 lines not on this page · raw message

Signature · 1 line
1.5.5.4
#4 lore raw

PATCH 3/4 powerpc: rtc_cmos_setup: assign interrupts only if there is i8259 PIC

In reply to Anton Vorontsov

i8259 PIC is disabled on MPC8610HPCD boards, thus currently rtc-cmos driver fails to probe.

To fix the issue, we lookup the device tree for "chrp,iic" and "pnpPNP,000" compatible devices, and if not found we do not assign RTC IRQ and assuming that i8259 was disabled.

Though this patch fixes RTC on some boards (and surely should not break any other), the whole approach is still broken. We can't easily fix this though, because old device trees do not specify i8259 interrupts for the cmos rtc node.

---
 arch/powerpc/sysdev/rtc_cmos_setup.c |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)
arch/powerpc/sysdev/rtc_cmos_setup.c +17 -6
index c09ddc0..c1879eb 100644
@@ -21,6 +21,7 @@ static int  __init add_rtc(void)
 	struct device_node *np;
 	struct platform_device *pd;
 	struct resource res[2];
+	unsigned int num_res = 1;
 	int ret;
 
 	memset(&res, 0, sizeof(res));
@@ -41,14 +42,24 @@ static int  __init add_rtc(void)
 	if (res[0].start != RTC_PORT(0))
 		return -EINVAL;
 
-	/* Use a fixed interrupt value of 8 since on PPC if we are using this
-	 * its off an i8259 which we ensure has interrupt numbers 0..15. */
-	res[1].start = 8;
-	res[1].end = 8;
-	res[1].flags = IORESOURCE_IRQ;
+	np = of_find_compatible_node(NULL, NULL, "chrp,iic");
+	if (!np)
+		np = of_find_compatible_node(NULL, NULL, "pnpPNP,000");
+	if (np) {
+		of_node_put(np);
+		/*
+		 * Use a fixed interrupt value of 8 since on PPC if we are
+		 * using this its off an i8259 which we ensure has interrupt
+		 * numbers 0..15.
+		 */
+		res[1].start = 8;
+		res[1].end = 8;
+		res[1].flags = IORESOURCE_IRQ;
+		num_res++;
+	}
 
 	pd = platform_device_register_simple("rtc_cmos", -1,
-					     &res[0], 2);
+					     &res[0], num_res);
 
 	if (IS_ERR(pd))
 		return PTR_ERR(pd);
Signature · 1 line
1.5.5.4
#6 lore raw

PATCH 4/4 powerpc/86xx: mpc8610_hpcd: add support for ULI RTC

In reply to 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.

i8259 is disabled on the MPC8610HPCD, and other peripherals are not traced out. So we use only RTC.

---
 arch/powerpc/boot/dts/mpc8610_hpcd.dts      |   14 +++++++
 arch/powerpc/configs/mpc8610_hpcd_defconfig |   51 ++++++++++++++++++++++++--
 2 files changed, 61 insertions(+), 4 deletions(-)
arch/powerpc/boot/dts/mpc8610_hpcd.dts +14 -0
index 65a5f64..c4507cd 100644
@@ -388,6 +388,20 @@
 					  0x01000000 0x0 0x00000000
 					  0x01000000 0x0 0x00000000
 					  0x0 0x00100000>;
+
+				isa@1e {
+					device_type = "isa";
+					#size-cells = <1>;
+					#address-cells = <2>;
+					reg = <0xf000 0 0 0 0>;
+					ranges = <1 0 0x01000000 0 0
+						  0x00001000>;
+
+					rtc@70 {
+						compatible = "pnpPNP,b00";
+						reg = <1 0x70 2>;
+					};
+				};
 			};
 		};
 	};
arch/powerpc/configs/mpc8610_hpcd_defconfig +47 -4

66 lines not on this page · raw message

Signature · 1 line
1.5.5.4
Applied
#2 lore raw

Re: [PATCH 1/4] powerpc: fsl_uli1575: fix RTC quirk to work on MPC8572DS and MPC8610HPCD

In reply to Anton Vorontsov
Quoted 11 lines · Anton Vorontsov

This patch fixes RTC on MPC8572DS boards: dummy read helps only when reading at the end of the bridge's memory (i.e. outside of behind the bridge devices' assigned regions).

With this change the quirk also makes RTC work on MPC8610HPCD, so it's unlikely that this will break MPC8641HPCN or MPC8544DS boards.

---
arch/powerpc/platforms/fsl_uli1575.c | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)

applied.

- k

Applied
#7 lore raw

Re: [PATCH 4/4] powerpc/86xx: mpc8610_hpcd: add support for ULI RTC

In reply to Anton Vorontsov
Quoted 7 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.

i8259 is disabled on the MPC8610HPCD, and other peripherals are not traced out. So we use only RTC.

Quoted 6 lines

---

arch/powerpc/boot/dts/mpc8610_hpcd.dts      |   14 +++++++
arch/powerpc/configs/mpc8610_hpcd_defconfig |   51 ++++++++++++++++++ 
++++++--
2 files changed, 61 insertions(+), 4 deletions(-)

applied.

- k

Applied
#5 lore raw

Re: [PATCH 3/4] powerpc: rtc_cmos_setup: assign interrupts only if there is i8259 PIC

In reply to Anton Vorontsov
Quoted 12 lines · Anton Vorontsov

i8259 PIC is disabled on MPC8610HPCD boards, thus currently rtc-cmos driver fails to probe.

To fix the issue, we lookup the device tree for "chrp,iic" and "pnpPNP,000" compatible devices, and if not found we do not assign RTC IRQ and assuming that i8259 was disabled.

Though this patch fixes RTC on some boards (and surely should not break any other), the whole approach is still broken. We can't easily fix this though, because old device trees do not specify i8259 interrupts for the cmos rtc node.

Quoted 4 lines

---
arch/powerpc/sysdev/rtc_cmos_setup.c | 23 +++++++++++++++++------

1 files changed, 17 insertions(+), 6 deletions(-)

applied.

- k