@@ -44,7 +44,7 @@ pub enum AdinError<E> {
44
44
MDIO_ACC_TIMEOUT ,
45
45
}
46
46
47
- pub type AEResult < T , SPIE > = core:: result:: Result < T , AdinError < SPIE > > ;
47
+ pub type AEResult < T , SPIError > = core:: result:: Result < T , AdinError < SPIError > > ;
48
48
pub const MDIO_PHY_ADDR : u8 = 0x01 ;
49
49
50
50
/// Maximum Transmission Unit
@@ -100,16 +100,12 @@ pub(crate) fn size_align_u32(size: u32) -> u32 {
100
100
( size + 3 ) & 0xFFFF_FFFC
101
101
}
102
102
103
- impl < SpiE , SPI > ADIN1110 < SPI >
104
- where
105
- SPI : SpiDevice < u8 , Error = SpiE > ,
106
- SpiE : core:: fmt:: Debug ,
107
- {
103
+ impl < SPI : SpiDevice > ADIN1110 < SPI > {
108
104
pub fn new ( spi : SPI , crc : bool ) -> Self {
109
105
Self { spi, crc }
110
106
}
111
107
112
- pub async fn read_reg ( & mut self , reg : sr ) -> AEResult < u32 , SpiE > {
108
+ pub async fn read_reg ( & mut self , reg : sr ) -> AEResult < u32 , SPI :: Error > {
113
109
let mut tx_buf = Vec :: < u8 , 16 > :: new ( ) ;
114
110
115
111
let mut spi_hdr = SpiHeader ( 0 ) ;
@@ -148,7 +144,7 @@ where
148
144
Ok ( value)
149
145
}
150
146
151
- pub async fn write_reg ( & mut self , reg : sr , value : u32 ) -> AEResult < ( ) , SpiE > {
147
+ pub async fn write_reg ( & mut self , reg : sr , value : u32 ) -> AEResult < ( ) , SPI :: Error > {
152
148
let mut tx_buf = Vec :: < u8 , 16 > :: new ( ) ;
153
149
154
150
let mut spi_hdr = SpiHeader ( 0 ) ;
@@ -177,7 +173,7 @@ where
177
173
}
178
174
179
175
/// helper function for write to `MDIO_ACC` register and wait for ready!
180
- async fn write_mdio_acc_reg ( & mut self , mdio_acc_val : u32 ) -> AEResult < u32 , SpiE > {
176
+ async fn write_mdio_acc_reg ( & mut self , mdio_acc_val : u32 ) -> AEResult < u32 , SPI :: Error > {
181
177
self . write_reg ( sr:: MDIO_ACC , mdio_acc_val) . await ?;
182
178
183
179
// TODO: Add proper timeout!
@@ -192,7 +188,7 @@ where
192
188
}
193
189
194
190
/// Read out fifo ethernet packet memory received via the wire.
195
- pub async fn read_fifo ( & mut self , packet : & mut [ u8 ] ) -> AEResult < usize , SpiE > {
191
+ pub async fn read_fifo ( & mut self , packet : & mut [ u8 ] ) -> AEResult < usize , SPI :: Error > {
196
192
let mut tx_buf = Vec :: < u8 , 16 > :: new ( ) ;
197
193
198
194
// Size of the frame, also includes the appednded header.
@@ -238,7 +234,7 @@ where
238
234
}
239
235
240
236
/// Write to fifo ethernet packet memory send over the wire.
241
- pub async fn write_fifo ( & mut self , frame : & [ u8 ] ) -> AEResult < ( ) , SpiE > {
237
+ pub async fn write_fifo ( & mut self , frame : & [ u8 ] ) -> AEResult < ( ) , SPI :: Error > {
242
238
let header_len = self . header_write_len ( ) ;
243
239
244
240
let mut packet = Packet :: new ( ) ;
@@ -318,7 +314,7 @@ where
318
314
/// Programs the mac address in the mac filters.
319
315
/// Also set the boardcast address.
320
316
/// The chip supports 2 priority queues but current code doesn't support this mode.
321
- pub async fn set_mac_addr ( & mut self , mac : & [ u8 ; 6 ] ) -> AEResult < ( ) , SpiE > {
317
+ pub async fn set_mac_addr ( & mut self , mac : & [ u8 ; 6 ] ) -> AEResult < ( ) , SPI :: Error > {
322
318
let mac_high_part = u16:: from_be_bytes ( mac[ 0 ..2 ] . try_into ( ) . unwrap ( ) ) ;
323
319
let mac_low_part = u32:: from_be_bytes ( mac[ 2 ..6 ] . try_into ( ) . unwrap ( ) ) ;
324
320
@@ -341,12 +337,8 @@ where
341
337
}
342
338
}
343
339
344
- impl < SpiE , SPI > mdio:: MdioBus for ADIN1110 < SPI >
345
- where
346
- SPI : SpiDevice < u8 , Error = SpiE > ,
347
- SpiE : core:: fmt:: Debug ,
348
- {
349
- type Error = AdinError < SpiE > ;
340
+ impl < SPI : SpiDevice > mdio:: MdioBus for ADIN1110 < SPI > {
341
+ type Error = AdinError < SPI :: Error > ;
350
342
351
343
/// Read from the PHY Registers as Clause 22.
352
344
async fn read_cl22 ( & mut self , phy_id : u8 , reg : u8 ) -> Result < u16 , Self :: Error > {
@@ -380,7 +372,7 @@ where
380
372
}
381
373
382
374
/// Write to the PHY Registers as Clause 45.
383
- async fn write_cl45 ( & mut self , phy_id : u8 , regc45 : ( u8 , u16 ) , value : u16 ) -> AEResult < ( ) , SpiE > {
375
+ async fn write_cl45 ( & mut self , phy_id : u8 , regc45 : ( u8 , u16 ) , value : u16 ) -> AEResult < ( ) , SPI :: Error > {
384
376
let phy_id = u32:: from ( phy_id & 0x1F ) << 21 ;
385
377
let dev_addr = u32:: from ( regc45. 0 & 0x1F ) << 16 ;
386
378
let reg = u32:: from ( regc45. 1 ) ;
0 commit comments