diff options
author | Gabe Black <gabeblack@google.com> | 2014-04-05 03:54:30 -0700 |
---|---|---|
committer | Marc Jones <marc.jones@se-eng.com> | 2014-12-15 19:57:49 +0100 |
commit | e5b21274bd3648a6797a2415e5ad654ca4609275 (patch) | |
tree | 2314fb62e508d33d54a7142bdde8e096d1c8c5da /src/include | |
parent | c04d3dd7b3d026be03d2acbba1585d1824b5ea82 (diff) | |
download | coreboot-e5b21274bd3648a6797a2415e5ad654ca4609275.tar.xz |
tegra124: A couple clock fixes.
This fixes two problems with the clock configuration on tegra124. First, the
macro which set up the i2c clocks tried to account for the fact that the i2c
divisor's lsb represents 1.0 where it normally represents 0.5 by multiplying
the target frequency by 2. That doesn't work, unfortunately, because the
divisor is actually n + 1, and what n + 1 means depends on where the one's
place is in the divisor.
Also, when calculating the divisor, the standard C division operator uses
truncation to deal any remainder which tends to make the divisor smaller. That
has the effect of making the output frequency higher than what was requested.
Since it's usually safer to undershoot a frequency than overshoot it, this
change makes those divisions round up instead.
Finally, the hand tuned temporary UART clock configuration was adjusted so
that it still ends up with the same divisor. Without that, very early output
from the bootblock is garbled, specifically the coreboot welcome banner,
build timestamp, etc.
BUG=chrome-os-partner:27220
TEST=Built and booted on nyan. Used a logic analyzer to verify that the TPM
i2c bus ran at 400KHz instead of 660KHz, and that the divisor was the expected
value. Measured boot time with and without EFS and verified that there was no
change. Spot checked the output for errors and verified that none of the
bootblock output was garbled.
BRANCH=None
Had to add the stdlib.h from 89ed6c that hadn't been merged correctly.
Original-Change-Id: I7e948c361ed4bf58c608627d32f2e3424faea1fb
Original-Signed-off-by: Gabe Black <gabeblack@google.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/193362
Original-Reviewed-by: Julius Werner <jwerner@chromium.org>
Original-Commit-Queue: Gabe Black <gabeblack@chromium.org>
Original-Tested-by: Gabe Black <gabeblack@chromium.org>
(cherry picked from commit 164f7010a47d3bbdbc8bb572106140ae186f3807)
Signed-off-by: Marc Jones <marc.jones@se-eng.com>
Change-Id: I317b66eda929c0e5a5832adca267b8b54c6aae34
Reviewed-on: http://review.coreboot.org/7736
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/stdlib.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/include/stdlib.h b/src/include/stdlib.h index 9bc0ebc97b..2fc6805c73 100644 --- a/src/include/stdlib.h +++ b/src/include/stdlib.h @@ -26,4 +26,12 @@ void *malloc(size_t size); static inline void free(void *ptr) {} #endif +#ifndef __ROMCC__ +static inline unsigned long div_round_up(unsigned int n, unsigned int d) +{ + return (n + d - 1) / d; +} +#endif + + #endif /* STDLIB_H */ |