firefly-linux-kernel-4.4.55.git
10 years agoMIPS: Add microMIPS MSA support.
Steven J. Hill [Tue, 15 Apr 2014 21:06:49 +0000 (16:06 -0500)]
MIPS: Add microMIPS MSA support.

This patch adds support for the microMIPS implementation of the MSA
instructions.

Signed-off-by: Steven J. Hill <Steven.Hill@imgtec.com>
Reviewed-by: Paul Burton <Paul.Burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6763/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Replace calls to obsolete strict_strto call with kstrto* equivalents.
Daniel Walter [Tue, 3 Jun 2014 15:22:08 +0000 (16:22 +0100)]
MIPS: Replace calls to obsolete strict_strto call with kstrto* equivalents.

Signed-off-by: Daniel Walter <dwalter@google.com>
Cc: linux-kernel@vger.kernel.org
Cc: richard@nod.at
Cc: akpm@linux-foundation.org
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Replace obsolete strict_strto call with kstrto
Daniel Walter [Tue, 3 Jun 2014 15:21:05 +0000 (16:21 +0100)]
MIPS: Replace obsolete strict_strto call with kstrto

Signed-off-by: Daniel Walter <dwalter@google.com>
Cc: linux-kernel@vger.kernel.org
Cc: richard@nod.at
Cc: akpm@linux-foundation.org
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: BFP: Simplify code slightly.
Ralf Baechle [Tue, 3 Jun 2014 11:05:55 +0000 (13:05 +0200)]
MIPS: BFP: Simplify code slightly.

This keeps the if condition slightly simpler - it's going to become ore
complication.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agomips: Update the email address of Geert Uytterhoeven
Geert Uytterhoeven [Tue, 22 Apr 2014 10:51:13 +0000 (12:51 +0200)]
mips: Update the email address of Geert Uytterhoeven

All my Sony addresses are defunct.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6817/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Add minimal defconfig for mips_paravirt
Andreas Herrmann [Wed, 28 May 2014 21:52:16 +0000 (23:52 +0200)]
MIPS: Add minimal defconfig for mips_paravirt

Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
Cc: linux-mips@linux-mips.org
Cc: David Daney <ddaney.cavm@gmail.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: kvm@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/7008/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Enable build for new system 'paravirt'
David Daney [Wed, 28 May 2014 21:52:15 +0000 (23:52 +0200)]
MIPS: Enable build for new system 'paravirt'

Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
Cc: linux-mips@linux-mips.org
Cc: James Hogan <james.hogan@imgtec.com>
Cc: kvm@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/7015/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: paravirt: Add pci controller for virtio
David Daney [Wed, 28 May 2014 21:52:14 +0000 (23:52 +0200)]
MIPS: paravirt: Add pci controller for virtio

Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
Cc: linux-mips@linux-mips.org
Cc: James Hogan <james.hogan@imgtec.com>
Cc: kvm@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/7011/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Add code for new system 'paravirt'
David Daney [Wed, 28 May 2014 21:52:13 +0000 (23:52 +0200)]
MIPS: Add code for new system 'paravirt'

For para-virtualized guests running under KVM or other equivalent
hypervisor.

Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
Cc: linux-mips@linux-mips.org
Cc: James Hogan <james.hogan@imgtec.com>
Cc: kvm@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/7004/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Add functions for hypervisor call
David Daney [Wed, 28 May 2014 21:52:12 +0000 (23:52 +0200)]
MIPS: Add functions for hypervisor call

Introduce kvm_hypercall[0-3].
Define three new hypercalls for MIPS: GET_CLOCK_FREQ, EXIT_VM, and
CONSOLE_OUTPUT.

[andreas.herrmann:
  * Properly define hypercalls and HC numbers for MIPS
    in kvm_para.h header files]

Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
Cc: linux-mips@linux-mips.org
Cc: James Hogan <james.hogan@imgtec.com>
Cc: kvm@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/7005/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: OCTEON: Add OCTEON3 to __get_cpu_type
Andreas Herrmann [Wed, 28 May 2014 21:52:11 +0000 (23:52 +0200)]
MIPS: OCTEON: Add OCTEON3 to __get_cpu_type

Otherwise __builtin_unreachable might be called.

Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
Cc: linux-mips@linux-mips.org
Cc: David Daney <ddaney.cavm@gmail.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: kvm@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/7014/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Add function get_ebase_cpunum
David Daney [Wed, 28 May 2014 21:52:10 +0000 (23:52 +0200)]
MIPS: Add function get_ebase_cpunum

This returns the CPUNum from the low order Ebase bits.

Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
Cc: linux-mips@linux-mips.org
Cc: James Hogan <james.hogan@imgtec.com>
Cc: kvm@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/7012/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Add minimal support for OCTEON3 to c-r4k.c
David Daney [Wed, 28 May 2014 21:52:09 +0000 (23:52 +0200)]
MIPS: Add minimal support for OCTEON3 to c-r4k.c

These are needed to boot a generic mips64r2 kernel on OCTEONIII.

Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
Cc: linux-mips@linux-mips.org
Cc: James Hogan <james.hogan@imgtec.com>
Cc: kvm@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/7003/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Don't build fast TLB refill handler with 32-bit kernels
David Daney [Wed, 28 May 2014 21:52:08 +0000 (23:52 +0200)]
MIPS: Don't build fast TLB refill handler with 32-bit kernels

The fast handler only supports 64-bit kernels.

Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
Cc: linux-mips@linux-mips.org
Cc: James Hogan <james.hogan@imgtec.com>
Cc: kvm@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/7010/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Don't use RI/XI with 32-bit kernels on 64-bit CPUs
David Daney [Wed, 28 May 2014 21:52:07 +0000 (23:52 +0200)]
MIPS: Don't use RI/XI with 32-bit kernels on 64-bit CPUs

The TLB handlers cannot handle this case, so disable it for now.

Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
Cc: linux-mips@linux-mips.org
Cc: James Hogan <james.hogan@imgtec.com>
Cc: kvm@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/7007/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: OCTEON: Move CAVIUM_OCTEON_CVMSEG_SIZE to CPU_CAVIUM_OCTEON
David Daney [Wed, 28 May 2014 21:52:06 +0000 (23:52 +0200)]
MIPS: OCTEON: Move CAVIUM_OCTEON_CVMSEG_SIZE to CPU_CAVIUM_OCTEON

