Add MSM USB Host Controller support
Subsystems (3)
cover Add MSM USB Host Controller support
This patch series adds support for EHCI compliant High speed USB host controller found in MSM family of SOCs. HCD depends on OTG driver for PHY initialization, clock management and powering up VBUS. So OTG driver is added in the patch series. These patches depends on "Add MSM USB Device Controller" series for header files. These patches are tested against v2.6.37-rc1
Pavankumar Kondeti (4):
USB: Add MSM OTG Controller driver
USB: EHCI: Add MSM Host Controller driver
USB: EHCI: msm: Add support for power management
USB: OTG: msm: Add spport for power management
drivers/usb/Kconfig | 1 + drivers/usb/host/Kconfig | 12 + drivers/usb/host/ehci-hcd.c | 5 + drivers/usb/host/ehci-msm.c | 373 ++++++++++++++ drivers/usb/otg/Kconfig | 11 + drivers/usb/otg/Makefile | 1 + drivers/usb/otg/msm72k_otg.c | 995 ++++++++++++++++++++++++++++++++++++++ include/linux/usb/msm_hsusb.h | 89 ++++ include/linux/usb/msm_hsusb_hw.h | 12 + 9 files changed, 1499 insertions(+), 0 deletions(-) create mode 100644 drivers/usb/host/ehci-msm.c create mode 100644 drivers/usb/otg/msm72k_otg.c
PATCH 1/4 USB: Add MSM OTG Controller driver
This driver implements PHY initialization, clock management, memory mapping register address space, ULPI IO ops and simple OTG state machine to kick host/peripheral based on Id/VBUS line status. VBUS/Id lines are tied to a reference voltage on some boards. Hence provide a sysfs interface to select host/peripheral mode.
--- drivers/usb/otg/Kconfig | 11 + drivers/usb/otg/Makefile | 1 + drivers/usb/otg/msm72k_otg.c | 724 ++++++++++++++++++++++++++++++++++++++ include/linux/usb/msm_hsusb.h | 85 +++++ include/linux/usb/msm_hsusb_hw.h | 9 + 5 files changed, 830 insertions(+), 0 deletions(-) create mode 100644 drivers/usb/otg/msm72k_otg.c
drivers/usb/otg/Kconfig +11 -0
@@ -81,4 +81,15 @@ config USB_LANGWELL_OTG To compile this driver as a module, choose M here: the module will be called langwell_otg. +config USB_MSM_OTG_72K + tristate "OTG support for Qualcomm on-chip USB controller" + depends on ARCH_MSM + select USB_OTG_UTILS + help + Enable this to support the USB OTG transceiver on MSM chips. It + handles PHY initialization, clock management, memory mapping of + register address space and workarounds required after resetting + the hardware. This driver is required for even peripheral only + or host only mode configuration. + endif # USB || OTG
drivers/usb/otg/Makefile +1 -0
@@ -15,3 +15,4 @@ obj-$(CONFIG_TWL4030_USB) += twl4030-usb.o obj-$(CONFIG_USB_LANGWELL_OTG) += langwell_otg.o obj-$(CONFIG_NOP_USB_XCEIV) += nop-usb-xceiv.o obj-$(CONFIG_USB_ULPI) += ulpi.o +obj-$(CONFIG_USB_MSM_OTG_72K) += msm72k_otg.o
drivers/usb/otg/msm72k_otg.c new file +724 -0
724 lines not on this page · raw message
include/linux/usb/msm_hsusb.h +85 -0
101 lines not on this page · raw message
include/linux/usb/msm_hsusb_hw.h +9 -0
@@ -195,4 +195,13 @@ struct ept_queue_item {#define PORTSC_LS (3 << 10)/* Read - Port's Line status */ #define PORTSC_PHCD (1 << 23)/* phy suspend mode */ +/* OTG definitions */ +#define OTGSC_INTSTS_MASK (0x7f << 16) +#define OTGSC_ID (1 << 8) +#define OTGSC_BSV (1 << 11) +#define OTGSC_IDIS (1 << 16) +#define OTGSC_BSVIS (1 << 19) +#define OTGSC_IDIE (1 << 24) +#define OTGSC_BSVIE (1 << 27) +#endif /* __LINUX_USB_GADGET_MSM72K_UDC_H__ */
Signature · 5 lines
1.7.1 -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Re: [PATCH 1/4] USB: Add MSM OTG Controller driver
Quoted 5 lines · Pavankumar Kondeti
This driver implements PHY initialization, clock management, memory mapping register address space, ULPI IO ops and simple OTG state machine to kick host/peripheral based on Id/VBUS line status. VBUS/Id lines are tied to a reference voltage on some boards. Hence provide a sysfs interface to select host/peripheral mode.
As you are creating a new user/kernel abi, it MUST be documented in the Documentation/ABI/ directory. I can't take this patch set until that happens.
Care to redo this one, and your device patch set based on the review comments there, and resend them?
thanks,
greg k-h
Re: [PATCH 1/4] USB: Add MSM OTG Controller driver
Hi Greg,
Quoted 11 lines · Greg KH
Quoted 5 lines · Pavankumar Kondeti
This driver implements PHY initialization, clock management, memory mapping register address space, ULPI IO ops and simple OTG state machine to kick host/peripheral based on Id/VBUS line status. VBUS/Id lines are tied to a reference voltage on some boards. Hence provide a sysfs interface to select host/peripheral mode.
As you are creating a new user/kernel abi, it MUST be documented in the
Documentation/ABI/directory. I can't take this patch set until that happens.
Thanks for letting me know this. I will add the documentation for the sysfs file.
Quoted 3 lines
Care to redo this one, and your device patch set based on the review comments there, and resend them?
I have been advised to reuse the ci13xxx_udc.c gadget controller driver. The driver currently supports PCI but not platform bus. I am working on making it to support platform bus. I will post RFC patch soon. Meanwhile I am thinking of resending host driver patches (as of now host/otg uses header files of device controller driver). Is this fine?
Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Re: [PATCH 1/4] USB: Add MSM OTG Controller driver
Quoted 10 lines · Pavan Kondeti
Hi Greg,
Quoted 7 lines · Greg KH
Quoted 5 lines · Pavankumar Kondeti
This driver implements PHY initialization, clock management, memory mapping register address space, ULPI IO ops and simple OTG state machine to kick host/peripheral based on Id/VBUS line status. VBUS/Id lines are tied to a reference voltage on some boards. Hence provide a sysfs interface to select host/peripheral mode.
Quoted 5 lines
Quoted 4 lines
As you are creating a new user/kernel abi, it MUST be documented in the
Documentation/ABI/directory. I can't take this patch set until that happens.Thanks for letting me know this. I will add the documentation for the sysfs file.
Also note that if you are adding a new ABI like this one, it needs to work the same for the other existing OTG drivers as well. So please also work to fix them to do the same thing, or change your code to work like the existing drivers do (hint, do the latter one...)
Quoted 8 lines
Quoted 3 lines
Care to redo this one, and your device patch set based on the review comments there, and resend them?
I have been advised to reuse the
ci13xxx_udc.cgadget controller driver. The driver currently supports PCI but not platform bus. I am working on making it to support platform bus. I will post RFC patch soon. Meanwhile I am thinking of resending host driver patches (as of now host/otg uses header files of device controller driver). Is this fine?
Would it make much sense to have the host code in the tree at this point in time due to the other changes you are going to have to do for the gadget controller?
thanks,
greg k-h
Re: [PATCH 1/4] USB: Add MSM OTG Controller driver
Hi Greg,
Quoted 15 lines · Greg KH
Quoted 14 lines · Pavan Kondeti
Hi Greg,
Quoted 11 lines · Greg KH
Quoted 5 lines · Pavankumar Kondeti
This driver implements PHY initialization, clock management, memory mapping register address space, ULPI IO ops and simple OTG state machine to kick host/peripheral based on Id/VBUS line status. VBUS/Id lines are tied to a reference voltage on some boards. Hence provide a sysfs interface to select host/peripheral mode.
As you are creating a new user/kernel abi, it MUST be documented in the
Documentation/ABI/directory. I can't take this patch set until that happens.
Quoted 7 lines
Quoted 1 line
Thanks for letting me know this. I will add the documentation for the sysfs file.
Also note that if you are adding a new ABI like this one, it needs to work the same for the other existing OTG drivers as well. So please also work to fix them to do the same thing, or change your code to work like the existing drivers do (hint, do the latter one...)
I am not sure if other OTG driver require this sysfs file. USB mode i.e Host/Peripheral is changed based on Id/VBUS status. But on some of the MSM boards, Id/VBUS is connected to reference voltage and need an additional sysfs file for user to change the operation mode.
Where should a driver specific sysfs file should go in Doc/ABI/ ?
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines
Care to redo this one, and your device patch set based on the review comments there, and resend them?
I have been advised to reuse the
ci13xxx_udc.cgadget controller driver. The driver currently supports PCI but not platform bus. I am working on making it to support platform bus. I will post RFC patch soon. Meanwhile I am thinking of resending host driver patches (as of now host/otg uses header files of device controller driver). Is this fine?
Quoted 4 lines
Would it make much sense to have the host code in the tree at this point in time due to the other changes you are going to have to do for the gadget controller?
May be, I should wait till gadget controller driver patches are ready to avoid any additional changes in otg driver for supporting gadget.
Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Re: [PATCH 1/4] USB: Add MSM OTG Controller driver
Quoted 18 lines · Pavan Kondeti
Hi Greg,
Quoted 15 lines · Greg KH
Quoted 14 lines · Pavan Kondeti
Hi Greg,
Quoted 11 lines · Greg KH
Quoted 5 lines · Pavankumar Kondeti
This driver implements PHY initialization, clock management, memory mapping register address space, ULPI IO ops and simple OTG state machine to kick host/peripheral based on Id/VBUS line status. VBUS/Id lines are tied to a reference voltage on some boards. Hence provide a sysfs interface to select host/peripheral mode.
As you are creating a new user/kernel abi, it MUST be documented in the
Documentation/ABI/directory. I can't take this patch set until that happens.
Quoted 8 lines
Quoted 7 lines
Quoted 1 line
Thanks for letting me know this. I will add the documentation for the sysfs file.
Also note that if you are adding a new ABI like this one, it needs to work the same for the other existing OTG drivers as well. So please also work to fix them to do the same thing, or change your code to work like the existing drivers do (hint, do the latter one...)
I am not sure if other OTG driver require this sysfs file.
That's the point, why does this driver require something that no other driver does?
Quoted 4 lines
USB mode i.e Host/Peripheral is changed based on Id/VBUS status. But on some of the MSM boards, Id/VBUS is connected to reference voltage and need an additional sysfs file for user to change the operation mode.
Are you sure this should be user selectable? Who is going to do that selection and how is it going to happen "automatically" like OTG is supposed to handle?
Quoted 1 line
Where should a driver specific sysfs file should go in Doc/ABI/ ?
Where all others are, there are lots of examples in that directory, including a README, right? Did you read that and it not explain things sufficiently? If so, please let me know what can be expanded on in that file to make it easier for others in the future.
My main complaint here is that you are creating a brand new kernel/userspace ABI, and you bury it in a driver patch without giving really any warning or description of it at all. This is something that we need to make sure we get correct as you (yes you) will be maintaining it for the next 12+ years. This is not something to do lightly at all, as I'm sure you can imagine.
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 3 lines
Care to redo this one, and your device patch set based on the review comments there, and resend them?
I have been advised to reuse the
ci13xxx_udc.cgadget controller driver. The driver currently supports PCI but not platform bus. I am working on making it to support platform bus. I will post RFC patch soon. Meanwhile I am thinking of resending host driver patches (as of now host/otg uses header files of device controller driver). Is this fine?
Quoted 6 lines
Quoted 4 lines
Would it make much sense to have the host code in the tree at this point in time due to the other changes you are going to have to do for the gadget controller?
May be, I should wait till gadget controller driver patches are ready to avoid any additional changes in otg driver for supporting gadget.
Yes, that sounds like a good idea.
thanks,
greg k-h
Re: [PATCH 1/4] USB: Add MSM OTG Controller driver
Quoted 31 lines · Greg KH
Quoted 18 lines · Pavan Kondeti
Hi Greg,
Quoted 15 lines · Greg KH
Quoted 14 lines · Pavan Kondeti
Hi Greg,
Quoted 11 lines · Greg KH
Quoted 5 lines · Pavankumar Kondeti
This driver implements PHY initialization, clock management, memory mapping register address space, ULPI IO ops and simple OTG state machine to kick host/peripheral based on Id/VBUS line status. VBUS/Id lines are tied to a reference voltage on some boards. Hence provide a sysfs interface to select host/peripheral mode.
As you are creating a new user/kernel abi, it MUST be documented in the
Documentation/ABI/directory. I can't take this patch set until that happens.Quoted 8 lines
Quoted 7 lines
Quoted 1 line
Thanks for letting me know this. I will add the documentation for the sysfs file.
Also note that if you are adding a new ABI like this one, it needs to work the same for the other existing OTG drivers as well. So please also work to fix them to do the same thing, or change your code to work like the existing drivers do (hint, do the latter one...)
I am not sure if other OTG driver require this sysfs file.
That's the point, why does this driver require something that no other driver does?
Quoted 9 lines
Quoted 4 lines
USB mode i.e Host/Peripheral is changed based on Id/VBUS status. But on some of the MSM boards, Id/VBUS is connected to reference voltage and need an additional sysfs file for user to change the operation mode.
Are you sure this should be user selectable? Who is going to do that selection and how is it going to happen "automatically" like OTG is supposed to handle?
The board I am using is a reference board where Id is grounded always. But we use it in peripheral mode for ADB (Android debugging Bridge). So user is going to write into the sysfs file ("host"/"peripheral"/"none"). But this is mainly for debugging/testing purpose.
Quoted 7 lines
Quoted 1 line
Where should a driver specific sysfs file should go in Doc/ABI/ ?
Where all others are, there are lots of examples in that directory, including a README, right? Did you read that and it not explain things sufficiently? If so, please let me know what can be expanded on in that file to make it easier for others in the future.
I have read the README file and it only talks about different levels of stability. I have not looked at examples. After looking at examples I understand that testing/sysfs-driver-usb-msm_otg is the correct file.
Quoted 8 lines
My main complaint here is that you are creating a brand new kernel/userspace ABI, and you bury it in a driver patch without giving really any warning or description of it at all. This is something that we need to make sure we get correct as you (yes you) will be maintaining it for the next 12+ years. This is not something to do lightly at all, as I'm sure you can imagine.
Okay. I understand now. Thanks for the explanation. I should not have used a sysfs file, which creates a new kernel/userspace ABI. I will use debugfs as it is mainly intended for debugging purpose. The only reason I have gone for sysfs is that to have this option available without CONFIG_DEBUGFS.
Quoted 1 line
Signature · 2 lines
Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 2/4 USB: EHCI: Add MSM Host Controller driver
In reply to Pavankumar KondetiThis patch adds support for EHCI compliant HSUSB Host controller found on MSM chips. The root hub has a single port and TT is built into it. This driver depends on OTG driver for PHY initialization, clock management and powering up VBUS.
--- drivers/usb/Kconfig | 1 + drivers/usb/host/Kconfig | 12 ++ drivers/usb/host/ehci-hcd.c | 5 + drivers/usb/host/ehci-msm.c | 294 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 312 insertions(+), 0 deletions(-) create mode 100644 drivers/usb/host/ehci-msm.c
drivers/usb/Kconfig +1 -0
@@ -66,6 +66,7 @@ config USB_ARCH_HAS_EHCI default y if ARCH_AT91SAM9G45 default y if ARCH_MXC default y if ARCH_OMAP3 + default y if ARCH_MSM default PCI # ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface.
drivers/usb/host/Kconfig +12 -0
@@ -133,6 +133,18 @@ config USB_EHCI_MXC ---help--- Variation of ARC USB block used in some Freescale chips. +config USB_EHCI_MSM + bool "Support for MSM on-chip EHCI USB controller" + depends on USB_EHCI_HCD && ARCH_MSM + select USB_EHCI_ROOT_HUB_TT + select USB_MSM_OTG_72K + ---help--- + Enables support for the USB Host controller present on the + Qualcomm chipsets. Root Hub has inbuilt TT. + This driver depends on OTG driver for PHY initialization, + clock management, powering up VBUS and memory mapping of + register address space. + config USB_EHCI_HCD_PPC_OF bool "EHCI support for PPC USB controller on OF platform bus" depends on USB_EHCI_HCD && PPC_OF
drivers/usb/host/ehci-hcd.c +5 -0
@@ -1216,6 +1216,11 @@ MODULE_LICENSE ("GPL");#define PLATFORM_DRIVER ehci_octeon_driver#endif +#ifdef CONFIG_USB_EHCI_MSM +#include "ehci-msm.c" +#define PLATFORM_DRIVER ehci_msm_driver +#endif +#if !defined(PCI_DRIVER ) && !defined(PLATFORM_DRIVER ) && \ !defined(PS3_SYSTEM_BUS_DRIVER ) && !defined(OF_PLATFORM_DRIVER ) && \ !defined(XILINX_OF_PLATFORM_DRIVER )
drivers/usb/host/ehci-msm.c new file +294 -0
294 lines not on this page · raw message
Signature · 5 lines
1.7.1 -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 3/4 USB: EHCI: msm: Add support for power management
In reply to Pavankumar KondetiHost device is made a child of OTG device. Implement nop functions for runtime PM callbacks and enable runtime PM. OTG device is notfied about Host device suspend and takes care of putting hardware into low power mode. Adjust port power wakeup flags during system suspend and resume.
--- drivers/usb/host/Kconfig | 4 +- drivers/usb/host/ehci-msm.c | 81 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 82 insertions(+), 3 deletions(-)
drivers/usb/host/Kconfig +2 -2
@@ -142,8 +142,8 @@ config USB_EHCI_MSM Enables support for the USB Host controller present on the Qualcomm chipsets. Root Hub has inbuilt TT. This driver depends on OTG driver for PHY initialization, - clock management, powering up VBUS and memory mapping of - register address space. + clock management, powering up VBUS, memory mapping of + register address space and power management. config USB_EHCI_HCD_PPC_OF bool "EHCI support for PPC USB controller on OF platform bus"
drivers/usb/host/ehci-msm.c +80 -1
116 lines not on this page · raw message
Signature · 5 lines
1.7.1 -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
PATCH 4/4 USB: OTG: msm: Add spport for power management
In reply to Pavankumar KondetiImplement runtime and system pm ops to put hardware into low power mode (LPM). As part of LPM, USB clocks are turned off, PHY is put into suspend state and PHY comparators are turned off if VBUS/Id notifications are not required from PHY.
--- drivers/usb/otg/Kconfig | 6 +- drivers/usb/otg/msm72k_otg.c | 279 +++++++++++++++++++++++++++++++++++++- include/linux/usb/msm_hsusb.h | 4 + include/linux/usb/msm_hsusb_hw.h | 3 + 4 files changed, 285 insertions(+), 7 deletions(-)
drivers/usb/otg/Kconfig +3 -3
@@ -88,8 +88,8 @@ config USB_MSM_OTG_72K help Enable this to support the USB OTG transceiver on MSM chips. It handles PHY initialization, clock management, memory mapping of - register address space and workarounds required after resetting - the hardware. This driver is required for even peripheral only - or host only mode configuration. + register address space, workarounds required after resetting + the hardware and power management. This driver is required for + even peripheral only or host only mode configurations. endif # USB || OTG
drivers/usb/otg/msm72k_otg.c +275 -4
381 lines not on this page · raw message
include/linux/usb/msm_hsusb.h +4 -0
@@ -122,6 +122,8 @@ struct msm_otg_platform_data {* @pclk: clock struct of usb_hs_pclk. * @inputs: OTG state machine inputs(Id, SessValid etc). * @sm_work: OTG state machine work. +* @in_lpm: indicates low power mode (LPM) state. +* @async_int: Async interrupt arrived. * */ struct msm_otg {
@@ -134,6 +136,8 @@ struct msm_otg {#define B_SESS_VLD 1unsigned long inputs;struct work_struct sm_work; +atomic_t in_lpm; + int async_int; };#endif
include/linux/usb/msm_hsusb_hw.h +3 -0
@@ -195,6 +195,9 @@ struct ept_queue_item {#define PORTSC_LS (3 << 10)/* Read - Port's Line status */ #define PORTSC_PHCD (1 << 23)/* phy suspend mode */ +#define ASYNC_INTR_CTRL (1 << 29)/* Enable async interrupt */ +#define ULPI_STP_CTRL (1 << 30)/* Block communication with PHY */ +/* OTG definitions */ #define OTGSC_INTSTS_MASK (0x7f << 16)#define OTGSC_ID (1 << 8)
Signature · 5 lines
1.7.1 -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.