Vinod Koul | 2f52a51 | 2017-12-14 11:19:41 +0530 | [diff] [blame] | 1 | // SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) |
| 2 | // Copyright(c) 2015-17 Intel Corporation. |
| 3 | |
| 4 | #ifndef __SDW_CADENCE_H |
| 5 | #define __SDW_CADENCE_H |
| 6 | |
| 7 | /** |
| 8 | * struct sdw_cdns - Cadence driver context |
| 9 | * @dev: Linux device |
| 10 | * @bus: Bus handle |
| 11 | * @instance: instance number |
Sanyog Kale | 956baa1 | 2017-12-14 11:19:42 +0530 | [diff] [blame] | 12 | * @response_buf: SoundWire response buffer |
| 13 | * @tx_complete: Tx completion |
| 14 | * @defer: Defer pointer |
Vinod Koul | 2f52a51 | 2017-12-14 11:19:41 +0530 | [diff] [blame] | 15 | * @registers: Cadence registers |
| 16 | * @link_up: Link status |
Sanyog Kale | 956baa1 | 2017-12-14 11:19:42 +0530 | [diff] [blame] | 17 | * @msg_count: Messages sent on bus |
Vinod Koul | 2f52a51 | 2017-12-14 11:19:41 +0530 | [diff] [blame] | 18 | */ |
| 19 | struct sdw_cdns { |
| 20 | struct device *dev; |
| 21 | struct sdw_bus bus; |
| 22 | unsigned int instance; |
| 23 | |
Sanyog Kale | 956baa1 | 2017-12-14 11:19:42 +0530 | [diff] [blame] | 24 | u32 response_buf[0x80]; |
| 25 | struct completion tx_complete; |
| 26 | struct sdw_defer *defer; |
| 27 | |
Vinod Koul | 2f52a51 | 2017-12-14 11:19:41 +0530 | [diff] [blame] | 28 | void __iomem *registers; |
| 29 | |
| 30 | bool link_up; |
Sanyog Kale | 956baa1 | 2017-12-14 11:19:42 +0530 | [diff] [blame] | 31 | unsigned int msg_count; |
Vinod Koul | 2f52a51 | 2017-12-14 11:19:41 +0530 | [diff] [blame] | 32 | }; |
| 33 | |
| 34 | #define bus_to_cdns(_bus) container_of(_bus, struct sdw_cdns, bus) |
| 35 | |
| 36 | /* Exported symbols */ |
| 37 | |
Sanyog Kale | 956baa1 | 2017-12-14 11:19:42 +0530 | [diff] [blame] | 38 | int sdw_cdns_probe(struct sdw_cdns *cdns); |
| 39 | extern struct sdw_master_ops sdw_cdns_master_ops; |
| 40 | |
Vinod Koul | 2f52a51 | 2017-12-14 11:19:41 +0530 | [diff] [blame] | 41 | irqreturn_t sdw_cdns_irq(int irq, void *dev_id); |
| 42 | irqreturn_t sdw_cdns_thread(int irq, void *dev_id); |
| 43 | |
| 44 | int sdw_cdns_init(struct sdw_cdns *cdns); |
Sanyog Kale | 956baa1 | 2017-12-14 11:19:42 +0530 | [diff] [blame] | 45 | int sdw_cdns_enable_interrupt(struct sdw_cdns *cdns); |
| 46 | |
Vinod Koul | 2f52a51 | 2017-12-14 11:19:41 +0530 | [diff] [blame] | 47 | |
| 48 | #endif /* __SDW_CADENCE_H */ |