drivers: i2c: added I2C basics.

i2c-msg:
Describes a message which is to be sent over an I2C interface.

i2c-bus:
Description of the I2C interface (aka the bus).

i2c-client:
Representation of the receiving chip and its I2C interface.

Signed-off-by: Michel Megens <dev@michelmegens.net>
Merge branch 'master' into i2c

Signed-off-by: Michel Megens <dev@michelmegens.net>

Conflicts:
	drivers/Kconfig
	drivers/Makefile
i2c: client: added a client to bus attatch.

i2c_add_client is used add a new client to a bus. Please note that
clients should not be added more than once to a bus.

Signed-off-by: Michel Megens <dev@michelmegens.net>
i2c: bus: added single message xfer functions.

Added the API functions:

i2c_master_send:
	Send a single I2C message of a given length to an I2C client.

i2c_master_rcv:
	Receive a single I2C message of a given length from an I2C
	client.

Signed-off-by: Michel Megens <dev@michelmegens.net>
i2c: bus: implemented API transfer function

i2c_bus_transfer is the API function to transfer multiple I2C messages
using the repeated start functionality in the I2C standard.

Signed-off-by: Michel Megens <dev@michelmegens.net>
locks: spinlock/mutex: added a wait function.

mutex_wait and spin_lock_wait wait for a spinlock or mutex to become
available. This function wont return untill the lock becomes unlocked.
After it returns it is safe to asume that the lock is unlocked.

Signed-off-by: Michel Megens <dev@michelmegens.net>
Merge branch 'time'

	* sys_tick variable
	* time_before time_after
	* sys_clk setter/getter
Merge branch 'master' into i2c
i2c: core: implemented the backend for I2C xfers

__i2c_transfer:
	Backend I2C transmission function. This function handles an
	of messages to the I2C bus driver. If the transmission fails
	and a retry is requested, it will retry the transmission for a
	maximum of i2c_bus::retries amount of times or untill the
	transmission received a timeout (i2c_bus::timeout).

Signed-off-by: Michel Megens <dev@michelmegens.net>
sched: core: added setup for the FIFO scheduler

FIFO algorithm:
	The FIFO scheduler is a priority independant scheduler. Threads
	are sorted in their queue's based on the time of insertion. This
	way starvation is kept to a minimum and threads can still execute
	in a real time context.

Signed-off-by: Michel Megens <dev@michelmegens.net>
Merge branch 'master' into sched
sched: fifo: implemented the FIFO algorithm.

kernel/sched/fifo.c:
	Implemented the FIFO (First In First Out) scheduling algorithm.
	The FIFO scheduler should be used in real time systems where
	sorting on a priority basis is not important.

Signed-off-by: Michel Megens <dev@michelmegens.net>
sched: core: fixed a entity dep in thread init

The thread data field initialiser used to set the next pointer in the
scheduling entity to NULL, but depending on the used algorithm, the
entity might not have a next pointer.

Signed-off-by: Michel Megens <dev@michelmegens.net>
Merge branch 'sched'

	* FIFO scheduler
i2c: atmega: added a setup for the ATmega I2C bus.

Added a bus structure and basic I/O definitions for the I2C bus. The
core bus needs some extra features before the actual bus can be
implemented. Requirements:

	* Set the bus speed
	* Time out handling
	* Retry setting/handling

Signed-off-by: Michel Megens <dev@michelmegens.net>
i2c: atmega: wrote an initial init function.

atmega_i2c_init:
	Wrote an initial version of the ATMega I2C bus init. The bus is
	almost fully initialised after calling this function. Only the
	bus speed configuration has to be added to fully complete the
	initialisation.

Signed-off-by: Michel Megens <dev@michelmegens.net>
i2c: atmega: implemented the a speed configurator

The speed of the ATmega AVR I2C bus can be changed and configured using
atmega_i2c_setspeed. Other drivers (i2c clients) can use
bus::ctrl(bus, I2C_SET_SPEED, &speed). The speed argument is given in
Hertz. The default SCL frequency (set on initialise) is 100KHz.

Signed-off-by: Michel Megens <dev@michelmegens.net>
i2c: atmega: implemented master xfer start

atmega_i2c_xfer:
	This function prepares the bus to start an I2C master
	transmission. It sets up all the (file) global variables which a
	typical master-to-slave transmission needs. As soon as the I2C START
	bit has been generated on the bus, the executing thread will be
	placed on a waiting queue, if the scheduler is enabled, untill the
	entire transmission is done. If the scheduler is not enabled,
	atmega_i2c_xfer will do NOP's untill the transmission has completed.

Signed-off-by: Michel Megens <dev@michelmegens.net>
i2c: client: added client factory.

Added a factory function for i2c_client's.

i2c_new_device:
	Create a new i2c_client for a device driver. Takes a pointer to
	a i2c_device_info structure as an argument. The i2c_device_info
	structure describes the layout of a chip using the I2C protocol.
	It includes a device name, end point address (I2C address), a
	bus (if not using the standard) and device file operations.

Signed-off-by: Michel Megens <dev@michelmegens.net>
i2c: atmega: added the ATmega I2C IRQ

Added the I2C STC (Serial Transfer Complete) interrupt vector to the
kernel. It is setup during the ATmega I2C driver initialisation using
irq_request.

Signed-off-by: Michel Megens <dev@michelmegens.net>