#define UB960_MAX_EQ_LEVEL 14
#define UB960_NUM_EQ_LEVELS (UB960_MAX_EQ_LEVEL - UB960_MIN_EQ_LEVEL + 1)
+enum chip_type {
+ UB960,
+ UB9702,
+};
+
+enum chip_family {
+ FAMILY_FPD3,
+ FAMILY_FPD4,
+};
+
struct ub960_hw_data {
const char *model;
+ enum chip_type chip_type;
+ enum chip_family chip_family;
u8 num_rxports;
u8 num_txports;
- bool is_ub9702;
- bool is_fpdlink4;
};
enum ub960_rxport_mode {
if (ret)
return ret;
- if (priv->hw_data->is_ub9702) {
+ if (priv->hw_data->chip_type == UB9702) {
dev_dbg(dev, "\trx%u: locked, freq %llu Hz\n",
nport, ((u64)v * HZ_PER_MHZ) >> 8);
} else {
ser_pdata->port = nport;
ser_pdata->atr = priv->atr;
- if (priv->hw_data->is_ub9702)
+ if (priv->hw_data->chip_type == UB9702)
ser_pdata->bc_rate = ub960_calc_bc_clk_rate_ub9702(priv, rxport);
else
ser_pdata->bc_rate = ub960_calc_bc_clk_rate_ub960(priv, rxport);
{
int ret;
- if (priv->hw_data->is_ub9702)
+ if (priv->hw_data->chip_type == UB9702)
ret = ub960_init_tx_ports_ub9702(priv);
else
ret = ub960_init_tx_ports_ub960(priv);
case RXPORT_MODE_CSI2_SYNC:
case RXPORT_MODE_CSI2_NONSYNC:
- if (!priv->hw_data->is_ub9702) {
+ if (priv->hw_data->chip_type == UB960) {
/* Map all VCs from this port to the same VC */
ub960_rxport_write(priv, nport, UB960_RR_CSI_VC_MAP,
(vc << UB960_RR_CSI_VC_MAP_SHIFT(3)) |
dev_info(dev, "\tcsi_err_counter %u\n", v);
- if (!priv->hw_data->is_ub9702) {
+ if (priv->hw_data->chip_type == UB960) {
ret = ub960_log_status_ub960_sp_eq(priv, nport);
if (ret)
return ret;
return -EINVAL;
}
- if (!priv->hw_data->is_fpdlink4 && cdr_mode == RXPORT_CDR_FPD4) {
+ if (priv->hw_data->chip_family != FAMILY_FPD4 && cdr_mode == RXPORT_CDR_FPD4) {
dev_err(dev, "rx%u: FPD-Link 4 CDR not supported\n", nport);
return -EINVAL;
}
if (ret)
goto err_pd_gpio;
- if (priv->hw_data->is_ub9702)
+ if (priv->hw_data->chip_type == UB9702)
ret = ub960_read(priv, UB9702_SR_REFCLK_FREQ, &refclk_freq,
NULL);
else
goto err_pd_gpio;
/* release GPIO lock */
- if (priv->hw_data->is_ub9702) {
+ if (priv->hw_data->chip_type == UB9702) {
ret = ub960_update_bits(priv, UB960_SR_RESET,
UB960_SR_RESET_GPIO_LOCK_RELEASE,
UB960_SR_RESET_GPIO_LOCK_RELEASE,
if (ret)
goto err_free_ports;
- if (priv->hw_data->is_ub9702)
+ if (priv->hw_data->chip_type == UB9702)
ret = ub960_init_rx_ports_ub9702(priv);
else
ret = ub960_init_rx_ports_ub960(priv);
static const struct ub960_hw_data ds90ub960_hw = {
.model = "ub960",
+ .chip_type = UB960,
+ .chip_family = FAMILY_FPD3,
.num_rxports = 4,
.num_txports = 2,
};
static const struct ub960_hw_data ds90ub9702_hw = {
.model = "ub9702",
+ .chip_type = UB9702,
+ .chip_family = FAMILY_FPD4,
.num_rxports = 4,
.num_txports = 2,
- .is_ub9702 = true,
- .is_fpdlink4 = true,
};
static const struct i2c_device_id ub960_id[] = {