Skip to content

Conversation

@artursartamonovsadi
Copy link

@artursartamonovsadi artursartamonovsadi commented Jan 14, 2026

PR Description

ADI ADSP-SC5xx reset driver, goal of PR to do first round of improvements on reset driver to align with general
kernel style. And align driver with upstreaming efforts.

  • renamed rcu.c to match upstream patch reset-sc5xx.c and moved under drivers/reset
  • removed properties adi,sharc-min and adi,sharc-max, and replaced with adi,sharc-core-ids

PR Type

  • Bug fix (a change that fixes an issue)
  • New feature (a change that adds new functionality)
  • Breaking change (a change that affects other repos or cause CIs to fail)

PR Checklist

  • I have conducted a self-review of my own code changes
  • I have compiled my changes, including the documentation
  • I have tested the changes on the relevant hardware
  • I have updated the documentation outside this repo accordingly
  • I have provided links for the relevant upstream lore

@UtsavAgarwalADI
Copy link

It says there are conflicts with sc573's defconfig - does this need rebasing?


#define ADI_RCU_REBOOT_PRIORITY 255
#define ADI_RCU_CORE_INIT_TIMEOUT msecs_to_jiffies(2000)
#define ADI_RCU_CORE_NUM 4

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this 4? Isn't the max sharc core count 2?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, do we want to hardcode this value? We might want to change things in the future if needed.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idea, was to have ARRAY of Cores, and mark Cores as being SHARC, as core assignment at currently are
Core0 ARM and usually Core1,Core2 are SHARC's
What if there if assignment of cores are like Core0,Core1,Core2,Core3 and Core0 and Core 3 are ARM's and Core1 and Core2 are SHARC's.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this 4? Isn't the max sharc core count 2?
Yes, and this is how many RCU's are there not how many SHARC Cores


config RESET_SC5XX
bool "ADI SC5XX Reset Driver"
depends on ARCH_SC59X_64 || ARCH_SC59X || ARCH_SC58X || ARCH_SC57X

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can use ARCH_SC59X_64 || ARCH_SC5XX ?

menuconfig ARCH_SC5XX

  Move the ADI ADSP-SC5XX reset controller from drivers/soc/adi/mach-sc5xx/
  to drivers/reset/ to integrate with the standard reset controller
  subsystem.

Signed-off-by: Arturs Artamonovs <Arturs.Artamonovs@analog.com>
# CONFIG_FTRACE is not set
CONFIG_ARM_PTDUMP_DEBUGFS=y
CONFIG_EARLY_PRINTK=y
CONFIG_RESET_SC5XX=y No newline at end of file
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing newline at the end of the file, its also the case for other defconfigs.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we are not using the generic reset controller framework of the kernel?
https://docs.kernel.org/driver-api/reset.html

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is to gradually improve the state of driver, also lets wait for comments from upstream.

return -EINVAL;

for (i = 0; i < count; i++)
adi_rcu->sharc_core_ids[i] = 1;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So as I understand correctly, we first read this array from device tree above (line 275), then we overwrite every entry 1 with this loop. Why is that so?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the goal is that the core IDs of the sharc core are read from the device tree, and then become the indexes that gets set to 1 in sharc_core_ids[] so the driver know which ones are the sharc cores, as we can set in check_coreid_valid above.

So there are a couple of issues here. If the device tree has 1, 2 for the core ids , this code will set indexes 0 and 1 in sharc_core_ids, instead of the expected 1 and 2. We should read the values from the device tree and use them as the indexes into the sharc_core_ids array instead of using the count which will always update the array starting from 0.

I would recommend reading this into another array first and sanity checking the values, and then updating the sharc_core_ids array.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea idea is to mark from list of cores mark each SHARC cores, as enumeration of SHARC cores isn't determinate between different ADSP-SC5xx SoC, also easy to detect when calling https://github.com/analogdevicesinc/linux/blob/adsp-main-6.12-rcu-review/drivers/reset/reset-sc5xx.c#L103

return -EINVAL;

for (i = 0; i < count; i++)
adi_rcu->sharc_core_ids[i] = 1;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the goal is that the core IDs of the sharc core are read from the device tree, and then become the indexes that gets set to 1 in sharc_core_ids[] so the driver know which ones are the sharc cores, as we can set in check_coreid_valid above.

So there are a couple of issues here. If the device tree has 1, 2 for the core ids , this code will set indexes 0 and 1 in sharc_core_ids, instead of the expected 1 and 2. We should read the values from the device tree and use them as the indexes into the sharc_core_ids array instead of using the count which will always update the array starting from 0.

I would recommend reading this into another array first and sanity checking the values, and then updating the sharc_core_ids array.

return -EINVAL;
}
memset32(adi_rcu->sharc_core_ids, 0, count);
ret = of_property_read_u32_array(np, "adi,sharc-core-ids", adi_rcu->sharc_core_ids, ADI_RCU_CORE_NUM);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see we check above if the number of elements in the sharc-core-ids is greater than the number of cores, but should we also add a check here to make sure the actual elements aren't out of bounds, for example accidentally putting 1,5 as the core ids?

@nunojsa
Copy link
Collaborator

nunojsa commented Jan 27, 2026

@artursartamonovsadi , fixup commits are really not helpful for reviewers. If you're working on something mark this as a draft and then mark it ready for review (without fixups) when ready

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

5 participants