Add support for AST2700 clk driver
Subsystems (6)
Ryan Chen
maintainerv5 cover Add support for AST2700 clk driver
This patch series is add clk driver for AST2700.
AST2700 is the 8th generation of Integrated Remote Management Processor introduced by ASPEED Technology Inc. Which is Board Management controller (BMC) SoC family. AST2700 have two SoC connected, one is SoC0, another is SoC1, it has it's own scu, this driver inlcude SCU0 and SCU1 driver.
v5:
-patch-2 Kconfig: add select AUXILIARY_BUS
-reset-aspeed: #define to_aspeed_reset(p) turn into static inline function. -reset-aspeed: modify spin_lock_irqsave to guard(spinlock_irqsave) -reset-aspeed: remove unnecessary parentheses.
-clk-ast2700: use <linux/units.h> and refrain from define clk
v4:
-yaml: keep size-cells=<1>.
-merge clk,reset dt binding header with yaml the same patch. -rename clk,reset dt binding header to aspeed,ast2700-scu.h -reset-aspeed: update tables tabs sapces to consistent spaces. -reset-aspeed: remove no use dev_set_drvdata.
-clk-ast2700: modify reset_name to const int scu in struct clk_data. -clk-ast2700: use scu number in clk_data generate reset_name for reset
driver register.
-clk-ast2700: fix pll number mix up scu0,scu1. -clk-ast2700: update dt-binding clock include file.
v3:
-yaml: v2 missing send yaml patch, v3 add. -yaml: drop 64bits address example.
-yaml: add discription about soc0 and soc1 -dt-bindings: remove (), *_NUMS, reserved. -dt-bindings: remove dulipated define number. -dt-bindings: merge clk and reset to be one patch. -reset-aspeed: add auxiliary device for reset driver. -clk-ast2700: modify reset to be auxiliary add. -clk-ast2700: modify to be platform driver. -clk-ast2700: modify each clk to const clk array.
v2:
-yaml: drop 64bits address example.
-yaml: add discription about soc0 and soc1
-dt-bindings: remove (), *_NUMS, reserved.
-dt-bindings: remove dulipated define number
-clk-ast2700: drop WARN_ON, weird comment.
Ryan Chen (3):
dt-bindings: mfd: aspeed: support for AST2700
reset: aspeed: register AST2700 reset auxiliary bus device
clk: aspeed: add AST2700 clock driver.
.../bindings/mfd/aspeed,ast2x00-scu.yaml | 8 +- drivers/clk/Kconfig | 8 + drivers/clk/Makefile | 1 + drivers/clk/clk-ast2700.c | 1554 +++++++++++++++++ drivers/reset/Kconfig | 7 + drivers/reset/Makefile | 1 + drivers/reset/reset-aspeed.c | 256 +++ .../dt-bindings/clock/aspeed,ast2700-scu.h | 163 ++ .../dt-bindings/reset/aspeed,ast2700-scu.h | 124 ++ 9 files changed, 2121 insertions(+), 1 deletion(-) create mode 100644 drivers/clk/clk-ast2700.c create mode 100644 drivers/reset/reset-aspeed.c create mode 100644 include/dt-bindings/clock/aspeed,ast2700-scu.h create mode 100644 include/dt-bindings/reset/aspeed,ast2700-scu.h
Signature · 1 line
2.34.1
Ryan Chen
maintainerPATCH v5 1/3 dt-bindings: mfd: aspeed: support for AST2700
Add reset, clk dt bindings headers, and update compatible support for AST2700 clk, silicon-id in yaml.
--- .../bindings/mfd/aspeed,ast2x00-scu.yaml | 8 +- .../dt-bindings/clock/aspeed,ast2700-scu.h | 163 ++++++++++++++++++ .../dt-bindings/reset/aspeed,ast2700-scu.h | 124 +++++++++++++ 3 files changed, 294 insertions(+), 1 deletion(-) create mode 100644 include/dt-bindings/clock/aspeed,ast2700-scu.h create mode 100644 include/dt-bindings/reset/aspeed,ast2700-scu.h
Documentation/devicetree/bindings/mfd/aspeed,ast2x00-scu.yaml +7 -1
@@ -9,6 +9,8 @@ title: Aspeed System Control Unit description: The Aspeed System Control Unit manages the global behaviour of the SoC, configuring elements such as clocks, pinmux, and reset. + In AST2700 SOC which has two soc connection, each soc have its own scu + register control, ast2700-scu0 for soc0, ast2700-scu1 for soc1. maintainers: - Joel Stanley <[email protected]>
@@ -21,6 +23,8 @@ properties: - aspeed,ast2400-scu - aspeed,ast2500-scu - aspeed,ast2600-scu + - aspeed,ast2700-scu0 + - aspeed,ast2700-scu1 - const: syscon - const: simple-mfd
@@ -30,7 +34,8 @@ properties: ranges: true '#address-cells': - const: 1 + minimum: 1 + maximum: 2 '#size-cells': const: 1
@@ -76,6 +81,7 @@ patternProperties: - aspeed,ast2400-silicon-id - aspeed,ast2500-silicon-id - aspeed,ast2600-silicon-id + - aspeed,ast2700-silicon-id - const: aspeed,silicon-id reg:
include/dt-bindings/clock/aspeed,ast2700-scu.h new file +163 -0
163 lines not on this page · raw message
include/dt-bindings/reset/aspeed,ast2700-scu.h new file +124 -0
124 lines not on this page · raw message
Signature · 1 line
2.34.1
Ryan Chen
maintainerPATCH v5 2/3 reset: aspeed: register AST2700 reset auxiliary bus device
In reply to Ryan ChenThe AST2700 reset driver is registered as an auxiliary device due to reset and clock controller share the same register region.
--- drivers/reset/Kconfig | 7 + drivers/reset/Makefile | 1 + drivers/reset/reset-aspeed.c | 256 +++++++++++++++++++++++++++++++++++ 3 files changed, 264 insertions(+) create mode 100644 drivers/reset/reset-aspeed.c
drivers/reset/Kconfig +7 -0
@@ -22,6 +22,13 @@ config RESET_A10SR This option enables support for the external reset functions for peripheral PHYs on the Altera Arria10 System Resource Chip. +config RESET_ASPEED + tristate "ASPEED Reset Driver" + depends on ARCH_ASPEED || COMPILE_TEST + select AUXILIARY_BUS + help + This enables the reset controller driver for AST2700. + config RESET_ATH79 bool "AR71xx Reset Driver" if COMPILE_TEST default ATH79
drivers/reset/Makefile +1 -0
@@ -5,6 +5,7 @@ obj-y += starfive/ obj-y += sti/ obj-y += tegra/ obj-$(CONFIG_RESET_A10SR) += reset-a10sr.o +obj-$(CONFIG_RESET_ASPEED) += reset-aspeed.o obj-$(CONFIG_RESET_ATH79) += reset-ath79.o obj-$(CONFIG_RESET_AXS10X) += reset-axs10x.o obj-$(CONFIG_RESET_BCM6345) += reset-bcm6345.o
drivers/reset/reset-aspeed.c new file +256 -0
256 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v5 2/3] reset: aspeed: register AST2700 reset auxiliary bus device
Quoted 47 lines · Ryan Chen
The AST2700 reset driver is registered as an auxiliary device due to reset and clock controller share the same register region.
Signed-off-by Ryan Chen <[email protected]>--- drivers/reset/Kconfig | 7 + drivers/reset/Makefile | 1 + drivers/reset/reset-aspeed.c | 256 +++++++++++++++++++++++++++++++++++ 3 files changed, 264 insertions(+) create mode 100644 drivers/reset/reset-aspeed.cdrivers/reset/Kconfig +7
-0@@ -22,6 +22,13 @@ config RESET_A10SR This option enables support for the external reset functions for peripheral PHYs on the Altera Arria10 System Resource Chip. +config RESET_ASPEED + tristate "ASPEED Reset Driver" + depends on ARCH_ASPEED || COMPILE_TEST + select AUXILIARY_BUS + help + This enables the reset controller driver for AST2700. + config RESET_ATH79 bool "AR71xx Reset Driver" if COMPILE_TEST default ATH79drivers/reset/Makefile +1
-0@@ -5,6 +5,7 @@ obj-y += starfive/ obj-y += sti/ obj-y += tegra/ obj-$(CONFIG_RESET_A10SR) += reset-a10sr.o +obj-$(CONFIG_RESET_ASPEED) += reset-aspeed.o obj-$(CONFIG_RESET_ATH79) += reset-ath79.o obj-$(CONFIG_RESET_AXS10X) += reset-axs10x.o obj-$(CONFIG_RESET_BCM6345) += reset-bcm6345.odrivers/reset/reset-aspeed.c new file +0
-0
drivers/reset/reset-aspeed.c line 6
Quoted 6 lines
drivers/reset/reset-aspeed.c new file +6
-0@@ -0,0 +1,256 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (c) 2024 ASPEED Technology Inc. +*/ + +#include <linux/auxiliary_bus.h>
Missing
#include <linux/cleanup.h>
for guard().
Quoted 209 lines
drivers/reset/reset-aspeed.c new file +209
-0+#include <linux/device.h> +#include <linux/io.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/reset-controller.h> + +#include <dt-bindings/reset/aspeed,ast2700-scu.h> + +#define SCU0_RESET_CTRL1 0x200 +#define SCU0_RESET_CTRL2 0x220 +#define SCU1_RESET_CTRL1 0x200 +#define SCU1_RESET_CTRL2 0x220 +#define SCU1_PCIE3_CTRL 0x908 + +struct ast2700_reset_signal { +bool dedicated_clr;/* dedicated reset clr offset */ +u32 offset, bit; +}; + +struct aspeed_reset_info { +unsigned int nr_resets; +const struct ast2700_reset_signal *signal; +}; + +struct aspeed_reset { +struct reset_controller_dev rcdev; +struct aspeed_reset_info *info; +spinlock_t lock;/* Protect read-modify-write cycle */ +void __iomem *base; +}; + +static const struct ast2700_reset_signal ast2700_reset0_signals[] = { + [SCU0_RESET_SDRAM ] = { true,SCU0_RESET_CTRL1 ,BIT (0 ) }, + [SCU0_RESET_DDRPHY ] = { true,SCU0_RESET_CTRL1 ,BIT (1 ) }, + [SCU0_RESET_RSA ] = { true,SCU0_RESET_CTRL1 ,BIT (2 ) }, + [SCU0_RESET_SHA3 ] = { true,SCU0_RESET_CTRL1 ,BIT (3 ) }, + [SCU0_RESET_HACE ] = { true,SCU0_RESET_CTRL1 ,BIT (4 ) }, + [SCU0_RESET_SOC ] = { true,SCU0_RESET_CTRL1 ,BIT (5 ) }, + [SCU0_RESET_VIDEO ] = { true,SCU0_RESET_CTRL1 ,BIT (6 ) }, + [SCU0_RESET_2D ] = { true,SCU0_RESET_CTRL1 ,BIT (7 ) }, + [SCU0_RESET_PCIS ] = { true,SCU0_RESET_CTRL1 ,BIT (8 ) }, + [SCU0_RESET_RVAS0 ] = { true,SCU0_RESET_CTRL1 ,BIT (9 ) }, + [SCU0_RESET_RVAS1 ] = { true,SCU0_RESET_CTRL1 ,BIT (10 ) }, + [SCU0_RESET_SM3 ] = { true,SCU0_RESET_CTRL1 ,BIT (11 ) }, + [SCU0_RESET_SM4 ] = { true,SCU0_RESET_CTRL1 ,BIT (12 ) }, + [SCU0_RESET_CRT0 ] = { true,SCU0_RESET_CTRL1 ,BIT (13 ) }, + [SCU0_RESET_ECC ] = { true,SCU0_RESET_CTRL1 ,BIT (14 ) }, + [SCU0_RESET_DP_PCI ] = { true,SCU0_RESET_CTRL1 ,BIT (15 ) }, + [SCU0_RESET_UFS ] = { true,SCU0_RESET_CTRL1 ,BIT (16 ) }, + [SCU0_RESET_EMMC ] = { true,SCU0_RESET_CTRL1 ,BIT (17 ) }, + [SCU0_RESET_PCIE1RST ] = { true,SCU0_RESET_CTRL1 ,BIT (18 ) }, + [SCU0_RESET_PCIE1RSTOE ] = { true,SCU0_RESET_CTRL1 ,BIT (19 ) }, + [SCU0_RESET_PCIE0RST ] = { true,SCU0_RESET_CTRL1 ,BIT (20 ) }, + [SCU0_RESET_PCIE0RSTOE ] = { true,SCU0_RESET_CTRL1 ,BIT (21 ) }, + [SCU0_RESET_JTAG ] = { true,SCU0_RESET_CTRL1 ,BIT (22 ) }, + [SCU0_RESET_MCTP0 ] = { true,SCU0_RESET_CTRL1 ,BIT (23 ) }, + [SCU0_RESET_MCTP1 ] = { true,SCU0_RESET_CTRL1 ,BIT (24 ) }, + [SCU0_RESET_XDMA0 ] = { true,SCU0_RESET_CTRL1 ,BIT (25 ) }, + [SCU0_RESET_XDMA1 ] = { true,SCU0_RESET_CTRL1 ,BIT (26 ) }, + [SCU0_RESET_H2X1 ] = { true,SCU0_RESET_CTRL1 ,BIT (27 ) }, + [SCU0_RESET_DP ] = { true,SCU0_RESET_CTRL1 ,BIT (28 ) }, + [SCU0_RESET_DP_MCU ] = { true,SCU0_RESET_CTRL1 ,BIT (29 ) }, + [SCU0_RESET_SSP ] = { true,SCU0_RESET_CTRL1 ,BIT (30 ) }, + [SCU0_RESET_H2X0 ] = { true,SCU0_RESET_CTRL1 ,BIT (31 ) }, + [SCU0_RESET_PORTA_VHUB ] = { true,SCU0_RESET_CTRL2 ,BIT (0 ) }, + [SCU0_RESET_PORTA_PHY3 ] = { true,SCU0_RESET_CTRL2 ,BIT (1 ) }, + [SCU0_RESET_PORTA_XHCI ] = { true,SCU0_RESET_CTRL2 ,BIT (2 ) }, + [SCU0_RESET_PORTB_VHUB ] = { true,SCU0_RESET_CTRL2 ,BIT (3 ) }, + [SCU0_RESET_PORTB_PHY3 ] = { true,SCU0_RESET_CTRL2 ,BIT (4 ) }, + [SCU0_RESET_PORTB_XHCI ] = { true,SCU0_RESET_CTRL2 ,BIT (5 ) }, + [SCU0_RESET_PORTA_VHUB_EHCI ] = { true,SCU0_RESET_CTRL2 ,BIT (6 ) }, + [SCU0_RESET_PORTB_VHUB_EHCI ] = { true,SCU0_RESET_CTRL2 ,BIT (7 ) }, + [SCU0_RESET_UHCI ] = { true,SCU0_RESET_CTRL2 ,BIT (8 ) }, + [SCU0_RESET_TSP ] = { true,SCU0_RESET_CTRL2 ,BIT (9 ) }, + [SCU0_RESET_E2M0 ] = { true,SCU0_RESET_CTRL2 ,BIT (10 ) }, + [SCU0_RESET_E2M1 ] = { true,SCU0_RESET_CTRL2 ,BIT (11 ) }, + [SCU0_RESET_VLINK ] = { true,SCU0_RESET_CTRL2 ,BIT (12 ) }, +}; + +static const struct ast2700_reset_signal ast2700_reset1_signals[] = { + [SCU1_RESET_LPC0 ] = { true,SCU1_RESET_CTRL1 ,BIT (0 ) }, + [SCU1_RESET_LPC1 ] = { true,SCU1_RESET_CTRL1 ,BIT (1 ) }, + [SCU1_RESET_MII ] = { true,SCU1_RESET_CTRL1 ,BIT (2 ) }, + [SCU1_RESET_PECI ] = { true,SCU1_RESET_CTRL1 ,BIT (3 ) }, + [SCU1_RESET_PWM ] = { true,SCU1_RESET_CTRL1 ,BIT (4 ) }, + [SCU1_RESET_MAC0 ] = { true,SCU1_RESET_CTRL1 ,BIT (5 ) }, + [SCU1_RESET_MAC1 ] = { true,SCU1_RESET_CTRL1 ,BIT (6 ) }, + [SCU1_RESET_MAC2 ] = { true,SCU1_RESET_CTRL1 ,BIT (7 ) }, + [SCU1_RESET_ADC ] = { true,SCU1_RESET_CTRL1 ,BIT (8 ) }, + [SCU1_RESET_SD ] = { true,SCU1_RESET_CTRL1 ,BIT (9 ) }, + [SCU1_RESET_ESPI0 ] = { true,SCU1_RESET_CTRL1 ,BIT (10 ) }, + [SCU1_RESET_ESPI1 ] = { true,SCU1_RESET_CTRL1 ,BIT (11 ) }, + [SCU1_RESET_JTAG1 ] = { true,SCU1_RESET_CTRL1 ,BIT (12 ) }, + [SCU1_RESET_SPI0 ] = { true,SCU1_RESET_CTRL1 ,BIT (13 ) }, + [SCU1_RESET_SPI1 ] = { true,SCU1_RESET_CTRL1 ,BIT (14 ) }, + [SCU1_RESET_SPI2 ] = { true,SCU1_RESET_CTRL1 ,BIT (15 ) }, + [SCU1_RESET_I3C0 ] = { true,SCU1_RESET_CTRL1 ,BIT (16 ) }, + [SCU1_RESET_I3C1 ] = { true,SCU1_RESET_CTRL1 ,BIT (17 ) }, + [SCU1_RESET_I3C2 ] = { true,SCU1_RESET_CTRL1 ,BIT (18 ) }, + [SCU1_RESET_I3C3 ] = { true,SCU1_RESET_CTRL1 ,BIT (19 ) }, + [SCU1_RESET_I3C4 ] = { true,SCU1_RESET_CTRL1 ,BIT (20 ) }, + [SCU1_RESET_I3C5 ] = { true,SCU1_RESET_CTRL1 ,BIT (21 ) }, + [SCU1_RESET_I3C6 ] = { true,SCU1_RESET_CTRL1 ,BIT (22 ) }, + [SCU1_RESET_I3C7 ] = { true,SCU1_RESET_CTRL1 ,BIT (23 ) }, + [SCU1_RESET_I3C8 ] = { true,SCU1_RESET_CTRL1 ,BIT (24 ) }, + [SCU1_RESET_I3C9 ] = { true,SCU1_RESET_CTRL1 ,BIT (25 ) }, + [SCU1_RESET_I3C10 ] = { true,SCU1_RESET_CTRL1 ,BIT (26 ) }, + [SCU1_RESET_I3C11 ] = { true,SCU1_RESET_CTRL1 ,BIT (27 ) }, + [SCU1_RESET_I3C12 ] = { true,SCU1_RESET_CTRL1 ,BIT (28 ) }, + [SCU1_RESET_I3C13 ] = { true,SCU1_RESET_CTRL1 ,BIT (29 ) }, + [SCU1_RESET_I3C14 ] = { true,SCU1_RESET_CTRL1 ,BIT (30 ) }, + [SCU1_RESET_I3C15 ] = { true,SCU1_RESET_CTRL1 ,BIT (31 ) }, + [SCU1_RESET_MCU0 ] = { true,SCU1_RESET_CTRL2 ,BIT (0 ) }, + [SCU1_RESET_MCU1 ] = { true,SCU1_RESET_CTRL2 ,BIT (1 ) }, + [SCU1_RESET_H2A_SPI1 ] = { true,SCU1_RESET_CTRL2 ,BIT (2 ) }, + [SCU1_RESET_H2A_SPI2 ] = { true,SCU1_RESET_CTRL2 ,BIT (3 ) }, + [SCU1_RESET_UART0 ] = { true,SCU1_RESET_CTRL2 ,BIT (4 ) }, + [SCU1_RESET_UART1 ] = { true,SCU1_RESET_CTRL2 ,BIT (5 ) }, + [SCU1_RESET_UART2 ] = { true,SCU1_RESET_CTRL2 ,BIT (6 ) }, + [SCU1_RESET_UART3 ] = { true,SCU1_RESET_CTRL2 ,BIT (7 ) }, + [SCU1_RESET_I2C_FILTER ] = { true,SCU1_RESET_CTRL2 ,BIT (8 ) }, + [SCU1_RESET_CALIPTRA ] = { true,SCU1_RESET_CTRL2 ,BIT (9 ) }, + [SCU1_RESET_XDMA ] = { true,SCU1_RESET_CTRL2 ,BIT (10 ) }, + [SCU1_RESET_FSI ] = { true,SCU1_RESET_CTRL2 ,BIT (12 ) }, + [SCU1_RESET_CAN ] = { true,SCU1_RESET_CTRL2 ,BIT (13 ) }, + [SCU1_RESET_MCTP ] = { true,SCU1_RESET_CTRL2 ,BIT (14 ) }, + [SCU1_RESET_I2C ] = { true,SCU1_RESET_CTRL2 ,BIT (15 ) }, + [SCU1_RESET_UART6 ] = { true,SCU1_RESET_CTRL2 ,BIT (16 ) }, + [SCU1_RESET_UART7 ] = { true,SCU1_RESET_CTRL2 ,BIT (17 ) }, + [SCU1_RESET_UART8 ] = { true,SCU1_RESET_CTRL2 ,BIT (18 ) }, + [SCU1_RESET_UART9 ] = { true,SCU1_RESET_CTRL2 ,BIT (19 ) }, + [SCU1_RESET_LTPI0 ] = { true,SCU1_RESET_CTRL2 ,BIT (20 ) }, + [SCU1_RESET_VGAL ] = { true,SCU1_RESET_CTRL2 ,BIT (21 ) }, + [SCU1_RESET_LTPI1 ] = { true,SCU1_RESET_CTRL2 ,BIT (22 ) }, + [SCU1_RESET_ACE ] = { true,SCU1_RESET_CTRL2 ,BIT (23 ) }, + [SCU1_RESET_E2M ] = { true,SCU1_RESET_CTRL2 ,BIT (24 ) }, + [SCU1_RESET_UHCI ] = { true,SCU1_RESET_CTRL2 ,BIT (25 ) }, + [SCU1_RESET_PORTC_USB2UART ] = { true,SCU1_RESET_CTRL2 ,BIT (26 ) }, + [SCU1_RESET_PORTC_VHUB_EHCI ] = { true,SCU1_RESET_CTRL2 ,BIT (27 ) }, + [SCU1_RESET_PORTD_USB2UART ] = { true,SCU1_RESET_CTRL2 ,BIT (28 ) }, + [SCU1_RESET_PORTD_VHUB_EHCI ] = { true,SCU1_RESET_CTRL2 ,BIT (29 ) }, + [SCU1_RESET_H2X ] = { true,SCU1_RESET_CTRL2 ,BIT (30 ) }, + [SCU1_RESET_I3CDMA ] = { true,SCU1_RESET_CTRL2 ,BIT (31 ) }, + [SCU1_RESET_PCIE2RST ] = { false,SCU1_PCIE3_CTRL ,BIT (0 ) }, +}; + +static inline struct aspeed_reset *to_aspeed_reset (struct reset_controller_dev *rcdev) +{ + return container_of(rcdev, struct aspeed_reset, rcdev); +} + +static int aspeed_reset_assert (struct reset_controller_dev *rcdev,unsigned long id) +{ +struct aspeed_reset *rc =to_aspeed_reset (rcdev); +void __iomem *reg_offset = rc->base + rc->info->signal[id].offset; + +if (rc->info->signal[id].dedicated_clr) { +writel (rc->info->signal[id].bit, reg_offset); + }else { +guard (spinlock_irqsave)(&rc->lock); +writel (readl (reg_offset) & ~rc->info->signal[id].bit, reg_offset); + } + +return 0 ; +} + +static int aspeed_reset_deassert (struct reset_controller_dev *rcdev,unsigned long id) +{ +struct aspeed_reset *rc =to_aspeed_reset (rcdev); +void __iomem *reg_offset = rc->base + rc->info->signal[id].offset; + +if (rc->info->signal[id].dedicated_clr) { +writel (rc->info->signal[id].bit, reg_offset +0x04 ); + }else { +guard (spinlock_irqsave)(&rc->lock); +writel (readl (reg_offset) | rc->info->signal[id].bit, reg_offset); + } + +return 0 ; +} + +static int aspeed_reset_status (struct reset_controller_dev *rcdev,unsigned long id) +{ +struct aspeed_reset *rc =to_aspeed_reset (rcdev); +void __iomem *reg_offset = rc->base + rc->info->signal[id].offset; + +return (readl (reg_offset) & rc->info->signal[id].bit) ?1 :0 ; +} + +static const struct reset_control_ops aspeed_reset_ops = { + .assert = aspeed_reset_assert, + .deassert = aspeed_reset_deassert, + .status = aspeed_reset_status, +}; + +static int aspeed_reset_probe (struct auxiliary_device *adev, +const struct auxiliary_device_id *id) +{ +struct aspeed_reset *reset; +struct device *dev = &adev->dev; + + reset =devm_kzalloc (dev,sizeof (*reset),GFP_KERNEL ); +if (!reset) +return -ENOMEM ; + +spin_lock_init (&reset->lock); + + reset->info = (struct aspeed_reset_info *)id->driver_data;
drivers/reset/reset-aspeed.c line 225
Quoted 10 lines
drivers/reset/reset-aspeed.c new file +10
-0+ reset->rcdev.owner =THIS_MODULE ; + reset->rcdev.nr_resets = reset->info->nr_resets; + reset->rcdev.ops = &aspeed_reset_ops; + reset->rcdev.of_node = dev->parent->of_node; + reset->rcdev.dev = dev; + reset->rcdev.of_reset_n_cells =1 ; + reset->base = (void __iomem *)adev->dev.platform_data; + +if (!reset->base) +return -ENOMEM ;
Looks like this should be -EINVAL to me.
If aspeed_reset_controller_register() is moved into the reset driver, like it is done in reset-mpfs, this check could be dropped completely.
With these issues addressed,
regards
Philipp
Ryan Chen
maintainerPATCH v5 3/3 clk: aspeed: add AST2700 clock driver.
In reply to Ryan ChenAdd AST2700 clock controller driver and also use axiliary device framework register the reset controller driver. Due to clock and reset using the same register region.
--- drivers/clk/Kconfig | 8 + drivers/clk/Makefile | 1 + drivers/clk/clk-ast2700.c | 1554 +++++++++++++++++++++++++++++++++++++ 3 files changed, 1563 insertions(+) create mode 100644 drivers/clk/clk-ast2700.c
drivers/clk/Kconfig +8 -0
@@ -269,6 +269,14 @@ config COMMON_CLK_ASPEED The G4 and G5 series, including the ast2400 and ast2500, are supported by this driver. +config COMMON_CLK_AST2700 + bool "Clock driver for AST2700 SoC" + depends on ARCH_ASPEED || COMPILE_TEST + help + This driver provides support for clock on AST2700 SoC. + The driver is responsible for managing the various clocks required + by the peripherals and cores within the AST2700. + config COMMON_CLK_S2MPS11 tristate "Clock driver for S2MPS1X/S5M8767 MFD" depends on MFD_SEC_CORE || COMPILE_TEST
drivers/clk/Makefile +1 -0
@@ -38,6 +38,7 @@ obj-$(CONFIG_COMMON_CLK_FSL_SAI) += clk-fsl-sai.o obj-$(CONFIG_COMMON_CLK_GEMINI) += clk-gemini.o obj-$(CONFIG_COMMON_CLK_ASPEED) += clk-aspeed.o obj-$(CONFIG_MACH_ASPEED_G6) += clk-ast2600.o +obj-$(CONFIG_COMMON_CLK_AST2700) += clk-ast2700.o obj-$(CONFIG_ARCH_HIGHBANK) += clk-highbank.o obj-$(CONFIG_CLK_HSDK) += clk-hsdk-pll.o obj-$(CONFIG_COMMON_CLK_K210) += clk-k210.o
drivers/clk/clk-ast2700.c new file +1554 -0
1,554 lines not on this page · raw message
Signature · 1 line
2.34.1
Philipp Zabel
maintainerRe: [PATCH v5 3/3] clk: aspeed: add AST2700 clock driver.
Quoted 12 lines · Ryan Chen
Add AST2700 clock controller driver and also use axiliary device framework register the reset controller driver. Due to clock and reset using the same register region.
Signed-off-by Ryan Chen <[email protected]>--- drivers/clk/Kconfig | 8 + drivers/clk/Makefile | 1 + drivers/clk/clk-ast2700.c | 1554 +++++++++++++++++++++++++++++++++++++ 3 files changed, 1563 insertions(+) create mode 100644 drivers/clk/clk-ast2700.c
[...]
Quoted 6 lines
drivers/clk/clk-ast2700.c new file +0
-0@@ -0,0 +1,1554 @@
[...]
Quoted 36 lines
drivers/clk/clk-ast2700.c new file +36
-0+static void aspeed_reset_unregister_adev (void *_adev) +{ +struct auxiliary_device *adev = _adev; + +auxiliary_device_delete (adev); +auxiliary_device_uninit (adev); +} + +static void aspeed_reset_adev_release (struct device *dev) +{ +struct auxiliary_device *adev =to_auxiliary_dev (dev); + +kfree (adev); +} + +static int aspeed_reset_controller_register (struct device *clk_dev, +void __iomem *base,const char *adev_name) +{ +struct auxiliary_device *adev; +int ret; + + adev =kzalloc (sizeof (*adev),GFP_KERNEL ); +if (!adev) +return -ENOMEM ; + + adev->name = adev_name; + adev->dev.parent = clk_dev; + adev->dev.release = aspeed_reset_adev_release; + adev->id =666u ; + + ret =auxiliary_device_init (adev); +if (ret) { +kfree (adev); +return ret; + } +
drivers/clk/clk-ast2700.c line 1435
Quoted 10 lines
drivers/clk/clk-ast2700.c new file +10
-0+ ret =auxiliary_device_add (adev); +if (ret) { +auxiliary_device_uninit (adev); +return ret; + } + + adev->dev.platform_data = (__force void *)base; + +return devm_add_action_or_reset (clk_dev, aspeed_reset_unregister_adev, adev); +}
Should this be moved into reset-aspeed.c?
regards
Philipp
Ryan Chen
maintainerRE: [PATCH v5 3/3] clk: aspeed: add AST2700 clock driver.
Quoted 60 lines
Subject: Re: [PATCH v5 3/3] clk: aspeed: add AST2700 clock driver.
Quoted 13 lines · Ryan Chen
Add AST2700 clock controller driver and also use axiliary device framework register the reset controller driver.
Due to clock and reset using the same register region.Signed-off-by Ryan Chen <[email protected]>--- drivers/clk/Kconfig | 8 + drivers/clk/Makefile | 1 + drivers/clk/clk-ast2700.c | 1554 +++++++++++++++++++++++++++++++++++++ 3 files changed, 1563 insertions(+) create mode 100644 drivers/clk/clk-ast2700.c[...]
Quoted 5 lines
drivers/clk/clk-ast2700.c new renamed from drivers/clk/clk-ast2700.c +0
-0file mode 100644 index 000000000000..ef1f939b1c9f
drivers/clk/clk-ast2700.c new file +0
-0@@ -0,0 +1,1554 @@[...]
Quoted 37 lines
drivers/clk/clk-ast2700.c new file +37
-0+static void aspeed_reset_unregister_adev (void *_adev) { +struct auxiliary_device *adev = _adev; + +auxiliary_device_delete (adev); +auxiliary_device_uninit (adev); +} + +static void aspeed_reset_adev_release (struct device *dev) { +struct auxiliary_device *adev =to_auxiliary_dev (dev); + +kfree (adev); +} + +static int aspeed_reset_controller_register (struct device *clk_dev, +void __iomem *base,const char *adev_name) { +struct auxiliary_device *adev; +int ret; + + adev =kzalloc (sizeof (*adev),GFP_KERNEL ); +if (!adev) +return -ENOMEM ; + + adev->name = adev_name; + adev->dev.parent = clk_dev; + adev->dev.release = aspeed_reset_adev_release; + adev->id =666u ; + + ret =auxiliary_device_init (adev); +if (ret) { +kfree (adev); +return ret; + } + + ret =auxiliary_device_add (adev); +if (ret) { +auxiliary_device_uninit (adev); +return ret;
Quoted 8 lines
drivers/clk/clk-ast2700.c
Quoted 6 lines
drivers/clk/clk-ast2700.c new file +6
-0+ } + + adev->dev.platform_data = (__force void *)base; + +return devm_add_action_or_reset (clk_dev, +aspeed_reset_unregister_adev, adev); }Should this be moved into
reset-aspeed.c?
If move to reset-aspeed.c that will have EXPORT_SYMBOL_GPL(aspeed_reset_controller_register); And add one header ./drivers/reset/reset-aspeed.h.
That is expected? Am I right?
Quoted 3 lines
regards
Philipp