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

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


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
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -44,7 +44,7 @@ config NFC_MRVL_I2C


config NFC_MRVL_SPI
config NFC_MRVL_SPI
	tristate "Marvell NFC-over-SPI driver"
	tristate "Marvell NFC-over-SPI driver"
	depends on NFC_MRVL && SPI
	depends on NFC_MRVL && NFC_NCI_SPI
	help
	help
	  Marvell NFC-over-SPI driver.
	  Marvell NFC-over-SPI driver.


+9 −3
Original line number Original line Diff line number Diff line
@@ -113,8 +113,11 @@ static void fw_dnld_over(struct nfcmrvl_private *priv, u32 error)
	}
	}


	atomic_set(&priv->ndev->cmd_cnt, 0);
	atomic_set(&priv->ndev->cmd_cnt, 0);

	if (timer_pending(&priv->ndev->cmd_timer))
		del_timer_sync(&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);
		del_timer_sync(&priv->fw_dnld.timer);


	nfc_info(priv->dev, "FW loading over (%d)]\n", error);
	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,
void	nfcmrvl_fw_dnld_recv_frame(struct nfcmrvl_private *priv,
				   struct sk_buff *skb)
				   struct sk_buff *skb)
{
{
	/* Discard command timer */
	if (timer_pending(&priv->ndev->cmd_timer))
		del_timer_sync(&priv->ndev->cmd_timer);

	/* Allow next command */
	/* Allow next command */
	atomic_set(&priv->ndev->cmd_cnt, 1);
	atomic_set(&priv->ndev->cmd_cnt, 1);
	del_timer_sync(&priv->ndev->cmd_timer);


	/* Queue and trigger rx work */
	/* Queue and trigger rx work */
	skb_queue_tail(&priv->fw_dnld.rx_q, skb);
	skb_queue_tail(&priv->fw_dnld.rx_q, skb);
+3 −12
Original line number Original line Diff line number Diff line
@@ -194,6 +194,9 @@ void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv)


	nfcmrvl_fw_dnld_deinit(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_unregister_device(ndev);
	nci_free_device(ndev);
	nci_free_device(ndev);
	kfree(priv);
	kfree(priv);
@@ -251,8 +254,6 @@ void nfcmrvl_chip_halt(struct nfcmrvl_private *priv)
		gpio_set_value(priv->config.reset_n_io, 0);
		gpio_set_value(priv->config.reset_n_io, 0);
}
}


#ifdef CONFIG_OF

int nfcmrvl_parse_dt(struct device_node *node,
int nfcmrvl_parse_dt(struct device_node *node,
		     struct nfcmrvl_platform_data *pdata)
		     struct nfcmrvl_platform_data *pdata)
{
{
@@ -275,16 +276,6 @@ int nfcmrvl_parse_dt(struct device_node *node,


	return 0;
	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);
EXPORT_SYMBOL_GPL(nfcmrvl_parse_dt);


MODULE_AUTHOR("Marvell International Ltd.");
MODULE_AUTHOR("Marvell International Ltd.");
+9 −17
Original line number Original line Diff line number Diff line
@@ -67,8 +67,6 @@ static struct nfcmrvl_if_ops uart_ops = {
	.nci_update_config = nfcmrvl_uart_nci_update_config
	.nci_update_config = nfcmrvl_uart_nci_update_config
};
};


#ifdef CONFIG_OF

static int nfcmrvl_uart_parse_dt(struct device_node *node,
static int nfcmrvl_uart_parse_dt(struct device_node *node,
				 struct nfcmrvl_platform_data *pdata)
				 struct nfcmrvl_platform_data *pdata)
{
{
@@ -102,16 +100,6 @@ static int nfcmrvl_uart_parse_dt(struct device_node *node,
	return 0;
	return 0;
}
}


#else

static int nfcmrvl_uart_parse_dt(struct device_node *node,
				 struct nfcmrvl_platform_data *pdata)
{
	return -ENODEV;
}

#endif

/*
/*
** NCI UART OPS
** NCI UART OPS
*/
*/
@@ -152,10 +140,6 @@ static int nfcmrvl_nci_uart_open(struct nci_uart *nu)
	nu->drv_data = priv;
	nu->drv_data = priv;
	nu->ndev = priv->ndev;
	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;
	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;
	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 */
	/* Remove BREAK to wake up the NFCC */
	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, 0);
		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;
	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
	** 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
	** up. we set BREAK. Once we will be ready to send again we will remove
	** it.
	** 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);
		nu->tty->ops->break_ctl(nu->tty, -1);
		usleep_range(1000, 3000);
	}
}
}


static struct nci_uart nfcmrvl_nci_uart = {
static struct nci_uart nfcmrvl_nci_uart = {