<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 29, 2016 at 6:49 PM, Andrew Jeffery <span dir="ltr"><<a href="mailto:andrew@aj.id.au" target="_blank">andrew@aj.id.au</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Thu, 2016-09-29 at 11:23 -0700, Maxim Sloyko wrote:<br>
> > > + /* Enable I2C Controllers */<br>
> > > + clrbits_le32(AST_SCU_BASE + AST_SCU_RESET, SCU_RESET_I2C);<br>
> > > +<br>
> > > + if (num < 3) {<br>
> ><br>
> > How do we enable buses number 1 and 2 when AST_SOC_G5 is not set?<br>
> I don't know. My guess is we don't, as in, the pins are always<br>
> assigned these functions. In datasheet these bits in PIN CTRL8<br>
> register are marked as "new in ast2500" and there is no mention of<br>
> sda{1,2},scl{1,2} in ast2500 datasheet.<br>
> Also, this part is basically taken from aspeed's sdk, this is why I<br>
> assume they are always on.<br>
<br>
</span>So to clarify, the AST2400 has (SCL1, SDA1) and (SCL2, SDA2) on fixed<br>
function pins: (K21, K22) and (J19, J18) respectively. I don't have the<br>
datasheets for earlier releases of the AST SoCs, so can't speak for<br>
them. The AST2500 has (SCL1, SDA1) and (SCL2, SDA2) on multi-function<br>
pins: (M18, M19) and (M20, P20) respectively.<br>
<br>
As an aside: In AST2500 case I2Cs 1 and 2 are only multiplexed with<br>
GPIO and are at a higher priority, so we don't need to flip any other<br>
bits to enable I2C.<br>
<br>
Maybe there should be some comments along these given the code looks<br>
odd at first glance?<br></blockquote><div><br></div><div>Added comment.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Cheers,<br>
<br>
Andrew<br>
<br>
Separately: This code makes me glad I took a data-driven approach for<br>
the Linux pinmux driver (not to say that result is beautiful either,<br>
but I don't want even begin to imagine the maze of conditionals<br>
protecting corner cases).</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div><b>M</b>axim <b>S</b>loyko</div></div>
</div></div>