Age | Commit message (Collapse) | Author |
|
It is intended to replace pn533_send_cmd_frame_sync() iface which
requires from the caller to create complete frame.
The new function constructs a complete frame itself and sends it out
in sync manner. This way frame logic is hidden from the caller.
pn533_send_cmd_sync() returns ERR_PTR in case of an error or a pointer
to valid response sk_buff otherwise. The pointer must be freed by the
caller when it's been consumed.
Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
This iface is intended to be used with DEP transfers. It differs
from pn533_send_cmd_async() in the way the response skb is allocated.
Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
This is intendend to replace pn533_send_cmd_frame_async() which
requires from the caller to create a complete frame.
The new function constructs a frame and sends it out which hides the
frame logic and avoid code duplication.
The caller has to allocate skb and put its payload there, and finally
provide the skb together with a complete cb to pn533_send_cmd_async().
Response skb is allocated by the core part and pass to the caller cb.
Next, the caller has to free it when is not needed anymore or pass it
up to the stack.
Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
__pn533_send_cmd_frame_async() is called when lock is held so GFP_KERNEL
flag will be always used. Thus, having extra param does not optimise the
code.
Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
PN533_CMD_DATAEXCH_HEAD_LEN includes a frame header length which is not
seen at a glance. It can be missleading, so split it and define the
frame header length explicitly.
Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
in_maxlen and out_maxlen was replaced with PN533_NORMAL_FRAME_MAX_LEN
Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
Conflicts:
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
drivers/net/wireless/iwlwifi/pcie/tx.c
|
|
In target mode, sent sk_buff were not freed in pn533_tm_send_complete
Signed-off-by: Thierry Escande <thierry.escande@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
cmd is allocated in pn533_dep_link_up and passed as an arg to
pn533_send_cmd_frame_async together with a complete cb.
arg is passed to the cb and must be kfreed there.
Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
cmd was freed in pn533_dep_link_up regardless of
pn533_send_cmd_frame_async return code. Cmd is passed as argument to
pn533_in_dep_link_up_complete callback and should be freed there.
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
In pn533_wq_cmd command was removed from list without cmd_lock held
(race with pn533_send_cmd_frame_async) which could lead to list
corruption. Delete command from list before releasing lock.
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
The pn544.h just provides the platform data struct and defines and
nothing else. So move it to to linux/platform_data/ now.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
Get rid of unused arg param in pn533_init_target_complete and
in pn533_start_poll_complete.
Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
Max frame size should be 264 bytes as per spec and not limited to
endpoint MaxPacketSize which is 64 in my case (acr122 reader).
Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
Signed-off-by: Arron Wang <arron.wang@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
The driver now has all HCI stuff isolated in one file, and all the
hardware link specifics in another. Writing a pn544 driver on top of
another hardware link is now just a matter of adding a new file for that
new hardware specifics.
Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
When the driver does not support checking the tag is still present, it
must return -EOPNOTSUPP. The NFC Core will then stop asking and not
report a tag lost event to user space.
Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
Signed-off-by: Arron Wang <arron.wang@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
And implement the corresponding hooks for pn544.
Signed-off-by: Arron Wang <arron.wang@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
And implement the corresponding hooks for pn544.
Signed-off-by: Arron Wang <arron.wang@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
We need to send continue activation command to allow NFCIP-1
activation when a NFC target has been discovered in type A or
type F reader gate.
Signed-off-by: Arron Wang <arron.wang@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
Signed-off-by: Arron Wang <arron.wang@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
Set the local general bytes and default value for NFCIP1
Target/Initiator registries if the protocol is NFC-DEP
Signed-off-by: Arron Wang <arron.wang@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
If command allocation failed cmd_lock was not released and deadlock
would occur.
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
xmit callback provided by a driver encapsulates upper layers
data and sends it to the hardware. So, HCI does not know the
exact amount of data being sent and thus can't handle partially
sent frames properly.
Therefore, the driver must return 0 for completely sent frame or
negative for failure.
Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Acked-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
This was scheduled for 3.6, we're late.
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
The dereference should be moved below the NULL test.
spatch with a semantic match is used to found this.
(http://coccinelle.lip6.fr/)
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
spatch with a semantic match is used to found this.
(http://coccinelle.lip6.fr/)
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
The previous shdlc HCI driver and its header are removed from the tree.
PN544 now registers directly with HCI and passes the name of the llc it
requires (shdlc).
HCI instantiation now allocates the required llc instance. The llc is
started when the HCI device is brought up.
Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
This enables the completion callback to be called from a different
context, preventing a possible deadlock if the callback resulted in the
invocation of a nested call to the currently locked nfc_dev.
This is also more in line with the im_transceive nfc_ops for NFC Core or
NCI drivers which already behave asynchronously.
Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
Checksum is specific for a chip spcification and it varies
(in size and type) between different hardware. It should be
handled in the driver then.
Moreover, shdlc spec doesn't mention crc as a part of the frame.
Update pn544_hci driver as well.
Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Acked-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
As we don't have a primary handler but only a threaded one, __setup_irq()
ends up failing if we don't set this flag.
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
NFC driver doesn't sit in memory reclaim path and has no reason to use
WQ_MEM_RECLAIM. Drop WQ_MEM_RECLAIM from pn533->wq and use
alloc_ordered_workqueue() instead of WQ_UNBOUND w/ max_active == 1.
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
Simplify the code by make use of module_platform_driver macro.
Signed-off-by: Syam Sidhardhan <s.syam@samsung.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
Instead of returning EBUSY when getting a command while another one is
running, we queue them. Upon completion of the pending command, the next
one is processed.
Besides the fact that it simplifies the pn533 locking scheme, it also
comes with the nice side effect of fixing the following warning:
[ 82.274297] =====================================
[ 82.274297] [ BUG: bad unlock balance detected! ]
[ 82.274298] 3.5.0-rc1+ #1 Not tainted
[ 82.274299] -------------------------------------
[ 82.274300] kworker/u:1/16 is trying to release lock (&dev->cmd_lock) at:
[ 82.274305] [<ffffffff8144f246>] mutex_unlock+0x9/0xb
[ 82.274305] but there are no more locks to release!
[ 82.274306]
[ 82.274306] other info that might help us debug this:
[ 82.274306] 2 locks held by kworker/u:1/16:
[ 82.274311] #0: (pn533){.+.+..}, at: [<ffffffff8103a67d>]
+process_one_work+0x145/0x2e2
[ 82.274314] #1: ((&dev->cmd_work)){+.+...}, at: [<ffffffff8103a67d>]
+process_one_work+0x145/0x2e2
[ 82.274314]
[ 82.274314] stack backtrace:
[ 82.274315] Pid: 16, comm: kworker/u:1 Not tainted 3.5.0-rc1+ #1
[ 82.274315] Call Trace:
[ 82.274317] [<ffffffff8144f246>] ? mutex_unlock+0x9/0xb
[ 82.274321] [<ffffffff81059841>] print_unlock_inbalance_bug+0xda/0xe4
[ 82.274323] [<ffffffff8105c74c>] lock_release_non_nested+0xb2/0x232
[ 82.274325] [<ffffffff8105a61e>] ? mark_held_locks+0x6d/0x95
[ 82.274326] [<ffffffff8144f246>] ? mutex_unlock+0x9/0xb
[ 82.274328] [<ffffffff81451105>] ? _raw_spin_unlock_irqrestore+0x40/0x5c
[ 82.274329] [<ffffffff8144f246>] ? mutex_unlock+0x9/0xb
[ 82.274330] [<ffffffff8105ca42>] lock_release+0x176/0x1ac
[ 82.274333] [<ffffffff8123de14>] ? pn533_send_complete+0xa8/0xa8
[ 82.274334] [<ffffffff8144f1d6>] __mutex_unlock_slowpath+0xb0/0x117
[ 82.274336] [<ffffffff8144f246>] mutex_unlock+0x9/0xb
[ 82.274337] [<ffffffff8123de65>] pn533_wq_cmd_complete+0x51/0x55
[ 82.274338] [<ffffffff8103a6db>] process_one_work+0x1a3/0x2e2
[ 82.274340] [<ffffffff8103a67d>] ? process_one_work+0x145/0x2e2
[ 82.274341] [<ffffffff8103b119>] worker_thread+0xcf/0x153
[ 82.274343] [<ffffffff8103b04a>] ? manage_workers.isra.22+0x16b/0x16b
[ 82.274344] [<ffffffff8103b04a>] ? manage_workers.isra.22+0x16b/0x16b
[ 82.274346] [<ffffffff8103eb11>] kthread+0x95/0x9d
[ 82.274348] [<ffffffff81452ef4>] kernel_thread_helper+0x4/0x10
[ 82.274351] [<ffffffff81046561>] ? finish_task_switch+0x45/0xc3
[ 82.274352] [<ffffffff814514f0>] ? retint_restore_args+0x13/0x13
[ 82.274353] [<ffffffff8103ea7c>] ? __init_kthread_worker+0x55/0x55
[ 82.274354] [<ffffffff81452ef0>] ? gs_change+0x13/0x13
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
Some devices (e.g. Sony's PaSoRi) can not do type B polling, so we have
to make a distinction between ISO14443 type A and B poll modes.
Cc: Eric Lapuyade <eric.lapuyade@intel.com>
Cc: Ilan Elias <ilane@ti.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
Otherwise DATA_EXCHANGE seems to be just fine.
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
Sony RC-S360 is also known as the Sony PaSoRi contactless reader.
Only type 2, 3 and 4 tag reading is supported at the moment.
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
Some NFC chips will statically create and open pipes for both standard
and proprietary gates. The driver can now pass this information to HCI
such that HCI will not attempt to create and open them, but will instead
directly use the passed pipe ids.
Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
Signed-off-by: Eric Lapuyade <eric.lapuyade@intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
When receiving a DEP link down event, we should cancel all pending URBs
if we're activated as a target or if we're an initiator.
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
We get the right baud rate from the last polled modulation.
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
After going through all the modulations, the pn533 driver spends 2
seconds listening for targets.
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
Without those settings several devices will not activate pn533 as a target.
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
When trying to enable a DEP link as a passive initiator, pn533 needs to
provide the polling request command payload.
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
Those define the ATR_RES response timeout after which the pn533 considers the
target to be mute.
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|
|
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
|