]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/log
mirror_ubuntu-eoan-kernel.git
10 years agoMIPS: Loongson 3: Add CPU hotplug support
Huacai Chen [Fri, 21 Mar 2014 10:44:09 +0000 (18:44 +0800)]
MIPS: Loongson 3: Add CPU hotplug support

Tips of Loongson's CPU hotplug:
1, To fully shutdown a core in Loongson 3, the target core should go to
   CKSEG1 and flush all L1 cache entries at first. Then, another core
   (usually Core 0) can safely disable the clock of the target core. So
   play_dead() call loongson3_play_dead() via CKSEG1 (both uncached and
   unmmaped).
2, The default clocksource of Loongson is MIPS. Since clock source is a
   global device, timekeeping need the CP0' Count registers of each core
   be synchronous. Thus, when a core is up, we use a SMP_ASK_C0COUNT IPI
   to ask Core-0's Count.

Signed-off-by: Huacai Chen <chenhc@lemote.com>
Signed-off-by: Hongliang Tao <taohl@lemote.com>
Signed-off-by: Hua Yan <yanh@lemote.com>
Tested-by: Alex Smith <alex.smith@imgtec.com>
Reviewed-by: Alex Smith <alex.smith@imgtec.com>
Cc: John Crispin <john@phrozen.org>
Cc: Steven J. Hill <Steven.Hill@imgtec.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: linux-mips@linux-mips.org
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/6639
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Loongson 3: Add Loongson-3 SMP support
Huacai Chen [Fri, 21 Mar 2014 10:44:08 +0000 (18:44 +0800)]
MIPS: Loongson 3: Add Loongson-3 SMP support

IPI registers of Loongson-3 include IPI_SET, IPI_CLEAR, IPI_STATUS,
IPI_EN and IPI_MAILBOX_BUF. Each bit of IPI_STATUS indicate a type of
IPI and IPI_EN indicate whether the IPI is enabled. The sender write 1
to IPI_SET bits generate IPIs in IPI_STATUS, and receiver write 1 to
bits of IPI_CLEAR to clear IPIs. IPI_MAILBOX_BUF are used to deliver
more information about IPIs.

Why we change code in arch/mips/loongson/common/setup.c?

If without this change, when SMP configured, system cannot boot since
it hang at printk() in cgroup_init_early(). The root cause is:

console_trylock()
  \-->down_trylock(&console_sem)
    \-->raw_spin_unlock_irqrestore(&sem->lock, flags)
      \-->_raw_spin_unlock_irqrestore()(SMP/UP have different versions)
        \-->__raw_spin_unlock_irqrestore()  (following is the SMP case)
          \-->do_raw_spin_unlock()
            \-->arch_spin_unlock()
              \-->nudge_writes()
                \-->mb()
                  \-->wbflush()
                    \-->__wbflush()

In previous code __wbflush() is initialized in plat_mem_setup(), but
cgroup_init_early() is called before plat_mem_setup(). Therefore, In
this patch we make changes to avoid boot failure.

Signed-off-by: Huacai Chen <chenhc@lemote.com>
Signed-off-by: Hongliang Tao <taohl@lemote.com>
Signed-off-by: Hua Yan <yanh@lemote.com>
Tested-by: Alex Smith <alex.smith@imgtec.com>
Reviewed-by: Alex Smith <alex.smith@imgtec.com>
Cc: John Crispin <john@phrozen.org>
Cc: Steven J. Hill <Steven.Hill@imgtec.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: linux-mips@linux-mips.org
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/6638
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Loongson: Add Loongson-3 Kconfig options
Huacai Chen [Fri, 21 Mar 2014 10:44:07 +0000 (18:44 +0800)]
MIPS: Loongson: Add Loongson-3 Kconfig options

Added Kconfig options include: Loongson-3 CPU and machine definition,
CPU cache features, UEFI-like firmware interface (LEFI), HT-linked PCI,
and swiotlb support.

Signed-off-by: Huacai Chen <chenhc@lemote.com>
Signed-off-by: Hongliang Tao <taohl@lemote.com>
Signed-off-by: Hua Yan <yanh@lemote.com>
Tested-by: Alex Smith <alex.smith@imgtec.com>
Reviewed-by: Alex Smith <alex.smith@imgtec.com>
Cc: John Crispin <john@phrozen.org>
Cc: Steven J. Hill <Steven.Hill@imgtec.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: linux-mips@linux-mips.org
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/6637
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Loongson: Add swiotlb to support All-Memory DMA
Huacai Chen [Fri, 21 Mar 2014 10:44:06 +0000 (18:44 +0800)]
MIPS: Loongson: Add swiotlb to support All-Memory DMA

Loongson doesn't support DMA address above 4GB traditionally. If memory
is more than 4GB, CONFIG_SWIOTLB and ZONE_DMA32 should be selected. In
this way, DMA pages are allocated below 4GB preferably. However, if low
memory is not enough, high pages are allocated and swiotlb is used for
bouncing.

Moreover, we provide a platform-specific dma_map_ops::set_dma_mask() to
set a device's dma_mask and coherent_dma_mask. We use these masks to
distinguishes an allocated page can be used for DMA directly, or need
swiotlb to bounce.

Recently, we found that 32-bit DMA isn't a hardware bug, but a hardware
configuration issue. So, latest firmware has enable the DMA support as
high as 40-bit. To support all-memory DMA for all devices (besides the
Loongson platform limit, there are still some devices have their own
DMA32 limit), and also to be compatible with old firmware, we keep use
swiotlb.

Signed-off-by: Huacai Chen <chenhc@lemote.com>
Signed-off-by: Hongliang Tao <taohl@lemote.com>
Signed-off-by: Hua Yan <yanh@lemote.com>
Tested-by: Alex Smith <alex.smith@imgtec.com>
Reviewed-by: Alex Smith <alex.smith@imgtec.com>
Cc: John Crispin <john@phrozen.org>
Cc: Steven J. Hill <Steven.Hill@imgtec.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: linux-mips@linux-mips.org
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/6636
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Loongson 3: Add serial port support
Huacai Chen [Fri, 21 Mar 2014 10:44:05 +0000 (18:44 +0800)]
MIPS: Loongson 3: Add serial port support

Loongson family machines has three types of serial port: PCI UART, LPC
UART and CPU internal UART. Loongson-2E and parts of Loongson-2F based
machines use PCI UART; most Loongson-2F based machines use LPC UART;
Loongson-2G/3A has both LPC and CPU UART but usually use CPU UART.

Port address of UARTs:
CPU UART: REG_BASE + OFFSET;
LPC UART: LIO1_BASE + OFFSET;
PCI UART: PCIIO_BASE + OFFSET.

Since LPC UART are linked in "Local Bus", both CPU UART and LPC UART
are called "CPU provided serial port".

