Skip to content
Snippets Groups Projects
Commit fc53f4ff authored by Rohit Vaswani's avatar Rohit Vaswani
Browse files

ssbi: Move ssbi struct to header file


Add support to use SSBI1 and SSBI2 from a single driver.

Change-Id: I673adc3633851dd76d2deb5ffbb4182ece578029
Acked-by: default avatarEdward Rodrigues <erodrigu@qti.qualcomm.com>
Signed-off-by: default avatarRohit Vaswani <rvaswani@codeaurora.org>
parent 23319934
No related branches found
No related tags found
No related merge requests found
...@@ -147,15 +147,6 @@ int mode_2_ram_array[GENI_RAM_SIZE] = { ...@@ -147,15 +147,6 @@ int mode_2_ram_array[GENI_RAM_SIZE] = {
0x00041017, 0x00101000, 0x00001200, 0x0008201C, 0x00000000 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)) #define to_ssbi(dev) platform_get_drvdata(to_platform_device(dev))
static inline u32 ssbi_readl(struct ssbi *ssbi, u32 reg) 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) ...@@ -424,7 +415,7 @@ int ssbi_write(struct device *dev, u16 addr, u8 *buf, int len)
} }
EXPORT_SYMBOL_GPL(ssbi_write); 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; int i;
...@@ -451,7 +442,7 @@ static void set_ssbi_mode_2(void __iomem *geni_offset) ...@@ -451,7 +442,7 @@ static void set_ssbi_mode_2(void __iomem *geni_offset)
GENI_ARB_CHNL_CONFIG_ADDDR + 4 * i); 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; int i;
...@@ -523,10 +514,8 @@ static int ssbi_probe(struct platform_device *pdev) ...@@ -523,10 +514,8 @@ static int ssbi_probe(struct platform_device *pdev)
ssbi->controller_type = MSM_SBI_CTRL_PMIC_ARBITER; ssbi->controller_type = MSM_SBI_CTRL_PMIC_ARBITER;
else if (strcmp(type, "geni-ssbi-arbiter") == 0) { else if (strcmp(type, "geni-ssbi-arbiter") == 0) {
ssbi->controller_type = FSM_SBI_CTRL_GENI_SSBI_ARBITER; ssbi->controller_type = FSM_SBI_CTRL_GENI_SSBI_ARBITER;
set_ssbi_mode_1(ssbi->base);
} else if (strcmp(type, "geni-ssbi2-arbiter") == 0) { } else if (strcmp(type, "geni-ssbi2-arbiter") == 0) {
ssbi->controller_type = FSM_SBI_CTRL_GENI_SSBI2_ARBITER; ssbi->controller_type = FSM_SBI_CTRL_GENI_SSBI2_ARBITER;
set_ssbi_mode_2(ssbi->base);
} else { } else {
pr_err("Unknown qcom,controller-type\n"); pr_err("Unknown qcom,controller-type\n");
ret = -EINVAL; ret = -EINVAL;
......
/* Copyright (C) 2010 Google, Inc. /* 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> * Author: Dima Zavin <dima@android.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -35,6 +35,17 @@ struct ssbi_platform_data { ...@@ -35,6 +35,17 @@ struct ssbi_platform_data {
enum ssbi_controller_type controller_type; 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_write(struct device *dev, u16 addr, u8 *buf, int len);
int ssbi_read(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 #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment