kernel_optimize_test/drivers/net/phy
David Daney cf41a51db8 of/phylib: Use device tree properties to initialize Marvell PHYs.
Some aspects of PHY initialization are board dependent, things like
indicator LED connections and some clocking modes cannot be determined
by probing.  The dev_flags element of struct phy_device can be used to
control these things if an appropriate value can be passed from the
Ethernet driver.  We run into problems however if the PHY connections
are specified by the device tree.  There is no way for the Ethernet
driver to know what flags it should pass.

If we are using the device tree, the struct phy_device will be
populated with the device tree node corresponding to the PHY, and we
can extract extra configuration information from there.

The next question is what should the format of that information be?
It is highly device specific, and the device tree representation
should not be tied to any arbitrary kernel defined constants.  A
straight forward representation is just to specify the exact bits that
should be set using the "marvell,reg-init" property:

      phy5: ethernet-phy@5 {
        reg = <5>;
        compatible = "marvell,88e1149r";
        marvell,reg-init =
                /* led[0]:1000, led[1]:100, led[2]:10, led[3]:tx */
                <3 0x10 0 0x5777>, /* Reg 3,16 <- 0x5777 */
                /* mix %:0, led[0123]:drive low off hiZ */
                <3 0x11 0 0x00aa>, /* Reg 3,17 <- 0x00aa */
                /* default blink periods. */
                <3 0x12 0 0x4105>, /* Reg 3,18 <- 0x4105 */
                /* led[4]:rx, led[5]:dplx, led[45]:drive low off hiZ */
                <3 0x13 0 0x0a60>; /* Reg 3,19 <- 0x0a60 */
      };

      phy6: ethernet-phy@6 {
        reg = <6>;
        compatible = "marvell,88e1118";
        marvell,reg-init =
                /* Fix rx and tx clock transition timing */
                <2 0x15 0xffcf 0>, /* Reg 2,21 Clear bits 4, 5 */
                /* Adjust LED drive. */
                <3 0x11 0 0x442a>, /* Reg 3,17 <- 0442a */
                /* irq, blink-activity, blink-link */
                <3 0x10 0 0x0242>; /* Reg 3,16 <- 0x0242 */
      };

The Marvell PHYs have a page select register at register 22 (0x16), we
can specify any register by its page and register number.  These are
the first and second word.  The third word contains a mask to be ANDed
with the existing register value, and the fourth word is ORed with the
result to yield the new register value.  The new marvell_of_reg_init
function leaves the page select register unchanged, so a call to it
can be dropped into the .config_init functions without unduly
affecting the state of the PHY.

If CONFIG_OF_MDIO is not set, there is no of_node, or no
"marvell,reg-init" property, the PHY initialization is unchanged.

Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Cyril Chemparathy <cyril@ti.com>
Cc: David Daney <ddaney@caviumnetworks.com>
Cc: Arnaud Patard <arnaud.patard@rtp-net.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-11-22 08:34:23 -08:00
..
bcm63xx.c net/phy: fix many "defined but unused" warnings 2010-10-05 00:34:29 -07:00
broadcom.c net/phy: fix many "defined but unused" warnings 2010-10-05 00:34:29 -07:00
cicada.c net/phy: fix many "defined but unused" warnings 2010-10-05 00:34:29 -07:00
davicom.c net/phy: fix many "defined but unused" warnings 2010-10-05 00:34:29 -07:00
et1011c.c net/phy: fix many "defined but unused" warnings 2010-10-05 00:34:29 -07:00
fixed.c
icplus.c net/phy: fix many "defined but unused" warnings 2010-10-05 00:34:29 -07:00
Kconfig don't let BCM63XX_PHY depend on non-existant symbol 2010-10-05 00:34:30 -07:00
lxt.c net/phy: fix many "defined but unused" warnings 2010-10-05 00:34:29 -07:00
Makefile drivers/net/phy: micrel phy driver 2010-05-03 15:43:26 -07:00
marvell.c of/phylib: Use device tree properties to initialize Marvell PHYs. 2010-11-22 08:34:23 -08:00
mdio_bus.c phylib: fix PAL state machine restart on resume 2010-09-14 14:31:03 -07:00
mdio-bitbang.c Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 2010-04-11 14:53:53 -07:00
mdio-gpio.c of/device: Replace struct of_device with struct platform_device 2010-08-06 09:25:50 -06:00
mdio-octeon.c netdev: mdio-octeon: Fix section mismatch errors. 2010-06-28 23:58:54 -07:00
micrel.c net/phy: fix many "defined but unused" warnings 2010-10-05 00:34:29 -07:00
national.c net/phy: fix many "defined but unused" warnings 2010-10-05 00:34:29 -07:00
phy_device.c phylib: make local function static 2010-10-24 15:07:11 -07:00
phy.c phylib: make local function static 2010-10-24 15:07:11 -07:00
qsemi.c net/phy: fix many "defined but unused" warnings 2010-10-05 00:34:29 -07:00
realtek.c net/phy: fix many "defined but unused" warnings 2010-10-05 00:34:29 -07:00
smsc.c net/phy: fix many "defined but unused" warnings 2010-10-05 00:34:29 -07:00
ste10Xp.c net/phy: fix many "defined but unused" warnings 2010-10-05 00:34:29 -07:00
vitesse.c net/phy: fix many "defined but unused" warnings 2010-10-05 00:34:29 -07:00