#ifdef CONFIG_PCF857X
#include <pcf857x.h>
#endif
-#ifdef CONFIG_PCA9698
-#include <pca9698.h>
-#endif
#ifdef CONFIG_PCA9554
#include <pca9554.h>
#endif
};
#endif
-#ifdef CONFIG_PCA9698
-/** List of compatible strings supported by pca9698 driver */
-static const char * const pca9698_gpio_list[] = {
- "nxp,pca9505", "pca9505", "nxp,pca9698", "pca9698", NULL,
-};
-#endif
-
#ifdef CONFIG_PCA953X
/** List of compatible strings supported by pca953x driver */
static const char * const pca953x_gpio_list[] = {
}
value = (value >> pin) & 1;
break;
-#endif
-#ifdef CONFIG_PCA9698
- case CVMX_GPIO_PIN_PCA9698:
- node = fdt_node_offset_by_phandle(fdt, phandle);
- if (octeon_fdt_get_i2c_bus_addr(fdt, node, &bus, &addr)) {
- printf("%s: Could not get gpio bus and/or address\n", __func__);
- return -1;
- }
- old_bus = i2c_get_bus_num();
- i2c_set_bus_num(bus);
- value = pca9698_get_value(addr, pin);
- i2c_set_bus_num(old_bus);
- break;
#endif
case CVMX_GPIO_PIN_OCTEON:
value = gpio_get_value(pin);
return -1;
}
return pcf957x_set_val(bus, addr, 1 << pin, val << pin);
-#endif
-#ifdef CONFIG_PCA9698
- case CVMX_GPIO_PIN_PCA9698:
- if (octeon_fdt_get_i2c_bus_addr(fdt, node, &bus, &addr)) {
- printf("%s: Could not get gpio bus and/or address\n", __func__);
- return -1;
- }
- old_bus = i2c_get_bus_num();
- i2c_set_bus_num(bus);
- rc = pca9698_set_value(addr, pin, val);
- i2c_set_bus_num(old_bus);
- return rc;
#endif
case CVMX_GPIO_PIN_OCTEON:
return gpio_set_value(pin, val);
*type = GPIO_TYPE_PCA953X;
}
#endif
-#ifdef CONFIG_PCA9698
- if (!octeon_fdt_node_check_compatible(fdt, fdt_node, pca9698_gpio_list)) {
- debug("%s: Found PCA9698 compatible GPIO", __func__);
- *type = GPIO_TYPE_PCA9698;
- }
-#endif
-#if defined(CONFIG_PCA953X) || defined(CONFIG_PCA9698) || \
+#if defined(CONFIG_PCA953X) || \
defined(CONFIG_PCA9555) || defined(CONFIG_PCA9554)
if (!i2c_addr || !i2c_bus) {
printf("%s: Error: i2c_addr or i2c_bus is NULL\n", __func__);
+++ /dev/null
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2011
- * Dirk Eibach, Guntermann & Drunck GmbH, dirk.eibach@gdsys.cc
- */
-
-/*
- * Driver for NXP's pca9698 40 bit I2C gpio expander
- */
-
-#include <common.h>
-#include <i2c.h>
-#include <malloc.h>
-#include <linux/errno.h>
-#include <pca9698.h>
-
-/*
- * The pca9698 registers
- */
-
-#define PCA9698_REG_INPUT 0x00
-#define PCA9698_REG_OUTPUT 0x08
-#define PCA9698_REG_POLARITY 0x10
-#define PCA9698_REG_CONFIG 0x18
-
-#define PCA9698_BUFFER_SIZE 5
-#define PCA9698_GPIO_COUNT 40
-
-static int pca9698_read40(u8 addr, u8 offset, u8 *buffer)
-{
- u8 command = offset | 0x80; /* autoincrement */
-
- return i2c_read(addr, command, 1, buffer, PCA9698_BUFFER_SIZE);
-}
-
-static int pca9698_write40(u8 addr, u8 offset, u8 *buffer)
-{
- u8 command = offset | 0x80; /* autoincrement */
-
- return i2c_write(addr, command, 1, buffer, PCA9698_BUFFER_SIZE);
-}
-
-static void pca9698_set_bit(unsigned gpio, u8 *buffer, unsigned value)
-{
- unsigned byte = gpio / 8;
- unsigned bit = gpio % 8;
-
- if (value)
- buffer[byte] |= (1 << bit);
- else
- buffer[byte] &= ~(1 << bit);
-}
-
-int pca9698_request(unsigned gpio, const char *label)
-{
- if (gpio >= PCA9698_GPIO_COUNT)
- return -EINVAL;
-
- return 0;
-}
-
-void pca9698_free(unsigned gpio)
-{
-}
-
-int pca9698_direction_input(u8 addr, unsigned gpio)
-{
- u8 data[PCA9698_BUFFER_SIZE];
- int res;
-
- res = pca9698_read40(addr, PCA9698_REG_CONFIG, data);
- if (res)
- return res;
-
- pca9698_set_bit(gpio, data, 1);
-
- return pca9698_write40(addr, PCA9698_REG_CONFIG, data);
-}
-
-int pca9698_direction_output(u8 addr, unsigned gpio, int value)
-{
- u8 data[PCA9698_BUFFER_SIZE];
- int res;
-
- res = pca9698_set_value(addr, gpio, value);
- if (res)
- return res;
-
- res = pca9698_read40(addr, PCA9698_REG_CONFIG, data);
- if (res)
- return res;
-
- pca9698_set_bit(gpio, data, 0);
-
- return pca9698_write40(addr, PCA9698_REG_CONFIG, data);
-}
-
-int pca9698_get_value(u8 addr, unsigned gpio)
-{
- unsigned config_byte = gpio / 8;
- unsigned config_bit = gpio % 8;
- unsigned value;
- u8 data[PCA9698_BUFFER_SIZE];
- int res;
-
- res = pca9698_read40(addr, PCA9698_REG_INPUT, data);
- if (res)
- return -1;
-
- value = data[config_byte] & (1 << config_bit);
-
- return !!value;
-}
-
-int pca9698_set_value(u8 addr, unsigned gpio, int value)
-{
- u8 data[PCA9698_BUFFER_SIZE];
- int res;
-
- res = pca9698_read40(addr, PCA9698_REG_OUTPUT, data);
- if (res)
- return res;
-
- pca9698_set_bit(gpio, data, value);
-
- return pca9698_write40(addr, PCA9698_REG_OUTPUT, data);
-}
+++ /dev/null
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * (C) Copyright 2011
- * Dirk Eibach, Guntermann & Drunck GmbH, dirk.eibach@gdsys.cc
- */
-
-#ifndef __PCA9698_H_
-#define __PCA9698_H_
-
-int pca9698_request(unsigned gpio, const char *label);
-void pca9698_free(unsigned gpio);
-int pca9698_direction_input(u8 addr, unsigned gpio);
-int pca9698_direction_output(u8 addr, unsigned gpio, int value);
-int pca9698_get_value(u8 addr, unsigned gpio);
-int pca9698_set_value(u8 addr, unsigned gpio, int value);
-
-#endif /* __PCA9698_H_ */