From fc53f4ff3cbda93cf522c524a77e57dedfd6116a Mon Sep 17 00:00:00 2001
From: Rohit Vaswani <rvaswani@codeaurora.org>
Date: Mon, 17 Mar 2014 19:09:42 -0700
Subject: [PATCH] ssbi: Move ssbi struct to header file
Add support to use SSBI1 and SSBI2 from a single driver.
Change-Id: I673adc3633851dd76d2deb5ffbb4182ece578029
Acked-by: Edward Rodrigues <erodrigu@qti.qualcomm.com>
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
---
drivers/ssbi/ssbi.c | 15 ++-------------
include/linux/ssbi.h | 13 ++++++++++++-
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/drivers/ssbi/ssbi.c b/drivers/ssbi/ssbi.c
index 684602c42275..0973b6956533 100644
--- a/drivers/ssbi/ssbi.c
+++ b/drivers/ssbi/ssbi.c
@@ -147,15 +147,6 @@ int mode_2_ram_array[GENI_RAM_SIZE] = {
0x00041017, 0x00101000, 0x00001200, 0x0008201C, 0x00000000
};
-struct ssbi {
- struct device *slave;
- void __iomem *base;
- spinlock_t lock;
- 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_ssbi(dev) platform_get_drvdata(to_platform_device(dev))
static inline u32 ssbi_readl(struct ssbi *ssbi, u32 reg)
@@ -424,7 +415,7 @@ int ssbi_write(struct device *dev, u16 addr, u8 *buf, int len)
}
EXPORT_SYMBOL_GPL(ssbi_write);
-static void set_ssbi_mode_2(void __iomem *geni_offset)
+void set_ssbi_mode_2(void __iomem *geni_offset)
{
int i;
@@ -451,7 +442,7 @@ static void set_ssbi_mode_2(void __iomem *geni_offset)
GENI_ARB_CHNL_CONFIG_ADDDR + 4 * i);
}
-static void set_ssbi_mode_1(void __iomem *geni_offset)
+void set_ssbi_mode_1(void __iomem *geni_offset)
{
int i;
@@ -523,10 +514,8 @@ static int ssbi_probe(struct platform_device *pdev)
ssbi->controller_type = MSM_SBI_CTRL_PMIC_ARBITER;
else if (strcmp(type, "geni-ssbi-arbiter") == 0) {
ssbi->controller_type = FSM_SBI_CTRL_GENI_SSBI_ARBITER;
- set_ssbi_mode_1(ssbi->base);
} else if (strcmp(type, "geni-ssbi2-arbiter") == 0) {
ssbi->controller_type = FSM_SBI_CTRL_GENI_SSBI2_ARBITER;
- set_ssbi_mode_2(ssbi->base);
} else {
pr_err("Unknown qcom,controller-type\n");
ret = -EINVAL;
diff --git a/include/linux/ssbi.h b/include/linux/ssbi.h
index 2631f8f11d1a..5050e6ea5d0e 100644
--- a/include/linux/ssbi.h
+++ b/include/linux/ssbi.h
@@ -1,5 +1,5 @@
/* Copyright (C) 2010 Google, Inc.
- * Copyright (c) 2011,2013, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011,2013-2014 The Linux Foundation. All rights reserved.
* Author: Dima Zavin <dima@android.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -35,6 +35,17 @@ struct ssbi_platform_data {
enum ssbi_controller_type controller_type;
};
+struct ssbi {
+ struct device *slave;
+ void __iomem *base;
+ spinlock_t lock;
+ 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);
+};
+
int ssbi_write(struct device *dev, u16 addr, u8 *buf, int len);
int ssbi_read(struct device *dev, u16 addr, u8 *buf, int len);
+void set_ssbi_mode_1(void __iomem *geni_offset);
+void set_ssbi_mode_2(void __iomem *geni_offset);
#endif
--
GitLab