[U-Boot] [RFC PATCH] drivers/usb: regorganisation

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Wed Apr 1 19:21:19 CEST 2009


Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
---
better description will be wrote for the final patch

Best Regards,
J.
 Makefile                                     |    4 +++-
 drivers/usb/{ => core}/Makefile              |   22 +---------------------
 drivers/usb/{ => core}/usb_ehci_core.c       |    2 +-
 drivers/usb/{ => core}/usb_ohci.c            |    2 +-
 drivers/usb/{ => core}/usbdcore.c            |    2 +-
 drivers/usb/{ => gadget}/Makefile            |   19 +------------------
 drivers/usb/{ => gadget}/usbdcore_ep0.c      |    2 +-
 drivers/usb/{ => gadget}/usbdcore_mpc8xx.c   |    4 ++--
 drivers/usb/{ => gadget}/usbdcore_omap1510.c |    4 ++--
 drivers/usb/{ => host}/Makefile              |   15 +--------------
 drivers/usb/{ => host}/davinci_usb.c         |    0
 drivers/usb/{ => host}/davinci_usb.h         |    0
 drivers/usb/{ => host}/isp116x-hcd.c         |    0
 drivers/usb/{ => host}/isp116x.h             |    0
 drivers/usb/{ => host}/musb_core.c           |    0
 drivers/usb/{ => host}/musb_core.h           |    0
 drivers/usb/{ => host}/musb_hcd.c            |    0
 drivers/usb/{ => host}/musb_hcd.h            |    0
 drivers/usb/{ => host}/r8a66597-hcd.c        |    0
 drivers/usb/{ => host}/r8a66597.h            |    0
 drivers/usb/{ => host}/sl811.h               |    0
 drivers/usb/{ => host}/sl811_usb.c           |    2 +-
 drivers/usb/{ => host}/usb_ehci_fsl.c        |    5 ++---
 drivers/usb/{ => host}/usb_ehci_fsl.h        |    0
 drivers/usb/{ => host}/usb_ehci_ixp.c        |    4 ++--
 drivers/usb/{ => host}/usb_ehci_pci.c        |    4 ++--
 drivers/usb/{ => host}/usb_ehci_vct.c        |    5 ++---
 {drivers/usb => include}/usb_ehci.h          |    0
 {drivers/usb => include}/usb_ehci_core.h     |    0
 {drivers/usb => include}/usb_ohci.h          |    0
 30 files changed, 23 insertions(+), 73 deletions(-)
 copy drivers/usb/{ => core}/Makefile (67%)
 rename drivers/usb/{ => core}/usb_ehci_core.c (99%)
 rename drivers/usb/{ => core}/usb_ohci.c (99%)
 rename drivers/usb/{ => core}/usbdcore.c (99%)
 copy drivers/usb/{ => gadget}/Makefile (71%)
 rename drivers/usb/{ => gadget}/usbdcore_ep0.c (99%)
 rename drivers/usb/{ => gadget}/usbdcore_mpc8xx.c (99%)
 rename drivers/usb/{ => gadget}/usbdcore_omap1510.c (99%)
 rename drivers/usb/{ => host}/Makefile (82%)
 rename drivers/usb/{ => host}/davinci_usb.c (100%)
 rename drivers/usb/{ => host}/davinci_usb.h (100%)
 rename drivers/usb/{ => host}/isp116x-hcd.c (100%)
 rename drivers/usb/{ => host}/isp116x.h (100%)
 rename drivers/usb/{ => host}/musb_core.c (100%)
 rename drivers/usb/{ => host}/musb_core.h (100%)
 rename drivers/usb/{ => host}/musb_hcd.c (100%)
 rename drivers/usb/{ => host}/musb_hcd.h (100%)
 rename drivers/usb/{ => host}/r8a66597-hcd.c (100%)
 rename drivers/usb/{ => host}/r8a66597.h (100%)
 rename drivers/usb/{ => host}/sl811.h (100%)
 rename drivers/usb/{ => host}/sl811_usb.c (99%)
 rename drivers/usb/{ => host}/usb_ehci_fsl.c (98%)
 rename drivers/usb/{ => host}/usb_ehci_fsl.h (100%)
 rename drivers/usb/{ => host}/usb_ehci_ixp.c (96%)
 rename drivers/usb/{ => host}/usb_ehci_pci.c (97%)
 rename drivers/usb/{ => host}/usb_ehci_vct.c (96%)
 rename {drivers/usb => include}/usb_ehci.h (100%)
 rename {drivers/usb => include}/usb_ehci_core.h (100%)
 rename {drivers/usb => include}/usb_ohci.h (100%)

