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>
This commit is contained in:
Stefan Reinauer 2013-09-17 14:08:29 -07:00 committed by Patrick Georgi
parent 2f6b0a9a4b
commit ff0df2bba5
1 changed files with 14 additions and 13 deletions

View File

@ -342,13 +342,15 @@ struct exynos_spi_media {
struct cbfs_simple_buffer buffer; 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; struct exynos_spi_media *spi = (struct exynos_spi_media*)media->context;
DEBUG_SPI("exynos_spi_cbfs_open\n"); DEBUG_SPI("exynos_spi_cbfs_open\n");
return spi_claim_bus(spi->slave); 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; struct exynos_spi_media *spi = (struct exynos_spi_media*)media->context;
DEBUG_SPI("exynos_spi_cbfs_close\n"); DEBUG_SPI("exynos_spi_cbfs_close\n");
spi_release_bus(spi->slave); 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, 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; struct exynos_spi_media *spi = (struct exynos_spi_media*)media->context;
int bytes; int bytes;
DEBUG_SPI("exynos_spi_cbfs_read(%u)\n", count); 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, 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; struct exynos_spi_media *spi = (struct exynos_spi_media*)media->context;
DEBUG_SPI("exynos_spi_cbfs_map\n"); DEBUG_SPI("exynos_spi_cbfs_map\n");
// exynos: spi_rx_tx may work in 4 byte-width-transmission mode and // 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, 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; struct exynos_spi_media *spi = (struct exynos_spi_media*)media->context;
DEBUG_SPI("exynos_spi_cbfs_unmap\n"); DEBUG_SPI("exynos_spi_cbfs_unmap\n");
return cbfs_simple_buffer_unmap(&spi->buffer, address); 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, int initialize_exynos_spi_cbfs_media(struct cbfs_media *media,
void *buffer_address, void *buffer_address,
size_t buffer_size) { size_t buffer_size)
{
// TODO Replace static variable to support multiple streams. // TODO Replace static variable to support multiple streams.
static struct exynos_spi_media context; static struct exynos_spi_media context;
static struct exynos_spi_slave eslave = { static struct exynos_spi_slave *eslave = &exynos_spi_slaves[1];
.slave = { .bus = 1, .rw = SPI_READ_FLAG, },
.regs = samsung_get_base_spi1(),
.fifo_size = 64,
.half_duplex = 0,
};
DEBUG_SPI("initialize_exynos_spi_cbfs_media\n"); 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.allocated = context.buffer.last_allocate = 0;
context.buffer.buffer = buffer_address; context.buffer.buffer = buffer_address;
context.buffer.size = buffer_size; context.buffer.size = buffer_size;