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

Merge branch 'fixes-for-3.9' of git://gitorious.org/linux-can/linux-can

Marc Kleine-Budde says:

====================
here's another fix for the v3.9 release cycle, if not too late:

Christoph Fritz fixed the device tree property handling on little endian
systems in the sja1000 device tree driver. It was Mylene Josserand who noticed
that the mcp251x spi CAN driver cannot request its interrupt anymore, as the
driver is using a threaded interrupt handler without a primary one and without
specifying IRQF_ONESHOT (which is needed since v3.5). A patch by me fixes this
problem.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 8b5b8c29 0443de5f
...@@ -929,6 +929,7 @@ static int mcp251x_open(struct net_device *net) ...@@ -929,6 +929,7 @@ static int mcp251x_open(struct net_device *net)
struct mcp251x_priv *priv = netdev_priv(net); struct mcp251x_priv *priv = netdev_priv(net);
struct spi_device *spi = priv->spi; struct spi_device *spi = priv->spi;
struct mcp251x_platform_data *pdata = spi->dev.platform_data; struct mcp251x_platform_data *pdata = spi->dev.platform_data;
unsigned long flags;
int ret; int ret;
ret = open_candev(net); ret = open_candev(net);
...@@ -945,9 +946,14 @@ static int mcp251x_open(struct net_device *net) ...@@ -945,9 +946,14 @@ static int mcp251x_open(struct net_device *net)
priv->tx_skb = NULL; priv->tx_skb = NULL;
priv->tx_len = 0; priv->tx_len = 0;
flags = IRQF_ONESHOT;
if (pdata->irq_flags)
flags |= pdata->irq_flags;
else
flags |= IRQF_TRIGGER_FALLING;
ret = request_threaded_irq(spi->irq, NULL, mcp251x_can_ist, ret = request_threaded_irq(spi->irq, NULL, mcp251x_can_ist,
pdata->irq_flags ? pdata->irq_flags : IRQF_TRIGGER_FALLING, flags, DEVICE_NAME, priv);
DEVICE_NAME, priv);
if (ret) { if (ret) {
dev_err(&spi->dev, "failed to acquire irq %d\n", spi->irq); dev_err(&spi->dev, "failed to acquire irq %d\n", spi->irq);
if (pdata->transceiver_enable) if (pdata->transceiver_enable)
......
...@@ -96,8 +96,8 @@ static int sja1000_ofp_probe(struct platform_device *ofdev) ...@@ -96,8 +96,8 @@ static int sja1000_ofp_probe(struct platform_device *ofdev)
struct net_device *dev; struct net_device *dev;
struct sja1000_priv *priv; struct sja1000_priv *priv;
struct resource res; struct resource res;
const u32 *prop; u32 prop;
int err, irq, res_size, prop_size; int err, irq, res_size;
void __iomem *base; void __iomem *base;
err = of_address_to_resource(np, 0, &res); err = of_address_to_resource(np, 0, &res);
...@@ -138,27 +138,27 @@ static int sja1000_ofp_probe(struct platform_device *ofdev) ...@@ -138,27 +138,27 @@ static int sja1000_ofp_probe(struct platform_device *ofdev)
priv->read_reg = sja1000_ofp_read_reg; priv->read_reg = sja1000_ofp_read_reg;
priv->write_reg = sja1000_ofp_write_reg; priv->write_reg = sja1000_ofp_write_reg;
prop = of_get_property(np, "nxp,external-clock-frequency", &prop_size); err = of_property_read_u32(np, "nxp,external-clock-frequency", &prop);
if (prop && (prop_size == sizeof(u32))) if (!err)
priv->can.clock.freq = *prop / 2; priv->can.clock.freq = prop / 2;
else else
priv->can.clock.freq = SJA1000_OFP_CAN_CLOCK; /* default */ priv->can.clock.freq = SJA1000_OFP_CAN_CLOCK; /* default */
prop = of_get_property(np, "nxp,tx-output-mode", &prop_size); err = of_property_read_u32(np, "nxp,tx-output-mode", &prop);
if (prop && (prop_size == sizeof(u32))) if (!err)
priv->ocr |= *prop & OCR_MODE_MASK; priv->ocr |= prop & OCR_MODE_MASK;
else else
priv->ocr |= OCR_MODE_NORMAL; /* default */ priv->ocr |= OCR_MODE_NORMAL; /* default */
prop = of_get_property(np, "nxp,tx-output-config", &prop_size); err = of_property_read_u32(np, "nxp,tx-output-config", &prop);
if (prop && (prop_size == sizeof(u32))) if (!err)
priv->ocr |= (*prop << OCR_TX_SHIFT) & OCR_TX_MASK; priv->ocr |= (prop << OCR_TX_SHIFT) & OCR_TX_MASK;
else else
priv->ocr |= OCR_TX0_PULLDOWN; /* default */ priv->ocr |= OCR_TX0_PULLDOWN; /* default */
prop = of_get_property(np, "nxp,clock-out-frequency", &prop_size); err = of_property_read_u32(np, "nxp,clock-out-frequency", &prop);
if (prop && (prop_size == sizeof(u32)) && *prop) { if (!err && prop) {
u32 divider = priv->can.clock.freq * 2 / *prop; u32 divider = priv->can.clock.freq * 2 / prop;
if (divider > 1) if (divider > 1)
priv->cdr |= divider / 2 - 1; priv->cdr |= divider / 2 - 1;
...@@ -168,8 +168,7 @@ static int sja1000_ofp_probe(struct platform_device *ofdev) ...@@ -168,8 +168,7 @@ static int sja1000_ofp_probe(struct platform_device *ofdev)
priv->cdr |= CDR_CLK_OFF; /* default */ priv->cdr |= CDR_CLK_OFF; /* default */
} }
prop = of_get_property(np, "nxp,no-comparator-bypass", NULL); if (!of_property_read_bool(np, "nxp,no-comparator-bypass"))
if (!prop)
priv->cdr |= CDR_CBP; /* default */ priv->cdr |= CDR_CBP; /* default */
priv->irq_flags = IRQF_SHARED; priv->irq_flags = IRQF_SHARED;
......
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