diff --git a/Makefile b/Makefile
index 1cce381..cad21ac 100644
--- a/Makefile
+++ b/Makefile
@@ -262,7 +262,9 @@ TAG_SUBDIRS += cpu/mpc8xxx
 endif
 LIBS += drivers/rtc/librtc.a
 LIBS += drivers/serial/libserial.a
-LIBS += drivers/usb/libusb.a
+LIBS += drivers/usb/core/libusb_core.a
+LIBS += drivers/usb/gadget/libusb_gadget.a
+LIBS += drivers/usb/host/libusb_host.a
 LIBS += drivers/video/libvideo.a
 LIBS += common/libcommon.a
 LIBS += libfdt/libfdt.a
diff --git a/drivers/usb/Makefile b/drivers/usb/core/Makefile
similarity index 67%
copy from drivers/usb/Makefile
copy to drivers/usb/core/Makefile
index b306a65..249da4b 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/core/Makefile
@@ -23,32 +23,12 @@
 
 include $(TOPDIR)/config.mk
 
-LIB	:= $(obj)libusb.a
+LIB	:= $(obj)libusb_core.a
 
-# core
 COBJS-y += usbdcore.o
 COBJS-$(CONFIG_USB_OHCI_NEW) += usb_ohci.o
 COBJS-$(CONFIG_USB_EHCI) += usb_ehci_core.o
 
-# host
-COBJS-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
-COBJS-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o
-COBJS-$(CONFIG_USB_SL811HS) += sl811_usb.o
-COBJS-$(CONFIG_USB_EHCI_FSL) += usb_ehci_fsl.o
-COBJS-$(CONFIG_USB_EHCI_PCI) += usb_ehci_pci.o
-COBJS-$(CONFIG_USB_EHCI_IXP4XX) += usb_ehci_ixp.o
-COBJS-$(CONFIG_MUSB_HCD) += musb_hcd.o musb_core.o
-COBJS-$(CONFIG_USB_DAVINCI) += davinci_usb.o
-COBJS-$(CONFIG_USB_EHCI_VCT) += usb_ehci_vct.o
-
-# device
-ifdef CONFIG_USB_DEVICE
-COBJS-y += usbdcore_ep0.o
-COBJS-$(CONFIG_OMAP1510) += usbdcore_omap1510.o
-COBJS-$(CONFIG_OMAP1610) += usbdcore_omap1510.o
-COBJS-$(CONFIG_MPC885_FAMILY) += usbdcore_mpc8xx.o
-endif
-
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
diff --git a/drivers/usb/usb_ehci_core.c b/drivers/usb/core/usb_ehci_core.c
similarity index 99%
rename from drivers/usb/usb_ehci_core.c
rename to drivers/usb/core/usb_ehci_core.c
index 4dbfb66..081622b 100644
--- a/drivers/usb/usb_ehci_core.c
+++ b/drivers/usb/core/usb_ehci_core.c
@@ -25,7 +25,7 @@
 #include <usb.h>
 #include <asm/io.h>
 #include <malloc.h>
-#include "usb_ehci.h"
+#include <usb_ehci.h>
 
 int rootdev;
 struct ehci_hccr *hccr;	/* R/O registers, not need for volatile */
diff --git a/drivers/usb/usb_ohci.c b/drivers/usb/core/usb_ohci.c
similarity index 99%
rename from drivers/usb/usb_ohci.c
rename to drivers/usb/core/usb_ohci.c
index 0bbee0f..464dbe2 100644
--- a/drivers/usb/usb_ohci.c
+++ b/drivers/usb/core/usb_ohci.c
@@ -57,7 +57,7 @@
 
 #include <malloc.h>
 #include <usb.h>
-#include "usb_ohci.h"
+#include <usb_ohci.h>
 
 #ifdef CONFIG_AT91RM9200
 #include <asm/arch/hardware.h>	/* needed for AT91_USB_HOST_BASE */
