Several GCC warnings were getting generated on various compilers. This
patch solves those warnings.
For various platforms, a uint32_t is not the same as an unsigned int. On
these platforms, printf("%x", (uint32_t)0) generates a warning. Use the
<inttypes.h> formats (i.e. PRIx32) as formatters to silence these warnings.
There was also a security warning picked up by certain compilers when
calling printf(msg) in fernly-usb-loader. This has been fixed.
Finally, lcd.c was refactored to fold the unused lcd_dat_slot() function
into the lcd_cmd_slot() function as a brand-new unified lcd_slot().
Signed-off-by: Sean Cross <xobs@kosagi.com>
cmd-hex: Dump absolute memory address.
This code has been copied-and-pasted across multiple projects, hence the split between
hex_offset() and hex(). This is a fine patch for this project.
Many MTK devices have bootloader connection available only for few seconds
after power-up. To not try to synchronize all of device connection over USB/
power-on and fernly-usb-loader start up, the latter can be run in this "wait"
mode, and a device connected and bootloader start at leisure.
We used to use source files taken from U-Boot to allow for division and
modular arithmetic. With the move to a BSD license, this is no longer
acceptible.
As a workaround, use a libgcc taken from a standard gcc distribution.
Add the .a file, which has not been modified in any way.
Signed-off-by: Sean Cross <xobs@kosagi.com>
This script was used early on to run Fernly on very customized hardware.
Remove it, as it's not relevant anymore.
Signed-off-by: Sean Cross <xobs@kosagi.com>
There is some racy condition where multiple bytes can cause a deadlock.
Until this is figured out, limit the FIFO to 1 byte.
Signed-off-by: Sean Cross <xobs@kosagi.com>
These calls enter into the MT6260 ROM. Explain a bit more about where they
come from and what their function prototypes are.
Signed-off-by: Sean Cross <xobs@kosagi.com>
To interactively communicate with the fernly loader, pass '-s' to the
fernly-usb-loader program. Otherwise it will wait for the shell to
start and then exit.
Signed-off-by: Sean Cross <xobs@kosagi.com>
It's unclear whether this refactor improves things at all, but it's
still limited to 32-byte buffers. Still, it results in less code,
which seems like a good thing.
Signed-off-by: Sean Cross <xobs@kosagi.com>
The set-plls script was running too quickly, and could sometimes
finish before the PLLs were stable. This patch fixes this problem,
in addition to making it clearer what the various settings do.
Signed-off-by: Sean Cross <xobs@kosagi.com>
Make the dqs/dqy values available for printing in other functions, so
we can determine what values were chosen at startup.
Signed-off-by: Sean Cross <xobs@kosagi.com>
PSRAM was failing on some newer parts. This change writes additional
values to the EMI controller early on that seems to fix the problems.
Signed-off-by: Sean Cross <xobs@kosagi.com>
Since putchar() is only called by printf() (as opposed to the lower-
level serial_putc()), we can have it nicely format the output by
adding \r when \n is printed.
To get the old behavior back, call serial_putc() directly.
This fixes gcc's optimization when calling:
printf("\n")
As this will get silently turned into a call to putchar('\n')
Signed-off-by: Sean Cross <xobs@kosagi.com>
We now use 32 bytes of the USB FIFO to increase performance with bulk
operations.
There may still be issues lurking, and 64-bytes causes issues, but so
far I've been able to read the entire SPI in 30 seconds, and it validates.
Signed-off-by: Sean Cross <xobs@kosagi.com>
The dummy read was due to a bug in the host-side flashrom code. It was
sending the NULL byte from the string. The host code has been fixed, so
the dummy read should be removed.
Signed-off-by: Sean Cross <xobs@kosagi.com>
Since putc() doesn't automatically print '\r' when '\n' is printed,
we must manually do this conversion ourselves.
Signed-off-by: Sean Cross <xobs@kosagi.com>
In order to improve reliability, add a binary mode for interacting
with the SPI chip. This lets us hook up flashrom.
Signed-off-by: Sean Cross <xobs@kosagi.com>
Due to a typo, USB receive was unreliable. This patch corrects a typo
that was causing USB receive to fail on certain devices.
Signed-off-by: Sean Cross <xobs@kosagi.com>
The default USB-CDC driver that ships with OS X does not recognize the
Fernvale platform.
Link to a repo maintianed by Jacob Rosenthal that works around the problem.
Signed-off-by: Sean Cross <xobs@kosagi.com>
To make cross-compilation easy, refer users to the setup_codesourcery
repo that is maintained by Robert Foss.
Signed-off-by: Sean Cross <xobs@kosagi.com>