resource_size_t addr;
int i;
u32 csigr_bits;
+ unsigned unknown_dma_burst_bits;
if(pci_enable_device(mite->pcidev)){
printk("error enabling mite\n");
// The 6602 board needs different initalisation, see the
// _updated_ (nov 2002) reg. Level Manual (filename 370505b.pdf) p. 3.55
if (mite->pcidev->device == 0x1310 ){
+ unsigned window_size_order;
+
printk("mite: detected NI6602, using other I/O Window Base Size register\n");
- writel((mite->daq_phys_addr & 0xffffff00L) | WENAB_6602 , mite->mite_io_addr + MITE_IODWBSR_1);
- writel(0 , mite->mite_io_addr + MITE_IODWCR_1);
+ window_size_order = 13; // 8 kbyte
+ writel(mite->daq_phys_addr | WENAB | MITE_IODWBSR_1_WSIZE_bits(window_size_order), mite->mite_io_addr + MITE_IODWBSR_1);
+ writel(0 ,mite->mite_io_addr + MITE_IODWCR_1);
+ }else
+ {
+ writel(mite->daq_phys_addr | WENAB, mite->mite_io_addr + MITE_IODWBSR);
}
- else writel(mite->daq_phys_addr | WENAB , mite->mite_io_addr + MITE_IODWBSR);
+ /* make sure dma bursts work. I got this from running a bus analyzer
+ on a pxi-6281 and a pxi-6713. 6713 powered up with register value
+ of 0x61f and bursts worked. 6281 powered up with register value of
+ 0x1f and bursts didn't work. The NI windows driver read the register, then
+ wrote 0x61f to it, so it looked like it was trying to preserve some
+ of the register bits instead of overwriting them all, I am only
+ guessing which ones though. Later I'll try initializing the register with
+ all ones and all zeros to see if I can determine which bits the
+ windows driver is really changing.
+ */
+ unknown_dma_burst_bits = readl(mite->mite_io_addr + MITE_UNKNOWN_DMA_BURST_REG);
+ unknown_dma_burst_bits |= 0x600;
+ writel(unknown_dma_burst_bits, mite->mite_io_addr + MITE_UNKNOWN_DMA_BURST_REG);
csigr_bits = readl(mite->mite_io_addr + MITE_CSIGR);
mite->num_channels = mite_csigr_dmac(csigr_bits);
enum mite_registers
{
+ MITE_UNKNOWN_DMA_BURST_REG = 0x28,
MITE_IODWBSR = 0xc0, //IO Device Window Base Size Register
- MITE_CSIGR = 0x460, //chip signature
- MITE_IODWBSR_1 = 0xc4, // IO Device Window Base Size Register 1 (used by 6602 boards)
- MITE_IODWCR_1 = 0xf4
+ MITE_IODWBSR_1 = 0xc4, // IO Device Window Base Size Register 1
+ MITE_IODWCR_1 = 0xf4,
+ MITE_PCI_CONFIG_OFFSET = 0x300,
+ MITE_CSIGR = 0x460 //chip signature
};
static inline int MITE_CHOR(int channel) // channel operation
{
enum MITE_IODWBSR_bits
{
WENAB = 0x80, // window enable
- WENAB_6602 = 0x8c // window enable for 6602 boards
};
+// sets window size to 2 raised to the power "order"
+static inline unsigned MITE_IODWBSR_1_WSIZE_bits(unsigned order)
+{
+ BUG_ON(order < 1);
+ return (order - 1) & 0x1f;
+}
static inline int mite_csigr_version(u32 csigr_bits)
{
bits |= AO_FIFO_Enable;
else
bits |= AO_DMA_PIO_Control;
+#if 0
+ /* F Hess: windows driver does not set AO_Number_Of_DAC_Packages bit for 6281,
+ verified with bus analyzer. */
if(boardtype.reg_type & ni_reg_m_series_mask)
- bits |= AO_Number_Of_DAC_Packages/* | AO_Multiple_DACS_Per_Package*/;
+ bits |= AO_Number_Of_DAC_Packages;
+#endif
devpriv->stc_writew(dev, bits, AO_Personal_Register);
// enable sending of ao dma requests
devpriv->stc_writew(dev, AO_AOFREQ_Enable, AO_Start_Select_Register);