Commit fb9a10d9 authored by David S. Miller's avatar David S. Miller

Merge tag 'nfc-fixes-4.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/nfc-fixes

Samuel Ortiz says:

====================
NFC 4.4 fixes

This is the 1st NFC fixes pull request for 4.4.

It includes bug fixes and one fix for a build failure, all of them
introduced with the first NFC pull request for 4.4.

We have:

- Fix nfcmrvl SPI driver potential build error due to a broken Kconfig
  dependency.
- A few fixes for the firmware download implementation for the nfcmrvl
  UART driver.
- A GPIO allocation leak for the nfcmrvl driver.
- One code simplification for the nfcmrvl DT handling.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents d0b89141 82aff3ea
......@@ -44,7 +44,7 @@ config NFC_MRVL_I2C
config NFC_MRVL_SPI
tristate "Marvell NFC-over-SPI driver"
depends on NFC_MRVL && SPI
depends on NFC_MRVL && NFC_NCI_SPI
help
Marvell NFC-over-SPI driver.
......
......@@ -113,9 +113,12 @@ static void fw_dnld_over(struct nfcmrvl_private *priv, u32 error)
}
atomic_set(&priv->ndev->cmd_cnt, 0);
del_timer_sync(&priv->ndev->cmd_timer);
del_timer_sync(&priv->fw_dnld.timer);
if (timer_pending(&priv->ndev->cmd_timer))
del_timer_sync(&priv->ndev->cmd_timer);
if (timer_pending(&priv->fw_dnld.timer))
del_timer_sync(&priv->fw_dnld.timer);
nfc_info(priv->dev, "FW loading over (%d)]\n", error);
......@@ -472,9 +475,12 @@ void nfcmrvl_fw_dnld_deinit(struct nfcmrvl_private *priv)
void nfcmrvl_fw_dnld_recv_frame(struct nfcmrvl_private *priv,
struct sk_buff *skb)
{
/* Discard command timer */
if (timer_pending(&priv->ndev->cmd_timer))
del_timer_sync(&priv->ndev->cmd_timer);
/* Allow next command */
atomic_set(&priv->ndev->cmd_cnt, 1);
del_timer_sync(&priv->ndev->cmd_timer);
/* Queue and trigger rx work */
skb_queue_tail(&priv->fw_dnld.rx_q, skb);
......
......@@ -194,6 +194,9 @@ void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv)
nfcmrvl_fw_dnld_deinit(priv);
if (priv->config.reset_n_io)
devm_gpio_free(priv->dev, priv->config.reset_n_io);
nci_unregister_device(ndev);
nci_free_device(ndev);
kfree(priv);
......@@ -251,8 +254,6 @@ void nfcmrvl_chip_halt(struct nfcmrvl_private *priv)
gpio_set_value(priv->config.reset_n_io, 0);
}
#ifdef CONFIG_OF
int nfcmrvl_parse_dt(struct device_node *node,
struct nfcmrvl_platform_data *pdata)
{
......@@ -275,16 +276,6 @@ int nfcmrvl_parse_dt(struct device_node *node,
return 0;
}
#else
int nfcmrvl_parse_dt(struct device_node *node,
struct nfcmrvl_platform_data *pdata)
{
return -ENODEV;
}
#endif
EXPORT_SYMBOL_GPL(nfcmrvl_parse_dt);
MODULE_AUTHOR("Marvell International Ltd.");
......
......@@ -67,8 +67,6 @@ static struct nfcmrvl_if_ops uart_ops = {
.nci_update_config = nfcmrvl_uart_nci_update_config
};
#ifdef CONFIG_OF
static int nfcmrvl_uart_parse_dt(struct device_node *node,
struct nfcmrvl_platform_data *pdata)
{
......@@ -102,16 +100,6 @@ static int nfcmrvl_uart_parse_dt(struct device_node *node,
return 0;
}
#else
static int nfcmrvl_uart_parse_dt(struct device_node *node,
struct nfcmrvl_platform_data *pdata)
{
return -ENODEV;
}
#endif
/*
** NCI UART OPS
*/
......@@ -152,10 +140,6 @@ static int nfcmrvl_nci_uart_open(struct nci_uart *nu)
nu->drv_data = priv;
nu->ndev = priv->ndev;
/* Set BREAK */
if (priv->config.break_control && nu->tty->ops->break_ctl)
nu->tty->ops->break_ctl(nu->tty, -1);
return 0;
}
......@@ -174,6 +158,9 @@ static void nfcmrvl_nci_uart_tx_start(struct nci_uart *nu)
{
struct nfcmrvl_private *priv = (struct nfcmrvl_private *)nu->drv_data;
if (priv->ndev->nfc_dev->fw_download_in_progress)
return;
/* Remove BREAK to wake up the NFCC */
if (priv->config.break_control && nu->tty->ops->break_ctl) {
nu->tty->ops->break_ctl(nu->tty, 0);
......@@ -185,13 +172,18 @@ static void nfcmrvl_nci_uart_tx_done(struct nci_uart *nu)
{
struct nfcmrvl_private *priv = (struct nfcmrvl_private *)nu->drv_data;
if (priv->ndev->nfc_dev->fw_download_in_progress)
return;
/*
** To ensure that if the NFCC goes in DEEP SLEEP sate we can wake him
** up. we set BREAK. Once we will be ready to send again we will remove
** it.
*/
if (priv->config.break_control && nu->tty->ops->break_ctl)
if (priv->config.break_control && nu->tty->ops->break_ctl) {
nu->tty->ops->break_ctl(nu->tty, -1);
usleep_range(1000, 3000);
}
}
static struct nci_uart nfcmrvl_nci_uart = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment