staging: sm750fb: change definition of DE_PITCH fields
authorMike Rapoport <mike.rapoport@gmail.com>
Mon, 15 Feb 2016 17:54:01 +0000 (19:54 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 16 Feb 2016 02:26:17 +0000 (18:26 -0800)
Use stratight-forward definition of DE_PITCH register fields
and use open-coded implementation for register manipulation

Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/sm750fb/sm750_accel.c
drivers/staging/sm750fb/sm750_accel.h

index bcc09e5212e3ed3262f9536110a607ca8d39e2a0..61666ce86d03ec6c0258f183d768e5308b6c8925 100644 (file)
@@ -100,8 +100,9 @@ int hw_fillrect(struct lynx_accel *accel,
 
        write_dpr(accel, DE_WINDOW_DESTINATION_BASE, base); /* dpr40 */
        write_dpr(accel, DE_PITCH,
-                       FIELD_VALUE(0, DE_PITCH, DESTINATION, pitch/Bpp)|
-                       FIELD_VALUE(0, DE_PITCH, SOURCE, pitch/Bpp)); /* dpr10 */
+                 ((pitch / Bpp << DE_PITCH_DESTINATION_SHIFT) &
+                  DE_PITCH_DESTINATION_MASK) |
+                 (pitch / Bpp & DE_PITCH_SOURCE_MASK)); /* dpr10 */
 
        write_dpr(accel, DE_WINDOW_WIDTH,
                        FIELD_VALUE(0, DE_WINDOW_WIDTH, DESTINATION, pitch/Bpp)|
@@ -227,11 +228,10 @@ unsigned int rop2)   /* ROP value */
        Note that input pitch is BYTE value, but the 2D Pitch register uses
        pixel values. Need Byte to pixel conversion.
     */
-       {
-               write_dpr(accel, DE_PITCH,
-                               FIELD_VALUE(0, DE_PITCH, DESTINATION, (dPitch/Bpp)) |
-                               FIELD_VALUE(0, DE_PITCH, SOURCE,      (sPitch/Bpp))); /* dpr10 */
-       }
+       write_dpr(accel, DE_PITCH,
+                 ((dPitch / Bpp << DE_PITCH_DESTINATION_SHIFT) &
+                  DE_PITCH_DESTINATION_MASK) |
+                 (sPitch / Bpp & DE_PITCH_SOURCE_MASK)); /* dpr10 */
 
     /* Screen Window width in Pixels.
        2D engine uses this value to calculate the linear address in frame buffer for a given point.
@@ -320,11 +320,10 @@ int hw_imageblit(struct lynx_accel *accel,
        Note that input pitch is BYTE value, but the 2D Pitch register uses
        pixel values. Need Byte to pixel conversion.
     */
-       {
-               write_dpr(accel, DE_PITCH,
-                               FIELD_VALUE(0, DE_PITCH, DESTINATION, dPitch/bytePerPixel) |
-                               FIELD_VALUE(0, DE_PITCH, SOURCE,      dPitch/bytePerPixel)); /* dpr10 */
-       }
+       write_dpr(accel, DE_PITCH,
+                 ((dPitch / bytePerPixel << DE_PITCH_DESTINATION_SHIFT) &
+                  DE_PITCH_DESTINATION_MASK) |
+                 (dPitch / bytePerPixel & DE_PITCH_SOURCE_MASK)); /* dpr10 */
 
        /* Screen Window width in Pixels.
         2D engine uses this value to calculate the linear address in frame buffer for a given point.
index 8fba6e16f9b495762db60cf1e2399b74158a7a73..f14abb68af2e7555aae530c2986e04f641cc72f5 100644 (file)
@@ -98,8 +98,9 @@
 #define DE_CONTROL_ROTATION_180                         3
 
 #define DE_PITCH                                        0x000010
-#define DE_PITCH_DESTINATION                            28:16
-#define DE_PITCH_SOURCE                                 12:0
+#define DE_PITCH_DESTINATION_SHIFT                      16
+#define DE_PITCH_DESTINATION_MASK                       (0x1fff << 16)
+#define DE_PITCH_SOURCE_MASK                            0x1fff
 
 #define DE_FOREGROUND                                   0x000014
 #define DE_FOREGROUND_COLOR                             31:0