From 3233c043f2e20fde627ddd6cf03f8cb472a822d1 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 28 Apr 2015 11:53:26 -0600 Subject: [PATCH] Add logic to register the hub class to all board logic that initialize USB host --- configs/mbed/src/lpc17_hidkbd.c | 14 ++++++++++++++ configs/olimex-lpc1766stk/src/lpc17_hidkbd.c | 1 - configs/olimex-stm32-p207/src/stm32_usb.c | 14 +++++++++++++- configs/sama5d3x-ek/src/sam_usb.c | 18 ++++++++++++++---- configs/stm32f429i-disco/src/stm32_usb.c | 15 ++++++++++++++- 5 files changed, 55 insertions(+), 7 deletions(-) diff --git a/configs/mbed/src/lpc17_hidkbd.c b/configs/mbed/src/lpc17_hidkbd.c index b13f8669ab..38fbca9033 100644 --- a/configs/mbed/src/lpc17_hidkbd.c +++ b/configs/mbed/src/lpc17_hidkbd.c @@ -39,6 +39,8 @@ #include +#include + #include #include "lpc17_usbhost.h" @@ -66,6 +68,18 @@ struct usbhost_connection_s *arch_usbhost_initialize(void) { +#ifdef CONFIG_USBHOST_HUB + int ret; + + /* Initialize USB hub class support */ + + ret = usbhost_hub_initialize(); + if (ret < 0) + { + udbg("ERROR: usbhost_hub_initialize failed: %d\n", ret); + } +#endif + return lpc17_usbhost_initialize(0); } #endif /* CONFIG_LPC17_USBHOST && CONFIG_USBHOST && CONFIG_EXAMPLES_HIDKBD */ diff --git a/configs/olimex-lpc1766stk/src/lpc17_hidkbd.c b/configs/olimex-lpc1766stk/src/lpc17_hidkbd.c index 3e8f3ab1c7..7c0d304fd1 100644 --- a/configs/olimex-lpc1766stk/src/lpc17_hidkbd.c +++ b/configs/olimex-lpc1766stk/src/lpc17_hidkbd.c @@ -39,7 +39,6 @@ #include -#include #include #include diff --git a/configs/olimex-stm32-p207/src/stm32_usb.c b/configs/olimex-stm32-p207/src/stm32_usb.c index e09c21d9dc..26057e15f0 100644 --- a/configs/olimex-stm32-p207/src/stm32_usb.c +++ b/configs/olimex-stm32-p207/src/stm32_usb.c @@ -1,7 +1,7 @@ /************************************************************************************ * configs/olimex-stm32-p207/src/stm32_usb.c * - * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -175,6 +175,18 @@ int stm32_usbhost_initialize(void) * that we care about: */ +#ifdef CONFIG_USBHOST_HUB + /* Initialize USB hub class support */ + + ret = usbhost_hub_initialize(); + if (ret < 0) + { + udbg("ERROR: usbhost_hub_initialize failed: %d\n", ret); + } +#endif + + /* Initialize Mass Storage Class support */ + uvdbg("Register class drivers\n"); ret = usbhost_storageinit(); if (ret != OK) diff --git a/configs/sama5d3x-ek/src/sam_usb.c b/configs/sama5d3x-ek/src/sam_usb.c index f46da45e78..8139a1addc 100644 --- a/configs/sama5d3x-ek/src/sam_usb.c +++ b/configs/sama5d3x-ek/src/sam_usb.c @@ -1,7 +1,7 @@ /************************************************************************************ * configs/sama5d3x-ek/src/sam_usb.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -309,11 +309,21 @@ int sam_usbhost_initialize(void) int ret; /* First, register all of the class drivers needed to support the drivers - * that we care about - * - * Register theUSB host Mass Storage Class: + * that we care about/ */ +#ifdef CONFIG_USBHOST_HUB + /* Initialize USB hub class support */ + + ret = usbhost_hub_initialize(); + if (ret < 0) + { + udbg("ERROR: usbhost_hub_initialize failed: %d\n", ret); + } +#endif + + /* Register the USB host Mass Storage Class */ + ret = usbhost_storageinit(); if (ret != OK) { diff --git a/configs/stm32f429i-disco/src/stm32_usb.c b/configs/stm32f429i-disco/src/stm32_usb.c index 5811070464..855e7ec222 100644 --- a/configs/stm32f429i-disco/src/stm32_usb.c +++ b/configs/stm32f429i-disco/src/stm32_usb.c @@ -1,7 +1,7 @@ /************************************************************************************ * configs/stm32f429i-disco/src/stm32_usbdev.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -177,6 +177,19 @@ int stm32_usbhost_initialize(void) */ uvdbg("Register class drivers\n"); + +#ifdef CONFIG_USBHOST_HUB + /* Initialize USB hub class support */ + + ret = usbhost_hub_initialize(); + if (ret < 0) + { + udbg("ERROR: usbhost_hub_initialize failed: %d\n", ret); + } +#endif + + /* Register the USB host Mass Storage Class */ + ret = usbhost_storageinit(); if (ret != OK) {