Commit 54f0e9ba authored by David S. Miller's avatar David S. Miller

Merge branch 'for-davem' of git://gitorious.org/linux-can/linux-can-next

Marc Kleine-Budde says:

====================
the fifth pull request for upcoming v3.6 net-next cleans up and
improves the janz-ican3 driver (6 patches by Ira W. Snyder, one by me).
A patch by Steffen Trumtrar adds imx53 support to the flexcan driver.
And another patch by me, which marks the bit timing constant in the CAN
drivers as "const".
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 90b90f60 3b5c6b9e
...@@ -170,7 +170,7 @@ static const struct at91_devtype_data at91_devtype_data[] __devinitconst = { ...@@ -170,7 +170,7 @@ static const struct at91_devtype_data at91_devtype_data[] __devinitconst = {
}, },
}; };
static struct can_bittiming_const at91_bittiming_const = { static const struct can_bittiming_const at91_bittiming_const = {
.name = KBUILD_MODNAME, .name = KBUILD_MODNAME,
.tseg1_min = 4, .tseg1_min = 4,
.tseg1_max = 16, .tseg1_max = 16,
......
...@@ -44,7 +44,7 @@ struct bfin_can_priv { ...@@ -44,7 +44,7 @@ struct bfin_can_priv {
/* /*
* bfin can timing parameters * bfin can timing parameters
*/ */
static struct can_bittiming_const bfin_can_bittiming_const = { static const struct can_bittiming_const bfin_can_bittiming_const = {
.name = DRV_NAME, .name = DRV_NAME,
.tseg1_min = 1, .tseg1_min = 1,
.tseg1_max = 16, .tseg1_max = 16,
......
...@@ -189,7 +189,7 @@ enum c_can_bus_error_types { ...@@ -189,7 +189,7 @@ enum c_can_bus_error_types {
C_CAN_ERROR_PASSIVE, C_CAN_ERROR_PASSIVE,
}; };
static struct can_bittiming_const c_can_bittiming_const = { static const struct can_bittiming_const c_can_bittiming_const = {
.name = KBUILD_MODNAME, .name = KBUILD_MODNAME,
.tseg1_min = 2, /* Time segment 1 = prop_seg + phase_seg1 */ .tseg1_min = 2, /* Time segment 1 = prop_seg + phase_seg1 */
.tseg1_max = 16, .tseg1_max = 16,
......
...@@ -90,7 +90,7 @@ static unsigned char cc770_obj_flags[CC770_OBJ_MAX] = { ...@@ -90,7 +90,7 @@ static unsigned char cc770_obj_flags[CC770_OBJ_MAX] = {
[CC770_OBJ_TX] = 0, [CC770_OBJ_TX] = 0,
}; };
static struct can_bittiming_const cc770_bittiming_const = { static const struct can_bittiming_const cc770_bittiming_const = {
.name = KBUILD_MODNAME, .name = KBUILD_MODNAME,
.tseg1_min = 1, .tseg1_min = 1,
.tseg1_max = 16, .tseg1_max = 16,
......
...@@ -190,7 +190,8 @@ struct flexcan_priv { ...@@ -190,7 +190,8 @@ struct flexcan_priv {
u32 reg_esr; u32 reg_esr;
u32 reg_ctrl_default; u32 reg_ctrl_default;
struct clk *clk; struct clk *clk_ipg;
struct clk *clk_per;
struct flexcan_platform_data *pdata; struct flexcan_platform_data *pdata;
const struct flexcan_devtype_data *devtype_data; const struct flexcan_devtype_data *devtype_data;
}; };
...@@ -203,7 +204,7 @@ static struct flexcan_devtype_data fsl_imx6q_devtype_data = { ...@@ -203,7 +204,7 @@ static struct flexcan_devtype_data fsl_imx6q_devtype_data = {
.hw_ver = 10, .hw_ver = 10,
}; };
static struct can_bittiming_const flexcan_bittiming_const = { static const struct can_bittiming_const flexcan_bittiming_const = {
.name = DRV_NAME, .name = DRV_NAME,
.tseg1_min = 4, .tseg1_min = 4,
.tseg1_max = 16, .tseg1_max = 16,
...@@ -828,7 +829,8 @@ static int flexcan_open(struct net_device *dev) ...@@ -828,7 +829,8 @@ static int flexcan_open(struct net_device *dev)
struct flexcan_priv *priv = netdev_priv(dev); struct flexcan_priv *priv = netdev_priv(dev);
int err; int err;
clk_prepare_enable(priv->clk); clk_prepare_enable(priv->clk_ipg);
clk_prepare_enable(priv->clk_per);
err = open_candev(dev); err = open_candev(dev);
if (err) if (err)
...@@ -850,7 +852,8 @@ static int flexcan_open(struct net_device *dev) ...@@ -850,7 +852,8 @@ static int flexcan_open(struct net_device *dev)
out_close: out_close:
close_candev(dev); close_candev(dev);
out: out:
clk_disable_unprepare(priv->clk); clk_disable_unprepare(priv->clk_per);
clk_disable_unprepare(priv->clk_ipg);
return err; return err;
} }
...@@ -864,7 +867,8 @@ static int flexcan_close(struct net_device *dev) ...@@ -864,7 +867,8 @@ static int flexcan_close(struct net_device *dev)
flexcan_chip_stop(dev); flexcan_chip_stop(dev);
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
clk_disable_unprepare(priv->clk); clk_disable_unprepare(priv->clk_per);
clk_disable_unprepare(priv->clk_ipg);
close_candev(dev); close_candev(dev);
...@@ -903,7 +907,8 @@ static int __devinit register_flexcandev(struct net_device *dev) ...@@ -903,7 +907,8 @@ static int __devinit register_flexcandev(struct net_device *dev)
struct flexcan_regs __iomem *regs = priv->base; struct flexcan_regs __iomem *regs = priv->base;
u32 reg, err; u32 reg, err;
clk_prepare_enable(priv->clk); clk_prepare_enable(priv->clk_ipg);
clk_prepare_enable(priv->clk_per);
/* select "bus clock", chip must be disabled */ /* select "bus clock", chip must be disabled */
flexcan_chip_disable(priv); flexcan_chip_disable(priv);
...@@ -936,7 +941,8 @@ static int __devinit register_flexcandev(struct net_device *dev) ...@@ -936,7 +941,8 @@ static int __devinit register_flexcandev(struct net_device *dev)
out: out:
/* disable core and turn off clocks */ /* disable core and turn off clocks */
flexcan_chip_disable(priv); flexcan_chip_disable(priv);
clk_disable_unprepare(priv->clk); clk_disable_unprepare(priv->clk_per);
clk_disable_unprepare(priv->clk_ipg);
return err; return err;
} }
...@@ -964,7 +970,7 @@ static int __devinit flexcan_probe(struct platform_device *pdev) ...@@ -964,7 +970,7 @@ static int __devinit flexcan_probe(struct platform_device *pdev)
struct net_device *dev; struct net_device *dev;
struct flexcan_priv *priv; struct flexcan_priv *priv;
struct resource *mem; struct resource *mem;
struct clk *clk = NULL; struct clk *clk_ipg = NULL, *clk_per = NULL;
struct pinctrl *pinctrl; struct pinctrl *pinctrl;
void __iomem *base; void __iomem *base;
resource_size_t mem_size; resource_size_t mem_size;
...@@ -980,13 +986,20 @@ static int __devinit flexcan_probe(struct platform_device *pdev) ...@@ -980,13 +986,20 @@ static int __devinit flexcan_probe(struct platform_device *pdev)
"clock-frequency", &clock_freq); "clock-frequency", &clock_freq);
if (!clock_freq) { if (!clock_freq) {
clk = clk_get(&pdev->dev, NULL); clk_ipg = devm_clk_get(&pdev->dev, "ipg");
if (IS_ERR(clk)) { if (IS_ERR(clk_ipg)) {
dev_err(&pdev->dev, "no clock defined\n"); dev_err(&pdev->dev, "no ipg clock defined\n");
err = PTR_ERR(clk); err = PTR_ERR(clk_ipg);
goto failed_clock;
}
clock_freq = clk_get_rate(clk_ipg);
clk_per = devm_clk_get(&pdev->dev, "per");
if (IS_ERR(clk_per)) {
dev_err(&pdev->dev, "no per clock defined\n");
err = PTR_ERR(clk_per);
goto failed_clock; goto failed_clock;
} }
clock_freq = clk_get_rate(clk);
} }
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
...@@ -1039,7 +1052,8 @@ static int __devinit flexcan_probe(struct platform_device *pdev) ...@@ -1039,7 +1052,8 @@ static int __devinit flexcan_probe(struct platform_device *pdev)
CAN_CTRLMODE_BERR_REPORTING; CAN_CTRLMODE_BERR_REPORTING;
priv->base = base; priv->base = base;
priv->dev = dev; priv->dev = dev;
priv->clk = clk; priv->clk_ipg = clk_ipg;
priv->clk_per = clk_per;
priv->pdata = pdev->dev.platform_data; priv->pdata = pdev->dev.platform_data;
priv->devtype_data = devtype_data; priv->devtype_data = devtype_data;
...@@ -1067,8 +1081,6 @@ static int __devinit flexcan_probe(struct platform_device *pdev) ...@@ -1067,8 +1081,6 @@ static int __devinit flexcan_probe(struct platform_device *pdev)
failed_map: failed_map:
release_mem_region(mem->start, mem_size); release_mem_region(mem->start, mem_size);
failed_get: failed_get:
if (clk)
clk_put(clk);
failed_clock: failed_clock:
return err; return err;
} }
...@@ -1086,9 +1098,6 @@ static int __devexit flexcan_remove(struct platform_device *pdev) ...@@ -1086,9 +1098,6 @@ static int __devexit flexcan_remove(struct platform_device *pdev)
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
release_mem_region(mem->start, resource_size(mem)); release_mem_region(mem->start, resource_size(mem));
if (priv->clk)
clk_put(priv->clk);
free_candev(dev); free_candev(dev);
return 0; return 0;
......
This diff is collapsed.
...@@ -214,7 +214,7 @@ static int mcp251x_enable_dma; /* Enable SPI DMA. Default: 0 (Off) */ ...@@ -214,7 +214,7 @@ static int mcp251x_enable_dma; /* Enable SPI DMA. Default: 0 (Off) */
module_param(mcp251x_enable_dma, int, S_IRUGO); module_param(mcp251x_enable_dma, int, S_IRUGO);
MODULE_PARM_DESC(mcp251x_enable_dma, "Enable SPI DMA. Default: 0 (Off)"); MODULE_PARM_DESC(mcp251x_enable_dma, "Enable SPI DMA. Default: 0 (Off)");
static struct can_bittiming_const mcp251x_bittiming_const = { static const struct can_bittiming_const mcp251x_bittiming_const = {
.name = DEVICE_NAME, .name = DEVICE_NAME,
.tseg1_min = 3, .tseg1_min = 3,
.tseg1_max = 16, .tseg1_max = 16,
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include "mscan.h" #include "mscan.h"
static struct can_bittiming_const mscan_bittiming_const = { static const struct can_bittiming_const mscan_bittiming_const = {
.name = "mscan", .name = "mscan",
.tseg1_min = 4, .tseg1_min = 4,
.tseg1_max = 16, .tseg1_max = 16,
......
...@@ -184,7 +184,7 @@ struct pch_can_priv { ...@@ -184,7 +184,7 @@ struct pch_can_priv {
int use_msi; int use_msi;
}; };
static struct can_bittiming_const pch_can_bittiming_const = { static const struct can_bittiming_const pch_can_bittiming_const = {
.name = KBUILD_MODNAME, .name = KBUILD_MODNAME,
.tseg1_min = 2, .tseg1_min = 2,
.tseg1_max = 16, .tseg1_max = 16,
......
...@@ -69,7 +69,7 @@ MODULE_AUTHOR("Oliver Hartkopp <oliver.hartkopp@volkswagen.de>"); ...@@ -69,7 +69,7 @@ MODULE_AUTHOR("Oliver Hartkopp <oliver.hartkopp@volkswagen.de>");
MODULE_LICENSE("Dual BSD/GPL"); MODULE_LICENSE("Dual BSD/GPL");
MODULE_DESCRIPTION(DRV_NAME "CAN netdevice driver"); MODULE_DESCRIPTION(DRV_NAME "CAN netdevice driver");
static struct can_bittiming_const sja1000_bittiming_const = { static const struct can_bittiming_const sja1000_bittiming_const = {
.name = DRV_NAME, .name = DRV_NAME,
.tseg1_min = 1, .tseg1_min = 1,
.tseg1_max = 16, .tseg1_max = 16,
......
...@@ -196,7 +196,7 @@ MODULE_VERSION(HECC_MODULE_VERSION); ...@@ -196,7 +196,7 @@ MODULE_VERSION(HECC_MODULE_VERSION);
#define HECC_CANGIM_SIL BIT(2) /* system interrupts to int line 1 */ #define HECC_CANGIM_SIL BIT(2) /* system interrupts to int line 1 */
/* CAN Bittiming constants as per HECC specs */ /* CAN Bittiming constants as per HECC specs */
static struct can_bittiming_const ti_hecc_bittiming_const = { static const struct can_bittiming_const ti_hecc_bittiming_const = {
.name = DRV_NAME, .name = DRV_NAME,
.tseg1_min = 1, .tseg1_min = 1,
.tseg1_max = 16, .tseg1_max = 16,
......
...@@ -889,7 +889,7 @@ static const struct net_device_ops ems_usb_netdev_ops = { ...@@ -889,7 +889,7 @@ static const struct net_device_ops ems_usb_netdev_ops = {
.ndo_start_xmit = ems_usb_start_xmit, .ndo_start_xmit = ems_usb_start_xmit,
}; };
static struct can_bittiming_const ems_usb_bittiming_const = { static const struct can_bittiming_const ems_usb_bittiming_const = {
.name = "ems_usb", .name = "ems_usb",
.tseg1_min = 1, .tseg1_min = 1,
.tseg1_max = 16, .tseg1_max = 16,
......
...@@ -871,7 +871,7 @@ static const struct net_device_ops esd_usb2_netdev_ops = { ...@@ -871,7 +871,7 @@ static const struct net_device_ops esd_usb2_netdev_ops = {
.ndo_start_xmit = esd_usb2_start_xmit, .ndo_start_xmit = esd_usb2_start_xmit,
}; };
static struct can_bittiming_const esd_usb2_bittiming_const = { static const struct can_bittiming_const esd_usb2_bittiming_const = {
.name = "esd_usb2", .name = "esd_usb2",
.tseg1_min = ESD_USB2_TSEG1_MIN, .tseg1_min = ESD_USB2_TSEG1_MIN,
.tseg1_max = ESD_USB2_TSEG1_MAX, .tseg1_max = ESD_USB2_TSEG1_MAX,
......
...@@ -45,7 +45,7 @@ struct peak_usb_adapter { ...@@ -45,7 +45,7 @@ struct peak_usb_adapter {
char *name; char *name;
u32 device_id; u32 device_id;
struct can_clock clock; struct can_clock clock;
struct can_bittiming_const bittiming_const; const struct can_bittiming_const bittiming_const;
unsigned int ctrl_count; unsigned int ctrl_count;
int (*intf_probe)(struct usb_interface *intf); int (*intf_probe)(struct usb_interface *intf);
......
...@@ -33,7 +33,7 @@ struct can_priv { ...@@ -33,7 +33,7 @@ struct can_priv {
struct can_device_stats can_stats; struct can_device_stats can_stats;
struct can_bittiming bittiming; struct can_bittiming bittiming;
struct can_bittiming_const *bittiming_const; const struct can_bittiming_const *bittiming_const;
struct can_clock clock; struct can_clock clock;
enum can_state state; enum can_state state;
......
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