Lines Matching +full:valid +full:- +full:mask

1 // SPDX-License-Identifier: GPL-2.0
44 /// PHY is in full-duplex mode.
46 /// PHY is in half-duplex mode.
79 /// For the duration of 'a, the pointer must point at a valid `phy_device`,
82 unsafe fn from_raw<'a>(ptr: *mut bindings::phy_device) -> &'a mut Self { in from_raw()
85 // SAFETY: by the function requirements the pointer is valid and we have unique access for in from_raw()
91 pub fn phy_id(&self) -> u32 { in phy_id()
99 pub fn state(&self) -> DeviceState { in state()
122 pub fn is_link_up(&self) -> bool { in is_link_up()
132 /// Gets the current auto-negotiation configuration.
134 /// It returns true if auto-negotiation is enabled.
135 pub fn is_autoneg_enabled(&self) -> bool { in is_autoneg_enabled()
144 /// Gets the current auto-negotiation state.
146 /// It returns true if auto-negotiation is completed.
147 pub fn is_autoneg_completed(&self) -> bool { in is_autoneg_completed()
180 pub fn read(&mut self, regnum: u16) -> Result<u16> { in read()
182 // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Self`. in read()
183 // So it's just an FFI call, open code of `phy_read()` with a valid `phy_device` pointer in read()
196 pub fn write(&mut self, regnum: u16, val: u16) -> Result { in write()
198 // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Self`. in write()
199 // So it's just an FFI call, open code of `phy_write()` with a valid `phy_device` pointer in write()
207 pub fn read_paged(&mut self, page: u16, regnum: u16) -> Result<u16> { in read_paged()
209 // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Self`. in read_paged()
222 // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Self`. in resolve_aneg_linkmode()
228 pub fn genphy_soft_reset(&mut self) -> Result { in genphy_soft_reset()
230 // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Self`. in genphy_soft_reset()
236 pub fn init_hw(&mut self) -> Result { in init_hw()
238 // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Self`. in init_hw()
243 /// Starts auto-negotiation.
244 pub fn start_aneg(&mut self) -> Result { in start_aneg()
246 // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Self`. in start_aneg()
252 pub fn genphy_resume(&mut self) -> Result { in genphy_resume()
254 // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Self`. in genphy_resume()
260 pub fn genphy_suspend(&mut self) -> Result { in genphy_suspend()
262 // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Self`. in genphy_suspend()
268 pub fn genphy_read_status(&mut self) -> Result<u16> { in genphy_read_status()
270 // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Self`. in genphy_read_status()
281 pub fn genphy_update_link(&mut self) -> Result { in genphy_update_link()
283 // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Self`. in genphy_update_link()
289 pub fn genphy_read_lpa(&mut self) -> Result { in genphy_read_lpa()
291 // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Self`. in genphy_read_lpa()
297 pub fn genphy_read_abilities(&mut self) -> Result { in genphy_read_abilities()
299 // SAFETY: `phydev` is pointing to a valid object by the type invariant of `Self`. in genphy_read_abilities()
330 ) -> core::ffi::c_int { in soft_reset_callback()
333 // where we hold `phy_device->lock`, so the accessors on in soft_reset_callback()
346 ) -> core::ffi::c_int { in get_features_callback()
349 // where we hold `phy_device->lock`, so the accessors on in get_features_callback()
360 unsafe extern "C" fn suspend_callback(phydev: *mut bindings::phy_device) -> core::ffi::c_int { in suspend_callback()
363 // `Device` are okay to call even though `phy_device->lock` in suspend_callback()
374 unsafe extern "C" fn resume_callback(phydev: *mut bindings::phy_device) -> core::ffi::c_int { in resume_callback()
377 // `Device` are okay to call even though `phy_device->lock` in resume_callback()
390 ) -> core::ffi::c_int { in config_aneg_callback()
393 // where we hold `phy_device->lock`, so the accessors on in config_aneg_callback()
406 ) -> core::ffi::c_int { in read_status_callback()
409 // where we hold `phy_device->lock`, so the accessors on in read_status_callback()
422 ) -> core::ffi::c_int { in match_phy_device_callback()
424 // where we hold `phy_device->lock`, so the accessors on in match_phy_device_callback()
437 ) -> i32 { in read_mmd_callback()
440 // where we hold `phy_device->lock`, so the accessors on in read_mmd_callback()
457 ) -> i32 { in write_mmd_callback()
460 // where we hold `phy_device->lock`, so the accessors on in write_mmd_callback()
473 // where we hold `phy_device->lock`, so the accessors on in link_change_notify_callback()
487 /// `self.0` is always in a valid state.
502 pub const fn create_phy_driver<T: Driver>() -> DriverVTable { in create_phy_driver()
578 /// The default id and mask are zero.
582 fn soft_reset(_dev: &mut Device) -> Result { in soft_reset()
587 fn get_features(_dev: &mut Device) -> Result { in get_features()
593 fn match_phy_device(_dev: &Device) -> bool { in match_phy_device()
597 /// Configures the advertisement and resets auto-negotiation
598 /// if auto-negotiation is enabled.
599 fn config_aneg(_dev: &mut Device) -> Result { in config_aneg()
604 fn read_status(_dev: &mut Device) -> Result<u16> { in read_status()
609 fn suspend(_dev: &mut Device) -> Result { in suspend()
614 fn resume(_dev: &mut Device) -> Result { in resume()
619 fn read_mmd(_dev: &mut Device, _devnum: u8, _regnum: u16) -> Result<u16> { in read_mmd()
624 fn write_mmd(_dev: &mut Device, _devnum: u8, _regnum: u16, _val: u16) -> Result { in write_mmd()
648 ) -> Result<Self> { in register()
665 // SAFETY: The type invariants guarantee that `self.drivers` is valid. in drop()
679 mask: DeviceMask, field
683 /// Creates a new instance with the exact match mask.
684 pub const fn new_with_exact_mask(id: u32) -> Self { in new_with_exact_mask()
687 mask: DeviceMask::Exact, in new_with_exact_mask()
691 /// Creates a new instance with the model match mask.
692 pub const fn new_with_model_mask(id: u32) -> Self { in new_with_model_mask()
695 mask: DeviceMask::Model, in new_with_model_mask()
699 /// Creates a new instance with the vendor match mask.
700 pub const fn new_with_vendor_mask(id: u32) -> Self { in new_with_vendor_mask()
703 mask: DeviceMask::Vendor, in new_with_vendor_mask()
707 /// Creates a new instance with a custom match mask.
708 pub const fn new_with_custom_mask(id: u32, mask: u32) -> Self { in new_with_custom_mask()
711 mask: DeviceMask::Custom(mask), in new_with_custom_mask()
716 pub const fn new_with_driver<T: Driver>() -> Self { in new_with_driver()
720 /// Get a `mask` as u32.
721 pub const fn mask_as_int(&self) -> u32 { in mask_as_int()
722 self.mask.as_int() in mask_as_int()
727 pub const fn mdio_device_id(&self) -> bindings::mdio_device_id { in mdio_device_id()
730 phy_id_mask: self.mask.as_int(), in mdio_device_id()
747 const fn as_int(&self) -> u32 { in as_int()
752 DeviceMask::Custom(mask) => *mask, in as_int()
824 /// fn init(module: &'static ThisModule) -> Result<Self> {
886 fn init(module: &'static ThisModule) -> Result<Self> {