1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
drivers/ide/pci/aec62xx.c | 36 +++++++++++++++++++++++++++++++++---
drivers/ide/setup-pci.c | 9 ++++++++-
2 files changed, 41 insertions(+), 4 deletions(-)
--- linux-2.6.14.orig/drivers/ide/pci/aec62xx.c 2005-11-12 15:31:31.000000000 +0100
+++ linux-2.6.14/drivers/ide/pci/aec62xx.c 2005-11-12 15:32:57.000000000 +0100
@@ -143,7 +143,13 @@ static int aec6210_tune_chipset (ide_dri
u8 ultra = 0, ultra_conf = 0;
u8 tmp0 = 0, tmp1 = 0, tmp2 = 0;
unsigned long flags;
-
+#ifdef CONFIG_MACH_NAS100D
+ byte reg4ah;
+ pci_write_config_byte(hwif->pci_dev, PCI_LATENCY_TIMER, 0x90);
+ /* Enable burst mode & force 2 ports enable */
+ pci_read_config_byte(hwif->pci_dev, 0x4a, ®4ah);
+ pci_write_config_byte(hwif->pci_dev, 0x4a, reg4ah | 0x80);
+#endif
local_irq_save(flags);
/* 0x40|(2*drive->dn): Active, 0x41|(2*drive->dn): Recovery */
pci_read_config_word(dev, 0x40|(2*drive->dn), &d_conf);
@@ -263,7 +269,7 @@ static int aec62xx_irq_timeout (ide_driv
case PCI_DEVICE_ID_ARTOP_ATP865:
case PCI_DEVICE_ID_ARTOP_ATP865R:
printk(" AEC62XX time out ");
-#if 0
+#ifdef CONFIG_MACH_NAS100D
{
int i = 0;
u8 reg49h = 0;
@@ -277,7 +283,7 @@ static int aec62xx_irq_timeout (ide_driv
default:
break;
}
-#if 0
+#ifdef CONFIG_MACH_NAS100D
{
ide_hwif_t *hwif = HWIF(drive);
struct pci_dev *dev = hwif->pci_dev;
@@ -299,6 +305,13 @@ static unsigned int __devinit init_chips
{
int bus_speed = system_bus_clock();
+#ifdef CONFIG_MACH_NAS100D
+ /* enable both ports */
+ byte tmp;
+ pci_read_config_byte(dev, 0x4a, &tmp);
+ pci_write_config_byte(dev, 0x4a, tmp | 0x06);
+#endif
+
if (dev->resource[PCI_ROM_RESOURCE].start) {
pci_write_config_dword(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE);
printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name, dev->resource[PCI_ROM_RESOURCE].start);
@@ -312,11 +325,22 @@ static unsigned int __devinit init_chips
return dev->irq;
}
+#ifdef CONFIG_MACH_NAS100D
+void nas100d_outw(u16 addr, unsigned long port)
+{
+ outsw(port, &addr, 1);
+}
+#endif
+
static void __devinit init_hwif_aec62xx(ide_hwif_t *hwif)
{
hwif->autodma = 0;
hwif->tuneproc = &aec62xx_tune_drive;
hwif->speedproc = &aec62xx_tune_chipset;
+#ifdef CONFIG_MACH_NAS100D
+ printk(KERN_INFO "aec62xx: nas100d workaround\n");
+ hwif->OUTW = nas100d_outw;
+#endif
if (hwif->pci_dev->device == PCI_DEVICE_ID_ARTOP_ATP850UF) {
hwif->serialized = hwif->channel;
@@ -408,6 +432,9 @@ static ide_pci_device_t aec62xx_chipsets
.init_dma = init_dma_aec62xx,
.channels = 2,
.autodma = NOAUTODMA,
+#ifdef CONFIG_MACH_NAS100D
+ .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
+#endif
.bootable = OFF_BOARD,
},{ /* 2 */
.name = "AEC6260R",
@@ -427,6 +454,9 @@ static ide_pci_device_t aec62xx_chipsets
.init_dma = init_dma_aec62xx,
.channels = 2,
.autodma = AUTODMA,
+#ifdef CONFIG_MACH_NAS100D
+ .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}},
+#endif
.bootable = OFF_BOARD,
},{ /* 4 */
.name = "AEC6X80R",
--- linux-2.6.14.orig/drivers/ide/setup-pci.c 2005-11-12 14:33:27.000000000 +0100
+++ linux-2.6.14/drivers/ide/setup-pci.c 2005-11-12 15:32:57.000000000 +0100
@@ -602,10 +602,17 @@ void ide_pci_setup_ports(struct pci_dev
if ((d->flags & IDEPCI_FLAG_FORCE_PDC) &&
(secondpdc++==1) && (port==1))
goto controller_ok;
-
+
+#ifdef CONFIG_MACH_NAS100D
+// XXX ????
+ pci_read_config_byte(dev, e->reg, &tmp);
+ pci_write_config_byte(dev, e->reg, tmp & ~0x01);
+#endif
if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) ||
(tmp & e->mask) != e->val))
continue; /* port not enabled */
+
+
controller_ok:
if (d->channels <= port)
|