blob: cd7fcad4901709dca23c24dca9923f91a1b12cc2 [file] [log] [blame]
Alexander Shishkine443b332012-05-11 17:25:46 +03001/*
2 * Platform data for the chipidea USB dual role controller
3 */
4
5#ifndef __LINUX_USB_CHIPIDEA_H
6#define __LINUX_USB_CHIPIDEA_H
7
Richard Zhaoa2c3d692012-07-07 22:56:46 +08008#include <linux/usb/otg.h>
9
Alexander Shishkin8e229782013-06-24 14:46:36 +030010struct ci_hdrc;
11struct ci_hdrc_platform_data {
Alexander Shishkine443b332012-05-11 17:25:46 +030012 const char *name;
13 /* offset of the capability registers */
14 uintptr_t capoffset;
Alexander Shishkinbd841982012-05-11 17:25:55 +030015 unsigned power_budget;
Antoine Tenart1e5e2d32014-10-30 18:41:19 +010016 struct phy *phy;
17 /* old usb_phy interface */
Antoine Tenartef44cb42014-10-30 18:41:16 +010018 struct usb_phy *usb_phy;
Michael Grzeschik40dcd0e2013-06-13 17:59:56 +030019 enum usb_phy_interface phy_mode;
Alexander Shishkine443b332012-05-11 17:25:46 +030020 unsigned long flags;
Alexander Shishkin8e229782013-06-24 14:46:36 +030021#define CI_HDRC_REGS_SHARED BIT(0)
Peter Chen8022d3d2014-10-30 09:15:15 +080022#define CI_HDRC_DISABLE_DEVICE_STREAMING BIT(1)
Peter Chen1f874ed2015-02-11 12:44:45 +080023#define CI_HDRC_SUPPORTS_RUNTIME_PM BIT(2)
Peter Chen8022d3d2014-10-30 09:15:15 +080024#define CI_HDRC_DISABLE_HOST_STREAMING BIT(3)
25#define CI_HDRC_DISABLE_STREAMING (CI_HDRC_DISABLE_DEVICE_STREAMING | \
26 CI_HDRC_DISABLE_HOST_STREAMING)
Peter Chen577b2322013-08-14 12:44:08 +030027 /*
28 * Only set it when DCCPARAMS.DC==1 and DCCPARAMS.HC==1,
29 * but otg is not supported (no register otgsc).
30 */
31#define CI_HDRC_DUAL_ROLE_NOT_OTG BIT(4)
Peter Chened8f8312014-01-10 13:51:27 +080032#define CI_HDRC_IMX28_WRITE_FIX BIT(5)
Michael Grzeschik4f6743d2014-02-19 13:41:43 +080033#define CI_HDRC_FORCE_FULLSPEED BIT(6)
Li Jun6adb9b7b2015-02-11 12:45:01 +080034#define CI_HDRC_TURN_VBUS_EARLY_ON BIT(7)
Peter Chen28362672015-06-18 11:51:53 +080035#define CI_HDRC_SET_NON_ZERO_TTHA BIT(8)
Peter Chen65668712015-03-17 14:21:00 +080036#define CI_HDRC_OVERRIDE_AHB_BURST BIT(9)
Sascha Hauer691962d2013-06-13 17:59:57 +030037 enum usb_dr_mode dr_mode;
Alexander Shishkin8e229782013-06-24 14:46:36 +030038#define CI_HDRC_CONTROLLER_RESET_EVENT 0
39#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1
40 void (*notify_event) (struct ci_hdrc *ci, unsigned event);
Peter Chen1542d9c2013-08-14 12:44:03 +030041 struct regulator *reg_vbus;
Peter Chenf6a9ff02014-08-19 09:51:56 +080042 bool tpl_support;
Peter Chendf96ed82014-09-22 16:45:39 +080043 /* interrupt threshold setting */
44 u32 itc_setting;
Peter Chen65668712015-03-17 14:21:00 +080045 u32 ahb_burst_config;
Alexander Shishkine443b332012-05-11 17:25:46 +030046};
47
48/* Default offset of capability registers */
49#define DEF_CAPOFFSET 0x100
50
Alexander Shishkin8e229782013-06-24 14:46:36 +030051/* Add ci hdrc device */
52struct platform_device *ci_hdrc_add_device(struct device *dev,
Richard Zhaocbc6dc22012-07-07 22:56:41 +080053 struct resource *res, int nres,
Alexander Shishkin8e229782013-06-24 14:46:36 +030054 struct ci_hdrc_platform_data *platdata);
55/* Remove ci hdrc device */
56void ci_hdrc_remove_device(struct platform_device *pdev);
Richard Zhaocbc6dc22012-07-07 22:56:41 +080057
Alexander Shishkine443b332012-05-11 17:25:46 +030058#endif