Add AST2600 LPC PCC support
Subsystems (4)
The AST2600 has PCC controller in LPC, placed in LPC node. As a result, add LPC PCC controller driver to support POST code capture.
--
v2:
-- Change driver path to drivers/misc
Kevin Chen (3):
dt-binding: aspeed: Add LPC PCC controller
ARM: dts: aspeed-g6: Add AST2600 LPC PCC support
soc: aspeed: lpc-pcc: Add PCC controller support
.../devicetree/bindings/mfd/aspeed-lpc.yaml | 36 ++ arch/arm/boot/dts/aspeed/aspeed-g6.dtsi | 7 + drivers/misc/Kconfig | 10 + drivers/misc/Makefile | 1 + drivers/misc/aspeed-lpc-pcc.c | 441 ++++++++++++++++++ 5 files changed, 495 insertions(+) create mode 100644 drivers/misc/aspeed-lpc-pcc.c
Signature · 1 line
2.34.1
PATCH v2 1/3 dt-binding: aspeed: Add LPC PCC controller
Add dt-bindings for Aspeed for Aspeed LPC POST code capture controller.
--- .../devicetree/bindings/mfd/aspeed-lpc.yaml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+)
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml +36 -0
@@ -149,6 +149,35 @@ patternProperties: - interrupts - snoop-ports + "^lpc-pcc@[0-9a-f]+$": + type: object + additionalProperties: false + + description: + The LPC pcc interface allows the BMC to listen on and record the data + bytes written by the Host to the targeted LPC I/O pots. + + properties: + compatible: + items: + - enum: + - aspeed,ast2600-lpc-pcc + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + pcc-ports: + $ref: /schemas/types.yaml#/definitions/uint32-array + description: The LPC I/O ports to pcc + + required: + - compatible + - interrupts + - pcc-ports + "^uart-routing@[0-9a-f]+$": $ref: /schemas/soc/aspeed/uart-routing.yaml# description: The UART routing control under LPC register space
@@ -176,6 +205,13 @@ examples: #size-cells = <1>; ranges = <0x0 0x1e789000 0x1000>; + lpc_pcc: lpc-pcc@0 { + compatible = "aspeed,ast2600-lpc-pcc"; + reg = <0x0 0x140>; + interrupts = <GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH>; + pcc-ports = <0x80>; + }; + lpc_ctrl: lpc-ctrl@80 { compatible = "aspeed,ast2600-lpc-ctrl"; reg = <0x80 0x80>;
Signature · 1 line
2.34.1
Re: [PATCH v2 1/3] dt-binding: aspeed: Add LPC PCC controller
Quoted 1 line · Kevin Chen
Add dt-bindings for Aspeed for Aspeed LPC POST code capture controller.
Please use subject prefixes matching the subsystem. You can get them for example with git log --oneline -- DIRECTORY_OR_FILE on the directory your patch is touching. For bindings, the preferred subjects are explained here:
https://www.kernel.org/doc/html/latest/devicetree/bindings/submitting-patches.html#i-for-patch-submitters
Missing 's'.
Quoted 25 lines
Signed-off-by Kevin Chen <[email protected]>--- .../devicetree/bindings/mfd/aspeed-lpc.yaml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+)Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml +11
-0@@ -149,6 +149,35 @@ patternProperties: - interrupts - snoop-ports + "^lpc-pcc@[0-9a-f]+$": + type: object + additionalProperties: false + + description: + The LPC pcc interface allows the BMC to listen on and record the data + bytes written by the Host to the targeted LPC I/O pots. + + properties: + compatible: + items:
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml patternProperties: · line 172
Quoted 10 lines
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml +10
-0+ - enum: + - aspeed,ast2600-lpc-pcc + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + pcc-ports:
Missing vendor prefix
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml patternProperties: · line 174
Quoted 2 lines
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml +2
-0+ $ref: /schemas/types.yaml#/definitions/uint32-array + description: The LPC I/O ports to pcc
Description is too vague. Why would we encode I/O ports as some numbers instead of GPIOs for example? If these are ports, why this is not a graph?
Missing constraints - min/maxItems, defaults, minimum/maximum etc.
Quoted 10 lines
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml +6
-0+ + required: + - compatible + - interrupts + - pcc-ports + "^uart-routing@[0-9a-f]+$": $ref: /schemas/soc/aspeed/uart-routing.yaml# description: The UART routing control under LPC register space
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml examples: · line 212
Quoted 8 lines
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml +5
-0@@ -176,6 +205,13 @@ examples: #size-cells = <1>; ranges = <0x0 0x1e789000 0x1000>; + lpc_pcc: lpc-pcc@0 { + compatible = "aspeed,ast2600-lpc-pcc"; + reg = <0x0 0x140>; + interrupts = <GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH>; + pcc-ports = <0x80>;
So what 0x80 stands for?
Best regards,
Krzysztof
RE: [PATCH v2 1/3] dt-binding: aspeed: Add LPC PCC controller
Quoted 43 lines · Kevin Chen
Quoted 1 line
Add dt-bindings for Aspeed for Aspeed LPC POST code capture controller.
Please use subject prefixes matching the subsystem. You can get them for example with
git log --oneline -- DIRECTORY_OR_FILEon the directory your patch is touching. For bindings, the preferred subjects are explained here:
https://www.kernel.org/doc/html/latest/devicetree/bindings/submitting-patch
es.html#i-for-patch-submittersMissing 's'.
Quoted 4 lines
Signed-off-by Kevin Chen <[email protected]>--- .../devicetree/bindings/mfd/aspeed-lpc.yaml | 36+++++++++++++++++++
Quoted 8 lines
1 file changed, 36 insertions(+)Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml +0
-0Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml patternProperties: · line 157
Quoted 9 lines
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml +6
-0@@ -149,6 +149,35 @@ patternProperties: - interrupts - snoop-ports + "^lpc-pcc@[0-9a-f]+$": + type: object + additionalProperties: false + + description: + The LPC pcc interface allows the BMC to listen on and record thedata
Quoted 9 lines
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml +9
-0+ bytes written by the Host to the targeted LPC I/O pots. + + properties: + compatible: + items: + - enum: + - aspeed,ast2600-lpc-pcc + + reg:
Quoted 8 lines
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml patternProperties: · line 172
Quoted 6 lines
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml +6
-0+ maxItems: 1 + + interrupts: + maxItems: 1 + + pcc-ports:Missing vendor prefix
OK, so I need to add the vendor prefix such as "aspeed,pcc-ports". Right?
But I want to check the snoop-ports usage. In the HW controller, the usage should be the same. Not only aspeed but nuvoton, there exist a HW module for the snoop-ports or pcc-ports usage.
Quoted 6 lines
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml patternProperties: · line 174
Quoted 3 lines
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml +2
-0+ $ref: /schemas/types.yaml#/definitions/uint32-array + description: The LPC I/O ports to pccDescription is too vague. Why would we encode I/O ports as some numbers instead of GPIOs for example? If these are ports, why this is not a graph?
For the port-mmaped I/O in x80 architecture, BMC need to handle specific port I/O in the relative HW module. So, I need to add the pcc-ports property as the snoop-ports property in Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml
Quoted 2 lines
Missing constraints - min/maxItems, defaults, minimum/maximum etc.
The port-mmaped I/O is defined from host, BMC as the device would capture the port I/O from the pcc-ports property defined in dts.
Quoted 14 lines
Quoted 14 lines
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml +6
-1+ + required: + - compatible + - interrupts + - pcc-ports + "^uart-routing@[0-9a-f]+$": $ref: /schemas/soc/aspeed/uart-routing.yaml# description: The UART routing control under LPC register space @@ -176,6 +205,13 @@ examples: #size-cells = <1>; ranges = <0x0 0x1e789000 0x1000>;
Quoted 7 lines
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml examples: · line 212
Quoted 5 lines
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml +5
-0+ lpc_pcc: lpc-pcc@0 { + compatible = "aspeed,ast2600-lpc-pcc"; + reg = <0x0 0x140>; + interrupts = <GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH>; + pcc-ports = <0x80>;So what
0x80stands for?
Host as x86 architecture would access the 0x80 port, which is mapped to the BMC PCC HW module.
As a result, x86 can keep the port-mmaped I/O usage and access the BMC device, which is needed to know which port using in the PCC module in BMC.
Quoted 4 lines
Best regards,
Krzysztof
Re: [PATCH v2 1/3] dt-binding: aspeed: Add LPC PCC controller
Quoted 11 lines · Kevin Chen
Quoted 5 lines
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml patternProperties: · line 174
Quoted 2 lines
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml +2
-0+ $ref: /schemas/types.yaml#/definitions/uint32-array + description: The LPC I/O ports to pccDescription is too vague. Why would we encode I/O ports as some numbers instead of GPIOs for example? If these are ports, why this is not a graph?
For the port-mmaped I/O in x80 architecture, BMC need to handle specific port I/O in the relative HW module. So, I need to add the pcc-ports property as the snoop-ports property in
Documentation/devicetree/bindings/mfd/aspeed-lpc.yamlQuoted 2 lines
Missing constraints - min/maxItems, defaults, minimum/maximum etc.
The port-mmaped I/O is defined from host, BMC as the device would capture the port I/O from the pcc-ports property defined in dts.
Put this information in the description, instead of copying property name.
Quoted 22 lines
Quoted 15 lines
Quoted 15 lines
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml +6
-1+ + required: + - compatible + - interrupts + - pcc-ports + "^uart-routing@[0-9a-f]+$": $ref: /schemas/soc/aspeed/uart-routing.yaml# description: The UART routing control under LPC register space @@ -176,6 +205,13 @@ examples: #size-cells = <1>; ranges = <0x0 0x1e789000 0x1000>;Quoted 7 lines
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml examples: · line 212
Quoted 5 lines
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml +5
-0+ lpc_pcc: lpc-pcc@0 { + compatible = "aspeed,ast2600-lpc-pcc"; + reg = <0x0 0x140>; + interrupts = <GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH>; + pcc-ports = <0x80>;So what
0x80stands for?
Quoted 2 lines
Host as x86 architecture would access the
0x80port, which is mapped to the BMC PCC HW module.
As a result, x86 can keep the port-mmaped I/O usage and access the BMC device, which is needed to know which port using in the PCC module in BMC.
And on different boards this is not 0x80?
Best regards,
Krzysztof
RE: [PATCH v2 1/3] dt-binding: aspeed: Add LPC PCC controller
Quoted 13 lines · Kevin Chen
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml patternProperties: · line 174
Quoted 2 lines
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml +2
-0+ $ref: /schemas/types.yaml#/definitions/uint32-array + description: The LPC I/O ports to pccDescription is too vague. Why would we encode I/O ports as some numbers instead of GPIOs for example? If these are ports, why this is not a
graph?
Quoted 1 line
For the port-mmaped I/O in x86 architecture, BMC need to handle specific
port I/O in the relative HW module.
Quoted 4 lines
So, I need to add the pcc-ports property as the snoop-ports property in
Documentation/devicetree/bindings/mfd/aspeed-lpc.yamlQuoted 1 line
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
Missing constraints - min/maxItems, defaults, minimum/maximum etc.
The port-mmaped I/O is defined from host, BMC as the device would capture
the port I/O from the pcc-ports property defined in dts.
Put this information in the description, instead of copying property name.
OK. I will put this information in the description.
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
Quoted 17 lines
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml +6
-0+ + required: + - compatible + - interrupts + - pcc-ports + "^uart-routing@[0-9a-f]+$": $ref: /schemas/soc/aspeed/uart-routing.yaml# description: The UART routing control under LPC register space@@
-176,6 +205,13 @@ examples:#size-cells = <1>; ranges = <0x0 0x1e789000 0x1000>;Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml examples: · line 212
Quoted 5 lines
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml +5
-0+ lpc_pcc: lpc-pcc@0 { + compatible = "aspeed,ast2600-lpc-pcc"; + reg = <0x0 0x140>; + interrupts = <GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH>; + pcc-ports = <0x80>;So what
0x80stands for?
Quoted 6 lines
Quoted 1 line
Host as x86 architecture would access the
0x80port, which is mapped to theBMC PCC HW module.
Quoted 1 line
As a result, x86 can keep the port-mmaped I/O usage and access the BMC
device, which is needed to know which port using in the PCC module in BMC.
And on different boards this is not
0x80?
The port-mmaped I/O defined in the intel legacy document as the example usage.
For example, the common usage agreement of port-mmaped I/O are the following. But this setting can be modified due to the host usage. We provide the flexibility to modify the I/O port settings. KCS : 0xCA2(CMD)/CA3(Data)
BT : 0xE4/E5/E6
SNOOP/PCC : 0x80/81/82/83
Mailbox : 0xCC0
SuperIO : 0x2E/2F or 0x4E/0x4F
System UART : 0x3F8/2F8/3E8/2E8
Quoted 3 lines
Best regards,
Krzysztof
Re: [PATCH v2 1/3] dt-binding: aspeed: Add LPC PCC controller
Quoted 12 lines · Kevin Chen
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml +4
-0+ compatible = "aspeed,ast2600-lpc-pcc"; + reg = <0x0 0x140>; + interrupts = <GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH>; + pcc-ports = <0x80>;Quoted 7 lines
Quoted 2 lines
Quoted 1 line
So what
0x80stands for?Host as x86 architecture would access the
0x80port, which is mapped to theBMC PCC HW module.
Quoted 1 line
As a result, x86 can keep the port-mmaped I/O usage and access the BMC
device, which is needed to know which port using in the PCC module in BMC.
And on different boards this is not
0x80?
Quoted 8 lines
The port-mmaped I/O defined in the intel legacy document as the example usage.
For example, the common usage agreement of port-mmaped I/O are the following. But this setting can be modified due to the host usage. We provide the flexibility to modify the I/O port settings. KCS : 0xCA2(CMD)/CA3(Data)
BT : 0xE4/E5/E6
SNOOP/PCC : 0x80/81/82/83
Mailbox :0xCC0
SuperIO : 0x2E/2F or 0x4E/0x4F
System UART : 0x3F8/2F8/3E8/2E8
So which boards have it modified?
Best regards,
Krzysztof
RE: [PATCH v2 1/3] dt-binding: aspeed: Add LPC PCC controller
Quoted 20 lines · Kevin Chen
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml examples: · line 212
Quoted 4 lines
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml +4
-0+ compatible = "aspeed,ast2600-lpc-pcc"; + reg = <0x0 0x140>; + interrupts = <GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH>; + pcc-ports = <0x80>;So what
0x80stands for?Host as x86 architecture would access the
0x80port, which is mapped tothe
Quoted 3 lines
Quoted 3 lines
BMC PCC HW module.
Quoted 1 line
As a result, x86 can keep the port-mmaped I/O usage and access the BMC
device, which is needed to know which port using in the PCC module in
BMC.
Quoted 3 lines
Quoted 2 lines
And on different boards this is not
0x80?The port-mmaped I/O defined in the intel legacy document as the example
usage.
Quoted 1 line
For example, the common usage agreement of port-mmaped I/O are the
following. But this setting can be modified due to the host usage. We provide the flexibility to modify the I/O port settings.
Quoted 7 lines
Quoted 6 lines
KCS : 0xCA2(CMD)/CA3(Data)
BT : 0xE4/E5/E6
SNOOP/PCC : 0x80/81/82/83
Mailbox :0xCC0
SuperIO : 0x2E/2F or 0x4E/0x4F
System UART : 0x3F8/2F8/3E8/2E8So which boards have it modified?
This setting should be as same as the snoop-ports. You can check the dts in arch/arm/boot/dts/aspeed folder. aspeed-bmc-amd-daytonax.dts
212: snoop-ports = <0x80>, <0x81>;
aspeed-bmc-facebook-tiogapass.dts
77: snoop-ports = <0x80>;
Quoted 3 lines
Best regards,
Krzysztof
PATCH v2 2/3 ARM: dts: aspeed-g6: Add AST2600 LPC PCC support
In reply to Kevin ChenThe AST2600 has PCC controller in LPC, placed in LPC node.
--- arch/arm/boot/dts/aspeed/aspeed-g6.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/boot/dts/aspeed/aspeed-g6.dtsi +7 -0
@@ -626,6 +626,13 @@ lpc_snoop: lpc-snoop@80 { status = "disabled"; }; + lpc_pcc: lpc-pcc@0 { + compatible = "aspeed,ast2600-lpc-pcc"; + reg = <0x0 0x140>; + interrupts = <GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH>; + status = "disabled"; + }; + lhc: lhc@a0 { compatible = "aspeed,ast2600-lhc"; reg = <0xa0 0x24 0xc8 0x8>;
Signature · 1 line
2.34.1
Re: [PATCH v2 2/3] ARM: dts: aspeed-g6: Add AST2600 LPC PCC support
Quoted 12 lines · Kevin Chen
The AST2600 has PCC controller in LPC, placed in LPC node.
Signed-off-by Kevin Chen <[email protected]>--- arch/arm/boot/dts/aspeed/aspeed-g6.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)arch/arm/boot/dts/aspeed/aspeed-g6.dtsi +0
-0
arch/arm/boot/dts/aspeed/aspeed-g6.dtsi lpc_snoop: lpc-snoop@80 { · line 633
Quoted 8 lines
arch/arm/boot/dts/aspeed/aspeed-g6.dtsi +5
-0@@ -626,6 +626,13 @@ lpc_snoop: lpc-snoop@80 { status = "disabled"; }; + lpc_pcc: lpc-pcc@0 { + compatible = "aspeed,ast2600-lpc-pcc"; + reg = <0x0 0x140>; + interrupts = <GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH>; + status = "disabled";
Incomplete. Your driver clearly bails on missing ports...
Best regards,
Krzysztof
RE: [PATCH v2 2/3] ARM: dts: aspeed-g6: Add AST2600 LPC PCC support
Quoted 17 lines · Kevin Chen
Review
Quoted 8 lines
The AST2600 has PCC controller in LPC, placed in LPC node.
Signed-off-by Kevin Chen <[email protected]>--- arch/arm/boot/dts/aspeed/aspeed-g6.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)(quoted diff) +0
-0
b/arch/arm/boot/dts/aspeed/aspeed-g6.dtsiQuoted 7 lines
index
8ed715bd53aa..87dcacb78692100644arch/arm/boot/dts/aspeed/aspeed-g6.dtsi +0
-0@@ -626,6 +626,13 @@ lpc_snoop: lpc-snoop@80 { status = "disabled"; };
Quoted 7 lines
arch/arm/boot/dts/aspeed/aspeed-g6.dtsi lpc_snoop: lpc-snoop@80 { · line 633
Quoted 5 lines
arch/arm/boot/dts/aspeed/aspeed-g6.dtsi +5
-0+ lpc_pcc: lpc-pcc@0 { + compatible = "aspeed,ast2600-lpc-pcc"; + reg = <0x0 0x140>; + interrupts = <GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH>; + status = "disabled";Incomplete. Your driver clearly bails on missing ports...
Agree.
Quoted 3 lines
Best regards,
Krzysztof
PATCH v2 3/3 soc: aspeed: lpc-pcc: Add PCC controller support
In reply to Kevin ChenAdd LPC PCC controller driver to support POST code capture.
--- drivers/misc/Kconfig | 10 + drivers/misc/Makefile | 1 + drivers/misc/aspeed-lpc-pcc.c | 441 ++++++++++++++++++++++++++++++++++ 3 files changed, 452 insertions(+) create mode 100644 drivers/misc/aspeed-lpc-pcc.c
drivers/misc/Kconfig +10 -0
@@ -50,6 +50,16 @@ config AD525X_DPOT_SPI To compile this driver as a module, choose M here: the module will be called ad525x_dpot-spi. +config ASPEED_LPC_PCC + tristate "Aspeed Post Code Capture support" + select REGMAP + select MFD_SYSCON + default ARCH_ASPEED + help + Provides a driver to control the LPC PCC interface, + allowing the BMC to snoop data bytes written by the + the host to an arbitrary LPC I/O port. + config DUMMY_IRQ tristate "Dummy IRQ handler" help
drivers/misc/Makefile +1 -0
@@ -8,6 +8,7 @@ obj-$(CONFIG_IBMVMC) += ibmvmc.o obj-$(CONFIG_AD525X_DPOT) += ad525x_dpot.o obj-$(CONFIG_AD525X_DPOT_I2C) += ad525x_dpot-i2c.o obj-$(CONFIG_AD525X_DPOT_SPI) += ad525x_dpot-spi.o +obj-$(CONFIG_ASPEED_LPC_PCC) += aspeed-lpc-pcc.o obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o obj-$(CONFIG_DUMMY_IRQ) += dummy-irq.o obj-$(CONFIG_ICS932S401) += ics932s401.o
drivers/misc/aspeed-lpc-pcc.c new file +441 -0
441 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v2 3/3] soc: aspeed: lpc-pcc: Add PCC controller support
drivers/misc/aspeed-lpc-pcc.c line 315
Quoted 9 lines · Kevin Chen
drivers/misc/aspeed-lpc-pcc.c new file +9
-0+ +static int aspeed_pcc_probe (struct platform_device *pdev) +{ +int rc; +struct aspeed_pcc_ctrl *pcc; +struct device *dev; +uint32_t fifo_size =PAGE_SIZE ; + + dev = &pdev->dev;
This goes to declaration.
drivers/misc/aspeed-lpc-pcc.c line 317
Quoted 2 lines
drivers/misc/aspeed-lpc-pcc.c new file +2
-0+ + pcc =devm_kzalloc (&pdev->dev,sizeof (*pcc),GFP_KERNEL );
Maybe my previous comment was not clear, but you agreed with it. Anyway nothing improved here.
If you have 'dev' variable, use it.
drivers/misc/aspeed-lpc-pcc.c line 321
Quoted 4 lines
drivers/misc/aspeed-lpc-pcc.c new file +4
-0+if (!pcc) +return -ENOMEM ; + + pcc->regmap =syscon_node_to_regmap (pdev->dev.parent->of_node);
same here and everywhere else.
Quoted 21 lines
drivers/misc/aspeed-lpc-pcc.c new file +21
-0+if (IS_ERR (pcc->regmap)) { +dev_err (dev,"Couldn't get regmap\n" ); +return -ENODEV ; + } + + rc =of_property_read_u32 (dev->of_node,"pcc-ports" , &pcc->port); +if (rc) { +dev_err (dev,"no pcc ports configured\n" ); +return -ENODEV ; + } + + rc =dma_set_mask_and_coherent (dev,DMA_BIT_MASK (64 )); +if (rc) { +dev_err (dev,"cannot set 64-bits DMA mask\n" ); +return rc; + } + + pcc->dma.size =PCC_DMA_BUFSZ ; + pcc->dma.virt = dmam_alloc_coherent(dev, + pcc->dma.size, + &pcc->dma.addr,
drivers/misc/aspeed-lpc-pcc.c line 352
Quoted 10 lines
drivers/misc/aspeed-lpc-pcc.c new file +10
-0+ GFP_KERNEL); +if (!pcc->dma.virt) { +dev_err (dev,"cannot allocate DMA buffer\n" ); +return -ENOMEM ; + } + + fifo_size =roundup (pcc->dma.size,PAGE_SIZE ); + rc =kfifo_alloc (&pcc->fifo, fifo_size,GFP_KERNEL ); +if (rc) { +dev_err (dev,"cannot allocate kFIFO\n" );
Drop
drivers/misc/aspeed-lpc-pcc.c line 365
Quoted 13 lines
drivers/misc/aspeed-lpc-pcc.c new file +13
-0+return -ENOMEM ; + } + +/* Disable PCC to clean up DMA buffer before request IRQ. */ + rc =aspeed_pcc_disable (pcc); +if (rc) { +dev_err (dev,"Couldn't disable PCC\n" ); + goto err_free_kfifo; + } + + pcc->irq =platform_get_irq (pdev,0 ); +if (pcc->irq <0 ) { +dev_err (dev,"Couldn't get IRQ\n" );
Drop, core already prints this. Do not duplicate messages.
drivers/misc/aspeed-lpc-pcc.c line 366
Quoted 1 line
drivers/misc/aspeed-lpc-pcc.c new file +1
-0+ rc = -ENODEV ;
Why not using pcc->irq as rc?
drivers/misc/aspeed-lpc-pcc.c line 362
Quoted 3 lines
drivers/misc/aspeed-lpc-pcc.c new file +3
-0+ goto err_free_kfifo; + } +
Best regards,
Krzysztof
RE: [PATCH v2 3/3] soc: aspeed: lpc-pcc: Add PCC controller support
Quoted 11 lines · Kevin Chen
drivers/misc/aspeed-lpc-pcc.c line 315
Quoted 8 lines
drivers/misc/aspeed-lpc-pcc.c new file +8
-0+ +static int aspeed_pcc_probe (struct platform_device *pdev) { +int rc; +struct aspeed_pcc_ctrl *pcc; +struct device *dev; +uint32_t fifo_size =PAGE_SIZE ; + + dev = &pdev->dev;This goes to declaration.
OK. I will move it to declaration.
Quoted 6 lines
drivers/misc/aspeed-lpc-pcc.c line 317
Quoted 3 lines
drivers/misc/aspeed-lpc-pcc.c new file +2
-0+ + pcc =devm_kzalloc (&pdev->dev,sizeof (*pcc),GFP_KERNEL );Maybe my previous comment was not clear, but you agreed with it. Anyway nothing improved here.
Could I reserve the pcc variable using for the pcc_ctrl data structure? Pcc_ctrl data include the regmap/irq/io_port/dma/kfifo.
If I change the name to dev, it does not make sense for these data to be.
Quoted 2 lines
If you have 'dev' variable, use it.
Do you mean just use the pdev->dev not local dev variable?
Quoted 33 lines
drivers/misc/aspeed-lpc-pcc.c line 321
Quoted 5 lines
drivers/misc/aspeed-lpc-pcc.c new file +4
-0+if (!pcc) +return -ENOMEM ; + + pcc->regmap =syscon_node_to_regmap (pdev->dev.parent->of_node);same here and everywhere else.
Quoted 25 lines
drivers/misc/aspeed-lpc-pcc.c new file +25
-0+if (IS_ERR (pcc->regmap)) { +dev_err (dev,"Couldn't get regmap\n" ); +return -ENODEV ; + } + + rc =of_property_read_u32 (dev->of_node,"pcc-ports" , &pcc->port); +if (rc) { +dev_err (dev,"no pcc ports configured\n" ); +return -ENODEV ; + } + + rc =dma_set_mask_and_coherent (dev,DMA_BIT_MASK (64 )); +if (rc) { +dev_err (dev,"cannot set 64-bits DMA mask\n" ); +return rc; + } + + pcc->dma.size =PCC_DMA_BUFSZ ; + pcc->dma.virt =dmam_alloc_coherent (dev, + pcc->dma.size, + &pcc->dma.addr, +GFP_KERNEL ); +if (!pcc->dma.virt) { +dev_err (dev,"cannot allocate DMA buffer\n" ); +return -ENOMEM ;
Quoted 8 lines
drivers/misc/aspeed-lpc-pcc.c line 352
Quoted 6 lines
drivers/misc/aspeed-lpc-pcc.c new file +6
-0+ } + + fifo_size =roundup (pcc->dma.size,PAGE_SIZE ); + rc =kfifo_alloc (&pcc->fifo, fifo_size,GFP_KERNEL ); +if (rc) { +dev_err (dev,"cannot allocate kFIFO\n" );Drop
Agree.
Quoted 16 lines
Quoted 4 lines
drivers/misc/aspeed-lpc-pcc.c new file +3
-0+return -ENOMEM ; + } +drivers/misc/aspeed-lpc-pcc.c line 365
Quoted 10 lines
drivers/misc/aspeed-lpc-pcc.c new file +10
-0+/* Disable PCC to clean up DMA buffer before request IRQ. */ + rc =aspeed_pcc_disable (pcc); +if (rc) { +dev_err (dev,"Couldn't disable PCC\n" ); + goto err_free_kfifo; + } + + pcc->irq =platform_get_irq (pdev,0 ); +if (pcc->irq <0 ) { +dev_err (dev,"Couldn't get IRQ\n" );Drop, core already prints this. Do not duplicate messages.
Agree.
Quoted 4 lines
drivers/misc/aspeed-lpc-pcc.c line 366
Quoted 2 lines
drivers/misc/aspeed-lpc-pcc.c new file +1
-0+ rc = -ENODEV ;Why not using
pcc->irqas rc?
Agree.
Quoted 6 lines
drivers/misc/aspeed-lpc-pcc.c line 362
Quoted 4 lines
drivers/misc/aspeed-lpc-pcc.c new file +3
-0+ goto err_free_kfifo; + } +Best regards,
Krzysztof
Re: [PATCH v2 3/3] soc: aspeed: lpc-pcc: Add PCC controller support
Quoted 19 lines · Kevin Chen
Quoted 11 lines · Kevin Chen
drivers/misc/aspeed-lpc-pcc.c line 315
Quoted 8 lines
drivers/misc/aspeed-lpc-pcc.c new file +8
-0+ +static int aspeed_pcc_probe (struct platform_device *pdev) { +int rc; +struct aspeed_pcc_ctrl *pcc; +struct device *dev; +uint32_t fifo_size =PAGE_SIZE ; + + dev = &pdev->dev;This goes to declaration.
OK. I will move it to declaration.
Quoted 6 lines
drivers/misc/aspeed-lpc-pcc.c line 317
Quoted 3 lines
drivers/misc/aspeed-lpc-pcc.c new file +2
-0+ + pcc =devm_kzalloc (&pdev->dev,sizeof (*pcc),GFP_KERNEL );Maybe my previous comment was not clear, but you agreed with it. Anyway nothing improved here.
Quoted 7 lines
Could I reserve the pcc variable using for the
pcc_ctrldata structure?Pcc_ctrldata include the regmap/irq/io_port/dma/kfifo.
If I change the name to dev, it does not make sense for these data to be.Quoted 2 lines
If you have 'dev' variable, use it.
Do you mean just use the
pdev->devnot local dev variable?
What is the point of this:
dev = &pdev->dev;
if you do not use 'dev'? If you come with a reason, sure. If you do not have such, then everything should use 'dev', not pdev->dev.
Best regards,
Krzysztof
RE: [PATCH v2 3/3] soc: aspeed: lpc-pcc: Add PCC controller support
Quoted 24 lines
Quoted 24 lines
Quoted 11 lines · Kevin Chen
drivers/misc/aspeed-lpc-pcc.c line 315
Quoted 8 lines
drivers/misc/aspeed-lpc-pcc.c new file +8
-0+ +static int aspeed_pcc_probe (struct platform_device *pdev) { +int rc; +struct aspeed_pcc_ctrl *pcc; +struct device *dev; +uint32_t fifo_size =PAGE_SIZE ; + + dev = &pdev->dev;This goes to declaration.
OK. I will move it to declaration.
Quoted 6 lines
drivers/misc/aspeed-lpc-pcc.c line 317
Quoted 3 lines
drivers/misc/aspeed-lpc-pcc.c new file +2
-0+ + pcc =devm_kzalloc (&pdev->dev,sizeof (*pcc),GFP_KERNEL );Maybe my previous comment was not clear, but you agreed with it. Anyway nothing improved here.
Could I reserve the pcc variable using for the
pcc_ctrldata structure?Pcc_ctrldata include the regmap/irq/io_port/dma/kfifo.
If I change the name to dev, it does not make sense for these data to be.Quoted 1 line
Quoted 7 lines
Quoted 2 lines
Quoted 1 line
If you have 'dev' variable, use it.
Do you mean just use the
pdev->devnot local dev variable?What is the point of this:
dev =&pdev->dev;if you do not use 'dev'? If you come with a reason, sure. If you do not have such, then everything should use 'dev', not
pdev->dev.
Agree, I fixed it in my v3 patch, and I already submitted. Thanks for your detailed explanation.
Sorry for my misunderstanding.
Quoted 3 lines
Best regards,
Krzysztof
Re: [PATCH v2 3/3] soc: aspeed: lpc-pcc: Add PCC controller support
In reply to Kevin ChenLe 04/03/2025 à 11:44, Kevin Chen a écrit :
Quoted 3 lines
Add LPC PCC controller driver to support POST code capture.
Signed-off-by Kevin Chen <[email protected]>
Hi,
drivers/misc/aspeed-lpc-pcc.c line 378
Quoted 3 lines
drivers/misc/aspeed-lpc-pcc.c new file +3
-0+init_waitqueue_head (&pcc->wq); + + pcc->mdev_id =ida_alloc (&aspeed_pcc_ida,GFP_KERNEL );
Missing ida_free() in therror handling path and in the rmove function?
Quoted 37 lines
drivers/misc/aspeed-lpc-pcc.c new file +37
-0+if (pcc->mdev_id <0 ) { +dev_err (dev,"Couldn't allocate ID\n" ); +return pcc->mdev_id; + } + + pcc->mdev.parent = dev; + pcc->mdev.minor =MISC_DYNAMIC_MINOR ; + pcc->mdev.name =devm_kasprintf (dev,GFP_KERNEL ,"%s%d" ,DEVICE_NAME , + pcc->mdev_id); + pcc->mdev.fops = &pcc_fops; + rc =misc_register (&pcc->mdev); +if (rc) { +dev_err (dev,"Couldn't register misc device\n" ); + goto err_free_kfifo; + } + + rc =aspeed_pcc_enable (pcc, dev); +if (rc) { +dev_err (dev,"Couldn't enable PCC\n" ); + goto err_dereg_mdev; + } + +dev_set_drvdata (&pdev->dev, pcc); + +return 0 ; + +err_dereg_mdev: +misc_deregister (&pcc->mdev); + +err_free_kfifo: +kfifo_free (&pcc->fifo); + +return rc; +} + +static void aspeed_pcc_remove (struct platform_device *pdev) +{
drivers/misc/aspeed-lpc-pcc.c line 425
Quoted 10 lines
drivers/misc/aspeed-lpc-pcc.c new file +10
-0+struct device *dev = &pdev->dev; +struct aspeed_pcc_ctrl *pcc =dev_get_drvdata (dev); + +kfifo_free (&pcc->fifo); +misc_deregister (&pcc->mdev); +} + +static const struct of_device_id aspeed_pcc_table[] = { + { .compatible ="aspeed,ast2600-lpc-pcc" }, + { },
Unneeded trailing comma after a terminator.
drivers/misc/aspeed-lpc-pcc.c line 435
Quoted 10 lines
drivers/misc/aspeed-lpc-pcc.c new file +10
-0+}; + +static struct platform_driver aspeed_pcc_driver = { + .driver = { + .name ="aspeed-pcc" , + .of_match_table = aspeed_pcc_table, + }, + .probe = aspeed_pcc_probe, + .remove = aspeed_pcc_remove, +};
...
CJ
RE: [PATCH v2 3/3] soc: aspeed: lpc-pcc: Add PCC controller support
Quoted 5 lines
Le 04/03/2025 à 11:44, Kevin Chen a écrit :
Quoted 3 lines
Add LPC PCC controller driver to support POST code capture.
Signed-off-by Kevin Chen <[email protected]>
Quoted 7 lines
Hi,
drivers/misc/aspeed-lpc-pcc.c line 378
Quoted 3 lines
drivers/misc/aspeed-lpc-pcc.c new file +3
-0+init_waitqueue_head (&pcc->wq); + + pcc->mdev_id =ida_alloc (&aspeed_pcc_ida,GFP_KERNEL );Missing
ida_free()in therror handling path and in the rmove function?
OK. I will add the ida_free function in remove function. Thanks a lot.
Quoted 42 lines
drivers/misc/aspeed-lpc-pcc.c
Quoted 9 lines
drivers/misc/aspeed-lpc-pcc.c new file +8
-0+if (pcc->mdev_id <0 ) { +dev_err (dev,"Couldn't allocate ID\n" ); +return pcc->mdev_id; + } + + pcc->mdev.parent = dev; + pcc->mdev.minor =MISC_DYNAMIC_MINOR ; + pcc->mdev.name = devm_kasprintf(dev, GFP_KERNEL, "%s%d",
DEVICE_NAME,Quoted 32 lines
drivers/misc/aspeed-lpc-pcc.c new file +32
-0+ pcc->mdev_id); + pcc->mdev.fops = &pcc_fops; + rc =misc_register (&pcc->mdev); +if (rc) { +dev_err (dev,"Couldn't register misc device\n" ); + goto err_free_kfifo; + } + + rc =aspeed_pcc_enable (pcc, dev); +if (rc) { +dev_err (dev,"Couldn't enable PCC\n" ); + goto err_dereg_mdev; + } + +dev_set_drvdata (&pdev->dev, pcc); + +return 0 ; + +err_dereg_mdev: +misc_deregister (&pcc->mdev); + +err_free_kfifo: +kfifo_free (&pcc->fifo); + +return rc; +} + +static void aspeed_pcc_remove (struct platform_device *pdev) { +struct device *dev = &pdev->dev; +struct aspeed_pcc_ctrl *pcc =dev_get_drvdata (dev); + +kfifo_free (&pcc->fifo);
Quoted 8 lines
drivers/misc/aspeed-lpc-pcc.c line 425
Quoted 6 lines
drivers/misc/aspeed-lpc-pcc.c new file +6
-0+misc_deregister (&pcc->mdev); +} + +static const struct of_device_id aspeed_pcc_table[] = { + { .compatible ="aspeed,ast2600-lpc-pcc" }, + { },Unneeded trailing comma after a terminator.
OK, I will remove it.
Quoted 15 lines
drivers/misc/aspeed-lpc-pcc.c line 435
Quoted 11 lines
drivers/misc/aspeed-lpc-pcc.c new file +10
-0+}; + +static struct platform_driver aspeed_pcc_driver = { + .driver = { + .name ="aspeed-pcc" , + .of_match_table = aspeed_pcc_table, + }, + .probe = aspeed_pcc_probe, + .remove = aspeed_pcc_remove, +};...
CJ
kernel test robot
build botRe: [PATCH v2 3/3] soc: aspeed: lpc-pcc: Add PCC controller support
In reply to Kevin Chenkernel test robot noticed the following build warnings:
Hi Kevin,
kernel test robot noticed the following build warnings:
[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on char-misc/char-misc-next char-misc/char-misc-linus lee-leds/for-leds-next lee-mfd/for-mfd-next robh/for-next lee-mfd/for-mfd-fixes linus/master v6.14-rc5 next-20250305] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Kevin-Chen/ARM-dts-aspeed-g6-Add-AST2600-LPC-PCC-support/20250304-194530 base: char-misc/char-misc-testing patch link: https://lore.kernel.org/r/20250304104434.481429-4-kevin_chen%40aspeedtech.com patch subject: [PATCH v2 3/3] soc: aspeed: lpc-pcc: Add PCC controller support config: s390-kismet-CONFIG_MFD_SYSCON-CONFIG_ASPEED_LPC_PCC-0-0 (https://download.01.org/0day-ci/archive/20250306/[email protected]/config) reproduce: (https://download.01.org/0day-ci/archive/20250306/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
kismet warnings: (new ones prefixed by >>)
>> kismet: WARNING: unmet direct dependencies detected for MFD_SYSCON when selected by ASPEED_LPC_PCC
WARNING: unmet direct dependencies detected for MFD_SYSCON
Depends on [n]: HAS_IOMEM [=n]
Selected by [y]:
- ASPEED_LPC_PCC [=y]
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH v2 3/3] soc: aspeed: lpc-pcc: Add PCC controller support
In reply to Kevin Chenkernel test robot noticed the following build errors:
Hi Kevin,
kernel test robot noticed the following build errors:
[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on char-misc/char-misc-next char-misc/char-misc-linus robh/for-next linus/master v6.14-rc6 next-20250307] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Kevin-Chen/ARM-dts-aspeed-g6-Add-AST2600-LPC-PCC-support/20250304-194530 base: char-misc/char-misc-testing patch link: https://lore.kernel.org/r/20250304104434.481429-4-kevin_chen%40aspeedtech.com patch subject: [PATCH v2 3/3] soc: aspeed: lpc-pcc: Add PCC controller support config: s390-randconfig-r112-20250310 (https://download.01.org/0day-ci/archive/20250310/[email protected]/config) compiler: s390-linux-gcc (GCC) 14.2.0 reproduce: (https://download.01.org/0day-ci/archive/20250310/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from include/linux/io.h:14,
from include/linux/of_address.h:7, from drivers/mfd/syscon.c:18:
drivers/mfd/syscon.c: In function 'of_syscon_register':
>> arch/s390/include/asm/io.h:31:17: error: implicit declaration of function 'iounmap' [-Wimplicit-function-declaration]
31 | #define iounmap iounmap
| ^~~~~~~
drivers/mfd/syscon.c:157:9: note: in expansion of macro 'iounmap'
157 | iounmap(base);
| ^~~~~~~Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for MFD_SYSCON Depends on [n]: HAS_IOMEM [=n]
Selected by [y]:
- ASPEED_LPC_PCC [=y]
vim +/iounmap +31 arch/s390/include/asm/io.h
cd24834130ac65 Jan Glauber 2012-11-29 26 b43b3fff042d08 Baoquan He 2023-07-06 27 /* b43b3fff042d08 Baoquan He 2023-07-06 28 * I/O memory mapping functions. b43b3fff042d08 Baoquan He 2023-07-06 29 */ b43b3fff042d08 Baoquan He 2023-07-06 30 #define ioremap_prot ioremap_prot
b43b3fff042d08 Baoquan He 2023-07-06 @31 #define iounmap iounmap b43b3fff042d08 Baoquan He 2023-07-06 32
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki