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

Commit 330bd4ec authored by John W. Linville's avatar John W. Linville
Browse files


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

"NFC: 3.18 pull request

This is the NFC pull request for 3.18.

We've had major updates for TI and ST Microelectronics drivers:

For TI's trf7970a driver:

- Target mode support for trf7970a
- Suspend/resume support for trf7970a
- DT properties additions to handle different quirks
- A bunch of fixes for smartphone IOP related issues

For ST Microelectronics' ST21NFCA and ST21NFCB drivers:

- ISO15693 support for st21nfcb
- checkpatch and sparse related warning fixes
- Code cleanups and a few minor fixes

Finally, Marvell add ISO15693 support to the NCI stack, together with a
couple of NCI fixes."

Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parents 687b9308 094e9359
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -26,7 +26,7 @@ Example (for ARM-based BeagleBoard xM with ST21NFCB on I2C2):
		clock-frequency = <400000>;
		clock-frequency = <400000>;


		interrupt-parent = <&gpio5>;
		interrupt-parent = <&gpio5>;
		interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
		interrupts = <2 IRQ_TYPE_LEVEL_HIGH>;


		reset-gpios = <&gpio5 29 GPIO_ACTIVE_HIGH>;
		reset-gpios = <&gpio5 29 GPIO_ACTIVE_HIGH>;
	};
	};
+8 −0
Original line number Original line Diff line number Diff line
@@ -13,6 +13,11 @@ Optional SoC Specific Properties:
- pinctrl-names: Contains only one value - "default".
- pinctrl-names: Contains only one value - "default".
- pintctrl-0: Specifies the pin control groups used for this controller.
- pintctrl-0: Specifies the pin control groups used for this controller.
- autosuspend-delay: Specify autosuspend delay in milliseconds.
- autosuspend-delay: Specify autosuspend delay in milliseconds.
- vin-voltage-override: Specify voltage of VIN pin in microvolts.
- irq-status-read-quirk: Specify that the trf7970a being used has the
  "IRQ Status Read" erratum.
- en2-rf-quirk: Specify that the trf7970a being used has the "EN2 RF"
  erratum.


Example (for ARM-based BeagleBone with TRF7970A on SPI1):
Example (for ARM-based BeagleBone with TRF7970A on SPI1):


@@ -30,7 +35,10 @@ Example (for ARM-based BeagleBone with TRF7970A on SPI1):
		ti,enable-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>,
		ti,enable-gpios = <&gpio2 2 GPIO_ACTIVE_LOW>,
				  <&gpio2 5 GPIO_ACTIVE_LOW>;
				  <&gpio2 5 GPIO_ACTIVE_LOW>;
		vin-supply = <&ldo3_reg>;
		vin-supply = <&ldo3_reg>;
		vin-voltage-override = <5000000>;
		autosuspend-delay = <30000>;
		autosuspend-delay = <30000>;
		irq-status-read-quirk;
		en2-rf-quirk;
		status = "okay";
		status = "okay";
	};
	};
};
};
+9 −25
Original line number Original line Diff line number Diff line
@@ -271,6 +271,7 @@ static int st21nfca_hci_i2c_write(void *phy_id, struct sk_buff *skb)
static int get_frame_size(u8 *buf, int buflen)
static int get_frame_size(u8 *buf, int buflen)
{
{
	int len = 0;
	int len = 0;

	if (buf[len + 1] == ST21NFCA_SOF_EOF)
	if (buf[len + 1] == ST21NFCA_SOF_EOF)
		return 0;
		return 0;


@@ -311,6 +312,7 @@ static int check_crc(u8 *buf, int buflen)
static int st21nfca_hci_i2c_repack(struct sk_buff *skb)
static int st21nfca_hci_i2c_repack(struct sk_buff *skb)
{
{
	int i, j, r, size;
	int i, j, r, size;

	if (skb->len < 1 || (skb->len > 1 && skb->data[1] != 0))
	if (skb->len < 1 || (skb->len > 1 && skb->data[1] != 0))
		return -EBADMSG;
		return -EBADMSG;


@@ -525,24 +527,19 @@ static int st21nfca_hci_i2c_of_request_resources(struct i2c_client *client)
	}
	}


	/* GPIO request and configuration */
	/* GPIO request and configuration */
	r = devm_gpio_request(&client->dev, gpio, "clf_enable");
	r = devm_gpio_request_one(&client->dev, gpio, GPIOF_OUT_INIT_HIGH,
				  "clf_enable");
	if (r) {
	if (r) {
		nfc_err(&client->dev, "Failed to request enable pin\n");
		nfc_err(&client->dev, "Failed to request enable pin\n");
		return -ENODEV;
		return -ENODEV;
	}
	}


	r = gpio_direction_output(gpio, 1);
	if (r) {
		nfc_err(&client->dev, "Failed to set enable pin direction as output\n");
		return -ENODEV;
	}
	phy->gpio_ena = gpio;
	phy->gpio_ena = gpio;


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


@@ -576,32 +573,20 @@ static int st21nfca_hci_i2c_request_resources(struct i2c_client *client)
	phy->gpio_ena = pdata->gpio_ena;
	phy->gpio_ena = pdata->gpio_ena;
	phy->irq_polarity = pdata->irq_polarity;
	phy->irq_polarity = pdata->irq_polarity;


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


	r = gpio_direction_input(phy->gpio_irq);
	if (r) {
		pr_err("%s : gpio_direction_input failed\n", __FILE__);
		return -ENODEV;
	}

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

		if (r) {
			pr_err("%s : ena gpio_direction_output failed\n",
			       __FILE__);
			return -ENODEV;
		}
	}
	}


	/* IRQ */
	/* IRQ */
