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

Commit a0d0d168 authored by John W. Linville's avatar John W. Linville
Browse files
parents 31a67102 05f8f252
Loading
Loading
Loading
Loading
+12 −0
Original line number Original line Diff line number Diff line
@@ -534,6 +534,18 @@ Who: Kees Cook <keescook@chromium.org>


----------------------------
----------------------------


What:	Removing the pn544 raw driver.
When:	3.6
Why:	With the introduction of the NFC HCI and SHDL kernel layers, pn544.c
	is being replaced by pn544_hci.c which is accessible through the netlink
	and socket NFC APIs. Moreover, pn544.c is outdated and does not seem to
	work properly with the latest Android stacks.
	Having 2 drivers for the same hardware is confusing and as such we
	should only keep the one following the kernel NFC APIs.
Who:	Samuel Ortiz <sameo@linux.intel.com>

----------------------------

What:	setitimer accepts user NULL pointer (value)
What:	setitimer accepts user NULL pointer (value)
When:	3.6
When:	3.6
Why:	setitimer is not returning -EFAULT if user pointer is NULL. This
Why:	setitimer is not returning -EFAULT if user pointer is NULL. This
+35 −10
Original line number Original line Diff line number Diff line
@@ -22,9 +22,9 @@ response to arrive.
HCI events can also be received from the host controller. They will be handled
HCI events can also be received from the host controller. They will be handled
and a translation will be forwarded to NFC Core as needed.
and a translation will be forwarded to NFC Core as needed.
HCI uses 2 execution contexts:
HCI uses 2 execution contexts:
- one if for executing commands : nfc_hci_msg_tx_work(). Only one command
- one for executing commands : nfc_hci_msg_tx_work(). Only one command
can be executing at any given moment.
can be executing at any given moment.
- one if for dispatching received events and responses : nfc_hci_msg_rx_work()
- one for dispatching received events and commands : nfc_hci_msg_rx_work().


HCI Session initialization:
HCI Session initialization:
---------------------------
---------------------------
@@ -52,18 +52,42 @@ entry points:
struct nfc_hci_ops {
struct nfc_hci_ops {
	int (*open)(struct nfc_hci_dev *hdev);
	int (*open)(struct nfc_hci_dev *hdev);
	void (*close)(struct nfc_hci_dev *hdev);
	void (*close)(struct nfc_hci_dev *hdev);
	int (*hci_ready) (struct nfc_hci_dev *hdev);
	int (*xmit)(struct nfc_hci_dev *hdev, struct sk_buff *skb);
	int (*xmit)(struct nfc_hci_dev *hdev, struct sk_buff *skb);
	int (*start_poll)(struct nfc_hci_dev *hdev, u32 protocols);
	int (*start_poll)(struct nfc_hci_dev *hdev, u32 protocols);
	int (*target_from_gate)(struct nfc_hci_dev *hdev, u8 gate,
	int (*target_from_gate)(struct nfc_hci_dev *hdev, u8 gate,
				struct nfc_target *target);
				struct nfc_target *target);
	int (*complete_target_discovered) (struct nfc_hci_dev *hdev, u8 gate,
					   struct nfc_target *target);
	int (*data_exchange) (struct nfc_hci_dev *hdev,
			      struct nfc_target *target,
			      struct sk_buff *skb, struct sk_buff **res_skb);
	int (*check_presence)(struct nfc_hci_dev *hdev,
			      struct nfc_target *target);
};
};


open() and close() shall turn the hardware on and off. xmit() shall simply
- open() and close() shall turn the hardware on and off.
write a frame to the chip. start_poll() is an optional entrypoint that shall
- hci_ready() is an optional entry point that is called right after the hci
set the hardware in polling mode. This must be implemented only if the hardware
session has been set up. The driver can use it to do additional initialization
uses proprietary gates or a mechanism slightly different from the HCI standard.
that must be performed using HCI commands.
target_from_gate() is another optional entrypoint to return the protocols
- xmit() shall simply write a frame to the chip.
- start_poll() is an optional entrypoint that shall set the hardware in polling
mode. This must be implemented only if the hardware uses proprietary gates or a
mechanism slightly different from the HCI standard.
- target_from_gate() is an optional entrypoint to return the nfc protocols
corresponding to a proprietary gate.
corresponding to a proprietary gate.
- complete_target_discovered() is an optional entry point to let the driver
perform additional proprietary processing necessary to auto activate the
discovered target.
- data_exchange() must be implemented by the driver if proprietary HCI commands
are required to send data to the tag. Some tag types will require custom
commands, others can be written to using the standard HCI commands. The driver
can check the tag type and either do proprietary processing, or return 1 to ask
for standard processing.
- check_presence() is an optional entry point that will be called regularly
by the core to check that an activated tag is still in the field. If this is
not implemented, the core will not be able to push tag_lost events to the user
space


