From d381294aef4a5b6ddeda3685519330a5b73d884f Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Fri, 21 Mar 2014 15:58:03 -0600 Subject: ARM: tegra: pack pinmux data tables tighter Use smaller fields in the Tegra pinmux structures in order to pack the data tables into a smaller space. This saves around 1-3KB for the SPL and around 3-8KB for the main build of U-Boot, depending on the board, which SoC it uses, and how many pinmux table entries there are. In order to pack PMUX_FUNC_* into a smaller space, don't hard-code the values of PMUX_FUNC_RSVD* to values which require 16 bits to store them, but instead let their values be assigned automatically, so they end up fitting into 8 bits. Signed-off-by: Stephen Warren Acked-by: Simon Glass Signed-off-by: Tom Warren --- arch/arm/cpu/tegra-common/pinmux-common.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'arch/arm/cpu/tegra-common/pinmux-common.c') diff --git a/arch/arm/cpu/tegra-common/pinmux-common.c b/arch/arm/cpu/tegra-common/pinmux-common.c index 32a46d53f0..d62618cd0f 100644 --- a/arch/arm/cpu/tegra-common/pinmux-common.c +++ b/arch/arm/cpu/tegra-common/pinmux-common.c @@ -14,8 +14,7 @@ /* return 1 if a pmux_func is in range */ #define pmux_func_isvalid(func) \ - ((((func) >= 0) && ((func) < PMUX_FUNC_COUNT)) || \ - (((func) >= PMUX_FUNC_RSVD1) && ((func) <= PMUX_FUNC_RSVD4))) + (((func) >= 0) && ((func) < PMUX_FUNC_COUNT)) /* return 1 if a pin_pupd_is in range */ #define pmux_pin_pupd_isvalid(pupd) \ @@ -97,8 +96,8 @@ void pinmux_set_func(enum pmux_pingrp pin, enum pmux_func func) assert(pmux_pingrp_isvalid(pin)); assert(pmux_func_isvalid(func)); - if (func & PMUX_FUNC_RSVD1) { - mux = func & 3; + if (func >= PMUX_FUNC_RSVD1) { + mux = (func - PMUX_FUNC_RSVD1) & 3; } else { /* Search for the appropriate function */ for (i = 0; i < 4; i++) { -- cgit v1.2.1