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

net: phy: adin: add support for Analog Devices PHYs

This change adds support for Analog Devices Industrial Ethernet PHYs.
Particularly the PHYs this driver adds support for:
* ADIN1200 - Robust, Industrial, Low Power 10/100 Ethernet PHY
* ADIN1300 - Robust, Industrial, Low Latency 10/100/1000 Gigabit
Ethernet PHY

The 2 chips are register compatible with one another. The main difference
being that ADIN1200 doesn't operate in gigabit mode.

The chips can be operated by the Generic PHY driver as well via the
standard IEEE PHY registers (0x0000 - 0x000F) which are supported by the
kernel as well. This assumes that configuration of the PHY has been done
completely in HW, according to spec.

Configuration can also be done via registers, which will be supported by
this driver.

Datasheets:
https://www.analog.com/media/en/technical-documentation/data-sheets/ADIN1300.pdf
https://www.analog.com/media/en/technical-documentation/data-sheets/ADIN1200.pdf

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Alexandru Ardelean and committed by
David S. Miller
9c102981 459c5fb4

+66
+7
MAINTAINERS
··· 938 938 F: drivers/mux/adgs1408.c 939 939 F: Documentation/devicetree/bindings/mux/adi,adgs1408.txt 940 940 941 + ANALOG DEVICES INC ADIN DRIVER 942 + M: Alexandru Ardelean <alexaundru.ardelean@analog.com> 943 + L: netdev@vger.kernel.org 944 + W: http://ez.analog.com/community/linux-device-drivers 945 + S: Supported 946 + F: drivers/net/phy/adin.c 947 + 941 948 ANALOG DEVICES INC ADIS DRIVER LIBRARY 942 949 M: Alexandru Ardelean <alexandru.ardelean@analog.com> 943 950 S: Supported
+9
drivers/net/phy/Kconfig
··· 257 257 depends on HWMON || HWMON=n 258 258 select MDIO_I2C 259 259 260 + config ADIN_PHY 261 + tristate "Analog Devices Industrial Ethernet PHYs" 262 + help 263 + Adds support for the Analog Devices Industrial Ethernet PHYs. 264 + Currently supports the: 265 + - ADIN1200 - Robust,Industrial, Low Power 10/100 Ethernet PHY 266 + - ADIN1300 - Robust,Industrial, Low Latency 10/100/1000 Gigabit 267 + Ethernet PHY 268 + 260 269 config AMD_PHY 261 270 tristate "AMD PHYs" 262 271 ---help---
+1
drivers/net/phy/Makefile
··· 47 47 sfp-obj-$(CONFIG_SFP) += sfp-bus.o 48 48 obj-y += $(sfp-obj-y) $(sfp-obj-m) 49 49 50 + obj-$(CONFIG_ADIN_PHY) += adin.o 50 51 obj-$(CONFIG_AMD_PHY) += amd.o 51 52 aquantia-objs += aquantia_main.o 52 53 ifdef CONFIG_HWMON
+49
drivers/net/phy/adin.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + /** 3 + * Driver for Analog Devices Industrial Ethernet PHYs 4 + * 5 + * Copyright 2019 Analog Devices Inc. 6 + */ 7 + #include <linux/kernel.h> 8 + #include <linux/errno.h> 9 + #include <linux/init.h> 10 + #include <linux/module.h> 11 + #include <linux/mii.h> 12 + #include <linux/phy.h> 13 + 14 + #define PHY_ID_ADIN1200 0x0283bc20 15 + #define PHY_ID_ADIN1300 0x0283bc30 16 + 17 + static int adin_config_init(struct phy_device *phydev) 18 + { 19 + return genphy_config_init(phydev); 20 + } 21 + 22 + static struct phy_driver adin_driver[] = { 23 + { 24 + PHY_ID_MATCH_MODEL(PHY_ID_ADIN1200), 25 + .name = "ADIN1200", 26 + .config_init = adin_config_init, 27 + .config_aneg = genphy_config_aneg, 28 + .read_status = genphy_read_status, 29 + }, 30 + { 31 + PHY_ID_MATCH_MODEL(PHY_ID_ADIN1300), 32 + .name = "ADIN1300", 33 + .config_init = adin_config_init, 34 + .config_aneg = genphy_config_aneg, 35 + .read_status = genphy_read_status, 36 + }, 37 + }; 38 + 39 + module_phy_driver(adin_driver); 40 + 41 + static struct mdio_device_id __maybe_unused adin_tbl[] = { 42 + { PHY_ID_MATCH_MODEL(PHY_ID_ADIN1200) }, 43 + { PHY_ID_MATCH_MODEL(PHY_ID_ADIN1300) }, 44 + { } 45 + }; 46 + 47 + MODULE_DEVICE_TABLE(mdio, adin_tbl); 48 + MODULE_DESCRIPTION("Analog Devices Industrial Ethernet PHY driver"); 49 + MODULE_LICENSE("GPL");