Merge pull request #164 from ThomasKaiser/master

Unified Ethernet patch 2nd try, reorganised other sun8i patches
This commit is contained in:
Igor Pečovnik 2016-02-20 12:05:46 +01:00
commit d8041cab36
5 changed files with 33 additions and 9 deletions

View File

@ -17,42 +17,65 @@ index af930df..13787db 100755
endif
diff --git a/drivers/net/ethernet/sunxi/eth/sunxi_geth.c b/drivers/net/ethernet/sunxi/eth/sunxi_geth.c
index 03931f2..8c9b912 100755
index 03931f2..446a83e 100755
--- a/drivers/net/ethernet/sunxi/eth/sunxi_geth.c
+++ b/drivers/net/ethernet/sunxi/eth/sunxi_geth.c
@@ -154,9 +154,6 @@ struct geth_priv {
@@ -154,9 +154,7 @@ struct geth_priv {
spinlock_t lock;
spinlock_t tx_lock;
-#ifdef CONFIG_GMAC_PHY_POWER
- u32 gpio_power_hd;
-#endif
+ int gpio_power_hd;
};
#ifdef CONFIG_GETH_PHY_POWER
@@ -199,10 +196,6 @@ static int geth_power_on(struct geth_priv *priv)
@@ -198,11 +196,8 @@ 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
-
+ if (gpio_is_valid(priv->gpio_power_hd))
+ gpio_set_value(priv->gpio_power_hd, 1);
#ifdef CONFIG_GETH_PHY_POWER
struct regulator **regu;
int ret = 0, i = 0;
@@ -267,10 +260,6 @@ static void geth_power_off(struct geth_priv *priv)
@@ -266,11 +261,8 @@ 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
-
+ if (gpio_is_valid(priv->gpio_power_hd))
+ gpio_set_value(priv->gpio_power_hd, 0);
#ifdef CONFIG_GETH_PHY_POWER
struct regulator **regu = priv->power;
int i = 0;
@@ -1621,12 +1610,6 @@ static int geth_sys_request(struct platform_device *pdev)
@@ -1575,6 +1567,15 @@ static int geth_script_parse(struct platform_device *pdev)
break;
}
+ priv->gpio_power_hd = -1;
+ type = script_get_item("gmac_phy_power", "gmac_phy_power_en", &item);
+ if (SCIRPT_ITEM_VALUE_TYPE_PIO == type) {
+ if (!gpio_request(item.gpio.gpio, NULL)) {
+ gpio_direction_output(item.gpio.gpio, 1);
+ priv->gpio_power_hd = item.gpio.gpio;
+ }
+ }
+
#ifdef CONFIG_GETH_PHY_POWER
memset(power_tb, 0, sizeof(power_tb));
for (cnt = 0; cnt < ARRAY_SIZE(power_tb); cnt++) {
@@ -1621,12 +1622,6 @@ static int geth_sys_request(struct platform_device *pdev)
int ret = 0;
struct resource *res;
@ -65,10 +88,11 @@ index 03931f2..8c9b912 100755
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "geth_extclk");
if (unlikely(!res)){
ret = -ENODEV;
@@ -1701,21 +1684,6 @@ static int geth_sys_request(struct platform_device *pdev)
@@ -1700,22 +1695,6 @@ 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) {