cbde5edc02683ee73486fa8448109e8b4af0d9f0
[openwrt/openwrt.git] / target / linux / samsung / patches-4.14 / 002-dm9000-clk.patch
1 --- a/drivers/net/ethernet/davicom/dm9000.c
2 +++ b/drivers/net/ethernet/davicom/dm9000.c
3 @@ -39,6 +39,7 @@
4 #include <linux/regulator/consumer.h>
5 #include <linux/gpio.h>
6 #include <linux/of_gpio.h>
7 +#include <linux/clk.h>
8
9 #include <asm/delay.h>
10 #include <asm/irq.h>
11 @@ -1438,6 +1439,7 @@ dm9000_probe(struct platform_device *pde
12 enum of_gpio_flags flags;
13 struct regulator *power;
14 bool inv_mac_addr = false;
15 + const char *clk_name;
16
17 power = devm_regulator_get(dev, "vcc");
18 if (IS_ERR(power)) {
19 @@ -1579,6 +1581,18 @@ dm9000_probe(struct platform_device *pde
20 goto out;
21 }
22
23 + /* Enable clock if specified */
24 + if (!of_property_read_string(dev->of_node, "clock-names", &clk_name)) {
25 + struct clk *clk = devm_clk_get(dev, clk_name);
26 + if (IS_ERR(clk)) {
27 + dev_err(dev, "cannot get clock of %s\n", clk_name);
28 + ret = PTR_ERR(clk);
29 + goto out;
30 + }
31 + clk_prepare_enable(clk);
32 + dev_info(dev, "enable clock '%s'\n", clk_name);
33 + }
34 +
35 /* fill in parameters for net-dev structure */
36 ndev->base_addr = (unsigned long)db->io_addr;
37