Commit 183fe2d0 authored by Christophe Ricard's avatar Christophe Ricard Committed by Samuel Ortiz

NFC: st21nfcb: Move powered flag from phy to ndlc layer

The powered flag can be set from the ndlc_open and ndlc_close layer.
Signed-off-by: default avatarChristophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent e8b72c20
...@@ -52,8 +52,6 @@ struct st21nfcb_i2c_phy { ...@@ -52,8 +52,6 @@ struct st21nfcb_i2c_phy {
unsigned int gpio_reset; unsigned int gpio_reset;
unsigned int irq_polarity; unsigned int irq_polarity;
int powered;
}; };
#define I2C_DUMP_SKB(info, skb) \ #define I2C_DUMP_SKB(info, skb) \
...@@ -70,7 +68,6 @@ static int st21nfcb_nci_i2c_enable(void *phy_id) ...@@ -70,7 +68,6 @@ static int st21nfcb_nci_i2c_enable(void *phy_id)
gpio_set_value(phy->gpio_reset, 0); gpio_set_value(phy->gpio_reset, 0);
usleep_range(10000, 15000); usleep_range(10000, 15000);
gpio_set_value(phy->gpio_reset, 1); gpio_set_value(phy->gpio_reset, 1);
phy->powered = 1;
usleep_range(80000, 85000); usleep_range(80000, 85000);
return 0; return 0;
...@@ -80,7 +77,6 @@ static void st21nfcb_nci_i2c_disable(void *phy_id) ...@@ -80,7 +77,6 @@ static void st21nfcb_nci_i2c_disable(void *phy_id)
{ {
struct st21nfcb_i2c_phy *phy = phy_id; struct st21nfcb_i2c_phy *phy = phy_id;
phy->powered = 0;
/* reset chip in order to flush clf */ /* reset chip in order to flush clf */
gpio_set_value(phy->gpio_reset, 0); gpio_set_value(phy->gpio_reset, 0);
usleep_range(10000, 15000); usleep_range(10000, 15000);
...@@ -203,7 +199,7 @@ static irqreturn_t st21nfcb_nci_irq_thread_fn(int irq, void *phy_id) ...@@ -203,7 +199,7 @@ static irqreturn_t st21nfcb_nci_irq_thread_fn(int irq, void *phy_id)
if (phy->ndlc->hard_fault) if (phy->ndlc->hard_fault)
return IRQ_HANDLED; return IRQ_HANDLED;
if (!phy->powered) { if (!phy->ndlc->powered) {
st21nfcb_nci_i2c_disable(phy); st21nfcb_nci_i2c_disable(phy);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
......
...@@ -59,6 +59,7 @@ int ndlc_open(struct llt_ndlc *ndlc) ...@@ -59,6 +59,7 @@ int ndlc_open(struct llt_ndlc *ndlc)
{ {
/* toggle reset pin */ /* toggle reset pin */
ndlc->ops->enable(ndlc->phy_id); ndlc->ops->enable(ndlc->phy_id);
ndlc->powered = 1;
return 0; return 0;
} }
EXPORT_SYMBOL(ndlc_open); EXPORT_SYMBOL(ndlc_open);
...@@ -67,6 +68,7 @@ void ndlc_close(struct llt_ndlc *ndlc) ...@@ -67,6 +68,7 @@ void ndlc_close(struct llt_ndlc *ndlc)
{ {
/* toggle reset pin */ /* toggle reset pin */
ndlc->ops->disable(ndlc->phy_id); ndlc->ops->disable(ndlc->phy_id);
ndlc->powered = 0;
} }
EXPORT_SYMBOL(ndlc_close); EXPORT_SYMBOL(ndlc_close);
...@@ -262,6 +264,7 @@ int ndlc_probe(void *phy_id, struct nfc_phy_ops *phy_ops, struct device *dev, ...@@ -262,6 +264,7 @@ int ndlc_probe(void *phy_id, struct nfc_phy_ops *phy_ops, struct device *dev,
ndlc->ops = phy_ops; ndlc->ops = phy_ops;
ndlc->phy_id = phy_id; ndlc->phy_id = phy_id;
ndlc->dev = dev; ndlc->dev = dev;
ndlc->powered = 0;
*ndlc_id = ndlc; *ndlc_id = ndlc;
......
...@@ -47,6 +47,7 @@ struct llt_ndlc { ...@@ -47,6 +47,7 @@ struct llt_ndlc {
* and prevents normal operation. * and prevents normal operation.
*/ */
int hard_fault; int hard_fault;
int powered;
}; };
int ndlc_open(struct llt_ndlc *ndlc); int ndlc_open(struct llt_ndlc *ndlc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment