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

Merge tag 'aspeed-5.11-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/joel/aspeed into arm/drivers

ASPEED soc driver updates for 5.11

New drivers:

- SoC info driver to expose revision information

New features:

- AST2600 support for the LPC control driver. This includes
setting the LPC2AHB bridge up in a backwards compatible manner.

Cleanups:

- LPC control
- Kconfig
- Bindings updates for AST2600 strings

* tag 'aspeed-5.11-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/joel/aspeed:
soc: aspeed: Enable drivers with ARCH_ASPEED
soc: aspeed: Fix a reference leak in aspeed_socinfo_init()
soc: aspeed: remove unneeded semicolon
soc: aspeed-lpc-ctrl: Fix driver name
soc: aspeed-lpc-ctrl: Fix whitespace
soc: aspeed-lpc-ctrl: LPC to AHB mapping on ast2600
soc: aspeed-lpc-ctrl: Fail probe of lpc-ctrl if reserved memory is not aligned
soc: aspeed: lpc: Add AST2600 compatible strings
dt-bindings: aspeed-lpc: Add AST2600 compatible strings
ARM: dts: aspeed: Add silicon id node
soc: aspeed: Add soc info driver
dt-bindings: aspeed: Add silicon id node to SCU
soc: aspeed: Improve kconfig

Link: https://lore.kernel.org/r/CACPK8Xe=9ezhyWRMqVOEQr7SU1YoYfVBGGdGzjmE4SiBr--vJQ@mail.gmail.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+252 -21
+7 -1
Documentation/devicetree/bindings/mfd/aspeed-lpc.txt
··· 46 46 - compatible: One of: 47 47 "aspeed,ast2400-lpc", "simple-mfd" 48 48 "aspeed,ast2500-lpc", "simple-mfd" 49 + "aspeed,ast2600-lpc", "simple-mfd" 49 50 50 51 - reg: contains the physical address and length values of the Aspeed 51 52 LPC memory region. ··· 65 64 - compatible: One of: 66 65 "aspeed,ast2400-lpc-bmc" 67 66 "aspeed,ast2500-lpc-bmc" 67 + "aspeed,ast2600-lpc-bmc" 68 68 69 69 - reg: contains the physical address and length values of the 70 70 H8S/2168-compatible LPC controller memory region ··· 76 74 - compatible: One of: 77 75 "aspeed,ast2400-lpc-host", "simple-mfd", "syscon" 78 76 "aspeed,ast2500-lpc-host", "simple-mfd", "syscon" 77 + "aspeed,ast2600-lpc-host", "simple-mfd", "syscon" 79 78 80 79 - reg: contains the address and length values of the host-related 81 80 register space for the Aspeed LPC controller ··· 131 128 - compatible: One of: 132 129 "aspeed,ast2400-lpc-ctrl"; 133 130 "aspeed,ast2500-lpc-ctrl"; 131 + "aspeed,ast2600-lpc-ctrl"; 134 132 135 133 - reg: contains offset/length values of the host interface controller 136 134 memory regions ··· 172 168 - compatible: One of: 173 169 "aspeed,ast2400-lhc"; 174 170 "aspeed,ast2500-lhc"; 171 + "aspeed,ast2600-lhc"; 175 172 176 173 - reg: contains offset/length values of the LHC memory regions. In the 177 174 AST2400 and AST2500 there are two regions. ··· 192 187 193 188 Required properties: 194 189 195 - - compatible: "aspeed,ast2500-lpc-reset" or 190 + - compatible: "aspeed,ast2600-lpc-reset" or 191 + "aspeed,ast2500-lpc-reset" 196 192 "aspeed,ast2400-lpc-reset" 197 193 - reg: offset and length of the IP in the LHC memory region 198 194 - #reset-controller indicates the number of reset cells expected
+26
Documentation/devicetree/bindings/mfd/aspeed-scu.txt
··· 20 20 #clock-cells = <1>; 21 21 #reset-cells = <1>; 22 22 }; 23 + 24 + Silicon ID 25 + ----------------- 26 + 27 + Families have unique hardware silicon identifiers within the SoC. 28 + 29 + Required properties: 30 + 31 + - compatible: "aspeed,silicon-id" or: 32 + "aspeed,ast2400-silicon-id" or 33 + "aspeed,ast2500-silicon-id" or 34 + "aspeed,ast2600-silicon-id" 35 + 36 + - reg: offset and length of the silicon id information 37 + optionally, a second offset and length describes the unique chip id 38 + 39 + The reg should be the unique silicon id register, and 40 + not backwards compatible one in eg. the 2600. 41 + 42 + Example: 43 + 44 + 45 + silicon-id@7c { 46 + compatible = "aspeed,ast2500-silicon-id", "aspeed,silicon-id"; 47 + reg = <0x7c 0x4 0x150 0x8>; 48 + };
+5
arch/arm/boot/dts/aspeed-g4.dtsi
··· 192 192 status = "disabled"; 193 193 }; 194 194 195 + silicon-id@7c { 196 + compatible = "aspeed,ast2400-silicon-id", "aspeed,silicon-id"; 197 + reg = <0x7c 0x4>; 198 + }; 199 + 195 200 pinctrl: pinctrl@80 { 196 201 reg = <0x80 0x18>, <0xa0 0x10>; 197 202 compatible = "aspeed,ast2400-pinctrl";
+5
arch/arm/boot/dts/aspeed-g5.dtsi
··· 239 239 status = "disabled"; 240 240 }; 241 241 242 + silicon-id@7c { 243 + compatible = "aspeed,ast2500-silicon-id", "aspeed,silicon-id"; 244 + reg = <0x7c 0x4 0x150 0x8>; 245 + }; 246 + 242 247 pinctrl: pinctrl@80 { 243 248 compatible = "aspeed,ast2500-pinctrl"; 244 249 reg = <0x80 0x18>, <0xa0 0x10>;
+5
arch/arm/boot/dts/aspeed-g6.dtsi
··· 311 311 compatible = "aspeed,ast2600-pinctrl"; 312 312 }; 313 313 314 + silicon-id@14 { 315 + compatible = "aspeed,ast2600-silicon-id", "aspeed,silicon-id"; 316 + reg = <0x14 0x4 0x5b0 0x8>; 317 + }; 318 + 314 319 smp-memram@180 { 315 320 compatible = "aspeed,ast2600-smpmem"; 316 321 reg = <0x180 0x40>;
+1 -1
drivers/soc/Makefile
··· 4 4 # 5 5 6 6 obj-$(CONFIG_ARCH_ACTIONS) += actions/ 7 - obj-$(CONFIG_SOC_ASPEED) += aspeed/ 7 + obj-y += aspeed/ 8 8 obj-$(CONFIG_ARCH_AT91) += atmel/ 9 9 obj-y += bcm/ 10 10 obj-$(CONFIG_ARCH_DOVE) += dove/
+31 -16
drivers/soc/aspeed/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 - menu "Aspeed SoC drivers" 3 2 4 - config SOC_ASPEED 5 - def_bool y 6 - depends on ARCH_ASPEED || COMPILE_TEST 3 + if ARCH_ASPEED || COMPILE_TEST 4 + 5 + menu "ASPEED SoC drivers" 7 6 8 7 config ASPEED_LPC_CTRL 9 - depends on SOC_ASPEED && REGMAP && MFD_SYSCON 10 - tristate "Aspeed ast2400/2500 HOST LPC to BMC bridge control" 8 + tristate "ASPEED LPC firmware cycle control" 9 + select REGMAP 10 + select MFD_SYSCON 11 + default ARCH_ASPEED 11 12 help 12 - Control Aspeed ast2400/2500 HOST LPC to BMC mappings through 13 - ioctl()s, the driver also provides a read/write interface to a BMC ram 14 - region where the host LPC read/write region can be buffered. 13 + Control LPC firmware cycle mappings through ioctl()s. The driver 14 + also provides a read/write interface to a BMC ram region where the 15 + host LPC read/write region can be buffered. 15 16 16 17 config ASPEED_LPC_SNOOP 17 - tristate "Aspeed ast2500 HOST LPC snoop support" 18 - depends on SOC_ASPEED && REGMAP && MFD_SYSCON 18 + tristate "ASPEED LPC snoop support" 19 + select REGMAP 20 + select MFD_SYSCON 21 + default ARCH_ASPEED 19 22 help 20 23 Provides a driver to control the LPC snoop interface which 21 24 allows the BMC to listen on and save the data written by 22 25 the host to an arbitrary LPC I/O port. 23 26 24 27 config ASPEED_P2A_CTRL 25 - depends on SOC_ASPEED && REGMAP && MFD_SYSCON 26 - tristate "Aspeed ast2400/2500 HOST P2A VGA MMIO to BMC bridge control" 28 + tristate "ASPEED P2A (VGA MMIO to BMC) bridge control" 29 + select REGMAP 30 + select MFD_SYSCON 31 + default ARCH_ASPEED 27 32 help 28 - Control Aspeed ast2400/2500 HOST P2A VGA MMIO to BMC mappings through 29 - ioctl()s, the driver also provides an interface for userspace mappings to 30 - a pre-defined region. 33 + Control ASPEED P2A VGA MMIO to BMC mappings through ioctl()s. The 34 + driver also provides an interface for userspace mappings to a 35 + pre-defined region. 36 + 37 + config ASPEED_SOCINFO 38 + bool "ASPEED SoC Information driver" 39 + default ARCH_ASPEED 40 + select SOC_BUS 41 + default ARCH_ASPEED 42 + help 43 + Say yes to support decoding of ASPEED BMC information. 31 44 32 45 endmenu 46 + 47 + endif
+1
drivers/soc/aspeed/Makefile
··· 2 2 obj-$(CONFIG_ASPEED_LPC_CTRL) += aspeed-lpc-ctrl.o 3 3 obj-$(CONFIG_ASPEED_LPC_SNOOP) += aspeed-lpc-snoop.o 4 4 obj-$(CONFIG_ASPEED_P2A_CTRL) += aspeed-p2a-ctrl.o 5 + obj-$(CONFIG_ASPEED_SOCINFO) += aspeed-socinfo.o
+34 -3
drivers/soc/aspeed/aspeed-lpc-ctrl.c
··· 4 4 */ 5 5 6 6 #include <linux/clk.h> 7 + #include <linux/log2.h> 7 8 #include <linux/mfd/syscon.h> 8 9 #include <linux/miscdevice.h> 9 10 #include <linux/mm.h> ··· 22 21 #define HICR5_ENL2H BIT(8) 23 22 #define HICR5_ENFWH BIT(10) 24 23 24 + #define HICR6 0x4 25 + #define SW_FWH2AHB BIT(17) 26 + 25 27 #define HICR7 0x8 26 28 #define HICR8 0xc 27 29 ··· 34 30 struct clk *clk; 35 31 phys_addr_t mem_base; 36 32 resource_size_t mem_size; 37 - u32 pnor_size; 38 - u32 pnor_base; 33 + u32 pnor_size; 34 + u32 pnor_base; 35 + bool fwh2ahb; 39 36 }; 40 37 41 38 static struct aspeed_lpc_ctrl *file_aspeed_lpc_ctrl(struct file *file) ··· 182 177 return rc; 183 178 184 179 /* 180 + * Switch to FWH2AHB mode, AST2600 only. 181 + * 182 + * The other bits in this register are interrupt status bits 183 + * that are cleared by writing 1. As we don't want to clear 184 + * them, set only the bit of interest. 185 + */ 186 + if (lpc_ctrl->fwh2ahb) 187 + regmap_write(lpc_ctrl->regmap, HICR6, SW_FWH2AHB); 188 + 189 + /* 185 190 * Enable LPC FHW cycles. This is required for the host to 186 191 * access the regions specified. 187 192 */ ··· 256 241 257 242 lpc_ctrl->mem_size = resource_size(&resm); 258 243 lpc_ctrl->mem_base = resm.start; 244 + 245 + if (!is_power_of_2(lpc_ctrl->mem_size)) { 246 + dev_err(dev, "Reserved memory size must be a power of 2, got %u\n", 247 + (unsigned int)lpc_ctrl->mem_size); 248 + return -EINVAL; 249 + } 250 + 251 + if (!IS_ALIGNED(lpc_ctrl->mem_base, lpc_ctrl->mem_size)) { 252 + dev_err(dev, "Reserved memory must be naturally aligned for size %u\n", 253 + (unsigned int)lpc_ctrl->mem_size); 254 + return -EINVAL; 255 + } 259 256 } 260 257 261 258 lpc_ctrl->regmap = syscon_node_to_regmap( ··· 287 260 dev_err(dev, "couldn't enable clock\n"); 288 261 return rc; 289 262 } 263 + 264 + if (of_device_is_compatible(dev->of_node, "aspeed,ast2600-lpc-ctrl")) 265 + lpc_ctrl->fwh2ahb = true; 290 266 291 267 lpc_ctrl->miscdev.minor = MISC_DYNAMIC_MINOR; 292 268 lpc_ctrl->miscdev.name = DEVICE_NAME; ··· 321 291 static const struct of_device_id aspeed_lpc_ctrl_match[] = { 322 292 { .compatible = "aspeed,ast2400-lpc-ctrl" }, 323 293 { .compatible = "aspeed,ast2500-lpc-ctrl" }, 294 + { .compatible = "aspeed,ast2600-lpc-ctrl" }, 324 295 { }, 325 296 }; 326 297 ··· 339 308 MODULE_DEVICE_TABLE(of, aspeed_lpc_ctrl_match); 340 309 MODULE_LICENSE("GPL"); 341 310 MODULE_AUTHOR("Cyril Bur <cyrilbur@gmail.com>"); 342 - MODULE_DESCRIPTION("Control for aspeed 2400/2500 LPC HOST to BMC mappings"); 311 + MODULE_DESCRIPTION("Control for ASPEED LPC HOST to BMC mappings");
+2
drivers/soc/aspeed/aspeed-lpc-snoop.c
··· 325 325 .data = &ast2400_model_data }, 326 326 { .compatible = "aspeed,ast2500-lpc-snoop", 327 327 .data = &ast2500_model_data }, 328 + { .compatible = "aspeed,ast2600-lpc-snoop", 329 + .data = &ast2500_model_data }, 328 330 { }, 329 331 }; 330 332
+135
drivers/soc/aspeed/aspeed-socinfo.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-or-later 2 + /* Copyright 2019 IBM Corp. */ 3 + 4 + #include <linux/io.h> 5 + #include <linux/of.h> 6 + #include <linux/of_address.h> 7 + #include <linux/of_platform.h> 8 + #include <linux/platform_device.h> 9 + #include <linux/slab.h> 10 + #include <linux/sys_soc.h> 11 + 12 + static struct { 13 + const char *name; 14 + const u32 id; 15 + } const rev_table[] = { 16 + /* AST2400 */ 17 + { "AST2400", 0x02000303 }, 18 + { "AST1400", 0x02010103 }, 19 + { "AST1250", 0x02010303 }, 20 + /* AST2500 */ 21 + { "AST2500", 0x04000303 }, 22 + { "AST2510", 0x04000103 }, 23 + { "AST2520", 0x04000203 }, 24 + { "AST2530", 0x04000403 }, 25 + /* AST2600 */ 26 + { "AST2600", 0x05000303 }, 27 + { "AST2620", 0x05010203 }, 28 + }; 29 + 30 + static const char *siliconid_to_name(u32 siliconid) 31 + { 32 + unsigned int id = siliconid & 0xff00ffff; 33 + unsigned int i; 34 + 35 + for (i = 0 ; i < ARRAY_SIZE(rev_table) ; ++i) { 36 + if (rev_table[i].id == id) 37 + return rev_table[i].name; 38 + } 39 + 40 + return "Unknown"; 41 + } 42 + 43 + static const char *siliconid_to_rev(u32 siliconid) 44 + { 45 + unsigned int rev = (siliconid >> 16) & 0xff; 46 + 47 + switch (rev) { 48 + case 0: 49 + return "A0"; 50 + case 1: 51 + return "A1"; 52 + case 3: 53 + return "A2"; 54 + } 55 + 56 + return "??"; 57 + } 58 + 59 + static int __init aspeed_socinfo_init(void) 60 + { 61 + struct soc_device_attribute *attrs; 62 + struct soc_device *soc_dev; 63 + struct device_node *np; 64 + void __iomem *reg; 65 + bool has_chipid = false; 66 + u32 siliconid; 67 + u32 chipid[2]; 68 + const char *machine = NULL; 69 + 70 + np = of_find_compatible_node(NULL, NULL, "aspeed,silicon-id"); 71 + if (!of_device_is_available(np)) { 72 + of_node_put(np); 73 + return -ENODEV; 74 + } 75 + 76 + reg = of_iomap(np, 0); 77 + if (!reg) { 78 + of_node_put(np); 79 + return -ENODEV; 80 + } 81 + siliconid = readl(reg); 82 + iounmap(reg); 83 + 84 + /* This is optional, the ast2400 does not have it */ 85 + reg = of_iomap(np, 1); 86 + if (reg) { 87 + has_chipid = true; 88 + chipid[0] = readl(reg); 89 + chipid[1] = readl(reg + 4); 90 + iounmap(reg); 91 + } 92 + of_node_put(np); 93 + 94 + attrs = kzalloc(sizeof(*attrs), GFP_KERNEL); 95 + if (!attrs) 96 + return -ENODEV; 97 + 98 + /* 99 + * Machine: Romulus BMC 100 + * Family: AST2500 101 + * Revision: A1 102 + * SoC ID: raw silicon revision id 103 + * Serial Number: 64-bit chipid 104 + */ 105 + 106 + np = of_find_node_by_path("/"); 107 + of_property_read_string(np, "model", &machine); 108 + if (machine) 109 + attrs->machine = kstrdup(machine, GFP_KERNEL); 110 + of_node_put(np); 111 + 112 + attrs->family = siliconid_to_name(siliconid); 113 + attrs->revision = siliconid_to_rev(siliconid); 114 + attrs->soc_id = kasprintf(GFP_KERNEL, "%08x", siliconid); 115 + 116 + if (has_chipid) 117 + attrs->serial_number = kasprintf(GFP_KERNEL, "%08x%08x", 118 + chipid[1], chipid[0]); 119 + 120 + soc_dev = soc_device_register(attrs); 121 + if (IS_ERR(soc_dev)) { 122 + kfree(attrs->soc_id); 123 + kfree(attrs->serial_number); 124 + kfree(attrs); 125 + return PTR_ERR(soc_dev); 126 + } 127 + 128 + pr_info("ASPEED %s rev %s (%s)\n", 129 + attrs->family, 130 + attrs->revision, 131 + attrs->soc_id); 132 + 133 + return 0; 134 + } 135 + early_initcall(aspeed_socinfo_init);