1// Copyright 2017 The Fuchsia Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#include <ddk/driver.h> 6#include <ddk/debug.h> 7#include <ddk/protocol/gpio.h> 8#include <ddk/protocol/platform-defs.h> 9#include <hw/reg.h> 10#include <soc/hi3660/hi3660.h> 11#include <soc/hi3660/hi3660-regs.h> 12 13#include <stdio.h> 14 15zx_status_t hi3660_dsi_init(hi3660_t* hi3660) { 16 volatile void* peri_crg = io_buffer_virt(&hi3660->peri_crg); 17 uint32_t temp; 18 19 writel(0x30000000, peri_crg + PERRSTDIS3); 20 21 temp = readl(peri_crg + TXDPHY0_REF_OFFSET); 22 temp |= (1 << TXDPHY0_REF_BIT); 23 writel(temp, peri_crg + TXDPHY0_REF_OFFSET); 24 readl(peri_crg + TXDPHY0_REF_OFFSET + CLKGATE_SEPERATED_STATUS); 25 26 temp = readl(peri_crg + TXDPHY0_CFG_OFFSET); 27 temp |= (1 << TXDPHY0_CFG_BIT); 28 writel(temp, peri_crg + TXDPHY0_CFG_OFFSET); 29 readl(peri_crg + TXDPHY0_CFG_OFFSET + CLKGATE_SEPERATED_STATUS); 30 31 temp = readl(peri_crg + PCLK_GATE_DSI0_OFFSET); 32 temp |= (1 << PCLK_GATE_DSI0_BIT); 33 writel(temp, peri_crg + PCLK_GATE_DSI0_OFFSET); 34 readl(peri_crg + PCLK_GATE_DSI0_OFFSET + CLKGATE_SEPERATED_STATUS); 35 36 return ZX_OK; 37}