Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 04bb7ecf authored by John W. Linville's avatar John W. Linville
Browse files


Samuel Ortiz <sameo@linux.intel.com> says:

"NFC: 3.19 pull request

This is the NFC pull request for 3.19.

With this one we get:

- NFC digital improvements for DEP support: Chaining, NACK and ATN
  support added.

- NCI improvements: Support for p2p target, SE IO operand addition,
  SE operands extensions to support proprietary implementations, and
  a few fixes.

- NFC HCI improvements: OPEN_PIPE and NOTIFY_ALL_CLEARED support,
  and SE IO operand addition.

- A bunch of minor improvements and fixes for STMicro st21nfcb and
  st21nfca"

Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parents ea375117 e479ce47
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -29,8 +29,8 @@
#include <linux/delay.h>
#include <linux/nfc.h>
#include <linux/firmware.h>
#include <linux/unaligned/access_ok.h>
#include <linux/platform_data/pn544.h>
#include <asm/unaligned.h>

#include <net/nfc/hci.h>
#include <net/nfc/llc.h>
+8 −33
Original line number Diff line number Diff line
@@ -28,8 +28,8 @@
#include <linux/delay.h>
#include <linux/nfc.h>
#include <linux/firmware.h>
#include <linux/unaligned/access_ok.h>
#include <linux/platform_data/st21nfca.h>
#include <asm/unaligned.h>

