Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+239 -1
+15
arch/arm/mach-bcm/Kconfig
··· 35 35 BCM11300, BCM11320, BCM11350, BCM11360, 36 36 BCM58300, BCM58302, BCM58303, BCM58305. 37 37 38 + config ARCH_BCM_NSP 39 + bool "Broadcom Northstar Plus SoC Support" if ARCH_MULTI_V7 40 + select ARCH_BCM_IPROC 41 + select ARM_ERRATA_754322 42 + select ARM_ERRATA_775420 43 + help 44 + Support for Broadcom Northstar Plus SoC. 45 + Broadcom Northstar Plus family of SoCs are used for switching control 46 + and management applications as well as residential router/gateway 47 + applications. The SoC features dual core Cortex A9 ARM CPUs, 48 + integrating several peripheral interfaces including multiple Gigabit 49 + Ethernet PHYs, DDR3 memory, PCIE Gen-2, USB 2.0 and USB 3.0, serial and 50 + NAND flash, SATA and several other IO controllers. 51 + 38 52 config ARCH_BCM_5301X 39 53 bool "Broadcom BCM470X / BCM5301X ARM SoC" if ARCH_MULTI_V7 40 54 select ARCH_BCM_IPROC ··· 161 147 select BCM7120_L2_IRQ 162 148 select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE 163 149 select ARCH_WANT_OPTIONAL_GPIOLIB 150 + select SOC_BRCMSTB 164 151 help 165 152 Say Y if you intend to run the kernel on a Broadcom ARM-based STB 166 153 chipset.
+4 -1
arch/arm/mach-bcm/Makefile
··· 1 1 # 2 - # Copyright (C) 2012-2014 Broadcom Corporation 2 + # Copyright (C) 2012-2015 Broadcom Corporation 3 3 # 4 4 # This program is free software; you can redistribute it and/or 5 5 # modify it under the terms of the GNU General Public License as ··· 12 12 13 13 # Cygnus 14 14 obj-$(CONFIG_ARCH_BCM_CYGNUS) += bcm_cygnus.o 15 + 16 + # Northstar Plus 17 + obj-$(CONFIG_ARCH_BCM_NSP) += bcm_nsp.o 15 18 16 19 # BCM281XX 17 20 obj-$(CONFIG_ARCH_BCM_281XX) += board_bcm281xx.o
+25
arch/arm/mach-bcm/bcm_nsp.c
··· 1 + /* 2 + * Copyright (C) 2015 Broadcom Corporation 3 + * 4 + * This program is free software; you can redistribute it and/or 5 + * modify it under the terms of the GNU General Public License as 6 + * published by the Free Software Foundation version 2. 7 + * 8 + * This program is distributed "as is" WITHOUT ANY WARRANTY of any 9 + * kind, whether express or implied; without even the implied warranty 10 + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 + * GNU General Public License for more details. 12 + */ 13 + 14 + #include <asm/mach/arch.h> 15 + 16 + static const char *const bcm_nsp_dt_compat[] __initconst = { 17 + "brcm,nsp", 18 + NULL, 19 + }; 20 + 21 + DT_MACHINE_START(NSP_DT, "Broadcom Northstar Plus SoC") 22 + .l2c_aux_val = 0, 23 + .l2c_aux_mask = ~0, 24 + .dt_compat = bcm_nsp_dt_compat, 25 + MACHINE_END
+9
arch/arm/mach-bcm/brcmstb.c
··· 12 12 */ 13 13 14 14 #include <linux/init.h> 15 + #include <linux/irqchip.h> 15 16 #include <linux/of_platform.h> 17 + #include <linux/soc/brcmstb/brcmstb.h> 16 18 17 19 #include <asm/mach-types.h> 18 20 #include <asm/mach/arch.h> 21 + 22 + static void __init brcmstb_init_irq(void) 23 + { 24 + irqchip_init(); 25 + brcmstb_biuctrl_init(); 26 + } 19 27 20 28 static const char *const brcmstb_match[] __initconst = { 21 29 "brcm,bcm7445", ··· 33 25 34 26 DT_MACHINE_START(BRCMSTB, "Broadcom STB (Flattened Device Tree)") 35 27 .dt_compat = brcmstb_match, 28 + .init_irq = brcmstb_init_irq, 36 29 MACHINE_END
+1
drivers/soc/Kconfig
··· 1 1 menu "SOC (System On Chip) specific Drivers" 2 2 3 + source "drivers/soc/brcmstb/Kconfig" 3 4 source "drivers/soc/mediatek/Kconfig" 4 5 source "drivers/soc/qcom/Kconfig" 5 6 source "drivers/soc/sunxi/Kconfig"
+1
drivers/soc/Makefile
··· 2 2 # Makefile for the Linux Kernel SOC specific device drivers. 3 3 # 4 4 5 + obj-$(CONFIG_SOC_BRCMSTB) += brcmstb/ 5 6 obj-$(CONFIG_MACH_DOVE) += dove/ 6 7 obj-$(CONFIG_ARCH_MEDIATEK) += mediatek/ 7 8 obj-$(CONFIG_ARCH_QCOM) += qcom/
+9
drivers/soc/brcmstb/Kconfig
··· 1 + menuconfig 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.
+1
drivers/soc/brcmstb/Makefile
··· 1 + obj-y += common.o biuctrl.o
+116
drivers/soc/brcmstb/biuctrl.c
··· 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 + 26 + static void __iomem *cpubiuctrl_base; 27 + static bool mcp_wr_pairing_en; 28 + 29 + static 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 + 52 + static 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"); 71 + out: 72 + of_node_put(np); 73 + return ret; 74 + } 75 + 76 + #ifdef CONFIG_PM_SLEEP 77 + static u32 cpu_credit_reg_dump; /* for save/restore */ 78 + 79 + static 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 + 87 + static 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 + 94 + static 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 + 101 + void __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 + }
+33
drivers/soc/brcmstb/common.c
··· 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 + 19 + static const struct of_device_id brcmstb_machine_match[] = { 20 + { .compatible = "brcm,brcmstb", }, 21 + { } 22 + }; 23 + 24 + bool 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 + }
+10
include/linux/soc/brcmstb/brcmstb.h
··· 1 + #ifndef __BRCMSTB_SOC_H 2 + #define __BRCMSTB_SOC_H 3 + 4 + /* 5 + * Bus Interface Unit control register setup, must happen early during boot, 6 + * before SMP is brought up, called by machine entry point. 7 + */ 8 + void brcmstb_biuctrl_init(void); 9 + 10 + #endif /* __BRCMSTB_SOC_H */
+15
include/soc/brcmstb/common.h
··· 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 + 10 + #ifndef __SOC_BRCMSTB_COMMON_H__ 11 + #define __SOC_BRCMSTB_COMMON_H__ 12 + 13 + bool soc_is_brcmstb(void); 14 + 15 + #endif /* __SOC_BRCMSTB_COMMON_H__ */