diff options
author | Jyri Sarha <jsarha@ti.com> | 2016-11-15 16:02:58 -0500 |
---|---|---|
committer | Jyri Sarha <jsarha@ti.com> | 2016-11-30 07:19:02 -0500 |
commit | 0f92e898d187e2c52cec7b93aa9d93ee8ed2cf16 (patch) | |
tree | 88536276b460651ce120edcf5ea28eda9af0b013 /drivers/gpu/drm/tilcdc | |
parent | 9963d36d14ecca29414c0e78d41840cec5b0ea03 (diff) |
drm/tilcdc: Add tilcdc_write_mask() to tilcdc_regs.h
Add tilcdc_write_mask() for handling register field wider than one bit
and mask values for those fields.
Signed-off-by: Jyri Sarha <jsarha@ti.com>
Tested-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Diffstat (limited to 'drivers/gpu/drm/tilcdc')
-rw-r--r-- | drivers/gpu/drm/tilcdc/tilcdc_regs.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_regs.h b/drivers/gpu/drm/tilcdc/tilcdc_regs.h index d195b6536e12..d69a940adbea 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_regs.h +++ b/drivers/gpu/drm/tilcdc/tilcdc_regs.h | |||
@@ -34,11 +34,14 @@ | |||
34 | 34 | ||
35 | /* LCDC DMA Control Register */ | 35 | /* LCDC DMA Control Register */ |
36 | #define LCDC_DMA_BURST_SIZE(x) ((x) << 4) | 36 | #define LCDC_DMA_BURST_SIZE(x) ((x) << 4) |
37 | #define LCDC_DMA_BURST_SIZE_MASK ((0x7) << 4) | ||
37 | #define LCDC_DMA_BURST_1 0x0 | 38 | #define LCDC_DMA_BURST_1 0x0 |
38 | #define LCDC_DMA_BURST_2 0x1 | 39 | #define LCDC_DMA_BURST_2 0x1 |
39 | #define LCDC_DMA_BURST_4 0x2 | 40 | #define LCDC_DMA_BURST_4 0x2 |
40 | #define LCDC_DMA_BURST_8 0x3 | 41 | #define LCDC_DMA_BURST_8 0x3 |
41 | #define LCDC_DMA_BURST_16 0x4 | 42 | #define LCDC_DMA_BURST_16 0x4 |
43 | #define LCDC_DMA_FIFO_THRESHOLD(x) ((x) << 8) | ||
44 | #define LCDC_DMA_FIFO_THRESHOLD_MASK ((0x3) << 8) | ||
42 | #define LCDC_V1_END_OF_FRAME_INT_ENA BIT(2) | 45 | #define LCDC_V1_END_OF_FRAME_INT_ENA BIT(2) |
43 | #define LCDC_V2_END_OF_FRAME0_INT_ENA BIT(8) | 46 | #define LCDC_V2_END_OF_FRAME0_INT_ENA BIT(8) |
44 | #define LCDC_V2_END_OF_FRAME1_INT_ENA BIT(9) | 47 | #define LCDC_V2_END_OF_FRAME1_INT_ENA BIT(9) |
@@ -46,10 +49,12 @@ | |||
46 | 49 | ||
47 | /* LCDC Control Register */ | 50 | /* LCDC Control Register */ |
48 | #define LCDC_CLK_DIVISOR(x) ((x) << 8) | 51 | #define LCDC_CLK_DIVISOR(x) ((x) << 8) |
52 | #define LCDC_CLK_DIVISOR_MASK ((0xFF) << 8) | ||
49 | #define LCDC_RASTER_MODE 0x01 | 53 | #define LCDC_RASTER_MODE 0x01 |
50 | 54 | ||
51 | /* LCDC Raster Control Register */ | 55 | /* LCDC Raster Control Register */ |
52 | #define LCDC_PALETTE_LOAD_MODE(x) ((x) << 20) | 56 | #define LCDC_PALETTE_LOAD_MODE(x) ((x) << 20) |
57 | #define LCDC_PALETTE_LOAD_MODE_MASK ((0x3) << 20) | ||
53 | #define PALETTE_AND_DATA 0x00 | 58 | #define PALETTE_AND_DATA 0x00 |
54 | #define PALETTE_ONLY 0x01 | 59 | #define PALETTE_ONLY 0x01 |
55 | #define DATA_ONLY 0x02 | 60 | #define DATA_ONLY 0x02 |
@@ -75,7 +80,9 @@ | |||
75 | 80 | ||
76 | /* LCDC Raster Timing 2 Register */ | 81 | /* LCDC Raster Timing 2 Register */ |
77 | #define LCDC_AC_BIAS_TRANSITIONS_PER_INT(x) ((x) << 16) | 82 | #define LCDC_AC_BIAS_TRANSITIONS_PER_INT(x) ((x) << 16) |
83 | #define LCDC_AC_BIAS_TRANSITIONS_PER_INT_MASK ((0xF) << 16) | ||
78 | #define LCDC_AC_BIAS_FREQUENCY(x) ((x) << 8) | 84 | #define LCDC_AC_BIAS_FREQUENCY(x) ((x) << 8) |
85 | #define LCDC_AC_BIAS_FREQUENCY_MASK ((0xFF) << 8) | ||
79 | #define LCDC_SYNC_CTRL BIT(25) | 86 | #define LCDC_SYNC_CTRL BIT(25) |
80 | #define LCDC_SYNC_EDGE BIT(24) | 87 | #define LCDC_SYNC_EDGE BIT(24) |
81 | #define LCDC_INVERT_PIXEL_CLOCK BIT(22) | 88 | #define LCDC_INVERT_PIXEL_CLOCK BIT(22) |
@@ -140,6 +147,12 @@ static inline u32 tilcdc_read(struct drm_device *dev, u32 reg) | |||
140 | return ioread32(priv->mmio + reg); | 147 | return ioread32(priv->mmio + reg); |
141 | } | 148 | } |
142 | 149 | ||
150 | static inline void tilcdc_write_mask(struct drm_device *dev, u32 reg, | ||
151 | u32 val, u32 mask) | ||
152 | { | ||
153 | tilcdc_write(dev, reg, (tilcdc_read(dev, reg) & ~mask) | (val & mask)); | ||
154 | } | ||
155 | |||
143 | static inline void tilcdc_set(struct drm_device *dev, u32 reg, u32 mask) | 156 | static inline void tilcdc_set(struct drm_device *dev, u32 reg, u32 mask) |
144 | { | 157 | { |
145 | tilcdc_write(dev, reg, tilcdc_read(dev, reg) | mask); | 158 | tilcdc_write(dev, reg, tilcdc_read(dev, reg) | mask); |