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

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

Merge branch 'for-upstream' of...

Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next



Johan Hedberg say:

====================
pull request: bluetooth-next 2014-12-31

Here's the first batch of bluetooth patches for 3.20.

 - Cleanups & fixes to ieee802154  drivers
 - Fix synchronization of mgmt commands with respective HCI commands
 - Add self-tests for LE pairing crypto functionality
 - Remove 'BlueFritz!' specific handling from core using a new quirk flag
 - Public address configuration support for ath3012
 - Refactor debugfs support into a dedicated file
 - Initial support for LE Data Length Extension feature from Bluetooth 4.2

Please let me know if there are any issues pulling. Thanks.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents a4c9ea5e e64b4fb6
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -696,6 +696,8 @@ static int bfusb_probe(struct usb_interface *intf, const struct usb_device_id *i
	hdev->flush = bfusb_flush;
	hdev->flush = bfusb_flush;
	hdev->send  = bfusb_send_frame;
	hdev->send  = bfusb_send_frame;


	set_bit(HCI_QUIRK_BROKEN_LOCAL_COMMANDS, &hdev->quirks);

	if (hci_register_dev(hdev) < 0) {
	if (hci_register_dev(hdev) < 0) {
		BT_ERR("Can't register HCI device");
		BT_ERR("Can't register HCI device");
		hci_free_dev(hdev);
		hci_free_dev(hdev);
+33 −1
Original line number Original line Diff line number Diff line
@@ -49,6 +49,7 @@ static struct usb_driver btusb_driver;
#define BTUSB_INTEL_BOOT	0x200
#define BTUSB_INTEL_BOOT	0x200
#define BTUSB_BCM_PATCHRAM	0x400
#define BTUSB_BCM_PATCHRAM	0x400
#define BTUSB_MARVELL		0x800
#define BTUSB_MARVELL		0x800
#define BTUSB_AVM		0x1000


static const struct usb_device_id btusb_table[] = {
static const struct usb_device_id btusb_table[] = {
	/* Generic Bluetooth USB device */
	/* Generic Bluetooth USB device */
@@ -85,7 +86,7 @@ static const struct usb_device_id btusb_table[] = {
	{ USB_DEVICE(0x05ac, 0x8281) },
	{ USB_DEVICE(0x05ac, 0x8281) },


	/* AVM BlueFRITZ! USB v2.0 */
	/* AVM BlueFRITZ! USB v2.0 */
	{ USB_DEVICE(0x057c, 0x3800) },
	{ USB_DEVICE(0x057c, 0x3800), .driver_info = BTUSB_AVM },


	/* Bluetooth Ultraport Module from IBM */
	/* Bluetooth Ultraport Module from IBM */
	{ USB_DEVICE(0x04bf, 0x030a) },
	{ USB_DEVICE(0x04bf, 0x030a) },
@@ -1943,6 +1944,31 @@ static int btusb_set_bdaddr_bcm(struct hci_dev *hdev, const bdaddr_t *bdaddr)
	return 0;
	return 0;
}
}


static int btusb_set_bdaddr_ath3012(struct hci_dev *hdev,
				    const bdaddr_t *bdaddr)
{
	struct sk_buff *skb;
	u8 buf[10];
	long ret;

	buf[0] = 0x01;
	buf[1] = 0x01;
	buf[2] = 0x00;
	buf[3] = sizeof(bdaddr_t);
	memcpy(buf + 4, bdaddr, sizeof(bdaddr_t));

	skb = __hci_cmd_sync(hdev, 0xfc0b, sizeof(buf), buf, HCI_INIT_TIMEOUT);
	if (IS_ERR(skb)) {
		ret = PTR_ERR(skb);
		BT_ERR("%s: Change address command failed (%ld)",
		       hdev->name, ret);
		return ret;
	}
	kfree_skb(skb);

	return 0;
}

static int btusb_probe(struct usb_interface *intf,
static int btusb_probe(struct usb_interface *intf,
		       const struct usb_device_id *id)
		       const struct usb_device_id *id)
{
{
@@ -2055,9 +2081,15 @@ static int btusb_probe(struct usb_interface *intf,
	if (id->driver_info & BTUSB_MARVELL)
	if (id->driver_info & BTUSB_MARVELL)
		hdev->set_bdaddr = btusb_set_bdaddr_marvell;
		hdev->set_bdaddr = btusb_set_bdaddr_marvell;


	if (id->driver_info & BTUSB_AVM)
		set_bit(HCI_QUIRK_BROKEN_LOCAL_COMMANDS, &hdev->quirks);

	if (id->driver_info & BTUSB_INTEL_BOOT)
	if (id->driver_info & BTUSB_INTEL_BOOT)
		set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks);
		set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks);


	if (id->driver_info & BTUSB_ATH3012)
		hdev->set_bdaddr = btusb_set_bdaddr_ath3012;

	/* Interface numbers are hardcoded in the specification */
	/* Interface numbers are hardcoded in the specification */
	data->isoc = usb_ifnum_to_if(data->udev, 1);
	data->isoc = usb_ifnum_to_if(data->udev, 1);


+48 −32
Original line number Original line Diff line number Diff line
@@ -450,7 +450,7 @@ at86rf230_async_error_recover(void *context)
	ieee802154_wake_queue(lp->hw);
	ieee802154_wake_queue(lp->hw);
}
}


static void
static inline void
at86rf230_async_error(struct at86rf230_local *lp,
at86rf230_async_error(struct at86rf230_local *lp,
		      struct at86rf230_state_change *ctx, int rc)
		      struct at86rf230_state_change *ctx, int rc)
{
{
@@ -524,7 +524,6 @@ at86rf230_async_state_assert(void *context)
			}
			}
		}
		}



		dev_warn(&lp->spi->dev, "unexcept state change from 0x%02x to 0x%02x. Actual state: 0x%02x\n",
		dev_warn(&lp->spi->dev, "unexcept state change from 0x%02x to 0x%02x. Actual state: 0x%02x\n",
			 ctx->from_state, ctx->to_state, trx_state);
			 ctx->from_state, ctx->to_state, trx_state);
	}
	}
@@ -655,7 +654,7 @@ at86rf230_async_state_change_start(void *context)
		if (ctx->irq_enable)
		if (ctx->irq_enable)
			enable_irq(lp->spi->irq);
			enable_irq(lp->spi->irq);


		at86rf230_async_error(lp, &lp->state, rc);
		at86rf230_async_error(lp, ctx, rc);
	}
	}
}
}


@@ -715,10 +714,7 @@ at86rf230_tx_complete(void *context)


	enable_irq(lp->spi->irq);
	enable_irq(lp->spi->irq);


	if (lp->max_frame_retries <= 0)
	ieee802154_xmit_complete(lp->hw, skb, !lp->tx_aret);
		ieee802154_xmit_complete(lp->hw, skb, true);
	else
		ieee802154_xmit_complete(lp->hw, skb, false);
}
}


static void
static void
@@ -753,16 +749,13 @@ at86rf230_tx_trac_check(void *context)
	 * to STATE_FORCE_TRX_OFF then STATE_TX_ON to recover the transceiver
	 * to STATE_FORCE_TRX_OFF then STATE_TX_ON to recover the transceiver
	 * state to TX_ON.
	 * state to TX_ON.
	 */
	 */
	if (trac) {
	if (trac)
		at86rf230_async_state_change(lp, ctx, STATE_FORCE_TRX_OFF,
		at86rf230_async_state_change(lp, ctx, STATE_FORCE_TRX_OFF,
					     at86rf230_tx_trac_error, true);
					     at86rf230_tx_trac_error, true);
		return;
	else
	}

		at86rf230_tx_on(context);
		at86rf230_tx_on(context);
}
}



static void
static void
at86rf230_tx_trac_status(void *context)
at86rf230_tx_trac_status(void *context)
{
{
@@ -1146,11 +1139,37 @@ at86rf230_set_lbt(struct ieee802154_hw *hw, bool on)
}
}


static int
static int
at86rf230_set_cca_mode(struct ieee802154_hw *hw, u8 mode)
at86rf230_set_cca_mode(struct ieee802154_hw *hw,
		       const struct wpan_phy_cca *cca)
{
{
	struct at86rf230_local *lp = hw->priv;
	struct at86rf230_local *lp = hw->priv;
	u8 val;


	return at86rf230_write_subreg(lp, SR_CCA_MODE, mode);
	/* mapping 802.15.4 to driver spec */
	switch (cca->mode) {
	case NL802154_CCA_ENERGY:
		val = 1;
		break;
	case NL802154_CCA_CARRIER:
		val = 2;
		break;
	case NL802154_CCA_ENERGY_CARRIER:
		switch (cca->opt) {
		case NL802154_CCA_OPT_ENERGY_CARRIER_AND:
			val = 3;
			break;
		case NL802154_CCA_OPT_ENERGY_CARRIER_OR:
			val = 0;
			break;
		default:
			return -EINVAL;
		}
		break;
	default:
		return -EINVAL;
	}

	return at86rf230_write_subreg(lp, SR_CCA_MODE, val);
}
}


static int
static int
@@ -1400,7 +1419,7 @@ at86rf230_detect_device(struct at86rf230_local *lp)
	if (rc)
	if (rc)
		return rc;
		return rc;


	rc = __at86rf230_read(lp, RG_PART_NUM, &version);
	rc = __at86rf230_read(lp, RG_VERSION_NUM, &version);
	if (rc)
	if (rc)
		return rc;
		return rc;


@@ -1410,11 +1429,12 @@ at86rf230_detect_device(struct at86rf230_local *lp)
		return -EINVAL;
		return -EINVAL;
	}
	}


	lp->hw->extra_tx_headroom = 0;
	lp->hw->flags = IEEE802154_HW_TX_OMIT_CKSUM | IEEE802154_HW_AACK |
	lp->hw->flags = IEEE802154_HW_TX_OMIT_CKSUM | IEEE802154_HW_AACK |
			IEEE802154_HW_TXPOWER | IEEE802154_HW_ARET |
			IEEE802154_HW_TXPOWER | IEEE802154_HW_ARET |
			IEEE802154_HW_AFILT | IEEE802154_HW_PROMISCUOUS;
			IEEE802154_HW_AFILT | IEEE802154_HW_PROMISCUOUS;


	lp->hw->phy->cca.mode = NL802154_CCA_ENERGY;

	switch (part) {
	switch (part) {
	case 2:
	case 2:
		chip = "at86rf230";
		chip = "at86rf230";
@@ -1429,16 +1449,12 @@ at86rf230_detect_device(struct at86rf230_local *lp)
		break;
		break;
	case 7:
	case 7:
		chip = "at86rf212";
		chip = "at86rf212";
		if (version == 1) {
		lp->data = &at86rf212_data;
		lp->data = &at86rf212_data;
		lp->hw->flags |= IEEE802154_HW_LBT;
		lp->hw->flags |= IEEE802154_HW_LBT;
		lp->hw->phy->channels_supported[0] = 0x00007FF;
		lp->hw->phy->channels_supported[0] = 0x00007FF;
		lp->hw->phy->channels_supported[2] = 0x00007FF;
		lp->hw->phy->channels_supported[2] = 0x00007FF;
		lp->hw->phy->current_channel = 5;
		lp->hw->phy->current_channel = 5;
		lp->hw->phy->symbol_duration = 25;
		lp->hw->phy->symbol_duration = 25;
		} else {
			rc = -ENOTSUPP;
		}
		break;
		break;
	case 11:
	case 11:
		chip = "at86rf233";
		chip = "at86rf233";
@@ -1448,7 +1464,7 @@ at86rf230_detect_device(struct at86rf230_local *lp)
		lp->hw->phy->symbol_duration = 16;
		lp->hw->phy->symbol_duration = 16;
		break;
		break;
	default:
	default:
		chip = "unkown";
		chip = "unknown";
		rc = -ENOTSUPP;
		rc = -ENOTSUPP;
		break;
		break;
	}
	}
+6 −21
Original line number Original line Diff line number Diff line
@@ -19,7 +19,6 @@
#include <linux/workqueue.h>
#include <linux/workqueue.h>
#include <linux/interrupt.h>
#include <linux/interrupt.h>
#include <linux/skbuff.h>
#include <linux/skbuff.h>
#include <linux/pinctrl/consumer.h>
#include <linux/of_gpio.h>
#include <linux/of_gpio.h>
#include <linux/ieee802154.h>
#include <linux/ieee802154.h>


@@ -513,7 +512,6 @@ err_tx:
	return rc;
	return rc;
}
}



