FogBugz #205930: Add a second parent option for the dbg_base_clk

The debug base clock can be bypassed from the main PLL to the OSC1 clock.
The bypass register is the staysoc1(0x10) register that is in the clock
manager.

This patch adds the option to get the correct parent for the debug base
clock.

Signed-off-by: Dinh Nguyen <dinguyen@altera.com>
FogBugz #198256: Fix unnecessary USB overcurrent condition

The CycloneV and ArriaV devkit has a small C_VBUS capacitor on the devkit.
Because of this, the USB driver sometimes detects an unnecessary
overcurrent error condition.

This patch uses the external VbusValid signal instead.

Signed-off-by: Dinh Nguyen <dinguyen@altera.com>
FogBugz #206007: Fix gpio dts entry for the correct clock

The correct clock for the HPS gpio(s) should be the l4_mp_clk.

Signed-off-by: Dinh Nguyen <dinguyen@altera.com>

Conflicts:

	arch/arm/boot/dts/socfpga.dtsi
net: stmmac: set phy to use polling by default

mii_irq[] array is never initialized anywhere in the driver, thus mii_irq[]
will always equate to zero. So, for the case where the PHY does not have an
irq, we should use PHY_POLL for that situation.

Signed-off-by: Dinh Nguyen <dinguyen@altera.com>
Tested-by: Vince Bridgers <vbridger@altera.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
stmmac: disable at run-time the EEE if not supported

This patch is to disable the EEE (so HW and timers)
for example when the phy communicates that the EEE
can be supported anymore.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
FogBugz #195995: nios2: Change default NIOS2_DCACHE_LINE_SIZE

FogBugz 190747 added initda instruction support and this instruction
requires more than 4-byte data cache line. So, default
NIOS2_DCACHE_LINE_SIZE needs change to more than 4 and
in range 0x10 and 0x20. Also add checking for
CONFIG_NIOS2_DCACHE_LINE_SIZE vs device tree dcache-line-size to make
sure they are matched.

Signed-off-by: Ley Foon Tan <lftan@altera.com>
FogBugz #193936: nios2: Fix nios2 compilation warnings

The warnings is caused by PAGE_SIZE macro. This is one of the change
request by kernel community when nios2 usptreaming. Recommended way is
using AC() macro for PAGE_SIZE calculation.

Discussion:
https://lkml.org/lkml/2014/4/22/577

Example warning:
fs/select.c:901:9: warning: comparison of distinct pointer types
lacks a cast [enabled by default]

Signed-off-by: Ley Foon Tan <lftan@altera.com>
FogBugz #199159: nios2: fix parentheses warning

Add parentheses for 'vaddr' variable.
Example warning:
mm/bootmem.c:585:3: warning: suggest parentheses around arithmetic
in operand of '|' [-Wparentheses]
mm/bootmem.c:585:3:
                region = phys_to_virt(PFN_PHYS(bdata->node_min_pfn) +
                                start_off);

Signed-off-by: Ley Foon Tan <lftan@altera.com>
FogBugz #205359: nios2: flushp after write instruction to memory

According to nios2 handbook [1], software needs to execute flushd,
flushi and flushp instructions after write instruction to memory.
This patch add the flushp instruction after flushd and flushi.

[1]http://www.altera.com/literature/hb/nios2/n2sw_nii52007.pdf
   (page 9-5)

Signed-off-by: Ley Foon Tan <lftan@altera.com>
FogBugz #205319: nios2: Use initi and initd to initialize caches

Change flushi to initi and flushd to initd instructions.

According to nios2 handbook:
- Use initi instruction initializes a single
instruction cache line. Do not use the flushi instruction because
it might cause undesired effects when used to initialize the
instruction cache in future Nios II implementations.
- Use initd instruction initializes a single data cache line. Do not
use the flushd instruction for this purpose, because it writes dirty
lines back to memory.

[1]http://www.altera.com/literature/hb/nios2/n2sw_nii52007.pdf

Signed-off-by: Ley Foon Tan <lftan@altera.com>
FogBugz #205636: nios2: check exception handler address

Don't copy exception handler if it is already at the exception address.
The CPU may be configured with the exception address already pointing
to the kernel's exception handler. Don't unnecessarily copy the handler
in this case, although the code appears harmless. But, this can optimize
boot up time.

Signed-off-by: Yuriy Kozlov <ykozlov@ptcusa.com>
Signed-off-by: Ley Foon Tan <lftan@altera.com>
FogBugz #209258: hotplug: put cpu1 in wfi

Use WFI when putting CPU1 to sleep.  Don't hold CPU1 in reset
since that results in increased power consumption.

Reset CPU1 briefly during CPU1 bootup.

This has been tested for hotplug and suspend/resume and results
in no increased power consumption.

Signed-off-by: Alan Tull <atull@altera.com>

v2: remove panic after cpu_do_idle loop.
FogBugz #208682: Denali NAND driver misidentifies Hynix chips

The denali driver was not reading enough id bytes to determine the
parameters for a Hynix chip.  The chip was therefore not identified
properly, and the page size and oob size were calculated incorrectly.

This resulted in a message stating the OOB area was not big enough
for 8-bit ECC.

Signed-off-by: Graham Moore <grmoore@altera.com>