mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
Convert all PFALCON, PFALCON2 and PRISCV registers to use the kernel's register macro and update the code accordingly. Because they rely on the same types to implement relative registers, they need to be updated in lockstep. nova-core's local register macro is now unused, so remove it. Reviewed-by: Gary Guo <gary@garyguo.net> Acked-by: Danilo Krummrich <dakr@kernel.org> Link: https://patch.msgid.link/20260325-b4-nova-register-v4-8-bdf172f0f6ca@nvidia.com [acourbot@nvidia.com: remove unused import.] Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
82 lines
1.8 KiB
Rust
82 lines
1.8 KiB
Rust
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
use core::marker::PhantomData;
|
|
|
|
use kernel::{
|
|
io::{
|
|
poll::read_poll_timeout,
|
|
register::WithBase,
|
|
Io, //
|
|
},
|
|
prelude::*,
|
|
time::Delta, //
|
|
};
|
|
|
|
use crate::{
|
|
driver::Bar0,
|
|
falcon::{
|
|
hal::LoadMethod,
|
|
Falcon,
|
|
FalconBromParams,
|
|
FalconEngine, //
|
|
},
|
|
regs, //
|
|
};
|
|
|
|
use super::FalconHal;
|
|
|
|
pub(super) struct Tu102<E: FalconEngine>(PhantomData<E>);
|
|
|
|
impl<E: FalconEngine> Tu102<E> {
|
|
pub(super) fn new() -> Self {
|
|
Self(PhantomData)
|
|
}
|
|
}
|
|
|
|
impl<E: FalconEngine> FalconHal<E> for Tu102<E> {
|
|
fn select_core(&self, _falcon: &Falcon<E>, _bar: &Bar0) -> Result {
|
|
Ok(())
|
|
}
|
|
|
|
fn signature_reg_fuse_version(
|
|
&self,
|
|
_falcon: &Falcon<E>,
|
|
_bar: &Bar0,
|
|
_engine_id_mask: u16,
|
|
_ucode_id: u8,
|
|
) -> Result<u32> {
|
|
Ok(0)
|
|
}
|
|
|
|
fn program_brom(&self, _falcon: &Falcon<E>, _bar: &Bar0, _params: &FalconBromParams) -> Result {
|
|
Ok(())
|
|
}
|
|
|
|
fn is_riscv_active(&self, bar: &Bar0) -> bool {
|
|
bar.read(regs::NV_PRISCV_RISCV_CORE_SWITCH_RISCV_STATUS::of::<E>())
|
|
.active_stat()
|
|
}
|
|
|
|
fn reset_wait_mem_scrubbing(&self, bar: &Bar0) -> Result {
|
|
// TIMEOUT: memory scrubbing should complete in less than 10ms.
|
|
read_poll_timeout(
|
|
|| Ok(bar.read(regs::NV_PFALCON_FALCON_DMACTL::of::<E>())),
|
|
|r| r.mem_scrubbing_done(),
|
|
Delta::ZERO,
|
|
Delta::from_millis(10),
|
|
)
|
|
.map(|_| ())
|
|
}
|
|
|
|
fn reset_eng(&self, bar: &Bar0) -> Result {
|
|
regs::NV_PFALCON_FALCON_ENGINE::reset_engine::<E>(bar);
|
|
self.reset_wait_mem_scrubbing(bar)?;
|
|
|
|
Ok(())
|
|
}
|
|
|
|
fn load_method(&self) -> LoadMethod {
|
|
LoadMethod::Pio
|
|
}
|
|
}
|