-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Morten H. Larsen
authored and
Matt Turner
committed
Jun 15, 2010
1 parent
285587b
commit a49182f
Showing
6 changed files
with
156 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 5efa16ff77cb785647a480dcdc70a6b4fc787996 | ||
refs/heads/master: 932e0c201d28a728e25d3b641aa95bd28ceb08b4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
#include <linux/ioport.h> | ||
#include <asm/io.h> | ||
|
||
#include "pc873xx.h" | ||
|
||
static unsigned pc873xx_probelist[] = {0x398, 0x26e, 0}; | ||
|
||
static char *pc873xx_names[] = { | ||
"PC87303", "PC87306", "PC87312", "PC87332", "PC87334" | ||
}; | ||
|
||
static unsigned int base, model; | ||
|
||
|
||
unsigned int __init pc873xx_get_base() | ||
{ | ||
return base; | ||
} | ||
|
||
char *__init pc873xx_get_model() | ||
{ | ||
return pc873xx_names[model]; | ||
} | ||
|
||
static unsigned char __init pc873xx_read(unsigned int base, int reg) | ||
{ | ||
outb(reg, base); | ||
return inb(base + 1); | ||
} | ||
|
||
static void __init pc873xx_write(unsigned int base, int reg, unsigned char data) | ||
{ | ||
unsigned long flags; | ||
|
||
local_irq_save(flags); | ||
outb(reg, base); | ||
outb(data, base + 1); | ||
outb(data, base + 1); /* Must be written twice */ | ||
local_irq_restore(flags); | ||
} | ||
|
||
int __init pc873xx_probe(void) | ||
{ | ||
int val, index = 0; | ||
|
||
while ((base = pc873xx_probelist[index++])) { | ||
|
||
if (request_region(base, 2, "Super IO PC873xx") == NULL) | ||
continue; | ||
|
||
val = pc873xx_read(base, REG_SID); | ||
if ((val & 0xf0) == 0x10) { | ||
model = PC87332; | ||
break; | ||
} else if ((val & 0xf8) == 0x70) { | ||
model = PC87306; | ||
break; | ||
} else if ((val & 0xf8) == 0x50) { | ||
model = PC87334; | ||
break; | ||
} else if ((val & 0xf8) == 0x40) { | ||
model = PC87303; | ||
break; | ||
} | ||
|
||
release_region(base, 2); | ||
} | ||
|
||
return (base == 0) ? -1 : 1; | ||
} | ||
|
||
void __init pc873xx_enable_epp19(void) | ||
{ | ||
unsigned char data; | ||
|
||
printk(KERN_INFO "PC873xx enabling EPP v1.9\n"); | ||
data = pc873xx_read(base, REG_PCR); | ||
pc873xx_write(base, REG_PCR, (data & 0xFC) | 0x02); | ||
} | ||
|
||
void __init pc873xx_enable_ide(void) | ||
{ | ||
unsigned char data; | ||
|
||
printk(KERN_INFO "PC873xx enabling IDE interrupt\n"); | ||
data = pc873xx_read(base, REG_FER); | ||
pc873xx_write(base, REG_FER, data | 0x40); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
|
||
#ifndef _PC873xx_H_ | ||
#define _PC873xx_H_ | ||
|
||
/* | ||
* Control Register Values | ||
*/ | ||
#define REG_FER 0x00 | ||
#define REG_FAR 0x01 | ||
#define REG_PTR 0x02 | ||
#define REG_FCR 0x03 | ||
#define REG_PCR 0x04 | ||
#define REG_KRR 0x05 | ||
#define REG_PMC 0x06 | ||
#define REG_TUP 0x07 | ||
#define REG_SID 0x08 | ||
#define REG_ASC 0x09 | ||
#define REG_IRC 0x0e | ||
|
||
/* | ||
* Model numbers | ||
*/ | ||
#define PC87303 0 | ||
#define PC87306 1 | ||
#define PC87312 2 | ||
#define PC87332 3 | ||
#define PC87334 4 | ||
|
||
int pc873xx_probe(void); | ||
unsigned int pc873xx_get_base(void); | ||
char *pc873xx_get_model(void); | ||
void pc873xx_enable_epp19(void); | ||
void pc873xx_enable_ide(void); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters