diff options
Diffstat (limited to 'src/soc/rockchip/rk3288/spi.c')
-rw-r--r-- | src/soc/rockchip/rk3288/spi.c | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/src/soc/rockchip/rk3288/spi.c b/src/soc/rockchip/rk3288/spi.c index 499998978b..fe4e377a08 100644 --- a/src/soc/rockchip/rk3288/spi.c +++ b/src/soc/rockchip/rk3288/spi.c @@ -297,78 +297,3 @@ struct rockchip_spi_media { struct spi_slave *slave; struct cbfs_simple_buffer buffer; }; - -static int rockchip_spi_cbfs_open(struct cbfs_media *media) -{ - return 0; -} - -static int rockchip_spi_cbfs_close(struct cbfs_media *media) -{ - return 0; -} - -static size_t rockchip_spi_cbfs_read(struct cbfs_media *media, void *dest, - size_t offset, size_t count) -{ - unsigned int cmd; - struct rockchip_spi_media *spi = - (struct rockchip_spi_media *)media->context; - int ret; - - spi_claim_bus(spi->slave); - cmd = swab32(offset) | SF_READ_DATA_CMD; - if (spi_xfer(spi->slave, &cmd, sizeof(cmd), NULL, 0)) { - printk(BIOS_DEBUG, "%s: could not send command\n", __func__); - ret = 0; - goto rockchip_spi_cbfs_read_done; - } - - if (spi_xfer(spi->slave, NULL, 0, dest, count)) { - printk(BIOS_DEBUG, "%s: could not receive data\n", __func__); - ret = 0; - goto rockchip_spi_cbfs_read_done; - } - -rockchip_spi_cbfs_read_done: - spi_release_bus(spi->slave); - return ret < 0 ? 0 : count; -} - -static void *rockchip_spi_cbfs_map(struct cbfs_media *media, size_t offset, - size_t count) -{ - struct rockchip_spi_media *spi = - (struct rockchip_spi_media *)media->context; - - count = ALIGN_UP(count, 4); - - return cbfs_simple_buffer_map(&spi->buffer, media, offset, count); -} - -static void *rockchip_spi_cbfs_unmap(struct cbfs_media *media, - const void *address) -{ - struct rockchip_spi_media *spi = - (struct rockchip_spi_media *)media->context; - return cbfs_simple_buffer_unmap(&spi->buffer, address); -} - -int initialize_rockchip_spi_cbfs_media(struct cbfs_media *media, - void *buffer_address, size_t buffer_size) -{ - static struct rockchip_spi_media context; - static struct rockchip_spi_slave *eslave = &rockchip_spi_slaves[2]; - context.slave = &eslave->slave; - context.buffer.allocated = context.buffer.last_allocate = 0; - context.buffer.buffer = buffer_address; - context.buffer.size = buffer_size; - media->context = (void *)&context; - media->open = rockchip_spi_cbfs_open; - media->close = rockchip_spi_cbfs_close; - media->read = rockchip_spi_cbfs_read; - media->map = rockchip_spi_cbfs_map; - media->unmap = rockchip_spi_cbfs_unmap; - - return 0; -} |