Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus

Pull MIPS updates from Ralf Baechle:
 "This is the main pull request for MIPS for 4.7.  Here's the summary of
  the changes:

   - ATH79: Support for DTB passuing using the UHI boot protocol
   - ATH79: Remove support for builtin DTB.
   - ATH79: Add zboot debug serial support.
   - ATH79: Add initial support for Dragino MS14 (Dragine 2), Onion Omega
            and DPT-Module.
   - ATH79: Update devicetree clock support for AR9132 and AR9331.
   - ATH79: Cleanup the DT code.
   - ATH79: Support newer SOCs in ath79_ddr_ctrl_init.
   - ATH79: Fix regression in PCI window initialization.
   - BCM47xx: Move SPROM driver to drivers/firmware/
   - BCM63xx: Enable partition parser in defconfig.
   - BMIPS: BMIPS5000 has I cache filing from D cache
   - BMIPS: BMIPS: Add cpu-feature-overrides.h
   - BMIPS: Add Whirlwind support
   - BMIPS: Adjust mips-hpt-frequency for BCM7435
   - BMIPS: Remove maxcpus from BCM97435SVMB DTS
   - BMIPS: Add missing 7038 L1 register cells to BCM7435
   - BMIPS: Various tweaks to initialization code.
   - BMIPS: Enable partition parser in defconfig.
   - BMIPS: Cache tweaks.
   - BMIPS: Add UART, I2C and SATA devices to DT.
   - BMIPS: Add BCM6358 and BCM63268support
   - BMIPS: Add device tree example for BCM6358.
   - BMIPS: Improve Improve BCM6328 and BCM6368 device trees
   - Lantiq: Add support for device tree file from boot loader
   - Lantiq: Allow build with no built-in DT.
   - Loongson 3: Reserve 32MB for RS780E integrated GPU.
   - Loongson 3: Fix build error after ld-version.sh modification
   - Loongson 3: Move chipset ACPI code from drivers to arch.
   - Loongson 3: Speedup irq processing.
   - Loongson 3: Add basic Loongson 3A support.
   - Loongson 3: Set cache flush handlers to nop.
   - Loongson 3: Invalidate special TLBs when needed.
   - Loongson 3: Fast TLB refill handler.
   - MT7620: Fallback strategy for invalid syscfg0.
   - Netlogic: Fix CP0_EBASE redefinition warnings
   - Octeon: Initialization fixes
   - Octeon: Add DTS files for the D-Link DSR-1000N and EdgeRouter Lite
   - Octeon: Enable add Octeon-drivers in cavium_octeon_defconfig
   - Octeon: Correctly handle endian-swapped initramfs images.
   - Octeon: Support CN73xx, CN75xx and CN78xx.
   - Octeon: Remove dead code from cvmx-sysinfo.
   - Octeon: Extend number of supported CPUs past 32.
   - Octeon: Remove some code limiting NR_IRQS to 255.
   - Octeon: Simplify octeon_irq_ciu_gpio_set_type.
   - Octeon: Mark some functions __init in smp.c
   - Octeon: Octeon: Add Octeon III CN7xxx interface detection
   - PIC32: Add serial driver and bindings for it.
   - PIC32: Add PIC32 deadman timer driver and bindings.
   - PIC32: Add PIC32 clock timer driver and bindings.
   - Pistachio: Determine SoC revision during boot
   - Sibyte: Fix Kconfig dependencies of SIBYTE_BUS_WATCHER.
   - Sibyte: Strip redundant comments from bcm1480_regs.h.
   - Panic immediately if panic_on_oops is set.
   - module: fix incorrect IS_ERR_VALUE macro usage.
   - module: Make consistent use of pr_*
   - Remove no longer needed work_on_cpu() call.
   - Remove CONFIG_IPV6_PRIVACY from defconfigs.
   - Fix registers of non-crashing CPUs in dumps.
   - Handle MIPSisms in new vmcore_elf32_check_arch.
   - Select CONFIG_HANDLE_DOMAIN_IRQ and make it work.
   - Allow RIXI to be used on non-R2 or R6 cores.
   - Reserve nosave data for hibernation
   - Fix siginfo.h to use strict POSIX types.
   - Don't unwind user mode with EVA.
   - Fix watchpoint restoration
   - Ptrace watchpoints for R6.
   - Sync icache when it fills from dcache
   - I6400 I-cache fills from dcache.
   - Various MSA fixes.
   - Cleanup MIPS_CPU_* definitions.
   - Signal: Move generic copy_siginfo to signal.h
   - Signal: Fix uapi include in exported asm/siginfo.h
   - Timer fixes for sake of KVM.
   - XPA TLB refill fixes.
   - Treat perf counter feature
   - Update John Crispin's email address
   - Add PIC32 watchdog and bindings.
   - Handle R10000 LL/SC bug in set_pte()
   - cpufreq: Various fixes for Longson1.
   - R6: Fix R2 emulation.
   - mathemu: Cosmetic fix to ADDIUPC emulation, plenty of other small fixes
   - ELF: ABI and FP fixes.
   - Allow for relocatable kernel and use that to support KASLR.
   - Fix CPC_BASE_ADDR mask
   - Plenty fo smp-cps, CM, R6 and M6250 fixes.
   - Make reset_control_ops const.
   - Fix kernel command line handling of leading whitespace.
   - Cleanups to cache handling.
   - Add brcm, bcm6345-l1-intc device tree bindings.
   - Use generic clkdev.h header
   - Remove CLK_IS_ROOT usage.
   - Misc small cleanups.
   - CM: Fix compilation error when !MIPS_CM
   - oprofile: Fix a preemption issue
   - Detect DSP ASE v3 support:1"

