<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 22, 2017 at 8:57 PM, Dana Myers <span dir="ltr"><<a href="mailto:k6jq@comcast.net" target="_blank">k6jq@comcast.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF">
    <div class="gmail-m_-5593086319371465818m_4148322773140317813moz-cite-prefix">On 2/22/2017 6:18 PM, L. D. Pinney
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr"><br>
        <div>spi-mt7621.c has bugs ... isn't very helpful.</div>
      </div>
    </blockquote>
    <br>
    I am a bit surprised you're not already aware of the SPI issues.<br>
    <br></div></blockquote><div><br></div><div>I am not surprised at all ... ALL of my MT76x8 devices have only a single SPI-NOR Chip connected to the SPI.</div><div>On every device it works as intended ... load the OS.</div><div><br></div><div>Whenever you (or anyone) adds functionality to a device you can expect problems.</div><div>In this case some device foreign to the actual device in question.</div><div>More specifically a device such as a RFID module or STM32.</div><div><br></div><div>If you have a working patch...You can start here :</div><div><br></div><div><a href="https://lede-project.org/docs/guide-developer/the-source-code">https://lede-project.org/docs/guide-developer/the-source-code</a></div><div> </div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF">
    You can start here:<br>
    <br>
        <a class="gmail-m_-5593086319371465818m_4148322773140317813moz-txt-link-freetext" href="https://community.onion.io/topic/1560/spi-pins-for-the-omega2/20" target="_blank">https://community.onion.io/top<wbr>ic/1560/spi-pins-for-the-omega<wbr>2/20</a><br>
    <br>
    which links to another forum thread which contains this *very*
    informative<br>
    posting:<br>
    <br>
        <a class="gmail-m_-5593086319371465818m_4148322773140317813moz-txt-link-freetext" href="http://52.76.69.244/jforum/posts/list/30/3683.page#12266" target="_blank">http://52.76.69.244/jforum/pos<wbr>ts/list/30/3683.page#12266</a><br>
    <br>
    and suggested patch:<br>
    <br>
        <a class="gmail-m_-5593086319371465818m_4148322773140317813moz-txt-link-freetext" href="http://52.76.69.244/jforum/posts/list/30/3683.page#12299" target="_blank">http://52.76.69.244/jforum/pos<wbr>ts/list/30/3683.page#12299</a><br>
    <br>
    which is the basis of the patch I'm using.<br>
    <br>
    <blockquote type="cite">
      <div dir="ltr">
        <div>Please describe the problem?</div>
        <div><br>
        </div>
      </div>
    </blockquote>
    berniwa does a much better job than me in the above-linked posting.<br>
    <br>
    <br>
    <blockquote type="cite">
      <div dir="ltr">
        <div>Can I reproduce the same problem on one of my many MT76x8
          devices?</div>
        <div>If so how?</div>
      </div>
    </blockquote>
    <br>
    I've only seen reports of  the issue on MT7688-based devices (LinkIt
    7688, Omega2)<br>
    and I personally have observed it on the Omega2.<br>
    <br>
    The easiest way to reproduce it is to attempt to send an SPI
    sequence<br>
    starting with the '10' bit sequence (first nibble of 0x8 .. 0xb).
    You'll find<br>
    the leading '1' bit is sent as a '0'.<br>
    <br>
    I'd be somewhat surprised if the same issue wasn't present on all
    devices which<br>
    incorporate the MT7621 SPI peripheral given the likelihood that
    MediaTek<br>
    reproduces the same logic on every chip that includes the
    peripheral.<br>
    <br>
    The SPI driver also exposes the transfer limit of 16 bytes, which
    berniwa's<br>
    patch addresses by breaking up a transfer as needed (keeping chip
    select<br>
    asserted).<br>
    <blockquote type="cite">
      <div dir="ltr">
        <div><br>
        </div>
        <div>The MediaTek Linkit github is based on OpenWrt 15.05 using
          a 3.18 kernel.</div>
        <div>The patches needed for 3.18 vs. 4.4 or 4.9 will be quite
          different.</div>
      </div>
    </blockquote>
    <br>
    Understood; I didn't say that MediaTek was using the *same* patch,
    but that<br>
    this issue is present on all MT7688 devices and that MediaTek has
    incorporated<br>
    a patch for it. The patch I'm using is for 4.4, of course.<br>
    <br>
    If you could confirm the presence of  the issue on other
    MT7621-based SPI<br>
    peripherals, that would address my initial inquiry indirectly if we
    could just<br>
    patch all instances of the MT7621 SPI build :-)<br>
    <br>
    Cheers,<br>
    Dana  K6JQ<br>
    <br>
    <blockquote type="cite">
      <div dir="ltr">
        <div><br>
        </div>
        <div><br>
        </div>
        <div> </div>
        <div><br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Wed, Feb 22, 2017 at 7:00 PM, Dana
          Myers <span dir="ltr"><<a href="mailto:k6jq@comcast.net" target="_blank">k6jq@comcast.net</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
            <div bgcolor="#FFFFFF">
              <div class="gmail-m_-5593086319371465818m_4148322773140317813m_651582301430210751moz-cite-prefix">On
                2/22/2017 4:27 PM, L. D. Pinney wrote:<br>
              </div>
              <blockquote type="cite">
                <div dir="ltr">Are you using <a href="https://github.com/OnionIoT/source" target="_blank">https://github.com/Onion<wbr>IoT/source</a>
                  onion-omega2 branch ?</div>
                <div class="gmail_extra"><br>
                </div>
              </blockquote>
              <br>
              I am not; I'm using <a class="gmail-m_-5593086319371465818m_4148322773140317813m_651582301430210751moz-txt-link-freetext" href="https://github.com/lede-project/source" target="_blank">https://github.com/lede-projec<wbr>t/source</a>
              (master branch)<br>
              <br>
              However, I don't believe it makes any difference -
              spi-mt7621.c appears<br>
              to be identical in both and the same patch applies; and
              this isn't an<br>
              Omega2-specific issue. All MT7688-based systems have this
              issue; MediaTek<br>
              Labs patched their LinkIt repo for this. A fix really
              belongs upstream.<br>
              <br>
              Thanks -<br>
              Dana<br>
              <br>
              <br>
              <blockquote type="cite">
                <div class="gmail_extra">
                  <div class="gmail_quote">On Wed, Feb 22, 2017 at 2:30
                    PM, Dana Myers <span dir="ltr"><<a href="mailto:k6jq@comcast.net" target="_blank">k6jq@comcast.net</a>></span>
                    wrote:<br>
                    <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
                      I'm working with the Onion Omega2, which is based
                      on an MT7688 SoC.<br>
                      The MT7688 SoC is a variant of the MT76xx family;
                      in particular, it<br>
                      shares the same SPI peripheral. Support for SPI is
                      in ..../drivers/spi/mt7621.c<br>
                      <br>
                      However, there's  bugs with the SPI in the MT7688
                      which require a patch<br>
                      to spi-mt7621.c - and I don't know if the same
                      bugs are present in the<br>
                      other MT76xx family members. It is possible the
                      other MT76xx SoCs have<br>
                      the same hardware issue (I'd be surprised if not)
                      but I can only test<br>
                      the MT7688 I have.<br>
                      <br>
                      I think I want to patch the source file only when
                      building only the MT7688<br>
                      target, but I'm not sure how to do that or if it's
                      supported.<br>
                      <br>
                      So I'm looking for advice on how I might
                      incorporate this patch so<br>
                      that it is only applied when building
                      ramips/mt7688.<br>
                      <br>
                      Thanks,<br>
                      Dana K6JQ<br>
                      ______________________________<wbr>_________________<br>
                      openwrt-devel mailing list<br>
                      <a href="mailto:openwrt-devel@lists.openwrt.org" target="_blank">openwrt-devel@lists.openwrt.or<wbr>g</a><br>
                      <a href="https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel" rel="noreferrer" target="_blank">https://lists.openwrt.org/cgi-<wbr>bin/mailman/listinfo/openwrt-d<wbr>evel</a><br>
                    </blockquote>
                  </div>
                  <br>
                </div>
              </blockquote>
              <br>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </div>

</blockquote></div><br></div></div>