Skip to content

Commit

Permalink
[driver] set clk driver to weak function
Browse files Browse the repository at this point in the history
  • Loading branch information
SamulKyull authored and SamulKyull committed Oct 16, 2024
1 parent 58dcc02 commit a0c353f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
26 changes: 15 additions & 11 deletions src/drivers/sys-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/sys-i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a0c353f

Please sign in to comment.