Re: PATCH: fix usb + add asic3 initialization.

From: Michael Opdenacker <zumbi3.a.t.free.fr>
Date: Fri Apr 16 2004 - 05:09:11 EDT

Thanks Shawn!

I committed this patch.

    :-)

    Michael.

>Hi,
>I fixed the h4000 usb so you dont have to unplug and replug to get it to
>work, and you dont have to have usb plugged in at boot for it to work
>(you can plug in usb after boot now :-).
>
>Would someone with cvs access check this in for me?
>
>Thanks,
>sa
>
>
>
>
>------------------------------------------------------------------------
>
>diff -urN kernel26/arch/arm/mach-pxa/h4000.c kernel26_h4000/arch/arm/mach-pxa/h4000.c
>--- kernel26/arch/arm/mach-pxa/h4000.c 2004-04-02 23:13:42.000000000 -0700
>+++ kernel26_h4000/arch/arm/mach-pxa/h4000.c 2004-04-15 21:30:32.536590848 -0600
>@@ -19,13 +19,13 @@
>
> #include <linux/lcd.h>
> #include <linux/backlight.h>
>-#include <linux/fb.h> // needed by pxafb.h
>-#include "../../../drivers/video/pxafb.h" /* pxafb_mach_info */
>+#include <linux/fb.h>
>+#include "../../../drivers/video/pxafb.h"
> #include <asm/arch/udc.h>
>
>-#include <asm/arch/ipaq.h> // struct ipaq_model_ops
>-#include <asm/mach/map.h> // struct map_desc
>-#include "generic.h" // pxa_map_io()
>+#include <asm/arch/ipaq.h>
>+#include <asm/mach/map.h>
>+#include "generic.h"
> #include <asm/mach/arch.h>
> #include <asm/hardware/ipaq-asic3.h>
>
>@@ -55,16 +55,15 @@
>
> static void h4000_udc_command (int cmd)
> {
>- // I dont think this works... GPIO[10] probably isnt the usb pullup
> switch (cmd)
> {
> case PXA2XX_UDC_CMD_DISCONNECT:
>- //GPSR0 |= 0x400;
>- printk("%s: make usb disappear:a GPLR0 0x%x\n",__FUNCTION__,GPLR0);
>+ IPAQ_ASIC3_GPIO_D_OUT(IPAQ_ASIC3_VIRT) &= ~0x1;
>+ /* printk("%s: make usb disappear\n",__FUNCTION__); */
> break;
> case PXA2XX_UDC_CMD_CONNECT:
>- //GPCR0 |= 0x400;
>- printk("%s: let usb appear:a GPLR0 0x%x\n",__FUNCTION__,GPLR0);
>+ IPAQ_ASIC3_GPIO_D_OUT(IPAQ_ASIC3_VIRT) |= 0x1;
>+ /* printk("%s: let usb appear\n",__FUNCTION__); */
> break;
> default:
> printk("_udc_control: unknown command!\n");
>@@ -75,7 +74,8 @@
> static int h4000_udc_is_connected (void)
> {
> /* do we see host? FIXME: return a meaningful value here...*/
>- printk("%s: is usb connected: GPLR0 0x%x\n",__FUNCTION__,GPLR0);
>+ /* printk("%s: is usb connected: GPIO 10 =%d\n",
>+ __FUNCTION__,(GPLR0 & 0x400)); */
> return 1;
> }
>
>@@ -96,7 +96,7 @@
> {
> unsigned int* ptr;
>
>- ptr = IPAQ_ASIC3_VIRT + gpiobase;
>+ ptr = (unsigned int* )IPAQ_ASIC3_VIRT + gpiobase;
> printk("---------- BEGIN ASIC3 GPIO%d DUMP\n", gpiobase/0x100);
> printk("MASK: %04x\n", *(ptr));
> printk("DIR : %04x\n", *(ptr+1));
>@@ -146,6 +146,65 @@
> PRER = 0;
> /* 3.6864 MHz oscillator power-down enable */
> PCFR = PCFR_OPDE;
>+
>+ /* Initialize the ASIC */
>+ IPAQ_ASIC3_CLOCK_CDEX(IPAQ_ASIC3_VIRT) = 0x26c3;
>+ IPAQ_ASIC3_CLOCK_SEL(IPAQ_ASIC3_VIRT) = 0x0007;
>+
>+ IPAQ_ASIC3_GPIO_A_MASK(IPAQ_ASIC3_VIRT) = 0xffff;
>+ IPAQ_ASIC3_GPIO_A_DIR(IPAQ_ASIC3_VIRT) = 0xfc7f;
>+ IPAQ_ASIC3_GPIO_A_LEVELTRI(IPAQ_ASIC3_VIRT) = 0x0000;
>+ IPAQ_ASIC3_GPIO_A_RISING(IPAQ_ASIC3_VIRT) = 0x0000;
>+ IPAQ_ASIC3_GPIO_A_LEVEL(IPAQ_ASIC3_VIRT) = 0x0000;
>+ IPAQ_ASIC3_GPIO_A_SLEEP_MASK(IPAQ_ASIC3_VIRT) = 0xffff;
>+ IPAQ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IC3_VIRT) = 0x0000;
>+ IPAQ_ASIC3_GPIO_D_SLEEP_CONF(IPAQ_ASIC3_VIRT) = 0x000c;
>+ /* (1<<14) turns on usb */
>+ IPAQ_ASIC3_GPIO_D_OUT(IPAQ_ASIC3_VIRT) = 0x0f02 | (1<<14);
>+
>+ IPAQ_ASIC3_INTR_IntMask(IPAQ_ASIC3_VIRT)= 0x0003;
>+ IPAQ_ASIC3_INTR_IntCPS(IPAQ_ASIC3_VIRT) = 0x001e;
>+ IPAQ_ASIC3_INTR_IntTBS(IPAQ_ASIC3_VIRT) = 0x000a;
>
> ipaq_model_ops = h4000_model_ops;
> }
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>H4100-port mailing list
>H4100-port@handhelds.org
>https://www.handhelds.org/mailman/listinfo/h4100-port
>
>

-- 
Michael Opdenacker
http://opdenacker.org/
Received on Fri Apr 16 09:09:28 2004

This archive was generated by hypermail 2.1.8 : Tue May 04 2004 - 09:41:51 EDT