Commit graph

133 commits

Author SHA1 Message Date
Paul Sokolovsky
0c2c269242 enable-psram.S: Fix typo in comment. 2015-04-05 15:22:59 +03:00
Sean Cross
a02ae82f67 Merge branch 'pfalcon-loader-wait' 2015-04-02 12:39:49 +08:00
Paul Sokolovsky
6020a9248a fernly-usb-loader.c: Add -w option, wait for serial port to appear.
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.
2015-04-02 12:39:34 +08:00
Sean Cross
005e2d67d5 Merge branch 'master' of github.com:xobs/fernly 2015-04-02 12:34:21 +08:00
Sean Cross
41511b793d LICENSE: Add BSD 2-clause license
Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-04-02 12:33:42 +08:00
Sean Cross
7323c280ce fernly: Remove GPL-2 files, move to libgcc
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>
2015-04-02 12:30:28 +08:00
Sean Cross
9e9bab1ff2 Merge pull request #16 from robertfoss/patch_1
Silenced GCC warnings
2015-03-18 17:15:59 +08:00
Sean Cross
ee08d8395a Merge pull request #15 from notthetup/patch-1
Changing baudrate to 115200
2015-03-18 17:13:55 +08:00
Robert Foss
11ac2200ff Silenced GCC warnings 2015-03-16 11:32:11 +01:00
Chinmay Pendharkar
0a1b9e3cd9 Changing baudrate to 115200
Changing baudrate to `B115200` which is defined in sys/temios.h on OSX.
2015-03-14 13:48:20 +08:00
Sean Cross
38011a7bdc spin: Remove not-very-relevant test script
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>
2015-03-11 15:14:11 +08:00
Sean Cross
7d07f8a2f0 serial: Formatting cleanup of old cruft
Remove unreachable code paths and awkward code comments.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-03-11 15:03:24 +08:00
Sean Cross
1dc8e8c573 serial: Limit USB fifo to 1 byte
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>
2015-03-11 15:00:26 +08:00
Sean Cross
8a4f98b5b1 usb-loader: Explain a little more about magic calls
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>
2015-02-19 18:54:34 +08:00
Sean Cross
91d05709fc Makefile: make 'test' and 'shell' depend on 'all'
To ensure everything is rebuilt, have the 'test' and 'shell' targets
depend on the 'all' target.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-05 16:04:49 +08:00
Sean Cross
16ffca7170 Makefile: Add 'make shell' target
The 'make shell' target loads fernly onto the board, then opens an
interactive shell with it.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-05 16:03:50 +08:00
Sean Cross
d4283bc9ce fernly-usb-loader: Add 'shell' argument
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>
2015-02-05 16:02:48 +08:00
Sean Cross
9759e98747 serial: Refactor slightly to improve throughput
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>
2015-02-05 15:50:28 +08:00
Sean Cross
977ccff309 bionic: Correct \r at the end of puts()
Since puts() calls serial_putc() directly, it needs to supply its own
\r before \n.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-05 13:03:08 +08:00
Sean Cross
f7207812b4 set-plls: Make script more robust
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>
2015-02-05 13:00:47 +08:00
Sean Cross
ef9d60df5c emi: Make dqs/dqy values global (for debug)
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>
2015-02-05 12:59:40 +08:00
Sean Cross
f15c7fb929 enable-psram: Make initialization more robust
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>
2015-02-05 12:58:27 +08:00
Sean Cross
c293f0e73f scriptic: Clean up debug output a bit
We can save a bit of space by not printing out command names twice.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-05 12:05:29 +08:00
Sean Cross
014b62ab26 bionic: Have putchar() put \r if \n is printed
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>
2015-02-05 11:31:53 +08:00
Sean Cross
1023337c61 serial: Use the USB FIFO
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>
2015-02-05 01:08:40 +08:00
Sean Cross
7ca50ab413 cmd-spi: Remove dummy read from flashrom
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>
2015-02-05 00:17:50 +08:00
Sean Cross
7b8a203f48 main: Convert serial_putc() to serial_puts()
This fixes printing '\r' when '\n' is printed.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-04 21:32:42 +08:00
Sean Cross
7321bd91ad vsprintf: Emit '\r' when printing '\n'
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>
2015-02-04 21:30:59 +08:00
Sean Cross
0bfdbb314f fernly-usb-loader: Get rid of call to 'screen'
Since we have an internal terminal of sorts, remove the call to 'screen'
when not running in monitor mode.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-04 21:30:03 +08:00
Sean Cross
9aad9797e6 README: Document flsahrom protocol
The flashrom protocol is binary, for speed.  Document this protocol.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-04 21:29:04 +08:00
Sean Cross
fb9c876148 cmd-spi: Add binary mode for flashrom
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>
2015-02-04 21:28:29 +08:00
Sean Cross
7fd6d1d093 bionic: Emit \r in puts()
Since serial_putc() doesn't automatically add \r to \n, add it in puts().

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-04 21:14:14 +08:00
Sean Cross
70140aa665 serial: Fix serial driver
The serial driver was having issues reading data.  This commit makes
the serial driver more robust.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-04 21:05:03 +08:00
Sean Cross
1602ba550c serial: Fix USB data receive
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>
2015-02-03 15:01:01 +08:00
Jacob Rosenthal
4f74885821 README: Add information on OS X serial driver
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>
2015-02-02 17:49:50 +08:00
Robert Foss
1e9fd14f3e README: Add cross compilation instructions
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>
2015-02-02 17:46:20 +08:00
Robert Foss
a8bd97b5d0 fernly-usb-loader: Silence a few printf warnings
This silences some printf() warnings that appear due to varying sizes
of printf arguments.
2015-02-02 17:42:46 +08:00
Sean Cross
0a5441d26e cmd-keypad: Slight formatting adjustments
Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-02 17:35:08 +08:00
Sean Cross
2b8a2a0b66 gitignore: Add fernly.log to ignored file list
Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-02 17:28:07 +08:00
Sean Cross
46d4e242ee Makefile: Use relative build path for 'make test'
Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-02 17:27:49 +08:00
Sean Cross
f7f40242ac scriptic: Correct debug output format
Replace %004x with %04x and %008x with %08x.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-02 17:27:48 +08:00
Sourcerer
f29a9e686d kbd: Add keypad support
This adds support for the Fernvale keypad.

