示例#1
0
int davinci_i2c_fix_ths7353_lockup( void )
{
    printk( "Toggle I2C clock to clear THS7353 false ACK\n" );

    PINMUX1 &= ~(1 << 7);

    request_gio( GIO_I2C_SCL );
    request_gio( GIO_I2C_SDA );

    gio_set_bitset( GIO_I2C_SCL );
    gio_set_bitset( GIO_I2C_SDA );

    gio_set_dir( GIO_I2C_SCL, 0 );
    gio_set_dir( GIO_I2C_SDA, 0 );

    gio_set_bitclr( GIO_I2C_SCL );
    udelay( 100 );
    gio_set_bitset( GIO_I2C_SCL );
    udelay( 100 );
    gio_set_bitclr( GIO_I2C_SCL );
    udelay( 100 );
    gio_set_bitset( GIO_I2C_SCL );
    udelay( 100 );

    unrequest_gio( GIO_I2C_SCL );
    unrequest_gio( GIO_I2C_SDA );

    udelay( 100 );
        
    return 0;
}
示例#2
0
void __init itdm320_20_ide_hdd_probe(void)
{
	int i;
	ide_hwif_t *hwif;

	/* 
	 * Find the first untaken slot in hwifs 
	 */
	for (i = 0; i < MAX_HWIFS; i++) {
		if (!ide_hwifs[i].io_ports[IDE_DATA_OFFSET]) {
			break;
		}
	}
	if (i == MAX_HWIFS) {
		printk("No space for ITDM320-20 onboard IDE driver in ide_hwifs[].  Not enabled.\n");
		return;
	}

#ifdef GIO_USB_ENABLE    
    /* Drive USB_ENABLE low (Reference section 10, USB in the MP4900-BRD-DM320-20
       Hardware Design Spec)
    */
    if (request_gio(GIO_USB_ENABLE)) {
       printk(KERN_ERR "Gio %d, was previously registered!\n", GIO_USB_ENABLE);
       return;
    }
    gio_set_dir(GIO_USB_ENABLE, bit_low);
    gio_set_bitclr(GIO_USB_ENABLE);
#endif

#if defined(CONFIG_DMA_HDD)
#if defined(HDD_DMA_INIT)
    HDD_DMA_INIT();
#endif
#endif    
	/* Set up our stuff, Note, __ide_hdd() can be found in hardware.h */
	hwif = &ide_hwifs[i];
	hwif->hw.io_ports[IDE_DATA_OFFSET]    = __ide_hdd(REGISTER_OFFSET + (0x00 << IDE_SHIFT));
	hwif->hw.io_ports[IDE_ERROR_OFFSET]   = __ide_hdd(REGISTER_OFFSET + (0x01 << IDE_SHIFT));
    hwif->hw.io_ports[IDE_NSECTOR_OFFSET] = __ide_hdd(REGISTER_OFFSET + (0x02 << IDE_SHIFT));
	hwif->hw.io_ports[IDE_SECTOR_OFFSET]  = __ide_hdd(REGISTER_OFFSET + (0x03 << IDE_SHIFT));
	hwif->hw.io_ports[IDE_LCYL_OFFSET]    = __ide_hdd(REGISTER_OFFSET + (0x04 << IDE_SHIFT));
	hwif->hw.io_ports[IDE_HCYL_OFFSET]    = __ide_hdd(REGISTER_OFFSET + (0x05 << IDE_SHIFT));
	hwif->hw.io_ports[IDE_SELECT_OFFSET]  = __ide_hdd(REGISTER_OFFSET + (0x06 << IDE_SHIFT));
	hwif->hw.io_ports[IDE_STATUS_OFFSET]  = __ide_hdd(REGISTER_OFFSET + (0x07 << IDE_SHIFT));
	hwif->hw.io_ports[IDE_CONTROL_OFFSET] = __ide_hdd(CONTROL_OFFSET  + (0x06 << IDE_SHIFT));
	hwif->hw.io_ports[IDE_IRQ_OFFSET]     = __ide_hdd(CONTROL_OFFSET  + (0x07 << IDE_SHIFT));
	hwif->hw.irq                          = IRQ_GIO7;//IRQ_GIO11;
    hwif->noprobe                         = 0;

    /* Set callbacks for IDE I/O access. Can't use defaults since we don't I/O map
       the IDE memory region. Instead we configure the MMU manually in core.c
    */
	hwif->OUTB	    = ide_itdm320_outb;
	hwif->OUTBSYNC	= ide_itdm320_outbsync;
	hwif->OUTW	    = ide_itdm320_outw;
	hwif->OUTL	    = ide_itdm320_outl;
	hwif->OUTSW	    = ide_itdm320_outsw;
	hwif->OUTSL	    = ide_itdm320_outsl;
	hwif->INB	    = ide_itdm320_inb;
	hwif->INW    	= ide_itdm320_inw;
	hwif->INL	    = ide_itdm320_inl;
	hwif->INSW	    = ide_itdm320_insw;
	hwif->INSL	    = ide_itdm320_insl;
    
	memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports));
	hwif->irq                             = hwif->hw.irq;
	printk("Ingenient onboard IDE/HDD configured as device %i\n", i);
#ifdef GIO_HDD_HOTPLUG       
	request_gio(GIO_HDD_HOTPLUG);
	gio_enable_irq(GIO_HDD_HOTPLUG,GIO_ANY_EDGE);
	request_irq(GIO_HDD_HOTPLUG + 21,ide_itdm320_hotplug_handler,0,"ide_usb_hotplug",NULL);
#endif
}