linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: linux-arm-kernel@lists.infradead.org, kevin@allwinnertech.com,
	sunny@allwinnertech.com, shuge@allwinnertech.com,
	"Emilio López" <emilio@elopez.com.ar>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Jiri Slaby" <jslaby@suse.cz>,
	linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/6] serial: 8250_dw: add support for clocks property when using DeviceTree
Date: Fri, 15 Mar 2013 20:48:09 +0100	[thread overview]
Message-ID: <51437AF9.2050007@free-electrons.com> (raw)
In-Reply-To: <20130315125615.GA27560@xps8300>

Hi Heikki

Le 15/03/2013 13:56, Heikki Krogerus a écrit :
>> @@ -137,8 +140,15 @@ static int dw8250_probe_of(struct uart_port *p)
>>  		p->regshift = val;
>>  
>>  	if (of_property_read_u32(np, "clock-frequency", &val)) {
>> -		dev_err(p->dev, "no clock-frequency property set\n");
>> -		return -EINVAL;
>> +		/* Get clk rate through clk driver if present */
>> +		data->clk = clk_get(p->dev, NULL);
>> +		if (IS_ERR(data->clk)) {
>> +			dev_err(p->dev, "clk or clock-frequency not defined\n");
>> +			return -EINVAL;
>> +		}
>> +
>> +		clk_prepare_enable(data->clk);
>> +		val = clk_get_rate(data->clk);
> 
> Don't get the clk here..
> 
>>  	}
>>  	p->uartclk = val;
>>  
>> @@ -300,6 +310,12 @@ static int dw8250_probe(struct platform_device *pdev)
> 
> Get it here so it is then handled for also others besides DT users.
> And prefer devm_clk_get(). Something like this:
> 
>         ...
>         uart.port.membase = ioremap(regs->start, resource_size(regs));
>         if (!uart.port.membase)
>                 return -ENOMEM;
> 
> +       data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
> +       if (!data)
> +       	return -ENOMEM;
> +        
> +       data->clk = devm_clk_get(&pdev->dev, NULL);
> +       clk_prepare_enable(data->clk);
> +
>         uart.port.iotype = UPIO_MEM;
>         uart.port.serial_in = dw8250_serial_in;
>         uart.port.serial_out = dw8250_serial_out;
> +       uart.port.private_data = data;
> +       uart.port.uartclk = clk_get_rate(data->clk);
> 
>   	dw8250_setup_port(&uart);
>         ... 
> 
> Then in dw8250_probe_of() you need to use the "clock-frequency"
> property only when p->uartclk is 0.

Thanks for your feedback.
Emilio made a new version of this patch, I'll send it soon.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2013-03-15 19:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1362694460-1919-1-git-send-email-maxime.ripard@free-electrons.com>
2013-03-07 22:14 ` [PATCH 1/6] serial: 8250_dw: add support for clocks property when using DeviceTree Maxime Ripard
2013-03-15 12:56   ` Heikki Krogerus
2013-03-15 19:48     ` Maxime Ripard [this message]

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=51437AF9.2050007@free-electrons.com \
    --to=maxime.ripard@free-electrons.com \
    --cc=emilio@elopez.com.ar \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=jslaby@suse.cz \
    --cc=kevin@allwinnertech.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=shuge@allwinnertech.com \
    --cc=sunny@allwinnertech.com \
    /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).