Lines Matching +full:spurious +full:- +full:oc

1 // SPDX-License-Identifier: GPL-2.0
24 #include "isp1760-core.h"
25 #include "isp1760-hcd.h"
26 #include "isp1760-regs.h"
27 #include "isp1760-udc.h"
31 struct isp1760_hcd *hcd = &isp->hcd; in isp1760_init_core()
32 struct isp1760_udc *udc = &isp->udc; in isp1760_init_core()
35 /* Low-level chip reset */ in isp1760_init_core()
36 if (isp->rst_gpio) { in isp1760_init_core()
37 gpiod_set_value_cansleep(isp->rst_gpio, 1); in isp1760_init_core()
39 gpiod_set_value_cansleep(isp->rst_gpio, 0); in isp1760_init_core()
46 isp1760_field_set(hcd->fields, SW_RESET_RESET_ALL); in isp1760_init_core()
49 /* Setup HW Mode Control: This assumes a level active-low interrupt */ in isp1760_init_core()
50 if ((isp->devflags & ISP1760_FLAG_ANALOG_OC) && hcd->is_isp1763) { in isp1760_init_core()
51 dev_err(isp->dev, "isp1763 analog overcurrent not available\n"); in isp1760_init_core()
52 return -EINVAL; in isp1760_init_core()
55 if (isp->devflags & ISP1760_FLAG_BUS_WIDTH_16) in isp1760_init_core()
56 isp1760_field_clear(hcd->fields, HW_DATA_BUS_WIDTH); in isp1760_init_core()
57 if (isp->devflags & ISP1760_FLAG_BUS_WIDTH_8) in isp1760_init_core()
58 isp1760_field_set(hcd->fields, HW_DATA_BUS_WIDTH); in isp1760_init_core()
59 if (isp->devflags & ISP1760_FLAG_ANALOG_OC) in isp1760_init_core()
60 isp1760_field_set(hcd->fields, HW_ANA_DIGI_OC); in isp1760_init_core()
61 if (isp->devflags & ISP1760_FLAG_DACK_POL_HIGH) in isp1760_init_core()
62 isp1760_field_set(hcd->fields, HW_DACK_POL_HIGH); in isp1760_init_core()
63 if (isp->devflags & ISP1760_FLAG_DREQ_POL_HIGH) in isp1760_init_core()
64 isp1760_field_set(hcd->fields, HW_DREQ_POL_HIGH); in isp1760_init_core()
65 if (isp->devflags & ISP1760_FLAG_INTR_POL_HIGH) in isp1760_init_core()
66 isp1760_field_set(hcd->fields, HW_INTR_HIGH_ACT); in isp1760_init_core()
67 if (isp->devflags & ISP1760_FLAG_INTR_EDGE_TRIG) in isp1760_init_core()
68 isp1760_field_set(hcd->fields, HW_INTR_EDGE_TRIG); in isp1760_init_core()
74 * spurious interrupts during HCD registration. in isp1760_init_core()
76 if (isp->devflags & ISP1760_FLAG_ISP1761) { in isp1760_init_core()
77 isp1760_reg_write(udc->regs, ISP176x_DC_MODE, 0); in isp1760_init_core()
78 isp1760_field_set(hcd->fields, HW_COMN_IRQ); in isp1760_init_core()
87 if (isp->devflags & ISP1760_FLAG_ISP1761) { in isp1760_init_core()
88 if (isp->devflags & ISP1760_FLAG_PERIPHERAL_EN) { in isp1760_init_core()
97 isp1760_reg_write(hcd->regs, ISP176x_HC_OTG_CTRL, otg_ctrl); in isp1760_init_core()
100 dev_info(isp->dev, "%s bus width: %u, oc: %s\n", in isp1760_init_core()
101 hcd->is_isp1763 ? "isp1763" : "isp1760", in isp1760_init_core()
102 isp->devflags & ISP1760_FLAG_BUS_WIDTH_8 ? 8 : in isp1760_init_core()
103 isp->devflags & ISP1760_FLAG_BUS_WIDTH_16 ? 16 : 32, in isp1760_init_core()
104 hcd->is_isp1763 ? "not available" : in isp1760_init_core()
105 isp->devflags & ISP1760_FLAG_ANALOG_OC ? "analog" : "digital"); in isp1760_init_core()
112 struct isp1760_udc *udc = &isp->udc; in isp1760_set_pullup()
115 isp1760_field_set(udc->fields, HW_DP_PULLUP); in isp1760_set_pullup()
117 isp1760_field_set(udc->fields, HW_DP_PULLUP_CLEAR); in isp1760_set_pullup()
124 * - 32 blocks @ 256 bytes
125 * - 20 blocks @ 1024 bytes
126 * - 4 blocks @ 8192 bytes
145 * - 8 blocks @ 256 bytes
146 * - 2 blocks @ 1024 bytes
147 * - 4 blocks @ 4096 bytes
174 .name = "isp1760-hc",
342 .name = "isp1763-hc",
362 .name = "isp1761-dc",
472 .name = "isp1763-dc",
505 return -ENODEV; in isp1760_register()
509 return -ENOMEM; in isp1760_register()
511 isp->dev = dev; in isp1760_register()
512 isp->devflags = devflags; in isp1760_register()
513 hcd = &isp->hcd; in isp1760_register()
514 udc = &isp->udc; in isp1760_register()
516 hcd->is_isp1763 = !!(devflags & ISP1760_FLAG_ISP1763); in isp1760_register()
517 udc->is_isp1763 = !!(devflags & ISP1760_FLAG_ISP1763); in isp1760_register()
519 if (!hcd->is_isp1763 && (devflags & ISP1760_FLAG_BUS_WIDTH_8)) { in isp1760_register()
521 return -EINVAL; in isp1760_register()
524 if (hcd->is_isp1763) { in isp1760_register()
536 isp->rst_gpio = devm_gpiod_get_optional(dev, NULL, GPIOD_OUT_HIGH); in isp1760_register()
537 if (IS_ERR(isp->rst_gpio)) in isp1760_register()
538 return PTR_ERR(isp->rst_gpio); in isp1760_register()
540 hcd->base = devm_ioremap_resource(dev, mem); in isp1760_register()
541 if (IS_ERR(hcd->base)) in isp1760_register()
542 return PTR_ERR(hcd->base); in isp1760_register()
544 hcd->regs = devm_regmap_init_mmio(dev, hcd->base, hc_regmap); in isp1760_register()
545 if (IS_ERR(hcd->regs)) in isp1760_register()
546 return PTR_ERR(hcd->regs); in isp1760_register()
549 f = devm_regmap_field_alloc(dev, hcd->regs, hc_reg_fields[i]); in isp1760_register()
553 hcd->fields[i] = f; in isp1760_register()
556 udc->regs = devm_regmap_init_mmio(dev, hcd->base, dc_regmap); in isp1760_register()
557 if (IS_ERR(udc->regs)) in isp1760_register()
558 return PTR_ERR(udc->regs); in isp1760_register()
561 f = devm_regmap_field_alloc(dev, udc->regs, dc_reg_fields[i]); in isp1760_register()
565 udc->fields[i] = f; in isp1760_register()
568 if (hcd->is_isp1763) in isp1760_register()
569 hcd->memory_layout = &isp1763_memory_conf; in isp1760_register()
571 hcd->memory_layout = &isp176x_memory_conf; in isp1760_register()
602 isp1760_hcd_unregister(&isp->hcd); in isp1760_unregister()
605 MODULE_DESCRIPTION("Driver for the ISP1760 USB-controller from NXP");