CVMSEG is related to the CPU core not the SoC system.  So needs to be
configurable there.

Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
Cc: linux-mips@linux-mips.org
Cc: James Hogan <james.hogan@imgtec.com>
Cc: kvm@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/7013/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Move system level config items from CPU_CAVIUM_OCTEON to CAVIUM_OCTEON_SOC
David Daney [Wed, 28 May 2014 21:52:05 +0000 (23:52 +0200)]
MIPS: Move system level config items from CPU_CAVIUM_OCTEON to CAVIUM_OCTEON_SOC

They are a property of the SoC not the CPU itself.

Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
Cc: linux-mips@linux-mips.org
Cc: James Hogan <james.hogan@imgtec.com>
Cc: kvm@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/7009/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: OCTEON: Enable use of FPU
David Daney [Wed, 28 May 2014 21:52:04 +0000 (23:52 +0200)]
MIPS: OCTEON: Enable use of FPU

Some versions of the assembler will not assemble CFC1 for OCTEON, so
override the ISA for these.

Add r4k_fpu.o to handle low level FPU initialization.

Modify octeon_switch.S to save the FPU registers.  And include
r4k_switch.S to pick up more FPU support.

Get rid of "#define cpu_has_fpu 0"

Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
Cc: linux-mips@linux-mips.org
Cc: James Hogan <james.hogan@imgtec.com>
Cc: kvm@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/7006/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Malta: support powering down
Paul Burton [Wed, 7 May 2014 11:22:12 +0000 (12:22 +0100)]
MIPS: Malta: support powering down

This patch powers down the Malta in response to a power off command (eg.
poweroff or shutdown -P). It may then be powered back up by pressing the
"ON/NMI" button (S4) on the board. In cases where the power off state
cannot be entered (eg. because the required PCI support is disabled) the
current reset behaviour will be used as a fallback.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Tested-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6907/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Malta: hang on halt
Paul Burton [Wed, 7 May 2014 11:20:59 +0000 (12:20 +0100)]
MIPS: Malta: hang on halt

When the system is halted it makes little sense to reset it. Instead,
hang by executing an infinite loop.

[ralf@linux-mips.org: Remove printk from mips_machine_halt() - this is not
the place to communicate with the user.]

Suggested-by: Maciej W. Rozycki <macro@linux-mips.org>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6906/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Malta: Let PIIX4 respond to PCI special cycles
Paul Burton [Wed, 7 May 2014 11:20:58 +0000 (12:20 +0100)]
MIPS: Malta: Let PIIX4 respond to PCI special cycles

This patch enables the PIIX4 to respond to special cycles on the PCI
bus. One such special cycle must be used in order to enter a suspend
state, and if response to it is not enabled then the suspend state will
never be entered.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6904/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Malta: add suspend state entry code
Paul Burton [Wed, 7 May 2014 11:20:57 +0000 (12:20 +0100)]
MIPS: Malta: add suspend state entry code

This patch introduces code which will enter a suspend state via the
PIIX4. This can only be done when PCI support is enabled since it
requires access to PCI I/O space and the generation of a special cycle
on the PCI bus. In cases where PCI is disabled the mips_pm_suspend
function will simply always return an error.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6905/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Define some more PIIX4 registers & values
Paul Burton [Wed, 7 May 2014 11:20:56 +0000 (12:20 +0100)]
MIPS: Define some more PIIX4 registers & values

This patch simply adds definitions for some I/O registers in the PIIX4
PM device, and the magic data for a special cycle which must occur on
the PCI bus in order for the PIIX4 to enter a suspend state.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6903/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: DEC: Remove the Halt button interrupt on R4k systems
Maciej W. Rozycki [Sun, 6 Apr 2014 21:06:28 +0000 (22:06 +0100)]
MIPS: DEC: Remove the Halt button interrupt on R4k systems

On R4k DECstations the Halt button is wired to the NMI processor input
rather than an ordinary interrupt input such as on R3k DECstations.  This
is possible with a different design of the CPU daughtercard that routes
the Halt button line from the baseboard connector.  Additionally the
interrupt input has been reused for a different purpose on the KN04 and
KN05 R4k CPU daughtercards so it is better kept masked.

Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6705/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: DEC: Only select the R4k clock event/source on R4k systems
Maciej W. Rozycki [Sun, 6 Apr 2014 20:46:05 +0000 (21:46 +0100)]
MIPS: DEC: Only select the R4k clock event/source on R4k systems

R3k systems have no R4k timer so there's no point in pulling code that's
going to be dead.

Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6704/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: __delay ABI-dependent subtraction simplification
Maciej W. Rozycki [Sun, 6 Apr 2014 20:42:49 +0000 (21:42 +0100)]
MIPS: __delay ABI-dependent subtraction simplification

This small update to the previous fix to __delay removes a conditional
around the ABI-dependent subtraction operation within an inline asm in
favor to the standard <asm/asm.h> LONG_SUBU macro.  No change in code
produced.

Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6703/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Implement random_get_entropy with CP0 Random
Maciej W. Rozycki [Sun, 6 Apr 2014 20:31:29 +0000 (21:31 +0100)]
MIPS: Implement random_get_entropy with CP0 Random

Update to commit 9c9b415c50bc298ac61412dff856eae2f54889ee [MIPS:
Reimplement get_cycles().]

On systems were for whatever reasons we can't use the cycle counter, fall
back to the c0_random register as an entropy source.  It has however a
very small range that makes it suitable for random_get_entropy only and
not get_cycles.

This optimised version compiles to 8 instructions in the fast path even in
the worst case of all the conditions to check being variable (including a
MFC0 move delay slot that is only required for very old processors):

     828: 8cf90000  lw t9,0(a3)
828: R_MIPS_LO16 jiffies
     82c: 40057800  mfc0 a1,c0_prid
     830: 3c0200ff  lui v0,0xff
     834: 00a21024  and v0,a1,v0
     838: 1040007d  beqz v0,a30 <add_interrupt_randomness+0x22c>
     83c: 3c030000  lui v1,0x0
83c: R_MIPS_HI16 cpu_data
     840: 40024800  mfc0 v0,c0_count
     844: 00000000  nop
     848: 00409021  move s2,v0
     84c: 8ce20000  lw v0,0(a3)
84c: R_MIPS_LO16 jiffies

