Skip to contentSkip to conversation

ppc32: Support for new Apple laptop models

PATCH In review Benjamin Herrenschmidt 2 participants 5 messages Jun 22, 2004 – Jun 23, 2004

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

PATCH 1/1 ppc32: Support for new Apple laptop models

Hi !

This patch adds support for newer Apple laptop models. It adds the basic identification for the new motherboards and the cpufreq support for models using the new 7447A CPU from Motorola.

This is mostly the work of John Steele Scott <[email protected]> with some bits from Sebastian Henschel <[email protected]> and some rework by myself. Please apply,

arch/ppc/kernel/misc.S +18 -0
diff -Nru a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S
@@ -253,6 +253,24 @@
 	mtmsr	r7
 	blr
 
+_GLOBAL(low_choose_7447a_dfs)
+	/* Clear MSR:EE */
+	mfmsr	r7
+	rlwinm	r0,r7,0,17,15
+	mtmsr	r0
+	
+	/* Calc new HID1 value */
+	mfspr	r4,SPRN_HID1
+	insrwi	r4,r3,1,9	/* insert parameter into bit 9 */
+	sync
+	mtspr	SPRN_HID1,r4
+	sync
+	isync
+
+	/* Return */
+	mtmsr	r7
+	blr
+
 #endif /* CONFIG_CPU_FREQ_PMAC && CONFIG_6xx */
 
 /* void local_save_flags_ptr(unsigned long *flags) */
arch/ppc/platforms/pmac_cpufreq.c +193 -118

413 lines not on this page · raw message

arch/ppc/platforms/pmac_feature.c +32 -0
diff -Nru a/arch/ppc/platforms/pmac_feature.c b/arch/ppc/platforms/pmac_feature.c
@@ -1282,6 +1282,25 @@
 	return 0;
 }
 
+static long __pmac
+intrepid_aack_delay_enable(struct device_node* node, long param, long value)
+{
+	unsigned long flags;
+
+    	if (uninorth_rev < 0xd2)
+		return -ENODEV;
+
+	LOCK(flags);
+	if (param)
+		UN_BIS(UNI_N_AACK_DELAY, UNI_N_AACK_DELAY_ENABLE);
+	else
+		UN_BIC(UNI_N_AACK_DELAY, UNI_N_AACK_DELAY_ENABLE);
+	UNLOCK(flags);
+
+    	return 0;
+}
+
+
 #endif /* CONFIG_POWER4 */
 
 static long __pmac
@@ -1914,6 +1933,7 @@
 	{ PMAC_FTR_SLEEP_STATE,		core99_sleep_state },
 	{ PMAC_FTR_READ_GPIO,		core99_read_gpio },
 	{ PMAC_FTR_WRITE_GPIO,		core99_write_gpio },
+	{ PMAC_FTR_AACK_DELAY_ENABLE,	intrepid_aack_delay_enable },
 	{ 0, NULL }
 };
 
@@ -2116,6 +2136,14 @@
 		PMAC_TYPE_UNKNOWN_INTREPID,	intrepid_features,
 		PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
 	},
+	{	"PowerBook5,4",			"PowerBook G4 15\"",
+		PMAC_TYPE_UNKNOWN_INTREPID,	intrepid_features,
+		PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
+	},
+	{	"PowerBook5,5",			"PowerBook G4 17\"",
+		PMAC_TYPE_UNKNOWN_INTREPID,	intrepid_features,
+		PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
+	},
 	{	"PowerBook6,1",			"PowerBook G4 12\"",
 		PMAC_TYPE_UNKNOWN_INTREPID,	intrepid_features,
 		PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
@@ -2125,6 +2153,10 @@
 		PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
 	},
 	{	"PowerBook6,3",			"iBook G4",
+		PMAC_TYPE_UNKNOWN_INTREPID,	intrepid_features,
+		PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
+	},
+	{	"PowerBook6,4",			"PowerBook G4 12\"",
 		PMAC_TYPE_UNKNOWN_INTREPID,	intrepid_features,
 		PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
 	},
include/asm-ppc/pmac_feature.h +6 -0
diff -Nru a/include/asm-ppc/pmac_feature.h b/include/asm-ppc/pmac_feature.h
@@ -273,6 +273,12 @@
  */
 #define PMAC_FTR_ENABLE_MPIC		PMAC_FTR_DEF(19)
 
+/* PMAC_FTR_AACK_DELAY_ENABLE	(NULL, int enable, 0)
+ *
+ * Enable/disable the AACK delay on the northbridge for systems using DFS
+ */
+#define PMAC_FTR_AACK_DELAY_ENABLE     	PMAC_FTR_DEF(20)
+
 
 /* Don't use those directly, they are for the sake of pmac_setup.c */
 extern long pmac_do_feature_call(unsigned int selector, ...);
