at91: USB gadget subsystem cleanup and driver fix.
authorJohn Crispin <john@openwrt.org>
Thu, 19 Feb 2015 09:06:56 +0000 (09:06 +0000)
committerJohn Crispin <john@openwrt.org>
Thu, 19 Feb 2015 09:06:56 +0000 (09:06 +0000)
Signed-off-by: Owen Kirby <osk@exegin.com>
SVN-Revision: 44491

target/linux/at91/Makefile
target/linux/at91/config-default
target/linux/at91/modules.mk
target/linux/at91/patches/100-ARM-at91-build-dtb-for-LMU5000.patch
target/linux/at91/patches/200-ARM-at91-udc-clockfix-backport.patch [new file with mode: 0644]

index 040df33300285b359c496c5e550f6f6fd26cd800..e1c771adbcbae8c847d7b3c3c7fe3b2612c0114f 100644 (file)
@@ -10,13 +10,13 @@ ARCH:=arm
 BOARD:=at91
 MAINTAINER:=Claudio Mignanti <c.mignanti@gmail.com>
 BOARDNAME:=Atmel AT91
-FEATURES:=squashfs targz ext2 usb
+FEATURES:=squashfs targz ext2 usb usbgadget ubifs
 SUBTARGETS:=legacy sama5d3
 
 KERNEL_PATCHVER:=3.18
 
 include $(INCLUDE_DIR)/target.mk
 
-DEFAULT_PACKAGES += kmod-usb-ohci
+DEFAULT_PACKAGES += kmod-usb-ohci kmod-at91-udc kmod-usb-eth-gadget
 
 $(eval $(call BuildTarget))
index 6972e806b5fb445f4f14d9caea0425799b16f271..85cacd833138579fa85d39daf0e603356377ad54 100644 (file)
@@ -215,15 +215,7 @@ CONFIG_UID16=y
 CONFIG_UIDGID_CONVERTED=y
 CONFIG_UNCOMPRESS_INCLUDE="mach/uncompress.h"
 # CONFIG_USB_ARCH_HAS_XHCI is not set
-CONFIG_USB_AT91=y
 # CONFIG_USB_ATMEL_USBA is not set
-CONFIG_USB_COMMON=y
-CONFIG_USB_ETH=y
-# CONFIG_USB_ETH_EEM is not set
-CONFIG_USB_ETH_RNDIS=y
-CONFIG_USB_GADGET=y
-# CONFIG_USB_GADGET_XILINX is not set
-CONFIG_USB_LIBCOMPOSITE=y
 CONFIG_USB_SUPPORT=y
 CONFIG_USE_OF=y
 CONFIG_VECTORS_BASE=0xffff0000
index 7f98233eb52e1e2ba225003764870cfdde05860e..6cfc3e4074002157dc1fd7ca711d44c8d0acac81 100644 (file)
@@ -50,6 +50,24 @@ endef
 
 $(eval $(call KernelPackage,at91-adc))
 
+define KernelPackage/at91-udc
+  SUBMENU:=$(USB_MENU)
+  TITLE:=USB Device Controller on atmel SoC
+  DEPENDS:=@TARGET_at91 +kmod-usb-gadget
+  KCONFIG:=CONFIG_USB_AT91
+ifneq ($(wildcard $(LINUX_DIR)/drivers/usb/gadget/udc/at91_udc.ko),)
+  FILES:=$(LINUX_DIR)/drivers/usb/gadget/udc/at91_udc.ko
+else
+  FILES:=$(LINUX_DIR)/drivers/usb/gadget/at91_udc.ko
+endif
+  AUTOLOAD:=$(call AutoLoad,51,at91_udc)
+endef
+
+define KernelPackage/at91-adc/description
+ Kernel module to use the USB Device controller for Atmel AT91
+endef
+
+$(eval $(call KernelPackage,at91-udc))
 
 I2C_AT91_MODULES:=\
   CONFIG_I2C_AT91:drivers/i2c/busses/i2c-at91
index e8cc68d13dcceca8878bd3c3bb06e7a074ca1d44..8852b6a4f04e305dbb07c415073863c5e6215015 100644 (file)
@@ -1,6 +1,6 @@
 --- a/arch/arm/boot/dts/Makefile
 +++ b/arch/arm/boot/dts/Makefile
