Resubmit munged patch -- [PATCH] Add ATA bestcomm dma support for MPC5200.
Dale noticed that the previous patch had been munged my my mailer. Sorry about that.
Subject: [PATCH] Add ATA bestcomm dma support for MPC5200.
This works on the Lite5200B platform with some caveats. The board seems to have a layout issue so the ata signals have a noise problem. You need to use an UDMA cable even though the connector on the board does not allow most UDMA cables to be plugged in. To get around this you can remove the key pin on the board connector or poke a hole in the cable connector. You also want to use the shortest cable you can get. I ended up cutting the cable just past the slave connector.
Even with the above changes some drives will not work. With the right cable and the right drive you can do UDMA1.
I have not tested this on the old Lite5200 but it is my understanding that the older silicon has issues that make UDMA not work. MDMA should work though.
---
arch/ppc/syslib/bestcomm/Makefile | 1 arch/ppc/syslib/bestcomm/ata.c | 143 +++++++ arch/ppc/syslib/bestcomm/ata.h | 49 ++ arch/ppc/syslib/bestcomm/bestcomm.c | 4 arch/ppc/syslib/bestcomm/bestcomm.h | 27 + arch/ppc/syslib/bestcomm/sdma_ata_task.c | 61 +++ arch/ppc/syslib/mpc52xx_setup.c | 7 drivers/ide/Kconfig | 11 + drivers/ide/ppc/mpc52xx_ide.c | 640 +++++++++++++++++++++++++++++- 9 files changed, 915 insertions(+), 28 deletions(-) create mode 100644 arch/ppc/syslib/bestcomm/ata.c create mode 100644 arch/ppc/syslib/bestcomm/ata.h create mode 100644 arch/ppc/syslib/bestcomm/sdma_ata_task.c
01a9cf3296c225320105d26201fe7e86596a2ad5
arch/ppc/syslib/bestcomm/Makefile +1 -0
@@ -1,2 +1,3 @@ obj-$(CONFIG_PPC_BESTCOMM) += bestcomm.o obj-$(CONFIG_FEC_MPC52xx) += sdma_fec_rx_task.o sdma_fec_tx_task.o fec.o +obj-$(CONFIG_BLK_DEV_MPC52xx_IDE_DMA) += sdma_ata_task.o ata.o
arch/ppc/syslib/bestcomm/ata.c new file +143 -0
143 lines not on this page · raw message
arch/ppc/syslib/bestcomm/ata.h new file +49 -0
49 lines not on this page · raw message
arch/ppc/syslib/bestcomm/bestcomm.c +2 -2
@@ -43,12 +43,12 @@ static spinlock_t sdma_lock = SPIN_LOCK_void sdma_dump (void ) {int i; -printk ("** SDMA registers: pa = %08x, va = %08x\n" , sdma.base_reg_addr, sdma.io); + +printk ("** SDMA registers: pa = %08x, va = %08x\n" , (u32 )sdma.base_reg_addr, (u32 )sdma.io);printk ("** taskBar = %08x\n" , sdma.io->taskBar);printk ("** currentPointer = %08x\n" , sdma.io->currentPointer);printk ("** endPointer = %08x\n" , sdma.io->endPointer);printk ("** variablePointer = %08x\n" , sdma.io->variablePointer); -printk ("** IntVect1 = %08x\n" , sdma.io->IntVect1);printk ("** IntVect2 = %08x\n" , sdma.io->IntVect2);printk ("** PtdCntrl = %08x\n" , sdma.io->PtdCntrl);
arch/ppc/syslib/bestcomm/bestcomm.h +25 -2
@@ -237,7 +237,7 @@ static inline int sdma_desc_initiator(u3static inline void sdma_set_desc_initiator (u32 *desc,int initiator) { *desc = (*desc & ~(0x1f <<SDMA_DRD_INITIATOR_SHIFT )) | - ((initiator <<SDMA_DRD_INITIATOR_SHIFT ) &0x1f ); + ((initiator &0x1f ) <<SDMA_DRD_INITIATOR_SHIFT ); } static inline void sdma_submit_buffer(struct sdma *s, void *cookie, void *data,
@@ -284,12 +284,23 @@ static inline void *sdma_retrieve_bufferreturn cookie; } +static inline void sdma_reset_buffers (struct sdma *s) +{ +while (!sdma_queue_empty (s)) { + s->bd[s->outdex].status =0 ; + s->bd[s->outdex].data =0 ; +sdma_retrieve_buffer (s,NULL ); + } + s->index = s->outdex =0 ; +} +static inline void sdma_submit_buffer2 (struct sdma *s,void *cookie,void *data1,void *data2,int length) {#ifdef CONFIG_BESTCOMM_DEBUG BUG_ON (!(s->flags &SDMA_FLAGS_BD2 ));#endif + s->cookie[s->index] = cookie; s->bd2[s->index].data1 = data1; s->bd2[s->index].data2 = data2;
@@ -312,6 +323,17 @@ static inline void *sdma_retrieve_bufferreturn cookie; } +static inline void sdma_reset_buffers2 (struct sdma *s) +{ +while (!sdma_queue_empty (s)) { + s->bd2[s->outdex].status =0 ; + s->bd2[s->outdex].data1 =0 ; + s->bd2[s->outdex].data2 =0 ; +sdma_retrieve_buffer2 (s,NULL ); + } + s->index = s->outdex =0 ; +} +#define SDMA_TASK_MAGIC 0x4243544B/* 'BCTK' */ /* the size fields are given in number of 32-bit words */
@@ -351,7 +373,7 @@ static inline int sdma_desc_is_drd(u32 d (0 <<SDMA_PRAGMA_BIT_RST_ERROR_NO ) | \ (0 <<SDMA_PRAGMA_BIT_PACK ) | \ (0 <<SDMA_PRAGMA_BIT_INTEGER ) | \ - (1 <<SDMA_PRAGMA_BIT_SPECREAD ) | \ + (0 <<SDMA_PRAGMA_BIT_SPECREAD ) | \ (1 <<SDMA_PRAGMA_BIT_CW ) | \ (1 << SDMA_PRAGMA_BIT_RL))
@@ -469,6 +491,7 @@ extern int sdma_load_task(u32 *task_imagextern void *sdma_sram_alloc (int size,int alignment,u32 *dma_handle);extern void sdma_init_bd (struct sdma *s);extern void sdma_init_bd2 (struct sdma *s); +extern void sdma_set_initiator (int task,int initiator);#define FIELD_OFFSET (s,f) ((unsigned long)(&(((struct s*)0)->f)))
arch/ppc/syslib/bestcomm/sdma_ata_task.c new file +61 -0
61 lines not on this page · raw message
arch/ppc/syslib/mpc52xx_setup.c +3 -4
@@ -220,7 +220,6 @@ mpc52xx_calibrate_decr(void) tb_to_us =mulhwu_scale_factor (xlbfreq / divisor,1000000 ); } -void __init mpc52xx_setup_cpu (void ) {
@@ -247,8 +246,9 @@ mpc52xx_setup_cpu(void)out_be16 (&cdm->fd_counters,0x5555 );/* Configure the XLB Arbiter priorities */ -out_be32 (&xlb->master_pri_enable,0xff ); -out_be32 (&xlb->master_priority,0x11111111 ); +/* Give PPC and BestComm the same priority on the XLB */ +out_be32 (&xlb->master_pri_enable,0xf ); +out_be32 (&xlb->master_priority,0x00007131 );/* Enable ram snooping for 1GB window */ out_be32 (&xlb->config,in_be32 (&xlb->config) | MPC52xx_XLB_CFG_SNOOP);
@@ -265,7 +265,6 @@ unmap_regs:if (xlb)iounmap (xlb); } -int mpc52xx_match_psc_function (int psc_idx,const char *func) {struct mpc52xx_psc_func *cf = mpc52xx_psc_functions;
drivers/ide/Kconfig +11 -0
@@ -973,6 +973,17 @@ config BLK_DEV_MPC52xx_IDE tristate "MPC52xx Builtin IDE support" depends on PPC_MPC52xx && IDE=y +config BLK_DEV_MPC52xx_IDE_MDMA + bool "MDMA support" + depends on BLK_DEV_MPC52xx_IDE + +config BLK_DEV_MPC52xx_IDE_UDMA + bool "UDMA support" + depends on BLK_DEV_MPC52xx_IDE + +config BLK_DEV_MPC52xx_IDE_DMA + def_bool BLK_DEV_MPC52xx_IDE_UDMA || BLK_DEV_MPC52xx_IDE_MDMA + # no isa -> no vlb config IDE_CHIPSETS bool "Other IDE chipset support"
drivers/ide/ppc/mpc52xx_ide.c +620 -20
737 lines not on this page · raw message
Signature · 1 line
1.1.3