Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fpga fr br: update supported version numbers

The value in the version register of the altera freeze bridge
controller changed from the beta value of 2 to the
value of 0xad000003 in the official release of the IP.
This patch supports the old and new version numbers, and the
driver's probe function will fail if neither of the supported
versions is found.

Signed-off-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>
Reviewed-by: Moritz Fischer <mdf@kernel.org>
Signed-off-by: Alan Tull <atull@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Matthew Gerlach and committed by
Greg Kroah-Hartman
dd17cc7b e73bbf64

+19 -11
+19 -11
drivers/fpga/altera-freeze-bridge.c
··· 28 28 #define FREEZE_CSR_REG_VERSION 12 29 29 30 30 #define FREEZE_CSR_SUPPORTED_VERSION 2 31 + #define FREEZE_CSR_OFFICIAL_VERSION 0xad000003 31 32 32 33 #define FREEZE_CSR_STATUS_FREEZE_REQ_DONE BIT(0) 33 34 #define FREEZE_CSR_STATUS_UNFREEZE_REQ_DONE BIT(1) ··· 219 218 { 220 219 struct device *dev = &pdev->dev; 221 220 struct device_node *np = pdev->dev.of_node; 221 + void __iomem *base_addr; 222 222 struct altera_freeze_br_data *priv; 223 223 struct resource *res; 224 224 u32 status, revision; ··· 227 225 if (!np) 228 226 return -ENODEV; 229 227 228 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 229 + base_addr = devm_ioremap_resource(dev, res); 230 + if (IS_ERR(base_addr)) 231 + return PTR_ERR(base_addr); 232 + 233 + revision = readl(base_addr + FREEZE_CSR_REG_VERSION); 234 + if ((revision != FREEZE_CSR_SUPPORTED_VERSION) && 235 + (revision != FREEZE_CSR_OFFICIAL_VERSION)) { 236 + dev_err(dev, 237 + "%s unexpected revision 0x%x != 0x%x != 0x%x\n", 238 + __func__, revision, FREEZE_CSR_SUPPORTED_VERSION, 239 + FREEZE_CSR_OFFICIAL_VERSION); 240 + return -EINVAL; 241 + } 242 + 230 243 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 231 244 if (!priv) 232 245 return -ENOMEM; 233 246 234 247 priv->dev = dev; 235 248 236 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 237 - priv->base_addr = devm_ioremap_resource(dev, res); 238 - if (IS_ERR(priv->base_addr)) 239 - return PTR_ERR(priv->base_addr); 240 - 241 - status = readl(priv->base_addr + FREEZE_CSR_STATUS_OFFSET); 249 + status = readl(base_addr + FREEZE_CSR_STATUS_OFFSET); 242 250 if (status & FREEZE_CSR_STATUS_UNFREEZE_REQ_DONE) 243 251 priv->enable = 1; 244 252 245 - revision = readl(priv->base_addr + FREEZE_CSR_REG_VERSION); 246 - if (revision != FREEZE_CSR_SUPPORTED_VERSION) 247 - dev_warn(dev, 248 - "%s Freeze Controller unexpected revision %d != %d\n", 249 - __func__, revision, FREEZE_CSR_SUPPORTED_VERSION); 253 + priv->base_addr = base_addr; 250 254 251 255 return fpga_bridge_register(dev, FREEZE_BRIDGE_NAME, 252 256 &altera_freeze_br_br_ops, priv);