Skip to content

Commit

Permalink
Merge branch 'for-davem' of git://gitorious.org/linux-can/linux-can-next
Browse files Browse the repository at this point in the history
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: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Jul 20, 2012
2 parents 90b90f6 + 3b5c6b9 commit 54f0e9b
Show file tree
Hide file tree
Showing 15 changed files with 226 additions and 88 deletions.
2 changes: 1 addition & 1 deletion drivers/net/can/at91_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
.tseg1_min = 4,
.tseg1_max = 16,
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/can/bfin_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct bfin_can_priv {
/*
* 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,
.tseg1_min = 1,
.tseg1_max = 16,
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/can/c_can/c_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ enum c_can_bus_error_types {
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,
.tseg1_min = 2, /* Time segment 1 = prop_seg + phase_seg1 */
.tseg1_max = 16,
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/can/cc770/cc770.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static unsigned char cc770_obj_flags[CC770_OBJ_MAX] = {
[CC770_OBJ_TX] = 0,
};

static struct can_bittiming_const cc770_bittiming_const = {
static const struct can_bittiming_const cc770_bittiming_const = {
.name = KBUILD_MODNAME,
.tseg1_min = 1,
.tseg1_max = 16,
Expand Down
47 changes: 28 additions & 19 deletions drivers/net/can/flexcan.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ struct flexcan_priv {
u32 reg_esr;
u32 reg_ctrl_default;

struct clk *clk;
struct clk *clk_ipg;
struct clk *clk_per;
struct flexcan_platform_data *pdata;
const struct flexcan_devtype_data *devtype_data;
};
Expand All @@ -203,7 +204,7 @@ static struct flexcan_devtype_data fsl_imx6q_devtype_data = {
.hw_ver = 10,
};

static struct can_bittiming_const flexcan_bittiming_const = {
static const struct can_bittiming_const flexcan_bittiming_const = {
.name = DRV_NAME,
.tseg1_min = 4,
.tseg1_max = 16,
Expand Down Expand Up @@ -828,7 +829,8 @@ static int flexcan_open(struct net_device *dev)
struct flexcan_priv *priv = netdev_priv(dev);
int err;

clk_prepare_enable(priv->clk);
clk_prepare_enable(priv->clk_ipg);
clk_prepare_enable(priv->clk_per);

err = open_candev(dev);
if (err)
Expand All @@ -850,7 +852,8 @@ static int flexcan_open(struct net_device *dev)
out_close:
close_candev(dev);
out:
clk_disable_unprepare(priv->clk);
clk_disable_unprepare(priv->clk_per);
clk_disable_unprepare(priv->clk_ipg);

return err;
}
Expand All @@ -864,7 +867,8 @@ static int flexcan_close(struct net_device *dev)
flexcan_chip_stop(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);

Expand Down Expand Up @@ -903,7 +907,8 @@ static int __devinit register_flexcandev(struct net_device *dev)
struct flexcan_regs __iomem *regs = priv->base;
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 */
flexcan_chip_disable(priv);
Expand Down Expand Up @@ -936,7 +941,8 @@ static int __devinit register_flexcandev(struct net_device *dev)
out:
/* disable core and turn off clocks */
flexcan_chip_disable(priv);
clk_disable_unprepare(priv->clk);
clk_disable_unprepare(priv->clk_per);
clk_disable_unprepare(priv->clk_ipg);

return err;
}
Expand Down Expand Up @@ -964,7 +970,7 @@ static int __devinit flexcan_probe(struct platform_device *pdev)
struct net_device *dev;
struct flexcan_priv *priv;
struct resource *mem;
struct clk *clk = NULL;
struct clk *clk_ipg = NULL, *clk_per = NULL;
struct pinctrl *pinctrl;
void __iomem *base;
resource_size_t mem_size;
Expand All @@ -980,13 +986,20 @@ static int __devinit flexcan_probe(struct platform_device *pdev)
"clock-frequency", &clock_freq);

if (!clock_freq) {
clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(clk)) {
dev_err(&pdev->dev, "no clock defined\n");
err = PTR_ERR(clk);
clk_ipg = devm_clk_get(&pdev->dev, "ipg");
if (IS_ERR(clk_ipg)) {
dev_err(&pdev->dev, "no ipg clock defined\n");
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;
}
clock_freq = clk_get_rate(clk);
}

mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
Expand Down Expand Up @@ -1039,7 +1052,8 @@ static int __devinit flexcan_probe(struct platform_device *pdev)
CAN_CTRLMODE_BERR_REPORTING;
priv->base = base;
priv->dev = dev;
priv->clk = clk;
priv->clk_ipg = clk_ipg;
priv->clk_per = clk_per;
priv->pdata = pdev->dev.platform_data;
priv->devtype_data = devtype_data;

Expand Down Expand Up @@ -1067,8 +1081,6 @@ static int __devinit flexcan_probe(struct platform_device *pdev)
failed_map:
release_mem_region(mem->start, mem_size);
failed_get:
if (clk)
clk_put(clk);
failed_clock:
return err;
}
Expand All @@ -1086,9 +1098,6 @@ static int __devexit flexcan_remove(struct platform_device *pdev)
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
release_mem_region(mem->start, resource_size(mem));

if (priv->clk)
clk_put(priv->clk);

free_candev(dev);

return 0;
Expand Down
Loading

0 comments on commit 54f0e9b

Please sign in to comment.