mbox series

[0/3] 8250_omap: use clk APIs to get fclk freqeuncy

Message ID 20190109091206.25759-1-vigneshr@ti.com
Headers show
Series 8250_omap: use clk APIs to get fclk freqeuncy | expand

Message

Raghavendra, Vignesh Jan. 9, 2019, 9:12 a.m. UTC
This series adds support obtain clk frequency of functional clk via
clocks phandle instead of hard coding it in DT as part of
clock-frequency DT parameter. This eliminates need to calculate
frequency offline and populate it.

Vignesh R (3):
  serial: 8250_omap: Drop check for of_node
  dt-bindings: serial: omap_serial: add clocks entry
  serial: 8250_omap: Use clk_get_rate() to obtain fclk frequency

 .../bindings/serial/omap_serial.txt           |  2 +
 drivers/tty/serial/8250/8250_omap.c           | 75 ++++++++++---------
 2 files changed, 42 insertions(+), 35 deletions(-)

Comments

Tony Lindgren Jan. 9, 2019, 9:44 p.m. UTC | #1
* Vignesh R <vigneshr@ti.com> [190109 09:11]:
> 8250_omap is DT only driver so dev->of_node always exists. Drop check
> for existence of valid dev->of_node to simplify omap8250_probe().

That part seems safe to me now.

> --- a/drivers/tty/serial/8250/8250_omap.c
> +++ b/drivers/tty/serial/8250/8250_omap.c
...
> -		const struct of_device_id *id;
> -
> -		ret = of_alias_get_id(pdev->dev.of_node, "serial");
> -
> -		of_property_read_u32(pdev->dev.of_node, "clock-frequency",
> -				     &up.port.uartclk);
> -		priv->wakeirq = irq_of_parse_and_map(pdev->dev.of_node, 1);
> -
> -		id = of_match_device(of_match_ptr(omap8250_dt_ids), &pdev->dev);
> -		if (id && id->data)
> -			priv->habit |= *(u8 *)id->data;

But this part it seems we still need to keep around
as we still have lots of clock-frequency references
in the *.dtsi files. Or am I missing something?

Regards

Tony
Sebastian Reichel Jan. 10, 2019, 12:07 p.m. UTC | #2
Hi,

On Wed, Jan 09, 2019 at 01:44:03PM -0800, Tony Lindgren wrote:
> * Vignesh R <vigneshr@ti.com> [190109 09:11]:
> > 8250_omap is DT only driver so dev->of_node always exists. Drop check
> > for existence of valid dev->of_node to simplify omap8250_probe().
> 
> That part seems safe to me now.
> 
> > --- a/drivers/tty/serial/8250/8250_omap.c
> > +++ b/drivers/tty/serial/8250/8250_omap.c
> ...
> > -		const struct of_device_id *id;
> > -
> > -		ret = of_alias_get_id(pdev->dev.of_node, "serial");
> > -
> > -		of_property_read_u32(pdev->dev.of_node, "clock-frequency",
> > -				     &up.port.uartclk);
> > -		priv->wakeirq = irq_of_parse_and_map(pdev->dev.of_node, 1);
> > -
> > -		id = of_match_device(of_match_ptr(omap8250_dt_ids), &pdev->dev);
> > -		if (id && id->data)
> > -			priv->habit |= *(u8 *)id->data;
> 
> But this part it seems we still need to keep around
> as we still have lots of clock-frequency references
> in the *.dtsi files. Or am I missing something?

It's re-added a couple of lines later. Only the indent was removed.

-- Sebastian
Raghavendra, Vignesh Jan. 10, 2019, 1:24 p.m. UTC | #3
On 10-Jan-19 5:37 PM, Sebastian Reichel wrote:
> Hi,
> 
> On Wed, Jan 09, 2019 at 01:44:03PM -0800, Tony Lindgren wrote:
>> * Vignesh R <vigneshr@ti.com> [190109 09:11]:
>>> 8250_omap is DT only driver so dev->of_node always exists. Drop check
>>> for existence of valid dev->of_node to simplify omap8250_probe().
>>
>> That part seems safe to me now.
>>
>>> --- a/drivers/tty/serial/8250/8250_omap.c
>>> +++ b/drivers/tty/serial/8250/8250_omap.c
>> ...
>>> -		const struct of_device_id *id;
>>> -
>>> -		ret = of_alias_get_id(pdev->dev.of_node, "serial");
>>> -
>>> -		of_property_read_u32(pdev->dev.of_node, "clock-frequency",
>>> -				     &up.port.uartclk);
>>> -		priv->wakeirq = irq_of_parse_and_map(pdev->dev.of_node, 1);
>>> -
>>> -		id = of_match_device(of_match_ptr(omap8250_dt_ids), &pdev->dev);
>>> -		if (id && id->data)
>>> -			priv->habit |= *(u8 *)id->data;
>>
>> But this part it seems we still need to keep around
>> as we still have lots of clock-frequency references
>> in the *.dtsi files. Or am I missing something?
> 
> It's re-added a couple of lines later. Only the indent was removed.
> 

That's right. You beat me to it. Thanks :)

Regards
Vignesh
Tony Lindgren Jan. 10, 2019, 3:27 p.m. UTC | #4
* Vignesh R <vigneshr@ti.com> [190110 13:24]:
> 
> On 10-Jan-19 5:37 PM, Sebastian Reichel wrote:
> > Hi,
> > 
> > On Wed, Jan 09, 2019 at 01:44:03PM -0800, Tony Lindgren wrote:
> >> * Vignesh R <vigneshr@ti.com> [190109 09:11]:
> >>> 8250_omap is DT only driver so dev->of_node always exists. Drop check
> >>> for existence of valid dev->of_node to simplify omap8250_probe().
> >>
> >> That part seems safe to me now.
> >>
> >>> --- a/drivers/tty/serial/8250/8250_omap.c
> >>> +++ b/drivers/tty/serial/8250/8250_omap.c
> >> ...
> >>> -		const struct of_device_id *id;
> >>> -
> >>> -		ret = of_alias_get_id(pdev->dev.of_node, "serial");
> >>> -
> >>> -		of_property_read_u32(pdev->dev.of_node, "clock-frequency",
> >>> -				     &up.port.uartclk);
> >>> -		priv->wakeirq = irq_of_parse_and_map(pdev->dev.of_node, 1);
> >>> -
> >>> -		id = of_match_device(of_match_ptr(omap8250_dt_ids), &pdev->dev);
> >>> -		if (id && id->data)
> >>> -			priv->habit |= *(u8 *)id->data;
> >>
> >> But this part it seems we still need to keep around
> >> as we still have lots of clock-frequency references
> >> in the *.dtsi files. Or am I missing something?
> > 
> > It's re-added a couple of lines later. Only the indent was removed.
> > 
> 
> That's right. You beat me to it. Thanks :)

Oh right, sorry I missed that :)

Regards,

Tony