sungem on imac G5

Markus Demleitner msdemlei at cl.uni-heidelberg.de
Sat Mar 19 01:24:49 EST 2005


On Fri, Mar 18, 2005 at 12:00:04PM +1100, benh wrote:
> > My problem is that with the 2.6.11.2 kernel, patched with benh's
> > recent patches (the sungem driver has date 
> > 2005-03-10 23:04:36.000000000 +0000), networking on an iMac G5 works
> > like a charm when OF hasn't touched the network card.
> 
> Can you try this patch ?
> 
> Index: linux-work/arch/ppc64/kernel/pmac_feature.c
> ===================================================================
> --- linux-work.orig/arch/ppc64/kernel/pmac_feature.c	2005-03-15 11:56:46.000000000 +1100
> +++ linux-work/arch/ppc64/kernel/pmac_feature.c	2005-03-18 11:20:21.000000000 +1100
> @@ -220,6 +220,34 @@
>  	return 0;
>  }
>  
> +static long __pmac g5_eth_phy_reset(struct device_node* node, long param, long value)
> +{
> +	struct device_node *phy;
> +	int need_reset;
> +	unsigned long flags;
> +
> +	/*
> +	 * We must not reset the combo PHYs, only the BCM5221 found in
> +	 * the iMac G5.
> +	 */
> +	phy = of_get_next_child(node, NULL);
> +	if (!phy)
> +		return -ENODEV;
> +	need_reset = device_is_compatible(phy, "B5221");
> +	of_node_put(phy);
> +	if (!need_reset)
> +		return 0;
> +
> +	/* PHY reset is GPIO 29, not in device-tree unfortunately */
> +	MACIO_OUT8(K2_GPIO_EXTINT_0 + 29,
> +		   KEYLARGO_GPIO_OUTPUT_ENABLE | KEYLARGO_GPIO_OUTOUT_DATA);
> +	/* Thankfully, this is now always called at a time when we can
> +	 * schedule by sungem.
> +	 */
> +	msleep(10);
> +	MACIO_OUT8(K2_GPIO_EXTINT_0 + 29, 0);
> +}
> +
>  #ifdef CONFIG_SMP
>  static long __pmac g5_reset_cpu(struct device_node* node, long param, long value)
>  {
> @@ -306,6 +334,7 @@
>  	{ PMAC_FTR_ENABLE_MPIC,		g5_mpic_enable },
>  	{ PMAC_FTR_READ_GPIO,		g5_read_gpio },
>  	{ PMAC_FTR_WRITE_GPIO,		g5_write_gpio },
> +	{ PMAC_FTR_GMAC_PHY_RESET,	g5_eth_phy_reset },
>  #ifdef CONFIG_SMP
>  	{ PMAC_FTR_RESET_CPU,		g5_reset_cpu },
>  #endif /* CONFIG_SMP */
> 
Yup, that does the trick, thanks a lot.  Hooray, I can netboot the
beast!

Minor issues: 

(a) The patch didn't apply cleanly, I had to fiddle in the second
hunk manually (that one probably doesn't matter at all, I just wanted
to mention it in case of a regression in the code I don't have)

(b) MACIO_OUT8 uses macio, which g5_eth_phy_reset doesn't define.  Fixed
it by adding
	struct macio_chip* macio = &macio_chips[0];
to its local declarations.

(c) There are two warnings remaining that I didn't care to fix (for
now):
arch/ppc64/kernel/pmac_feature.c:227: warning: unused variable `flags'
arch/ppc64/kernel/pmac_feature.c:250: warning: control reaches end of non-void function
(the line numbers are of course for my version)

          Markus

PS: While I'm here, current progress report on thermal control: I'm
prototyping a thermal control driver in userspace python right now,
basically doing PID (though I'm convinced there just has to be a
better control algorithm for this particular problem).  Trouble is
that I have one fan that doesn't seem to have an effect on the
temperatures (harddisk fan?  I don't think I can see the hard disk
temperature, though I have one sensor I cannot interpret at all, plus
there is one sensor OF reads directly through i2c, which may well be
the hard disk one).  I'll rip the machine open soon to see where the
fans are (have been reluctant so far since it isn't my machine).
Good news: The machine switches itself off if it overheats :-)



More information about the Linuxppc64-dev mailing list