Print a warning when an unknow USB controller type is detected.
[coreboot.git] / payloads / libpayload / drivers / usb / usbinit.c
index 50dbf9747090e3fb7c42680af4444915f5d9f2ee..d3cfbb75e15f2ab37e15991e4cbe317759ea4577 100644 (file)
@@ -31,7 +31,7 @@
 #include <usb/usb.h>
 #include "uhci.h"
 #include "ohci.h"
-//#include "ehci.h"
+#include "ehci.h"
 #include "xhci.h"
 #include <usb/usbdisk.h>
 
@@ -70,41 +70,47 @@ usb_controller_initialize (int bus, int dev, int func)
 
                printf ("%02x:%02x.%x %04x:%04x.%d ", bus, dev, func,
                        pciid >> 16, pciid & 0xFFFF, func);
-               if (prog_if == 0) {
-                       printf ("UHCI controller\n");
+               switch(prog_if) {
+                       case 0x00:
+                               printf ("UHCI controller\n");
 #ifdef CONFIG_USB_UHCI
-                       uhci_init (addr);
+                               uhci_init (addr);
 #else
-                       printf ("Not supported.\n");
+                               printf ("Not supported.\n");
 #endif
-               }
-               if (prog_if == 0x10) {
-                       printf ("OHCI controller\n");
+                               break;
+
+                       case 0x10:
+                               printf ("OHCI controller\n");
 #ifdef CONFIG_USB_OHCI
-                       ohci_init(addr);
+                               ohci_init(addr);
 #else
-                       printf ("Not supported.\n");
+                               printf ("Not supported.\n");
 #endif
+                               break;
 
-               }
-               if (prog_if == 0x20) {
-                       printf ("EHCI controller\n");
+                       case 0x20:
+                               printf ("EHCI controller\n");
 #ifdef CONFIG_USB_EHCI
-                       //ehci_init(addr);
-                       printf ("Not supported.\n");
+                               ehci_init(addr);
 #else
-                       printf ("Not supported.\n");
+                               printf ("Not supported.\n");
 #endif
+                               break;
 
-               }
-               if (prog_if == 0x30) {
-                       printf ("xHCI controller\n");
+                       case 0x30:
+                               printf ("xHCI controller\n");
 #ifdef CONFIG_USB_XHCI
-                       xhci_init(addr);
+                               xhci_init(addr);
 #else
-                       printf ("Not supported.\n");
+                               printf ("Not supported.\n");
 #endif
+                               break;
 
+                       default:
+                               printf ("unknown controller %x not supported\n",
+                                               prog_if);
+                               break;
                }
        }