]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
FSL LAW: Add new interface to use the last free LAW
authorKumar Gala <galak@kernel.crashing.org>
Tue, 10 Jun 2008 21:16:02 +0000 (16:16 -0500)
committerAndrew Fleming-AFLEMING <afleming@freescale.com>
Wed, 11 Jun 2008 06:53:09 +0000 (01:53 -0500)
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>
drivers/misc/fsl_law.c
include/asm-ppc/fsl_law.h

index d7d6c403baa583ff169315f2b3e384d941ad0a0a..48ece4f090b8c2af5e9705529ad22fafa43f7de1 100644 (file)
@@ -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);
index 6c445a471a9b8bcf7ffc83e66b3bb5f378cb5809..227bf8326c0979bd6384d2873463269cd047be71 100644 (file)
@@ -74,6 +74,7 @@ struct law_entry {
 
 extern void set_law(u8 idx, phys_addr_t addr, enum law_size sz, enum law_trgt_if id);
 extern int set_next_law(phys_addr_t addr, enum law_size sz, enum law_trgt_if id);
+extern int set_last_law(phys_addr_t addr, enum law_size sz, enum law_trgt_if id);
 extern void disable_law(u8 idx);
 extern void init_laws(void);
 extern void print_laws(void);