[PATCH] mc13xxx: make driver-provided SPI frequency overridable

Alexander Kurz akurz at blala.de
Tue Jul 19 22:57:28 PDT 2016


The preset SPI frequency for mc13xxx PMIC introduced with patch 6e18b3a48ee4
("mc13xxx: Define maximum SPI clock frequency global to driver") is not
desirable or working on all boards. Provide a possibility to override
the default SPI max_speed_hz from board code.

Signed-off-by: Alexander Kurz <akurz at blala.de>
---
 drivers/mfd/mc13xxx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/mc13xxx.c b/drivers/mfd/mc13xxx.c
index 68d70c5..b2fcd95 100644
--- a/drivers/mfd/mc13xxx.c
+++ b/drivers/mfd/mc13xxx.c
@@ -330,7 +330,8 @@ static int __init mc13xxx_probe(struct device_d *dev)
 		mc_dev->spi = dev->type_data;
 		mc_dev->spi->mode = SPI_MODE_0 | SPI_CS_HIGH;
 		mc_dev->spi->bits_per_word = 32;
-		mc_dev->spi->max_speed_hz = 20000000;
+		mc_dev->spi->max_speed_hz = mc_dev->spi->max_speed_hz ?
+			mc_dev->spi->max_speed_hz : 20000000;
 		mc_dev->map = regmap_init(dev, &regmap_mc13xxx_spi_bus,
 			     mc_dev, &mc13xxx_regmap_spi_config);
 	}
-- 
2.1.4




More information about the barebox mailing list