Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

phy/micrel: add ability to support 50MHz RMII clock on KZS8051RNL

Platform code can now set the MICREL_PHY_50MHZ_CLK bit of dev_flags in a fixup
routine (registered with phy_register_fixup_for_uid()), to make the KZS8051RNL
PHY work with 50MHz RMII reference clock.

Cc: David J. Choi <david.choi@micrel.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Baruch Siach and committed by
David S. Miller
d606ef3f 68aa3fd5

+32 -8
+16 -8
drivers/net/phy/micrel.c
··· 19 19 #include <linux/kernel.h> 20 20 #include <linux/module.h> 21 21 #include <linux/phy.h> 22 - 23 - #define PHY_ID_KSZ9021 0x00221611 24 - #define PHY_ID_KS8737 0x00221720 25 - #define PHY_ID_KS8041 0x00221510 26 - #define PHY_ID_KS8051 0x00221550 27 - /* both for ks8001 Rev. A/B, and for ks8721 Rev 3. */ 28 - #define PHY_ID_KS8001 0x0022161A 22 + #include <linux/micrel_phy.h> 29 23 30 24 /* general Interrupt control/status reg in vendor specific block. */ 31 25 #define MII_KSZPHY_INTCS 0x1B ··· 40 46 #define KSZPHY_CTRL_INT_ACTIVE_HIGH (1 << 9) 41 47 #define KSZ9021_CTRL_INT_ACTIVE_HIGH (1 << 14) 42 48 #define KS8737_CTRL_INT_ACTIVE_HIGH (1 << 14) 49 + #define KSZ8051_RMII_50MHZ_CLK (1 << 7) 43 50 44 51 static int kszphy_ack_interrupt(struct phy_device *phydev) 45 52 { ··· 101 106 return 0; 102 107 } 103 108 109 + static int ks8051_config_init(struct phy_device *phydev) 110 + { 111 + int regval; 112 + 113 + if (phydev->dev_flags & MICREL_PHY_50MHZ_CLK) { 114 + regval = phy_read(phydev, MII_KSZPHY_CTRL); 115 + regval |= KSZ8051_RMII_50MHZ_CLK; 116 + phy_write(phydev, MII_KSZPHY_CTRL, regval); 117 + } 118 + 119 + return 0; 120 + } 121 + 104 122 static struct phy_driver ks8737_driver = { 105 123 .phy_id = PHY_ID_KS8737, 106 124 .phy_id_mask = 0x00fffff0, ··· 150 142 .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause 151 143 | SUPPORTED_Asym_Pause), 152 144 .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, 153 - .config_init = kszphy_config_init, 145 + .config_init = ks8051_config_init, 154 146 .config_aneg = genphy_config_aneg, 155 147 .read_status = genphy_read_status, 156 148 .ack_interrupt = kszphy_ack_interrupt,
+16
include/linux/micrel_phy.h
··· 1 + #ifndef _MICREL_PHY_H 2 + #define _MICREL_PHY_H 3 + 4 + #define MICREL_PHY_ID_MASK 0x00fffff0 5 + 6 + #define PHY_ID_KSZ9021 0x00221611 7 + #define PHY_ID_KS8737 0x00221720 8 + #define PHY_ID_KS8041 0x00221510 9 + #define PHY_ID_KS8051 0x00221550 10 + /* both for ks8001 Rev. A/B, and for ks8721 Rev 3. */ 11 + #define PHY_ID_KS8001 0x0022161A 12 + 13 + /* struct phy_device dev_flags definitions */ 14 + #define MICREL_PHY_50MHZ_CLK 0x00000001 15 + 16 + #endif /* _MICREL_PHY_H */