Pl also find the patch attached, incase corrupted by mailer Thanks Hemanth >From ae4c6a91bbcfc842f97cf48dd13f6de02baae1d3 Mon Sep 17 00:00:00 2001 From: Hemanth V <hemanthv@xxxxxx> Date: Fri, 27 Nov 2009 14:37:20 +0530 Subject: [PATCH 3/3] Add McSPI slave support. This patch adds support for mcspi slave mode. Signed-off-by: Hemanth V <hemanthv@xxxxxx> --- drivers/spi/omap2_mcspi.c | 24 ++++++++++++++++++------ 1 files changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c index 75a3f04..03d61cf 100644 --- a/drivers/spi/omap2_mcspi.c +++ b/drivers/spi/omap2_mcspi.c @@ -428,6 +428,18 @@ static void omap2_mcspi_set_master_mode(struct spi_master *master) omap2_mcspi_ctx[master->bus_num - 1].modulctrl = l; } +static void omap2_mcspi_set_slave_mode(struct spi_master *master) +{ + u32 l; + + l = mcspi_read_reg(master, OMAP2_MCSPI_MODULCTRL); + MOD_REG_BIT(l, OMAP2_MCSPI_MODULCTRL_STEST, 0); + MOD_REG_BIT(l, OMAP2_MCSPI_MODULCTRL_MS, 1); + mcspi_write_reg(master, OMAP2_MCSPI_MODULCTRL, l); + + omap2_mcspi_ctx[master->bus_num - 1].modulctrl = l; +} + static int mcspi_wait_for_reg_bit(void __iomem *reg, unsigned long bit) { unsigned long timeout; @@ -827,10 +839,11 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi, l &= ~(OMAP2_MCSPI_CHCONF_IS|OMAP2_MCSPI_CHCONF_DPE1); l |= OMAP2_MCSPI_CHCONF_DPE0; } else { - return -EINVAL; + l |= OMAP2_MCSPI_CHCONF_IS; + l |= OMAP2_MCSPI_CHCONF_DPE1; + l &= ~OMAP2_MCSPI_CHCONF_DPE0; } - /* wordlength */ l &= ~OMAP2_MCSPI_CHCONF_WL_MASK; l |= (word_len - 1) << 7; @@ -1214,7 +1227,6 @@ static int __init omap2_mcspi_reset(struct omap2_mcspi *mcspi) { struct spi_master *master = mcspi->master; u32 tmp; - u32 error = 0; if (omap2_mcspi_enable_clocks(mcspi)) return -1; @@ -1238,10 +1250,10 @@ static int __init omap2_mcspi_reset(struct omap2_mcspi *mcspi) if (mcspi->mcspi_mode == OMAP2_MCSPI_MASTER) omap2_mcspi_set_master_mode(master); else - error = -EINVAL; + omap2_mcspi_set_slave_mode(master); omap2_mcspi_disable_clocks(mcspi); - return error; + return 0; } static u8 __initdata spi1_rxdma_id [] = { @@ -1353,7 +1365,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev) mcspi = spi_master_get_devdata(master); mcspi->master = master; - mcspi->mcspi_mode = OMAP2_MCSPI_MASTER; + mcspi->mcspi_mode = pdata->mode; mcspi->dma_mode = pdata->dma_mode; mcspi->force_cs_mode = pdata->force_cs_mode; -- 1.6.3.3
Attachment:
0003-Add-McSPI-slave-support.patch
Description: Binary data