Permalink
Browse files

C2: initial patchwork

  • Loading branch information...
umiddelb committed Mar 8, 2017
1 parent e82d407 commit 755b3ac9e63b338fb4771a0660eaba0b6d7c8fac
Showing with 80 additions and 6 deletions.
  1. +32 −6 arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts
  2. +48 −0 drivers/net/phy/realtek.c
@@ -61,10 +61,23 @@
memory@0 {
device_type = "memory";
reg = <0x0 0x0 0x0 0x80000000>;
linux,usable-memory = <0x0 0x01000000 0x0 0x7f000000>;
};
usb_otg_pwr: regulator-usb-pwrs {
usb_host_pwr: regulator-usb-host-pwrs {
compatible = "regulator-fixed";
regulator-name = "USB_HOST_PWR";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
gpio = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_HIGH>;
enable-active-high;
};
usb_otg_pwr: regulator-usb-otg-pwrs {
compatible = "regulator-fixed";
regulator-name = "USB_OTG_PWR";
@@ -137,10 +150,6 @@
};
};
&scpi_clocks {
status = "disabled";
};
&uart_AO {
status = "okay";
pinctrl-0 = <&uart_ao_a_pins>;
@@ -184,6 +193,7 @@
&usb1_phy {
status = "okay";
phy-supply = <&usb_host_pwr>;
};
&usb0 {
@@ -194,6 +204,22 @@
status = "okay";
};
&ethmac {
phy-handle = <&eth_phy0>;
mdio {
compatible = "snps,dwmac-mdio";
#address-cells = <1>;
#size-cells = <0>;
eth_phy0: ethernet-phy@0 {
reg = <0>;
realtek,disable-eee-1000t;
};
};
};
/* SD */
&sd_emmc_b {
status = "okay";
View
@@ -15,6 +15,12 @@
*/
#include <linux/phy.h>
#include <linux/module.h>
#include <linux/of.h>
struct rtl8211f_phy_priv {
bool eee_1000_disable;
bool eee_100_disable;
};
#define RTL821x_PHYSR 0x11
#define RTL821x_PHYSR_DUPLEX 0x2000
@@ -93,6 +99,25 @@ static int rtl8211f_config_intr(struct phy_device *phydev)
return err;
}
static void rtl8211f_force_eee(struct phy_device *phydev)
{
struct rtl8211f_phy_priv *priv = phydev->priv;
u16 val;
if (priv->eee_1000_disable || priv->eee_100_disable) {
val = phy_read_mmd_indirect(phydev, MDIO_AN_EEE_ADV,
MDIO_MMD_AN);
if (priv->eee_1000_disable)
val &= ~MDIO_AN_EEE_ADV_1000T;
if (priv->eee_100_disable)
val &= ~MDIO_AN_EEE_ADV_100TX;
phy_write_mmd_indirect(phydev, MDIO_AN_EEE_ADV,
MDIO_MMD_AN, val);
}
}
static int rtl8211f_config_init(struct phy_device *phydev)
{
int ret;
@@ -102,6 +127,8 @@ static int rtl8211f_config_init(struct phy_device *phydev)
if (ret < 0)
return ret;
rtl8211f_force_eee(phydev);
phy_write(phydev, RTL8211F_PAGE_SELECT, 0xd08);
reg = phy_read(phydev, 0x11);
@@ -119,6 +146,26 @@ static int rtl8211f_config_init(struct phy_device *phydev)
return 0;
}
static int rtl8211f_phy_probe(struct phy_device *phydev)
{
struct device *dev = &phydev->mdio.dev;
struct device_node *of_node = dev->of_node;
struct rtl8211f_phy_priv *priv;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
if (of_property_read_bool(of_node, "realtek,disable-eee-1000t"))
priv->eee_1000_disable= true;
if (of_property_read_bool(of_node, "realtek,disable-eee-100t"))
priv->eee_100_disable= true;
phydev->priv = priv;
return 0;
}
static struct phy_driver realtek_drvs[] = {
{
.phy_id = 0x00008201,
@@ -168,6 +215,7 @@ static struct phy_driver realtek_drvs[] = {
.phy_id_mask = 0x001fffff,
.features = PHY_GBIT_FEATURES,
.flags = PHY_HAS_INTERRUPT,
.probe = &rtl8211f_phy_probe,
.config_aneg = &genphy_config_aneg,
.config_init = &rtl8211f_config_init,
.read_status = &genphy_read_status,

0 comments on commit 755b3ac

Please sign in to comment.