On most targets the sequence will be shorter and on some it will reduce to
a single `MFC0 <reg>,c0_count', as all MIPS architecture (i.e. non-legacy
MIPS) processors require the CP0 Count register to be present.

The only known exception that reports MIPS architecture compliance, but
contrary to that lacks CP0 Count is the Ingenic JZ4740 thingy.  For broken
platforms like that this code requires cpu_has_counter to be hardcoded to
0 (i.e. no variable setting is permitted) so as not to penalise all the
other good platforms out there.

The asm barrier is required so that the compiler does not pull any
potentially costly (cold cache!) `cpu_data' variable access into the fast
path.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: John Crispin <blogic@openwrt.org>
Cc: Andrew McGregor <andrewmcgr@gmail.com>
Cc: Dave Taht <dave.taht@bufferbloat.net>
Cc: Felix Fietkau <nbd@nbd.name>
Cc: Simon Kelley <simon@thekelleys.org.uk>
Cc: Jim Gettys <jg@freedesktop.org>
Cc: David Daney <ddaney@caviumnetworks.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6702/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Netlogic: XLP9XX on-chip SATA support
Ganesan Ramalingam [Fri, 9 May 2014 11:06:25 +0000 (16:36 +0530)]
MIPS: Netlogic: XLP9XX on-chip SATA support

The XLP9XX SoC has an on-chip SATA controller with two ports. Add
ahci-init-xlp2.c to initialize the controller, setup the glue logic
registers, fixup PCI quirks and setup interrupt ack logic.

Signed-off-by: Ganesan Ramalingam <ganesanr@broadcom.com>
Signed-off-by: Jayachandran C <jchandra@broadcom.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6913/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Netlogic: Support for XLP3XX on-chip SATA
Ganesan Ramalingam [Tue, 29 Apr 2014 14:37:55 +0000 (20:07 +0530)]
MIPS: Netlogic: Support for XLP3XX on-chip SATA

XLP3XX includes an on-chip SATA controller with 4 ports. The
controller needs glue logic initialization and PCI fixup before
it can be used with the standard AHCI driver.

Signed-off-by: Ganesan Ramalingam <ganesanr@broadcom.com>
Signed-off-by: Jayachandran C <jchandra@broadcom.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6872/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Add MSI support for XLP9XX
Ganesan Ramalingam [Fri, 9 May 2014 11:05:49 +0000 (16:35 +0530)]
MIPS: Add MSI support for XLP9XX

In XLP9XX, the interrupt routing table for MSI-X has been moved to the
PCIe controller's config space from PIC. There are also 32 MSI-X
interrupts available per link on XLP9XX.

Update XLP MSI/MSI-X code to handle this.

Signed-off-by: Ganesan Ramalingam <ganesanr@broadcom.com>
Signed-off-by: Jayachandran C <jchandra@broadcom.com>
Cc: g@linux-mips.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6912/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Netlogic: Add support for XLP5XX
Yonghong Song [Tue, 29 Apr 2014 14:37:53 +0000 (20:07 +0530)]
MIPS: Netlogic: Add support for XLP5XX

Add support for the XLP5XX processor which is an 8 core variant of the
XLP9XX. Add XLP5XX cases to code which earlier handled XLP9XX.

Signed-off-by: Yonghong Song <ysong@broadcom.com>
Signed-off-by: Jayachandran C <jchandra@broadcom.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6871/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Netlogic: Update XLP9XX/2XX core freq calculation
Jayachandran C [Tue, 29 Apr 2014 14:37:52 +0000 (20:07 +0530)]
MIPS: Netlogic: Update XLP9XX/2XX core freq calculation

Calculate XLP 9XX and 2XX core frequency from the per-core PLL. This
should give the correct value for all board configurations.

Signed-off-by: Jayachandran C <jchandra@broadcom.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6870/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Netlogic: PIC freq calculation for XLP 9XX/2XX
Ganesan Ramalingam [Tue, 29 Apr 2014 14:37:51 +0000 (20:07 +0530)]
MIPS: Netlogic: PIC freq calculation for XLP 9XX/2XX

Update PIC frequency calculation for XLP9XX and 2XX processors using
the correct PLL registers. This should work for all possible board
configurations.

Signed-off-by: Ganesan Ramalingam <ganesanr@broadcom.com>
Signed-off-by: Jayachandran C <jchandra@broadcom.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6876/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Netlogic: Fix XLP9XX pic entry
Jayachandran C [Tue, 29 Apr 2014 14:37:50 +0000 (20:07 +0530)]
MIPS: Netlogic: Fix XLP9XX pic entry

Add the compatible property to the PIC entry. Also fix up the nodename
to use the correct address.

Signed-off-by: Jayachandran C <jchandra@broadcom.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6869/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Netlogic: Use PRID_IMP_MASK macro
Jayachandran C [Tue, 29 Apr 2014 14:37:49 +0000 (20:07 +0530)]
MIPS: Netlogic: Use PRID_IMP_MASK macro

Use PRID_IMP_MASK macro instead of 0xff00 to extract the processor
type.

Signed-off-by: Jayachandran C <jchandra@broadcom.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6868/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Netlogic: IRQ mapping for some more SoC blocks
Jayachandran C [Fri, 9 May 2014 11:05:34 +0000 (16:35 +0530)]
MIPS: Netlogic: IRQ mapping for some more SoC blocks

Add IRQ to IRT (PIC interupt table index) mapping for SATA, GPIO, NAND
and SPI interfaces on the XLP SoC. Fix offsets for few blocks and add
device IDs for a few blocks.

Signed-off-by: Jayachandran C <jchandra@broadcom.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6911/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Netlogic: Enable access to more than 64GB
Jayachandran C [Tue, 29 Apr 2014 14:37:47 +0000 (20:07 +0530)]
MIPS: Netlogic: Enable access to more than 64GB

The ELPA bit needs to be set in the PAGEGRAIN register to enable
access to >64GB physical address. Update reset.S to do this from
every hardware thread.

Signed-off-by: Jayachandran C <jchandra@broadcom.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6866/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Netlogic: Reduce size of reset code
Jayachandran C [Fri, 9 May 2014 11:05:14 +0000 (16:35 +0530)]
MIPS: Netlogic: Reduce size of reset code

Update thread wakeup function to use scratch registers for saving SP and
RA. Move the register restore code needed for thread 0 to the calling
function. This reduces the size of code copied to the reset vector.

Signed-off-by: Jayachandran C <jchandra@broadcom.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6910/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Netlogic: Use cpumask_scnprintf for wakeup_mask
Jayachandran C [Fri, 9 May 2014 11:04:54 +0000 (16:34 +0530)]
MIPS: Netlogic: Use cpumask_scnprintf for wakeup_mask

