* [PATCH 1/3] phy/micrel: Implement support for KSZ8021 @ 2012-09-21 2:46 Marek Vasut 2012-09-21 2:46 ` [PATCH 2/3] phy/micrel: Rename KS80xx to KSZ80xx Marek Vasut 2012-09-21 2:46 ` [PATCH 3/3] phy/micrel: Add missing header to micrel_phy.h Marek Vasut 0 siblings, 2 replies; 3+ messages in thread From: Marek Vasut @ 2012-09-21 2:46 UTC (permalink / raw) To: netdev Cc: Marek Vasut, David J. Choi, David S. Miller, Nobuhiro Iwamatsu, Fabio Estevam, Shawn Guo The KSZ8021 PHY was previously caught by KS8051, which is not correct. This PHY needs additional setup if it is strapped for address 0. In such case an reserved bit must be written in the 0x16, "Operation Mode Strap Override" register. According to the KS8051 datasheet, that bit means "PHY Address 0 in non-broadcast" and it indeed behaves as such on KSZ8021. The issue where the ethernet controller (Freescale FEC) did not communicate with network is fixed by writing this bit as 1. Signed-off-by: Marek Vasut <marex@denx.de> Cc: David J. Choi <david.choi@micrel.com> Cc: David S. Miller <davem@davemloft.net> Cc: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com> Cc: Fabio Estevam <fabio.estevam@freescale.com> Cc: Shawn Guo <shawn.guo@linaro.org> --- drivers/net/phy/micrel.c | 26 ++++++++++++++++++++++++++ include/linux/micrel_phy.h | 1 + 2 files changed, 27 insertions(+) diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index cf287e0..200fbc8 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -21,6 +21,12 @@ #include <linux/phy.h> #include <linux/micrel_phy.h> +/* Operation Mode Strap Override */ +#define MII_KSZPHY_OMSO 0x16 +#define KSZPHY_OMSO_B_CAST_OFF (1 << 9) +#define KSZPHY_OMSO_RMII_OVERRIDE (1 << 1) +#define KSZPHY_OMSO_MII_OVERRIDE (1 << 0) + /* general Interrupt control/status reg in vendor specific block. */ #define MII_KSZPHY_INTCS 0x1B #define KSZPHY_INTCS_JABBER (1 << 15) @@ -101,6 +107,13 @@ static int kszphy_config_init(struct phy_device *phydev) return 0; } +static int ksz8021_config_init(struct phy_device *phydev) +{ + phy_write(phydev, MII_KSZPHY_OMSO, + KSZPHY_OMSO_B_CAST_OFF | KSZPHY_OMSO_RMII_OVERRIDE); + return 0; +} + static int ks8051_config_init(struct phy_device *phydev) { int regval; @@ -128,6 +141,19 @@ static struct phy_driver ksphy_driver[] = { .config_intr = ks8737_config_intr, .driver = { .owner = THIS_MODULE,}, }, { + .phy_id = PHY_ID_KSZ8021, + .phy_id_mask = 0x00ffffff, + .name = "Micrel KSZ8021", + .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause + | SUPPORTED_Asym_Pause), + .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, + .config_init = ksz8021_config_init, + .config_aneg = genphy_config_aneg, + .read_status = genphy_read_status, + .ack_interrupt = kszphy_ack_interrupt, + .config_intr = kszphy_config_intr, + .driver = { .owner = THIS_MODULE,}, +}, { .phy_id = PHY_ID_KS8041, .phy_id_mask = 0x00fffff0, .name = "Micrel KS8041", diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h index 61f0905..be7f366 100644 --- a/include/linux/micrel_phy.h +++ b/include/linux/micrel_phy.h @@ -5,6 +5,7 @@ #define PHY_ID_KSZ9021 0x00221610 #define PHY_ID_KS8737 0x00221720 +#define PHY_ID_KSZ8021 0x00221555 #define PHY_ID_KS8041 0x00221510 #define PHY_ID_KS8051 0x00221550 /* both for ks8001 Rev. A/B, and for ks8721 Rev 3. */ -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/3] phy/micrel: Rename KS80xx to KSZ80xx 2012-09-21 2:46 [PATCH 1/3] phy/micrel: Implement support for KSZ8021 Marek Vasut @ 2012-09-21 2:46 ` Marek Vasut 2012-09-21 2:46 ` [PATCH 3/3] phy/micrel: Add missing header to micrel_phy.h Marek Vasut 1 sibling, 0 replies; 3+ messages in thread From: Marek Vasut @ 2012-09-21 2:46 UTC (permalink / raw) To: netdev Cc: Marek Vasut, David J. Choi, David S. Miller, Nobuhiro Iwamatsu, Linux ARM kernel, Fabio Estevam, Shawn Guo There is no such part as KS8001, KS8041 or KS8051. There are only KSZ8001, KSZ8041 and KSZ8051. Rename these parts as such to match the Micrel naming. Signed-off-by: Marek Vasut <marex@denx.de> Cc: David J. Choi <david.choi@micrel.com> Cc: David S. Miller <davem@davemloft.net> Cc: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com> Cc: Linux ARM kernel <linux-arm-kernel@lists.infradead.org> Cc: Fabio Estevam <fabio.estevam@freescale.com> Cc: Shawn Guo <shawn.guo@linaro.org> --- arch/arm/mach-mxs/mach-mxs.c | 2 +- drivers/net/phy/micrel.c | 18 +++++++++--------- include/linux/micrel_phy.h | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) NOTE: This affect one board in Linux ARM, but the change is very minor it should not cause merge conflict, so if this could go through net, that would be for the best. diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c index 3f29a52..fc9c8d5 100644 --- a/arch/arm/mach-mxs/mach-mxs.c +++ b/arch/arm/mach-mxs/mach-mxs.c @@ -295,7 +295,7 @@ static void __init apx4devkit_init(void) enable_clk_enet_out(); if (IS_BUILTIN(CONFIG_PHYLIB)) - phy_register_fixup_for_uid(PHY_ID_KS8051, MICREL_PHY_ID_MASK, + phy_register_fixup_for_uid(PHY_ID_KSZ8051, MICREL_PHY_ID_MASK, apx4devkit_phy_fixup); mxsfb_pdata.mode_list = apx4devkit_video_modes; diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index 200fbc8..f9c9146 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -154,9 +154,9 @@ static struct phy_driver ksphy_driver[] = { .config_intr = kszphy_config_intr, .driver = { .owner = THIS_MODULE,}, }, { - .phy_id = PHY_ID_KS8041, + .phy_id = PHY_ID_KSZ8041, .phy_id_mask = 0x00fffff0, - .name = "Micrel KS8041", + .name = "Micrel KSZ8041", .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause | SUPPORTED_Asym_Pause), .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, @@ -167,9 +167,9 @@ static struct phy_driver ksphy_driver[] = { .config_intr = kszphy_config_intr, .driver = { .owner = THIS_MODULE,}, }, { - .phy_id = PHY_ID_KS8051, + .phy_id = PHY_ID_KSZ8051, .phy_id_mask = 0x00fffff0, - .name = "Micrel KS8051", + .name = "Micrel KSZ8051", .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause | SUPPORTED_Asym_Pause), .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, @@ -180,8 +180,8 @@ static struct phy_driver ksphy_driver[] = { .config_intr = kszphy_config_intr, .driver = { .owner = THIS_MODULE,}, }, { - .phy_id = PHY_ID_KS8001, - .name = "Micrel KS8001 or KS8721", + .phy_id = PHY_ID_KSZ8001, + .name = "Micrel KSZ8001 or KS8721", .phy_id_mask = 0x00ffffff, .features = (PHY_BASIC_FEATURES | SUPPORTED_Pause), .flags = PHY_HAS_MAGICANEG | PHY_HAS_INTERRUPT, @@ -227,10 +227,10 @@ MODULE_LICENSE("GPL"); static struct mdio_device_id __maybe_unused micrel_tbl[] = { { PHY_ID_KSZ9021, 0x000ffffe }, - { PHY_ID_KS8001, 0x00ffffff }, + { PHY_ID_KSZ8001, 0x00ffffff }, { PHY_ID_KS8737, 0x00fffff0 }, - { PHY_ID_KS8041, 0x00fffff0 }, - { PHY_ID_KS8051, 0x00fffff0 }, + { PHY_ID_KSZ8041, 0x00fffff0 }, + { PHY_ID_KSZ8051, 0x00fffff0 }, { } }; diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h index be7f366..d02355d 100644 --- a/include/linux/micrel_phy.h +++ b/include/linux/micrel_phy.h @@ -6,10 +6,10 @@ #define PHY_ID_KSZ9021 0x00221610 #define PHY_ID_KS8737 0x00221720 #define PHY_ID_KSZ8021 0x00221555 -#define PHY_ID_KS8041 0x00221510 -#define PHY_ID_KS8051 0x00221550 +#define PHY_ID_KSZ8041 0x00221510 +#define PHY_ID_KSZ8051 0x00221550 /* both for ks8001 Rev. A/B, and for ks8721 Rev 3. */ -#define PHY_ID_KS8001 0x0022161A +#define PHY_ID_KSZ8001 0x0022161A /* struct phy_device dev_flags definitions */ #define MICREL_PHY_50MHZ_CLK 0x00000001 -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 3/3] phy/micrel: Add missing header to micrel_phy.h 2012-09-21 2:46 [PATCH 1/3] phy/micrel: Implement support for KSZ8021 Marek Vasut 2012-09-21 2:46 ` [PATCH 2/3] phy/micrel: Rename KS80xx to KSZ80xx Marek Vasut @ 2012-09-21 2:46 ` Marek Vasut 1 sibling, 0 replies; 3+ messages in thread From: Marek Vasut @ 2012-09-21 2:46 UTC (permalink / raw) To: netdev Cc: Marek Vasut, David J. Choi, David S. Miller, Nobuhiro Iwamatsu, Fabio Estevam, Shawn Guo The license header was missing in micrel_phy.h . This patch adds one. Signed-off-by: Marek Vasut <marex@denx.de> Cc: David J. Choi <david.choi@micrel.com> Cc: David S. Miller <davem@davemloft.net> Cc: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com> Cc: Fabio Estevam <fabio.estevam@freescale.com> Cc: Shawn Guo <shawn.guo@linaro.org> --- include/linux/micrel_phy.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) NOTE: I'd like to have ACK on this from the original author of the file, as this now says it's GPL2+. diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h index d02355d..de20120 100644 --- a/include/linux/micrel_phy.h +++ b/include/linux/micrel_phy.h @@ -1,3 +1,15 @@ +/* + * include/linux/micrel_phy.h + * + * Micrel PHY IDs + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + */ + #ifndef _MICREL_PHY_H #define _MICREL_PHY_H -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-09-21 2:46 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-09-21 2:46 [PATCH 1/3] phy/micrel: Implement support for KSZ8021 Marek Vasut 2012-09-21 2:46 ` [PATCH 2/3] phy/micrel: Rename KS80xx to KSZ80xx Marek Vasut 2012-09-21 2:46 ` [PATCH 3/3] phy/micrel: Add missing header to micrel_phy.h Marek Vasut
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).