Hi Daniel

On Fri, Jan 20, 2017 at 12:42:44AM +0100, Daniel Golle wrote:
> +int rt2800_probe_clk(struct rt2x00_dev *rt2x00dev)
> +{
> +     struct hw_mode_spec *spec = &rt2x00dev->spec;
> +     struct clk *clk = clk_get(rt2x00dev->dev, NULL);
> +
> +     if (IS_ERR(clk))
> +             return PTR_ERR(clk);
> +
> +     if (clk_get_rate(clk) == 20000000)
> +             spec->clk_is_20mhz = 1;
> +
> +     return 0;
> +}
> +
>  int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
>  {
>       int retval;
> @@ -7864,6 +7903,15 @@ int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
>       rt2800_register_write(rt2x00dev, GPIO_CTRL, reg);
>  
>       /*
> +      * Probe SoC clock.
> +      */
> +     if (rt2x00_is_soc(rt2x00dev)) {
> +             retval = rt2800_probe_clk(rt2x00dev);
> +             if (retval)
> +                     return retval;
> +     }
<snip>
> @@ -415,6 +416,7 @@ struct hw_mode_spec {
>       const struct channel_info *channels_info;
>  
>       struct ieee80211_sta_ht_cap ht;
> +     int clk_is_20mhz;

I dislike adding this variable to structure that is intended to describe
wireless capabilities. Additionally we do not actually "probe" the
clock but just read it value from rt2x00dev->dev, this can be handled
better. I'll post different patch reading clk and on top of if this
patch and "add support for RT5350 WiSoC" .

Regards
Stanislaw

Reply via email to