aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-01-30 20:07:18 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-30 20:07:18 -0500
commit4bcec913d0a98d991c750034a04675443d1f10b5 (patch)
treece2e960ba26d50f09b6a7bd864b2b4d3c275e69b /drivers
parent03c7287dd22c18815964219c9a2e75054cd004df (diff)
parentf878f84373aefda7f041a74b24a83b8b7dec1cf0 (diff)
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
Pull more powerpc bits from Ben Herrenschmidt: "Here are a few more powerpc bits for this merge window. The bulk is made of two pull requests from Scott and Anatolij that I had missed previously (they arrived while I was away). Since both their branches are in -next independently, and the content has been around for a little while, they can still go in. The rest is mostly bug and regression fixes, a small series of cleanups to our pseries cpuidle code (including moving it to the right place), and one new cpuidle bakend for the powernv platform. I also wired up the new sched_attr syscalls" * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (37 commits) powerpc: Wire up sched_setattr and sched_getattr syscalls powerpc/hugetlb: Replace __get_cpu_var with get_cpu_var powerpc: Make sure "cache" directory is removed when offlining cpu powerpc/mm: Fix mmap errno when MAP_FIXED is set and mapping exceeds the allowed address space powerpc/powernv/cpuidle: Back-end cpuidle driver for powernv platform. powerpc/pseries/cpuidle: smt-snooze-delay cleanup. powerpc/pseries/cpuidle: Remove MAX_IDLE_STATE macro. powerpc/pseries/cpuidle: Make cpuidle-pseries backend driver a non-module. powerpc/pseries/cpuidle: Use cpuidle_register() for initialisation. powerpc/pseries/cpuidle: Move processor_idle.c to drivers/cpuidle. powerpc: Fix 32-bit frames for signals delivered when transactional powerpc/iommu: Fix initialisation of DART iommu table powerpc/numa: Fix decimal permissions powerpc/mm: Fix compile error of pgtable-ppc64.h powerpc: Fix hw breakpoints on !HAVE_HW_BREAKPOINT configurations clk: corenet: Adds the clock binding powerpc/booke64: Guard e6500 tlb handler with CONFIG_PPC_FSL_BOOK3E powerpc/512x: dts: add MPC5125 clock specs powerpc/512x: clk: support MPC5121/5123/5125 SoC variants powerpc/512x: clk: enforce even SDHC divider values ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/cpuidle/Kconfig5
-rw-r--r--drivers/cpuidle/Kconfig.powerpc20
-rw-r--r--drivers/cpuidle/Makefile5
-rw-r--r--drivers/cpuidle/cpuidle-powernv.c169
-rw-r--r--drivers/cpuidle/cpuidle-pseries.c267
-rw-r--r--drivers/media/platform/fsl-viu.c2
-rw-r--r--drivers/mtd/nand/mpc5121_nfc.c2
-rw-r--r--drivers/net/can/mscan/mpc5xxx_can.c270
-rw-r--r--drivers/spi/spi-mpc512x-psc.c26
-rw-r--r--drivers/tty/serial/mpc52xx_uart.c90
-rw-r--r--drivers/usb/host/fsl-mph-dr-of.c13
11 files changed, 720 insertions, 149 deletions
diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig
index b3fb81d7cf04..f04e25f6c98d 100644
--- a/drivers/cpuidle/Kconfig
+++ b/drivers/cpuidle/Kconfig
@@ -35,6 +35,11 @@ depends on ARM
35source "drivers/cpuidle/Kconfig.arm" 35source "drivers/cpuidle/Kconfig.arm"
36endmenu 36endmenu
37 37
38menu "POWERPC CPU Idle Drivers"
39depends on PPC
40source "drivers/cpuidle/Kconfig.powerpc"
41endmenu
42
38endif 43endif
39 44
40config ARCH_NEEDS_CPU_IDLE_COUPLED 45config ARCH_NEEDS_CPU_IDLE_COUPLED
diff --git a/drivers/cpuidle/Kconfig.powerpc b/drivers/cpuidle/Kconfig.powerpc
new file mode 100644
index 000000000000..66c3a09574e9
--- /dev/null
+++ b/drivers/cpuidle/Kconfig.powerpc
@@ -0,0 +1,20 @@
1#
2# POWERPC CPU Idle Drivers
3#
4config PSERIES_CPUIDLE
5 bool "Cpuidle driver for pSeries platforms"
6 depends on CPU_IDLE
7 depends on PPC_PSERIES
8 default y
9 help
10 Select this option to enable processor idle state management
11 through cpuidle subsystem.
12
13config POWERNV_CPUIDLE
14 bool "Cpuidle driver for powernv platforms"
15 depends on CPU_IDLE
16 depends on PPC_POWERNV
17 default y
18 help
19 Select this option to enable processor idle state management
20 through cpuidle subsystem.
diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
index 527be28e5c1e..f71ae1b373c5 100644
--- a/drivers/cpuidle/Makefile
+++ b/drivers/cpuidle/Makefile
@@ -13,3 +13,8 @@ obj-$(CONFIG_ARM_KIRKWOOD_CPUIDLE) += cpuidle-kirkwood.o
13obj-$(CONFIG_ARM_ZYNQ_CPUIDLE) += cpuidle-zynq.o 13obj-$(CONFIG_ARM_ZYNQ_CPUIDLE) += cpuidle-zynq.o
14obj-$(CONFIG_ARM_U8500_CPUIDLE) += cpuidle-ux500.o 14obj-$(CONFIG_ARM_U8500_CPUIDLE) += cpuidle-ux500.o
15obj-$(CONFIG_ARM_AT91_CPUIDLE) += cpuidle-at91.o 15obj-$(CONFIG_ARM_AT91_CPUIDLE) += cpuidle-at91.o
16
17###############################################################################
18# POWERPC drivers
19obj-$(CONFIG_PSERIES_CPUIDLE) += cpuidle-pseries.o
20obj-$(CONFIG_POWERNV_CPUIDLE) += cpuidle-powernv.o
diff --git a/drivers/cpuidle/cpuidle-powernv.c b/drivers/cpuidle/cpuidle-powernv.c
new file mode 100644
index 000000000000..78fd174c57e8
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-powernv.c
@@ -0,0 +1,169 @@
1/*
2 * cpuidle-powernv - idle state cpuidle driver.
3 * Adapted from drivers/cpuidle/cpuidle-pseries
4 *
5 */
6
7#include <linux/kernel.h>
8#include <linux/module.h>
9#include <linux/init.h>
10#include <linux/moduleparam.h>
11#include <linux/cpuidle.h>
12#include <linux/cpu.h>
13#include <linux/notifier.h>
14
15#include <asm/machdep.h>
16#include <asm/firmware.h>
17
18struct cpuidle_driver powernv_idle_driver = {
19 .name = "powernv_idle",
20 .owner = THIS_MODULE,
21};
22
23static int max_idle_state;
24static struct cpuidle_state *cpuidle_state_table;
25
26static int snooze_loop(struct cpuidle_device *dev,
27 struct cpuidle_driver *drv,
28 int index)
29{
30 local_irq_enable();
31 set_thread_flag(TIF_POLLING_NRFLAG);
32
33 while (!need_resched()) {
34 HMT_low();
35 HMT_very_low();
36 }
37
38 HMT_medium();
39 clear_thread_flag(TIF_POLLING_NRFLAG);
40 smp_mb();
41 return index;
42}
43
44static int nap_loop(struct cpuidle_device *dev,
45 struct cpuidle_driver *drv,
46 int index)
47{
48 power7_idle();
49 return index;
50}
51
52/*
53 * States for dedicated partition case.
54 */
55static struct cpuidle_state powernv_states[] = {
56 { /* Snooze */
57 .name = "snooze",
58 .desc = "snooze",
59 .flags = CPUIDLE_FLAG_TIME_VALID,
60 .exit_latency = 0,
61 .target_residency = 0,
62 .enter = &snooze_loop },
63 { /* NAP */
64 .name = "NAP",
65 .desc = "NAP",
66 .flags = CPUIDLE_FLAG_TIME_VALID,
67 .exit_latency = 10,
68 .target_residency = 100,
69 .enter = &nap_loop },
70};
71
72static int powernv_cpuidle_add_cpu_notifier(struct notifier_block *n,
73 unsigned long action, void *hcpu)
74{
75 int hotcpu = (unsigned long)hcpu;
76 struct cpuidle_device *dev =
77 per_cpu(cpuidle_devices, hotcpu);
78
79 if (dev && cpuidle_get_driver()) {
80 switch (action) {
81 case CPU_ONLINE:
82 case CPU_ONLINE_FROZEN:
83 cpuidle_pause_and_lock();
84 cpuidle_enable_device(dev);
85 cpuidle_resume_and_unlock();
86 break;
87
88 case CPU_DEAD:
89 case CPU_DEAD_FROZEN:
90 cpuidle_pause_and_lock();
91 cpuidle_disable_device(dev);
92 cpuidle_resume_and_unlock();
93 break;
94
95 default:
96 return NOTIFY_DONE;
97 }
98 }
99 return NOTIFY_OK;
100}
101
102static struct notifier_block setup_hotplug_notifier = {
103 .notifier_call = powernv_cpuidle_add_cpu_notifier,
104};
105
106/*
107 * powernv_cpuidle_driver_init()
108 */
109static int powernv_cpuidle_driver_init(void)
110{
111 int idle_state;
112 struct cpuidle_driver *drv = &powernv_idle_driver;
113
114 drv->state_count = 0;
115
116 for (idle_state = 0; idle_state < max_idle_state; ++idle_state) {
117 /* Is the state not enabled? */
118 if (cpuidle_state_table[idle_state].enter == NULL)
119 continue;
120
121 drv->states[drv->state_count] = /* structure copy */
122 cpuidle_state_table[idle_state];
123
124 drv->state_count += 1;
125 }
126
127 return 0;
128}
129
130/*
131 * powernv_idle_probe()
132 * Choose state table for shared versus dedicated partition
133 */
134static int powernv_idle_probe(void)
135{
136
137 if (cpuidle_disable != IDLE_NO_OVERRIDE)
138 return -ENODEV;
139
140 if (firmware_has_feature(FW_FEATURE_OPALv3)) {
141 cpuidle_state_table = powernv_states;
142 max_idle_state = ARRAY_SIZE(powernv_states);
143 } else
144 return -ENODEV;
145
146 return 0;
147}
148
149static int __init powernv_processor_idle_init(void)
150{
151 int retval;
152
153 retval = powernv_idle_probe();
154 if (retval)
155 return retval;
156
157 powernv_cpuidle_driver_init();
158 retval = cpuidle_register(&powernv_idle_driver, NULL);
159 if (retval) {
160 printk(KERN_DEBUG "Registration of powernv driver failed.\n");
161 return retval;
162 }
163
164 register_cpu_notifier(&setup_hotplug_notifier);
165 printk(KERN_DEBUG "powernv_idle_driver registered\n");
166 return 0;
167}
168
169device_initcall(powernv_processor_idle_init);
diff --git a/drivers/cpuidle/cpuidle-pseries.c b/drivers/cpuidle/cpuidle-pseries.c
new file mode 100644
index 000000000000..7ab564aa0b1c
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-pseries.c
@@ -0,0 +1,267 @@
1/*
2 * cpuidle-pseries - idle state cpuidle driver.
3 * Adapted from drivers/idle/intel_idle.c and
4 * drivers/acpi/processor_idle.c
5 *
6 */
7
8#include <linux/kernel.h>
9#include <linux/module.h>
10#include <linux/init.h>
11#include <linux/moduleparam.h>
12#include <linux/cpuidle.h>
13#include <linux/cpu.h>
14#include <linux/notifier.h>
15
16#include <asm/paca.h>
17#include <asm/reg.h>
18#include <asm/machdep.h>
19#include <asm/firmware.h>
20#include <asm/plpar_wrappers.h>
21
22struct cpuidle_driver pseries_idle_driver = {
23 .name = "pseries_idle",
24 .owner = THIS_MODULE,
25};
26
27static int max_idle_state;
28static struct cpuidle_state *cpuidle_state_table;
29
30static inline void idle_loop_prolog(unsigned long *in_purr)
31{
32 *in_purr = mfspr(SPRN_PURR);
33 /*
34 * Indicate to the HV that we are idle. Now would be
35 * a good time to find other work to dispatch.
36 */
37 get_lppaca()->idle = 1;
38}
39
40static inline void idle_loop_epilog(unsigned long in_purr)
41{
42 u64 wait_cycles;
43
44 wait_cycles = be64_to_cpu(get_lppaca()->wait_state_cycles);
45 wait_cycles += mfspr(SPRN_PURR) - in_purr;
46 get_lppaca()->wait_state_cycles = cpu_to_be64(wait_cycles);
47 get_lppaca()->idle = 0;
48}
49
50static int snooze_loop(struct cpuidle_device *dev,
51 struct cpuidle_driver *drv,
52 int index)
53{
54 unsigned long in_purr;
55
56 idle_loop_prolog(&in_purr);
57 local_irq_enable();
58 set_thread_flag(TIF_POLLING_NRFLAG);
59
60 while (!need_resched()) {
61 HMT_low();
62 HMT_very_low();
63 }
64
65 HMT_medium();
66 clear_thread_flag(TIF_POLLING_NRFLAG);
67 smp_mb();
68
69 idle_loop_epilog(in_purr);
70
71 return index;
72}
73
74static void check_and_cede_processor(void)
75{
76 /*
77 * Ensure our interrupt state is properly tracked,
78 * also checks if no interrupt has occurred while we
79 * were soft-disabled
80 */
81 if (prep_irq_for_idle()) {
82 cede_processor();
83#ifdef CONFIG_TRACE_IRQFLAGS
84 /* Ensure that H_CEDE returns with IRQs on */
85 if (WARN_ON(!(mfmsr() & MSR_EE)))
86 __hard_irq_enable();
87#endif
88 }
89}
90
91static int dedicated_cede_loop(struct cpuidle_device *dev,
92 struct cpuidle_driver *drv,
93 int index)
94{
95 unsigned long in_purr;
96
97 idle_loop_prolog(&in_purr);
98 get_lppaca()->donate_dedicated_cpu = 1;
99
100 HMT_medium();
101 check_and_cede_processor();
102
103 get_lppaca()->donate_dedicated_cpu = 0;
104
105 idle_loop_epilog(in_purr);
106
107 return index;
108}
109
110static int shared_cede_loop(struct cpuidle_device *dev,
111 struct cpuidle_driver *drv,
112 int index)
113{
114 unsigned long in_purr;
115
116 idle_loop_prolog(&in_purr);
117
118 /*
119 * Yield the processor to the hypervisor. We return if
120 * an external interrupt occurs (which are driven prior
121 * to returning here) or if a prod occurs from another
122 * processor. When returning here, external interrupts
123 * are enabled.
124 */
125 check_and_cede_processor();
126
127 idle_loop_epilog(in_purr);
128
129 return index;
130}
131
132/*
133 * States for dedicated partition case.
134 */
135static struct cpuidle_state dedicated_states[] = {
136 { /* Snooze */
137 .name = "snooze",
138 .desc = "snooze",
139 .flags = CPUIDLE_FLAG_TIME_VALID,
140 .exit_latency = 0,
141 .target_residency = 0,
142 .enter = &snooze_loop },
143 { /* CEDE */
144 .name = "CEDE",
145 .desc = "CEDE",
146 .flags = CPUIDLE_FLAG_TIME_VALID,
147 .exit_latency = 10,
148 .target_residency = 100,
149 .enter = &dedicated_cede_loop },
150};
151
152/*
153 * States for shared partition case.
154 */
155static struct cpuidle_state shared_states[] = {
156 { /* Shared Cede */
157 .name = "Shared Cede",
158 .desc = "Shared Cede",
159 .flags = CPUIDLE_FLAG_TIME_VALID,
160 .exit_latency = 0,
161 .target_residency = 0,
162 .enter = &shared_cede_loop },
163};
164
165static int pseries_cpuidle_add_cpu_notifier(struct notifier_block *n,
166 unsigned long action, void *hcpu)
167{
168 int hotcpu = (unsigned long)hcpu;
169 struct cpuidle_device *dev =
170 per_cpu(cpuidle_devices, hotcpu);
171
172 if (dev && cpuidle_get_driver()) {
173 switch (action) {
174 case CPU_ONLINE:
175 case CPU_ONLINE_FROZEN:
176 cpuidle_pause_and_lock();
177 cpuidle_enable_device(dev);
178 cpuidle_resume_and_unlock();
179 break;
180
181 case CPU_DEAD:
182 case CPU_DEAD_FROZEN:
183 cpuidle_pause_and_lock();
184 cpuidle_disable_device(dev);
185 cpuidle_resume_and_unlock();
186 break;
187
188 default:
189 return NOTIFY_DONE;
190 }
191 }
192 return NOTIFY_OK;
193}
194
195static struct notifier_block setup_hotplug_notifier = {
196 .notifier_call = pseries_cpuidle_add_cpu_notifier,
197};
198
199/*
200 * pseries_cpuidle_driver_init()
201 */
202static int pseries_cpuidle_driver_init(void)
203{
204 int idle_state;
205 struct cpuidle_driver *drv = &pseries_idle_driver;
206
207 drv->state_count = 0;
208
209 for (idle_state = 0; idle_state < max_idle_state; ++idle_state) {
210 /* Is the state not enabled? */
211 if (cpuidle_state_table[idle_state].enter == NULL)
212 continue;
213
214 drv->states[drv->state_count] = /* structure copy */
215 cpuidle_state_table[idle_state];
216
217 drv->state_count += 1;
218 }
219
220 return 0;
221}
222
223/*
224 * pseries_idle_probe()
225 * Choose state table for shared versus dedicated partition
226 */
227static int pseries_idle_probe(void)
228{
229
230 if (cpuidle_disable != IDLE_NO_OVERRIDE)
231 return -ENODEV;
232
233 if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
234 if (lppaca_shared_proc(get_lppaca())) {
235 cpuidle_state_table = shared_states;
236 max_idle_state = ARRAY_SIZE(shared_states);
237 } else {
238 cpuidle_state_table = dedicated_states;
239 max_idle_state = ARRAY_SIZE(dedicated_states);
240 }
241 } else
242 return -ENODEV;
243
244 return 0;
245}
246
247static int __init pseries_processor_idle_init(void)
248{
249 int retval;
250
251 retval = pseries_idle_probe();
252 if (retval)
253 return retval;
254
255 pseries_cpuidle_driver_init();
256 retval = cpuidle_register(&pseries_idle_driver, NULL);
257 if (retval) {
258 printk(KERN_DEBUG "Registration of pseries driver failed.\n");
259 return retval;
260 }
261
262 register_cpu_notifier(&setup_hotplug_notifier);
263 printk(KERN_DEBUG "pseries_idle_driver registered\n");
264 return 0;
265}
266
267device_initcall(pseries_processor_idle_init);
diff --git a/drivers/media/platform/fsl-viu.c b/drivers/media/platform/fsl-viu.c
index 6a232239ee8c..dbf0ce38a8e7 100644
--- a/drivers/media/platform/fsl-viu.c
+++ b/drivers/media/platform/fsl-viu.c
@@ -1580,7 +1580,7 @@ static int viu_of_probe(struct platform_device *op)
1580 } 1580 }
1581 1581
1582 /* enable VIU clock */ 1582 /* enable VIU clock */
1583 clk = devm_clk_get(&op->dev, "viu_clk"); 1583 clk = devm_clk_get(&op->dev, "ipg");
1584 if (IS_ERR(clk)) { 1584 if (IS_ERR(clk)) {
1585 dev_err(&op->dev, "failed to lookup the clock!\n"); 1585 dev_err(&op->dev, "failed to lookup the clock!\n");
1586 ret = PTR_ERR(clk); 1586 ret = PTR_ERR(clk);
diff --git a/drivers/mtd/nand/mpc5121_nfc.c b/drivers/mtd/nand/mpc5121_nfc.c
index 61e2abc216ad..31ee7cfbc12b 100644
--- a/drivers/mtd/nand/mpc5121_nfc.c
+++ b/drivers/mtd/nand/mpc5121_nfc.c
@@ -729,7 +729,7 @@ static int mpc5121_nfc_probe(struct platform_device *op)
729 of_node_put(rootnode); 729 of_node_put(rootnode);
730 730
731 /* Enable NFC clock */ 731 /* Enable NFC clock */
732 clk = devm_clk_get(dev, "nfc_clk"); 732 clk = devm_clk_get(dev, "ipg");
733 if (IS_ERR(clk)) { 733 if (IS_ERR(clk)) {
734 dev_err(dev, "Unable to acquire NFC clock!\n"); 734 dev_err(dev, "Unable to acquire NFC clock!\n");
735 retval = PTR_ERR(clk); 735 retval = PTR_ERR(clk);
diff --git a/drivers/net/can/mscan/mpc5xxx_can.c b/drivers/net/can/mscan/mpc5xxx_can.c
index 035e235e3118..44725296f72a 100644
--- a/drivers/net/can/mscan/mpc5xxx_can.c
+++ b/drivers/net/can/mscan/mpc5xxx_can.c
@@ -108,135 +108,170 @@ static u32 mpc52xx_can_get_clock(struct platform_device *ofdev,
108#endif /* CONFIG_PPC_MPC52xx */ 108#endif /* CONFIG_PPC_MPC52xx */
109 109
110#ifdef CONFIG_PPC_MPC512x 110#ifdef CONFIG_PPC_MPC512x
111struct mpc512x_clockctl {
112 u32 spmr; /* System PLL Mode Reg */
113 u32 sccr[2]; /* System Clk Ctrl Reg 1 & 2 */
114 u32 scfr1; /* System Clk Freq Reg 1 */
115 u32 scfr2; /* System Clk Freq Reg 2 */
116 u32 reserved;
117 u32 bcr; /* Bread Crumb Reg */
118 u32 pccr[12]; /* PSC Clk Ctrl Reg 0-11 */
119 u32 spccr; /* SPDIF Clk Ctrl Reg */
120 u32 cccr; /* CFM Clk Ctrl Reg */
121 u32 dccr; /* DIU Clk Cnfg Reg */
122 u32 mccr[4]; /* MSCAN Clk Ctrl Reg 1-3 */
123};
124
125static struct of_device_id mpc512x_clock_ids[] = {
126 { .compatible = "fsl,mpc5121-clock", },
127 {}
128};
129
130static u32 mpc512x_can_get_clock(struct platform_device *ofdev, 111static u32 mpc512x_can_get_clock(struct platform_device *ofdev,
131 const char *clock_name, int *mscan_clksrc) 112 const char *clock_source, int *mscan_clksrc)
132{ 113{
133 struct mpc512x_clockctl __iomem *clockctl; 114 struct device_node *np;
134 struct device_node *np_clock; 115 u32 clockdiv;
135 struct clk *sys_clk, *ref_clk; 116 enum {
136 int plen, clockidx, clocksrc = -1; 117 CLK_FROM_AUTO,
137 u32 sys_freq, val, clockdiv = 1, freq = 0; 118 CLK_FROM_IPS,
138 const u32 *pval; 119 CLK_FROM_SYS,
139 120 CLK_FROM_REF,
140 np_clock = of_find_matching_node(NULL, mpc512x_clock_ids); 121 } clk_from;
141 if (!np_clock) { 122 struct clk *clk_in, *clk_can;
142 dev_err(&ofdev->dev, "couldn't find clock node\n"); 123 unsigned long freq_calc;
143 return 0; 124 struct mscan_priv *priv;
144 } 125 struct clk *clk_ipg;
145 clockctl = of_iomap(np_clock, 0);
146 if (!clockctl) {
147 dev_err(&ofdev->dev, "couldn't map clock registers\n");
148 goto exit_put;
149 }
150 126
151 /* Determine the MSCAN device index from the peripheral's 127 /* the caller passed in the clock source spec that was read from
152 * physical address. Register address offsets against the 128 * the device tree, get the optional clock divider as well
153 * IMMR base are: 0x1300, 0x1380, 0x2300, 0x2380
154 */ 129 */
155 pval = of_get_property(ofdev->dev.of_node, "reg", &plen); 130 np = ofdev->dev.of_node;
156 BUG_ON(!pval || plen < sizeof(*pval)); 131 clockdiv = 1;
157 clockidx = (*pval & 0x80) ? 1 : 0; 132 of_property_read_u32(np, "fsl,mscan-clock-divider", &clockdiv);
158 if (*pval & 0x2000) 133 dev_dbg(&ofdev->dev, "device tree specs: clk src[%s] div[%d]\n",
159 clockidx += 2; 134 clock_source ? clock_source : "<NULL>", clockdiv);
135
136 /* when clock-source is 'ip', the CANCTL1[CLKSRC] bit needs to
137 * get set, and the 'ips' clock is the input to the MSCAN
138 * component
139 *
140 * for clock-source values of 'ref' or 'sys' the CANCTL1[CLKSRC]
141 * bit needs to get cleared, an optional clock-divider may have
142 * been specified (the default value is 1), the appropriate
143 * MSCAN related MCLK is the input to the MSCAN component
144 *
145 * in the absence of a clock-source spec, first an optimal clock
146 * gets determined based on the 'sys' clock, if that fails the
147 * 'ref' clock is used
148 */
149 clk_from = CLK_FROM_AUTO;
150 if (clock_source) {
151 /* interpret the device tree's spec for the clock source */
152 if (!strcmp(clock_source, "ip"))
153 clk_from = CLK_FROM_IPS;
154 else if (!strcmp(clock_source, "sys"))
155 clk_from = CLK_FROM_SYS;
156 else if (!strcmp(clock_source, "ref"))
157 clk_from = CLK_FROM_REF;
158 else
159 goto err_invalid;
160 dev_dbg(&ofdev->dev, "got a clk source spec[%d]\n", clk_from);
161 }
162 if (clk_from == CLK_FROM_AUTO) {
163 /* no spec so far, try the 'sys' clock; round to the
164 * next MHz and see if we can get a multiple of 16MHz
165 */
166 dev_dbg(&ofdev->dev, "no clk source spec, trying SYS\n");
167 clk_in = devm_clk_get(&ofdev->dev, "sys");
168 if (IS_ERR(clk_in))
169 goto err_notavail;
170 freq_calc = clk_get_rate(clk_in);
171 freq_calc += 499999;
172 freq_calc /= 1000000;
173 freq_calc *= 1000000;
174 if ((freq_calc % 16000000) == 0) {
175 clk_from = CLK_FROM_SYS;
176 clockdiv = freq_calc / 16000000;
177 dev_dbg(&ofdev->dev,
178 "clk fit, sys[%lu] div[%d] freq[%lu]\n",
179 freq_calc, clockdiv, freq_calc / clockdiv);
180 }
181 }
182 if (clk_from == CLK_FROM_AUTO) {
183 /* no spec so far, use the 'ref' clock */
184 dev_dbg(&ofdev->dev, "no clk source spec, trying REF\n");
185 clk_in = devm_clk_get(&ofdev->dev, "ref");
186 if (IS_ERR(clk_in))
187 goto err_notavail;
188 clk_from = CLK_FROM_REF;
189 freq_calc = clk_get_rate(clk_in);
190 dev_dbg(&ofdev->dev,
191 "clk fit, ref[%lu] (no div) freq[%lu]\n",
192 freq_calc, freq_calc);
193 }
160 194
161 /* 195 /* select IPS or MCLK as the MSCAN input (returned to the caller),
162 * Clock source and divider selection: 3 different clock sources 196 * setup the MCLK mux source and rate if applicable, apply the
163 * can be selected: "ip", "ref" or "sys". For the latter two, a 197 * optionally specified or derived above divider, and determine
164 * clock divider can be defined as well. If the clock source is 198 * the actual resulting clock rate to return to the caller
165 * not specified by the device tree, we first try to find an
166 * optimal CAN source clock based on the system clock. If that
167 * is not posslible, the reference clock will be used.
168 */ 199 */
169 if (clock_name && !strcmp(clock_name, "ip")) { 200 switch (clk_from) {
201 case CLK_FROM_IPS:
202 clk_can = devm_clk_get(&ofdev->dev, "ips");
203 if (IS_ERR(clk_can))
204 goto err_notavail;
205 priv = netdev_priv(dev_get_drvdata(&ofdev->dev));
206 priv->clk_can = clk_can;
207 freq_calc = clk_get_rate(clk_can);
170 *mscan_clksrc = MSCAN_CLKSRC_IPS; 208 *mscan_clksrc = MSCAN_CLKSRC_IPS;
171 freq = mpc5xxx_get_bus_frequency(ofdev->dev.of_node); 209 dev_dbg(&ofdev->dev, "clk from IPS, clksrc[%d] freq[%lu]\n",
172 } else { 210 *mscan_clksrc, freq_calc);
211 break;
212 case CLK_FROM_SYS:
213 case CLK_FROM_REF:
214 clk_can = devm_clk_get(&ofdev->dev, "mclk");
215 if (IS_ERR(clk_can))
216 goto err_notavail;
217 priv = netdev_priv(dev_get_drvdata(&ofdev->dev));
218 priv->clk_can = clk_can;
219 if (clk_from == CLK_FROM_SYS)
220 clk_in = devm_clk_get(&ofdev->dev, "sys");
221 if (clk_from == CLK_FROM_REF)
222 clk_in = devm_clk_get(&ofdev->dev, "ref");
223 if (IS_ERR(clk_in))
224 goto err_notavail;
225 clk_set_parent(clk_can, clk_in);
226 freq_calc = clk_get_rate(clk_in);
227 freq_calc /= clockdiv;
228 clk_set_rate(clk_can, freq_calc);
229 freq_calc = clk_get_rate(clk_can);
173 *mscan_clksrc = MSCAN_CLKSRC_BUS; 230 *mscan_clksrc = MSCAN_CLKSRC_BUS;
174 231 dev_dbg(&ofdev->dev, "clk from MCLK, clksrc[%d] freq[%lu]\n",
175 pval = of_get_property(ofdev->dev.of_node, 232 *mscan_clksrc, freq_calc);
176 "fsl,mscan-clock-divider", &plen); 233 break;
177 if (pval && plen == sizeof(*pval)) 234 default:
178 clockdiv = *pval; 235 goto err_invalid;
179 if (!clockdiv)
180 clockdiv = 1;
181
182 if (!clock_name || !strcmp(clock_name, "sys")) {
183 sys_clk = devm_clk_get(&ofdev->dev, "sys_clk");
184 if (IS_ERR(sys_clk)) {
185 dev_err(&ofdev->dev, "couldn't get sys_clk\n");
186 goto exit_unmap;
187 }
188 /* Get and round up/down sys clock rate */
189 sys_freq = 1000000 *
190 ((clk_get_rate(sys_clk) + 499999) / 1000000);
191
192 if (!clock_name) {
193 /* A multiple of 16 MHz would be optimal */
194 if ((sys_freq % 16000000) == 0) {
195 clocksrc = 0;
196 clockdiv = sys_freq / 16000000;
197 freq = sys_freq / clockdiv;
198 }
199 } else {
200 clocksrc = 0;
201 freq = sys_freq / clockdiv;
202 }
203 }
204
205 if (clocksrc < 0) {
206 ref_clk = devm_clk_get(&ofdev->dev, "ref_clk");
207 if (IS_ERR(ref_clk)) {
208 dev_err(&ofdev->dev, "couldn't get ref_clk\n");
209 goto exit_unmap;
210 }
211 clocksrc = 1;
212 freq = clk_get_rate(ref_clk) / clockdiv;
213 }
214 } 236 }
215 237
216 /* Disable clock */ 238 /* the above clk_can item is used for the bitrate, access to
217 out_be32(&clockctl->mccr[clockidx], 0x0); 239 * the peripheral's register set needs the clk_ipg item
218 if (clocksrc >= 0) { 240 */
219 /* Set source and divider */ 241 clk_ipg = devm_clk_get(&ofdev->dev, "ipg");
220 val = (clocksrc << 14) | ((clockdiv - 1) << 17); 242 if (IS_ERR(clk_ipg))
221 out_be32(&clockctl->mccr[clockidx], val); 243 goto err_notavail_ipg;
222 /* Enable clock */ 244 if (clk_prepare_enable(clk_ipg))
223 out_be32(&clockctl->mccr[clockidx], val | 0x10000); 245 goto err_notavail_ipg;
224 } 246 priv = netdev_priv(dev_get_drvdata(&ofdev->dev));
247 priv->clk_ipg = clk_ipg;
248
249 /* return the determined clock source rate */
250 return freq_calc;
251
252err_invalid:
253 dev_err(&ofdev->dev, "invalid clock source specification\n");
254 /* clock source rate could not get determined */
255 return 0;
225 256
226 /* Enable MSCAN clock domain */ 257err_notavail:
227 val = in_be32(&clockctl->sccr[1]); 258 dev_err(&ofdev->dev, "cannot acquire or setup bitrate clock source\n");
228 if (!(val & (1 << 25))) 259 /* clock source rate could not get determined */
229 out_be32(&clockctl->sccr[1], val | (1 << 25)); 260 return 0;
230 261
231 dev_dbg(&ofdev->dev, "using '%s' with frequency divider %d\n", 262err_notavail_ipg:
232 *mscan_clksrc == MSCAN_CLKSRC_IPS ? "ips_clk" : 263 dev_err(&ofdev->dev, "cannot acquire or setup register clock\n");
233 clocksrc == 1 ? "ref_clk" : "sys_clk", clockdiv); 264 /* clock source rate could not get determined */
265 return 0;
266}
234 267
235exit_unmap: 268static void mpc512x_can_put_clock(struct platform_device *ofdev)
236 iounmap(clockctl); 269{
237exit_put: 270 struct mscan_priv *priv;
238 of_node_put(np_clock); 271
239 return freq; 272 priv = netdev_priv(dev_get_drvdata(&ofdev->dev));
273 if (priv->clk_ipg)
274 clk_disable_unprepare(priv->clk_ipg);
240} 275}
241#else /* !CONFIG_PPC_MPC512x */ 276#else /* !CONFIG_PPC_MPC512x */
242static u32 mpc512x_can_get_clock(struct platform_device *ofdev, 277static u32 mpc512x_can_get_clock(struct platform_device *ofdev,
@@ -244,6 +279,7 @@ static u32 mpc512x_can_get_clock(struct platform_device *ofdev,
244{ 279{
245 return 0; 280 return 0;
246} 281}
282#define mpc512x_can_put_clock NULL
247#endif /* CONFIG_PPC_MPC512x */ 283#endif /* CONFIG_PPC_MPC512x */
248 284
249static const struct of_device_id mpc5xxx_can_table[]; 285static const struct of_device_id mpc5xxx_can_table[];
@@ -385,11 +421,13 @@ static int mpc5xxx_can_resume(struct platform_device *ofdev)
385static const struct mpc5xxx_can_data mpc5200_can_data = { 421static const struct mpc5xxx_can_data mpc5200_can_data = {
386 .type = MSCAN_TYPE_MPC5200, 422 .type = MSCAN_TYPE_MPC5200,
387 .get_clock = mpc52xx_can_get_clock, 423 .get_clock = mpc52xx_can_get_clock,
424 /* .put_clock not applicable */
388}; 425};
389 426
390static const struct mpc5xxx_can_data mpc5121_can_data = { 427static const struct mpc5xxx_can_data mpc5121_can_data = {
391 .type = MSCAN_TYPE_MPC5121, 428 .type = MSCAN_TYPE_MPC5121,
392 .get_clock = mpc512x_can_get_clock, 429 .get_clock = mpc512x_can_get_clock,
430 .put_clock = mpc512x_can_put_clock,
393}; 431};
394 432
395static const struct of_device_id mpc5xxx_can_table[] = { 433static const struct of_device_id mpc5xxx_can_table[] = {
diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c
index 46d2313f7c6f..5032141eeeec 100644
--- a/drivers/spi/spi-mpc512x-psc.c
+++ b/drivers/spi/spi-mpc512x-psc.c
@@ -40,6 +40,7 @@ struct mpc512x_psc_spi {
40 unsigned int irq; 40 unsigned int irq;
41 u8 bits_per_word; 41 u8 bits_per_word;
42 struct clk *clk_mclk; 42 struct clk *clk_mclk;
43 struct clk *clk_ipg;
43 u32 mclk_rate; 44 u32 mclk_rate;
44 45
45 struct completion txisrdone; 46 struct completion txisrdone;
@@ -475,8 +476,6 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr,
475 struct spi_master *master; 476 struct spi_master *master;
476 int ret; 477 int ret;
477 void *tempp; 478 void *tempp;
478 int psc_num;
479 char clk_name[16];
480 struct clk *clk; 479 struct clk *clk;
481 480
482 master = spi_alloc_master(dev, sizeof *mps); 481 master = spi_alloc_master(dev, sizeof *mps);
@@ -519,9 +518,7 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr,
519 goto free_master; 518 goto free_master;
520 init_completion(&mps->txisrdone); 519 init_completion(&mps->txisrdone);
521 520
522 psc_num = master->bus_num; 521 clk = devm_clk_get(dev, "mclk");
523 snprintf(clk_name, sizeof(clk_name), "psc%d_mclk", psc_num);
524 clk = devm_clk_get(dev, clk_name);
525 if (IS_ERR(clk)) { 522 if (IS_ERR(clk)) {
526 ret = PTR_ERR(clk); 523 ret = PTR_ERR(clk);
527 goto free_master; 524 goto free_master;
@@ -532,17 +529,29 @@ static int mpc512x_psc_spi_do_probe(struct device *dev, u32 regaddr,
532 mps->clk_mclk = clk; 529 mps->clk_mclk = clk;
533 mps->mclk_rate = clk_get_rate(clk); 530 mps->mclk_rate = clk_get_rate(clk);
534 531
532 clk = devm_clk_get(dev, "ipg");
533 if (IS_ERR(clk)) {
534 ret = PTR_ERR(clk);
535 goto free_mclk_clock;
536 }
537 ret = clk_prepare_enable(clk);
538 if (ret)
539 goto free_mclk_clock;
540 mps->clk_ipg = clk;
541
535 ret = mpc512x_psc_spi_port_config(master, mps); 542 ret = mpc512x_psc_spi_port_config(master, mps);
536 if (ret < 0) 543 if (ret < 0)
537 goto free_clock; 544 goto free_ipg_clock;
538 545
539 ret = devm_spi_register_master(dev, master); 546 ret = devm_spi_register_master(dev, master);
540 if (ret < 0) 547 if (ret < 0)
541 goto free_clock; 548 goto free_ipg_clock;
542 549
543 return ret; 550 return ret;
544 551
545free_clock: 552free_ipg_clock:
553 clk_disable_unprepare(mps->clk_ipg);
554free_mclk_clock:
546 clk_disable_unprepare(mps->clk_mclk); 555 clk_disable_unprepare(mps->clk_mclk);
547free_master: 556free_master:
548 spi_master_put(master); 557 spi_master_put(master);
@@ -556,6 +565,7 @@ static int mpc512x_psc_spi_do_remove(struct device *dev)
556 struct mpc512x_psc_spi *mps = spi_master_get_devdata(master); 565 struct mpc512x_psc_spi *mps = spi_master_get_devdata(master);
557 566
558 clk_disable_unprepare(mps->clk_mclk); 567 clk_disable_unprepare(mps->clk_mclk);
568 clk_disable_unprepare(mps->clk_ipg);
559 569
560 return 0; 570 return 0;
561} 571}
diff --git a/drivers/tty/serial/mpc52xx_uart.c b/drivers/tty/serial/mpc52xx_uart.c
index ec06505e3ae6..97888f4900ec 100644
--- a/drivers/tty/serial/mpc52xx_uart.c
+++ b/drivers/tty/serial/mpc52xx_uart.c
@@ -421,6 +421,7 @@ struct psc_fifoc {
421 421
422static struct psc_fifoc __iomem *psc_fifoc; 422static struct psc_fifoc __iomem *psc_fifoc;
423static unsigned int psc_fifoc_irq; 423static unsigned int psc_fifoc_irq;
424static struct clk *psc_fifoc_clk;
424 425
425static void mpc512x_psc_fifo_init(struct uart_port *port) 426static void mpc512x_psc_fifo_init(struct uart_port *port)
426{ 427{
@@ -568,36 +569,73 @@ static unsigned int mpc512x_psc_set_baudrate(struct uart_port *port,
568/* Init PSC FIFO Controller */ 569/* Init PSC FIFO Controller */
569static int __init mpc512x_psc_fifoc_init(void) 570static int __init mpc512x_psc_fifoc_init(void)
570{ 571{
572 int err;
571 struct device_node *np; 573 struct device_node *np;
574 struct clk *clk;
575
576 /* default error code, potentially overwritten by clock calls */
577 err = -ENODEV;
572 578
573 np = of_find_compatible_node(NULL, NULL, 579 np = of_find_compatible_node(NULL, NULL,
574 "fsl,mpc5121-psc-fifo"); 580 "fsl,mpc5121-psc-fifo");
575 if (!np) { 581 if (!np) {
576 pr_err("%s: Can't find FIFOC node\n", __func__); 582 pr_err("%s: Can't find FIFOC node\n", __func__);
577 return -ENODEV; 583 goto out_err;
578 } 584 }
579 585
586 clk = of_clk_get(np, 0);
587 if (IS_ERR(clk)) {
588 /* backwards compat with device trees that lack clock specs */
589 clk = clk_get_sys(np->name, "ipg");
590 }
591 if (IS_ERR(clk)) {
592 pr_err("%s: Can't lookup FIFO clock\n", __func__);
593 err = PTR_ERR(clk);
594 goto out_ofnode_put;
595 }
596 if (clk_prepare_enable(clk)) {
597 pr_err("%s: Can't enable FIFO clock\n", __func__);
598 clk_put(clk);
599 goto out_ofnode_put;
600 }
601 psc_fifoc_clk = clk;
602
580 psc_fifoc = of_iomap(np, 0); 603 psc_fifoc = of_iomap(np, 0);
581 if (!psc_fifoc) { 604 if (!psc_fifoc) {
582 pr_err("%s: Can't map FIFOC\n", __func__); 605 pr_err("%s: Can't map FIFOC\n", __func__);
583 of_node_put(np); 606 goto out_clk_disable;
584 return -ENODEV;
585 } 607 }
586 608
587 psc_fifoc_irq = irq_of_parse_and_map(np, 0); 609 psc_fifoc_irq = irq_of_parse_and_map(np, 0);
588 of_node_put(np);
589 if (psc_fifoc_irq == 0) { 610 if (psc_fifoc_irq == 0) {
590 pr_err("%s: Can't get FIFOC irq\n", __func__); 611 pr_err("%s: Can't get FIFOC irq\n", __func__);
591 iounmap(psc_fifoc); 612 goto out_unmap;
592 return -ENODEV;
593 } 613 }
594 614
615 of_node_put(np);
595 return 0; 616 return 0;
617
618out_unmap:
619 iounmap(psc_fifoc);
620out_clk_disable:
621 clk_disable_unprepare(psc_fifoc_clk);
622 clk_put(psc_fifoc_clk);
623out_ofnode_put:
624 of_node_put(np);
625out_err:
626 return err;
596} 627}
597 628
598static void __exit mpc512x_psc_fifoc_uninit(void) 629static void __exit mpc512x_psc_fifoc_uninit(void)
599{ 630{
600 iounmap(psc_fifoc); 631 iounmap(psc_fifoc);
632
633 /* disable the clock, errors are not fatal */
634 if (psc_fifoc_clk) {
635 clk_disable_unprepare(psc_fifoc_clk);
636 clk_put(psc_fifoc_clk);
637 psc_fifoc_clk = NULL;
638 }
601} 639}
602 640
603/* 512x specific interrupt handler. The caller holds the port lock */ 641/* 512x specific interrupt handler. The caller holds the port lock */
@@ -619,29 +657,55 @@ static irqreturn_t mpc512x_psc_handle_irq(struct uart_port *port)
619} 657}
620 658
621static struct clk *psc_mclk_clk[MPC52xx_PSC_MAXNUM]; 659static struct clk *psc_mclk_clk[MPC52xx_PSC_MAXNUM];
660static struct clk *psc_ipg_clk[MPC52xx_PSC_MAXNUM];
622 661
623/* called from within the .request_port() callback (allocation) */ 662/* called from within the .request_port() callback (allocation) */
624static int mpc512x_psc_alloc_clock(struct uart_port *port) 663static int mpc512x_psc_alloc_clock(struct uart_port *port)
625{ 664{
626 int psc_num; 665 int psc_num;
627 char clk_name[16];
628 struct clk *clk; 666 struct clk *clk;
629 int err; 667 int err;
630 668
631 psc_num = (port->mapbase & 0xf00) >> 8; 669 psc_num = (port->mapbase & 0xf00) >> 8;
632 snprintf(clk_name, sizeof(clk_name), "psc%d_mclk", psc_num); 670
633 clk = devm_clk_get(port->dev, clk_name); 671 clk = devm_clk_get(port->dev, "mclk");
634 if (IS_ERR(clk)) { 672 if (IS_ERR(clk)) {
635 dev_err(port->dev, "Failed to get MCLK!\n"); 673 dev_err(port->dev, "Failed to get MCLK!\n");
636 return PTR_ERR(clk); 674 err = PTR_ERR(clk);
675 goto out_err;
637 } 676 }
638 err = clk_prepare_enable(clk); 677 err = clk_prepare_enable(clk);
639 if (err) { 678 if (err) {
640 dev_err(port->dev, "Failed to enable MCLK!\n"); 679 dev_err(port->dev, "Failed to enable MCLK!\n");
641 return err; 680 goto out_err;
642 } 681 }
643 psc_mclk_clk[psc_num] = clk; 682 psc_mclk_clk[psc_num] = clk;
683
684 clk = devm_clk_get(port->dev, "ipg");
685 if (IS_ERR(clk)) {
686 dev_err(port->dev, "Failed to get IPG clock!\n");
687 err = PTR_ERR(clk);
688 goto out_err;
689 }
690 err = clk_prepare_enable(clk);
691 if (err) {
692 dev_err(port->dev, "Failed to enable IPG clock!\n");
693 goto out_err;
694 }
695 psc_ipg_clk[psc_num] = clk;
696
644 return 0; 697 return 0;
698
699out_err:
700 if (psc_mclk_clk[psc_num]) {
701 clk_disable_unprepare(psc_mclk_clk[psc_num]);
702 psc_mclk_clk[psc_num] = NULL;
703 }
704 if (psc_ipg_clk[psc_num]) {
705 clk_disable_unprepare(psc_ipg_clk[psc_num]);
706 psc_ipg_clk[psc_num] = NULL;
707 }
708 return err;
645} 709}
646 710
647/* called from within the .release_port() callback (release) */ 711/* called from within the .release_port() callback (release) */
@@ -656,6 +720,10 @@ static void mpc512x_psc_relse_clock(struct uart_port *port)
656 clk_disable_unprepare(clk); 720 clk_disable_unprepare(clk);
657 psc_mclk_clk[psc_num] = NULL; 721 psc_mclk_clk[psc_num] = NULL;
658 } 722 }
723 if (psc_ipg_clk[psc_num]) {
724 clk_disable_unprepare(psc_ipg_clk[psc_num]);
725 psc_ipg_clk[psc_num] = NULL;
726 }
659} 727}
660 728
661/* implementation of the .clock() callback (enable/disable) */ 729/* implementation of the .clock() callback (enable/disable) */
diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c
index abd5050a4899..9162d1b6c0a3 100644
--- a/drivers/usb/host/fsl-mph-dr-of.c
+++ b/drivers/usb/host/fsl-mph-dr-of.c
@@ -261,19 +261,8 @@ int fsl_usb2_mpc5121_init(struct platform_device *pdev)
261 struct fsl_usb2_platform_data *pdata = dev_get_platdata(&pdev->dev); 261 struct fsl_usb2_platform_data *pdata = dev_get_platdata(&pdev->dev);
262 struct clk *clk; 262 struct clk *clk;
263 int err; 263 int err;
264 char clk_name[10];
265 int base, clk_num;
266
267 base = pdev->resource->start & 0xf000;
268 if (base == 0x3000)
269 clk_num = 1;
270 else if (base == 0x4000)
271 clk_num = 2;
272 else
273 return -ENODEV;
274 264
275 snprintf(clk_name, sizeof(clk_name), "usb%d_clk", clk_num); 265 clk = devm_clk_get(pdev->dev.parent, "ipg");
276 clk = devm_clk_get(pdev->dev.parent, clk_name);
277 if (IS_ERR(clk)) { 266 if (IS_ERR(clk)) {
278 dev_err(&pdev->dev, "failed to get clk\n"); 267 dev_err(&pdev->dev, "failed to get clk\n");
279 return PTR_ERR(clk); 268 return PTR_ERR(clk);