PebbleOS v4.47.0-160-g9e782207f
Loading...
Searching...
No Matches
SF32LB MPI

Core of the SF32LB MPI memory controller. More...

Data Structures

struct  pbl_sf32lb_mpi
 SF32LB MPI controller. More...
 

Macros

#define PBL_SF32LB_MPI_DEFINE(sym, _name, _base, _mem_base, _mem_size, _clk, _pinctrl, ...)
 Define an SF32LB MPI controller.
 

Functions

int pbl_sf32lb_mpi_prepare (const struct pbl_sf32lb_mpi *mpi)
 Set up the pins and the clock parents of a controller, once.
 

Detailed Description

Core of the SF32LB MPI memory controller.

The controller drives one memory: a SPI one, with the SPI memory driver of the controller, or a HyperBus one, with its HyperBus driver. The core is what both have of the controller: its registers, its memory-mapped window, its clock and its pins. The devicetree generator gives a controller the driver for the memory on it.


Data Structure Documentation

◆ pbl_sf32lb_mpi

struct pbl_sf32lb_mpi

SF32LB MPI controller.

Data Fields
const struct pbl_clk_assigned * assigned Clock parents and rates to assign.
uintptr_t base Registers.
struct pbl_clk clk Clock.
struct pbl_device dev Device.
uintptr_t mem_base Memory-mapped window.
uint32_t mem_size Memory-mapped window size, in bytes.
struct pbl_pinctrl pinctrl Pins, when the boot code did not set them up.
struct pbl_sf32lb_mpi_state * state Runtime state.

Macro Definition Documentation

◆ PBL_SF32LB_MPI_DEFINE

#define PBL_SF32LB_MPI_DEFINE (   sym,
  _name,
  _base,
  _mem_base,
  _mem_size,
  _clk,
  _pinctrl,
  ... 
)
Value:
static struct pbl_sf32lb_mpi_state sym##_mpi_state; \
PBL_CLK_ASSIGNED_DEFINE(sym##_assigned, __VA_ARGS__); \
const struct pbl_sf32lb_mpi sym = { \
.dev = PBL_DEVICE_INIT(sym, _name, nullptr, nullptr, nullptr), \
.base = (_base), \
.mem_base = (_mem_base), \
.mem_size = (_mem_size), \
.clk = _clk, \
.pinctrl = PBL_PINCTRL(_pinctrl, nullptr, 0), \
.assigned = sym##_assigned, \
.state = &sym##_mpi_state, \
}; \
PBL_DEVICE_REGISTER(sym, &sym.dev)
#define PBL_DEVICE_STATE_DEFINE(sym)
Define the runtime state of device instance sym.
Definition device.h:131
#define PBL_DEVICE_INIT(sym, _name, _init, _parent, _deps)
Initializer for the struct pbl_device of device instance sym.
Definition device.h:164
uintptr_t mem_base
Memory-mapped window.
Definition sf32lb_mpi.h:38
struct pbl_clk clk
Clock.
Definition sf32lb_mpi.h:42
struct pbl_device dev
Device.
Definition sf32lb_mpi.h:34
struct pbl_sf32lb_mpi_state * state
Runtime state.
Definition sf32lb_mpi.h:48
struct pbl_pinctrl pinctrl
Pins, when the boot code did not set them up.
Definition sf32lb_mpi.h:44
SF32LB MPI controller.
Definition sf32lb_mpi.h:32
#define PBL_PINCTRL(_default, _sleep, _reg)
Initializer for a struct pbl_pinctrl.
Definition pinctrl.h:131

Define an SF32LB MPI controller.

Parameters
symSymbol of the controller.
_nameName.
_baseRegisters.
_mem_baseMemory-mapped window.
_mem_sizeMemory-mapped window size, in bytes.
_clkClock, from PBL_CLK().
_pinctrlDefault state of its pins, or NULL when the boot code set them up.
...PBL_CLK_ASSIGNED() initializers, applied by pbl_sf32lb_mpi_prepare().

Function Documentation

◆ pbl_sf32lb_mpi_prepare()

int pbl_sf32lb_mpi_prepare ( const struct pbl_sf32lb_mpi *  mpi)

Set up the pins and the clock parents of a controller, once.

Called by the driver of the memory on it before its first use, so that a controller nothing uses is left as it is.

Parameters
mpiController.
Returns
0 or a negative errno.