include/asm-ppc/reg.h +1 -0
diff -Nru a/include/asm-ppc/reg.h b/include/asm-ppc/reg.h
@@ -174,6 +174,7 @@
 
 #define SPRN_HID1	0x3F1		/* Hardware Implementation Register 1 */
 #define HID1_EMCP	(1<<31)		/* 7450 Machine Check Pin Enable */
+#define HID1_DFS	(1<<22)		/* 7447A Dynamic Frequency Scaling */
 #define HID1_PC0	(1<<16)		/* 7450 PLL_CFG[0] */
 #define HID1_PC1	(1<<15)		/* 7450 PLL_CFG[1] */
 #define HID1_PC2	(1<<14)		/* 7450 PLL_CFG[2] */
include/asm-ppc/uninorth.h +6 -0
diff -Nru a/include/asm-ppc/uninorth.h b/include/asm-ppc/uninorth.h
@@ -142,6 +142,12 @@
  */
 #define UNI_N_HWINIT_STATE_CPU1_FLAG	0x10000000
 
+/* This register controls AACK delay, which is set when 2004 iBook/PowerBook
+ * is in low speed mode.
+ */
+#define UNI_N_AACK_DELAY		0x0100
+#define UNI_N_AACK_DELAY_ENABLE		0x00000001
+
 /* Uninorth 1.5 rev. has additional perf. monitor registers at 0xf00-0xf50 */
 
 
#1 lore raw
Quoted 3 lines · Benjamin Herrenschmidt

This patch adds support for newer Apple laptop models. It adds the basic identification for the new motherboards and the cpufreq support for models using the new 7447A CPU from Motorola.

And here's a patch to add sound support for some of the newer PowerBooks. It appears that this chip supports the AWACS sample rates, but has a snapper-style mixer. Tested and works on my PowerBook5,4.

Jesse

===== sound/ppc/pmac.c 1.23 vs edited =====

sound/ppc/pmac.c +7 -0
@@ -931,6 +931,13 @@
 		chip->freq_table = tumbler_freqs;
 		chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */
 	}
+	if (device_is_compatible(sound, "AOAKeylargo")) {
+		/* Seems to support the stock AWACS frequencies, but has
+		   a snapper mixer */
+		chip->model = PMAC_SNAPPER;
+		// chip->can_byte_swap = 0; /* FIXME: check this */
+		chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */
+	}
 	prop = (unsigned int *)get_property(sound, "device-id", 0);
 	if (prop)
 		chip->device_id = *prop;
#2 lore raw
Quoted 10 lines · Jesse Barnes
Quoted 3 lines · Benjamin Herrenschmidt

This patch adds support for newer Apple laptop models. It adds the basic identification for the new motherboards and the cpufreq support for models using the new 7447A CPU from Motorola.

And here's a patch to add sound support for some of the newer PowerBooks. It appears that this chip supports the AWACS sample rates, but has a snapper-style mixer. Tested and works on my PowerBook5,4.

Can you check out in more details the OS X driver ? I think there need to be some i2s tweaking when changing the format and/or the frequency. Doing that right would allow to support 8 & 16 bits properly at least.

Also, don't leave the commented out line, especially with the c++ style comments. If the chip can byteswap, make sure you have proper code to do this, if not, leave can_byteswap to 0, or people will experience all sorts of funny troubles ;)

Ben.

#3 lore raw
Quoted 4 lines · Benjamin Herrenschmidt

Can you check out in more details the OS X driver ? I think there need to be some i2s tweaking when changing the format and/or the frequency. Doing that right would allow to support 8 & 16 bits properly at least.

Sure, do you have an URL for that stuff? I don't want to have to go through any red tape to get access to the Darwin sources...

Quoted 4 lines

Also, don't leave the commented out line, especially with the c++ style comments. If the chip can byteswap, make sure you have proper code to do this, if not, leave can_byteswap to 0, or people will experience all sorts of funny troubles ;)

Sure.

Jesse

#4 lore raw
Quoted 8 lines · Jesse Barnes
Quoted 4 lines · Benjamin Herrenschmidt

Can you check out in more details the OS X driver ? I think there need to be some i2s tweaking when changing the format and/or the frequency. Doing that right would allow to support 8 & 16 bits properly at least.

Sure, do you have an URL for that stuff? I don't want to have to go through any red tape to get access to the Darwin sources...

An AppleID account is enough, or there's opendarwin CVS but that may not be completely up-to-date cs. apple latest versions.

Quoted 8 lines
Quoted 4 lines

Also, don't leave the commented out line, especially with the c++ style comments. If the chip can byteswap, make sure you have proper code to do this, if not, leave can_byteswap to 0, or people will experience all sorts of funny troubles ;)

Sure.

Jesse

Signature · 1 line
Benjamin Herrenschmidt <[email protected]>