summaryrefslogtreecommitdiff
path: root/drivers/soc/aspeed
diff options
context:
space:
mode:
authorJoel Stanley <joel@jms.id.au>2020-03-12 15:14:13 +0300
committerJoel Stanley <joel@jms.id.au>2020-09-25 08:24:42 +0300
commit5042d3f278de45e215291d2adcf1024cc3c7f73a (patch)
tree5fc9eee19730b1c98409e3171c678cd9f21823cc /drivers/soc/aspeed
parent6bf4ddbe2b4805f0628922446a7e85e34013cd10 (diff)
downloadlinux-5042d3f278de45e215291d2adcf1024cc3c7f73a.tar.xz
soc: aspeed-lpc-ctrl: LPC to AHB mapping on ast2600
The ast2600 disables the mapping of AHB memory regions by default, only allowing the LPC window to point to SPI NOR. In order to point the window to any AHB address, an ast2600 specific bit must be toggled. Reviewed-by: Andrew Jeffery <andrew@aj.id.au> Link: https://lore.kernel.org/r/20200312121413.294384-1-joel@jms.id.au Signed-off-by: Joel Stanley <joel@jms.id.au>
Diffstat (limited to 'drivers/soc/aspeed')
-rw-r--r--drivers/soc/aspeed/aspeed-lpc-ctrl.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/soc/aspeed/aspeed-lpc-ctrl.c b/drivers/soc/aspeed/aspeed-lpc-ctrl.c
index d8f3dff97cd4..ee2def4ffda3 100644
--- a/drivers/soc/aspeed/aspeed-lpc-ctrl.c
+++ b/drivers/soc/aspeed/aspeed-lpc-ctrl.c
@@ -22,6 +22,9 @@
#define HICR5_ENL2H BIT(8)
#define HICR5_ENFWH BIT(10)
+#define HICR6 0x4
+#define SW_FWH2AHB BIT(17)
+
#define HICR7 0x8
#define HICR8 0xc
@@ -33,6 +36,7 @@ struct aspeed_lpc_ctrl {
resource_size_t mem_size;
u32 pnor_size;
u32 pnor_base;
+ bool fwh2ahb;
};
static struct aspeed_lpc_ctrl *file_aspeed_lpc_ctrl(struct file *file)
@@ -178,6 +182,16 @@ static long aspeed_lpc_ctrl_ioctl(struct file *file, unsigned int cmd,
return rc;
/*
+ * Switch to FWH2AHB mode, AST2600 only.
+ *
+ * The other bits in this register are interrupt status bits
+ * that are cleared by writing 1. As we don't want to clear
+ * them, set only the bit of interest.
+ */
+ if (lpc_ctrl->fwh2ahb)
+ regmap_write(lpc_ctrl->regmap, HICR6, SW_FWH2AHB);
+
+ /*
* Enable LPC FHW cycles. This is required for the host to
* access the regions specified.
*/
@@ -274,6 +288,9 @@ static int aspeed_lpc_ctrl_probe(struct platform_device *pdev)
return rc;
}
+ if (of_device_is_compatible(dev->of_node, "aspeed,ast2600-lpc-ctrl"))
+ lpc_ctrl->fwh2ahb = true;
+
lpc_ctrl->miscdev.minor = MISC_DYNAMIC_MINOR;
lpc_ctrl->miscdev.name = DEVICE_NAME;
lpc_ctrl->miscdev.fops = &aspeed_lpc_ctrl_fops;