summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorCédric Le Goater <clg@kaod.org>2017-10-09 15:41:07 +0200
committerJoel Stanley <joel@jms.id.au>2019-03-20 15:13:32 +1030
commitb73be2f6da2bd9e6009ba26411d7694232802fb4 (patch)
tree4a0793d726bc70384cf87ab00c20c886c5acde70 /drivers/mtd
parentab37b762c44bbd0b01f115540a546e30e7cd1986 (diff)
downloadblackbird-obmc-linux-b73be2f6da2bd9e6009ba26411d7694232802fb4.tar.gz
blackbird-obmc-linux-b73be2f6da2bd9e6009ba26411d7694232802fb4.zip
mtd: spi-nor: aspeed: link controller with the ahb clock
We will need the AHB frequency to set the HCLK settings in the SMC controller to optimize the reads. OpenBMC-Staging-Count: 5 Signed-off-by: Cédric Le Goater <clg@kaod.org> Signed-off-by: Joel Stanley <joel@jms.id.au>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/spi-nor/aspeed-smc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/mtd/spi-nor/aspeed-smc.c b/drivers/mtd/spi-nor/aspeed-smc.c
index 942d5be77316..2dcdd2d09b80 100644
--- a/drivers/mtd/spi-nor/aspeed-smc.c
+++ b/drivers/mtd/spi-nor/aspeed-smc.c
@@ -10,6 +10,7 @@
*/
#include <linux/bug.h>
+#include <linux/clk.h>
#include <linux/device.h>
#include <linux/io.h>
#include <linux/module.h>
@@ -113,6 +114,8 @@ struct aspeed_smc_controller {
void __iomem *ahb_base; /* per-chip windows resource */
u32 ahb_window_size; /* full mapping window size */
+ unsigned long clk_frequency;
+
struct aspeed_smc_chip *chips[0]; /* pointers to attached chips */
};
@@ -911,6 +914,7 @@ static int aspeed_smc_probe(struct platform_device *pdev)
struct aspeed_smc_controller *controller;
const struct of_device_id *match;
const struct aspeed_smc_info *info;
+ struct clk *clk;
struct resource *res;
int ret;
@@ -942,6 +946,12 @@ static int aspeed_smc_probe(struct platform_device *pdev)
controller->ahb_window_size = resource_size(res);
+ clk = devm_clk_get(&pdev->dev, NULL);
+ if (IS_ERR(clk))
+ return PTR_ERR(clk);
+ controller->clk_frequency = clk_get_rate(clk);
+ devm_clk_put(&pdev->dev, clk);
+
ret = aspeed_smc_setup_flash(controller, np, res);
if (ret)
dev_err(dev, "Aspeed SMC probe failed %d\n", ret);
OpenPOWER on IntegriCloud