netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: netdev@vger.kernel.org, vivien.didelot@savoirfairelinux.com,
	davem@davemloft.net, jon.mason@broadcom.com,
	hemal.shah@broadcom.com, bandaru.viswanath@broadcom.com,
	michael.chan@broadcom.com, jogo@openwrt.org, cphealy@gmail.com,
	ardeleanalex@gmail.com, jiri@mellanox.com, idosch@mellanox.com
Subject: Re: [PATCH net-next 1/5] net: dsa: b53: Add support for Broadcom RoboSwitch
Date: Fri, 10 Jun 2016 14:11:49 +0200	[thread overview]
Message-ID: <20160610121149.GC2338@lunn.ch> (raw)
In-Reply-To: <1465521837-30193-2-git-send-email-f.fainelli@gmail.com>

> +static void b53_switch_reset_gpio(struct b53_device *dev)
> +{
> +	int gpio = dev->reset_gpio;
> +
> +	if (gpio < 0)
> +		return;
> +
> +	/* Reset sequence: RESET low(50ms)->high(20ms)
> +	 */
> +	gpio_set_value(gpio, 0);
> +	mdelay(50);
> +
> +	gpio_set_value(gpio, 1);
> +	mdelay(20);
> +
> +	dev->current_page = 0xff;
> +}

Hi Florian

It would be better to use the gpiod API here, so the active hi/active
low flag is respected.

> +	dev->reset_gpio = b53_switch_get_reset_gpio(dev);
> +	if (dev->reset_gpio >= 0) {
> +		ret = devm_gpio_request_one(dev->dev, dev->reset_gpio,
> +					    GPIOF_OUT_INIT_HIGH, "robo_reset");
> +		if (ret)
> +			return ret;
> +	}
> +
> +	return 0;
> +}

> +static inline int b53_switch_get_reset_gpio(struct b53_device *dev)
> +{
> +	enum bcm47xx_board board = bcm47xx_board_get();
> +
> +	switch (board) {
> +	case BCM47XX_BOARD_LINKSYS_WRT300NV11:
> +	case BCM47XX_BOARD_LINKSYS_WRT310NV1:
> +		return 8;

Rather than hard coding it, could we get it from device tree?

       Andrew

  reply	other threads:[~2016-06-10 12:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-10  1:23 [PATCH net-next 0/5] net: dsa: Broadcom BCM53xx switches support Florian Fainelli
2016-06-10  1:23 ` [PATCH net-next 1/5] net: dsa: b53: Add support for Broadcom RoboSwitch Florian Fainelli
2016-06-10 12:11   ` Andrew Lunn [this message]
2016-06-10 18:49     ` Florian Fainelli
2016-06-10 18:57       ` Andrew Lunn
2016-06-10  1:23 ` [PATCH net-next 2/5] net: dsa: b53: Add BCM7445 quirk Florian Fainelli
2016-06-10  1:23 ` [PATCH net-next 3/5] net: dsa: b53: Implement ARL add/del/dump operations Florian Fainelli
2016-06-10  1:23 ` [PATCH net-next 4/5] net: dsa: b53: Add bridge support Florian Fainelli
2016-06-10  1:23 ` [PATCH net-next 5/5] net: dsa: b53: Plug in VLAN support Florian Fainelli
2016-06-10  5:21 ` [PATCH net-next 0/5] net: dsa: Broadcom BCM53xx switches support David Miller

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=20160610121149.GC2338@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=ardeleanalex@gmail.com \
    --cc=bandaru.viswanath@broadcom.com \
    --cc=cphealy@gmail.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=hemal.shah@broadcom.com \
    --cc=idosch@mellanox.com \
    --cc=jiri@mellanox.com \
    --cc=jogo@openwrt.org \
    --cc=jon.mason@broadcom.com \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@savoirfairelinux.com \
    /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).