diff options
Diffstat (limited to 'drivers/zorro')
| -rw-r--r-- | drivers/zorro/Makefile | 3 | ||||
| -rw-r--r-- | drivers/zorro/names.c | 11 | ||||
| -rw-r--r-- | drivers/zorro/proc.c | 40 | ||||
| -rw-r--r-- | drivers/zorro/zorro-driver.c | 23 | ||||
| -rw-r--r-- | drivers/zorro/zorro-sysfs.c | 22 | ||||
| -rw-r--r-- | drivers/zorro/zorro.c | 36 | ||||
| -rw-r--r-- | drivers/zorro/zorro.h | 5 | ||||
| -rw-r--r-- | drivers/zorro/zorro.ids | 2 | 
8 files changed, 72 insertions, 70 deletions
diff --git a/drivers/zorro/Makefile b/drivers/zorro/Makefile index f6217260321..7dc5332ff98 100644 --- a/drivers/zorro/Makefile +++ b/drivers/zorro/Makefile @@ -2,8 +2,9 @@  # Makefile for the Zorro bus specific drivers.  # -obj-$(CONFIG_ZORRO)	+= zorro.o zorro-driver.o zorro-sysfs.o names.o +obj-$(CONFIG_ZORRO)	+= zorro.o zorro-driver.o zorro-sysfs.o  obj-$(CONFIG_PROC_FS)	+= proc.o +obj-$(CONFIG_ZORRO_NAMES) +=  names.o  hostprogs-y 		:= gen-devlist diff --git a/drivers/zorro/names.c b/drivers/zorro/names.c index e8517c3d8e8..6f3fd9903ac 100644 --- a/drivers/zorro/names.c +++ b/drivers/zorro/names.c @@ -15,8 +15,6 @@  #include <linux/zorro.h> -#ifdef CONFIG_ZORRO_NAMES -  struct zorro_prod_info {  	__u16 prod;  	unsigned short seen; @@ -69,7 +67,6 @@ void __init zorro_name_device(struct zorro_dev *dev)  	} while (--i);  	/* Couldn't find either the manufacturer nor the product */ -	sprintf(name, "Zorro device %08x", dev->id);  	return;  	match_manuf: { @@ -98,11 +95,3 @@ void __init zorro_name_device(struct zorro_dev *dev)  		}  	}  } - -#else - -void __init zorro_name_device(struct zorro_dev *dev) -{ -} - -#endif diff --git a/drivers/zorro/proc.c b/drivers/zorro/proc.c index cafc5045429..6ac2579da0e 100644 --- a/drivers/zorro/proc.c +++ b/drivers/zorro/proc.c @@ -13,7 +13,9 @@  #include <linux/proc_fs.h>  #include <linux/seq_file.h>  #include <linux/init.h> -#include <linux/smp_lock.h> +#include <linux/export.h> + +#include <asm/byteorder.h>  #include <asm/uaccess.h>  #include <asm/amigahw.h>  #include <asm/setup.h> @@ -21,35 +23,13 @@  static loff_t  proc_bus_zorro_lseek(struct file *file, loff_t off, int whence)  { -	loff_t new = -1; -	struct inode *inode = file->f_path.dentry->d_inode; - -	mutex_lock(&inode->i_mutex); -	switch (whence) { -	case 0: -		new = off; -		break; -	case 1: -		new = file->f_pos + off; -		break; -	case 2: -		new = sizeof(struct ConfigDev) + off; -		break; -	} -	if (new < 0 || new > sizeof(struct ConfigDev)) -		new = -EINVAL; -	else -		file->f_pos = new; -	mutex_unlock(&inode->i_mutex); -	return new; +	return fixed_size_llseek(file, off, whence, sizeof(struct ConfigDev));  }  static ssize_t  proc_bus_zorro_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)  { -	struct inode *ino = file->f_path.dentry->d_inode; -	struct proc_dir_entry *dp = PDE(ino); -	struct zorro_dev *z = dp->data; +	struct zorro_dev *z = PDE_DATA(file_inode(file));  	struct ConfigDev cd;  	loff_t pos = *ppos; @@ -63,10 +43,10 @@ proc_bus_zorro_read(struct file *file, char __user *buf, size_t nbytes, loff_t *  	/* Construct a ConfigDev */  	memset(&cd, 0, sizeof(cd));  	cd.cd_Rom = z->rom; -	cd.cd_SlotAddr = z->slotaddr; -	cd.cd_SlotSize = z->slotsize; -	cd.cd_BoardAddr = (void *)zorro_resource_start(z); -	cd.cd_BoardSize = zorro_resource_len(z); +	cd.cd_SlotAddr = cpu_to_be16(z->slotaddr); +	cd.cd_SlotSize = cpu_to_be16(z->slotsize); +	cd.cd_BoardAddr = cpu_to_be32(zorro_resource_start(z)); +	cd.cd_BoardSize = cpu_to_be32(zorro_resource_len(z));  	if (copy_to_user(buf, (void *)&cd + pos, nbytes))  		return -EFAULT; @@ -141,7 +121,7 @@ static int __init zorro_proc_attach_device(unsigned int slot)  				 &zorro_autocon[slot]);  	if (!entry)  		return -ENOMEM; -	entry->size = sizeof(struct zorro_dev); +	proc_set_size(entry, sizeof(struct zorro_dev));  	return 0;  } diff --git a/drivers/zorro/zorro-driver.c b/drivers/zorro/zorro-driver.c index 7ee2b6e7178..eacae1434b7 100644 --- a/drivers/zorro/zorro-driver.c +++ b/drivers/zorro/zorro-driver.c @@ -37,6 +37,7 @@ zorro_match_device(const struct zorro_device_id *ids,  	}  	return NULL;  } +EXPORT_SYMBOL(zorro_match_device);  static int zorro_device_probe(struct device *dev) @@ -91,6 +92,7 @@ int zorro_register_driver(struct zorro_driver *drv)  	/* register with core */  	return driver_register(&drv->driver);  } +EXPORT_SYMBOL(zorro_register_driver);      /** @@ -107,6 +109,7 @@ void zorro_unregister_driver(struct zorro_driver *drv)  {  	driver_unregister(&drv->driver);  } +EXPORT_SYMBOL(zorro_unregister_driver);      /** @@ -139,7 +142,6 @@ static int zorro_bus_match(struct device *dev, struct device_driver *drv)  static int zorro_uevent(struct device *dev, struct kobj_uevent_env *env)  { -#ifdef CONFIG_HOTPLUG  	struct zorro_dev *z;  	if (!dev) @@ -156,18 +158,17 @@ static int zorro_uevent(struct device *dev, struct kobj_uevent_env *env)  		return -ENOMEM;  	return 0; -#else /* !CONFIG_HOTPLUG */ -	return -ENODEV; -#endif /* !CONFIG_HOTPLUG */  }  struct bus_type zorro_bus_type = { -	.name	= "zorro", -	.match	= zorro_bus_match, -	.uevent	= zorro_uevent, -	.probe	= zorro_device_probe, -	.remove	= zorro_device_remove, +	.name     = "zorro", +	.dev_name = "zorro", +	.match    = zorro_bus_match, +	.uevent   = zorro_uevent, +	.probe    = zorro_device_probe, +	.remove   = zorro_device_remove,  }; +EXPORT_SYMBOL(zorro_bus_type);  static int __init zorro_driver_init(void) @@ -177,7 +178,3 @@ static int __init zorro_driver_init(void)  postcore_initcall(zorro_driver_init); -EXPORT_SYMBOL(zorro_match_device); -EXPORT_SYMBOL(zorro_register_driver); -EXPORT_SYMBOL(zorro_unregister_driver); -EXPORT_SYMBOL(zorro_bus_type); diff --git a/drivers/zorro/zorro-sysfs.c b/drivers/zorro/zorro-sysfs.c index 26f7184ef9e..36b210f9b6b 100644 --- a/drivers/zorro/zorro-sysfs.c +++ b/drivers/zorro/zorro-sysfs.c @@ -16,6 +16,8 @@  #include <linux/stat.h>  #include <linux/string.h> +#include <asm/byteorder.h> +  #include "zorro.h" @@ -33,10 +35,20 @@ static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL);  zorro_config_attr(id, id, "0x%08x\n");  zorro_config_attr(type, rom.er_Type, "0x%02x\n"); -zorro_config_attr(serial, rom.er_SerialNumber, "0x%08x\n");  zorro_config_attr(slotaddr, slotaddr, "0x%04x\n");  zorro_config_attr(slotsize, slotsize, "0x%04x\n"); +static ssize_t +show_serial(struct device *dev, struct device_attribute *attr, char *buf) +{ +	struct zorro_dev *z; + +	z = to_zorro_dev(dev); +	return sprintf(buf, "0x%08x\n", be32_to_cpu(z->rom.er_SerialNumber)); +} + +static DEVICE_ATTR(serial, S_IRUGO, show_serial, NULL); +  static ssize_t zorro_show_resource(struct device *dev, struct device_attribute *attr, char *buf)  {  	struct zorro_dev *z = to_zorro_dev(dev); @@ -60,10 +72,10 @@ static ssize_t zorro_read_config(struct file *filp, struct kobject *kobj,  	/* Construct a ConfigDev */  	memset(&cd, 0, sizeof(cd));  	cd.cd_Rom = z->rom; -	cd.cd_SlotAddr = z->slotaddr; -	cd.cd_SlotSize = z->slotsize; -	cd.cd_BoardAddr = (void *)zorro_resource_start(z); -	cd.cd_BoardSize = zorro_resource_len(z); +	cd.cd_SlotAddr = cpu_to_be16(z->slotaddr); +	cd.cd_SlotSize = cpu_to_be16(z->slotsize); +	cd.cd_BoardAddr = cpu_to_be32(zorro_resource_start(z)); +	cd.cd_BoardSize = cpu_to_be32(zorro_resource_len(z));  	return memory_read_from_buffer(buf, count, &off, &cd, sizeof(cd));  } diff --git a/drivers/zorro/zorro.c b/drivers/zorro/zorro.c index e0c2807b097..707c1a5a031 100644 --- a/drivers/zorro/zorro.c +++ b/drivers/zorro/zorro.c @@ -18,6 +18,7 @@  #include <linux/platform_device.h>  #include <linux/slab.h> +#include <asm/byteorder.h>  #include <asm/setup.h>  #include <asm/amigahw.h> @@ -29,7 +30,8 @@       */  unsigned int zorro_num_autocon; -struct zorro_dev zorro_autocon[ZORRO_NUM_AUTO]; +struct zorro_dev_init zorro_autocon_init[ZORRO_NUM_AUTO] __initdata; +struct zorro_dev *zorro_autocon;      /* @@ -37,8 +39,8 @@ struct zorro_dev zorro_autocon[ZORRO_NUM_AUTO];       */  struct zorro_bus { -	struct list_head devices;	/* list of devices on this bus */  	struct device dev; +	struct zorro_dev devices[0];  }; @@ -126,19 +128,22 @@ static struct resource __init *zorro_find_parent_resource(  static int __init amiga_zorro_probe(struct platform_device *pdev)  {  	struct zorro_bus *bus; +	struct zorro_dev_init *zi;  	struct zorro_dev *z;  	struct resource *r;  	unsigned int i;  	int error;  	/* Initialize the Zorro bus */ -	bus = kzalloc(sizeof(*bus), GFP_KERNEL); +	bus = kzalloc(sizeof(*bus) + +		      zorro_num_autocon * sizeof(bus->devices[0]), +		      GFP_KERNEL);  	if (!bus)  		return -ENOMEM; -	INIT_LIST_HEAD(&bus->devices); +	zorro_autocon = bus->devices;  	bus->dev.parent = &pdev->dev; -	dev_set_name(&bus->dev, "zorro"); +	dev_set_name(&bus->dev, zorro_bus_type.name);  	error = device_register(&bus->dev);  	if (error) {  		pr_err("Zorro: Error registering zorro_bus\n"); @@ -148,20 +153,28 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)  	}  	platform_set_drvdata(pdev, bus); -	/* Register all devices */  	pr_info("Zorro: Probing AutoConfig expansion devices: %u device%s\n",  		 zorro_num_autocon, zorro_num_autocon == 1 ? "" : "s"); +	/* First identify all devices ... */  	for (i = 0; i < zorro_num_autocon; i++) { +		zi = &zorro_autocon_init[i];  		z = &zorro_autocon[i]; -		z->id = (z->rom.er_Manufacturer<<16) | (z->rom.er_Product<<8); + +		z->rom = zi->rom; +		z->id = (be16_to_cpu(z->rom.er_Manufacturer) << 16) | +			(z->rom.er_Product << 8);  		if (z->id == ZORRO_PROD_GVP_EPC_BASE) {  			/* GVP quirk */ -			unsigned long magic = zorro_resource_start(z)+0x8000; +			unsigned long magic = zi->boardaddr + 0x8000;  			z->id |= *(u16 *)ZTWO_VADDR(magic) & GVP_PRODMASK;  		} +		z->slotaddr = zi->slotaddr; +		z->slotsize = zi->slotsize;  		sprintf(z->name, "Zorro device %08x", z->id);  		zorro_name_device(z); +		z->resource.start = zi->boardaddr; +		z->resource.end = zi->boardaddr + zi->boardsize - 1;  		z->resource.name = z->name;  		r = zorro_find_parent_resource(pdev, z);  		error = request_resource(r, &z->resource); @@ -169,9 +182,14 @@ static int __init amiga_zorro_probe(struct platform_device *pdev)  			dev_err(&bus->dev,  				"Address space collision on device %s %pR\n",  				z->name, &z->resource); -		dev_set_name(&z->dev, "%02x", i);  		z->dev.parent = &bus->dev;  		z->dev.bus = &zorro_bus_type; +		z->dev.id = i; +	} + +	/* ... then register them */ +	for (i = 0; i < zorro_num_autocon; i++) { +		z = &zorro_autocon[i];  		error = device_register(&z->dev);  		if (error) {  			dev_err(&bus->dev, "Error registering device %s\n", diff --git a/drivers/zorro/zorro.h b/drivers/zorro/zorro.h index b682d5ccd63..34119fb4e56 100644 --- a/drivers/zorro/zorro.h +++ b/drivers/zorro/zorro.h @@ -1,4 +1,9 @@ +#ifdef CONFIG_ZORRO_NAMES  extern void zorro_name_device(struct zorro_dev *z); +#else +static inline void zorro_name_device(struct zorro_dev *dev) { } +#endif +  extern int zorro_create_sysfs_dev_files(struct zorro_dev *z); diff --git a/drivers/zorro/zorro.ids b/drivers/zorro/zorro.ids index de24e3deced..119abea8c6c 100644 --- a/drivers/zorro/zorro.ids +++ b/drivers/zorro/zorro.ids @@ -351,7 +351,7 @@  	0200  EGS 28/24 Spectrum [Graphics Card]  0892  Apollo  	0100  A1200 [FPU and RAM Expansion] -0893  Ingenieurbüro Helfrich +0893  Ingenieurbüro Helfrich  	0500  Piccolo RAM [Graphics Card]  	0600  Piccolo [Graphics Card]  	0700  PeggyPlus MPEG [Video Card]  | 
