From 33df49519eb19556497bb3fdf442b058be324895 Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Tue, 16 Dec 2014 22:48:26 -0800 Subject: rk3288: Implement support for CRYPTO module and use it in vboot hashing This patch implements support for the CRYPTO module in RK3288 and ties it into the new vboot vb2ex_hwcrypto API. We only implement SHA256 for now, since the engine doesn't support SHA512 and it's very unlikely that we'll ever use SHA1 for anything again. BRANCH=None BUG=chrome-os-partner:32987 TEST=Booted Pinky, confirmed that it uses the hardware crypto engine and that firmware body hashing time dropped to about 1.5ms (from over 70ms). Change-Id: I91d0860b42b93d690d2fa083324d343efe7da5f1 Signed-off-by: Stefan Reinauer Original-Commit-Id: e60d42cbffd0748e13bfe1a281877460ecde936b Original-Change-Id: I92510082b311a48a56224a4fc44b1bbce39b17ac Original-Signed-off-by: Julius Werner Original-Reviewed-on: https://chromium-review.googlesource.com/236436 Original-Reviewed-by: Aaron Durbin Original-Reviewed-by: Randall Spangler Reviewed-on: http://review.coreboot.org/9641 Tested-by: build bot (Jenkins) Reviewed-by: Marc Jones --- src/soc/rockchip/rk3288/clock.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/soc/rockchip/rk3288/clock.c') diff --git a/src/soc/rockchip/rk3288/clock.c b/src/soc/rockchip/rk3288/clock.c index ab12e8c896..d7420ea8d6 100644 --- a/src/soc/rockchip/rk3288/clock.c +++ b/src/soc/rockchip/rk3288/clock.c @@ -493,6 +493,16 @@ void rkclk_configure_i2s(unsigned int hz) writel(d << 16 | n, &cru_ptr->cru_clksel_con[8]); } +void rkclk_configure_crypto(unsigned int hz) +{ + u32 div = PD_BUS_ACLK_HZ / hz; + + assert((div - 1 < 4) && (div * hz == PD_BUS_ACLK_HZ)); + assert(hz <= 150*MHz); /* Suggested max in TRM. */ + writel(RK_CLRSETBITS(0x3 << 6, (div - 1) << 6), + &cru_ptr->cru_clksel_con[26]); +} + void rkclk_configure_tsadc(unsigned int hz) { u32 div; -- cgit v1.2.3