From: Florian Fainelli <f.fainelli@gmail.com>
To: Joel Stanley <joel@jms.id.au>,
"David S . Miller" <davem@davemloft.net>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Andrew Jeffery <andrew@aj.id.au>
Subject: Re: [PATCH] net: ftgmac100: Request clock and set speed
Date: Mon, 9 Oct 2017 22:04:07 -0700 [thread overview]
Message-ID: <0150f64f-6093-1cca-465b-8ec158abe7e6@gmail.com> (raw)
In-Reply-To: <20171010044925.21078-1-joel@jms.id.au>
On 10/09/2017 09:49 PM, Joel Stanley wrote:
> According to the ASPEED datasheet, gigabit speeds require a clock of
> 100MHz or higher. Other speeds require 25MHz or higher.
>
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> ---
> @@ -161,6 +170,9 @@ static int ftgmac100_reset_and_config_mac(struct ftgmac100 *priv)
> break;
> }
>
> + if (freq && priv->clk)
> + clk_set_rate(priv->clk, freq);
Checking for priv->clk should not be necessary all public clk APIs can
deal with a NULL clock pointer.
> +
> /* (Re)initialize the queue pointers */
> priv->rx_pointer = 0;
> priv->tx_clean_pointer = 0;
> @@ -1775,6 +1787,13 @@ static int ftgmac100_probe(struct platform_device *pdev)
> priv->dev = &pdev->dev;
> INIT_WORK(&priv->reset_task, ftgmac100_reset_task);
>
> + /* Enable clock if present */
> + priv->clk = devm_clk_get(&pdev->dev, NULL);
> + if (!IS_ERR(priv->clk))
> + clk_prepare_enable(priv->clk);
> + else
> + priv->clk = NULL;
Same here.
> +
> /* map io memory */
> priv->res = request_mem_region(res->start, resource_size(res),
> dev_name(&pdev->dev));
> @@ -1883,6 +1902,9 @@ static int ftgmac100_remove(struct platform_device *pdev)
>
> unregister_netdev(netdev);
>
> + if (priv->clk)
> + clk_disable_unprepare(priv->clk);
And here.
> +
> /* There's a small chance the reset task will have been re-queued,
> * during stop, make sure it's gone before we free the structure.
> */
>
--
Florian
next prev parent reply other threads:[~2017-10-10 5:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-10 4:49 Joel Stanley
2017-10-10 5:04 ` Florian Fainelli [this message]
2017-10-10 5:08 ` Joel Stanley
2017-10-10 8:14 ` Benjamin Herrenschmidt
2017-10-12 3:02 ` Joel Stanley
2017-10-11 19:08 ` 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=0150f64f-6093-1cca-465b-8ec158abe7e6@gmail.com \
--to=f.fainelli@gmail.com \
--cc=andrew@aj.id.au \
--cc=benh@kernel.crashing.org \
--cc=davem@davemloft.net \
--cc=joel@jms.id.au \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.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
all inboxes | Powered by JetHome®