aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/Makefile2
-rw-r--r--drivers/mfd/Kconfig2
-rw-r--r--drivers/mfd/pm8921-core.c14
-rw-r--r--drivers/ssbi/Kconfig4
-rw-r--r--drivers/ssbi/Makefile2
-rw-r--r--drivers/ssbi/ssbi.c86
-rw-r--r--include/linux/ssbi.h (renamed from include/linux/msm_ssbi.h)18
7 files changed, 64 insertions, 64 deletions
diff --git a/drivers/Makefile b/drivers/Makefile
index 778821ba3f68..4865ed24708a 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -114,7 +114,7 @@ obj-y += firmware/
114obj-$(CONFIG_CRYPTO) += crypto/ 114obj-$(CONFIG_CRYPTO) += crypto/
115obj-$(CONFIG_SUPERH) += sh/ 115obj-$(CONFIG_SUPERH) += sh/
116obj-$(CONFIG_ARCH_SHMOBILE) += sh/ 116obj-$(CONFIG_ARCH_SHMOBILE) += sh/
117obj-$(CONFIG_MSM_SSBI) += ssbi/ 117obj-$(CONFIG_SSBI) += ssbi/
118ifndef CONFIG_ARCH_USES_GETTIMEOFFSET 118ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
119obj-y += clocksource/ 119obj-y += clocksource/
120endif 120endif
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 671f5b171c73..5bfa7bb555b7 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -990,7 +990,7 @@ config MFD_PM8XXX
990 990
991config MFD_PM8921_CORE 991config MFD_PM8921_CORE
992 tristate "Qualcomm PM8921 PMIC chip" 992 tristate "Qualcomm PM8921 PMIC chip"
993 depends on MSM_SSBI 993 depends on SSBI
994 select MFD_CORE 994 select MFD_CORE
995 select MFD_PM8XXX 995 select MFD_PM8XXX
996 help 996 help
diff --git a/drivers/mfd/pm8921-core.c b/drivers/mfd/pm8921-core.c
index d4b297cbd801..ecc137ffa8c3 100644
--- a/drivers/mfd/pm8921-core.c
+++ b/drivers/mfd/pm8921-core.c
@@ -17,7 +17,7 @@
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/err.h> 19#include <linux/err.h>
20#include <linux/msm_ssbi.h> 20#include <linux/ssbi.h>
21#include <linux/mfd/core.h> 21#include <linux/mfd/core.h>
22#include <linux/mfd/pm8xxx/pm8921.h> 22#include <linux/mfd/pm8xxx/pm8921.h>
23#include <linux/mfd/pm8xxx/core.h> 23#include <linux/mfd/pm8xxx/core.h>
@@ -35,7 +35,7 @@ static int pm8921_readb(const struct device *dev, u16 addr, u8 *val)
35 const struct pm8xxx_drvdata *pm8921_drvdata = dev_get_drvdata(dev); 35 const struct pm8xxx_drvdata *pm8921_drvdata = dev_get_drvdata(dev);
36 const struct pm8921 *pmic = pm8921_drvdata->pm_chip_data; 36 const struct pm8921 *pmic = pm8921_drvdata->pm_chip_data;
37 37
38 return msm_ssbi_read(pmic->dev->parent, addr, val, 1); 38 return ssbi_read(pmic->dev->parent, addr, val, 1);
39} 39}
40 40
41static int pm8921_writeb(const struct device *dev, u16 addr, u8 val) 41static int pm8921_writeb(const struct device *dev, u16 addr, u8 val)
@@ -43,7 +43,7 @@ static int pm8921_writeb(const struct device *dev, u16 addr, u8 val)
43 const struct pm8xxx_drvdata *pm8921_drvdata = dev_get_drvdata(dev); 43 const struct pm8xxx_drvdata *pm8921_drvdata = dev_get_drvdata(dev);
44 const struct pm8921 *pmic = pm8921_drvdata->pm_chip_data; 44 const struct pm8921 *pmic = pm8921_drvdata->pm_chip_data;
45 45
46 return msm_ssbi_write(pmic->dev->parent, addr, &val, 1); 46 return ssbi_write(pmic->dev->parent, addr, &val, 1);
47} 47}
48 48
49static int pm8921_read_buf(const struct device *dev, u16 addr, u8 *buf, 49static int pm8921_read_buf(const struct device *dev, u16 addr, u8 *buf,
@@ -52,7 +52,7 @@ static int pm8921_read_buf(const struct device *dev, u16 addr, u8 *buf,
52 const struct pm8xxx_drvdata *pm8921_drvdata = dev_get_drvdata(dev); 52 const struct pm8xxx_drvdata *pm8921_drvdata = dev_get_drvdata(dev);
53 const struct pm8921 *pmic = pm8921_drvdata->pm_chip_data; 53 const struct pm8921 *pmic = pm8921_drvdata->pm_chip_data;
54 54
55 return msm_ssbi_read(pmic->dev->parent, addr, buf, cnt); 55 return ssbi_read(pmic->dev->parent, addr, buf, cnt);
56} 56}
57 57
58static int pm8921_write_buf(const struct device *dev, u16 addr, u8 *buf, 58static int pm8921_write_buf(const struct device *dev, u16 addr, u8 *buf,
@@ -61,7 +61,7 @@ static int pm8921_write_buf(const struct device *dev, u16 addr, u8 *buf,
61 const struct pm8xxx_drvdata *pm8921_drvdata = dev_get_drvdata(dev); 61 const struct pm8xxx_drvdata *pm8921_drvdata = dev_get_drvdata(dev);
62 const struct pm8921 *pmic = pm8921_drvdata->pm_chip_data; 62 const struct pm8921 *pmic = pm8921_drvdata->pm_chip_data;
63 63
64 return msm_ssbi_write(pmic->dev->parent, addr, buf, cnt); 64 return ssbi_write(pmic->dev->parent, addr, buf, cnt);
65} 65}
66 66
67static int pm8921_read_irq_stat(const struct device *dev, int irq) 67static int pm8921_read_irq_stat(const struct device *dev, int irq)
@@ -124,7 +124,7 @@ static int pm8921_probe(struct platform_device *pdev)
124 } 124 }
125 125
126 /* Read PMIC chip revision */ 126 /* Read PMIC chip revision */
127 rc = msm_ssbi_read(pdev->dev.parent, REG_HWREV, &val, sizeof(val)); 127 rc = ssbi_read(pdev->dev.parent, REG_HWREV, &val, sizeof(val));
128 if (rc) { 128 if (rc) {
129 pr_err("Failed to read hw rev reg %d:rc=%d\n", REG_HWREV, rc); 129 pr_err("Failed to read hw rev reg %d:rc=%d\n", REG_HWREV, rc);
130 goto err_read_rev; 130 goto err_read_rev;
@@ -133,7 +133,7 @@ static int pm8921_probe(struct platform_device *pdev)
133 rev = val; 133 rev = val;
134 134
135 /* Read PMIC chip revision 2 */ 135 /* Read PMIC chip revision 2 */
136 rc = msm_ssbi_read(pdev->dev.parent, REG_HWREV_2, &val, sizeof(val)); 136 rc = ssbi_read(pdev->dev.parent, REG_HWREV_2, &val, sizeof(val));
137 if (rc) { 137 if (rc) {
138 pr_err("Failed to read hw rev 2 reg %d:rc=%d\n", 138 pr_err("Failed to read hw rev 2 reg %d:rc=%d\n",
139 REG_HWREV_2, rc); 139 REG_HWREV_2, rc);
diff --git a/drivers/ssbi/Kconfig b/drivers/ssbi/Kconfig
index c7bc534ddf50..1ae4040afedd 100644
--- a/drivers/ssbi/Kconfig
+++ b/drivers/ssbi/Kconfig
@@ -1,10 +1,10 @@
1# 1#
2# MSM SSBI bus support 2# SSBI bus support
3# 3#
4 4
5menu "Qualcomm MSM SSBI bus support" 5menu "Qualcomm MSM SSBI bus support"
6 6
7config MSM_SSBI 7config SSBI
8 tristate "Qualcomm Single-wire Serial Bus Interface (SSBI)" 8 tristate "Qualcomm Single-wire Serial Bus Interface (SSBI)"
9 help 9 help
10 If you say yes to this option, support will be included for the 10 If you say yes to this option, support will be included for the
diff --git a/drivers/ssbi/Makefile b/drivers/ssbi/Makefile
index 22e408f45d61..38fb70c31caf 100644
--- a/drivers/ssbi/Makefile
+++ b/drivers/ssbi/Makefile
@@ -1 +1 @@
obj-$(CONFIG_MSM_SSBI) += ssbi.o obj-$(CONFIG_SSBI) += ssbi.o
diff --git a/drivers/ssbi/ssbi.c b/drivers/ssbi/ssbi.c
index b056a072c3b3..f32da0258a8e 100644
--- a/drivers/ssbi/ssbi.c
+++ b/drivers/ssbi/ssbi.c
@@ -1,4 +1,4 @@
1/* Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved. 1/* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
2 * Copyright (c) 2010, Google Inc. 2 * Copyright (c) 2010, Google Inc.
3 * 3 *
4 * Original authors: Code Aurora Forum 4 * Original authors: Code Aurora Forum
@@ -24,7 +24,7 @@
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/msm_ssbi.h> 27#include <linux/ssbi.h>
28#include <linux/module.h> 28#include <linux/module.h>
29#include <linux/of.h> 29#include <linux/of.h>
30#include <linux/of_device.h> 30#include <linux/of_device.h>
@@ -65,23 +65,23 @@
65 65
66#define SSBI_TIMEOUT_US 100 66#define SSBI_TIMEOUT_US 100
67 67
68struct msm_ssbi { 68struct ssbi {
69 struct device *slave; 69 struct device *slave;
70 void __iomem *base; 70 void __iomem *base;
71 spinlock_t lock; 71 spinlock_t lock;
72 enum msm_ssbi_controller_type controller_type; 72 enum ssbi_controller_type controller_type;
73 int (*read)(struct msm_ssbi *, u16 addr, u8 *buf, int len); 73 int (*read)(struct ssbi *, u16 addr, u8 *buf, int len);
74 int (*write)(struct msm_ssbi *, u16 addr, u8 *buf, int len); 74 int (*write)(struct ssbi *, u16 addr, u8 *buf, int len);
75}; 75};
76 76
77#define to_msm_ssbi(dev) platform_get_drvdata(to_platform_device(dev)) 77#define to_ssbi(dev) platform_get_drvdata(to_platform_device(dev))
78 78
79static inline u32 ssbi_readl(struct msm_ssbi *ssbi, u32 reg) 79static inline u32 ssbi_readl(struct ssbi *ssbi, u32 reg)
80{ 80{
81 return readl(ssbi->base + reg); 81 return readl(ssbi->base + reg);
82} 82}
83 83
84static inline void ssbi_writel(struct msm_ssbi *ssbi, u32 val, u32 reg) 84static inline void ssbi_writel(struct ssbi *ssbi, u32 val, u32 reg)
85{ 85{
86 writel(val, ssbi->base + reg); 86 writel(val, ssbi->base + reg);
87} 87}
@@ -95,7 +95,7 @@ static inline void ssbi_writel(struct msm_ssbi *ssbi, u32 val, u32 reg)
95 * 95 *
96 * As such, this wait merely spins, with a udelay. 96 * As such, this wait merely spins, with a udelay.
97 */ 97 */
98static int ssbi_wait_mask(struct msm_ssbi *ssbi, u32 set_mask, u32 clr_mask) 98static int ssbi_wait_mask(struct ssbi *ssbi, u32 set_mask, u32 clr_mask)
99{ 99{
100 u32 timeout = SSBI_TIMEOUT_US; 100 u32 timeout = SSBI_TIMEOUT_US;
101 u32 val; 101 u32 val;
@@ -111,7 +111,7 @@ static int ssbi_wait_mask(struct msm_ssbi *ssbi, u32 set_mask, u32 clr_mask)
111} 111}
112 112
113static int 113static int
114msm_ssbi_read_bytes(struct msm_ssbi *ssbi, u16 addr, u8 *buf, int len) 114ssbi_read_bytes(struct ssbi *ssbi, u16 addr, u8 *buf, int len)
115{ 115{
116 u32 cmd = SSBI_CMD_RDWRN | ((addr & 0xff) << 16); 116 u32 cmd = SSBI_CMD_RDWRN | ((addr & 0xff) << 16);
117 int ret = 0; 117 int ret = 0;
@@ -140,7 +140,7 @@ err:
140} 140}
141 141
142static int 142static int
143msm_ssbi_write_bytes(struct msm_ssbi *ssbi, u16 addr, u8 *buf, int len) 143ssbi_write_bytes(struct ssbi *ssbi, u16 addr, u8 *buf, int len)
144{ 144{
145 int ret = 0; 145 int ret = 0;
146 146
@@ -172,7 +172,7 @@ err:
172 * busywait. 172 * busywait.
173 */ 173 */
174static inline int 174static inline int
175msm_ssbi_pa_transfer(struct msm_ssbi *ssbi, u32 cmd, u8 *data) 175ssbi_pa_transfer(struct ssbi *ssbi, u32 cmd, u8 *data)
176{ 176{
177 u32 timeout = SSBI_TIMEOUT_US; 177 u32 timeout = SSBI_TIMEOUT_US;
178 u32 rd_status = 0; 178 u32 rd_status = 0;
@@ -197,7 +197,7 @@ msm_ssbi_pa_transfer(struct msm_ssbi *ssbi, u32 cmd, u8 *data)
197} 197}
198 198
199static int 199static int
200msm_ssbi_pa_read_bytes(struct msm_ssbi *ssbi, u16 addr, u8 *buf, int len) 200ssbi_pa_read_bytes(struct ssbi *ssbi, u16 addr, u8 *buf, int len)
201{ 201{
202 u32 cmd; 202 u32 cmd;
203 int ret = 0; 203 int ret = 0;
@@ -205,7 +205,7 @@ msm_ssbi_pa_read_bytes(struct msm_ssbi *ssbi, u16 addr, u8 *buf, int len)
205 cmd = SSBI_PA_CMD_RDWRN | (addr & SSBI_PA_CMD_ADDR_MASK) << 8; 205 cmd = SSBI_PA_CMD_RDWRN | (addr & SSBI_PA_CMD_ADDR_MASK) << 8;
206 206
207 while (len) { 207 while (len) {
208 ret = msm_ssbi_pa_transfer(ssbi, cmd, buf); 208 ret = ssbi_pa_transfer(ssbi, cmd, buf);
209 if (ret) 209 if (ret)
210 goto err; 210 goto err;
211 buf++; 211 buf++;
@@ -217,14 +217,14 @@ err:
217} 217}
218 218
219static int 219static int
220msm_ssbi_pa_write_bytes(struct msm_ssbi *ssbi, u16 addr, u8 *buf, int len) 220ssbi_pa_write_bytes(struct ssbi *ssbi, u16 addr, u8 *buf, int len)
221{ 221{
222 u32 cmd; 222 u32 cmd;
223 int ret = 0; 223 int ret = 0;
224 224
225 while (len) { 225 while (len) {
226 cmd = (addr & SSBI_PA_CMD_ADDR_MASK) << 8 | *buf; 226 cmd = (addr & SSBI_PA_CMD_ADDR_MASK) << 8 | *buf;
227 ret = msm_ssbi_pa_transfer(ssbi, cmd, NULL); 227 ret = ssbi_pa_transfer(ssbi, cmd, NULL);
228 if (ret) 228 if (ret)
229 goto err; 229 goto err;
230 buf++; 230 buf++;
@@ -235,9 +235,9 @@ err:
235 return ret; 235 return ret;
236} 236}
237 237
238int msm_ssbi_read(struct device *dev, u16 addr, u8 *buf, int len) 238int ssbi_read(struct device *dev, u16 addr, u8 *buf, int len)
239{ 239{
240 struct msm_ssbi *ssbi = to_msm_ssbi(dev); 240 struct ssbi *ssbi = to_ssbi(dev);
241 unsigned long flags; 241 unsigned long flags;
242 int ret; 242 int ret;
243 243
@@ -247,11 +247,11 @@ int msm_ssbi_read(struct device *dev, u16 addr, u8 *buf, int len)
247 247
248 return ret; 248 return ret;
249} 249}
250EXPORT_SYMBOL_GPL(msm_ssbi_read); 250EXPORT_SYMBOL_GPL(ssbi_read);
251 251
252int msm_ssbi_write(struct device *dev, u16 addr, u8 *buf, int len) 252int ssbi_write(struct device *dev, u16 addr, u8 *buf, int len)
253{ 253{
254 struct msm_ssbi *ssbi = to_msm_ssbi(dev); 254 struct ssbi *ssbi = to_ssbi(dev);
255 unsigned long flags; 255 unsigned long flags;
256 int ret; 256 int ret;
257 257
@@ -261,17 +261,17 @@ int msm_ssbi_write(struct device *dev, u16 addr, u8 *buf, int len)
261 261
262 return ret; 262 return ret;
263} 263}
264EXPORT_SYMBOL_GPL(msm_ssbi_write); 264EXPORT_SYMBOL_GPL(ssbi_write);
265 265
266static int msm_ssbi_probe(struct platform_device *pdev) 266static int ssbi_probe(struct platform_device *pdev)
267{ 267{
268 struct device_node *np = pdev->dev.of_node; 268 struct device_node *np = pdev->dev.of_node;
269 struct resource *mem_res; 269 struct resource *mem_res;
270 struct msm_ssbi *ssbi; 270 struct ssbi *ssbi;
271 int ret = 0; 271 int ret = 0;
272 const char *type; 272 const char *type;
273 273
274 ssbi = kzalloc(sizeof(struct msm_ssbi), GFP_KERNEL); 274 ssbi = kzalloc(sizeof(struct ssbi), GFP_KERNEL);
275 if (!ssbi) { 275 if (!ssbi) {
276 pr_err("can not allocate ssbi_data\n"); 276 pr_err("can not allocate ssbi_data\n");
277 return -ENOMEM; 277 return -ENOMEM;
@@ -312,11 +312,11 @@ static int msm_ssbi_probe(struct platform_device *pdev)
312 } 312 }
313 313
314 if (ssbi->controller_type == MSM_SBI_CTRL_PMIC_ARBITER) { 314 if (ssbi->controller_type == MSM_SBI_CTRL_PMIC_ARBITER) {
315 ssbi->read = msm_ssbi_pa_read_bytes; 315 ssbi->read = ssbi_pa_read_bytes;
316 ssbi->write = msm_ssbi_pa_write_bytes; 316 ssbi->write = ssbi_pa_write_bytes;
317 } else { 317 } else {
318 ssbi->read = msm_ssbi_read_bytes; 318 ssbi->read = ssbi_read_bytes;
319 ssbi->write = msm_ssbi_write_bytes; 319 ssbi->write = ssbi_write_bytes;
320 } 320 }
321 321
322 spin_lock_init(&ssbi->lock); 322 spin_lock_init(&ssbi->lock);
@@ -336,9 +336,9 @@ err_get_mem_res:
336 return ret; 336 return ret;
337} 337}
338 338
339static int msm_ssbi_remove(struct platform_device *pdev) 339static int ssbi_remove(struct platform_device *pdev)
340{ 340{
341 struct msm_ssbi *ssbi = platform_get_drvdata(pdev); 341 struct ssbi *ssbi = platform_get_drvdata(pdev);
342 342
343 platform_set_drvdata(pdev, NULL); 343 platform_set_drvdata(pdev, NULL);
344 iounmap(ssbi->base); 344 iounmap(ssbi->base);
@@ -351,29 +351,29 @@ static struct of_device_id ssbi_match_table[] = {
351 {} 351 {}
352}; 352};
353 353
354static struct platform_driver msm_ssbi_driver = { 354static struct platform_driver ssbi_driver = {
355 .probe = msm_ssbi_probe, 355 .probe = ssbi_probe,
356 .remove = msm_ssbi_remove, 356 .remove = ssbi_remove,
357 .driver = { 357 .driver = {
358 .name = "msm_ssbi", 358 .name = "ssbi",
359 .owner = THIS_MODULE, 359 .owner = THIS_MODULE,
360 .of_match_table = ssbi_match_table, 360 .of_match_table = ssbi_match_table,
361 }, 361 },
362}; 362};
363 363
364static int __init msm_ssbi_init(void) 364static int __init ssbi_init(void)
365{ 365{
366 return platform_driver_register(&msm_ssbi_driver); 366 return platform_driver_register(&ssbi_driver);
367} 367}
368module_init(msm_ssbi_init); 368module_init(ssbi_init);
369 369
370static void __exit msm_ssbi_exit(void) 370static void __exit ssbi_exit(void)
371{ 371{
372 platform_driver_unregister(&msm_ssbi_driver); 372 platform_driver_unregister(&ssbi_driver);
373} 373}
374module_exit(msm_ssbi_exit) 374module_exit(ssbi_exit)
375 375
376MODULE_LICENSE("GPL v2"); 376MODULE_LICENSE("GPL v2");
377MODULE_VERSION("1.0"); 377MODULE_VERSION("1.0");
378MODULE_ALIAS("platform:msm_ssbi"); 378MODULE_ALIAS("platform:ssbi");
379MODULE_AUTHOR("Dima Zavin <dima@android.com>"); 379MODULE_AUTHOR("Dima Zavin <dima@android.com>");
diff --git a/include/linux/msm_ssbi.h b/include/linux/ssbi.h
index 0fe245bb2940..44ef5da21470 100644
--- a/include/linux/msm_ssbi.h
+++ b/include/linux/ssbi.h
@@ -12,27 +12,27 @@
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 */ 13 */
14 14
15#ifndef _LINUX_MSM_SSBI_H 15#ifndef _LINUX_SSBI_H
16#define _LINUX_MSM_SSBI_H 16#define _LINUX_SSBI_H
17 17
18#include <linux/types.h> 18#include <linux/types.h>
19 19
20struct msm_ssbi_slave_info { 20struct ssbi_slave_info {
21 const char *name; 21 const char *name;
22 void *platform_data; 22 void *platform_data;
23}; 23};
24 24
25enum msm_ssbi_controller_type { 25enum ssbi_controller_type {
26 MSM_SBI_CTRL_SSBI = 0, 26 MSM_SBI_CTRL_SSBI = 0,
27 MSM_SBI_CTRL_SSBI2, 27 MSM_SBI_CTRL_SSBI2,
28 MSM_SBI_CTRL_PMIC_ARBITER, 28 MSM_SBI_CTRL_PMIC_ARBITER,
29}; 29};
30 30
31struct msm_ssbi_platform_data { 31struct ssbi_platform_data {
32 struct msm_ssbi_slave_info slave; 32 struct ssbi_slave_info slave;
33 enum msm_ssbi_controller_type controller_type; 33 enum ssbi_controller_type controller_type;
34}; 34};
35 35
36int msm_ssbi_write(struct device *dev, u16 addr, u8 *buf, int len); 36int ssbi_write(struct device *dev, u16 addr, u8 *buf, int len);
37int msm_ssbi_read(struct device *dev, u16 addr, u8 *buf, int len); 37int ssbi_read(struct device *dev, u16 addr, u8 *buf, int len);
38#endif 38#endif