Commit 497e8d89 authored by Matthew Wilcox's avatar Matthew Wilcox Committed by Linus Torvalds

[PATCH] Fix PA-RISC EISA EEPROM support

The EISA EEPROM driver was being initialised too early, before miscdevs
can be registered.  But EISA needs to be registered early -- before PCI.
So stash the EEPROM address in a global variable at EISA init time,
then pick it up later in the EISA EEPROM driver.

Also ioremap() it, use readb instead of gsc_readb and rename the
miscdev to not have a space in the name.
Signed-off-by: default avatarMatthew Wilcox <willy@parisc-linux.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d54c115b
......@@ -44,6 +44,7 @@
#include <asm/parisc-device.h>
#include <asm/delay.h>
#include <asm/eisa_bus.h>
#include <asm/eisa_eeprom.h>
#if 0
#define EISA_DBG(msg, arg... ) printk(KERN_DEBUG "eisa: " msg , ## arg )
......@@ -56,6 +57,8 @@
static DEFINE_SPINLOCK(eisa_irq_lock);
void __iomem *eisa_eeprom_addr;
/* We can only have one EISA adapter in the system because neither
* implementation can be flexed.
*/
......@@ -351,6 +354,7 @@ static int __devinit eisa_probe(struct parisc_device *dev)
}
EISA_bus = 1;
if (dev->num_addrs) {
/* newer firmware hand out the eeprom address */
eisa_dev.eeprom_addr = dev->addr[0];
......@@ -362,8 +366,9 @@ static int __devinit eisa_probe(struct parisc_device *dev)
eisa_dev.eeprom_addr = MIRAGE_EEPROM_BASE_ADDR;
}
}
eisa_eeprom_init(eisa_dev.eeprom_addr);
result = eisa_enumerator(eisa_dev.eeprom_addr, &eisa_dev.hba.io_space, &eisa_dev.hba.lmmio_space);
eisa_eeprom_addr = ioremap(eisa_dev.eeprom_addr, HPEE_MAX_LENGTH);
result = eisa_enumerator(eisa_dev.eeprom_addr, &eisa_dev.hba.io_space,
&eisa_dev.hba.lmmio_space);
init_eisa_pic();
if (result >= 0) {
......
......@@ -31,8 +31,6 @@
#define EISA_EEPROM_MINOR 241
static unsigned long eeprom_addr;
static loff_t eisa_eeprom_llseek(struct file *file, loff_t offset, int origin )
{
switch (origin) {
......@@ -63,7 +61,7 @@ static ssize_t eisa_eeprom_read(struct file * file,
tmp = kmalloc(count, GFP_KERNEL);
if (tmp) {
for (i = 0; i < count; i++)
tmp[i] = gsc_readb(eeprom_addr+(*ppos)++);
tmp[i] = readb(eisa_eeprom_addr+(*ppos)++);
if (copy_to_user (buf, tmp, count))
ret = -EFAULT;
......@@ -85,7 +83,7 @@ static int eisa_eeprom_ioctl(struct inode *inode, struct file *file,
static int eisa_eeprom_open(struct inode *inode, struct file *file)
{
if (file->f_mode & 2 || eeprom_addr == 0)
if (file->f_mode & 2)
return -EINVAL;
return 0;
......@@ -108,22 +106,18 @@ static struct file_operations eisa_eeprom_fops = {
.release = eisa_eeprom_release,
};
static struct miscdevice eisa_eeprom_dev=
{
static struct miscdevice eisa_eeprom_dev = {
EISA_EEPROM_MINOR,
"eisa eeprom",
"eisa_eeprom",
&eisa_eeprom_fops
};
int __init eisa_eeprom_init(unsigned long addr)
static int __init eisa_eeprom_init(void)
{
int retval;
/* XXX why return success when we haven't done anything? */
if (!addr)
return 0;
eeprom_addr = addr;
if (!eisa_eeprom_addr)
return -ENODEV;
retval = misc_register(&eisa_eeprom_dev);
if (retval < 0) {
......@@ -131,8 +125,10 @@ int __init eisa_eeprom_init(unsigned long addr)
return retval;
}
printk(KERN_INFO "EISA EEPROM at 0x%lx\n", eeprom_addr);
printk(KERN_INFO "EISA EEPROM at 0x%p\n", eisa_eeprom_addr);
return 0;
}
MODULE_LICENSE("GPL");
module_init(eisa_eeprom_init);
......@@ -13,6 +13,8 @@
#ifndef ASM_EISA_EEPROM_H
#define ASM_EISA_EEPROM_H
extern void __iomem *eisa_eeprom_addr;
#define HPEE_MAX_LENGTH 0x2000 /* maximum eeprom length */
#define HPEE_SLOT_INFO(slot) (20+(48*slot))
......
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