at91: USB gadget subsystem cleanup and driver fix.

Signed-off-by: Owen Kirby <osk@exegin.com>

SVN-Revision: 44491
master
John Crispin 10 years ago
parent 6fb59689c6
commit 3cf87e67b2
  1. 4
      target/linux/at91/Makefile
  2. 8
      target/linux/at91/config-default
  3. 18
      target/linux/at91/modules.mk
  4. 2
      target/linux/at91/patches/100-ARM-at91-build-dtb-for-LMU5000.patch
  5. 82
      target/linux/at91/patches/200-ARM-at91-udc-clockfix-backport.patch

@ -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))

@ -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

@ -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

@ -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

@ -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;
}
Loading…
Cancel
Save