diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2008-06-10 16:16:02 -0500 |
---|---|---|
committer | Andrew Fleming-AFLEMING <afleming@freescale.com> | 2008-06-11 01:53:09 -0500 |
commit | ba04f7010958e88a8910f2a123fee53fdc72e013 (patch) | |
tree | 73d8ef2f836c87e4d91fc7333915981e8588742b /drivers | |
parent | 859a86a25c569d3665ff413d1d923394b8a961f3 (diff) | |
download | u-boot-imx-ba04f7010958e88a8910f2a123fee53fdc72e013.zip u-boot-imx-ba04f7010958e88a8910f2a123fee53fdc72e013.tar.gz u-boot-imx-ba04f7010958e88a8910f2a123fee53fdc72e013.tar.bz2 |
FSL LAW: Add new interface to use the last free LAW
LAWs have the concept of priority so its useful to be able to allocate
the lowest (highest number) priority. We will end up using this with the
new DDR code.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/misc/fsl_law.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/misc/fsl_law.c b/drivers/misc/fsl_law.c index d7d6c40..48ece4f 100644 --- a/drivers/misc/fsl_law.c +++ b/drivers/misc/fsl_law.c @@ -70,6 +70,25 @@ int set_next_law(phys_addr_t addr, enum law_size sz, enum law_trgt_if id) return idx; } +int set_last_law(phys_addr_t addr, enum law_size sz, enum law_trgt_if id) +{ + u32 idx; + + /* we have no LAWs free */ + if (gd->used_laws == -1) + return -1; + + /* grab the last free law */ + idx = __ilog2(~(gd->used_laws)); + + if (idx >= FSL_HW_NUM_LAWS) + return -1; + + set_law(idx, addr, sz, id); + + return idx; +} + void disable_law(u8 idx) { volatile u32 *base = (volatile u32 *)(CFG_IMMR + 0xc08); |