};
mac_rxpins: mac-rxpins {
- rockchip,pins = <MAC_RXD0>, <MAC_RXD1>, <MAC_RXD2>, <MAC_RXD3>, <MAC_RXDV>, <MAC_RXER>, <MAC_RXCLK>, <MAC_CRS>, <MAC_COL>;
+ rockchip,pins = <MAC_RXD0>, <MAC_RXD1>, <MAC_RXD2>, <MAC_RXD3>, <MAC_RXDV>, <MAC_RXER>, <MAC_RXCLK>, <MAC_COL>;
+ rockchip,pull = <VALUE_PULL_DISABLE>;
+ //rockchip,voltage = <VALUE_VOL_DEFAULT>;
+ rockchip,drive = <VALUE_DRV_DEFAULT>;
+ //rockchip,tristate = <VALUE_TRI_DEFAULT>;
+ };
+
+ mac_crs: mac-crs {
+ rockchip,pins = <MAC_CRS>;
rockchip,pull = <VALUE_PULL_DISABLE>;
//rockchip,voltage = <VALUE_VOL_DEFAULT>;
rockchip,drive = <VALUE_DRV_DEFAULT>;
// power_ctl_by = "gpio"; //"gpio" "pmu"
power-gpio = <&gpio0 GPIO_A6 GPIO_ACTIVE_HIGH>;
// power-pmu = "act_ldo"
- reset-gpio = <&gpio4 GPIO_A7 GPIO_ACTIVE_HIGH>;
+ reset-gpio = <&gpio4 GPIO_A7 GPIO_ACTIVE_LOW>;
};
&pinctrl {
struct bsp_priv {
char pwr_ctl_by[8];
int power_io;
+ int power_io_level;
int reset_io;
+ int reset_io_level;
int phy_iface;
int (*phy_power_on)(struct plat_stmmacenet_data *plat, int enable);
};
stmmac_check_ether_addr(priv);
+ if (priv->pcs != STMMAC_PCS_SGMII && priv->pcs != STMMAC_PCS_TBI &&
+ priv->pcs != STMMAC_PCS_RTBI) {
+ /* MDIO bus Registration */
+ ret = stmmac_mdio_register(priv->dev);
+ if (ret < 0) {
+ pr_debug("%s: MDIO bus (id: %d) registration failed",
+ __func__, priv->plat->bus_id);
+ goto open_error;
+ }
+ }
+
if (priv->pcs != STMMAC_PCS_SGMII && priv->pcs != STMMAC_PCS_TBI &&
priv->pcs != STMMAC_PCS_RTBI) {
ret = stmmac_init_phy(dev);
stmmac_check_pcs_mode(priv);
- if (priv->pcs != STMMAC_PCS_SGMII && priv->pcs != STMMAC_PCS_TBI &&
- priv->pcs != STMMAC_PCS_RTBI) {
- /* MDIO bus Registration */
- ret = stmmac_mdio_register(ndev);
- if (ret < 0) {
- pr_debug("%s: MDIO bus (id: %d) registration failed",
- __func__, priv->plat->bus_id);
- goto error_mdio_register;
- }
- }
-
return priv;
error_mdio_register:
#include <linux/of_net.h>
#include <linux/gpio.h>
#include <linux/of_gpio.h>
+#include <linux/of_device.h>
+#include <dt-bindings/gpio/gpio.h>
#include "stmmac.h"
#include <linux/rockchip/iomap.h>
#include <linux/rockchip/grf.h>
if (enable) {
//power on
if (gpio_is_valid(bsp_priv->power_io)) {
- gpio_direction_output(bsp_priv->power_io, 0);
- gpio_set_value(bsp_priv->power_io, 1);
+ gpio_direction_output(bsp_priv->power_io, !bsp_priv->power_io_level);
+ msleep(10);
+ gpio_direction_output(bsp_priv->power_io, bsp_priv->power_io_level);
+ //gpio_set_value(bsp_priv->power_io, 1);
}
//reset
if (gpio_is_valid(bsp_priv->reset_io)) {
- gpio_direction_output(bsp_priv->reset_io, 0);
- gpio_set_value(bsp_priv->reset_io, 0);
+ gpio_direction_output(bsp_priv->reset_io, bsp_priv->reset_io_level);
+ //gpio_set_value(bsp_priv->reset_io, 0);
msleep(10);
- gpio_set_value(bsp_priv->reset_io, 1);
+ gpio_direction_output(bsp_priv->reset_io, !bsp_priv->reset_io_level);
}
} else {
//power off
if (gpio_is_valid(bsp_priv->power_io)) {
- gpio_direction_output(bsp_priv->power_io, 0);
- gpio_set_value(bsp_priv->power_io, 0);
+ gpio_direction_output(bsp_priv->power_io, !bsp_priv->power_io_level);
+ //gpio_set_value(bsp_priv->power_io, 0);
}
}
g_bsp_priv.reset_io =
of_get_named_gpio_flags(np, "reset-gpio", 0, &flags);
+ g_bsp_priv.reset_io_level = (flags == GPIO_ACTIVE_HIGH) ? 1 : 0;
g_bsp_priv.power_io =
of_get_named_gpio_flags(np, "power-gpio", 0, &flags);
+ g_bsp_priv.power_io_level = (flags == GPIO_ACTIVE_HIGH) ? 1 : 0;
g_bsp_priv.phy_iface = plat->interface;
g_bsp_priv.phy_power_on = phy_power_on;