On the rx path, the driver is responsible to push incoming HCP frames to HCI
On the rx path, the driver is responsible to push incoming HCP frames to HCI
using nfc_hci_recv_frame(). HCI will take care of re-aggregation and handling
using nfc_hci_recv_frame(). HCI will take care of re-aggregation and handling
@@ -99,7 +123,8 @@ fast, cannot sleep. stores incoming frames into an shdlc rx queue
handles shdlc rx & tx queues. Dispatches HCI cmd responses.
handles shdlc rx & tx queues. Dispatches HCI cmd responses.


- HCI Tx Cmd worker (MSGTXWQ)
- HCI Tx Cmd worker (MSGTXWQ)
Serialize execution of HCI commands. Complete execution in case of resp timeout.
Serializes execution of HCI commands. Completes execution in case of response
timeout.


- HCI Rx worker (MSGRXWQ)
- HCI Rx worker (MSGRXWQ)
Dispatches incoming HCI commands or events.
Dispatches incoming HCI commands or events.
@@ -133,11 +158,11 @@ able to complete the command with a timeout error if no response arrive.
SMW context gets scheduled and invokes nfc_shdlc_sm_work(). This function
SMW context gets scheduled and invokes nfc_shdlc_sm_work(). This function
handles shdlc framing in and out. It uses the driver xmit to send frames and
handles shdlc framing in and out. It uses the driver xmit to send frames and
receives incoming frames in an skb queue filled from the driver IRQ handler.
receives incoming frames in an skb queue filled from the driver IRQ handler.
SHDLC I(nformation) frames payload are HCP fragments. They are agregated to
SHDLC I(nformation) frames payload are HCP fragments. They are aggregated to
form complete HCI frames, which can be a response, command, or event.
form complete HCI frames, which can be a response, command, or event.


HCI Responses are dispatched immediately from this context to unblock
HCI Responses are dispatched immediately from this context to unblock
waiting command execution. Reponse processing involves invoking the completion
waiting command execution. Response processing involves invoking the completion
callback that was provided by nfc_hci_msg_tx_work() when it sent the command.
callback that was provided by nfc_hci_msg_tx_work() when it sent the command.
The completion callback will then wake the syscall context.
The completion callback will then wake the syscall context.


+7 −8
Original line number Original line Diff line number Diff line
@@ -90,6 +90,7 @@ static int bcm47xx_get_sprom_ssb(struct ssb_bus *bus, struct ssb_sprom *out)
	char prefix[10];
	char prefix[10];


	if (bus->bustype == SSB_BUSTYPE_PCI) {
	if (bus->bustype == SSB_BUSTYPE_PCI) {
		memset(out, 0, sizeof(struct ssb_sprom));
		snprintf(prefix, sizeof(prefix), "pci/%u/%u/",
		snprintf(prefix, sizeof(prefix), "pci/%u/%u/",
			 bus->host_pci->bus->number + 1,
			 bus->host_pci->bus->number + 1,
			 PCI_SLOT(bus->host_pci->devfn));
			 PCI_SLOT(bus->host_pci->devfn));
@@ -109,15 +110,9 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus,
	/* Fill boardinfo structure */
	/* Fill boardinfo structure */
	memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo));
	memset(&(iv->boardinfo), 0 , sizeof(struct ssb_boardinfo));


	if (nvram_getenv("boardvendor", buf, sizeof(buf)) >= 0)
	bcm47xx_fill_ssb_boardinfo(&iv->boardinfo, NULL);
		iv->boardinfo.vendor = (u16)simple_strtoul(buf, NULL, 0);
	else
		iv->boardinfo.vendor = SSB_BOARDVENDOR_BCM;
	if (nvram_getenv("boardtype", buf, sizeof(buf)) >= 0)
		iv->boardinfo.type = (u16)simple_strtoul(buf, NULL, 0);
	if (nvram_getenv("boardrev", buf, sizeof(buf)) >= 0)
		iv->boardinfo.rev = (u16)simple_strtoul(buf, NULL, 0);


	memset(&iv->sprom, 0, sizeof(struct ssb_sprom));
	bcm47xx_fill_sprom(&iv->sprom, NULL);
	bcm47xx_fill_sprom(&iv->sprom, NULL);


	if (nvram_getenv("cardbus", buf, sizeof(buf)) >= 0)
	if (nvram_getenv("cardbus", buf, sizeof(buf)) >= 0)
