Commit 706b0a02 authored by Adam Wujek's avatar Adam Wujek 💬

userspace/libwr: remove files sfp.c and sfp.h, since not used

parent 2fd05d3f
#include "sfp.h"
#define MUX_ADDR(sel) ((0xE << 3) | (sel & 0x7))
static const pio_pin_t mux_sda = {PIOB, 0, PIO_MODE_GPIO, PIO_OUT_1};
static const pio_pin_t mux_scl = {PIOB, 1, PIO_MODE_GPIO, PIO_OUT_1};
struct i2c_bus_t *mux_bus;
struct wr_i2c_mux sfp_mux = {
.address = {
MUX_ADDR(0),
MUX_ADDR(1)
},
.reset = {
.port = PIOD,
.pin = 12,
.mode = PIO_MODE_GPIO,
.dir = PIO_OUT_1
}
};
struct i2c_bus_t *sfp_bus0;
struct i2c_bus_t *sfp_bus1;
struct pca9554d wr_sfp_gpio[] = {
{
/* 0 */
}, {
/* 1 */
}, {
/* 2 */
}, {
/* 3 */
}, {
/* 4 */
}, {
/* 5 */
}, {
/* 6 */
}, {
/* 7 */
}, {
/* 8 */
},
};
struct wr_sfp_module[18]
void sfp_init(void)
{
/* Create a bit-banged i2c for the muxes */
mux_bus = i2c_cpu_bb_new_bus(&mux_scl, &mux_sda);
/* Set the bus to be used for the mux control */
sfp_mux.bus = mux_bus;
}
#ifndef SFP_H
#define SFP_H
/* This structure describes the pair of PCA9548A chip used as muxes for i2c */
struct wr_i2c_mux {
/* I2C bus */
struct i2c_bus *bus;
/* I2C addresses of the two PCA9548 chips */
int address[2];
/* Reset pin */
struct pio_pin_t reset;
};
int wr_i2c_mux_set_channel(struct wr_i2c_mux *, int);
/* This structure describes a single PCA9554D chip */
struct pca9554d {
/* The i2c bus used for access */
struct i2c_bus_t *bus;
/* The address of this PCA9554D (set by A0,A1,A2 pins) */
int address;
int (*init)(struct pca9554d *);
int (*exit)(struct pca9554d *);
};
int pca9554d_get_input_reg(struct pca9554d *);
int pca9554d_set_output_reg(struct pca9554d *);
int pca9554d_set_polarity_reg(struct pca9554d *);
int pca9554d_set_config_reg(struct pca9554d *);
#define GPIO_BITS_LOWER 0
#define GPIO_BITS_UPPER 1
#define WRLINK_LED_LINK(m) \
(1 << (((m->bits_type == GPIO_BITS_LOWER) ? 0 : 2) + 4*m->bits_type))
#define WRLINK_LED_WRMODE(m) \
(1 << (((m->bits_type == GPIO_BITS_LOWER) ? 1 : 0) + 4*m->bits_type))
#define WRLINK_LED_SYNCED(m) \
(1 << (((m->bits_type == GPIO_BITS_LOWER) ? 3 : 1) + 4*m->bits_type))
#define SFP_TX_DISABLE(m) \
(1 << (((m->bits_type == GPIO_BITS_LOWER) ? 2 : 3) + 4*m->bits_type))
struct wr_sfp_module {
/*
* The PCA9554D associated with this device. Use a pointer here
* as a single PCA9554D controls the pins for two SFP modules
* each.
*/
struct pca9554d *gpio_ctl;
/* One of PCA9554_BITS_LOWER or PCA9554_BITS_UPPER */
int bits_type;
/* The PCA9548 chip for accessing this SFP module */
struct wr_i2c_mux *mux;
/*
* The channel for writing to control register of the
* PCA9548 chips.
*/
int channel;
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment