Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

K70: KHCI USB-FS driver implementation for device mode #6

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions arch/arm/mach-kinetis/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,15 @@ config KINETIS_SPI2
bool "Enable Kinetis SPI2"
default n

config KINETIS_USBFS
depends on ARCH_KINETIS && KINETIS_NO_IDLE_SLEEP
bool "Enable Kinetis USB-FS"
default n

config KINETIS_NO_IDLE_SLEEP
depends on ARCH_KINETIS
bool "Do not sleep in Idle state"
default y

endmenu

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-kinetis/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ obj-$(CONFIG_KINETIS_FB) += fb.o
obj-$(CONFIG_I2C_GPIO) += i2c-gpio.o
obj-$(CONFIG_KINETIS_EDMA) += dmainit.o dmac.o
obj-$(CONFIG_USB_EHCI_MXC) += ehci.o
obj-$(CONFIG_USB_KHCI_HCD) += khci.o
obj-$(CONFIG_KINETIS_USBFS) += khci.o
obj-$(CONFIG_KINETIS_SPI_GPIO) += spi-gpio.o
obj-$(CONFIG_GPIOLIB) += gpio.o
obj-$(CONFIG_MMC_ESDHC) += esdhc.o
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-kinetis/kinetis_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ static void __init kinetis_init(void)
kinetis_ehci_init();
#endif

#if defined(CONFIG_USB_KHCI_HCD)
#if defined(CONFIG_KINETIS_USBFS)
/*
* Configure the Freescale Kinetis USB Full Speed controller
*/
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mm/proc-v7m.S
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ ENDPROC(cpu_v7m_reset)
*/
ENTRY(cpu_v7m_do_idle)
dsb @ WFI may enter a low-power mode
#if !defined(CONFIG_ARCH_M2S)
#if !defined(CONFIG_ARCH_M2S) && !defined(CONFIG_KINETIS_NO_IDLE_SLEEP)
wfi
#endif
mov pc, lr
Expand Down
14 changes: 14 additions & 0 deletions drivers/usb/gadget/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,20 @@ config USB_S3C_HSOTG
default USB_GADGET
select USB_GADGET_SELECTED

config USB_GADGET_KHCI_GCD
boolean "Freescale KHCI (USB-FS) Device controller"
depends on KINETIS_USBFS
help
The Freescale KHCI controllers are dual-role host/peripheral/OTG
USB controllers implemented in Kinetis (K70,K60,...) processors,
and in some Coldfire (MCF52259,...) processors.

config USB_KHCI_GCD
tristate
depends on USB_GADGET_KHCI_GCD
default USB_GADGET
select USB_GADGET_SELECTED

config USB_GADGET_IMX
boolean "Freescale IMX USB Peripheral Controller"
depends on ARCH_MX1
Expand Down
3 changes: 2 additions & 1 deletion drivers/usb/gadget/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ obj-$(CONFIG_USB_FSL_QE) += fsl_qe_udc.o
obj-$(CONFIG_USB_CI13XXX) += ci13xxx_udc.o
obj-$(CONFIG_USB_S3C_HSOTG) += s3c-hsotg.o
obj-$(CONFIG_USB_LANGWELL) += langwell_udc.o

obj-$(CONFIG_USB_KHCI_GCD) += fsl_khci_udc.o
CFLAGS_fsl_khci_udc.o = -O0
#
# USB gadget drivers
#
Expand Down
5 changes: 3 additions & 2 deletions drivers/usb/gadget/f_mass_storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,9 @@ static int fsg_setup(struct usb_function *f,
return -EDOM;
VDBG(fsg, "get max LUN\n");
*(u8 *) req->buf = fsg->common->nluns - 1;
return 1;
/* Backport from current kernel: queue req here */
req->length = min((u16)1, w_length);
return ep0_queue(fsg->common);
}

VDBG(fsg,
Expand Down Expand Up @@ -2530,7 +2532,6 @@ static void handle_exception(struct fsg_common *common)
DBG(common, "ep0 set halt\n");
usb_ep_set_halt(common->ep0);
} else { /* Complete the status stage */
ep0_queue(common);
}
break;

Expand Down
Loading