Commit 6bb9c0e3 authored by Mark Brown's avatar Mark Brown

spi/s3c64xx: Use prepare_message() and unprepare_message()

This is of very little value in itself but will be useful once the loop
iterating over the transfers is also factored out into the core.
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 2841a5fc
...@@ -862,16 +862,12 @@ static void s3c64xx_spi_unmap_mssg(struct s3c64xx_spi_driver_data *sdd, ...@@ -862,16 +862,12 @@ static void s3c64xx_spi_unmap_mssg(struct s3c64xx_spi_driver_data *sdd,
} }
} }
static int s3c64xx_spi_transfer_one_message(struct spi_master *master, static int s3c64xx_spi_prepare_message(struct spi_master *master,
struct spi_message *msg) struct spi_message *msg)
{ {
struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master); struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
struct spi_device *spi = msg->spi; struct spi_device *spi = msg->spi;
struct s3c64xx_spi_csinfo *cs = spi->controller_data; struct s3c64xx_spi_csinfo *cs = spi->controller_data;
struct spi_transfer *xfer;
int status = 0, cs_toggle = 0;
u32 speed;
u8 bpw;
/* If Master's(controller) state differs from that needed by Slave */ /* If Master's(controller) state differs from that needed by Slave */
if (sdd->cur_speed != spi->max_speed_hz if (sdd->cur_speed != spi->max_speed_hz
...@@ -887,13 +883,25 @@ static int s3c64xx_spi_transfer_one_message(struct spi_master *master, ...@@ -887,13 +883,25 @@ static int s3c64xx_spi_transfer_one_message(struct spi_master *master,
if (s3c64xx_spi_map_mssg(sdd, msg)) { if (s3c64xx_spi_map_mssg(sdd, msg)) {
dev_err(&spi->dev, dev_err(&spi->dev,
"Xfer: Unable to map message buffers!\n"); "Xfer: Unable to map message buffers!\n");
status = -ENOMEM; return -ENOMEM;
goto out;
} }
/* Configure feedback delay */ /* Configure feedback delay */
writel(cs->fb_delay & 0x3, sdd->regs + S3C64XX_SPI_FB_CLK); writel(cs->fb_delay & 0x3, sdd->regs + S3C64XX_SPI_FB_CLK);
return 0;
}
static int s3c64xx_spi_transfer_one_message(struct spi_master *master,
struct spi_message *msg)
{
struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
struct spi_device *spi = msg->spi;
struct spi_transfer *xfer;
int status = 0, cs_toggle = 0;
u32 speed;
u8 bpw;
list_for_each_entry(xfer, &msg->transfers, transfer_list) { list_for_each_entry(xfer, &msg->transfers, transfer_list) {
unsigned long flags; unsigned long flags;
...@@ -991,6 +999,16 @@ static int s3c64xx_spi_transfer_one_message(struct spi_master *master, ...@@ -991,6 +999,16 @@ static int s3c64xx_spi_transfer_one_message(struct spi_master *master,
return 0; return 0;
} }
static int s3c64xx_spi_unprepare_message(struct spi_master *master,
struct spi_message *msg)
{
struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
s3c64xx_spi_unmap_mssg(sdd, msg);
return 0;
}
static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata( static struct s3c64xx_spi_csinfo *s3c64xx_get_slave_ctrldata(
struct spi_device *spi) struct spi_device *spi)
{ {
...@@ -1359,7 +1377,9 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) ...@@ -1359,7 +1377,9 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
master->setup = s3c64xx_spi_setup; master->setup = s3c64xx_spi_setup;
master->cleanup = s3c64xx_spi_cleanup; master->cleanup = s3c64xx_spi_cleanup;
master->prepare_transfer_hardware = s3c64xx_spi_prepare_transfer; master->prepare_transfer_hardware = s3c64xx_spi_prepare_transfer;
master->prepare_message = s3c64xx_spi_prepare_message;
master->transfer_one_message = s3c64xx_spi_transfer_one_message; master->transfer_one_message = s3c64xx_spi_transfer_one_message;
master->unprepare_message = s3c64xx_spi_unprepare_message;
master->unprepare_transfer_hardware = s3c64xx_spi_unprepare_transfer; master->unprepare_transfer_hardware = s3c64xx_spi_unprepare_transfer;
master->num_chipselect = sci->num_cs; master->num_chipselect = sci->num_cs;
master->dma_alignment = 8; master->dma_alignment = 8;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment