| Thomas Gleixner | d2912cb | 2019-06-04 10:11:33 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ | 
| Andy Shevchenko | 2b49e0c | 2015-02-23 16:24:42 +0200 | [diff] [blame] | 2 | /* | 
 | 3 |  * Driver for the High Speed UART DMA | 
 | 4 |  * | 
 | 5 |  * Copyright (C) 2015 Intel Corporation | 
| Andy Shevchenko | 2b49e0c | 2015-02-23 16:24:42 +0200 | [diff] [blame] | 6 |  */ | 
 | 7 |  | 
 | 8 | #ifndef _DMA_HSU_H | 
 | 9 | #define _DMA_HSU_H | 
 | 10 |  | 
 | 11 | #include <linux/device.h> | 
 | 12 | #include <linux/interrupt.h> | 
 | 13 |  | 
 | 14 | #include <linux/platform_data/dma-hsu.h> | 
 | 15 |  | 
 | 16 | struct hsu_dma; | 
 | 17 |  | 
 | 18 | /** | 
 | 19 |  * struct hsu_dma_chip - representation of HSU DMA hardware | 
 | 20 |  * @dev:		 struct device of the DMA controller | 
 | 21 |  * @irq:		 irq line | 
 | 22 |  * @regs:		 memory mapped I/O space | 
 | 23 |  * @length:		 I/O space length | 
 | 24 |  * @offset:		 offset of the I/O space where registers are located | 
 | 25 |  * @hsu:		 struct hsu_dma that is filed by ->probe() | 
 | 26 |  * @pdata:		 platform data for the DMA controller if provided | 
 | 27 |  */ | 
 | 28 | struct hsu_dma_chip { | 
 | 29 | 	struct device			*dev; | 
 | 30 | 	int				irq; | 
 | 31 | 	void __iomem			*regs; | 
 | 32 | 	unsigned int			length; | 
 | 33 | 	unsigned int			offset; | 
 | 34 | 	struct hsu_dma			*hsu; | 
| Andy Shevchenko | 2b49e0c | 2015-02-23 16:24:42 +0200 | [diff] [blame] | 35 | }; | 
 | 36 |  | 
| Heikki Krogerus | 47f82f1 | 2015-10-13 13:29:04 +0300 | [diff] [blame] | 37 | #if IS_ENABLED(CONFIG_HSU_DMA) | 
| Andy Shevchenko | 2b49e0c | 2015-02-23 16:24:42 +0200 | [diff] [blame] | 38 | /* Export to the internal users */ | 
| Chuah, Kim Tatt | c6f8278 | 2016-06-15 13:44:11 +0800 | [diff] [blame] | 39 | int hsu_dma_get_status(struct hsu_dma_chip *chip, unsigned short nr, | 
 | 40 | 		       u32 *status); | 
| Andy Shevchenko | d2f5a73 | 2016-08-23 16:09:40 +0300 | [diff] [blame] | 41 | int hsu_dma_do_irq(struct hsu_dma_chip *chip, unsigned short nr, u32 status); | 
| Andy Shevchenko | 2b49e0c | 2015-02-23 16:24:42 +0200 | [diff] [blame] | 42 |  | 
 | 43 | /* Export to the platform drivers */ | 
 | 44 | int hsu_dma_probe(struct hsu_dma_chip *chip); | 
 | 45 | int hsu_dma_remove(struct hsu_dma_chip *chip); | 
| Heikki Krogerus | 47f82f1 | 2015-10-13 13:29:04 +0300 | [diff] [blame] | 46 | #else | 
| Chuah, Kim Tatt | c6f8278 | 2016-06-15 13:44:11 +0800 | [diff] [blame] | 47 | static inline int hsu_dma_get_status(struct hsu_dma_chip *chip, | 
 | 48 | 				     unsigned short nr, u32 *status) | 
 | 49 | { | 
 | 50 | 	return 0; | 
 | 51 | } | 
| Andy Shevchenko | d2f5a73 | 2016-08-23 16:09:40 +0300 | [diff] [blame] | 52 | static inline int hsu_dma_do_irq(struct hsu_dma_chip *chip, unsigned short nr, | 
 | 53 | 				 u32 status) | 
| Heikki Krogerus | 47f82f1 | 2015-10-13 13:29:04 +0300 | [diff] [blame] | 54 | { | 
| Andy Shevchenko | d2f5a73 | 2016-08-23 16:09:40 +0300 | [diff] [blame] | 55 | 	return 0; | 
| Heikki Krogerus | 47f82f1 | 2015-10-13 13:29:04 +0300 | [diff] [blame] | 56 | } | 
 | 57 | static inline int hsu_dma_probe(struct hsu_dma_chip *chip) { return -ENODEV; } | 
 | 58 | static inline int hsu_dma_remove(struct hsu_dma_chip *chip) { return 0; } | 
 | 59 | #endif /* CONFIG_HSU_DMA */ | 
| Andy Shevchenko | 2b49e0c | 2015-02-23 16:24:42 +0200 | [diff] [blame] | 60 |  | 
 | 61 | #endif /* _DMA_HSU_H */ |