Source
// SPDX-License-Identifier: GPL-2.0+
/*
* (C) Copyright 2017
* Mario Six, Guntermann & Drunck GmbH, mario.six@gdsys.cc
*/
/* Sequence number of I2C bus that holds the GPIO expanders */
static const int I2C_BUS_SEQ_NO = 1;
/* I2C address of SC/MC2 expander */
static const int MC2_EXPANDER_ADDR = 0x20;
/* I2C address of MC4 expander */
static const int MC4_EXPANDER_ADDR = 0x22;
/* Number of the GPIO to read the SC data from */
static const int SC_GPIO_NO;
/* Number of the GPIO to read the CON data from */
static const int CON_GPIO_NO = 1;
/**
* struct board_gazerbeam_priv - Private data structure for the gazerbeam board
* driver.
* @reset_gpios: GPIOs for the board's reset GPIOs.
* @var_gpios: GPIOs for the board's hardware variant GPIOs
* @ver_gpios: GPIOs for the board's hardware version GPIOs
* @variant: Container for the board's hardware variant (CON/CPU)
* @multichannel: Container for the board's multichannel variant (MC4/MC2/SC)
* @hwversion: Container for the board's hardware version
*/
struct board_gazerbeam_priv {
struct gpio_desc reset_gpios[2];
struct gpio_desc var_gpios[2];
struct gpio_desc ver_gpios[4];
int variant;
int multichannel;
int hwversion;
};
/**
* _read_board_variant_data() - Read variant information from the hardware.
* @dev: The board device for which to determine the multichannel and device
* type information.
*
* The data read from the board's hardware (mostly hard-wired GPIOs) is stored
* in the private data structure of the driver to be used by other driver
* methods.
*
* Return: 0 if OK, -ve on error.
*/
static int _read_board_variant_data(struct udevice *dev)
{
struct board_gazerbeam_priv *priv = dev_get_priv(dev);
struct udevice *i2c_bus;
struct udevice *dummy;
char *listname;