Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 370147
b: refs/heads/master
c: b6c2301
h: refs/heads/master
i:
  370145: 25c9ec7
  370143: d17979c
v: v3
  • Loading branch information
Lee Jones authored and Linus Walleij committed Mar 1, 2013
1 parent a1bb81b commit 611763a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1e6b6801405ec578c8607e9dabcc4e946ea64f4c
refs/heads/master: b6c230196f07b9cdd23ceb899070076cdab0c467
29 changes: 28 additions & 1 deletion trunk/drivers/net/ethernet/smsc/smsc911x.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/crc32.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/etherdevice.h>
Expand Down Expand Up @@ -144,6 +145,9 @@ struct smsc911x_data {

/* regulators */
struct regulator_bulk_data supplies[SMSC911X_NUM_SUPPLIES];

/* clock */
struct clk *clk;
};

/* Easy access to information */
Expand Down Expand Up @@ -369,7 +373,7 @@ smsc911x_rx_readfifo_shift(struct smsc911x_data *pdata, unsigned int *buf,
}

/*
* enable resources, currently just regulators.
* enable regulator and clock resources.
*/
static int smsc911x_enable_resources(struct platform_device *pdev)
{
Expand All @@ -382,6 +386,13 @@ static int smsc911x_enable_resources(struct platform_device *pdev)
if (ret)
netdev_err(ndev, "failed to enable regulators %d\n",
ret);

if (!IS_ERR(pdata->clk)) {
ret = clk_prepare_enable(pdata->clk);
if (ret < 0)
netdev_err(ndev, "failed to enable clock %d\n", ret);
}

return ret;
}

Expand All @@ -396,6 +407,10 @@ static int smsc911x_disable_resources(struct platform_device *pdev)

ret = regulator_bulk_disable(ARRAY_SIZE(pdata->supplies),
pdata->supplies);

if (!IS_ERR(pdata->clk))
clk_disable_unprepare(pdata->clk);

return ret;
}

Expand All @@ -421,6 +436,12 @@ static int smsc911x_request_resources(struct platform_device *pdev)
if (ret)
netdev_err(ndev, "couldn't get regulators %d\n",
ret);

/* Request clock */
pdata->clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(pdata->clk))
netdev_warn(ndev, "couldn't get clock %li\n", PTR_ERR(pdata->clk));

return ret;
}

Expand All @@ -436,6 +457,12 @@ static void smsc911x_free_resources(struct platform_device *pdev)
/* Free regulators */
regulator_bulk_free(ARRAY_SIZE(pdata->supplies),
pdata->supplies);

/* Free clock */
if (!IS_ERR(pdata->clk)) {
clk_put(pdata->clk);
pdata->clk = NULL;
}
}

/* waits for MAC not busy, with timeout. Only called by smsc911x_mac_read
Expand Down

0 comments on commit 611763a

Please sign in to comment.