Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 164797
b: refs/heads/master
c: 89c0537
h: refs/heads/master
i:
  164795: 64808ed
v: v3
  • Loading branch information
Tero Kristo authored and Linus Torvalds committed Sep 23, 2009
1 parent e7fba37 commit a3b6b85
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a41ae1ad907655b2efbb9b1a97736ab1451e1649
refs/heads/master: 89c05372d08f3982eeb94d1ea22a60a5eaa8cd6d
16 changes: 16 additions & 0 deletions trunk/drivers/spi/omap2_mcspi.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ struct omap2_mcspi_cs {
void __iomem *base;
unsigned long phys;
int word_len;
struct list_head node;
/* Context save and restore shadow register */
u32 chconf0;
};
Expand All @@ -145,6 +146,7 @@ struct omap2_mcspi_regs {
u32 sysconfig;
u32 modulctrl;
u32 wakeupenable;
struct list_head cs;
};

static struct omap2_mcspi_regs omap2_mcspi_ctx[OMAP2_MCSPI_MAX_CTRL];
Expand Down Expand Up @@ -255,6 +257,7 @@ static void omap2_mcspi_set_master_mode(struct spi_master *master)
static void omap2_mcspi_restore_ctx(struct omap2_mcspi *mcspi)
{
struct spi_master *spi_cntrl;
struct omap2_mcspi_cs *cs;
spi_cntrl = mcspi->master;

/* McSPI: context restore */
Expand All @@ -266,6 +269,10 @@ static void omap2_mcspi_restore_ctx(struct omap2_mcspi *mcspi)

mcspi_write_reg(spi_cntrl, OMAP2_MCSPI_WAKEUPENABLE,
omap2_mcspi_ctx[spi_cntrl->bus_num - 1].wakeupenable);

list_for_each_entry(cs, &omap2_mcspi_ctx[spi_cntrl->bus_num - 1].cs,
node)
__raw_writel(cs->chconf0, cs->base + OMAP2_MCSPI_CHCONF0);
}
static void omap2_mcspi_disable_clocks(struct omap2_mcspi *mcspi)
{
Expand Down Expand Up @@ -714,6 +721,9 @@ static int omap2_mcspi_setup(struct spi_device *spi)
cs->phys = mcspi->phys + spi->chip_select * 0x14;
cs->chconf0 = 0;
spi->controller_state = cs;
/* Link this to context save list */
list_add_tail(&cs->node,
&omap2_mcspi_ctx[mcspi->master->bus_num - 1].cs);
}

if (mcspi_dma->dma_rx_channel == -1
Expand All @@ -736,10 +746,15 @@ static void omap2_mcspi_cleanup(struct spi_device *spi)
{
struct omap2_mcspi *mcspi;
struct omap2_mcspi_dma *mcspi_dma;
struct omap2_mcspi_cs *cs;

mcspi = spi_master_get_devdata(spi->master);
mcspi_dma = &mcspi->dma_channels[spi->chip_select];

/* Unlink controller state from context save list */
cs = spi->controller_state;
list_del(&cs->node);

kfree(spi->controller_state);

if (mcspi_dma->dma_rx_channel != -1) {
Expand Down Expand Up @@ -1104,6 +1119,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev)

spin_lock_init(&mcspi->lock);
INIT_LIST_HEAD(&mcspi->msg_queue);
INIT_LIST_HEAD(&omap2_mcspi_ctx[master->bus_num - 1].cs);

mcspi->ick = clk_get(&pdev->dev, "ick");
if (IS_ERR(mcspi->ick)) {
Expand Down

0 comments on commit a3b6b85

Please sign in to comment.