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 <limits.h> 6 7#include <ddk/debug.h> 8#include <ddk/device.h> 9#include <ddk/protocol/platform-bus.h> 10#include <ddk/protocol/platform-defs.h> 11#include <soc/aml-a113/a113-hw.h> 12 13#include "gauss.h" 14 15static const pbus_mmio_t clk_mmios[] = { 16 { 17 .base = AXG_HIU_BASE_PHYS, 18 .length = PAGE_SIZE, 19 }, 20}; 21 22static const pbus_dev_t clk_dev = { 23 .name = "a113-clk", 24 .vid = PDEV_VID_AMLOGIC, 25 .pid = PDEV_PID_AMLOGIC_A113, 26 .did = PDEV_DID_AMLOGIC_AXG_CLK, 27 .mmios = clk_mmios, 28 .mmio_count = countof(clk_mmios), 29}; 30 31zx_status_t gauss_clk_init(gauss_bus_t* bus) { 32 zxlogf(INFO, "gauss_clk_init"); 33 zx_status_t st; 34 35 st = pbus_protocol_device_add(&bus->pbus, ZX_PROTOCOL_CLK, &clk_dev); 36 if (st != ZX_OK) { 37 zxlogf(ERROR, "gauss_clk_init: pbus_protocol_device_add failed, st = %d\n", st); 38 return st; 39 } 40 41 return ZX_OK; 42} 43