1. 01 Dec, 2016 1 commit
    • Bernhard Nortmann's avatar
      fel: Add a --list option to enumerate FEL devices · beeb8ec3
      Bernhard Nortmann authored
      
      
      "./sunxi-fel --list" enumerates Allwinner USB devices that
      are in FEL mode. For each device detected, the SoC name/ID
      and - if available - the SID key will be printed to stdout.
      The utility then exits with status code 0 (upon success),
      or 1 if no devices were found.
      
      The current implementation treats the list feature as an option,
      to be able to handle it *before* the first attempt to call
      feldev_open() - which could fail (with no FEL devices connected).
      However, a "list" alias is available for users who expect this
      to be 'command' syntax, so "./sunxi-fel list" works too.
      Signed-off-by: default avatarBernhard Nortmann <bernhard.nortmann@web.de>
      beeb8ec3
  2. 29 Nov, 2016 9 commits
  3. 19 Nov, 2016 2 commits
  4. 13 Nov, 2016 1 commit
  5. 11 Nov, 2016 1 commit
    • Bernhard Nortmann's avatar
      fel: Lower timeout to a more practical value · d3e860b0
      Bernhard Nortmann authored
      
      
      The previous timeout of 60 seconds was mostly based on scenarios
      where large ("write") transfers take place. But it could easily
      become annoying if users are awaiting completion of simpler
      commands like "read" or "hexdump", and for some reason FEL fails
      to respond.
      
      Therefore I've decided to lower the timeout value to 10 seconds,
      adjust the maximum chunk size accordingly and - while at it -
      improve the source comments documenting their relationship.
      Signed-off-by: default avatarBernhard Nortmann <bernhard.nortmann@web.de>
      d3e860b0
  6. 10 Nov, 2016 1 commit
  7. 26 Oct, 2016 2 commits
  8. 25 Oct, 2016 2 commits
  9. 24 Oct, 2016 2 commits
    • Bernhard Nortmann's avatar
      Have programs display version information in their usage help · 569f1896
      Bernhard Nortmann authored
      
      
      This way we don't have to introduce new options for retrieving
      version info. For those programs that do not output their usage
      by default (e.g. because they would process stdin), you may pass
      a "-?" option to get help - and thus version information.
      Signed-off-by: default avatarBernhard Nortmann <bernhard.nortmann@web.de>
      569f1896
    • NiteHawk's avatar
      fel: Add the ability to pass uEnv-style data via FEL (#60) · a8eadb9b
      NiteHawk authored
      
      
      * fel: Add the ability to pass uEnv-style data via FEL
      
      The corresponding format is recognized by having the environment
      data (= text) start with a special "#=uEnv" marker. Upon transfer
      of such a file, sunxi-fel will detect this condition, and set a
      field in the SPL header accordingly - which in turn also requests
      U-Boot to auto-import it (i.e. merge with the default environment).
      
      (Note that this requires a U-Boot version that knows about the
      new meaning of this field, namely v2016.09 or later. Older U-Boot
      versions will fail to import the uEnv-style data.)
      Signed-off-by: default avatarBernhard Nortmann <bernhard.nortmann@web.de>
      a8eadb9b
  10. 22 Oct, 2016 1 commit
  11. 27 May, 2016 1 commit
  12. 11 May, 2016 1 commit
    • Siarhei Siamashka's avatar
      fel: Add fel spl command support for Allwinner A64 · 52768471
      Siarhei Siamashka authored
      
      
      The SCTLR bits are somewhat different because the V bit is set
      to 0 on A64 (Low exception vectors, base address 0x00000000) and
      the UNK bit (Reads of this bit return an UNKNOWN value) is also not
      the same as on the other SoCs. So the SCTLR check can be relaxed.
      
      Changes in v2:
       - Because the SRAM A and SRAM C reside back-to-back in the address
         space, it is possible to use 40 KiB of SRAM by the SPL for its
         code+data+stack. So the FEL backup storage is moved from 0x18000
         to 0x1A000 to support this.
      Signed-off-by: default avatarSiarhei Siamashka <siarhei.siamashka@gmail.com>
      52768471
  13. 08 May, 2016 4 commits
  14. 06 May, 2016 1 commit
  15. 05 May, 2016 3 commits
    • Bernhard Nortmann's avatar
      fel: add "sid" command to print SID (128-bit key) on supported SoCs · 848a054c
      Bernhard Nortmann authored
      
      
      This patch makes use of the new aw_fel_readl_n() function to output
      the first four 32-bit values (SID key) from an SoC-specific address.
      The corresponding e-fuses may not necessarily start at the SID
      "base" address, e.g. on H3/A83T they are at <base+0x200>.
      
      Note: SoC support is currently incomplete. In particular, reading
      the SID on A31(s) is unsupported. Accessing it there is complicated
      by the fact that Allwinner moved this information from the SoC into
      the PMIC/AXP221.
      Signed-off-by: default avatarBernhard Nortmann <bernhard.nortmann@web.de>
      848a054c
    • Bernhard Nortmann's avatar
      fel: Add "readl" and "writel" commands · 3269b963
      Bernhard Nortmann authored
      
      Signed-off-by: default avatarBernhard Nortmann <bernhard.nortmann@web.de>
      
      Squashed commit of the following:
      
      commit 95f3614357446c4a35ec541bb2c21503c54d3fac
      Author: Bernhard Nortmann <bernhard.nortmann@web.de>
      Date:   Fri Apr 8 09:10:17 2016 +0200
      
          fel: Add support for multiple sequential readl/writel
      
          There are cases where "long" reads/writes might be used to transfer
          multiple values from/to sequential addresses.
      
          When doing so, we can avoid having to setup and upload the entire
          scratch buffer (ARM code) every time, by making the underlying
          functions auto-increment the address on each invocation.
      
          The patch implements this functionality, and maps the existing
          aw_fel_readl() and aw_fel_writel() to special cases (count == 1).
      Signed-off-by: default avatarBernhard Nortmann <bernhard.nortmann@web.de>
      
      commit 20ececdfc7f3c4070469a7b74ba77bb74e01f876
      Author: Bernhard Nortmann <bernhard.nortmann@web.de>
      Date:   Fri Apr 8 09:00:20 2016 +0200
      
          fel: Modify handling of command line args for "readl"/"writel"
      
          Most other commands use their decoded argument values directly,
          without storing them to local vars first. Also "writel" needs
          an (argc > 3).
      Signed-off-by: default avatarBernhard Nortmann <bernhard.nortmann@web.de>
      
      commit b4216371b97e9f1dd19f7fc2ce720b9cb8e2434e
      Author: Siarhei Siamashka <siarhei.siamashka@gmail.com>
      Date:   Sat Dec 19 08:22:26 2015 +0200
      
          fel: Add "readl" and "writel" commands
      
          The read/write operations done by FEL are not suitable for accessing
          hardware registers. For example, trying to read a SID value using
          the "read" or "hexdump" commands results in the following:
      
            $ sunxi-fel hexdump 0x01c23800 4
            01c23800: 87 00 00 00 __ __ __ __ __ __ __ __ __ __ __ __
      
          Apparently, FEL tries to read data one byte at a time and this does
          not always work correctly. Introducing new commands to explicitly
          do 32-bit reads and writes helps:
      
            $ sunxi-fel readl 0x01c23800
            0x16254187
      Signed-off-by: default avatarSiarhei Siamashka <siarhei.siamashka@gmail.com>
      Tested-by: default avatarBernhard Nortmann <bernhard.nortmann@web.de>
      3269b963
    • Siarhei Siamashka's avatar
      fel: Move the temporary scratch buffer under the IRQ stack · 118dfa8e
      Siarhei Siamashka authored
      
      
      Doing certain operations may need uploading and executing code
      on the device. For example, such operations right now are
      reading/writing ARM CP15 coprocessor registers. Uploading the
      code to the device is naturally overwriting some part of SRAM
      as a side effect. Right now it is not a problem, because the
      CP15 coprocessor registers are only accessed as part of uploading
      and executing U-Boot SPL. They are nicely timed not to cause
      problems and the temporary scratch area gets overwritten by
      the SPL code anyway.
      
      But if we decide to provide access to such operations via
      command line interface, then any side effects may potentially
      cause problems for the users. Consider the following scenario:
      
        sunxi-fel clear 0x2000 0x100 \
                  advanced-command-which-uploads-and-executes-code \
                  hexdump 0x2000 0x100
      
      The user may rightfully expect that clearing a buffer in SRAM
      to zero and then reading it back should show all zero bytes.
      But inserting advanced commands in the middle may cause data
      corruption.
      
      In order to resolve this problem, just move the scratch area
      away from the 0x2000-0x5BFF addresses range. These particular
      addresses are already known to the users as a safe place for
      their bare metal expariments in FEL mode. The "sunxi-fel spl"
      command is a special case though and it is expected to
      overwrite data in this area too.
      
      A possible alternative would be to just backup & restore data
      in the scratch area. But this has some disadvantages:
        1. Extra code in the sunxi-fel tool and extra roundtrips over
           USB to do the backup/restore job.
        2. If we allow the OpenRISC core to use the 0x2000-0x5C00
           range in SRAM A1, then this becomes unsafe and racy
           (we can't really backup & restore data without causing
           a temporarily glitch for the currently running code on
           the OpenRISC core).
      
      To sum it up. With this patch we make it so that now the
      0x2000-0x5BFF range is freely available for the users of the
      sunxi-fel tool. The 0x1000-0x1FFF range is off limits (the
      upper part of it is used by the FEL IRQ handler, the lower
      part of it is reserved for internal use by the sunxi-fel
      tool). The 0x0000-0x0FFF addresses range is reserved for
      passing data from the SPL to the main U-Boot binary (via
      the SPL header) and is also off limits.
      Signed-off-by: default avatarSiarhei Siamashka <siarhei.siamashka@gmail.com>
      Tested-by: default avatarBernhard Nortmann <bernhard.nortmann@web.de>
      Reviewed-by: default avatarBernhard Nortmann <bernhard.nortmann@web.de>
      118dfa8e
  16. 04 May, 2016 2 commits
  17. 03 May, 2016 1 commit
  18. 20 Apr, 2016 5 commits