Commit 38455d7a authored by Esben Haabendal's avatar Esben Haabendal Committed by Mark Brown

spi: fsl-(e)spi: Support compile as module

Signed-off-by: default avatarEsben Haabendal <eha@deif.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 1004b9f1
...@@ -279,7 +279,7 @@ config SPI_FSL_CPM ...@@ -279,7 +279,7 @@ config SPI_FSL_CPM
depends on FSL_SOC depends on FSL_SOC
config SPI_FSL_SPI config SPI_FSL_SPI
bool "Freescale SPI controller and Aeroflex Gaisler GRLIB SPI controller" tristate "Freescale SPI controller and Aeroflex Gaisler GRLIB SPI controller"
depends on OF depends on OF
select SPI_FSL_LIB select SPI_FSL_LIB
select SPI_FSL_CPM if FSL_SOC select SPI_FSL_CPM if FSL_SOC
...@@ -300,7 +300,7 @@ config SPI_FSL_DSPI ...@@ -300,7 +300,7 @@ config SPI_FSL_DSPI
mode. VF610 platform uses the controller. mode. VF610 platform uses the controller.
config SPI_FSL_ESPI config SPI_FSL_ESPI
bool "Freescale eSPI controller" tristate "Freescale eSPI controller"
depends on FSL_SOC depends on FSL_SOC
select SPI_FSL_LIB select SPI_FSL_LIB
help help
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/fsl_devices.h> #include <linux/fsl_devices.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -68,6 +69,7 @@ void fsl_spi_cpm_reinit_txrx(struct mpc8xxx_spi *mspi) ...@@ -68,6 +69,7 @@ void fsl_spi_cpm_reinit_txrx(struct mpc8xxx_spi *mspi)
} }
} }
} }
EXPORT_SYMBOL_GPL(fsl_spi_cpm_reinit_txrx);
static void fsl_spi_cpm_bufs_start(struct mpc8xxx_spi *mspi) static void fsl_spi_cpm_bufs_start(struct mpc8xxx_spi *mspi)
{ {
...@@ -162,6 +164,7 @@ int fsl_spi_cpm_bufs(struct mpc8xxx_spi *mspi, ...@@ -162,6 +164,7 @@ int fsl_spi_cpm_bufs(struct mpc8xxx_spi *mspi,
dma_unmap_single(dev, mspi->tx_dma, t->len, DMA_TO_DEVICE); dma_unmap_single(dev, mspi->tx_dma, t->len, DMA_TO_DEVICE);
return -ENOMEM; return -ENOMEM;
} }
EXPORT_SYMBOL_GPL(fsl_spi_cpm_bufs);
void fsl_spi_cpm_bufs_complete(struct mpc8xxx_spi *mspi) void fsl_spi_cpm_bufs_complete(struct mpc8xxx_spi *mspi)
{ {
...@@ -174,6 +177,7 @@ void fsl_spi_cpm_bufs_complete(struct mpc8xxx_spi *mspi) ...@@ -174,6 +177,7 @@ void fsl_spi_cpm_bufs_complete(struct mpc8xxx_spi *mspi)
dma_unmap_single(dev, mspi->rx_dma, t->len, DMA_FROM_DEVICE); dma_unmap_single(dev, mspi->rx_dma, t->len, DMA_FROM_DEVICE);
mspi->xfer_in_progress = NULL; mspi->xfer_in_progress = NULL;
} }
EXPORT_SYMBOL_GPL(fsl_spi_cpm_bufs_complete);
void fsl_spi_cpm_irq(struct mpc8xxx_spi *mspi, u32 events) void fsl_spi_cpm_irq(struct mpc8xxx_spi *mspi, u32 events)
{ {
...@@ -198,6 +202,7 @@ void fsl_spi_cpm_irq(struct mpc8xxx_spi *mspi, u32 events) ...@@ -198,6 +202,7 @@ void fsl_spi_cpm_irq(struct mpc8xxx_spi *mspi, u32 events)
else else
complete(&mspi->done); complete(&mspi->done);
} }
EXPORT_SYMBOL_GPL(fsl_spi_cpm_irq);
static void *fsl_spi_alloc_dummy_rx(void) static void *fsl_spi_alloc_dummy_rx(void)
{ {
...@@ -375,6 +380,7 @@ int fsl_spi_cpm_init(struct mpc8xxx_spi *mspi) ...@@ -375,6 +380,7 @@ int fsl_spi_cpm_init(struct mpc8xxx_spi *mspi)
fsl_spi_free_dummy_rx(); fsl_spi_free_dummy_rx();
return -ENOMEM; return -ENOMEM;
} }
EXPORT_SYMBOL_GPL(fsl_spi_cpm_init);
void fsl_spi_cpm_free(struct mpc8xxx_spi *mspi) void fsl_spi_cpm_free(struct mpc8xxx_spi *mspi)
{ {
...@@ -389,3 +395,6 @@ void fsl_spi_cpm_free(struct mpc8xxx_spi *mspi) ...@@ -389,3 +395,6 @@ void fsl_spi_cpm_free(struct mpc8xxx_spi *mspi)
cpm_muram_free(cpm_muram_offset(mspi->pram)); cpm_muram_free(cpm_muram_offset(mspi->pram));
fsl_spi_free_dummy_rx(); fsl_spi_free_dummy_rx();
} }
EXPORT_SYMBOL_GPL(fsl_spi_cpm_free);
MODULE_LICENSE("GPL");
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/module.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#ifdef CONFIG_FSL_SOC #ifdef CONFIG_FSL_SOC
...@@ -35,7 +36,8 @@ void mpc8xxx_spi_rx_buf_##type(u32 data, struct mpc8xxx_spi *mpc8xxx_spi) \ ...@@ -35,7 +36,8 @@ void mpc8xxx_spi_rx_buf_##type(u32 data, struct mpc8xxx_spi *mpc8xxx_spi) \
type *rx = mpc8xxx_spi->rx; \ type *rx = mpc8xxx_spi->rx; \
*rx++ = (type)(data >> mpc8xxx_spi->rx_shift); \ *rx++ = (type)(data >> mpc8xxx_spi->rx_shift); \
mpc8xxx_spi->rx = rx; \ mpc8xxx_spi->rx = rx; \
} } \
EXPORT_SYMBOL_GPL(mpc8xxx_spi_rx_buf_##type);
#define MPC8XXX_SPI_TX_BUF(type) \ #define MPC8XXX_SPI_TX_BUF(type) \
u32 mpc8xxx_spi_tx_buf_##type(struct mpc8xxx_spi *mpc8xxx_spi) \ u32 mpc8xxx_spi_tx_buf_##type(struct mpc8xxx_spi *mpc8xxx_spi) \
...@@ -47,7 +49,8 @@ u32 mpc8xxx_spi_tx_buf_##type(struct mpc8xxx_spi *mpc8xxx_spi) \ ...@@ -47,7 +49,8 @@ u32 mpc8xxx_spi_tx_buf_##type(struct mpc8xxx_spi *mpc8xxx_spi) \
data = *tx++ << mpc8xxx_spi->tx_shift; \ data = *tx++ << mpc8xxx_spi->tx_shift; \
mpc8xxx_spi->tx = tx; \ mpc8xxx_spi->tx = tx; \
return data; \ return data; \
} } \
EXPORT_SYMBOL_GPL(mpc8xxx_spi_tx_buf_##type);
MPC8XXX_SPI_RX_BUF(u8) MPC8XXX_SPI_RX_BUF(u8)
MPC8XXX_SPI_RX_BUF(u16) MPC8XXX_SPI_RX_BUF(u16)
...@@ -60,6 +63,7 @@ struct mpc8xxx_spi_probe_info *to_of_pinfo(struct fsl_spi_platform_data *pdata) ...@@ -60,6 +63,7 @@ struct mpc8xxx_spi_probe_info *to_of_pinfo(struct fsl_spi_platform_data *pdata)
{ {
return container_of(pdata, struct mpc8xxx_spi_probe_info, pdata); return container_of(pdata, struct mpc8xxx_spi_probe_info, pdata);
} }
EXPORT_SYMBOL_GPL(to_of_pinfo);
const char *mpc8xxx_spi_strmode(unsigned int flags) const char *mpc8xxx_spi_strmode(unsigned int flags)
{ {
...@@ -75,6 +79,7 @@ const char *mpc8xxx_spi_strmode(unsigned int flags) ...@@ -75,6 +79,7 @@ const char *mpc8xxx_spi_strmode(unsigned int flags)
} }
return "CPU"; return "CPU";
} }
EXPORT_SYMBOL_GPL(mpc8xxx_spi_strmode);
void mpc8xxx_spi_probe(struct device *dev, struct resource *mem, void mpc8xxx_spi_probe(struct device *dev, struct resource *mem,
unsigned int irq) unsigned int irq)
...@@ -107,6 +112,7 @@ void mpc8xxx_spi_probe(struct device *dev, struct resource *mem, ...@@ -107,6 +112,7 @@ void mpc8xxx_spi_probe(struct device *dev, struct resource *mem,
init_completion(&mpc8xxx_spi->done); init_completion(&mpc8xxx_spi->done);
} }
EXPORT_SYMBOL_GPL(mpc8xxx_spi_probe);
int mpc8xxx_spi_remove(struct device *dev) int mpc8xxx_spi_remove(struct device *dev)
{ {
...@@ -125,6 +131,7 @@ int mpc8xxx_spi_remove(struct device *dev) ...@@ -125,6 +131,7 @@ int mpc8xxx_spi_remove(struct device *dev)
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(mpc8xxx_spi_remove);
int of_mpc8xxx_spi_probe(struct platform_device *ofdev) int of_mpc8xxx_spi_probe(struct platform_device *ofdev)
{ {
...@@ -171,3 +178,6 @@ int of_mpc8xxx_spi_probe(struct platform_device *ofdev) ...@@ -171,3 +178,6 @@ int of_mpc8xxx_spi_probe(struct platform_device *ofdev)
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(of_mpc8xxx_spi_probe);
MODULE_LICENSE("GPL");
...@@ -28,7 +28,7 @@ struct mpc8xxx_spi { ...@@ -28,7 +28,7 @@ struct mpc8xxx_spi {
/* rx & tx bufs from the spi_transfer */ /* rx & tx bufs from the spi_transfer */
const void *tx; const void *tx;
void *rx; void *rx;
#ifdef CONFIG_SPI_FSL_ESPI #if IS_ENABLED(CONFIG_SPI_FSL_ESPI)
int len; int len;
#endif #endif
...@@ -68,7 +68,7 @@ struct mpc8xxx_spi { ...@@ -68,7 +68,7 @@ struct mpc8xxx_spi {
unsigned int flags; unsigned int flags;
#ifdef CONFIG_SPI_FSL_SPI #if IS_ENABLED(CONFIG_SPI_FSL_SPI)
int type; int type;
int native_chipselects; int native_chipselects;
u8 max_bits_per_word; u8 max_bits_per_word;
......
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