* 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (275 commits)
  MIPS: pic32mzda: fix getting timer clock rate.
  MIPS: ath79: fix regression in PCI window initialization
  MIPS: ath79: make ath79_ddr_ctrl_init() compatible for newer SoCs
  MIPS: Fix VZ probe gas errors with binutils <2.24
  MIPS: perf: Fix I6400 event numbers
  MIPS: DEC: Export `ioasic_ssr_lock' to modules
  MIPS: MSA: Fix a link error on `_init_msa_upper' with older GCC
  MIPS: CM: Fix compilation error when !MIPS_CM
  MIPS: Fix genvdso error on rebuild
  USB: ohci-jz4740: Remove obsolete driver
  MIPS: JZ4740: Probe OHCI platform device via DT
  MIPS: JZ4740: Qi LB60: Remove support for AVT2 variant
  MIPS: pistachio: Determine SoC revision during boot
  MIPS: BMIPS: Adjust mips-hpt-frequency for BCM7435
  mips: mt7620: fallback to SDRAM when syscfg0 does not have a valid value for the memory type
  MIPS: Prevent "restoration" of MSA context in non-MSA kernels
  MIPS: cevt-r4k: Dynamically calculate min_delta_ns
  MIPS: malta-time: Take seconds into account
  MIPS: malta-time: Start GIC count before syncing to RTC
  MIPS: Force CPUs to lose FP context during mode switches
  ...
This commit is contained in:
Linus Torvalds 2016-05-19 10:02:26 -07:00
commit 07b75260eb
358 changed files with 14005 additions and 3399 deletions

View file

@ -197,6 +197,9 @@ config COMMON_CLK_PXA
---help---
Support for the Marvell PXA SoC.
config COMMON_CLK_PIC32
def_bool COMMON_CLK && MACH_PIC32
source "drivers/clk/bcm/Kconfig"
source "drivers/clk/hisilicon/Kconfig"
source "drivers/clk/mvebu/Kconfig"

View file

@ -58,6 +58,7 @@ obj-$(CONFIG_ARCH_MXC) += imx/
obj-$(CONFIG_MACH_INGENIC) += ingenic/
obj-$(CONFIG_COMMON_CLK_KEYSTONE) += keystone/
obj-$(CONFIG_ARCH_MEDIATEK) += mediatek/
obj-$(CONFIG_MACH_PIC32) += microchip/
ifeq ($(CONFIG_COMMON_CLK), y)
obj-$(CONFIG_ARCH_MMP) += mmp/
endif

View file

@ -0,0 +1,2 @@
obj-$(CONFIG_COMMON_CLK_PIC32) += clk-core.o
obj-$(CONFIG_PIC32MZDA) += clk-pic32mzda.o

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,84 @@
/*
* Purna Chandra Mandal,<purna.mandal@microchip.com>
* Copyright (C) 2015 Microchip Technology Inc. All rights reserved.
*
* This program is free software; you can distribute it and/or modify it
* under the terms of the GNU General Public License (Version 2) as
* published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifndef __MICROCHIP_CLK_PIC32_H_
#define __MICROCHIP_CLK_PIC32_H_
#include <linux/clk-provider.h>
/* PIC32 clock data */
struct pic32_clk_common {
struct device *dev;
void __iomem *iobase;
spinlock_t reg_lock; /* clock lock */
};
/* System PLL clock */
struct pic32_sys_pll_data {
struct clk_init_data init_data;
const u32 ctrl_reg;
const u32 status_reg;
const u32 lock_mask;
};
/* System clock */
struct pic32_sys_clk_data {
struct clk_init_data init_data;
const u32 mux_reg;
const u32 slew_reg;
const u32 *parent_map;
const u32 slew_div;
};
/* Reference Oscillator clock */
struct pic32_ref_osc_data {
struct clk_init_data init_data;
const u32 ctrl_reg;
const u32 *parent_map;
};
/* Peripheral Bus clock */
struct pic32_periph_clk_data {
struct clk_init_data init_data;
const u32 ctrl_reg;
};
/* External Secondary Oscillator clock */
struct pic32_sec_osc_data {
struct clk_init_data init_data;
const u32 enable_reg;
const u32 status_reg;
const u32 enable_mask;
const u32 status_mask;
const unsigned long fixed_rate;
};
extern const struct clk_ops pic32_pbclk_ops;
extern const struct clk_ops pic32_sclk_ops;
extern const struct clk_ops pic32_sclk_no_div_ops;
extern const struct clk_ops pic32_spll_ops;
extern const struct clk_ops pic32_roclk_ops;
extern const struct clk_ops pic32_sosc_ops;
struct clk *pic32_periph_clk_register(const struct pic32_periph_clk_data *data,
struct pic32_clk_common *core);
struct clk *pic32_refo_clk_register(const struct pic32_ref_osc_data *data,
struct pic32_clk_common *core);
struct clk *pic32_sys_clk_register(const struct pic32_sys_clk_data *data,
struct pic32_clk_common *core);
struct clk *pic32_spll_clk_register(const struct pic32_sys_pll_data *data,
struct pic32_clk_common *core);
struct clk *pic32_sosc_clk_register(const struct pic32_sec_osc_data *data,
struct pic32_clk_common *core);
#endif /* __MICROCHIP_CLK_PIC32_H_*/

View file