#include <net/nfc/hci.h>
#include <net/nfc/llc.h>
@@ -72,7 +72,6 @@ struct st21nfca_i2c_phy {
	struct nfc_hci_dev *hdev;

	unsigned int gpio_ena;
	unsigned int gpio_irq;
	unsigned int irq_polarity;

	struct sk_buff *pending_skb;
@@ -531,20 +530,12 @@ static int st21nfca_hci_i2c_of_request_resources(struct i2c_client *client)
				  "clf_enable");
	if (r) {
		nfc_err(&client->dev, "Failed to request enable pin\n");
		return -ENODEV;
		return r;
	}

	phy->gpio_ena = gpio;

	/* IRQ */
	r = irq_of_parse_and_map(pp, 0);
	if (r < 0) {
		nfc_err(&client->dev, "Unable to get irq, error: %d\n", r);
		return r;
	}

	phy->irq_polarity = irq_get_trigger_type(r);
	client->irq = r;
	phy->irq_polarity = irq_get_trigger_type(client->irq);

	return 0;
}
@@ -560,7 +551,6 @@ static int st21nfca_hci_i2c_request_resources(struct i2c_client *client)
	struct st21nfca_nfc_platform_data *pdata;
	struct st21nfca_i2c_phy *phy = i2c_get_clientdata(client);
	int r;
	int irq;

	pdata = client->dev.platform_data;
	if (pdata == NULL) {
@@ -569,35 +559,17 @@ static int st21nfca_hci_i2c_request_resources(struct i2c_client *client)
	}

	/* store for later use */
	phy->gpio_irq = pdata->gpio_irq;
	phy->gpio_ena = pdata->gpio_ena;
	phy->irq_polarity = pdata->irq_polarity;

	r = devm_gpio_request_one(&client->dev, phy->gpio_irq, GPIOF_IN,
				  "wake_up");
	if (r) {
		pr_err("%s : gpio_request failed\n", __FILE__);
		return -ENODEV;
	}

	if (phy->gpio_ena > 0) {
		r = devm_gpio_request_one(&client->dev, phy->gpio_ena,
					  GPIOF_OUT_INIT_HIGH, "clf_enable");
		if (r) {
			pr_err("%s : ena gpio_request failed\n", __FILE__);
			return -ENODEV;
		}
			return r;
		}

	/* IRQ */
	irq = gpio_to_irq(phy->gpio_irq);
	if (irq < 0) {
		nfc_err(&client->dev,
				"Unable to get irq number for GPIO %d error %d\n",
				phy->gpio_irq, r);
		return -ENODEV;
	}
	client->irq = irq;

	return 0;
}
@@ -656,7 +628,7 @@ static int st21nfca_hci_i2c_probe(struct i2c_client *client,
	r = st21nfca_hci_platform_init(phy);
	if (r < 0) {
		nfc_err(&client->dev, "Unable to reboot st21nfca\n");
		return -ENODEV;
		return r;
	}

	r = devm_request_threaded_irq(&client->dev, client->irq, NULL,
@@ -687,10 +659,13 @@ static int st21nfca_hci_i2c_remove(struct i2c_client *client)
	return 0;
}

#ifdef CONFIG_OF
static const struct of_device_id of_st21nfca_i2c_match[] = {
	{ .compatible = "st,st21nfca_i2c", },
	{}
};
MODULE_DEVICE_TABLE(of, of_st21nfca_i2c_match);
#endif

static struct i2c_driver st21nfca_hci_i2c_driver = {
	.driver = {
+4 −28
Original line number Diff line number Diff line
@@ -77,10 +77,6 @@
	((p & 0x0f) == (ST21NFCA_DM_PIPE_CREATED | ST21NFCA_DM_PIPE_OPEN))

#define ST21NFCA_NFC_MODE			0x03	/* NFC_MODE parameter*/
#define ST21NFCA_EVT_FIELD_ON			0x11
#define ST21NFCA_EVT_CARD_DEACTIVATED		0x12
#define ST21NFCA_EVT_CARD_ACTIVATED		0x13
#define ST21NFCA_EVT_FIELD_OFF			0x14

static DECLARE_BITMAP(dev_mask, ST21NFCA_NUM_DEVICES);

@@ -841,31 +837,11 @@ static int st21nfca_hci_check_presence(struct nfc_hci_dev *hdev,
static int st21nfca_hci_event_received(struct nfc_hci_dev *hdev, u8 gate,
				       u8 event, struct sk_buff *skb)
{
	int r;
	struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev);
	pr_debug("hci event: %d gate: %x\n", event, gate);

	pr_debug("hci event: %d\n", event);

	switch (event) {
	case ST21NFCA_EVT_CARD_ACTIVATED:
		if (gate == ST21NFCA_RF_CARD_F_GATE)
			info->dep_info.curr_nfc_dep_pni = 0;
		break;
	case ST21NFCA_EVT_CARD_DEACTIVATED:
		break;
	case ST21NFCA_EVT_FIELD_ON:
		break;
	case ST21NFCA_EVT_FIELD_OFF:
		break;
	case ST21NFCA_EVT_SEND_DATA:
		if (gate == ST21NFCA_RF_CARD_F_GATE) {
			r = st21nfca_tm_event_send_data(hdev, skb, gate);
			if (r < 0)
				return r;
			return 0;
		}
		info->dep_info.curr_nfc_dep_pni = 0;
		return 1;
	switch (gate) {
	case ST21NFCA_RF_CARD_F_GATE:
		return st21nfca_dep_event_received(hdev, event, skb);
	default:
		return 1;
	}
+0 −2
Original line number Diff line number Diff line
@@ -85,6 +85,4 @@ struct st21nfca_hci_info {

#define ST21NFCA_RF_CARD_F_GATE 0x24

#define ST21NFCA_EVT_SEND_DATA 0x10

#endif /* __LOCAL_ST21NFCA_H_ */
+44 −3
Original line number Diff line number Diff line
@@ -49,6 +49,12 @@
#define ST21NFCA_LR_BITS_PAYLOAD_SIZE_254B 0x30
#define ST21NFCA_GB_BIT  0x02

#define ST21NFCA_EVT_SEND_DATA		0x10
#define ST21NFCA_EVT_FIELD_ON           0x11
#define ST21NFCA_EVT_CARD_DEACTIVATED   0x12
#define ST21NFCA_EVT_CARD_ACTIVATED     0x13
#define ST21NFCA_EVT_FIELD_OFF          0x14

#define ST21NFCA_EVT_CARD_F_BITRATE 0x16
#define ST21NFCA_EVT_READER_F_BITRATE 0x13
#define	ST21NFCA_PSL_REQ_SEND_SPEED(brs) (brs & 0x38)
@@ -372,8 +378,8 @@ static int st21nfca_tm_recv_dep_req(struct nfc_hci_dev *hdev,
	return r;
}

int st21nfca_tm_event_send_data(struct nfc_hci_dev *hdev, struct sk_buff *skb,
				u8 gate)
static int st21nfca_tm_event_send_data(struct nfc_hci_dev *hdev,
				struct sk_buff *skb)
{
	u8 cmd0, cmd1;
	int r;
@@ -400,7 +406,42 @@ int st21nfca_tm_event_send_data(struct nfc_hci_dev *hdev, struct sk_buff *skb,
	}
	return r;
}
EXPORT_SYMBOL(st21nfca_tm_event_send_data);

/*
 * Returns:
 * <= 0: driver handled the event, skb consumed
 *    1: driver does not handle the event, please do standard processing
 */
int st21nfca_dep_event_received(struct nfc_hci_dev *hdev,
				u8 event, struct sk_buff *skb)
{
	int r = 0;
	struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev);

	pr_debug("dep event: %d\n", event);

	switch (event) {
	case ST21NFCA_EVT_CARD_ACTIVATED:
		info->dep_info.curr_nfc_dep_pni = 0;
		break;
	case ST21NFCA_EVT_CARD_DEACTIVATED:
		break;
	case ST21NFCA_EVT_FIELD_ON:
		break;
	case ST21NFCA_EVT_FIELD_OFF:
		break;
	case ST21NFCA_EVT_SEND_DATA:
		r = st21nfca_tm_event_send_data(hdev, skb);
		if (r < 0)
			return r;
		return 0;
	default:
		return 1;
	}
	kfree_skb(skb);
	return r;
}
EXPORT_SYMBOL(st21nfca_dep_event_received);

static void st21nfca_im_send_psl_req(struct nfc_hci_dev *hdev, u8 did, u8 bsi,
				     u8 bri, u8 lri)
Loading