/[linux-patches]/genpatches-2.6/tags/2.6.12-12/4120_sungem-imacg5.patch
Gentoo

Contents of /genpatches-2.6/tags/2.6.12-12/4120_sungem-imacg5.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 137 - (show annotations) (download)
Tue Aug 9 21:23:12 2005 UTC (12 years, 11 months ago) by dsd
File size: 4547 byte(s)
2.6.12-12 release
1 From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2 Date: Fri, 8 Jul 2005 00:56:09 +0000 (-0700)
3 Subject: [PATCH] ppc64: Add new PHY to sungem
4 X-Git-Tag: v2.6.13-rc3
5 X-Git-Url: http://www.kernel.org/git/gitweb.cgi?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=3c326fe9cb7ae022f7589a6f5781e49ceab82e64
6
7 [PATCH] ppc64: Add new PHY to sungem
8
9 This patch adds support for some new PHY models to sungem as used on some
10 recent Apple iMac G5 models.
11
12 Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
13 Signed-off-by: Andrew Morton <akpm@osdl.org>
14 Signed-off-by: Linus Torvalds <torvalds@osdl.org>
15 ---
16
17 --- a/drivers/net/sungem.c
18 +++ b/drivers/net/sungem.c
19 @@ -3079,7 +3079,9 @@ static int __devinit gem_init_one(struct
20 gp->phy_mii.dev = dev;
21 gp->phy_mii.mdio_read = _phy_read;
22 gp->phy_mii.mdio_write = _phy_write;
23 -
24 +#ifdef CONFIG_PPC_PMAC
25 + gp->phy_mii.platform_data = gp->of_node;
26 +#endif
27 /* By default, we start with autoneg */
28 gp->want_autoneg = 1;
29
30 --- a/drivers/net/sungem_phy.c
31 +++ b/drivers/net/sungem_phy.c
32 @@ -32,6 +32,10 @@
33 #include <linux/ethtool.h>
34 #include <linux/delay.h>
35
36 +#ifdef CONFIG_PPC_PMAC
37 +#include <asm/prom.h>
38 +#endif
39 +
40 #include "sungem_phy.h"
41
42 /* Link modes of the BCM5400 PHY */
43 @@ -281,10 +285,12 @@ static int bcm5411_suspend(struct mii_ph
44 static int bcm5421_init(struct mii_phy* phy)
45 {
46 u16 data;
47 - int rev;
48 + unsigned int id;
49
50 - rev = phy_read(phy, MII_PHYSID2) & 0x000f;
51 - if (rev == 0) {
52 + id = (phy_read(phy, MII_PHYSID1) << 16 | phy_read(phy, MII_PHYSID2));
53 +
54 + /* Revision 0 of 5421 needs some fixups */
55 + if (id == 0x002060e0) {
56 /* This is borrowed from MacOS
57 */
58 phy_write(phy, 0x18, 0x1007);
59 @@ -297,21 +303,28 @@ static int bcm5421_init(struct mii_phy*
60 data = phy_read(phy, 0x15);
61 phy_write(phy, 0x15, data | 0x0200);
62 }
63 -#if 0
64 - /* This has to be verified before I enable it */
65 - /* Enable automatic low-power */
66 - phy_write(phy, 0x1c, 0x9002);
67 - phy_write(phy, 0x1c, 0xa821);
68 - phy_write(phy, 0x1c, 0x941d);
69 -#endif
70 - return 0;
71 -}
72
73 -static int bcm5421k2_init(struct mii_phy* phy)
74 -{
75 - /* Init code borrowed from OF */
76 - phy_write(phy, 4, 0x01e1);
77 - phy_write(phy, 9, 0x0300);
78 + /* Pick up some init code from OF for K2 version */
79 + if ((id & 0xfffffff0) == 0x002062e0) {
80 + phy_write(phy, 4, 0x01e1);
81 + phy_write(phy, 9, 0x0300);
82 + }
83 +
84 + /* Check if we can enable automatic low power */
85 +#ifdef CONFIG_PPC_PMAC
86 + if (phy->platform_data) {
87 + struct device_node *np = of_get_parent(phy->platform_data);
88 + int can_low_power = 1;
89 + if (np == NULL || get_property(np, "no-autolowpower", NULL))
90 + can_low_power = 0;
91 + if (can_low_power) {
92 + /* Enable automatic low-power */
93 + phy_write(phy, 0x1c, 0x9002);
94 + phy_write(phy, 0x1c, 0xa821);
95 + phy_write(phy, 0x1c, 0x941d);
96 + }
97 + }
98 +#endif /* CONFIG_PPC_PMAC */
99
100 return 0;
101 }
102 @@ -762,7 +775,7 @@ static struct mii_phy_def bcm5421_phy_de
103
104 /* Broadcom BCM 5421 built-in K2 */
105 static struct mii_phy_ops bcm5421k2_phy_ops = {
106 - .init = bcm5421k2_init,
107 + .init = bcm5421_init,
108 .suspend = bcm5411_suspend,
109 .setup_aneg = bcm54xx_setup_aneg,
110 .setup_forced = bcm54xx_setup_forced,
111 @@ -779,6 +792,25 @@ static struct mii_phy_def bcm5421k2_phy_
112 .ops = &bcm5421k2_phy_ops
113 };
114
115 +/* Broadcom BCM 5462 built-in Vesta */
116 +static struct mii_phy_ops bcm5462V_phy_ops = {
117 + .init = bcm5421_init,
118 + .suspend = bcm5411_suspend,
119 + .setup_aneg = bcm54xx_setup_aneg,
120 + .setup_forced = bcm54xx_setup_forced,
121 + .poll_link = genmii_poll_link,
122 + .read_link = bcm54xx_read_link,
123 +};
124 +
125 +static struct mii_phy_def bcm5462V_phy_def = {
126 + .phy_id = 0x002060d0,
127 + .phy_id_mask = 0xfffffff0,
128 + .name = "BCM5462-Vesta",
129 + .features = MII_GBIT_FEATURES,
130 + .magic_aneg = 1,
131 + .ops = &bcm5462V_phy_ops
132 +};
133 +
134 /* Marvell 88E1101 (Apple seem to deal with 2 different revs,
135 * I masked out the 8 last bits to get both, but some specs
136 * would be useful here) --BenH.
137 @@ -824,6 +856,7 @@ static struct mii_phy_def* mii_phy_table
138 &bcm5411_phy_def,
139 &bcm5421_phy_def,
140 &bcm5421k2_phy_def,
141 + &bcm5462V_phy_def,
142 &marvell_phy_def,
143 &genmii_phy_def,
144 NULL
145 --- a/drivers/net/sungem_phy.h
146 +++ b/drivers/net/sungem_phy.h
147 @@ -43,9 +43,10 @@ struct mii_phy
148 int pause;
149
150 /* Provided by host chip */
151 - struct net_device* dev;
152 + struct net_device *dev;
153 int (*mdio_read) (struct net_device *dev, int mii_id, int reg);
154 void (*mdio_write) (struct net_device *dev, int mii_id, int reg, int val);
155 + void *platform_data;
156 };
157
158 /* Pass in a struct mii_phy with dev, mdio_read and mdio_write

  ViewVC Help
Powered by ViewVC 1.1.20