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 <ddk/device.h> 8 #include <ddk/protocol/gpioimpl.h> 9 #include <ddk/protocol/iommu.h> 10 #include <ddk/protocol/platform/bus.h> 11 #include <soc/aml-s905d2/s905d2-gpio.h> 12 13 // BTI IDs for our devices 14 enum { 15 BTI_BOARD, 16 BTI_USB_XHCI, 17 BTI_DISPLAY, 18 BTI_MALI, 19 BTI_VIDEO, 20 BTI_AML_RAW_NAND, 21 BTI_SDIO, 22 BTI_CANVAS, 23 BTI_THERMAL, 24 BTI_AUDIO_IN, 25 BTI_AUDIO_OUT, 26 BTI_TEE, 27 }; 28 29 // MAC address metadata indices 30 enum { 31 MACADDR_WIFI = 0, 32 MACADDR_BLUETOOTH = 1, 33 }; 34 35 typedef struct { 36 zx_device_t* parent; 37 pbus_protocol_t pbus; 38 gpio_impl_protocol_t gpio; 39 iommu_protocol_t iommu; 40 } aml_bus_t; 41 42 // astro-gpio.c 43 zx_status_t aml_gpio_init(aml_bus_t* bus); 44 45 // astro-i2c.c 46 zx_status_t aml_i2c_init(aml_bus_t* bus); 47 48 // astro-bluetooth.c 49 zx_status_t aml_bluetooth_init(aml_bus_t* bus); 50 51 // astro-usb.c 52 zx_status_t aml_usb_init(aml_bus_t* bus); 53 54 // astro-display.c 55 zx_status_t aml_display_init(aml_bus_t* bus); 56 57 // astro-backlight.c 58 zx_status_t astro_backlight_init(aml_bus_t* bus); 59 60 // These should match the mmio table defined in astro-i2c.c 61 enum { 62 ASTRO_I2C_A0_0, 63 ASTRO_I2C_2, 64 ASTRO_I2C_3, 65 }; 66 67 // Astro Board Revs 68 enum { 69 BOARD_REV_P1 = 0, 70 BOARD_REV_P2 = 1, 71 BOARD_REV_EVT_1 = 2, 72 BOARD_REV_EVT_2 = 3, 73 74 MAX_SUPPORTED_REV, // This must be last entry 75 }; 76 77 // Astro GPIO Pins used for board rev detection 78 #define GPIO_HW_ID0 (S905D2_GPIOZ(7)) 79 #define GPIO_HW_ID1 (S905D2_GPIOZ(8)) 80 #define GPIO_HW_ID2 (S905D2_GPIOZ(3)) 81 82 /* Astro I2C Devices */ 83 #define I2C_BACKLIGHT_ADDR (0x2C) 84 #define I2C_AMBIENTLIGHT_ADDR (0x39) 85 // astro-touch.c 86 zx_status_t astro_touch_init(aml_bus_t* bus); 87 // aml-raw_nand.c 88 zx_status_t aml_raw_nand_init(aml_bus_t* bus); 89 // astro-sdio.c 90 zx_status_t aml_sdio_init(aml_bus_t* bus); 91 // astro-canvas.c 92 zx_status_t aml_canvas_init(aml_bus_t* bus); 93 // astro-light.c 94 zx_status_t ams_light_init(aml_bus_t* bus); 95 // astro-thermal.c 96 zx_status_t aml_thermal_init(aml_bus_t* bus); 97 // astro-video.c 98 zx_status_t aml_video_init(aml_bus_t* bus); 99 // astro-clk.c 100 zx_status_t aml_clk_init(aml_bus_t* bus); 101 // astro-audio.c 102 zx_status_t astro_tdm_init(aml_bus_t* bus); 103 // astro-tee.c 104 zx_status_t astro_tee_init(aml_bus_t* bus); 105 // astro-buttons.c 106 zx_status_t astro_buttons_init(aml_bus_t* bus); 107