• Linus Walleij's avatar
    ARM: 8169/1: l2c: parse cache properties from ePAPR definitions · f3354ab6
    Linus Walleij authored
    When both 'cache-size' and 'cache-sets' are specified for a L2 cache
    controller node, parse those properties and set up the
    set size based on which type of L2 cache controller we are using.
    
    Update the L2 cache controller Device Tree binding with the optional
    'cache-size', 'cache-sets', 'cache-block-size' and 'cache-line-size'
    properties. These come from the ePAPR specification.
    
    Using the cache size, number of sets and cache line size we can
    calculate desired associativity of the L2 cache. This is done
    by the calculation:
    
        set size = cache size / sets
        ways = set size / line size
        way size = cache size / ways = sets * line size
        associativity = cache size / way size
    
    Example output from the PB1176 DT that look like this:
    
    L2: l2-cache {
        compatible = "arm,l220-cache";
        (...)
        arm,override-auxreg;
        cache-size = <131072>; // 128kB
        cache-sets = <512>;
        cache-line-size = <32>;
    };
    
    Ends up like this:
    
    L2C OF: override cache size: 131072 bytes (128KB)
    L2C OF: override line size: 32 bytes
    L2C OF: override way size: 16384 bytes (16KB)
    L2C OF: override associativity: 8
    L2C: DT/platform modifies aux control register: 0x02020fff -> 0x02030fff
    L2C-220 cache controller enabled, 8 ways, 128 kB
    L2C-220: CACHE_ID 0x41000486, AUX_CTRL 0x06030fff
    
    Which is consistent with the value earlier hardcoded for the
    PB1176 platform.
    
    This patch is an extended version based on the initial patch
    by Florian Fainelli.
    Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
    Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
    Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
    f3354ab6
l2cc.txt 3.22 KB