mm: add include gaurds to bitfield internals header

Change-Id: I7201dad141150cd530146ddc73d24844a3b2ba09
mm: Update buddy internals include guard name

Change-Id: I7292592e4acbdf8ca5a5921b2fa9ee9f84870a09
mm: refine chip specific comments

Change-Id: I8d2bab63cedd80c026aaa189ec895ccc4e604465
mm: provide default values for min/max buddy orders

Change-Id: Ib8fdecb580399629811805830b181ea43f530896
stm32f40x: registers: Reorder peripherals to match datasheet

Change-Id: I792d527088a08122d316a0281b00c69dedbc6902
stm32f40x: registers: correct USART defines

Apparently USART6 was hiding as a duplicate of USART2, and USART 2 and 3
were hiding as members of APB2.

Change-Id: I4afaab2f204ef45c07aef7a92a50c2cc452ebff0
Signed-off-by: Michael Pratt <michael@pratt.im>
stm32f40x: overhaul USART defines

Change-Id: I7a3efe3c90584c14567004d08ad4523819a61f6f
Signed-off-by: Michael Pratt <michael@pratt.im>
stm32f40x: overhaul SPI registers

Much like the USART, overhaul the definitions of the SPI registers to
use a struct representation of the registers.  Provide all SPI register
bitfields.

The spi_port struct now contains a pointer to the registers, rather than
the port number.

Change-Id: I2ba7db507b5a2b391c341822509566ed7b8e569d
Fix cscope PHONY target name

Change-Id: Iac596719b2d976d229fe39df8df32f68af4ef3a4
spi: remove spi address argument

Previously, spi_read and spi_write accepted an address argument, which
was written out before the data to be read/written.  This was in use
because many SPI devices protocol involves writing the address to be
read or written before doing so.

However, since this is simply a convention, rather than part of the SPI
protocol, it hinders development for devices which do not follow the
convention.  By removing the argument, we leave it up to individual
devices to write the address before performing a read or write.

Further complicating matters. unfortunately, is that spi_read and
spi_write automatically handle setting the chip select high and low,
meaning that CS will go high between writing an address and actually
reading.  In order to avoid this, the concept of extended transactions
is introduced.  Extended transactions take place over more than old call
to spi_read and/or spi_write, with CS held low the entire time.  It is
not safe to release control of the SPI port during an extended
transaction, as the CS of the device is still low.

Update device drivers on the SPI bus to use this new interface.

Remove SPI functions from the .kernel section.

Change-Id: I1c56af7b8acd5b932497f5451d450f947ed2f585
spi: unify spi_read and spi_write

Reduce duplicated logic by unifying spi_read and spi_write into a common
spi_read_write.  Provide static inline versions of spi_read and
spi_write that simply call spi_read_write with the appropriate
arguments.

Change-Id: I440c9fd1a6bd2f909ebd7198e4da6f9c01882635
Add arch folder, put chip folder inside

This is in anticipation of separating out arch-specific portions in an
attempt to make it easier to port to another architecture in the future.

Change-Id: I2eb1e0b122e26e45e498ae10392b58815d40b927
Prefix arch and chip includes

Prefix arch and chip specific includes with arch/ and arch/chip/,
respectively.

This is done by copying the relevant includes into an include folder in
the output directory, and using that as the root include directory.

Doing this provides distinct namespaces for arch and chip headers, which
will never collide with global headers.

Change-Id: I5cc01df3ac2460105d644b8ba6ec771a564139cf
cscope and ctags ignore output and tools directory

Change-Id: Iad918d96223e80b7aefabbd4dc857e7268b3cfbc
arch: reorganize headers, arch functions

Rename several of the chip headers.  Generally, the chip headers should
be chip-specific hardware devices, so move include/dev/hw/ to include.
With a new resource model, it should be possible to eliminate
chip-specific external peripherals, like accelerometers.

Move the Cortex-M initialization into arch/armv7m/ and name it
init_arch, which is what os_start will call.

Move the systick driver into arch/armv7m/dev/hw/, as it is common
across the architecture.

TODO: Eliminate all arch/ includes outside of arch/.  These should be
replaced by generic APIs implemented by the arch or chip.

Change-Id: I7e45623e78270222e2fadc3e89f4ea0c4efc9003
boot: move clock initialization to arch/

init_arch() is responsible for ensuring that the clocks get initialized
properly, most likely by calling a chip specific function.

Change-Id: Iae915901550821395151ee85cf0e5fc90e5e8dc7
boot: generalize os_start, make early boot arch specific

Move os_start to kernel/init.c, since it will be general, and the very
early startup to arch/armv7m/handlers.S, since it is part of the reset
handler.

Change-Id: I31d5bdf11bac2883ab25351b3fbfc562d5e60304
shell: Add arch to uname

Change-Id: Ic70c40a2fd070deb0d531af9b066a09a1b0b4bf6
build: clean when applying defconfig

Many source files have slightly different dependencies between
configurations, causing build errors when the dependencies cannot be met
when switching defconfigs.  Work around this by forcing a clean upon
applying a defconfig.

Change-Id: Ic8064bb45be2fe67b6d9685ae1ad9679bb9e1ab1
build: dynamically generate defconfig rules

Change-Id: I8ea3030a025e40dc2b7eb8227a1443ce4a6c0323