* [PATCH net-next 0/2] net: phy: add macros for PHYID matching in PHY driver config
@ 2018-11-09 23:37 Heiner Kallweit
2018-11-09 23:39 ` [PATCH net-next 1/2] net: phy: add macros for PHYID matching Heiner Kallweit
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Heiner Kallweit @ 2018-11-09 23:37 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, David Miller; +Cc: netdev@vger.kernel.org
Add macros for PHYID matching to be used in PHY driver configs.
By using these macros some boilerplate code can be avoided.
Use them initially in the Realtek PHY drivers.
Heiner Kallweit (2):
net: phy: add macros for PHYID matching
net: phy: realtek: use new PHYID matching macros
drivers/net/phy/realtek.c | 29 ++++++++++-------------------
include/linux/phy.h | 4 ++++
2 files changed, 14 insertions(+), 19 deletions(-)
--
2.19.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net-next 1/2] net: phy: add macros for PHYID matching
2018-11-09 23:37 [PATCH net-next 0/2] net: phy: add macros for PHYID matching in PHY driver config Heiner Kallweit
@ 2018-11-09 23:39 ` Heiner Kallweit
2018-11-09 23:40 ` [PATCH net-next 2/2] net: phy: realtek: use new PHYID matching macros Heiner Kallweit
2018-11-11 17:44 ` [PATCH net-next 0/2] net: phy: add macros for PHYID matching in PHY driver config David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Heiner Kallweit @ 2018-11-09 23:39 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, David Miller; +Cc: netdev@vger.kernel.org
Add macros for PHYID matching to be used in PHY driver configs.
By using these macros some boilerplate code can be avoided.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
include/linux/phy.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 17d1f6472..03005c65e 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -651,6 +651,10 @@ struct phy_driver {
#define PHY_ANY_ID "MATCH ANY PHY"
#define PHY_ANY_UID 0xffffffff
+#define PHY_ID_MATCH_EXACT(id) .phy_id = (id), .phy_id_mask = GENMASK(31, 0)
+#define PHY_ID_MATCH_MODEL(id) .phy_id = (id), .phy_id_mask = GENMASK(31, 4)
+#define PHY_ID_MATCH_VENDOR(id) .phy_id = (id), .phy_id_mask = GENMASK(31, 10)
+
/* A Structure for boards to register fixups with the PHY Lib */
struct phy_fixup {
struct list_head list;
--
2.19.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net-next 2/2] net: phy: realtek: use new PHYID matching macros
2018-11-09 23:37 [PATCH net-next 0/2] net: phy: add macros for PHYID matching in PHY driver config Heiner Kallweit
2018-11-09 23:39 ` [PATCH net-next 1/2] net: phy: add macros for PHYID matching Heiner Kallweit
@ 2018-11-09 23:40 ` Heiner Kallweit
2018-11-11 17:44 ` [PATCH net-next 0/2] net: phy: add macros for PHYID matching in PHY driver config David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Heiner Kallweit @ 2018-11-09 23:40 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, David Miller; +Cc: netdev@vger.kernel.org
Use new macros for PHYID matching to avoid boilerplate code.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/net/phy/realtek.c | 29 ++++++++++-------------------
1 file changed, 10 insertions(+), 19 deletions(-)
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
index 0f8e5b1c9..c6010fb1a 100644
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -213,14 +213,12 @@ static int rtl8366rb_config_init(struct phy_device *phydev)
static struct phy_driver realtek_drvs[] = {
{
- .phy_id = 0x00008201,
+ PHY_ID_MATCH_EXACT(0x00008201),
.name = "RTL8201CP Ethernet",
- .phy_id_mask = 0x0000ffff,
.features = PHY_BASIC_FEATURES,
}, {
- .phy_id = 0x001cc816,
+ PHY_ID_MATCH_EXACT(0x001cc816),
.name = "RTL8201F Fast Ethernet",
- .phy_id_mask = 0x001fffff,
.features = PHY_BASIC_FEATURES,
.ack_interrupt = &rtl8201_ack_interrupt,
.config_intr = &rtl8201_config_intr,
@@ -229,17 +227,15 @@ static struct phy_driver realtek_drvs[] = {
.read_page = rtl821x_read_page,
.write_page = rtl821x_write_page,
}, {
- .phy_id = 0x001cc910,
+ PHY_ID_MATCH_EXACT(0x001cc910),
.name = "RTL8211 Gigabit Ethernet",
- .phy_id_mask = 0x001fffff,
.features = PHY_GBIT_FEATURES,
.config_aneg = rtl8211_config_aneg,
.read_mmd = &genphy_read_mmd_unsupported,
.write_mmd = &genphy_write_mmd_unsupported,
}, {
- .phy_id = 0x001cc912,
+ PHY_ID_MATCH_EXACT(0x001cc912),
.name = "RTL8211B Gigabit Ethernet",
- .phy_id_mask = 0x001fffff,
.features = PHY_GBIT_FEATURES,
.ack_interrupt = &rtl821x_ack_interrupt,
.config_intr = &rtl8211b_config_intr,
@@ -248,35 +244,31 @@ static struct phy_driver realtek_drvs[] = {
.suspend = rtl8211b_suspend,
.resume = rtl8211b_resume,
}, {
- .phy_id = 0x001cc913,
+ PHY_ID_MATCH_EXACT(0x001cc913),
.name = "RTL8211C Gigabit Ethernet",
- .phy_id_mask = 0x001fffff,
.features = PHY_GBIT_FEATURES,
.config_init = rtl8211c_config_init,
.read_mmd = &genphy_read_mmd_unsupported,
.write_mmd = &genphy_write_mmd_unsupported,
}, {
- .phy_id = 0x001cc914,
+ PHY_ID_MATCH_EXACT(0x001cc914),
.name = "RTL8211DN Gigabit Ethernet",
- .phy_id_mask = 0x001fffff,
.features = PHY_GBIT_FEATURES,
.ack_interrupt = rtl821x_ack_interrupt,
.config_intr = rtl8211e_config_intr,
.suspend = genphy_suspend,
.resume = genphy_resume,
}, {
- .phy_id = 0x001cc915,
+ PHY_ID_MATCH_EXACT(0x001cc915),
.name = "RTL8211E Gigabit Ethernet",
- .phy_id_mask = 0x001fffff,
.features = PHY_GBIT_FEATURES,
.ack_interrupt = &rtl821x_ack_interrupt,
.config_intr = &rtl8211e_config_intr,
.suspend = genphy_suspend,
.resume = genphy_resume,
}, {
- .phy_id = 0x001cc916,
+ PHY_ID_MATCH_EXACT(0x001cc916),
.name = "RTL8211F Gigabit Ethernet",
- .phy_id_mask = 0x001fffff,
.features = PHY_GBIT_FEATURES,
.config_init = &rtl8211f_config_init,
.ack_interrupt = &rtl8211f_ack_interrupt,
@@ -286,9 +278,8 @@ static struct phy_driver realtek_drvs[] = {
.read_page = rtl821x_read_page,
.write_page = rtl821x_write_page,
}, {
- .phy_id = 0x001cc961,
+ PHY_ID_MATCH_EXACT(0x001cc961),
.name = "RTL8366RB Gigabit Ethernet",
- .phy_id_mask = 0x001fffff,
.features = PHY_GBIT_FEATURES,
.config_init = &rtl8366rb_config_init,
.suspend = genphy_suspend,
@@ -299,7 +290,7 @@ static struct phy_driver realtek_drvs[] = {
module_phy_driver(realtek_drvs);
static const struct mdio_device_id __maybe_unused realtek_tbl[] = {
- { 0x001cc800, GENMASK(31, 10) },
+ { PHY_ID_MATCH_VENDOR(0x001cc800) },
{ }
};
--
2.19.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net-next 0/2] net: phy: add macros for PHYID matching in PHY driver config
2018-11-09 23:37 [PATCH net-next 0/2] net: phy: add macros for PHYID matching in PHY driver config Heiner Kallweit
2018-11-09 23:39 ` [PATCH net-next 1/2] net: phy: add macros for PHYID matching Heiner Kallweit
2018-11-09 23:40 ` [PATCH net-next 2/2] net: phy: realtek: use new PHYID matching macros Heiner Kallweit
@ 2018-11-11 17:44 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2018-11-11 17:44 UTC (permalink / raw)
To: hkallweit1; +Cc: andrew, f.fainelli, netdev
From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Sat, 10 Nov 2018 00:37:46 +0100
> Add macros for PHYID matching to be used in PHY driver configs.
> By using these macros some boilerplate code can be avoided.
>
> Use them initially in the Realtek PHY drivers.
Series applied.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-11-12 3:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-09 23:37 [PATCH net-next 0/2] net: phy: add macros for PHYID matching in PHY driver config Heiner Kallweit
2018-11-09 23:39 ` [PATCH net-next 1/2] net: phy: add macros for PHYID matching Heiner Kallweit
2018-11-09 23:40 ` [PATCH net-next 2/2] net: phy: realtek: use new PHYID matching macros Heiner Kallweit
2018-11-11 17:44 ` [PATCH net-next 0/2] net: phy: add macros for PHYID matching in PHY driver config David Miller
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).