[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160610121149.GC2338@lunn.ch>
Date: Fri, 10 Jun 2016 14:11:49 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Florian Fainelli <f.fainelli@...il.com>
Cc: netdev@...r.kernel.org, vivien.didelot@...oirfairelinux.com,
davem@...emloft.net, jon.mason@...adcom.com,
hemal.shah@...adcom.com, bandaru.viswanath@...adcom.com,
michael.chan@...adcom.com, jogo@...nwrt.org, cphealy@...il.com,
ardeleanalex@...il.com, jiri@...lanox.com, idosch@...lanox.com
Subject: Re: [PATCH net-next 1/5] net: dsa: b53: Add support for Broadcom
RoboSwitch
> +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
Powered by blists - more mailing lists