Lines Matching +full:otg +full:- +full:rev

1 // SPDX-License-Identifier: GPL-2.0
3 * OMAP OTG controller driver
5 * Based on code from tahvo-usb.c and isp1301_omap.c drivers.
7 * Copyright (C) 2005-2006 Nokia Corporation
19 #include <linux/platform_data/usb-omap1.h>
44 l = readl(otg_dev->base + OMAP_OTG_CTRL); in omap_otg_ctrl()
47 writel(l, otg_dev->base + OMAP_OTG_CTRL); in omap_otg_ctrl()
52 if (!otg_dev->id && otg_dev->vbus) in omap_otg_set_mode()
53 /* Set B-session valid. */ in omap_otg_set_mode()
55 else if (otg_dev->vbus) in omap_otg_set_mode()
56 /* Set A-session valid. */ in omap_otg_set_mode()
58 else if (!otg_dev->id) in omap_otg_set_mode()
59 /* Set B-session end to indicate no VBUS. */ in omap_otg_set_mode()
68 otg_dev->id = event; in omap_otg_id_notifier()
80 otg_dev->vbus = event; in omap_otg_vbus_notifier()
88 const struct omap_usb_config *config = pdev->dev.platform_data; in omap_otg_probe()
92 u32 rev; in omap_otg_probe() local
94 if (!config || !config->extcon) in omap_otg_probe()
95 return -ENODEV; in omap_otg_probe()
97 extcon = extcon_get_extcon_dev(config->extcon); in omap_otg_probe()
101 otg_dev = devm_kzalloc(&pdev->dev, sizeof(*otg_dev), GFP_KERNEL); in omap_otg_probe()
103 return -ENOMEM; in omap_otg_probe()
105 otg_dev->base = devm_ioremap_resource(&pdev->dev, &pdev->resource[0]); in omap_otg_probe()
106 if (IS_ERR(otg_dev->base)) in omap_otg_probe()
107 return PTR_ERR(otg_dev->base); in omap_otg_probe()
109 otg_dev->extcon = extcon; in omap_otg_probe()
110 otg_dev->id_nb.notifier_call = omap_otg_id_notifier; in omap_otg_probe()
111 otg_dev->vbus_nb.notifier_call = omap_otg_vbus_notifier; in omap_otg_probe()
113 ret = devm_extcon_register_notifier(&pdev->dev, extcon, in omap_otg_probe()
114 EXTCON_USB_HOST, &otg_dev->id_nb); in omap_otg_probe()
118 ret = devm_extcon_register_notifier(&pdev->dev, extcon, in omap_otg_probe()
119 EXTCON_USB, &otg_dev->vbus_nb); in omap_otg_probe()
124 otg_dev->id = extcon_get_state(extcon, EXTCON_USB_HOST); in omap_otg_probe()
125 otg_dev->vbus = extcon_get_state(extcon, EXTCON_USB); in omap_otg_probe()
128 rev = readl(otg_dev->base); in omap_otg_probe()
130 dev_info(&pdev->dev, in omap_otg_probe()
131 "OMAP USB OTG controller rev %d.%d (%s, id=%d, vbus=%d)\n", in omap_otg_probe()
132 (rev >> 4) & 0xf, rev & 0xf, config->extcon, otg_dev->id, in omap_otg_probe()
133 otg_dev->vbus); in omap_otg_probe()
148 MODULE_DESCRIPTION("OMAP USB OTG controller driver");