Konstantin Porotchkin | 73cd881 | 2018-02-26 16:06:35 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 Marvell International Ltd. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * https://spdx.org/licenses |
| 6 | */ |
| 7 | |
| 8 | /* This driver provides I2C support for Marvell A8K and compatible SoCs */ |
| 9 | |
| 10 | #ifndef _A8K_I2C_H_ |
| 11 | #define _A8K_I2C_H_ |
| 12 | |
| 13 | #include <stdint.h> |
| 14 | |
| 15 | /* |
| 16 | * Initialization, must be called once on start up, may be called |
| 17 | * repeatedly to change the speed and slave addresses. |
| 18 | */ |
| 19 | void i2c_init(void *i2c_base); |
| 20 | |
| 21 | /* |
| 22 | * Read/Write interface: |
| 23 | * chip: I2C chip address, range 0..127 |
| 24 | * addr: Memory (register) address within the chip |
| 25 | * alen: Number of bytes to use for addr (typically 1, 2 for larger |
| 26 | * memories, 0 for register type devices with only one |
| 27 | * register) |
| 28 | * buffer: Where to read/write the data |
| 29 | * len: How many bytes to read/write |
| 30 | * |
| 31 | * Returns: 0 on success, not 0 on failure |
| 32 | */ |
| 33 | int i2c_read(uint8_t chip, |
| 34 | unsigned int addr, int alen, uint8_t *buffer, int len); |
| 35 | |
| 36 | int i2c_write(uint8_t chip, |
| 37 | unsigned int addr, int alen, uint8_t *buffer, int len); |
| 38 | #endif |