diff --git a/drivers/usb/usbdcore.c b/drivers/usb/core/usbdcore.c
similarity index 99%
rename from drivers/usb/usbdcore.c
rename to drivers/usb/core/usbdcore.c
index 53ed669..7955096 100644
--- a/drivers/usb/usbdcore.c
+++ b/drivers/usb/core/usbdcore.c
@@ -30,7 +30,7 @@
  */
 
 #include <malloc.h>
-#include "usbdcore.h"
+#include <usbdcore.h>
 
 #define MAX_INTERFACES 2
 
diff --git a/drivers/usb/Makefile b/drivers/usb/gadget/Makefile
similarity index 71%
copy from drivers/usb/Makefile
copy to drivers/usb/gadget/Makefile
index b306a65..933eac9 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -23,25 +23,8 @@
 
 include $(TOPDIR)/config.mk
 
-LIB	:= $(obj)libusb.a
+LIB	:= $(obj)libusb_gadget.a
 
-# core
-COBJS-y += usbdcore.o
-COBJS-$(CONFIG_USB_OHCI_NEW) += usb_ohci.o
-COBJS-$(CONFIG_USB_EHCI) += usb_ehci_core.o
-
-# host
-COBJS-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
-COBJS-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o
-COBJS-$(CONFIG_USB_SL811HS) += sl811_usb.o
-COBJS-$(CONFIG_USB_EHCI_FSL) += usb_ehci_fsl.o
-COBJS-$(CONFIG_USB_EHCI_PCI) += usb_ehci_pci.o
-COBJS-$(CONFIG_USB_EHCI_IXP4XX) += usb_ehci_ixp.o
-COBJS-$(CONFIG_MUSB_HCD) += musb_hcd.o musb_core.o
-COBJS-$(CONFIG_USB_DAVINCI) += davinci_usb.o
-COBJS-$(CONFIG_USB_EHCI_VCT) += usb_ehci_vct.o
-
-# device
 ifdef CONFIG_USB_DEVICE
 COBJS-y += usbdcore_ep0.o
 COBJS-$(CONFIG_OMAP1510) += usbdcore_omap1510.o
diff --git a/drivers/usb/usbdcore_ep0.c b/drivers/usb/gadget/usbdcore_ep0.c
similarity index 99%
rename from drivers/usb/usbdcore_ep0.c
rename to drivers/usb/gadget/usbdcore_ep0.c
index f6e017d..a1a117d 100644
--- a/drivers/usb/usbdcore_ep0.c
+++ b/drivers/usb/gadget/usbdcore_ep0.c
@@ -51,7 +51,7 @@
  */
 
 #include <common.h>
-#include "usbdcore.h"
+#include <usbdcore.h>
 
 #if 0
 #define dbg_ep0(lvl,fmt,args...) serial_printf("[%s] %s:%d: "fmt"\n",__FILE__,__FUNCTION__,__LINE__,##args)
diff --git a/drivers/usb/usbdcore_mpc8xx.c b/drivers/usb/gadget/usbdcore_mpc8xx.c
similarity index 99%
rename from drivers/usb/usbdcore_mpc8xx.c
rename to drivers/usb/gadget/usbdcore_mpc8xx.c
index 0e311ad..e2439cd 100644
--- a/drivers/usb/usbdcore_mpc8xx.c
+++ b/drivers/usb/gadget/usbdcore_mpc8xx.c
@@ -59,9 +59,9 @@
 #include <common.h>
 #include <config.h>
 #include <commproc.h>
-#include "usbdcore.h"
+#include <usbdcore.h>
 #include "usbdcore_mpc8xx.h"
-#include "usbdcore_ep0.h"
+#include <usbdcore_ep0.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/usb/usbdcore_omap1510.c b/drivers/usb/gadget/usbdcore_omap1510.c
similarity index 99%
rename from drivers/usb/usbdcore_omap1510.c
rename to drivers/usb/gadget/usbdcore_omap1510.c
index 6b7b61b..4fb6cc5 100644
--- a/drivers/usb/usbdcore_omap1510.c
+++ b/drivers/usb/gadget/usbdcore_omap1510.c
@@ -32,9 +32,9 @@
 #include <i2c.h>
 #endif
 
-#include "usbdcore.h"
+#include <usbdcore.h>
 #include "usbdcore_omap1510.h"
