aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/common
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/common')
-rw-r--r--arch/arm/common/sa1111.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
index b0f93628dcd7..1366e82e6707 100644
--- a/arch/arm/common/sa1111.c
+++ b/arch/arm/common/sa1111.c
@@ -106,6 +106,7 @@ struct sa1111 {
106 int irq_base; /* base for cascaded on-chip IRQs */ 106 int irq_base; /* base for cascaded on-chip IRQs */
107 spinlock_t lock; 107 spinlock_t lock;
108 void __iomem *base; 108 void __iomem *base;
109 struct sa1111_platform_data *pdata;
109#ifdef CONFIG_PM 110#ifdef CONFIG_PM
110 void *saved_state; 111 void *saved_state;
111#endif 112#endif
@@ -756,6 +757,7 @@ __sa1111_probe(struct device *me, struct resource *mem, int irq)
756 sachip->dev = me; 757 sachip->dev = me;
757 dev_set_drvdata(sachip->dev, sachip); 758 dev_set_drvdata(sachip->dev, sachip);
758 759
760 sachip->pdata = pd;
759 sachip->phys = mem->start; 761 sachip->phys = mem->start;
760 sachip->irq = irq; 762 sachip->irq = irq;
761 763
@@ -1282,16 +1284,23 @@ EXPORT_SYMBOL(sa1111_set_sleep_io);
1282 * sa1111_enable_device - enable an on-chip SA1111 function block 1284 * sa1111_enable_device - enable an on-chip SA1111 function block
1283 * @sadev: SA1111 function block device to enable 1285 * @sadev: SA1111 function block device to enable
1284 */ 1286 */
1285void sa1111_enable_device(struct sa1111_dev *sadev) 1287int sa1111_enable_device(struct sa1111_dev *sadev)
1286{ 1288{
1287 struct sa1111 *sachip = sa1111_chip_driver(sadev); 1289 struct sa1111 *sachip = sa1111_chip_driver(sadev);
1288 unsigned long flags; 1290 unsigned long flags;
1289 unsigned int val; 1291 unsigned int val;
1292 int ret = 0;
1290 1293
1291 spin_lock_irqsave(&sachip->lock, flags); 1294 if (sachip->pdata && sachip->pdata->enable)
1292 val = sa1111_readl(sachip->base + SA1111_SKPCR); 1295 ret = sachip->pdata->enable(sachip->pdata->data, sadev->devid);
1293 sa1111_writel(val | sadev->skpcr_mask, sachip->base + SA1111_SKPCR); 1296
1294 spin_unlock_irqrestore(&sachip->lock, flags); 1297 if (ret == 0) {
1298 spin_lock_irqsave(&sachip->lock, flags);
1299 val = sa1111_readl(sachip->base + SA1111_SKPCR);
1300 sa1111_writel(val | sadev->skpcr_mask, sachip->base + SA1111_SKPCR);
1301 spin_unlock_irqrestore(&sachip->lock, flags);
1302 }
1303 return ret;
1295} 1304}
1296EXPORT_SYMBOL(sa1111_enable_device); 1305EXPORT_SYMBOL(sa1111_enable_device);
1297 1306
@@ -1309,6 +1318,9 @@ void sa1111_disable_device(struct sa1111_dev *sadev)
1309 val = sa1111_readl(sachip->base + SA1111_SKPCR); 1318 val = sa1111_readl(sachip->base + SA1111_SKPCR);
1310 sa1111_writel(val & ~sadev->skpcr_mask, sachip->base + SA1111_SKPCR); 1319 sa1111_writel(val & ~sadev->skpcr_mask, sachip->base + SA1111_SKPCR);
1311 spin_unlock_irqrestore(&sachip->lock, flags); 1320 spin_unlock_irqrestore(&sachip->lock, flags);
1321
1322 if (sachip->pdata && sachip->pdata->disable)
1323 sachip->pdata->disable(sachip->pdata->data, sadev->devid);
1312} 1324}
1313EXPORT_SYMBOL(sa1111_disable_device); 1325EXPORT_SYMBOL(sa1111_disable_device);
1314 1326