-
Notifications
You must be signed in to change notification settings - Fork 930
reset: sc5xx: Add ADI SC5XX reset controller driver #3079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: adsp-6.12.0-y
Are you sure you want to change the base?
Conversation
97cf234 to
7dfeabf
Compare
3e0a768 to
9305cac
Compare
|
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
drivers/reset/Kconfig
Outdated
|
|
||
| config RESET_SC5XX | ||
| bool "ADI SC5XX Reset Driver" | ||
| depends on ARCH_SC59X_64 || ARCH_SC59X || ARCH_SC58X || ARCH_SC57X |
There was a problem hiding this comment.
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 ?
linux/arch/arm/mach-sc5xx/Kconfig
Line 2 in 9305cac
| 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>
9305cac to
52368fe
Compare
| # CONFIG_FTRACE is not set | ||
| CONFIG_ARM_PTDUMP_DEBUGFS=y | ||
| CONFIG_EARLY_PRINTK=y | ||
| CONFIG_RESET_SC5XX=y No newline at end of file |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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?
|
@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 |
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.
PR Type
PR Checklist