diff mbox series

[v8,2/8] include: fpga: adi-axi-common.h: add version helper macros

Message ID 20200306110100.22092-3-alexandru.ardelean@analog.com (mailing list archive)
State New, archived
Headers show
Series iio: adi-axi-adc,ad9647: Add support for AD9467 ADC | expand

Commit Message

Alexandru Ardelean March 6, 2020, 11 a.m. UTC
The format for all ADI AXI IP cores is the same.
i.e. 'major.minor.patch'.

This patch adds the helper macros to be re-used in ADI AXI drivers.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
 include/linux/fpga/adi-axi-common.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Jonathan Cameron March 7, 2020, 2:26 p.m. UTC | #1
On Fri, 6 Mar 2020 13:00:54 +0200
Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:

> The format for all ADI AXI IP cores is the same.
> i.e. 'major.minor.patch'.
> 
> This patch adds the helper macros to be re-used in ADI AXI drivers.
> 
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>

Again, trivial but needs a Moritz ack as it's his subsystem.

> ---
>  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 ebd4e07ae3d8..141ac3f251e6 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_ */
Moritz Fischer March 7, 2020, 7:56 p.m. UTC | #2
On Sat, Mar 07, 2020 at 02:26:04PM +0000, Jonathan Cameron wrote:
> On Fri, 6 Mar 2020 13:00:54 +0200
> Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:
> 
> > The format for all ADI AXI IP cores is the same.
> > i.e. 'major.minor.patch'.
> > 
> > This patch adds the helper macros to be re-used in ADI AXI drivers.
> > 
> > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Acked-by: Moritz Fischer <mdf@kernel.org>

> 
> Again, trivial but needs a Moritz ack as it's his subsystem.

I had originally asked to not put it under include/linux/fpga, but alas,
now it's here :)

It never made much sense imho to drop it under linux/fpga just because
it's a hardware implemented in an FPGA....

Cheers,
Moritz
Alexandru Ardelean March 9, 2020, 1:58 p.m. UTC | #3
On Sat, 2020-03-07 at 11:56 -0800, Moritz Fischer wrote:
> [External]
> 
> On Sat, Mar 07, 2020 at 02:26:04PM +0000, Jonathan Cameron wrote:
> > On Fri, 6 Mar 2020 13:00:54 +0200
> > Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:
> > 
> > > The format for all ADI AXI IP cores is the same.
> > > i.e. 'major.minor.patch'.
> > > 
> > > This patch adds the helper macros to be re-used in ADI AXI drivers.
> > > 
> > > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> Acked-by: Moritz Fischer <mdf@kernel.org>
> 
> > Again, trivial but needs a Moritz ack as it's his subsystem.
> 
> I had originally asked to not put it under include/linux/fpga, but alas,
> now it's here :)
> 
> It never made much sense imho to drop it under linux/fpga just because
> it's a hardware implemented in an FPGA....

We can always move it.
I don't remember about any discussion on this matter.
Or maybe I wasn't included.
Or maybe I have some severe case of amnesia or carelessness for omitting
threads. I am terrible at following threads.

Apologies for anything on my part.

If you propose another location, I can spin-up a patch on it.

These reg-definitions are common to all ADI HDL regs.
Maybe more may come up as stuff gets upstreamed.

The full-blown/internal version we have is:
https://github.com/analogdevicesinc/linux/blob/master/include/linux/fpga/adi-axi-common.h

It tries to define some things that are common between Intel, Xilinx and ADI IP
cores across [these and hopefully other] FPGA boards.
I'm not saying it's doing a good job of that at the moment.
¯\_(ツ)_/¯
Thanks
Alex

> 
> Cheers,
> Moritz
diff mbox series

Patch

diff --git a/include/linux/fpga/adi-axi-common.h b/include/linux/fpga/adi-axi-common.h
index ebd4e07ae3d8..141ac3f251e6 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_ */