Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1599597

Re: [PATCH net-next 4/4] net-next: dsa: add dsa support for Mediatek MT7530 switch

From Andrew Lunn <andrew@lunn.ch>
Newsgroups linux.kernel
Subject Re: [PATCH net-next 4/4] net-next: dsa: add dsa support for Mediatek MT7530 switch
Date 2017-03-13 17:50 +0100
Message-ID <tkBku-3fs-25@gated-at.bofh.it> (permalink)
References <tkARr-34n-13@gated-at.bofh.it> <tkARr-34n-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi Sean

Just looking at the GPIO handling at the moment.

> +	/* Reset whole chip through gpio pin or
> +	 * memory-mapped registers for different
> +	 * type of hardware
> +	 */
> +	if (priv->mcm) {
> +		regmap_update_bits(priv->ethsys, SYSC_REG_RSTCTRL,
> +				   RESET_MCM, RESET_MCM);
> +		usleep_range(1000, 1100);
> +		regmap_update_bits(priv->ethsys, SYSC_REG_RSTCTRL,
> +				   RESET_MCM, ~RESET_MCM);
> +	} else {
> +		gpio_direction_output(priv->reset, 0);
> +		usleep_range(1000, 1100);
> +		gpio_set_value(priv->reset, 1);
> +	}

....

> +	/* Not MCM that indicates switch works as the remote standalone
> +	 * integrated circuit so the GPIO pin would be used to complete
> +	 * the reset, otherwise memory-mapped register accessing used
> +	 * through syscon provides in the case of MCM.
> +	 */
> +	if (!priv->mcm) {
> +		priv->reset = of_get_named_gpio(dn, "mediatek,reset-pin", 0);
> +		if (!gpio_is_valid(priv->reset))
> +			return priv->reset;
> +
> +		ret = devm_gpio_request_one(&mdiodev->dev,
> +					    priv->reset, GPIOF_OUT_INIT_LOW,
> +					    "mediatek,reset-pin");
> +		if (ret < 0) {
> +			dev_err(&mdiodev->dev,
> +				"fail to devm_gpio_request reset\n");
> +			return ret;
> +		}
> +	}

You are not handling the flags part of the GPIO binding. It is better
to use devm_gpiod_ API calls, which will handle the active low flags
for you.

    Andrew

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH net-next 0/4] net-next: dsa: add Mediatek MT7530 support <sean.wang@mediatek.com> - 2017-03-13 17:20 +0100
  [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX handler <sean.wang@mediatek.com> - 2017-03-13 17:20 +0100
    Re: [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX  handler Andrew Lunn <andrew@lunn.ch> - 2017-03-13 17:40 +0100
    Re: [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX  handler Florian Fainelli <f.fainelli@gmail.com> - 2017-03-13 17:50 +0100
      Re: [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX  handler Sean Wang <sean.wang@mediatek.com> - 2017-03-14 07:20 +0100
    Re: [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX handler Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-03-13 18:10 +0100
      Re: [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX  handler Sean Wang <sean.wang@mediatek.com> - 2017-03-14 07:30 +0100
        Re: [PATCH net-next 2/4] net-next: dsa: add Mediatek tag RX/TX handler Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2017-03-14 14:50 +0100
  [PATCH net-next 3/4] net-next: ethernet: mediatek: add CDM able to recognize the tag for DSA <sean.wang@mediatek.com> - 2017-03-13 17:20 +0100
    Re: [PATCH net-next 3/4] net-next: ethernet: mediatek: add CDM able  to recognize the tag for DSA Andrew Lunn <andrew@lunn.ch> - 2017-03-13 17:40 +0100
    Re: [PATCH net-next 3/4] net-next: ethernet: mediatek: add CDM able  to recognize the tag for DSA Florian Fainelli <f.fainelli@gmail.com> - 2017-03-13 17:50 +0100
  Re: [PATCH net-next 4/4] net-next: dsa: add dsa support for Mediatek  MT7530 switch Andrew Lunn <andrew@lunn.ch> - 2017-03-13 17:50 +0100
  Re: [PATCH net-next 0/4] net-next: dsa: add Mediatek MT7530 support John Crispin <john@phrozen.org> - 2017-03-13 18:00 +0100
  Re: [PATCH net-next 4/4] net-next: dsa: add dsa support for Mediatek  MT7530 switch Andrew Lunn <andrew@lunn.ch> - 2017-03-14 00:20 +0100
    Re: [PATCH net-next 4/4] net-next: dsa: add dsa support for  Mediatek MT7530 switch Sean Wang <sean.wang@mediatek.com> - 2017-03-14 08:10 +0100

csiph-web