@@ -711,7 +696,6 @@ static struct i2c_driver st21nfca_hci_i2c_driver = {
	.driver = {
	.driver = {
		.owner = THIS_MODULE,
		.owner = THIS_MODULE,
		.name = ST21NFCA_HCI_I2C_DRIVER_NAME,
		.name = ST21NFCA_HCI_I2C_DRIVER_NAME,
		.owner = THIS_MODULE,
		.of_match_table = of_match_ptr(of_st21nfca_i2c_match),
		.of_match_table = of_match_ptr(of_st21nfca_i2c_match),
	},
	},
	.probe = st21nfca_hci_i2c_probe,
	.probe = st21nfca_hci_i2c_probe,
+40 −19
Original line number Original line Diff line number Diff line
@@ -45,6 +45,23 @@
#define ST21NFCA_RF_READER_14443_3_A_ATQA	0x03
#define ST21NFCA_RF_READER_14443_3_A_ATQA	0x03
#define ST21NFCA_RF_READER_14443_3_A_SAK	0x04
#define ST21NFCA_RF_READER_14443_3_A_SAK	0x04


#define ST21NFCA_RF_READER_F_DATARATE		0x01
#define ST21NFCA_RF_READER_F_DATARATE_106	0x01
#define ST21NFCA_RF_READER_F_DATARATE_212	0x02
#define ST21NFCA_RF_READER_F_DATARATE_424	0x04
#define ST21NFCA_RF_READER_F_POL_REQ		0x02
#define ST21NFCA_RF_READER_F_POL_REQ_DEFAULT	0xffff0000
#define ST21NFCA_RF_READER_F_NFCID2		0x03
#define ST21NFCA_RF_READER_F_NFCID1		0x04

#define ST21NFCA_RF_CARD_F_MODE			0x01
#define ST21NFCA_RF_CARD_F_NFCID2_LIST		0x04
#define ST21NFCA_RF_CARD_F_NFCID1		0x05
#define ST21NFCA_RF_CARD_F_SENS_RES		0x06
#define ST21NFCA_RF_CARD_F_SEL_RES		0x07
#define ST21NFCA_RF_CARD_F_DATARATE		0x08
#define ST21NFCA_RF_CARD_F_DATARATE_212_424	0x01

#define ST21NFCA_DEVICE_MGNT_GATE		0x01
#define ST21NFCA_DEVICE_MGNT_GATE		0x01
#define ST21NFCA_DEVICE_MGNT_PIPE		0x02
#define ST21NFCA_DEVICE_MGNT_PIPE		0x02


@@ -60,6 +77,10 @@
	((p & 0x0f) == (ST21NFCA_DM_PIPE_CREATED | ST21NFCA_DM_PIPE_OPEN))
	((p & 0x0f) == (ST21NFCA_DM_PIPE_CREATED | ST21NFCA_DM_PIPE_OPEN))


#define ST21NFCA_NFC_MODE			0x03	/* NFC_MODE parameter*/
#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);
static DECLARE_BITMAP(dev_mask, ST21NFCA_NUM_DEVICES);


@@ -355,8 +376,8 @@ static int st21nfca_hci_start_poll(struct nfc_hci_dev *hdev,
			if (r < 0)
			if (r < 0)
				return r;
				return r;


			pol_req =
			pol_req = be32_to_cpu((__force __be32)
			    be32_to_cpu(ST21NFCA_RF_READER_F_POL_REQ_DEFAULT);
					ST21NFCA_RF_READER_F_POL_REQ_DEFAULT);
			r = nfc_hci_set_param(hdev, ST21NFCA_RF_READER_F_GATE,
			r = nfc_hci_set_param(hdev, ST21NFCA_RF_READER_F_GATE,
					      ST21NFCA_RF_READER_F_POL_REQ,
					      ST21NFCA_RF_READER_F_POL_REQ,
					      (u8 *) &pol_req, 4);
					      (u8 *) &pol_req, 4);
@@ -790,6 +811,7 @@ static int st21nfca_hci_check_presence(struct nfc_hci_dev *hdev,
				       struct nfc_target *target)
				       struct nfc_target *target)
{
{
	u8 fwi = 0x11;
	u8 fwi = 0x11;

	switch (target->hci_reader_gate) {
	switch (target->hci_reader_gate) {
	case NFC_HCI_RF_READER_A_GATE:
	case NFC_HCI_RF_READER_A_GATE:
	case NFC_HCI_RF_READER_B_GATE:
	case NFC_HCI_RF_READER_B_GATE:
@@ -839,20 +861,16 @@ static int st21nfca_hci_event_received(struct nfc_hci_dev *hdev, u8 gate,
		if (gate == ST21NFCA_RF_CARD_F_GATE) {
		if (gate == ST21NFCA_RF_CARD_F_GATE) {
			r = st21nfca_tm_event_send_data(hdev, skb, gate);
			r = st21nfca_tm_event_send_data(hdev, skb, gate);
			if (r < 0)
			if (r < 0)
				goto exit;
				return r;
			return 0;
			return 0;
		} else {
		}
		info->dep_info.curr_nfc_dep_pni = 0;
		info->dep_info.curr_nfc_dep_pni = 0;
		return 1;
		return 1;
		}
		break;
	default:
	default:
		return 1;
		return 1;
	}
	}
	kfree_skb(skb);
	kfree_skb(skb);
	return 0;
	return 0;
exit:
	return r;
}
}


static struct nfc_hci_ops st21nfca_hci_ops = {
static struct nfc_hci_ops st21nfca_hci_ops = {
@@ -904,8 +922,11 @@ int st21nfca_hci_probe(void *phy_id, struct nfc_phy_ops *phy_ops,
	 * persistent info to discriminate 2 identical chips
	 * persistent info to discriminate 2 identical chips
	 */
	 */
	dev_num = find_first_zero_bit(dev_mask, ST21NFCA_NUM_DEVICES);
	dev_num = find_first_zero_bit(dev_mask, ST21NFCA_NUM_DEVICES);

	if (dev_num >= ST21NFCA_NUM_DEVICES)
	if (dev_num >= ST21NFCA_NUM_DEVICES)
		goto err_alloc_hdev;
		return -ENODEV;

	set_bit(dev_num, dev_mask);


	scnprintf(init_data.session_id, sizeof(init_data.session_id), "%s%2x",
	scnprintf(init_data.session_id, sizeof(init_data.session_id), "%s%2x",
		  "ST21AH", dev_num);
		  "ST21AH", dev_num);
+0 −21
Original line number Original line Diff line number Diff line
@@ -82,30 +82,9 @@ struct st21nfca_hci_info {
#define ST21NFCA_WR_XCHG_DATA            0x10
#define ST21NFCA_WR_XCHG_DATA            0x10


#define ST21NFCA_RF_READER_F_GATE               0x14
#define ST21NFCA_RF_READER_F_GATE               0x14
#define ST21NFCA_RF_READER_F_DATARATE 0x01
#define ST21NFCA_RF_READER_F_DATARATE_106 0x01
#define ST21NFCA_RF_READER_F_DATARATE_212 0x02
#define ST21NFCA_RF_READER_F_DATARATE_424 0x04
#define ST21NFCA_RF_READER_F_POL_REQ    0x02
#define ST21NFCA_RF_READER_F_POL_REQ_DEFAULT    0xffff0000
#define ST21NFCA_RF_READER_F_NFCID2 0x03
#define ST21NFCA_RF_READER_F_NFCID1 0x04
#define ST21NFCA_RF_READER_F_SENS_RES 0x05


#define ST21NFCA_RF_CARD_F_GATE 0x24
#define ST21NFCA_RF_CARD_F_GATE 0x24
#define ST21NFCA_RF_CARD_F_MODE 0x01
#define ST21NFCA_RF_CARD_F_NFCID2_LIST 0x04
#define ST21NFCA_RF_CARD_F_NFCID1 0x05
#define ST21NFCA_RF_CARD_F_SENS_RES 0x06
#define ST21NFCA_RF_CARD_F_SEL_RES 0x07
#define ST21NFCA_RF_CARD_F_DATARATE 0x08
#define ST21NFCA_RF_CARD_F_DATARATE_106 0x00
#define ST21NFCA_RF_CARD_F_DATARATE_212_424 0x01


#define ST21NFCA_EVT_SEND_DATA 0x10
#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


#endif /* __LOCAL_ST21NFCA_H_ */
#endif /* __LOCAL_ST21NFCA_H_ */
Loading