2013-03-18 22:06:49

by Alan Ott

[permalink] [raw]
Subject: [PATCH 0/4] Misc MRF24J40 Fixes

These are fairly straight-forward.

Alan Ott (4):
mrf24j40: pinctrl support
mrf24j40: Warn if transmit interrupts timeout
mrf24j40: Increase max SPI speed to 10MHz
mrf24j40: Fix byte-order of IEEE address

drivers/net/ieee802154/mrf24j40.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)

--
1.7.11.2


2013-03-18 22:06:50

by Alan Ott

[permalink] [raw]
Subject: [PATCH 1/4] mrf24j40: pinctrl support

Activate pinctrl settings when used with a DT system.

Signed-off-by: Alan Ott <[email protected]>
---
drivers/net/ieee802154/mrf24j40.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/net/ieee802154/mrf24j40.c b/drivers/net/ieee802154/mrf24j40.c
index 3f2c7aa..3106895 100644
--- a/drivers/net/ieee802154/mrf24j40.c
+++ b/drivers/net/ieee802154/mrf24j40.c
@@ -22,6 +22,7 @@
#include <linux/spi/spi.h>
#include <linux/interrupt.h>
#include <linux/module.h>
+#include <linux/pinctrl/consumer.h>
#include <net/wpan-phy.h>
#include <net/mac802154.h>

@@ -623,6 +624,7 @@ static int mrf24j40_probe(struct spi_device *spi)
int ret = -ENOMEM;
u8 val;
struct mrf24j40 *devrec;
+ struct pinctrl *pinctrl;

printk(KERN_INFO "mrf24j40: probe(). IRQ: %d\n", spi->irq);

@@ -633,6 +635,11 @@ static int mrf24j40_probe(struct spi_device *spi)
if (!devrec->buf)
goto err_buf;

+ pinctrl = devm_pinctrl_get_select_default(&spi->dev);
+ if (IS_ERR(pinctrl))
+ dev_warn(&spi->dev,
+ "pinctrl pins are not configured from the driver");
+
spi->mode = SPI_MODE_0; /* TODO: Is this appropriate for right here? */
if (spi->max_speed_hz > MAX_SPI_SPEED_HZ)
spi->max_speed_hz = MAX_SPI_SPEED_HZ;
--
1.7.11.2

2013-03-18 22:07:13

by Alan Ott

[permalink] [raw]
Subject: [PATCH 4/4] mrf24j40: Fix byte-order of IEEE address

Load the 64-bit Extended (IEEE) address into the hardware in the proper
byte order.

Signed-off-by: Alan Ott <[email protected]>
---
drivers/net/ieee802154/mrf24j40.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ieee802154/mrf24j40.c b/drivers/net/ieee802154/mrf24j40.c
index b4f9b67..0ca8f88 100644
--- a/drivers/net/ieee802154/mrf24j40.c
+++ b/drivers/net/ieee802154/mrf24j40.c
@@ -478,7 +478,7 @@ static int mrf24j40_filter(struct ieee802154_dev *dev,
int i;
for (i = 0; i < 8; i++)
write_short_reg(devrec, REG_EADR0+i,
- filt->ieee_addr[i]);
+ filt->ieee_addr[7-i]);

#ifdef DEBUG
printk(KERN_DEBUG "Set long addr to: ");
--
1.7.11.2

2013-03-18 22:07:46

by Alan Ott

[permalink] [raw]
Subject: [PATCH 3/4] mrf24j40: Increase max SPI speed to 10MHz

Upon consulting the datasheet further, it does indicates a maximum speed
for SCK at 10MHz.

Signed-off-by: Alan Ott <[email protected]>
---
drivers/net/ieee802154/mrf24j40.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ieee802154/mrf24j40.c b/drivers/net/ieee802154/mrf24j40.c
index 582c0a3..b4f9b67 100644
--- a/drivers/net/ieee802154/mrf24j40.c
+++ b/drivers/net/ieee802154/mrf24j40.c
@@ -92,9 +92,8 @@ struct mrf24j40 {
#define MRF24J40_READLONG(reg) (1 << 15 | (reg) << 5)
#define MRF24J40_WRITELONG(reg) (1 << 15 | (reg) << 5 | 1 << 4)

-/* Maximum speed to run the device at. TODO: Get the real max value from
- * someone at Microchip since it isn't in the datasheet. */
-#define MAX_SPI_SPEED_HZ 1000000
+/* The datasheet indicates the theoretical maximum for SCK to be 10MHz */
+#define MAX_SPI_SPEED_HZ 10000000

#define printdev(X) (&X->spi->dev)

--
1.7.11.2

2013-03-18 22:08:15

by Alan Ott

[permalink] [raw]
Subject: [PATCH 2/4] mrf24j40: Warn if transmit interrupts timeout

Issue a warning if a transmit complete interrupt doesn't happen in time.

Signed-off-by: Alan Ott <[email protected]>
---
drivers/net/ieee802154/mrf24j40.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/net/ieee802154/mrf24j40.c b/drivers/net/ieee802154/mrf24j40.c
index 3106895..582c0a3 100644
--- a/drivers/net/ieee802154/mrf24j40.c
+++ b/drivers/net/ieee802154/mrf24j40.c
@@ -362,6 +362,7 @@ static int mrf24j40_tx(struct ieee802154_dev *dev, struct sk_buff *skb)
if (ret == -ERESTARTSYS)
goto err;
if (ret == 0) {
+ dev_warn(printdev(devrec), "Timeout waiting for TX interrupt\n");
ret = -ETIMEDOUT;
goto err;
}
--
1.7.11.2

2013-03-19 14:08:32

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 0/4] Misc MRF24J40 Fixes

From: Alan Ott <[email protected]>
Date: Mon, 18 Mar 2013 18:06:39 -0400

> These are fairly straight-forward.

All applied to net-next, thanks.