aboutsummaryrefslogtreecommitdiff
path: root/lib/usb
diff options
context:
space:
mode:
authorUwe Bonnes2011-07-05 18:40:34 +0200
committerUwe Hermann2011-07-13 10:04:03 +0200
commit32c276a7084141ea0e65f1fa4cd92146251958d6 (patch)
tree2926fa8d32c786a77230cbc0ec823b80e1a1a222 /lib/usb
parent6a8eb81480dad08a2fa2729f076fb03c1b337dd4 (diff)
Move enabling the USB Clock into stm32f10x_usbd_init
Diffstat (limited to 'lib/usb')
-rw-r--r--lib/usb/usb_f103.c2
-rw-r--r--lib/usb/usb_f107.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/usb/usb_f103.c b/lib/usb/usb_f103.c
index 19f645d..594d3c6 100644
--- a/lib/usb/usb_f103.c
+++ b/lib/usb/usb_f103.c
@@ -17,6 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <libopencm3/stm32/rcc.h>
#include <libopencm3/cm3/common.h>
#include <libopencm3/stm32/tools.h>
#include <libopencm3/stm32/usb.h>
@@ -53,6 +54,7 @@ const struct _usbd_driver stm32f103_usb_driver = {
/** Initialize the USB device controller hardware of the STM32. */
static void stm32f103_usbd_init(void)
{
+ rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USBEN);
SET_REG(USB_CNTR_REG, 0);
SET_REG(USB_BTABLE_REG, 0);
SET_REG(USB_ISTR_REG, 0);
diff --git a/lib/usb/usb_f107.c b/lib/usb/usb_f107.c
index ee83b65..134b728 100644
--- a/lib/usb/usb_f107.c
+++ b/lib/usb/usb_f107.c
@@ -17,6 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <libopencm3/stm32/rcc.h>
#include <libopencm3/cm3/common.h>
#include <libopencm3/stm32/tools.h>
#include <libopencm3/stm32/otg_fs.h>
@@ -63,6 +64,7 @@ const struct _usbd_driver stm32f107_usb_driver = {
/** Initialize the USB device controller hardware of the STM32. */
static void stm32f107_usbd_init(void)
{
+ rcc_peripheral_enable_clock(&RCC_AHBENR, RCC_AHBENR_OTGFSEN);
OTG_FS_GINTSTS = OTG_FS_GINTSTS_MMIS;
/* WARNING: Undocumented! Select internal PHY */