usb: patches for v3.10 merge window

Here is the big Gadget & PHY pull request. Many of us have
 been really busy lately getting multiple drivers to a better
 position.
 
 Since this pull request is so large, I will divide it in sections
 so it's easier to grasp what's included.
 
 - cleanups:
 	. UDC drivers no longer touch gadget->dev, that's now udc-core
 		responsibility
 	. Many more UDC drivers converted to usb_gadget_map/unmap_request()
 	. UDC drivers no longer initialize DMA-related fields from gadget's
 		device structure
 	. UDC drivers don't touch gadget.dev.driver directly
 	. UDC drivers don't assign gadget.dev.release directly
 	. Removal of some unused DMA_ADDR_INVALID
 	. Introduction of CONFIG_USB_PHY
 	. All phy drivers have been moved to drivers/usb/phy and renamed to
 		a common naming scheme
 	. Fix PHY layer so it never returns a NULL pointer, also fix all
 		callers to avoid using IS_ERR_OR_NULL()
 	. Sparse fixes all over the place
 	. drivers/usb/otg/ has been deleted
 	. Marvel drivers (mv_udc, ehci-mv, mv_otg and mv_u3d) improved clock
 		usage
 
 - new features:
 	. UDC core now provides a generic way for tracking and reporting
 		UDC's state (not attached, resuming, suspended, addressed,
 		default, etc)
 	. twl4030-usb learned that it shouldn't be enabled during init
 	. Full DT support for DWC3 has been implemented
 	. ab8500-usb learned about pinctrl framework
 	. nop PHY learned about DeviceTree and regulators
 	. DWC3 learned about suspend/resume
 	. DWC3 can now be compiled in host-only and gadget-only (as well as
 		DRD) configurations
 	. UVC now enables streaming endpoint based on negotiated speed
 	. isp1301 now implements the PHY API properly
 	. configfs-based interface for gadget drivers which will lead to
 		the removal of all code which just combines functions together
 		to build functional gadget drivers.
 	. f_serial and f_obex were converted to new configfs interface while
 		maintaining old interface around.
 
 - non-critical fixes:
 	. UVC gadget driver got fixes for Endpoint usage and stream calculation
 	. ab8500-usb fixed unbalanced clock and regulator API usage
 	. twl4030-usb got a fix for when OMAP3 is booted with cable connected
 	. fusb300_udc got a fix for DMA usage
 	. UVC got fixes for two assertions of the USB Video Class Compliance
 		specification revision 1.1
 	. build warning issues caused by recent addition of __must_check to
 		regulator API
 
 These are all changes which deserve a mention, all other changes are related
 to these one or minor spelling fixes and other similar tasks.
 
 Signed-of-by: Felipe Balbi <balbi@ti.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJRXG8GAAoJEIaOsuA1yqREJzYQAKMLW3J/TKTWS1DDuf7qMtMz
 Ug6qChKZXgT1/QrNjsq2tx4jYIkNdSMtRKiUx0BnIptlUx6gM22gcsN8mXX/UJjC
 FYAiWl+tYe85e9uayqqt+qVCZjTZCc7St4wQalugDHefvA7yCbiZpSaJRGlJMK+x
 mePJ7MfrulDsYBXr0u+m2LOJ0qxMDi40k3/UN3aUu5yzrmBiRpVq1mySruvLwGFp
 Pr6vBnprEc6bW5sRdUR4SICKLvLk5sHwHpvpkzDLYBIb/jXQwbfQri/HKeh4VMk8
 trbsvHZyB7H8uuFsCHiBc6VtjcbZ4mxPUK+1PCq8hG077avdkm3ox0BERk9aRTeC
 jg4mdpyWjgovwi882woPEQXNZoaAXpVDyI8tBRx92a+rGJjXSHhLQI+4Ffi4ZvzV
 d+q1ZzrHxuzwa/BwcPETY76umXQqXWXg+ap1bHDY0RZFoPLdXMpl583NXGSn3gOD
 dUlD0UlgYwb75333tRIPNQn3qOx0HVd6MlYPMNzl9t9c9qqfX78AYRny6ZucupRg
 t9VZ6FO3D2yre9W7u3U3q2c9H7uSAKr/8xaNfvdsIWPncgvvYVIyE8MnR7AiHoPv
 ZYESs/Gs6w9vUsHa9K4J16Ape7D3AMcGpXUoPUxTBHrwBexzt4j27VWtcL4ns/9r
 0kcltUJ4Zq+PIjc7xgxe
 =aF4r
 -----END PGP SIGNATURE-----

