aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb
diff options
context:
space:
mode:
authorcodeworkx <daniel.hillenbrand@codeworkx.de>2012-06-02 13:09:29 +0200
committercodeworkx <daniel.hillenbrand@codeworkx.de>2012-06-02 13:09:29 +0200
commitc6da2cfeb05178a11c6d062a06f8078150ee492f (patch)
treef3b4021d252c52d6463a9b3c1bb7245e399b009c /include/linux/usb
parentc6d7c4dbff353eac7919342ae6b3299a378160a6 (diff)
downloadkernel_samsung_smdk4412-c6da2cfeb05178a11c6d062a06f8078150ee492f.zip
kernel_samsung_smdk4412-c6da2cfeb05178a11c6d062a06f8078150ee492f.tar.gz
kernel_samsung_smdk4412-c6da2cfeb05178a11c6d062a06f8078150ee492f.tar.bz2
samsung update 1
Diffstat (limited to 'include/linux/usb')
-rw-r--r--include/linux/usb/android_composite.h100
-rw-r--r--include/linux/usb/ch11.h38
-rw-r--r--include/linux/usb/ch9.h2
-rw-r--r--include/linux/usb/composite.h67
-rw-r--r--include/linux/usb/ehci_def.h6
-rw-r--r--include/linux/usb/exynos_usb3_drd.h404
-rw-r--r--include/linux/usb/f_accessory.h83
-rw-r--r--include/linux/usb/f_mtp.h75
-rw-r--r--include/linux/usb/gadget.h32
-rw-r--r--include/linux/usb/otg_id.h58
-rw-r--r--include/linux/usb/quirks.h9
11 files changed, 873 insertions, 1 deletions
diff --git a/include/linux/usb/android_composite.h b/include/linux/usb/android_composite.h
new file mode 100644
index 0000000..886bd78
--- /dev/null
+++ b/include/linux/usb/android_composite.h
@@ -0,0 +1,100 @@
+/*
+ * Platform data for Android USB
+ *
+ * Copyright (C) 2008 Google, Inc.
+ * Author: Mike Lockwood <lockwood@android.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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 __LINUX_USB_ANDROID_H
+#define __LINUX_USB_ANDROID_H
+
+#include <linux/usb/composite.h>
+#include <linux/if_ether.h>
+
+struct android_usb_product {
+ /* Vendor ID for this set of functions.
+ * Default vendor_id in platform data will be used if this is zero.
+ */
+ __u16 vendor_id;
+
+ /* Product ID for this set of functions. */
+ __u16 product_id;
+
+ /* List of function names associated with this product.
+ * This is used to compute the USB product ID dynamically
+ * based on which functions are enabled.
+ */
+ int num_functions;
+ char **functions;
+};
+
+struct android_usb_platform_data {
+ /* USB device descriptor fields */
+ __u16 vendor_id;
+
+ /* Default product ID. */
+ __u16 product_id;
+
+ __u16 version;
+
+ char *product_name;
+ char *manufacturer_name;
+ char *serial_number;
+
+ /* List of available USB products.
+ * This is used to compute the USB product ID dynamically
+ * based on which functions are enabled.
+ * if num_products is zero or no match can be found,
+ * we use the default product ID
+ */
+ int num_products;
+ struct android_usb_product *products;
+
+ /* List of all supported USB functions.
+ * This list is used to define the order in which
+ * the functions appear in the configuration's list of USB interfaces.
+ * This is necessary to avoid depending upon the order in which
+ * the individual function drivers are initialized.
+ */
+ int num_functions;
+ char **functions;
+
+ /* Number of LUNs function have [For USB Mass storage]
+ * (anywhere from 1 to FSG_MAX_LUNS which is 8).
+ */
+ unsigned int nluns;
+};
+
+/* Platform data for "usb_mass_storage" driver. */
+struct usb_mass_storage_platform_data {
+ /* Contains values for the SC_INQUIRY SCSI command. */
+ char *vendor;
+ char *product;
+ int release;
+
+ /* number of LUNS */
+ int nluns;
+};
+
+/* Platform data for USB ethernet driver. */
+struct usb_ether_platform_data {
+ u8 ethaddr[ETH_ALEN];
+ u32 vendorID;
+ const char *vendorDescr;
+};
+
+/* Platform data for ACM driver. */
+struct acm_platform_data {
+ u8 num_inst;
+};
+
+#endif /* __LINUX_USB_ANDROID_H */
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h
index 4ebaf08..b2b34da 100644
--- a/include/linux/usb/ch11.h
+++ b/include/linux/usb/ch11.h
@@ -83,6 +83,44 @@
#define USB_PORT_FEAT_C_BH_PORT_RESET 29
#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30
+#ifdef CONFIG_HOST_COMPLIANT_TEST
+/*
+ * Hub Port Test Mode Selector Codes
+ * See USB 2.0 spec Table 11-24
+ */
+#define USB_PORT_TEST_J 0x01
+#define USB_PORT_TEST_K 0x02
+#define USB_PORT_TEST_SE0_NAK 0x03
+#define USB_PORT_TEST_PACKET 0x04
+#define USB_PORT_TEST_FORCE_ENABLE 0x05
+
+/*
+ * Product IDs used to trigger USB Hi-Speed Host Electrical Tests
+ * on the root hub. See USB 2.0 spec 7.1.20 and the
+ * Embedded High-speed Host Electrical Test Procedure.
+ */
+#define EHSET_TEST_SE0_NAK 0x0101
+#define EHSET_TEST_J 0x0102
+#define EHSET_TEST_K 0x0103
+#define EHSET_TEST_PACKET 0x0104
+/* Note that the FORCE ENABLE test is no longer used in the EHSET spec. */
+#define EHSET_TEST_FORCE_ENABLE 0x0105
+#define EHSET_HS_HOST_PORT_SUSPEND_RESUME 0x0106
+#define EHSET_SINGLE_STEP_GET_DEV_DESC 0x0107
+#define EHSET_SINGLE_STEP_SET_FEATURE 0x0108
+#define LOW_LEVEL_TEST_J 0x010a
+#define LOW_LEVEL_TEST_K 0x010b
+#define LOW_LEVEL_SE0_NAK 0x010c
+#define LOW_LEVEL_TEST_PACKET 0x010d
+
+/*
+ * This is used for the Hi-Speed Host Electrical Tests
+ * on the root hub. See USB 2.0 spec 7.1.20 and the
+ * Embedded High-speed Host Electrical Test Procedure.
+ */
+#define USB_PORT_TEST_SINGLE_STEP_SET_FEATURE 0x00
+
+#endif
/*
* Hub Status and Hub Change results
* See USB 2.0 spec Table 11-19 and Table 11-20
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index 0fd3fbd..fc6c106 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -87,6 +87,8 @@
#define USB_REQ_GET_INTERFACE 0x0A
#define USB_REQ_SET_INTERFACE 0x0B
#define USB_REQ_SYNCH_FRAME 0x0C
+#define USB_REQ_SET_SEL 0x30
+#define USB_REQ_SET_ISOCH_DELAY 0x31
#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */
#define USB_REQ_GET_ENCRYPTION 0x0E
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index b78cba4..456bab3 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -36,7 +36,9 @@
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
-
+#ifdef CONFIG_USB_ANDROID
+#include <linux/switch.h>
+#endif
/*
* USB function drivers should return USB_GADGET_DELAYED_STATUS if they
* wish to delay the data/status stages of the control transfer till they
@@ -46,6 +48,9 @@
*/
#define USB_GADGET_DELAYED_STATUS 0x7fff /* Impossibly large value */
+#ifdef CONFIG_USB_ANDROID
+struct usb_composite_dev;
+#endif
struct usb_configuration;
/**
@@ -59,6 +64,10 @@ struct usb_configuration;
* @hs_descriptors: Table of high speed descriptors, using interface and
* string identifiers assigned during @bind(). If this pointer is null,
* the function will not be available at high speed.
+ * @ss_descriptors: Table of super speed descriptors, using interface and
+ * string identifiers assigned during @bind(). If this
+ * pointer is null after initiation, the function will not
+ * be available at super speed.
* @config: assigned when @usb_add_function() is called; this is the
* configuration with which this function is associated.
* @bind: Before the gadget can register, all of its functions bind() to the
@@ -77,6 +86,10 @@ struct usb_configuration;
* @setup: Used for interface-specific control requests.
* @suspend: Notifies functions when the host stops sending USB traffic.
* @resume: Notifies functions when the host restarts USB traffic.
+ * @get_status: Returns function status as a reply to
+ * GetStatus() request when the recepient is Interface.
+ * @func_suspend: callback to be called when
+ * SetFeature(FUNCTION_SUSPEND) is reseived
*
* A single USB function uses one or more interfaces, and should in most
* cases support operation at both full and high speeds. Each function is
@@ -106,9 +119,19 @@ struct usb_function {
struct usb_gadget_strings **strings;
struct usb_descriptor_header **descriptors;
struct usb_descriptor_header **hs_descriptors;
+ struct usb_descriptor_header **ss_descriptors;
struct usb_configuration *config;
+#ifdef CONFIG_USB_ANDROID_SAMSUNG_COMPOSITE
+ int (*set_intf_num)(struct usb_function *f,
+ int intf_num, int index_num);
+ int (*set_config_desc)(int conf_num);
+#endif
+#ifdef CONFIG_USB_ANDROID
+ /* disabled is zero if the function is enabled */
+ int disabled;
+#endif
/* REVISIT: bind() functions can be marked __init, which
* makes trouble for section mismatch analysis. See if
* we can't restructure things to avoid mismatching.
@@ -132,10 +155,17 @@ struct usb_function {
void (*suspend)(struct usb_function *);
void (*resume)(struct usb_function *);
+ int (*get_status)(struct usb_function *);
+ int (*func_suspend)(struct usb_function *,
+ u8 suspend_opt);
+
/* private: */
/* internals */
struct list_head list;
DECLARE_BITMAP(endpoints, 32);
+#ifdef CONFIG_USB_ANDROID
+ struct device *dev;
+#endif
};
int usb_add_function(struct usb_configuration *, struct usb_function *);
@@ -145,6 +175,10 @@ int usb_function_activate(struct usb_function *);
int usb_interface_id(struct usb_configuration *, struct usb_function *);
+#ifdef CONFIG_USB_ANDROID
+void usb_function_set_enabled(struct usb_function *, int);
+void usb_composite_force_reset(struct usb_composite_dev *);
+#endif
/**
* ep_choose - select descriptor endpoint at current device speed
* @g: gadget, connected and running at some speed
@@ -231,6 +265,7 @@ struct usb_configuration {
struct list_head list;
struct list_head functions;
u8 next_interface_id;
+ unsigned superspeed:1;
unsigned highspeed:1;
unsigned fullspeed:1;
struct usb_function *interface[MAX_CONFIG_INTERFACES];
@@ -240,6 +275,9 @@ int usb_add_config(struct usb_composite_dev *,
struct usb_configuration *,
int (*)(struct usb_configuration *));
+int usb_remove_config(struct usb_composite_dev *,
+ struct usb_configuration *);
+
/**
* struct usb_composite_driver - groups configurations into a gadget
* @name: For diagnostics, identifies the driver.
@@ -281,6 +319,10 @@ struct usb_composite_driver {
struct usb_gadget_strings **strings;
unsigned needs_serial:1;
+#ifdef CONFIG_USB_ANDROID
+ struct class *class;
+ atomic_t function_count;
+#endif
int (*unbind)(struct usb_composite_dev *);
void (*disconnect)(struct usb_composite_dev *);
@@ -288,6 +330,10 @@ struct usb_composite_driver {
/* global suspend hooks */
void (*suspend)(struct usb_composite_dev *);
void (*resume)(struct usb_composite_dev *);
+
+#ifdef CONFIG_USB_ANDROID
+ void (*enable_function)(struct usb_function *f, int enable);
+#endif
};
extern int usb_composite_probe(struct usb_composite_driver *driver,
@@ -358,6 +404,25 @@ struct usb_composite_dev {
/* protects deactivations and delayed_status counts*/
spinlock_t lock;
+
+#ifdef CONFIG_USB_ANDROID
+ /* switch indicating connected/disconnected state */
+ struct switch_dev sw_connected;
+ /* switch indicating current configuration */
+ struct switch_dev sw_config;
+ /* current connected state for sw_connected */
+ bool connected;
+
+ struct work_struct switch_work;
+#endif
+
+#ifdef CONFIG_USB_ANDROID_SAMSUNG_COMPOSITE
+ /* used by enable_store function of android.c
+ * to avoid signalling switch changes
+ */
+ bool mute_switch;
+ bool force_disconnect;
+#endif
};
extern int usb_string_id(struct usb_composite_dev *c);
diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h
index 7cc95ee..b776e1d 100644
--- a/include/linux/usb/ehci_def.h
+++ b/include/linux/usb/ehci_def.h
@@ -133,8 +133,14 @@ struct ehci_regs {
#define PORT_WKCONN_E (1<<20) /* wake on connect (enable) */
/* 19:16 for port testing */
#define PORT_TEST(x) (((x)&0xf)<<16) /* Port Test Control */
+#ifdef CONFIG_HOST_COMPLIANT_TEST
+#define PORT_TEST_J PORT_TEST(0x1)
+#define PORT_TEST_K PORT_TEST(0x2)
+#define PORT_TEST_SE0_NAK PORT_TEST(0x3)
+#endif
#define PORT_TEST_PKT PORT_TEST(0x4) /* Port Test Control - packet test */
#define PORT_TEST_FORCE PORT_TEST(0x5) /* Port Test Control - force enable */
+
#define PORT_LED_OFF (0<<14)
#define PORT_LED_AMBER (1<<14)
#define PORT_LED_GREEN (2<<14)
diff --git a/include/linux/usb/exynos_usb3_drd.h b/include/linux/usb/exynos_usb3_drd.h
new file mode 100644
index 0000000..9f58605
--- /dev/null
+++ b/include/linux/usb/exynos_usb3_drd.h
@@ -0,0 +1,404 @@
+/* include/linux/usb/exynos_usb3_drd.h
+ *
+ * Copyright (c) 2012 Samsung Electronics Co. Ltd
+ * Author: Anton Tikhomirov <av.tikhomirov@samsung.com>
+ *
+ * Exynos SuperSpeed USB 3.0 DRD Controller global and OTG registers
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __LINUX_USB_EXYNOS_USB3_DRD_H
+#define __LINUX_USB_EXYNOS_USB3_DRD_H
+
+/* Global registers */
+#define EXYNOS_USB3_GSBUSCFG0 0xC100
+#define EXYNOS_USB3_GSBUSCFG0_SBusStoreAndForward (1 << 12)
+#define EXYNOS_USB3_GSBUSCFG0_DatBigEnd (1 << 11)
+#define EXYNOS_USB3_GSBUSCFG0_INCR256BrstEna (1 << 7)
+#define EXYNOS_USB3_GSBUSCFG0_INCR128BrstEna (1 << 6)
+#define EXYNOS_USB3_GSBUSCFG0_INCR64BrstEna (1 << 5)
+#define EXYNOS_USB3_GSBUSCFG0_INCR32BrstEna (1 << 4)
+#define EXYNOS_USB3_GSBUSCFG0_INCR16BrstEna (1 << 3)
+#define EXYNOS_USB3_GSBUSCFG0_INCR8BrstEna (1 << 2)
+#define EXYNOS_USB3_GSBUSCFG0_INCR4BrstEna (1 << 1)
+#define EXYNOS_USB3_GSBUSCFG0_INCRBrstEna (1 << 0)
+
+#define EXYNOS_USB3_GSBUSCFG1 0xC104
+#define EXYNOS_USB3_GSBUSCFG1_EN1KPAGE (1 << 12)
+#define EXYNOS_USB3_GSBUSCFG1_BREQLIMIT_MASK (0xf << 8)
+#define EXYNOS_USB3_GSBUSCFG1_BREQLIMIT_SHIFT 8
+#define EXYNOS_USB3_GSBUSCFG1_BREQLIMIT(_x) ((_x) << 8)
+
+#define EXYNOS_USB3_GTXTHRCFG 0xC108
+#define EXYNOS_USB3_GTXTHRCFG_USBTxPktCntSel (1 << 29)
+#define EXYNOS_USB3_GTXTHRCFG_USBTxPktCnt_MASK (0xf << 24)
+#define EXYNOS_USB3_GTXTHRCFG_USBTxPktCnt_SHIFT 24
+#define EXYNOS_USB3_GTXTHRCFG_USBTxPktCnt(_x) ((_x) << 24)
+#define EXYNOS_USB3_GTXTHRCFG_USBMaxTxBurstSize_MASK (0xff << 16)
+#define EXYNOS_USB3_GTXTHRCFG_USBMaxTxBurstSize_SHIFT 16
+#define EXYNOS_USB3_GTXTHRCFG_USBMaxTxBurstSize(_x) ((_x) << 16)
+
+#define EXYNOS_USB3_GRXTHRCFG 0xC10C
+#define EXYNOS_USB3_GRXTHRCFG_USBRxPktCntSel (1 << 29)
+#define EXYNOS_USB3_GRXTHRCFG_USBRxPktCnt_MASK (0xf << 24)
+#define EXYNOS_USB3_GRXTHRCFG_USBRxPktCnt_SHIFT 24
+#define EXYNOS_USB3_GRXTHRCFG_USBRxPktCnt(_x) ((_x) << 24)
+#define EXYNOS_USB3_GRXTHRCFG_USBMaxRxBurstSize_MASK (0x1f << 19)
+#define EXYNOS_USB3_GRXTHRCFG_USBMaxRxBurstSize_SHIFT 19
+#define EXYNOS_USB3_GRXTHRCFG_USBMaxRxBurstSize(_x) ((_x) << 19)
+
+#define EXYNOS_USB3_GCTL 0xC110
+#define EXYNOS_USB3_GCTL_PwrDnScale_MASK (0x1fff << 19)
+#define EXYNOS_USB3_GCTL_PwrDnScale_SHIFT 19
+#define EXYNOS_USB3_GCTL_PwrDnScale(_x) ((_x) << 19)
+#define EXYNOS_USB3_GCTL_U2RSTECN (1 << 16)
+#define EXYNOS_USB3_GCTL_FRMSCLDWN_MASK (0x3 << 14)
+#define EXYNOS_USB3_GCTL_FRMSCLDWN_SHIFT 14
+#define EXYNOS_USB3_GCTL_FRMSCLDWN(_x) ((_x) << 14)
+#define EXYNOS_USB3_GCTL_PrtCapDir_MASK (0x3 << 12)
+#define EXYNOS_USB3_GCTL_PrtCapDir_SHIFT 12
+#define EXYNOS_USB3_GCTL_PrtCapDir(_x) ((_x) << 12)
+#define EXYNOS_USB3_GCTL_CoreSoftReset (1 << 11)
+#define EXYNOS_USB3_GCTL_LocalLpBkEn (1 << 10)
+#define EXYNOS_USB3_GCTL_LpbkEn (1 << 9)
+#define EXYNOS_USB3_GCTL_DebugAttach (1 << 8)
+#define EXYNOS_USB3_GCTL_RAMClkSel_MASK (0x3 << 6)
+#define EXYNOS_USB3_GCTL_RAMClkSel_SHIFT 6
+#define EXYNOS_USB3_GCTL_RAMClkSel(_x) ((_x) << 6)
+#define EXYNOS_USB3_GCTL_ScaleDown_MASK (0x3 << 4)
+#define EXYNOS_USB3_GCTL_ScaleDown_SHIFT 4
+#define EXYNOS_USB3_GCTL_ScaleDown(_x) ((_x) << 4)
+#define EXYNOS_USB3_GCTL_DisScramble (1 << 3)
+#define EXYNOS_USB3_GCTL_SsPwrClmp (1 << 2)
+#define EXYNOS_USB3_GCTL_HsFsLsPwrClmp (1 << 1)
+#define EXYNOS_USB3_GCTL_DsblClkGtng (1 << 0)
+
+#define EXYNOS_USB3_GEVTEN 0xC114
+#define EXYNOS_USB3_GEVTEN_I2CEvtEn (1 << 1)
+#define EXYNOS_USB3_GEVTEN_ULPICKEvtEn (1 << 0)
+#define EXYNOS_USB3_GEVTEN_I2CCKEvtEn (1 << 0)
+
+#define EXYNOS_USB3_GSTS 0xC118
+#define EXYNOS_USB3_GSTS_CBELT_MASK (0xfff << 20)
+#define EXYNOS_USB3_GSTS_CBELT_SHIFT 20
+#define EXYNOS_USB3_GSTS_CBELT(_x) ((_x) << 20)
+#define EXYNOS_USB3_GSTS_OTG_IP (1 << 10)
+#define EXYNOS_USB3_GSTS_BC_IP (1 << 9)
+#define EXYNOS_USB3_GSTS_ADP_IP (1 << 8)
+#define EXYNOS_USB3_GSTS_Host_IP (1 << 7)
+#define EXYNOS_USB3_GSTS_Device_IP (1 << 6)
+#define EXYNOS_USB3_GSTS_CSRTimeout (1 << 5)
+#define EXYNOS_USB3_GSTS_BusErrAddrVld (1 << 4)
+#define EXYNOS_USB3_GSTS_CurMod_MASK (0x3 << 0)
+#define EXYNOS_USB3_GSTS_CurMod_SHIFT 0
+#define EXYNOS_USB3_GSTS_CurMod(_x) ((_x) << 0)
+
+#define EXYNOS_USB3_GSNPSID 0xC120
+
+#define EXYNOS_USB3_GGPIO 0xC124
+#define EXYNOS_USB3_GGPIO_GPO_MASK (0xffff << 16)
+#define EXYNOS_USB3_GGPIO_GPO_SHIFT 16
+#define EXYNOS_USB3_GGPIO_GPO(_x) ((_x) << 16)
+#define EXYNOS_USB3_GGPIO_GPI_MASK (0xffff << 0)
+#define EXYNOS_USB3_GGPIO_GPI_SHIFT 0
+#define EXYNOS_USB3_GGPIO_GPI(_x) ((x) << 0)
+
+#define EXYNOS_USB3_GUID 0xC128
+
+#define EXYNOS_USB3_GUCTL 0xC12C
+#define EXYNOS_USB3_GUCTL_SprsCtrlTransEn (1 << 17)
+#define EXYNOS_USB3_GUCTL_ResBwHSEPS (1 << 16)
+#define EXYNOS_USB3_GUCTL_CMdevAddr (1 << 15)
+#define EXYNOS_USB3_GUCTL_USBHstInAutoRetryEn (1 << 14)
+#define EXYNOS_USB3_GUCTL_USBHstInMaxBurst_MASK (0x7 << 11)
+#define EXYNOS_USB3_GUCTL_USBHstInMaxBurst_SHIFT 11
+#define EXYNOS_USB3_GUCTL_USBHstInMaxBurst(_x) ((_x) << 11)
+#define EXYNOS_USB3_GUCTL_DTCT_MASK (0x3 << 9)
+#define EXYNOS_USB3_GUCTL_DTCT_SHIFT 9
+#define EXYNOS_USB3_GUCTL_DTCT(_x) ((_x) << 9)
+#define EXYNOS_USB3_GUCTL_DTFT_MASK (0x1ff << 0)
+#define EXYNOS_USB3_GUCTL_DTFT_SHIFT 0
+#define EXYNOS_USB3_GUCTL_DTFT(_x) ((_x) << 0)
+
+#define EXYNOS_USB3_GBUSERRADDR_31_0 0xC130
+#define EXYNOS_USB3_GBUSERRADDR_63_32 0xC134
+#define EXYNOS_USB3_GPRTBIMAP_31_0 0xC138
+#define EXYNOS_USB3_GPRTBIMAP_63_32 0xC13C
+
+#define EXYNOS_USB3_GHWPARAMS0 0xC140
+#define EXYNOS_USB3_GHWPARAMS1 0xC144
+#define EXYNOS_USB3_GHWPARAMS2 0xC148
+#define EXYNOS_USB3_GHWPARAMS3 0xC14C
+#define EXYNOS_USB3_GHWPARAMS4 0xC150
+#define EXYNOS_USB3_GHWPARAMS5 0xC154
+#define EXYNOS_USB3_GHWPARAMS6 0xC158
+#define EXYNOS_USB3_GHWPARAMS7 0xC15C
+
+#define EXYNOS_USB3_GDBGFIFOSPACE 0xC160
+#define EXYNOS_USB3_GDBGLTSSM 0xC164
+
+#define EXYNOS_USB3_GDBGLSPMUX 0xC170
+#define EXYNOS_USB3_GDBGLSP 0xC174
+#define EXYNOS_USB3_GDBGEPINFO0 0xC178
+#define EXYNOS_USB3_GDBGEPINFO1 0xC17C
+
+#define EXYNOS_USB3_GPRTBIMAP_HS_31_0 0xC180
+#define EXYNOS_USB3_GPRTBIMAP_HS_63_32 0xC184
+#define EXYNOS_USB3_GPRTBIMAP_FS_31_0 0xC188
+#define EXYNOS_USB3_GPRTBIMAP_FS_63_32 0xC18C
+
+#define EXYNOS_USB3_GUSB2PHYCFG(_a) (0xC200 + ((_a) * 0x04))
+#define EXYNOS_USB3_GUSB2PHYCFGx_PHYSoftRst (1 << 31)
+#define EXYNOS_USB3_GUSB2PHYCFGx_PhyIntrNum_MASK (0x3f << 19)
+#define EXYNOS_USB3_GUSB2PHYCFGx_PhyIntrNum_SHIFT 19
+#define EXYNOS_USB3_GUSB2PHYCFGx_PhyIntrNum(_x) ((_x) << 19)
+#define EXYNOS_USB3_GUSB2PHYCFGx_ULPIExtVbusIndicator (1 << 18)
+#define EXYNOS_USB3_GUSB2PHYCFGx_ULPIExtVbusDrv (1 << 17)
+#define EXYNOS_USB3_GUSB2PHYCFGx_ULPIClkSusM (1 << 16)
+#define EXYNOS_USB3_GUSB2PHYCFGx_ULPIAutoRes (1 << 15)
+#define EXYNOS_USB3_GUSB2PHYCFGx_PhyLPwrClkSel (1 << 14)
+#define EXYNOS_USB3_GUSB2PHYCFGx_USBTrdTim_MASK (0xf << 10)
+#define EXYNOS_USB3_GUSB2PHYCFGx_USBTrdTim_SHIFT 10
+#define EXYNOS_USB3_GUSB2PHYCFGx_USBTrdTim(_x) ((_x) << 10)
+#define EXYNOS_USB3_GUSB2PHYCFGx_EnblSlpM (1 << 8)
+#define EXYNOS_USB3_GUSB2PHYCFGx_PHYSel (1 << 7)
+#define EXYNOS_USB3_GUSB2PHYCFGx_SusPHY (1 << 6)
+#define EXYNOS_USB3_GUSB2PHYCFGx_FSIntf (1 << 5)
+#define EXYNOS_USB3_GUSB2PHYCFGx_ULPI_UTMI_Sel (1 << 4)
+#define EXYNOS_USB3_GUSB2PHYCFGx_PHYIf (1 << 3)
+#define EXYNOS_USB3_GUSB2PHYCFGx_TOutCal_MASK (0x7 << 0)
+#define EXYNOS_USB3_GUSB2PHYCFGx_TOutCal_SHIFT 0
+#define EXYNOS_USB3_GUSB2PHYCFGx_TOutCal(_x) ((_x) << 0)
+
+#define EXYNOS_USB3_GUSB2I2CCTL(_a) (0xC240 + ((_a) * 0x04))
+
+#define EXYNOS_USB3_GUSB2PHYACC(_a) (0xC280 + ((_a) * 0x04))
+#define EXYNOS_USB3_GUSB2PHYACCx_DisUlpiDrvr (1 << 26)
+#define EXYNOS_USB3_GUSB2PHYACCx_NewRegReq (1 << 25)
+#define EXYNOS_USB3_GUSB2PHYACCx_VStsDone (1 << 24)
+#define EXYNOS_USB3_GUSB2PHYACCx_VStsBsy (1 << 23)
+#define EXYNOS_USB3_GUSB2PHYACCx_RegWr (1 << 22)
+#define EXYNOS_USB3_GUSB2PHYACCx_RegAddr_MASK (0x3f << 16)
+#define EXYNOS_USB3_GUSB2PHYACCx_RegAddr_SHIFT 16
+#define EXYNOS_USB3_GUSB2PHYACCx_RegAddr(_x) ((_x) << 16)
+/* Next 2 fields are overlaping. Is it error in user manual? */
+#define EXYNOS_USB3_GUSB2PHYACCx_VCtrl_MASK (0xff << 8)
+#define EXYNOS_USB3_GUSB2PHYACCx_VCtrl_SHIFT 8
+#define EXYNOS_USB3_GUSB2PHYACCx_VCtrl(_x) ((_x) << 8)
+/*--------*/
+#define EXYNOS_USB3_GUSB2PHYACCx_ExtRegAddr_MASK (0x3f << 8)
+#define EXYNOS_USB3_GUSB2PHYACCx_ExtRegAddr_SHIFT 8
+#define EXYNOS_USB3_GUSB2PHYACCx_ExtRegAddr(_x) ((_x) << 8)
+/*--------*/
+#define EXYNOS_USB3_GUSB2PHYACCx_RegData_MASK (0xff << 0)
+#define EXYNOS_USB3_GUSB2PHYACCx_RegData_SHIFT 0
+#define EXYNOS_USB3_GUSB2PHYACCx_RegData(_x) ((_x) << 0)
+
+#define EXYNOS_USB3_GUSB3PIPECTL(_a) (0xC2C0 + ((_a) * 0x04))
+#define EXYNOS_USB3_GUSB3PIPECTLx_PHYSoftRst (1 << 31)
+#define EXYNOS_USB3_GUSB3PIPECTLx_request_p1p2p3 (1 << 24)
+#define EXYNOS_USB3_GUSB3PIPECTLx_StartRxdetU3RxDet (1 << 23)
+#define EXYNOS_USB3_GUSB3PIPECTLx_DisRxDetU3RxDet (1 << 22)
+#define EXYNOS_USB3_GUSB3PIPECTLx_delay_p1p2p3_MASK (0x7 << 19)
+#define EXYNOS_USB3_GUSB3PIPECTLx_delay_p1p2p3_SHIFT 19
+#define EXYNOS_USB3_GUSB3PIPECTLx_delay_p1p2p3(_x) ((_x) << 19)
+#define EXYNOS_USB3_GUSB3PIPECTLx_delay_phy_pwr_p1p2p3 (1 << 18)
+#define EXYNOS_USB3_GUSB3PIPECTLx_SuspSSPhy (1 << 17)
+#define EXYNOS_USB3_GUSB3PIPECTLx_DatWidth_MASK (0x3 << 15)
+#define EXYNOS_USB3_GUSB3PIPECTLx_DatWidth_SHIFT 15
+#define EXYNOS_USB3_GUSB3PIPECTLx_DatWidth(_x) ((_x) << 15)
+#define EXYNOS_USB3_GUSB3PIPECTLx_AbortRxDetInU2 (1 << 14)
+#define EXYNOS_USB3_GUSB3PIPECTLx_SkipRxDet (1 << 13)
+#define EXYNOS_USB3_GUSB3PIPECTLx_LFPSP0Algn (1 << 12)
+#define EXYNOS_USB3_GUSB3PIPECTLx_P3P2TranOK (1 << 11)
+#define EXYNOS_USB3_GUSB3PIPECTLx_LFPSFilt (1 << 9)
+#define EXYNOS_USB3_GUSB3PIPECTLx_TxSwing (1 << 6)
+#define EXYNOS_USB3_GUSB3PIPECTLx_TxMargin_MASK (0x7 << 3)
+#define EXYNOS_USB3_GUSB3PIPECTLx_TxMargin_SHIFT 3
+#define EXYNOS_USB3_GUSB3PIPECTLx_TxMargin(_x) ((_x) << 3)
+#define EXYNOS_USB3_GUSB3PIPECTLx_TxDeemphasis_MASK (0x3 << 1)
+#define EXYNOS_USB3_GUSB3PIPECTLx_TxDeemphasis_SHIFT 1
+#define EXYNOS_USB3_GUSB3PIPECTLx_TxDeemphasis(_x) ((_x) << 1)
+#define EXYNOS_USB3_GUSB3PIPECTLx_ElasticBufferMode (1 << 0)
+
+#define EXYNOS_USB3_GTXFIFOSIZ(_a) (0xC300 + ((_a) * 0x04))
+#define EXYNOS_USB3_GTXFIFOSIZx_TxFStAddr_n_MASK (0xffff << 16)
+#define EXYNOS_USB3_GTXFIFOSIZx_TxFStAddr_n_SHIFT 16
+#define EXYNOS_USB3_GTXFIFOSIZx_TxFStAddr_n(_x) ((_x) << 16)
+#define EXYNOS_USB3_GTXFIFOSIZx_TxFDep_n_MASK (0xffff << 0)
+#define EXYNOS_USB3_GTXFIFOSIZx_TxFDep_n_SHIFT 0
+#define EXYNOS_USB3_GTXFIFOSIZx_TxFDep_n(_x) ((_x) << 0)
+
+#define EXYNOS_USB3_GRXFIFOSIZ(_a) (0xC380 + ((_a) * 0x04))
+#define EXYNOS_USB3_GRXFIFOSIZx_RxFStAddr_n_MASK (0xffff << 16)
+#define EXYNOS_USB3_GRXFIFOSIZx_RxFStAddr_n_SHIFT 16
+#define EXYNOS_USB3_GRXFIFOSIZx_RxFStAddr_n(_x) ((_x) << 16)
+#define EXYNOS_USB3_GRXFIFOSIZx_RxFDep_n_MASK (0xffff << 0)
+#define EXYNOS_USB3_GRXFIFOSIZx_RxFDep_n_SHIFT 0
+#define EXYNOS_USB3_GRXFIFOSIZx_RxFDep_n(_x) ((_x) << 0)
+
+#define EXYNOS_USB3_GEVNTADR_31_0(_a) (0xC400 + ((_a) * 0x10))
+#define EXYNOS_USB3_GEVNTADR_63_32(_a) (0xC404 + ((_a) * 0x10))
+
+#define EXYNOS_USB3_GEVNTSIZ(_a) (0xC408 + ((_a) * 0x10))
+#define EXYNOS_USB3_GEVNTSIZx_EvntIntMask (1 << 31)
+#define EXYNOS_USB3_GEVNTSIZx_EVNTSiz_MASK (0xffff << 0)
+#define EXYNOS_USB3_GEVNTSIZx_EVNTSiz_SHIFT 0
+#define EXYNOS_USB3_GEVNTSIZx_EVNTSiz(x) ((_x) << 0)
+
+#define EXYNOS_USB3_GEVNTCOUNT(_a) (0xC40C + ((_a) * 0x10))
+#define EXYNOS_USB3_GEVNTCOUNTx_EVNTCount_MASK (0xffff << 0)
+#define EXYNOS_USB3_GEVNTCOUNTx_EVNTCount_SHIFT 0
+#define EXYNOS_USB3_GEVNTCOUNTx_EVNTCount(_x) ((_x) << 0)
+
+/* Event Buffer Content for Device Endpoint-Specific Events (DEPEVT) */
+#define EXYNOS_USB3_DEPEVT_EventParam_MASK (0xffff << 16)
+#define EXYNOS_USB3_DEPEVT_EventParam_SHIFT 16
+#define EXYNOS_USB3_DEPEVT_EventParam(_x) ((_x) << 16)
+#define EXYNOS_USB3_DEPEVT_EventStatus_MASK (0xf << 12)
+#define EXYNOS_USB3_DEPEVT_EventStatus_SHIFT 12
+#define EXYNOS_USB3_DEPEVT_EventStatus_CTL_MASK (0x3 << 12)
+#define EXYNOS_USB3_DEPEVT_EventStatus_CTL_SETUP (0 << 12)
+#define EXYNOS_USB3_DEPEVT_EventStatus_CTL_DATA (1 << 12)
+#define EXYNOS_USB3_DEPEVT_EventStatus_CTL_STATUS (2 << 12)
+#define EXYNOS_USB3_DEPEVT_EventStatus_BUSERR (1 << 12)
+#define EXYNOS_USB3_DEPEVT_EVENT_MASK (0xf << 6)
+#define EXYNOS_USB3_DEPEVT_EVENT_SHIFT 6
+#define EXYNOS_USB3_DEPEVT_EVENT_EPCmdCmplt (7 << 6)
+#define EXYNOS_USB3_DEPEVT_EVENT_StreamEvt (6 << 6)
+#define EXYNOS_USB3_DEPEVT_EVENT_RxTxfifoEvt (4 << 6)
+#define EXYNOS_USB3_DEPEVT_EVENT_XferNotReady (3 << 6)
+#define EXYNOS_USB3_DEPEVT_EVENT_XferInProgress (2 << 6)
+#define EXYNOS_USB3_DEPEVT_EVENT_XferComplete (1 << 6)
+#define EXYNOS_USB3_DEPEVT_EPNUM_MASK (0x1f << 1)
+#define EXYNOS_USB3_DEPEVT_EPNUM_SHIFT 1
+#define EXYNOS_USB3_DEPEVT_EPNUM(_x) ((_x) << 1)
+
+/* Event Buffer Content for Device-Specific Events (DEVT) */
+#define EXYNOS_USB3_DEVT_EvtInfo_MASK (0xf << 16)
+#define EXYNOS_USB3_DEVT_EvtInfo_SHIFT 16
+#define EXYNOS_USB3_DEVT_EvtInfo(_x) ((_x) << 16)
+#define EXYNOS_USB3_DEVT_EvtInfo_SS (1 << 20)
+#define EXYNOS_USB3_DEVT_EvtInfo_U3 (0x3 << 16)
+#define EXYNOS_USB3_DEVT_EvtInfo_SS_DIS (0x4 << 16)
+#define EXYNOS_USB3_DEVT_EvtInfo_Suspend (0x3 << 16)
+#define EXYNOS_USB3_DEVT_EVENT_MASK (0xf << 8)
+#define EXYNOS_USB3_DEVT_EVENT_SHIFT 8
+#define EXYNOS_USB3_DEVT_EVENT_VndrDevTstRcved (12 << 8)
+#define EXYNOS_USB3_DEVT_EVENT_EvntOverflow (11 << 8)
+#define EXYNOS_USB3_DEVT_EVENT_CmdCmplt (10 << 8)
+#define EXYNOS_USB3_DEVT_EVENT_ErrticErr (9 << 8)
+#define EXYNOS_USB3_DEVT_EVENT_Sof (7 << 8)
+#define EXYNOS_USB3_DEVT_EVENT_EOPF (6 << 8)
+#define EXYNOS_USB3_DEVT_EVENT_WkUpEvt (4 << 8)
+#define EXYNOS_USB3_DEVT_EVENT_ULStChng (3 << 8)
+#define EXYNOS_USB3_DEVT_EVENT_ConnectDone (2 << 8)
+#define EXYNOS_USB3_DEVT_EVENT_USBRst (1 << 8)
+#define EXYNOS_USB3_DEVT_EVENT_DisconnEvt (0 << 8)
+
+#define EXYNOS_USB3_GHWPARAMS8 0xC600
+
+/* USB 2.0 OTG and Battery Charger registers */
+#define EXYNOS_USB3_OCFG 0xCC00
+#define EXYNOS_USB3_OCFG_OTG_Version (1 << 2)
+#define EXYNOS_USB3_OCFG_HNPCap (1 << 1)
+#define EXYNOS_USB3_OCFG_SRPCap (1 << 0)
+
+#define EXYNOS_USB3_OCTL 0xCC04
+#define EXYNOS_USB3_OCTL_PeriMode (1 << 6)
+#define EXYNOS_USB3_OCTL_PrtPwrCtl (1 << 5)
+#define EXYNOS_USB3_OCTL_HNPReq (1 << 4)
+#define EXYNOS_USB3_OCTL_SesReq (1 << 3)
+#define EXYNOS_USB3_OCTL_TermSelDLPulse (1 << 2)
+#define EXYNOS_USB3_OCTL_DevSetHNPEn (1 << 1)
+#define EXYNOS_USB3_OCTL_HstSetHNPEn (1 << 0)
+
+#define EXYNOS_USB3_OEVT 0xCC08
+#define EXYNOS_USB3_OEVT_DeviceMode (1 << 31)
+#define EXYNOS_USB3_OEVT_OTGConIDStsChngEvnt (1 << 24)
+#define EXYNOS_USB3_OEVT_OTGADevBHostEndEvnt (1 << 20)
+#define EXYNOS_USB3_OEVT_OTGADevHostEvnt (1 << 19)
+#define EXYNOS_USB3_OEVT_OTGADevHNPChngEvnt (1 << 18)
+#define EXYNOS_USB3_OEVT_OTGADevSRPDetEvnt (1 << 17)
+#define EXYNOS_USB3_OEVT_OTGADevSessEndDetEvnt (1 << 16)
+#define EXYNOS_USB3_OEVT_OTGBDevBHostEndEvnt (1 << 11)
+#define EXYNOS_USB3_OEVT_OTGBDevHNPChngEvnt (1 << 10)
+#define EXYNOS_USB3_OEVT_OTGBDevSessVldDetEvnt (1 << 9)
+#define EXYNOS_USB3_OEVT_OTGBDevVBUSChngEvnt (1 << 8)
+#define EXYNOS_USB3_OEVT_BSesVld (1 << 3)
+#define EXYNOS_USB3_OEVT_HstNegSts (1 << 2)
+#define EXYNOS_USB3_OEVT_SesReqSts (1 << 1)
+#define EXYNOS_USB3_OEVT_OEVTError (1 << 0)
+
+#define EXYNOS_USB3_OEVTEN 0xCC0C
+#define EXYNOS_USB3_OEVTEN_OTGConIDStsChngEvntEn (1 << 24)
+#define EXYNOS_USB3_OEVTEN_OTGADevBHostEndEvntEn (1 << 20)
+#define EXYNOS_USB3_OEVTEN_OTGADevHostEvntEn (1 << 19)
+#define EXYNOS_USB3_OEVTEN_OTGADevHNPChngEvntEn (1 << 18)
+#define EXYNOS_USB3_OEVTEN_OTGADevSRPDetEvntEn (1 << 17)
+#define EXYNOS_USB3_OEVTEN_OTGADevSessEndDetEvntEn (1 << 16)
+#define EXYNOS_USB3_OEVTEN_OTGBDevBHostEndEvntEn (1 << 11)
+#define EXYNOS_USB3_OEVTEN_OTGBDevHNPChngEvntEn (1 << 10)
+#define EXYNOS_USB3_OEVTEN_OTGBDevSessVldDetEvntEn (1 << 9)
+#define EXYNOS_USB3_OEVTEN_OTGBDevVBUSChngEvntEn (1 << 8)
+
+#define EXYNOS_USB3_OSTS 0xCC10
+#define EXYNOS_USB3_OSTS_OTG_state_MASK (0xf << 8)
+#define EXYNOS_USB3_OSTS_OTG_state_SHIFT 8
+#define EXYNOS_USB3_OSTS_OTG_state(_x) ((_x) << 8)
+#define EXYNOS_USB3_OSTS_PeripheralState (1 << 4)
+#define EXYNOS_USB3_OSTS_xHCIPrtPower (1 << 3)
+#define EXYNOS_USB3_OSTS_BSesVld (1 << 2)
+#define EXYNOS_USB3_OSTS_VbusVld (1 << 1)
+#define EXYNOS_USB3_OSTS_ConIDSts (1 << 0)
+
+#define EXYNOS_USB3_ADPCFG 0xCC20
+#define EXYNOS_USB3_ADPCFG_PrbPer_MASK (0x3 << 30)
+#define EXYNOS_USB3_ADPCFG_PrbPer_SHIFT 30
+#define EXYNOS_USB3_ADPCFG_PrbPer(_x) ((_x) << 30)
+#define EXYNOS_USB3_ADPCFG_PrbDelta_MASK (0x3 << 28)
+#define EXYNOS_USB3_ADPCFG_PrbDelta_SHIFT 28
+#define EXYNOS_USB3_ADPCFG_PrbDelta(_x) ((_x) << 28)
+#define EXYNOS_USB3_ADPCFG_PrbDschg_MASK (0x3 << 26)
+#define EXYNOS_USB3_ADPCFG_PrbDschg_SHIFT 26
+#define EXYNOS_USB3_ADPCFG_PrbDschg(_x) ((_x) << 26)
+
+#define EXYNOS_USB3_ADPCTL 0xCC24
+#define EXYNOS_USB3_ADPCTL_EnaPrb (1 << 28)
+#define EXYNOS_USB3_ADPCTL_EnaSns (1 << 27)
+#define EXYNOS_USB3_ADPCTL_ADPEn (1 << 26)
+#define EXYNOS_USB3_ADPCTL_ADPRes (1 << 25)
+#define EXYNOS_USB3_ADPCTL_WB (1 << 24)
+
+#define EXYNOS_USB3_ADPEVT 0xCC28
+#define EXYNOS_USB3_ADPEVT_AdpPrbEvnt (1 << 28)
+#define EXYNOS_USB3_ADPEVT_AdpSnsEvnt (1 << 27)
+#define EXYNOS_USB3_ADPEVT_AdpTmoutEvnt (1 << 26)
+#define EXYNOS_USB3_ADPEVT_ADPRstCmpltEvnt (1 << 25)
+#define EXYNOS_USB3_ADPEVT_RTIM_MASK (0x7ff << 0)
+#define EXYNOS_USB3_ADPEVT_RTIM_SHIFT 0
+#define EXYNOS_USB3_ADPEVT_RTIM(_x) ((_x) << 0)
+
+#define EXYNOS_USB3_ADPEVTEN 0xCC2C
+#define EXYNOS_USB3_ADPEVTEN_AdpPrbEvntEn (1 << 28)
+#define EXYNOS_USB3_ADPEVTEN_AdpSnsEvntEn (1 << 27)
+#define EXYNOS_USB3_ADPEVTEN_AdpTmoutEvntEn (1 << 26)
+#define EXYNOS_USB3_ADPEVTEN_ADPRstCmpltEvntEn (1 << 25)
+
+#define EXYNOS_USB3_BCFG 0xCC30
+#define EXYNOS_USB3_BCFG_IDDIG_SEL (1 << 1)
+#define EXYNOS_USB3_BCFG_CHIRP_EN (1 << 0)
+
+#define EXYNOS_USB3_BCEVT 0xCC38
+#define EXYNOS_USB3_BCEVT_MV_ChngEvnt (1 << 24)
+#define EXYNOS_USB3_BCEVT_MultValIdBc_MASK (0x1f << 0)
+#define EXYNOS_USB3_BCEVT_MultValIdBc_SHIFT 0
+#define EXYNOS_USB3_BCEVT_MultValIdBc(_x) ((_x) << 0)
+
+#define EXYNOS_USB3_BCEVTEN 0xCC3C
+#define EXYNOS_USB3_BCEVTEN_MV_ChngEvntEn (1 << 24)
+
+#endif /* __LINUX_USB_EXYNOS_USB3_DRD_H */
diff --git a/include/linux/usb/f_accessory.h b/include/linux/usb/f_accessory.h
new file mode 100644
index 0000000..5b2dcf9
--- /dev/null
+++ b/include/linux/usb/f_accessory.h
@@ -0,0 +1,83 @@
+/*
+ * Gadget Function Driver for Android USB accessories
+ *
+ * Copyright (C) 2011 Google, Inc.
+ * Author: Mike Lockwood <lockwood@android.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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 __LINUX_USB_F_ACCESSORY_H
+#define __LINUX_USB_F_ACCESSORY_H
+
+/* Use Google Vendor ID when in accessory mode */
+#define USB_ACCESSORY_VENDOR_ID 0x18D1
+
+
+/* Product ID to use when in accessory mode */
+#define USB_ACCESSORY_PRODUCT_ID 0x2D00
+
+/* Product ID to use when in accessory mode and adb is enabled */
+#define USB_ACCESSORY_ADB_PRODUCT_ID 0x2D01
+
+/* Indexes for strings sent by the host via ACCESSORY_SEND_STRING */
+#define ACCESSORY_STRING_MANUFACTURER 0
+#define ACCESSORY_STRING_MODEL 1
+#define ACCESSORY_STRING_DESCRIPTION 2
+#define ACCESSORY_STRING_VERSION 3
+#define ACCESSORY_STRING_URI 4
+#define ACCESSORY_STRING_SERIAL 5
+
+/* Control request for retrieving device's protocol version (currently 1)
+ *
+ * requestType: USB_DIR_IN | USB_TYPE_VENDOR
+ * request: ACCESSORY_GET_PROTOCOL
+ * value: 0
+ * index: 0
+ * data version number (16 bits little endian)
+ */
+#define ACCESSORY_GET_PROTOCOL 51
+
+/* Control request for host to send a string to the device
+ *
+ * requestType: USB_DIR_OUT | USB_TYPE_VENDOR
+ * request: ACCESSORY_SEND_STRING
+ * value: 0
+ * index: string ID
+ * data zero terminated UTF8 string
+ *
+ * The device can later retrieve these strings via the
+ * ACCESSORY_GET_STRING_* ioctls
+ */
+#define ACCESSORY_SEND_STRING 52
+
+/* Control request for starting device in accessory mode.
+ * The host sends this after setting all its strings to the device.
+ *
+ * requestType: USB_DIR_OUT | USB_TYPE_VENDOR
+ * request: ACCESSORY_START
+ * value: 0
+ * index: 0
+ * data none
+ */
+#define ACCESSORY_START 53
+
+/* ioctls for retrieving strings set by the host */
+#define ACCESSORY_GET_STRING_MANUFACTURER _IOW('M', 1, char[256])
+#define ACCESSORY_GET_STRING_MODEL _IOW('M', 2, char[256])
+#define ACCESSORY_GET_STRING_DESCRIPTION _IOW('M', 3, char[256])
+#define ACCESSORY_GET_STRING_VERSION _IOW('M', 4, char[256])
+#define ACCESSORY_GET_STRING_URI _IOW('M', 5, char[256])
+#define ACCESSORY_GET_STRING_SERIAL _IOW('M', 6, char[256])
+/* returns 1 if there is a start request pending */
+#define ACCESSORY_IS_START_REQUESTED _IO('M', 7)
+
+#endif /* __LINUX_USB_F_ACCESSORY_H */
diff --git a/include/linux/usb/f_mtp.h b/include/linux/usb/f_mtp.h
new file mode 100644
index 0000000..7422b17
--- /dev/null
+++ b/include/linux/usb/f_mtp.h
@@ -0,0 +1,75 @@
+/*
+ * Gadget Function Driver for MTP
+ *
+ * Copyright (C) 2010 Google, Inc.
+ * Author: Mike Lockwood <lockwood@android.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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 __LINUX_USB_F_MTP_H
+#define __LINUX_USB_F_MTP_H
+
+#include <linux/ioctl.h>
+
+#ifdef __KERNEL__
+
+struct mtp_data_header {
+ /* length of packet, including this header */
+ uint32_t length;
+ /* container type (2 for data packet) */
+ uint16_t type;
+ /* MTP command code */
+ uint16_t command;
+ /* MTP transaction ID */
+ uint32_t transaction_id;
+};
+
+#endif /* __KERNEL__ */
+
+struct mtp_file_range {
+ /* file descriptor for file to transfer */
+ int fd;
+ /* offset in file for start of transfer */
+ loff_t offset;
+ /* number of bytes to transfer */
+ int64_t length;
+ /* MTP command ID for data header,
+ * used only for MTP_SEND_FILE_WITH_HEADER
+ */
+ uint16_t command;
+ /* MTP transaction ID for data header,
+ * used only for MTP_SEND_FILE_WITH_HEADER
+ */
+ uint32_t transaction_id;
+};
+
+struct mtp_event {
+ /* size of the event */
+ size_t length;
+ /* event data to send */
+ void *data;
+};
+
+/* Sends the specified file range to the host */
+#define MTP_SEND_FILE _IOW('M', 0, struct mtp_file_range)
+/* Receives data from the host and writes it to a file.
+ * The file is created if it does not exist.
+ */
+#define MTP_RECEIVE_FILE _IOW('M', 1, struct mtp_file_range)
+/* Sends an event to the host via the interrupt endpoint */
+#define MTP_SEND_EVENT _IOW('M', 3, struct mtp_event)
+/* Sends the specified file range to the host,
+ * with a 12 byte MTP data packet header at the beginning.
+ */
+#define MTP_SEND_FILE_WITH_HEADER _IOW('M', 4, struct mtp_file_range)
+
+#endif /* __LINUX_USB_F_MTP_H */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index dd1571d..fc450a7 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -131,6 +131,7 @@ struct usb_ep_ops {
* @maxpacket:The maximum packet size used on this endpoint. The initial
* value can sometimes be reduced (hardware allowing), according to
* the endpoint descriptor used to configure the endpoint.
+ * @maxburst: The maximum burst size.
* @driver_data:for use by the gadget driver. all other fields are
* read-only to gadget drivers.
*
@@ -145,6 +146,9 @@ struct usb_ep {
const struct usb_ep_ops *ops;
struct list_head ep_list;
unsigned maxpacket:16;
+
+ unsigned numstreams:5;
+ unsigned maxburst:4;
};
/*-------------------------------------------------------------------------*/
@@ -416,6 +420,13 @@ static inline void usb_ep_fifo_flush(struct usb_ep *ep)
/*-------------------------------------------------------------------------*/
+struct usb_dcd_config_params {
+ __u8 bU1devExitLat; /* U1 Device exit Latency */
+#define USB_DEFAULT_U1_DEV_EXIT_LAT 0x01 /* Less then 1 microsec */
+ __le16 bU2DevExitLat; /* U2 Device exit Latency */
+#define USB_DEFAULT_U2_DEV_EXIT_LAT 0x1F4 /* Less then 500 microsec */
+};
+
struct usb_gadget;
/* the rest of the api to the controller hardware: device operations,
@@ -430,6 +441,7 @@ struct usb_gadget_ops {
int (*pullup) (struct usb_gadget *, int is_on);
int (*ioctl)(struct usb_gadget *,
unsigned code, unsigned long param);
+ void (*get_config_params)(struct usb_dcd_config_params *);
};
/**
@@ -521,6 +533,24 @@ static inline int gadget_is_dualspeed(struct usb_gadget *g)
}
/**
+ * gadget_is_superspeed() - return true if the hardware handles
+ * supperspeed
+ * @g: controller that might support supper speed
+ */
+static inline int gadget_is_superspeed(struct usb_gadget *g)
+{
+#ifdef CONFIG_USB_GADGET_SUPERSPEED
+ /*
+ * runtime test would check "g->is_superspeed" ... that might be
+ * useful to work around hardware bugs, but is mostly pointless
+ */
+ return 1;
+#else
+ return 0;
+#endif
+}
+
+/**
* gadget_is_otg - return true iff the hardware is OTG-ready
* @g: controller that might have a Mini-AB connector
*
@@ -671,6 +701,7 @@ static inline int usb_gadget_vbus_disconnect(struct usb_gadget *gadget)
*/
static inline int usb_gadget_connect(struct usb_gadget *gadget)
{
+ printk(KERN_DEBUG "usb: %s\n", __func__);
if (!gadget->ops->pullup)
return -EOPNOTSUPP;
return gadget->ops->pullup(gadget, 1);
@@ -693,6 +724,7 @@ static inline int usb_gadget_connect(struct usb_gadget *gadget)
*/
static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
{
+ printk(KERN_DEBUG "usb: %s\n", __func__);
if (!gadget->ops->pullup)
return -EOPNOTSUPP;
return gadget->ops->pullup(gadget, 0);
diff --git a/include/linux/usb/otg_id.h b/include/linux/usb/otg_id.h
new file mode 100644
index 0000000..f9f5189
--- /dev/null
+++ b/include/linux/usb/otg_id.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2011 Google, Inc.
+ *
+ * Author:
+ * Colin Cross <ccross@android.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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 __LINUX_USB_OTG_ID_H
+#define __LINUX_USB_OTG_ID_H
+
+#include <linux/notifier.h>
+#include <linux/plist.h>
+
+/**
+ * otg_id_notifier_block
+ *
+ * @priority: Order the notifications will be called in. Higher numbers
+ * get called first.
+ * @detect: Called during otg_id_notify. Return OTG_ID_HANDLED if the USB cable
+ * has been identified
+ * @proxy_wait: Called during otg_id_notify if a previous handler returns
+ * OTG_ID_PROXY_WAIT. This should wait on ID change then call otg_id_notify.
+ * This is used when a handler knows what's connected but can't detect
+ * the change itself.
+ * @cancel: Called after detect has returned OTG_ID_HANDLED to ask it to
+ * release detection resources to allow a new identification to occur.
+ */
+
+struct otg_id_notifier_block {
+ int priority;
+ int (*detect)(struct otg_id_notifier_block *otg_id_nb);
+ int (*proxy_wait)(struct otg_id_notifier_block *otg_id_nb);
+ void (*cancel)(struct otg_id_notifier_block *otg_id_nb);
+ struct plist_node p;
+};
+
+#define OTG_ID_PROXY_WAIT 2
+#define OTG_ID_HANDLED 1
+#define OTG_ID_UNHANDLED 0
+
+int otg_id_register_notifier(struct otg_id_notifier_block *otg_id_nb);
+void otg_id_unregister_notifier(struct otg_id_notifier_block *otg_id_nb);
+
+void otg_id_notify(void);
+int otg_id_suspend(void);
+void otg_id_resume(void);
+
+#endif /* __LINUX_USB_OTG_ID_H */
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
index 3e93de7..ef75b0b 100644
--- a/include/linux/usb/quirks.h
+++ b/include/linux/usb/quirks.h
@@ -30,4 +30,13 @@
descriptor */
#define USB_QUIRK_DELAY_INIT 0x00000040
+/* device does not support reset-resume */
+#define USB_QUIRK_NO_RESET_RESUME 0x00000080
+
+/* device does not need GET_STATUS request */
+#define USB_QUIRK_NO_GET_STATUS 0x00000100
+
+/* device needs hsic specific tunning */
+#define USB_QUIRK_HSIC_TUNE 0x00000200
+
#endif /* __LINUX_USB_QUIRKS_H */