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