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>
i2c: atmega: implemented the master transmitter

Implemented the master transmission code for the ATmega I2C bus.
Transmissions are handled in an IRQ handled (which cannot EVER be
threaded!). All cases for master transmission are implemented now.

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

Implemented all cases concerning the I2C master receiver. This means
that the entire master I2C protocol has been implemented for the ATmega
I2C (TWI) bus.

Signed-off-by: Michel Megens <dev@michelmegens.net>
i2c: core: fixed a bug in the transfer init

__i2c_transfer:
	Fixed a bug that would setup a faulty transfer by passing the
	wrong amount messages to the I2C bus transfer routine
	(i2c_bus::xfer).

init:
	Fixed an I2C initialisation bug for AVR chips. The ATmega I2C
	bus would never be initialised due to a spelling error in the
	preprocessor checking whether I2C has been configured for building
	or not.

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

	* I2C core
	* ATmega I2C bus