Use standard function to print cpumask. Also fixup a typo in the same
file.

Signed-off-by: Jayachandran C <jchandra@broadcom.com>
Cc: g@linux-mips.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6909/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Netlogic: Warn on invalid irq
Jayachandran C [Tue, 29 Apr 2014 14:37:43 +0000 (20:07 +0530)]
MIPS: Netlogic: Warn on invalid irq

Warn and return if invalid IRQ is passed to nlm_set_pic_extra_ack.

Signed-off-by: Jayachandran C <jchandra@broadcom.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6862/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Netlogic: Move coremask setup to nlm_node_init
Jayachandran C [Tue, 29 Apr 2014 14:37:42 +0000 (20:07 +0530)]
MIPS: Netlogic: Move coremask setup to nlm_node_init

This is needed for nlm_node_present(0) to work on uniprocessor compile.

Signed-off-by: Jayachandran C <jchandra@broadcom.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6861/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Netlogic: Fix uniprocessor compilation
Jayachandran C [Tue, 29 Apr 2014 14:37:41 +0000 (20:07 +0530)]
MIPS: Netlogic: Fix uniprocessor compilation

The macros in topology.h need CONFIG_SMP, and the uniprocessor compilation
fails due to this. Wrap the macros in an ifdef so that uniprocessor works.

Signed-off-by: Jayachandran C <jchandra@broadcom.com>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/6863/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Support upto 256 CPUs
Jayachandran C [Tue, 29 Apr 2014 14:37:40 +0000 (20:07 +0530)]
MIPS: Support upto 256 CPUs

This is needed for two node XLP9xx configurations.

Signed-off-by: Jayachandran C <jchandra@broadcom.com>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/6860/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Enable the BPF_JIT symbol for MIPS
Markos Chandras [Wed, 9 Apr 2014 16:02:35 +0000 (17:02 +0100)]
MIPS: Enable the BPF_JIT symbol for MIPS

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/6743/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: net: Add BPF JIT
Markos Chandras [Tue, 8 Apr 2014 11:47:14 +0000 (12:47 +0100)]
MIPS: net: Add BPF JIT

This adds initial support for BPF-JIT on MIPS

Tested on mips32 LE/BE and mips64 BE/n64 using
dhcp, ping and various tcpdump filters.

Benchmarking:

Assuming the remote MIPS target uses 192.168.154.181
as its IP address, and the local host uses 192.168.154.136,
the following results can be obtained using the following
tcpdump filter (catches no frames) and a simple
'time ping -f -c 1000000' command.

[root@(none) ~]# tcpdump -p -n -s 0 -i eth0 net 10.0.0.0/24 -d
(000) ldh      [12]
(001) jeq      #0x800           jt 2 jf 8
(002) ld       [26]
(003) and      #0xffffff00
(004) jeq      #0xa000000       jt 16 jf 5
(005) ld       [30]
(006) and      #0xffffff00
(007) jeq      #0xa000000       jt 16 jf 17
(008) jeq      #0x806           jt 10 jf 9
(009) jeq      #0x8035          jt 10 jf 17
(010) ld       [28]
(011) and      #0xffffff00
(012) jeq      #0xa000000       jt 16 jf 13
(013) ld       [38]
(014) and      #0xffffff00
(015) jeq      #0xa000000       jt 16 jf 17
(016) ret      #65535

- BPF-JIT Disabled

real    1m38.005s
user    0m1.510s
sys     0m6.710s

- BPF-JIT Enabled

real    1m35.215s
user    0m1.200s
sys     0m4.140s

[ralf@linux-mips.org: Resolved conflict.]

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: uasm: Add lb uasm instruction
Markos Chandras [Wed, 16 Apr 2014 12:49:57 +0000 (13:49 +0100)]
MIPS: uasm: Add lb uasm instruction

It will be used later on by bpf-jit

[ralf@linux-mips.org: Resolved conflict.]

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: uasm: Add mflo uasm instruction
Markos Chandras [Mon, 14 Apr 2014 14:42:31 +0000 (15:42 +0100)]
MIPS: uasm: Add mflo uasm instruction

It will be used later on by bpf-jit

[ralf@linux-mips.org: Resolved conflict.]

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: uasm: Add mul uasm instruction
Markos Chandras [Tue, 8 Apr 2014 11:47:13 +0000 (12:47 +0100)]
MIPS: uasm: Add mul uasm instruction

It will be used later on by bpf-jit

[ralf@linux-mips.org: Resolved conflict.]

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/6736/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: uasm: Add lh uam instruction
Markos Chandras [Tue, 8 Apr 2014 11:47:12 +0000 (12:47 +0100)]
MIPS: uasm: Add lh uam instruction

It will be used later on by bpf-jit

[ralf@linux-mips.org: Resolved conflict.]

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/6733/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: uasm: Add wsbh uasm instruction
Markos Chandras [Tue, 8 Apr 2014 11:47:11 +0000 (12:47 +0100)]
MIPS: uasm: Add wsbh uasm instruction

It will be used later on by bpf-jit

[ralf@linux-mips.org: Resolved conflict.]

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/6732/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: uasm: Add sltu uasm instruction
Markos Chandras [Tue, 8 Apr 2014 11:47:10 +0000 (12:47 +0100)]
MIPS: uasm: Add sltu uasm instruction

It will be used later on by bpf-jit

[ralf@linux-mips.org: Resolved conflict.]

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/6731/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: uasm: Add sltiu uasm instruction
Markos Chandras [Tue, 8 Apr 2014 11:47:09 +0000 (12:47 +0100)]
MIPS: uasm: Add sltiu uasm instruction

It will be used later on by bpf-jit

[ralf@linux-mips.org: Resolved conflict.]

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/6730/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: uasm: Add jalr uasm instruction
Markos Chandras [Tue, 8 Apr 2014 11:47:08 +0000 (12:47 +0100)]
MIPS: uasm: Add jalr uasm instruction

It will be used later on by bpf-jit

[ralf@linux-mips.org: Resolved conflict.]

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/6729/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: uasm: Add mfhi uasm instruction
Markos Chandras [Tue, 8 Apr 2014 11:47:07 +0000 (12:47 +0100)]
MIPS: uasm: Add mfhi uasm instruction

It will be used later on by bpf-jit

