ARM: i.mx53: Parse Reset GPIO pin in FEC driver from Devicetree
Signed-off-by: Rostislav Lisovy <lisovy@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
bb7929aaaa
commit
5c1846b625
|
@ -27,6 +27,8 @@
|
|||
#include <linux/clk.h>
|
||||
#include <linux/err.h>
|
||||
#include <of_net.h>
|
||||
#include <of_gpio.h>
|
||||
#include <gpio.h>
|
||||
|
||||
#include <asm/mmu.h>
|
||||
|
||||
|
@ -643,6 +645,7 @@ static int fec_probe(struct device_d *dev)
|
|||
void *base;
|
||||
int ret;
|
||||
enum fec_type type;
|
||||
int phy_reset;
|
||||
|
||||
ret = dev_get_drvdata(dev, (unsigned long *)&type);
|
||||
if (ret)
|
||||
|
@ -671,6 +674,20 @@ static int fec_probe(struct device_d *dev)
|
|||
|
||||
fec->regs = dev_request_mem_region(dev, 0);
|
||||
|
||||
phy_reset = of_get_named_gpio(dev->device_node, "phy-reset-gpios", 0);
|
||||
if (gpio_is_valid(phy_reset)) {
|
||||
ret = gpio_request(phy_reset, "phy-reset");
|
||||
if (ret)
|
||||
goto err_free;
|
||||
|
||||
ret = gpio_direction_output(phy_reset, 0);
|
||||
if (ret)
|
||||
goto err_free;
|
||||
|
||||
udelay(10);
|
||||
gpio_set_value(phy_reset, 1);
|
||||
}
|
||||
|
||||
/* Reset chip. */
|
||||
writel(FEC_ECNTRL_RESET, fec->regs + FEC_ECNTRL);
|
||||
while(readl(fec->regs + FEC_ECNTRL) & 1) {
|
||||
|
|
Loading…
Reference in New Issue