From: aisheng.dong@freescale.com (Dong Aisheng)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/2] net: flexcan: add transceiver switch gpios support
Date: Thu, 28 Jun 2012 20:47:37 +0800 [thread overview]
Message-ID: <20120628124736.GA5778@shlinux2.ap.freescale.net> (raw)
In-Reply-To: <20460.20182.552394.407578@ipc1.ka-ro>
On Thu, Jun 28, 2012 at 08:32:22PM +0800, Lothar Wa?mann wrote:
> Hi,
>
> Dong Aisheng writes:
> > On Thu, Jun 28, 2012 at 08:05:14PM +0800, Marc Kleine-Budde wrote:
> > > On 06/28/2012 01:46 PM, Shawn Guo wrote:
> > > > On Thu, Jun 28, 2012 at 07:33:28PM +0800, Dong Aisheng wrote:
> > > >>> + phy_stby_gpio = of_get_named_gpio_flags(pdev->dev.of_node,
> > > >>> + "phy-standby-gpios",
> > > >>> + 0, &flags);
> > > >>> + if (gpio_is_valid(phy_stby_gpio)) {
> > > >>> + if (flags == OF_GPIO_ACTIVE_LOW)
> > > >>> + phy_stby_high = false;
> > > >>> + err = devm_gpio_request_one(&pdev->dev, phy_stby_gpio,
> > > >>> + GPIOF_DIR_OUT,
> > > >>> + "phy-standby");
> > > >>> + if (err) {
> > > >>> + dev_err(&pdev->dev,
> > > >>> + "failed to request gpio %d: %d\n",
> > > >>> + phy_stby_gpio, err);
> > > >>> + goto failed_gpio;
> > > >> I checked mx28 evk, it seems the phy only has a STB gpio and shared by both CAN0&CAN1.
> > > >> I wonder the CAN1 probe may fail here.
> > > >>
> > > > It can be managed by dts. Here is what I have in imx28-evk.dts, where
> > > > only can0 has phy-enable-gpios property.
> > > >
> > > >
> > > > can0: can at 80032000 {
> > > > pinctrl-names = "default";
> > > > pinctrl-0 = <&can0_pins_a>;
> > > > phy-enable-gpios = <&gpio2 13 0>;
> > > > status = "okay";
> > > > };
> > > >
> > > > can1: can at 80034000 {
> > > > pinctrl-names = "default";
> > > > pinctrl-0 = <&can1_pins_a>;
> > > > status = "okay";
> > > > };
> > >
> > > Will this work if can0 is down and can1 is up?
> > >
> > > Can we abstract the transceiver power as a regulator? Or a clock? :P
> > >
> > Hmm, it may not be a power.
> > For mx28evk, it's a STBY pin.
> > So it may hard to abstract it as a regulator or clock.
> >
> I have created a 'gpio-switch' driver in my private tree that can be
> used for exactly this purpose. It takes care of the pin polarity and
> initial state of the pins and can handle shared pins like in this
> case. The client driver does not even need to care whether an actual
> GPIO exists for the current platform.
>
> I could prepare a patch and post it here.
>
Would be glad to see your patches.
It may be useful, not only for this case,
we also meet some other issues, i'm not sure but may have similar requirement
like SDIO WiFi reset, usb phy reset and etc.
Regards
Dong Aisheng
next prev parent reply other threads:[~2012-06-28 12:47 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-28 3:21 [PATCH v2 0/2] flexcan driver updates Shawn Guo
2012-06-28 3:21 ` [PATCH v2 1/2] net: flexcan: clock-frequency is optional for device tree probe Shawn Guo
2012-06-28 11:23 ` Dong Aisheng
2012-06-28 3:21 ` [PATCH v2 2/2] net: flexcan: add transceiver switch gpios support Shawn Guo
2012-06-28 5:22 ` Lothar Waßmann
2012-06-28 5:30 ` Shawn Guo
2012-06-28 6:14 ` Hui Wang
2012-06-28 6:34 ` Shawn Guo
2012-06-28 7:01 ` Hui Wang
2012-06-28 10:32 ` Marc Kleine-Budde
2012-06-28 10:31 ` Marc Kleine-Budde
2012-06-28 11:21 ` Shawn Guo
2012-06-28 11:29 ` Marc Kleine-Budde
2012-06-28 11:41 ` Shawn Guo
2012-06-28 11:52 ` Shawn Guo
2012-06-28 12:05 ` Shawn Guo
2012-06-28 12:11 ` Dong Aisheng
2012-06-28 12:19 ` Lothar Waßmann
2012-06-28 12:07 ` Lothar Waßmann
2012-06-28 12:13 ` Shawn Guo
2012-06-28 12:24 ` Lothar Waßmann
2012-07-02 2:55 ` Hui Wang
2012-06-28 12:08 ` Kurt Van Dijck
2012-06-28 12:10 ` Marc Kleine-Budde
2012-06-28 12:16 ` Shawn Guo
2012-06-28 11:39 ` Dong Aisheng
2012-06-28 11:33 ` Dong Aisheng
2012-06-28 11:46 ` Shawn Guo
2012-06-28 11:48 ` Dong Aisheng
2012-06-28 12:00 ` Shawn Guo
2012-06-28 12:02 ` Dong Aisheng
2012-06-28 12:19 ` Shawn Guo
2012-06-28 12:05 ` Marc Kleine-Budde
2012-06-28 12:18 ` Dong Aisheng
2012-06-28 12:32 ` Lothar Waßmann
2012-06-28 12:40 ` Shawn Guo
2012-06-28 12:47 ` Dong Aisheng [this message]
2012-06-28 12:39 ` Shawn Guo
2012-06-29 9:27 ` Marc Kleine-Budde
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=20120628124736.GA5778@shlinux2.ap.freescale.net \
--to=aisheng.dong@freescale.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).