summaryrefslogtreecommitdiff
path: root/packages/linux/linux-titan-sh4/titan-flash.patch
diff options
context:
space:
mode:
authorJamie Lenehan <lenehan@twibble.org>2007-04-26 10:25:12 +0000
committerJamie Lenehan <lenehan@twibble.org>2007-04-26 10:25:12 +0000
commit61648a45cdd85c347d41faed9f95307a42cedb81 (patch)
tree93b6e0fd0aa9eed1d973dc754b35b8522837b21b /packages/linux/linux-titan-sh4/titan-flash.patch
parent0c0263c009bf9be6ffe9192d3e3c468a081e6382 (diff)
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.
Diffstat (limited to 'packages/linux/linux-titan-sh4/titan-flash.patch')
-rw-r--r--packages/linux/linux-titan-sh4/titan-flash.patch94
1 files changed, 45 insertions, 49 deletions
diff --git a/packages/linux/linux-titan-sh4/titan-flash.patch b/packages/linux/linux-titan-sh4/titan-flash.patch
index fc633f3e05..c84adcdb8c 100644
--- a/packages/linux/linux-titan-sh4/titan-flash.patch
+++ b/packages/linux/linux-titan-sh4/titan-flash.patch
@@ -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/block/Kconfig linux-2.6.16/drivers/block/Kc
+ 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/block/Makefile linux-2.6.16/drivers/block/M
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/block/ssfdc.c linux-2.6.16/drivers/block/ss
+#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/block/ssfdc.c linux-2.6.16/drivers/block/ss
+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/block/ssfdc.c linux-2.6.16/drivers/block/ss
+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/block/ssfdc.c linux-2.6.16/drivers/block/ss
+
+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,33 +2431,28 @@ diff -duNr linux-2.6.16-orig/drivers/block/ssfdc.c linux-2.6.16/drivers/block/ss
+ 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)
+{
@@ -2514,14 +2512,11 @@ diff -duNr linux-2.6.16-orig/drivers/block/ssfdc.c linux-2.6.16/drivers/block/ss
+ 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/block/ssfdc.c linux-2.6.16/drivers/block/ss
+
+ 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/block/ssfdc.c linux-2.6.16/drivers/block/ss
+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