diff options
Diffstat (limited to 'include/linux/usb/langwell_otg.h')
-rw-r--r-- | include/linux/usb/langwell_otg.h | 120 |
1 files changed, 41 insertions, 79 deletions
diff --git a/include/linux/usb/langwell_otg.h b/include/linux/usb/langwell_otg.h index e115ae6df1da..51f17b16d312 100644 --- a/include/linux/usb/langwell_otg.h +++ b/include/linux/usb/langwell_otg.h @@ -1,6 +1,6 @@ /* * Intel Langwell USB OTG transceiver driver - * Copyright (C) 2008, Intel Corporation. + * Copyright (C) 2008 - 2010, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -17,21 +17,10 @@ * */ -#ifndef __LANGWELL_OTG_H__ -#define __LANGWELL_OTG_H__ +#ifndef __LANGWELL_OTG_H +#define __LANGWELL_OTG_H -/* notify transceiver driver about OTG events */ -extern void langwell_update_transceiver(void); -/* HCD register bus driver */ -extern int langwell_register_host(struct pci_driver *host_driver); -/* HCD unregister bus driver */ -extern void langwell_unregister_host(struct pci_driver *host_driver); -/* DCD register bus driver */ -extern int langwell_register_peripheral(struct pci_driver *client_driver); -/* DCD unregister bus driver */ -extern void langwell_unregister_peripheral(struct pci_driver *client_driver); -/* No silent failure, output warning message */ -extern void langwell_otg_nsf_msg(unsigned long message); +#include <linux/usb/intel_mid_otg.h> #define CI_USBCMD 0x30 # define USBCMD_RST BIT(1) @@ -78,58 +67,31 @@ extern void langwell_otg_nsf_msg(unsigned long message); # define OTGSC_VC BIT(1) # define OTGSC_VD BIT(0) # define OTGSC_INTEN_MASK (0x7f << 24) +# define OTGSC_INT_MASK (0x5f << 24) # define OTGSC_INTSTS_MASK (0x7f << 16) #define CI_USBMODE 0xf8 # define USBMODE_CM (BIT(1) | BIT(0)) # define USBMODE_IDLE 0 # define USBMODE_DEVICE 0x2 # define USBMODE_HOST 0x3 +#define USBCFG_ADDR 0xff10801c +#define USBCFG_LEN 4 +# define USBCFG_VBUSVAL BIT(14) +# define USBCFG_AVALID BIT(13) +# define USBCFG_BVALID BIT(12) +# define USBCFG_SESEND BIT(11) #define INTR_DUMMY_MASK (USBSTS_SLI | USBSTS_URI | USBSTS_PCI) -struct otg_hsm { - /* Input */ - int a_bus_resume; - int a_bus_suspend; - int a_conn; - int a_sess_vld; - int a_srp_det; - int a_vbus_vld; - int b_bus_resume; - int b_bus_suspend; - int b_conn; - int b_se0_srp; - int b_sess_end; - int b_sess_vld; - int id; - - /* Internal variables */ - int a_set_b_hnp_en; - int b_srp_done; - int b_hnp_enable; - - /* Timeout indicator for timers */ - int a_wait_vrise_tmout; - int a_wait_bcon_tmout; - int a_aidl_bdis_tmout; - int b_ase0_brst_tmout; - int b_bus_suspend_tmout; - int b_srp_res_tmout; - - /* Informative variables */ - int a_bus_drop; - int a_bus_req; - int a_clr_err; - int a_suspend_req; - int b_bus_req; - - /* Output */ - int drv_vbus; - int loc_conn; - int loc_sof; - - /* Others */ - int b_bus_suspend_vld; +enum langwell_otg_timer_type { + TA_WAIT_VRISE_TMR, + TA_WAIT_BCON_TMR, + TA_AIDL_BDIS_TMR, + TB_ASE0_BRST_TMR, + TB_SE0_SRP_TMR, + TB_SRP_INIT_TMR, + TB_SRP_FAIL_TMR, + TB_BUS_SUSPEND_TMR }; #define TA_WAIT_VRISE 100 @@ -137,7 +99,8 @@ struct otg_hsm { #define TA_AIDL_BDIS 15000 #define TB_ASE0_BRST 5000 #define TB_SE0_SRP 2 -#define TB_SRP_RES 100 +#define TB_SRP_INIT 100 +#define TB_SRP_FAIL 5500 #define TB_BUS_SUSPEND 500 struct langwell_otg_timer { @@ -149,29 +112,28 @@ struct langwell_otg_timer { }; struct langwell_otg { - struct otg_transceiver otg; - struct otg_hsm hsm; - void __iomem *regs; - unsigned region; - struct pci_driver *host_ops; - struct pci_driver *client_ops; - struct pci_dev *pdev; - struct work_struct work; - struct workqueue_struct *qwork; - spinlock_t lock; - spinlock_t wq_lock; + struct intel_mid_otg_xceiv iotg; + struct device *dev; + + void __iomem *usbcfg; /* SCCBUSB config Reg */ + + unsigned region; + unsigned cfg_region; + + struct work_struct work; + struct workqueue_struct *qwork; + struct timer_list hsm_timer; + + spinlock_t lock; + spinlock_t wq_lock; + + struct notifier_block iotg_notifier; }; -static inline struct langwell_otg *otg_to_langwell(struct otg_transceiver *otg) +static inline +struct langwell_otg *mid_xceiv_to_lnw(struct intel_mid_otg_xceiv *iotg) { - return container_of(otg, struct langwell_otg, otg); + return container_of(iotg, struct langwell_otg, iotg); } -#ifdef DEBUG -#define otg_dbg(fmt, args...) \ - printk(KERN_DEBUG fmt , ## args) -#else -#define otg_dbg(fmt, args...) \ - do { } while (0) -#endif /* DEBUG */ #endif /* __LANGWELL_OTG_H__ */ |