Skip to content
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: sam0_rtc_timer: DT_INST changes have broken this driver #24399

Closed
sslupsky opened this issue Apr 15, 2020 · 1 comment · Fixed by #24401
Closed

drivers: sam0_rtc_timer: DT_INST changes have broken this driver #24399

sslupsky opened this issue Apr 15, 2020 · 1 comment · Fixed by #24401
Assignees
Labels
bug The issue is a bug, or the PR is fixing a bug

Comments

@sslupsky
Copy link
Contributor

Describe the bug
Commit 28870e7 appears to have broken the sam0_rtc_timer driver. The new macro appears to be generating a name that doesn't exist in the devicetree generated file. I think this problem is related to #23107 and #22806

Here is the error message:

/Users/stevenslupsky/Documents/source/zephyrproject/zephyr/drivers/timer/sam0_rtc_timer.c:75:22: error: 'GCLK_CLKCTRL_GEN_GCLKDT_N_S_soc_S_rtc_40001400_P_clocks_IDX_0_VAL_clock_generator' undeclared (first use in this function); did you mean 'DT_N_S_soc_S_rtc_40001400_P_clock_generator'?

From the generated file:

/* Generic property macros: */
#define DT_N_S_soc_S_rtc_40001400_P_reg {1073746944 /* 0x40001400 */, 28 /* 0x1c */}
#define DT_N_S_soc_S_rtc_40001400_P_reg_IDX_0 1073746944
#define DT_N_S_soc_S_rtc_40001400_P_reg_IDX_1 28
#define DT_N_S_soc_S_rtc_40001400_P_reg_EXISTS 1
#define DT_N_S_soc_S_rtc_40001400_P_clock_generator 4
#define DT_N_S_soc_S_rtc_40001400_P_clock_generator_EXISTS 1
#define DT_N_S_soc_S_rtc_40001400_P_label "RTC"
#define DT_N_S_soc_S_rtc_40001400_P_label_EXISTS 1
#define DT_N_S_soc_S_rtc_40001400_P_interrupts {3 /* 0x3 */, 0 /* 0x0 */}
#define DT_N_S_soc_S_rtc_40001400_P_interrupts_IDX_0 3
#define DT_N_S_soc_S_rtc_40001400_P_interrupts_IDX_1 0
#define DT_N_S_soc_S_rtc_40001400_P_interrupts_EXISTS 1
#define DT_N_S_soc_S_rtc_40001400_P_prescaler 0
#define DT_N_S_soc_S_rtc_40001400_P_prescaler_EXISTS 1
#define DT_N_S_soc_S_rtc_40001400_P_status "okay"
#define DT_N_S_soc_S_rtc_40001400_P_status_ENUM_IDX 1
#define DT_N_S_soc_S_rtc_40001400_P_status_EXISTS 1
#define DT_N_S_soc_S_rtc_40001400_P_compatible {"atmel,sam0-rtc"}
#define DT_N_S_soc_S_rtc_40001400_P_compatible_IDX_0 "atmel,sam0-rtc"
#define DT_N_S_soc_S_rtc_40001400_P_compatible_LEN 1
#define DT_N_S_soc_S_rtc_40001400_P_compatible_EXISTS 1

It appears as if the wrong macro is being used here but I could not find a macro in devicetree/clocks.h that would generate the correct result. So, I am not sure how to fix this.

@sslupsky sslupsky added the bug The issue is a bug, or the PR is fixing a bug label Apr 15, 2020
@galak
Copy link
Collaborator

galak commented Apr 15, 2020

Yeah, looks like:

-                           | GCLK_GEN(DT_INST_0_ATMEL_SAM0_RTC_CLOCK_GENERATOR);
+                           | GCLK_GEN(DT_INST_CLOCKS_CELL(0, generator));

should probably be:

GCLK_GEN(DT_INST_PROP(0, clock_generator)

@galak galak self-assigned this Apr 15, 2020
@galak galak added the has-pr label Apr 15, 2020
galak added a commit to galak/zephyr that referenced this issue Apr 16, 2020
clock-generator is a normal property.  To access it we should use
DT_INST_PROP(0, clock_generator) and not DT_INST_CLOCKS_CELL().

Fixes: zephyrproject-rtos#24399

Signed-off-by: Kumar Gala <[email protected]>
carlescufi pushed a commit that referenced this issue Apr 16, 2020
clock-generator is a normal property.  To access it we should use
DT_INST_PROP(0, clock_generator) and not DT_INST_CLOCKS_CELL().

Fixes: #24399

Signed-off-by: Kumar Gala <[email protected]>
stradebianche pushed a commit to stradebianche/zephyr that referenced this issue Apr 16, 2020
clock-generator is a normal property.  To access it we should use
DT_INST_PROP(0, clock_generator) and not DT_INST_CLOCKS_CELL().

Fixes: zephyrproject-rtos#24399

Signed-off-by: Kumar Gala <[email protected]>
hakehuang pushed a commit to hakehuang/zephyr that referenced this issue Jun 20, 2020
clock-generator is a normal property.  To access it we should use
DT_INST_PROP(0, clock_generator) and not DT_INST_CLOCKS_CELL().

Fixes: zephyrproject-rtos#24399

Signed-off-by: Kumar Gala <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants