[oe-commits] org.oe.dev linux-titan-sh4: Update flash driver so that it'll build with recent kernels:

lenehan commit openembedded-commits at lists.openembedded.org
Thu Apr 26 10:51:58 UTC 2007


linux-titan-sh4: Update flash driver so that it'll build with recent kernels:
* Remove remains of devfs support.
* Implement HDIO_GETGEO ioctl in place of getgeo block device operation.

Author: lenehan at openembedded.org
Branch: org.openembedded.dev
Revision: aa1ed7ac9b34bd30dff0d3f0505c7e1848fffbe8
ViewMTN: http://monotone.openembedded.org/revision.psp?id=aa1ed7ac9b34bd30dff0d3f0505c7e1848fffbe8
Files:
1
packages/linux/linux-titan-sh4/titan-flash.patch
Diffs:

#
# mt diff -rb72cc6057e9627154aecce088453bf8b23314ccc -raa1ed7ac9b34bd30dff0d3f0505c7e1848fffbe8
#
# 
# 
# patch "packages/linux/linux-titan-sh4/titan-flash.patch"
#  from [76ea33a763f805afe4afbae98f0e9f222045ee9e]
#    to [aae617941a5b9daa1e3aa8c111244d99e9e4be18]
# 
============================================================
--- packages/linux/linux-titan-sh4/titan-flash.patch	76ea33a763f805afe4afbae98f0e9f222045ee9e
+++ packages/linux/linux-titan-sh4/titan-flash.patch	aae617941a5b9daa1e3aa8c111244d99e9e4be18
@@ -1,14 +1,14 @@
-
 Add the driver for onboard flash.
 The quality of this driver means that it has not been included in the
-upstream CVS.
-This implements the block device translation layer to match what the 
+upstream kernel sources.
+This implements a block device translation layer to match what the 
 onboard firmware implements.
 
-diff -duNr linux-2.6.16-orig/drivers/block/Kconfig linux-2.6.16/drivers/block/Kconfig
---- linux-2.6.16-orig/drivers/block/Kconfig	2006-06-29 16:12:57.000000000 +1000
-+++ linux-2.6.16/drivers/block/Kconfig	2006-06-29 16:13:27.000000000 +1000
-@@ -190,6 +190,13 @@
+diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig
+index 58c1deb..9668ac7 100644
+--- a/drivers/block/Kconfig
++++ b/drivers/block/Kconfig
+@@ -186,6 +186,13 @@ config BLK_DEV_DAC960
  	  To compile this driver as a module, choose M here: the
  	  module will be called DAC960.
  
@@ -16,16 +16,17 @@ diff -duNr linux-2.6.16-orig/drivers/blo
 +	tristate "SmartMedia(TM) Driver (sm)"
 +	depends on SH_TITAN
 +	help
-+	Say Y here if you want the SmartMedia chip enabled.
++	  Say Y here if you want the SmartMedia chip enabled.
 +	  Otherwise say N.
 +
  config BLK_DEV_UMEM
  	tristate "Micro Memory MM5415 Battery Backed RAM support (EXPERIMENTAL)"
  	depends on PCI && EXPERIMENTAL
-diff -duNr linux-2.6.16-orig/drivers/block/Makefile linux-2.6.16/drivers/block/Makefile
---- linux-2.6.16-orig/drivers/block/Makefile	2006-06-29 16:12:57.000000000 +1000
-+++ linux-2.6.16/drivers/block/Makefile	2006-06-29 16:13:27.000000000 +1000
-@@ -21,6 +21,7 @@
+diff --git a/drivers/block/Makefile b/drivers/block/Makefile
+index dd88e33..37fc9e8 100644
+--- a/drivers/block/Makefile
++++ b/drivers/block/Makefile
+@@ -19,6 +19,7 @@ obj-$(CONFIG_BLK_DEV_XD)	+= xd.o
  obj-$(CONFIG_BLK_CPQ_DA)	+= cpqarray.o
  obj-$(CONFIG_BLK_CPQ_CISS_DA)  += cciss.o
  obj-$(CONFIG_BLK_DEV_DAC960)	+= DAC960.o
@@ -33,10 +34,12 @@ diff -duNr linux-2.6.16-orig/drivers/blo
  obj-$(CONFIG_CDROM_PKTCDVD)	+= pktcdvd.o
  
  obj-$(CONFIG_BLK_DEV_UMEM)	+= umem.o
