diff options
author | Peter Chen <peter.chen@freescale.com> | 2013-08-14 05:44:06 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-08-14 15:37:19 -0400 |
commit | c10b4f033e7c0ddba2b7b699d01109e4de46e831 (patch) | |
tree | 5bbf40eb6076bfd59c38f8e916f0e686b2eb1cb2 | |
parent | d66895f9df6b880fa3a280f5bdfe919169ca37dd (diff) |
usb: chipidea: otg: add otg file used to access otgsc
This file is mainly used to access otgsc currently, it may
add otg related things in the future.
Tested-by: Marek Vasut <marex@denx.de>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/chipidea/Makefile | 2 | ||||
-rw-r--r-- | drivers/usb/chipidea/bits.h | 10 | ||||
-rw-r--r-- | drivers/usb/chipidea/core.c | 3 | ||||
-rw-r--r-- | drivers/usb/chipidea/otg.c | 35 | ||||
-rw-r--r-- | drivers/usb/chipidea/otg.h | 32 |
5 files changed, 80 insertions, 2 deletions
diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile index 6cf5f68dedd8..a99d980454a6 100644 --- a/drivers/usb/chipidea/Makefile +++ b/drivers/usb/chipidea/Makefile | |||
@@ -2,7 +2,7 @@ ccflags-$(CONFIG_USB_CHIPIDEA_DEBUG) := -DDEBUG | |||
2 | 2 | ||
3 | obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc.o | 3 | obj-$(CONFIG_USB_CHIPIDEA) += ci_hdrc.o |
4 | 4 | ||
5 | ci_hdrc-y := core.o | 5 | ci_hdrc-y := core.o otg.o |
6 | ci_hdrc-$(CONFIG_USB_CHIPIDEA_UDC) += udc.o | 6 | ci_hdrc-$(CONFIG_USB_CHIPIDEA_UDC) += udc.o |
7 | ci_hdrc-$(CONFIG_USB_CHIPIDEA_HOST) += host.o | 7 | ci_hdrc-$(CONFIG_USB_CHIPIDEA_HOST) += host.o |
8 | ci_hdrc-$(CONFIG_USB_CHIPIDEA_DEBUG) += debug.o | 8 | ci_hdrc-$(CONFIG_USB_CHIPIDEA_DEBUG) += debug.o |
diff --git a/drivers/usb/chipidea/bits.h b/drivers/usb/chipidea/bits.h index 1b23e354f9fb..464584c6ccae 100644 --- a/drivers/usb/chipidea/bits.h +++ b/drivers/usb/chipidea/bits.h | |||
@@ -79,11 +79,21 @@ | |||
79 | #define OTGSC_ASVIS BIT(18) | 79 | #define OTGSC_ASVIS BIT(18) |
80 | #define OTGSC_BSVIS BIT(19) | 80 | #define OTGSC_BSVIS BIT(19) |
81 | #define OTGSC_BSEIS BIT(20) | 81 | #define OTGSC_BSEIS BIT(20) |
82 | #define OTGSC_1MSIS BIT(21) | ||
83 | #define OTGSC_DPIS BIT(22) | ||
82 | #define OTGSC_IDIE BIT(24) | 84 | #define OTGSC_IDIE BIT(24) |
83 | #define OTGSC_AVVIE BIT(25) | 85 | #define OTGSC_AVVIE BIT(25) |
84 | #define OTGSC_ASVIE BIT(26) | 86 | #define OTGSC_ASVIE BIT(26) |
85 | #define OTGSC_BSVIE BIT(27) | 87 | #define OTGSC_BSVIE BIT(27) |
86 | #define OTGSC_BSEIE BIT(28) | 88 | #define OTGSC_BSEIE BIT(28) |
89 | #define OTGSC_1MSIE BIT(29) | ||
90 | #define OTGSC_DPIE BIT(30) | ||
91 | #define OTGSC_INT_EN_BITS (OTGSC_IDIE | OTGSC_AVVIE | OTGSC_ASVIE \ | ||
92 | | OTGSC_BSVIE | OTGSC_BSEIE | OTGSC_1MSIE \ | ||
93 | | OTGSC_DPIE) | ||
94 | #define OTGSC_INT_STATUS_BITS (OTGSC_IDIS | OTGSC_AVVIS | OTGSC_ASVIS \ | ||
95 | | OTGSC_BSVIS | OTGSC_BSEIS | OTGSC_1MSIS \ | ||
96 | | OTGSC_DPIS) | ||
87 | 97 | ||
88 | /* USBMODE */ | 98 | /* USBMODE */ |
89 | #define USBMODE_CM (0x03UL << 0) | 99 | #define USBMODE_CM (0x03UL << 0) |
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 13dbd511f59a..2f70080023ae 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c | |||
@@ -72,6 +72,7 @@ | |||
72 | #include "bits.h" | 72 | #include "bits.h" |
73 | #include "host.h" | 73 | #include "host.h" |
74 | #include "debug.h" | 74 | #include "debug.h" |
75 | #include "otg.h" | ||
75 | 76 | ||
76 | /* Controller register map */ | 77 | /* Controller register map */ |
77 | static uintptr_t ci_regs_nolpm[] = { | 78 | static uintptr_t ci_regs_nolpm[] = { |
@@ -528,7 +529,7 @@ static int ci_hdrc_probe(struct platform_device *pdev) | |||
528 | goto stop; | 529 | goto stop; |
529 | 530 | ||
530 | if (ci->is_otg) | 531 | if (ci->is_otg) |
531 | hw_write(ci, OP_OTGSC, OTGSC_IDIE, OTGSC_IDIE); | 532 | ci_hdrc_otg_init(ci); |
532 | 533 | ||
533 | ret = dbg_create_files(ci); | 534 | ret = dbg_create_files(ci); |
534 | if (!ret) | 535 | if (!ret) |
diff --git a/drivers/usb/chipidea/otg.c b/drivers/usb/chipidea/otg.c new file mode 100644 index 000000000000..999a085491d7 --- /dev/null +++ b/drivers/usb/chipidea/otg.c | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | * otg.c - ChipIdea USB IP core OTG driver | ||
3 | * | ||
4 | * Copyright (C) 2013 Freescale Semiconductor, Inc. | ||
5 | * | ||
6 | * Author: Peter Chen | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | /* | ||
14 | * This file mainly handles otgsc register, it may include OTG operation | ||
15 | * in the future. | ||
16 | */ | ||
17 | |||
18 | #include <linux/usb/otg.h> | ||
19 | #include <linux/usb/gadget.h> | ||
20 | #include <linux/usb/chipidea.h> | ||
21 | |||
22 | #include "ci.h" | ||
23 | #include "bits.h" | ||
24 | #include "otg.h" | ||
25 | |||
26 | /** | ||
27 | * ci_hdrc_otg_init - initialize otgsc bits | ||
28 | * ci: the controller | ||
29 | */ | ||
30 | int ci_hdrc_otg_init(struct ci_hdrc *ci) | ||
31 | { | ||
32 | ci_enable_otg_interrupt(ci, OTGSC_IDIE); | ||
33 | |||
34 | return 0; | ||
35 | } | ||
diff --git a/drivers/usb/chipidea/otg.h b/drivers/usb/chipidea/otg.h new file mode 100644 index 000000000000..376eaee73042 --- /dev/null +++ b/drivers/usb/chipidea/otg.h | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2013 Freescale Semiconductor, Inc. | ||
3 | * | ||
4 | * Author: Peter Chen | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #ifndef __DRIVERS_USB_CHIPIDEA_OTG_H | ||
12 | #define __DRIVERS_USB_CHIPIDEA_OTG_H | ||
13 | |||
14 | static inline void ci_clear_otg_interrupt(struct ci_hdrc *ci, u32 bits) | ||
15 | { | ||
16 | /* Only clear request bits */ | ||
17 | hw_write(ci, OP_OTGSC, OTGSC_INT_STATUS_BITS, bits); | ||
18 | } | ||
19 | |||
20 | static inline void ci_enable_otg_interrupt(struct ci_hdrc *ci, u32 bits) | ||
21 | { | ||
22 | hw_write(ci, OP_OTGSC, bits, bits); | ||
23 | } | ||
24 | |||
25 | static inline void ci_disable_otg_interrupt(struct ci_hdrc *ci, u32 bits) | ||
26 | { | ||
27 | hw_write(ci, OP_OTGSC, bits, 0); | ||
28 | } | ||
29 | |||
30 | int ci_hdrc_otg_init(struct ci_hdrc *ci); | ||
31 | |||
32 | #endif /* __DRIVERS_USB_CHIPIDEA_OTG_H */ | ||