95 lines
2.6 KiB
Plaintext
95 lines
2.6 KiB
Plaintext
diff --git a/drivers/net/ethernet/sunxi/eth/Kconfig b/drivers/net/ethernet/sunxi/eth/Kconfig
|
|
index 13787db..af930df 100755
|
|
--- a/drivers/net/ethernet/sunxi/eth/Kconfig
|
|
+++ b/drivers/net/ethernet/sunxi/eth/Kconfig
|
|
@@ -35,5 +35,13 @@ config GETH_PHY_POWER
|
|
If external PHY power is exist, and it want to be controled,
|
|
select it. If not, it mean the power of PHY already on.
|
|
|
|
+config GMAC_PHY_POWER
|
|
+ bool "External PHY power control"
|
|
+ depends on SUNXI_GETH
|
|
+ default y
|
|
+ ---help---
|
|
+ If external PHY power is exist, and it want to be controled,
|
|
+ select it. If not, it mean the power of PHY already on.
|
|
+
|
|
endif
|
|
|
|
diff --git a/drivers/net/ethernet/sunxi/eth/sunxi_geth.c b/drivers/net/ethernet/sunxi/eth/sunxi_geth.c
|
|
index 7c48f7b..96be5a3 100755
|
|
--- a/drivers/net/ethernet/sunxi/eth/sunxi_geth.c
|
|
+++ b/drivers/net/ethernet/sunxi/eth/sunxi_geth.c
|
|
@@ -154,6 +154,9 @@ struct geth_priv {
|
|
|
|
spinlock_t lock;
|
|
spinlock_t tx_lock;
|
|
+#ifdef CONFIG_GMAC_PHY_POWER
|
|
+ u32 gpio_power_hd;
|
|
+#endif
|
|
};
|
|
|
|
#ifdef CONFIG_GETH_PHY_POWER
|
|
@@ -195,6 +198,11 @@ static void desc_print(struct dma_desc *desc, int size)
|
|
static int geth_power_on(struct geth_priv *priv)
|
|
{
|
|
int value;
|
|
+
|
|
+#ifdef CONFIG_GMAC_PHY_POWER
|
|
+ gpio_set_value(priv->gpio_power_hd, 1);
|
|
+#endif
|
|
+
|
|
#ifdef CONFIG_GETH_PHY_POWER
|
|
struct regulator **regu;
|
|
int ret = 0, i = 0;
|
|
@@ -258,6 +266,11 @@ err:
|
|
static void geth_power_off(struct geth_priv *priv)
|
|
{
|
|
int value;
|
|
+
|
|
+#ifdef CONFIG_GMAC_PHY_POWER
|
|
+ gpio_set_value(priv->gpio_power_hd, 0);
|
|
+#endif
|
|
+
|
|
#ifdef CONFIG_GETH_PHY_POWER
|
|
struct regulator **regu = priv->power;
|
|
int i = 0;
|
|
@@ -1607,7 +1620,13 @@ static int geth_sys_request(struct platform_device *pdev)
|
|
struct geth_priv *priv = netdev_priv(ndev);
|
|
int ret = 0;
|
|
struct resource *res;
|
|
-
|
|
+
|
|
+#ifdef CONFIG_GMAC_PHY_POWER
|
|
+ script_item_value_type_e type;
|
|
+ script_item_u item;
|
|
+ int req_status;
|
|
+#endif
|
|
+
|
|
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "geth_extclk");
|
|
if (unlikely(!res)){
|
|
ret = -ENODEV;
|
|
@@ -1681,6 +1700,22 @@ static int geth_sys_request(struct platform_device *pdev)
|
|
}
|
|
}
|
|
#endif
|
|
+
|
|
+#ifdef CONFIG_GMAC_PHY_POWER && CONFIG_GETH_SCRIPT_SYS
|
|
+ type = script_get_item("gmac_phy_power", "gmac_phy_power_en", &item);
|
|
+ if (SCIRPT_ITEM_VALUE_TYPE_PIO != type) {
|
|
+ pr_err("script_get_item return type err\n");
|
|
+ return -EFAULT;
|
|
+ }
|
|
+ /*request gpio*/
|
|
+ req_status = gpio_request(item.gpio.gpio, NULL);
|
|
+ if (0 != req_status) {
|
|
+ pr_err("request gpio failed!\n");
|
|
+ }
|
|
+ gpio_direction_output(item.gpio.gpio, 1);
|
|
+ priv->gpio_power_hd = item.gpio.gpio;
|
|
+ #endif
|
|
+
|
|
return 0;
|
|
|
|
pin_err:
|