From: Rostislav Lisovy <lisovy@gmail.com>
To: barebox@lists.infradead.org
Cc: Rostislav Lisovy <lisovy@gmail.com>, pisa@cmp.felk.cvut.cz
Subject: [PATCH 2/3] ARM: i.mx53: Parse Reset GPIO pin in FEC driver from Devicetree
Date: Tue, 12 Nov 2013 23:46:35 +0100 [thread overview]
Message-ID: <1384296396-18841-3-git-send-email-lisovy@gmail.com> (raw)
In-Reply-To: <1384296396-18841-1-git-send-email-lisovy@gmail.com>
Signed-off-by: Rostislav Lisovy <lisovy@gmail.com>
diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index 2f31352..9855e8c 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -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,36 @@ static int fec_probe(struct device_d *dev)
fec->regs = dev_request_mem_region(dev, 0);
+ if (IS_ENABLED(CONFIG_OFDEVICE)) {
+ phy_reset = of_get_named_gpio(dev->device_node, "phy-reset-gpios", 0);
+ if (phy_reset < 0) {
+ pr_info("%s: 'phy-reset-gpios' not used. Skipping hardware PHY reset.\n", __func__);
+ } else {
+ if (!gpio_is_valid(phy_reset)) {
+ pr_err("%s: 'phy-reset' gpio is not valid:\n",
+ __func__);
+ goto err_free;
+ }
+
+ ret = gpio_request(phy_reset, "phy-reset");
+ if (ret) {
+ pr_err("%s: can not request gpio %d (phy-reset): %d\n",
+ __func__, phy_reset, ret);
+ goto err_free;
+ }
+
+ ret = gpio_direction_output(phy_reset, 0);
+ if (ret) {
+ pr_err("%s: can not set gpio %d (phy-reset) direction: %d\n",
+ __func__, phy_reset, 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) {
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2013-11-12 22:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-12 22:46 [PATCH 0/3 v2] Support for Voipac X53-DMM-668 module and Voipac Baseboard Rostislav Lisovy
2013-11-12 22:46 ` [PATCH 1/3] ARM: dts: i.mx53: Internal keyboard controller + i2c pinmux Rostislav Lisovy
2013-11-12 22:46 ` Rostislav Lisovy [this message]
2013-11-13 10:35 ` [PATCH 2/3] ARM: i.mx53: Parse Reset GPIO pin in FEC driver from Devicetree Sascha Hauer
2013-11-12 22:46 ` [PATCH 3/3] ARM: i.mx53: Support for Voipac board with X53-DMM-668 module Rostislav Lisovy
2013-11-13 10:36 ` Sascha Hauer
2013-11-12 23:11 ` [PATCH 0/3 v2] Support for Voipac X53-DMM-668 module and Voipac Baseboard Rostislav Lisovy
2013-11-13 6:10 ` Sascha Hauer
-- strict thread matches above, loose matches on Subject: below --
2013-11-20 21:22 [PATCH 0/3 v3] " Rostislav Lisovy
2013-11-20 21:22 ` [PATCH 2/3] ARM: i.mx53: Parse Reset GPIO pin in FEC driver from Devicetree Rostislav Lisovy
2013-11-22 7:09 ` Sascha Hauer
2013-11-22 9:34 ` Alexander Shiyan
2013-11-05 14:42 [PATCH 0/3] Support for Voipac X53-DMM-668 module and Voipac Baseboard Rostislav Lisovy
2013-11-05 14:42 ` [PATCH 2/3] ARM: i.mx53: Parse Reset GPIO pin in FEC driver from Devicetree Rostislav Lisovy
2013-11-05 16:15 ` Jean-Christophe PLAGNIOL-VILLARD
2013-11-05 19:11 ` Pavel Pisa
2013-11-06 8:39 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1384296396-18841-3-git-send-email-lisovy@gmail.com \
--to=lisovy@gmail.com \
--cc=barebox@lists.infradead.org \
--cc=pisa@cmp.felk.cvut.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox