blob: ab7b8974bc18ba531829507e5f46b8a13361ba5b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
// SPDX-License-Identifier: GPL-2.0+
/*
* Central probing code for the FOTG210 dual role driver
* We register one driver for the hardware and then we decide
* whether to proceed with probing the host or the peripheral
* driver.
*/
#include <linux/device.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/usb.h>
#include "fotg210.h"
static int fotg210_probe(struct platform_device *pdev)
{
int ret;
if (IS_ENABLED(CONFIG_USB_FOTG210_HCD)) {
ret = fotg210_hcd_probe(pdev);
if (ret)
return ret;
}
if (IS_ENABLED(CONFIG_USB_FOTG210_UDC))
ret = fotg210_udc_probe(pdev);
return ret;
}
static int fotg210_remove(struct platform_device *pdev)
{
if (IS_ENABLED(CONFIG_USB_FOTG210_HCD))
fotg210_hcd_remove(pdev);
if (IS_ENABLED(CONFIG_USB_FOTG210_UDC))
fotg210_udc_remove(pdev);
return 0;
}
#ifdef CONFIG_OF
static const struct of_device_id fotg210_of_match[] = {
{ .compatible = "faraday,fotg210" },
{},
};
MODULE_DEVICE_TABLE(of, fotg210_of_match);
#endif
static struct platform_driver fotg210_driver = {
.driver = {
.name = "fotg210",
.of_match_table = of_match_ptr(fotg210_of_match),
},
.probe = fotg210_probe,
.remove = fotg210_remove,
};
static int __init fotg210_init(void)
{
if (usb_disabled())
return -ENODEV;
if (IS_ENABLED(CONFIG_USB_FOTG210_HCD))
fotg210_hcd_init();
return platform_driver_register(&fotg210_driver);
}
module_init(fotg210_init);
static void __exit fotg210_cleanup(void)
{
platform_driver_unregister(&fotg210_driver);
if (IS_ENABLED(CONFIG_USB_FOTG210_HCD))
fotg210_hcd_cleanup();
}
module_exit(fotg210_cleanup);
MODULE_AUTHOR("Yuan-Hsin Chen, Feng-Hsin Chiang");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("FOTG210 Dual Role Controller Driver");
|