[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 3.3V PC card is available on hpcmips ?



In message: <02ee01c196b3$38eaf840$c801a8c0@megu2>
            "TAKEMURA Shin" <takemura@netbsd.org> writes:
: How could you distinguish the variant of pcic from ordinary pcic
: on runtime? Could you use any id or revision register?

Most have an ID Rev of 0x82 or 0x83.  Here's a simplified cut and past
from the FreeBSD code.  It knows about i82365 A/B/C step, i82365 DF
step, various VADEM chips, the two Ricoh chips, and Cirrus Logic's
67xx chips.  getb reads the index'd register.  The rest should be
fairly easy to understand.

#define PCIC_ID_REV	0x00	/* Identification and Revision */
#define PCIC_CLCHIP	0x1f	/* PD67xx: Chip I/D */
#define PCIC_VMISC	0x3a	/* Vadem: Misc control register */
#define PCIC_RICOH_ID	0x3a	/* Ricoh: ID register */

/* CL-PD67[12]x: Chip info (PCIC_CLCHIP) */
#define PCIC_CLC_TOGGLE 0xc0		/* These bits toggle 1 -> 0 */
#define PCIC_CLC_DUAL	0x20		/* Single/dual socket version */

/* Vadem: misc register (PCIC_VMISC) */
#define PCIC_VADEMREV	0x40

/* Ricoh: ID register values (PCIC_RICOH_ID) */
#define PCIC_RID_296	0x32
#define PCIC_RID_396	0xb2


switch(sp->getb(sp, PCIC_ID_REV) {
case 0x82:
case 0x83:
	/* Assume intel */
	/*
	 * Check for Vadem chips by unlocking their extra
	 * registers and looking for valid ID.  Bit 3 in
	 * the ID register is normally 0, except when
	 * PCIC_VADEMREV is set.  Other bridges appear
	 * to ignore this frobbing.
	 */
	bus_space_write_1(sp->bst, sp->bsh, PCIC_INDEX, 0x0E);
	bus_space_write_1(sp->bst, sp->bsh, PCIC_INDEX, 0x37);
	pcic_setb(sp, PCIC_VMISC, PCIC_VADEMREV);
	c = sp->getb(sp, PCIC_ID_REV);
	if (c & 0x08) {
		sp->controller = PCIC_VADEM;
		/* Set revision */
	} else {
		c = sp->getb(sp, PCIC_RICOH_ID);
		if (c == PCIC_RID_396)
			sp->controller = PCIC_RF5C396;
		else if (c == PCIC_RID_296)
			sp->controller = PCIC_RF5C296;
	} else {
		/*
		 *	Check for Cirrus logic chips.
		 */
		sp->putb(sp, PCIC_CLCHIP, 0);
		c = sp->getb(sp, PCIC_CLCHIP);
		if ((c & PCIC_CLC_TOGGLE) == PCIC_CLC_TOGGLE) {
			c = sp->getb(sp, PCIC_CLCHIP);
			if ((c & PCIC_CLC_TOGGLE) == 0) {
				if (c & PCIC_CLC_DUAL)
					sp->controller = PCIC_PD6722;
				else
					sp->controller = PCIC_PD6710;
				sp->revision = 8 - ((c & 0x1F) >> 2);
			}
		}
	}
	break;
case 0x84:
	/* intel DF step */
}

The NetBSD code looks like:
int
pcic_vendor(h)
{
	/* check for cirrus logic using the above probe */
	else assume intel.
}

which is where the changes would need to be made.  It doesn't even
seem to grok D step cards even.

Warner