[ralf@linux-mips.org: Resolved conflict.]

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: Markos Chandras <markos.chandras@imgtec.com>
Patchwork: http://patchwork.linux-mips.org/patch/6728/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: uasm: Add divu uasm instruction
Markos Chandras [Tue, 8 Apr 2014 11:47:06 +0000 (12:47 +0100)]
MIPS: uasm: Add divu uasm instruction

It will be used later on by bpf-jit

[ralf@linux-mips.org: Resolved conflict.]

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/6727/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: uasm: Add srlv uasm instruction
Markos Chandras [Tue, 8 Apr 2014 11:47:05 +0000 (12:47 +0100)]
MIPS: uasm: Add srlv uasm instruction

It will be used later on by bpf-jit

[ralf@linux-mips.org: Fixed conflict due to other preceeding conflicts.]

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/6726/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: uasm: Add sllv uasm instruction
Markos Chandras [Tue, 8 Apr 2014 11:47:04 +0000 (12:47 +0100)]
MIPS: uasm: Add sllv uasm instruction

It will be used later on by bpf-jit

[ralf@linux-mips.org: Fixed conflict with
49e9529b9d43773307b8c73bd251b71784830c3d [MIPS: uasm: add jalr instruction].

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/6725/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: uasm: Add u2u1 instruction builders
Markos Chandras [Tue, 8 Apr 2014 11:47:03 +0000 (12:47 +0100)]
MIPS: uasm: Add u2u1 instruction builders

It will be used later one for the jalr and wsbh instructions.

[ralf@linux-mips.org: Dropped arch/mips/include/asm/uasm.h segment because
that was already added by 49e9529b9d43773307b8c73bd251b71784830c3d
[MIPS: uasm: add jalr instruction].

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/6724/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: uasm: Add u3u2u1 instruction builders
Markos Chandras [Tue, 8 Apr 2014 11:47:02 +0000 (12:47 +0100)]
MIPS: uasm: Add u3u2u1 instruction builders

It will be used later on by the sllv and srlv instructions.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: http://patchwork.linux-mips.org/patch/6723/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: math-emu: Add IEEE754 exception statistics to debugfs
Deng-Cheng Zhu [Thu, 29 May 2014 19:26:45 +0000 (12:26 -0700)]
MIPS: math-emu: Add IEEE754 exception statistics to debugfs

Sometimes it's useful to let the user, while doing performance research,
know what in the IEEE754 exceptions has caused many times of FP emulation
when running a specific application. This patch adds 5 more files to
/sys/kernel/debug/mips/fpuemustats/, whose filenames begin with "ieee754".
These stats are in addition to the existing cp1ops, cp1xops, errors, loads
and stores, which may not be useful in understanding the reasons of ieee754
exceptions.

[ralf@linux-mips.org: Fixed reject due to other changes to the kernel
FP assist software.]

Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: Steven.Hill@imgtec.com
Cc: james.hogan@imgtec.com
Patchwork: http://patchwork.linux-mips.org/patch/7044/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: BCM47XX: Slightly clean memory detection
Rafał Miłecki [Sat, 19 Apr 2014 10:49:46 +0000 (12:49 +0200)]
MIPS: BCM47XX: Slightly clean memory detection

Patch was tested on devices with 64 MiB and 256 MiB of RAM.
It documents every part nicely and drops this hacky part of code:
max = off | ((128 << 20) - 1);

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: Hauke Mehrtens <hauke@hauke-m.de>
Patchwork: https://patchwork.linux-mips.org/patch/6808/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: octeon: Add interface mode detection for Octeon II
Alex Smith [Thu, 29 May 2014 10:10:01 +0000 (11:10 +0100)]
MIPS: octeon: Add interface mode detection for Octeon II

Add interface mode detection for Octeon II. This is necessary to detect
the interface modes correctly on the UBNT E200 board. Code is taken
from the UBNT GPL source release, with some alterations: SRIO, ILK and
RXAUI interface modes are removed and instead return disabled as these
modes are not currently supported.

Signed-off-by: Alex Smith <alex.smith@imgtec.com>
Tested-by: David Daney <david.daney@cavium.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/7039/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMerge branch 'wip-mips-pm' of https://github.com/paulburton/linux into mips-for-linux...
Ralf Baechle [Wed, 28 May 2014 17:00:14 +0000 (19:00 +0200)]
Merge branch 'wip-mips-pm' of https://github.com/paulburton/linux into mips-for-linux-next

10 years agoMIPS: Malta: CPS SMP by default
Paul Burton [Tue, 15 Apr 2014 11:24:23 +0000 (12:24 +0100)]
MIPS: Malta: CPS SMP by default

The CONFIG_MIPS_CPS SMP implementation should be able to handle all
cases the CONFIG_MIPS_CMP implementation does, but without requiring
bootloader assistance. It is also required in order to make use of
features such as hotplug & cpuidle core power gating. Enable it by
default for Malta configs that previously enabled the now deprecated
CONFIG_MIPS_CMP, and disable the latter. The local version suffix "cmp"
is removed rather than replaced with "cps" since there are other ways to
tell that the CPS SMP implementation is in use (the "VPE topology" line
in the boot log being one).

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
10 years agocpuidle: cpuidle-cps: add MIPS CPS cpuidle driver
Paul Burton [Mon, 14 Apr 2014 15:25:29 +0000 (16:25 +0100)]
cpuidle: cpuidle-cps: add MIPS CPS cpuidle driver

This patch adds a cpuidle driver for systems based around the MIPS
Coherent Processing System (CPS) architecture. It supports four idle
states:

  - The standard MIPS wait instruction.

  - The non-coherent wait, clock gated & power gated states exposed by
    the recently added pm-cps layer.

The pm-cps layer is used to enter all the deep idle states. Since cores
in the clock or power gated states cannot service interrupts, the
gic_send_ipi_single function is modified to send a power up command for
the appropriate core to the CPC in cases where the target CPU has marked
itself potentially incoherent.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
10 years agocpuidle: declare cpuidle_dev in cpuidle.h
Paul Burton [Wed, 8 Jan 2014 11:23:35 +0000 (11:23 +0000)]
cpuidle: declare cpuidle_dev in cpuidle.h

Declaring this allows drivers which need to initialise each struct
cpuidle_device at initialisation time to make use of the structures
already defined in cpuidle.c, rather than having to wastefully define
their own.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
10 years agoMIPS: include cpuidle Kconfig menu
Paul Burton [Mon, 14 Apr 2014 15:24:22 +0000 (16:24 +0100)]
MIPS: include cpuidle Kconfig menu

This patch simply includes the cpuidle Kconfig entries in preparation
for cpuidle drivers used on MIPS systems.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
10 years agoMIPS: cpuidle wait instruction state
Paul Burton [Mon, 14 Apr 2014 15:16:41 +0000 (16:16 +0100)]
MIPS: cpuidle wait instruction state

Defines a macro intended to allow trivial use of the regular MIPS wait
instruction from cpuidle drivers, which may simply invoke the macro
within their array of states.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
10 years agoMIPS: smp-cps: duplicate core0 CCA on secondary cores
Paul Burton [Wed, 16 Apr 2014 10:10:57 +0000 (11:10 +0100)]
MIPS: smp-cps: duplicate core0 CCA on secondary cores

Rather than hardcoding CCA=0x5 for secondary cores, re-use the CCA from
the boot CPU. This allows overrides of the CCA using the cca= kernel
parameter to take effect on all CPUs for consistency.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
10 years agoMIPS: smp-cps: set a coherent default CCA
Paul Burton [Mon, 14 Apr 2014 14:58:45 +0000 (15:58 +0100)]
MIPS: smp-cps: set a coherent default CCA

This patch sets a default CCA suited for use with multi-core SMP on all
current MIPS CPS based systems. It may still be overriden by the cca=
argument on the kernel command line.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
10 years agoMIPS: smp-cps: prevent multi-core SMP with unsuitable CCA
Paul Burton [Mon, 14 Apr 2014 14:21:25 +0000 (15:21 +0100)]
MIPS: smp-cps: prevent multi-core SMP with unsuitable CCA

If the user or bootloader sets the CCA to a value which is not suited
for multi-core SMP (ie. anything non-coherent) then limit the system to
using only a single core and warn the user.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
10 years agoMIPS: smp-cps: hotplug support
Paul Burton [Mon, 14 Apr 2014 13:13:57 +0000 (14:13 +0100)]
MIPS: smp-cps: hotplug support

This patch adds support for offlining CPUs via hotplug when using the
CONFIG_MIPS_CPS SMP implementation. When a CPU is offlined one of 2
things will happen:

  - If the CPU is part of a core which implements the MT ASE and there
    is at least one other VPE online within that core then the VPE will
    be halted by settings its TCHalt bit.

  - Otherwise if supported the core will be powered down via the CPC.

  - Otherwise the CPU will hang by executing an infinite loop.

Bringing CPUs back online is then a process of either clearing the
appropriate VPEs TCHalt bit or powering up the appropriate core via the
CPC. Throughout the process the struct core_boot_config vpe_mask field
must be maintained such that mips_cps_boot_vpes will start & stop the
correct VPEs.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
10 years agoMIPS: pm-cps: add PM state entry code for CPS systems
Paul Burton [Mon, 14 Apr 2014 10:00:56 +0000 (11:00 +0100)]
MIPS: pm-cps: add PM state entry code for CPS systems

This patch adds code to generate entry & exit code for various low power
states available on systems based around the MIPS Coherent Processing
System architecture (ie. those with a Coherence Manager, Global
Interrupt Controller & for >=CM2 a Cluster Power Controller). States
supported are:

  - Non-coherent wait. This state first leaves the coherent domain and
    then executes a regular MIPS wait instruction. Power savings are
    found from the elimination of coherency interventions between the
    core and any other coherent requestors in the system.

  - Clock gated. This state leaves the coherent domain and then gates
    the clock input to the core. This removes all dynamic power from the
    core but leaves the core at the mercy of another to restart its
    clock. Register state is preserved, but the core can not service
    interrupts whilst its clock is gated.

  - Power gated. This deepest state removes all power input to the core.
    All register state is lost and the core will restart execution from
    its BEV when another core powers it back up. Because register state
    is lost this state requires cooperation with the CONFIG_MIPS_CPS SMP
    implementation in order for the core to exit the state successfully.

The code will detect which states are available on the current system
during boot & generate the entry/exit code for those states. This will
be used by cpuidle & hotplug implementations.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
10 years agoMIPS: smp-cps: use CPC core-other locking
Paul Burton [Fri, 7 Mar 2014 10:42:52 +0000 (10:42 +0000)]
MIPS: smp-cps: use CPC core-other locking

The core which the CPC core-other region relates to is based upon the
core-local core-other addressing register. As its name suggests this
register is shared between all VPEs within a core, and if there is a
possibility that multiple VPEs within a core will attempt to access
another core simultaneously then locking is required. This wasn't
previously a problem with the only user being cpu0 during boot, but will
be an issue once hotplug is implemented & may race with other users such
as cpuidle.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
10 years agoMIPS: smp-cps: flush cache after patching mips_cps_core_entry
Paul Burton [Mon, 14 Apr 2014 11:21:49 +0000 (12:21 +0100)]
MIPS: smp-cps: flush cache after patching mips_cps_core_entry

The start of mips_cps_core_entry is patched in order to provide the code
with the address of the CM register region at a point where it will be
running non-coherent with the rest of the system. However the cache
wasn't being flushed after that patching which could in principle lead
to secondary cores using an invalid CM base address.

The patching is moved to cps_prepare_cpus since local_flush_icache_range
has not been initialised at the point cps_smp_setup is called.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
10 years agoMIPS: smp-cps: function to determine whether CPS SMP is in use
Paul Burton [Fri, 14 Mar 2014 16:06:16 +0000 (16:06 +0000)]
MIPS: smp-cps: function to determine whether CPS SMP is in use

The core power down state for cpuidle will require that the CPS SMP
implementation is in use. This patch provides a mips_cps_smp_in_use
function which determines whether or not the CPS SMP implementation is
currently in use.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
10 years agoMIPS: smp-cps: rework core/VPE initialisation
Paul Burton [Mon, 14 Apr 2014 11:04:27 +0000 (12:04 +0100)]
MIPS: smp-cps: rework core/VPE initialisation

When hotplug and/or a powered down idle state are supported cases will
arise where a non-zero VPE must be brought online without VPE 0, and it
where multiple VPEs must be onlined simultaneously. This patch prepares
for that by:

  - Splitting struct boot_config into core & VPE boot config structures,
    allocated one per core or VPE respectively. This allows for multiple
    VPEs to be onlined simultaneously without clobbering each others
    configuration.

  - Indicating which VPEs should be online within a core at any given
    time using a bitmap. This allows multiple VPEs to be brought online
    simultaneously and also indicates to VPE 0 whether it should halt
    after starting any non-zero VPEs that should be online within the
    core. For example if all VPEs within a core are offlined via hotplug
    and the user onlines the second VPE within that core:

      1) The core will be powered up.

      2) VPE 0 will run from the BEV (ie. mips_cps_core_entry) to
         initialise the core.

      3) VPE 0 will start VPE 1 because its bit is set in the cores
         bitmap.

      4) VPE 0 will halt itself because its bit is clear in the cores
         bitmap.

  - Moving the core & VPE initialisation to assembly code which does not
    make any use of the stack. This is because if a non-zero VPE is to
    be brought online in a powered down core then when VPE 0 of that
    core runs it may not have a valid stack, and even if it did then
    it's messy to run through parts of generic kernel code on VPE 0
    before starting the correct VPE.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
10 years agoMIPS: uasm: add MT ASE yield instruction
Paul Burton [Tue, 4 Mar 2014 15:12:36 +0000 (15:12 +0000)]
MIPS: uasm: add MT ASE yield instruction

This patch allows use of the MT ASE yield instruction from uasm. It will
be used by a subsequent patch.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
10 years agoMIPS: uasm: add wait instruction
Paul Burton [Tue, 24 Dec 2013 03:50:35 +0000 (03:50 +0000)]
MIPS: uasm: add wait instruction

This patch allows use of the wait instruction from uasm. It will be used
by a subsequent patch.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
10 years agoMIPS: uasm: add sync instruction
Paul Burton [Tue, 24 Dec 2013 03:49:45 +0000 (03:49 +0000)]
MIPS: uasm: add sync instruction

This patch allows use of the sync instruction from uasm. It will be used
by a subsequent patch.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
10 years agoMIPS: uasm: add jalr instruction
Paul Burton [Sun, 16 Mar 2014 12:58:05 +0000 (12:58 +0000)]
MIPS: uasm: add jalr instruction

This patch allows use of the jalr instruction from uasm. It will be used
by a subsequent patch.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
10 years agoMIPS: uasm: add a label variant of beq
Paul Burton [Tue, 24 Dec 2013 03:51:39 +0000 (03:51 +0000)]
MIPS: uasm: add a label variant of beq

This patch allows for use of the beq instruction with labels from uasm,
much as bne & others already do. It will be used by a subsequent patch.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
10 years agoMIPS: inst.h: define microMIPS wait op
Paul Burton [Thu, 9 Jan 2014 15:30:37 +0000 (15:30 +0000)]
MIPS: inst.h: define microMIPS wait op

The opcode for the wait instruction within POOL32AXf was missing. This
patch adds it for use by a subsequent patch.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
10 years agoMIPS: inst.h: define microMIPS sync op
Paul Burton [Thu, 9 Jan 2014 15:27:32 +0000 (15:27 +0000)]
MIPS: inst.h: define microMIPS sync op

The opcode for the sync instruction within POOL32AXf was missing. This
patch adds it for use by a subsequent patch.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
10 years agoMIPS: inst.h: define MT yield op
Paul Burton [Tue, 4 Mar 2014 15:11:12 +0000 (15:11 +0000)]
MIPS: inst.h: define MT yield op

The opcode for the MT ASE yield instruction within the spec3 group was
missing. This patch adds it for use by a subsequent patch.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
10 years agoMIPS: inst.h: define COP0 wait op
Paul Burton [Tue, 24 Dec 2013 03:44:28 +0000 (03:44 +0000)]
MIPS: inst.h: define COP0 wait op

The func field for the wait instruction was missing from inst.h - this
patch adds it.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
10 years agoMIPS: MT: define write_c0_tchalt macro
Paul Burton [Sun, 16 Mar 2014 16:21:34 +0000 (16:21 +0000)]
MIPS: MT: define write_c0_tchalt macro

Define a macro to write to the current TCs TCHalt register. This will be
used by a subsequent patch.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
10 years agoMIPS: add kmap_noncoherent to wire a cached non-coherent TLB entry
Paul Burton [Mon, 3 Mar 2014 12:08:40 +0000 (12:08 +0000)]
MIPS: add kmap_noncoherent to wire a cached non-coherent TLB entry

This is identical to kmap_coherent apart from the cache coherency
attribute used for the TLB entry, so kmap_coherent is abstracted to
kmap_prot which is then called for both kmap_coherent &
kmap_noncoherent. This will be used by a subsequent patch.

Suggested-by: Leonid Yegoshin <leonid.yegoshin@imgtec.com>
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
10 years agoMIPS: SNI: Remove USE_GENERIC_EARLY_PRINTK_8250
Thomas Bogendoerfer [Mon, 7 Apr 2014 22:22:26 +0000 (00:22 +0200)]
MIPS: SNI: Remove USE_GENERIC_EARLY_PRINTK_8250

SNI RM code has its own EARLY_PRINTK support no need for some generic 8250
stuff.

Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6715/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Alchemy: Default to noncoherent IO on Au1200 AB
Manuel Lauss [Thu, 10 Apr 2014 20:57:59 +0000 (22:57 +0200)]
MIPS: Alchemy: Default to noncoherent IO on Au1200 AB

CONFIG_DMA_COHERENT is no longer set; default to noncoherent io on
Au1200 revision AB to make USB work.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Cc: Linux-MIPS <linux-mips@linux-mips.org>
Patchwork: https://patchwork.linux-mips.org/patch/6745/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Octeon: Add PCIe2 support in arch_setup_msi_irq()
Eunbong Song [Fri, 11 Apr 2014 08:32:54 +0000 (08:32 +0000)]
MIPS: Octeon: Add PCIe2 support in arch_setup_msi_irq()

In arch_setup_msi_irq(), there is no case for PCIe2. So board which have PCIe2 functionality
fails to boot with "Kernel panic - not syncing: arch_setup_msi_irq: Invalid octeon_dma_bar_type"
message. This patch solve this problem.

Signed-off-by: Eunbong Song <eunb.song@samsung.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/6747/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: defconfigs: add MTD_SPI_NOR (new dependency for M25P80)
Brian Norris [Thu, 1 May 2014 06:26:45 +0000 (23:26 -0700)]
MIPS: defconfigs: add MTD_SPI_NOR (new dependency for M25P80)

