Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pinctrl: aspeed: Rework strap register write logic for the AST2500

Yong Li found that writes to the AST2500 strapping register were not
properly supported by the Aspeed pinctrl core and provided a patch to
rectify the problem. Several revisions of the patch were posted and
ultimately v4 should have been applied, however some unfortunate
liberal application of tags on my part lead to confusion between v3[1]
and v4[2].

Generate the diff between v3 and v4 to apply as a fixup patch.

[1] http://patchwork.ozlabs.org/patch/801662/
[2] http://patchwork.ozlabs.org/patch/802946/

Cc: Yong Li <sdliyong@gmail.com>
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Andrew Jeffery and committed by
Linus Walleij
5241bd16 faaaba06

+16 -10
+16 -10
drivers/pinctrl/aspeed/pinctrl-aspeed.c
··· 183 183 { 184 184 int ret; 185 185 int i; 186 - unsigned int rev_id; 187 186 188 187 for (i = 0; i < expr->ndescs; i++) { 189 188 const struct aspeed_sig_desc *desc = &expr->descs[i]; ··· 215 216 216 217 /* On AST2500, Set bits in SCU7C are cleared from SCU70 */ 217 218 if (desc->ip == ASPEED_IP_SCU && desc->reg == HW_STRAP1) { 219 + unsigned int rev_id; 220 + 218 221 ret = regmap_read(maps[ASPEED_IP_SCU], 219 222 HW_REVISION_ID, &rev_id); 220 223 if (ret < 0) 221 224 return ret; 222 225 223 - if (0x04 == ((rev_id >> 24) & 0xff)) 224 - ret = regmap_write(maps[desc->ip], 225 - HW_REVISION_ID, (~val & desc->mask)); 226 - else 227 - ret = regmap_update_bits(maps[desc->ip], 228 - desc->reg, desc->mask, val); 229 - } else 230 - ret = regmap_update_bits(maps[desc->ip], desc->reg, 231 - desc->mask, val); 226 + if (0x04 == (rev_id >> 24)) { 227 + u32 value = ~val & desc->mask; 228 + 229 + if (value) { 230 + ret = regmap_write(maps[desc->ip], 231 + HW_REVISION_ID, value); 232 + if (ret < 0) 233 + return ret; 234 + } 235 + } 236 + } 237 + 238 + ret = regmap_update_bits(maps[desc->ip], desc->reg, 239 + desc->mask, val); 232 240 233 241 if (ret) 234 242 return ret;