summaryrefslogtreecommitdiff
path: root/drivers/ssbi/ssbi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ssbi/ssbi.c')
-rw-r--r--drivers/ssbi/ssbi.c86
1 files changed, 43 insertions, 43 deletions
diff --git a/drivers/ssbi/ssbi.c b/drivers/ssbi/ssbi.c
index b056a072c3b..f32da0258a8 100644
--- a/drivers/ssbi/ssbi.c
+++ b/drivers/ssbi/ssbi.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
* Copyright (c) 2010, Google Inc.
*
* Original authors: Code Aurora Forum
@@ -24,7 +24,7 @@
#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
-#include <linux/msm_ssbi.h>
+#include <linux/ssbi.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
@@ -65,23 +65,23 @@
#define SSBI_TIMEOUT_US 100
-struct msm_ssbi {
+struct ssbi {
struct device *slave;
void __iomem *base;
spinlock_t lock;
- enum msm_ssbi_controller_type controller_type;
- int (*read)(struct msm_ssbi *, u16 addr, u8 *buf, int len);
- int (*write)(struct msm_ssbi *, u16 addr, u8 *buf, int len);
+ enum ssbi_controller_type controller_type;
+ int (*read)(struct ssbi *, u16 addr, u8 *buf, int len);
+ int (*write)(struct ssbi *, u16 addr, u8 *buf, int len);
};
-#define to_msm_ssbi(dev) platform_get_drvdata(to_platform_device(dev))
+#define to_ssbi(dev) platform_get_drvdata(to_platform_device(dev))
-static inline u32 ssbi_readl(struct msm_ssbi *ssbi, u32 reg)
+static inline u32 ssbi_readl(struct ssbi *ssbi, u32 reg)
{
return readl(ssbi->base + reg);
}
-static inline void ssbi_writel(struct msm_ssbi *ssbi, u32 val, u32 reg)
+static inline void ssbi_writel(struct ssbi *ssbi, u32 val, u32 reg)
{
writel(val, ssbi->base + reg);
}
@@ -95,7 +95,7 @@ static inline void ssbi_writel(struct msm_ssbi *ssbi, u32 val, u32 reg)
*
* As such, this wait merely spins, with a udelay.
*/
-static int ssbi_wait_mask(struct msm_ssbi *ssbi, u32 set_mask, u32 clr_mask)
+static int ssbi_wait_mask(struct ssbi *ssbi, u32 set_mask, u32 clr_mask)
{
u32 timeout = SSBI_TIMEOUT_US;
u32 val;
@@ -111,7 +111,7 @@ static int ssbi_wait_mask(struct msm_ssbi *ssbi, u32 set_mask, u32 clr_mask)
}
static int
-msm_ssbi_read_bytes(struct msm_ssbi *ssbi, u16 addr, u8 *buf, int len)
+ssbi_read_bytes(struct ssbi *ssbi, u16 addr, u8 *buf, int len)
{
u32 cmd = SSBI_CMD_RDWRN | ((addr & 0xff) << 16);
int ret = 0;
@@ -140,7 +140,7 @@ err:
}
static int
-msm_ssbi_write_bytes(struct msm_ssbi *ssbi, u16 addr, u8 *buf, int len)
+ssbi_write_bytes(struct ssbi *ssbi, u16 addr, u8 *buf, int len)
{
int ret = 0;
@@ -172,7 +172,7 @@ err:
* busywait.
*/
static inline int
-msm_ssbi_pa_transfer(struct msm_ssbi *ssbi, u32 cmd, u8 *data)
+ssbi_pa_transfer(struct ssbi *ssbi, u32 cmd, u8 *data)
{
u32 timeout = SSBI_TIMEOUT_US;
u32 rd_status = 0;
@@ -197,7 +197,7 @@ msm_ssbi_pa_transfer(struct msm_ssbi *ssbi, u32 cmd, u8 *data)
}
static int
-msm_ssbi_pa_read_bytes(struct msm_ssbi *ssbi, u16 addr, u8 *buf, int len)
+ssbi_pa_read_bytes(struct ssbi *ssbi, u16 addr, u8 *buf, int len)
{
u32 cmd;
int ret = 0;
@@ -205,7 +205,7 @@ msm_ssbi_pa_read_bytes(struct msm_ssbi *ssbi, u16 addr, u8 *buf, int len)
cmd = SSBI_PA_CMD_RDWRN | (addr & SSBI_PA_CMD_ADDR_MASK) << 8;
while (len) {
- ret = msm_ssbi_pa_transfer(ssbi, cmd, buf);
+ ret = ssbi_pa_transfer(ssbi, cmd, buf);
if (ret)
goto err;
buf++;
@@ -217,14 +217,14 @@ err:
}
static int
-msm_ssbi_pa_write_bytes(struct msm_ssbi *ssbi, u16 addr, u8 *buf, int len)
+ssbi_pa_write_bytes(struct ssbi *ssbi, u16 addr, u8 *buf, int len)
{
u32 cmd;
int ret = 0;
while (len) {
cmd = (addr & SSBI_PA_CMD_ADDR_MASK) << 8 | *buf;
- ret = msm_ssbi_pa_transfer(ssbi, cmd, NULL);
+ ret = ssbi_pa_transfer(ssbi, cmd, NULL);
if (ret)
goto err;
buf++;
@@ -235,9 +235,9 @@ err:
return ret;
}
-int msm_ssbi_read(struct device *dev, u16 addr, u8 *buf, int len)
+int ssbi_read(struct device *dev, u16 addr, u8 *buf, int len)
{
- struct msm_ssbi *ssbi = to_msm_ssbi(dev);
+ struct ssbi *ssbi = to_ssbi(dev);
unsigned long flags;
int ret;
@@ -247,11 +247,11 @@ int msm_ssbi_read(struct device *dev, u16 addr, u8 *buf, int len)
return ret;
}
-EXPORT_SYMBOL_GPL(msm_ssbi_read);
+EXPORT_SYMBOL_GPL(ssbi_read);
-int msm_ssbi_write(struct device *dev, u16 addr, u8 *buf, int len)
+int ssbi_write(struct device *dev, u16 addr, u8 *buf, int len)
{
- struct msm_ssbi *ssbi = to_msm_ssbi(dev);
+ struct ssbi *ssbi = to_ssbi(dev);
unsigned long flags;
int ret;
@@ -261,17 +261,17 @@ int msm_ssbi_write(struct device *dev, u16 addr, u8 *buf, int len)
return ret;
}
-EXPORT_SYMBOL_GPL(msm_ssbi_write);
+EXPORT_SYMBOL_GPL(ssbi_write);
-static int msm_ssbi_probe(struct platform_device *pdev)
+static int ssbi_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
struct resource *mem_res;
- struct msm_ssbi *ssbi;
+ struct ssbi *ssbi;
int ret = 0;
const char *type;
- ssbi = kzalloc(sizeof(struct msm_ssbi), GFP_KERNEL);
+ ssbi = kzalloc(sizeof(struct ssbi), GFP_KERNEL);
if (!ssbi) {
pr_err("can not allocate ssbi_data\n");
return -ENOMEM;
@@ -312,11 +312,11 @@ static int msm_ssbi_probe(struct platform_device *pdev)
}
if (ssbi->controller_type == MSM_SBI_CTRL_PMIC_ARBITER) {
- ssbi->read = msm_ssbi_pa_read_bytes;
- ssbi->write = msm_ssbi_pa_write_bytes;
+ ssbi->read = ssbi_pa_read_bytes;
+ ssbi->write = ssbi_pa_write_bytes;
} else {
- ssbi->read = msm_ssbi_read_bytes;
- ssbi->write = msm_ssbi_write_bytes;
+ ssbi->read = ssbi_read_bytes;
+ ssbi->write = ssbi_write_bytes;
}
spin_lock_init(&ssbi->lock);
@@ -336,9 +336,9 @@ err_get_mem_res:
return ret;
}
-static int msm_ssbi_remove(struct platform_device *pdev)
+static int ssbi_remove(struct platform_device *pdev)
{
- struct msm_ssbi *ssbi = platform_get_drvdata(pdev);
+ struct ssbi *ssbi = platform_get_drvdata(pdev);
platform_set_drvdata(pdev, NULL);
iounmap(ssbi->base);
@@ -351,29 +351,29 @@ static struct of_device_id ssbi_match_table[] = {
{}
};
-static struct platform_driver msm_ssbi_driver = {
- .probe = msm_ssbi_probe,
- .remove = msm_ssbi_remove,
+static struct platform_driver ssbi_driver = {
+ .probe = ssbi_probe,
+ .remove = ssbi_remove,
.driver = {
- .name = "msm_ssbi",
+ .name = "ssbi",
.owner = THIS_MODULE,
.of_match_table = ssbi_match_table,
},
};
-static int __init msm_ssbi_init(void)
+static int __init ssbi_init(void)
{
- return platform_driver_register(&msm_ssbi_driver);
+ return platform_driver_register(&ssbi_driver);
}
-module_init(msm_ssbi_init);
+module_init(ssbi_init);
-static void __exit msm_ssbi_exit(void)
+static void __exit ssbi_exit(void)
{
- platform_driver_unregister(&msm_ssbi_driver);
+ platform_driver_unregister(&ssbi_driver);
}
-module_exit(msm_ssbi_exit)
+module_exit(ssbi_exit)
MODULE_LICENSE("GPL v2");
MODULE_VERSION("1.0");
-MODULE_ALIAS("platform:msm_ssbi");
+MODULE_ALIAS("platform:ssbi");
MODULE_AUTHOR("Dima Zavin <dima@android.com>");