@ -0,0 +1,275 @@
/*
* Purna Chandra Mandal,<purna.mandal@microchip.com>
* Copyright (C) 2015 Microchip Technology Inc. All rights reserved.
*
* This program is free software; you can distribute it and/or modify it
* under the terms of the GNU General Public License (Version 2) as
* published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#include <dt-bindings/clock/microchip,pic32-clock.h>
#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/clkdev.h>
#include <linux/module.h>
#include <linux/of_address.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <asm/traps.h>
#include "clk-core.h"
/* FRC Postscaler */
#define OSC_FRCDIV_MASK 0x07
#define OSC_FRCDIV_SHIFT 24
/* SPLL fields */
#define PLL_ICLK_MASK 0x01
#define PLL_ICLK_SHIFT 7
#define DECLARE_PERIPHERAL_CLOCK(__clk_name, __reg, __flags) \
{ \
.ctrl_reg = (__reg), \
.init_data = { \
.name = (__clk_name), \
.parent_names = (const char *[]) { \
"sys_clk" \
}, \
.num_parents = 1, \
.ops = &pic32_pbclk_ops, \
.flags = (__flags), \
}, \
}
#define DECLARE_REFO_CLOCK(__clkid, __reg) \
{ \
.ctrl_reg = (__reg), \
.init_data = { \
.name = "refo" #__clkid "_clk", \
.parent_names = (const char *[]) { \
"sys_clk", "pb1_clk", "posc_clk", \
"frc_clk", "lprc_clk", "sosc_clk", \
"sys_pll", "refi" #__clkid "_clk", \
"bfrc_clk", \
}, \
.num_parents = 9, \
.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE,\
.ops = &pic32_roclk_ops, \
}, \
.parent_map = (const u32[]) { \
0, 1, 2, 3, 4, 5, 7, 8, 9 \
}, \
}
static const struct pic32_ref_osc_data ref_clks[] = {
DECLARE_REFO_CLOCK(1, 0x80),
DECLARE_REFO_CLOCK(2, 0xa0),
DECLARE_REFO_CLOCK(3, 0xc0),
DECLARE_REFO_CLOCK(4, 0xe0),
DECLARE_REFO_CLOCK(5, 0x100),
};
static const struct pic32_periph_clk_data periph_clocks[] = {
DECLARE_PERIPHERAL_CLOCK("pb1_clk", 0x140, 0),
DECLARE_PERIPHERAL_CLOCK("pb2_clk", 0x150, CLK_IGNORE_UNUSED),
DECLARE_PERIPHERAL_CLOCK("pb3_clk", 0x160, 0),
DECLARE_PERIPHERAL_CLOCK("pb4_clk", 0x170, 0),
DECLARE_PERIPHERAL_CLOCK("pb5_clk", 0x180, 0),
DECLARE_PERIPHERAL_CLOCK("pb6_clk", 0x190, 0),
DECLARE_PERIPHERAL_CLOCK("cpu_clk", 0x1a0, CLK_IGNORE_UNUSED),
};
static const struct pic32_sys_clk_data sys_mux_clk = {
.slew_reg = 0x1c0,
.slew_div = 2, /* step of div_4 -> div_2 -> no_div */
.init_data = {
.name = "sys_clk",
.parent_names = (const char *[]) {
"frcdiv_clk", "sys_pll", "posc_clk",
"sosc_clk", "lprc_clk", "frcdiv_clk",
},
.num_parents = 6,
.ops = &pic32_sclk_ops,
},
.parent_map = (const u32[]) {
0, 1, 2, 4, 5, 7,
},
};
static const struct pic32_sys_pll_data sys_pll = {
.ctrl_reg = 0x020,
.status_reg = 0x1d0,
.lock_mask = BIT(7),
.init_data = {
.name = "sys_pll",
.parent_names = (const char *[]) {
"spll_mux_clk"
},
.num_parents = 1,
.ops = &pic32_spll_ops,
},
};
static const struct pic32_sec_osc_data sosc_clk = {
.status_reg = 0x1d0,
.enable_mask = BIT(1),
.status_mask = BIT(4),
.init_data = {
.name = "sosc_clk",
.parent_names = NULL,
.ops = &pic32_sosc_ops,
},
};
static int pic32mzda_critical_clks[] = {
PB2CLK, PB7CLK
};
/* PIC32MZDA clock data */
struct pic32mzda_clk_data {
struct clk *clks[MAXCLKS];
struct pic32_clk_common core;
struct clk_onecell_data onecell_data;
struct notifier_block failsafe_notifier;
};
static int pic32_fscm_nmi(struct notifier_block *nb,
unsigned long action, void *data)
{
struct pic32mzda_clk_data *cd;
cd = container_of(nb, struct pic32mzda_clk_data, failsafe_notifier);
/* SYSCLK is now running from BFRCCLK. Report clock failure. */
if (readl(cd->core.iobase) & BIT(2))
pr_alert("pic32-clk: FSCM detected clk failure.\n");
/* TODO: detect reason of failure and recover accordingly */
return NOTIFY_OK;
}
static int pic32mzda_clk_probe(struct platform_device *pdev)
{
const char *const pll_mux_parents[] = {"posc_clk", "frc_clk"};
struct device_node *np = pdev->dev.of_node;
struct pic32mzda_clk_data *cd;
struct pic32_clk_common *core;
struct clk *pll_mux_clk, *clk;
struct clk **clks;
int nr_clks, i, ret;
cd = devm_kzalloc(&pdev->dev, sizeof(*cd), GFP_KERNEL);
if (!cd)
return -ENOMEM;
core = &cd->core;
core->iobase = of_io_request_and_map(np, 0, of_node_full_name(np));
if (IS_ERR(core->iobase)) {
dev_err(&pdev->dev, "pic32-clk: failed to map registers\n");
return PTR_ERR(core->iobase);
}
spin_lock_init(&core->reg_lock);
core->dev = &pdev->dev;
clks = &cd->clks[0];
/* register fixed rate clocks */
clks[POSCCLK] = clk_register_fixed_rate(&pdev->dev, "posc_clk", NULL,
CLK_IS_ROOT, 24000000);
clks[FRCCLK] = clk_register_fixed_rate(&pdev->dev, "frc_clk", NULL,
CLK_IS_ROOT, 8000000);
clks[BFRCCLK] = clk_register_fixed_rate(&pdev->dev, "bfrc_clk", NULL,
CLK_IS_ROOT, 8000000);
clks[LPRCCLK] = clk_register_fixed_rate(&pdev->dev, "lprc_clk", NULL,
CLK_IS_ROOT, 32000);
clks[UPLLCLK] = clk_register_fixed_rate(&pdev->dev, "usbphy_clk", NULL,
CLK_IS_ROOT, 24000000);
/* fixed rate (optional) clock */
if (of_find_property(np, "microchip,pic32mzda-sosc", NULL)) {
pr_info("pic32-clk: dt requests SOSC.\n");
clks[SOSCCLK] = pic32_sosc_clk_register(&sosc_clk, core);
}
/* divider clock */
clks[FRCDIVCLK] = clk_register_divider(&pdev->dev, "frcdiv_clk",
"frc_clk", 0,
core->iobase,
OSC_FRCDIV_SHIFT,
OSC_FRCDIV_MASK,
CLK_DIVIDER_POWER_OF_TWO,
&core->reg_lock);
/* PLL ICLK mux */
pll_mux_clk = clk_register_mux(&pdev->dev, "spll_mux_clk",
pll_mux_parents, 2, 0,
core->iobase + 0x020,
PLL_ICLK_SHIFT, 1, 0, &core->reg_lock);
if (IS_ERR(pll_mux_clk))
pr_err("spll_mux_clk: clk register failed\n");
/* PLL */
clks[PLLCLK] = pic32_spll_clk_register(&sys_pll, core);
/* SYSTEM clock */
clks[SCLK] = pic32_sys_clk_register(&sys_mux_clk, core);
/* Peripheral bus clocks */
for (nr_clks = PB1CLK, i = 0; nr_clks <= PB7CLK; i++, nr_clks++)
clks[nr_clks] = pic32_periph_clk_register(&periph_clocks[i],
core);
/* Reference oscillator clock */
for (nr_clks = REF1CLK, i = 0; nr_clks <= REF5CLK; i++, nr_clks++)
clks[nr_clks] = pic32_refo_clk_register(&ref_clks[i], core);
/* register clkdev */
for (i = 0; i < MAXCLKS; i++) {
if (IS_ERR(clks[i]))
continue;
clk_register_clkdev(clks[i], NULL, __clk_get_name(clks[i]));
}
/* register clock provider */
cd->onecell_data.clks = clks;
cd->onecell_data.clk_num = MAXCLKS;
ret = of_clk_add_provider(np, of_clk_src_onecell_get,
&cd->onecell_data);
if (ret)
return ret;
/* force enable critical clocks */
for (i = 0; i < ARRAY_SIZE(pic32mzda_critical_clks); i++) {
clk = clks[pic32mzda_critical_clks[i]];
if (clk_prepare_enable(clk))
dev_err(&pdev->dev, "clk_prepare_enable(%s) failed\n",
__clk_get_name(clk));
}
/* register NMI for failsafe clock monitor */
cd->failsafe_notifier.notifier_call = pic32_fscm_nmi;
return register_nmi_notifier(&cd->failsafe_notifier);
}
static const struct of_device_id pic32mzda_clk_match_table[] = {
{ .compatible = "microchip,pic32mzda-clk", },
{ }
};
MODULE_DEVICE_TABLE(of, pic32mzda_clk_match_table);
static struct platform_driver pic32mzda_clk_driver = {
.probe = pic32mzda_clk_probe,
.driver = {
.name = "clk-pic32mzda",
.of_match_table = pic32mzda_clk_match_table,
},
};
static int __init microchip_pic32mzda_clk_init(void)
{
return platform_driver_register(&pic32mzda_clk_driver);
}
core_initcall(microchip_pic32mzda_clk_init);
MODULE_DESCRIPTION("Microchip PIC32MZDA Clock Driver");
MODULE_LICENSE("GPL v2");
MODULE_ALIAS("platform:clk-pic32mzda");