diff --git a/src/drivers/sys-dma.c b/src/drivers/sys-dma.c index 414a869b..dd3e492f 100644 --- a/src/drivers/sys-dma.c +++ b/src/drivers/sys-dma.c @@ -23,15 +23,7 @@ static dma_source_t dma_channel_source[SUNXI_DMA_MAX]; static dma_desc_t dma_channel_desc[SUNXI_DMA_MAX] __attribute__((aligned(64))); -void dma_init(void) { - printk_debug("DMA: init\n"); - int i; - uint32_t val; - dma_reg_t *const dma_reg = (dma_reg_t *) SUNXI_DMA_BASE; - - if (dma_init_ok > 0) - return; - +void __attribute__((weak)) sunxi_dma_clk_init() { /* dma : mbus clock gating */ // ccu->mbus_gate |= 1 << 0; val = read32(CCU_BASE + CCU_MBUS_MAT_CLK_GATING_REG); @@ -49,6 +41,18 @@ void dma_init(void) { val = read32(CCU_BASE + CCU_DMA_BGR_REG); val |= 1 << DMA_GATING_OFS; write32(CCU_BASE + CCU_DMA_BGR_REG, val); +} + +void dma_init(void) { + printk_debug("DMA: init\n"); + int i; + uint32_t val; + dma_reg_t *const dma_reg = (dma_reg_t *) SUNXI_DMA_BASE; + + if (dma_init_ok > 0) + return; + + sunxi_dma_clk_init(); dma_reg->irq_en0 = 0; dma_reg->irq_en1 = 0; @@ -215,7 +219,7 @@ int dma_test(uint32_t *src_addr, uint32_t *dst_addr) { len = ALIGN(len, 4); printk_debug("DMA: test 0x%08x ====> 0x%08x, len %uKB \n", - (uint32_t) src_addr, (uint32_t) dst_addr, (len / 1024)); + (uint32_t) src_addr, (uint32_t) dst_addr, (len / 1024)); /* dma */ dma_set.loop_mode = 0; @@ -278,7 +282,7 @@ int dma_test(uint32_t *src_addr, uint32_t *dst_addr) { } if (valid) { printk_info("DMA: test OK in %lums\n", - (time_ms() - timeout)); + (time_ms() - timeout)); } else printk_error("DMA: test check failed at %u bytes\n", i); } diff --git a/src/drivers/sys-i2c.c b/src/drivers/sys-i2c.c index 0a0a06e3..6a6bdbc0 100644 --- a/src/drivers/sys-i2c.c +++ b/src/drivers/sys-i2c.c @@ -456,7 +456,7 @@ static void sunxi_i2c_set_clock(sunxi_i2c_t *i2c_dev) { i2c->eft = 0; } -static void sunxi_i2c_bus_open(sunxi_i2c_t *i2c_dev) { +void __attribute__((weak)) sunxi_i2c_bus_open(sunxi_i2c_t *i2c_dev) { int reg_value = 0; if (i2c_dev->id <= 5) {