U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Angus Ainslie <angus@akkea.ca>
To: Heiko Thiery <heiko.thiery@gmail.com>
Cc: u-boot@lists.denx.de, Marek Vasut <marex@denx.de>,
	Michale Walle <michael@walle.cc>,
	Angus Ainslie <angus.ainslie@puri.sm>,
	lukma@denx.de, seanga2@gmail.com, sbabic@denx.de,
	festevam@gmail.com, uboot-imx@nxp.com, peng.fan@nxp.com
Subject: Re: [RFC] serial: mxc: get the clock frequency from the used clock for the device
Date: Tue, 22 Mar 2022 05:47:57 -0700	[thread overview]
Message-ID: <07b0fe11ef637f518ff5d499e25a72ed@akkea.ca> (raw)
In-Reply-To: <CAEyMn7aVR+mEJGf3HTQNVt8bPBBjB73dsDw2815XJsdjaNbzrg@mail.gmail.com>

On 2022-03-21 06:50, Heiko Thiery wrote:
> Hi Angus,
> 
> [snip]
> 
>> > So I'm not sure if the ipg clock is the right one for the boards that
>> > has different clock for ipg and per.
>> 
>> So I only looked at imx6qdl.dtsi where the clocks are different
>> 
>> clocks = <&clks IMX6QDL_CLK_UART_IPG>,
>>           <&clks IMX6QDL_CLK_UART_SERIAL>;
>> clock-names = "ipg", "per";
>> 
>> And from that file it looks like the per clock would be the correct 
>> one.
> 
> Yes, 'per' seems to be the right one.
> 
>> Should the clock be looked up by id instead of by name and then have a
>> different code path for each imx board type ?
> 
> But how to get the right clk id? The id's for all the implementations
> are different. Or not?
> 

Yeah you're correct that won't work.

>> 
>> >
>> >> > +     }
>> >> > +
>> >> > +     /* as fallback we try to get the clk rate that way */
>> >> > +     if (rate == 0)
>> >> > +             rate = imx_get_uartclk();
>> >>
>> >> Would it be better to re-write imx_get_uartclk so that both the
>> >> getting
>> >> and setting of clocks was correct ?
>> >
>> > I do not understand what you mean with that.
>> >
>> 
>> There are other places in the code that imx_get_uartclk gets called. 
>> If
>> an index was added to imx_get_uartclk(int index) then you wouldn't 
>> need
>> the code above in the mxc_serial_setbrg function. That would also make
>> all of the places where imx_get_uartclk gets called return the correct
>> value.
> 
> By index do you mean the clk id?
> 

No I was thinking number of the device uart[0-3].

Thinking about it some more it's probably not useful as you already have 
the udevice pointer. I was just trying to think of ways to reduce the 
amount of code change for the older SOCs. Using the 'per' clock is a 
better solution.

>> 
>> It might make sense to create a new function imx7_get_uartclk that 
>> gets
>> called on newer SOCs so that the imx6 and earlier code doesn't need to
>> get changed.
> 
> At what point should this be called instead of the imx_get_uartclk() 
> function?
> 

I was thinking a CONFIG_IS_ENBLED switch between the old version and the 
new one based on SOC.

Angus

  reply	other threads:[~2022-03-22 12:48 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-17 12:41 [RFC] serial: mxc: get the clock frequency from the used clock for the device Heiko Thiery
2022-03-17 13:19 ` Angus Ainslie
2022-03-18 19:06   ` Heiko Thiery
2022-03-19 14:32     ` Angus Ainslie
2022-03-21 13:50       ` Heiko Thiery
2022-03-22 12:47         ` Angus Ainslie [this message]
2022-03-24  2:08           ` Adam Ford
2022-03-24  9:58             ` Heiko Thiery
2022-03-24 10:57               ` Adam Ford
2022-03-17 14:38 ` Sean Anderson
2022-03-17 14:47   ` Michael Walle
2022-03-18  2:15     ` Sean Anderson
2022-03-17 16:31   ` Lukasz Majewski
2022-03-17 19:14   ` Heiko Thiery
2022-03-18  2:19     ` Sean Anderson
2022-03-18  8:05       ` Heiko Thiery
2022-03-18 13:26         ` Sean Anderson

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=07b0fe11ef637f518ff5d499e25a72ed@akkea.ca \
    --to=angus@akkea.ca \
    --cc=angus.ainslie@puri.sm \
    --cc=festevam@gmail.com \
    --cc=heiko.thiery@gmail.com \
    --cc=lukma@denx.de \
    --cc=marex@denx.de \
    --cc=michael@walle.cc \
    --cc=peng.fan@nxp.com \
    --cc=sbabic@denx.de \
    --cc=seanga2@gmail.com \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-imx@nxp.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