diff options
| -rw-r--r-- | drivers/ata/acard-ahci.c | 2 | ||||
| -rw-r--r-- | drivers/ata/libata-core.c | 10 | ||||
| -rw-r--r-- | drivers/ata/libata-eh.c | 2 | ||||
| -rw-r--r-- | drivers/ata/libata-pmp.c | 10 | ||||
| -rw-r--r-- | drivers/ata/libata-scsi.c | 2 | ||||
| -rw-r--r-- | drivers/ata/libata-sff.c | 9 | ||||
| -rw-r--r-- | drivers/ata/pata_at91.c | 297 | ||||
| -rw-r--r-- | drivers/ata/pata_cmd64x.c | 42 | ||||
| -rw-r--r-- | drivers/ata/pata_triflex.c | 23 | ||||
| -rw-r--r-- | include/linux/libata.h | 1 | ||||
| -rw-r--r-- | include/linux/pci_ids.h | 2 |
11 files changed, 289 insertions, 111 deletions
diff --git a/drivers/ata/acard-ahci.c b/drivers/ata/acard-ahci.c index 339c210f03a6..ae22be4157b5 100644 --- a/drivers/ata/acard-ahci.c +++ b/drivers/ata/acard-ahci.c | |||
| @@ -417,7 +417,7 @@ static int acard_ahci_init_one(struct pci_dev *pdev, const struct pci_device_id | |||
| 417 | 417 | ||
| 418 | VPRINTK("ENTER\n"); | 418 | VPRINTK("ENTER\n"); |
| 419 | 419 | ||
| 420 | WARN_ON(ATA_MAX_QUEUE > AHCI_MAX_CMDS); | 420 | WARN_ON((int)ATA_MAX_QUEUE > AHCI_MAX_CMDS); |
| 421 | 421 | ||
| 422 | if (!printed_version++) | 422 | if (!printed_version++) |
| 423 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); | 423 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 76c3c15cb1e6..736bee5dafeb 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
| @@ -3619,8 +3619,14 @@ int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy, | |||
| 3619 | scontrol |= (0x2 << 8); | 3619 | scontrol |= (0x2 << 8); |
| 3620 | break; | 3620 | break; |
| 3621 | case ATA_LPM_MIN_POWER: | 3621 | case ATA_LPM_MIN_POWER: |
| 3622 | /* no restrictions on LPM transitions */ | 3622 | if (ata_link_nr_enabled(link) > 0) |
| 3623 | scontrol &= ~(0x3 << 8); | 3623 | /* no restrictions on LPM transitions */ |
| 3624 | scontrol &= ~(0x3 << 8); | ||
| 3625 | else { | ||
| 3626 | /* empty port, power off */ | ||
| 3627 | scontrol &= ~0xf; | ||
| 3628 | scontrol |= (0x1 << 2); | ||
| 3629 | } | ||
| 3624 | break; | 3630 | break; |
| 3625 | default: | 3631 | default: |
| 3626 | WARN_ON(1); | 3632 | WARN_ON(1); |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index dad9fd660f37..dfb6e9d3d759 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
| @@ -3423,7 +3423,7 @@ fail: | |||
| 3423 | return rc; | 3423 | return rc; |
| 3424 | } | 3424 | } |
| 3425 | 3425 | ||
| 3426 | static int ata_link_nr_enabled(struct ata_link *link) | 3426 | int ata_link_nr_enabled(struct ata_link *link) |
| 3427 | { | 3427 | { |
| 3428 | struct ata_device *dev; | 3428 | struct ata_device *dev; |
| 3429 | int cnt = 0; | 3429 | int cnt = 0; |
diff --git a/drivers/ata/libata-pmp.c b/drivers/ata/libata-pmp.c index 3120596d4afc..f06b7ea590d3 100644 --- a/drivers/ata/libata-pmp.c +++ b/drivers/ata/libata-pmp.c | |||
| @@ -449,6 +449,16 @@ static void sata_pmp_quirks(struct ata_port *ap) | |||
| 449 | * otherwise. Don't try hard to recover it. | 449 | * otherwise. Don't try hard to recover it. |
| 450 | */ | 450 | */ |
| 451 | ap->pmp_link[ap->nr_pmp_links - 1].flags |= ATA_LFLAG_NO_RETRY; | 451 | ap->pmp_link[ap->nr_pmp_links - 1].flags |= ATA_LFLAG_NO_RETRY; |
| 452 | } else if (vendor == 0x197b && devid == 0x2352) { | ||
| 453 | /* chip found in Thermaltake BlackX Duet, jmicron JMB350? */ | ||
| 454 | ata_for_each_link(link, ap, EDGE) { | ||
| 455 | /* SRST breaks detection and disks get misclassified | ||
| 456 | * LPM disabled to avoid potential problems | ||
| 457 | */ | ||
| 458 | link->flags |= ATA_LFLAG_NO_LPM | | ||
| 459 | ATA_LFLAG_NO_SRST | | ||
| 460 | ATA_LFLAG_ASSUME_ATA; | ||
| 461 | } | ||
| 452 | } | 462 | } |
| 453 | } | 463 | } |
| 454 | 464 | ||
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index e2f57e9e12f0..30ea95f43e79 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
| @@ -2138,7 +2138,7 @@ static unsigned int ata_scsiop_inq_b0(struct ata_scsi_args *args, u8 *rbuf) | |||
| 2138 | * with the unmap bit set. | 2138 | * with the unmap bit set. |
| 2139 | */ | 2139 | */ |
| 2140 | if (ata_id_has_trim(args->id)) { | 2140 | if (ata_id_has_trim(args->id)) { |
| 2141 | put_unaligned_be32(65535 * 512 / 8, &rbuf[20]); | 2141 | put_unaligned_be64(65535 * 512 / 8, &rbuf[36]); |
| 2142 | put_unaligned_be32(1, &rbuf[28]); | 2142 | put_unaligned_be32(1, &rbuf[28]); |
| 2143 | } | 2143 | } |
| 2144 | 2144 | ||
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index f8380ce0f4d1..b1b926c55a72 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
| @@ -2447,13 +2447,18 @@ int ata_pci_sff_activate_host(struct ata_host *host, | |||
| 2447 | return -ENOMEM; | 2447 | return -ENOMEM; |
| 2448 | 2448 | ||
| 2449 | if (!legacy_mode && pdev->irq) { | 2449 | if (!legacy_mode && pdev->irq) { |
| 2450 | int i; | ||
| 2451 | |||
| 2450 | rc = devm_request_irq(dev, pdev->irq, irq_handler, | 2452 | rc = devm_request_irq(dev, pdev->irq, irq_handler, |
| 2451 | IRQF_SHARED, drv_name, host); | 2453 | IRQF_SHARED, drv_name, host); |
| 2452 | if (rc) | 2454 | if (rc) |
| 2453 | goto out; | 2455 | goto out; |
| 2454 | 2456 | ||
| 2455 | ata_port_desc(host->ports[0], "irq %d", pdev->irq); | 2457 | for (i = 0; i < 2; i++) { |
| 2456 | ata_port_desc(host->ports[1], "irq %d", pdev->irq); | 2458 | if (ata_port_is_dummy(host->ports[i])) |
| 2459 | continue; | ||
| 2460 | ata_port_desc(host->ports[i], "irq %d", pdev->irq); | ||
| 2461 | } | ||
| 2457 | } else if (legacy_mode) { | 2462 | } else if (legacy_mode) { |
| 2458 | if (!ata_port_is_dummy(host->ports[0])) { | 2463 | if (!ata_port_is_dummy(host->ports[0])) { |
| 2459 | rc = devm_request_irq(dev, ATA_PRIMARY_IRQ(pdev), | 2464 | rc = devm_request_irq(dev, ATA_PRIMARY_IRQ(pdev), |
diff --git a/drivers/ata/pata_at91.c b/drivers/ata/pata_at91.c index a5fdbdcb0faf..960c72571395 100644 --- a/drivers/ata/pata_at91.c +++ b/drivers/ata/pata_at91.c | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | * with CompactFlash interface in True IDE mode | 3 | * with CompactFlash interface in True IDE mode |
| 4 | * | 4 | * |
| 5 | * Copyright (C) 2009 Matyukevich Sergey | 5 | * Copyright (C) 2009 Matyukevich Sergey |
| 6 | * 2011 Igor Plyatov | ||
| 6 | * | 7 | * |
| 7 | * Based on: | 8 | * Based on: |
| 8 | * * generic platform driver by Paul Mundt: drivers/ata/pata_platform.c | 9 | * * generic platform driver by Paul Mundt: drivers/ata/pata_platform.c |
| @@ -31,38 +32,150 @@ | |||
| 31 | #include <mach/board.h> | 32 | #include <mach/board.h> |
| 32 | #include <mach/gpio.h> | 33 | #include <mach/gpio.h> |
| 33 | 34 | ||
| 35 | #define DRV_NAME "pata_at91" | ||
| 36 | #define DRV_VERSION "0.3" | ||
| 34 | 37 | ||
| 35 | #define DRV_NAME "pata_at91" | 38 | #define CF_IDE_OFFSET 0x00c00000 |
| 36 | #define DRV_VERSION "0.2" | 39 | #define CF_ALT_IDE_OFFSET 0x00e00000 |
| 37 | 40 | #define CF_IDE_RES_SIZE 0x08 | |
| 38 | #define CF_IDE_OFFSET 0x00c00000 | 41 | #define CS_PULSE_MAXIMUM 319 |
| 39 | #define CF_ALT_IDE_OFFSET 0x00e00000 | 42 | #define ER_SMC_CALC 1 |
| 40 | #define CF_IDE_RES_SIZE 0x08 | 43 | #define ER_SMC_RECALC 2 |
| 41 | #define NCS_RD_PULSE_LIMIT 0x3f /* maximal value for pulse bitfields */ | ||
| 42 | 44 | ||
| 43 | struct at91_ide_info { | 45 | struct at91_ide_info { |
| 44 | unsigned long mode; | 46 | unsigned long mode; |
| 45 | unsigned int cs; | 47 | unsigned int cs; |
| 46 | |||
| 47 | struct clk *mck; | 48 | struct clk *mck; |
| 48 | |||
| 49 | void __iomem *ide_addr; | 49 | void __iomem *ide_addr; |
| 50 | void __iomem *alt_addr; | 50 | void __iomem *alt_addr; |
| 51 | }; | 51 | }; |
| 52 | 52 | ||
| 53 | static const struct ata_timing initial_timing = { | 53 | /** |
| 54 | .mode = XFER_PIO_0, | 54 | * struct smc_range - range of valid values for SMC register. |
| 55 | .setup = 70, | 55 | */ |
| 56 | .act8b = 290, | 56 | struct smc_range { |
| 57 | .rec8b = 240, | 57 | int min; |
| 58 | .cyc8b = 600, | 58 | int max; |
| 59 | .active = 165, | ||
| 60 | .recover = 150, | ||
| 61 | .dmack_hold = 0, | ||
| 62 | .cycle = 600, | ||
| 63 | .udma = 0 | ||
| 64 | }; | 59 | }; |
| 65 | 60 | ||
| 61 | /** | ||
| 62 | * adjust_smc_value - adjust value for one of SMC registers. | ||
| 63 | * @value: adjusted value | ||
| 64 | * @range: array of SMC ranges with valid values | ||
| 65 | * @size: SMC ranges array size | ||
| 66 | * | ||
| 67 | * This returns the difference between input and output value or negative | ||
| 68 | * in case of invalid input value. | ||
| 69 | * If negative returned, then output value = maximal possible from ranges. | ||
| 70 | */ | ||
| 71 | static int adjust_smc_value(int *value, struct smc_range *range, int size) | ||
| 72 | { | ||
| 73 | int maximum = (range + size - 1)->max; | ||
| 74 | int remainder; | ||
| 75 | |||
| 76 | do { | ||
| 77 | if (*value < range->min) { | ||
| 78 | remainder = range->min - *value; | ||
| 79 | *value = range->min; /* nearest valid value */ | ||
| 80 | return remainder; | ||
| 81 | } else if ((range->min <= *value) && (*value <= range->max)) | ||
| 82 | return 0; | ||
| 83 | |||
| 84 | range++; | ||
| 85 | } while (--size); | ||
| 86 | *value = maximum; | ||
| 87 | |||
| 88 | return -1; /* invalid value */ | ||
| 89 | } | ||
| 90 | |||
| 91 | /** | ||
| 92 | * calc_smc_vals - calculate SMC register values | ||
| 93 | * @dev: ATA device | ||
| 94 | * @setup: SMC_SETUP register value | ||
| 95 | * @pulse: SMC_PULSE register value | ||
| 96 | * @cycle: SMC_CYCLE register value | ||
| 97 | * | ||
| 98 | * This returns negative in case of invalid values for SMC registers: | ||
| 99 | * -ER_SMC_RECALC - recalculation required for SMC values, | ||
| 100 | * -ER_SMC_CALC - calculation failed (invalid input values). | ||
| 101 | * | ||
| 102 | * SMC use special coding scheme, see "Coding and Range of Timing | ||
| 103 | * Parameters" table from AT91SAM9 datasheets. | ||
| 104 | * | ||
| 105 | * SMC_SETUP = 128*setup[5] + setup[4:0] | ||
| 106 | * SMC_PULSE = 256*pulse[6] + pulse[5:0] | ||
| 107 | * SMC_CYCLE = 256*cycle[8:7] + cycle[6:0] | ||
| 108 | */ | ||
| 109 | static int calc_smc_vals(struct device *dev, | ||
| 110 | int *setup, int *pulse, int *cycle, int *cs_pulse) | ||
| 111 | { | ||
| 112 | int ret_val; | ||
| 113 | int err = 0; | ||
| 114 | struct smc_range range_setup[] = { /* SMC_SETUP valid values */ | ||
| 115 | {.min = 0, .max = 31}, /* first range */ | ||
| 116 | {.min = 128, .max = 159} /* second range */ | ||
| 117 | }; | ||
| 118 | struct smc_range range_pulse[] = { /* SMC_PULSE valid values */ | ||
| 119 | {.min = 0, .max = 63}, /* first range */ | ||
| 120 | {.min = 256, .max = 319} /* second range */ | ||
| 121 | }; | ||
| 122 | struct smc_range range_cycle[] = { /* SMC_CYCLE valid values */ | ||
| 123 | {.min = 0, .max = 127}, /* first range */ | ||
| 124 | {.min = 256, .max = 383}, /* second range */ | ||
| 125 | {.min = 512, .max = 639}, /* third range */ | ||
| 126 | {.min = 768, .max = 895} /* fourth range */ | ||
| 127 | }; | ||
| 128 | |||
| 129 | ret_val = adjust_smc_value(setup, range_setup, ARRAY_SIZE(range_setup)); | ||
| 130 | if (ret_val < 0) | ||
| 131 | dev_warn(dev, "maximal SMC Setup value\n"); | ||
| 132 | else | ||
| 133 | *cycle += ret_val; | ||
| 134 | |||
| 135 | ret_val = adjust_smc_value(pulse, range_pulse, ARRAY_SIZE(range_pulse)); | ||
| 136 | if (ret_val < 0) | ||
| 137 | dev_warn(dev, "maximal SMC Pulse value\n"); | ||
| 138 | else | ||
| 139 | *cycle += ret_val; | ||
| 140 | |||
| 141 | ret_val = adjust_smc_value(cycle, range_cycle, ARRAY_SIZE(range_cycle)); | ||
| 142 | if (ret_val < 0) | ||
| 143 | dev_warn(dev, "maximal SMC Cycle value\n"); | ||
| 144 | |||
| 145 | *cs_pulse = *cycle; | ||
| 146 | if (*cs_pulse > CS_PULSE_MAXIMUM) { | ||
| 147 | dev_err(dev, "unable to calculate valid SMC settings\n"); | ||
| 148 | return -ER_SMC_CALC; | ||
| 149 | } | ||
| 150 | |||
| 151 | ret_val = adjust_smc_value(cs_pulse, range_pulse, | ||
| 152 | ARRAY_SIZE(range_pulse)); | ||
| 153 | if (ret_val < 0) { | ||
| 154 | dev_warn(dev, "maximal SMC CS Pulse value\n"); | ||
| 155 | } else if (ret_val != 0) { | ||
| 156 | *cycle = *cs_pulse; | ||
| 157 | dev_warn(dev, "SMC Cycle extended\n"); | ||
| 158 | err = -ER_SMC_RECALC; | ||
| 159 | } | ||
| 160 | |||
| 161 | return err; | ||
| 162 | } | ||
| 163 | |||
| 164 | /** | ||
| 165 | * to_smc_format - convert values into SMC format | ||
| 166 | * @setup: SETUP value of SMC Setup Register | ||
| 167 | * @pulse: PULSE value of SMC Pulse Register | ||
| 168 | * @cycle: CYCLE value of SMC Cycle Register | ||
| 169 | * @cs_pulse: NCS_PULSE value of SMC Pulse Register | ||
| 170 | */ | ||
| 171 | static void to_smc_format(int *setup, int *pulse, int *cycle, int *cs_pulse) | ||
| 172 | { | ||
| 173 | *setup = (*setup & 0x1f) | ((*setup & 0x80) >> 2); | ||
| 174 | *pulse = (*pulse & 0x3f) | ((*pulse & 0x100) >> 2); | ||
| 175 | *cycle = (*cycle & 0x7f) | ((*cycle & 0x300) >> 1); | ||
| 176 | *cs_pulse = (*cs_pulse & 0x3f) | ((*cs_pulse & 0x100) >> 2); | ||
| 177 | } | ||
| 178 | |||
| 66 | static unsigned long calc_mck_cycles(unsigned long ns, unsigned long mck_hz) | 179 | static unsigned long calc_mck_cycles(unsigned long ns, unsigned long mck_hz) |
| 67 | { | 180 | { |
| 68 | unsigned long mul; | 181 | unsigned long mul; |
| @@ -80,85 +193,77 @@ static unsigned long calc_mck_cycles(unsigned long ns, unsigned long mck_hz) | |||
| 80 | return (ns * mul + 65536) >> 16; /* rounding */ | 193 | return (ns * mul + 65536) >> 16; /* rounding */ |
| 81 | } | 194 | } |
| 82 | 195 | ||
| 83 | static void set_smc_mode(struct at91_ide_info *info) | 196 | /** |
| 84 | { | 197 | * set_smc_timing - SMC timings setup. |
| 85 | at91_sys_write(AT91_SMC_MODE(info->cs), info->mode); | 198 | * @dev: device |
| 86 | return; | 199 | * @info: AT91 IDE info |
| 87 | } | 200 | * @ata: ATA timings |
| 88 | 201 | * | |
| 89 | static void set_smc_timing(struct device *dev, | 202 | * Its assumed that write timings are same as read timings, |
| 203 | * cs_setup = 0 and cs_pulse = cycle. | ||
| 204 | */ | ||
| 205 | static void set_smc_timing(struct device *dev, struct ata_device *adev, | ||
| 90 | struct at91_ide_info *info, const struct ata_timing *ata) | 206 | struct at91_ide_info *info, const struct ata_timing *ata) |
| 91 | { | 207 | { |
| 92 | unsigned long read_cycle, write_cycle, active, recover; | 208 | int ret = 0; |
| 93 | unsigned long nrd_setup, nrd_pulse, nrd_recover; | 209 | int use_iordy; |
| 94 | unsigned long nwe_setup, nwe_pulse; | 210 | unsigned int t6z; /* data tristate time in ns */ |
| 95 | 211 | unsigned int cycle; /* SMC Cycle width in MCK ticks */ | |
| 96 | unsigned long ncs_write_setup, ncs_write_pulse; | 212 | unsigned int setup; /* SMC Setup width in MCK ticks */ |
| 97 | unsigned long ncs_read_setup, ncs_read_pulse; | 213 | unsigned int pulse; /* CFIOR and CFIOW pulse width in MCK ticks */ |
| 98 | 214 | unsigned int cs_setup = 0;/* CS4 or CS5 setup width in MCK ticks */ | |
| 99 | unsigned long mck_hz; | 215 | unsigned int cs_pulse; /* CS4 or CS5 pulse width in MCK ticks*/ |
| 100 | 216 | unsigned int tdf_cycles; /* SMC TDF MCK ticks */ | |
| 101 | read_cycle = ata->cyc8b; | 217 | unsigned long mck_hz; /* MCK frequency in Hz */ |
| 102 | nrd_setup = ata->setup; | 218 | |
| 103 | nrd_pulse = ata->act8b; | 219 | t6z = (ata->mode < XFER_PIO_5) ? 30 : 20; |
| 104 | nrd_recover = ata->rec8b; | ||
| 105 | |||
| 106 | mck_hz = clk_get_rate(info->mck); | 220 | mck_hz = clk_get_rate(info->mck); |
| 107 | 221 | cycle = calc_mck_cycles(ata->cyc8b, mck_hz); | |
| 108 | read_cycle = calc_mck_cycles(read_cycle, mck_hz); | 222 | setup = calc_mck_cycles(ata->setup, mck_hz); |
| 109 | nrd_setup = calc_mck_cycles(nrd_setup, mck_hz); | 223 | pulse = calc_mck_cycles(ata->act8b, mck_hz); |
| 110 | nrd_pulse = calc_mck_cycles(nrd_pulse, mck_hz); | 224 | tdf_cycles = calc_mck_cycles(t6z, mck_hz); |
| 111 | nrd_recover = calc_mck_cycles(nrd_recover, mck_hz); | 225 | |
| 112 | 226 | do { | |
| 113 | active = nrd_setup + nrd_pulse; | 227 | ret = calc_smc_vals(dev, &setup, &pulse, &cycle, &cs_pulse); |
| 114 | recover = read_cycle - active; | 228 | } while (ret == -ER_SMC_RECALC); |
| 115 | 229 | ||
| 116 | /* Need at least two cycles recovery */ | 230 | if (ret == -ER_SMC_CALC) |
| 117 | if (recover < 2) | 231 | dev_err(dev, "Interface may not operate correctly\n"); |
| 118 | read_cycle = active + 2; | 232 | |
| 119 | 233 | dev_dbg(dev, "SMC Setup=%u, Pulse=%u, Cycle=%u, CS Pulse=%u\n", | |
| 120 | /* (CS0, CS1, DIR, OE) <= (CFCE1, CFCE2, CFRNW, NCSX) timings */ | 234 | setup, pulse, cycle, cs_pulse); |
| 121 | ncs_read_setup = 1; | 235 | to_smc_format(&setup, &pulse, &cycle, &cs_pulse); |
| 122 | ncs_read_pulse = read_cycle - 2; | 236 | /* disable or enable waiting for IORDY signal */ |
| 123 | if (ncs_read_pulse > NCS_RD_PULSE_LIMIT) { | 237 | use_iordy = ata_pio_need_iordy(adev); |
| 124 | ncs_read_pulse = NCS_RD_PULSE_LIMIT; | 238 | if (use_iordy) |
| 125 | dev_warn(dev, "ncs_read_pulse limited to maximal value %lu\n", | 239 | info->mode |= AT91_SMC_EXNWMODE_READY; |
| 126 | ncs_read_pulse); | 240 | |
| 241 | if (tdf_cycles > 15) { | ||
| 242 | tdf_cycles = 15; | ||
| 243 | dev_warn(dev, "maximal SMC TDF Cycles value\n"); | ||
| 127 | } | 244 | } |
| 128 | 245 | ||
| 129 | /* Write timings same as read timings */ | 246 | dev_dbg(dev, "Use IORDY=%u, TDF Cycles=%u\n", use_iordy, tdf_cycles); |
| 130 | write_cycle = read_cycle; | 247 | info->mode |= AT91_SMC_TDF_(tdf_cycles); |
| 131 | nwe_setup = nrd_setup; | ||
| 132 | nwe_pulse = nrd_pulse; | ||
| 133 | ncs_write_setup = ncs_read_setup; | ||
| 134 | ncs_write_pulse = ncs_read_pulse; | ||
| 135 | |||
| 136 | dev_dbg(dev, "ATA timings: nrd_setup = %lu nrd_pulse = %lu nrd_cycle = %lu\n", | ||
| 137 | nrd_setup, nrd_pulse, read_cycle); | ||
| 138 | dev_dbg(dev, "ATA timings: nwe_setup = %lu nwe_pulse = %lu nwe_cycle = %lu\n", | ||
| 139 | nwe_setup, nwe_pulse, write_cycle); | ||
| 140 | dev_dbg(dev, "ATA timings: ncs_read_setup = %lu ncs_read_pulse = %lu\n", | ||
| 141 | ncs_read_setup, ncs_read_pulse); | ||
| 142 | dev_dbg(dev, "ATA timings: ncs_write_setup = %lu ncs_write_pulse = %lu\n", | ||
| 143 | ncs_write_setup, ncs_write_pulse); | ||
| 144 | 248 | ||
| 249 | /* write SMC Setup Register */ | ||
| 145 | at91_sys_write(AT91_SMC_SETUP(info->cs), | 250 | at91_sys_write(AT91_SMC_SETUP(info->cs), |
| 146 | AT91_SMC_NWESETUP_(nwe_setup) | | 251 | AT91_SMC_NWESETUP_(setup) | |
| 147 | AT91_SMC_NRDSETUP_(nrd_setup) | | 252 | AT91_SMC_NRDSETUP_(setup) | |
| 148 | AT91_SMC_NCS_WRSETUP_(ncs_write_setup) | | 253 | AT91_SMC_NCS_WRSETUP_(cs_setup) | |
| 149 | AT91_SMC_NCS_RDSETUP_(ncs_read_setup)); | 254 | AT91_SMC_NCS_RDSETUP_(cs_setup)); |
| 150 | 255 | /* write SMC Pulse Register */ | |
| 151 | at91_sys_write(AT91_SMC_PULSE(info->cs), | 256 | at91_sys_write(AT91_SMC_PULSE(info->cs), |
| 152 | AT91_SMC_NWEPULSE_(nwe_pulse) | | 257 | AT91_SMC_NWEPULSE_(pulse) | |
| 153 | AT91_SMC_NRDPULSE_(nrd_pulse) | | 258 | AT91_SMC_NRDPULSE_(pulse) | |
| 154 | AT91_SMC_NCS_WRPULSE_(ncs_write_pulse) | | 259 | AT91_SMC_NCS_WRPULSE_(cs_pulse) | |
| 155 | AT91_SMC_NCS_RDPULSE_(ncs_read_pulse)); | 260 | AT91_SMC_NCS_RDPULSE_(cs_pulse)); |
| 156 | 261 | /* write SMC Cycle Register */ | |
| 157 | at91_sys_write(AT91_SMC_CYCLE(info->cs), | 262 | at91_sys_write(AT91_SMC_CYCLE(info->cs), |
| 158 | AT91_SMC_NWECYCLE_(write_cycle) | | 263 | AT91_SMC_NWECYCLE_(cycle) | |
| 159 | AT91_SMC_NRDCYCLE_(read_cycle)); | 264 | AT91_SMC_NRDCYCLE_(cycle)); |
| 160 | 265 | /* write SMC Mode Register*/ | |
| 161 | return; | 266 | at91_sys_write(AT91_SMC_MODE(info->cs), info->mode); |
| 162 | } | 267 | } |
| 163 | 268 | ||
| 164 | static void pata_at91_set_piomode(struct ata_port *ap, struct ata_device *adev) | 269 | static void pata_at91_set_piomode(struct ata_port *ap, struct ata_device *adev) |
| @@ -172,15 +277,9 @@ static void pata_at91_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
| 172 | if (ret) { | 277 | if (ret) { |
| 173 | dev_warn(ap->dev, "Failed to compute ATA timing %d, " | 278 | dev_warn(ap->dev, "Failed to compute ATA timing %d, " |
| 174 | "set PIO_0 timing\n", ret); | 279 | "set PIO_0 timing\n", ret); |
| 175 | set_smc_timing(ap->dev, info, &initial_timing); | 280 | timing = *ata_timing_find_mode(XFER_PIO_0); |
| 176 | } else { | ||
| 177 | set_smc_timing(ap->dev, info, &timing); | ||
| 178 | } | 281 | } |
| 179 | 282 | set_smc_timing(ap->dev, adev, info, &timing); | |
| 180 | /* Setup SMC mode */ | ||
| 181 | set_smc_mode(info); | ||
| 182 | |||
| 183 | return; | ||
| 184 | } | 283 | } |
| 185 | 284 | ||
| 186 | static unsigned int pata_at91_data_xfer_noirq(struct ata_device *dev, | 285 | static unsigned int pata_at91_data_xfer_noirq(struct ata_device *dev, |
| @@ -346,7 +445,7 @@ static int __devexit pata_at91_remove(struct platform_device *pdev) | |||
| 346 | static struct platform_driver pata_at91_driver = { | 445 | static struct platform_driver pata_at91_driver = { |
| 347 | .probe = pata_at91_probe, | 446 | .probe = pata_at91_probe, |
| 348 | .remove = __devexit_p(pata_at91_remove), | 447 | .remove = __devexit_p(pata_at91_remove), |
| 349 | .driver = { | 448 | .driver = { |
| 350 | .name = DRV_NAME, | 449 | .name = DRV_NAME, |
| 351 | .owner = THIS_MODULE, | 450 | .owner = THIS_MODULE, |
| 352 | }, | 451 | }, |
diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c index 905ff76d3cbb..7bafc16cf5e0 100644 --- a/drivers/ata/pata_cmd64x.c +++ b/drivers/ata/pata_cmd64x.c | |||
| @@ -41,6 +41,9 @@ | |||
| 41 | enum { | 41 | enum { |
| 42 | CFR = 0x50, | 42 | CFR = 0x50, |
| 43 | CFR_INTR_CH0 = 0x04, | 43 | CFR_INTR_CH0 = 0x04, |
| 44 | CNTRL = 0x51, | ||
| 45 | CNTRL_CH0 = 0x04, | ||
| 46 | CNTRL_CH1 = 0x08, | ||
| 44 | CMDTIM = 0x52, | 47 | CMDTIM = 0x52, |
| 45 | ARTTIM0 = 0x53, | 48 | ARTTIM0 = 0x53, |
| 46 | DRWTIM0 = 0x54, | 49 | DRWTIM0 = 0x54, |
| @@ -328,9 +331,19 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 328 | .port_ops = &cmd648_port_ops | 331 | .port_ops = &cmd648_port_ops |
| 329 | } | 332 | } |
| 330 | }; | 333 | }; |
| 331 | const struct ata_port_info *ppi[] = { &cmd_info[id->driver_data], NULL }; | 334 | const struct ata_port_info *ppi[] = { |
| 332 | u8 mrdmode; | 335 | &cmd_info[id->driver_data], |
| 336 | &cmd_info[id->driver_data], | ||
| 337 | NULL | ||
| 338 | }; | ||
| 339 | u8 mrdmode, reg; | ||
| 333 | int rc; | 340 | int rc; |
| 341 | struct pci_dev *bridge = pdev->bus->self; | ||
| 342 | /* mobility split bridges don't report enabled ports correctly */ | ||
| 343 | int port_ok = !(bridge && bridge->vendor == | ||
| 344 | PCI_VENDOR_ID_MOBILITY_ELECTRONICS); | ||
| 345 | /* all (with exceptions below) apart from 643 have CNTRL_CH0 bit */ | ||
| 346 | int cntrl_ch0_ok = (id->driver_data != 0); | ||
| 334 | 347 | ||
| 335 | rc = pcim_enable_device(pdev); | 348 | rc = pcim_enable_device(pdev); |
| 336 | if (rc) | 349 | if (rc) |
| @@ -341,11 +354,18 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 341 | 354 | ||
| 342 | if (pdev->device == PCI_DEVICE_ID_CMD_646) { | 355 | if (pdev->device == PCI_DEVICE_ID_CMD_646) { |
| 343 | /* Does UDMA work ? */ | 356 | /* Does UDMA work ? */ |
| 344 | if (pdev->revision > 4) | 357 | if (pdev->revision > 4) { |
| 345 | ppi[0] = &cmd_info[2]; | 358 | ppi[0] = &cmd_info[2]; |
| 359 | ppi[1] = &cmd_info[2]; | ||
| 360 | } | ||
| 346 | /* Early rev with other problems ? */ | 361 | /* Early rev with other problems ? */ |
| 347 | else if (pdev->revision == 1) | 362 | else if (pdev->revision == 1) { |
| 348 | ppi[0] = &cmd_info[3]; | 363 | ppi[0] = &cmd_info[3]; |
| 364 | ppi[1] = &cmd_info[3]; | ||
| 365 | } | ||
| 366 | /* revs 1,2 have no CNTRL_CH0 */ | ||
| 367 | if (pdev->revision < 3) | ||
| 368 | cntrl_ch0_ok = 0; | ||
| 349 | } | 369 | } |
| 350 | 370 | ||
| 351 | pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 64); | 371 | pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 64); |
| @@ -354,6 +374,20 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 354 | mrdmode |= 0x02; /* Memory read line enable */ | 374 | mrdmode |= 0x02; /* Memory read line enable */ |
| 355 | pci_write_config_byte(pdev, MRDMODE, mrdmode); | 375 | pci_write_config_byte(pdev, MRDMODE, mrdmode); |
| 356 | 376 | ||
| 377 | /* check for enabled ports */ | ||
| 378 | pci_read_config_byte(pdev, CNTRL, ®); | ||
| 379 | if (!port_ok) | ||
| 380 | dev_printk(KERN_NOTICE, &pdev->dev, "Mobility Bridge detected, ignoring CNTRL port enable/disable\n"); | ||
| 381 | if (port_ok && cntrl_ch0_ok && !(reg & CNTRL_CH0)) { | ||
| 382 | dev_printk(KERN_NOTICE, &pdev->dev, "Primary port is disabled\n"); | ||
| 383 | ppi[0] = &ata_dummy_port_info; | ||
| 384 | |||
| 385 | } | ||
| 386 | if (port_ok && !(reg & CNTRL_CH1)) { | ||
| 387 | dev_printk(KERN_NOTICE, &pdev->dev, "Secondary port is disabled\n"); | ||
| 388 | ppi[1] = &ata_dummy_port_info; | ||
| 389 | } | ||
| 390 | |||
| 357 | /* Force PIO 0 here.. */ | 391 | /* Force PIO 0 here.. */ |
| 358 | 392 | ||
| 359 | /* PPC specific fixup copied from old driver */ | 393 | /* PPC specific fixup copied from old driver */ |
diff --git a/drivers/ata/pata_triflex.c b/drivers/ata/pata_triflex.c index 03b6d69d6197..b3e0c9432283 100644 --- a/drivers/ata/pata_triflex.c +++ b/drivers/ata/pata_triflex.c | |||
| @@ -210,13 +210,34 @@ static const struct pci_device_id triflex[] = { | |||
| 210 | { }, | 210 | { }, |
| 211 | }; | 211 | }; |
| 212 | 212 | ||
| 213 | #ifdef CONFIG_PM | ||
| 214 | static int triflex_ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg) | ||
| 215 | { | ||
| 216 | struct ata_host *host = dev_get_drvdata(&pdev->dev); | ||
| 217 | int rc = 0; | ||
| 218 | |||
| 219 | rc = ata_host_suspend(host, mesg); | ||
| 220 | if (rc) | ||
| 221 | return rc; | ||
| 222 | |||
| 223 | /* | ||
| 224 | * We must not disable or powerdown the device. | ||
| 225 | * APM bios refuses to suspend if IDE is not accessible. | ||
| 226 | */ | ||
| 227 | pci_save_state(pdev); | ||
| 228 | |||
| 229 | return 0; | ||
| 230 | } | ||
| 231 | |||
| 232 | #endif | ||
| 233 | |||
| 213 | static struct pci_driver triflex_pci_driver = { | 234 | static struct pci_driver triflex_pci_driver = { |
| 214 | .name = DRV_NAME, | 235 | .name = DRV_NAME, |
| 215 | .id_table = triflex, | 236 | .id_table = triflex, |
| 216 | .probe = triflex_init_one, | 237 | .probe = triflex_init_one, |
| 217 | .remove = ata_pci_remove_one, | 238 | .remove = ata_pci_remove_one, |
| 218 | #ifdef CONFIG_PM | 239 | #ifdef CONFIG_PM |
| 219 | .suspend = ata_pci_device_suspend, | 240 | .suspend = triflex_ata_pci_device_suspend, |
| 220 | .resume = ata_pci_device_resume, | 241 | .resume = ata_pci_device_resume, |
| 221 | #endif | 242 | #endif |
| 222 | }; | 243 | }; |
diff --git a/include/linux/libata.h b/include/linux/libata.h index 04f32a3eb26b..5a9926b34072 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
| @@ -1151,6 +1151,7 @@ extern void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset, | |||
| 1151 | ata_reset_fn_t softreset, ata_reset_fn_t hardreset, | 1151 | ata_reset_fn_t softreset, ata_reset_fn_t hardreset, |
| 1152 | ata_postreset_fn_t postreset); | 1152 | ata_postreset_fn_t postreset); |
| 1153 | extern void ata_std_error_handler(struct ata_port *ap); | 1153 | extern void ata_std_error_handler(struct ata_port *ap); |
| 1154 | extern int ata_link_nr_enabled(struct ata_link *link); | ||
| 1154 | 1155 | ||
| 1155 | /* | 1156 | /* |
| 1156 | * Base operations to inherit from and initializers for sht | 1157 | * Base operations to inherit from and initializers for sht |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 8abe8d78c4bf..8652a4fa3fe2 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
| @@ -608,6 +608,8 @@ | |||
| 608 | #define PCI_DEVICE_ID_MATROX_G550 0x2527 | 608 | #define PCI_DEVICE_ID_MATROX_G550 0x2527 |
| 609 | #define PCI_DEVICE_ID_MATROX_VIA 0x4536 | 609 | #define PCI_DEVICE_ID_MATROX_VIA 0x4536 |
| 610 | 610 | ||
| 611 | #define PCI_VENDOR_ID_MOBILITY_ELECTRONICS 0x14f2 | ||
| 612 | |||
| 611 | #define PCI_VENDOR_ID_CT 0x102c | 613 | #define PCI_VENDOR_ID_CT 0x102c |
| 612 | #define PCI_DEVICE_ID_CT_69000 0x00c0 | 614 | #define PCI_DEVICE_ID_CT_69000 0x00c0 |
| 613 | #define PCI_DEVICE_ID_CT_65545 0x00d8 | 615 | #define PCI_DEVICE_ID_CT_65545 0x00d8 |
