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

misc: aspeed-lpc-ctrl: Enable FWH and A2H bridge cycles

To date this driver has relied on prevous state from out of tree hacks
and vendor u-boot trees in order to have the host be able to access
data over the LPC bus.

Now we explicitly enable the AHB to LPC bridge and FWH cycles from when
the user first configures the address to map. We chose to do this then
as before that time there is no way for the kernel to know where it is
safe to point the LPC window.

Tested-by: Lei YU <mine260309@gmail.com>
Reviewed-by: Andrew Jeffery <andrew@aj.id.au>
Signed-off-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Cyril Bur <cyrilbur@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Joel Stanley and committed by
Greg Kroah-Hartman
f4d02909 99aad9e3

+16 -2
+16 -2
drivers/misc/aspeed-lpc-ctrl.c
··· 21 21 22 22 #define DEVICE_NAME "aspeed-lpc-ctrl" 23 23 24 + #define HICR5 0x0 25 + #define HICR5_ENL2H BIT(8) 26 + #define HICR5_ENFWH BIT(10) 27 + 24 28 #define HICR7 0x8 25 29 #define HICR8 0xc 26 30 ··· 159 155 if (rc) 160 156 return rc; 161 157 162 - return regmap_write(lpc_ctrl->regmap, HICR8, 163 - (~(map.size - 1)) | ((map.size >> 16) - 1)); 158 + rc = regmap_write(lpc_ctrl->regmap, HICR8, 159 + (~(map.size - 1)) | ((map.size >> 16) - 1)); 160 + if (rc) 161 + return rc; 162 + 163 + /* 164 + * Enable LPC FHW cycles. This is required for the host to 165 + * access the regions specified. 166 + */ 167 + return regmap_update_bits(lpc_ctrl->regmap, HICR5, 168 + HICR5_ENFWH | HICR5_ENL2H, 169 + HICR5_ENFWH | HICR5_ENL2H); 164 170 } 165 171 166 172 return -EINVAL;