Changeset View
Changeset View
Standalone View
Standalone View
sys/arm/ti/ti_edma3.c
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | |||||
#include <machine/bus.h> | #include <machine/bus.h> | ||||
#include <sys/rman.h> | #include <sys/rman.h> | ||||
#include <machine/resource.h> | #include <machine/resource.h> | ||||
#include <dev/ofw/ofw_bus.h> | #include <dev/ofw/ofw_bus.h> | ||||
#include <dev/ofw/ofw_bus_subr.h> | #include <dev/ofw/ofw_bus_subr.h> | ||||
#include <arm/ti/ti_scm.h> | #include <arm/ti/ti_scm.h> | ||||
#include <arm/ti/ti_prcm.h> | #include <arm/ti/ti_sysc.h> | ||||
#include <arm/ti/ti_edma3.h> | #include <arm/ti/ti_edma3.h> | ||||
#define TI_EDMA3_NUM_TCS 3 | #define TI_EDMA3_NUM_TCS 3 | ||||
#define TI_EDMA3_NUM_IRQS 3 | #define TI_EDMA3_NUM_IRQS 3 | ||||
#define TI_EDMA3_NUM_DMA_CHS 64 | #define TI_EDMA3_NUM_DMA_CHS 64 | ||||
#define TI_EDMA3_NUM_QDMA_CHS 8 | #define TI_EDMA3_NUM_QDMA_CHS 8 | ||||
▲ Show 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | ti_edma3_attach(device_t dev) | ||||
/* Request the IRQ resources */ | /* Request the IRQ resources */ | ||||
err = bus_alloc_resources(dev, ti_edma3_irq_spec, sc->irq_res); | err = bus_alloc_resources(dev, ti_edma3_irq_spec, sc->irq_res); | ||||
if (err) { | if (err) { | ||||
device_printf(dev, "Error: could not allocate irq resources\n"); | device_printf(dev, "Error: could not allocate irq resources\n"); | ||||
return (ENXIO); | return (ENXIO); | ||||
} | } | ||||
/* FIXME: Require DTS from Linux kernel 5.7 */ | |||||
/* FIXME: OK to enable clkctrl here? */ | |||||
/* Enable Channel Controller */ | /* Enable Channel Controller */ | ||||
ti_prcm_clk_enable(EDMA_TPCC_CLK); | ti_sysc_clock_enable(device_get_parent(dev)); | ||||
reg = ti_edma3_cc_rd_4(TI_EDMA3CC_PID); | reg = ti_edma3_cc_rd_4(TI_EDMA3CC_PID); | ||||
device_printf(dev, "EDMA revision %08x\n", reg); | device_printf(dev, "EDMA revision %08x\n", reg); | ||||
/* Attach interrupt handlers */ | /* Attach interrupt handlers */ | ||||
for (i = 0; i < TI_EDMA3_NUM_IRQS; ++i) { | for (i = 0; i < TI_EDMA3_NUM_IRQS; ++i) { | ||||
Show All 19 Lines | |||||
static driver_t ti_edma3_driver = { | static driver_t ti_edma3_driver = { | ||||
"ti_edma3", | "ti_edma3", | ||||
ti_edma3_methods, | ti_edma3_methods, | ||||
sizeof(struct ti_edma3_softc), | sizeof(struct ti_edma3_softc), | ||||
}; | }; | ||||
static devclass_t ti_edma3_devclass; | static devclass_t ti_edma3_devclass; | ||||
DRIVER_MODULE(ti_edma3, simplebus, ti_edma3_driver, ti_edma3_devclass, 0, 0); | DRIVER_MODULE(ti_edma3, simplebus, ti_edma3_driver, ti_edma3_devclass, 0, 0); | ||||
MODULE_DEPEND(ti_edma3, ti_prcm, 1, 1, 1); | MODULE_DEPEND(ti_edma3, ti_sysc, 1, 1, 1); | ||||
static void | static void | ||||
ti_edma3_intr_comp(void *arg) | ti_edma3_intr_comp(void *arg) | ||||
{ | { | ||||
printf("%s: unimplemented\n", __func__); | printf("%s: unimplemented\n", __func__); | ||||
} | } | ||||
static void | static void | ||||
ti_edma3_intr_mperr(void *arg) | ti_edma3_intr_mperr(void *arg) | ||||
{ | { | ||||
printf("%s: unimplemented\n", __func__); | printf("%s: unimplemented\n", __func__); | ||||
} | } | ||||
static void | static void | ||||
ti_edma3_intr_err(void *arg) | ti_edma3_intr_err(void *arg) | ||||
{ | { | ||||
printf("%s: unimplemented\n", __func__); | printf("%s: unimplemented\n", __func__); | ||||
} | } | ||||
void | void | ||||
ti_edma3_init(unsigned int eqn) | ti_edma3_init(unsigned int eqn) | ||||
{ | { | ||||
uint32_t reg; | uint32_t reg; | ||||
int i; | int i; | ||||
/* on AM335x Event queue 0 is always mapped to Transfer Controller 0, | |||||
* event queue 1 to TC2, etc. So we are asking PRCM to power on specific | |||||
* TC based on what event queue we need to initialize */ | |||||
ti_prcm_clk_enable(EDMA_TPTC0_CLK + eqn); | |||||
/* Clear Event Missed Regs */ | /* Clear Event Missed Regs */ | ||||
ti_edma3_cc_wr_4(TI_EDMA3CC_EMCR, 0xFFFFFFFF); | ti_edma3_cc_wr_4(TI_EDMA3CC_EMCR, 0xFFFFFFFF); | ||||
ti_edma3_cc_wr_4(TI_EDMA3CC_EMCRH, 0xFFFFFFFF); | ti_edma3_cc_wr_4(TI_EDMA3CC_EMCRH, 0xFFFFFFFF); | ||||
ti_edma3_cc_wr_4(TI_EDMA3CC_QEMCR, 0xFFFFFFFF); | ti_edma3_cc_wr_4(TI_EDMA3CC_QEMCR, 0xFFFFFFFF); | ||||
/* Clear Error Reg */ | /* Clear Error Reg */ | ||||
ti_edma3_cc_wr_4(TI_EDMA3CC_CCERRCLR, 0xFFFFFFFF); | ti_edma3_cc_wr_4(TI_EDMA3CC_CCERRCLR, 0xFFFFFFFF); | ||||
▲ Show 20 Lines • Show All 170 Lines • Show Last 20 Lines |