Signed-off-by: Huacai Chen <chenhc@lemote.com>
Signed-off-by: Hongliang Tao <taohl@lemote.com>
Signed-off-by: Hua Yan <yanh@lemote.com>
Tested-by: Alex Smith <alex.smith@imgtec.com>
Reviewed-by: Alex Smith <alex.smith@imgtec.com>
Cc: John Crispin <john@phrozen.org>
Cc: Steven J. Hill <Steven.Hill@imgtec.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: linux-mips@linux-mips.org
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/6635
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Loongson 3: Add IRQ init and dispatch support
Huacai Chen [Fri, 21 Mar 2014 10:44:04 +0000 (18:44 +0800)]
MIPS: Loongson 3: Add IRQ init and dispatch support

IRQ routing path of Loongson-3:
Devices(most) --> I8259 --> HT Controller --> IRQ Routing Table --> CPU
                                                  ^
                                                  |
Device(legacy devices such as UART) --> Bonito ---|

IRQ Routing Table route 32 INTs to CPU's INT0~INT3(IP2~IP5 of CP0), 32
INTs include 16 HT INTs(mostly), 4 PCI INTs, 1 LPC INT, etc. IP6 is used
for IPI and IP7 is used for internal MIPS timer. LOONGSON_INT_ROUTER_*
are IRQ Routing Table registers.

I8259 IRQs are 1:1 mapped to HT1 INTs. LOONGSON_HT1_* are configuration
registers of HT1 controller.

Signed-off-by: Huacai Chen <chenhc@lemote.com>
Signed-off-by: Hongliang Tao <taohl@lemote.com>
Signed-off-by: Hua Yan <yanh@lemote.com>
Tested-by: Alex Smith <alex.smith@imgtec.com>
Reviewed-by: Alex Smith <alex.smith@imgtec.com>
Cc: John Crispin <john@phrozen.org>
Cc: Steven J. Hill <Steven.Hill@imgtec.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: linux-mips@linux-mips.org
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/6634
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Loongson 3: Add HT-linked PCI support
Huacai Chen [Fri, 21 Mar 2014 10:44:03 +0000 (18:44 +0800)]
MIPS: Loongson 3: Add HT-linked PCI support

Loongson family machines use Hyper-Transport bus for inter-core
connection and device connection. The PCI bus is a subordinate
linked at HT1.

With LEFI firmware interface, We don't need fixup for PCI irq routing
(except providing a VBIOS of the integrated GPU).

Signed-off-by: Huacai Chen <chenhc@lemote.com>
Signed-off-by: Hongliang Tao <taohl@lemote.com>
Signed-off-by: Hua Yan <yanh@lemote.com>
Tested-by: Alex Smith <alex.smith@imgtec.com>
Reviewed-by: Alex Smith <alex.smith@imgtec.com>
Cc: John Crispin <john@phrozen.org>
Cc: Steven J. Hill <Steven.Hill@imgtec.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: linux-mips@linux-mips.org
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/6633
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Loongson: Add UEFI-like firmware interface (LEFI) support
Huacai Chen [Fri, 21 Mar 2014 10:44:02 +0000 (18:44 +0800)]
MIPS: Loongson: Add UEFI-like firmware interface (LEFI) support

The new UEFI-like firmware interface (LEFI, i.e. Loongson Unified
Firmware Interface) has 3 advantages:

1, Firmware export a physical memory map which is similar to X86's
   E820 map, so prom_init_memory() will be more elegant that #ifdef
   clauses can be removed.
2, Firmware export a pci irq routing table, we no longer need pci
   irq routing fixup in kernel's code.
3, Firmware has a built-in vga bios, and its address is exported,
   the linux kernel no longer need an embedded blob.

With the LEFI interface, Loongson-3A/2G and all their successors can use
a unified kernel. All Loongson-based machines support this new interface
except 2E/2F series.

Signed-off-by: Huacai Chen <chenhc@lemote.com>
Signed-off-by: Hongliang Tao <taohl@lemote.com>
Signed-off-by: Hua Yan <yanh@lemote.com>
Tested-by: Alex Smith <alex.smith@imgtec.com>
Reviewed-by: Alex Smith <alex.smith@imgtec.com>
Cc: John Crispin <john@phrozen.org>
Cc: Steven J. Hill <Steven.Hill@imgtec.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: linux-mips@linux-mips.org
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/6632
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Loongson 3: Add Lemote-3A machtypes definition
Huacai Chen [Fri, 21 Mar 2014 10:44:01 +0000 (18:44 +0800)]
MIPS: Loongson 3: Add Lemote-3A machtypes definition

Add four Loongson-3 based machine types:
MACH_LEMOTE_A1004/MACH_LEMOTE_A1201 are laptops;
MACH_LEMOTE_A1101 is mini-itx;
MACH_LEMOTE_A1205 is all-in-one machine.

The most significant differrent between A1004/A1201 and A1101/A1205 is
the laptops have EC but others don't.

Signed-off-by: Huacai Chen <chenhc@lemote.com>
Signed-off-by: Hongliang Tao <taohl@lemote.com>
Signed-off-by: Hua Yan <yanh@lemote.com>
Tested-by: Alex Smith <alex.smith@imgtec.com>
Reviewed-by: Alex Smith <alex.smith@imgtec.com>
Cc: John Crispin <john@phrozen.org>
Cc: Steven J. Hill <Steven.Hill@imgtec.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: linux-mips@linux-mips.org
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/6631
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Loongson: Add basic Loongson-3 CPU support
Huacai Chen [Fri, 21 Mar 2014 10:44:00 +0000 (18:44 +0800)]
MIPS: Loongson: Add basic Loongson-3 CPU support

Basic Loongson-3 CPU support include CPU probing and TLB/cache
initializing.

Signed-off-by: Huacai Chen <chenhc@lemote.com>
Signed-off-by: Hongliang Tao <taohl@lemote.com>
Signed-off-by: Hua Yan <yanh@lemote.com>
Tested-by: Alex Smith <alex.smith@imgtec.com>
Reviewed-by: Alex Smith <alex.smith@imgtec.com>
Cc: John Crispin <john@phrozen.org>
Cc: Steven J. Hill <Steven.Hill@imgtec.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: linux-mips@linux-mips.org
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/6630
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Loongson: Add basic Loongson-3 definition
Huacai Chen [Fri, 21 Mar 2014 10:43:59 +0000 (18:43 +0800)]
MIPS: Loongson: Add basic Loongson-3 definition

Loongson-3 is a multi-core MIPS family CPU, it support MIPS64R2 fully.
Loongson-3 has the same IMP field (0x6300) as Loongson-2.

Loongson-3 has a hardware-maintained cache, system software doesn't
need to maintain coherency.

Loongson-3A is the first revision of Loongson-3, and it is the quad-
core version of Loongson-2G. Loongson-3A has a simplified version named
Loongson-2Gq, the main difference between Loongson-3A/2Gq is 3A has two
HyperTransport controller but 2Gq has only one. HT0 is used for cross-
chip interconnection and HT1 is used to link PCI bus. Therefore, 2Gq
cannot support NUMA but 3A can. For software, Loongson-2Gq is simply
identified as Loongson-3A.

Exsisting Loongson family CPUs:
Loongson-1: Loongson-1A, Loongson-1B, they are 32-bit MIPS CPUs.
Loongson-2: Loongson-2E, Loongson-2F, Loongson-2G, they are 64-bit
            single-core MIPS CPUs.
Loongson-3: Loongson-3A(including so-called Loongson-2Gq), they are
            64-bit multi-core MIPS CPUs.

Signed-off-by: Huacai Chen <chenhc@lemote.com>
Signed-off-by: Hongliang Tao <taohl@lemote.com>
Signed-off-by: Hua Yan <yanh@lemote.com>
Tested-by: Alex Smith <alex.smith@imgtec.com>
Reviewed-by: Alex Smith <alex.smith@imgtec.com>
Cc: John Crispin <john@phrozen.org>
Cc: Steven J. Hill <Steven.Hill@imgtec.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: linux-mips@linux-mips.org
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/6629/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: MT: proc: Add support for printing VPE and TC ids
Ralf Baechle [Wed, 16 Oct 2013 15:10:07 +0000 (17:10 +0200)]
MIPS: MT: proc: Add support for printing VPE and TC ids

And there are more CPUs or configurations that want to provide special
per-CPU information in /proc/cpuinfo.  So I think there needs to be a
hook mechanism, such as a notifier.

This is a first cut only; I need to think about what sort of looking
the notifier needs to have.  But I'd appreciate testing on MT hardware!

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Cc: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6066/

10 years agoMIPS: BCM47XX: Add new file for device specific workarounds
Rafał Miłecki [Fri, 21 Mar 2014 09:08:08 +0000 (10:08 +0100)]
MIPS: BCM47XX: Add new file for device specific workarounds

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/6627/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: VR41xx: Mark GPIO lines used for IRQ
Linus Walleij [Thu, 23 Jan 2014 23:07:57 +0000 (00:07 +0100)]
MIPS: VR41xx: Mark GPIO lines used for IRQ

When an IRQ is started on a GPIO line, mark this GPIO as IRQ in
the gpiolib so we can keep track of the usage centrally.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Cc: linux-gpio@vger.kernel.org
Cc: Alexandre Courbot <acourbot@nvidia.com>
Patchwork: https://patchwork.linux-mips.org/patch/6417/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Simplify ptrace_getfpregs FPU IR retrieval
Paul Burton [Tue, 19 Nov 2013 17:30:36 +0000 (17:30 +0000)]
MIPS: Simplify ptrace_getfpregs FPU IR retrieval

All architecturally defined bits in the FPU implementation register
are read only & unchanging. It contains some implementation-defined
bits but the architecture manual states "This bits are explicitly not
intended to be used for mode control functions" which seems to provide
justification for viewing the register as a whole as unchanging. This
being the case we can simply re-use the value we read at boot rather
than having to re-read it later, and avoid the complexity which that
read entails.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6147/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Simplify PTRACE_PEEKUSR for FPC_EIR
Paul Burton [Tue, 19 Nov 2013 17:30:35 +0000 (17:30 +0000)]
MIPS: Simplify PTRACE_PEEKUSR for FPC_EIR

All architecturally defined bits in the FPU implementation register
are read only & unchanging. It contains some implementation-defined
bits but the architecture manual states "This bits are explicitly not
intended to be used for mode control functions" which seems to provide
justification for viewing the register as a whole as unchanging. This
being the case we can simply re-use the value we read at boot rather
than having to re-read it later, and avoid the complexity which that
read entails.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Qais Yousef <qais.yousef@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6144/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Use current_cpu_type() instead of c->cputype
Wu Zhangjin [Sat, 25 Dec 2010 20:42:37 +0000 (04:42 +0800)]
MIPS: Use current_cpu_type() instead of c->cputype

If current_cpu_type() is pre-defined in cpu-feature-overrides.h, This
may save about 10k for the compressed kernel image(vmlinuz).

Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/1901/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoEDAC: Octeon: Add error injection support
Daniel Walker [Fri, 20 Sep 2013 22:46:41 +0000 (15:46 -0700)]
EDAC: Octeon: Add error injection support

This adds an ad-hoc error injection method. Octeon II doesn't have
hardware support for injection, so this simulates it.

Signed-off-by: Daniel Walker <dwalker@fifo99.com>
Cc: David Daney <david.daney@cavium.com>
Cc: Doug Thompson <dougthompson@xmission.com>
Cc: linux-edac@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/5873/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoEDAC: Octeon: Fix lack of opstate_init
Daniel Walker [Fri, 20 Sep 2013 22:46:40 +0000 (15:46 -0700)]
EDAC: Octeon: Fix lack of opstate_init

If the opstate_init() isn't called the driver won't start properly.

I just added it in what appears to be an appropriate place.

Signed-off-by: Daniel Walker <dwalker@fifo99.com>
Cc: David Daney <david.daney@cavium.com>
Cc: Doug Thompson <dougthompson@xmission.com>
Cc: linux-edac@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/5872/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Octeon: Remove SYS_HAS_DMA_OPS
Richard Weinberger [Sun, 9 Feb 2014 18:47:46 +0000 (19:47 +0100)]
MIPS: Octeon: Remove SYS_HAS_DMA_OPS

The symbol is an orphan, get rid of it.

Signed-off-by: Richard Weinberger <richard@nod.at>
Cc: linux-mips@linux-mips.org (open list:MIPS)
Cc: linux-kernel@vger.kernel.org (open list)
Patchwork: https://patchwork.linux-mips.org/patch/6523/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: SEAD3: Don't use module_init in non-modular sead3-mtd.c code
Paul Gortmaker [Wed, 22 Jan 2014 20:21:30 +0000 (15:21 -0500)]
MIPS: SEAD3: Don't use module_init in non-modular sead3-mtd.c code

The sead3-mtd.o is built for obj-y -- and hence this code is always
present.  It will never be modular, so using module_init as an alias
for __initcall can be somewhat misleading.

Fix this up now, so that we can relocate module_init from
init.h into module.h in the future.  If we don't do this, we'd
have to add module.h to obviously non-modular code, and that
would be a worse thing.

Note that direct use of __initcall is discouraged, vs. one
of the priority categorized subgroups.  As __initcall gets
mapped onto device_initcall, our use of device_initcall
directly in this change means that the runtime impact is
zero -- it will remain at level 6 in initcall ordering.

We also fix a missing semicolon, which this change uncovers.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Cc: linux-mips@linux-mips.org
Cc: fengguang.wu@intel.com
Patchwork: https://patchwork.linux-mips.org/patch/6412/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Malta: Fix CONFIG_BLK_DEV_IDE vestiges.
Ralf Baechle [Tue, 18 Mar 2014 20:22:46 +0000 (21:22 +0100)]
MIPS: Malta: Fix CONFIG_BLK_DEV_IDE vestiges.

Don't depend on CONFIG_IDE to make this more robust.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Loongson: Rename PRID_IMP_LOONGSON1 and PRID_IMP_LOONGSON2
Huacai Chen [Sun, 16 Feb 2014 08:01:18 +0000 (16:01 +0800)]
MIPS: Loongson: Rename PRID_IMP_LOONGSON1 and PRID_IMP_LOONGSON2

Loongson-1 is a 32-bit MIPS CPU and Loongson-2/3 are 64-bit MIPS CPUs,
and both Loongson-2/3 has the same PRID IMP filed (0x6300). As a
result, renaming PRID_IMP_LOONGSON1 and PRID_IMP_LOONGSON2 to
PRID_IMP_LOONGSON_32 and PRID_IMP_LOONGSON_64 will make more sense.

Signed-off-by: Huacai Chen <chenhc@lemote.com>
Tested-by: Alex Smith <alex.smith@imgtec.com>
Reviewed-by: Alex Smith <alex.smith@imgtec.com>
Cc: John Crispin <john@phrozen.org>
Cc: Steven J. Hill <Steven.Hill@imgtec.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: linux-mips@linux-mips.org
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/6552/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: No need to select ARCH_SUPPORTS_MSI
Paul Bolle [Sat, 8 Feb 2014 21:46:58 +0000 (22:46 +0100)]
MIPS: No need to select ARCH_SUPPORTS_MSI

Commit c24a8a7a9988 ("MIPS: Netlogic: Add MSI support for XLP") added
"select ARCH_SUPPORTS_MSI". But the Kconfig symbol ARCH_SUPPORTS_MSI was
already removed in v3.12, so that select is a nop. Drop it.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Cc: Jayachandran C <jchandra@broadcom.com>
Cc: John Crispin <blogic@openwrt.org>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/6521/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: perf: Add interAptiv support
Deng-Cheng Zhu [Mon, 10 Feb 2014 17:48:54 +0000 (09:48 -0800)]
MIPS: perf: Add interAptiv support

Choose event/cache maps and handle raw event mapping for interAptiv. Update
code comments.

Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
Reviewed-by: Markos Chandras <Markos.Chandras@imgtec.com>
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: Steven.Hill@imgtec.com
Patchwork: https://patchwork.linux-mips.org/patch/6528/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: perf: Add proAptiv support
Deng-Cheng Zhu [Mon, 10 Feb 2014 17:48:53 +0000 (09:48 -0800)]
MIPS: perf: Add proAptiv support

Choose event/cache maps and handle raw event mapping for proAptiv. Update
code comments.

Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
Reviewed-by: Markos Chandras <Markos.Chandras@imgtec.com>
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: Steven.Hill@imgtec.com
Patchwork: https://patchwork.linux-mips.org/patch/6527/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: perf: Rename 74K event/cache maps in preparation for Aptiv support
Deng-Cheng Zhu [Mon, 10 Feb 2014 17:48:52 +0000 (09:48 -0800)]
MIPS: perf: Rename 74K event/cache maps in preparation for Aptiv support

74K/proAptiv share the same event/cache maps. So it's better to change the
names of the existing mipsxx74Kcore_[event|cache]_map.

Signed-off-by: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
Reviewed-by: Markos Chandras <Markos.Chandras@imgtec.com>
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: Steven.Hill@imgtec.com
Patchwork: https://patchwork.linux-mips.org/patch/6526/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: JZ4740: Don't select HAVE_PWM
Jingoo Han [Mon, 10 Feb 2014 01:12:38 +0000 (10:12 +0900)]
MIPS: JZ4740: Don't select HAVE_PWM

The HAVE_PWM symbol is only for legacy platforms that provide the PWM
API without using the generic framework. The jz4740 platform uses the
generic PWM framework, after the commit "f6b8a57 pwm: Add Ingenic
JZ4740 support".

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6525/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Restore init.h usage to arch/mips/ar7/time.c
Paul Gortmaker [Thu, 23 Jan 2014 16:46:41 +0000 (11:46 -0500)]
MIPS: Restore init.h usage to arch/mips/ar7/time.c

Commit 0046be10e0c502705fc74d91408eba13a73bc201 ("mips: delete
non-required instances of include <linux/init.h>") inadvertently
removed an include that was actually correct.  Restore it.

Note that it gets init.h implicitly anyway, so this is largely a
cosmetic fixup; no build regressions were caused by this.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: John Crispin <blogic@openwrt.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6416/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: BCM47XX: Add Belkin F7Dxxxx board detection
Cody P Schafer [Sun, 2 Mar 2014 16:49:29 +0000 (17:49 +0100)]
MIPS: BCM47XX: Add Belkin F7Dxxxx board detection

Add a few Belkin F7Dxxxx entries, with F7D4401 sourced from online
documentation and the "F7D7302" being observed. F7D3301F7D3302, and
F7D4302 are reasonable guesses which are unlikely to cause
mis-detection.

Signed-off-by: Cody P Schafer <devel@codyps.com>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Cc: linux-mips@linux-mips.org
Cc: zajec5@gmail.com
Cc: Cody P Schafer <devel@codyps.com>
Patchwork: https://patchwork.linux-mips.org/patch/6594/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: BCM47XX: Add detection and GPIO config for Siemens SE505v2
Hauke Mehrtens [Sun, 2 Mar 2014 16:49:28 +0000 (17:49 +0100)]
MIPS: BCM47XX: Add detection and GPIO config for Siemens SE505v2

This adds board detection for the Siemens SE505v2 and the led gpio
configuration. This board does not have any buttons.
This is based on OpenWrt broadcom-diag and Manuel Munz's nvram dump.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Cc: linux-mips@linux-mips.org
Cc: zajec5@gmail.com
Patchwork: https://patchwork.linux-mips.org/patch/6593/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: BCM47XX: Add button and led configuration for some Linksys devices
Hauke Mehrtens [Sun, 2 Mar 2014 16:49:27 +0000 (17:49 +0100)]
MIPS: BCM47XX: Add button and led configuration for some Linksys devices

This adds led and button GPIO configuration for Linksys wrt54g3gv2,
wrt54gsv1 and wrtsl54gs. This is based on OpenWrt broadcom-diag code.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Cc: linux-mips@linux-mips.org
Cc: zajec5@gmail.com
Patchwork: https://patchwork.linux-mips.org/patch/6592/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: BCM47XX: Detect some more Linksys devices
Hauke Mehrtens [Sun, 2 Mar 2014 16:49:26 +0000 (17:49 +0100)]
MIPS: BCM47XX: Detect some more Linksys devices

The Linksys WRT54G/GS/GL family uses the same boardtype numbers, and
the same gpio configuration. The boardtype numbers are changing with
the hardware versions, but these hardware numbers are different or each
model.
Detect them all as one device, this also worked in OpenWrt.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Cc: linux-mips@linux-mips.org
Cc: zajec5@gmail.com
Patchwork: https://patchwork.linux-mips.org/patch/6591/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: cpu-probe: Add support for probing M5150 cores
Leonid Yegoshin [Tue, 4 Mar 2014 13:34:44 +0000 (13:34 +0000)]
MIPS: cpu-probe: Add support for probing M5150 cores

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6597/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Add support for the M5150 processor
Leonid Yegoshin [Tue, 4 Mar 2014 13:34:43 +0000 (13:34 +0000)]
MIPS: Add support for the M5150 processor

The M5150 core is a 32-bit MIPS RISC which implements the
MIPS Architecture Release-5  in a 5-stage pipeline.
In addition, it includes the MIPS Architecture Virtualization Module
that enables virtualization of operating systems,
which provides a scalable, trusted, and secure execution environment.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6596/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Add processor identifier for the M5150 processor
Leonid Yegoshin [Tue, 4 Mar 2014 13:34:42 +0000 (13:34 +0000)]
MIPS: Add processor identifier for the M5150 processor

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6595/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Add defconfig for Malta SMVP with EVA
Markos Chandras [Thu, 20 Feb 2014 14:00:28 +0000 (14:00 +0000)]
MIPS: Add defconfig for Malta SMVP with EVA

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6581/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Default NR_CPUS=8 for malta SMP defconfigs
Paul Burton [Thu, 20 Feb 2014 14:00:27 +0000 (14:00 +0000)]
MIPS: Default NR_CPUS=8 for malta SMP defconfigs

The previous NR_CPUS=2 default is not an optimal default for current
Malta setups where it is common to have more than 2 CPUs available. It
makes sense to increase this to a number which covers all common setups
currently in use, such that all of those cores are usable. 8 seems to
fit that description.

If the user has less than 8 CPUs & they wish to have a more optimal
kernel they can simply reduce this in their config. It makes sense for
the default to work on as many systems as possible.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6580/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Set page size to 16KB for malta SMP defconfigs
Paul Burton [Thu, 20 Feb 2014 14:00:26 +0000 (14:00 +0000)]
MIPS: Set page size to 16KB for malta SMP defconfigs

For Malta defconfigs which may run on an SMP configuration without
hardware cache anti-aliasing, a 16KB page size is a safer default.
Most notably at the moment it will avoid cache aliasing issues for
multicore proAptiv systems.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6579/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Malta: Enable DEVTMPFS
Markos Chandras [Thu, 20 Feb 2014 14:00:25 +0000 (14:00 +0000)]
MIPS: Malta: Enable DEVTMPFS

Recent versions of udev and systemd require the kernel
to be compiled with CONFIG_DEVTMPFS in order to populate
the /dev directory. Most MIPS platforms have it enabled by
default, so enable it for Malta configs as well.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6582/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Regenerate malta defconfigs
Paul Burton [Thu, 20 Feb 2014 14:00:24 +0000 (14:00 +0000)]
MIPS: Regenerate malta defconfigs

This patch simply regenerates the malta defconfigs such that they don't
change after being used & saved as a defconfig again. ie. it is the
result of running the following:

for cfg in arch/mips/configs/malta*; do
ARCH=mips make `basename ${cfg}`
ARCH=mips make savedefconfig
mv -v defconfig ${cfg}
done

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/6578/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Alchemy: pata_platform for DB1200
Manuel Lauss [Wed, 26 Mar 2014 14:05:21 +0000 (15:05 +0100)]
MIPS: Alchemy: pata_platform for DB1200

The au1xxx-ide driver isn't any faster than pata_platform since it
spends a lot of time busy waiting for DMA to finish; faster PIO/DMA
modes only work on the db1200 with a certain cpu speed, UDMA is broken,
and finally the old IDE layer is on death row, so time to switch to
the newer ATA layer.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Cc: Linux-MIPS <linux-mips@linux-mips.org>
Patchwork: https://patchwork.linux-mips.org/patch/6662/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Alchemy: fold mach-db1xxx/db1x00 headers into board code
Manuel Lauss [Wed, 26 Mar 2014 09:41:48 +0000 (10:41 +0100)]
MIPS: Alchemy: fold mach-db1xxx/db1x00 headers into board code

Merge the db1200.h and db1300.h headers into their only users.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Cc: Linux-MIPS <linux-mips@linux-mips.org>
Patchwork: https://patchwork.linux-mips.org/patch/6660/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Alchemy: Unify Devboard support.
Manuel Lauss [Thu, 20 Feb 2014 13:59:24 +0000 (14:59 +0100)]
MIPS: Alchemy: Unify Devboard support.

This patch merges support for all DB1xxx and PB1xxx
boards into a single image, along with a new single defconfig
for them.

Run-tested on DB1300 and DB1500.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Cc: Linux-MIPS <linux-mips@linux-mips.org>
Patchwork: https://patchwork.linux-mips.org/patch/6577/
Patchwork: https://patchwork.linux-mips.org/patch/6659/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Alchemy: Determine cohereny at runtime based on cpu type
Manuel Lauss [Thu, 20 Feb 2014 13:59:23 +0000 (14:59 +0100)]
MIPS: Alchemy: Determine cohereny at runtime based on cpu type

All Alchemy chips have coherent DMA, but for example the USB or AC97
peripherals on the Au1000/1500/1100 are not.
This patch uses DMA_MAYBE_COHERENT on Alchemy and sets coherentio based
on CPU type.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Cc: Linux-MIPS <linux-mips@linux-mips.org>
Patchwork: https://patchwork.linux-mips.org/patch/6576/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Extend DMA_MAYBE_COHERENT logic to DMA_NONCOHERENT use
Manuel Lauss [Thu, 20 Feb 2014 13:59:22 +0000 (14:59 +0100)]
MIPS: Extend DMA_MAYBE_COHERENT logic to DMA_NONCOHERENT use

Setting DMA_MAYBE_COHERENT gives a platform the opportunity to select
use of cache ops at boot.

Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com>
Cc: Linux-MIPS <linux-mips@linux-mips.org>
Patchwork: https://patchwork.linux-mips.org/patch/6575/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
10 years agoMIPS: Enable MIPS 3.5 features on Malta
Markos Chandras [Thu, 16 Jan 2014 13:12:36 +0000 (13:12 +0000)]
MIPS: Enable MIPS 3.5 features on Malta

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: malta: Add support for SMP EVA
Markos Chandras [Tue, 21 Jan 2014 09:52:23 +0000 (09:52 +0000)]
MIPS: malta: Add support for SMP EVA

Allow secondary cores to program their segment control registers
during smp bootstrap code. This enables EVA on Malta SMP
configurations

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: malta: malta-init: Fix System Controller memory mapping for EVA
Leonid Yegoshin [Fri, 17 Jan 2014 13:11:29 +0000 (13:11 +0000)]
MIPS: malta: malta-init: Fix System Controller memory mapping for EVA

Shift System Controller memory mapping to 0x80000000

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: malta: malta-memory: Add free_init_pages_eva() callback
Markos Chandras [Wed, 15 Jan 2014 14:07:57 +0000 (14:07 +0000)]
MIPS: malta: malta-memory: Add free_init_pages_eva() callback

Use a Malta specific function to free the init section once the
kernel has booted. When operating in EVA mode, the physical memory
is shifted to 0x80000000. Kernel is loaded into 0x80000000 (virtual)
so the offset between physical and virtual addresses is 0.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: malta: malta-memory: Use the PHYS_OFFSET to build the memory map
Markos Chandras [Wed, 15 Jan 2014 14:13:05 +0000 (14:13 +0000)]
MIPS: malta: malta-memory: Use the PHYS_OFFSET to build the memory map

PHYS_OFFSET is used to denote the physical start address of the
first bank of RAM. When the Malta board is in EVA mode, the physical
start address of RAM is shifted to 0x80000000 so it's necessary to use
this macro in order to make the code EVA agnostic.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: malta: malta-memory: Add support for the 'ememsize' variable
Markos Chandras [Wed, 15 Jan 2014 13:55:07 +0000 (13:55 +0000)]
MIPS: malta: malta-memory: Add support for the 'ememsize' variable

The 'ememsize' variable is used to denote the real RAM which is
present on the Malta board. This is different compared to 'memsize'
which is capped to 256MB. The 'ememsize' is used to get the actual
physical memory when setting up the Malta memory layout. This only
makes sense in case the core operates in the EVA mode, and it's
ignored otherwise.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: malta: spaces.h: Add spaces.h file for Malta (EVA)
Markos Chandras [Wed, 15 Jan 2014 14:11:43 +0000 (14:11 +0000)]
MIPS: malta: spaces.h: Add spaces.h file for Malta (EVA)

Add a spaces.h file for Malta to override certain memory macros
when operating in EVA mode.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: malta: Configure Segment Control registers for EVA boot
Markos Chandras [Wed, 15 Jan 2014 11:18:56 +0000 (11:18 +0000)]
MIPS: malta: Configure Segment Control registers for EVA boot

The Malta board aliases 0x80000000 - 0xffffffff to 0x00000000
- 0x7fffffff ignoring the 256 MB IO hole in 0x10000000.
The physical memory is shifted to 0x80000000 so up to 2GB
can be used. Kuseg is expanded to 3GB (due to board limitations
only 2GB can be accessed) and lowmem (kernel space) is expanded to 2GB.

The Segment Control registers are programmed as follows:

Virtual memory           Physical memory           Mapping
0x00000000 - 0x7fffffff  0x80000000 - 0xfffffffff   MUSUK (kuseg)
0x80000000 - 0x9fffffff  0x00000000 - 0x1ffffffff   MUSUK (kseg0)
0xa0000000 - 0xbf000000  0x00000000 - 0x1ffffffff   MUSUK (kseg1)
0xc0000000 - 0xdfffffff             -                 MK  (kseg2)
0xe0000000 - 0xffffffff             -                 MK  (kseg3)

The location of exception vectors remain the same since 0xbfc00000
(traditional exception base) still maps to 0x1fc00000 physical.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: mm: c-r4k: Flush scache to avoid cache aliases
Leonid Yegoshin [Tue, 21 Jan 2014 09:48:48 +0000 (09:48 +0000)]
MIPS: mm: c-r4k: Flush scache to avoid cache aliases

There is a chance for the secondary cache to have memory
aliases. This can happen if the bootloader is in a non-EVA mode
(or even in EVA mode but with different mapping from the kernel)
and the kernel switching to EVA afterwards. It's best to flush
the icache to avoid having the secondary CPUs fetching stale
data from it.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: mm: c-r4k: Add support for flushing user pages from cache
Markos Chandras [Thu, 16 Jan 2014 13:11:08 +0000 (13:11 +0000)]
MIPS: mm: c-r4k: Add support for flushing user pages from cache

Use the userspace cache flushing functions if the interrupted
process is a userspace one.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: mm: c-r4k: Build EVA {d,i}cache flushing functions
Leonid Yegoshin [Wed, 15 Jan 2014 14:47:28 +0000 (14:47 +0000)]
MIPS: mm: c-r4k: Build EVA {d,i}cache flushing functions

Build EVA specific cache flushing functions (ie cachee).
They will be used by a subsequent patch.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: mm: init: Add free_init_pages() callback for EVA
Markos Chandras [Wed, 15 Jan 2014 14:06:03 +0000 (14:06 +0000)]
MIPS: mm: init: Add free_init_pages() callback for EVA

A core in EVA mode can have any possible segment mapping, so the
default free_initmem_default() function may not always work as expected.
Therefore, add a callback that platforms can use to free up the init section.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: kernel: proc: Add EVA to the list of CPU features
Markos Chandras [Mon, 27 Jan 2014 15:10:40 +0000 (15:10 +0000)]
MIPS: kernel: proc: Add EVA to the list of CPU features

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: kernel: cpu-probe: Enable EVA option on supported cores
Markos Chandras [Thu, 9 Jan 2014 16:04:51 +0000 (16:04 +0000)]
MIPS: kernel: cpu-probe: Enable EVA option on supported cores

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: cpu: Add cpu flag for Enhanced Virtual Addressing
Markos Chandras [Thu, 9 Jan 2014 16:01:29 +0000 (16:01 +0000)]
MIPS: asm: cpu: Add cpu flag for Enhanced Virtual Addressing

The MIPS *Aptiv family uses bit 28 in Config5 CP0 register to
indicate whether the core supports EVA or not.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: page: Allow __pa_symbol overrides
Leonid Yegoshin [Thu, 9 Jan 2014 13:06:34 +0000 (13:06 +0000)]
MIPS: asm: page: Allow __pa_symbol overrides

This will allow platforms to use an alternative way to get
the physical address of a symbol.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: kernel: {ftrace,kgdb}: Set correct address limit for cache flushes
Leonid Yegoshin [Mon, 16 Dec 2013 12:06:55 +0000 (12:06 +0000)]
MIPS: kernel: {ftrace,kgdb}: Set correct address limit for cache flushes

When flushing the icache, make sure the address limit is correct
so the appropriate 'cache' instruction will be used. This has no
impact on cores operating in non-eva mode. However, when EVA is
enabled, we ensure that 'cache' will be used instead of 'cachee'.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: r4kcache: Add EVA cache flushing functions
Leonid Yegoshin [Mon, 16 Dec 2013 11:46:33 +0000 (11:46 +0000)]
MIPS: asm: r4kcache: Add EVA cache flushing functions

Add EVA cache flushing functions similar to non-EVA configurations.
Because the cache may or may not contain user virtual addresses, we
need to use the 'cache' or 'cachee' instruction based on whether we
flush the cache on behalf of kernel or user respectively.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: r4kcache: Add protected cache operation for EVA
Leonid Yegoshin [Mon, 16 Dec 2013 11:38:00 +0000 (11:38 +0000)]
MIPS: asm: r4kcache: Add protected cache operation for EVA

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: r4kcache: Build flushing code for instruction cache
Leonid Yegoshin [Mon, 16 Dec 2013 11:24:13 +0000 (11:24 +0000)]
MIPS: asm: r4kcache: Build flushing code for instruction cache

Build code to invalidate an address range in the  instruction cache
using the Hit Invalidate cache operation.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: kernel: signal: Prevent save/restore FPU context in user memory
Leonid Yegoshin [Thu, 12 Dec 2013 16:57:19 +0000 (16:57 +0000)]
MIPS: kernel: signal: Prevent save/restore FPU context in user memory

EVA does not have FPU specific instructions for reading or writing
FPU registers from userspace memory.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: checksum: Add MIPS specific csum_and_copy_from_user function
Leonid Yegoshin [Tue, 17 Dec 2013 09:30:13 +0000 (09:30 +0000)]
MIPS: asm: checksum: Add MIPS specific csum_and_copy_from_user function

A MIPS specific csum_and_copy_from_user function is necessary because
the generic one from include/net/checksum.h will not work for EVA.
This is because the generic one will link to symbols from lib/checksum.c
which are not EVA aware.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: checksum: Split kernel and user copy operations
Leonid Yegoshin [Thu, 19 Dec 2013 17:09:17 +0000 (17:09 +0000)]
MIPS: asm: checksum: Split kernel and user copy operations

In EVA mode, different instructions need to be used to read/write
from kernel and userland. In non-EVA mode, there is no functional
difference. The current address limit is checked to decide the
type of operation that will be performed.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: csum_partial: Add EVA support
Markos Chandras [Fri, 17 Jan 2014 11:36:16 +0000 (11:36 +0000)]
MIPS: lib: csum_partial: Add EVA support

Use EVA specific functions to read and write data to
user address space.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: csum_partial: Add macro to build csum_partial symbols
Markos Chandras [Fri, 17 Jan 2014 10:48:46 +0000 (10:48 +0000)]
MIPS: lib: csum_partial: Add macro to build csum_partial symbols

In preparation for EVA support, we use a macro to build the
__csum_partial_copy_user main code so it can be shared across
multiple implementations. EVA uses the same code but it replaces
the load/store/prefetch instructions with the EVA specific ones
therefore using a macro avoids unnecessary code duplications.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: csum_partial: Merge EXC and load/store macros
Markos Chandras [Thu, 16 Jan 2014 17:02:13 +0000 (17:02 +0000)]
MIPS: lib: csum_partial: Merge EXC and load/store macros

Each load/store macro always adds an entry to the __ex_table
using the EXC macro. There are cases where a load instruction may
never fail such as when we are sure the load happens in the kernel
address space. Therefore, we merge these the EXC and LOADX/STOREX
macros into a single one. We also expand the argument list in the EXC
macro to make the macro more flexible. The extra 'type' argument is not
used by this commit, but it will be used when EVA support is added to
memcpy.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: checksum: Split the 'copy_user' symbol
Markos Chandras [Thu, 12 Dec 2013 16:21:00 +0000 (16:21 +0000)]
MIPS: checksum: Split the 'copy_user' symbol

The 'copy_user' symbol can be used to copy from or to
userland so we will use two different symbols for these
operations. This makes no difference in the existing code,
but when the core is operating in EVA mode, different instructions
need to be used to read and write to userland address space.
The old function has also been renamed to 'copy_kernel' to denote
that it is suitable for copy data to and from kernel space.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: kernel: unaligned: Handle unaligned accesses for EVA
Leonid Yegoshin [Thu, 12 Dec 2013 16:15:15 +0000 (16:15 +0000)]
MIPS: kernel: unaligned: Handle unaligned accesses for EVA

Handle unaligned accesses when we access userspace memory
EVA mode.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: kernel: unaligned: Add EVA instruction wrappers
Markos Chandras [Thu, 19 Dec 2013 16:41:05 +0000 (16:41 +0000)]
MIPS: kernel: unaligned: Add EVA instruction wrappers

Use the load/store instruction wrappers from asm/asm.h to
perform such operations when operating in EVA mode.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: uaccess: Add EVA support for str*_user operations
Markos Chandras [Fri, 3 Jan 2014 14:55:02 +0000 (14:55 +0000)]
MIPS: asm: uaccess: Add EVA support for str*_user operations

The str*_user functions are used to securely access NULL terminated
strings from userland. Therefore, it's necessary to use the appropriate
EVA function. However, if the string is in kernel space, then the normal
instructions are being used to access it. The __str*_kernel_asm and
__str*_user_asm symbols are the same for non-EVA mode so there is no
functional change for the non-EVA kernels.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: uaccess: Add EVA support to copy_{in, to,from}_user
Markos Chandras [Wed, 11 Dec 2013 16:47:10 +0000 (16:47 +0000)]
MIPS: asm: uaccess: Add EVA support to copy_{in, to,from}_user

Use the EVA specific functions from memcpy.S to perform
userspace operations. When get_fs() == get_ds() the usual load/store
instructions are used because the destination address is located in
the kernel address space region. Otherwise, the EVA specifc load/store
instructions are used which will go through th TLB to perform the virtual
to physical translation for the userspace address.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: uaccess: Rename {get,put}_user_asm macros
Markos Chandras [Mon, 6 Jan 2014 12:48:28 +0000 (12:48 +0000)]
MIPS: asm: uaccess: Rename {get,put}_user_asm macros

The {get,put}_user_asm functions can be used to load data from
kernel or the user address space so rename them to avoid
confusion.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: uaccess: Use EVA instructions wrappers
Markos Chandras [Wed, 11 Dec 2013 11:25:33 +0000 (11:25 +0000)]
MIPS: asm: uaccess: Use EVA instructions wrappers

Use the EVA instruction wrappers from asm.h to perform
read/write operations from userland.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: uaccess: Disable unaligned access macros for EVA
Leonid Yegoshin [Tue, 17 Dec 2013 15:20:24 +0000 (15:20 +0000)]
MIPS: asm: uaccess: Disable unaligned access macros for EVA

ulb, ulh, ulw are macros which emulate unaligned access for MIPS.
However, no such macros exist for EVA mode, so the only way to do
EVA unaligned accesses is in the ADE exception handler. As a result
of which, disable these macros for EVA.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: uaccess: Move duplicated code to common function
Markos Chandras [Tue, 17 Dec 2013 14:42:23 +0000 (14:42 +0000)]
MIPS: asm: uaccess: Move duplicated code to common function

Similar to __get_user_* functions, move common code to
__put_user_*_common so it can be shared among similar users.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: asm: uaccess: Add instruction argument to __{put,get}_user_asm
Markos Chandras [Tue, 17 Dec 2013 13:15:40 +0000 (13:15 +0000)]
MIPS: asm: uaccess: Add instruction argument to __{put,get}_user_asm

In preparation for EVA support, an instruction argument is needed
for the __get_user_asm{,_ll32} functions to allow instruction overrides in
EVA mode. Even though EVA only works for MIPS 32-bit, both codepaths are
changed (32-bit and 64-bit) for consistency reasons.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: memset: Add EVA support for the __bzero function.
Markos Chandras [Fri, 3 Jan 2014 10:11:45 +0000 (10:11 +0000)]
MIPS: lib: memset: Add EVA support for the __bzero function.

Build the __bzero function using the EVA load/store instructions
when operating in the EVA mode. This function is only used when
accessing user code so there is no need to build two distinct symbols
for user and kernel operations respectively.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: memset: Use macro to build the __bzero symbol
Markos Chandras [Fri, 3 Jan 2014 09:23:16 +0000 (09:23 +0000)]
MIPS: lib: memset: Use macro to build the __bzero symbol

Build the __bzero symbol using a macor. In EVA mode we will
need to use similar code to do the userspace load operations so
it is better if we use a macro to avoid code duplications.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: memset: Whitespace fixes
Markos Chandras [Fri, 3 Jan 2014 09:21:20 +0000 (09:21 +0000)]
MIPS: lib: memset: Whitespace fixes

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: memcpy: Add EVA support
Markos Chandras [Tue, 7 Jan 2014 16:20:22 +0000 (16:20 +0000)]
MIPS: lib: memcpy: Add EVA support

Add copy_{to,from,in}_user when the CPU operates in EVA mode.
This is necessary so the EVA specific instructions can be used
to perform the virtual to physical translation for user space
addresses. We will use the non-EVA functions to read from kernel
if needed.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: memcpy: Use macro to build the copy_user code
Markos Chandras [Tue, 7 Jan 2014 14:34:05 +0000 (14:34 +0000)]
MIPS: lib: memcpy: Use macro to build the copy_user code

The code can be shared between EVA and non-EVA configurations,
therefore use a macro to build it to avoid code duplications.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: memcpy: Split source and destination prefetch macros
Markos Chandras [Tue, 7 Jan 2014 15:59:03 +0000 (15:59 +0000)]
MIPS: lib: memcpy: Split source and destination prefetch macros

In preparation for EVA support, the PREF macro is split into two
separate macros, PREFS and PREFD, for source and destination data
prefetching respectively.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: memcpy: Merge EXC and load/store macros
Markos Chandras [Tue, 7 Jan 2014 12:57:04 +0000 (12:57 +0000)]
MIPS: lib: memcpy: Merge EXC and load/store macros

Each load/store macro always adds an entry to the __ex_table
using the EXC macro. Therefore, these load/store macros are now merged
with the EXC one. The argument list is also expanded in order to make
the macro more flexible. The extra 'type' argument is not used by this
commit, but it will be used when the EVA support is added to the memcpy.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: strncpy_user: Add EVA support
Markos Chandras [Thu, 2 Jan 2014 16:40:20 +0000 (16:40 +0000)]
MIPS: lib: strncpy_user: Add EVA support

In non-EVA mode, strncpy_from_user* aliases are used for the
strncpy_from_kernel* symbols since the code is identical. In EVA
mode, new strcpy_from_user* symbols are used which use the EVA
specific instructions to load values from userspace.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: strncpy_user: Use macro to build the strncpy_from_user symbol
Markos Chandras [Thu, 2 Jan 2014 16:36:49 +0000 (16:36 +0000)]
MIPS: lib: strncpy_user: Use macro to build the strncpy_from_user symbol

Build the __strncpy_from_user symbol using a macro. In EVA mode we will
need to use similar code to do the userspace load operations so
it is better if we use a macro to avoid code duplications.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: strlen_user: Add EVA support
Markos Chandras [Thu, 2 Jan 2014 16:04:38 +0000 (16:04 +0000)]
MIPS: lib: strlen_user: Add EVA support

In non-EVA mode, strlen_user* aliases are used for the
strlen_kernel* symbols since the code is identical. In EVA
mode, new strlen_user* symbols are used which use the EVA
specific instructions to load values from userspace.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: strlen_user: Use macro to build the strlen_user symbol
Markos Chandras [Thu, 2 Jan 2014 15:55:58 +0000 (15:55 +0000)]
MIPS: lib: strlen_user: Use macro to build the strlen_user symbol

Build the __strlen_user symbol using a macro. In EVA mode we will
need to use similar code to do the userspace load operations so
it is better if we use a macro to avoid code duplications.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: strnlen_user: Add EVA support
Markos Chandras [Mon, 9 Dec 2013 15:28:10 +0000 (15:28 +0000)]
MIPS: lib: strnlen_user: Add EVA support

In non-EVA mode, a strlen_user* alias is used for the
strlen_kernel* symbols since the code is identical. In EVA
mode, a new strlen_user* symbol is used which uses the EVA
specific instructions to load values from userspace.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: lib: strnlen_user: Use macro to build the strnlen_user symbol
Markos Chandras [Thu, 2 Jan 2014 16:19:49 +0000 (16:19 +0000)]
MIPS: lib: strnlen_user: Use macro to build the strnlen_user symbol

Build the __strnlen_user symbol using a macro. In EVA mode we will
need to use similar code to do the userspace load operations so
it is better if we use a macro to avoid code duplications.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: traps: Set correct address limit for breakpoints and traps
Leonid Yegoshin [Wed, 4 Dec 2013 16:39:34 +0000 (16:39 +0000)]
MIPS: traps: Set correct address limit for breakpoints and traps

When a breakpoint or trap happens when operating in kernel mode but
on users behalf (eg syscall) it is necessary to change the address
limit to KERNEL_DS so any address checking can be bypassed and print
the correct stack trace.

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: kernel: traps: Whitespace clean up
Markos Chandras [Wed, 4 Dec 2013 16:20:08 +0000 (16:20 +0000)]
MIPS: kernel: traps: Whitespace clean up

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: kernel: scall32-o32: Use EVA wrappers to fetch syscall arguments
Markos Chandras [Wed, 4 Dec 2013 14:35:28 +0000 (14:35 +0000)]
MIPS: kernel: scall32-o32: Use EVA wrappers to fetch syscall arguments

Arguments 4-8 are stored on user's stack, so use the EVA instructions
to fetch them if EVA is enabled.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: uapi: inst: Add instruction format for SPECIAL3 instructions
Leonid Yegoshin [Wed, 4 Dec 2013 11:06:57 +0000 (11:06 +0000)]
MIPS: uapi: inst: Add instruction format for SPECIAL3 instructions

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
10 years agoMIPS: uapi: inst: Add new EVA opcodes
Leonid Yegoshin [Wed, 4 Dec 2013 11:00:27 +0000 (11:00 +0000)]
MIPS: uapi: inst: Add new EVA opcodes

Signed-off-by: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>