-#include "usbdcore_ep0.h"
+#include <usbdcore_ep0.h>
 
 
 #define UDC_INIT_MDELAY		     80 /* Device settle delay */
diff --git a/drivers/usb/Makefile b/drivers/usb/host/Makefile
similarity index 82%
rename from drivers/usb/Makefile
rename to drivers/usb/host/Makefile
index b306a65..240bc36 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/host/Makefile
@@ -23,12 +23,7 @@
 
 include $(TOPDIR)/config.mk
 
-LIB	:= $(obj)libusb.a
-
-# core
-COBJS-y += usbdcore.o
-COBJS-$(CONFIG_USB_OHCI_NEW) += usb_ohci.o
-COBJS-$(CONFIG_USB_EHCI) += usb_ehci_core.o
+LIB	:= $(obj)libusb_host.a
 
 # host
 COBJS-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
@@ -41,14 +36,6 @@ COBJS-$(CONFIG_MUSB_HCD) += musb_hcd.o musb_core.o
 COBJS-$(CONFIG_USB_DAVINCI) += davinci_usb.o
 COBJS-$(CONFIG_USB_EHCI_VCT) += usb_ehci_vct.o
 
-# device
-ifdef CONFIG_USB_DEVICE
-COBJS-y += usbdcore_ep0.o
-COBJS-$(CONFIG_OMAP1510) += usbdcore_omap1510.o
-COBJS-$(CONFIG_OMAP1610) += usbdcore_omap1510.o
-COBJS-$(CONFIG_MPC885_FAMILY) += usbdcore_mpc8xx.o
-endif
-
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))
diff --git a/drivers/usb/davinci_usb.c b/drivers/usb/host/davinci_usb.c
similarity index 100%
rename from drivers/usb/davinci_usb.c
rename to drivers/usb/host/davinci_usb.c
diff --git a/drivers/usb/davinci_usb.h b/drivers/usb/host/davinci_usb.h
similarity index 100%
rename from drivers/usb/davinci_usb.h
rename to drivers/usb/host/davinci_usb.h
diff --git a/drivers/usb/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
similarity index 100%
rename from drivers/usb/isp116x-hcd.c
rename to drivers/usb/host/isp116x-hcd.c
diff --git a/drivers/usb/isp116x.h b/drivers/usb/host/isp116x.h
similarity index 100%
rename from drivers/usb/isp116x.h
rename to drivers/usb/host/isp116x.h
diff --git a/drivers/usb/musb_core.c b/drivers/usb/host/musb_core.c
similarity index 100%
rename from drivers/usb/musb_core.c
rename to drivers/usb/host/musb_core.c
diff --git a/drivers/usb/musb_core.h b/drivers/usb/host/musb_core.h
similarity index 100%
rename from drivers/usb/musb_core.h
rename to drivers/usb/host/musb_core.h
diff --git a/drivers/usb/musb_hcd.c b/drivers/usb/host/musb_hcd.c
similarity index 100%
rename from drivers/usb/musb_hcd.c
rename to drivers/usb/host/musb_hcd.c
diff --git a/drivers/usb/musb_hcd.h b/drivers/usb/host/musb_hcd.h
similarity index 100%
rename from drivers/usb/musb_hcd.h
rename to drivers/usb/host/musb_hcd.h
diff --git a/drivers/usb/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
similarity index 100%
rename from drivers/usb/r8a66597-hcd.c
rename to drivers/usb/host/r8a66597-hcd.c
diff --git a/drivers/usb/r8a66597.h b/drivers/usb/host/r8a66597.h
similarity index 100%
rename from drivers/usb/r8a66597.h
rename to drivers/usb/host/r8a66597.h
diff --git a/drivers/usb/sl811.h b/drivers/usb/host/sl811.h
similarity index 100%
rename from drivers/usb/sl811.h
rename to drivers/usb/host/sl811.h
diff --git a/drivers/usb/sl811_usb.c b/drivers/usb/host/sl811_usb.c
similarity index 99%
rename from drivers/usb/sl811_usb.c
rename to drivers/usb/host/sl811_usb.c
index a03e469..82a8b36 100644
--- a/drivers/usb/sl811_usb.c
+++ b/drivers/usb/host/sl811_usb.c
@@ -40,7 +40,7 @@
 #include <usb.h>
 #include "sl811.h"
 