Signed-off-by: Sourcerer <sourcerer@gmx.at>
2015-02-02 17:26:09 +08:00
Sean Cross
09bf775667 fernly-usb-loader: Correct stdio handle numbers
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>
2015-02-02 16:50:03 +08:00
Sean Cross
eacfd9ff72 vsprintf: Fix <sys/string.h> include on Novena
This file does not exist.  Include <string.h> instead.

Signed-off-by: Sean Cross <xobs@kosagi.com>
2015-02-02 16:42:32 +08:00
Mandl
eba08f0218 bionic: fix gcc build
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.
2015-01-14 12:16:46 +08:00
thesourcerer8
e948d27bb0 fernly-usb-loader: Log output to fernly.log
Log output received from the Fernvale board to a logfile.

Signed-off-by: thesourcerer8 <pg@futureware.at>
2015-01-14 12:14:06 +08:00
thesourcerer8
51c7932150 Makefile: Add a "make test" target
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>
2015-01-14 12:12:50 +08:00
Sean Cross
ae59347cd1 serial: Add \r when \n is printed
Signed-off-by: Sean Cross <xobs@kosagi.com>
2014-12-30 17:53:16 +08:00
Sean Cross
78d5cff679 main: Use serial_putc() for one-character prints
Signed-off-by: Sean Cross <xobs@kosagi.com>
2014-12-30 17:53:05 +08:00
Sean Cross
9ceaffea5d bionic: Use serial functions for puts() / putchar()
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>
2014-12-30 17:52:48 +08:00