summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2013-03-15 22:17:17 +0100
committerArnd Bergmann <arnd@arndb.de>2013-03-15 22:17:17 +0100
commit831bbbeb2b0341a82a464896be49493c104d78f0 (patch)
tree7b4f593eb1d481a82b59f2c2a804e6c2632b32f0 /drivers/net/ethernet
parentf6161aa153581da4a3867a2d1a7caf4be19b6ec9 (diff)
parent924e82dacab9a0b2ea661c57c98112569267f0db (diff)
downloadop-kernel-dev-831bbbeb2b0341a82a464896be49493c104d78f0.zip
op-kernel-dev-831bbbeb2b0341a82a464896be49493c104d78f0.tar.gz
Merge tag 'ux500-dt-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson into next/fixes-non-critical
From Linus Walleij <linus.walleij@linaro.org>: Ux500 Device Tree fixes All are necessary to make a proper DT boot on the v3.9 series: - IRQ edges. - Register defines. - FSMC clock. - Ethernet clk fixup (one patch to drivers/net ACKed by David Miller) - Proper IOS and regulator voltages for MMCI. - AB8500 GPIOs restored after they were fixed in the v3.9 merge window from the pinctrl tree. - There is also a minor cleanup in the platform code, but it is strongly connected to the other patches. * tag 'ux500-dt-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson: ARM: ux500: allow Snowball access to the AB8500 GPIO pins ARM: ux500: enable AB8500 GPIO for HREF ARM: ux500: Remove traces of the ios_handler from platform code ARM: ux500: Use the GPIO regulator framework for SDI0's 'en' and 'vsel' ARM: ux500: Setup correct settling time for the MMCI regulator ARM: ux500: Use the correct name when supplying a GPIO enable pin ARM: ux500: Specify which IOS regulator to use for MMCI ARM: ux500: Specify the ux5x0 MMCI regulator's on/off GPIO as high-enable ARM: ux500: Set correct MMCI regulator voltages in the ux5x0 Device Tree mmc: mmci: Move ios_handler functionality into the driver net/smsc911x: Provide common clock functionality clk: ux500: Provide an alias for the SMSC911x Ethernet chip clk: ux500: Ensure the FMSC clock is obtainable ARM: ux500: Provide a means to obtain the SMSC9115 clock when DT is enabled ARM: ux500: Include the PRCMU's Secure Registers in DB8500's DT ARM: ux500: Change IRQ from low-to-high edge triggered to high-to-low Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/smsc/smsc911x.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index da5cc9a..df77df1 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -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>
@@ -144,6 +145,9 @@ struct smsc911x_data {
/* regulators */
struct regulator_bulk_data supplies[SMSC911X_NUM_SUPPLIES];
+
+ /* clock */
+ struct clk *clk;
};
/* Easy access to information */
@@ -369,7 +373,7 @@ out:
}
/*
- * enable resources, currently just regulators.
+ * enable regulator and clock resources.
*/
static int smsc911x_enable_resources(struct platform_device *pdev)
{
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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
OpenPOWER on IntegriCloud