Merge tag 'usb-for-v3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

Felipe writes:

usb: patches for v3.10 merge window

Here is the big Gadget & PHY pull request. Many of us have
been really busy lately getting multiple drivers to a better
position.

Since this pull request is so large, I will divide it in sections
so it's easier to grasp what's included.

- cleanups:
	. UDC drivers no longer touch gadget->dev, that's now udc-core
		responsibility
	. Many more UDC drivers converted to usb_gadget_map/unmap_request()
	. UDC drivers no longer initialize DMA-related fields from gadget's
		device structure
	. UDC drivers don't touch gadget.dev.driver directly
	. UDC drivers don't assign gadget.dev.release directly
	. Removal of some unused DMA_ADDR_INVALID
	. Introduction of CONFIG_USB_PHY
	. All phy drivers have been moved to drivers/usb/phy and renamed to
		a common naming scheme
	. Fix PHY layer so it never returns a NULL pointer, also fix all
		callers to avoid using IS_ERR_OR_NULL()
	. Sparse fixes all over the place
	. drivers/usb/otg/ has been deleted
	. Marvel drivers (mv_udc, ehci-mv, mv_otg and mv_u3d) improved clock
		usage

- new features:
	. UDC core now provides a generic way for tracking and reporting
		UDC's state (not attached, resuming, suspended, addressed,
		default, etc)
	. twl4030-usb learned that it shouldn't be enabled during init
	. Full DT support for DWC3 has been implemented
	. ab8500-usb learned about pinctrl framework
	. nop PHY learned about DeviceTree and regulators
	. DWC3 learned about suspend/resume
	. DWC3 can now be compiled in host-only and gadget-only (as well as
		DRD) configurations
	. UVC now enables streaming endpoint based on negotiated speed
	. isp1301 now implements the PHY API properly
	. configfs-based interface for gadget drivers which will lead to
		the removal of all code which just combines functions together
		to build functional gadget drivers.
	. f_serial and f_obex were converted to new configfs interface while
		maintaining old interface around.

- non-critical fixes:
	. UVC gadget driver got fixes for Endpoint usage and stream calculation
	. ab8500-usb fixed unbalanced clock and regulator API usage
	. twl4030-usb got a fix for when OMAP3 is booted with cable connected
	. fusb300_udc got a fix for DMA usage
	. UVC got fixes for two assertions of the USB Video Class Compliance
		specification revision 1.1
	. build warning issues caused by recent addition of __must_check to
		regulator API

These are all changes which deserve a mention, all other changes are related
to these one or minor spelling fixes and other similar tasks.

Signed-of-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
Greg Kroah-Hartman 2013-04-05 15:18:00 -07:00
commit 64dc9e2e73
159 changed files with 6868 additions and 4499 deletions

View file

@ -43,4 +43,13 @@
*/
extern const char *usb_speed_string(enum usb_device_speed speed);
/**
* usb_state_string - Returns human readable name for the state.
* @state: The state to return a human-readable name for. If it's not
* any of the states devices in usb_device_state_string enum,
* the string UNKNOWN will be returned.
*/
extern const char *usb_state_string(enum usb_device_state state);
#endif /* __LINUX_USB_CH9_H */

View file

@ -39,6 +39,7 @@
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
#include <linux/log2.h>
#include <linux/configfs.h>
/*
* USB function drivers should return USB_GADGET_DELAYED_STATUS if they
@ -464,6 +465,8 @@ struct usb_function_driver {
};
struct usb_function_instance {
struct config_group group;
struct list_head cfs_list;
struct usb_function_driver *fd;
void (*free_func_inst)(struct usb_function_instance *inst);
};

View file

@ -19,11 +19,11 @@ enum omap_dwc3_vbus_id_status {
};
#if (defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_DWC3_MODULE))
extern void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status);
extern int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status);
#else
static inline void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
static inline int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
{
return;
return -ENODEV;
}
#endif

View file

@ -482,6 +482,7 @@ struct usb_gadget_ops {
* @speed: Speed of current connection to USB host.
* @max_speed: Maximal speed the UDC can handle. UDC must support this
* and all slower speeds.
* @state: the state we are now (attached, suspended, configured, etc)
* @sg_supported: true if we can handle scatter-gather
* @is_otg: True if the USB device port uses a Mini-AB jack, so that the
* gadget driver must provide a USB OTG descriptor.
@ -525,6 +526,7 @@ struct usb_gadget {
struct list_head ep_list; /* of usb_ep */
enum usb_device_speed speed;
enum usb_device_speed max_speed;
enum usb_device_state state;
unsigned sg_supported:1;
unsigned is_otg:1;
unsigned is_a_peripheral:1;
@ -872,6 +874,8 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver);
*/
int usb_gadget_unregister_driver(struct usb_gadget_driver *driver);
extern int usb_add_gadget_udc_release(struct device *parent,
struct usb_gadget *gadget, void (*release)(struct device *dev));
extern int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget);
extern void usb_del_gadget_udc(struct usb_gadget *gadget);
extern int udc_attach_driver(const char *name,
@ -959,6 +963,13 @@ extern void usb_gadget_unmap_request(struct usb_gadget *gadget,
/*-------------------------------------------------------------------------*/
/* utility to set gadget state properly */
extern void usb_gadget_set_state(struct usb_gadget *gadget,
enum usb_device_state state);
/*-------------------------------------------------------------------------*/
/* utility wrapping a simple endpoint selection policy */
extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *,

View file

@ -0,0 +1,110 @@
#ifndef __GADGET_CONFIGFS__
#define __GADGET_CONFIGFS__
#include <linux/configfs.h>
int check_user_usb_string(const char *name,
struct usb_gadget_strings *stringtab_dev);
#define GS_STRINGS_W(__struct, __name) \
static ssize_t __struct##_##__name##_store(struct __struct *gs, \
const char *page, size_t len) \
{ \
int ret; \
\
ret = usb_string_copy(page, &gs->__name); \
if (ret) \
return ret; \
return len; \
}
#define GS_STRINGS_R(__struct, __name) \
static ssize_t __struct##_##__name##_show(struct __struct *gs, \
char *page) \
{ \
return sprintf(page, "%s\n", gs->__name ?: ""); \
}
#define GS_STRING_ITEM_ATTR(struct_name, name) \
static struct struct_name##_attribute struct_name##_##name = \
__CONFIGFS_ATTR(name, S_IRUGO | S_IWUSR, \
struct_name##_##name##_show, \
struct_name##_##name##_store)
#define GS_STRINGS_RW(struct_name, _name) \
GS_STRINGS_R(struct_name, _name) \
GS_STRINGS_W(struct_name, _name) \
GS_STRING_ITEM_ATTR(struct_name, _name)
#define USB_CONFIG_STRING_RW_OPS(struct_in) \
CONFIGFS_ATTR_OPS(struct_in); \
\
static struct configfs_item_operations struct_in##_langid_item_ops = { \
.release = struct_in##_attr_release, \
.show_attribute = struct_in##_attr_show, \
.store_attribute = struct_in##_attr_store, \
}; \
\
static struct config_item_type struct_in##_langid_type = { \
.ct_item_ops = &struct_in##_langid_item_ops, \
.ct_attrs = struct_in##_langid_attrs, \
.ct_owner = THIS_MODULE, \
}
#define USB_CONFIG_STRINGS_LANG(struct_in, struct_member) \
static struct config_group *struct_in##_strings_make( \
struct config_group *group, \
const char *name) \
{ \
struct struct_member *gi; \
struct struct_in *gs; \
struct struct_in *new; \
int langs = 0; \
int ret; \
\
new = kzalloc(sizeof(*new), GFP_KERNEL); \
if (!new) \
return ERR_PTR(-ENOMEM); \
\
ret = check_user_usb_string(name, &new->stringtab_dev); \
if (ret) \
goto err; \
config_group_init_type_name(&new->group, name, \
&struct_in##_langid_type); \
\
gi = container_of(group, struct struct_member, strings_group); \
ret = -EEXIST; \
list_for_each_entry(gs, &gi->string_list, list) { \
if (gs->stringtab_dev.language == new->stringtab_dev.language) \
goto err; \
langs++; \
} \
ret = -EOVERFLOW; \
if (langs >= MAX_USB_STRING_LANGS) \
goto err; \
\
list_add_tail(&new->list, &gi->string_list); \
return &new->group; \
err: \
kfree(new); \
return ERR_PTR(ret); \
} \
\
static void struct_in##_strings_drop( \
struct config_group *group, \
struct config_item *item) \
{ \
config_item_put(item); \
} \
\
static struct configfs_group_operations struct_in##_strings_ops = { \
.make_group = &struct_in##_strings_make, \
.drop_item = &struct_in##_strings_drop, \
}; \
\
static struct config_item_type struct_in##_strings_type = { \
.ct_group_ops = &struct_in##_strings_ops, \
.ct_owner = THIS_MODULE, \
}
#endif

