linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.6.18-rc4] sisusbvga: fix sisusb.c
@ 2006-08-13 20:47 Mitsuhiro KOGA
  2006-08-15  0:09 ` Antonino A. Daplas
  0 siblings, 1 reply; 9+ messages in thread
From: Mitsuhiro KOGA @ 2006-08-13 20:47 UTC (permalink / raw)
  To: akpm; +Cc: linux-fbdev-devel, linux-usb-devel

I had a problem with usb2vga and ppc linux.
The background of the console greens, and the font is not displayed.

This patch can be normally displayed by the Big endian machine.
Moreover, because KAIREN's usb2vga has two or more devices id, it adds it.

Signed-off-by: Mitsuhiro Koga <shiena.jp@gmail.com>
Cc: linux-usb-devel@lists.sourceforge.net
Cc: linux-fbdev-devel@lists.sourceforge.net
---
 drivers/usb/misc/sisusbvga/sisusb.c      |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -76,6 +76,16 @@

 DEFINE_MUTEX(disconnect_mutex);

+#ifdef __BIG_ENDIAN
+static void
+correct_endianness_buffer(u16* data, const int length)
+{
+   int i;
+   for (i = 0; i < length; i++)
+       *(data+i) = cpu_to_le16(*(data+i));
+}
+#endif
+
 static void
 sisusb_free_buffers(struct sisusb_usb_data *sisusb)
 {
@@ -411,6 +421,10 @@
            memcpy(buffer, kernbuffer, passsize);
            kernbuffer += passsize;

+#ifdef __BIG_ENDIAN
+           if ((len & 3) == 0)
+               correct_endianness_buffer((u16 *)buffer, thispass/2);
+#endif
        }

        retry = 5;
@@ -906,9 +920,13 @@
            if (userbuffer) {
                if (get_user(swap32, (u32 __user *)userbuffer))
                    return -EFAULT;
-           } else
+           } else {
                swap32 = *((u32 *)kernbuffer);

+#ifdef __BIG_ENDIAN
+               swap32 = ((swap32 << 16) & 0xffff0000) | ((swap32 >>
16) & 0xffff);
+#endif
+           }
            ret = sisusb_write_memio_long(sisusb,
                            SISUSB_TYPE_MEM,
                            addr,
@@ -1259,7 +1277,11 @@

                    userbuffer += 4;
                } else {
+#ifdef __BIG_ENDIAN
+                   *((u32 *)kernbuffer) = ((swap32 << 16) &
0xffff0000) | ((swap32 >> 16) & 0xffff);
+#else
                    *((u32 *)kernbuffer) = swap32;
+#endif
                    kernbuffer += 4;
                }
                addr += 4;
@@ -3435,6 +3457,9 @@

 static struct usb_device_id sisusb_table [] = {
    { USB_DEVICE(0x0711, 0x0900) },
+   { USB_DEVICE(0x0711, 0x0901) },
+   { USB_DEVICE(0x0711, 0x0902) },
+   { USB_DEVICE(0x0711, 0x0920) },
    { USB_DEVICE(0x182d, 0x021c) },
    { USB_DEVICE(0x182d, 0x0269) },
    { }

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread
* [PATCH 2.6.18-rc4] sisusbvga: fix sisusb.c
@ 2006-08-13 21:13 Mitsuhiro KOGA
  0 siblings, 0 replies; 9+ messages in thread
From: Mitsuhiro KOGA @ 2006-08-13 21:13 UTC (permalink / raw)
  To: linux-usb-devel, linux-fbdev-devel

I had a problem with usb2vga and ppc linux.
The background of the console greens, and the font is not displayed.

This patch can be normally displayed by the Big endian machine.
Moreover, because KAIREN's usb2vga has two or more devices id, it adds it.

Signed-off-by: Mitsuhiro Koga <shiena.jp@gmail.com>
Cc: linux-usb-devel@lists.sourceforge.net
Cc: linux-fbdev-devel@lists.sourceforge.net
---
 drivers/usb/misc/sisusbvga/sisusb.c      |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -76,6 +76,16 @@

 DEFINE_MUTEX(disconnect_mutex);

+#ifdef __BIG_ENDIAN
+static void
+correct_endianness_buffer(u16* data, const int length)
+{
+   int i;
+   for (i = 0; i < length; i++)
+       *(data+i) = cpu_to_le16(*(data+i));
+}
+#endif
+
 static void
 sisusb_free_buffers(struct sisusb_usb_data *sisusb)
 {
@@ -411,6 +421,10 @@
           memcpy(buffer, kernbuffer, passsize);
           kernbuffer += passsize;

+#ifdef __BIG_ENDIAN
+           if ((len & 3) == 0)
+               correct_endianness_buffer((u16 *)buffer, thispass/2);
+#endif
       }

       retry = 5;
@@ -906,9 +920,13 @@
           if (userbuffer) {
               if (get_user(swap32, (u32 __user *)userbuffer))
                   return -EFAULT;
-           } else
+           } else {
               swap32 = *((u32 *)kernbuffer);

+#ifdef __BIG_ENDIAN
+               swap32 = ((swap32 << 16) & 0xffff0000) | ((swap32 >>
16) & 0xffff);
+#endif
+           }
           ret = sisusb_write_memio_long(sisusb,
                           SISUSB_TYPE_MEM,
                           addr,
@@ -1259,7 +1277,11 @@

                   userbuffer += 4;
               } else {
+#ifdef __BIG_ENDIAN
+                   *((u32 *)kernbuffer) = ((swap32 << 16) &
0xffff0000) | ((swap32 >> 16) & 0xffff);
+#else
                   *((u32 *)kernbuffer) = swap32;
+#endif
                   kernbuffer += 4;
               }
               addr += 4;
@@ -3435,6 +3457,9 @@

 static struct usb_device_id sisusb_table [] = {
   { USB_DEVICE(0x0711, 0x0900) },
+   { USB_DEVICE(0x0711, 0x0901) },
+   { USB_DEVICE(0x0711, 0x0902) },
+   { USB_DEVICE(0x0711, 0x0920) },
   { USB_DEVICE(0x182d, 0x021c) },
   { USB_DEVICE(0x182d, 0x0269) },
   { }

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-08-24  6:34 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-13 20:47 [PATCH 2.6.18-rc4] sisusbvga: fix sisusb.c Mitsuhiro KOGA
2006-08-15  0:09 ` Antonino A. Daplas
2006-08-16 11:31   ` Mitsuhiro KOGA
2006-08-16 11:41     ` [Linux-fbdev-devel] " Geert Uytterhoeven
2006-08-16 12:06       ` Mitsuhiro KOGA
2006-08-16 12:56     ` Antonino A. Daplas
2006-08-16 15:33       ` Mitsuhiro KOGA
2006-08-24  6:34         ` Mitsuhiro KOGA
  -- strict thread matches above, loose matches on Subject: below --
2006-08-13 21:13 Mitsuhiro KOGA

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).