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

Commit 3648dc6d authored by Christophe Ricard's avatar Christophe Ricard Committed by Samuel Ortiz
Browse files

NFC: st-nci: Add ese-present/uicc-present dts properties



In order to align with st21nfca, dts configuration properties
ese_present and uicc_present are made available in st-nci driver.

So far, in early development firmware, because
nci_nfcee_mode_set(DISABLE) was not supported we had to try to
enable it during the secure element discovery phase.

After several trials on commercial and qualified firmware it appears
that nci_nfcee_mode_set(ENABLE) and nci_nfcee_mode_set(DISABLE) are
properly supported.

Such feature also help us to eventually save some time (~5ms) when
only one secure element is connected.

Acked-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarChristophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent be73c2cb
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -11,6 +11,10 @@ Required properties:
Optional SoC Specific Properties:
- pinctrl-names: Contains only one value - "default".
- pintctrl-0: Specifies the pin control groups used for this controller.
- ese-present: Specifies that an ese is physically connected to the nfc
controller.
- uicc-present: Specifies that the uicc swp signal can be physically
connected to the nfc controller.

Example (for ARM-based BeagleBoard xM with ST21NFCB on I2C2):

@@ -29,5 +33,8 @@ Example (for ARM-based BeagleBoard xM with ST21NFCB on I2C2):
		interrupts = <2 IRQ_TYPE_LEVEL_HIGH>;

		reset-gpios = <&gpio5 29 GPIO_ACTIVE_HIGH>;

		ese-present;
		uicc-present;
	};
};
+8 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@

Required properties:
- compatible: Should be "st,st21nfcb-spi"
- spi-max-frequency: Maximum SPI frequency (<= 10000000).
- spi-max-frequency: Maximum SPI frequency (<= 4000000).
- interrupt-parent: phandle for the interrupt gpio controller
- interrupts: GPIO interrupt to which the chip is connected
- reset-gpios: Output GPIO pin used to reset the ST21NFCB
@@ -10,6 +10,10 @@ Required properties:
Optional SoC Specific Properties:
- pinctrl-names: Contains only one value - "default".
- pintctrl-0: Specifies the pin control groups used for this controller.
- ese-present: Specifies that an ese is physically connected to the nfc
controller.
- uicc-present: Specifies that the uicc swp signal can be physically
connected to the nfc controller.

Example (for ARM-based BeagleBoard xM with ST21NFCB on SPI4):

@@ -27,5 +31,8 @@ Example (for ARM-based BeagleBoard xM with ST21NFCB on SPI4):
		interrupts = <2 IRQ_TYPE_EDGE_RISING>;

		reset-gpios = <&gpio5 29 GPIO_ACTIVE_HIGH>;

		ese-present;
		uicc-present;
	};
};
+2 −2
Original line number Diff line number Diff line
@@ -123,7 +123,7 @@ static struct nci_ops st_nci_ops = {
};

int st_nci_probe(struct llt_ndlc *ndlc, int phy_headroom,
		       int phy_tailroom)
		 int phy_tailroom, struct st_nci_se_status *se_status)
{
	struct st_nci_info *info;
	int r;
@@ -164,7 +164,7 @@ int st_nci_probe(struct llt_ndlc *ndlc, int phy_headroom,
		goto err_reg_dev;
	}

	return st_nci_se_init(ndlc->ndev);
	return st_nci_se_init(ndlc->ndev, se_status);

err_reg_dev:
	nci_free_device(ndlc->ndev);
+11 −1
Original line number Diff line number Diff line
@@ -52,6 +52,8 @@ struct st_nci_i2c_phy {

	unsigned int gpio_reset;
	unsigned int irq_polarity;

	struct st_nci_se_status se_status;
};

#define I2C_DUMP_SKB(info, skb)					\
@@ -245,6 +247,11 @@ static int st_nci_i2c_of_request_resources(struct i2c_client *client)

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

	phy->se_status.is_ese_present =
				of_property_read_bool(pp, "ese-present");
	phy->se_status.is_uicc_present =
				of_property_read_bool(pp, "uicc-present");

	return 0;
}
#else
@@ -277,6 +284,9 @@ static int st_nci_i2c_request_resources(struct i2c_client *client)
		return r;
	}

	phy->se_status.is_ese_present = pdata->is_ese_present;
	phy->se_status.is_uicc_present = pdata->is_uicc_present;

	return 0;
}

@@ -326,7 +336,7 @@ static int st_nci_i2c_probe(struct i2c_client *client,

	r = ndlc_probe(phy, &i2c_phy_ops, &client->dev,
			ST_NCI_FRAME_HEADROOM, ST_NCI_FRAME_TAILROOM,
			&phy->ndlc);
			&phy->ndlc, &phy->se_status);
	if (r < 0) {
		nfc_err(&client->dev, "Unable to register ndlc layer\n");
		return r;
+4 −2
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include <net/nfc/nci_core.h>

#include "st-nci.h"
#include "ndlc.h"

#define NDLC_TIMER_T1		100
#define NDLC_TIMER_T1_WAIT	400
@@ -265,7 +266,8 @@ static void ndlc_t2_timeout(unsigned long data)
}

int ndlc_probe(void *phy_id, struct nfc_phy_ops *phy_ops, struct device *dev,
	       int phy_headroom, int phy_tailroom, struct llt_ndlc **ndlc_id)
	       int phy_headroom, int phy_tailroom, struct llt_ndlc **ndlc_id,
	       struct st_nci_se_status *se_status)
{
	struct llt_ndlc *ndlc;

@@ -295,7 +297,7 @@ int ndlc_probe(void *phy_id, struct nfc_phy_ops *phy_ops, struct device *dev,

	INIT_WORK(&ndlc->sm_work, llt_ndlc_sm_work);

	return st_nci_probe(ndlc, phy_headroom, phy_tailroom);
	return st_nci_probe(ndlc, phy_headroom, phy_tailroom, se_status);
}
EXPORT_SYMBOL(ndlc_probe);

Loading