-@@ -26,6 +26,7 @@ dtb-$(CONFIG_ARCH_AT91) += usb_a9g20.dtb
+@@ -28,6 +28,7 @@ dtb-$(CONFIG_ARCH_AT91) += usb_a9g20.dtb
  dtb-$(CONFIG_ARCH_AT91) += usb_a9g20_lpw.dtb
  # sam9g45
  dtb-$(CONFIG_ARCH_AT91) += at91sam9m10g45ek.dtb
diff --git a/target/linux/at91/patches/200-ARM-at91-udc-clockfix-backport.patch b/target/linux/at91/patches/200-ARM-at91-udc-clockfix-backport.patch
new file mode 100644 (file)
index 0000000..1aec3d0
--- /dev/null
@@ -0,0 +1,82 @@
+--- a/drivers/usb/gadget/udc/at91_udc.c
++++ b/drivers/usb/gadget/udc/at91_udc.c
+@@ -870,8 +870,6 @@
+               return;
+       udc->clocked = 1;
+-      if (IS_ENABLED(CONFIG_COMMON_CLK))
+-              clk_enable(udc->uclk);
+       clk_enable(udc->iclk);
+       clk_enable(udc->fclk);
+ }
+@@ -884,8 +882,6 @@
+       udc->gadget.speed = USB_SPEED_UNKNOWN;
+       clk_disable(udc->fclk);
+       clk_disable(udc->iclk);
+-      if (IS_ENABLED(CONFIG_COMMON_CLK))
+-              clk_disable(udc->uclk);
+ }
+ /*
+@@ -1766,27 +1762,18 @@
+       udc_reinit(udc);
+       /* get interface and function clocks */
+-      udc->iclk = clk_get(dev, "udc_clk");
+-      udc->fclk = clk_get(dev, "udpck");
+-      if (IS_ENABLED(CONFIG_COMMON_CLK))
+-              udc->uclk = clk_get(dev, "usb_clk");
+-      if (IS_ERR(udc->iclk) || IS_ERR(udc->fclk) ||
+-          (IS_ENABLED(CONFIG_COMMON_CLK) && IS_ERR(udc->uclk))) {
++      udc->iclk = clk_get(dev, "pclk");
++      udc->fclk = clk_get(dev, "hclk");
++      if (IS_ERR(udc->iclk) || IS_ERR(udc->fclk)) {
+               DBG("clocks missing\n");
+               retval = -ENODEV;
+               goto fail1;
+       }
+-      /* don't do anything until we have both gadget driver and VBUS */
+-      if (IS_ENABLED(CONFIG_COMMON_CLK)) {
+-              clk_set_rate(udc->uclk, 48000000);
+-              retval = clk_prepare(udc->uclk);
+-              if (retval)
+-                      goto fail1;
+-      }
++      clk_set_rate(udc->fclk, 48000000);
+       retval = clk_prepare(udc->fclk);
+       if (retval)
+-              goto fail1a;
++              goto fail1;
+       retval = clk_prepare_enable(udc->iclk);
+       if (retval)
+@@ -1860,12 +1847,7 @@
+       clk_unprepare(udc->iclk);
+ fail1b:
+       clk_unprepare(udc->fclk);
+-fail1a:
+-      if (IS_ENABLED(CONFIG_COMMON_CLK))
+-              clk_unprepare(udc->uclk);
+ fail1:
+-      if (IS_ENABLED(CONFIG_COMMON_CLK) && !IS_ERR(udc->uclk))
+-              clk_put(udc->uclk);
+       if (!IS_ERR(udc->fclk))
+               clk_put(udc->fclk);
+       if (!IS_ERR(udc->iclk))
+@@ -1911,15 +1893,11 @@
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       release_mem_region(res->start, resource_size(res));
+-      if (IS_ENABLED(CONFIG_COMMON_CLK))
+-              clk_unprepare(udc->uclk);
+       clk_unprepare(udc->fclk);
+       clk_unprepare(udc->iclk);
+       clk_put(udc->iclk);
+       clk_put(udc->fclk);
+-      if (IS_ENABLED(CONFIG_COMMON_CLK))
+-              clk_put(udc->uclk);
+       return 0;
+ }