misc: generic on-chip SRAM allocation driver

This driver requests and remaps a memory region as configured in the
device tree.  It serves memory from this region via the genalloc API.  It
optionally enables the SRAM clock.

Other drivers can retrieve the genalloc pool from a phandle pointing to
this drivers' device node in the device tree.

The allocation granularity is hard-coded to 32 bytes for now, to make the
SRAM driver useful for the 6502 remoteproc driver.  There is overhead for
bigger SRAMs, where only a much coarser allocation granularity is needed:
At 32 bytes minimum allocation size, a 256 KiB SRAM needs a 1 KiB bitmap
to track allocations.

[[email protected]: fix Kconfig text, make sram_init static]
Signed-off-by: Philipp Zabel <[email protected]>
Reviewed-by: Shawn Guo <[email protected]>
Acked-by: Grant Likely <[email protected]>
Tested-by: Michal Simek <[email protected]>
Cc: Dong Aisheng <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Huang Shijie <[email protected]>
Cc: Javier Martin <[email protected]>
Cc: Matt Porter <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Paul Gortmaker <[email protected]>
Cc: Rob Herring <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Philipp Zabel 2013-04-29 16:17:12 -07:00 • committed by Linus Torvalds
commit 4984c6f5e5
4 changed files with 147 additions and 0 deletions

View file

@ -0,0 +1,16 @@
Generic on-chip SRAM
Simple IO memory regions to be managed by the genalloc API.
Required properties:
- compatible : mmio-sram
- reg : SRAM iomem address range
Example:
sram: sram@5c000000 {
compatible = "mmio-sram";
reg = <0x5c000000 0x40000>; /* 256 KiB SRAM at address 0x5c000000 */
};