static int cc2520_rx(struct cc2520_private *priv)
static int cc2520_rx(struct cc2520_private *priv)
{
{
	u8 len = 0, lqi = 0, bytes = 1;
	u8 len = 0, lqi = 0, bytes = 1;
@@ -652,6 +650,7 @@ static int cc2520_register(struct cc2520_private *priv)
	priv->hw->parent = &priv->spi->dev;
	priv->hw->parent = &priv->spi->dev;
	priv->hw->extra_tx_headroom = 0;
	priv->hw->extra_tx_headroom = 0;
	priv->hw->vif_data_size = sizeof(*priv);
	priv->hw->vif_data_size = sizeof(*priv);
	ieee802154_random_extended_addr(&priv->hw->phy->perm_extended_addr);


	/* We do support only 2.4 Ghz */
	/* We do support only 2.4 Ghz */
	priv->hw->phy->channels_supported[0] = 0x7FFF800;
	priv->hw->phy->channels_supported[0] = 0x7FFF800;
@@ -842,24 +841,15 @@ done:
static int cc2520_probe(struct spi_device *spi)
static int cc2520_probe(struct spi_device *spi)
{
{
	struct cc2520_private *priv;
	struct cc2520_private *priv;
	struct pinctrl *pinctrl;
	struct cc2520_platform_data *pdata;
	struct cc2520_platform_data *pdata;
	int ret;
	int ret;


	priv = devm_kzalloc(&spi->dev,
	priv = devm_kzalloc(&spi->dev, sizeof(*priv), GFP_KERNEL);
			    sizeof(struct cc2520_private), GFP_KERNEL);
	if (!priv)
	if (!priv) {
		return -ENOMEM;
		ret = -ENOMEM;
		goto err_ret;
	}


	spi_set_drvdata(spi, priv);
	spi_set_drvdata(spi, priv);


	pinctrl = devm_pinctrl_get_select_default(&spi->dev);
	if (IS_ERR(pinctrl))
		dev_warn(&spi->dev,
			 "pinctrl pins are not configured\n");

	pdata = cc2520_get_platform_data(spi);
	pdata = cc2520_get_platform_data(spi);
	if (!pdata) {
	if (!pdata) {
		dev_err(&spi->dev, "no platform data\n");
		dev_err(&spi->dev, "no platform data\n");
@@ -870,10 +860,8 @@ static int cc2520_probe(struct spi_device *spi)


	priv->buf = devm_kzalloc(&spi->dev,
	priv->buf = devm_kzalloc(&spi->dev,
				 SPI_COMMAND_BUFFER, GFP_KERNEL);
				 SPI_COMMAND_BUFFER, GFP_KERNEL);
	if (!priv->buf) {
	if (!priv->buf)
		ret = -ENOMEM;
		return -ENOMEM;
		goto err_ret;
	}


	mutex_init(&priv->buffer_mutex);
	mutex_init(&priv->buffer_mutex);
	INIT_WORK(&priv->fifop_irqwork, cc2520_fifop_irqwork);
	INIT_WORK(&priv->fifop_irqwork, cc2520_fifop_irqwork);
@@ -947,7 +935,6 @@ static int cc2520_probe(struct spi_device *spi)
	if (ret)
	if (ret)
		goto err_hw_init;
		goto err_hw_init;



	gpio_set_value(pdata->vreg, HIGH);
	gpio_set_value(pdata->vreg, HIGH);
	usleep_range(100, 150);
	usleep_range(100, 150);


@@ -991,8 +978,6 @@ static int cc2520_probe(struct spi_device *spi)
err_hw_init:
err_hw_init:
	mutex_destroy(&priv->buffer_mutex);
	mutex_destroy(&priv->buffer_mutex);
	flush_work(&priv->fifop_irqwork);
	flush_work(&priv->fifop_irqwork);

err_ret:
	return ret;
	return ret;
}
}


+3 −3
Original line number Original line Diff line number Diff line
@@ -289,7 +289,7 @@ static int mrf24j40_read_rx_buf(struct mrf24j40 *devrec,
		goto out;
		goto out;


	/* Range check the RX FIFO length, accounting for the one-byte
	/* Range check the RX FIFO length, accounting for the one-byte
	 * length field at the begining. */
	 * length field at the beginning. */
	if (rx_len > RX_FIFO_SIZE-1) {
	if (rx_len > RX_FIFO_SIZE-1) {
		dev_err(printdev(devrec), "Invalid length read from device. Performing short read.\n");
		dev_err(printdev(devrec), "Invalid length read from device. Performing short read.\n");
		rx_len = RX_FIFO_SIZE-1;
		rx_len = RX_FIFO_SIZE-1;
Loading