for (i = 0; i < OHCI_LOOP_COUNT; i++) { if (reg_read(ohci, OHCI1394_PhyControl) & 0x80000000) break;
mdelay(1);
}
r = reg_read(ohci, OHCI1394_PhyControl);
return (r & 0x00ff0000) >> 16;
}
/* Writes to a PHY register of an OHCI-1394 controller */ staticinlinevoid __init set_phy_reg(struct ohci *ohci, u8 addr, u8 data)
{ int i;
reg_write(ohci, OHCI1394_PhyControl, (addr << 8) | data | 0x00004000);
for (i = 0; i < OHCI_LOOP_COUNT; i++) { if (!(reg_read(ohci, OHCI1394_PhyControl) & 0x00004000)) break;
mdelay(1);
}
}
/* Resets an OHCI-1394 controller (for sane state before initialization) */ staticinlinevoid __init init_ohci1394_soft_reset(struct ohci *ohci)
{ int i;
/* Basic OHCI-1394 register and port inititalization */ staticinlinevoid __init init_ohci1394_initialize(struct ohci *ohci)
{
u32 bus_options; int num_ports, i;
/* Put some defaults to these undefined bus options */
bus_options = reg_read(ohci, OHCI1394_BusOptions);
bus_options |= 0x60000000; /* Enable CMC and ISC */
bus_options &= ~0x00ff0000; /* XXX: Set cyc_clk_acc to zero for now */
bus_options &= ~0x18000000; /* Disable PMC and BMC */
reg_write(ohci, OHCI1394_BusOptions, bus_options);
/* Set the bus number */
reg_write(ohci, OHCI1394_NodeID, 0x0000ffc0);
/* We don't want hardware swapping */
reg_write(ohci, OHCI1394_HCControlClear,
OHCI1394_HCControl_noByteSwapData);
/* Enable link */
reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_linkEnable);
/* If anything is connected to a port, make sure it is enabled */
num_ports = get_phy_reg(ohci, 2) & 0xf; for (i = 0; i < num_ports; i++) { unsignedint status;
set_phy_reg(ohci, 7, i);
status = get_phy_reg(ohci, 8);
if (status & 0x20)
set_phy_reg(ohci, 8, status & ~1);
}
}
/** *init_ohci1394_wait_for_busresets-waituntilbusresetsarecompleted * *OHCI1394initializationitselfandanydevicegoingon-oroffline *andanycableissuecauseaIEEE1394busreset.TheOHCI1394spec *specifiesthatphysicalDMAisdisabledoneachbusresetandit *hastobeenabledaftereachbusresetwhenneeded.Weresort *topollingherebecauseonearlyboot,wehavenointerrupts.
*/ staticinlinevoid __init init_ohci1394_wait_for_busresets(struct ohci *ohci)
{ int i, events;
for (i = 0; i < 9; i++) {
mdelay(200);
events = reg_read(ohci, OHCI1394_IntEventSet); if (events & OHCI1394_busReset)
reg_write(ohci, OHCI1394_IntEventClear,
OHCI1394_busReset);
}
}
/** *init_ohci1394_reset_and_init_dma-initcontrollerandenableDMA *ThisinitializesthegivencontrollerandenablesphysicalDMAengineinit.
*/ staticinlinevoid __init init_ohci1394_reset_and_init_dma(struct ohci *ohci)
{ /* Start off with a soft reset, clears everything to a sane state. */
init_ohci1394_soft_reset(ohci);
/* Accessing some registers without LPS enabled may cause lock up */
reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_LPS);
/* Poor man's PCI discovery, the only thing we can do at early boot */ for (num = 0; num < 32; num++) { for (slot = 0; slot < 32; slot++) { for (func = 0; func < 8; func++) { class = read_pci_config(num, slot, func,
PCI_CLASS_REVISION); if (class == 0xffffffff) continue; /* No device at this func */
if (class>>8 != PCI_CLASS_SERIAL_FIREWIRE_OHCI) continue; /* Not an OHCI-1394 device */
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.