Add AST2600 LPC PCC support
Subsystems (4)
v3 cover Add AST2600 LPC PCC support
--
v3aspeed-lpc-pcc.c:
-- Add ida_free and fix the dev usage with removing some debug messages.aspeed-lpc.yaml:
-- Add description about the pcc-ports usage.
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 | 38 ++ arch/arm/boot/dts/aspeed/aspeed-g6.dtsi | 7 + drivers/misc/Kconfig | 10 + drivers/misc/Makefile | 1 + drivers/misc/aspeed-lpc-pcc.c | 440 ++++++++++++++++++ 5 files changed, 496 insertions(+) create mode 100644 drivers/misc/aspeed-lpc-pcc.c
Signature · 1 line
2.34.1
PATCH v3 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 | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+)
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml +38 -0
@@ -149,6 +149,37 @@ 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: + As a device handshake with a host using the port-mmaped I/O in x86 + architecture, need to handle specific which port I/O address for use. + + 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 +207,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 v3 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.
<form letter>
This is a friendly reminder during the review process.
It seems my or other reviewer's previous comments were not fully addressed. Maybe the feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.
Thank you.
</form letter>
Quoted 29 lines
Signed-off-by Kevin Chen <[email protected]>--- .../devicetree/bindings/mfd/aspeed-lpc.yaml | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+)Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml +15
-0@@ -149,6 +149,37 @@ 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:
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml patternProperties: · line 176
Quoted 10 lines
Documentation/devicetree/bindings/mfd/aspeed-lpc.yaml +10
-0+ maxItems: 1 + + interrupts: + maxItems: 1 + + pcc-ports: + $ref: /schemas/types.yaml#/definitions/uint32-array + description: + As a device handshake with a host using the port-mmaped I/O in x86 + architecture, need to handle specific which port I/O address for use.
<form letter>
This is a friendly reminder during the review process.
It seems my or other reviewer's previous comments were not fully addressed. Maybe the feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.
Thank you.
</form letter>
Best regards,
Krzysztof
PATCH v3 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
PATCH v3 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 | 440 ++++++++++++++++++++++++++++++++++ 3 files changed, 451 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 capture post code 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 +440 -0
440 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v3 3/3] soc: aspeed: lpc-pcc: Add PCC controller support
Quoted 4 lines · Kevin Chen
drivers/misc/aspeed-lpc-pcc.c new file +4
-0+static int aspeed_pcc_probe (struct platform_device *pdev) +{ +int rc; +struct aspeed_pcc_ctrl *pcc;
drivers/misc/aspeed-lpc-pcc.c line 321
Quoted 10 lines
drivers/misc/aspeed-lpc-pcc.c new file +10
-0+struct device *dev = &pdev->dev; +uint32_t fifo_size =PAGE_SIZE ; + + pcc =devm_kzalloc (dev,sizeof (*pcc),GFP_KERNEL ); +if (!pcc) +return -ENOMEM ; + + pcc->regmap =syscon_node_to_regmap (dev->parent->of_node); +if (IS_ERR (pcc->regmap)) { +dev_err (dev,"Couldn't get regmap\n" );
return dev_err_probe() is not suitable?
Review
Quoted 1 line
(quoted diff) +1
-0+ return -ENODEV;
Why overriding error code?
drivers/misc/aspeed-lpc-pcc.c line 328
Quoted 6 lines
drivers/misc/aspeed-lpc-pcc.c new file +6
-0+ } + + rc =of_property_read_u32 (dev->of_node,"pcc-ports" , &pcc->port); +if (rc) { +dev_err (dev,"no pcc ports configured\n" ); +return -ENODEV ;
Why overriding error code?
You got this comment already at v2.
Quoted 11 lines
drivers/misc/aspeed-lpc-pcc.c new file +11
-0+ } + + 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,
drivers/misc/aspeed-lpc-pcc.c line 349
Quoted 10 lines
drivers/misc/aspeed-lpc-pcc.c new file +10
-0+ &pcc->dma.addr, + 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) {
Drop {}
drivers/misc/aspeed-lpc-pcc.c line 324
Quoted 3 lines
drivers/misc/aspeed-lpc-pcc.c new file +3
-0+return -ENOMEM ; + } +
Please run scripts/checkpatch.pl and fix reported warnings. After that, run also scripts/checkpatch.pl --strict and (probably) fix more warnings. Some warnings can be ignored, especially from --strict run, but the code here looks like it needs a fix. Feel free to get in touch if the warning is not clear.
Best regards,
Krzysztof
RE: [PATCH v3 3/3] soc: aspeed: lpc-pcc: Add PCC controller support
Quoted 8 lines · Kevin Chen
Quoted 7 lines
drivers/misc/aspeed-lpc-pcc.c new file +7
-0+static int aspeed_pcc_probe (struct platform_device *pdev) { +int rc; +struct aspeed_pcc_ctrl *pcc; +struct device *dev = &pdev->dev; +uint32_t fifo_size =PAGE_SIZE ; + + pcc =devm_kzalloc (dev,sizeof (*pcc),GFP_KERNEL );
Quoted 8 lines
drivers/misc/aspeed-lpc-pcc.c line 321
Quoted 6 lines
drivers/misc/aspeed-lpc-pcc.c new file +6
-0+if (!pcc) +return -ENOMEM ; + + pcc->regmap =syscon_node_to_regmap (dev->parent->of_node); +if (IS_ERR (pcc->regmap)) { +dev_err (dev,"Couldn't get regmap\n" );return
dev_err_probe()is not suitable?
Agree. Change to " dev_err_probe(dev, PTR_ERR(pcc->regmap),"Couldn't get regmap\n");"?
Quoted 6 lines
Review
Quoted 2 lines
(quoted diff) +1
-0+ return -ENODEV;Why overriding error code?
Quoted 8 lines
drivers/misc/aspeed-lpc-pcc.c line 328
Quoted 6 lines
drivers/misc/aspeed-lpc-pcc.c new file +6
-0+ } + + rc =of_property_read_u32 (dev->of_node,"pcc-ports" , &pcc->port); +if (rc) { +dev_err (dev,"no pcc ports configured\n" ); +return -ENODEV ;Why overriding error code?
Agree.
Quoted 2 lines
You got this comment already at v2.
Sorry, I already checked the comment in v2.
Quoted 16 lines
Quoted 16 lines
drivers/misc/aspeed-lpc-pcc.c new file +15
-0+ } + + 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" );
Quoted 8 lines
drivers/misc/aspeed-lpc-pcc.c line 349
Quoted 6 lines
drivers/misc/aspeed-lpc-pcc.c new file +6
-0+return -ENOMEM ; + } + + fifo_size =roundup (pcc->dma.size,PAGE_SIZE ); + rc =kfifo_alloc (&pcc->fifo, fifo_size,GFP_KERNEL ); +if (rc) {Drop {}
Agree.
Quoted 9 lines
drivers/misc/aspeed-lpc-pcc.c line 324
Quoted 4 lines
drivers/misc/aspeed-lpc-pcc.c new file +3
-0+return -ENOMEM ; + } +Please run
scripts/checkpatch.pland fix reported warnings. After that, run alsoscripts/checkpatch.pl --strictand (probably) fix more warnings. Some warnings can be ignored, especially from --strict run, but the code here looks like it needs a fix. Feel free to get in touch if the warning is not clear.
Agree.
Quoted 5 lines
Best regards,
Krzysztof
kernel test robot
build botRe: [PATCH v3 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 lee-leds/for-leds-next lee-mfd/for-mfd-next robh/for-next lee-mfd/for-mfd-fixes linus/master v6.14-rc6 next-20250314] [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/dt-binding-aspeed-Add-LPC-PCC-controller/20250310-195011 base: char-misc/char-misc-testing patch link: https://lore.kernel.org/r/20250310114839.3098148-4-kevin_chen%40aspeedtech.com patch subject: [PATCH v3 3/3] soc: aspeed: lpc-pcc: Add PCC controller support config: s390-randconfig-002-20250316 (https://download.01.org/0day-ci/archive/20250316/[email protected]/config) compiler: clang version 16.0.6 (https://github.com/llvm/llvm-project 7cbf1a2591520c2491aa35339f227775f4d3adf6) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250316/[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 >>):
>> drivers/mfd/syscon.c:157:2: error: call to undeclared function 'iounmap'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
iounmap(base);
^
arch/s390/include/asm/io.h:31:17: note: expanded from macro 'iounmap'
#define iounmap iounmap
^1 error generated.
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 +157 drivers/mfd/syscon.c
87d687301f38072 Dong Aisheng 2012-09-05 39
7d1e3bd94828ad9 Jeremy Kerr 2023-01-05 40 static struct syscon *of_syscon_register(struct device_node *np, bool check_res)
87d687301f38072 Dong Aisheng 2012-09-05 41 {
a00406b71c5f08f Fabrice Gasnier 2018-12-12 42 struct clk *clk;
bdb0066df96e74a Pankaj Dubey 2014-09-30 43 struct regmap *regmap;
bdb0066df96e74a Pankaj Dubey 2014-09-30 44 void __iomem *base;
db2fb60cd35d2d0 Damien Riegel 2015-11-30 45 u32 reg_io_width;
bdb0066df96e74a Pankaj Dubey 2014-09-30 46 int ret;
bdb0066df96e74a Pankaj Dubey 2014-09-30 47 struct regmap_config syscon_config = syscon_regmap_config;
ca668f0edfae654 Philipp Zabel 2016-01-29 48 struct resource res;
7d1e3bd94828ad9 Jeremy Kerr 2023-01-05 49 struct reset_control *reset;
bdb0066df96e74a Pankaj Dubey 2014-09-30 50
805f7aaf7fee14a Rob Herring (Arm 2024-12-17 51) WARN_ON(!mutex_is_locked(&syscon_list_lock));
805f7aaf7fee14a Rob Herring (Arm 2024-12-17 52)
82f898f47112bc7 Krzysztof Kozlowski 2024-07-07 53 struct syscon *syscon __free(kfree) = kzalloc(sizeof(*syscon), GFP_KERNEL);
bdb0066df96e74a Pankaj Dubey 2014-09-30 54 if (!syscon)
bdb0066df96e74a Pankaj Dubey 2014-09-30 55 return ERR_PTR(-ENOMEM);
bdb0066df96e74a Pankaj Dubey 2014-09-30 56
82f898f47112bc7 Krzysztof Kozlowski 2024-07-07 57 if (of_address_to_resource(np, 0, &res))
82f898f47112bc7 Krzysztof Kozlowski 2024-07-07 58 return ERR_PTR(-ENOMEM);
ca668f0edfae654 Philipp Zabel 2016-01-29 59
452d07413954ef3 Hector Martin 2021-08-23 60 base = of_iomap(np, 0);
82f898f47112bc7 Krzysztof Kozlowski 2024-07-07 61 if (!base)
82f898f47112bc7 Krzysztof Kozlowski 2024-07-07 62 return ERR_PTR(-ENOMEM);
bdb0066df96e74a Pankaj Dubey 2014-09-30 63
ca4582c286aa446 Jason A. Donenfeld 2022-10-08 64 /* Parse the device's DT node for an endianness specification */
ca4582c286aa446 Jason A. Donenfeld 2022-10-08 65 if (of_property_read_bool(np, "big-endian"))
ca4582c286aa446 Jason A. Donenfeld 2022-10-08 66 syscon_config.val_format_endian = REGMAP_ENDIAN_BIG;
ca4582c286aa446 Jason A. Donenfeld 2022-10-08 67 else if (of_property_read_bool(np, "little-endian"))
ca4582c286aa446 Jason A. Donenfeld 2022-10-08 68 syscon_config.val_format_endian = REGMAP_ENDIAN_LITTLE;
ca4582c286aa446 Jason A. Donenfeld 2022-10-08 69 else if (of_property_read_bool(np, "native-endian"))
ca4582c286aa446 Jason A. Donenfeld 2022-10-08 70 syscon_config.val_format_endian = REGMAP_ENDIAN_NATIVE;
ca4582c286aa446 Jason A. Donenfeld 2022-10-08 71
db2fb60cd35d2d0 Damien Riegel 2015-11-30 72 /*
db2fb60cd35d2d0 Damien Riegel 2015-11-30 73 * search for reg-io-width property in DT. If it is not provided,
db2fb60cd35d2d0 Damien Riegel 2015-11-30 74 * default to 4 bytes. regmap_init_mmio will return an error if values
db2fb60cd35d2d0 Damien Riegel 2015-11-30 75 * are invalid so there is no need to check them here.
db2fb60cd35d2d0 Damien Riegel 2015-11-30 76 */
db2fb60cd35d2d0 Damien Riegel 2015-11-30 77 ret = of_property_read_u32(np, "reg-io-width", ®_io_width);
db2fb60cd35d2d0 Damien Riegel 2015-11-30 78 if (ret)
db2fb60cd35d2d0 Damien Riegel 2015-11-30 79 reg_io_width = 4;
db2fb60cd35d2d0 Damien Riegel 2015-11-30 80
3bafc09e779710a Baolin Wang 2017-12-25 81 ret = of_hwspin_lock_get_id(np, 0);
3bafc09e779710a Baolin Wang 2017-12-25 82 if (ret > 0 || (IS_ENABLED(CONFIG_HWSPINLOCK) && ret == 0)) {
3bafc09e779710a Baolin Wang 2017-12-25 83 syscon_config.use_hwlock = true;
3bafc09e779710a Baolin Wang 2017-12-25 84 syscon_config.hwlock_id = ret;
3bafc09e779710a Baolin Wang 2017-12-25 85 syscon_config.hwlock_mode = HWLOCK_IRQSTATE;
3bafc09e779710a Baolin Wang 2017-12-25 86 } else if (ret < 0) {
3bafc09e779710a Baolin Wang 2017-12-25 87 switch (ret) {
3bafc09e779710a Baolin Wang 2017-12-25 88 case -ENOENT:
3bafc09e779710a Baolin Wang 2017-12-25 89 /* Ignore missing hwlock, it's optional. */
3bafc09e779710a Baolin Wang 2017-12-25 90 break;
3bafc09e779710a Baolin Wang 2017-12-25 91 default:
3bafc09e779710a Baolin Wang 2017-12-25 92 pr_err("Failed to retrieve valid hwlock: %d\n", ret);
df561f6688fef77 Gustavo A. R. Silva 2020-08-23 93 fallthrough;
3bafc09e779710a Baolin Wang 2017-12-25 94 case -EPROBE_DEFER:
3bafc09e779710a Baolin Wang 2017-12-25 95 goto err_regmap;
3bafc09e779710a Baolin Wang 2017-12-25 96 }
3bafc09e779710a Baolin Wang 2017-12-25 97 }
3bafc09e779710a Baolin Wang 2017-12-25 98
7ff7d5ffb7259f7 Andy Shevchenko 2022-05-31 99 syscon_config.name = kasprintf(GFP_KERNEL, "%pOFn@%pa", np, &res.start);
41673c66b3d0c09 Kunwu Chan 2023-12-04 100 if (!syscon_config.name) {
41673c66b3d0c09 Kunwu Chan 2023-12-04 101 ret = -ENOMEM;
41673c66b3d0c09 Kunwu Chan 2023-12-04 102 goto err_regmap;
41673c66b3d0c09 Kunwu Chan 2023-12-04 103 }
db2fb60cd35d2d0 Damien Riegel 2015-11-30 104 syscon_config.reg_stride = reg_io_width;
db2fb60cd35d2d0 Damien Riegel 2015-11-30 105 syscon_config.val_bits = reg_io_width * 8;
ca668f0edfae654 Philipp Zabel 2016-01-29 106 syscon_config.max_register = resource_size(&res) - reg_io_width;
2e63d6fa113d362 Nishanth Menon 2024-09-03 107 if (!syscon_config.max_register)
2e63d6fa113d362 Nishanth Menon 2024-09-03 108 syscon_config.max_register_is_0 = true;
db2fb60cd35d2d0 Damien Riegel 2015-11-30 109
bdb0066df96e74a Pankaj Dubey 2014-09-30 110 regmap = regmap_init_mmio(NULL, base, &syscon_config);
56a1188159cb2b8 Limeng 2021-04-07 111 kfree(syscon_config.name);
bdb0066df96e74a Pankaj Dubey 2014-09-30 112 if (IS_ERR(regmap)) {
bdb0066df96e74a Pankaj Dubey 2014-09-30 113 pr_err("regmap init failed\n");
bdb0066df96e74a Pankaj Dubey 2014-09-30 114 ret = PTR_ERR(regmap);
bdb0066df96e74a Pankaj Dubey 2014-09-30 115 goto err_regmap;
bdb0066df96e74a Pankaj Dubey 2014-09-30 116 }
bdb0066df96e74a Pankaj Dubey 2014-09-30 117
7d1e3bd94828ad9 Jeremy Kerr 2023-01-05 118 if (check_res) {
a00406b71c5f08f Fabrice Gasnier 2018-12-12 119 clk = of_clk_get(np, 0);
a00406b71c5f08f Fabrice Gasnier 2018-12-12 120 if (IS_ERR(clk)) {
a00406b71c5f08f Fabrice Gasnier 2018-12-12 121 ret = PTR_ERR(clk);
a00406b71c5f08f Fabrice Gasnier 2018-12-12 122 /* clock is optional */
a00406b71c5f08f Fabrice Gasnier 2018-12-12 123 if (ret != -ENOENT)
a00406b71c5f08f Fabrice Gasnier 2018-12-12 124 goto err_clk;
a00406b71c5f08f Fabrice Gasnier 2018-12-12 125 } else {
a00406b71c5f08f Fabrice Gasnier 2018-12-12 126 ret = regmap_mmio_attach_clk(regmap, clk);
a00406b71c5f08f Fabrice Gasnier 2018-12-12 127 if (ret)
7d1e3bd94828ad9 Jeremy Kerr 2023-01-05 128 goto err_attach_clk;
a00406b71c5f08f Fabrice Gasnier 2018-12-12 129 }
7d1e3bd94828ad9 Jeremy Kerr 2023-01-05 130
7d1e3bd94828ad9 Jeremy Kerr 2023-01-05 131 reset = of_reset_control_get_optional_exclusive(np, NULL);
7d1e3bd94828ad9 Jeremy Kerr 2023-01-05 132 if (IS_ERR(reset)) {
7d1e3bd94828ad9 Jeremy Kerr 2023-01-05 133 ret = PTR_ERR(reset);
7d1e3bd94828ad9 Jeremy Kerr 2023-01-05 134 goto err_attach_clk;
7d1e3bd94828ad9 Jeremy Kerr 2023-01-05 135 }
7d1e3bd94828ad9 Jeremy Kerr 2023-01-05 136
7d1e3bd94828ad9 Jeremy Kerr 2023-01-05 137 ret = reset_control_deassert(reset);
7d1e3bd94828ad9 Jeremy Kerr 2023-01-05 138 if (ret)
7d1e3bd94828ad9 Jeremy Kerr 2023-01-05 139 goto err_reset;
39233b7c611248c Paul Cercueil 2019-07-24 140 }
a00406b71c5f08f Fabrice Gasnier 2018-12-12 141
bdb0066df96e74a Pankaj Dubey 2014-09-30 142 syscon->regmap = regmap;
bdb0066df96e74a Pankaj Dubey 2014-09-30 143 syscon->np = np;
bdb0066df96e74a Pankaj Dubey 2014-09-30 144
bdb0066df96e74a Pankaj Dubey 2014-09-30 145 list_add_tail(&syscon->list, &syscon_list);
87d687301f38072 Dong Aisheng 2012-09-05 146
82f898f47112bc7 Krzysztof Kozlowski 2024-07-07 147 return_ptr(syscon);
bdb0066df96e74a Pankaj Dubey 2014-09-30 148
7d1e3bd94828ad9 Jeremy Kerr 2023-01-05 149 err_reset:
7d1e3bd94828ad9 Jeremy Kerr 2023-01-05 150 reset_control_put(reset);
7d1e3bd94828ad9 Jeremy Kerr 2023-01-05 151 err_attach_clk:
a00406b71c5f08f Fabrice Gasnier 2018-12-12 152 if (!IS_ERR(clk))
a00406b71c5f08f Fabrice Gasnier 2018-12-12 153 clk_put(clk);
a00406b71c5f08f Fabrice Gasnier 2018-12-12 154 err_clk:
a00406b71c5f08f Fabrice Gasnier 2018-12-12 155 regmap_exit(regmap);
bdb0066df96e74a Pankaj Dubey 2014-09-30 156 err_regmap:
bdb0066df96e74a Pankaj Dubey 2014-09-30 @157 iounmap(base);
bdb0066df96e74a Pankaj Dubey 2014-09-30 158 return ERR_PTR(ret);
87d687301f38072 Dong Aisheng 2012-09-05 159 }
87d687301f38072 Dong Aisheng 2012-09-05 160 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki