Message ID | 1417688512-7644-11-git-send-email-lee.jones@linaro.org |
---|---|
State | New |
Headers | show |
Hi Lee, On Thu, 04 Dec 2014, Lee Jones wrote: > From: Christophe Kerello <christophe.kerello@st.com> > > This patch adds a mask to be able to get the right boot device selection. Have you seen this series I posted https://lkml.org/lkml/2014/11/19/71? It is trying to consolodate the way the various STI drivers are handling syscfg registers in the upstream kernel. Now this series came about mainly due to the mixing of address spaces in the reg property, but the overall aim was to get all STI drivers handling syscfg registers in a uniform way. Sadly it seems this driver uses another approach for syscfg handling with extra DT properties encoding the offset and mask. IMHO I don't think it makes sense to add more DT properties for doing this. We should consider migrating this over to using the interface provided in the series above, and for the mask I would suggest implementing it in a similar way to the code in drivers/phy/phy-stih41x-usb.c which solves much the same problem by statically encoding the information in the driver and making a decision based on the compatible flag. regards, Peter. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c index 18f6f0b..f992f00 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -2123,6 +2123,7 @@ static void stfsm_fetch_platform_configs(struct platform_device *pdev) struct regmap *regmap; uint32_t boot_device_reg; uint32_t boot_device_spi; + uint32_t boot_device_msk; uint32_t boot_device; /* Value we read from *boot_device_reg */ int ret; @@ -2147,10 +2148,17 @@ static void stfsm_fetch_platform_configs(struct platform_device *pdev) if (ret) goto boot_device_fail; + /* Mask to apply on boot_device_reg */ + ret = of_property_read_u32(np, "st,boot-device-msk", &boot_device_msk); + if (ret) + goto boot_device_fail; + ret = regmap_read(regmap, boot_device_reg, &boot_device); if (ret) goto boot_device_fail; + boot_device &= boot_device_msk; + if (boot_device != boot_device_spi) fsm->booted_from_spi = false;