View file

@ -0,0 +1,31 @@
/*
* Copyright (C) 2013 ST-Ericsson AB
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __MUSB_UX500_H__
#define __MUSB_UX500_H__
enum ux500_musb_vbus_id_status {
UX500_MUSB_NONE = 0,
UX500_MUSB_VBUS,
UX500_MUSB_ID,
UX500_MUSB_CHARGER,
UX500_MUSB_ENUMERATED,
UX500_MUSB_RIDA,
UX500_MUSB_RIDB,
UX500_MUSB_RIDC,
UX500_MUSB_PREPARE,
UX500_MUSB_CLEAN,
};
#endif /* __MUSB_UX500_H__ */

View file

@ -5,6 +5,11 @@
struct nop_usb_xceiv_platform_data {
enum usb_phy_type type;
unsigned long clk_rate;
/* if set fails with -EPROBE_DEFER if can't get regulator */
unsigned int needs_vcc:1;
unsigned int needs_reset:1;
};
#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE))

View file

@ -36,14 +36,7 @@ struct usb_otg {
};
#ifdef CONFIG_USB_OTG_UTILS
extern const char *otg_state_string(enum usb_otg_state state);
#else
static inline const char *otg_state_string(enum usb_otg_state state)
{
return NULL;
}
#endif
extern const char *usb_otg_state_string(enum usb_otg_state state);
/* Context: can sleep */
static inline int

View file

@ -91,6 +91,9 @@ struct usb_phy {
int (*init)(struct usb_phy *x);
void (*shutdown)(struct usb_phy *x);
/* enable/disable VBUS */
int (*set_vbus)(struct usb_phy *x, int on);
/* effective for B devices, ignored for A-peripheral */
int (*set_power)(struct usb_phy *x,
unsigned mA);
@ -160,8 +163,26 @@ usb_phy_shutdown(struct usb_phy *x)
x->shutdown(x);
}
static inline int
usb_phy_vbus_on(struct usb_phy *x)
{
if (!x->set_vbus)
return 0;
return x->set_vbus(x, true);
}
static inline int
usb_phy_vbus_off(struct usb_phy *x)
{
if (!x->set_vbus)
return 0;
return x->set_vbus(x, false);
}
/* for usb host and peripheral controller drivers */
#ifdef CONFIG_USB_OTG_UTILS
#if IS_ENABLED(CONFIG_USB_PHY)
extern struct usb_phy *usb_get_phy(enum usb_phy_type type);
extern struct usb_phy *devm_usb_get_phy(struct device *dev,
enum usb_phy_type type);
@ -176,29 +197,29 @@ extern int usb_bind_phy(const char *dev_name, u8 index,
#else
static inline struct usb_phy *usb_get_phy(enum usb_phy_type type)
{
return NULL;
return ERR_PTR(-ENXIO);
}
static inline struct usb_phy *devm_usb_get_phy(struct device *dev,
enum usb_phy_type type)
{
return NULL;
return ERR_PTR(-ENXIO);
}
static inline struct usb_phy *usb_get_phy_dev(struct device *dev, u8 index)
{
return NULL;
return ERR_PTR(-ENXIO);
}
static inline struct usb_phy *devm_usb_get_phy_dev(struct device *dev, u8 index)
{
return NULL;
return ERR_PTR(-ENXIO);
}
static inline struct usb_phy *devm_usb_get_phy_by_phandle(struct device *dev,
const char *phandle, u8 index)
{
return NULL;
return ERR_PTR(-ENXIO);
}
static inline void usb_put_phy(struct usb_phy *x)

View file

@ -62,14 +62,14 @@ struct renesas_usbhs_platform_callback {
* Hardware exit function for platform.
* it is called when driver was removed
*/
void (*hardware_exit)(struct platform_device *pdev);
int (*hardware_exit)(struct platform_device *pdev);
/*
* option:
*
* for board specific clock control
*/
void (*power_ctrl)(struct platform_device *pdev,
int (*power_ctrl)(struct platform_device *pdev,
void __iomem *base, int enable);
/*
@ -77,7 +77,7 @@ struct renesas_usbhs_platform_callback {
*
* Phy reset for platform
*/
void (*phy_reset)(struct platform_device *pdev);
int (*phy_reset)(struct platform_device *pdev);
/*
* get USB ID function