Pārlūkot izejas kodu

spi: efm32: properly namespace location property

While reviewing an i2c driver for efm32 that needs a similar property
Wolfram Sang pointed out that "location" is a too generic name for
something that is efm32 specific. So add an appropriate namespace and
fall back to the generic name in case of failure.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
Uwe Kleine-König 11 gadi atpakaļ
vecāks
revīzija
f2bb31057a

+ 2 - 2
Documentation/devicetree/bindings/spi/efm32-spi.txt

@@ -8,7 +8,7 @@ Required properties:
 - interrupts: pair specifying rx and tx irq
 - interrupts: pair specifying rx and tx irq
 - clocks: phandle to the spi clock
 - clocks: phandle to the spi clock
 - cs-gpios: see spi-bus.txt
 - cs-gpios: see spi-bus.txt
-- location: Value to write to the ROUTE register's LOCATION bitfield to configure the pinmux for the device, see datasheet for values.
+- efm32,location: Value to write to the ROUTE register's LOCATION bitfield to configure the pinmux for the device, see datasheet for values.
 
 
 Example:
 Example:
 
 
@@ -20,7 +20,7 @@ spi1: spi@0x4000c400 { /* USART1 */
 	interrupts = <15 16>;
 	interrupts = <15 16>;
 	clocks = <&cmu 20>;
 	clocks = <&cmu 20>;
 	cs-gpios = <&gpio 51 1>; // D3
 	cs-gpios = <&gpio 51 1>; // D3
-	location = <1>;
+	efm32,location = <1>;
 	status = "ok";
 	status = "ok";
 
 
 	ks8851@0 {
 	ks8851@0 {

+ 4 - 1
drivers/spi/spi-efm32.c

@@ -294,7 +294,10 @@ static void efm32_spi_probe_dt(struct platform_device *pdev,
 	u32 location;
 	u32 location;
 	int ret;
 	int ret;
 
 
-	ret = of_property_read_u32(np, "location", &location);
+	ret = of_property_read_u32(np, "efm32,location", &location);
+	if (ret)
+		/* fall back to old and (wrongly) generic property "location" */
+		ret = of_property_read_u32(np, "location", &location);
 	if (!ret) {
 	if (!ret) {
 		dev_dbg(&pdev->dev, "using location %u\n", location);
 		dev_dbg(&pdev->dev, "using location %u\n", location);
 	} else {
 	} else {