|
10 | 10 | #define ICE_DPLL_PIN_IDX_INVALID 0xff
|
11 | 11 | #define ICE_DPLL_RCLK_NUM_PER_PF 1
|
12 | 12 | #define ICE_DPLL_PIN_ESYNC_PULSE_HIGH_PERCENT 25
|
| 13 | +#define ICE_DPLL_PIN_GEN_RCLK_FREQ 1953125 |
13 | 14 |
|
14 | 15 | /**
|
15 | 16 | * enum ice_dpll_pin_type - enumerate ice pin types:
|
@@ -2063,6 +2064,73 @@ static int ice_dpll_init_worker(struct ice_pf *pf)
|
2063 | 2064 | return 0;
|
2064 | 2065 | }
|
2065 | 2066 |
|
| 2067 | +/** |
| 2068 | + * ice_dpll_init_info_pins_generic - initializes generic pins info |
| 2069 | + * @pf: board private structure |
| 2070 | + * @input: if input pins initialized |
| 2071 | + * |
| 2072 | + * Init information for generic pins, cache them in PF's pins structures. |
| 2073 | + * |
| 2074 | + * Return: |
| 2075 | + * * 0 - success |
| 2076 | + * * negative - init failure reason |
| 2077 | + */ |
| 2078 | +static int ice_dpll_init_info_pins_generic(struct ice_pf *pf, bool input) |
| 2079 | +{ |
| 2080 | + struct ice_dpll *de = &pf->dplls.eec, *dp = &pf->dplls.pps; |
| 2081 | + static const char labels[][sizeof("99")] = { |
| 2082 | + "0", "1", "2", "3", "4", "5", "6", "7", "8", |
| 2083 | + "9", "10", "11", "12", "13", "14", "15" }; |
| 2084 | + u32 cap = DPLL_PIN_CAPABILITIES_STATE_CAN_CHANGE; |
| 2085 | + enum ice_dpll_pin_type pin_type; |
| 2086 | + int i, pin_num, ret = -EINVAL; |
| 2087 | + struct ice_dpll_pin *pins; |
| 2088 | + u32 phase_adj_max; |
| 2089 | + |
| 2090 | + if (input) { |
| 2091 | + pin_num = pf->dplls.num_inputs; |
| 2092 | + pins = pf->dplls.inputs; |
| 2093 | + phase_adj_max = pf->dplls.input_phase_adj_max; |
| 2094 | + pin_type = ICE_DPLL_PIN_TYPE_INPUT; |
| 2095 | + cap |= DPLL_PIN_CAPABILITIES_PRIORITY_CAN_CHANGE; |
| 2096 | + } else { |
| 2097 | + pin_num = pf->dplls.num_outputs; |
| 2098 | + pins = pf->dplls.outputs; |
| 2099 | + phase_adj_max = pf->dplls.output_phase_adj_max; |
| 2100 | + pin_type = ICE_DPLL_PIN_TYPE_OUTPUT; |
| 2101 | + } |
| 2102 | + if (pin_num > ARRAY_SIZE(labels)) |
| 2103 | + return ret; |
| 2104 | + |
| 2105 | + for (i = 0; i < pin_num; i++) { |
| 2106 | + pins[i].idx = i; |
| 2107 | + pins[i].prop.board_label = labels[i]; |
| 2108 | + pins[i].prop.phase_range.min = phase_adj_max; |
| 2109 | + pins[i].prop.phase_range.max = -phase_adj_max; |
| 2110 | + pins[i].prop.capabilities = cap; |
| 2111 | + pins[i].pf = pf; |
| 2112 | + ret = ice_dpll_pin_state_update(pf, &pins[i], pin_type, NULL); |
| 2113 | + if (ret) |
| 2114 | + break; |
| 2115 | + if (input && pins[i].freq == ICE_DPLL_PIN_GEN_RCLK_FREQ) |
| 2116 | + pins[i].prop.type = DPLL_PIN_TYPE_MUX; |
| 2117 | + else |
| 2118 | + pins[i].prop.type = DPLL_PIN_TYPE_EXT; |
| 2119 | + if (!input) |
| 2120 | + continue; |
| 2121 | + ret = ice_aq_get_cgu_ref_prio(&pf->hw, de->dpll_idx, i, |
| 2122 | + &de->input_prio[i]); |
| 2123 | + if (ret) |
| 2124 | + break; |
| 2125 | + ret = ice_aq_get_cgu_ref_prio(&pf->hw, dp->dpll_idx, i, |
| 2126 | + &dp->input_prio[i]); |
| 2127 | + if (ret) |
| 2128 | + break; |
| 2129 | + } |
| 2130 | + |
| 2131 | + return ret; |
| 2132 | +} |
| 2133 | + |
2066 | 2134 | /**
|
2067 | 2135 | * ice_dpll_init_info_direct_pins - initializes direct pins info
|
2068 | 2136 | * @pf: board private structure
|
@@ -2101,6 +2169,8 @@ ice_dpll_init_info_direct_pins(struct ice_pf *pf,
|
2101 | 2169 | default:
|
2102 | 2170 | return -EINVAL;
|
2103 | 2171 | }
|
| 2172 | + if (num_pins != ice_cgu_get_num_pins(hw, input)) |
| 2173 | + return ice_dpll_init_info_pins_generic(pf, input); |
2104 | 2174 |
|
2105 | 2175 | for (i = 0; i < num_pins; i++) {
|
2106 | 2176 | caps = 0;
|
|
0 commit comments