diff mbox series

[1/3] include: fpga: adi-axi-common: Define version macros

Message ID 20190926103925.194973-2-nuno.sa@analog.com (mailing list archive)
State Mainlined, archived
Headers show
Series Support AXI FAN Control IP core | expand

Commit Message

Nuno Sa Sept. 26, 2019, 10:39 a.m. UTC
Add commom macros to "parse" ADI HDL cores version, in terms of
major, minor and patch.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
---
 include/linux/fpga/adi-axi-common.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Moritz Fischer Sept. 27, 2019, 3:01 p.m. UTC | #1
Hi Nuno,

On Thu, Sep 26, 2019 at 12:39:23PM +0200, Nuno Sá wrote:
> Add commom macros to "parse" ADI HDL cores version, in terms of
> major, minor and patch.
> 
> Signed-off-by: Nuno Sá <nuno.sa@analog.com>
> ---
>  include/linux/fpga/adi-axi-common.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/include/linux/fpga/adi-axi-common.h b/include/linux/fpga/adi-axi-common.h
> index 7fc95d5c95bb..5bc5603e6bc8 100644
> --- a/include/linux/fpga/adi-axi-common.h
> +++ b/include/linux/fpga/adi-axi-common.h
> @@ -16,4 +16,8 @@
>  #define ADI_AXI_PCORE_VER(major, minor, patch)	\
>  	(((major) << 16) | ((minor) << 8) | (patch))
>  
> +#define ADI_AXI_PCORE_VER_MAJOR(version)	(((version) >> 16) & 0xff)
> +#define ADI_AXI_PCORE_VER_MINOR(version)	(((version) >> 8) & 0xff)
> +#define ADI_AXI_PCORE_VER_PATCH(version)	((version) & 0xff)
> +
>  #endif /* ADI_AXI_COMMON_H_ */
> -- 
> 2.23.0
> 

While implemented in an FPGA I'm not sure if this needs to go into
includelinux/fpga/.

I'd suggest to add this to the actual driver for now, and once you have
multiple users you can find a common location.

Cheers,
Moritz
Nuno Sa Sept. 30, 2019, 10:46 a.m. UTC | #2
Hi Moritz,

On Fri, 2019-09-27 at 08:01 -0700, Moritz Fischer wrote:
> 
> Hi Nuno,
> 
> On Thu, Sep 26, 2019 at 12:39:23PM +0200, Nuno Sá wrote:
> > Add commom macros to "parse" ADI HDL cores version, in terms of
> > major, minor and patch.
> > 
> > Signed-off-by: Nuno Sá <nuno.sa@analog.com>
> > ---
> >  include/linux/fpga/adi-axi-common.h | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/include/linux/fpga/adi-axi-common.h
> > b/include/linux/fpga/adi-axi-common.h
> > index 7fc95d5c95bb..5bc5603e6bc8 100644
> > --- a/include/linux/fpga/adi-axi-common.h
> > +++ b/include/linux/fpga/adi-axi-common.h
> > @@ -16,4 +16,8 @@
> >  #define ADI_AXI_PCORE_VER(major, minor, patch)	\
> >  	(((major) << 16) | ((minor) << 8) | (patch))
> >  
> > +#define ADI_AXI_PCORE_VER_MAJOR(version)	(((version) >> 16) &
> > 0xff)
> > +#define ADI_AXI_PCORE_VER_MINOR(version)	(((version) >> 8) &
> > 0xff)
> > +#define ADI_AXI_PCORE_VER_PATCH(version)	((version) & 0xff)
> > +
> >  #endif /* ADI_AXI_COMMON_H_ */
> > -- 
> > 2.23.0
> > 
> 
> While implemented in an FPGA I'm not sure if this needs to go into
> includelinux/fpga/.
> 
> I'd suggest to add this to the actual driver for now, and once you
> have
> multiple users you can find a common location.

Will do that.

> Cheers,
> Moritz

Thanks!
Nuno Sá
diff mbox series

Patch

diff --git a/include/linux/fpga/adi-axi-common.h b/include/linux/fpga/adi-axi-common.h
index 7fc95d5c95bb..5bc5603e6bc8 100644
--- a/include/linux/fpga/adi-axi-common.h
+++ b/include/linux/fpga/adi-axi-common.h
@@ -16,4 +16,8 @@ 
 #define ADI_AXI_PCORE_VER(major, minor, patch)	\
 	(((major) << 16) | ((minor) << 8) | (patch))
 
+#define ADI_AXI_PCORE_VER_MAJOR(version)	(((version) >> 16) & 0xff)
+#define ADI_AXI_PCORE_VER_MINOR(version)	(((version) >> 8) & 0xff)
+#define ADI_AXI_PCORE_VER_PATCH(version)	((version) & 0xff)
+
 #endif /* ADI_AXI_COMMON_H_ */