@@ -53,6 +53,22 @@ static s32 igc_set_pcie_completion_timeout(struct igc_hw *hw)
5353 return ret_val ;
5454}
5555
56+ /**
57+ * igc_check_for_link_base - Check for link
58+ * @hw: pointer to the HW structure
59+ *
60+ * If sgmii is enabled, then use the pcs register to determine link, otherwise
61+ * use the generic interface for determining link.
62+ */
63+ static s32 igc_check_for_link_base (struct igc_hw * hw )
64+ {
65+ s32 ret_val = 0 ;
66+
67+ ret_val = igc_check_for_copper_link (hw );
68+
69+ return ret_val ;
70+ }
71+
5672/**
5773 * igc_reset_hw_base - Reset hardware
5874 * @hw: pointer to the HW structure
@@ -107,12 +123,51 @@ static s32 igc_reset_hw_base(struct igc_hw *hw)
107123 return ret_val ;
108124}
109125
126+ /**
127+ * igc_init_nvm_params_base - Init NVM func ptrs.
128+ * @hw: pointer to the HW structure
129+ */
130+ static s32 igc_init_nvm_params_base (struct igc_hw * hw )
131+ {
132+ struct igc_nvm_info * nvm = & hw -> nvm ;
133+ u32 eecd = rd32 (IGC_EECD );
134+ u16 size ;
135+
136+ size = (u16 )((eecd & IGC_EECD_SIZE_EX_MASK ) >>
137+ IGC_EECD_SIZE_EX_SHIFT );
138+
139+ /* Added to a constant, "size" becomes the left-shift value
140+ * for setting word_size.
141+ */
142+ size += NVM_WORD_SIZE_BASE_SHIFT ;
143+
144+ /* Just in case size is out of range, cap it to the largest
145+ * EEPROM size supported
146+ */
147+ if (size > 15 )
148+ size = 15 ;
149+
150+ nvm -> word_size = BIT (size );
151+ nvm -> opcode_bits = 8 ;
152+ nvm -> delay_usec = 1 ;
153+
154+ nvm -> page_size = eecd & IGC_EECD_ADDR_BITS ? 32 : 8 ;
155+ nvm -> address_bits = eecd & IGC_EECD_ADDR_BITS ?
156+ 16 : 8 ;
157+
158+ if (nvm -> word_size == BIT (15 ))
159+ nvm -> page_size = 128 ;
160+
161+ return 0 ;
162+ }
163+
110164/**
111165 * igc_init_mac_params_base - Init MAC func ptrs.
112166 * @hw: pointer to the HW structure
113167 */
114168static s32 igc_init_mac_params_base (struct igc_hw * hw )
115169{
170+ struct igc_dev_spec_base * dev_spec = & hw -> dev_spec ._base ;
116171 struct igc_mac_info * mac = & hw -> mac ;
117172
118173 /* Set mta register count */
@@ -125,6 +180,10 @@ static s32 igc_init_mac_params_base(struct igc_hw *hw)
125180 mac -> ops .acquire_swfw_sync = igc_acquire_swfw_sync_i225 ;
126181 mac -> ops .release_swfw_sync = igc_release_swfw_sync_i225 ;
127182
183+ /* Allow a single clear of the SW semaphore on I225 */
184+ if (mac -> type == igc_i225 )
185+ dev_spec -> clear_semaphore_once = true;
186+
128187 return 0 ;
129188}
130189
@@ -142,10 +201,43 @@ static s32 igc_get_invariants_base(struct igc_hw *hw)
142201 if (ret_val )
143202 goto out ;
144203
204+ /* NVM initialization */
205+ ret_val = igc_init_nvm_params_base (hw );
206+ switch (hw -> mac .type ) {
207+ case igc_i225 :
208+ ret_val = igc_init_nvm_params_i225 (hw );
209+ break ;
210+ default :
211+ break ;
212+ }
213+
214+ if (ret_val )
215+ goto out ;
216+
145217out :
146218 return ret_val ;
147219}
148220
221+ /**
222+ * igc_get_link_up_info_base - Get link speed/duplex info
223+ * @hw: pointer to the HW structure
224+ * @speed: stores the current speed
225+ * @duplex: stores the current duplex
226+ *
227+ * This is a wrapper function, if using the serial gigabit media independent
228+ * interface, use PCS to retrieve the link speed and duplex information.
229+ * Otherwise, use the generic function to get the link speed and duplex info.
230+ */
231+ static s32 igc_get_link_up_info_base (struct igc_hw * hw , u16 * speed ,
232+ u16 * duplex )
233+ {
234+ s32 ret_val ;
235+
236+ ret_val = igc_get_speed_and_duplex_copper (hw , speed , duplex );
237+
238+ return ret_val ;
239+ }
240+
149241/**
150242 * igc_init_hw_base - Initialize hardware
151243 * @hw: pointer to the HW structure
@@ -184,6 +276,19 @@ static s32 igc_init_hw_base(struct igc_hw *hw)
184276 return ret_val ;
185277}
186278
279+ /**
280+ * igc_read_mac_addr_base - Read device MAC address
281+ * @hw: pointer to the HW structure
282+ */
283+ static s32 igc_read_mac_addr_base (struct igc_hw * hw )
284+ {
285+ s32 ret_val = 0 ;
286+
287+ ret_val = igc_read_mac_addr (hw );
288+
289+ return ret_val ;
290+ }
291+
187292/**
188293 * igc_rx_fifo_flush_base - Clean rx fifo after Rx enable
189294 * @hw: pointer to the HW structure
@@ -262,6 +367,10 @@ void igc_rx_fifo_flush_base(struct igc_hw *hw)
262367
263368static struct igc_mac_operations igc_mac_ops_base = {
264369 .init_hw = igc_init_hw_base ,
370+ .check_for_link = igc_check_for_link_base ,
371+ .rar_set = igc_rar_set ,
372+ .read_mac_addr = igc_read_mac_addr_base ,
373+ .get_speed_and_duplex = igc_get_link_up_info_base ,
265374};
266375
267376const struct igc_info igc_base_info = {
0 commit comments