-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A mainboard driver will do init functions as needed, as well as supporting read and write. The ClockNode might be useful. Signed-off-by: Ronald G Minnich <rminnich@gmail.com>
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* This file is part of the coreboot project. | ||
* | ||
* Copyright (C) 2020 Google Inc. | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; version 2 of the License. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
*/ | ||
|
||
pub struct MainBoard { | ||
} | ||
|
||
impl MainBoard { | ||
pub fn new(base: usize, baudrate: u32) -> MainBoard { | ||
MainBoard { } | ||
} | ||
} | ||
|
||
impl Driver for MainBoard { | ||
fn init(&mut self) -> Result<()> { | ||
Ok(()) | ||
} | ||
|
||
fn pread(&self, data: &mut [u8], _offset: usize) -> Result<usize> { | ||
return Ok(0); | ||
} | ||
|
||
fn pwrite(&mut self, data: &[u8], _offset: usize) -> Result<usize> { | ||
Ok(data.len()) | ||
} | ||
|
||
fn shutdown(&mut self) {} | ||
} | ||
|
||
impl ClockNode for MainBoard { | ||
// This uses hfclk as the input rate. | ||
fn set_clock_rate(&mut self, rate: u32) { | ||
} | ||
} | ||
|