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#pragma once 6 7#include <zircon/types.h> 8 9#include <ddk/device.h> 10#include <ddk/protocol/clk.h> 11#include <ddk/protocol/gpio.h> 12#include <ddk/protocol/platform-device.h> 13#include <dev/pci/designware/atu-cfg.h> 14#include <fbl/unique_ptr.h> 15 16#include "aml-pcie.h" 17 18namespace pcie { 19namespace aml { 20 21class AmlPcieDevice { 22 public: 23 AmlPcieDevice(zx_device_t* parent) : parent_(parent) {} 24 ~AmlPcieDevice(); 25 26 zx_status_t Init(); 27 28 private: 29 zx_status_t InitProtocols(); 30 zx_status_t InitMmios(); 31 zx_status_t InitMetadata(); 32 33 zx_device_t* parent_; 34 zx_device_t* dev_; 35 36 // Protocols 37 platform_device_protocol_t pdev_; 38 clk_protocol_t clk_; 39 gpio_protocol_t gpio_; 40 41 // IO Buffers 42 io_buffer_t dbi_; 43 io_buffer_t cfg_; 44 io_buffer_t rst_; 45 io_buffer_t pll_; 46 47 // Device Metadata 48 iatu_translation_entry_t atu_cfg_; 49 iatu_translation_entry_t atu_io_; 50 iatu_translation_entry_t atu_mem_; 51 52 fbl::unique_ptr<AmlPcie> pcie_; 53}; 54 55} // namespace aml 56} // namespace pcie