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/debug.h>
6 #include <ddk/platform-defs.h>
7 #include <soc/mt8167/mt8167-hw.h>
8 
9 #include "mt8167.h"
10 
11 namespace board_mt8167 {
12 
ClkInit()13 zx_status_t Mt8167::ClkInit() {
14     static const pbus_mmio_t clk_mmios[] = {
15         {
16             .base = MT8167_XO_BASE,
17             .length = MT8167_XO_SIZE
18         }
19     };
20 
21     pbus_dev_t clk_dev = {};
22     clk_dev.name = "clk";
23     clk_dev.vid = PDEV_VID_MEDIATEK;
24     clk_dev.did = PDEV_DID_MEDIATEK_CLK;
25     clk_dev.mmio_list = clk_mmios;
26     clk_dev.mmio_count = countof(clk_mmios);
27     clk_dev.bti_count = 0;
28     clk_dev.metadata_count = 0;
29     clk_dev.irq_count = 0;
30     clk_dev.gpio_count = 0;
31 
32     zx_status_t status = pbus_.ProtocolDeviceAdd(ZX_PROTOCOL_CLK, &clk_dev);
33     if (status != ZX_OK) {
34         zxlogf(ERROR, "%s: DeviceAdd clk failed %d\n", __FUNCTION__, status);
35     }
36 
37     return status;
38 }
39 
40 }  // namespace board_mt8167
41