]>
Commit | Line | Data |
---|---|---|
63b1a90d SJ |
1 | /* |
2 | * Analog Devices PPI header file | |
3 | * | |
4 | * Copyright (c) 2011 Analog Devices Inc. | |
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 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
63b1a90d SJ |
14 | */ |
15 | ||
16 | #ifndef _PPI_H_ | |
17 | #define _PPI_H_ | |
18 | ||
19 | #include <linux/interrupt.h> | |
45b82596 SJ |
20 | #include <asm/blackfin.h> |
21 | #include <asm/bfin_ppi.h> | |
63b1a90d | 22 | |
45b82596 | 23 | /* EPPI */ |
63b1a90d SJ |
24 | #ifdef EPPI_EN |
25 | #define PORT_EN EPPI_EN | |
45b82596 | 26 | #define PORT_DIR EPPI_DIR |
63b1a90d SJ |
27 | #define DMA32 0 |
28 | #define PACK_EN PACKEN | |
29 | #endif | |
30 | ||
45b82596 SJ |
31 | /* EPPI3 */ |
32 | #ifdef EPPI0_CTL2 | |
33 | #define PORT_EN EPPI_CTL_EN | |
34 | #define PORT_DIR EPPI_CTL_DIR | |
35 | #define PACK_EN EPPI_CTL_PACKEN | |
36 | #define DMA32 0 | |
37 | #define DLEN_8 EPPI_CTL_DLEN08 | |
38 | #define DLEN_16 EPPI_CTL_DLEN16 | |
39 | #endif | |
40 | ||
63b1a90d SJ |
41 | struct ppi_if; |
42 | ||
43 | struct ppi_params { | |
45b82596 SJ |
44 | u32 width; /* width in pixels */ |
45 | u32 height; /* height in lines */ | |
46 | u32 hdelay; /* delay after the HSYNC in pixels */ | |
47 | u32 vdelay; /* delay after the VSYNC in lines */ | |
48 | u32 line; /* total pixels per line */ | |
49 | u32 frame; /* total lines per frame */ | |
50 | u32 hsync; /* HSYNC length in pixels */ | |
51 | u32 vsync; /* VSYNC length in lines */ | |
52 | int bpp; /* bits per pixel */ | |
53 | int dlen; /* data length for ppi in bits */ | |
54 | u32 ppi_control; /* ppi configuration */ | |
55 | u32 int_mask; /* interrupt mask */ | |
63b1a90d SJ |
56 | }; |
57 | ||
58 | struct ppi_ops { | |
59 | int (*attach_irq)(struct ppi_if *ppi, irq_handler_t handler); | |
60 | void (*detach_irq)(struct ppi_if *ppi); | |
61 | int (*start)(struct ppi_if *ppi); | |
62 | int (*stop)(struct ppi_if *ppi); | |
63 | int (*set_params)(struct ppi_if *ppi, struct ppi_params *params); | |
64 | void (*update_addr)(struct ppi_if *ppi, unsigned long addr); | |
65 | }; | |
66 | ||
67 | enum ppi_type { | |
68 | PPI_TYPE_PPI, | |
69 | PPI_TYPE_EPPI, | |
45b82596 | 70 | PPI_TYPE_EPPI3, |
63b1a90d SJ |
71 | }; |
72 | ||
73 | struct ppi_info { | |
74 | enum ppi_type type; | |
75 | int dma_ch; | |
76 | int irq_err; | |
77 | void __iomem *base; | |
78 | const unsigned short *pin_req; | |
79 | }; | |
80 | ||
81 | struct ppi_if { | |
0a6824bc | 82 | struct device *dev; |
63b1a90d SJ |
83 | unsigned long ppi_control; |
84 | const struct ppi_ops *ops; | |
85 | const struct ppi_info *info; | |
d78a4882 SJ |
86 | bool err_int; /* if we need request error interrupt */ |
87 | bool err; /* if ppi has fifo error */ | |
63b1a90d SJ |
88 | void *priv; |
89 | }; | |
90 | ||
f7d0e6d6 SZ |
91 | struct ppi_if *ppi_create_instance(struct platform_device *pdev, |
92 | const struct ppi_info *info); | |
63b1a90d SJ |
93 | void ppi_delete_instance(struct ppi_if *ppi); |
94 | #endif |