Skip to content
Snippets Groups Projects
Commit 313505cb authored by Beata Michalska's avatar Beata Michalska
Browse files

drm: panthor-rs: Add first phase for MMU related bits

parent c9e506fb
No related tags found
Loading
Pipeline #1381149 failed
......@@ -3,13 +3,23 @@
//! Top-level GPU driver implementation.
use kernel::{
bindings, c_str, drm, drm::drv, drm::ioctl, error::Result, error::to_result, of, platform, prelude::*, sync::Arc,
bindings,
c_str,
drm, drm::drv, drm::ioctl,
error::Result, error::to_result,
new_mutex,
of,
platform,
prelude::*,
sync::{Arc, Mutex},
};
use core::ffi;
use kernel::macros::vtable;
use kernel::types::{ ARef, ForeignOwnable};
use crate::mmu::Mmu;
#[cfg(CONFIG_PM)]
use kernel::runtime_dev_pm_ops;
......@@ -41,6 +51,9 @@ pub(crate) struct PanthorData {
#[pin]
pub(crate) ptdev: *mut bindings::panthor_device,
pub(crate) pdev: platform::Device,
// @TODO: Temporarily wrapped in Mutex & Option to support lazy init
#[pin]
pub(crate) mmu: Mutex<Option<Arc<Mmu>>>,
}
//HACK
......@@ -178,11 +191,14 @@ impl platform::Driver for PanthorDriver {
to_result(unsafe { panthor_init() })?;
let data = Arc::new(
PanthorData {
// This is needed due to moving the var to closure in try_pin_init
let pdev_c = pdev.clone();
let data = Arc::pin_init(
try_pin_init!( PanthorData {
ptdev: unsafe { bindings::panthor_device_alloc() },
pdev: pdev.clone(),
},
pdev: pdev_c,
mmu <- new_mutex!(None),
}),
GFP_KERNEL,
)?;
......@@ -194,6 +210,10 @@ impl platform::Driver for PanthorDriver {
panthor_device_init(data.ptdev);
}
// Init MMU
let mut mmu_locked = data.mmu.lock();
mmu_locked.replace(Mmu::new(drm.clone())?);
drm::drv::Registration::new_foreign_owned(drm.clone(), 0)?;
dev_info!(pdev.as_ref(), "Probed!\n");
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment