mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-18 17:54:13 +08:00
e5a32b5b21
An overview of the general architecture changes: - Massive DMA ops refactoring from Christoph Hellwig (huzzah for deleting crufty code!). - We introduce NT_MIPS_DSP & NT_MIPS_FP_MODE ELF notes & corresponding regsets to expose DSP ASE & floating point mode state respectively, both for live debugging & core dumps. - We better optimize our code by hard-coding cpu_has_* macros at compile time where their values are known due to the ISA revision that the kernel build is targeting. - The EJTAG exception handler now better handles SMP systems, where it was previously possible for CPUs to clobber a register value saved by another CPU. - Our implementation of memset() gained a couple of fixes for MIPSr6 systems to return correct values in some cases where stores fault. - We now implement ioremap_wc() using the uncached-accelerated cache coherency attribute where supported, which is detected during boot, and fall back to plain uncached access where necessary. The MIPS-specific (and unused in tree) ioremap_uncached_accelerated() & ioremap_cacheable_cow() are removed. - The prctl(PR_SET_FP_MODE, ...) syscall is better supported for SMP systems by reworking the way we ensure remote CPUs that may be running threads within the affected process switch mode. - Systems using the MIPS Coherence Manager will now set the MIPS_IC_SNOOPS_REMOTE flag to avoid some unnecessary cache maintenance overhead when flushing the icache. - A few fixes were made for building with clang/LLVM, which now sucessfully builds kernels for many of our platforms. - Miscellaneous cleanups all over. And some platform-specific changes: - ar7 gained stubs for a few clock API functions to fix build failures for some drivers. - ath79 gained support for a few new SoCs, a few fixes & better gpio-keys support. - Ci20 now exposes its SPI bus using the spi-gpio driver. - The generic platform can now auto-detect a suitable value for PHYS_OFFSET based upon the memory map described by the device tree, allowing us to avoid wasting memory on page book-keeping for systems where RAM starts at a non-zero physical address. - Ingenic systems using the jz4740 platform code now link their vmlinuz higher to allow for kernels of a realistic size. - Loongson32 now builds the kernel targeting MIPSr1 rather than MIPSr2 to avoid CPU errata. - Loongson64 gains a couple of fixes, a workaround for a write buffering issue & support for the Loongson 3A R3.1 CPU. - Malta now uses the piix4-poweroff driver to handle powering down. - Microsemi Ocelot gained support for its SPI bus & NOR flash, its second MDIO bus and can now be supported by a FIT/.itb image. - Octeon saw a bunch of header cleanups which remove a lot of duplicate or unused code. -----BEGIN PGP SIGNATURE----- iIsEABYIADMWIQRgLjeFAZEXQzy86/s+p5+stXUA3QUCW3G6JxUccGF1bC5idXJ0 b25AbWlwcy5jb20ACgkQPqefrLV1AN0n/gD/Rpdgay31G/4eTTKBmBrcaju6Shjt /2Iu6WC5Sj4hDHUBAJSbuI+B9YjcNsjekBYxB/LLD7ImcLBl6nLMIvKmXLAL =cUiF -----END PGP SIGNATURE----- Merge tag 'mips_4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux Pull MIPS updates from Paul Burton: "Here are the main MIPS changes for 4.19. An overview of the general architecture changes: - Massive DMA ops refactoring from Christoph Hellwig (huzzah for deleting crufty code!). - We introduce NT_MIPS_DSP & NT_MIPS_FP_MODE ELF notes & corresponding regsets to expose DSP ASE & floating point mode state respectively, both for live debugging & core dumps. - We better optimize our code by hard-coding cpu_has_* macros at compile time where their values are known due to the ISA revision that the kernel build is targeting. - The EJTAG exception handler now better handles SMP systems, where it was previously possible for CPUs to clobber a register value saved by another CPU. - Our implementation of memset() gained a couple of fixes for MIPSr6 systems to return correct values in some cases where stores fault. - We now implement ioremap_wc() using the uncached-accelerated cache coherency attribute where supported, which is detected during boot, and fall back to plain uncached access where necessary. The MIPS-specific (and unused in tree) ioremap_uncached_accelerated() & ioremap_cacheable_cow() are removed. - The prctl(PR_SET_FP_MODE, ...) syscall is better supported for SMP systems by reworking the way we ensure remote CPUs that may be running threads within the affected process switch mode. - Systems using the MIPS Coherence Manager will now set the MIPS_IC_SNOOPS_REMOTE flag to avoid some unnecessary cache maintenance overhead when flushing the icache. - A few fixes were made for building with clang/LLVM, which now sucessfully builds kernels for many of our platforms. - Miscellaneous cleanups all over. And some platform-specific changes: - ar7 gained stubs for a few clock API functions to fix build failures for some drivers. - ath79 gained support for a few new SoCs, a few fixes & better gpio-keys support. - Ci20 now exposes its SPI bus using the spi-gpio driver. - The generic platform can now auto-detect a suitable value for PHYS_OFFSET based upon the memory map described by the device tree, allowing us to avoid wasting memory on page book-keeping for systems where RAM starts at a non-zero physical address. - Ingenic systems using the jz4740 platform code now link their vmlinuz higher to allow for kernels of a realistic size. - Loongson32 now builds the kernel targeting MIPSr1 rather than MIPSr2 to avoid CPU errata. - Loongson64 gains a couple of fixes, a workaround for a write buffering issue & support for the Loongson 3A R3.1 CPU. - Malta now uses the piix4-poweroff driver to handle powering down. - Microsemi Ocelot gained support for its SPI bus & NOR flash, its second MDIO bus and can now be supported by a FIT/.itb image. - Octeon saw a bunch of header cleanups which remove a lot of duplicate or unused code" * tag 'mips_4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: (123 commits) MIPS: Remove remnants of UASM_ISA MIPS: netlogic: xlr: Remove erroneous check in nlm_fmn_send() MIPS: VDSO: Force link endianness MIPS: Always specify -EB or -EL when using clang MIPS: Use dins to simplify __write_64bit_c0_split() MIPS: Use read-write output operand in __write_64bit_c0_split() MIPS: Avoid using array as parameter to write_c0_kpgd() MIPS: vdso: Allow clang's --target flag in VDSO cflags MIPS: genvdso: Remove GOT checks MIPS: Remove obsolete MIPS checks for DST node "chosen@0" MIPS: generic: Remove input symbols from defconfig MIPS: Delete unused code in linux32.c MIPS: Remove unused sys_32_mmap2 MIPS: Remove nabi_no_regargs mips: dts: mscc: enable spi and NOR flash support on ocelot PCB123 mips: dts: mscc: Add spi on Ocelot MIPS: Loongson: Merge load addresses MIPS: Loongson: Set Loongson32 to MIPS32R1 MIPS: mscc: ocelot: add interrupt controller properties to GPIO controller MIPS: generic: Select MIPS_AUTO_PFN_OFFSET ...
153 lines
4.3 KiB
C
153 lines
4.3 KiB
C
/*
|
|
* Atheros AR71XX/AR724X/AR913X common routines
|
|
*
|
|
* Copyright (C) 2010-2011 Jaiganesh Narayanan <jnarayanan@atheros.com>
|
|
* Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org>
|
|
* Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
|
|
*
|
|
* Parts of this file are based on Atheros' 2.6.15/2.6.31 BSP
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License version 2 as published
|
|
* by the Free Software Foundation.
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
#include <linux/export.h>
|
|
#include <linux/types.h>
|
|
#include <linux/spinlock.h>
|
|
|
|
#include <asm/mach-ath79/ath79.h>
|
|
#include <asm/mach-ath79/ar71xx_regs.h>
|
|
#include "common.h"
|
|
|
|
static DEFINE_SPINLOCK(ath79_device_reset_lock);
|
|
|
|
u32 ath79_cpu_freq;
|
|
EXPORT_SYMBOL_GPL(ath79_cpu_freq);
|
|
|
|
u32 ath79_ahb_freq;
|
|
EXPORT_SYMBOL_GPL(ath79_ahb_freq);
|
|
|
|
u32 ath79_ddr_freq;
|
|
EXPORT_SYMBOL_GPL(ath79_ddr_freq);
|
|
|
|
enum ath79_soc_type ath79_soc;
|
|
unsigned int ath79_soc_rev;
|
|
|
|
void __iomem *ath79_pll_base;
|
|
void __iomem *ath79_reset_base;
|
|
EXPORT_SYMBOL_GPL(ath79_reset_base);
|
|
static void __iomem *ath79_ddr_base;
|
|
static void __iomem *ath79_ddr_wb_flush_base;
|
|
static void __iomem *ath79_ddr_pci_win_base;
|
|
|
|
void ath79_ddr_ctrl_init(void)
|
|
{
|
|
ath79_ddr_base = ioremap_nocache(AR71XX_DDR_CTRL_BASE,
|
|
AR71XX_DDR_CTRL_SIZE);
|
|
if (soc_is_ar913x() || soc_is_ar724x() || soc_is_ar933x()) {
|
|
ath79_ddr_wb_flush_base = ath79_ddr_base + 0x7c;
|
|
ath79_ddr_pci_win_base = 0;
|
|
} else {
|
|
ath79_ddr_wb_flush_base = ath79_ddr_base + 0x9c;
|
|
ath79_ddr_pci_win_base = ath79_ddr_base + 0x7c;
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(ath79_ddr_ctrl_init);
|
|
|
|
void ath79_ddr_wb_flush(u32 reg)
|
|
{
|
|
void __iomem *flush_reg = ath79_ddr_wb_flush_base + (reg * 4);
|
|
|
|
/* Flush the DDR write buffer. */
|
|
__raw_writel(0x1, flush_reg);
|
|
while (__raw_readl(flush_reg) & 0x1)
|
|
;
|
|
|
|
/* It must be run twice. */
|
|
__raw_writel(0x1, flush_reg);
|
|
while (__raw_readl(flush_reg) & 0x1)
|
|
;
|
|
}
|
|
EXPORT_SYMBOL_GPL(ath79_ddr_wb_flush);
|
|
|
|
void ath79_ddr_set_pci_windows(void)
|
|
{
|
|
BUG_ON(!ath79_ddr_pci_win_base);
|
|
|
|
__raw_writel(AR71XX_PCI_WIN0_OFFS, ath79_ddr_pci_win_base + 0x0);
|
|
__raw_writel(AR71XX_PCI_WIN1_OFFS, ath79_ddr_pci_win_base + 0x4);
|
|
__raw_writel(AR71XX_PCI_WIN2_OFFS, ath79_ddr_pci_win_base + 0x8);
|
|
__raw_writel(AR71XX_PCI_WIN3_OFFS, ath79_ddr_pci_win_base + 0xc);
|
|
__raw_writel(AR71XX_PCI_WIN4_OFFS, ath79_ddr_pci_win_base + 0x10);
|
|
__raw_writel(AR71XX_PCI_WIN5_OFFS, ath79_ddr_pci_win_base + 0x14);
|
|
__raw_writel(AR71XX_PCI_WIN6_OFFS, ath79_ddr_pci_win_base + 0x18);
|
|
__raw_writel(AR71XX_PCI_WIN7_OFFS, ath79_ddr_pci_win_base + 0x1c);
|
|
}
|
|
EXPORT_SYMBOL_GPL(ath79_ddr_set_pci_windows);
|
|
|
|
void ath79_device_reset_set(u32 mask)
|
|
{
|
|
unsigned long flags;
|
|
u32 reg;
|
|
u32 t;
|
|
|
|
if (soc_is_ar71xx())
|
|
reg = AR71XX_RESET_REG_RESET_MODULE;
|
|
else if (soc_is_ar724x())
|
|
reg = AR724X_RESET_REG_RESET_MODULE;
|
|
else if (soc_is_ar913x())
|
|
reg = AR913X_RESET_REG_RESET_MODULE;
|
|
else if (soc_is_ar933x())
|
|
reg = AR933X_RESET_REG_RESET_MODULE;
|
|
else if (soc_is_ar934x())
|
|
reg = AR934X_RESET_REG_RESET_MODULE;
|
|
else if (soc_is_qca953x())
|
|
reg = QCA953X_RESET_REG_RESET_MODULE;
|
|
else if (soc_is_qca955x())
|
|
reg = QCA955X_RESET_REG_RESET_MODULE;
|
|
else if (soc_is_qca956x() || soc_is_tp9343())
|
|
reg = QCA956X_RESET_REG_RESET_MODULE;
|
|
else
|
|
BUG();
|
|
|
|
spin_lock_irqsave(&ath79_device_reset_lock, flags);
|
|
t = ath79_reset_rr(reg);
|
|
ath79_reset_wr(reg, t | mask);
|
|
spin_unlock_irqrestore(&ath79_device_reset_lock, flags);
|
|
}
|
|
EXPORT_SYMBOL_GPL(ath79_device_reset_set);
|
|
|
|
void ath79_device_reset_clear(u32 mask)
|
|
{
|
|
unsigned long flags;
|
|
u32 reg;
|
|
u32 t;
|
|
|
|
if (soc_is_ar71xx())
|
|
reg = AR71XX_RESET_REG_RESET_MODULE;
|
|
else if (soc_is_ar724x())
|
|
reg = AR724X_RESET_REG_RESET_MODULE;
|
|
else if (soc_is_ar913x())
|
|
reg = AR913X_RESET_REG_RESET_MODULE;
|
|
else if (soc_is_ar933x())
|
|
reg = AR933X_RESET_REG_RESET_MODULE;
|
|
else if (soc_is_ar934x())
|
|
reg = AR934X_RESET_REG_RESET_MODULE;
|
|
else if (soc_is_qca953x())
|
|
reg = QCA953X_RESET_REG_RESET_MODULE;
|
|
else if (soc_is_qca955x())
|
|
reg = QCA955X_RESET_REG_RESET_MODULE;
|
|
else if (soc_is_qca956x() || soc_is_tp9343())
|
|
reg = QCA956X_RESET_REG_RESET_MODULE;
|
|
else
|
|
BUG();
|
|
|
|
spin_lock_irqsave(&ath79_device_reset_lock, flags);
|
|
t = ath79_reset_rr(reg);
|
|
ath79_reset_wr(reg, t & ~mask);
|
|
spin_unlock_irqrestore(&ath79_device_reset_lock, flags);
|
|
}
|
|
EXPORT_SYMBOL_GPL(ath79_device_reset_clear);
|