53 #include <linux/device.h>
58 #include <linux/module.h>
63 #include <linux/kernel.h>
64 #include <linux/slab.h>
66 #include <linux/usb/ch9.h>
122 static int hw_alloc_regmap(
struct ci13xxx *ci,
bool is_lpm)
136 (is_lpm ? ci_regs_lpm[
i] : ci_regs_nolpm[
i]);
140 4 * (i - OP_ENDPTCTRL) +
156 const u8 TEST_MODE_MAX = 7;
158 if (mode > TEST_MODE_MAX)
186 hw_alloc_regmap(ci,
false);
190 hw_alloc_regmap(ci, !!reg);
202 dev_dbg(ci->
dev,
"ChipIdea HDRC found, lpm: %d; cap: %p op: %p\n",
276 if (role != ci->
role) {
281 ci_role_start(ci, role);
295 const char *buf,
size_t count)
305 if (role == CI_ROLE_END || role == ci->
role)
309 ret = ci_role_start(ci, role);
327 if (ci->
role != CI_ROLE_END)
331 hw_write(ci,
OP_OTGSC, OTGSC_IDIS, OTGSC_IDIS);
402 dev_err(dev,
"platform data missing\n");
408 dev_err(dev,
"missing resource\n");
414 dev_err(dev,
"can't request and ioremap resource\n");
420 dev_err(dev,
"can't allocate device\n");
431 ret = hw_device_init(ci, base);
433 dev_err(dev,
"can't initialize hardware\n");
448 dev_err(dev,
"can't create workqueue\n");
455 dev_info(dev,
"doesn't support host\n");
459 dev_info(dev,
"doesn't support gadget\n");
462 dev_err(dev,
"no supported roles\n");
471 ci->
role = ci_otg_role(ci);
478 ret = ci_role_start(ci, ci->
role);
485 platform_set_drvdata(pdev, ci);
513 struct ci13xxx *ci = platform_get_drvdata(pdev);
525 .probe = ci_hdrc_probe,