@@ -166,12 +161,14 @@ static int bcm47xx_get_sprom_bcma(struct bcma_bus *bus, struct ssb_sprom *out)


	switch (bus->hosttype) {
	switch (bus->hosttype) {
	case BCMA_HOSTTYPE_PCI:
	case BCMA_HOSTTYPE_PCI:
		memset(out, 0, sizeof(struct ssb_sprom));
		snprintf(prefix, sizeof(prefix), "pci/%u/%u/",
		snprintf(prefix, sizeof(prefix), "pci/%u/%u/",
			 bus->host_pci->bus->number + 1,
			 bus->host_pci->bus->number + 1,
			 PCI_SLOT(bus->host_pci->devfn));
			 PCI_SLOT(bus->host_pci->devfn));
		bcm47xx_fill_sprom(out, prefix);
		bcm47xx_fill_sprom(out, prefix);
		return 0;
		return 0;
	case BCMA_HOSTTYPE_SOC:
	case BCMA_HOSTTYPE_SOC:
		memset(out, 0, sizeof(struct ssb_sprom));
		bcm47xx_fill_sprom_ethernet(out, NULL);
		bcm47xx_fill_sprom_ethernet(out, NULL);
		core = bcma_find_core(bus, BCMA_CORE_80211);
		core = bcma_find_core(bus, BCMA_CORE_80211);
		if (core) {
		if (core) {
@@ -197,6 +194,8 @@ static void __init bcm47xx_register_bcma(void)
	err = bcma_host_soc_register(&bcm47xx_bus.bcma);
	err = bcma_host_soc_register(&bcm47xx_bus.bcma);
	if (err)
	if (err)
		panic("Failed to initialize BCMA bus (err %d)", err);
		panic("Failed to initialize BCMA bus (err %d)", err);

	bcm47xx_fill_bcma_boardinfo(&bcm47xx_bus.bcma.bus.boardinfo, NULL);
}
}
#endif
#endif


+26 −2
Original line number Original line Diff line number Diff line
@@ -165,6 +165,8 @@ static void bcm47xx_fill_sprom_r1234589(struct ssb_sprom *sprom,
					const char *prefix)
					const char *prefix)
{
{
	nvram_read_u16(prefix, NULL, "boardrev", &sprom->board_rev, 0);
	nvram_read_u16(prefix, NULL, "boardrev", &sprom->board_rev, 0);
	if (!sprom->board_rev)
		nvram_read_u16(NULL, NULL, "boardrev", &sprom->board_rev, 0);
	nvram_read_u16(prefix, NULL, "boardnum", &sprom->board_num, 0);
	nvram_read_u16(prefix, NULL, "boardnum", &sprom->board_num, 0);
	nvram_read_u8(prefix, NULL, "ledbh0", &sprom->gpio0, 0xff);
	nvram_read_u8(prefix, NULL, "ledbh0", &sprom->gpio0, 0xff);
	nvram_read_u8(prefix, NULL, "ledbh1", &sprom->gpio1, 0xff);
	nvram_read_u8(prefix, NULL, "ledbh1", &sprom->gpio1, 0xff);
@@ -555,8 +557,6 @@ void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom, const char *prefix)


void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix)
void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix)
{
{
	memset(sprom, 0, sizeof(struct ssb_sprom));

	bcm47xx_fill_sprom_ethernet(sprom, prefix);
	bcm47xx_fill_sprom_ethernet(sprom, prefix);


	nvram_read_u8(prefix, NULL, "sromrev", &sprom->revision, 0);
	nvram_read_u8(prefix, NULL, "sromrev", &sprom->revision, 0);
@@ -618,3 +618,27 @@ void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix)
		bcm47xx_fill_sprom_r1(sprom, prefix);
		bcm47xx_fill_sprom_r1(sprom, prefix);
	}
	}
}
}

#ifdef CONFIG_BCM47XX_SSB
void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo,
				const char *prefix)
{
	nvram_read_u16(prefix, NULL, "boardvendor", &boardinfo->vendor, 0);
	if (!boardinfo->vendor)
		boardinfo->vendor = SSB_BOARDVENDOR_BCM;

	nvram_read_u16(prefix, NULL, "boardtype", &boardinfo->type, 0);
}
#endif

#ifdef CONFIG_BCM47XX_BCMA
void bcm47xx_fill_bcma_boardinfo(struct bcma_boardinfo *boardinfo,
				 const char *prefix)
{
	nvram_read_u16(prefix, NULL, "boardvendor", &boardinfo->vendor, 0);
	if (!boardinfo->vendor)
		boardinfo->vendor = SSB_BOARDVENDOR_BCM;

	nvram_read_u16(prefix, NULL, "boardtype", &boardinfo->type, 0);
}
#endif
+9 −0
Original line number Original line Diff line number Diff line
@@ -47,4 +47,13 @@ extern enum bcm47xx_bus_type bcm47xx_bus_type;
void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix);
void bcm47xx_fill_sprom(struct ssb_sprom *sprom, const char *prefix);
void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom, const char *prefix);
void bcm47xx_fill_sprom_ethernet(struct ssb_sprom *sprom, const char *prefix);


#ifdef CONFIG_BCM47XX_SSB
void bcm47xx_fill_ssb_boardinfo(struct ssb_boardinfo *boardinfo,
				const char *prefix);
#endif
#ifdef CONFIG_BCM47XX_BCMA
void bcm47xx_fill_bcma_boardinfo(struct bcma_boardinfo *boardinfo,
				 const char *prefix);
#endif

#endif /* __ASM_BCM47XX_H */
#endif /* __ASM_BCM47XX_H */
Loading