aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ide/ide-cd.c2
-rw-r--r--drivers/ide/ide-gd.c17
-rw-r--r--drivers/ide/palm_bk3710.c93
-rw-r--r--drivers/macintosh/mediabay.c1
4 files changed, 47 insertions, 66 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 3aec19d1fdfc..3d4e09969763 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -609,7 +609,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
609 struct request *rq = hwif->rq; 609 struct request *rq = hwif->rq;
610 ide_expiry_t *expiry = NULL; 610 ide_expiry_t *expiry = NULL;
611 int dma_error = 0, dma, thislen, uptodate = 0; 611 int dma_error = 0, dma, thislen, uptodate = 0;
612 int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc, nsectors; 612 int write = (rq_data_dir(rq) == WRITE) ? 1 : 0, rc = 0, nsectors;
613 int sense = blk_sense_request(rq); 613 int sense = blk_sense_request(rq);
614 unsigned int timeout; 614 unsigned int timeout;
615 u16 len; 615 u16 len;
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c
index 1aebdf1a4f58..4b6b71e2cdf5 100644
--- a/drivers/ide/ide-gd.c
+++ b/drivers/ide/ide-gd.c
@@ -7,6 +7,7 @@
7#include <linux/mutex.h> 7#include <linux/mutex.h>
8#include <linux/ide.h> 8#include <linux/ide.h>
9#include <linux/hdreg.h> 9#include <linux/hdreg.h>
10#include <linux/dmi.h>
10 11
11#if !defined(CONFIG_DEBUG_BLOCK_EXT_DEVT) 12#if !defined(CONFIG_DEBUG_BLOCK_EXT_DEVT)
12#define IDE_DISK_MINORS (1 << PARTN_BITS) 13#define IDE_DISK_MINORS (1 << PARTN_BITS)
@@ -99,6 +100,19 @@ static void ide_gd_resume(ide_drive_t *drive)
99 (void)drive->disk_ops->get_capacity(drive); 100 (void)drive->disk_ops->get_capacity(drive);
100} 101}
101 102
103static const struct dmi_system_id ide_coldreboot_table[] = {
104 {
105 /* Acer TravelMate 66x cuts power during reboot */
106 .ident = "Acer TravelMate 660",
107 .matches = {
108 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
109 DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 660"),
110 },
111 },
112
113 { } /* terminate list */
114};
115
102static void ide_gd_shutdown(ide_drive_t *drive) 116static void ide_gd_shutdown(ide_drive_t *drive)
103{ 117{
104#ifdef CONFIG_ALPHA 118#ifdef CONFIG_ALPHA
@@ -115,7 +129,8 @@ static void ide_gd_shutdown(ide_drive_t *drive)
115 the disk to expire its write cache. */ 129 the disk to expire its write cache. */
116 if (system_state != SYSTEM_POWER_OFF) { 130 if (system_state != SYSTEM_POWER_OFF) {
117#else 131#else
118 if (system_state == SYSTEM_RESTART) { 132 if (system_state == SYSTEM_RESTART &&
133 !dmi_check_system(ide_coldreboot_table)) {
119#endif 134#endif
120 drive->disk_ops->flush(drive); 135 drive->disk_ops->flush(drive);
121 return; 136 return;
diff --git a/drivers/ide/palm_bk3710.c b/drivers/ide/palm_bk3710.c
index c7acca0b8733..09d813d313f4 100644
--- a/drivers/ide/palm_bk3710.c
+++ b/drivers/ide/palm_bk3710.c
@@ -39,27 +39,12 @@
39/* Primary Control Offset */ 39/* Primary Control Offset */
40#define IDE_PALM_ATA_PRI_CTL_OFFSET 0x3F6 40#define IDE_PALM_ATA_PRI_CTL_OFFSET 0x3F6
41 41
42/*
43 * PalmChip 3710 IDE Controller UDMA timing structure Definition
44 */
45struct palm_bk3710_udmatiming {
46 unsigned int rptime; /* Ready to pause time */
47 unsigned int cycletime; /* Cycle Time */
48};
49
50#define BK3710_BMICP 0x00 42#define BK3710_BMICP 0x00
51#define BK3710_BMISP 0x02 43#define BK3710_BMISP 0x02
52#define BK3710_BMIDTP 0x04 44#define BK3710_BMIDTP 0x04
53#define BK3710_BMICS 0x08
54#define BK3710_BMISS 0x0A
55#define BK3710_BMIDTS 0x0C
56#define BK3710_IDETIMP 0x40 45#define BK3710_IDETIMP 0x40
57#define BK3710_IDETIMS 0x42
58#define BK3710_SIDETIM 0x44
59#define BK3710_SLEWCTL 0x45
60#define BK3710_IDESTATUS 0x47 46#define BK3710_IDESTATUS 0x47
61#define BK3710_UDMACTL 0x48 47#define BK3710_UDMACTL 0x48
62#define BK3710_UDMATIM 0x4A
63#define BK3710_MISCCTL 0x50 48#define BK3710_MISCCTL 0x50
64#define BK3710_REGSTB 0x54 49#define BK3710_REGSTB 0x54
65#define BK3710_REGRCVR 0x58 50#define BK3710_REGRCVR 0x58
@@ -71,17 +56,22 @@ struct palm_bk3710_udmatiming {
71#define BK3710_UDMATRP 0x70 56#define BK3710_UDMATRP 0x70
72#define BK3710_UDMAENV 0x74 57#define BK3710_UDMAENV 0x74
73#define BK3710_IORDYTMP 0x78 58#define BK3710_IORDYTMP 0x78
74#define BK3710_IORDYTMS 0x7C
75 59
76static unsigned ideclk_period; /* in nanoseconds */ 60static unsigned ideclk_period; /* in nanoseconds */
77 61
62struct palm_bk3710_udmatiming {
63 unsigned int rptime; /* tRP -- Ready to pause time (nsec) */
64 unsigned int cycletime; /* tCYCTYP2/2 -- avg Cycle Time (nsec) */
65 /* tENV is always a minimum of 20 nsec */
66};
67
78static const struct palm_bk3710_udmatiming palm_bk3710_udmatimings[6] = { 68static const struct palm_bk3710_udmatiming palm_bk3710_udmatimings[6] = {
79 {160, 240}, /* UDMA Mode 0 */ 69 { 160, 240 / 2 }, /* UDMA Mode 0 */
80 {125, 160}, /* UDMA Mode 1 */ 70 { 125, 160 / 2 }, /* UDMA Mode 1 */
81 {100, 120}, /* UDMA Mode 2 */ 71 { 100, 120 / 2 }, /* UDMA Mode 2 */
82 {100, 90}, /* UDMA Mode 3 */ 72 { 100, 90 / 2 }, /* UDMA Mode 3 */
83 {100, 60}, /* UDMA Mode 4 */ 73 { 100, 60 / 2 }, /* UDMA Mode 4 */
84 {85, 40}, /* UDMA Mode 5 */ 74 { 85, 40 / 2 }, /* UDMA Mode 5 */
85}; 75};
86 76
87static void palm_bk3710_setudmamode(void __iomem *base, unsigned int dev, 77static void palm_bk3710_setudmamode(void __iomem *base, unsigned int dev,
@@ -98,11 +88,6 @@ static void palm_bk3710_setudmamode(void __iomem *base, unsigned int dev,
98 trp = DIV_ROUND_UP(palm_bk3710_udmatimings[mode].rptime, 88 trp = DIV_ROUND_UP(palm_bk3710_udmatimings[mode].rptime,
99 ideclk_period) - 1; 89 ideclk_period) - 1;
100 90
101 /* udmatim Register */
102 val16 = readw(base + BK3710_UDMATIM) & (dev ? 0xFF0F : 0xFFF0);
103 val16 |= (mode << (dev ? 4 : 0));
104 writew(val16, base + BK3710_UDMATIM);
105
106 /* udmastb Ultra DMA Access Strobe Width */ 91 /* udmastb Ultra DMA Access Strobe Width */
107 val32 = readl(base + BK3710_UDMASTB) & (0xFF << (dev ? 0 : 8)); 92 val32 = readl(base + BK3710_UDMASTB) & (0xFF << (dev ? 0 : 8));
108 val32 |= (t0 << (dev ? 8 : 0)); 93 val32 |= (t0 << (dev ? 8 : 0));
@@ -163,10 +148,11 @@ static void palm_bk3710_setpiomode(void __iomem *base, ide_drive_t *mate,
163 u32 val32; 148 u32 val32;
164 struct ide_timing *t; 149 struct ide_timing *t;
165 150
151 t = ide_timing_find_mode(XFER_PIO_0 + mode);
152
166 /* PIO Data Setup */ 153 /* PIO Data Setup */
167 t0 = DIV_ROUND_UP(cycletime, ideclk_period); 154 t0 = DIV_ROUND_UP(cycletime, ideclk_period);
168 t2 = DIV_ROUND_UP(ide_timing_find_mode(XFER_PIO_0 + mode)->active, 155 t2 = DIV_ROUND_UP(t->active, ideclk_period);
169 ideclk_period);
170 156
171 t2i = t0 - t2 - 1; 157 t2i = t0 - t2 - 1;
172 t2 -= 1; 158 t2 -= 1;
@@ -187,7 +173,6 @@ static void palm_bk3710_setpiomode(void __iomem *base, ide_drive_t *mate,
187 } 173 }
188 174
189 /* TASKFILE Setup */ 175 /* TASKFILE Setup */
190 t = ide_timing_find_mode(XFER_PIO_0 + mode);
191 t0 = DIV_ROUND_UP(t->cyc8b, ideclk_period); 176 t0 = DIV_ROUND_UP(t->cyc8b, ideclk_period);
192 t2 = DIV_ROUND_UP(t->act8b, ideclk_period); 177 t2 = DIV_ROUND_UP(t->act8b, ideclk_period);
193 178
@@ -236,42 +221,23 @@ static void palm_bk3710_set_pio_mode(ide_drive_t *drive, u8 pio)
236static void __devinit palm_bk3710_chipinit(void __iomem *base) 221static void __devinit palm_bk3710_chipinit(void __iomem *base)
237{ 222{
238 /* 223 /*
239 * enable the reset_en of ATA controller so that when ata signals 224 * REVISIT: the ATA reset signal needs to be managed through a
240 * are brought out, by writing into device config. at that 225 * GPIO, which means it should come from platform_data. Until
241 * time por_n signal should not be 'Z' and have a stable value. 226 * we get and use such information, we have to trust that things
227 * have been reset before we get here.
242 */ 228 */
243 writel(0x0300, base + BK3710_MISCCTL);
244
245 /* wait for some time and deassert the reset of ATA Device. */
246 mdelay(100);
247
248 /* Deassert the Reset */
249 writel(0x0200, base + BK3710_MISCCTL);
250 229
251 /* 230 /*
252 * Program the IDETIMP Register Value based on the following assumptions 231 * Program the IDETIMP Register Value based on the following assumptions
253 * 232 *
254 * (ATA_IDETIMP_IDEEN , ENABLE ) | 233 * (ATA_IDETIMP_IDEEN , ENABLE ) |
255 * (ATA_IDETIMP_SLVTIMEN , DISABLE) |
256 * (ATA_IDETIMP_RDYSMPL , 70NS) |
257 * (ATA_IDETIMP_RDYRCVRY , 50NS) |
258 * (ATA_IDETIMP_DMAFTIM1 , PIOCOMP) |
259 * (ATA_IDETIMP_PREPOST1 , DISABLE) | 234 * (ATA_IDETIMP_PREPOST1 , DISABLE) |
260 * (ATA_IDETIMP_RDYSEN1 , DISABLE) |
261 * (ATA_IDETIMP_PIOFTIM1 , DISABLE) |
262 * (ATA_IDETIMP_DMAFTIM0 , PIOCOMP) |
263 * (ATA_IDETIMP_PREPOST0 , DISABLE) | 235 * (ATA_IDETIMP_PREPOST0 , DISABLE) |
264 * (ATA_IDETIMP_RDYSEN0 , DISABLE) | 236 *
265 * (ATA_IDETIMP_PIOFTIM0 , DISABLE) 237 * DM6446 silicon rev 2.1 and earlier have no observed net benefit
266 */ 238 * from enabling prefetch/postwrite.
267 writew(0xB388, base + BK3710_IDETIMP);
268
269 /*
270 * Configure SIDETIM Register
271 * (ATA_SIDETIM_RDYSMPS1 ,120NS ) |
272 * (ATA_SIDETIM_RDYRCYS1 ,120NS )
273 */ 239 */
274 writeb(0, base + BK3710_SIDETIM); 240 writew(BIT(15), base + BK3710_IDETIMP);
275 241
276 /* 242 /*
277 * UDMACTL Ultra-ATA DMA Control 243 * UDMACTL Ultra-ATA DMA Control
@@ -283,11 +249,11 @@ static void __devinit palm_bk3710_chipinit(void __iomem *base)
283 249
284 /* 250 /*
285 * MISCCTL Miscellaneous Conrol Register 251 * MISCCTL Miscellaneous Conrol Register
286 * (ATA_MISCCTL_RSTMODEP , 1) | 252 * (ATA_MISCCTL_HWNHLD1P , 1 cycle)
287 * (ATA_MISCCTL_RESETP , 0) | 253 * (ATA_MISCCTL_HWNHLD0P , 1 cycle)
288 * (ATA_MISCCTL_TIMORIDE , 1) 254 * (ATA_MISCCTL_TIMORIDE , 1)
289 */ 255 */
290 writel(0x201, base + BK3710_MISCCTL); 256 writel(0x001, base + BK3710_MISCCTL);
291 257
292 /* 258 /*
293 * IORDYTMP IORDY Timer for Primary Register 259 * IORDYTMP IORDY Timer for Primary Register
@@ -357,10 +323,9 @@ static int __init palm_bk3710_probe(struct platform_device *pdev)
357 323
358 clk_enable(clk); 324 clk_enable(clk);
359 rate = clk_get_rate(clk); 325 rate = clk_get_rate(clk);
360 ideclk_period = 1000000000UL / rate;
361 326
362 /* Register the IDE interface with Linux ATA Interface */ 327 /* NOTE: round *down* to meet minimum timings; we count in clocks */
363 memset(&hw, 0, sizeof(hw)); 328 ideclk_period = 1000000000UL / rate;
364 329
365 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 330 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
366 if (mem == NULL) { 331 if (mem == NULL) {
@@ -390,6 +355,7 @@ static int __init palm_bk3710_probe(struct platform_device *pdev)
390 /* Configure the Palm Chip controller */ 355 /* Configure the Palm Chip controller */
391 palm_bk3710_chipinit(base); 356 palm_bk3710_chipinit(base);
392 357
358 memset(&hw, 0, sizeof(hw));
393 for (i = 0; i < IDE_NR_PORTS - 2; i++) 359 for (i = 0; i < IDE_NR_PORTS - 2; i++)
394 hw.io_ports_array[i] = (unsigned long) 360 hw.io_ports_array[i] = (unsigned long)
395 (base + IDE_PALM_ATA_PRI_REG_OFFSET + i); 361 (base + IDE_PALM_ATA_PRI_REG_OFFSET + i);
@@ -402,6 +368,7 @@ static int __init palm_bk3710_probe(struct platform_device *pdev)
402 palm_bk3710_port_info.udma_mask = rate < 100000000 ? ATA_UDMA4 : 368 palm_bk3710_port_info.udma_mask = rate < 100000000 ? ATA_UDMA4 :
403 ATA_UDMA5; 369 ATA_UDMA5;
404 370
371 /* Register the IDE interface with Linux */
405 rc = ide_host_add(&palm_bk3710_port_info, hws, NULL); 372 rc = ide_host_add(&palm_bk3710_port_info, hws, NULL);
406 if (rc) 373 if (rc)
407 goto out; 374 goto out;
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c
index cf02188a90a6..029ad8ce8a7e 100644
--- a/drivers/macintosh/mediabay.c
+++ b/drivers/macintosh/mediabay.c
@@ -18,7 +18,6 @@
18#include <linux/timer.h> 18#include <linux/timer.h>
19#include <linux/stddef.h> 19#include <linux/stddef.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/ide.h>
22#include <linux/kthread.h> 21#include <linux/kthread.h>
23#include <linux/mutex.h> 22#include <linux/mutex.h>
24#include <asm/prom.h> 23#include <asm/prom.h>