On Wed, Jan 28, 2009 at 10:11:29AM +0100, ext Nayak, Rajendra wrote:
> From: Hemanth V <heman...@ti.com>
> 
> This patch adds context save/restore feature to McSPI driver.
> This has been tested by instrumenting the driver code i.e by
> adding a McSPI softreset in omap2_mcspi_disable_clocks function.
> 
> This patch includes review comment fixes
> 
> Signed-off-by: Hemanth V <heman...@ti.com>
> 
> ---
>  drivers/spi/omap2_mcspi.c |   97 
> ++++++++++++++++++++++++++++++++++++----------
>  1 files changed, 77 insertions(+), 20 deletions(-)
> 
> Index: linux-omap-2.6/drivers/spi/omap2_mcspi.c
> ===================================================================
> --- linux-omap-2.6.orig/drivers/spi/omap2_mcspi.c       2009-01-27 
> 11:45:06.000000000 +0530
> +++ linux-omap-2.6/drivers/spi/omap2_mcspi.c    2009-01-27 11:53:16.000000000 
> +0530
>
> [...]
>
> +static void omap2_mcspi_restore_ctx(struct omap2_mcspi *mcspi)
> +{
> +       struct spi_master *spi_cntrl;
> +       spi_cntrl = mcspi->master;
> +
> +       /* McSPI: context restore */
> +       mcspi_write_reg(spi_cntrl, OMAP2_MCSPI_MODULCTRL,
> +                       omap2_mcspi_ctx[spi_cntrl->bus_num - 1].modulctrl);
> +
> +       mcspi_write_reg(spi_cntrl, OMAP2_MCSPI_SYSCONFIG,
> +                       omap2_mcspi_ctx[spi_cntrl->bus_num - 1].sysconfig);
> +
> +       mcspi_write_reg(spi_cntrl, OMAP2_MCSPI_CHCONF0,
> +                       omap2_mcspi_ctx[spi_cntrl->bus_num - 1].chconf0);

You have to restore this to the proper CHCONF register. And in the
current form you have to restore all of them.

> +
> +
> +       mcspi_write_reg(spi_cntrl, OMAP2_MCSPI_WAKEUPENABLE,
> +                       omap2_mcspi_ctx[spi_cntrl->bus_num - 1].wakeupenable);
> +}
> +static void omap2_mcspi_disable_clocks(struct omap2_mcspi *mcspi)
> +{
> +       clk_disable(mcspi->ick);
> +       clk_disable(mcspi->fck);
> +}
> +
> [...]
>
> @@ -537,6 +593,8 @@
> 
>         mcspi_write_cs_reg(spi, OMAP2_MCSPI_CHCONF0, l);
> 
> +       omap2_mcspi_ctx[spi_cntrl->bus_num - 1].chconf0 = l;

And here save it to a slot based on CS.

--Imre


--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to