tdc: added DMA helper functions

They are declared in tdc-dma.c file
Signed-off-by: Samuel Iglesias Gonsálvez's avatarSamuel Iglesias Gonsálvez <siglesias@igalia.com>
parent ece19872
......@@ -13,7 +13,7 @@ subdirs-ccflags-y = $(ccflags-y)
obj-m := spec-tdc.o
spec-tdc-objs = tdc-core.o tdc-zio.o tdc-fmc.o tdc-acam.o
spec-tdc-objs = tdc-core.o tdc-zio.o tdc-fmc.o tdc-acam.o tdc-dma.o
all: modules
......
/*
* DMA support for tdc driver
*
* Copyright (C) 2012 CERN (http://www.cern.ch)
* Author: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2 as published by the Free Software Foundation.
*/
#include <asm/io.h>
#include "tdc.h"
#include "hw/tdc_regs.h"
/*
* tdc_dma_setup -- Setup DMA operation
*
* @tdc: pointer to spec_tdc struct of the device
* @src: address to copy the data from (in TDC board)
* @dst: address to copy the data to (in host computer)
* @size: size of the DMA transfer (in bytes)
*
*/
int tdc_dma_setup(struct spec_tdc *tdc, unsigned long src, unsigned long dst, int size)
{
/* Write the source and destination addresses */
writel(src, tdc->base + TDC_DMA_C_START_R);
writel(dst & 0x00ffffffff, tdc->base + TDC_DMA_H_START_L_R);
writel(dst >> 32, tdc->base + TDC_DMA_H_START_H_R);
/* Write the DMA length */
writel(size, tdc->base + TDC_DMA_LEN_R);
return 0;
}
int tdc_dma_start(struct spec_tdc *tdc)
{
writel(0x1, tdc->base + TDC_DMA_CTRL_R);
return 0;
}
......@@ -96,8 +96,8 @@ int tdc_fmc_remove(struct fmc_device *dev)
int tdc_fmc_init(void)
{
tdc_fmc_driver.probe = tdc_probe;
tdc_fmc_driver.remove = tdc_remove;
tdc_fmc_driver.probe = tdc_fmc_probe;
tdc_fmc_driver.remove = tdc_fmc_remove;
fmc_driver_register(&tdc_fmc_driver);
return 0;
}
......
......@@ -3,6 +3,8 @@
#define TDC_VERSION 1
#include <linux/types.h>
struct spec_tdc {
struct fmc_device *fmc;
struct spec_dev *spec;
......@@ -53,14 +55,21 @@ void tdc_fmc_exit(void);
void tdc_acam_reset(struct spec_tdc *tdc);
int tdc_acam_load_config(struct spec_tdc *tdc, struct tdc_acam_cfg *cfg);
int tdc_acam_get_config(struct spec_tdc *tdc, struct tdc_acam_cfg *cfg);
int tdc_acam_set_default_config(struct spec_tdc *tdc);
u32 tdc_acam_status(struct spec_tdc *tdc);
u32 tdc_acam_read_ififo1(struct spec_tdc *tdc);
u32 tdc_acam_read_ififo2(struct spec_tdc *tdc);
u32 tdc_acam_read_start01(struct spec_tdc *tdc);
/* DMA helper functions */
int tdc_dma_setup(struct spec_tdc *tdc, unsigned long src, unsigned long dst, int size);
int tdc_dma_start(struct spec_tdc *tdc);
/* Core functions */
int tdc_probe(struct fmc_device *dev);
int tdc_remove(struct fmc_device *dev);
int tdc_fmc_probe(struct fmc_device *dev);
int tdc_fmc_remove(struct fmc_device *dev);
int tdc_set_utc_time(struct spec_tdc *tdc);
u32 tdc_get_utc_time(struct spec_tdc *tdc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment