xref: /minix/minix/drivers/usb/usbd/base/earm/usbd_earm.c (revision 0a6a1f1d)
1 /*
2  * EARM USBD setup
3  */
4 
5 #include <minix/board.h>
6 #include <minix/syslib.h>
7 
8 #include <usbd/hcd_platforms.h>
9 #include <usbd/usbd_common.h>
10 #include <usbd/usbd_interface.h>
11 
12 
13 /*===========================================================================*
14  *    usbd_init_hcd                                                          *
15  *===========================================================================*/
16 int
17 usbd_init_hcd(void)
18 {
19 	/* More specific platform type than just EARM */
20 	static struct machine platform;
21 
22 	DEBUG_DUMP;
23 
24 	if (sys_getmachine(&platform)) {
25 		USB_MSG("Getting machine type, failed");
26 		return EXIT_FAILURE;
27 	}
28 
29 	if (BOARD_IS_BB(platform.board_id)) {
30 		USB_MSG("Using AM335x driver");
31 		return musb_am335x_init();
32 	} else {
33 		USB_MSG("Only AM335x driver available");
34 		return EXIT_FAILURE;
35 	}
36 }
37 
38 
39 /*===========================================================================*
40  *    usbd_deinit_hcd                                                        *
41  *===========================================================================*/
42 void
43 usbd_deinit_hcd(void)
44 {
45 	/* More specific platform type than just EARM */
46 	static struct machine platform;
47 
48 	DEBUG_DUMP;
49 
50 	if (sys_getmachine(&platform)) {
51 		USB_MSG("Getting machine type, failed");
52 		return;
53 	}
54 
55 	if (BOARD_IS_BB(platform.board_id))
56 		musb_am335x_deinit();
57 	else
58 		USB_MSG("Only AM335x driver available");
59 }
60