📄 1004.ide.patch
字号:
+ if ((drive->media == ide_cdrom)){+ max_sectors = CONFIG_SD_CDROM_MAXIMUM_SECTORS;+ printk("The CDROM maximum sectors is set to 0x%x\n", max_sectors);+ }+#endif+ blk_queue_max_sectors(q, max_sectors); #ifdef CONFIG_PCI@@ -1119,9 +1142,9 @@ */ if (!match || match->irq != hwif->irq) { int sa = SA_INTERRUPT;-#if defined(__mc68000__) || defined(CONFIG_APUS)+#if defined(__mc68000__) || defined(CONFIG_APUS) || defined(CONFIG_TANGOX) sa = SA_SHIRQ;-#endif /* __mc68000__ || CONFIG_APUS */+#endif /* __mc68000__ || CONFIG_APUS || CONFIG_TANGOX */ if (IDE_CHIPSET_IS_PCI(hwif->chipset)) { sa = SA_SHIRQ;diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linux-2.6.15.ref/drivers/ide/Kconfig linux-2.6.15/drivers/ide/Kconfig--- linux-2.6.15.ref/drivers/ide/Kconfig 2006-01-25 20:51:25.000000000 -0800+++ linux-2.6.15/drivers/ide/Kconfig 2007-06-16 17:05:09.000000000 -0700@@ -812,6 +812,80 @@ default "128" depends BLK_DEV_IDE_AU1XXX +config BLK_DEV_BMIDE_TANGOX+ select IDE_GENERIC+ tristate "BMIDE for SMP863x/SMP865x"+ depends on TANGOX+ help+ Enable the support for Bus Mastering IDE controller. ++config BLK_DEV_BMIDE_TANGOX_DMA+ select SD_CDROM_DMAPACKET if BLK_DEV_IDECD+ bool "support BMIDE DMA operations"+ default y+ depends on BLK_DEV_BMIDE_TANGOX+ help+ Enable the DMA support for Bus Mastering IDE controller, which+ include support for MDMA and UDMA modes. ++config BLK_DEV_PBIDE_TANGOX+ select IDE_GENERIC+ tristate "PBIDE for SMP863x/SMP865x"+ depends on TANGOX+ help+ Enable the support for Peripheral Bus IDE controller. ++config BLK_DEV_PBIDE_TANGOX_DMA+ select SD_CDROM_DMAPACKET if BLK_DEV_IDECD+ bool "support PBIDE DMA operations"+ default y+ depends on BLK_DEV_PBIDE_TANGOX+ help+ Enable the DMA support for Bus Mastering IDE controller, which+ include support for MDMA modes. ++config SD_CDROM_MAXIMUM_SECTOR_RESTRICTION+ bool "Limit CDROM maximum transfer sectors"+ default n+ depends on (BLK_DEV_BMIDE_TANGOX || BLK_DEV_PBIDE_TANGOX) && BLK_DEV_IDECD+ help+ Some CDROM has restriction on maximum tansfer sectors per request.++config SD_CDROM_MAXIMUM_SECTORS+ int "Maximum transfer sectors per request (in sectors)"+ default 256+ depends on SD_CDROM_MAXIMUM_SECTOR_RESTRICTION+ help+ How many maximum sectors can be tranferred per request.++config SD_CDROM_WAIT+ bool "enable CDROM wait for spin-up"+ default y+ depends on (BLK_DEV_BMIDE_TANGOX || BLK_DEV_PBIDE_TANGOX) && BLK_DEV_IDECD+ help+ Some CDROM implements spin-down control and hence will be spinned down after+ a period of inactivities. However, once the access started after spinned down,+ timeout may occured with I/O error. Enable this (and specify wait time) for+ your platform.++config SD_CDROM_WAIT_TIME+ int "CDROM spin-up wait time (in seconds)"+ default 5+ depends on SD_CDROM_WAIT+ help+ How long should the driver wait for CDROM spin-up.++config SD_CDROM_KEEP_DMA+ bool "Keep DMA mode even I/O failed on non-HDD"+ default y+ depends on ((BLK_DEV_BMIDE_TANGOX && BLK_DEV_BMIDE_TANGOX_DMA) || (BLK_DEV_PBIDE_TANGOX && BLK_DEV_PBIDE_TANGOX_DMA)) && BLK_DEV_IDECD + help+ Normally when DMA operation went bad, IDE layer may disable DMA and switch to+ PIO operation afterward. Enable this to keep DMA mode intact.++config SD_CDROM_DMAPACKET+ bool+ config IDE_ARM def_bool ARM && (ARCH_A5K || ARCH_CLPS7500 || ARCH_RPC || ARCH_SHARK) @@ -1047,7 +1121,7 @@ endif config BLK_DEV_IDEDMA- def_bool BLK_DEV_IDEDMA_PCI || BLK_DEV_IDEDMA_PMAC || BLK_DEV_IDEDMA_ICS || BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA+ def_bool BLK_DEV_IDEDMA_PCI || BLK_DEV_IDEDMA_PMAC || BLK_DEV_IDEDMA_ICS || BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA || BLK_DEV_BMIDE_TANGOX_DMA || BLK_DEV_PBIDE_TANGOX_DMA config IDEDMA_IVB bool "IGNORE word93 Validation BITS"@@ -1066,7 +1140,7 @@ It is normally safe to answer Y; however, the default is N. config IDEDMA_AUTO- def_bool IDEDMA_PCI_AUTO || IDEDMA_ICS_AUTO+ def_bool IDEDMA_PCI_AUTO || IDEDMA_ICS_AUTO || BLK_DEV_BMIDE_TANGOX_DMA || BLK_DEV_PBIDE_TANGOX_DMA endif diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linux-2.6.15.ref/drivers/ide/Makefile linux-2.6.15/drivers/ide/Makefile--- linux-2.6.15.ref/drivers/ide/Makefile 2006-01-25 20:51:25.000000000 -0800+++ linux-2.6.15/drivers/ide/Makefile 2007-06-16 17:05:09.000000000 -0700@@ -48,6 +48,6 @@ obj-$(CONFIG_BLK_DEV_IDETAPE) += ide-tape.o obj-$(CONFIG_BLK_DEV_IDEFLOPPY) += ide-floppy.o -obj-$(CONFIG_BLK_DEV_IDE) += legacy/ arm/ mips/+obj-$(CONFIG_BLK_DEV_IDE) += legacy/ arm/ mips/ tangox/ obj-$(CONFIG_BLK_DEV_HD) += legacy/ obj-$(CONFIG_ETRAX_IDE) += cris/diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linux-2.6.15.ref/drivers/ide/mips/Makefile linux-2.6.15/drivers/ide/mips/Makefile--- linux-2.6.15.ref/drivers/ide/mips/Makefile 2006-01-25 20:51:25.000000000 -0800+++ linux-2.6.15/drivers/ide/mips/Makefile 2007-06-16 17:05:09.000000000 -0700@@ -1,4 +1,4 @@ obj-$(CONFIG_BLK_DEV_IDE_SWARM) += swarm.o obj-$(CONFIG_BLK_DEV_IDE_AU1XXX) += au1xxx-ide.o -CFLAGS_au1xxx-ide.o := -Idrivers/ide+EXTRA_CFLAGS := -Idrivers/idediff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linux-2.6.15.ref/drivers/ide/tangox/Makefile linux-2.6.15/drivers/ide/tangox/Makefile--- linux-2.6.15.ref/drivers/ide/tangox/Makefile 1969-12-31 16:00:00.000000000 -0800+++ linux-2.6.15/drivers/ide/tangox/Makefile 2007-06-16 17:05:09.000000000 -0700@@ -0,0 +1,4 @@+obj-$(CONFIG_BLK_DEV_BMIDE_TANGOX) += tangox-bmide.o+obj-$(CONFIG_BLK_DEV_PBIDE_TANGOX) += tangox-pbide.o++EXTRA_CFLAGS := -I../diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linux-2.6.15.ref/drivers/ide/tangox/tangox-bmide.c linux-2.6.15/drivers/ide/tangox/tangox-bmide.c--- linux-2.6.15.ref/drivers/ide/tangox/tangox-bmide.c 1969-12-31 16:00:00.000000000 -0800+++ linux-2.6.15/drivers/ide/tangox/tangox-bmide.c 2007-06-16 17:05:09.000000000 -0700@@ -0,0 +1,921 @@++#include <linux/config.h>+#include <linux/init.h>+#include <linux/module.h>+#include <linux/ide.h>++#include "tangox-ide.h"++static DEFINE_SPINLOCK(bmide_tune_chipset_spin_lock);++#define PFX "tangox_bmide: "++#ifdef CONFIG_BLK_DEV_BMIDE_TANGOX_DMA+#define CONFIG_BLK_DEV_BMIDE_TANGOX_UDMA /* enable UDMA as well */+#endif++/*+ * helper to access host interface+ */+#define RD_HOST_REG32(r) \+ gbus_readl(REG_BASE_host_interface + (r))++#define WR_HOST_REG32(r, v) \+ gbus_writel(REG_BASE_host_interface + (r), (v))++#define RD_HOST_REG8(r) \+ gbus_readb(REG_BASE_host_interface + (r))++#define WR_HOST_REG8(r, v) \+ gbus_writeb(REG_BASE_host_interface + (r), (v))++#define CONFIG_RUNTIME_CLK_CALC++#ifdef CONFIG_RUNTIME_CLK_CALC+typedef struct {+ unsigned long cycle_time;+ unsigned long active_time;+ unsigned long recovery_time;+ unsigned long setup_time;+ unsigned long hold_time;+} j2_tim_pio_dma_t;++typedef struct {+ unsigned long t_zah;//+ unsigned long t_mli;//+ unsigned long t_ack;//+ unsigned long t_env;//+ unsigned long t_rp; //+ unsigned long t_cyc;//+ unsigned long t_cvh;//+ unsigned long t_cvs;//+} j2_tim_udma_t;++static j2_tim_pio_dma_t j2_pio_timings[] = +{+// cycle , active, recov , setup , hold+ {600 , 165 , 70 , 70 , 30 },+ {383 , 125 , 70 , 50 , 20 },+ {240 , 100 , 70 , 30 , 15 },+ {180 , 80 , 70 , 30 , 10 },+ {120 , 70 , 25 , 25 , 10 },+};++static j2_tim_pio_dma_t j2_dma_timings[] =+{+// cycle , active, recov , setup , hold+ {480 , 215 , 215 , 50 , 20 },+ {150 , 80 , 50 , 30 , 15 },+ {120 , 70 , 25 , 25 , 10 },+};++// We round 16.8 to 17 - Ex: mode 5, t_cyc=16.8!!!+static j2_tim_udma_t j2_udma_timings[] =+{+// t_zah, t_mli, t_ack, t_env, t_rp, t_cyc t_cvh t_cvs+ { 20, 20, 20, 20, 160, 112, 7, 70 },+ { 20, 20, 20, 20, 125, 73, 7, 48 },+ { 20, 20, 20, 20, 100, 54, 7, 31 },+ { 20, 20, 20, 20, 100, 39, 7, 20 },+ { 20, 20, 20, 20, 100, 25, 7, 7 },+ { 20, 20, 20, 20, 85, 17, 10, 10 },+ { 20, 20, 20, 20, 85, 13, 10, 10 },+ { 20, 20, 20, 20, 85, 13, 10, 10 },+};++static unsigned int CalcRegValTiming_PIO_DMA(j2_tim_pio_dma_t *t, unsigned long ide_clock);+static unsigned int CalcRegValTiming1_UDMA(j2_tim_udma_t *t, unsigned long ide_clock);+static unsigned int CalcRegValTiming2_UDMA(j2_tim_udma_t *t, unsigned long ide_clock);+#endif /* CONFIG_RUNTIME_CLK_CALC */++/*+ * io helpers for PIO access+ */+static void tangox_bmide_outb(u8 data, unsigned long port)+{+ gbus_writew(port, data);+}++static void tangox_bmide_outw(u16 data, unsigned long port)+{+ gbus_writew(port, data);+}++static void tangox_bmide_outbsync(ide_drive_t *drive, u8 data,+ unsigned long port)+{+ gbus_writew(port, data);+}++static u8 tangox_bmide_inb(unsigned long port)+{+ u8 val;++ val = ((u8)(gbus_readw(port) & 0xff));+ return val;+}++static u16 tangox_bmide_inw(unsigned long port)+{+ u16 val;++ val = ((u16)(gbus_readw(port) & 0xffff));+ return val;+}++static void tangox_bmide_insw(unsigned long port, void *addr, u32 count)+{+ while (count--) {+ *(u16 *)addr = (u16)(gbus_readw(port) & 0xffff);+ addr += 2;+ }+}++static void tangox_bmide_outsw(unsigned long port, void *addr, u32 count)+{+ while (count--) {+ gbus_writew(port, *(u16 *)addr);+ addr += 2;+ }+}++#ifdef CONFIG_BLK_DEV_BMIDE_TANGOX_DMA+/*+ * returns closest pio mode timings from given dma speed+ */+static u8 dma_2_pio(u8 xfer_rate) {++ switch (xfer_rate) {+ case XFER_UDMA_6:+ case XFER_UDMA_5:+ case XFER_UDMA_4:+ case XFER_UDMA_3:+ case XFER_UDMA_2:+ case XFER_UDMA_1:+ case XFER_UDMA_0:+ case XFER_MW_DMA_2:+ case XFER_PIO_4:+ return 4;++ case XFER_MW_DMA_1:+ case XFER_PIO_3:+ return 3;++ case XFER_SW_DMA_2:+ case XFER_PIO_2:+ return 2;++ case XFER_MW_DMA_0:+ case XFER_SW_DMA_1:+ case XFER_SW_DMA_0:+ case XFER_PIO_1:+ case XFER_PIO_0:+ case XFER_PIO_SLOW:+ default:+ return 0;+ }+}++/*+ * dma related callbacks+ */+int tangox_bmide_dma_host_on(ide_drive_t *drive)+{+ if (drive->using_dma) {+ ide_hwif_t *hwif = HWIF(drive);+ u8 unit = (drive->select.b.unit & 0x01);+ u8 dma_stat = hwif->INB(hwif->dma_status);++ hwif->OUTB((dma_stat | (1 << (5 + unit))), hwif->dma_status);+ return 0;+ }+ return 1;+}++int tangox_bmide_dma_host_off(ide_drive_t *drive)+{+ ide_hwif_t *hwif = HWIF(drive);+ u8 unit = (drive->select.b.unit & 0x01);+ u8 dma_stat = hwif->INB(hwif->dma_status);++ hwif->OUTB((dma_stat & ~(1 << (5 + unit))), hwif->dma_status);++ return 0;+}++int tangox_bmide_dma_check(ide_drive_t *drive)+{+ ide_hwif_t *hwif = HWIF(drive);+ struct hd_driveid *id = drive->id;+ u8 pio, speed;++ drive->init_speed = 0;++ /* check if the drive claim to dma-able */+ if ((id->capability & 1) && drive->autodma && ide_use_dma(drive)) {+ u8 mode;++#ifdef CONFIG_BLK_DEV_BMIDE_TANGOX_UDMA+ /* We can do all udma mode, but only with 80 conductor+ * cable */+ mode = 4;+ if ((gbus_readl(REG_BASE_host_interface ++ IDECTRL_idestatus) & 0x02) == 0x02) {+ printk("%s: no 80 conductors cable, falling back to "+ "lower udma mode\n", drive->name);+ mode = 1;+ }+#else+ mode = 0; /* max. MWDMA mode 2 */+#endif++ /* find a speed supported by the drive */+ speed = ide_dma_speed(drive, mode);++ if (speed >= XFER_MW_DMA_0) {+ /* ok, we have one, configure chipset for it+ * and apply speed to the drive */+ hwif->speedproc(drive, speed);+ return hwif->ide_dma_on(drive);+ }+ }++ /* fallback to pio mode */+ pio = ide_get_best_pio_mode(drive, 255, 5, NULL);+ speed = dma_2_pio(XFER_PIO_0 + pio) + XFER_PIO_0;+ hwif->speedproc(drive, speed);+ return hwif->ide_dma_off_quietly(drive);+}++int tangox_bmide_dma_on(ide_drive_t *drive)+{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -