summaryrefslogtreecommitdiffstats
path: root/drivers/net/phy
Commit message (Collapse)AuthorAgeFilesLines
* net: dsa: mv88e6xxx: Wait for EEPROM done after HW resetAndrey Smirnov2019-10-145-0/+124
| | | | | | | | | | | | | | | | | | | | | Based on a unpublished patch from Andrew Lunn: When the switch is hardware reset, it reads the contents of the EEPROM. This can contain instructions for programming values into registers and to perform waits between such programming. Reading the EEPROM can take longer than the 100ms mv88e6xxx_hardware_reset() waits after deasserting the reset GPIO. So poll the EEPROM done bit to ensure it is complete. Signed-off-by: Andrew Lunn <andrew@lunn.ch> orignal patch augmented to have necessary Global 1 plubming, ported to Barebox and slightly changed. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Cc: Chris Healy <cphealy@gmail.com> Cc: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: dsa: mv88e6xxx: Fix error message typoAndrey Smirnov2019-10-141-1/+1
| | | | | | | s/MIDO/MDIO Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: phy: mv88e6xxx: remove duplicate member in struct initializerAhmad Fatoum2019-08-301-1/+0
| | | | | | | There's already an .ops member two lines later. Remove one. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: replace '---help---' with 'help' in Kconfig filesMasahiro Yamada2019-05-171-13/+13
| | | | | | | | | | | | | | | | In Linux, '---help---' was deprecated in favor of 'help', and this is checked by the recent checkpatch.pl See Linux commit 84af7a6194e493fae312a2b7fa5a3b51f76d9282 The number of '---help---' is gradually decreasing in Linux, but there are still lots. However, '---help---' will be completely killed when the time comes. Fortunately, there are only some in Barebox. Replacing them is not hard. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* realtek phy driverSascha Hauer2019-03-113-0/+178
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: phy: Add register access helper functions for physSascha Hauer2019-03-112-1/+176
| | | | | | | Linux has phy helpers to access paged registers and to modify phy registers. Add them to barebox for upcoming realtek phy support. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2019-02-131-0/+32
|\
| * net: phy: micrel: backport ksz9031 125MHz ref-clk workaroundMarco Felsch2019-02-121-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch backports linux commit e1b505a60366 ("net: phy: micrel: add 125MHz reference clock workaround"). 8<--------------------- The original commit message ------------------- net: phy: micrel: add 125MHz reference clock workaround The micrel KSZ9031 phy has a optional clock pin (CLK125_NDO) which can be used as reference clock for the MAC unit. The clock signal must meet the RGMII requirements to ensure the correct data transmission between the MAC and the PHY. The KSZ9031 phy does not fulfill the duty cycle requirement if the phy is configured as slave. For a complete describtion look at the errata sheets: DS80000691D or DS80000692D. The errata sheet recommends to force the phy into master mode whenever there is a 1000Base-T link-up as work around. Only set the "micrel,force-master" property if you use the phy reference clock provided by CLK125_NDO pin as MAC reference clock in your application. Attenation, this workaround is only usable if the link partner can be configured to slave mode for 1000Base-T. Signed-off-by: Markus Niebel <Markus.Niebel@tqs.de> [m.felsch@pengutronix.de: fix dt-binding documentation] [m.felsch@pengutronix.de: use already existing result var for read/write] [m.felsch@pengutronix.de: add error handling] [m.felsch@pengutronix.de: add more comments] Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net> 8<--------------------------------------------------------------------- Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | devfs: Drop dev_lseek_default()Andrey Smirnov2019-01-291-1/+0
|/ | | | | | | | | | | | | | | | | | | | | Only the following cdevs do not declare an .lseek() operation: - Console devices in common/console.c - Firmware framework in common/firmware.c - JTAG driver in drivers/misc/jtag.c - UBI in drivers/mtd/ubi/barebox.c Of those four, first two are marked DEVFS_IS_CHARACTER_DEV and implement only .write() operation and the last two don't implement anything but .ioctl(). While there's probably no meaningful way to use lseek() against any of those devices, there doesn't seem to be any harm in allowing it either. Change devfs_lseek() to ignore absense of .lseek() callback and drop dev_lseek_default() and all references to it in the codebase. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* dp83867: port from linuxThomas Hämmerle2019-01-093-0/+329
| | | | | | | Port driver for TI DP83867 Gigabit Ethernet PHY from linux. Signed-off-by: Thomas Haemmerle <thomas.haemmerle@wolfvision.net> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* drivers: net: phy: convert drivers to spdxOleksij Rempel2018-12-0714-83/+14
| | | | | | Reviewed-by: Roland Hieber <r.hieber@pengutronix.de> Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/net-switch-mv88e6xxx'Sascha Hauer2018-11-0911-13/+2355
|\
| * net: phy: mv88e6xxx: Add support for MAC portsAndrey Smirnov2018-10-234-9/+877
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for MAC-only/no-PHY ports by adding code that will create a pseudo PHY device for such ports and a driver to match against. Original Linux driver exposes all of the ports using DSA subystem, but lacking that in Barebox, creating pseudo PHYs is the simplest option to have code to properly configure various interface parameters. This is needed, for example, on ZII RPU2 board where FEC is connected directly to one of the MAC-only ports. That link requires proper RGMII delay configuration in order to be functional. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * net: phy: mv88e6xxx: Port EEPROM support codeAndrey Smirnov2018-10-234-0/+388
| | | | | | | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * net: phy: Add basic driver for MV88E6XXX switches from MarvellAndrey Smirnov2018-10-239-0/+1070
| | | | | | | | | | | | | | | | | | Port a very abridged version of MV88E6XXX DSA driver from Linux kernel. Currently only internal MDIO bus connected to switch PHYs is exposed. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mdio_bus: Allow for non PHY-devices on MDIO busesAndrey Smirnov2018-10-231-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of just creating a simple PHY device for every child of MDIO bus node, add code to check if any of them have "compatible" property set, as well as code to create a proper platform device for such cases. This change is useful for when MDIO bus and some of Ethernet ports are connected to a switch or some other MDIO device that doesn't behave like a generic PHY and can't be probed via its PHY ID. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * net: phy: Check phy_mask in get_phy_device()Andrey Smirnov2018-10-181-3/+4
| | | | | | | | | | | | | | | | | | | | | | Do not try to probe PHY devices if they are masked in phy_mask. This way we won't try adding devices that are unlikely to be proper PHYs by default. With this change it still remains possible to add such a device explicitly either using "miitool" or calling phy_device_create() explicilty. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mdio_bus: Fix documentation for mdio_bus_match()Andrey Smirnov2018-10-181-4/+7
| | | | | | | | | | | | | | | | | | Fix documentation for mdio_bus_match(). While at it, re-arrange the code to be easier to follow. Seeing != used as a result of a matching function is extremely confusing. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * drivers: Introduce dev_set_name()Andrey Smirnov2018-10-182-5/+5
| | | | | | | | | | | | | | | | Introduce dev_set_name() in order to hide implementation details of setting device's name so it'd be easier to change it. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | phy: call adjust_link in attach if using fixed-linkClément Leger2018-10-161-0/+4
|/ | | | | | | | | | | | | Normally, phy_update_status is in charge of reporting a change in link status when phy is updated. When using fixed-link, speed and duplex are initialized directly after registering the phy and there is no driver. Hence when phy_update_status is called, the check for new values fails and returns directly. Since update_link call is mandatory for some network devices to work, call it directly when using fixed link in phy_device_attach to force update of link. Signed-off-by: Clement Leger <clement.leger@kalray.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: mdio: Do not warn about invalid PHY addressSascha Hauer2018-09-181-4/+4
| | | | | | | | | | | | | | | | of_mdiobus_register is now called with nodes from ethernet devices. Their child nodes are not necessarily phy nodes. For am335x devices we get several warnings now: miibus0: /ocp/ethernet@4a100000/mdio@4a101000 PHY address 1242566656 is too large miibus0: /ocp/ethernet@4a100000/slave@4a100200 has invalid PHY address miibus0: /ocp/ethernet@4a100000/slave@4a100300 has invalid PHY address miibus0: /ocp/ethernet@4a100000/cpsw-phy-sel@44e10650 PHY address 1155597904 is too large None of the nodes is a phy node, so silence the warnings and turn them into dev_dbg. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* phylib: add support for reset-gpiosSam Ravnborg2018-08-241-1/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add minimal support for reset-gpios in the PHY node. Example DT that uses this: macb0: ethernet@fffbc000 { phy-mode = "rmii"; #address-cells = <1>; #size-cells = <0>; ethphy0: ethernet-phy@1 { reg = <3>; reset-gpios = <&pioE 17 GPIO_ACTIVE_LOW>; reset-assert-us = <1000>; reset-deassert-us = <2000>; }; }; The reset is required to get the Davicom PHY operational on my proprietary board, and is assumed relevant for other boards too. The PHY is reset when we read the info from DT, before the phy_id is retreived. The bindings are documented in dts/Bindings/net/phy.txt. A side-effect of this patch is that we may see phy devices created from the DT due to the extra call to: of_mdiobus_register() with the ethernet node as argument. The logic to determine if a child node is a PHY node is a simpler version compared to the one used in the kernel. The kernel have a whitelist of compatible strings that is not included in the barebox version. They can be added later if needed. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* phylib: add Davicom PHY supportSam Ravnborg2018-08-243-0/+146
| | | | | | | Based on driver from Linux kernel 4.18.0-rc4 Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/net'Sascha Hauer2018-05-091-0/+1
|\
| * net: phy: micrel: fix too late link upChristian Hemp2018-04-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit a4cee7207a1 ("net: phy: micrel: Add workaround for bad autoneg") by Philipp Zabel <p.zabel@pengutronix.de>: Based on kernel commit d2fd719bcb0e ("net/phy: micrel: Add workaround for bad autoneg") by Nathan Sullivan <nathan.sullivan@ni.com>: Very rarely, the KSZ9031 will appear to complete autonegotiation, but will drop all traffic afterwards. When this happens, the idle error count will read 0xFF after autonegotiation completes. Reset the PHY when in that state. is it possible that we get the link to late and barebox reports "Network is down". The problem is that ksz9031_config_init is called again in an error case. In this case autoneg will restart but waiting for finish is missing. Signed-off-by: Christian Hemp <c.hemp@phytec.de> Tested-by: Stefan Müller-Klieser <s.mueller-klieser@phytec.de>
* | rename file_operations -> cdev_operationsSascha Hauer2018-04-061-1/+1
|/ | | | | | | | Linux also has struct file_operations which are something different. Rename our file_operations to cdev_operations which better matches what we have. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2018-02-081-2/+19
|\
| * net: phy: fixed-link: read link parameters from devicetreeLucas Stach2018-02-061-2/+7
| | | | | | | | | | | | | | Implement the missing reading of the fixed link parameters from the devicetree properties. Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
| * net: phy: scan PHYs referenced by phandleLucas Stach2018-01-251-0/+12
| | | | | | | | | | | | | | | | | | | | If we point to a PHY node by phandle, that PHY might well be on a MDIO bus that hasn't been scanned when we look for the PHY. Fortunately we know exactly where to look for the PHY, so make sure to scan the bus at the right address. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net: phy: ar8327: fix ar8327n_reg_readOleksij Rempel2018-02-051-1/+1
|/ | | | | | | Actual read value was lost and only by accident worked properly. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: mdio-mux: Avoid probing multiplexed bussesAndrey Smirnov2017-12-062-0/+4
| | | | | | | | | | | | Calling mdiobus_detect() for a bus that serves as a parent for a MDIO bus multiplexer would result in parent bus being populated with devices that are present on downstream bus that multiplexer happens to be "pointing" at that moment. To avoid that introduce 'is_multiplexed' flag to struct mii_bus and change mdiobus_detect to ignore busses for which that flag is set. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: phy: Port GPIO controlled MDIO multiplexer driverAndrey Smirnov2017-12-063-0/+158
| | | | | | | | Port Linux version driver to Barebox, to support such device found in various revisions of ZII's VF610 development board. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net: phy: Port MDIO bus miltiplexer framework from Linux kernelAndrey Smirnov2017-12-063-0/+152
| | | | | | | | Port mdio-mux.c from Linux kernel to Barebox, to support adding dirvers that rely on that infrastructure/API. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mdio_bus: Port of_mdio_find_bus() from Linux kernelAndrey Smirnov2017-12-061-0/+27
| | | | | | | | Port of_mdio_find_bus() from Linux kernel. This function is used in MDIO multiplexor infrastructure added in following commit. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2017-10-191-4/+69
|\
| * Marvell: implement marvell_of_reg_initClément Leger2017-10-161-4/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | From ed1cbcd05d5efeb4012d77a9a4ab9c1da0449bdc Mon Sep 17 00:00:00 2001 From: Clement Leger <clement.leger@kalray.eu> Date: Tue, 10 Oct 2017 14:29:49 +0200 Subject: [PATCH] Marvell: implement marvell_of_reg_init Implement marvell_of_reg_init in order to use marvell,reg-init property from device-tree. The code is taken from Linux kernel and slighlty modify to fit barebox structures. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net: phy: add ar8327 driverOleksij Rempel2017-09-203-0/+286
|/ | | | | | | | The Atheros ar8327 is a seven port gigabit ethernet switch. This patch adds a driver for the phys in it. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Phy: Check NULL bus case and undetected phy via ofClément Leger2017-09-061-0/+5
| | | | | | | | | | | | | | | From 5e87dc2c24051c2cd2985e513c5a825d51d9bb00 Mon Sep 17 00:00:00 2001 From: Clement Leger <clement.leger@kalray.eu> Date: Tue, 5 Sep 2017 10:37:23 +0200 Subject: [PATCH] Phy: Check NULL bus case and undetected phy via of phy_device_connect can be called with NULL miibus for automatic match with the phy described in the device tree. In the case where the phy was not detected for some unknown reason, the next calls will be done with a NULL bus. This will lead to undefined behavior and more probably crashes. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* phy: don't crash if we have no parentOleksij Rempel2017-09-061-1/+1
| | | | | | | | current code will crash if DT has no PHY entry. With this patch we will test if parent exist, before testing the parent device node. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* param: make parameter functions more consistentSascha Hauer2017-04-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | This patch creates a consitent set of device parameter functions. With this we have: dev_add_param_<type><access> "type" is one of: int32, uint32, int64, uint64, string, mac, ipv4, enum, bitmask The improvement here is that we now can exactly specify the width of the int type parameters and also correctly distinguish between signed and unsigned variables which means that a variable no longer ends up with INT_MAX when it's assigned -1. "access" can be empty for regular read/write parameter, "_ro" for readonly parameters which get their value from a variable pointer in the background or "_fixed" for parameters which are set to a fixed value (without a pointer in the background). Some more exotic types are not (yet) implemented, like dev_add_param_ip_ro. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/net'Sascha Hauer2017-04-071-0/+126
|\
| * net/phy: marvell: import support for 88E1111 from the LinuxPeter Mamonov2017-03-301-0/+126
| | | | | | | | | | Signed-off-by: Peter Mamonov <pmamonov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | net: phy: mdio-gpio.c: fix "no previous prototype" warningAntony Pavlov2017-03-301-1/+1
|/ | | | | | | | | | | | The patch fixes this compiler's warning: drivers/net/phy/mdio-gpio.c:48:24: warning: no previous prototype for 'mdio_gpio_of_get_info' [-Wmissing-prototypes] struct mdio_gpio_info *mdio_gpio_of_get_info(struct device_d *dev) ^ Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net/phy: marvell: add support for 88e1510 to marvell phy driverUwe Kleine-König2017-01-131-3/+201
| | | | | | | This is mostly copied verbatim from the Linux driver. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net/phy: marvell: improve config_aneg for 88E1121R and 88E1318SUwe Kleine-König2017-01-131-2/+76
| | | | | | | This is taken from the Linux driver Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net/phy: marvell: align definition of MII_88E1121_PHY_MSCR to Linux driverUwe Kleine-König2017-01-131-3/+3
| | | | | Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net/phy: marvell: change spacing to be more similar to the Linux driverUwe Kleine-König2017-01-131-28/+28
| | | | | | | | To make the barebox driver more similar to the Linux driver, only use a single space before the = in member initialisation. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net/phy: marvell: rename phy_driver array to match Linux driverUwe Kleine-König2017-01-131-2/+3
| | | | | Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net/phy: marvell: 88E1540 LED registers already exist on 88E1121Uwe Kleine-König2017-01-131-5/+5
| | | | | | | So rename accordingly to match the definition used by Linux Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* net/phy: marvell: rename 88E1545 to 88E1540Uwe Kleine-König2017-01-131-2/+2
| | | | | | | The Linux driver calls it 88E1540 so do it here, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>