|
@@ -61,44 +61,6 @@ struct mpc8xxx_spi_probe_info *to_of_pinfo(struct fsl_spi_platform_data *pdata)
|
|
|
return container_of(pdata, struct mpc8xxx_spi_probe_info, pdata);
|
|
|
}
|
|
|
|
|
|
-static void mpc8xxx_spi_work(struct work_struct *work)
|
|
|
-{
|
|
|
- struct mpc8xxx_spi *mpc8xxx_spi = container_of(work, struct mpc8xxx_spi,
|
|
|
- work);
|
|
|
-
|
|
|
- spin_lock_irq(&mpc8xxx_spi->lock);
|
|
|
- while (!list_empty(&mpc8xxx_spi->queue)) {
|
|
|
- struct spi_message *m = container_of(mpc8xxx_spi->queue.next,
|
|
|
- struct spi_message, queue);
|
|
|
-
|
|
|
- list_del_init(&m->queue);
|
|
|
- spin_unlock_irq(&mpc8xxx_spi->lock);
|
|
|
-
|
|
|
- if (mpc8xxx_spi->spi_do_one_msg)
|
|
|
- mpc8xxx_spi->spi_do_one_msg(m);
|
|
|
-
|
|
|
- spin_lock_irq(&mpc8xxx_spi->lock);
|
|
|
- }
|
|
|
- spin_unlock_irq(&mpc8xxx_spi->lock);
|
|
|
-}
|
|
|
-
|
|
|
-int mpc8xxx_spi_transfer(struct spi_device *spi,
|
|
|
- struct spi_message *m)
|
|
|
-{
|
|
|
- struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master);
|
|
|
- unsigned long flags;
|
|
|
-
|
|
|
- m->actual_length = 0;
|
|
|
- m->status = -EINPROGRESS;
|
|
|
-
|
|
|
- spin_lock_irqsave(&mpc8xxx_spi->lock, flags);
|
|
|
- list_add_tail(&m->queue, &mpc8xxx_spi->queue);
|
|
|
- queue_work(mpc8xxx_spi->workqueue, &mpc8xxx_spi->work);
|
|
|
- spin_unlock_irqrestore(&mpc8xxx_spi->lock, flags);
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
const char *mpc8xxx_spi_strmode(unsigned int flags)
|
|
|
{
|
|
|
if (flags & SPI_QE_CPU_MODE) {
|
|
@@ -114,13 +76,12 @@ const char *mpc8xxx_spi_strmode(unsigned int flags)
|
|
|
return "CPU";
|
|
|
}
|
|
|
|
|
|
-int mpc8xxx_spi_probe(struct device *dev, struct resource *mem,
|
|
|
+void mpc8xxx_spi_probe(struct device *dev, struct resource *mem,
|
|
|
unsigned int irq)
|
|
|
{
|
|
|
struct fsl_spi_platform_data *pdata = dev_get_platdata(dev);
|
|
|
struct spi_master *master;
|
|
|
struct mpc8xxx_spi *mpc8xxx_spi;
|
|
|
- int ret = 0;
|
|
|
|
|
|
master = dev_get_drvdata(dev);
|
|
|
|
|
@@ -128,7 +89,6 @@ int mpc8xxx_spi_probe(struct device *dev, struct resource *mem,
|
|
|
master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH
|
|
|
| SPI_LSB_FIRST | SPI_LOOP;
|
|
|
|
|
|
- master->transfer = mpc8xxx_spi_transfer;
|
|
|
master->dev.of_node = dev->of_node;
|
|
|
|
|
|
mpc8xxx_spi = spi_master_get_devdata(master);
|
|
@@ -147,22 +107,7 @@ int mpc8xxx_spi_probe(struct device *dev, struct resource *mem,
|
|
|
master->bus_num = pdata->bus_num;
|
|
|
master->num_chipselect = pdata->max_chipselect;
|
|
|
|
|
|
- spin_lock_init(&mpc8xxx_spi->lock);
|
|
|
init_completion(&mpc8xxx_spi->done);
|
|
|
- INIT_WORK(&mpc8xxx_spi->work, mpc8xxx_spi_work);
|
|
|
- INIT_LIST_HEAD(&mpc8xxx_spi->queue);
|
|
|
-
|
|
|
- mpc8xxx_spi->workqueue = create_singlethread_workqueue(
|
|
|
- dev_name(master->dev.parent));
|
|
|
- if (mpc8xxx_spi->workqueue == NULL) {
|
|
|
- ret = -EBUSY;
|
|
|
- goto err;
|
|
|
- }
|
|
|
-
|
|
|
- return 0;
|
|
|
-
|
|
|
-err:
|
|
|
- return ret;
|
|
|
}
|
|
|
|
|
|
int mpc8xxx_spi_remove(struct device *dev)
|
|
@@ -173,8 +118,6 @@ int mpc8xxx_spi_remove(struct device *dev)
|
|
|
master = dev_get_drvdata(dev);
|
|
|
mpc8xxx_spi = spi_master_get_devdata(master);
|
|
|
|
|
|
- flush_workqueue(mpc8xxx_spi->workqueue);
|
|
|
- destroy_workqueue(mpc8xxx_spi->workqueue);
|
|
|
spi_unregister_master(master);
|
|
|
|
|
|
free_irq(mpc8xxx_spi->irq, mpc8xxx_spi);
|