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>
1-wire: add PDA TM4300 support

Signed-off-by: Bo Shen <voice.shen@atmel.com>
clean: remove useless AT91_BASE_SYS macro

Signed-off-by: Josh Wu <josh.wu@atmel.com>
board/sama5d3xek: special setting, GMAC & EMAC clock related pins to Pullup and Pulldown disabled and output low

Since for the chips with no EMAC or GMAC, No actions is done to make
its phy to enter the power save mode when linux system enter suspend to memory or standby.
And it causes the VDDCORE current is higher than our expection.
So set GMAC related pins (PB0 - PB9, PB11, PB13, PB16 - PB18)
and EMAC related pins (PC0 - PC9) to Pullup and Pulldown disabled, and output low.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Makefile: change version to 3.6.0

Signed-off-by: Josh Wu <josh.wu@atmel.com>
1-wire: fix incorrect revision_id and bom_revision swapping

In case of revision mapping "B" the revision_id and bom_revision values were
swapped when normalizing them.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
1-wire: correct mapping B with alpha-numeric revisions

Use same normalisation function as the revision code and rev id
alpha-numeric characters as stated on the mapping specification "B".

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
1-wire: swap BOM revision and revision id printing

Mapping specification "B" state that the order of characters
should be:
Board Revision - revision_code
Schema Revision - revision_id
BOM Revision - bom_revision

So swap alpha-numeric characters when printing these information.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
1-wire: add information for newer PDA TM4301 DM

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
nandflash: add missing CONFIG_ for small blocks ifdef

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