1 /** 2 * 3 * Copyright (c) 2018, Marvell International Ltd. All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-2-Clause-Patent 6 * 7 **/ 8 #ifndef __MV_PCA953X_H__ 9 #define __MV_PCA953X_H__ 10 11 #include <Library/ArmadaBoardDescLib.h> 12 #include <Library/BaseMemoryLib.h> 13 #include <Library/DebugLib.h> 14 #include <Library/DevicePathLib.h> 15 #include <Library/IoLib.h> 16 #include <Library/MemoryAllocationLib.h> 17 #include <Library/MvGpioLib.h> 18 #include <Library/PcdLib.h> 19 #include <Library/UefiBootServicesTableLib.h> 20 #include <Library/UefiLib.h> 21 22 #include <Protocol/BoardDesc.h> 23 #include <Protocol/MvI2c.h> 24 25 #include <Uefi/UefiBaseType.h> 26 27 #define PCA95XX_GPIO_SIGNATURE SIGNATURE_32 ('I', 'O', 'E', 'X') 28 29 #define PCA95XX_INPUT_REG 0x0 30 #define PCA95XX_OUTPUT_REG 0x2 31 #define PCA95XX_DIRECTION_REG 0x6 32 33 #define PCA95XX_BANK_SIZE 8 34 #define PCA95XX_OPERATION_COUNT 2 35 #define PCA95XX_OPERATION_LENGTH 1 36 37 typedef enum { 38 PCA9505_PIN_COUNT = 40, 39 PCA9534_PIN_COUNT = 8, 40 PCA9535_PIN_COUNT = 16, 41 PCA9536_PIN_COUNT = 4, 42 PCA9537_PIN_COUNT = 4, 43 PCA9538_PIN_COUNT = 8, 44 PCA9539_PIN_COUNT = 16, 45 PCA9554_PIN_COUNT = 8, 46 PCA9555_PIN_COUNT = 16, 47 PCA9556_PIN_COUNT = 16, 48 PCA9557_PIN_COUNT = 16, 49 } PCA95XX_PIN_COUNT; 50 51 typedef struct { 52 EMBEDDED_GPIO GpioProtocol; 53 MV_GPIO_EXPANDER *GpioExpanders; 54 UINTN GpioExpanderCount; 55 UINTN Signature; 56 EFI_HANDLE ControllerHandle; 57 } PCA95XX; 58 59 #endif 60