patch-2.4.1 linux/arch/ppc/kernel/feature.c

Next file: linux/arch/ppc/kernel/galaxy_pci.c
Previous file: linux/arch/ppc/kernel/error_log.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0/linux/arch/ppc/kernel/feature.c linux/arch/ppc/kernel/feature.c
@@ -238,12 +238,15 @@
 static struct feature_controller*
 feature_lookup_controller(struct device_node *device);
 
+#ifdef CONFIG_PMAC_PBOOK
 static void heathrow_prepare_for_sleep(struct feature_controller* ctrler);
 static void heathrow_wakeup(struct feature_controller* ctrler);
-static void keylargo_init(void);
-static void uninorth_init(void);
 static void core99_prepare_for_sleep(struct feature_controller* ctrler);
 static void core99_wake_up(struct feature_controller* ctrler);
+#endif /* CONFIG_PMAC_PBOOK */
+
+static void keylargo_init(void);
+static void uninorth_init(void);
 
 /* static variables */
 static struct feature_controller	controllers[MAX_FEATURE_CONTROLLERS];
@@ -255,6 +258,10 @@
 static int				uninorth_rev;
 static int				keylargo_rev;
 
+/*
+ * WARNING ! This function is called early in setup_arch, neither the IO base
+ * nor the udelay calibration have been done yet
+ */
 void
 feature_init(void)
 {
@@ -527,14 +534,31 @@
 void 
 feature_set_firewire_power(struct device_node* device, int power)
 {
+	if (!uninorth_base)
+		return;
+	if (power)
+		UN_BIS(UNI_N_CLOCK_CNTL, UNI_N_CLOCK_CNTL_FW);
+	else
+		UN_BIC(UNI_N_CLOCK_CNTL, UNI_N_CLOCK_CNTL_FW);
+	udelay(20);
+}
+
+#ifdef CONFIG_SMP
+void
+feature_core99_kick_cpu1(void)
+{
+	out_8((volatile u8 *)KL_FCR(KL_GPIO_KICK_CPU1), KL_GPIO_KICK_CPU1_UP);
+	udelay(1);
+	out_8((volatile u8 *)KL_FCR(KL_GPIO_KICK_CPU1), KL_GPIO_KICK_CPU1_DOWN);
 }
+#endif /* CONFIG_SMP */
 
 /* Initialize the Core99 UniNorth host bridge and memory controller
  */
 static void
 uninorth_init(void)
 {
-	struct device_node* gmac;
+	struct device_node* gmac, *fw;
 	unsigned long actrl;
 	
 	/* Set the arbitrer QAck delay according to what Apple does
@@ -564,6 +588,11 @@
 	}
 	if (gmac)
 		feature_set_gmac_power(gmac, 0);
+
+	/* Kludge (enable FW before PCI probe) */
+	fw = find_devices("firewire");
+	if (fw && device_is_compatible(fw, "pci106b,18"))
+		feature_set_firewire_power(fw, 1);
 }
 
 /* Initialize the Core99 KeyLargo ASIC. Currently, we just make sure
@@ -576,6 +605,43 @@
 }
 
 #ifdef CONFIG_PMAC_PBOOK
+
+static u32 save_fcr[5];
+static u32 save_mbcr;
+
+static void
+heathrow_prepare_for_sleep(struct feature_controller* ctrler)
+{
+	save_mbcr = in_le32(FREG(ctrler, 0x34));
+	save_fcr[0] = in_le32(FREG(ctrler, 0x38));
+	save_fcr[1] = in_le32(FREG(ctrler, 0x3c));
+
+	out_le32(FREG(ctrler, 0x38), save_fcr[0] & ~HRW_IOBUS_ENABLE);
+}
+
+static void
+heathrow_wakeup(struct feature_controller* ctrler)
+{
+	out_le32(FREG(ctrler, 0x38), save_fcr[0]);
+	out_le32(FREG(ctrler, 0x3c), save_fcr[1]);
+	out_le32(FREG(ctrler, 0x34), save_mbcr);
+	mdelay(1);
+	out_le32(FREG(ctrler, 0x38), save_fcr[0] | HRW_IOBUS_ENABLE);
+	mdelay(1);
+}
+
+static void
+core99_prepare_for_sleep(struct feature_controller* ctrler)
+{
+	/* Not yet implemented */
+}
+
+static void
+core99_wake_up(struct feature_controller* ctrler)
+{
+	/* Not yet implemented */
+}
+
 void
 feature_prepare_for_sleep(void)
 {
@@ -599,7 +665,6 @@
 	}
 }
 
-
 void
 feature_wake_up(void)
 {
@@ -622,39 +687,4 @@
 	}
 }
 
-static u32 save_fcr[5];
-static u32 save_mbcr;
-
-static void
-heathrow_prepare_for_sleep(struct feature_controller* ctrler)
-{
-	save_mbcr = in_le32(FREG(ctrler, 0x34));
-	save_fcr[0] = in_le32(FREG(ctrler, 0x38));
-	save_fcr[1] = in_le32(FREG(ctrler, 0x3c));
-
-	out_le32(FREG(ctrler, 0x38), save_fcr[0] & ~HRW_IOBUS_ENABLE);
-}
-
-static void
-heathrow_wakeup(struct feature_controller* ctrler)
-{
-	out_le32(FREG(ctrler, 0x38), save_fcr[0]);
-	out_le32(FREG(ctrler, 0x3c), save_fcr[1]);
-	out_le32(FREG(ctrler, 0x34), save_mbcr);
-	mdelay(1);
-	out_le32(FREG(ctrler, 0x38), save_fcr[0] | HRW_IOBUS_ENABLE);
-	mdelay(1);
-}
-
-static void
-core99_prepare_for_sleep(struct feature_controller* ctrler)
-{
-	/* Not yet implemented */
-}
-
-static void
-core99_wake_up(struct feature_controller* ctrler)
-{
-	/* Not yet implemented */
-}
 #endif /* CONFIG_PMAC_PBOOK */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)