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

ARM: 7922/1: l2x0: add Marvell Tauros3 support

This adds support for the Marvell Tauros3 cache controller which
is compatible with pl310 cache controller but broadcasts L1 cache
operations to L2 cache. While updating the binding documentation,
clean up the list of possible compatibles. Also reorder driver
compatibles to allow non-ARM derivated to be compatible to ARM
cache controller compatibles.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Sebastian Hesselbarth and committed by
Russell King
e68f31f4 017f161a

+94 -19
+12 -11
Documentation/devicetree/bindings/arm/l2cc.txt
··· 7 7 Required properties: 8 8 9 9 - compatible : should be one of: 10 - "arm,pl310-cache" 11 - "arm,l220-cache" 12 - "arm,l210-cache" 13 - "marvell,aurora-system-cache": Marvell Controller designed to be 10 + "arm,pl310-cache" 11 + "arm,l220-cache" 12 + "arm,l210-cache" 13 + "bcm,bcm11351-a2-pl310-cache": DEPRECATED by "brcm,bcm11351-a2-pl310-cache" 14 + "brcm,bcm11351-a2-pl310-cache": For Broadcom bcm11351 chipset where an 15 + offset needs to be added to the address before passing down to the L2 16 + cache controller 17 + "marvell,aurora-system-cache": Marvell Controller designed to be 14 18 compatible with the ARM one, with system cache mode (meaning 15 19 maintenance operations on L1 are broadcasted to the L2 and L2 16 20 performs the same operation). 17 - "marvell,"aurora-outer-cache: Marvell Controller designed to be 18 - compatible with the ARM one with outer cache mode. 19 - "brcm,bcm11351-a2-pl310-cache": For Broadcom bcm11351 chipset where an 20 - offset needs to be added to the address before passing down to the L2 21 - cache controller 22 - "bcm,bcm11351-a2-pl310-cache": DEPRECATED by 23 - "brcm,bcm11351-a2-pl310-cache" 21 + "marvell,aurora-outer-cache": Marvell Controller designed to be 22 + compatible with the ARM one with outer cache mode. 23 + "marvell,tauros3-cache": Marvell Tauros3 cache controller, compatible 24 + with arm,pl310-cache controller. 24 25 - cache-unified : Specifies the cache is a unified cache. 25 26 - cache-level : Should be set to 2 for a level 2 cache. 26 27 - reg : Physical base address and size of cache controller's memory mapped
+1
arch/arm/include/asm/hardware/cache-l2x0.h
··· 131 131 unsigned long prefetch_ctrl; 132 132 unsigned long pwr_ctrl; 133 133 unsigned long ctrl; 134 + unsigned long aux2_ctrl; 134 135 }; 135 136 136 137 extern struct l2x0_regs l2x0_saved_regs;
+40 -8
arch/arm/mm/cache-l2x0.c
··· 25 25 26 26 #include <asm/cacheflush.h> 27 27 #include <asm/hardware/cache-l2x0.h> 28 + #include "cache-tauros3.h" 28 29 #include "cache-aurora-l2.h" 29 30 30 31 #define CACHE_LINE_SIZE 32 ··· 768 767 l2x0_saved_regs.aux_ctrl = readl_relaxed(l2x0_base + L2X0_AUX_CTRL); 769 768 } 770 769 770 + static void __init tauros3_save(void) 771 + { 772 + l2x0_saved_regs.aux2_ctrl = 773 + readl_relaxed(l2x0_base + TAUROS3_AUX2_CTRL); 774 + l2x0_saved_regs.prefetch_ctrl = 775 + readl_relaxed(l2x0_base + L2X0_PREFETCH_CTRL); 776 + } 777 + 771 778 static void l2x0_resume(void) 772 779 { 773 780 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) { ··· 828 819 l2x0_base + L2X0_AUX_CTRL); 829 820 writel_relaxed(l2x0_saved_regs.ctrl, l2x0_base + L2X0_CTRL); 830 821 } 822 + } 823 + 824 + static void tauros3_resume(void) 825 + { 826 + if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN)) { 827 + writel_relaxed(l2x0_saved_regs.aux2_ctrl, 828 + l2x0_base + TAUROS3_AUX2_CTRL); 829 + writel_relaxed(l2x0_saved_regs.prefetch_ctrl, 830 + l2x0_base + L2X0_PREFETCH_CTRL); 831 + } 832 + 833 + l2x0_resume(); 831 834 } 832 835 833 836 static void __init aurora_broadcast_l2_commands(void) ··· 927 906 }, 928 907 }; 929 908 909 + static const struct l2x0_of_data tauros3_data = { 910 + .setup = NULL, 911 + .save = tauros3_save, 912 + /* Tauros3 broadcasts L1 cache operations to L2 */ 913 + .outer_cache = { 914 + .resume = tauros3_resume, 915 + }, 916 + }; 917 + 930 918 static const struct l2x0_of_data bcm_l2x0_data = { 931 919 .setup = pl310_of_setup, 932 920 .save = pl310_save, ··· 952 922 }; 953 923 954 924 static const struct of_device_id l2x0_ids[] __initconst = { 955 - { .compatible = "arm,pl310-cache", .data = (void *)&pl310_data }, 956 - { .compatible = "arm,l220-cache", .data = (void *)&l2x0_data }, 957 925 { .compatible = "arm,l210-cache", .data = (void *)&l2x0_data }, 958 - { .compatible = "marvell,aurora-system-cache", 959 - .data = (void *)&aurora_no_outer_data}, 960 - { .compatible = "marvell,aurora-outer-cache", 961 - .data = (void *)&aurora_with_outer_data}, 962 - { .compatible = "brcm,bcm11351-a2-pl310-cache", 963 - .data = (void *)&bcm_l2x0_data}, 926 + { .compatible = "arm,l220-cache", .data = (void *)&l2x0_data }, 927 + { .compatible = "arm,pl310-cache", .data = (void *)&pl310_data }, 964 928 { .compatible = "bcm,bcm11351-a2-pl310-cache", /* deprecated name */ 965 929 .data = (void *)&bcm_l2x0_data}, 930 + { .compatible = "brcm,bcm11351-a2-pl310-cache", 931 + .data = (void *)&bcm_l2x0_data}, 932 + { .compatible = "marvell,aurora-outer-cache", 933 + .data = (void *)&aurora_with_outer_data}, 934 + { .compatible = "marvell,aurora-system-cache", 935 + .data = (void *)&aurora_no_outer_data}, 936 + { .compatible = "marvell,tauros3-cache", 937 + .data = (void *)&tauros3_data }, 966 938 {} 967 939 }; 968 940
+41
arch/arm/mm/cache-tauros3.h
··· 1 + /* 2 + * Marvell Tauros3 cache controller includes 3 + * 4 + * Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> 5 + * 6 + * based on GPL'ed 2.6 kernel sources 7 + * (c) Marvell International Ltd. 8 + * 9 + * This program is free software; you can redistribute it and/or modify 10 + * it under the terms of the GNU General Public License version 2 as 11 + * published by the Free Software Foundation. 12 + * 13 + * This program is distributed in the hope that it will be useful, 14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 + * GNU General Public License for more details. 17 + * 18 + * You should have received a copy of the GNU General Public License 19 + * along with this program; if not, write to the Free Software 20 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 + */ 22 + 23 + #ifndef __ASM_ARM_HARDWARE_TAUROS3_H 24 + #define __ASM_ARM_HARDWARE_TAUROS3_H 25 + 26 + /* 27 + * Marvell Tauros3 L2CC is compatible with PL310 r0p0 28 + * but with PREFETCH_CTRL (r2p0) and an additional event counter. 29 + * Also, there is AUX2_CTRL for some Marvell specific control. 30 + */ 31 + 32 + #define TAUROS3_EVENT_CNT2_CFG 0x224 33 + #define TAUROS3_EVENT_CNT2_VAL 0x228 34 + #define TAUROS3_INV_ALL 0x780 35 + #define TAUROS3_CLEAN_ALL 0x784 36 + #define TAUROS3_AUX2_CTRL 0x820 37 + 38 + /* Registers shifts and masks */ 39 + #define TAUROS3_AUX2_CTRL_LINEFILL_BURST8_EN (1 << 2) 40 + 41 + #endif