1 // Copyright 2018 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/device.h> 6 #include <zircon/types.h> 7 8 #define HISI_CLK_FLAG_BANK_MASK (0x7) 9 #define HISI_CLK_FLAG_BANK(v) ((v) & HISI_CLK_FLAG_BANK_MASK) 10 #define HISI_CLK_FLAG_BANK_SCTRL (0x1) 11 #define HISI_CLK_FLAG_BANK_PERI (0x2) 12 13 14 typedef struct hisi_clk_gate { 15 uint32_t reg; // Offset from Clock Base Addr (in 4 byte words) 16 uint32_t bit; // Offset into this register. 17 18 uint32_t flags; 19 } hisi_clk_gate_t; 20 21 // Initialize a hisilicon clock 22 zx_status_t hisi_clk_init(const char* name, hisi_clk_gate_t* gates, 23 const size_t gate_count, zx_device_t* parent); 24