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>
Use the macros STDIN_FILENO and STDOUT_FILENO to refer to the file
handles for stdin and stdout. This prevents us from using the wrong handle
to write or read, which was a problem with the older code.
Signed-off-by: Sean Cross <xobs@kosagi.com>
The memset() prototype from glibc includes __THROW and __nonnull as
decorators, which are nonstandard. Remove these for additional
compatibility with gcc.
Additionally, remove linux/types.h and linux/string.h, and replace them
with sys/types.h and sys/string.h.
The "make test" target allows for more convenient testing of new code. It
uses novena-usb-hub to power-toggle the USB port on Novena, then upload the
new build of fernly.
Signed-off-by: thesourcerer8 <pg@futureware.at>
gcc will automatically use these functions for certain operations. Don't
punt and use printf(), instead call serial_putc and serial_puts.
Signed-off-by: Sean Cross <xobs@kosagi.com>
It was nice, but it isn't as good at cross-compiling yet. Plus, by sticking
with gcc, we have one compiler throughout the entire system.
Signed-off-by: Sean Cross <xobs@kosagi.com>
The serial is in an unknown state at the start, so print the
register list after init.
This will cause some registers to get clobbered. If we really need
to know the state of the registers early on, we should copy them
to RAM before our init code runs.
Signed-off-by: Sean Cross <xobs@kosagi.com>
The USB device was triggering bugs in the Linux USB stack. Possibly
a queueing issue, I'm not sure. The end result was corruption in audio
playback, probably due to DMA timing issues.
Signed-off-by: Sean Cross <xobs@kosagi.com>