From 93d9f92cfbb214718e211aee71ac869c77f725ee Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Thu, 27 Mar 2014 21:52:43 -0700 Subject: spi: Change spi_xfer to work in units of bytes instead of bits. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Whenever spi_xfer is called and whenver it's implemented, the natural unit for the amount of data being transfered is bytes. The API expected things to be expressed in bits, however, which led to a lot of multiplying and dividing by eight, and checkes to make sure things were multiples of eight. All of that can now be removed. BUG=None TEST=Built and booted on link, falco, peach_pit and nyan and looked for SPI errors in the firmware log. Built for rambi. BRANCH=None Change-Id: I02365bdb6960a35def7be7a0cd1aa0a2cc09392f Signed-off-by: Gabe Black Reviewed-on: https://chromium-review.googlesource.com/192049 Reviewed-by: Gabe Black Tested-by: Gabe Black Commit-Queue: Gabe Black [km: cherry-pick from chromium] Signed-off-by: Kyösti Mälkki Reviewed-on: http://review.coreboot.org/6175 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan Reviewed-by: Patrick Georgi --- src/cpu/samsung/exynos5420/spi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/cpu/samsung') diff --git a/src/cpu/samsung/exynos5420/spi.c b/src/cpu/samsung/exynos5420/spi.c index 5c546cc14c..46b9ced4b3 100644 --- a/src/cpu/samsung/exynos5420/spi.c +++ b/src/cpu/samsung/exynos5420/spi.c @@ -258,15 +258,13 @@ int spi_claim_bus(struct spi_slave *slave) return 0; } -int spi_xfer(struct spi_slave *slave, const void *dout, unsigned int bitsout, - void *din, unsigned int bitsin) +int spi_xfer(struct spi_slave *slave, const void *dout, unsigned int out_bytes, + void *din, unsigned int in_bytes) { - unsigned int out_bytes = bitsout / 8, in_bytes = bitsin / 8; uint8_t *out_ptr = (uint8_t *)dout, *in_ptr = (uint8_t *)din; int offset, todo, len; int ret = 0; - ASSERT(bitsout % 8 == 0 && bitsin % 8 == 0); len = MAX(out_bytes, in_bytes); /* -- cgit v1.2.3