Commit 26af05ea authored by Jens Axboe's avatar Jens Axboe

Update of the legcay ide controller drivers. mainly the IN_BYTE -> inb()

and preparation for truly modular low level drivers.
parent 0d1e8f1f
......@@ -39,6 +39,8 @@
#undef REALLY_SLOW_IO /* most systems can safely undef this */
#include <linux/module.h>
#include <linux/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/delay.h>
......@@ -52,14 +54,20 @@
#include <asm/io.h>
#include "ide_modes.h"
#ifdef CONFIG_BLK_DEV_ALI14XX_MODULE
# define _IDE_C
# include "ide_modes.h"
# undef _IDE_C
#else
# include "ide_modes.h"
#endif /* CONFIG_BLK_DEV_ALI14XX_MODULE */
/* port addresses for auto-detection */
#define ALI_NUM_PORTS 4
static int ports[ALI_NUM_PORTS] __initdata = {0x074, 0x0f4, 0x034, 0x0e4};
/* register initialization data */
typedef struct { byte reg, data; } RegInitializer;
typedef struct { u8 reg, data; } RegInitializer;
static RegInitializer initData[] __initdata = {
{0x01, 0x0f}, {0x02, 0x00}, {0x03, 0x00}, {0x04, 0x00},
......@@ -74,7 +82,7 @@ static RegInitializer initData[] __initdata = {
#define ALI_MAX_PIO 4
/* timing parameter registers for each drive */
static struct { byte reg1, reg2, reg3, reg4; } regTab[4] = {
static struct { u8 reg1, reg2, reg3, reg4; } regTab[4] = {
{0x03, 0x26, 0x04, 0x27}, /* drive 0 */
{0x05, 0x28, 0x06, 0x29}, /* drive 1 */
{0x2b, 0x30, 0x2c, 0x31}, /* drive 2 */
......@@ -84,24 +92,24 @@ static struct { byte reg1, reg2, reg3, reg4; } regTab[4] = {
static int basePort; /* base port address */
static int regPort; /* port for register number */
static int dataPort; /* port for register data */
static byte regOn; /* output to base port to access registers */
static byte regOff; /* output to base port to close registers */
static u8 regOn; /* output to base port to access registers */
static u8 regOff; /* output to base port to close registers */
/*------------------------------------------------------------------------*/
/*
* Read a controller register.
*/
static inline byte inReg (byte reg)
static inline u8 inReg (u8 reg)
{
outb_p(reg, regPort);
return IN_BYTE(dataPort);
return inb(dataPort);
}
/*
* Write a controller register.
*/
static void outReg (byte data, byte reg)
static void outReg (u8 data, u8 reg)
{
outb_p(reg, regPort);
outb_p(data, dataPort);
......@@ -112,11 +120,11 @@ static void outReg (byte data, byte reg)
* This function computes timing parameters
* and sets controller registers accordingly.
*/
static void ali14xx_tune_drive (ide_drive_t *drive, byte pio)
static void ali14xx_tune_drive (ide_drive_t *drive, u8 pio)
{
int driveNum;
int time1, time2;
byte param1, param2, param3, param4;
u8 param1, param2, param3, param4;
unsigned long flags;
ide_pio_data_t d;
int bus_speed = system_bus_clock();
......@@ -132,7 +140,7 @@ static void ali14xx_tune_drive (ide_drive_t *drive, byte pio)
param3 += 8;
param4 += 8;
}
printk("%s: PIO mode%d, t1=%dns, t2=%dns, cycles = %d+%d, %d+%d\n",
printk(KERN_DEBUG "%s: PIO mode%d, t1=%dns, t2=%dns, cycles = %d+%d, %d+%d\n",
drive->name, pio, time1, time2, param1, param2, param3, param4);
/* stuff timing parameters into controller registers */
......@@ -153,16 +161,16 @@ static void ali14xx_tune_drive (ide_drive_t *drive, byte pio)
static int __init findPort (void)
{
int i;
byte t;
u8 t;
unsigned long flags;
local_irq_save(flags);
for (i = 0; i < ALI_NUM_PORTS; ++i) {
basePort = ports[i];
regOff = IN_BYTE(basePort);
regOff = inb(basePort);
for (regOn = 0x30; regOn <= 0x33; ++regOn) {
outb_p(regOn, basePort);
if (IN_BYTE(basePort) == regOn) {
if (inb(basePort) == regOn) {
regPort = basePort + 4;
dataPort = basePort + 8;
t = inReg(0) & 0xf0;
......@@ -184,7 +192,7 @@ static int __init findPort (void)
*/
static int __init initRegisters (void) {
RegInitializer *p;
byte t;
u8 t;
unsigned long flags;
local_irq_save(flags);
......@@ -192,21 +200,21 @@ static int __init initRegisters (void) {
for (p = initData; p->reg != 0; ++p)
outReg(p->data, p->reg);
outb_p(0x01, regPort);
t = IN_BYTE(regPort) & 0x01;
t = inb(regPort) & 0x01;
outb_p(regOff, basePort);
local_irq_restore(flags);
return t;
}
void __init init_ali14xx (void)
int __init probe_ali14xx (void)
{
/* auto-detect IDE controller port */
if (!findPort()) {
printk("\nali14xx: not found");
return;
printk(KERN_ERR "ali14xx: not found.\n");
return 1;
}
printk("\nali14xx: base= 0x%03x, regOn = 0x%02x", basePort, regOn);
printk(KERN_DEBUG "ali14xx: base= 0x%03x, regOn = 0x%02x.\n", basePort, regOn);
ide_hwifs[0].chipset = ide_ali14xx;
ide_hwifs[1].chipset = ide_ali14xx;
ide_hwifs[0].tuneproc = &ali14xx_tune_drive;
......@@ -217,7 +225,80 @@ void __init init_ali14xx (void)
/* initialize controller registers */
if (!initRegisters()) {
printk("\nali14xx: Chip initialization failed");
printk(KERN_ERR "ali14xx: Chip initialization failed.\n");
return 1;
}
#ifndef HWIF_PROBE_CLASSIC_METHOD
probe_hwif_init(&ide_hwifs[0]);
probe_hwif_init(&ide_hwifs[1]);
#endif /* HWIF_PROBE_CLASSIC_METHOD */
return 0;
}
void __init ali14xx_release (void)
{
if (ide_hwifs[0].chipset != ide_ali14xx &&
ide_hwifs[1].chipset != ide_ali14xx)
return;
ide_hwifs[0].chipset = ide_unknown;
ide_hwifs[1].chipset = ide_unknown;
ide_hwifs[0].tuneproc = NULL;
ide_hwifs[1].tuneproc = NULL;
ide_hwifs[0].mate = NULL;
ide_hwifs[1].mate = NULL;
}
#ifndef MODULE
/*
* init_ali14xx:
*
* called by ide.c when parsing command line
*/
void __init init_ali14xx (void)
{
/* auto-detect IDE controller port */
if (findPort())
if (probe_ali14xx())
goto no_detect;
return;
no_detect:
printk(KERN_ERR "ali14xx: not found.\n");
ali14xx_release();
}
#else
MODULE_AUTHOR("see local file");
MODULE_DESCRIPTION("support of ALI 14XX IDE chipsets");
MODULE_LICENSE("GPL");
int __init ali14xx_mod_init(void)
{
/* auto-detect IDE controller port */
if (findPort())
if (probe_ali14xx()) {
ali14xx_release();
return -ENODEV;
}
if (ide_hwifs[0].chipset != ide_ali14xx &&
ide_hwifs[1].chipset != ide_ali14xx) {
ali14xx_release();
return -ENODEV;
}
return 0;
}
module_init(ali14xx_mod_init);
void __init ali14xx_mod_exit(void)
{
ali14xx_release();
}
module_exit(ali14xx_mod_exit);
#endif
......@@ -169,6 +169,10 @@ void __init buddha_init(void)
board = z->resource.start;
/*
* FIXME: we now have selectable mmio v/s iomio transports.
*/
if(type != BOARD_XSURF) {
if (!request_mem_region(board+BUDDHA_BASE1, 0x800, "IDE"))
continue;
......@@ -196,12 +200,16 @@ void __init buddha_init(void)
ide_setup_ports(&hw, (ide_ioreg_t)(buddha_board+buddha_bases[i]),
buddha_offsets, 0,
(ide_ioreg_t)(buddha_board+buddha_irqports[i]),
buddha_ack_intr, IRQ_AMIGA_PORTS);
buddha_ack_intr,
// budda_iops,
IRQ_AMIGA_PORTS);
} else {
ide_setup_ports(&hw, (ide_ioreg_t)(buddha_board+xsurf_bases[i]),
xsurf_offsets, 0,
(ide_ioreg_t)(buddha_board+xsurf_irqports[i]),
xsurf_ack_intr, IRQ_AMIGA_PORTS);
xsurf_ack_intr,
// xsurf_iops,
IRQ_AMIGA_PORTS);
}
index = ide_register_hw(&hw, NULL);
......
......@@ -6,6 +6,8 @@
#undef REALLY_SLOW_IO /* most systems can safely undef this */
#include <linux/module.h>
#include <linux/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/delay.h>
......@@ -19,7 +21,13 @@
#include <asm/io.h>
#include "ide_modes.h"
#ifdef CONFIG_BLK_DEV_DTC2278_MODULE
# define _IDE_C
# include "ide_modes.h"
# undef _IDE_C
#else
# include "ide_modes.h"
#endif /* CONFIG_BLK_DEV_DTC2278_MODULE */
/*
* Changing this #undef to #define may solve start up problems in some systems.
......@@ -57,20 +65,20 @@ static void sub22 (char b, char c)
int i;
for(i = 0; i < 3; ++i) {
IN_BYTE(0x3f6);
inb(0x3f6);
outb_p(b,0xb0);
IN_BYTE(0x3f6);
inb(0x3f6);
outb_p(c,0xb4);
IN_BYTE(0x3f6);
if(IN_BYTE(0xb4) == c) {
inb(0x3f6);
if(inb(0xb4) == c) {
outb_p(7,0xb0);
IN_BYTE(0x3f6);
inb(0x3f6);
return; /* success */
}
}
}
static void tune_dtc2278 (ide_drive_t *drive, byte pio)
static void tune_dtc2278 (ide_drive_t *drive, u8 pio)
{
unsigned long flags;
......@@ -95,7 +103,7 @@ static void tune_dtc2278 (ide_drive_t *drive, byte pio)
HWIF(drive)->drives[!drive->select.b.unit].io_32bit = 1;
}
void __init init_dtc2278 (void)
void __init probe_dtc2278 (void)
{
unsigned long flags;
......@@ -104,9 +112,9 @@ void __init init_dtc2278 (void)
* This enables the second interface
*/
outb_p(4,0xb0);
IN_BYTE(0x3f6);
inb(0x3f6);
outb_p(0x20,0xb4);
IN_BYTE(0x3f6);
inb(0x3f6);
#ifdef ALWAYS_SET_DTC2278_PIO_MODE
/*
* This enables PIO mode4 (3?) on the first interface
......@@ -129,4 +137,67 @@ void __init init_dtc2278 (void)
ide_hwifs[0].mate = &ide_hwifs[1];
ide_hwifs[1].mate = &ide_hwifs[0];
ide_hwifs[1].channel = 1;
#ifndef HWIF_PROBE_CLASSIC_METHOD
probe_hwif_init(&ide_hwifs[0]);
probe_hwif_init(&ide_hwifs[1]);
#endif /* HWIF_PROBE_CLASSIC_METHOD */
}
void __init dtc2278_release (void)
{
if (ide_hwifs[0].chipset != ide_dtc2278 &&
ide_hwifs[1].chipset != ide_dtc2278)
return;
ide_hwifs[0].serialized = 0;
ide_hwifs[1].serialized = 0;
ide_hwifs[0].chipset = ide_unknown;
ide_hwifs[1].chipset = ide_unknown;
ide_hwifs[0].tuneproc = NULL;
ide_hwifs[0].drives[0].no_unmask = 0;
ide_hwifs[0].drives[1].no_unmask = 0;
ide_hwifs[1].drives[0].no_unmask = 0;
ide_hwifs[1].drives[1].no_unmask = 0;
ide_hwifs[0].mate = NULL;
ide_hwifs[1].mate = NULL;
}
#ifndef MODULE
/*
* init_dtc2278:
*
* called by ide.c when parsing command line
*/
void __init init_dtc2278 (void)
{
probe_dtc2278();
}
#else
MODULE_AUTHOR("See Local File");
MODULE_DESCRIPTION("support of DTC-2278 VLB IDE chipsets");
MODULE_LICENSE("GPL");
int __init dtc2278_mod_init(void)
{
probe_dtc2278();
if (ide_hwifs[0].chipset != ide_dtc2278 &&
ide_hwifs[1].chipset != ide_dtc2278) {
dtc2278_release();
return -ENODEV;
}
return 0;
}
module_init(dtc2278_mod_init);
void __init dtc2278_mod_exit(void)
{
dtc2278_release();
}
module_exit(dtc2278_mod_exit);
#endif
......@@ -59,7 +59,9 @@ void __init falconide_init(void)
int index;
ide_setup_ports(&hw, (ide_ioreg_t)ATA_HD_BASE, falconide_offsets,
0, 0, NULL, IRQ_MFP_IDE);
0, 0, NULL,
// falconide_iops,
IRQ_MFP_IDE);
index = ide_register_hw(&hw, NULL);
if (index != -1)
......
......@@ -137,6 +137,10 @@ void __init gayle_init(void)
irqport = (ide_ioreg_t)ZTWO_VADDR(GAYLE_IRQ_1200);
ack_intr = gayle_ack_intr_a1200;
}
/*
* FIXME: we now have selectable modes between mmio v/s iomio
*/
phys_base += i*GAYLE_NEXT_PORT;
res_start = ((unsigned long)phys_base) & ~(GAYLE_NEXT_PORT-1);
......@@ -149,7 +153,9 @@ void __init gayle_init(void)
ctrlport = GAYLE_HAS_CONTROL_REG ? (base + GAYLE_CONTROL) : 0;
ide_setup_ports(&hw, base, gayle_offsets,
ctrlport, irqport, ack_intr, IRQ_AMIGA_PORTS);
ctrlport, irqport, ack_intr,
// gaule_iops,
IRQ_AMIGA_PORTS);
index = ide_register_hw(&hw, NULL);
if (index != -1) {
......
......@@ -50,13 +50,6 @@
#define DEVICE_NR(device) (minor(device)>>6)
#include <linux/blk.h>
/* ATA commands we use.
*/
#define WIN_SPECIFY 0x91 /* set drive geometry translation */
#define WIN_RESTORE 0x10
#define WIN_READ 0x20 /* 28-Bit */
#define WIN_WRITE 0x30 /* 28-Bit */
#define HD_IRQ 14 /* the standard disk interrupt */
#ifdef __arm__
......
......@@ -38,6 +38,8 @@
#undef REALLY_SLOW_IO /* most systems can safely undef this */
#include <linux/module.h>
#include <linux/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/delay.h>
......@@ -51,7 +53,13 @@
#include <asm/io.h>
#include "ide_modes.h"
#ifdef CONFIG_BLK_DEV_HT6560B_MODULE
# define _IDE_C
# include "ide_modes.h"
# undef _IDE_C
#else
# include "ide_modes.h"
#endif /* CONFIG_BLK_DEV_HT6560B_MODULE */
/* #define DEBUG */ /* remove comments for DEBUG messages */
......@@ -68,7 +76,7 @@
* bit3 (0x08): "1" 3 cycle time, "0" 2 cycle time (?)
*/
#define HT_CONFIG_PORT 0x3e6
#define HT_CONFIG(drivea) (byte)(((drivea)->drive_data & 0xff00) >> 8)
#define HT_CONFIG(drivea) (u8)(((drivea)->drive_data & 0xff00) >> 8)
/*
* FIFO + PREFETCH (both a/b-model)
*/
......@@ -114,7 +122,7 @@
* Active Time for each drive. Smaller value gives higher speed.
* In case of failures you should probably fall back to a higher value.
*/
#define HT_TIMING(drivea) (byte)((drivea)->drive_data & 0x00ff)
#define HT_TIMING(drivea) (u8)((drivea)->drive_data & 0x00ff)
#define HT_TIMING_DEFAULT 0xff
/*
......@@ -130,9 +138,9 @@
static void ht6560b_selectproc (ide_drive_t *drive)
{
unsigned long flags;
static byte current_select = 0;
static byte current_timing = 0;
byte select, timing;
static u8 current_select = 0;
static u8 current_timing = 0;
u8 select, timing;
local_irq_save(flags);
......@@ -144,16 +152,16 @@ static void ht6560b_selectproc (ide_drive_t *drive)
current_timing = timing;
if (drive->media != ide_disk || !drive->present)
select |= HT_PREFETCH_MODE;
(void) IN_BYTE(HT_CONFIG_PORT);
(void) IN_BYTE(HT_CONFIG_PORT);
(void) IN_BYTE(HT_CONFIG_PORT);
(void) IN_BYTE(HT_CONFIG_PORT);
OUT_BYTE(select, HT_CONFIG_PORT);
(void) HWIF(drive)->INB(HT_CONFIG_PORT);
(void) HWIF(drive)->INB(HT_CONFIG_PORT);
(void) HWIF(drive)->INB(HT_CONFIG_PORT);
(void) HWIF(drive)->INB(HT_CONFIG_PORT);
HWIF(drive)->OUTB(select, HT_CONFIG_PORT);
/*
* Set timing for this drive:
*/
OUT_BYTE(timing, IDE_SELECT_REG);
(void) IN_BYTE(IDE_STATUS_REG);
HWIF(drive)->OUTB(timing, IDE_SELECT_REG);
(void) HWIF(drive)->INB(IDE_STATUS_REG);
#ifdef DEBUG
printk("ht6560b: %s: select=%#x timing=%#x\n",
drive->name, select, timing);
......@@ -167,31 +175,31 @@ static void ht6560b_selectproc (ide_drive_t *drive)
*/
static int __init try_to_init_ht6560b(void)
{
byte orig_value;
u8 orig_value;
int i;
/* Autodetect ht6560b */
if ((orig_value = IN_BYTE(HT_CONFIG_PORT)) == 0xff)
if ((orig_value = inb(HT_CONFIG_PORT)) == 0xff)
return 0;
for (i=3;i>0;i--) {
OUT_BYTE(0x00, HT_CONFIG_PORT);
if (!( (~IN_BYTE(HT_CONFIG_PORT)) & 0x3f )) {
OUT_BYTE(orig_value, HT_CONFIG_PORT);
outb(0x00, HT_CONFIG_PORT);
if (!( (~inb(HT_CONFIG_PORT)) & 0x3f )) {
outb(orig_value, HT_CONFIG_PORT);
return 0;
}
}
OUT_BYTE(0x00, HT_CONFIG_PORT);
if ((~IN_BYTE(HT_CONFIG_PORT))& 0x3f) {
OUT_BYTE(orig_value, HT_CONFIG_PORT);
outb(0x00, HT_CONFIG_PORT);
if ((~inb(HT_CONFIG_PORT))& 0x3f) {
outb(orig_value, HT_CONFIG_PORT);
return 0;
}
/*
* Ht6560b autodetected
*/
OUT_BYTE(HT_CONFIG_DEFAULT, HT_CONFIG_PORT);
OUT_BYTE(HT_TIMING_DEFAULT, 0x1f6); /* IDE_SELECT_REG */
(void) IN_BYTE(0x1f7); /* IDE_STATUS_REG */
outb(HT_CONFIG_DEFAULT, HT_CONFIG_PORT);
outb(HT_TIMING_DEFAULT, 0x1f6); /* IDE_SELECT_REG */
(void) inb(0x1f7); /* IDE_STATUS_REG */
printk("\nht6560b " HT6560B_VERSION
": chipset detected and initialized"
......@@ -202,7 +210,7 @@ static int __init try_to_init_ht6560b(void)
return 1;
}
static byte ht_pio2timings(ide_drive_t *drive, byte pio)
static u8 ht_pio2timings(ide_drive_t *drive, u8 pio)
{
int active_time, recovery_time;
int active_cycles, recovery_cycles;
......@@ -238,7 +246,7 @@ static byte ht_pio2timings(ide_drive_t *drive, byte pio)
printk("ht6560b: drive %s setting pio=%d recovery=%d (%dns) active=%d (%dns)\n", drive->name, pio, recovery_cycles, recovery_time, active_cycles, active_time);
#endif
return (byte)((recovery_cycles << 4) | active_cycles);
return (u8)((recovery_cycles << 4) | active_cycles);
} else {
#ifdef DEBUG
......@@ -252,7 +260,7 @@ static byte ht_pio2timings(ide_drive_t *drive, byte pio)
/*
* Enable/Disable so called prefetch mode
*/
static void ht_set_prefetch(ide_drive_t *drive, byte state)
static void ht_set_prefetch(ide_drive_t *drive, u8 state)
{
unsigned long flags;
int t = HT_PREFETCH_MODE << 8;
......@@ -278,10 +286,10 @@ static void ht_set_prefetch(ide_drive_t *drive, byte state)
#endif
}
static void tune_ht6560b (ide_drive_t *drive, byte pio)
static void tune_ht6560b (ide_drive_t *drive, u8 pio)
{
unsigned long flags;
byte timing;
u8 timing;
switch (pio) {
case 8: /* set prefetch off */
......@@ -304,14 +312,10 @@ static void tune_ht6560b (ide_drive_t *drive, byte pio)
#endif
}
void __init init_ht6560b (void)
void __init probe_ht6560b (void)
{
int t;
if (check_region(HT_CONFIG_PORT,1)) {
printk(KERN_ERR "ht6560b: PORT %#x ALREADY IN USE\n", HT_CONFIG_PORT);
} else {
if (try_to_init_ht6560b()) {
request_region(HT_CONFIG_PORT, 1, ide_hwifs[0].name);
ide_hwifs[0].chipset = ide_ht6560b;
ide_hwifs[1].chipset = ide_ht6560b;
......@@ -335,7 +339,92 @@ void __init init_ht6560b (void)
t |= (HT_SECONDARY_IF << 8);
ide_hwifs[1].drives[0].drive_data = t;
ide_hwifs[1].drives[1].drive_data = t;
} else
printk(KERN_ERR "ht6560b: not found\n");
#ifndef HWIF_PROBE_CLASSIC_METHOD
probe_hwif_init(&ide_hwifs[0]);
probe_hwif_init(&ide_hwifs[1]);
#endif /* HWIF_PROBE_CLASSIC_METHOD */
}
void __init ht6560b_release (void)
{
if (ide_hwifs[0].chipset != ide_ht6560b &&
ide_hwifs[1].chipset != ide_ht6560b)
return;
ide_hwifs[0].chipset = ide_unknown;
ide_hwifs[1].chipset = ide_unknown;
ide_hwifs[0].tuneproc = NULL;
ide_hwifs[1].tuneproc = NULL;
ide_hwifs[0].selectproc = NULL;
ide_hwifs[1].selectproc = NULL;
ide_hwifs[0].serialized = 0;
ide_hwifs[1].serialized = 0;
ide_hwifs[0].mate = NULL;
ide_hwifs[1].mate = NULL;
ide_hwifs[0].drives[0].drive_data = 0;
ide_hwifs[0].drives[1].drive_data = 0;
ide_hwifs[1].drives[0].drive_data = 0;
ide_hwifs[1].drives[1].drive_data = 0;
release_region(HT_CONFIG_PORT, 1);
}
#ifndef MODULE
/*
* init_ht6560b:
*
* called by ide.c when parsing command line
*/
void __init init_ht6560b (void)
{
if (check_region(HT_CONFIG_PORT,1)) {
printk(KERN_NOTICE "%s: HT_CONFIG_PORT not found\n",
__FUNCTION__);
return;
}
if (!try_to_init_ht6560b()) {
printk(KERN_NOTICE "%s: HBA not found\n", __FUNCTION__);
return;
}
probe_ht6560b();
}
#else
MODULE_AUTHOR("See Local File");
MODULE_DESCRIPTION("HT-6560B EIDE-controller support");
MODULE_LICENSE("GPL");
int __init ht6560b_mod_init(void)
{
if (check_region(HT_CONFIG_PORT,1)) {
printk(KERN_NOTICE "%s: HT_CONFIG_PORT not found\n",
__FUNCTION__);
return -ENODEV;
}
if (!try_to_init_ht6560b()) {
printk(KERN_NOTICE "%s: HBA not found\n", __FUNCTION__);
return -ENODEV;
}
probe_ht6560b();
if (ide_hwifs[0].chipset != ide_ht6560b &&
ide_hwifs[1].chipset != ide_ht6560b) {
ht6560b_release();
return -ENODEV;
}
return 0;
}
module_init(ht6560b_mod_init);
void __init ht6560b_mod_exit(void)
{
ht6560b_release();
}
module_exit(ht6560b_mod_exit);
#endif
......@@ -340,12 +340,12 @@ void ide_config(dev_link_t *link)
/* retry registration in case device is still spinning up */
for (i = 0; i < 10; i++) {
if (ctl_base)
OUT_BYTE(0x02, ctl_base); /* Set nIEN = disable device interrupts */
outb(0x02, ctl_base); /* Set nIEN = disable device interrupts */
hd = idecs_register(io_base, ctl_base, link->irq.AssignedIRQ);
if (hd >= 0) break;
if (link->io.NumPorts1 == 0x20) {
if (ctl_base)
OUT_BYTE(0x02, ctl_base+0x10);
outb(0x02, ctl_base+0x10);
hd = idecs_register(io_base+0x10, ctl_base+0x10,
link->irq.AssignedIRQ);
if (hd >= 0) {
......
......@@ -83,7 +83,7 @@ static void macide_mediabay_interrupt(int irq, void *dev_id, struct pt_regs *reg
{
int state = baboon->mb_status & 0x04;
printk("macide: media bay %s detected\n", state? "removal":"insertion");
printk(KERN_INFO "macide: media bay %s detected\n", state? "removal":"insertion");
}
#endif
......@@ -99,24 +99,30 @@ void macide_init(void)
switch (macintosh_config->ide_type) {
case MAC_IDE_QUADRA:
ide_setup_ports(&hw, (ide_ioreg_t)IDE_BASE, macide_offsets,
0, 0, macide_ack_intr, IRQ_NUBUS_F);
0, 0, macide_ack_intr,
// quadra_ide_iops,
IRQ_NUBUS_F);
index = ide_register_hw(&hw, NULL);
break;
case MAC_IDE_PB:
ide_setup_ports(&hw, (ide_ioreg_t)IDE_BASE, macide_offsets,
0, 0, macide_ack_intr, IRQ_NUBUS_C);
0, 0, macide_ack_intr,
// macide_pb_iops,
IRQ_NUBUS_C);
index = ide_register_hw(&hw, NULL);
break;
case MAC_IDE_BABOON:
ide_setup_ports(&hw, (ide_ioreg_t)BABOON_BASE, macide_offsets,
0, 0, NULL, IRQ_BABOON_1);
0, 0, NULL,
// macide_baboon_iops,
IRQ_BABOON_1);
index = ide_register_hw(&hw, NULL);
if (index == -1) break;
if (macintosh_config->ident == MAC_MODEL_PB190) {
/* Fix breakage in ide-disk.c: drive capacity */
/* is not initialized for drives without a */
/* hardware ID, and we cna't get that without */
/* hardware ID, and we can't get that without */
/* probing the drive which freezes a 190. */
ide_drive_t *drive = &ide_hwifs[index].drives[0];
......@@ -136,12 +142,12 @@ void macide_init(void)
if (index != -1) {
if (macintosh_config->ide_type == MAC_IDE_QUADRA)
printk("ide%d: Macintosh Quadra IDE interface\n", index);
printk(KERN_INFO "ide%d: Macintosh Quadra IDE interface\n", index);
else if (macintosh_config->ide_type == MAC_IDE_PB)
printk("ide%d: Macintosh Powerbook IDE interface\n", index);
printk(KERN_INFO "ide%d: Macintosh Powerbook IDE interface\n", index);
else if (macintosh_config->ide_type == MAC_IDE_BABOON)
printk("ide%d: Macintosh Powerbook Baboon IDE interface\n", index);
printk(KERN_INFO "ide%d: Macintosh Powerbook Baboon IDE interface\n", index);
else
printk("ide%d: Unknown Macintosh IDE interface\n", index);
printk(KERN_INFO "ide%d: Unknown Macintosh IDE interface\n", index);
}
}
This diff is collapsed.
......@@ -84,7 +84,9 @@ void q40ide_init(void)
ide_setup_ports(&hw,(ide_ioreg_t) pcide_bases[i], (int *)pcide_offsets,
pcide_bases[i]+0x206,
0, NULL, q40ide_default_irq(pcide_bases[i]));
0, NULL,
// pcide_iops,
q40ide_default_irq(pcide_bases[i]));
ide_register_hw(&hw, NULL);
}
}
......
This diff is collapsed.
......@@ -39,6 +39,8 @@
*/
#define REALLY_SLOW_IO /* some systems can safely undef this */
#include <linux/module.h>
#include <linux/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/delay.h>
......@@ -52,7 +54,13 @@
#include <asm/io.h>
#include "ide_modes.h"
#ifdef CONFIG_BLK_DEV_UMC8672_MODULE
# define _IDE_C
# include "ide_modes.h"
# undef _IDE_C
#else
# include "ide_modes.h"
#endif /* CONFIG_BLK_DEV_UMC8672_MODULE */
/*
* Default speeds. These can be changed with "auto-tune" and/or hdparm.
......@@ -62,11 +70,11 @@
#define UMC_DRIVE2 1 /* 11 = Fastest Speed */
#define UMC_DRIVE3 1 /* In case of crash reduce speed */
static byte current_speeds[4] = {UMC_DRIVE0, UMC_DRIVE1, UMC_DRIVE2, UMC_DRIVE3};
static const byte pio_to_umc [5] = {0,3,7,10,11}; /* rough guesses */
static u8 current_speeds[4] = {UMC_DRIVE0, UMC_DRIVE1, UMC_DRIVE2, UMC_DRIVE3};
static const u8 pio_to_umc [5] = {0,3,7,10,11}; /* rough guesses */
/* 0 1 2 3 4 5 6 7 8 9 10 11 */
static const byte speedtab [3][12] = {
static const u8 speedtab [3][12] = {
{0xf, 0xb, 0x2, 0x2, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1 },
{0x3, 0x2, 0x2, 0x2, 0x2, 0x2, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1 },
{0xff,0xcb,0xc0,0x58,0x36,0x33,0x23,0x22,0x21,0x11,0x10,0x0}};
......@@ -77,13 +85,13 @@ static void out_umc (char port,char wert)
outb_p(wert,0x109);
}
static inline byte in_umc (char port)
static inline u8 in_umc (char port)
{
outb_p(port,0x108);
return inb_p(0x109);
}
static void umc_set_speeds (byte speeds[])
static void umc_set_speeds (u8 speeds[])
{
int i, tmp;
......@@ -106,7 +114,7 @@ static void umc_set_speeds (byte speeds[])
speeds[0], speeds[1], speeds[2], speeds[3]);
}
static void tune_umc (ide_drive_t *drive, byte pio)
static void tune_umc (ide_drive_t *drive, u8 pio)
{
unsigned long flags;
ide_hwgroup_t *hwgroup = ide_hwifs[HWIF(drive)->index^1].hwgroup;
......@@ -116,7 +124,7 @@ static void tune_umc (ide_drive_t *drive, byte pio)
drive->name, pio, pio_to_umc[pio]);
spin_lock_irqsave(&ide_lock, flags);
if (hwgroup && hwgroup->handler != NULL) {
printk("umc8672: other interface is busy: exiting tune_umc()\n");
printk(KERN_ERR "umc8672: other interface is busy: exiting tune_umc()\n");
} else {
current_speeds[drive->name[2] - 'a'] = pio_to_umc[pio];
umc_set_speeds (current_speeds);
......@@ -124,21 +132,21 @@ static void tune_umc (ide_drive_t *drive, byte pio)
spin_unlock_irqrestore(&ide_lock, flags);
}
void __init init_umc8672 (void) /* called from ide.c */
int __init probe_umc8672 (void)
{
unsigned long flags;
local_irq_save(flags);
if (check_region(0x108, 2)) {
local_irq_restore(flags);
printk("\numc8672: PORTS 0x108-0x109 ALREADY IN USE\n");
return;
printk(KERN_ERR "umc8672: ports 0x108-0x109 already in use.\n");
return 1;
}
outb_p(0x5A,0x108); /* enable umc */
if (in_umc (0xd5) != 0xa0) {
local_irq_restore(flags);
printk ("umc8672: not found\n");
return;
printk(KERN_ERR "umc8672: not found\n");
return 1;
}
outb_p(0xa5,0x108); /* disable umc */
......@@ -153,4 +161,77 @@ void __init init_umc8672 (void) /* called from ide.c */
ide_hwifs[0].mate = &ide_hwifs[1];
ide_hwifs[1].mate = &ide_hwifs[0];
ide_hwifs[1].channel = 1;
#ifndef HWIF_PROBE_CLASSIC_METHOD
probe_hwif_init(&ide_hwifs[0]);
probe_hwif_init(&ide_hwifs[1]);
#endif /* HWIF_PROBE_CLASSIC_METHOD */
return 0;
}
void __init umc8672_release (void)
{
unsigned long flags;
local_irq_save(flags);
if (ide_hwifs[0].chipset != ide_umc8672 &&
ide_hwifs[1].chipset != ide_umc8672) {
local_irq_restore(flags);
return;
}
ide_hwifs[0].chipset = ide_unknown;
ide_hwifs[1].chipset = ide_unknown;
ide_hwifs[0].tuneproc = NULL;
ide_hwifs[1].tuneproc = NULL;
ide_hwifs[0].mate = NULL;
ide_hwifs[1].mate = NULL;
ide_hwifs[0].channel = 0;
ide_hwifs[1].channel = 0;
outb_p(0xa5,0x108); /* disable umc */
release_region(0x108, 2);
local_irq_restore(flags);
}
#ifndef MODULE
/*
* init_umc8672:
*
* called by ide.c when parsing command line
*/
void __init init_umc8672 (void)
{
if (probe_umc8672())
printk(KERN_ERR "init_umc8672: umc8672 controller not found.\n");
}
#else
MODULE_AUTHOR("Wolfram Podien");
MODULE_DESCRIPTION("Support for UMC 8672 IDE chipset");
MODULE_LICENSE("GPL");
int __init umc8672_mod_init(void)
{
if (probe_umc8672())
return -ENODEV;
if (ide_hwifs[0].chipset != ide_umc8672 &&
ide_hwifs[1].chipset != ide_umc8672) {
umc8672_release();
return -ENODEV;
}
return 0;
}
module_init(umc8672_mod_init);
void __init umc8672_mod_exit(void)
{
umc8672_release();
}
module_exit(umc8672_mod_exit);
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment