[PATCH] Palmchip BK3710 IDE driver
This is Palmchip BK3710 IDE controller support for kernel version 2.6.24. The IDE controller logic supports PIO, multiword DMA and ultra-DMA modes. Supports interface to compact Flash (CF) configured in True-IDE mode. Signed-off-by: Anton Salnikov [EMAIL PROTECTED] --- drivers/ide/Kconfig |8 drivers/ide/arm/Makefile |1 drivers/ide/arm/palm_bk3710.c | 424 ++ drivers/ide/ide-proc.c|1 include/linux/ide.h |2 5 files changed, 435 insertions(+), 1 deletion(-) Index: 2.6.24.ide/drivers/ide/Kconfig === --- 2.6.24.ide.orig/drivers/ide/Kconfig +++ 2.6.24.ide/drivers/ide/Kconfig @@ -1008,6 +1008,14 @@ config BLK_DEV_Q40IDE normally be on; disable it only if you are running a custom hard drive subsystem through an expansion card. +config BLK_DEV_PALMCHIP_BK3710 + bool Palmchip bk3710 IDE controller support + depends on ARCH_DAVINCI + select BLK_DEV_IDEDMA_PCI + help + Say Y here if you want to support the onchip IDE controller on the + TI DaVinci SoC + config BLK_DEV_MPC8xx_IDE bool MPC8xx IDE support depends on 8xx (LWMON || IVMS8 || IVML24 || TQM8xxL) IDE=y BLK_DEV_IDE=y !PPC_MERGE Index: 2.6.24.ide/drivers/ide/arm/Makefile === --- 2.6.24.ide.orig/drivers/ide/arm/Makefile +++ 2.6.24.ide/drivers/ide/arm/Makefile @@ -2,5 +2,6 @@ obj-$(CONFIG_BLK_DEV_IDE_ICSIDE) += icside.o obj-$(CONFIG_BLK_DEV_IDE_RAPIDE) += rapide.o obj-$(CONFIG_BLK_DEV_IDE_BAST) += bast-ide.o +obj-$(CONFIG_BLK_DEV_PALMCHIP_BK3710) += palm_bk3710.o EXTRA_CFLAGS := -Idrivers/ide Index: 2.6.24.ide/drivers/ide/arm/palm_bk3710.c === --- /dev/null +++ 2.6.24.ide/drivers/ide/arm/palm_bk3710.c @@ -0,0 +1,424 @@ +/* + * Palmchip bk3710 IDE controller + * + * Copyright (C) 2006 Texas Instruments. + * Copyright (C) 2007 MontaVista Software, Inc., [EMAIL PROTECTED] + * + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + */ + +#include linux/types.h +#include linux/module.h +#include linux/kernel.h +#include linux/ioport.h +#include linux/hdreg.h +#include linux/ide.h +#include linux/delay.h +#include linux/init.h +#include linux/clk.h +#include linux/platform_device.h + +/* Offset of the primary interface registers */ +#define IDE_PALM_ATA_PRI_REG_OFFSET 0x1F0 + +/* Primary Control Offset */ +#define IDE_PALM_ATA_PRI_CTL_OFFSET 0x3F6 + +/* + * PalmChip 3710 IDE Controller UDMA timing structure Definition + */ +struct palm_bk3710_udmatiming { + unsigned int rptime;/* Ready to pause time */ + unsigned int cycletime; /* Cycle Time */ +}; + +#define BK3710_BMICP 0x00 +#define BK3710_BMISP 0x02 +#define BK3710_BMIDTP 0x04 +#define BK3710_BMICS 0x08 +#define BK3710_BMISS 0x0A +#define BK3710_BMIDTS 0x0C +#define BK3710_IDETIMP 0x40 +#define BK3710_IDETIMS 0x42 +#define BK3710_SIDETIM 0x44 +#define BK3710_SLEWCTL 0x45 +#define BK3710_IDESTATUS 0x47 +#define BK3710_UDMACTL 0x48 +#define BK3710_UDMATIM 0x4A +#define BK3710_MISCCTL 0x50 +#define BK3710_REGSTB 0x54 +#define BK3710_REGRCVR 0x58 +#define BK3710_DATSTB 0x5C +#define BK3710_DATRCVR 0x60 +#define BK3710_DMASTB 0x64 +#define BK3710_DMARCVR 0x68 +#define BK3710_UDMASTB 0x6C +#define BK3710_UDMATRP 0x70 +#define BK3710_UDMAENV 0x74 +#define BK3710_IORDYTMP0x78 +#define BK3710_IORDYTMS0x7C + +#include ../ide-timing.h + +static long ide_palm_clk; + +static const struct palm_bk3710_udmatiming palm_bk3710_udmatimings[6] = { + {160, 240}, /* UDMA Mode 0 */ + {125, 160}, /* UDMA Mode 1 */ + {100, 120}, /* UDMA Mode 2 */ + {100, 90}, /* UDMA Mode 3 */ + {85, 60
[PATCH] Palmchip BK3710 IDE driver
This is Palmchip BK3710 IDE controller support for kernel version 2.6.24-rc8. The IDE controller logic supports PIO, multiword DMA and ultra-DMA modes. Supports interface to compact Flash (CF) configured in True-IDE mode. Signed-off-by: Anton Salnikov [EMAIL PROTECTED] --- drivers/ide/Kconfig |8 drivers/ide/arm/Makefile |1 drivers/ide/arm/palm_bk3710.c | 428 ++ drivers/ide/ide-proc.c|1 include/linux/ide.h |2 5 files changed, 439 insertions(+), 1 deletion(-) Index: 2.6.24-rc8.ide/drivers/ide/Kconfig === --- 2.6.24-rc8.ide.orig/drivers/ide/Kconfig +++ 2.6.24-rc8.ide/drivers/ide/Kconfig @@ -1008,6 +1008,14 @@ config BLK_DEV_Q40IDE normally be on; disable it only if you are running a custom hard drive subsystem through an expansion card. +config BLK_DEV_PALMCHIP_BK3710 + bool Palmchip bk3710 IDE controller support + depends on ARCH_DAVINCI + select BLK_DEV_IDEDMA_PCI + help + Say Y here if you want to support the onchip IDE controller on the + TI DaVinci SoC + config BLK_DEV_MPC8xx_IDE bool MPC8xx IDE support depends on 8xx (LWMON || IVMS8 || IVML24 || TQM8xxL) IDE=y BLK_DEV_IDE=y !PPC_MERGE Index: 2.6.24-rc8.ide/drivers/ide/arm/Makefile === --- 2.6.24-rc8.ide.orig/drivers/ide/arm/Makefile +++ 2.6.24-rc8.ide/drivers/ide/arm/Makefile @@ -2,5 +2,6 @@ obj-$(CONFIG_BLK_DEV_IDE_ICSIDE) += icside.o obj-$(CONFIG_BLK_DEV_IDE_RAPIDE) += rapide.o obj-$(CONFIG_BLK_DEV_IDE_BAST) += bast-ide.o +obj-$(CONFIG_BLK_DEV_PALMCHIP_BK3710) += palm_bk3710.o EXTRA_CFLAGS := -Idrivers/ide Index: 2.6.24-rc8.ide/drivers/ide/arm/palm_bk3710.c === --- /dev/null +++ 2.6.24-rc8.ide/drivers/ide/arm/palm_bk3710.c @@ -0,0 +1,428 @@ +/* + * Palmchip bk3710 IDE controller + * + * Copyright (C) 2006 Texas Instruments. + * Copyright (C) 2007 MontaVista Software, Inc., [EMAIL PROTECTED] + * + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + */ + +#include linux/types.h +#include linux/module.h +#include linux/kernel.h +#include linux/ioport.h +#include linux/hdreg.h +#include linux/ide.h +#include linux/delay.h +#include linux/init.h +#include linux/clk.h +#include linux/platform_device.h + +/* Offset of the primary interface registers */ +#define IDE_PALM_ATA_PRI_REG_OFFSET 0x1F0 + +/* Primary Control Offset */ +#define IDE_PALM_ATA_PRI_CTL_OFFSET 0x3F6 + +/* + * PalmChip 3710 IDE Controller UDMA timing structure Definition + */ +struct palm_bk3710_udmatiming { + unsigned int rptime;/* Ready to pause time */ + unsigned int cycletime; /* Cycle Time */ +}; + +#define BK3710_BMICP 0x00 +#define BK3710_BMISP 0x02 +#define BK3710_BMIDTP 0x04 +#define BK3710_BMICS 0x08 +#define BK3710_BMISS 0x0A +#define BK3710_BMIDTS 0x0C +#define BK3710_IDETIMP 0x40 +#define BK3710_IDETIMS 0x42 +#define BK3710_SIDETIM 0x44 +#define BK3710_SLEWCTL 0x45 +#define BK3710_IDESTATUS 0x47 +#define BK3710_UDMACTL 0x48 +#define BK3710_UDMATIM 0x4A +#define BK3710_MISCCTL 0x50 +#define BK3710_REGSTB 0x54 +#define BK3710_REGRCVR 0x58 +#define BK3710_DATSTB 0x5C +#define BK3710_DATRCVR 0x60 +#define BK3710_DMASTB 0x64 +#define BK3710_DMARCVR 0x68 +#define BK3710_UDMASTB 0x6C +#define BK3710_UDMATRP 0x70 +#define BK3710_UDMAENV 0x74 +#define BK3710_IORDYTMP0x78 +#define BK3710_IORDYTMS0x7C + +#include ../ide-timing.h + +static long ide_palm_clk; + +static const struct palm_bk3710_udmatiming palm_bk3710_udmatimings[6] = { + {160, 240}, /* UDMA Mode 0 */ + {125, 160}, /* UDMA Mode 1 */ + {100, 120}, /* UDMA Mode 2 */ + {100, 90}, /* UDMA Mode
Re: [PATCH] Palmchip BK3710 IDE driver
+static inline u32 ioread(u32 reg) +{ + return ioread32(base + reg); +} + +static inline void iowrite(u32 val, u32 reg) +{ + iowrite32(val, base + reg); +} Why not just use ioread32/iowrite32 directly ? Because this increases readability and does not affect functionality at all Otherwise this looks way way better. Alan Anton - To unsubscribe from this list: send the line unsubscribe linux-ide in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Palmchip BK3710 IDE driver
This is Palmchip BK3710 IDE controller support for kernel version 2.6.24-rc8. The IDE controller logic supports PIO, multiword DMA and ultra-DMA modes. Supports interface to compact Flash (CF) configured in True-IDE mode. Use ide_setup_dma() since BLK_DEV_PALMCHIP_BK3710 selects BLK_DEV_IDEDMA_PCI So I deleted exports from ide-dma.c Signed-off-by: Anton Salnikov [EMAIL PROTECTED] --- drivers/ide/Kconfig |8 drivers/ide/arm/Makefile |1 drivers/ide/arm/palm_bk3710.c | 434 ++ drivers/ide/ide-proc.c|1 include/linux/ide.h |2 5 files changed, 445 insertions(+), 1 deletion(-) Index: 2.6.24-rc8.ide/drivers/ide/Kconfig === --- 2.6.24-rc8.ide.orig/drivers/ide/Kconfig +++ 2.6.24-rc8.ide/drivers/ide/Kconfig @@ -1008,6 +1008,14 @@ config BLK_DEV_Q40IDE normally be on; disable it only if you are running a custom hard drive subsystem through an expansion card. +config BLK_DEV_PALMCHIP_BK3710 + bool Palmchip bk3710 IDE controller support + depends on ARCH_DAVINCI + select BLK_DEV_IDEDMA_PCI + help + Say Y here if you want to support the onchip IDE controller on the + TI DaVinci SoC + config BLK_DEV_MPC8xx_IDE bool MPC8xx IDE support depends on 8xx (LWMON || IVMS8 || IVML24 || TQM8xxL) IDE=y BLK_DEV_IDE=y !PPC_MERGE Index: 2.6.24-rc8.ide/drivers/ide/arm/Makefile === --- 2.6.24-rc8.ide.orig/drivers/ide/arm/Makefile +++ 2.6.24-rc8.ide/drivers/ide/arm/Makefile @@ -2,5 +2,6 @@ obj-$(CONFIG_BLK_DEV_IDE_ICSIDE) += icside.o obj-$(CONFIG_BLK_DEV_IDE_RAPIDE) += rapide.o obj-$(CONFIG_BLK_DEV_IDE_BAST) += bast-ide.o +obj-$(CONFIG_BLK_DEV_PALMCHIP_BK3710) += palm_bk3710.o EXTRA_CFLAGS := -Idrivers/ide Index: 2.6.24-rc8.ide/drivers/ide/arm/palm_bk3710.c === --- /dev/null +++ 2.6.24-rc8.ide/drivers/ide/arm/palm_bk3710.c @@ -0,0 +1,434 @@ +/* + * Palmchip bk3710 IDE controller + * + * Copyright (C) 2006 Texas Instruments. + * Copyright (C) 2007 MontaVista Software, Inc., [EMAIL PROTECTED] + * + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * + */ + +#include linux/types.h +#include linux/module.h +#include linux/kernel.h +#include linux/ioport.h +#include linux/hdreg.h +#include linux/ide.h +#include linux/delay.h +#include linux/init.h +#include linux/clk.h +#include linux/platform_device.h + +/* Offset of the primary interface registers */ +#define IDE_PALM_ATA_PRI_REG_OFFSET 0x1F0 + +/* Primary Control Offset */ +#define IDE_PALM_ATA_PRI_CTL_OFFSET 0x3F6 + +/* + * PalmChip 3710 IDE Controller UDMA timing structure Definition + */ +struct palm_bk3710_udmatiming { + unsigned int rptime;/* Ready to pause time */ + unsigned int cycletime; /* Cycle Time */ +}; + +#define BK3710_BMICP 0x00 +#define BK3710_BMISP 0x02 +#define BK3710_BMIDTP 0x04 +#define BK3710_BMICS 0x08 +#define BK3710_BMISS 0x0A +#define BK3710_BMIDTS 0x0C +#define BK3710_IDETIMP 0x40 +#define BK3710_IDETIMS 0x42 +#define BK3710_SIDETIM 0x44 +#define BK3710_SLEWCTL 0x45 +#define BK3710_IDESTATUS 0x47 +#define BK3710_UDMACTL 0x48 +#define BK3710_UDMATIM 0x4A +#define BK3710_MISCCTL 0x50 +#define BK3710_REGSTB 0x54 +#define BK3710_REGRCVR 0x58 +#define BK3710_DATSTB 0x5C +#define BK3710_DATRCVR 0x60 +#define BK3710_DMASTB 0x64 +#define BK3710_DMARCVR 0x68 +#define BK3710_UDMASTB 0x6C +#define BK3710_UDMATRP 0x70 +#define BK3710_UDMAENV 0x74 +#define BK3710_IORDYTMP0x78 +#define BK3710_IORDYTMS0x7C + +#include ../ide-timing.h + +static long ide_palm_clk; +static u32 base; + +static const struct palm_bk3710_udmatiming palm_bk3710_udmatimings[6] = { + {160, 240}, /* UDMA Mode 0 */ + {125
[PATCH] Palmchip BK3710 IDE driver
This is Palmchip BK3710 IDE controller support for kernel version 2.6.24-rc8. The IDE controller logic supports PIO, multiword DMA and ultra-DMA modes. Supports interface to compact Flash (CF) configured in True-IDE mode. I had to export two functions (ide_dma_exec_cmd and __ide_dma_test_irq) from driver/ide/ide-dma.c to get rid of copying them. Signed-off-by: Anton Salnikov [EMAIL PROTECTED] --- drivers/ide/Kconfig |8 drivers/ide/arm/Makefile |1 drivers/ide/arm/palm_bk3710.c | 486 ++ drivers/ide/ide-dma.c |6 drivers/ide/ide-proc.c|1 include/linux/ide.h |4 6 files changed, 503 insertions(+), 3 deletions(-) Index: 2.6.24-rc7.ide/drivers/ide/Kconfig === --- 2.6.24-rc7.ide.orig/drivers/ide/Kconfig +++ 2.6.24-rc7.ide/drivers/ide/Kconfig @@ -1008,6 +1008,14 @@ config BLK_DEV_Q40IDE normally be on; disable it only if you are running a custom hard drive subsystem through an expansion card. +config BLK_DEV_PALMCHIP_BK3710 + bool Palmchip bk3710 IDE controller support + depends on ARCH_DAVINCI + select BLK_DEV_IDEDMA_PCI + help + Say Y here if you want to support the onchip IDE controller on the + TI DaVinci SoC + config BLK_DEV_MPC8xx_IDE bool MPC8xx IDE support depends on 8xx (LWMON || IVMS8 || IVML24 || TQM8xxL) IDE=y BLK_DEV_IDE=y !PPC_MERGE Index: 2.6.24-rc7.ide/drivers/ide/arm/Makefile === --- 2.6.24-rc7.ide.orig/drivers/ide/arm/Makefile +++ 2.6.24-rc7.ide/drivers/ide/arm/Makefile @@ -2,5 +2,6 @@ obj-$(CONFIG_BLK_DEV_IDE_ICSIDE) += icside.o obj-$(CONFIG_BLK_DEV_IDE_RAPIDE) += rapide.o obj-$(CONFIG_BLK_DEV_IDE_BAST) += bast-ide.o +obj-$(CONFIG_BLK_DEV_PALMCHIP_BK3710) += palm_bk3710.o EXTRA_CFLAGS := -Idrivers/ide Index: 2.6.24-rc7.ide/drivers/ide/arm/palm_bk3710.c === --- /dev/null +++ 2.6.24-rc7.ide/drivers/ide/arm/palm_bk3710.c @@ -0,0 +1,486 @@ +/* + * Palmchip bk3710 IDE controller + * + * Copyright (C) 2006 Texas Instruments. + * Copyright (C) 2007 MontaVista Software, Inc., [EMAIL PROTECTED] + * + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + Modifications: + ver. 1.0: Oct 2005, Swaminathan S + - + * + */ + +#include linux/types.h +#include linux/module.h +#include linux/kernel.h +#include linux/ioport.h +#include linux/hdreg.h +#include linux/ide.h +#include linux/delay.h +#include linux/init.h +#include linux/clk.h +#include linux/platform_device.h + +/* Offset of the primary interface registers */ +#define IDE_PALM_ATA_PRI_REG_OFFSET 0x1F0 + +/* Primary Control Offset */ +#define IDE_PALM_ATA_PRI_CTL_OFFSET 0x3F6 + +/* + * PalmChip 3710 IDE Controller UDMA timing structure Definition + */ +struct palm_bk3710_udmatiming { + unsigned int rptime;/* Ready to pause time */ + unsigned int cycletime; /* Cycle Time */ +}; + +/* + * Register Layout Structure for DmaEngine + */ +struct palm_bk3710_dmaengineregs { + unsigned short bmicp; + unsigned short bmisp; + unsigned int bmidtp; + unsigned short bmics; + unsigned short bmiss; + unsigned int bmidts; +}; + +/* + * Register Layout Structure for Config + */ +struct palm_bk3710_ideconfigregs { + unsigned short idetimp __attribute__((packed)); + unsigned short idetims __attribute__((packed)); + unsigned char sidetim; + unsigned short slewctl __attribute__((packed)); + unsigned char idestatus; + unsigned short udmactl __attribute__((packed)); + unsigned short udmatim __attribute__((packed)); + unsigned char rsvd0[4]; + unsigned int miscctl __attribute__((packed)); + unsigned int regstb __attribute__((packed)); + unsigned int regrcvr __attribute__((packed)); + unsigned int datstb __attribute__((packed)); + unsigned int datrcvr __attribute__((packed)); + unsigned int dmastb __attribute__