[PATCH linux dev-4.10 5/6] mtd: spi-nor: aspeed: link controller with the ahb clock
Cédric Le Goater
clg at kaod.org
Sat Mar 25 01:44:42 AEDT 2017
We will need the AHB frequency to set the HCLK settings in the SMC
controller to optimize the reads.
Signed-off-by: Cédric Le Goater <clg at kaod.org>
---
arch/arm/boot/dts/aspeed-bmc-opp-palmetto.dts | 4 ++++
arch/arm/boot/dts/aspeed-g5.dtsi | 6 ++++++
drivers/mtd/spi-nor/aspeed-smc.c | 7 +++++++
3 files changed, 17 insertions(+)
diff --git a/arch/arm/boot/dts/aspeed-bmc-opp-palmetto.dts b/arch/arm/boot/dts/aspeed-bmc-opp-palmetto.dts
index 140b5919748e..d5472b5ba409 100644
--- a/arch/arm/boot/dts/aspeed-bmc-opp-palmetto.dts
+++ b/arch/arm/boot/dts/aspeed-bmc-opp-palmetto.dts
@@ -56,6 +56,8 @@
compatible = "aspeed,ast2400-fmc";
aspeed,fmc-has-dma;
interrupts = <19>;
+ clocks = <&clk_ahb>;
+ clock-names = "ahb";
flash at 0 {
reg = < 0 >;
compatible = "jedec,spi-nor" ;
@@ -70,6 +72,8 @@
#address-cells = <1>;
#size-cells = <0>;
compatible = "aspeed,ast2400-spi";
+ clocks = <&clk_ahb>;
+ clock-names = "ahb";
flash {
reg = < 0 >;
compatible = "jedec,spi-nor" ;
diff --git a/arch/arm/boot/dts/aspeed-g5.dtsi b/arch/arm/boot/dts/aspeed-g5.dtsi
index bc5e00e72eba..77e3daaecd03 100644
--- a/arch/arm/boot/dts/aspeed-g5.dtsi
+++ b/arch/arm/boot/dts/aspeed-g5.dtsi
@@ -33,6 +33,8 @@
status = "disabled";
aspeed,fmc-has-dma;
interrupts = <19>;
+ clocks = <&clk_ahb>;
+ clock-names = "ahb";
flash at 0 {
reg = < 0 >;
compatible = "jedec,spi-nor";
@@ -58,6 +60,8 @@
#size-cells = <0>;
compatible = "aspeed,ast2500-spi";
status = "disabled";
+ clocks = <&clk_ahb>;
+ clock-names = "ahb";
flash at 0 {
reg = < 0 >;
compatible = "jedec,spi-nor";
@@ -77,6 +81,8 @@
#size-cells = <0>;
compatible = "aspeed,ast2500-spi";
status = "disabled";
+ clocks = <&clk_ahb>;
+ clock-names = "ahb";
flash at 0 {
reg = < 0 >;
compatible = "jedec,spi-nor";
diff --git a/drivers/mtd/spi-nor/aspeed-smc.c b/drivers/mtd/spi-nor/aspeed-smc.c
index 3c004dfaf873..1b398303f039 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/dma-direction.h>
#include <linux/dma-mapping.h>
@@ -119,6 +120,8 @@ struct aspeed_smc_controller {
void __iomem *regs; /* controller registers */
void __iomem *ahb_base; /* per-chip windows resource */
+ struct clk *ahb_clk;
+
/* interrupt handling */
int irq;
@@ -1107,6 +1110,10 @@ static int aspeed_smc_probe(struct platform_device *pdev)
if (IS_ERR(controller->ahb_base))
return PTR_ERR(controller->ahb_base);
+ controller->ahb_clk = devm_clk_get(&pdev->dev, "ahb");
+ if (IS_ERR(controller->ahb_clk))
+ return PTR_ERR(controller->ahb_clk);
+
aspeed_smc_dma_setup(controller, pdev);
ret = aspeed_smc_setup_flash(controller, np, res);
--
2.7.4
More information about the openbmc
mailing list