|
@@ -78,7 +78,8 @@ static u32 comphy_mux_get_mux_value(struct comphy_mux_data *mux_data,
|
|
|
static void comphy_mux_reg_write(struct comphy_mux_data *mux_data,
|
|
|
struct comphy_map *comphy_map_data,
|
|
|
int comphy_max_lanes,
|
|
|
- void __iomem *selector_base, u32 bitcount)
|
|
|
+ void __iomem *selector_base,
|
|
|
+ const fdt32_t *mux_lane_order, u32 bitcount)
|
|
|
{
|
|
|
u32 lane, value, offset, mask;
|
|
|
|
|
@@ -89,7 +90,15 @@ static void comphy_mux_reg_write(struct comphy_mux_data *mux_data,
|
|
|
if (comphy_map_data->type == PHY_TYPE_IGNORE)
|
|
|
continue;
|
|
|
|
|
|
- offset = lane * bitcount;
|
|
|
+ /*
|
|
|
+ * if the order of nodes in selector base register is
|
|
|
+ * nontrivial, use mapping from mux_lane_order
|
|
|
+ */
|
|
|
+ if (mux_lane_order)
|
|
|
+ offset = fdt32_to_cpu(mux_lane_order[lane]) * bitcount;
|
|
|
+ else
|
|
|
+ offset = lane * bitcount;
|
|
|
+
|
|
|
mask = (((1 << bitcount) - 1) << offset);
|
|
|
value = (comphy_mux_get_mux_value(mux_data,
|
|
|
comphy_map_data->type,
|
|
@@ -105,6 +114,7 @@ void comphy_mux_init(struct chip_serdes_phy_config *chip_cfg,
|
|
|
void __iomem *selector_base)
|
|
|
{
|
|
|
struct comphy_mux_data *mux_data;
|
|
|
+ const fdt32_t *mux_lane_order;
|
|
|
u32 mux_bitcount;
|
|
|
u32 comphy_max_lanes;
|
|
|
|
|
@@ -112,13 +122,14 @@ void comphy_mux_init(struct chip_serdes_phy_config *chip_cfg,
|
|
|
|
|
|
comphy_max_lanes = chip_cfg->comphy_lanes_count;
|
|
|
mux_data = chip_cfg->mux_data;
|
|
|
+ mux_lane_order = chip_cfg->comphy_mux_lane_order;
|
|
|
mux_bitcount = chip_cfg->comphy_mux_bitcount;
|
|
|
|
|
|
/* check if the configuration is valid */
|
|
|
comphy_mux_check_config(mux_data, comphy_map_data, comphy_max_lanes);
|
|
|
/* Init COMPHY selectors */
|
|
|
comphy_mux_reg_write(mux_data, comphy_map_data, comphy_max_lanes,
|
|
|
- selector_base, mux_bitcount);
|
|
|
+ selector_base, mux_lane_order, mux_bitcount);
|
|
|
|
|
|
debug_exit();
|
|
|
}
|