Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 73689
b: refs/heads/master
c: ba0a7f3
h: refs/heads/master
i:
  73687: d68e689
v: v3
  • Loading branch information
Atsushi Nemoto authored and Linus Torvalds committed Nov 15, 2007
1 parent e1984c5 commit 4bfec51
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 350d0076c5763ca2b88ca05e3889bfa7c1905f21
refs/heads/master: ba0a7f39ce8cd54a1b2f3adb03509ff251a91bde
40 changes: 20 additions & 20 deletions trunk/drivers/spi/spi_txx9.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <linux/spi/spi.h>
#include <linux/err.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <asm/gpio.h>


Expand Down Expand Up @@ -74,7 +75,6 @@ struct txx9spi {
struct list_head queue;
wait_queue_head_t waitq;
void __iomem *membase;
int irq;
int baseclk;
struct clk *clk;
u32 max_speed_hz, min_speed_hz;
Expand Down Expand Up @@ -350,12 +350,12 @@ static int __init txx9spi_probe(struct platform_device *dev)
struct resource *res;
int ret = -ENODEV;
u32 mcr;
int irq;

master = spi_alloc_master(&dev->dev, sizeof(*c));
if (!master)
return ret;
c = spi_master_get_devdata(master);
c->irq = -1;
platform_set_drvdata(dev, master);

INIT_WORK(&c->work, txx9spi_work);
Expand All @@ -381,32 +381,36 @@ static int __init txx9spi_probe(struct platform_device *dev)

res = platform_get_resource(dev, IORESOURCE_MEM, 0);
if (!res)
goto exit;
c->membase = ioremap(res->start, res->end - res->start + 1);
goto exit_busy;
if (!devm_request_mem_region(&dev->dev,
res->start, res->end - res->start + 1,
"spi_txx9"))
goto exit_busy;
c->membase = devm_ioremap(&dev->dev,
res->start, res->end - res->start + 1);
if (!c->membase)
goto exit;
goto exit_busy;

/* enter config mode */
mcr = txx9spi_rd(c, TXx9_SPMCR);
mcr &= ~(TXx9_SPMCR_OPMODE | TXx9_SPMCR_SPSTP | TXx9_SPMCR_BCLR);
txx9spi_wr(c, mcr | TXx9_SPMCR_CONFIG | TXx9_SPMCR_BCLR, TXx9_SPMCR);

c->irq = platform_get_irq(dev, 0);
if (c->irq < 0)
goto exit;
ret = request_irq(c->irq, txx9spi_interrupt, 0, dev->name, c);
if (ret) {
c->irq = -1;
irq = platform_get_irq(dev, 0);
if (irq < 0)
goto exit_busy;
ret = devm_request_irq(&dev->dev, irq, txx9spi_interrupt, 0,
"spi_txx9", c);
if (ret)
goto exit;
}

c->workqueue = create_singlethread_workqueue(master->dev.parent->bus_id);
if (!c->workqueue)
goto exit;
goto exit_busy;
c->last_chipselect = -1;

dev_info(&dev->dev, "at %#llx, irq %d, %dMHz\n",
(unsigned long long)res->start, c->irq,
(unsigned long long)res->start, irq,
(c->baseclk + 500000) / 1000000);

master->bus_num = dev->id;
Expand All @@ -418,13 +422,11 @@ static int __init txx9spi_probe(struct platform_device *dev)
if (ret)
goto exit;
return 0;
exit_busy:
ret = -EBUSY;
exit:
if (c->workqueue)
destroy_workqueue(c->workqueue);
if (c->irq >= 0)
free_irq(c->irq, c);
if (c->membase)
iounmap(c->membase);
if (c->clk) {
clk_disable(c->clk);
clk_put(c->clk);
Expand All @@ -442,8 +444,6 @@ static int __exit txx9spi_remove(struct platform_device *dev)
spi_unregister_master(master);
platform_set_drvdata(dev, NULL);
destroy_workqueue(c->workqueue);
free_irq(c->irq, c);
iounmap(c->membase);
clk_disable(c->clk);
clk_put(c->clk);
spi_master_put(master);
Expand Down

0 comments on commit 4bfec51

Please sign in to comment.