ATMEGA: make it possible to add a pre-built bootloader
tasks/task-mcuio: get rid of useless function __get_ranges() and fix warning
include/tasks/mcuio.h: fix misc inlines
lib/udelay.c: avoid defining pr_debug here
Makefile: first convert bootloader to bin, then to elf

If the hex is directly converted to elf and then linked, the resulting
image is twice as big as it should be. This has probably something to
do with the fact that flash is word addressable (not byte addressable)
on the atmega.
MCUIO i2c: equalize obuf head and tail in case of NAK while sending data
lib/events.c: increase size of events buffer
trivial arch-atmega/pwm.c: do not define NPWM, use ARRAY_SIZE instead

Signed-off-by: Aurelio Colosimo <aurelio@aureliocolosimo.it>
pwm: rewrite common code in parametrized functions, when possible

This patch permits to simplify and reduce flash size of pwm implementation
in arch-atmega, by putting in the same function the commands for enable/disable,
polarity, duty_cycle.

Signed-off-by: Aurelio Colosimo <aurelio@aureliocolosimo.it>
arch-atmega pwm: at disable, don't set 'in' dir if gpio was out before enable

This patch fixes bug #8.

Signed-off-by: Aurelio Colosimo <aurelio@aureliocolosimo.it>
arch-atmega/pwm.c: fix timer 0 initialization

WGM02 bit in TCCR0B register must be set in order to have Fast PWM mode with
TOP=OCRA. This fixes the period of pwm output 0A and 0B to 4ms exactly.
In previous implementation, output was actually 4ms/250*256.

Signed-off-by: Aurelio Colosimo <aurelio@aureliocolosimo.it>
arch-atmega/pwm.c: fix duty=0 and duty=100% behaviour

From Atmega16/32U4 documentation, we can read that "The extreme
values for the OCRnx Register represent special cases when
generating a PWM waveform output in the fast PWM mode".
I tried to hide this in the past, but it's better to provide a
straightforward control of pwm registers.

Signed-off-by: Aurelio Colosimo <aurelio@aureliocolosimo.it>
CONFIG yun_defconfig: CONFIG_ADD_EXTERNAL_BOOTLOADER (unset as default)

CONFIG_ADD_EXTERNAL_BOOTLOADER is a new arch-atmega config option which
permits to set the path of an external bootloader, to be linked at address
0x7000. As a default, it is left unset, but is useful in systems like
Arduino-style boards, which rely on Caterina bootloader for usb firmware
update.

Signed-off-by: Aurelio Colosimo <aurelio@aureliocolosimo.it>
arch-atmega Kconfig: new option RUN_BOOTLOADER_ON_1200_BPS

RUN_BOOTLOADER_ON_1200_BPS is an option which makes configurable the
behaviour implemented for Arduino IDE compatibility.

Signed-off-by: Aurelio Colosimo <aurelio@aureliocolosimo.it>
tasks: removed unused file lucky-gpios.cfg

Signed-off-by: Aurelio Colosimo <aurelio@aureliocolosimo.it>
tasks: yun-gpios.cfg 'NC' gpios replaced by their name on chip

Signed-off-by: Aurelio Colosimo <aurelio@aureliocolosimo.it>