aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb
diff options
context:
space:
mode:
authorPavankumar Kondeti <pkondeti@codeaurora.org>2010-12-07 07:23:55 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2010-12-10 17:23:31 -0500
commite0c201f339fe7fc38d1b0f6f4755ff627686c7e0 (patch)
treea8245f60d4e0c0e22901a15a655af45eaf17325d /include/linux/usb
parent05570297ecbe834b1756b522412b68eaffb9ab11 (diff)
USB: Add MSM OTG Controller driver
This driver implements PHY initialization, clock management, 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 debugfs interface to select host/peripheral mode. Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/usb')
-rw-r--r--include/linux/usb/msm_hsusb.h108
-rw-r--r--include/linux/usb/msm_hsusb_hw.h56
2 files changed, 164 insertions, 0 deletions
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
new file mode 100644
index 000000000000..b796df94ec72
--- /dev/null
+++ b/include/linux/usb/msm_hsusb.h
@@ -0,0 +1,108 @@
1/* linux/include/asm-arm/arch-msm/hsusb.h
2 *
3 * Copyright (C) 2008 Google, Inc.
4 * Author: Brian Swetland <swetland@google.com>
5 * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#ifndef __ASM_ARCH_MSM_HSUSB_H
19#define __ASM_ARCH_MSM_HSUSB_H
20
21#include <linux/types.h>
22#include <linux/usb/otg.h>
23
24/**
25 * Supported USB modes
26 *
27 * USB_PERIPHERAL Only peripheral mode is supported.
28 * USB_HOST Only host mode is supported.
29 * USB_OTG OTG mode is supported.
30 *
31 */
32enum usb_mode_type {
33 USB_NONE = 0,
34 USB_PERIPHERAL,
35 USB_HOST,
36 USB_OTG,
37};
38
39/**
40 * OTG control
41 *
42 * OTG_NO_CONTROL Id/VBUS notifications not required. Useful in host
43 * only configuration.
44 * OTG_PHY_CONTROL Id/VBUS notifications comes form USB PHY.
45 * OTG_PMIC_CONTROL Id/VBUS notifications comes from PMIC hardware.
46 * OTG_USER_CONTROL Id/VBUS notifcations comes from User via sysfs.
47 *
48 */
49enum otg_control_type {
50 OTG_NO_CONTROL = 0,
51 OTG_PHY_CONTROL,
52 OTG_PMIC_CONTROL,
53 OTG_USER_CONTROL,
54};
55
56/**
57 * struct msm_otg_platform_data - platform device data
58 * for msm72k_otg driver.
59 * @phy_init_seq: PHY configuration sequence. val, reg pairs
60 * terminated by -1.
61 * @vbus_power: VBUS power on/off routine.
62 * @power_budget: VBUS power budget in mA (0 will be treated as 500mA).
63 * @mode: Supported mode (OTG/peripheral/host).
64 * @otg_control: OTG switch controlled by user/Id pin
65 * @default_mode: Default operational mode. Applicable only if
66 * OTG switch is controller by user.
67 *
68 */
69struct msm_otg_platform_data {
70 int *phy_init_seq;
71 void (*vbus_power)(bool on);
72 unsigned power_budget;
73 enum usb_mode_type mode;
74 enum otg_control_type otg_control;
75 enum usb_mode_type default_mode;
76 void (*setup_gpio)(enum usb_otg_state state);
77};
78
79/**
80 * struct msm_otg: OTG driver data. Shared by HCD and DCD.
81 * @otg: USB OTG Transceiver structure.
82 * @pdata: otg device platform data.
83 * @irq: IRQ number assigned for HSUSB controller.
84 * @clk: clock struct of usb_hs_clk.
85 * @pclk: clock struct of usb_hs_pclk.
86 * @phy_reset_clk: clock struct of usb_phy_clk.
87 * @core_clk: clock struct of usb_hs_core_clk.
88 * @regs: ioremapped register base address.
89 * @inputs: OTG state machine inputs(Id, SessValid etc).
90 * @sm_work: OTG state machine work.
91 *
92 */
93struct msm_otg {
94 struct otg_transceiver otg;
95 struct msm_otg_platform_data *pdata;
96 int irq;
97 struct clk *clk;
98 struct clk *pclk;
99 struct clk *phy_reset_clk;
100 struct clk *core_clk;
101 void __iomem *regs;
102#define ID 0
103#define B_SESS_VLD 1
104 unsigned long inputs;
105 struct work_struct sm_work;
106};
107
108#endif
diff --git a/include/linux/usb/msm_hsusb_hw.h b/include/linux/usb/msm_hsusb_hw.h
new file mode 100644
index 000000000000..b061cffcf048
--- /dev/null
+++ b/include/linux/usb/msm_hsusb_hw.h
@@ -0,0 +1,56 @@
1/*
2 * Copyright (C) 2007 Google, Inc.
3 * Author: Brian Swetland <swetland@google.com>
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#ifndef __LINUX_USB_GADGET_MSM72K_UDC_H__
17#define __LINUX_USB_GADGET_MSM72K_UDC_H__
18
19#ifdef CONFIG_ARCH_MSM7X00A
20#define USB_SBUSCFG (MSM_USB_BASE + 0x0090)
21#else
22#define USB_AHBBURST (MSM_USB_BASE + 0x0090)
23#define USB_AHBMODE (MSM_USB_BASE + 0x0098)
24#endif
25#define USB_CAPLENGTH (MSM_USB_BASE + 0x0100) /* 8 bit */
26
27#define USB_USBCMD (MSM_USB_BASE + 0x0140)
28#define USB_PORTSC (MSM_USB_BASE + 0x0184)
29#define USB_OTGSC (MSM_USB_BASE + 0x01A4)
30#define USB_USBMODE (MSM_USB_BASE + 0x01A8)
31
32#define USBCMD_RESET 2
33#define USB_USBINTR (MSM_USB_BASE + 0x0148)
34
35#define PORTSC_PHCD (1 << 23) /* phy suspend mode */
36#define PORTSC_PTS_MASK (3 << 30)
37#define PORTSC_PTS_ULPI (3 << 30)
38
39#define USB_ULPI_VIEWPORT (MSM_USB_BASE + 0x0170)
40#define ULPI_RUN (1 << 30)
41#define ULPI_WRITE (1 << 29)
42#define ULPI_READ (0 << 29)
43#define ULPI_ADDR(n) (((n) & 255) << 16)
44#define ULPI_DATA(n) ((n) & 255)
45#define ULPI_DATA_READ(n) (((n) >> 8) & 255)
46
47/* OTG definitions */
48#define OTGSC_INTSTS_MASK (0x7f << 16)
49#define OTGSC_ID (1 << 8)
50#define OTGSC_BSV (1 << 11)
51#define OTGSC_IDIS (1 << 16)
52#define OTGSC_BSVIS (1 << 19)
53#define OTGSC_IDIE (1 << 24)
54#define OTGSC_BSVIE (1 << 27)
55
56#endif /* __LINUX_USB_GADGET_MSM72K_UDC_H__ */