mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-12 14:23:00 +00:00
330d64f5a0
Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Acked-by: Michal Simek <michal.simek@amd.com> Tested-by: Michal Simek <michal.simek@amd.com> #microblaze (MANUAL_RELOC)
41 lines
1.1 KiB
C
41 lines
1.1 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
#include <common.h>
|
|
#include <phy.h>
|
|
#include <linux/bitfield.h>
|
|
|
|
#define XWAY_MDIO_MIICTRL 0x17 /* mii control */
|
|
|
|
#define XWAY_MDIO_MIICTRL_RXSKEW_MASK GENMASK(14, 12)
|
|
#define XWAY_MDIO_MIICTRL_TXSKEW_MASK GENMASK(10, 8)
|
|
|
|
static int xway_config(struct phy_device *phydev)
|
|
{
|
|
ofnode node = phy_get_ofnode(phydev);
|
|
u32 val = 0;
|
|
|
|
if (ofnode_valid(node)) {
|
|
u32 rx_delay, tx_delay;
|
|
|
|
rx_delay = ofnode_read_u32_default(node, "rx-internal-delay-ps", 2000);
|
|
tx_delay = ofnode_read_u32_default(node, "tx-internal-delay-ps", 2000);
|
|
val |= FIELD_PREP(XWAY_MDIO_MIICTRL_TXSKEW_MASK, rx_delay / 500);
|
|
val |= FIELD_PREP(XWAY_MDIO_MIICTRL_RXSKEW_MASK, tx_delay / 500);
|
|
phy_modify(phydev, MDIO_DEVAD_NONE, XWAY_MDIO_MIICTRL,
|
|
XWAY_MDIO_MIICTRL_TXSKEW_MASK |
|
|
XWAY_MDIO_MIICTRL_RXSKEW_MASK, val);
|
|
}
|
|
|
|
genphy_config_aneg(phydev);
|
|
|
|
return 0;
|
|
}
|
|
|
|
U_BOOT_PHY_DRIVER(xway) = {
|
|
.name = "XWAY",
|
|
.uid = 0xD565A400,
|
|
.mask = 0xffffff00,
|
|
.features = PHY_GBIT_FEATURES,
|
|
.config = xway_config,
|
|
.startup = genphy_startup,
|
|
.shutdown = genphy_shutdown,
|
|
};
|