Palmchip BK3710 IDE driver
PATCH 1/1 Palmchip BK3710 IDE driver
I've tested the driver on 2.6.24.
I've made the changes you asked for. But when I tested them on arm/mach-davinci architecture on the current Linus' git there was link error undefined reference to symbol ide_hwif_setup_dma().
However on x86_64 architecture it compiles well without any warnings with respect to link error of undefined clk_get() clk_enable() clk_get_rate(), which are not present in this architecture.
Quoted 1 line
I've just noticed that there is no cable detection for UDMA modes > UDMA2?
For the present controller in documentation: Cable Select (CSEL) - unsupported IDE controller signal. This signal is not necessary because an 80-conductor cable must be used with the DM644x.
---
drivers/ide/Kconfig | 9 drivers/ide/arm/Makefile | 1 drivers/ide/arm/palm_bk3710.c | 420 ++++++++++++++++++++++++++++++++++++++++++ drivers/ide/ide-proc.c | 1 include/linux/ide.h | 2 5 files changed, 432 insertions(+), 1 deletion(-)
drivers/ide/Kconfig +9 -0
@@ -1009,6 +1009,15 @@ 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 + tristate "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 tristate "MPC8xx IDE support" depends on 8xx && (LWMON || IVMS8 || IVML24 || TQM8xxL) && IDE=y &&
BLK_DEV_IDE=y && !PPC_MERGE
drivers/ide/arm/Makefile +1 -0
@@ -2,6 +2,7 @@ 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 ifeq ($(CONFIG_IDE_ARM), m) obj-m += ide_arm.o
drivers/ide/arm/palm_bk3710.c new file +420 -0
420 lines not on this page · raw message
drivers/ide/ide-proc.c +1 -0
@@ -65,6 +65,7 @@ static int proc_ide_read_imodelcase ide_4drives: name ="4drives" ;break ;case ide_pmac: name ="mac-io" ;break ;case ide_au1xxx: name ="au1xxx" ;break ; +case ide_palm3710: name ="palm3710" ;break ;case ide_etrax100: name ="etrax100" ;break ;case ide_acorn: name ="acorn" ;break ;default : name ="(unknown)" ;break ;
include/linux/ide.h +1 -1
@@ -173,7 +173,7 @@ enum { ide_unknown, ide_generic, ide_pc ide_rz1000, ide_trm290, ide_cmd646, ide_cy82c693, ide_4drives, ide_pmac, ide_etrax100, ide_acorn, - ide_au1xxx, ide_forced + ide_au1xxx, ide_palm3710, ide_forced };typedef u8 hwif_chipset_t ;
Quoted 3 lines · Anton Salnikov
I've tested the driver on 2.6.24.
I've made the changes you asked for. But when I tested them on arm/mach-davinci
Thanks!
Quoted 5 lines
architecture on the current Linus' git there was link error undefined reference to symbol
ide_hwif_setup_dma().
However onx86_64architecture it compiles well without any warnings with respect to link error of undefinedclk_get()clk_enable()clk_get_rate(), which are not present in this architecture.
ide_hwif_setup_dma() comes from setup-pci.c which depends on BLK_DEV_IDEPCI. palm_bk3710 host driver selects BLK_DEV_IDEDMA_PCI which should also select BLK_DEV_IDEPCI but PCI doesn't even seem to be supported by this ARM platform.
I (hopefully) workarounded the issue by adding an additional #ifdef to <linux/ide.h> but it is a unmaintanable and ugly hack:
include/linux/ide.h +2 -1
@@ -1014,7 +1014,8 @@ extern int __ide_pci_register_driver(strvoid ide_pci_setup_ports (struct pci_dev *,const struct ide_port_info *,int ,u8 *);void ide_setup_pci_noise (struct pci_dev *,const struct ide_port_info *); -#ifdef CONFIG_BLK_DEV_IDEDMA_PCI +/* FIXME: palm_bk3710 uses BLK_DEV_IDEDMA_PCI without BLK_DEV_IDEPCI! */ +#if defined(CONFIG_BLK_DEV_IDEPCI ) && defined(CONFIG_BLK_DEV_IDEDMA_PCI )void ide_hwif_setup_dma (ide_hwif_t *,const struct ide_port_info *);#else static inline void ide_hwif_setup_dma(ide_hwif_t *hwif,
Anton/Sergei: please look into fixing it properly - we probably just need to to have a new config option (CONFIG_IDE_SFF_DMA sounds neat) to be selected by both BLK_DEV_{IDEDMA_PCI,PALMCHIP_BK3710} and to replace BLK_DEV_IDEDMA_PCI #ifdefs in ide-dma.c.
Quoted 6 lines
Quoted 1 line
I've just noticed that there is no cable detection for UDMA modes > UDMA2?
For the present controller in documentation: Cable Select (CSEL) - unsupported IDE controller signal. This signal is not necessary because an 80-conductor cable must be used with the DM644x.
Signed-off-by Anton Salnikov <[email protected]>
Minor issue: the original patch description got lost somehow so I just used the one from the previous version.
Quoted 46 lines
---
drivers/ide/Kconfig | 9 drivers/ide/arm/Makefile | 1 drivers/ide/arm/palm_bk3710.c | 420 ++++++++++++++++++++++++++++++++++++++++++ drivers/ide/ide-proc.c | 1 include/linux/ide.h | 2 5 files changed, 432 insertions(+), 1 deletion(-)Index: 2.6.25.ide/drivers/ide/Kconfig
===================================================================drivers/ide/Kconfig +9
-0@@ -1009,6 +1009,15 @@ 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 + tristate "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 tristate "MPC8xx IDE support" depends on 8xx && (LWMON || IVMS8 || IVML24 || TQM8xxL) && IDE=y &&BLK_DEV_IDE=y && !PPC_MERGE
Index: 2.6.25.ide/drivers/ide/arm/Makefile
===================================================================drivers/ide/arm/Makefile +1
-0@@ -2,6 +2,7 @@ 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 ifeq ($(CONFIG_IDE_ARM), m) obj-m += ide_arm.oIndex:
2.6.25.ide/drivers/ide/arm/palm_bk3710.c
===================================================================drivers/ide/arm/palm_bk3710.c new file +0
-0
[...]
Quoted 14 lines
drivers/ide/arm/palm_bk3710.c new file +14
-0+/*static inline u8 hwif_read8(u32 base, u32 reg) +{ +return readb(base + reg); +} + +static inline u16 hwif_read16(u32 base, u32 reg) +{ +return readw(base + reg); +} + +static inline void hwif_write16(u32 base, u16 val, u32 reg) +{ +writew(val, base + reg); +}
drivers/ide/arm/palm_bk3710.c
Quoted 10 lines
drivers/ide/arm/palm_bk3710.c new file +10
-0+ +static inline u32 hwif_read32(u32 base, u32 reg) +{ +return readl(base + reg); +} + +static inline void hwif_write32(u32 base, u32 val, u32 reg) +{ +writel(val, base + reg); +}*/
I removed this chunk while merging the patch (no need for a dead code)
also added "Reviewed-by:" tags crediting Alan & Sergei
Quoted 1 line · Anton Salnikov
I've tested the driver on 2.6.24.
Unfortunately, I've never seen the platofrm device registration code until
now...
Quoted 7 lines
Signed-off-by Anton Salnikov <[email protected]>Index:
2.6.25.ide/drivers/ide/arm/palm_bk3710.c
===================================================================drivers/ide/arm/palm_bk3710.c new file +0
-0@@ -0,0 +1,420 @@
[...]
drivers/ide/arm/palm_bk3710.c line 371
Quoted 12 lines
drivers/ide/arm/palm_bk3710.c new file +12
-0+ mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (mem ==NULL ) { +printk (KERN_ERR "failed to get memory region resource\n" ); +return -ENODEV ; + } + irq =platform_get_resource (pdev,IORESOURCE_IRQ ,0 ); +if (irq ==NULL ) { +printk (KERN_ERR "failed to get IRQ resource\n" ); +return -ENODEV ; + } + + base = (void *)mem->start;
Crrap! You shouldn't specify virtual addresses in the device resources
whatever arch you are using. Should've been ioremap() here. And where did only my eyes were?
MBR, Sergei