driver/pmc: rework the implementations of pmc driver.

Add AT91C_PMC_ALT_PRES for atlernate location for PRES field

To switch from internal 12MHz RC Oscillator to the 12 MHz Crystal,
follow the sequence to program the PMC_MOR register:
1./ Enable the 12MHz oscillator by setting the bit MOSCXTEN to 1.
2./ Wait for 12MHz oscillator status bit MOSCXTS set 1.
For the SoC with internal 12MHz RC oscilltor, such as at91sam9x5ek,
at91sam9n12ek and sama5d3xek, add the following steps,
3./ Switch from internal 12MHz RC oscillator to the 12MHz oscillator by setting the bit MOSCSEL to 1.
4./ Wait for 12MHz oscillator status bit MOSCSELS set 1.
5./ Disable the 12MHz RC oscillator by setting the bit MOSCRCEN to 0.

To select the Master clock and Processor clock source from PLLA,
follow the sequence to program the PMC_MCKR register.
1./ Program the PRES field in the PMC_MCKR register.
2./ Wait for the MCKRDY bit to be set in the PMC_SR register.
3./ Program the CSS field in the PMC_MCKR register.
4./ Wait for the MCKRDY bit to be set in the PMC_SR register.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
driver/pmc: add the functions to enable peripheral clock and system clock

To make the code more elegant, add new function,
	int pmc_enable_periph_clock(unsigned int periph_id)
	void pmc_enable_system_clock(unsigned int clock_id)

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
board file: adopt the new function, pmc_enable_periph_clock and pmc_enable_systen_clock

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
driver/pmc: remove not used function, die()

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
lib/div: fix BUG: if dividend is equal to division, the result is error.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
dbgu: fix mode register init

so we set n8 mode correctly and we can use any usart port

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
dbgu: allow the board to specify the usart port to use

if USART_BASE is not set use the dbgu as currently

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
rename dbgu driver at91_usart as it's usart IP compatible

As we can now use it on any usart/uart/dbug port

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
rename usart_print to usart_puts to reflect it's feature

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
debug: handle '\n\r' or '\r\n' as puts level

so we do not need to put it in every print

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
dbg_log: drop non allow debug message via macro

so we drop the string too at compiling time

introduce at the same time a macro for each debug level
dbg_info, dbg_loud and dbg_very_loud

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>