Re: [RFC 3/5] clk: shmobile: r8a7795: add OSC and R_INT clocks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Geert,

> > +       DEF_DIV6_RO("osc",      R8A7795_CLK_OSC,   CLK_EXTAL, 0x0240, 8),
> > +       DEF_DIV6_RO("r_int",    R8A7795_CLK_RINT,  CLK_EXTAL, 0x0240, 32),

Yes, we should ask the HW team if this is safe. I got the assumption
from Figure 8.1a. In the middle, after EXTAL divider, OSCCLK and
internal RCLK seem to have the same origin. (Note that in the diagram
the 1/4 divider should have been placed to the internal RCLK).

> However, the notes for Table 8.2a say there are _2_ possible values:
> 
>     "The initial value depend on MD14, MD13.
>      When MD14=L and MD13 = H, RCLK = 32.89 (kHz)
>      In the other setting, RCLK = 32.55 (kHz)

Well, to be precise, it says the are two resulting frequencies, but for
that, 4 values are needed as you found out.


> While the register documentation says there are _4_ possible values, and it
> doesn't document the relation behind these values and the "dividers":
> 
>     "MD14=0, MD13=0: 6’B00_1111
>      MD14=0, MD13=1: 6’B01_0010
>      MD14=1, MD13=0: 6’B01_0111
>      MD14=1, MD13=1: 6’B01_1111"
> 
> I also cannot see how you get to the RCLK/OSCCLK values by using EXTAL
> (33.33333 MHz on final boards) and the dividers above.

See figure 8.1a. OSCCLK is EXTAL_divider / 8. Internal RCLK is
EXTAL_divider / 8 / 4. So, now assume the lower 6 bits of the RCKCR
register are a standard DIV6 divider where the divisor is the value of
these bits + 1. So, with EXTAL = 33.333MHz and MD14=MD13=1, the register
value becomes 0x1f and divisor = 32.

So for internal RCLK: 33333333 / 32 (fixed prescaler) / 32 (DIV6) = 32552.1

According to the Salvator-X manual, section 2.1.1.9:

When EXTAL = 20MHz, and MD14=0 and MD13=1, then regval = 0x12, divisor = 19:

So for internal RCLK: 20000000 / 32 (fixed prescaler) / 19 (DIV6) = 32894.7

I tried all the combinations and they match the datasheet precisely.

> > +#define R8A7795_CLK_RINT               45
> > +#define R8A7795_CLK_R                  46
> > +#define R8A7795_CLK_OSC                        47
> 
> This list of values is append-only, as it's part of the stable DT ABI.
> Please add new values at the end.

Uh, okay. Then I'll introduce a special define for the end of that list,
since there is one place where R8A7795_CLK_OSC is hardcoded.

Thanks,

   Wolfram




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux