/* * ti113x.h 1.16 1999/10/25 20:03:34 * * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License * at http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See * the License for the specific language governing rights and * limitations under the License. * * The initial developer of the original code is David A. Hinds * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. * * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License version 2 (the "GPL"), in which * case the provisions of the GPL are applicable instead of the * above. If you wish to allow the use of your version of this file * only under the terms of the GPL and not to allow others to use * your version of this file under the MPL, indicate your decision by * deleting the provisions above and replace them with the notice and * other provisions required by the GPL. If you do not delete the * provisions above, a recipient may use your version of this file * under either the MPL or the GPL.
*/
#ifndef _LINUX_TI113X_H #define _LINUX_TI113X_H
/* Register definitions for TI 113X PCI-to-CardBus bridges */
/* If we don't have a Zoom Video switch this is harmless,
we just tristate the unused (ZV) lines */
reg = config_readb(socket, TI113X_CARD_CONTROL); if (onoff) /* Zoom zoom, we will all go together, zoom zoom, zoom zoom */
reg |= TI113X_CCR_ZVENABLE; else
reg &= ~TI113X_CCR_ZVENABLE;
config_writeb(socket, TI113X_CARD_CONTROL, reg);
}
/* * The 145x series can also use this. They have an additional * ZV autodetect mode we don't use but don't actually need. * FIXME: manual says its in func0 and func1 but disagrees with * itself about this - do we need to force func0, if so we need * to know a lot more about socket pairings in pcmcia_socket than * we do now.. uggh.
*/
staticvoid ti_set_zv(struct yenta_socket *socket)
{ if(socket->dev->vendor == PCI_VENDOR_ID_TI)
{ switch(socket->dev->device)
{ /* There may be more .. */ case PCI_DEVICE_ID_TI_1220: case PCI_DEVICE_ID_TI_1221: case PCI_DEVICE_ID_TI_1225: case PCI_DEVICE_ID_TI_4510:
socket->socket.zoom_video = ti_zoom_video; break; case PCI_DEVICE_ID_TI_1250: case PCI_DEVICE_ID_TI_1251A: case PCI_DEVICE_ID_TI_1251B: case PCI_DEVICE_ID_TI_1450:
socket->socket.zoom_video = ti1250_zoom_video;
}
}
}
/* * Generic TI init - TI has an extension for the * INTCTL register that sets the PCI CSC interrupt. * Make sure we set it correctly at open and init * time * - override: disable the PCI CSC interrupt. This makes * it possible to use the CSC interrupt to probe the * ISA interrupts. * - init: set the interrupt to match our PCI state. * This makes us correctly get PCI CSC interrupt * events.
*/ staticint ti_init(struct yenta_socket *socket)
{
u8 new, reg = exca_readb(socket, I365_INTCTL);
new = reg & ~I365_INTR_ENA; if (socket->dev->irq) new |= I365_INTR_ENA; if (new != reg)
exca_writeb(socket, I365_INTCTL, new); return 0;
}
/* make sure PCI interrupts are enabled before probing */
ti_init(socket);
/* test PCI interrupts first. only try fixing if return value is 0! */
pci_irq_status = yenta_probe_cb_irq(socket); if (pci_irq_status) goto out;
/* * We're here which means PCI interrupts are _not_ delivered. try to * find the right setting (all serial or parallel)
*/
dev_info(&socket->dev->dev, "TI: probing PCI interrupt failed, trying to fix\n");
/* for serial PCI make sure MFUNC3 is set to IRQSER */ if ((devctl & TI113X_DCR_IMODE_MASK) == TI12XX_DCR_IMODE_ALL_SERIAL) { switch (socket->dev->device) { case PCI_DEVICE_ID_TI_1250: case PCI_DEVICE_ID_TI_1251A: case PCI_DEVICE_ID_TI_1251B: case PCI_DEVICE_ID_TI_1450: case PCI_DEVICE_ID_TI_1451A: case PCI_DEVICE_ID_TI_4450: case PCI_DEVICE_ID_TI_4451: /* these chips have no IRQSER setting in MFUNC3 */ break;
/* not working, back to old value */
mfunc = mfunc_old;
config_writel(socket, TI122X_MFUNC, mfunc);
if (pci_irq_status == -1) goto out;
}
}
/* serial PCI interrupts not working fall back to parallel */
dev_info(&socket->dev->dev, "TI: falling back to parallel PCI interrupts\n");
devctl &= ~TI113X_DCR_IMODE_MASK;
devctl |= TI113X_DCR_IMODE_SERIAL; /* serial ISA could be right */
config_writeb(socket, TI113X_DEVICE_CONTROL, devctl);
}
/* parallel PCI interrupts: route INTA */ switch (socket->dev->device) { case PCI_DEVICE_ID_TI_1250: case PCI_DEVICE_ID_TI_1251A: case PCI_DEVICE_ID_TI_1251B: case PCI_DEVICE_ID_TI_1450: /* make sure GPIO3 is set to INTA */
gpio3 = gpio3_old = config_readb(socket, TI1250_GPIO3_CONTROL);
gpio3 &= ~TI1250_GPIO_MODE_MASK; if (gpio3 != gpio3_old)
config_writeb(socket, TI1250_GPIO3_CONTROL, gpio3); break;
/* time to probe again */
pci_irq_status = yenta_probe_cb_irq(socket); if (pci_irq_status == 1) {
mfunc_old = mfunc;
dev_info(&socket->dev->dev, "TI: parallel PCI interrupts ok\n");
} else { /* not working, back to old value */
mfunc = mfunc_old;
config_writel(socket, TI122X_MFUNC, mfunc); if (gpio3 != gpio3_old)
config_writeb(socket, TI1250_GPIO3_CONTROL, gpio3_old);
}
out: if (pci_irq_status < 1) {
socket->cb_irq = 0;
dev_info(&socket->dev->dev, "Yenta TI: no PCI interrupts. Fish. Please report.\n");
}
}
/* changes the irq of func1 to match that of func0 */ staticint ti12xx_align_irqs(struct yenta_socket *socket, int *old_irq)
{ struct pci_dev *func0;
if (old_irq)
*old_irq = socket->cb_irq;
socket->cb_irq = socket->dev->irq = func0->irq;
pci_dev_put(func0);
return 1;
}
/* * ties INTA and INTB together. also changes the devices irq to that of * the function 0 device. call from func1 only. * returns 1 if INTRTIE changed, 0 otherwise.
*/ staticint ti12xx_tie_interrupts(struct yenta_socket *socket, int *old_irq)
{
u32 sysctl; int ret;
sysctl = config_readl(socket, TI113X_SYSTEM_CONTROL); if (sysctl & TI122X_SCR_INTRTIE) return 0;
/* align */
ret = ti12xx_align_irqs(socket, old_irq); if (!ret) return 0;
/* tie */
sysctl |= TI122X_SCR_INTRTIE;
config_writel(socket, TI113X_SYSTEM_CONTROL, sysctl);
return 1;
}
/* undo what ti12xx_tie_interrupts() did */ staticvoid ti12xx_untie_interrupts(struct yenta_socket *socket, int old_irq)
{
u32 sysctl = config_readl(socket, TI113X_SYSTEM_CONTROL);
sysctl &= ~TI122X_SCR_INTRTIE;
config_writel(socket, TI113X_SYSTEM_CONTROL, sysctl);
socket->cb_irq = socket->dev->irq = old_irq;
}
/* * irqrouting for func1, plays with INTB routing * only touches MFUNC for INTB routing. all other bits are taken * care of in func0 already.
*/ staticvoid ti12xx_irqroute_func1(struct yenta_socket *socket)
{
u32 mfunc, mfunc_old, devctl, sysctl; int pci_irq_status;
/* if IRQs are configured as tied, align irq of func1 with func0 */
sysctl = config_readl(socket, TI113X_SYSTEM_CONTROL); if (sysctl & TI122X_SCR_INTRTIE)
ti12xx_align_irqs(socket, NULL);
/* make sure PCI interrupts are enabled before probing */
ti_init(socket);
/* test PCI interrupts first. only try fixing if return value is 0! */
pci_irq_status = yenta_probe_cb_irq(socket); if (pci_irq_status) goto out;
/* * We're here which means PCI interrupts are _not_ delivered. try to * find the right setting
*/
dev_info(&socket->dev->dev, "TI: probing PCI interrupt failed, trying to fix\n");
/* if all serial: set INTRTIE, probe again */ if ((devctl & TI113X_DCR_IMODE_MASK) == TI12XX_DCR_IMODE_ALL_SERIAL) { int old_irq;
ti12xx_untie_interrupts(socket, old_irq);
}
} /* parallel PCI: route INTB, probe again */ else { int old_irq;
switch (socket->dev->device) { case PCI_DEVICE_ID_TI_1250: /* the 1250 has one pin for IRQSER/INTB depending on devctl */ break;
case PCI_DEVICE_ID_TI_1251A: case PCI_DEVICE_ID_TI_1251B: case PCI_DEVICE_ID_TI_1450: /* * those have a pin for IRQSER/INTB plus INTB in MFUNC0 * we alread probed the shared pin, now go for MFUNC0
*/
mfunc = (mfunc & ~TI122X_MFUNC0_MASK) | TI125X_MFUNC0_INTB; break;
/* still nothing: set INTRTIE */ if (ti12xx_tie_interrupts(socket, &old_irq)) {
pci_irq_status = yenta_probe_cb_irq(socket); if (pci_irq_status == 1) {
dev_info(&socket->dev->dev, "TI: parallel PCI interrupts, tied ok\n"); goto out;
}
ti12xx_untie_interrupts(socket, old_irq);
}
}
out: if (pci_irq_status < 1) {
socket->cb_irq = 0;
dev_info(&socket->dev->dev, "TI: no PCI interrupts. Fish. Please report.\n");
}
}
/* Returns true value if the second slot of a two-slot controller is empty */ staticint ti12xx_2nd_slot_empty(struct yenta_socket *socket)
{ struct pci_dev *func; struct yenta_socket *slot2; int devfn; unsignedint state; int ret = 1;
u32 sysctl;
/* catch the two-slot controllers */ switch (socket->dev->device) { case PCI_DEVICE_ID_TI_1220: case PCI_DEVICE_ID_TI_1221: case PCI_DEVICE_ID_TI_1225: case PCI_DEVICE_ID_TI_1251A: case PCI_DEVICE_ID_TI_1251B: case PCI_DEVICE_ID_TI_1420: case PCI_DEVICE_ID_TI_1450: case PCI_DEVICE_ID_TI_1451A: case PCI_DEVICE_ID_TI_1520: case PCI_DEVICE_ID_TI_1620: case PCI_DEVICE_ID_TI_4520: case PCI_DEVICE_ID_TI_4450: case PCI_DEVICE_ID_TI_4451: /* * there are way more, but they need to be added in yenta_socket.c * and pci_ids.h first anyway.
*/ break;
case PCI_DEVICE_ID_TI_XX12: case PCI_DEVICE_ID_TI_X515: case PCI_DEVICE_ID_TI_X420: case PCI_DEVICE_ID_TI_X620: case PCI_DEVICE_ID_TI_XX21_XX11: case PCI_DEVICE_ID_TI_7410: case PCI_DEVICE_ID_TI_7610: /* * those are either single or dual slot CB with additional functions * like 1394, smartcard reader, etc. check the TIEALL flag for them * the TIEALL flag binds the IRQ of all functions together. * we catch the single slot variants later.
*/
sysctl = config_readl(socket, TI113X_SYSTEM_CONTROL); if (sysctl & TIXX21_SCR_TIEALL) return 0;
break;
/* single-slot controllers have the 2nd slot empty always :) */ default: return 1;
}
/* get other slot */
devfn = socket->dev->devfn & ~0x07;
func = pci_get_slot(socket->dev->bus,
(socket->dev->devfn & 0x07) ? devfn : devfn | 0x01); if (!func) return 1;
/* * check that the device id of both slots match. this is needed for the * XX21 and the XX11 controller that share the same device id for single * and dual slot controllers. return '2nd slot empty'. we already checked * if the interrupt is tied to another function.
*/ if (socket->dev->device != func->device) goto out;
slot2 = pci_get_drvdata(func); if (!slot2) goto out;
/* check state */
yenta_get_status(&slot2->socket, &state); if (state & SS_DETECT) {
ret = 0; goto out;
}
out:
pci_dev_put(func); return ret;
}
/* * TI specifiy parts for the power hook. * * some TI's with some CB's produces interrupt storm on power on. it has been * seen with atheros wlan cards on TI1225 and TI1410. solution is simply to * disable any CB interrupts during this time.
*/ staticint ti12xx_power_hook(struct pcmcia_socket *sock, int operation)
{ struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
u32 mfunc, devctl, sysctl;
u8 gpio3;
/* only POWER_PRE and POWER_POST are interesting */ if ((operation != HOOK_POWER_PRE) && (operation != HOOK_POWER_POST)) return 0;
/* * all serial/tied: only disable when modparm set. always doing it * would mean a regression for working setups 'cos it disables the * interrupts for both both slots on 2-slot controllers * (and users of single slot controllers where it's save have to * live with setting the modparm, most don't have to anyway)
*/ if (((devctl & TI113X_DCR_IMODE_MASK) == TI12XX_DCR_IMODE_ALL_SERIAL) &&
(pwr_irqs_off || ti12xx_2nd_slot_empty(socket))) { switch (socket->dev->device) { case PCI_DEVICE_ID_TI_1250: case PCI_DEVICE_ID_TI_1251A: case PCI_DEVICE_ID_TI_1251B: case PCI_DEVICE_ID_TI_1450: case PCI_DEVICE_ID_TI_1451A: case PCI_DEVICE_ID_TI_4450: case PCI_DEVICE_ID_TI_4451: /* these chips have no IRQSER setting in MFUNC3 */ break;
/* do the job differently for func0/1 */ if ((PCI_FUNC(socket->dev->devfn) == 0) ||
((sysctl & TI122X_SCR_INTRTIE) &&
(pwr_irqs_off || ti12xx_2nd_slot_empty(socket)))) { /* some bridges are different */ switch (socket->dev->device) { case PCI_DEVICE_ID_TI_1250: case PCI_DEVICE_ID_TI_1251A: case PCI_DEVICE_ID_TI_1251B: case PCI_DEVICE_ID_TI_1450: /* those oldies use gpio3 for INTA */
gpio3 = config_readb(socket, TI1250_GPIO3_CONTROL); if (operation == HOOK_POWER_PRE)
gpio3 = (gpio3 & ~TI1250_GPIO_MODE_MASK) | 0x40; else
gpio3 &= ~TI1250_GPIO_MODE_MASK;
config_writeb(socket, TI1250_GPIO3_CONTROL, gpio3); break;
default: /* all new bridges are the same */ if (operation == HOOK_POWER_PRE)
mfunc &= ~TI122X_MFUNC0_MASK; else
mfunc |= TI122X_MFUNC0_INTA;
config_writel(socket, TI122X_MFUNC, mfunc);
}
} else { switch (socket->dev->device) { case PCI_DEVICE_ID_TI_1251A: case PCI_DEVICE_ID_TI_1251B: case PCI_DEVICE_ID_TI_1450: /* those have INTA elsewhere and INTB in MFUNC0 */ if (operation == HOOK_POWER_PRE)
mfunc &= ~TI122X_MFUNC0_MASK; else
mfunc |= TI125X_MFUNC0_INTB;
config_writel(socket, TI122X_MFUNC, mfunc);
break;
default: /* all new bridges are the same */ if (operation == HOOK_POWER_PRE)
mfunc &= ~TI122X_MFUNC1_MASK; else
mfunc |= TI122X_MFUNC1_INTB;
config_writel(socket, TI122X_MFUNC, mfunc);
}
}
/** * EnE specific part. EnE bridges are register compatible with TI bridges but * have their own test registers and more important their own little problems. * Some fixup code to make everybody happy (TM).
*/
#ifdef CONFIG_YENTA_ENE_TUNE /* * set/clear various test bits: * Defaults to clear the bit. * - mask (u8) defines what bits to change * - bits (u8) is the values to change them to * -> it's * current = (current & ~mask) | bits
*/ /* pci ids of devices that wants to have the bit set */ #define DEVID(_vend,_dev,_subvend,_subdev,mask,bits) { \
.vendor = _vend, \
.device = _dev, \
.subvendor = _subvend, \
.subdevice = _subdev, \
.driver_data = ((mask) << 8 | (bits)), \
} staticstruct pci_device_id ene_tune_tbl[] = { /* Echo Audio products based on motorola DSP56301 and DSP56361 */
DEVID(PCI_VENDOR_ID_MOTOROLA, 0x1801, 0xECC0, PCI_ANY_ID,
ENE_TEST_C9_TLTENABLE | ENE_TEST_C9_PFENABLE, ENE_TEST_C9_TLTENABLE),
DEVID(PCI_VENDOR_ID_MOTOROLA, 0x3410, 0xECC0, PCI_ANY_ID,
ENE_TEST_C9_TLTENABLE | ENE_TEST_C9_PFENABLE, ENE_TEST_C9_TLTENABLE),
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.