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: sam: update to support sama7g5 PDMC peripheral #7228

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

TonyHan11
Copy link
Contributor

The commits includes:

  • add clock range support for the clocks used by SCMI
  • configure clocks for sama7g5 PDMC peripheral
  • fix the operation on PMC_PLL_CTRL registers

Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

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

Acked-by: Etienne Carriere <[email protected]> for commits
"drivers: clk: sam: initialize the clock range values for sama7g5 SCMI clocks",
"drivers: clk: sam: initialize the clocks used by sama7g5 PDMC0",
"drivers: clk: sam: fix operation on wrong PMC_PLL_CTRLx registers" (s/wrote/written/ and s/Setting/Set/ in commit message),
"drivers: clk: sam: fix underflow of the divider for sama7g5 PLL clocks" and
"plat-sam: add sama7g5's PDMC gclk clocks to the SCMI clock list".

@@ -1116,6 +1117,46 @@ size_t plat_scmi_rd_count(unsigned int channel_id)
return resource->rd_count;
}

void sam_set_clock_range(unsigned int pmc_type, unsigned int pmc_id,
const struct clk_range *output)
Copy link
Contributor

Choose a reason for hiding this comment

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

this is rather an input argument. Maybe prefer range as variable name.
but that's not a strong opinion.

@@ -111,10 +111,11 @@ struct sam_pmc_clk {
unsigned int scmi_id;
unsigned int pmc_type;
unsigned int pmc_id;
struct clk_range output;
Copy link
Contributor

Choose a reason for hiding this comment

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

range or output_range?

unsigned int i = 0;

if (channel_id == 0) {
for (i = 0; i < ARRAY_SIZE(pmc_clks); i++, p++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpicking: p initialization should preferably be in the for instruction.
Maybe for (p = pmc_clks; p < pmc_clks + ARRAY_SIZE(pmc_clks); p++) { is enougth.
`

p->output.max = output->max;
return;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

no issue if clock is not found?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No side effects when a clock has the range but it's not included in the SCMI clock list.

Add clock range attribute to the struct for the clocks.
New function for initializing the clock range for the clocks.
Implement "plat_scmi_clock_rates_by_step()" to be used by SCMI.

Signed-off-by: Tony Han <[email protected]>
… clocks

Initialize the clock range values for sama7g5 clocks so that they can be
used in responding SCMI CLOCK_DESCRIBE_RATES command.

Signed-off-by: Tony Han <[email protected]>
Acked-by: Etienne Carriere <[email protected]>
Initialize the audio PLL and generic clocks used by for sama7g5 PDMC0
peripheral.

Signed-off-by: Tony Han <[email protected]>
Acked-by: Etienne Carriere <[email protected]>
When writing/reading a PLL control register (PMC_PLL_CTRLx), the ID in
PMC_PLL_UPDT specifies which PLL fields are written/read. Set correct ID
to PMC_PLL_UPDT to avoid operating on wrong PMC_PLL_CTRLx.

Fixes: 4318c69 ("drivers: clk: sam: add PLL clock driver for sama7g5")
Signed-off-by: Tony Han <[email protected]>
Acked-by: Etienne Carriere <[email protected]>
Fix the underflow of the divider calculated when clock given rate is
greater than the rate of the clock parent.

Fixes: 4318c69 ("drivers: clk: sam: add PLL clock driver for sama7g5")
Signed-off-by: Tony Han <[email protected]>
Acked-by: Etienne Carriere <[email protected]>
Add PDMC gclk clocks to the SCMI clock list so that they could be
used outside OP-TEE OS.

Signed-off-by: Tony Han <[email protected]>
Acked-by: Etienne Carriere <[email protected]>
…GCLK

Initialize the generic clock used by for sama7g5 I2SMCC0 peripheral.

Signed-off-by: Tony Han <[email protected]>
@TonyHan11
Copy link
Contributor Author

Updated according to the comments and add an extra commit for supporting I2SMCC peripheral, thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants