2 * Meson GXL Internal PHY Driver
4 * Copyright (C) 2015 Amlogic, Inc. All rights reserved.
5 * Copyright (C) 2016 BayLibre, SAS. All rights reserved.
6 * Author: Neil Armstrong <narmstrong@baylibre.com>
8 * SPDX-License-Identifier: GPL-2.0+
12 #include <linux/bitops.h>
15 static int meson_gxl_phy_config(struct phy_device *phydev)
17 /* Enable Analog and DSP register Bank access by */
18 phy_write(phydev, MDIO_DEVAD_NONE, 0x14, 0x0000);
19 phy_write(phydev, MDIO_DEVAD_NONE, 0x14, 0x0400);
20 phy_write(phydev, MDIO_DEVAD_NONE, 0x14, 0x0000);
21 phy_write(phydev, MDIO_DEVAD_NONE, 0x14, 0x0400);
23 /* Write Analog register 23 */
24 phy_write(phydev, MDIO_DEVAD_NONE, 0x17, 0x8E0D);
25 phy_write(phydev, MDIO_DEVAD_NONE, 0x14, 0x4417);
27 /* Enable fractional PLL */
28 phy_write(phydev, MDIO_DEVAD_NONE, 0x17, 0x0005);
29 phy_write(phydev, MDIO_DEVAD_NONE, 0x14, 0x5C1B);
31 /* Program fraction FR_PLL_DIV1 */
32 phy_write(phydev, MDIO_DEVAD_NONE, 0x17, 0x029A);
33 phy_write(phydev, MDIO_DEVAD_NONE, 0x14, 0x5C1D);
35 /* Program fraction FR_PLL_DIV1 */
36 phy_write(phydev, MDIO_DEVAD_NONE, 0x17, 0xAAAA);
37 phy_write(phydev, MDIO_DEVAD_NONE, 0x14, 0x5C1C);
39 return genphy_config(phydev);
42 static struct phy_driver meson_gxl_phy_driver = {
43 .name = "Meson GXL Internal PHY",
46 .features = PHY_BASIC_FEATURES,
47 .config = &meson_gxl_phy_config,
48 .startup = &genphy_startup,
49 .shutdown = &genphy_shutdown,
52 int phy_meson_gxl_init(void)
54 phy_register(&meson_gxl_phy_driver);