These defconfigs contain the CONFIG_M25P80 symbol, which is now
dependent on the MTD_SPI_NOR symbol. Add CONFIG_MTD_SPI_NOR to satisfy
the new dependency.

At the same time, drop the now-nonexistent CONFIG_MTD_CHAR symbol.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Cc: Huang Shijie <b32955@freescale.com>
Cc: Marek Vasut <marex@denx.de>
Cc: linux-mtd@lists.infradead.org
Patchwork: https://patchwork.linux-mips.org/patch/6878/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Add __SANE_USERSPACE_TYPES__ to asm/types.h for LL64
Aaro Koskinen [Tue, 6 May 2014 12:55:43 +0000 (15:55 +0300)]
MIPS: Add __SANE_USERSPACE_TYPES__ to asm/types.h for LL64

Allow 64-bit userspace programs to use ll64 types. The define name
comes from commit 2c9c6ce0199a4d252e20c531cfdc9d24e39235c0 (powerpc:
Add __SANE_USERSPACE_TYPES__ to asm/types.h for LL64).

The patch allows to compile perf on MIPS64 and eliminates the following
warnings:

tests/attr.c:74:4: error: format '%llu' expects argument of type 'long
long unsigned int', but argument 6 has type '__u64' [-Werror=format=]

Signed-off-by: Aaro Koskinen <aaro.koskinen@nsn.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/6890/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Lemote 2F: cs5536: mfgpt: depend on !highres
Sebastian Andrzej Siewior [Tue, 13 May 2014 15:07:05 +0000 (17:07 +0200)]
MIPS: Lemote 2F: cs5536: mfgpt: depend on !highres

This timer does not support oneshot mode and as such the system remains
in periodic mode and won't support high res timers.
This patch adds a note about this in Kconfig and lets it depend on
!highres so users which want to use high timers don' stuck with this
timer.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-mips@linux-mips.org
Cc: Hua Yan <yanh@lemote.com>
Cc: Huacai Chen <chenhc@lemote.com>
Cc: Alex Smith <alex.smith@imgtec.com>
Cc: Hongliang Tao <taohl@lemote.com>
Cc: Wu Zhangjin <wuzhangjin@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/6935/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: SMP: Remove plat_smp_ops cpus_done method.
Ralf Baechle [Tue, 27 May 2014 08:56:23 +0000 (10:56 +0200)]
MIPS: SMP: Remove plat_smp_ops cpus_done method.

Nothing was using the method and there isn't any need for this hook.  This
leaves smp_cpus_done() empty for the moment.

As suggested by Paul Bolle <pebolle@tiscali.nl>.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: DTS: Fix missing device_type="memory" property in memory nodes
Leif Lindholm [Mon, 26 May 2014 13:42:49 +0000 (14:42 +0100)]
MIPS: DTS: Fix missing device_type="memory" property in memory nodes

A few platforms lack a 'device_type = "memory"' for their memory
nodes, relying on an old ppc quirk in order to discover its memory.
Add the missing data so that all parsing code can find memory nodes
correctly.

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
Acked-by: John Crispin <blogic@openwrt.org>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
Cc: linux-mips@linux-mips.org
Cc: devicetree@vger.kernel.org
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: <stable@vger.kernel.org>
Cc: gaurav.minocha@alumni.ubc.ca
Patchwork: https://patchwork.linux-mips.org/patch/6989/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: SEAD3: Introduce the use of the managed version of kzalloc
Himangi Saraogi [Tue, 20 May 2014 18:09:42 +0000 (23:39 +0530)]
MIPS: SEAD3: Introduce the use of the managed version of kzalloc

This patch moves data allocated using kzalloc to managed data allocated
using devm_kzalloc and cleans now unnecessary kfrees in probe and remove
functions. Also, the now unnecessary labels out_mem and out are done
away with. The error handling code is moved under if and return 0 is now
at the end of the function.

The following Coccinelle semantic patch was used for making the change:

@platform@
identifier p, probefn, removefn;
@@
struct platform_driver p = {
  .probe = probefn,
  .remove = removefn,
};

@prb@
identifier platform.probefn, pdev;
expression e, e1, e2;
@@
probefn(struct platform_device *pdev, ...) {
  <+...
- e = kzalloc(e1, e2)
+ e = devm_kzalloc(&pdev->dev, e1, e2)
  ...
?-kfree(e);
  ...+>
}

@rem depends on prb@
identifier platform.removefn;
expression e;
@@
removefn(...) {
  <...
- kfree(e);
  ...>
}

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Tested-by: Markos Chandras <markos.chandras@imgtec.com>
Reviewed-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/6977/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: malta: Remove 'maybe_unused' attribute from ememsize{, _str}
Markos Chandras [Fri, 23 May 2014 12:31:32 +0000 (13:31 +0100)]
MIPS: malta: Remove 'maybe_unused' attribute from ememsize{, _str}

First introduced in e6ca4e5bf11466b5e9423a1e4ea51a8216c4b9b6
"MIPS: malta: malta-memory: Add support for the 'ememsize' variable"
but it is not needed since both variables are visible to the compiler.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: <stable@vger.kernel.org> # v3.15+
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6985/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Kconfig: Make MIPS_MT_SMP a regular Kconfig symbol
Markos Chandras [Tue, 8 Apr 2014 10:59:10 +0000 (11:59 +0100)]
MIPS: Kconfig: Make MIPS_MT_SMP a regular Kconfig symbol

Following the removal of SMTC, MIPS_MT_SMP is the only available
MT/SMP option so make it a regular Kconfig symbol.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: Markos Chandras <markos.chandras@imgtec.com>
Patchwork: https://patchwork.linux-mips.org/patch/6720/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: MT: Remove SMTC support
Ralf Baechle [Fri, 23 May 2014 14:29:44 +0000 (16:29 +0200)]
MIPS: MT: Remove SMTC support

Nobody is maintaining SMTC anymore and there also seems to be no userbase.
Which is a pity - the SMTC technology primarily developed by Kevin D.
Kissell <kevink@paralogos.com> is an ingenious demonstration for the MT
ASE's power and elegance.

Based on Markos Chandras <Markos.Chandras@imgtec.com> patch
https://patchwork.linux-mips.org/patch/6719/ which while very similar did
no longer apply cleanly when I tried to merge it plus some additional
post-SMTC cleanup - SMTC was a feature as tricky to remove as it was to
merge once upon a time.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>