Skip to content

[RZ_A1H]Modify frequency setting processing of SPI #817

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

Merged
merged 1 commit into from
Jan 2, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ void spi_frequency(spi_t *obj, int hz) {
uint32_t pclk_base;
uint32_t div;
uint32_t brdv = 0;
uint32_t hz_max;
uint32_t hz_min;
uint16_t mask = 0x000c;

/* set PCLK */
Expand All @@ -178,7 +180,9 @@ void spi_frequency(spi_t *obj, int hz) {
pclk_base = CM0_RENESAS_RZ_A1_P1_CLK;
}

if ((hz < (pclk_base / 2 / 256 / 8)) || (hz > (pclk_base / 2))) {
hz_min = pclk_base / 2 / 256 / 8;
hz_max = pclk_base / 2;
if ((hz < hz_min) || (hz > hz_max)) {
error("Couldn't setup requested SPI frequency");
return;
}
Expand Down