summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStefan Reinauer <reinauer@chromium.org>2013-09-17 14:08:29 -0700
committerPatrick Georgi <patrick@georgi-clan.de>2014-08-09 17:36:40 +0200
commitff0df2bba5f29dc992c0ab59b44337b7277c231a (patch)
tree651c37d467fcacf5f71489cb20fad071a32da0ea /src
parent2f6b0a9a4b7dd7c6b04c6f17f024db8643afde5f (diff)
downloadcoreboot-ff0df2bba5f29dc992c0ab59b44337b7277c231a.tar.xz
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 <reinauer@google.com> Change-Id: I586d290f2f3ba2f44aca7fdee400b88547465599 Reviewed-on: https://chromium-review.googlesource.com/169780 Reviewed-by: Stefan Reinauer <reinauer@google.com> Commit-Queue: Stefan Reinauer <reinauer@google.com> Tested-by: Stefan Reinauer <reinauer@google.com> (cherry picked from commit f7df9f05fb707cac7976cd8a0b36bcf30cef8e0f) Signed-off-by: Isaac Christensen <isaac.christensen@se-eng.com> Reviewed-on: http://review.coreboot.org/6532 Tested-by: build bot (Jenkins) Reviewed-by: David Hendricks <dhendrix@chromium.org> Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Diffstat (limited to 'src')
-rw-r--r--src/cpu/samsung/exynos5420/spi.c27
1 files changed, 14 insertions, 13 deletions
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;