• Sergei Shtylyov's avatar
    hpt366: init code rewrite · 7b73ee05
    Sergei Shtylyov authored
    Finally, rework the driver init.  code to correctly handle all the chip
    variants HighPoint has created so far.  This should cure the rest of the
    timing issues in the driver (especially, on 66 MHz PCI) caused by the
    HighPoint's habit of switching the base DPLL clock with every new revision
    of the chips...
      - switch to using the enumeration type to differ between the numerous chip
        variants, matching PCI device/revision ID with the chip type early, at the
        init_setup stage;
      - extend the hpt_info structure to hold the DPLL and PCI clock frequencies,
        stop duplicating it for each channel by storing the pointer in the pci_dev
        structure: first, at the init_setup stage, point it to a static "template"
        with only the chip type and its specific base DPLL frequency, the highest
        supported DMA mode, and the chip settings table pointer filled, then, at
        the init_chipset stage, allocate per-chip instance  and fill it with the
        rest of the necessary information;
      - get rid of the constant thresholds in the HPT37x PCI clock detection code,
        switch  to calculating  PCI clock frequency based on the chip's base DPLL
      - switch to using the DPLL clock and enable UltraATA/133 mode by default on
        anything newer than HPT370/A;
      - fold PCI clock detection and DPLL setup code into init_chipset_hpt366(),
        unify the HPT36x/37x setup code and the speedproc handlers by joining the
        register setting lists into the table indexed by the clock selected;
      - add enablebits for all the chips to avoid touching disabled channels
        (though the HighPoint BIOS seem to only disable the primary one on
      - separate the UltraDMA and MWDMA masks there to avoid changing PIO timings
        when setting an UltraDMA mode in hpt37x_tune_chipset().
    This version has been tested on HPT370/302/371N.
    Thanks to Alan for the inspiration. Hopefully, his libata driver will also
    benefit from the work done on this "obsolete" driver...
    Signed-off-by: default avatarSergei Shtylyov <sshtylyov@ru.mvista.com>
    Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
hpt366.c 44.9 KB