| 1 | /* |
| 2 | * arch/ubicom32/include/asm/vdc_tio.h |
| 3 | * Ubicom32 architecture VDC TIO definitions. |
| 4 | * |
| 5 | * (C) Copyright 2009, Ubicom, Inc. |
| 6 | * |
| 7 | * This file is part of the Ubicom32 Linux Kernel Port. |
| 8 | * |
| 9 | * The Ubicom32 Linux Kernel Port is free software: you can redistribute |
| 10 | * it and/or modify it under the terms of the GNU General Public License |
| 11 | * as published by the Free Software Foundation, either version 2 of the |
| 12 | * License, or (at your option) any later version. |
| 13 | * |
| 14 | * The Ubicom32 Linux Kernel Port is distributed in the hope that it |
| 15 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
| 16 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See |
| 17 | * the GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with the Ubicom32 Linux Kernel Port. If not, |
| 21 | * see <http://www.gnu.org/licenses/>. |
| 22 | * |
| 23 | * Ubicom32 implementation derived from (with many thanks): |
| 24 | * arch/m68knommu |
| 25 | * arch/blackfin |
| 26 | * arch/parisc |
| 27 | */ |
| 28 | #ifndef _ASM_UBICOM32_VDC_TIO_H |
| 29 | #define _ASM_UBICOM32_VDC_TIO_H |
| 30 | |
| 31 | #include <asm/devtree.h> |
| 32 | |
| 33 | #define VDCTIO_VP_VERSION 5 |
| 34 | |
| 35 | #define VDCTIO_SCALE_FLAG_VSUB (1 << 9) |
| 36 | #define VDCTIO_SCALE_FLAG_YUV_SCAN_ORDER (1 << 8) |
| 37 | #define VDCTIO_SCALE_FLAG_YUV_BLOCK_ORDER (1 << 7) |
| 38 | #define VDCTIO_SCALE_FLAG_YUV (1 << 6) |
| 39 | #define VDCTIO_SCALE_FLAG_VRANGE_16_255 (1 << 5) |
| 40 | #define VDCTIO_SCALE_FLAG_VRANGE_0_255 (1 << 4) |
| 41 | #define VDCTIO_SCALE_FLAG_HSUB_2_1 (1 << 3) |
| 42 | #define VDCTIO_SCALE_FLAG_HSUB_1_1 (1 << 2) |
| 43 | #define VDCTIO_SCALE_FLAG_SET_FRAME_BUFFER (1 << 1) |
| 44 | #define VDCTIO_SCALE_FLAG_ENABLE (1 << 0) |
| 45 | |
| 46 | #define VDCTIO_NEXT_FRAME_FLAG_YUV_BIT 0 |
| 47 | #define VDCTIO_NEXT_FRAME_FLAG_YUV (1 << (VDCTIO_NEXT_FRAME_FLAG_YUV_BIT)) |
| 48 | |
| 49 | #define VDCTIO_CAPS_SUPPORTS_SCALING (1 << 0) |
| 50 | |
| 51 | #define VDCTIO_COMMAND_START (1 << 3) |
| 52 | #define VDCTIO_COMMAND_SET_COEFF (1 << 2) |
| 53 | #define VDCTIO_COMMAND_SET_LUT (1 << 1) |
| 54 | #define VDCTIO_COMMAND_SET_SCALE_MODE (1 << 0) |
| 55 | |
| 56 | /* |
| 57 | * Command / Data registers to access the VDC |
| 58 | */ |
| 59 | struct vdc_tio_vp_regs { |
| 60 | /* |
| 61 | * Version of this TIO register map |
| 62 | */ |
| 63 | u32_t version; |
| 64 | |
| 65 | volatile u32_t command; |
| 66 | |
| 67 | /* |
| 68 | * Next frame pointer, when the command VDCTIO_COMMAND_SET_FRAME_BUFFER is set, |
| 69 | * the vdc will take the pointer here and display it. |
| 70 | */ |
| 71 | void *next_frame; |
| 72 | u32_t next_frame_flags; |
| 73 | |
| 74 | /* |
| 75 | * These map directly into the PIXP registers 0x20-0x80. |
| 76 | * DO NOT change the order of these three variables. |
| 77 | */ |
| 78 | u32_t red_lut[6]; |
| 79 | u32_t blue_lut[6]; |
| 80 | u32_t green_lut[13]; |
| 81 | |
| 82 | /* |
| 83 | * These map directly into the PIXP registers 0x04, 0x08 |
| 84 | */ |
| 85 | u32_t coeff0; |
| 86 | u32_t coeff1; |
| 87 | |
| 88 | /* |
| 89 | * There are used to set the scaling parameters |
| 90 | */ |
| 91 | u32_t x_in; |
| 92 | u32_t x_out; |
| 93 | u32_t y_in; |
| 94 | u32_t y_out; |
| 95 | u32_t scale_flags; |
| 96 | |
| 97 | /* |
| 98 | * Current frame number, monotonically increasing number |
| 99 | */ |
| 100 | u32_t frame_number; |
| 101 | |
| 102 | /* |
| 103 | * These variables tell the guest OS what the underlying hardware looks like |
| 104 | */ |
| 105 | u32_t caps; |
| 106 | u32_t xres; |
| 107 | u32_t yres; |
| 108 | u32_t fb_align; |
| 109 | u8_t bpp; |
| 110 | u8_t rbits; |
| 111 | u8_t gbits; |
| 112 | u8_t bbits; |
| 113 | u8_t rshift; |
| 114 | u8_t gshift; |
| 115 | u8_t bshift; |
| 116 | }; |
| 117 | |
| 118 | /* |
| 119 | * Devtree node for VDC |
| 120 | */ |
| 121 | struct vdc_tio_node { |
| 122 | struct devtree_node dn; |
| 123 | |
| 124 | struct vdc_tio_vp_regs *regs; |
| 125 | }; |
| 126 | |
| 127 | extern void vdc_tio_init(void); |
| 128 | |
| 129 | #endif /* _ASM_UBICOM32_VDC_TIO_H */ |
| 130 | |