From ff0df2bba5f29dc992c0ab59b44337b7277c231a Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Tue, 17 Sep 2013 14:08:29 -0700 Subject: Exynos5420: clean up SPI driver That extra struct is not needed, we already defined it earlier on. Also fix coding style in the file. Signed-off-by: Stefan Reinauer Change-Id: I586d290f2f3ba2f44aca7fdee400b88547465599 Reviewed-on: https://chromium-review.googlesource.com/169780 Reviewed-by: Stefan Reinauer Commit-Queue: Stefan Reinauer Tested-by: Stefan Reinauer (cherry picked from commit f7df9f05fb707cac7976cd8a0b36bcf30cef8e0f) Signed-off-by: Isaac Christensen Reviewed-on: http://review.coreboot.org/6532 Tested-by: build bot (Jenkins) Reviewed-by: David Hendricks Reviewed-by: Edward O'Callaghan --- src/cpu/samsung/exynos5420/spi.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'src/cpu/samsung') diff --git a/src/cpu/samsung/exynos5420/spi.c b/src/cpu/samsung/exynos5420/spi.c index 7b9febcb58..0d2d6d7fd9 100644 --- a/src/cpu/samsung/exynos5420/spi.c +++ b/src/cpu/samsung/exynos5420/spi.c @@ -342,13 +342,15 @@ struct exynos_spi_media { struct cbfs_simple_buffer buffer; }; -static int exynos_spi_cbfs_open(struct cbfs_media *media) { +static int exynos_spi_cbfs_open(struct cbfs_media *media) +{ struct exynos_spi_media *spi = (struct exynos_spi_media*)media->context; DEBUG_SPI("exynos_spi_cbfs_open\n"); return spi_claim_bus(spi->slave); } -static int exynos_spi_cbfs_close(struct cbfs_media *media) { +static int exynos_spi_cbfs_close(struct cbfs_media *media) +{ struct exynos_spi_media *spi = (struct exynos_spi_media*)media->context; DEBUG_SPI("exynos_spi_cbfs_close\n"); spi_release_bus(spi->slave); @@ -356,7 +358,8 @@ static int exynos_spi_cbfs_close(struct cbfs_media *media) { } static size_t exynos_spi_cbfs_read(struct cbfs_media *media, void *dest, - size_t offset, size_t count) { + size_t offset, size_t count) +{ struct exynos_spi_media *spi = (struct exynos_spi_media*)media->context; int bytes; DEBUG_SPI("exynos_spi_cbfs_read(%u)\n", count); @@ -365,7 +368,8 @@ static size_t exynos_spi_cbfs_read(struct cbfs_media *media, void *dest, } static void *exynos_spi_cbfs_map(struct cbfs_media *media, size_t offset, - size_t count) { + size_t count) +{ struct exynos_spi_media *spi = (struct exynos_spi_media*)media->context; DEBUG_SPI("exynos_spi_cbfs_map\n"); // exynos: spi_rx_tx may work in 4 byte-width-transmission mode and @@ -376,7 +380,8 @@ static void *exynos_spi_cbfs_map(struct cbfs_media *media, size_t offset, } static void *exynos_spi_cbfs_unmap(struct cbfs_media *media, - const void *address) { + const void *address) +{ struct exynos_spi_media *spi = (struct exynos_spi_media*)media->context; DEBUG_SPI("exynos_spi_cbfs_unmap\n"); return cbfs_simple_buffer_unmap(&spi->buffer, address); @@ -384,18 +389,14 @@ static void *exynos_spi_cbfs_unmap(struct cbfs_media *media, int initialize_exynos_spi_cbfs_media(struct cbfs_media *media, void *buffer_address, - size_t buffer_size) { + size_t buffer_size) +{ // TODO Replace static variable to support multiple streams. static struct exynos_spi_media context; - static struct exynos_spi_slave eslave = { - .slave = { .bus = 1, .rw = SPI_READ_FLAG, }, - .regs = samsung_get_base_spi1(), - .fifo_size = 64, - .half_duplex = 0, - }; + static struct exynos_spi_slave *eslave = &exynos_spi_slaves[1]; DEBUG_SPI("initialize_exynos_spi_cbfs_media\n"); - context.slave = &eslave.slave; + context.slave = &eslave->slave; context.buffer.allocated = context.buffer.last_allocate = 0; context.buffer.buffer = buffer_address; context.buffer.size = buffer_size; -- cgit v1.2.3