* [PATCH] fpga fr br: fix warning for unexpected version number
@ 2017-04-05 19:05 matthew.gerlach
2017-04-05 20:12 ` Moritz Fischer
0 siblings, 1 reply; 4+ messages in thread
From: matthew.gerlach @ 2017-04-05 19:05 UTC (permalink / raw)
To: atull, moritz.fischer, linux-fpga, linux-kernel; +Cc: Matthew Gerlach
From: Matthew Gerlach <matthew.gerlach@linux.intel.com>
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
without printing an warning.
Signed-off-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>
---
drivers/fpga/altera-freeze-bridge.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/fpga/altera-freeze-bridge.c b/drivers/fpga/altera-freeze-bridge.c
index 8dcd9fb..bdfd5eb 100644
--- a/drivers/fpga/altera-freeze-bridge.c
+++ b/drivers/fpga/altera-freeze-bridge.c
@@ -28,6 +28,7 @@
#define FREEZE_CSR_REG_VERSION 12
#define FREEZE_CSR_SUPPORTED_VERSION 2
+#define FREEZE_CSR_OFFICIAL_VERSION 0xad000003
#define FREEZE_CSR_STATUS_FREEZE_REQ_DONE BIT(0)
#define FREEZE_CSR_STATUS_UNFREEZE_REQ_DONE BIT(1)
@@ -241,10 +242,12 @@ static int altera_freeze_br_probe(struct platform_device *pdev)
priv->enable = 1;
revision = readl(priv->base_addr + FREEZE_CSR_REG_VERSION);
- if (revision != FREEZE_CSR_SUPPORTED_VERSION)
+ if ((revision != FREEZE_CSR_SUPPORTED_VERSION) &&
+ (revision != FREEZE_CSR_OFFICIAL_VERSION))
dev_warn(dev,
- "%s Freeze Controller unexpected revision %d != %d\n",
- __func__, revision, FREEZE_CSR_SUPPORTED_VERSION);
+ "%s unexpected revision 0x%x != 0x%x != 0x%x\n",
+ __func__, revision, FREEZE_CSR_SUPPORTED_VERSION,
+ FREEZE_CSR_OFFICIAL_VERSION);
return fpga_bridge_register(dev, FREEZE_BRIDGE_NAME,
&altera_freeze_br_br_ops, priv);
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] fpga fr br: fix warning for unexpected version number
2017-04-05 19:05 [PATCH] fpga fr br: fix warning for unexpected version number matthew.gerlach
@ 2017-04-05 20:12 ` Moritz Fischer
2017-04-05 22:25 ` matthew.gerlach
0 siblings, 1 reply; 4+ messages in thread
From: Moritz Fischer @ 2017-04-05 20:12 UTC (permalink / raw)
To: matthew.gerlach; +Cc: Alan Tull, linux-fpga, Linux Kernel Mailing List
Hi Matthew,
On Wed, Apr 5, 2017 at 12:05 PM, <matthew.gerlach@linux.intel.com> wrote:
> From: Matthew Gerlach <matthew.gerlach@linux.intel.com>
>
> 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
> without printing an warning.
>
> Signed-off-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>
> ---
> drivers/fpga/altera-freeze-bridge.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/fpga/altera-freeze-bridge.c b/drivers/fpga/altera-freeze-bridge.c
> index 8dcd9fb..bdfd5eb 100644
> --- a/drivers/fpga/altera-freeze-bridge.c
> +++ b/drivers/fpga/altera-freeze-bridge.c
> @@ -28,6 +28,7 @@
> #define FREEZE_CSR_REG_VERSION 12
>
> #define FREEZE_CSR_SUPPORTED_VERSION 2
> +#define FREEZE_CSR_OFFICIAL_VERSION 0xad000003
>
> #define FREEZE_CSR_STATUS_FREEZE_REQ_DONE BIT(0)
> #define FREEZE_CSR_STATUS_UNFREEZE_REQ_DONE BIT(1)
> @@ -241,10 +242,12 @@ static int altera_freeze_br_probe(struct platform_device *pdev)
> priv->enable = 1;
>
> revision = readl(priv->base_addr + FREEZE_CSR_REG_VERSION);
> - if (revision != FREEZE_CSR_SUPPORTED_VERSION)
> + if ((revision != FREEZE_CSR_SUPPORTED_VERSION) &&
> + (revision != FREEZE_CSR_OFFICIAL_VERSION))
> dev_warn(dev,
> - "%s Freeze Controller unexpected revision %d != %d\n",
> - __func__, revision, FREEZE_CSR_SUPPORTED_VERSION);
> + "%s unexpected revision 0x%x != 0x%x != 0x%x\n",
> + __func__, revision, FREEZE_CSR_SUPPORTED_VERSION,
> + FREEZE_CSR_OFFICIAL_VERSION);
Maybe you actually wanna bail out if you read a random other value
instead of what you
expect instead of printing a warning.
>
> return fpga_bridge_register(dev, FREEZE_BRIDGE_NAME,
> &altera_freeze_br_br_ops, priv);
> --
> 2.7.4
>
Cheers,
Moritz
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fpga fr br: fix warning for unexpected version number
2017-04-05 20:12 ` Moritz Fischer
@ 2017-04-05 22:25 ` matthew.gerlach
2017-04-06 0:13 ` Moritz Fischer
0 siblings, 1 reply; 4+ messages in thread
From: matthew.gerlach @ 2017-04-05 22:25 UTC (permalink / raw)
To: Moritz Fischer; +Cc: Alan Tull, linux-fpga, Linux Kernel Mailing List
On Wed, 5 Apr 2017, Moritz Fischer wrote:
> Hi Matthew,
>
Hi Moritz,
> On Wed, Apr 5, 2017 at 12:05 PM, <matthew.gerlach@linux.intel.com> wrote:
>> From: Matthew Gerlach <matthew.gerlach@linux.intel.com>
>>
>> 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
>> without printing an warning.
>>
>> Signed-off-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>
>> ---
>> drivers/fpga/altera-freeze-bridge.c | 9 ++++++---
>> 1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/fpga/altera-freeze-bridge.c b/drivers/fpga/altera-freeze-bridge.c
>> index 8dcd9fb..bdfd5eb 100644
>> --- a/drivers/fpga/altera-freeze-bridge.c
>> +++ b/drivers/fpga/altera-freeze-bridge.c
>> @@ -28,6 +28,7 @@
>> #define FREEZE_CSR_REG_VERSION 12
>>
>> #define FREEZE_CSR_SUPPORTED_VERSION 2
>> +#define FREEZE_CSR_OFFICIAL_VERSION 0xad000003
>>
>> #define FREEZE_CSR_STATUS_FREEZE_REQ_DONE BIT(0)
>> #define FREEZE_CSR_STATUS_UNFREEZE_REQ_DONE BIT(1)
>> @@ -241,10 +242,12 @@ static int altera_freeze_br_probe(struct platform_device *pdev)
>> priv->enable = 1;
>>
>> revision = readl(priv->base_addr + FREEZE_CSR_REG_VERSION);
>> - if (revision != FREEZE_CSR_SUPPORTED_VERSION)
>> + if ((revision != FREEZE_CSR_SUPPORTED_VERSION) &&
>> + (revision != FREEZE_CSR_OFFICIAL_VERSION))
>> dev_warn(dev,
>> - "%s Freeze Controller unexpected revision %d != %d\n",
>> - __func__, revision, FREEZE_CSR_SUPPORTED_VERSION);
>> + "%s unexpected revision 0x%x != 0x%x != 0x%x\n",
>> + __func__, revision, FREEZE_CSR_SUPPORTED_VERSION,
>> + FREEZE_CSR_OFFICIAL_VERSION);
>
> Maybe you actually wanna bail out if you read a random other value
> instead of what you
> expect instead of printing a warning.
I thought about making it an error if the version didn't match, but it was
a dev_warn() before and that allowed folks to use the "old" driver with
the new IP version.
>>
>> return fpga_bridge_register(dev, FREEZE_BRIDGE_NAME,
>> &altera_freeze_br_br_ops, priv);
>> --
>> 2.7.4
>>
>
> Cheers,
>
> Moritz
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fpga fr br: fix warning for unexpected version number
2017-04-05 22:25 ` matthew.gerlach
@ 2017-04-06 0:13 ` Moritz Fischer
0 siblings, 0 replies; 4+ messages in thread
From: Moritz Fischer @ 2017-04-06 0:13 UTC (permalink / raw)
To: matthew.gerlach; +Cc: Alan Tull, linux-fpga, Linux Kernel Mailing List
Hi Matthew,
On Wed, Apr 5, 2017 at 3:25 PM, <matthew.gerlach@linux.intel.com> wrote:
>> Maybe you actually wanna bail out if you read a random other value
>> instead of what you
>> expect instead of printing a warning.
>
>
> I thought about making it an error if the version didn't match, but it was a
> dev_warn() before and that allowed folks to use the "old" driver with the
> new IP version.
Or some random other piece of logic in the FPGA that happens to be mapped
to that address ;-)
I agree we should've probably caught this in the initial review, but maybe we
should change it.
Cheers,
Moritz
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-04-06 0:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-05 19:05 [PATCH] fpga fr br: fix warning for unexpected version number matthew.gerlach
2017-04-05 20:12 ` Moritz Fischer
2017-04-05 22:25 ` matthew.gerlach
2017-04-06 0:13 ` Moritz Fischer
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.