Remove LPC register partitioning
Subsystems (5)
cover Remove LPC register partitioning
The LPC controller has no concept of the BMC and the Host partitions. The incorrect partitioning can impose unnecessary range restrictions on register access through the syscon regmap interface.
For instance, HICRB contains the I/O port address configuration of KCS channel 1/2. However, the KCS#1/#2 drivers cannot access HICRB as it is located at the other LPC partition.
In addition, to be backward compatible, the newly added HW control bits could be added at any reserved bits over the LPC addressing space.
Thereby, this patch series aims to remove the LPC partitioning for better driver development and maintenance.
Chia-Wei, Wang (4):
ARM: dts: Remove LPC BMC and Host partitions
soc: aspeed: Fix LPC register offsets
ipmi: kcs: aspeed: Fix LPC register offsets
pinctrl: aspeed-g5: Fix LPC register offsets
arch/arm/boot/dts/aspeed-g4.dtsi | 74 +++++------ arch/arm/boot/dts/aspeed-g5.dtsi | 135 +++++++++------------ arch/arm/boot/dts/aspeed-g6.dtsi | 135 +++++++++------------ drivers/char/ipmi/kcs_bmc_aspeed.c | 13 +- drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c | 2 +- drivers/soc/aspeed/aspeed-lpc-ctrl.c | 6 +- drivers/soc/aspeed/aspeed-lpc-snoop.c | 11 +- 7 files changed, 162 insertions(+), 214 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/4 ARM: dts: Remove LPC BMC and Host partitions
The LPC controller has no concept of the BMC and the Host partitions.
A concrete instance is that the HICRB[5:4] are for the I/O port address configurtaion of KCS channel 1/2. However, the KCS driver cannot access HICRB for channel 1/2 initialization via syscon regmap interface due to the parition boundary. (i.e. offset 80h)
In addition, to be backward compatible, the newly added HW control bits could be located at any reserved bits over the LPC addressing space.
Thereby, this patch removes the lpc-bmc and lpc-host child node and thus the LPC partitioning for better driver development and maintenance.
--- arch/arm/boot/dts/aspeed-g4.dtsi | 74 +++++++---------- arch/arm/boot/dts/aspeed-g5.dtsi | 135 ++++++++++++++----------------- arch/arm/boot/dts/aspeed-g6.dtsi | 135 ++++++++++++++----------------- 3 files changed, 148 insertions(+), 196 deletions(-)
arch/arm/boot/dts/aspeed-g4.dtsi +30 -44
@@ -338,58 +338,44 @@ }; lpc: lpc at 1e789000 { - compatible = "aspeed,ast2400-lpc", "simple-mfd"; + compatible = "aspeed,ast2400-lpc", "simple-mfd", "syscon"; reg = <0x1e789000 0x1000>; + reg-io-width = <4>; #address-cells = <1>; #size-cells = <1>; ranges = <0x0 0x1e789000 0x1000>; - lpc_bmc: lpc-bmc at 0 { - compatible = "aspeed,ast2400-lpc-bmc"; - reg = <0x0 0x80>; + lpc_ctrl: lpc-ctrl at 80 { + compatible = "aspeed,ast2400-lpc-ctrl"; + reg = <0x80 0x10>; + clocks = <&syscon ASPEED_CLK_GATE_LCLK>; + status = "disabled"; }; - lpc_host: lpc-host at 80 { - compatible = "aspeed,ast2400-lpc-host", "simple-mfd", "syscon"; - reg = <0x80 0x1e0>; - reg-io-width = <4>; - - #address-cells = <1>; - #size-cells = <1>; - ranges = <0x0 0x80 0x1e0>; - - lpc_ctrl: lpc-ctrl at 0 { - compatible = "aspeed,ast2400-lpc-ctrl"; - reg = <0x0 0x10>; - clocks = <&syscon ASPEED_CLK_GATE_LCLK>; - status = "disabled"; - }; - - lpc_snoop: lpc-snoop at 10 { - compatible = "aspeed,ast2400-lpc-snoop"; - reg = <0x10 0x8>; - interrupts = <8>; - status = "disabled"; - }; - - lhc: lhc at 20 { - compatible = "aspeed,ast2400-lhc"; - reg = <0x20 0x24 0x48 0x8>; - }; - - lpc_reset: reset-controller at 18 { - compatible = "aspeed,ast2400-lpc-reset"; - reg = <0x18 0x4>; - #reset-cells = <1>; - }; - - ibt: ibt at c0 { - compatible = "aspeed,ast2400-ibt-bmc"; - reg = <0xc0 0x18>; - interrupts = <8>; - status = "disabled"; - }; + lpc_snoop: lpc-snoop at 90 { + compatible = "aspeed,ast2400-lpc-snoop"; + reg = <0x90 0x8>; + interrupts = <8>; + status = "disabled"; + }; + + lhc: lhc at a0 { + compatible = "aspeed,ast2400-lhc"; + reg = <0xa0 0x24 0xc8 0x8>; + }; + + lpc_reset: reset-controller at 98 { + compatible = "aspeed,ast2400-lpc-reset"; + reg = <0x98 0x4>; + #reset-cells = <1>; + }; + + ibt: ibt at 140 { + compatible = "aspeed,ast2400-ibt-bmc"; + reg = <0x140 0x18>; + interrupts = <8>; + status = "disabled"; }; };
arch/arm/boot/dts/aspeed-g5.dtsi +59 -76
149 lines not on this page · raw message
arch/arm/boot/dts/aspeed-g6.dtsi +59 -76
149 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 2/4 soc: aspeed: Fix LPC register offsets
In reply to Chia-Wei, WangThe LPC register offsets are fixed to adapt to the LPC DTS change, where the LPC partitioning is removed.
--- drivers/soc/aspeed/aspeed-lpc-ctrl.c | 6 +++--- drivers/soc/aspeed/aspeed-lpc-snoop.c | 11 +++++------ 2 files changed, 8 insertions(+), 9 deletions(-)
drivers/soc/aspeed/aspeed-lpc-ctrl.c +3 -3
@@ -17,12 +17,12 @@#define DEVICE_NAME "aspeed-lpc-ctrl" -#define HICR5 0x0 +#define HICR5 0x80#define HICR5_ENL2H BIT(8)#define HICR5_ENFWH BIT(10) -#define HICR7 0x8 -#define HICR8 0xc +#define HICR7 0x88 +#define HICR8 0x8cstruct aspeed_lpc_ctrl {struct miscdevice miscdev;
drivers/soc/aspeed/aspeed-lpc-snoop.c +5 -6
@@ -28,26 +28,25 @@#define NUM_SNOOP_CHANNELS 2#define SNOOP_FIFO_SIZE 2048 -#define HICR5 0x0 +#define HICR5 0x80#define HICR5_EN_SNP0W BIT(0)#define HICR5_ENINT_SNP0W BIT(1)#define HICR5_EN_SNP1W BIT(2)#define HICR5_ENINT_SNP1W BIT(3) - -#define HICR6 0x4 +#define HICR6 0x84#define HICR6_STR_SNP0W BIT(0)#define HICR6_STR_SNP1W BIT(1) -#define SNPWADR 0x10 +#define SNPWADR 0x90#define SNPWADR_CH0_MASK GENMASK(15, 0)#define SNPWADR_CH0_SHIFT 0#define SNPWADR_CH1_MASK GENMASK(31, 16)#define SNPWADR_CH1_SHIFT 16 -#define SNPWDR 0x14 +#define SNPWDR 0x94#define SNPWDR_CH0_MASK GENMASK(7, 0)#define SNPWDR_CH0_SHIFT 0#define SNPWDR_CH1_MASK GENMASK(15, 8)#define SNPWDR_CH1_SHIFT 8 -#define HICRB 0x80 +#define HICRB 0x100#define HICRB_ENSNP0D BIT(14)#define HICRB_ENSNP1D BIT(15)
Signature · 1 line
2.17.1
PATCH 3/4 ipmi: kcs: aspeed: Fix LPC register offsets
In reply to Chia-Wei, WangThe LPC register offsets are fixed to adapt to the LPC DTS change, where the LPC partitioning is removed.
--- drivers/char/ipmi/kcs_bmc_aspeed.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
drivers/char/ipmi/kcs_bmc_aspeed.c +5 -8
@@ -27,7 +27,6 @@#define KCS_CHANNEL_MAX 4 -/* mapped to lpc-bmc at 0 IO space */ #define LPC_HICR0 0x000#define LPC_HICR0_LPC3E BIT(7)#define LPC_HICR0_LPC2E BIT(6)
@@ -52,15 +51,13 @@#define LPC_STR1 0x03C#define LPC_STR2 0x040#define LPC_STR3 0x044 - -/* mapped to lpc-host at 80 IO space */ -#define LPC_HICRB 0x080 +#define LPC_HICRB 0x100#define LPC_HICRB_IBFIF4 BIT(1)#define LPC_HICRB_LPC4E BIT(0) -#define LPC_LADR4 0x090 -#define LPC_IDR4 0x094 -#define LPC_ODR4 0x098 -#define LPC_STR4 0x09C +#define LPC_LADR4 0x110 +#define LPC_IDR4 0x114 +#define LPC_ODR4 0x118 +#define LPC_STR4 0x11Cstruct aspeed_kcs_bmc {struct regmap *map;
Signature · 1 line
2.17.1
PATCH 4/4 pinctrl: aspeed-g5: Fix LPC register offsets
In reply to Chia-Wei, WangThe LPC register offsets are fixed to adapt to the LPC DTS change, where the LPC partitioning is removed.
--- drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c +1 -1
@@ -60,7 +60,7 @@#define COND2 { ASPEED_IP_SCU, SCU94, GENMASK(1, 0), 0, 0 }/* LHCR0 is offset from the end of the H8S/2168-compatible registers */ -#define LHCR0 0x20 +#define LHCR0 0xa0#define GFX064 0x64#define B14 0
Signature · 1 line
2.17.1
Joel Stanley
maintainerHello,
Quoted 9 lines · Wang
The LPC controller has no concept of the BMC and the Host partitions. The incorrect partitioning can impose unnecessary range restrictions on register access through the syscon regmap interface.
For instance, HICRB contains the I/O port address configuration of KCS channel 1/2. However, the KCS#1/#2 drivers cannot access HICRB as it is located at the other LPC partition.
Quoted 5 lines
In addition, to be backward compatible, the newly added HW control bits could be added at any reserved bits over the LPC addressing space.
Thereby, this patch series aims to remove the LPC partitioning for better driver development and maintenance.
I support this cleanup. The only consideration is to be careful with breaking the driver/device-tree relationship. We either need to ensure the drivers remain compatible with both device trees.
Another solution is to get agreement from all parties that for the LPC device the device tree is always the one shipped with the kernel, so it is okay to make incompatible changes.
While we are doing a cleanup, Andrew suggested we remove the detailed description of LPC out of the device tree. We would have the one LPC node, and create a LPC driver that creates all of the sub devices (snoop, FW cycles, kcs, bt, vuart). Andrew, can you elaborate on this plan?
Cheers,
Joel
Quoted 19 lines
Chia-Wei, Wang (4):
ARM: dts: Remove LPC BMC and Host partitions
soc: aspeed: Fix LPC register offsets
ipmi: kcs: aspeed: Fix LPC register offsets
pinctrl: aspeed-g5: Fix LPC register offsetsarch/arm/boot/dts/aspeed-g4.dtsi | 74 +++++------ arch/arm/boot/dts/aspeed-g5.dtsi | 135 +++++++++------------ arch/arm/boot/dts/aspeed-g6.dtsi | 135 +++++++++------------ drivers/char/ipmi/kcs_bmc_aspeed.c | 13 +- drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c | 2 +- drivers/soc/aspeed/aspeed-lpc-ctrl.c | 6 +- drivers/soc/aspeed/aspeed-lpc-snoop.c | 11 +- 7 files changed, 162 insertions(+), 214 deletions(-)--
2.17.1
Quoted 12 lines · Joel Stanley
Hello,
Quoted 8 lines · Wang
The LPC controller has no concept of the BMC and the Host partitions. The incorrect partitioning can impose unnecessary range restrictions on register access through the syscon regmap interface.
For instance, HICRB contains the I/O port address configuration of KCS channel 1/2. However, the KCS#1/#2 drivers cannot access HICRB as it is located at the other LPC partition.
Thanks for addressing this, I've regretted that choice for a while now.
The split was rooted in trying to support pinmux while not being across every detail of the LPC controller, and so I made some poor decisions.
Quoted 15 lines
Quoted 6 lines
In addition, to be backward compatible, the newly added HW control bits could be added at any reserved bits over the LPC addressing space.
Thereby, this patch series aims to remove the LPC partitioning for better driver development and maintenance.
I support this cleanup. The only consideration is to be careful with breaking the driver/device-tree relationship. We either need to ensure the drivers remain compatible with both device trees.
Another solution is to get agreement from all parties that for the LPC device the device tree is always the one shipped with the kernel, so it is okay to make incompatible changes.
Quoted 5 lines
While we are doing a cleanup, Andrew suggested we remove the detailed description of LPC out of the device tree. We would have the one LPC node, and create a LPC driver that creates all of the sub devices (snoop, FW cycles, kcs, bt, vuart). Andrew, can you elaborate on this plan?
I dug up the conversation I had with Rob over a year ago about being unhappy with what I'd cooked up.
https://lore.kernel.org/linux-arm-kernel/CAL_JsqJ+sFDG8eKbV3gvmqVHx+otWbki4dY213apzXgfhbXXEw at mail.gmail.com/
But I think you covered most of the idea there: We have the LPC driver create the subdevices and that moves the details out of the devicetree. However, I haven't thought about it more than that, and I think there are still problems with that idea. For instance, how we manage configuration of those devices, and how to enable only the devices a given platform actually cares about (i.e. the problems that devicetree solves for us).
It may be that the only way to do that is with platform code, and that's not really a direction we should be going either.
Andrew
Hello,
Thanks for your prompt feedback.
Quoted 18 lines
-----Original Message-----
From: Andrew Jeffery <[email protected]>
Sent: Friday, September 11, 2020 12:46 PM
To: Joel Stanley <[email protected]>; ChiaWei Wang <[email protected]>
Subject: Re: [PATCH 0/4] Remove LPC register partitioningQuoted 9 lines · Joel Stanley
Hello,
Quoted 5 lines · Wang
The LPC controller has no concept of the BMC and the Host partitions. The incorrect partitioning can impose unnecessary range restrictions on register access through the syscon regmap interface.
Quoted 23 lines
Quoted 3 lines
Quoted 3 lines
For instance, HICRB contains the I/O port address configuration of KCS channel 1/2. However, the KCS#1/#2 drivers cannot access HICRB as it is located at the other LPC partition.
Thanks for addressing this, I've regretted that choice for a while now.
The split was rooted in trying to support pinmux while not being across every detail of the LPC controller, and so I made some poor decisions.
Quoted 14 lines
Quoted 6 lines
In addition, to be backward compatible, the newly added HW control bits could be added at any reserved bits over the LPC addressing space.
Thereby, this patch series aims to remove the LPC partitioning for better driver development and maintenance.
I support this cleanup. The only consideration is to be careful with breaking the driver/device-tree relationship. We either need to ensure the drivers remain compatible with both device trees.
Another solution is to get agreement from all parties that for the LPC device the device tree is always the one shipped with the kernel, so it is okay to make incompatible changes.
If it is possible, I would prefer this solution to avoid adding additional if-logic for the compatibility support in the driver implementation. As the patch can be less change made to register offset definitions and leave the core logic untouched.
Quoted 13 lines
Quoted 6 lines
While we are doing a cleanup, Andrew suggested we remove the detailed description of LPC out of the device tree. We would have the one LPC node, and create a LPC driver that creates all of the sub devices (snoop, FW cycles, kcs, bt, vuart). Andrew, can you elaborate on this plan?
I dug up the conversation I had with Rob over a year ago about being unhappy with what I'd cooked up.
https://lore.kernel.org/linux-arm-kernel/CAL_JsqJ+sFDG8eKbV3gvmqVHx+otW
bki4dY213apzXgfhbXXEw at mail.gmail.com/
Quoted 6 lines
But I think you covered most of the idea there: We have the LPC driver create the subdevices and that moves the details out of the devicetree. However, I haven't thought about it more than that, and I think there are still problems with that idea. For instance, how we manage configuration of those devices, and how to enable only the devices a given platform actually cares about (i.e. the problems that devicetree solves for us).
Another concern to make centralized LPC driver implementation more complicated is the relationship with eSPI driver.
AST2500 binds the reset control of LPC and eSPI together. If eSPI is used for the Host communication, the behavior in current "lpc-ctrl" should be skipped but not for KCS, BT, Snoop, etc. And this will be much easier to achieve by devicetree if LPC sub devices are individually described.
Quoted 4 lines
It may be that the only way to do that is with platform code, and that's not really a direction we should be going either.
Ryan Chen
reviewerHello Joel & Andrew,
Those patches are more organize for ASPEED SOC LPC register layout. Does those patches have any feedback?
Ryan
Quoted 95 lines
-----Original Message-----
From: ChiaWei Wang <[email protected]>
Sent: Friday, September 11, 2020 4:21 PM
To: Andrew Jeffery <[email protected]>; Joel Stanley <[email protected]>
Cc: Rob Herring <[email protected]>; Corey Minyard <[email protected]>; Linus Walleij <[email protected]>; Haiyue Wang <[email protected]>; Cyril Bur <[email protected]>; Robert Lippert <[email protected]>; Linux ARM <[email protected]>; linux-aspeed <[email protected]>; Linux Kernel Mailing List <[email protected]>; OpenBMC Maillist <[email protected]>; Ryan Chen <[email protected]>
Subject: RE: [PATCH 0/4] Remove LPC register partitioningHello,
Thanks for your prompt feedback.
Quoted 18 lines
-----Original Message-----
From: Andrew Jeffery <[email protected]>
Sent: Friday, September 11, 2020 12:46 PM
To: Joel Stanley <[email protected]>; ChiaWei Wang <[email protected]>
Subject: Re: [PATCH 0/4] Remove LPC register partitioningQuoted 9 lines · Joel Stanley
Hello,
Quoted 5 lines · Wang
The LPC controller has no concept of the BMC and the Host partitions. The incorrect partitioning can impose unnecessary range restrictions on register access through the syscon regmap interface.
Quoted 23 lines
Quoted 3 lines
Quoted 3 lines
For instance, HICRB contains the I/O port address configuration of KCS channel 1/2. However, the KCS#1/#2 drivers cannot access HICRB as it is located at the other LPC partition.
Thanks for addressing this, I've regretted that choice for a while now.
The split was rooted in trying to support pinmux while not being across every detail of the LPC controller, and so I made some poor decisions.
Quoted 14 lines
Quoted 6 lines
In addition, to be backward compatible, the newly added HW control bits could be added at any reserved bits over the LPC addressing space.
Thereby, this patch series aims to remove the LPC partitioning for better driver development and maintenance.
I support this cleanup. The only consideration is to be careful with breaking the driver/device-tree relationship. We either need to ensure the drivers remain compatible with both device trees.
Another solution is to get agreement from all parties that for the LPC device the device tree is always the one shipped with the kernel, so it is okay to make incompatible changes.
If it is possible, I would prefer this solution to avoid adding additional if-logic for the compatibility support in the driver implementation.
As the patch can be less change made to register offset definitions and leave the core logic untouched.Quoted 14 lines
Quoted 6 lines
While we are doing a cleanup, Andrew suggested we remove the detailed description of LPC out of the device tree. We would have the one LPC node, and create a LPC driver that creates all of the sub devices (snoop, FW cycles, kcs, bt, vuart). Andrew, can you elaborate on this plan?
I dug up the conversation I had with Rob over a year ago about being unhappy with what I'd cooked up.
https://lore.kernel.org/linux-arm-kernel/CAL_JsqJ+sFDG8eKbV3gvmqVHx+ot
W
bki4dY213apzXgfhbXXEw at mail.gmail.com/Quoted 6 lines
But I think you covered most of the idea there: We have the LPC driver create the subdevices and that moves the details out of the devicetree. However, I haven't thought about it more than that, and I think there are still problems with that idea. For instance, how we manage configuration of those devices, and how to enable only the devices a given platform actually cares about (i.e. the problems that devicetree solves
for us).
Another concern to make centralized LPC driver implementation more complicated is the relationship with eSPI driver.
AST2500 binds the reset control of LPC and eSPI together. If eSPI is used for the Host communication, the behavior in current "lpc-ctrl" should be skipped but not for KCS, BT, Snoop, etc.
And this will be much easier to achieve by devicetree if LPC sub devices are individually described.Quoted 4 lines
It may be that the only way to do that is with platform code, and that's not really a direction we should be going either.
Re: [PATCH 4/4] pinctrl: aspeed-g5: Fix LPC register offsets
In reply to Chia-Wei, WangQuoted 4 lines · Wang
The LPC register offsets are fixed to adapt to the LPC DTS change, where the LPC partitioning is removed.
Signed-off-by Chia-Wei, Wang <[email protected]>
I can apply this one patch if I get a review from one of the Aspeed pinctrl maintainer.
Andrew?
Yours,
Linus Walleij
Quoted 3 lines · Ryan Chen
Hello Joel & Andrew,
Those patches are more organize for ASPEED SOC LPC register layout. Does those patches have any feedback?
I support getting the problem fixed. However, the series also needs to fix the LPC devicetree binding at
Documentation/devicetree/bindings/mfd/aspeed-lpc.txt
What's proposed isn't backwards compatible. We need to agree that a breaking change is the way we want to go and get Rob's buy-in. Given the impact of the change I'd prefer we don't try to maintain backwards compatibility. All known users of the binding ship the dtb with the kernel.
Can we get a v2 with the binding documentation fixed? That will probably need some review.
Andrew
Hi Andrew,
Quoted 19 lines
-----Original Message-----
From: Andrew Jeffery <[email protected]>
Sent: Wednesday, September 30, 2020 2:12 PM
To: Ryan Chen <[email protected]>; ChiaWei Wang <[email protected]>; Joel Stanley <[email protected]>
Subject: Re: [PATCH 0/4] Remove LPC register partitioningQuoted 3 lines · Ryan Chen
Hello Joel & Andrew,
Those patches are more organize for ASPEED SOC LPC register layout. Does those patches have any feedback?I support getting the problem fixed. However, the series also needs to fix the LPC devicetree binding at
Documentation/devicetree/bindings/mfd/aspeed-lpc.txt
Quoted 7 lines
What's proposed isn't backwards compatible. We need to agree that a breaking change is the way we want to go and get Rob's buy-in. Given the impact of the change I'd prefer we don't try to maintain backwards compatibility. All known users of the binding ship the dtb with the kernel.
Can we get a v2 with the binding documentation fixed? That will probably need some review.
Yes, I will fix the binding documentation and resend the v2 patch for the review. Thanks.
Re: [PATCH 4/4] pinctrl: aspeed-g5: Fix LPC register offsets
In reply to Linus WalleijQuoted 6 lines · Linus Walleij
Quoted 3 lines · Wang
The LPC register offsets are fixed to adapt to the LPC DTS change, where the LPC partitioning is removed.
Quoted 6 lines
Quoted 1 line
Signed-off-by Chia-Wei, Wang <[email protected]>I can apply this one patch if I get a review from one of the Aspeed pinctrl maintainer.
Andrew?
There needs to be a v2 of the series that fixes the binding documentation, which will drive some discussion about backwards compatibility. So lets not apply this patch just yet.
Thanks for touching base!
Andrew