-#include "../../board/kup/common/kup.h"
+#include "../../../board/kup/common/kup.h"
 
 #ifdef __PPC__
 # define EIEIO		__asm__ volatile ("eieio")
diff --git a/drivers/usb/usb_ehci_fsl.c b/drivers/usb/host/usb_ehci_fsl.c
similarity index 98%
rename from drivers/usb/usb_ehci_fsl.c
rename to drivers/usb/host/usb_ehci_fsl.c
index 81d5d21..866a83d 100644
--- a/drivers/usb/usb_ehci_fsl.c
+++ b/drivers/usb/host/usb_ehci_fsl.c
@@ -25,10 +25,9 @@
 #include <mpc83xx.h>
 #include <asm/io.h>
 #include <asm/bitops.h>
-
-#include "usb_ehci.h"
+#include <usb_ehci.h>
 #include "usb_ehci_fsl.h"
-#include "usb_ehci_core.h"
+#include <usb_ehci_core.h>
 
 /*
  * Create the appropriate control structures to manage
diff --git a/drivers/usb/usb_ehci_fsl.h b/drivers/usb/host/usb_ehci_fsl.h
similarity index 100%
rename from drivers/usb/usb_ehci_fsl.h
rename to drivers/usb/host/usb_ehci_fsl.h
diff --git a/drivers/usb/usb_ehci_ixp.c b/drivers/usb/host/usb_ehci_ixp.c
similarity index 96%
rename from drivers/usb/usb_ehci_ixp.c
rename to drivers/usb/host/usb_ehci_ixp.c
index 25c18c1..f6d1d02 100644
--- a/drivers/usb/usb_ehci_ixp.c
+++ b/drivers/usb/host/usb_ehci_ixp.c
@@ -21,8 +21,8 @@
  */
 #include <common.h>
 #include <usb.h>
-#include "usb_ehci.h"
-#include "usb_ehci_core.h"
+#include <usb_ehci.h>
+#include <usb_ehci_core.h>
 /*
  * Create the appropriate control structures to manage
  * a new EHCI host controller.
diff --git a/drivers/usb/usb_ehci_pci.c b/drivers/usb/host/usb_ehci_pci.c
similarity index 97%
rename from drivers/usb/usb_ehci_pci.c
rename to drivers/usb/host/usb_ehci_pci.c
index 3e7143c..64ca3df 100644
--- a/drivers/usb/usb_ehci_pci.c
+++ b/drivers/usb/host/usb_ehci_pci.c
@@ -21,8 +21,8 @@
 #include <common.h>
 #include <pci.h>
 #include <usb.h>
-#include "usb_ehci.h"
-#include "usb_ehci_core.h"
+#include <usb_ehci.h>
+#include <usb_ehci_core.h>
 
 #ifdef CONFIG_PCI_EHCI_DEVICE
 static struct pci_device_id ehci_pci_ids[] = {
diff --git a/drivers/usb/usb_ehci_vct.c b/drivers/usb/host/usb_ehci_vct.c
similarity index 96%
rename from drivers/usb/usb_ehci_vct.c
rename to drivers/usb/host/usb_ehci_vct.c
index 89daaaf..769b4b2 100644
--- a/drivers/usb/usb_ehci_vct.c
+++ b/drivers/usb/host/usb_ehci_vct.c
@@ -19,9 +19,8 @@
 
 #include <common.h>
 #include <usb.h>
-
-#include "usb_ehci.h"
-#include "usb_ehci_core.h"
+#include <usb_ehci.h>
+#include <usb_ehci_core.h>
 
 int vct_ehci_hcd_init(u32 *hccr, u32 *hcor);
 
diff --git a/drivers/usb/usb_ehci.h b/include/usb_ehci.h
similarity index 100%
rename from drivers/usb/usb_ehci.h
rename to include/usb_ehci.h
diff --git a/drivers/usb/usb_ehci_core.h b/include/usb_ehci_core.h
similarity index 100%
rename from drivers/usb/usb_ehci_core.h
rename to include/usb_ehci_core.h
diff --git a/drivers/usb/usb_ohci.h b/include/usb_ohci.h
similarity index 100%
rename from drivers/usb/usb_ohci.h
rename to include/usb_ohci.h
-- 
1.6.1.3



More information about the U-Boot mailing list