Lines Matching full:ohci
3 * init_ohci1394_dma.c - Initializes physical DMA on all OHCI 1394 controllers
9 * - scan the PCI very early on boot for all OHCI 1394-compliant controllers
32 #include "ohci.h"
36 struct ohci { struct
40 static inline void reg_write(const struct ohci *ohci, int offset, u32 data) in reg_write() argument
42 writel(data, ohci->registers + offset); in reg_write()
45 static inline u32 reg_read(const struct ohci *ohci, int offset) in reg_read() argument
47 return readl(ohci->registers + offset); in reg_read()
52 /* Reads a PHY register of an OHCI-1394 controller */
53 static inline u8 __init get_phy_reg(struct ohci *ohci, u8 addr) in get_phy_reg() argument
58 reg_write(ohci, OHCI1394_PhyControl, (addr << 8) | 0x00008000); in get_phy_reg()
61 if (reg_read(ohci, OHCI1394_PhyControl) & 0x80000000) in get_phy_reg()
65 r = reg_read(ohci, OHCI1394_PhyControl); in get_phy_reg()
70 /* Writes to a PHY register of an OHCI-1394 controller */
71 static inline void __init set_phy_reg(struct ohci *ohci, u8 addr, u8 data) in set_phy_reg() argument
75 reg_write(ohci, OHCI1394_PhyControl, (addr << 8) | data | 0x00004000); in set_phy_reg()
78 if (!(reg_read(ohci, OHCI1394_PhyControl) & 0x00004000)) in set_phy_reg()
84 /* Resets an OHCI-1394 controller (for sane state before initialization) */
85 static inline void __init init_ohci1394_soft_reset(struct ohci *ohci) in init_ohci1394_soft_reset() argument
89 reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_softReset); in init_ohci1394_soft_reset()
92 if (!(reg_read(ohci, OHCI1394_HCControlSet) in init_ohci1394_soft_reset()
103 /* Basic OHCI-1394 register and port inititalization */
104 static inline void __init init_ohci1394_initialize(struct ohci *ohci) in init_ohci1394_initialize() argument
110 bus_options = reg_read(ohci, OHCI1394_BusOptions); in init_ohci1394_initialize()
114 reg_write(ohci, OHCI1394_BusOptions, bus_options); in init_ohci1394_initialize()
117 reg_write(ohci, OHCI1394_NodeID, 0x0000ffc0); in init_ohci1394_initialize()
120 reg_write(ohci, OHCI1394_HCControlSet, in init_ohci1394_initialize()
124 reg_write(ohci, OHCI1394_LinkControlClear, 0xffffffff); in init_ohci1394_initialize()
127 reg_write(ohci, OHCI1394_LinkControlSet, in init_ohci1394_initialize()
131 reg_write(ohci, OHCI1394_LinkControlClear, 0x00000400); in init_ohci1394_initialize()
134 reg_write(ohci, OHCI1394_IsoRecvIntMaskClear, 0xffffffff); in init_ohci1394_initialize()
135 reg_write(ohci, OHCI1394_IsoRecvIntEventClear, 0xffffffff); in init_ohci1394_initialize()
136 reg_write(ohci, OHCI1394_IsoXmitIntMaskClear, 0xffffffff); in init_ohci1394_initialize()
137 reg_write(ohci, OHCI1394_IsoXmitIntEventClear, 0xffffffff); in init_ohci1394_initialize()
140 reg_write(ohci, OHCI1394_AsReqFilterHiSet, 0x80000000); in init_ohci1394_initialize()
143 reg_write(ohci, OHCI1394_ATRetries, in init_ohci1394_initialize()
149 reg_write(ohci, OHCI1394_HCControlClear, in init_ohci1394_initialize()
153 reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_linkEnable); in init_ohci1394_initialize()
156 num_ports = get_phy_reg(ohci, 2) & 0xf; in init_ohci1394_initialize()
160 set_phy_reg(ohci, 7, i); in init_ohci1394_initialize()
161 status = get_phy_reg(ohci, 8); in init_ohci1394_initialize()
164 set_phy_reg(ohci, 8, status & ~1); in init_ohci1394_initialize()
177 static inline void __init init_ohci1394_wait_for_busresets(struct ohci *ohci) in init_ohci1394_wait_for_busresets() argument
183 events = reg_read(ohci, OHCI1394_IntEventSet); in init_ohci1394_wait_for_busresets()
185 reg_write(ohci, OHCI1394_IntEventClear, in init_ohci1394_wait_for_busresets()
195 static inline void __init init_ohci1394_enable_physical_dma(struct ohci *ohci) in init_ohci1394_enable_physical_dma() argument
197 reg_write(ohci, OHCI1394_PhyReqFilterHiSet, 0xffffffff); in init_ohci1394_enable_physical_dma()
198 reg_write(ohci, OHCI1394_PhyReqFilterLoSet, 0xffffffff); in init_ohci1394_enable_physical_dma()
199 reg_write(ohci, OHCI1394_PhyUpperBound, 0xffff0000); in init_ohci1394_enable_physical_dma()
206 static inline void __init init_ohci1394_reset_and_init_dma(struct ohci *ohci) in init_ohci1394_reset_and_init_dma() argument
209 init_ohci1394_soft_reset(ohci); in init_ohci1394_reset_and_init_dma()
212 reg_write(ohci, OHCI1394_HCControlSet, OHCI1394_HCControl_LPS); in init_ohci1394_reset_and_init_dma()
215 reg_write(ohci, OHCI1394_IntEventClear, 0xffffffff); in init_ohci1394_reset_and_init_dma()
216 reg_write(ohci, OHCI1394_IntMaskClear, 0xffffffff); in init_ohci1394_reset_and_init_dma()
220 init_ohci1394_initialize(ohci); in init_ohci1394_reset_and_init_dma()
225 init_ohci1394_wait_for_busresets(ohci); in init_ohci1394_reset_and_init_dma()
228 init_ohci1394_enable_physical_dma(ohci); in init_ohci1394_reset_and_init_dma()
238 struct ohci ohci; in init_ohci1394_controller() local
240 printk(KERN_INFO "init_ohci1394_dma: initializing OHCI-1394" in init_ohci1394_controller()
248 ohci.registers = (void __iomem *)fix_to_virt(FIX_OHCI1394_BASE); in init_ohci1394_controller()
250 init_ohci1394_reset_and_init_dma(&ohci); in init_ohci1394_controller()
275 continue; /* Not an OHCI-1394 device */ in init_ohci1394_dma_on_all_controllers()
282 printk(KERN_INFO "init_ohci1394_dma: finished initializing OHCI DMA\n"); in init_ohci1394_dma_on_all_controllers()