aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/soc
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2015-10-15 16:09:07 -0400
committerArnd Bergmann <arnd@arndb.de>2015-10-15 16:09:07 -0400
commitd72b712824ef906f548210b0012ff7c2a041ef7e (patch)
treea508cc3d23bd71fd81f059a62137de7473c7d024 /drivers/soc
parentaebd774de939c853122829c29c4cfe79f8b440ac (diff)
parentc4a8ea9e0698945b182ba1e1063a0981b1f35139 (diff)
Merge tag 'arm-soc/for-4.4/soc' of http://github.com/Broadcom/stblinux into next/soc
Merge "Broadcom soc changes for v4.4 (try 2)" from Florian Fainelli: This pull request contains the following Broadcom SoC platform and driver changes: - Brian Norris create a drivers/soc/brcmstb/ stub as a place holder for SoC-specific code which is coming next - Florian Fainelli adds support for configuring the BCM7xxx SoCs Bus Interface Unit with their specific write-pairing setting, which must be saved and restored during system-wide suspend/resume, and consequently updates the brcmstb machine code to initialize the BIU - Jon Mason adds support for the Northstar Plus SoCs by introducing a custom machine descriptor matching their compatible string and setting up the PL310 L2 cache and enabling the relevant ARM errata for their Cortex-A9 * tag 'arm-soc/for-4.4/soc' of http://github.com/Broadcom/stblinux: ARM: brcmstb: Setup BIU control registers during boot soc: brcmstb: Add Bus Interface Unit control setup soc: add stubs for brcmstb SoC's ARM: NSP: Add basic support for Broadcom Northstar Plus SoC
Diffstat (limited to 'drivers/soc')
-rw-r--r--drivers/soc/Kconfig1
-rw-r--r--drivers/soc/Makefile1
-rw-r--r--drivers/soc/brcmstb/Kconfig9
-rw-r--r--drivers/soc/brcmstb/Makefile1
-rw-r--r--drivers/soc/brcmstb/biuctrl.c116
-rw-r--r--drivers/soc/brcmstb/common.c33
6 files changed, 161 insertions, 0 deletions
diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig
index 96ddecb92254..c9c0fcce98a7 100644
--- a/drivers/soc/Kconfig
+++ b/drivers/soc/Kconfig
@@ -1,5 +1,6 @@
1menu "SOC (System On Chip) specific Drivers" 1menu "SOC (System On Chip) specific Drivers"
2 2
3source "drivers/soc/brcmstb/Kconfig"
3source "drivers/soc/mediatek/Kconfig" 4source "drivers/soc/mediatek/Kconfig"
4source "drivers/soc/qcom/Kconfig" 5source "drivers/soc/qcom/Kconfig"
5source "drivers/soc/sunxi/Kconfig" 6source "drivers/soc/sunxi/Kconfig"
diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile
index 0b12d777d3c4..4e27f10367f0 100644
--- a/drivers/soc/Makefile
+++ b/drivers/soc/Makefile
@@ -2,6 +2,7 @@
2# Makefile for the Linux Kernel SOC specific device drivers. 2# Makefile for the Linux Kernel SOC specific device drivers.
3# 3#
4 4
5obj-$(CONFIG_SOC_BRCMSTB) += brcmstb/
5obj-$(CONFIG_MACH_DOVE) += dove/ 6obj-$(CONFIG_MACH_DOVE) += dove/
6obj-$(CONFIG_ARCH_MEDIATEK) += mediatek/ 7obj-$(CONFIG_ARCH_MEDIATEK) += mediatek/
7obj-$(CONFIG_ARCH_QCOM) += qcom/ 8obj-$(CONFIG_ARCH_QCOM) += qcom/
diff --git a/drivers/soc/brcmstb/Kconfig b/drivers/soc/brcmstb/Kconfig
new file mode 100644
index 000000000000..39cab3bd544d
--- /dev/null
+++ b/drivers/soc/brcmstb/Kconfig
@@ -0,0 +1,9 @@
1menuconfig SOC_BRCMSTB
2 bool "Broadcom STB SoC drivers"
3 depends on ARM
4 help
5 Enables drivers for the Broadcom Set-Top Box (STB) series of chips.
6 This option alone enables only some support code, while the drivers
7 can be enabled individually within this menu.
8
9 If unsure, say N.
diff --git a/drivers/soc/brcmstb/Makefile b/drivers/soc/brcmstb/Makefile
new file mode 100644
index 000000000000..9120b2715d3e
--- /dev/null
+++ b/drivers/soc/brcmstb/Makefile
@@ -0,0 +1 @@
obj-y += common.o biuctrl.o
diff --git a/drivers/soc/brcmstb/biuctrl.c b/drivers/soc/brcmstb/biuctrl.c
new file mode 100644
index 000000000000..9049c076f9a1
--- /dev/null
+++ b/drivers/soc/brcmstb/biuctrl.c
@@ -0,0 +1,116 @@
1/*
2 * Broadcom STB SoCs Bus Unit Interface controls
3 *
4 * Copyright (C) 2015, Broadcom Corporation
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#define pr_fmt(fmt) "brcmstb: " KBUILD_MODNAME ": " fmt
17
18#include <linux/kernel.h>
19#include <linux/io.h>
20#include <linux/of_address.h>
21#include <linux/syscore_ops.h>
22
23#define CPU_CREDIT_REG_OFFSET 0x184
24#define CPU_CREDIT_REG_MCPx_WR_PAIRING_EN_MASK 0x70000000
25
26static void __iomem *cpubiuctrl_base;
27static bool mcp_wr_pairing_en;
28
29static int __init mcp_write_pairing_set(void)
30{
31 u32 creds = 0;
32
33 if (!cpubiuctrl_base)
34 return -1;
35
36 creds = readl_relaxed(cpubiuctrl_base + CPU_CREDIT_REG_OFFSET);
37 if (mcp_wr_pairing_en) {
38 pr_info("MCP: Enabling write pairing\n");
39 writel_relaxed(creds | CPU_CREDIT_REG_MCPx_WR_PAIRING_EN_MASK,
40 cpubiuctrl_base + CPU_CREDIT_REG_OFFSET);
41 } else if (creds & CPU_CREDIT_REG_MCPx_WR_PAIRING_EN_MASK) {
42 pr_info("MCP: Disabling write pairing\n");
43 writel_relaxed(creds & ~CPU_CREDIT_REG_MCPx_WR_PAIRING_EN_MASK,
44 cpubiuctrl_base + CPU_CREDIT_REG_OFFSET);
45 } else {
46 pr_info("MCP: Write pairing already disabled\n");
47 }
48
49 return 0;
50}
51
52static int __init setup_hifcpubiuctrl_regs(void)
53{
54 struct device_node *np;
55 int ret = 0;
56
57 np = of_find_compatible_node(NULL, NULL, "brcm,brcmstb-cpu-biu-ctrl");
58 if (!np) {
59 pr_err("missing BIU control node\n");
60 return -ENODEV;
61 }
62
63 cpubiuctrl_base = of_iomap(np, 0);
64 if (!cpubiuctrl_base) {
65 pr_err("failed to remap BIU control base\n");
66 ret = -ENOMEM;
67 goto out;
68 }
69
70 mcp_wr_pairing_en = of_property_read_bool(np, "brcm,write-pairing");
71out:
72 of_node_put(np);
73 return ret;
74}
75
76#ifdef CONFIG_PM_SLEEP
77static u32 cpu_credit_reg_dump; /* for save/restore */
78
79static int brcmstb_cpu_credit_reg_suspend(void)
80{
81 if (cpubiuctrl_base)
82 cpu_credit_reg_dump =
83 readl_relaxed(cpubiuctrl_base + CPU_CREDIT_REG_OFFSET);
84 return 0;
85}
86
87static void brcmstb_cpu_credit_reg_resume(void)
88{
89 if (cpubiuctrl_base)
90 writel_relaxed(cpu_credit_reg_dump,
91 cpubiuctrl_base + CPU_CREDIT_REG_OFFSET);
92}
93
94static struct syscore_ops brcmstb_cpu_credit_syscore_ops = {
95 .suspend = brcmstb_cpu_credit_reg_suspend,
96 .resume = brcmstb_cpu_credit_reg_resume,
97};
98#endif
99
100
101void __init brcmstb_biuctrl_init(void)
102{
103 int ret;
104
105 setup_hifcpubiuctrl_regs();
106
107 ret = mcp_write_pairing_set();
108 if (ret) {
109 pr_err("MCP: Unable to disable write pairing!\n");
110 return;
111 }
112
113#ifdef CONFIG_PM_SLEEP
114 register_syscore_ops(&brcmstb_cpu_credit_syscore_ops);
115#endif
116}
diff --git a/drivers/soc/brcmstb/common.c b/drivers/soc/brcmstb/common.c
new file mode 100644
index 000000000000..c262c029b1b8
--- /dev/null
+++ b/drivers/soc/brcmstb/common.c
@@ -0,0 +1,33 @@
1/*
2 * Copyright © 2014 NVIDIA Corporation
3 * Copyright © 2015 Broadcom Corporation
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#include <linux/of.h>
16
17#include <soc/brcmstb/common.h>
18
19static const struct of_device_id brcmstb_machine_match[] = {
20 { .compatible = "brcm,brcmstb", },
21 { }
22};
23
24bool soc_is_brcmstb(void)
25{
26 struct device_node *root;
27
28 root = of_find_node_by_path("/");
29 if (!root)
30 return false;
31
32 return of_match_node(brcmstb_machine_match, root) != NULL;
33}