blob: 2a7381f4fe4c81598188a14e7a9bbcd76f0fed16 [file] [log] [blame]
Yunzhi Li64d11402014-12-12 23:07:46 +08001/*
2 * Rockchip usb PHY driver
3 *
4 * Copyright (C) 2014 Yunzhi Li <lyz@rock-chips.com>
5 * Copyright (C) 2014 ROCKCHIP, Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#include <linux/clk.h>
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +010018#include <linux/clk-provider.h>
Yunzhi Li64d11402014-12-12 23:07:46 +080019#include <linux/io.h>
20#include <linux/kernel.h>
21#include <linux/module.h>
22#include <linux/mutex.h>
23#include <linux/of.h>
24#include <linux/of_address.h>
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +010025#include <linux/of_platform.h>
Yunzhi Li64d11402014-12-12 23:07:46 +080026#include <linux/phy/phy.h>
27#include <linux/platform_device.h>
28#include <linux/regulator/consumer.h>
29#include <linux/reset.h>
30#include <linux/regmap.h>
31#include <linux/mfd/syscon.h>
32
Heiko Stuebner605df8a2016-02-22 12:55:01 +010033static int enable_usb_uart;
34
35#define HIWORD_UPDATE(val, mask) \
36 ((val) | (mask) << 16)
37
38#define UOC_CON0_SIDDQ BIT(13)
Yunzhi Li64d11402014-12-12 23:07:46 +080039
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +010040struct rockchip_usb_phys {
41 int reg;
42 const char *pll_name;
43};
44
Heiko Stuebner605df8a2016-02-22 12:55:01 +010045struct rockchip_usb_phy_base;
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +010046struct rockchip_usb_phy_pdata {
47 struct rockchip_usb_phys *phys;
Heiko Stuebner605df8a2016-02-22 12:55:01 +010048 int (*init_usb_uart)(struct regmap *grf);
49 int usb_uart_phy;
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +010050};
51
Heiko Stuebner5fdbb972015-11-19 22:22:23 +010052struct rockchip_usb_phy_base {
53 struct device *dev;
54 struct regmap *reg_base;
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +010055 const struct rockchip_usb_phy_pdata *pdata;
Heiko Stuebner5fdbb972015-11-19 22:22:23 +010056};
57
Yunzhi Li64d11402014-12-12 23:07:46 +080058struct rockchip_usb_phy {
Heiko Stuebner5fdbb972015-11-19 22:22:23 +010059 struct rockchip_usb_phy_base *base;
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +010060 struct device_node *np;
Yunzhi Li64d11402014-12-12 23:07:46 +080061 unsigned int reg_offset;
Yunzhi Li64d11402014-12-12 23:07:46 +080062 struct clk *clk;
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +010063 struct clk *clk480m;
64 struct clk_hw clk480m_hw;
Yunzhi Li64d11402014-12-12 23:07:46 +080065 struct phy *phy;
Heiko Stuebner605df8a2016-02-22 12:55:01 +010066 bool uart_enabled;
Yunzhi Li64d11402014-12-12 23:07:46 +080067};
68
69static int rockchip_usb_phy_power(struct rockchip_usb_phy *phy,
70 bool siddq)
71{
Heiko Stuebner605df8a2016-02-22 12:55:01 +010072 u32 val = HIWORD_UPDATE(siddq ? UOC_CON0_SIDDQ : 0, UOC_CON0_SIDDQ);
73
74 return regmap_write(phy->base->reg_base, phy->reg_offset, val);
Yunzhi Li64d11402014-12-12 23:07:46 +080075}
76
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +010077static unsigned long rockchip_usb_phy480m_recalc_rate(struct clk_hw *hw,
78 unsigned long parent_rate)
79{
80 return 480000000;
81}
82
83static void rockchip_usb_phy480m_disable(struct clk_hw *hw)
84{
85 struct rockchip_usb_phy *phy = container_of(hw,
86 struct rockchip_usb_phy,
87 clk480m_hw);
88
89 /* Power down usb phy analog blocks by set siddq 1 */
90 rockchip_usb_phy_power(phy, 1);
91}
92
93static int rockchip_usb_phy480m_enable(struct clk_hw *hw)
94{
95 struct rockchip_usb_phy *phy = container_of(hw,
96 struct rockchip_usb_phy,
97 clk480m_hw);
98
99 /* Power up usb phy analog blocks by set siddq 0 */
100 return rockchip_usb_phy_power(phy, 0);
101}
102
103static int rockchip_usb_phy480m_is_enabled(struct clk_hw *hw)
104{
105 struct rockchip_usb_phy *phy = container_of(hw,
106 struct rockchip_usb_phy,
107 clk480m_hw);
108 int ret;
109 u32 val;
110
111 ret = regmap_read(phy->base->reg_base, phy->reg_offset, &val);
112 if (ret < 0)
113 return ret;
114
Heiko Stuebner605df8a2016-02-22 12:55:01 +0100115 return (val & UOC_CON0_SIDDQ) ? 0 : 1;
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +0100116}
117
118static const struct clk_ops rockchip_usb_phy480m_ops = {
119 .enable = rockchip_usb_phy480m_enable,
120 .disable = rockchip_usb_phy480m_disable,
121 .is_enabled = rockchip_usb_phy480m_is_enabled,
122 .recalc_rate = rockchip_usb_phy480m_recalc_rate,
123};
124
Yunzhi Li64d11402014-12-12 23:07:46 +0800125static int rockchip_usb_phy_power_off(struct phy *_phy)
126{
127 struct rockchip_usb_phy *phy = phy_get_drvdata(_phy);
Yunzhi Li64d11402014-12-12 23:07:46 +0800128
Heiko Stuebner605df8a2016-02-22 12:55:01 +0100129 if (phy->uart_enabled)
130 return -EBUSY;
131
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +0100132 clk_disable_unprepare(phy->clk480m);
Yunzhi Li64d11402014-12-12 23:07:46 +0800133
134 return 0;
135}
136
137static int rockchip_usb_phy_power_on(struct phy *_phy)
138{
139 struct rockchip_usb_phy *phy = phy_get_drvdata(_phy);
Yunzhi Li64d11402014-12-12 23:07:46 +0800140
Heiko Stuebner605df8a2016-02-22 12:55:01 +0100141 if (phy->uart_enabled)
142 return -EBUSY;
143
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +0100144 return clk_prepare_enable(phy->clk480m);
Yunzhi Li64d11402014-12-12 23:07:46 +0800145}
146
Axel Lin4a9e5ca2015-07-15 15:33:51 +0800147static const struct phy_ops ops = {
Yunzhi Li64d11402014-12-12 23:07:46 +0800148 .power_on = rockchip_usb_phy_power_on,
149 .power_off = rockchip_usb_phy_power_off,
150 .owner = THIS_MODULE,
151};
152
Heiko Stuebner75d390f2015-11-19 22:22:22 +0100153static void rockchip_usb_phy_action(void *data)
154{
155 struct rockchip_usb_phy *rk_phy = data;
156
Heiko Stuebner605df8a2016-02-22 12:55:01 +0100157 if (!rk_phy->uart_enabled) {
158 of_clk_del_provider(rk_phy->np);
159 clk_unregister(rk_phy->clk480m);
160 }
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +0100161
Heiko Stuebner75d390f2015-11-19 22:22:22 +0100162 if (rk_phy->clk)
163 clk_put(rk_phy->clk);
164}
165
Heiko Stuebner97dd9102015-11-19 22:22:24 +0100166static int rockchip_usb_phy_init(struct rockchip_usb_phy_base *base,
167 struct device_node *child)
168{
169 struct rockchip_usb_phy *rk_phy;
170 unsigned int reg_offset;
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +0100171 const char *clk_name;
172 struct clk_init_data init;
173 int err, i;
Heiko Stuebner97dd9102015-11-19 22:22:24 +0100174
175 rk_phy = devm_kzalloc(base->dev, sizeof(*rk_phy), GFP_KERNEL);
176 if (!rk_phy)
177 return -ENOMEM;
178
179 rk_phy->base = base;
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +0100180 rk_phy->np = child;
Heiko Stuebner97dd9102015-11-19 22:22:24 +0100181
182 if (of_property_read_u32(child, "reg", &reg_offset)) {
183 dev_err(base->dev, "missing reg property in node %s\n",
184 child->name);
185 return -EINVAL;
186 }
187
188 rk_phy->reg_offset = reg_offset;
189
Heiko Stuebner97dd9102015-11-19 22:22:24 +0100190 rk_phy->clk = of_clk_get_by_name(child, "phyclk");
191 if (IS_ERR(rk_phy->clk))
192 rk_phy->clk = NULL;
193
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +0100194 i = 0;
195 init.name = NULL;
196 while (base->pdata->phys[i].reg) {
197 if (base->pdata->phys[i].reg == reg_offset) {
198 init.name = base->pdata->phys[i].pll_name;
199 break;
200 }
201 i++;
202 }
203
204 if (!init.name) {
205 dev_err(base->dev, "phy data not found\n");
206 return -EINVAL;
207 }
208
Heiko Stuebner605df8a2016-02-22 12:55:01 +0100209 if (enable_usb_uart && base->pdata->usb_uart_phy == i) {
210 dev_dbg(base->dev, "phy%d used as uart output\n", i);
211 rk_phy->uart_enabled = true;
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +0100212 } else {
Heiko Stuebner605df8a2016-02-22 12:55:01 +0100213 if (rk_phy->clk) {
214 clk_name = __clk_get_name(rk_phy->clk);
215 init.flags = 0;
216 init.parent_names = &clk_name;
217 init.num_parents = 1;
218 } else {
Stephen Boyd444525d2016-04-19 18:17:26 -0700219 init.flags = 0;
Heiko Stuebner605df8a2016-02-22 12:55:01 +0100220 init.parent_names = NULL;
221 init.num_parents = 0;
222 }
223
224 init.ops = &rockchip_usb_phy480m_ops;
225 rk_phy->clk480m_hw.init = &init;
226
227 rk_phy->clk480m = clk_register(base->dev, &rk_phy->clk480m_hw);
228 if (IS_ERR(rk_phy->clk480m)) {
229 err = PTR_ERR(rk_phy->clk480m);
230 goto err_clk;
231 }
232
233 err = of_clk_add_provider(child, of_clk_src_simple_get,
234 rk_phy->clk480m);
235 if (err < 0)
236 goto err_clk_prov;
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +0100237 }
238
Sudip Mukherjeed33fb002016-07-03 22:01:06 +0100239 err = devm_add_action_or_reset(base->dev, rockchip_usb_phy_action,
240 rk_phy);
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +0100241 if (err)
Sudip Mukherjeed33fb002016-07-03 22:01:06 +0100242 return err;
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +0100243
Heiko Stuebner97dd9102015-11-19 22:22:24 +0100244 rk_phy->phy = devm_phy_create(base->dev, child, &ops);
245 if (IS_ERR(rk_phy->phy)) {
246 dev_err(base->dev, "failed to create PHY\n");
247 return PTR_ERR(rk_phy->phy);
248 }
249 phy_set_drvdata(rk_phy->phy, rk_phy);
250
Heiko Stuebner605df8a2016-02-22 12:55:01 +0100251 /*
252 * When acting as uart-pipe, just keep clock on otherwise
253 * only power up usb phy when it use, so disable it when init
254 */
255 if (rk_phy->uart_enabled)
256 return clk_prepare_enable(rk_phy->clk);
257 else
258 return rockchip_usb_phy_power(rk_phy, 1);
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +0100259
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +0100260err_clk_prov:
Heiko Stuebner605df8a2016-02-22 12:55:01 +0100261 if (!rk_phy->uart_enabled)
262 clk_unregister(rk_phy->clk480m);
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +0100263err_clk:
264 if (rk_phy->clk)
265 clk_put(rk_phy->clk);
266 return err;
Heiko Stuebner97dd9102015-11-19 22:22:24 +0100267}
268
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +0100269static const struct rockchip_usb_phy_pdata rk3066a_pdata = {
270 .phys = (struct rockchip_usb_phys[]){
271 { .reg = 0x17c, .pll_name = "sclk_otgphy0_480m" },
272 { .reg = 0x188, .pll_name = "sclk_otgphy1_480m" },
273 { /* sentinel */ }
274 },
275};
276
277static const struct rockchip_usb_phy_pdata rk3188_pdata = {
278 .phys = (struct rockchip_usb_phys[]){
279 { .reg = 0x10c, .pll_name = "sclk_otgphy0_480m" },
280 { .reg = 0x11c, .pll_name = "sclk_otgphy1_480m" },
281 { /* sentinel */ }
282 },
283};
284
Heiko Stuebner605df8a2016-02-22 12:55:01 +0100285#define RK3288_UOC0_CON0 0x320
286#define RK3288_UOC0_CON0_COMMON_ON_N BIT(0)
287#define RK3288_UOC0_CON0_DISABLE BIT(4)
288
289#define RK3288_UOC0_CON2 0x328
290#define RK3288_UOC0_CON2_SOFT_CON_SEL BIT(2)
291
292#define RK3288_UOC0_CON3 0x32c
293#define RK3288_UOC0_CON3_UTMI_SUSPENDN BIT(0)
294#define RK3288_UOC0_CON3_UTMI_OPMODE_NODRIVING (1 << 1)
295#define RK3288_UOC0_CON3_UTMI_OPMODE_MASK (3 << 1)
296#define RK3288_UOC0_CON3_UTMI_XCVRSEELCT_FSTRANSC (1 << 3)
297#define RK3288_UOC0_CON3_UTMI_XCVRSEELCT_MASK (3 << 3)
298#define RK3288_UOC0_CON3_UTMI_TERMSEL_FULLSPEED BIT(5)
299#define RK3288_UOC0_CON3_BYPASSDMEN BIT(6)
300#define RK3288_UOC0_CON3_BYPASSSEL BIT(7)
301
302/*
303 * Enable the bypass of uart2 data through the otg usb phy.
304 * Original description in the TRM.
305 * 1. Disable the OTG block by setting OTGDISABLE0 to 1’b1.
306 * 2. Disable the pull-up resistance on the D+ line by setting
307 * OPMODE0[1:0] to 2’b01.
308 * 3. To ensure that the XO, Bias, and PLL blocks are powered down in Suspend
309 * mode, set COMMONONN to 1’b1.
310 * 4. Place the USB PHY in Suspend mode by setting SUSPENDM0 to 1’b0.
311 * 5. Set BYPASSSEL0 to 1’b1.
312 * 6. To transmit data, controls BYPASSDMEN0, and BYPASSDMDATA0.
313 * To receive data, monitor FSVPLUS0.
314 *
315 * The actual code in the vendor kernel does some things differently.
316 */
317static int __init rk3288_init_usb_uart(struct regmap *grf)
318{
319 u32 val;
320 int ret;
321
322 /*
323 * COMMON_ON and DISABLE settings are described in the TRM,
324 * but were not present in the original code.
325 * Also disable the analog phy components to save power.
326 */
327 val = HIWORD_UPDATE(RK3288_UOC0_CON0_COMMON_ON_N
328 | RK3288_UOC0_CON0_DISABLE
329 | UOC_CON0_SIDDQ,
330 RK3288_UOC0_CON0_COMMON_ON_N
331 | RK3288_UOC0_CON0_DISABLE
332 | UOC_CON0_SIDDQ);
333 ret = regmap_write(grf, RK3288_UOC0_CON0, val);
334 if (ret)
335 return ret;
336
337 val = HIWORD_UPDATE(RK3288_UOC0_CON2_SOFT_CON_SEL,
338 RK3288_UOC0_CON2_SOFT_CON_SEL);
339 ret = regmap_write(grf, RK3288_UOC0_CON2, val);
340 if (ret)
341 return ret;
342
343 val = HIWORD_UPDATE(RK3288_UOC0_CON3_UTMI_OPMODE_NODRIVING
344 | RK3288_UOC0_CON3_UTMI_XCVRSEELCT_FSTRANSC
345 | RK3288_UOC0_CON3_UTMI_TERMSEL_FULLSPEED,
346 RK3288_UOC0_CON3_UTMI_SUSPENDN
347 | RK3288_UOC0_CON3_UTMI_OPMODE_MASK
348 | RK3288_UOC0_CON3_UTMI_XCVRSEELCT_MASK
349 | RK3288_UOC0_CON3_UTMI_TERMSEL_FULLSPEED);
350 ret = regmap_write(grf, RK3288_UOC0_CON3, val);
351 if (ret)
352 return ret;
353
354 val = HIWORD_UPDATE(RK3288_UOC0_CON3_BYPASSSEL
355 | RK3288_UOC0_CON3_BYPASSDMEN,
356 RK3288_UOC0_CON3_BYPASSSEL
357 | RK3288_UOC0_CON3_BYPASSDMEN);
358 ret = regmap_write(grf, RK3288_UOC0_CON3, val);
359 if (ret)
360 return ret;
361
362 return 0;
363}
364
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +0100365static const struct rockchip_usb_phy_pdata rk3288_pdata = {
366 .phys = (struct rockchip_usb_phys[]){
367 { .reg = 0x320, .pll_name = "sclk_otgphy0_480m" },
368 { .reg = 0x334, .pll_name = "sclk_otgphy1_480m" },
369 { .reg = 0x348, .pll_name = "sclk_otgphy2_480m" },
370 { /* sentinel */ }
371 },
Heiko Stuebner605df8a2016-02-22 12:55:01 +0100372 .init_usb_uart = rk3288_init_usb_uart,
373 .usb_uart_phy = 0,
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +0100374};
375
Yunzhi Li64d11402014-12-12 23:07:46 +0800376static int rockchip_usb_phy_probe(struct platform_device *pdev)
377{
378 struct device *dev = &pdev->dev;
Heiko Stuebner5fdbb972015-11-19 22:22:23 +0100379 struct rockchip_usb_phy_base *phy_base;
Yunzhi Li64d11402014-12-12 23:07:46 +0800380 struct phy_provider *phy_provider;
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +0100381 const struct of_device_id *match;
Yunzhi Li64d11402014-12-12 23:07:46 +0800382 struct device_node *child;
huang lin08db7e52015-07-17 15:29:25 +0800383 int err;
Yunzhi Li64d11402014-12-12 23:07:46 +0800384
Heiko Stuebner5fdbb972015-11-19 22:22:23 +0100385 phy_base = devm_kzalloc(dev, sizeof(*phy_base), GFP_KERNEL);
386 if (!phy_base)
387 return -ENOMEM;
388
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +0100389 match = of_match_device(dev->driver->of_match_table, dev);
390 if (!match || !match->data) {
391 dev_err(dev, "missing phy data\n");
392 return -EINVAL;
393 }
394
395 phy_base->pdata = match->data;
396
Heiko Stuebner5fdbb972015-11-19 22:22:23 +0100397 phy_base->dev = dev;
Heiko Stuebnera0da4452016-06-29 00:12:58 +0200398 phy_base->reg_base = ERR_PTR(-ENODEV);
399 if (dev->parent && dev->parent->of_node)
400 phy_base->reg_base = syscon_node_to_regmap(
401 dev->parent->of_node);
402 if (IS_ERR(phy_base->reg_base))
403 phy_base->reg_base = syscon_regmap_lookup_by_phandle(
404 dev->of_node, "rockchip,grf");
Heiko Stuebner5fdbb972015-11-19 22:22:23 +0100405 if (IS_ERR(phy_base->reg_base)) {
Yunzhi Li64d11402014-12-12 23:07:46 +0800406 dev_err(&pdev->dev, "Missing rockchip,grf property\n");
Heiko Stuebner5fdbb972015-11-19 22:22:23 +0100407 return PTR_ERR(phy_base->reg_base);
Yunzhi Li64d11402014-12-12 23:07:46 +0800408 }
409
410 for_each_available_child_of_node(dev->of_node, child) {
Heiko Stuebner97dd9102015-11-19 22:22:24 +0100411 err = rockchip_usb_phy_init(phy_base, child);
412 if (err) {
413 of_node_put(child);
Heiko Stuebner75d390f2015-11-19 22:22:22 +0100414 return err;
Yunzhi Li64d11402014-12-12 23:07:46 +0800415 }
Yunzhi Li64d11402014-12-12 23:07:46 +0800416 }
417
418 phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
419 return PTR_ERR_OR_ZERO(phy_provider);
420}
421
422static const struct of_device_id rockchip_usb_phy_dt_ids[] = {
Heiko Stuebnerb74fe7c2015-11-19 22:22:26 +0100423 { .compatible = "rockchip,rk3066a-usb-phy", .data = &rk3066a_pdata },
424 { .compatible = "rockchip,rk3188-usb-phy", .data = &rk3188_pdata },
425 { .compatible = "rockchip,rk3288-usb-phy", .data = &rk3288_pdata },
Yunzhi Li64d11402014-12-12 23:07:46 +0800426 {}
427};
428
429MODULE_DEVICE_TABLE(of, rockchip_usb_phy_dt_ids);
430
431static struct platform_driver rockchip_usb_driver = {
432 .probe = rockchip_usb_phy_probe,
433 .driver = {
434 .name = "rockchip-usb-phy",
Yunzhi Li64d11402014-12-12 23:07:46 +0800435 .of_match_table = rockchip_usb_phy_dt_ids,
436 },
437};
438
439module_platform_driver(rockchip_usb_driver);
440
Heiko Stuebner605df8a2016-02-22 12:55:01 +0100441#ifndef MODULE
442static int __init rockchip_init_usb_uart(void)
443{
444 const struct of_device_id *match;
445 const struct rockchip_usb_phy_pdata *data;
446 struct device_node *np;
447 struct regmap *grf;
448 int ret;
449
450 if (!enable_usb_uart)
451 return 0;
452
453 np = of_find_matching_node_and_match(NULL, rockchip_usb_phy_dt_ids,
454 &match);
455 if (!np) {
456 pr_err("%s: failed to find usbphy node\n", __func__);
457 return -ENOTSUPP;
458 }
459
460 pr_debug("%s: using settings for %s\n", __func__, match->compatible);
461 data = match->data;
462
463 if (!data->init_usb_uart) {
464 pr_err("%s: usb-uart not available on %s\n",
465 __func__, match->compatible);
466 return -ENOTSUPP;
467 }
468
Heiko Stuebnera0da4452016-06-29 00:12:58 +0200469 grf = ERR_PTR(-ENODEV);
470 if (np->parent)
471 grf = syscon_node_to_regmap(np->parent);
472 if (IS_ERR(grf))
473 grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf");
Heiko Stuebner605df8a2016-02-22 12:55:01 +0100474 if (IS_ERR(grf)) {
475 pr_err("%s: Missing rockchip,grf property, %lu\n",
476 __func__, PTR_ERR(grf));
477 return PTR_ERR(grf);
478 }
479
480 ret = data->init_usb_uart(grf);
481 if (ret) {
482 pr_err("%s: could not init usb_uart, %d\n", __func__, ret);
483 enable_usb_uart = 0;
484 return ret;
485 }
486
487 return 0;
488}
489early_initcall(rockchip_init_usb_uart);
490
491static int __init rockchip_usb_uart(char *buf)
492{
493 enable_usb_uart = true;
494 return 0;
495}
496early_param("rockchip.usb_uart", rockchip_usb_uart);
497#endif
498
Yunzhi Li64d11402014-12-12 23:07:46 +0800499MODULE_AUTHOR("Yunzhi Li <lyz@rock-chips.com>");
500MODULE_DESCRIPTION("Rockchip USB 2.0 PHY driver");
501MODULE_LICENSE("GPL v2");