NFC: Driver: Remove SW WAR to enable NFC Clock
Removed SW WAR to enable NFC Clock, this feature not required on Pineapple Change-Id: I118502df98293a48f58569c91444b415076329c4
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
9f0ff151a7
commit
f616cf76bd
69
nfc/common.c
69
nfc/common.c
@@ -64,21 +64,16 @@ int nfc_parse_dt(struct device *dev, struct platform_configs *nfc_configs,
|
|||||||
/* some products like sn220 does not required fw dwl pin */
|
/* some products like sn220 does not required fw dwl pin */
|
||||||
nfc_gpio->dwl_req = of_get_named_gpio(np, DTS_FWDN_GPIO_STR, 0);
|
nfc_gpio->dwl_req = of_get_named_gpio(np, DTS_FWDN_GPIO_STR, 0);
|
||||||
/* not returning failure for dwl gpio as it is optional for sn220 */
|
/* not returning failure for dwl gpio as it is optional for sn220 */
|
||||||
if ((!gpio_is_valid(nfc_gpio->dwl_req)))
|
if ((!gpio_is_valid(nfc_gpio->dwl_req))){
|
||||||
pr_warn("%s: nfc dwl_req gpio invalid %d\n", __func__,
|
pr_warn("%s: nfc dwl_req gpio invalid %d\n", __func__,
|
||||||
nfc_gpio->dwl_req);
|
nfc_gpio->dwl_req);
|
||||||
/* Read clock request gpio configuration if MGPIO configurations are not preasent */
|
}
|
||||||
if (of_property_read_string(np, DTS_CLKSRC_GPIO_STR, &nfc_configs->clk_src_name)) {
|
/* Read clkreq GPIO pin number from DTSI */
|
||||||
nfc_configs->clk_pin_voting = false;
|
nfc_gpio->clkreq = of_get_named_gpio(np, DTS_CLKREQ_GPIO_STR, 0);
|
||||||
nfc_gpio->clkreq = of_get_named_gpio(np, DTS_CLKREQ_GPIO_STR, 0);
|
if (!gpio_is_valid(nfc_gpio->clkreq)) {
|
||||||
if (!gpio_is_valid(nfc_gpio->clkreq)) {
|
|
||||||
dev_err(dev, "clkreq gpio invalid %d\n", nfc_gpio->clkreq);
|
dev_err(dev, "clkreq gpio invalid %d\n", nfc_gpio->clkreq);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
|
||||||
nfc_configs->clk_pin_voting = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Read DTS_SZONE_STR to check secure zone support */
|
/* Read DTS_SZONE_STR to check secure zone support */
|
||||||
if (of_property_read_string(np, DTS_SZONE_STR, &nfc_configs->szone)) {
|
if (of_property_read_string(np, DTS_SZONE_STR, &nfc_configs->szone)) {
|
||||||
@@ -86,8 +81,8 @@ int nfc_parse_dt(struct device *dev, struct platform_configs *nfc_configs,
|
|||||||
}else
|
}else
|
||||||
nfc_configs->CNSS_NFC_HW_SECURE_ENABLE = true;
|
nfc_configs->CNSS_NFC_HW_SECURE_ENABLE = true;
|
||||||
|
|
||||||
pr_info("%s: irq %d, ven %d, dwl %d, clkreq %d, clk_pin_voting %d \n", __func__, nfc_gpio->irq, nfc_gpio->ven,
|
pr_info("%s: irq %d, ven %d, dwl %d, clkreq %d \n", __func__, nfc_gpio->irq, nfc_gpio->ven,
|
||||||
nfc_gpio->dwl_req, nfc_gpio->clkreq, nfc_configs->clk_pin_voting);
|
nfc_gpio->dwl_req, nfc_gpio->clkreq);
|
||||||
|
|
||||||
/* optional property */
|
/* optional property */
|
||||||
ret = of_property_read_u32_array(np, NFC_LDO_VOL_DT_NAME,
|
ret = of_property_read_u32_array(np, NFC_LDO_VOL_DT_NAME,
|
||||||
@@ -353,21 +348,9 @@ static int nfc_ioctl_power_states(struct nfc_dev *nfc_dev, unsigned long arg)
|
|||||||
nfc_dev->nfc_state = NFC_STATE_NCI;
|
nfc_dev->nfc_state = NFC_STATE_NCI;
|
||||||
|
|
||||||
} else if (arg == NFC_ENABLE) {
|
} else if (arg == NFC_ENABLE) {
|
||||||
if(nfc_dev->configs.clk_pin_voting) {
|
|
||||||
/* Enabling nfc clock */
|
|
||||||
ret = nfc_clock_select(nfc_dev);
|
|
||||||
if (ret)
|
|
||||||
pr_err("%s unable to select clock\n", __func__);
|
|
||||||
}
|
|
||||||
/* Setting flag true when NFC is enabled */
|
/* Setting flag true when NFC is enabled */
|
||||||
nfc_dev->cold_reset.is_nfc_enabled = true;
|
nfc_dev->cold_reset.is_nfc_enabled = true;
|
||||||
} else if (arg == NFC_DISABLE) {
|
} else if (arg == NFC_DISABLE) {
|
||||||
if(nfc_dev->configs.clk_pin_voting) {
|
|
||||||
/* Disabling nfc clock */
|
|
||||||
ret = nfc_clock_deselect(nfc_dev);
|
|
||||||
if (ret)
|
|
||||||
pr_err("%s unable to disable clock\n", __func__);
|
|
||||||
}
|
|
||||||
/* Setting flag true when NFC is disabled */
|
/* Setting flag true when NFC is disabled */
|
||||||
nfc_dev->cold_reset.is_nfc_enabled = false;
|
nfc_dev->cold_reset.is_nfc_enabled = false;
|
||||||
} else {
|
} else {
|
||||||
@@ -439,29 +422,19 @@ int nfc_post_init(struct nfc_dev *nfc_dev)
|
|||||||
__func__, nfc_gpio->dwl_req);
|
__func__, nfc_gpio->dwl_req);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!(nfc_configs.clk_pin_voting)){
|
/* Read clkreq GPIO number from device tree*/
|
||||||
ret = configure_gpio(nfc_gpio->clkreq, GPIO_INPUT);
|
ret = of_property_read_u32_index(nfc_dev->i2c_dev.client->dev.of_node, DTS_CLKREQ_GPIO_STR, 1, &clkreq_gpio);
|
||||||
if (ret) {
|
if (ret < 0) {
|
||||||
pr_err("%s: unable to request nfc clkreq gpio [%d]\n",
|
pr_err("%s Failed to read clkreq gipo number, ret: %d\n", __func__, ret);
|
||||||
__func__, nfc_gpio->clkreq);
|
return ret;
|
||||||
return ret;
|
}
|
||||||
}
|
/* configure clkreq GPIO as wakeup capable */
|
||||||
|
ret = msm_gpio_mpm_wake_set(clkreq_gpio, true);
|
||||||
/* Read clkreq GPIO number from device tree*/
|
if (ret < 0) {
|
||||||
ret = of_property_read_u32_index(nfc_dev->i2c_dev.client->dev.of_node, DTS_CLKREQ_GPIO_STR, 1, &clkreq_gpio);
|
pr_err("%s Failed to setup clkreq gpio %d as wakeup capable, ret: %d\n", __func__, clkreq_gpio , ret);
|
||||||
if (ret < 0) {
|
return ret;
|
||||||
pr_err("%s Failed to read clkreq gipo number, ret: %d\n", __func__, ret);
|
} else {
|
||||||
return ret;
|
pr_info("%s clkreq gpio %d successfully setup for wakeup capable\n", __func__, clkreq_gpio);
|
||||||
}
|
|
||||||
|
|
||||||
/* configure clkreq GPIO as wakeup capable */
|
|
||||||
ret = msm_gpio_mpm_wake_set(clkreq_gpio, true);
|
|
||||||
if (ret < 0) {
|
|
||||||
pr_err("%s Failed to setup clkreq gpio %d as wakeup capable, ret: %d\n", __func__, clkreq_gpio , ret);
|
|
||||||
return ret;
|
|
||||||
} else {
|
|
||||||
pr_info("%s clkreq gpio %d successfully setup for wakeup capable\n", __func__, clkreq_gpio);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = nfcc_hw_check(nfc_dev);
|
ret = nfcc_hw_check(nfc_dev);
|
||||||
|
10
nfc/common.h
10
nfc/common.h
@@ -110,7 +110,6 @@
|
|||||||
#define DTS_VEN_GPIO_STR "qcom,sn-ven"
|
#define DTS_VEN_GPIO_STR "qcom,sn-ven"
|
||||||
#define DTS_FWDN_GPIO_STR "qcom,sn-firm"
|
#define DTS_FWDN_GPIO_STR "qcom,sn-firm"
|
||||||
#define DTS_CLKREQ_GPIO_STR "qcom,sn-clkreq"
|
#define DTS_CLKREQ_GPIO_STR "qcom,sn-clkreq"
|
||||||
#define DTS_CLKSRC_GPIO_STR "qcom,clk-src"
|
|
||||||
#define DTS_SZONE_STR "qcom,sn-szone"
|
#define DTS_SZONE_STR "qcom,sn-szone"
|
||||||
#define NFC_LDO_SUPPLY_DT_NAME "qcom,sn-vdd-1p8"
|
#define NFC_LDO_SUPPLY_DT_NAME "qcom,sn-vdd-1p8"
|
||||||
#define NFC_LDO_SUPPLY_NAME "qcom,sn-vdd-1p8-supply"
|
#define NFC_LDO_SUPPLY_NAME "qcom,sn-vdd-1p8-supply"
|
||||||
@@ -237,9 +236,6 @@ struct platform_ldo {
|
|||||||
struct platform_configs {
|
struct platform_configs {
|
||||||
struct platform_gpio gpio;
|
struct platform_gpio gpio;
|
||||||
struct platform_ldo ldo;
|
struct platform_ldo ldo;
|
||||||
const char *clk_src_name;
|
|
||||||
/* NFC_CLK pin voting state */
|
|
||||||
bool clk_pin_voting;
|
|
||||||
const char *szone;
|
const char *szone;
|
||||||
bool CNSS_NFC_HW_SECURE_ENABLE;
|
bool CNSS_NFC_HW_SECURE_ENABLE;
|
||||||
};
|
};
|
||||||
@@ -284,10 +280,6 @@ struct nfc_dev {
|
|||||||
/*secure zone state*/
|
/*secure zone state*/
|
||||||
bool secure_zone;
|
bool secure_zone;
|
||||||
|
|
||||||
/* CLK control */
|
|
||||||
bool clk_run;
|
|
||||||
struct clk *s_clk;
|
|
||||||
|
|
||||||
void *ipcl;
|
void *ipcl;
|
||||||
|
|
||||||
/* function pointers for the common i2c functionality */
|
/* function pointers for the common i2c functionality */
|
||||||
@@ -323,8 +315,6 @@ int nfc_ese_pwr(struct nfc_dev *nfc_dev, unsigned long arg);
|
|||||||
int nfc_ldo_unvote(struct nfc_dev *nfc_dev);
|
int nfc_ldo_unvote(struct nfc_dev *nfc_dev);
|
||||||
int is_nfc_data_available_for_read(struct nfc_dev *nfc_dev);
|
int is_nfc_data_available_for_read(struct nfc_dev *nfc_dev);
|
||||||
int validate_nfc_state_nci(struct nfc_dev *nfc_dev);
|
int validate_nfc_state_nci(struct nfc_dev *nfc_dev);
|
||||||
int nfc_clock_select(struct nfc_dev *nfc_dev);
|
|
||||||
int nfc_clock_deselect(struct nfc_dev *nfc_dev);
|
|
||||||
int nfc_post_init(struct nfc_dev *nfc_dev);
|
int nfc_post_init(struct nfc_dev *nfc_dev);
|
||||||
int nfc_dynamic_protection_ioctl(struct nfc_dev *nfc_dev, unsigned long sec_zone_trans);
|
int nfc_dynamic_protection_ioctl(struct nfc_dev *nfc_dev, unsigned long sec_zone_trans);
|
||||||
bool nfc_hw_secure_check(void);
|
bool nfc_hw_secure_check(void);
|
||||||
|
@@ -162,43 +162,3 @@ int nfc_ldo_unvote(struct nfc_dev *nfc_dev)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Routine to enable clock.
|
|
||||||
* this routine can be extended to select from multiple
|
|
||||||
* sources based on clk name.
|
|
||||||
*/
|
|
||||||
int nfc_clock_select(struct nfc_dev *nfc_dev)
|
|
||||||
{
|
|
||||||
int r = 0;
|
|
||||||
|
|
||||||
nfc_dev->s_clk = clk_get(&nfc_dev->i2c_dev.client->dev, "nfc_ref_clk");
|
|
||||||
|
|
||||||
if (IS_ERR(nfc_dev->s_clk))
|
|
||||||
return PTR_ERR(nfc_dev->s_clk);
|
|
||||||
|
|
||||||
if (!nfc_dev->clk_run)
|
|
||||||
r = clk_prepare_enable(nfc_dev->s_clk);
|
|
||||||
|
|
||||||
if (r)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
nfc_dev->clk_run = true;
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Routine to disable clocks
|
|
||||||
*/
|
|
||||||
int nfc_clock_deselect(struct nfc_dev *nfc_dev)
|
|
||||||
{
|
|
||||||
int r = -EINVAL;
|
|
||||||
|
|
||||||
if (nfc_dev->s_clk != NULL) {
|
|
||||||
if (nfc_dev->clk_run) {
|
|
||||||
clk_disable_unprepare(nfc_dev->s_clk);
|
|
||||||
nfc_dev->clk_run = false;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
@@ -432,11 +432,6 @@ int nfc_i2c_dev_probe(struct i2c_client *client, const struct i2c_device_id *id)
|
|||||||
nfc_post_init(nfc_dev);
|
nfc_post_init(nfc_dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(nfc_dev->configs.clk_pin_voting)
|
|
||||||
nfc_dev->clk_run = false;
|
|
||||||
else
|
|
||||||
nfc_dev->clk_run = true;
|
|
||||||
|
|
||||||
device_init_wakeup(&client->dev, true);
|
device_init_wakeup(&client->dev, true);
|
||||||
i2c_set_clientdata(client, nfc_dev);
|
i2c_set_clientdata(client, nfc_dev);
|
||||||
i2c_dev->irq_wake_up = false;
|
i2c_dev->irq_wake_up = false;
|
||||||
|
Reference in New Issue
Block a user