soc: sunxi: sram: Add H616 SRAM support
Subsystems (2)
Chen-Yu Tsai
maintainercover soc: sunxi: sram: Add H616 SRAM support
Hi,
The Allwinner H616 has two switchable peripheral SRAM regions:
- The VE SRAM is a 2 MB dedicated SRAM for the Video Engine. CPU access to this region is enabled by default. CPU access can be disabled, after which reads will show the same stale value for all addresses, while writes are ignored.
The mux value for this region is different from previous generations.
- The SRAM C region is an alias of the first 128 KB of VE SRAM, plus 64 KB of DE SRAM. The latter is otherwise unaccessible from the CPU. When CPU access is disabled, the whole region reads as zero, while writes are ignored.
The mux value for this region is the same as on the A64 and H6.
The driver needs to allow both the Video Engine and Display Engine to claim the SRAM C region at the same time.
At the same time, since the Video Engine needs to claim both SRAM regions, the Allwinner SRAM consumer interface needs to support claiming multiple regions for one consumer.
Patch 1 adds a compatible for the new H616 VE SRAM to the common SRAM binding.
Patch 2 adds a compatible for the new H616 VE SRAM to the Allwinner SRAM binding.
Patch 3 is a minor cleanup that const-ifies the SRAM related hardware description data in the driver.
Patch 4 implements support for multiple hardware block drivers to claim the same SRAM region.
Patch 5 implements support for one consumer to claim multiple SRAM regions.
Patch 6 adds support for the H616 VE SRAM region to the SRAM driver.
Patch 7 adds the SRAM regions to the H616 dtsi file. This was picked from Jernej's tree and split into one patch for SRAM and one patch for the video engine.
I think all the changes can go through the sunxi tree, unless the device tree maintainers want to take the first patch separately?
The new users of this, support for the H616 video engine, will be sent separately.
Thanks
ChenYu
Chen-Yu Tsai (6):
dt-bindings: sram: Document Allwinner H616 VE SRAM
dt-bindings: sram: sunxi-sram: Add H616 SRAM regions
soc: sunxi: sram: Const-ify sunxi_sram_func data and references
soc: sunxi: sram: Allow SRAM to be claimed multiple times
soc: sunxi: sram: Support claiming multiple regions per device
soc: sunxi: sram: Add H616 SRAM regions
Jernej Skrabec (1):
arm64: dts: allwinner: sun50i-h616: Add SRAM nodes
.../allwinner,sun4i-a10-system-control.yaml | 5 +- .../devicetree/bindings/sram/sram.yaml | 1 + .../arm64/boot/dts/allwinner/sun50i-h616.dtsi | 28 ++- drivers/soc/sunxi/sunxi_sram.c | 196 +++++++++++------- 4 files changed, 151 insertions(+), 79 deletions(-)
Signature · 1 line
2.47.3
Chen-Yu Tsai
maintainerPATCH 1/7 dt-bindings: sram: Document Allwinner H616 VE SRAM
The Allwinner H616 has two switchable peripheral SRAM regions:
- The VE SRAM is a 2 MB dedicated SRAM for the Video Engine. CPU access to this region is enabled by default. CPU access can be disabled, after which reads will show the same stale value for all addresses, while writes are ignored.
The mux value for this region is different from previous generations, and thus needs a completely new compatible.
- The SRAM C region is an alias of the first 128 KB of VE SRAM, plus 64 KB of DE SRAM. The latter is otherwise unaccessible from the CPU. When CPU access is disabled, the whole region reads as zero, while writes are ignored.
The mux value for this region is the same as on the A64 and H6. The existing compatible for the A64 already covers this.
Add the compatible for the VE SRAM to the list of covered compatibles in the generic SRAM region binding.
--- Documentation/devicetree/bindings/sram/sram.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/sram/sram.yaml +1 -0
@@ -81,6 +81,7 @@ patternProperties: - allwinner,sun4i-a10-sram-d - allwinner,sun9i-a80-smp-sram - allwinner,sun50i-a64-sram-c + - allwinner,sun50i-h616-ve-sram - amlogic,meson8-ao-arc-sram - amlogic,meson8b-ao-arc-sram - amlogic,meson8-smp-sram
Signature · 1 line
2.47.3
Re: [PATCH 1/7] dt-bindings: sram: Document Allwinner H616 VE SRAM
Dne torek, 24. marec 2026 ob 17:43:49 Srednjeevropski standardni čas je Chen-Yu Tsai napisal(a):
Quoted 15 lines
The Allwinner H616 has two switchable peripheral SRAM regions:
- The VE SRAM is a 2 MB dedicated SRAM for the Video Engine. CPU access to this region is enabled by default. CPU access can be disabled, after which reads will show the same stale value for all addresses, while writes are ignored.
The mux value for this region is different from previous generations, and thus needs a completely new compatible.
- The SRAM C region is an alias of the first 128 KB of VE SRAM, plus 64 KB of DE SRAM. The latter is otherwise unaccessible from the CPU. When CPU access is disabled, the whole region reads as zero, while writes are ignored.
Quoted 7 lines
The mux value for this region is the same as on the A64 and H6. The existing compatible for the A64 already covers this.
Add the compatible for the VE SRAM to the list of covered compatibles in the generic SRAM region binding.
Signed-off-by Chen-Yu Tsai <[email protected]>
Best regards,
Jernej
Re: [PATCH 1/7] dt-bindings: sram: Document Allwinner H616 VE SRAM
In reply to Chen-Yu TsaiQuoted 18 lines · Chen-Yu Tsai
The Allwinner H616 has two switchable peripheral SRAM regions:
- The VE SRAM is a 2 MB dedicated SRAM for the Video Engine. CPU access to this region is enabled by default. CPU access can be disabled, after which reads will show the same stale value for all addresses, while writes are ignored.
The mux value for this region is different from previous generations, and thus needs a completely new compatible.
- The SRAM C region is an alias of the first 128 KB of VE SRAM, plus 64 KB of DE SRAM. The latter is otherwise unaccessible from the CPU. When CPU access is disabled, the whole region reads as zero, while writes are ignored.
The mux value for this region is the same as on the A64 and H6. The existing compatible for the A64 already covers this.
Quoted 8 lines
Add the compatible for the VE SRAM to the list of covered compatibles in the generic SRAM region binding.
Signed-off-by Chen-Yu Tsai <[email protected]>--- Documentation/devicetree/bindings/sram/sram.yaml | 1 + 1 file changed, 1 insertion(+)
Chen-Yu Tsai
maintainerPATCH 2/7 dt-bindings: sram: sunxi-sram: Add H616 SRAM regions
In reply to Chen-Yu TsaiThe Allwinner H616 has two switchable peripheral SRAM regions:
- The VE SRAM is a 2 MB dedicated SRAM for the Video Engine. CPU access to this region is enabled by default. CPU access can be disabled, after which reads will show the same stale value for all addresses, while writes are ignored.
The mux value for this region is different from previous generations.
- The SRAM C region is an alias of the first 128 KB of VE SRAM, plus 64 KB of DE SRAM. The latter is otherwise unaccessible from the CPU. When CPU access is disabled, the whole region reads as zero, while writes are ignored.
The mux value for this region is the same as on the A64 and H6.
Add compatible strings for both of them.
--- .../bindings/sram/allwinner,sun4i-a10-system-control.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/sram/allwinner,sun4i-a10-system-control.yaml +4 -1
@@ -80,6 +80,7 @@ patternProperties: - const: allwinner,sun4i-a10-sram-c1 - const: allwinner,sun4i-a10-sram-d - const: allwinner,sun50i-a64-sram-c + - const: allwinner,sun50i-h616-ve-sram - items: - enum: - allwinner,sun5i-a13-sram-a3-a4
@@ -103,7 +104,9 @@ patternProperties: - allwinner,sun7i-a20-sram-d - const: allwinner,sun4i-a10-sram-d - items: - - const: allwinner,sun50i-h6-sram-c + - enum: + - allwinner,sun50i-h6-sram-c + - allwinner,sun50i-h616-sram-c - const: allwinner,sun50i-a64-sram-c required:
Signature · 1 line
2.47.3
Re: [PATCH 2/7] dt-bindings: sram: sunxi-sram: Add H616 SRAM regions
Dne torek, 24. marec 2026 ob 17:43:50 Srednjeevropski standardni čas je Chen-Yu Tsai napisal(a):
Quoted 14 lines
The Allwinner H616 has two switchable peripheral SRAM regions:
- The VE SRAM is a 2 MB dedicated SRAM for the Video Engine. CPU access to this region is enabled by default. CPU access can be disabled, after which reads will show the same stale value for all addresses, while writes are ignored.
The mux value for this region is different from previous generations.
- The SRAM C region is an alias of the first 128 KB of VE SRAM, plus 64 KB of DE SRAM. The latter is otherwise unaccessible from the CPU. When CPU access is disabled, the whole region reads as zero, while writes are ignored.
Quoted 5 lines
The mux value for this region is the same as on the A64 and H6.
Add compatible strings for both of them.
Signed-off-by Chen-Yu Tsai <[email protected]>
Best regards,
Jernej
Re: [PATCH 2/7] dt-bindings: sram: sunxi-sram: Add H616 SRAM regions
In reply to Chen-Yu TsaiQuoted 14 lines · Chen-Yu Tsai
The Allwinner H616 has two switchable peripheral SRAM regions:
- The VE SRAM is a 2 MB dedicated SRAM for the Video Engine. CPU access to this region is enabled by default. CPU access can be disabled, after which reads will show the same stale value for all addresses, while writes are ignored.
The mux value for this region is different from previous generations.
- The SRAM C region is an alias of the first 128 KB of VE SRAM, plus 64 KB of DE SRAM. The latter is otherwise unaccessible from the CPU. When CPU access is disabled, the whole region reads as zero, while writes are ignored.
Quoted 9 lines
The mux value for this region is the same as on the A64 and H6.
Add compatible strings for both of them.
Signed-off-by Chen-Yu Tsai <[email protected]>--- .../bindings/sram/allwinner,sun4i-a10-system-control.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Chen-Yu Tsai
maintainerPATCH 3/7 soc: sunxi: sram: Const-ify sunxi_sram_func data and references
In reply to Chen-Yu Tsaisunxi_sram_func contains value mapping that do not change at runtime.
Const-ify them.
--- drivers/soc/sunxi/sunxi_sram.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/soc/sunxi/sunxi_sram.c +8 -8
@@ -29,11 +29,11 @@ struct sunxi_sram_func { };struct sunxi_sram_data { -char *name; -u8 reg; -u8 offset; -u8 width; -struct sunxi_sram_func *func; +char *name; +u8 reg; +u8 offset; +u8 width; +const struct sunxi_sram_func *func; };struct sunxi_sram_desc {
@@ -54,7 +54,7 @@ struct sunxi_sram_desc { .reg = _reg, \ .offset = _off, \ .width = _width, \ - .func = (struct sunxi_sram_func[]){ \ + .func = (const struct sunxi_sram_func[]){ \ __VA_ARGS__, { } }, \ }
@@ -111,7 +111,7 @@ static int sunxi_sram_show(struct seq_file *s, void *data)struct device_node *sram_node, *section_node;const struct sunxi_sram_data *sram_data;const struct of_device_id *match; -struct sunxi_sram_func *func; +const struct sunxi_sram_func *func;const __be32 *sram_addr_p, *section_addr_p;u32 val;
@@ -169,7 +169,7 @@ static const struct sunxi_sram_data *sunxi_sram_of_parse(struct device_node *nod {const struct of_device_id *match;const struct sunxi_sram_data *data; -struct sunxi_sram_func *func; +const struct sunxi_sram_func *func;struct of_phandle_args args;u8 val;int ret;
Signature · 1 line
2.47.3
Re: [PATCH 3/7] soc: sunxi: sram: Const-ify sunxi_sram_func data and references
Dne torek, 24. marec 2026 ob 17:43:51 Srednjeevropski standardni čas je Chen-Yu Tsai napisal(a):
Quoted 5 lines
sunxi_sram_funccontains value mapping that do not change at runtime.Const-ify them.
Signed-off-by Chen-Yu Tsai <[email protected]>
Best regards,
Jernej
Chen-Yu Tsai
maintainerPATCH 4/7 soc: sunxi: sram: Allow SRAM to be claimed multiple times
In reply to Chen-Yu TsaiOn the H616, the SRAM C region is an alias mapping to part of the VE SRAM (accessible in whole at a different address) and part of the DE SRAM (otherwise unaccessible). As such both the VE and DE need to claim this SRAM region to prevent access from the CPU.
The SRAM claim API is designed so that a "claim" routes the SRAM to the peripheral device, disabling access from the CPU. So long as the written register value is the same for all the claimants involved, allowing multiple or repeated claims is trivial. This is indeed the case for all supported SRAM regions. The only known SRAM region to have multiple different settings is the SRAM C2 region; this can be claimed by the AE, CE, or ACE (assumed to be AE + CE). This region is not supported, and likely will never be needed nor supported, as there is no documentation for the peripherals involved.
Change the SRAM region "claimed" field from a boolean to a reference count. A claim will increment the count, while a release decreases it. The first claim will trigger the register value write. The driver otherwise behaves as before.
--- drivers/soc/sunxi/sunxi_sram.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
drivers/soc/sunxi/sunxi_sram.c +9 -5
@@ -12,6 +12,7 @@#include <linux/debugfs.h> #include <linux/io.h> +#include <linux/limits.h> #include <linux/mfd/syscon.h> #include <linux/module.h> #include <linux/of.h>
@@ -38,7 +39,7 @@ struct sunxi_sram_data {struct sunxi_sram_desc {struct sunxi_sram_data data; -bool claimed; +u8 claim_cnt; };#define SUNXI_SRAM_MAP (_reg_val, _val, _func) \
@@ -244,9 +245,11 @@ int sunxi_sram_claim(struct device *dev)spin_lock (&sram_lock); -if (sram_desc->claimed) { +if (sram_desc->claim_cnt) { +if (!WARN_ON (sram_desc->claim_cnt ==U8_MAX )) + sram_desc->claim_cnt++;spin_unlock (&sram_lock); -return -EBUSY ; +return 0 ; } mask = GENMASK(sram_data->offset + sram_data->width - 1,
@@ -256,7 +259,7 @@ int sunxi_sram_claim(struct device *dev)writel (val | ((device << sram_data->offset) & mask), base + sram_data->reg); - sram_desc->claimed = true; + sram_desc->claim_cnt++;spin_unlock (&sram_lock);return 0 ;
@@ -278,7 +281,8 @@ void sunxi_sram_release(struct device *dev) sram_desc =to_sram_desc (sram_data);spin_lock (&sram_lock); - sram_desc->claimed = false; +if (!WARN_ON (sram_desc->claim_cnt ==0 )) + sram_desc->claim_cnt--;spin_unlock (&sram_lock); }EXPORT_SYMBOL (sunxi_sram_release);
Signature · 1 line
2.47.3
Re: [PATCH 4/7] soc: sunxi: sram: Allow SRAM to be claimed multiple times
Dne torek, 24. marec 2026 ob 17:43:52 Srednjeevropski standardni čas je Chen-Yu Tsai napisal(a):
Quoted 15 lines
On the H616, the SRAM C region is an alias mapping to part of the VE SRAM (accessible in whole at a different address) and part of the DE SRAM (otherwise unaccessible). As such both the VE and DE need to claim this SRAM region to prevent access from the CPU.
The SRAM claim API is designed so that a "claim" routes the SRAM to the peripheral device, disabling access from the CPU. So long as the written register value is the same for all the claimants involved, allowing multiple or repeated claims is trivial. This is indeed the case for all supported SRAM regions. The only known SRAM region to have multiple different settings is the SRAM C2 region; this can be claimed by the AE, CE, or ACE (assumed to be AE + CE). This region is not supported, and likely will never be needed nor supported, as there is no documentation for the peripherals involved.
Quoted 6 lines
Change the SRAM region "claimed" field from a boolean to a reference count. A claim will increment the count, while a release decreases it. The first claim will trigger the register value write. The driver otherwise behaves as before.
Signed-off-by Chen-Yu Tsai <[email protected]>
Best regards,
Jernej
Chen-Yu Tsai
maintainerPATCH 5/7 soc: sunxi: sram: Support claiming multiple regions per device
In reply to Chen-Yu TsaiOn the H616, the video engine needs to claim two SRAM regions.
Support claiming multiple regions per device.
--- drivers/soc/sunxi/sunxi_sram.c | 164 +++++++++++++++++++-------------- 1 file changed, 96 insertions(+), 68 deletions(-)
drivers/soc/sunxi/sunxi_sram.c +96 -68
@@ -165,79 +165,48 @@ static inline struct sunxi_sram_desc *to_sram_desc(const struct sunxi_sram_data return container_of(data, struct sunxi_sram_desc, data); } -static const struct sunxi_sram_data *sunxi_sram_of_parse (struct device_node *node, -unsigned int *reg_value) +static const struct sunxi_sram_data *sunxi_sram_get_match (struct device_node *np,u8 val, +unsigned int *reg_value) {const struct of_device_id *match;const struct sunxi_sram_data *data;const struct sunxi_sram_func *func; -struct of_phandle_args args; -u8 val; -int ret; - - ret =of_parse_phandle_with_fixed_args (node,"allwinner,sram" ,1 ,0 , - &args); -if (ret) -return ERR_PTR (ret); -if (!of_device_is_available (args.np)) { - ret = -EBUSY ; - goto err; - } +if (!of_device_is_available (np)) +return ERR_PTR (-ENODEV ); - val = args.args[0 ]; - - match =of_match_node (sunxi_sram_dt_ids, args.np); -if (!match) { - ret = -EINVAL ; - goto err; - } + match =of_match_node (sunxi_sram_dt_ids, np); +if (!match) +return ERR_PTR (-ENODEV ); data = match->data; -if (!data) { - ret = -EINVAL ; - goto err; - } - -for (func = data->func; func->func; func++) { -if (val == func->val) { -if (reg_value) - *reg_value = func->reg_val; +if (!data) +return ERR_PTR (-EINVAL ); +for (func = data->func; func->func; func++) +if (val == func->val)break ; - } - } -if (!func->func) { - ret = -EINVAL ; - goto err; - } +if (!func->func) +return ERR_PTR (-EINVAL ); -of_node_put (args.np); -return match->data; +if (reg_value) + *reg_value = func->reg_val; -err: -of_node_put (args.np); -return ERR_PTR (ret); +return data; } -int sunxi_sram_claim (struct device *dev) +#define SUNXI_SRAM_PROP "allwinner,sram" +#define SUNXI_SRAM_CELLS 1 + +static int sunxi_sram_claim_one (struct device_node *np,u8 arg) {const struct sunxi_sram_data *sram_data;struct sunxi_sram_desc *sram_desc;unsigned int device;u32 val, mask; -if (IS_ERR (base)) -return PTR_ERR (base); - -if (!base) -return -EPROBE_DEFER ; - -if (!dev || !dev->of_node) -return -EINVAL ; - - sram_data =sunxi_sram_of_parse (dev->of_node, &device); + sram_data =sunxi_sram_get_match (np, arg, &device);if (IS_ERR (sram_data))return PTR_ERR (sram_data);
@@ -248,33 +217,28 @@ int sunxi_sram_claim(struct device *dev)if (sram_desc->claim_cnt) {if (!WARN_ON (sram_desc->claim_cnt ==U8_MAX )) sram_desc->claim_cnt++; -spin_unlock (&sram_lock); -return 0 ; + }else { + mask =GENMASK (sram_data->offset + sram_data->width -1 , + sram_data->offset); + val =readl (base + sram_data->reg); + val &= ~mask; +writel (val | ((device << sram_data->offset) & mask), + base + sram_data->reg); + + sram_desc->claim_cnt++; } - mask =GENMASK (sram_data->offset + sram_data->width -1 , - sram_data->offset); - val =readl (base + sram_data->reg); - val &= ~mask; -writel (val | ((device << sram_data->offset) & mask), - base + sram_data->reg); - - sram_desc->claim_cnt++;spin_unlock (&sram_lock);return 0 ; } -EXPORT_SYMBOL (sunxi_sram_claim); -void sunxi_sram_release (struct device *dev) +static void sunxi_sram_release_one (struct device_node *np,u8 arg) {const struct sunxi_sram_data *sram_data;struct sunxi_sram_desc *sram_desc; -if (!dev || !dev->of_node) -return ; - - sram_data =sunxi_sram_of_parse (dev->of_node,NULL ); + sram_data =sunxi_sram_get_match (np, arg,NULL );if (IS_ERR (sram_data))return ;
@@ -285,6 +249,70 @@ void sunxi_sram_release(struct device *dev) sram_desc->claim_cnt--;spin_unlock (&sram_lock); } + +int sunxi_sram_claim (struct device *dev) +{ +struct of_phandle_iterator it; +int err; +int count =0 ; + +if (IS_ERR (base)) +return PTR_ERR (base); + +if (!base) +return -EPROBE_DEFER ; + +if (!dev || !dev->of_node) +return -EINVAL ; + +of_for_each_phandle (&it, err, dev->of_node,SUNXI_SRAM_PROP , +NULL ,SUNXI_SRAM_CELLS ) { +u32 args[SUNXI_SRAM_CELLS ]; + +of_phandle_iterator_args (&it, args,SUNXI_SRAM_CELLS ); + + err =sunxi_sram_claim_one (it.node, args[0 ]); +if (err) + goto err; + + count++; + } + +if (count ==0 ) +return -ENOENT ; + +return 0 ; + +err: +while (count--) { +struct of_phandle_args args; + +of_parse_phandle_with_fixed_args (dev->of_node,SUNXI_SRAM_PROP , +SUNXI_SRAM_CELLS , count, &args); +sunxi_sram_release_one (args.np, args.args[0 ]); + } + +return err; +} +EXPORT_SYMBOL (sunxi_sram_claim); + +void sunxi_sram_release (struct device *dev) +{ +struct of_phandle_iterator it; +int err; + +if (!dev || !dev->of_node) +return ; + +of_for_each_phandle (&it, err, dev->of_node,SUNXI_SRAM_PROP , +NULL ,SUNXI_SRAM_CELLS ) { +u32 args[SUNXI_SRAM_CELLS ]; + +of_phandle_iterator_args (&it, args,SUNXI_SRAM_CELLS ); + +sunxi_sram_release_one (it.node, args[0 ]); + } +}EXPORT_SYMBOL (sunxi_sram_release);struct sunxi_sramc_variant {
Signature · 1 line
2.47.3
Re: [PATCH 5/7] soc: sunxi: sram: Support claiming multiple regions per device
Dne torek, 24. marec 2026 ob 17:43:53 Srednjeevropski standardni čas je Chen-Yu Tsai napisal(a):
Quoted 5 lines
On the H616, the video engine needs to claim two SRAM regions.
Support claiming multiple regions per device.
Signed-off-by Chen-Yu Tsai <[email protected]>
Best regards,
Jernej
Chen-Yu Tsai
maintainerPATCH 6/7 soc: sunxi: sram: Add H616 SRAM regions
In reply to Chen-Yu TsaiThe Allwinner H616 has two switchable peripheral SRAM regions:
- The VE SRAM is a 2 MB dedicated SRAM for the Video Engine. CPU access to this region is enabled by default. CPU access can be disabled, after which reads will show the same stale value for all addresses, while writes are ignored.
The mux value for this region is different from previous generations.
- The SRAM C region is an alias of the first 128 KB of VE SRAM, plus 64 KB of DE SRAM. The latter is otherwise unaccessible from the CPU. When CPU access is disabled, the whole region reads as zero, while writes are ignored.
The mux value for this region is the same as on the A64 and H6.
Add data for the VE SRAM. The register values were taken from the BSP vendor kernel.
--- drivers/soc/sunxi/sunxi_sram.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/soc/sunxi/sunxi_sram.c +10 -0
@@ -83,6 +83,12 @@ static struct sunxi_sram_desc sun50i_a64_sram_c = { SUNXI_SRAM_MAP(0, 1, "de2")), }; +static struct sunxi_sram_desc sun50i_h616_ve_sram = { + .data =SUNXI_SRAM_DATA ("VE" ,0x0 ,0 ,1 , +SUNXI_SRAM_MAP (1 ,0 ,"cpu" ), +SUNXI_SRAM_MAP (0 ,1 ,"ve" )), +}; +static const struct of_device_id sunxi_sram_dt_ids[] = { { .compatible ="allwinner,sun4i-a10-sram-a3-a4" ,
@@ -100,6 +106,10 @@ static const struct of_device_id sunxi_sram_dt_ids[] = { .compatible = "allwinner,sun50i-a64-sram-c", .data = &sun50i_a64_sram_c.data, }, + { + .compatible = "allwinner,sun50i-h616-ve-sram", + .data = &sun50i_h616_ve_sram.data, + }, {} };
Signature · 1 line
2.47.3
Re: [PATCH 6/7] soc: sunxi: sram: Add H616 SRAM regions
Dne torek, 24. marec 2026 ob 17:43:54 Srednjeevropski standardni čas je Chen-Yu Tsai napisal(a):
Quoted 14 lines
The Allwinner H616 has two switchable peripheral SRAM regions:
- The VE SRAM is a 2 MB dedicated SRAM for the Video Engine. CPU access to this region is enabled by default. CPU access can be disabled, after which reads will show the same stale value for all addresses, while writes are ignored.
The mux value for this region is different from previous generations.
- The SRAM C region is an alias of the first 128 KB of VE SRAM, plus 64 KB of DE SRAM. The latter is otherwise unaccessible from the CPU. When CPU access is disabled, the whole region reads as zero, while writes are ignored.
Quoted 6 lines
The mux value for this region is the same as on the A64 and H6.
Add data for the VE SRAM. The register values were taken from the BSP vendor kernel.
Signed-off-by Chen-Yu Tsai <[email protected]>
Best regards,
Jernej
Chen-Yu Tsai
maintainerPATCH 7/7 arm64: dts: allwinner: sun50i-h616: Add SRAM nodes
In reply to Chen-Yu TsaiFrom: Jernej Skrabec <[email protected]>
The H616 SoC has a video engine, and two SRAM regions needed by it.
Add the SRAM regions to the dtsi file. The video engine will be added in a separate change.
--- .../arm64/boot/dts/allwinner/sun50i-h616.dtsi | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi +27 -1
@@ -182,12 +182,38 @@ syscon: syscon@3000000 { #size-cells = <1>; ranges; - sram_c: sram@28000 { + /* SRAM C */ + sram@28000 { compatible = "mmio-sram"; reg = <0x00028000 0x30000>; #address-cells = <1>; #size-cells = <1>; ranges = <0 0x00028000 0x30000>; + + /* + * 0x0 ~ 0x20000 is partial alias of VE SRAM below. + * 0x20000 ~ 0x2ffff is (partial?) alias of DE SRAM. + * However the whole region is toggled together. + */ + sram_c: sram-section@0 { + compatible = "allwinner,sun50i-h616-sram-c", + "allwinner,sun50i-a64-sram-c"; + reg = <0x00000 0x30000>; + }; + }; + + /* VE SRAM */ + sram@1a00000 { + compatible = "mmio-sram"; + reg = <0x01a00000 0x200000>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0x01a00000 0x200000>; + + ve_sram: sram-section@0 { + compatible = "allwinner,sun50i-h616-ve-sram"; + reg = <0x000000 0x200000>; + }; }; };
Signature · 1 line
2.47.3
Re: [PATCH 7/7] arm64: dts: allwinner: sun50i-h616: Add SRAM nodes
Dne torek, 24. marec 2026 ob 17:43:55 Srednjeevropski standardni čas je Chen-Yu Tsai napisal(a):
Quoted 10 lines
From: Jernej Skrabec <[email protected]>
The H616 SoC has a video engine, and two SRAM regions needed by it.
Add the SRAM regions to the dtsi file. The video engine will be added in a separate change.
Signed-off-by Jernej Skrabec <[email protected]>[[email protected]: Add VE SRAM region, commit message, and split into two]Signed-off-by Chen-Yu Tsai <[email protected]>
Best regards,
Jernej
Chen-Yu Tsai
maintainerRe: (subset) [PATCH 0/7] soc: sunxi: sram: Add H616 SRAM support
In reply to Chen-Yu TsaiQuoted 8 lines · Chen-Yu Tsai
The Allwinner H616 has two switchable peripheral SRAM regions:
- The VE SRAM is a 2 MB dedicated SRAM for the Video Engine. CPU access to this region is enabled by default. CPU access can be disabled, after which reads will show the same stale value for all addresses, while writes are ignored.
[...]
Applied to sunxi/drivers-for-7.2 in local tree, thanks!
[7/7] arm64: dts: allwinner: sun50i-h616: Add SRAM nodes
(no commit info)
Best regards,
Signature · 1 line
Chen-Yu Tsai <[email protected]>
Chen-Yu Tsai
maintainerRe: (subset) [PATCH 0/7] soc: sunxi: sram: Add H616 SRAM support
In reply to Chen-Yu TsaiQuoted 8 lines · Chen-Yu Tsai
The Allwinner H616 has two switchable peripheral SRAM regions:
- The VE SRAM is a 2 MB dedicated SRAM for the Video Engine. CPU access to this region is enabled by default. CPU access can be disabled, after which reads will show the same stale value for all addresses, while writes are ignored.
[...]
Applied to sunxi/drivers-for-7.2 in local tree, thanks!
[1/7] dt-bindings: sram: Document Allwinner H616 VE SRAM
commit: 5b7f39687b173f042cb9530bcee5f5805020bffd
[2/7] dt-bindings: sram: sunxi-sram: Add H616 SRAM regions
commit: 775c75e4ae2b0277b5e55644f9890afef4dedee9
[3/7] soc: sunxi: sram: Const-ify sunxi_sram_func data and references
commit: 7765752f528b5b516d8cdf94faaabcba935dff41
[4/7] soc: sunxi: sram: Allow SRAM to be claimed multiple times
commit: 67890da74dd1b85a47769561bfc6e0c542762d45
[5/7] soc: sunxi: sram: Support claiming multiple regions per device
commit: be99eb936b4ffffbf87d34c4a202e15c05b30417
[6/7] soc: sunxi: sram: Add H616 SRAM regions
commit: b708294322745ce30035d960a1118b4b8d857120Best regards,
Signature · 1 line
Chen-Yu Tsai <[email protected]>