--- Lothar Wassmann <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> here is the isp1362-hcd driver that I created based on Olav
> Kongas' isp116x-hcd and my earlier OHCI emulation driver.
> 
> This driver provides host controller functionality only. OTG
> features of the chip are not supported (though it might be that
> I need to implement it in the future).
> 
> I've tested it on a PXA255 board with the following devices in
> various combinations:
...

Hi, Lothar.
I'm trying to use this isp1362-hcd driver you recently posted to
the list.  (I'm happy about its existance)

However, it makes my kernel crash (dereferencing a NULL pointer) in
the isp1362_probe function, specifically in 'isp1362_write_addr'. 
After much fruitless hunting, I finally found that it's the
_BUG_ON(!irqs_disabled()); that's doing it.
( I would have hoped that it would actually say something to
  the tune of 'hey, there's a bug here', but it just crashed. )

I will try to hunt this down or disable the _BUG_ON, but I would
greatly appreciate any suggestions you might have.

I've attached my arch/arm/mach-lh7a40x/arch-oscar.c file, where I
specify that I have this platform device.

Thanks,
Mike
/*

 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
 *  version 2 as published by the Free Software Foundation.
 *
 *  2004-10-07, MWM - Added platform_device definitions for USB driver
 */
#include <linux/tty.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/usb.h>
#include <linux/usb_isp1362.h>

#include <asm/hardware.h>
#include <asm/setup.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/irq.h>
#include <asm/mach/irq.h>
#include <asm/mach/map.h>

#include "common.h"

/* These functions call the board specific IRQ initialization functions. */
extern void lh7a400_init_irq(void);
extern void lh7a40x_init_time(void);

// static physical to virtual memory mapping
static struct map_desc oscar_io_desc[] __initdata = {
    { IO_VIRT,   IO_PHYS,  IO_SIZE,  MT_DEVICE },
    { OSCAR_USB_VIRT, OSCAR_USB_PHYS, OSCAR_USB_SIZE,  MT_DEVICE },
    { BUSDELAY_VIRT, BUSDELAY_PHYS, BUSDELAY_SIZE, MT_DEVICE }, // for explicit bus delays (e.g. USB driver)
};

void __init oscar_map_io(void)
{
    iotable_init( oscar_io_desc, ARRAY_SIZE( oscar_io_desc ) );
}

static void isp1362_delay(struct device *dev, unsigned int delay)
{
    printk(KERN_INFO"in isp1362_delay\n");
    ndelay(delay * 2);
//    (void) *(volatile unsigned long *)BUSDELAY_VIRT;
}

static struct isp1362_platform_data isp1362_hcd_data = {
//       .reset = isp1362_hw_reset,
    .reset = NULL,  // no usb hardware reset on oscar!
    .delay = isp1362_delay,
    .clock = NULL,
    .potpg = 25,
    .no_power_switching = 0,
    .power_switching_mode = 1,
//    .remote_wakeup_enable = 1,
//    .remote_wakeup_connected = 1,
//    .remote_wakeup_enable = 0,   // AAH, this isn't a valid field
    .remote_wakeup_connected = 0,
    .int_edge_triggered = 0,
    .int_act_high = 0,
    .dreq_act_high = 1,
    .dack_act_high = 0,
    .oc_enable = 1,
};

static struct resource isp1362_hcd_resources[] = {
    {
	.name	= "isp1362-hcd data reg",
        .start	= OSCAR_USB_PHYS,
        .end	= OSCAR_USB_PHYS,
        .flags	= IORESOURCE_MEM,
    },
    {
        .name	= "isp1362-hcd addr reg",
        .start	= OSCAR_USB_PHYS + 2,
        .end	= OSCAR_USB_PHYS + 2,
        .flags	= IORESOURCE_MEM,
    },
    {
        .name	= "isp1362-hcd irq",
        .start	= IRQ_USB1,
        .flags	= IORESOURCE_IRQ,
    },
};

static struct platform_device isp1362_hcd_device = {
    .name               = "isp1362-hcd",
    .id                 = 0,
    .num_resources      = ARRAY_SIZE(isp1362_hcd_resources),
    .resource           = isp1362_hcd_resources,
    .dev = {
        .platform_data = &isp1362_hcd_data,
    }
};

static struct platform_device *oscar_platform_devices[] __initdata = {
    &isp1362_hcd_device,
};

void __init lh7a40x_init_board_irq(void)
{
  // 0xC1 => set bits 1 thru 5 low  (INT1, INT2, INT3, INT4, INT5)
  // 0x3E => set bits 1 thru 5 high (INT1, INT2, INT3, INT4, INT5)

  // Allow interrupts for GPIO1INTR, i.e. PF1/INT1
  GPIO_PFDD     &= 0xC1;        // PF1-5 are inputs
  GPIO_INTTYPE1 &= 0xC1;        // INT1-5 are level sensitive
  GPIO_INTTYPE2 &= 0xC1;        // INT1-5 are active low
  barrier();
  /*  * - unconfigured
      -    *PF0 - tied to PF1 (redundant)
      -     PF1 - INT_L (goes to MSP)
      -     PF2 - CAN_IRQ_L
      -     PF3 - RXD3
      -     PF4 - USB_IRQ2
      -     PF5 - USB_IRQ1
      -    *PF6 - tied high
      -    *PF7 - LCD_VCC_EN_L (used as GPIO)
      -   */
  GPIO_GPIOFINTEN |= 0x3E;      // Enable the GPIO interrupts
}


static void __init oscar_init (void)
{
    /*
      We could detect the board revision, and somehow share it with the
      rest of the kernel.  However, I've disabled this, as we don't support
      revision R0 anymore.  Otherwise, we'd use:
        
      // Detect the board revision
      int board_rev = 7 - ((GPIO_PA_PIND & 0x70) >> 4);
    */

#if 0
    printk( KERN_NOTICE"--- Adding platform devices...\r\n");

    // Add our platform devices defined above
    (void) platform_add_devices( oscar_platform_devices, ARRAY_SIZE(oscar_platform_devices) );
#else
    int ret_val;

    ret_val = platform_device_register( &isp1362_hcd_device );

    if ( 0 != ret_val )
    {
        printk( KERN_NOTICE "--- ERR %d: Couldn't register the ISP1362 platform device.\r\n", ret_val);
    }
    else
    {
        printk( KERN_NOTICE "--- Registered the ISP1362 platform device.\r\n");
    }
#endif
}

MACHINE_START (OSCAR, "Vansco's 'Oscar'")
    MAINTAINER ("Michael Moedt, Vansco Electronics ([EMAIL PROTECTED])")
    BOOT_MEM (0xc0000000, IO_PHYS, IO_VIRT)
    BOOT_PARAMS (0xc0000100)
    MAPIO (oscar_map_io)
    INITIRQ (lh7a400_init_irq)
    .timer         = &lh7a40x_timer,
    INIT_MACHINE(oscar_init)
MACHINE_END

Reply via email to