Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755440AbbKRKXT (ORCPT ); Wed, 18 Nov 2015 05:23:19 -0500 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:51971 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753314AbbKRKXQ (ORCPT ); Wed, 18 Nov 2015 05:23:16 -0500 Subject: Re: [PATCH 2/2] can: m_can: Add CAN clock generated by UPLLCK support To: Wenyou Yang , Wolfgang Grandegger References: <1447841049-5010-1-git-send-email-wenyou.yang@atmel.com> <1447841049-5010-3-git-send-email-wenyou.yang@atmel.com> Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Nicolas Ferre From: Marc Kleine-Budde X-Enigmail-Draft-Status: N1110 Message-ID: <564C518A.8000501@pengutronix.de> Date: Wed, 18 Nov 2015 11:23:06 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.3.0 MIME-Version: 1.0 In-Reply-To: <1447841049-5010-3-git-send-email-wenyou.yang@atmel.com> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="3WahwkAJDksEuLn6Wk9RoapSo4VDN5meS" X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: mkl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3600 Lines: 107 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --3WahwkAJDksEuLn6Wk9RoapSo4VDN5meS Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 11/18/2015 11:04 AM, Wenyou Yang wrote: > As said SAMA5D2 datasheet, it is recommended to use the CAN clock > at frequencies of 20, 40 or 80 MHz. To achieve these frequencies, > PMC GCK3 must select the UPLLCK(480 MHz) as source clock and > divide by 24, 12 or 6. In this patch the CAN clock at 20 MHz. >=20 > As it is configured through DT, it doesn't affect the M_CAN > without configuring CAN clock and its generated clock. >=20 > Signed-off-by: Wenyou Yang NACK Please do this setup in your SoC code, where you setup the clock infrastructure or have a look at Documentation/devicetree/bindings/clock/clock-bindings.txt "Assigned clock parents and rates" > --- >=20 > drivers/net/can/m_can/m_can.c | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_ca= n.c > index fd1caa0..2ca47db 100644 > --- a/drivers/net/can/m_can/m_can.c > +++ b/drivers/net/can/m_can/m_can.c > @@ -269,6 +269,8 @@ enum m_can_mram_cfg { > #define TX_BUF_XTD BIT(30) > #define TX_BUF_RTR BIT(29) > =20 > +#define AT91_CAN_CLK_FREQ 20000000 > + > /* address offset and element number for each FIFO/Buffer in the Messa= ge RAM */ > struct mram_cfg { > u16 off; > @@ -1188,7 +1190,7 @@ static int m_can_plat_probe(struct platform_devic= e *pdev) > struct m_can_priv *priv; > struct resource *res; > void __iomem *addr; > - struct clk *hclk, *cclk; > + struct clk *hclk, *cclk, *upll_clk; > int irq, ret; > =20 > hclk =3D devm_clk_get(&pdev->dev, "hclk"); > @@ -1198,6 +1200,18 @@ static int m_can_plat_probe(struct platform_devi= ce *pdev) > return -ENODEV; > } > =20 > + upll_clk =3D devm_clk_get(&pdev->dev, "upllclk"); > + if (!IS_ERR(upll_clk)) { > + ret =3D clk_set_parent(cclk, upll_clk); > + if (!ret) { > + ret =3D clk_set_rate(cclk, AT91_CAN_CLK_FREQ); > + if (ret) { > + dev_err(&pdev->dev, "failed to set gck\n"); > + return -ENODEV; > + } > + } > + } > + > res =3D platform_get_resource_byname(pdev, IORESOURCE_MEM, "m_can"); > addr =3D devm_ioremap_resource(&pdev->dev, res); > irq =3D platform_get_irq_byname(pdev, "int0"); >=20 regards, Marc --=20 Pengutronix e.K. | Marc Kleine-Budde | Industrial Linux Solutions | Phone: +49-231-2826-924 | Vertretung West/Dortmund | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de | --3WahwkAJDksEuLn6Wk9RoapSo4VDN5meS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBCgAGBQJWTFGKAAoJEP5prqPJtc/H5igH/2JMpexzcIiNH9+CVXgatpGl QuQIW3vTXcYNYarRRcrVy7HwICunG6+7EDu2SWC36BJpmFp5A9HlU1+zD+SO+KNB z4ZRD5tDK/KH6gQdPoIt2HQkFwpq28uMyAlPCfkQiuFua0N9Tjg2iCxBougw3x4a XayVFYf5JzDkOck5u46q+xz/lgzE2L7C7ngmx6cSqs5Ub9rGHb8Vr+9pfIxISKa6 a7WSk5PqckM5JlyKspFLOdeIujQ6B3NboQA6v0+b9vDeKOo9/QEpJaBK63gY2hDg 7zZvdxY71ihT/j99S/4AL8B1oI79ASBE+Ib9eJpvdGrBtwo7Kahm9DQkU0L2qPg= =dOwB -----END PGP SIGNATURE----- --3WahwkAJDksEuLn6Wk9RoapSo4VDN5meS-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/