linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Lucas Zampar Bernardi <lucas.zampar@gmail.com>,
	Alexander Shiyan <shc_work@mail.ru>
Cc: linux-can@vger.kernel.org
Subject: Re: MCP2515 DTS support
Date: Tue, 25 Feb 2014 22:35:18 +0100	[thread overview]
Message-ID: <530D0C96.6060207@pengutronix.de> (raw)
In-Reply-To: <5308FE97.8090804@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2640 bytes --]

On 02/22/2014 08:46 PM, Lucas Zampar Bernardi wrote:
> Hi again,
> 
> 
> I found the causes of problem, and now I need to know if I was setting
> wrong structure or there are driver problem.
> I've had this modification on mcp251x.c:
> 
> static int mcp251x_can_probe(struct spi_device *spi)
> {
>     const struct of_device_id *of_id = of_match_device(mcp251x_of_match,
>                                &spi->dev);
>     struct mcp251x_platform_data *pdata = dev_get_platdata(&spi->dev);
>     struct net_device *net;
>     struct mcp251x_priv *priv;
>     int freq, ret = -ENODEV;
>     struct clk *clk;
> 
> 
>     clk = devm_clk_get(&spi->dev, NULL);
>     dev_dbg(&spi->dev, "MCP2515: clk = devm_clk_get(&spi->dev, NULL)");
>     if (IS_ERR(clk)) {
>         if (pdata)
>         {
>             freq = pdata->oscillator_frequency;
>         }
>         else
>         {
>>>        freq = 20 * 1000 * 1000;    // FORCE FREQUENCY to 20Mhz
>             //return PTR_ERR(clk);
>         }
>     } else {
>         dev_dbg(&spi->dev, "MCP2515: freq = clk_get_rate(clk);");
>         freq = clk_get_rate(clk);
>     }
> 
> 
> Then the driver start to run.
> 
> I think that the problem is about how to set a correct clock.
> 
> 
> I put on can node:
>                 can0: can@1 {
>                     compatible = "microchip,mcp2515";
>                     reg = <2>;
>                     spi-max-frequency = <5000000>;
>                     clocks = <&mcp251x_clock>;
>                     interrupt-parent = <&pioC>; /* MCP GPO Interrupt */
>                     interrupts = <12 0x2>;
>                 };
> 
> 
> 
> and my clocks node:
> 
>     clocks {
>         #address-cells = <1>;
>         #size-cells = <1>;
>         ranges;
> 
>         main_clock: clock@0 {
>             compatible = "atmel,osc", "fixed-clock";
>             clock-frequency = <12000000>;
>         };
> 
>         mcp251x_clock: mcp2515 {
>             compatible = "fixed-clock";
>             #clock-cells = <0>;
>             clock-frequency = <20000000>;
>         };
> 
> 
>     };
> 
> 
> So... How can we know if it's a DTS definition or a driver problem?

The driver looks good. I've put Alexander Shiyan, who contributed the DT
pachtes, on Cc. Maybe he can post the DT he used.

Marc

-- 
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   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]

  reply	other threads:[~2014-02-25 21:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1445543c688.2748.cbaa067694a7e68fb76a213b35423fb5@gmail.com>
2014-02-21 16:26 ` MCP2515 DTS support Lucas Zampar Bernardi
2014-02-22 19:46   ` Lucas Zampar Bernardi
2014-02-25 21:35     ` Marc Kleine-Budde [this message]
2014-02-26  4:17       ` Alexander Shiyan
2014-02-26 13:12         ` Lucas Zampar Bernardi
2014-02-26 14:50           ` Alexander Shiyan
2014-02-26 17:36             ` Lucas Zampar Bernardi
2014-02-26 17:50               ` Marc Kleine-Budde
2014-02-26 18:01                 ` Alexander Shiyan
2014-02-26 18:17                   ` Lucas Zampar Bernardi

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=530D0C96.6060207@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=lucas.zampar@gmail.com \
    --cc=shc_work@mail.ru \
    /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;
as well as URLs for NNTP newsgroup(s).