Mayank Rana | 511f3b2 | 2016-08-02 12:00:11 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | |
| 13 | #ifndef __DBM_H |
| 14 | #define __DBM_H |
| 15 | |
| 16 | #include <linux/device.h> |
| 17 | #include <linux/types.h> |
| 18 | |
| 19 | /** |
| 20 | * USB DBM Hardware registers bitmask. |
| 21 | * |
| 22 | */ |
| 23 | /* DBM_EP_CFG */ |
| 24 | #define DBM_EN_EP 0x00000001 |
| 25 | #define USB3_EPNUM 0x0000003E |
| 26 | #define DBM_BAM_PIPE_NUM 0x000000C0 |
| 27 | #define DBM_PRODUCER 0x00000100 |
| 28 | #define DBM_DISABLE_WB 0x00000200 |
| 29 | #define DBM_INT_RAM_ACC 0x00000400 |
| 30 | |
| 31 | /* DBM_DATA_FIFO_SIZE */ |
| 32 | #define DBM_DATA_FIFO_SIZE_MASK 0x0000ffff |
| 33 | |
| 34 | /* DBM_GEVNTSIZ */ |
| 35 | #define DBM_GEVNTSIZ_MASK 0x0000ffff |
| 36 | |
| 37 | /* DBM_DBG_CNFG */ |
| 38 | #define DBM_ENABLE_IOC_MASK 0x0000000f |
| 39 | |
| 40 | /* DBM_SOFT_RESET */ |
| 41 | #define DBM_SFT_RST_EP0 0x00000001 |
| 42 | #define DBM_SFT_RST_EP1 0x00000002 |
| 43 | #define DBM_SFT_RST_EP2 0x00000004 |
| 44 | #define DBM_SFT_RST_EP3 0x00000008 |
| 45 | #define DBM_SFT_RST_EPS_MASK 0x0000000F |
| 46 | #define DBM_SFT_RST_MASK 0x80000000 |
| 47 | #define DBM_EN_MASK 0x00000002 |
| 48 | |
| 49 | /* DBM TRB configurations */ |
| 50 | #define DBM_TRB_BIT 0x80000000 |
| 51 | #define DBM_TRB_DATA_SRC 0x40000000 |
| 52 | #define DBM_TRB_DMA 0x20000000 |
| 53 | #define DBM_TRB_EP_NUM(ep) (ep<<24) |
| 54 | |
| 55 | struct dbm; |
| 56 | |
| 57 | struct dbm *usb_get_dbm_by_phandle(struct device *dev, const char *phandle); |
| 58 | |
| 59 | int dbm_soft_reset(struct dbm *dbm, bool enter_reset); |
| 60 | int dbm_ep_config(struct dbm *dbm, u8 usb_ep, u8 bam_pipe, bool producer, |
| 61 | bool disable_wb, bool internal_mem, bool ioc); |
| 62 | int dbm_ep_unconfig(struct dbm *dbm, u8 usb_ep); |
| 63 | int dbm_get_num_of_eps_configured(struct dbm *dbm); |
| 64 | int dbm_event_buffer_config(struct dbm *dbm, u32 addr_lo, u32 addr_hi, |
| 65 | int size); |
| 66 | int dbm_data_fifo_config(struct dbm *dbm, u8 dep_num, phys_addr_t addr, |
| 67 | u32 size, u8 dst_pipe_idx); |
| 68 | void dbm_set_speed(struct dbm *dbm, bool speed); |
| 69 | void dbm_enable(struct dbm *dbm); |
| 70 | int dbm_ep_soft_reset(struct dbm *dbm, u8 usb_ep, bool enter_reset); |
| 71 | bool dbm_reset_ep_after_lpm(struct dbm *dbm); |
| 72 | bool dbm_l1_lpm_interrupt(struct dbm *dbm); |
| 73 | |
| 74 | #endif /* __DBM_H */ |