145cb4fccSLei YU /** 245cb4fccSLei YU * Copyright © 2016 Google Inc. 345cb4fccSLei YU * Copyright © 2016 IBM Corporation 445cb4fccSLei YU * 545cb4fccSLei YU * Licensed under the Apache License, Version 2.0 (the "License"); 645cb4fccSLei YU * you may not use this file except in compliance with the License. 745cb4fccSLei YU * You may obtain a copy of the License at 845cb4fccSLei YU * 945cb4fccSLei YU * http://www.apache.org/licenses/LICENSE-2.0 1045cb4fccSLei YU * 1145cb4fccSLei YU * Unless required by applicable law or agreed to in writing, software 1245cb4fccSLei YU * distributed under the License is distributed on an "AS IS" BASIS, 1345cb4fccSLei YU * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1445cb4fccSLei YU * See the License for the specific language governing permissions and 1545cb4fccSLei YU * limitations under the License. 1645cb4fccSLei YU */ 1745cb4fccSLei YU 1845cb4fccSLei YU #ifndef __GPIO_CONFIGS_H__ 1945cb4fccSLei YU #define __GPIO_CONFIGS_H__ 2045cb4fccSLei YU 2145cb4fccSLei YU #include <stddef.h> 2245cb4fccSLei YU #include <glib.h> 2345cb4fccSLei YU #include "gpio.h" 2445cb4fccSLei YU 2545cb4fccSLei YU typedef struct PowerGpio { 2645cb4fccSLei YU /* Optional active high pin enabling writes to latched power_up pins. */ 2745cb4fccSLei YU GPIO latch_out; /* NULL name if not used. */ 2845cb4fccSLei YU /* Active high pin that is asserted following successful host power up. */ 2945cb4fccSLei YU GPIO power_good_in; 3045cb4fccSLei YU /* Selectable polarity pins enabling host power rails. */ 3145cb4fccSLei YU size_t num_power_up_outs; 3245cb4fccSLei YU GPIO *power_up_outs; 3345cb4fccSLei YU /* TRUE for active high */ 3445cb4fccSLei YU gboolean *power_up_pols; 3545cb4fccSLei YU /* Selectable polarity pins holding system complexes in reset. */ 3645cb4fccSLei YU size_t num_reset_outs; 3745cb4fccSLei YU GPIO *reset_outs; 3845cb4fccSLei YU /* TRUE for active high */ 3945cb4fccSLei YU gboolean *reset_pols; 4045cb4fccSLei YU size_t num_pci_reset_outs; 4145cb4fccSLei YU GPIO *pci_reset_outs; 4245cb4fccSLei YU /* TRUE for active high */ 4345cb4fccSLei YU gboolean *pci_reset_pols; 4445cb4fccSLei YU gboolean *pci_reset_holds; 4545cb4fccSLei YU } PowerGpio; 4645cb4fccSLei YU 4745cb4fccSLei YU typedef struct GpioConfigs { 4845cb4fccSLei YU PowerGpio power_gpio; 4945cb4fccSLei YU } GpioConfigs; 5045cb4fccSLei YU 5145cb4fccSLei YU /* Read system configuration for GPIOs. */ 52*0f3fd5aaSMatt Spinler gboolean read_gpios(GpioConfigs *gpios); 5345cb4fccSLei YU /* Frees internal buffers. Does not free parameter. Does not close GPIOs. */ 5445cb4fccSLei YU void free_gpios(GpioConfigs *gpios); 5545cb4fccSLei YU 5645cb4fccSLei YU #endif 57