-
Notifications
You must be signed in to change notification settings - Fork 7.6k
drivers: syscon: bflb efuses #89108
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
drivers: syscon: bflb efuses #89108
Conversation
The following west manifest projects have changed revision in this Pull Request:
✅ All manifest checks OK Note: This message is automatically posted and updated by the Manifest GitHub Action. |
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.
Is the EEPROM API really the correct one to use here?
That is one of the main questions yea, what alternatives is there? |
If you are just reading the eFUSE settings, perhaps the syscon API is better suited? |
It looks like it would fit yea... Is there any example driver for it that doesnt just read memory actually? Or would that be a first driver for a syscon interface? |
needs rebase |
6515391
to
f9d7b8c
Compare
Rebased and made to use syscon. |
4705786
to
b92a322
Compare
re-assigning to BFLB maintainers |
This sets revision to the one with vendor headers from final hal version Signed-off-by: Camille BAUD <[email protected]>
ca83c05
to
bd2febe
Compare
/* 32 Mhz Oscillator: 0 | ||
* crystal: 1 | ||
* PLL and 32M: 2 | ||
* PLL and crystal: 3 | ||
*/ |
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.
could have used enum
for these
enum bflb_root_clock {
BFLB_CLOCK_32M_OSC,
BFLB_CLOCK_XTAL,
BFLB_CLOCK_PLL_32M_OSC,
BFLB_CLOCK_PLL_XTAL,
BFLB_CLOCK_INVALID,
};
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.
Clock driver with this functionality and many others (and enums/defines) is next, but it is dependant on this driver.
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.
Clock driver with this functionality and many others (and enums/defines) is next
We shouldn't depend on upcoming PRs since they are not guaranteed, but this is reasonably commented so 🤷♂️
/* invalid value, fallback to internal 32M */ | ||
if (clock > 3) { | ||
clock = 0; | ||
} |
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.
then this would naturally be:
/* invalid value, fallback to internal 32M */ | |
if (clock > 3) { | |
clock = 0; | |
} | |
if (clock >= BFLB_CLOCK_INVALID) { | |
clock = BFLB_CLOCK_32M_OSC; | |
} |
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.
See clock driver comment
tmp = sys_read32(HBN_BASE + HBN_GLB_OFFSET); | ||
old_clock_root = (tmp & HBN_ROOT_CLK_SEL_MSK) >> HBN_ROOT_CLK_SEL_POS; | ||
|
||
efuse_bflb_set_root_clock(0); |
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.
if the enum suggestion above is adopted:
efuse_bflb_set_root_clock(0); | |
efuse_bflb_set_root_clock(BFLB_CLOCK_32M_OSC); |
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.
See clock driver comment
tmp = sys_read32(HBN_BASE + HBN_GLB_OFFSET); | ||
old_clock_root = (tmp & HBN_ROOT_CLK_SEL_MSK) >> HBN_ROOT_CLK_SEL_POS; |
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.
nit: we can have a matching helper efuse_bflb_get_root_clock()
function
tmp = sys_read32(HBN_BASE + HBN_GLB_OFFSET); | |
old_clock_root = (tmp & HBN_ROOT_CLK_SEL_MSK) >> HBN_ROOT_CLK_SEL_POS; | |
old_clock_root = efuse_bflb_get_root_clock(); |
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.
See clock driver comment
This introduces a driver used to access bouffalolab efuses via syscon API Signed-off-by: Camille BAUD <[email protected]>
This enables the driver by default, it will be needed at init in the future Signed-off-by: Camille BAUD <[email protected]>
|
This introduces bflb efuse access via syscon api.
This is not used at the moment but will be in the next steps of integration (for clock_control and things like DAC and ADC).