-diff -duNr linux-2.6.16-orig/drivers/block/ssfdc.c linux-2.6.16/drivers/block/ssfdc.c
---- linux-2.6.16-orig/drivers/block/ssfdc.c	1970-01-01 10:00:00.000000000 +1000
-+++ linux-2.6.16/drivers/block/ssfdc.c	2006-06-29 16:13:50.000000000 +1000
-@@ -0,0 +1,2742 @@
+diff --git a/drivers/block/ssfdc.c b/drivers/block/ssfdc.c
+new file mode 100644
+index 0000000..482d617
+--- /dev/null
++++ b/drivers/block/ssfdc.c
+@@ -0,0 +1,2733 @@
 +/* $id:   $
 +ssfdc.c - Solid State Flopyy Disk Card
 +
@@ -102,7 +105,6 @@ diff -duNr linux-2.6.16-orig/drivers/blo
 +#include <linux/errno.h>
 +#include <linux/major.h>
 +#include <linux/init.h>
-+#include <linux/devfs_fs_kernel.h>
 +#include <asm/uaccess.h>
 +#include <asm/hardirq.h>
 +#include <linux/bio.h>
@@ -122,7 +124,6 @@ diff -duNr linux-2.6.16-orig/drivers/blo
 +static ssfdc_dev *ssfdc[MAX_SSFDC];
 +
 +static int ssfdc_open(struct inode *i_node, struct file *fptr);
-+static int ssfdc_getgeo(struct block_device *bdev, struct hd_geometry *geo);
 +static int ssfdc_release(struct inode *i_node, struct file *fptr);
 +static int ssfdc_ioctl(struct inode *i_node, struct file *fptr, unsigned cmd, unsigned long arg);
 +static int ssfdc_revalidate(struct gendisk *disk);
@@ -131,7 +132,6 @@ diff -duNr linux-2.6.16-orig/drivers/blo
 +static struct block_device_operations ssfdc_fops = {
 +	.owner			= THIS_MODULE,
 +	.open			= ssfdc_open,
-+	.getgeo			= ssfdc_getgeo,
 +	.release		= ssfdc_release,
 +	.ioctl			= ssfdc_ioctl,
 +	// bjm out .revalidate_disk	= ssfdc_revalidate,
@@ -2387,7 +2387,10 @@ diff -duNr linux-2.6.16-orig/drivers/blo
 +
 +static int ssfdc_ioctl(struct inode *i_node, struct file *fptr, unsigned cmd, unsigned long arg)
 +{
-+	int drive, int_val;
++	int err, drive, int_val;
++	unsigned char heads, sectors;
++	unsigned int cylinders;
++	struct hd_geometry  geo;
 +	ssfdc_dev *psm;
 +
 +#if DEBUG_SSFDC
@@ -2428,34 +2431,29 @@ diff -duNr linux-2.6.16-orig/drivers/blo
 +			printk(KERN_DEBUG "ssfdc_ioctl(BLKGETSIZE) not handled.\n");
 +#endif
 +			break;
++
++		case HDIO_GETGEO:
++			if ((void *) arg == NULL) return -EINVAL;
++			if (!access_ok(VERIFY_WRITE,  (void __user *)arg, sizeof(geo)))
++				return -EFAULT;
++			if ((err=CheckLogCHS( psm, &cylinders, &heads, &sectors)))
++				return ssfdc_maperror(err);	
++			memset(&geo, 0, sizeof(geo));
++			geo.cylinders = cylinders;
++			geo.heads = heads;
++			geo.sectors = sectors;
++			geo.start = get_start_sect(i_node->i_bdev);
++			if (copy_to_user((void *) arg, &geo, sizeof(geo)))
++				return -EFAULT;		
++			if (copy_to_user((void *) arg, &geo, sizeof(geo)))
++				return -EFAULT;		
++			return 0;
 +	}
 +	return -EINVAL;
 +}
 +
 +
-+static int ssfdc_getgeo(struct block_device *bdev, struct hd_geometry *geo)
-+{
-+	unsigned char heads, sectors;
-+	unsigned int cylinders;
-+	struct gendisk *disk = bdev->bd_disk;
-+	ssfdc_dev *psm = disk->private_data;
-+	int drive = psm->sm_minor;
-+	int err;
 +
-+	if (drive < 0 || drive >= MAX_SSFDC)
-+        	return -ENODEV;                                                                         
-+
-+	err = CheckLogCHS(psm, &cylinders, &heads, &sectors);
-+	if (err)
-+		return ssfdc_maperror(err);
-+	
-+	geo->heads = heads;
-+	geo->sectors = sectors;
-+	geo->cylinders = cylinders;
-+	return 0;
-+}
-+
-+
 +static int ssfdc_revalidate(struct gendisk *disk)
 +{
 +    unsigned int cis;
@@ -2514,14 +2512,11 @@ diff -duNr linux-2.6.16-orig/drivers/blo
 +		goto busy_error;
 +	}
 +
-+	devfs_mk_dir("sm");
-+
 +	for ( i=0; i < MAX_SSFDC; ++i) {
 +		disks[i]->major = SSFDC_MAJOR;
 +		disks[i]->first_minor = i << SSFDC_PARTN_BITS;
 +		disks[i]->fops = &ssfdc_fops;
 +		sprintf(disks[i]->disk_name, "sm%d", i);
-+		sprintf(disks[i]->devfs_name, "sm/%d", i);
 +		disks[i]->private_data = ssfdc[i];
 +		ssfdc_init_device(ssfdc[i], i << SSFDC_PARTN_BITS,
 +			CPLD_BASE_ADDRESS + SMART_MEDIA_ONE_OFFSET);
@@ -2592,7 +2587,6 @@ diff -duNr linux-2.6.16-orig/drivers/blo
 +
 +	if (unregister_blkdev(SSFDC_MAJOR, "smartmedia"))
 +		printk(KERN_WARNING "smartmedia: cannot unregister blkdev\n");
-+	devfs_remove("sm");
 +}
 +
 +#if DEBUG_SSFDC
@@ -2779,9 +2773,11 @@ diff -duNr linux-2.6.16-orig/drivers/blo
 +MODULE_LICENSE("GPL");
 +
 +/* End of Linux Driver Modifications */
-diff -duNr linux-2.6.16-orig/drivers/block/ssfdc.h linux-2.6.16/drivers/block/ssfdc.h
---- linux-2.6.16-orig/drivers/block/ssfdc.h	1970-01-01 10:00:00.000000000 +1000
-+++ linux-2.6.16/drivers/block/ssfdc.h	2006-06-29 16:13:27.000000000 +1000
+diff --git a/drivers/block/ssfdc.h b/drivers/block/ssfdc.h
+new file mode 100644
+index 0000000..06f4a3c
+--- /dev/null
++++ b/drivers/block/ssfdc.h
 @@ -0,0 +1,372 @@
 +/* $id:   $ */
 +#ifndef _SSFDC_H






More information about the Openembedded-commits mailing list