blob: 5f080d40ced409ea7e9ff66abf29f958a698c15b [file] [log] [blame]
Greg Kroah-Hartmane1308c12014-12-24 13:01:43 -08001/*
2 * Greybus GP Bridge driver
3 *
4 * Copyright 2014 Google Inc.
5 * Copyright 2014 Linaro Ltd.
6 *
7 * Released under the GPLv2 only.
8 */
9
10#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
11
12#include <linux/types.h>
13#include <linux/module.h>
14#include <linux/moduleparam.h>
15#include <linux/kernel.h>
16#include <linux/slab.h>
17#include <linux/device.h>
18
19#include "greybus.h"
20
21
22static int __init gpbridge_init(void)
23{
24 if (gb_gpio_protocol_init()) {
25 pr_err("error initializing gpio protocol\n");
26 goto error_gpio;
27 }
28 if (gb_pwm_protocol_init()) {
29 pr_err("error initializing pwm protocol\n");
30 goto error_pwm;
31 }
32 if (gb_uart_protocol_init()) {
33 pr_err("error initializing uart protocol\n");
34 goto error_uart;
35 }
36 if (gb_sdio_protocol_init()) {
37 pr_err("error initializing sdio protocol\n");
38 goto error_sdio;
39 }
40 if (gb_usb_protocol_init()) {
41 pr_err("error initializing usb protocol\n");
42 goto error_usb;
43 }
Greg Kroah-Hartman2c078172014-12-24 13:01:44 -080044 if (gb_i2c_protocol_init()) {
45 pr_err("error initializing usb protocol\n");
46 goto error_i2c;
47 }
Viresh Kumar15d651b2015-01-23 13:07:45 +053048 if (gb_spi_protocol_init()) {
49 pr_err("error initializing usb protocol\n");
50 goto error_spi;
51 }
Greg Kroah-Hartmane1308c12014-12-24 13:01:43 -080052 return 0;
53
Viresh Kumar15d651b2015-01-23 13:07:45 +053054error_spi:
55 gb_i2c_protocol_exit();
Greg Kroah-Hartman2c078172014-12-24 13:01:44 -080056error_i2c:
57 gb_usb_protocol_exit();
Greg Kroah-Hartmane1308c12014-12-24 13:01:43 -080058error_usb:
59 gb_sdio_protocol_exit();
60error_sdio:
61 gb_uart_protocol_exit();
62error_uart:
63 gb_pwm_protocol_exit();
64error_pwm:
65 gb_gpio_protocol_exit();
66error_gpio:
67 return -EPROTO;
68}
69
70static void __exit gpbridge_exit(void)
71{
Viresh Kumar15d651b2015-01-23 13:07:45 +053072 gb_spi_protocol_exit();
Greg Kroah-Hartman2c078172014-12-24 13:01:44 -080073 gb_i2c_protocol_exit();
Greg Kroah-Hartmane1308c12014-12-24 13:01:43 -080074 gb_usb_protocol_exit();
75 gb_sdio_protocol_exit();
76 gb_uart_protocol_exit();
77 gb_pwm_protocol_exit();
78 gb_gpio_protocol_exit();
79}
80
81module_init(gpbridge_init);
82module_exit(gpbridge_exit);
83
84MODULE_LICENSE("GPL");