static int aec6210_tune_chipset (ide_drive_t *drive, u8 xferspeed)
{
	ide_hwif_t *hwif	= HWIF(drive);
	struct pci_dev *dev	= hwif->pci_dev;
	u16 d_conf		= 0;
	u8 speed	= ide_rate_filter(aec62xx_ratemask(drive), xferspeed);
	u8 ultra = 0, ultra_conf = 0;
	u8 tmp0 = 0, tmp1 = 0, tmp2 = 0;
	unsigned long flags;

	local_irq_save(flags);
	pci_read_config_word(dev, 0x40|(2*drive->dn), &d_conf);
	tmp0 = pci_bus_clock_list(speed, BUSCLOCK(dev));
	SPLIT_BYTE(tmp0,tmp1,tmp2);
	MAKE_WORD(d_conf,tmp1,tmp2);
	pci_write_config_word(dev, 0x40|(2*drive->dn), d_conf);

	tmp1 = 0x00;
	tmp2 = 0x00;
	pci_read_config_byte(dev, 0x54, &ultra);
	tmp1 = ((0x00 << (2*drive->dn)) | (ultra & ~(3 << (2*drive->dn))));
	ultra_conf = pci_bus_clock_list_ultra(speed, BUSCLOCK(dev));
	tmp2 = ((ultra_conf << (2*drive->dn)) | (tmp1 & ~(3 << (2*drive->dn))));
	pci_write_config_byte(dev, 0x54, tmp2);
	local_irq_restore(flags);
	return(ide_config_drive_speed(drive, speed));
}
Example #2
0
static char * print_cmd64x_get_info (char *buf, struct pci_dev *dev, int index)
{
    char *p = buf;
#ifndef CONFIG_SMALL

    u8 reg53 = 0, reg54 = 0, reg55 = 0, reg56 = 0;	/* primary */
    u8 reg57 = 0, reg58 = 0, reg5b;			/* secondary */
    u8 reg72 = 0, reg73 = 0;			/* primary */
    u8 reg7a = 0, reg7b = 0;			/* secondary */
    u8 reg50 = 0, reg71 = 0;			/* extra */
#ifdef DEBUG_CMD_REGS
    u8 hi_byte = 0, lo_byte = 0;
#endif /* DEBUG_CMD_REGS */

    p += sprintf(p, "\nController: %d\n", index);
    p += sprintf(p, "CMD%x Chipset.\n", dev->device);
    (void) pci_read_config_byte(dev, CFR,       &reg50);
    (void) pci_read_config_byte(dev, ARTTIM0,   &reg53);
    (void) pci_read_config_byte(dev, DRWTIM0,   &reg54);
    (void) pci_read_config_byte(dev, ARTTIM1,   &reg55);
    (void) pci_read_config_byte(dev, DRWTIM1,   &reg56);
    (void) pci_read_config_byte(dev, ARTTIM2,   &reg57);
    (void) pci_read_config_byte(dev, DRWTIM2,   &reg58);
    (void) pci_read_config_byte(dev, DRWTIM3,   &reg5b);
    (void) pci_read_config_byte(dev, MRDMODE,   &reg71);
    (void) pci_read_config_byte(dev, BMIDESR0,  &reg72);
    (void) pci_read_config_byte(dev, UDIDETCR0, &reg73);
    (void) pci_read_config_byte(dev, BMIDESR1,  &reg7a);
    (void) pci_read_config_byte(dev, UDIDETCR1, &reg7b);

    p += sprintf(p, "--------------- Primary Channel "
                 "---------------- Secondary Channel "
                 "-------------\n");
    p += sprintf(p, "                %sabled           "
                 "              %sabled\n",
                 (reg72&0x80)?"dis":" en",
                 (reg7a&0x80)?"dis":" en");
    p += sprintf(p, "--------------- drive0 "
                 "--------- drive1 -------- drive0 "
                 "---------- drive1 ------\n");
    p += sprintf(p, "DMA enabled:    %s              %s"
                 "             %s               %s\n",
                 (reg72&0x20)?"yes":"no ", (reg72&0x40)?"yes":"no ",
                 (reg7a&0x20)?"yes":"no ", (reg7a&0x40)?"yes":"no ");

    p += sprintf(p, "DMA Mode:       %s(%s)          %s(%s)",
                 (reg72&0x20)?((reg73&0x01)?"UDMA":" DMA"):" PIO",
                 (reg72&0x20)?(
                     ((reg73&0x30)==0x30)?(((reg73&0x35)==0x35)?"3":"0"):
                     ((reg73&0x20)==0x20)?(((reg73&0x25)==0x25)?"3":"1"):
                     ((reg73&0x10)==0x10)?(((reg73&0x15)==0x15)?"4":"2"):
                     ((reg73&0x00)==0x00)?(((reg73&0x05)==0x05)?"5":"2"):
                     "X"):"?",
                 (reg72&0x40)?((reg73&0x02)?"UDMA":" DMA"):" PIO",
                 (reg72&0x40)?(
                     ((reg73&0xC0)==0xC0)?(((reg73&0xC5)==0xC5)?"3":"0"):
                     ((reg73&0x80)==0x80)?(((reg73&0x85)==0x85)?"3":"1"):
                     ((reg73&0x40)==0x40)?(((reg73&0x4A)==0x4A)?"4":"2"):
                     ((reg73&0x00)==0x00)?(((reg73&0x0A)==0x0A)?"5":"2"):
                     "X"):"?");
    p += sprintf(p, "         %s(%s)           %s(%s)\n",
                 (reg7a&0x20)?((reg7b&0x01)?"UDMA":" DMA"):" PIO",
                 (reg7a&0x20)?(
                     ((reg7b&0x30)==0x30)?(((reg7b&0x35)==0x35)?"3":"0"):
                     ((reg7b&0x20)==0x20)?(((reg7b&0x25)==0x25)?"3":"1"):
                     ((reg7b&0x10)==0x10)?(((reg7b&0x15)==0x15)?"4":"2"):
                     ((reg7b&0x00)==0x00)?(((reg7b&0x05)==0x05)?"5":"2"):
                     "X"):"?",
                 (reg7a&0x40)?((reg7b&0x02)?"UDMA":" DMA"):" PIO",
                 (reg7a&0x40)?(
                     ((reg7b&0xC0)==0xC0)?(((reg7b&0xC5)==0xC5)?"3":"0"):
                     ((reg7b&0x80)==0x80)?(((reg7b&0x85)==0x85)?"3":"1"):
                     ((reg7b&0x40)==0x40)?(((reg7b&0x4A)==0x4A)?"4":"2"):
                     ((reg7b&0x00)==0x00)?(((reg7b&0x0A)==0x0A)?"5":"2"):
                     "X"):"?" );
    p += sprintf(p, "PIO Mode:       %s                %s"
                 "               %s                 %s\n",
                 "?", "?", "?", "?");
    p += sprintf(p, "                %s                     %s\n",
                 (reg50 & CFR_INTR_CH0) ? "interrupting" : "polling     ",
                 (reg57 & ARTTIM23_INTR_CH1) ? "interrupting" : "polling");
    p += sprintf(p, "                %s                          %s\n",
                 (reg71 & MRDMODE_INTR_CH0) ? "pending" : "clear  ",
                 (reg71 & MRDMODE_INTR_CH1) ? "pending" : "clear");
    p += sprintf(p, "                %s                          %s\n",
                 (reg71 & MRDMODE_BLK_CH0) ? "blocked" : "enabled",
                 (reg71 & MRDMODE_BLK_CH1) ? "blocked" : "enabled");

#ifdef DEBUG_CMD_REGS
    SPLIT_BYTE(reg50, hi_byte, lo_byte);
    p += sprintf(p, "CFR       = 0x%02x, HI = 0x%02x, "
                 "LOW = 0x%02x\n", reg50, hi_byte, lo_byte);
    SPLIT_BYTE(reg57, hi_byte, lo_byte);
    p += sprintf(p, "ARTTIM23  = 0x%02x, HI = 0x%02x, "
                 "LOW = 0x%02x\n", reg57, hi_byte, lo_byte);
    SPLIT_BYTE(reg71, hi_byte, lo_byte);
    p += sprintf(p, "MRDMODE   = 0x%02x, HI = 0x%02x, "
                 "LOW = 0x%02x\n", reg71, hi_byte, lo_byte);
#endif /* DEBUG_CMD_REGS */
#endif
    return (char *)p;
}
Example #3
0
static char * pdc202xx_info (char *buf, struct pci_dev *dev)
{
	char *p = buf;

	u32 bibma  = pci_resource_start(dev, 4);
	u32 reg60h = 0, reg64h = 0, reg68h = 0, reg6ch = 0;
	u16 reg50h = 0, pmask = (1<<10), smask = (1<<11);
	u8 hi = 0, lo = 0;

        /*
         * at that point bibma+0x2 et bibma+0xa are byte registers
         * to investigate:
         */
	u8 c0	= inb_p((unsigned short)bibma + 0x02);
	u8 c1	= inb_p((unsigned short)bibma + 0x0a);

	u8 sc11	= inb_p((unsigned short)bibma + 0x11);
	u8 sc1a	= inb_p((unsigned short)bibma + 0x1a);
	u8 sc1b	= inb_p((unsigned short)bibma + 0x1b);
	u8 sc1c	= inb_p((unsigned short)bibma + 0x1c); 
	u8 sc1d	= inb_p((unsigned short)bibma + 0x1d);
	u8 sc1e	= inb_p((unsigned short)bibma + 0x1e);
	u8 sc1f	= inb_p((unsigned short)bibma + 0x1f);

	pci_read_config_word(dev, 0x50, &reg50h);
	pci_read_config_dword(dev, 0x60, &reg60h);
	pci_read_config_dword(dev, 0x64, &reg64h);
	pci_read_config_dword(dev, 0x68, &reg68h);
	pci_read_config_dword(dev, 0x6c, &reg6ch);

	switch(dev->device) {
		case PCI_DEVICE_ID_PROMISE_20267:
			p += sprintf(p, "\n                                PDC20267 Chipset.\n");
			break;
		case PCI_DEVICE_ID_PROMISE_20265:
			p += sprintf(p, "\n                                PDC20265 Chipset.\n");
			break;
		case PCI_DEVICE_ID_PROMISE_20262:
			p += sprintf(p, "\n                                PDC20262 Chipset.\n");
			break;
		case PCI_DEVICE_ID_PROMISE_20246:
			p += sprintf(p, "\n                                PDC20246 Chipset.\n");
			reg50h |= 0x0c00;
			break;
		default:
			p += sprintf(p, "\n                                PDC202XX Chipset.\n");
			break;
	}

	p += sprintf(p, "------------------------------- General Status ---------------------------------\n");
	p += sprintf(p, "Burst Mode                           : %sabled\n", (sc1f & 0x01) ? "en" : "dis");
	p += sprintf(p, "Host Mode                            : %s\n", (sc1f & 0x08) ? "Tri-Stated" : "Normal");
	p += sprintf(p, "Bus Clocking                         : %s\n",
		((sc1f & 0xC0) == 0xC0) ? "100 External" :
		((sc1f & 0x80) == 0x80) ? "66 External" :
		((sc1f & 0x40) == 0x40) ? "33 External" : "33 PCI Internal");
	p += sprintf(p, "IO pad select                        : %s mA\n",
		((sc1c & 0x03) == 0x03) ? "10" :
		((sc1c & 0x02) == 0x02) ? "8" :
		((sc1c & 0x01) == 0x01) ? "6" :
		((sc1c & 0x00) == 0x00) ? "4" : "??");
	SPLIT_BYTE(sc1e, hi, lo);
	p += sprintf(p, "Status Polling Period                : %d\n", hi);
	p += sprintf(p, "Interrupt Check Status Polling Delay : %d\n", lo);
	p += sprintf(p, "--------------- Primary Channel ---------------- Secondary Channel -------------\n");
	p += sprintf(p, "                %s                         %s\n",
		(c0&0x80)?"disabled":"enabled ",
		(c1&0x80)?"disabled":"enabled ");
	p += sprintf(p, "66 Clocking     %s                         %s\n",
		(sc11&0x02)?"enabled ":"disabled",
		(sc11&0x08)?"enabled ":"disabled");
	p += sprintf(p, "           Mode %s                      Mode %s\n",
		(sc1a & 0x01) ? "MASTER" : "PCI   ",
		(sc1b & 0x01) ? "MASTER" : "PCI   ");
	p += sprintf(p, "                %s                     %s\n",
		(sc1d & 0x08) ? "Error       " :
		((sc1d & 0x05) == 0x05) ? "Not My INTR " :
		(sc1d & 0x04) ? "Interrupting" :
		(sc1d & 0x02) ? "FIFO Full   " :
		(sc1d & 0x01) ? "FIFO Empty  " : "????????????",
		(sc1d & 0x80) ? "Error       " :
		((sc1d & 0x50) == 0x50) ? "Not My INTR " :
		(sc1d & 0x40) ? "Interrupting" :
		(sc1d & 0x20) ? "FIFO Full   " :
		(sc1d & 0x10) ? "FIFO Empty  " : "????????????");
	p += sprintf(p, "--------------- drive0 --------- drive1 -------- drive0 ---------- drive1 ------\n");
	p += sprintf(p, "DMA enabled:    %s              %s             %s               %s\n",
		(c0&0x20)?"yes":"no ",(c0&0x40)?"yes":"no ",(c1&0x20)?"yes":"no ",(c1&0x40)?"yes":"no ");
	p += sprintf(p, "DMA Mode:       %s           %s          %s            %s\n",
		pdc202xx_ultra_verbose(reg60h, (reg50h & pmask)),
		pdc202xx_ultra_verbose(reg64h, (reg50h & pmask)),
		pdc202xx_ultra_verbose(reg68h, (reg50h & smask)),
		pdc202xx_ultra_verbose(reg6ch, (reg50h & smask)));
	p += sprintf(p, "PIO Mode:       %s            %s           %s            %s\n",
		pdc202xx_pio_verbose(reg60h),pdc202xx_pio_verbose(reg64h),
		pdc202xx_pio_verbose(reg68h),pdc202xx_pio_verbose(reg6ch));
#if 0
	p += sprintf(p, "--------------- Can ATAPI DMA ---------------\n");
#endif
	return (char *)p;
}