linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND 0/5] soc/fsl/qe: cleanups and new DT binding
@ 2019-04-30 13:36 Rasmus Villemoes
  2019-04-30 13:36 ` [PATCH 1/5] soc/fsl/qe: qe.c: drop useless static qualifier Rasmus Villemoes
                   ` (5 more replies)
  0 siblings, 6 replies; 40+ messages in thread
From: Rasmus Villemoes @ 2019-04-30 13:36 UTC (permalink / raw)
  To: Qiang Zhao, Li Yang
  Cc: linuxppc-dev, linux-arm-kernel, linux-kernel, Rob Herring,
	Valentin Longchamp, Scott Wood, Rasmus Villemoes

This small series consists of some small cleanups and simplifications
of the QUICC engine driver, and introduces a new DT binding that makes
it much easier to support other variants of the QUICC engine IP block
that appears in the wild: There's no reason to expect in general that
the number of valid SNUMs uniquely determines the set of such, so it's
better to simply let the device tree specify the values (and,
implicitly via the array length, also the count).

I sent these two months ago, but mostly as POC inside another
thread. Resending as proper patch series.

Rasmus Villemoes (5):
  soc/fsl/qe: qe.c: drop useless static qualifier
  soc/fsl/qe: qe.c: reduce static memory footprint by 1.7K
  soc/fsl/qe: qe.c: introduce qe_get_device_node helper
  soc/fsl/qe: qe.c: support fsl,qe-snums property
  soc/fsl/qe: qe.c: fold qe_get_num_of_snums into qe_snums_init

 .../devicetree/bindings/soc/fsl/cpm_qe/qe.txt |   8 +-
 drivers/net/ethernet/freescale/ucc_geth.c     |   2 +-
 drivers/soc/fsl/qe/qe.c                       | 162 +++++++-----------
 include/soc/fsl/qe/qe.h                       |   2 +-
 4 files changed, 73 insertions(+), 101 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 40+ messages in thread
* RE: [PATCH v2 3/6] soc/fsl/qe: qe.c: introduce qe_get_device_node helper
@ 2019-05-09  2:31 Qiang Zhao
  0 siblings, 0 replies; 40+ messages in thread
From: Qiang Zhao @ 2019-05-09  2:31 UTC (permalink / raw)
  To: Rasmus Villemoes, devicetree, Leo Li
  Cc: linuxppc-dev, linux-arm-kernel, linux-kernel, Rob Herring,
	Scott Wood, Christophe Leroy, Mark Rutland, Rasmus Villemoes

On 2019/5/1 17:29, Rasmus Villemoes <rasmus.villemoes@prevas.dk> wrote:

> -----Original Message-----
> From: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
> Sent: 2019年5月1日 17:29
> To: devicetree@vger.kernel.org; Qiang Zhao <qiang.zhao@nxp.com>; Leo Li
> <leoyang.li@nxp.com>
> Cc: linuxppc-dev@lists.ozlabs.org; linux-arm-kernel@lists.infradead.org;
> linux-kernel@vger.kernel.org; Rob Herring <robh+dt@kernel.org>; Scott Wood
> <oss@buserror.net>; Christophe Leroy <christophe.leroy@c-s.fr>; Mark
> Rutland <mark.rutland@arm.com>; Rasmus Villemoes
> <Rasmus.Villemoes@prevas.se>
> Subject: [PATCH v2 3/6] soc/fsl/qe: qe.c: introduce qe_get_device_node
> helper
> 
> The 'try of_find_compatible_node(NULL, NULL, "fsl,qe"), fall back to
> of_find_node_by_type(NULL, "qe")' pattern is repeated five times. Factor it
> into a common helper.
> 
> Reviewed-by: Christophe Leroy <christophe.leroy@c-s.fr>
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
> ---
 
Reviewed-by: Qiang Zhao <qiang.zhao@nxp.com>

>  drivers/soc/fsl/qe/qe.c | 71 +++++++++++++++++------------------------
>  1 file changed, 29 insertions(+), 42 deletions(-)
> 
> diff --git a/drivers/soc/fsl/qe/qe.c b/drivers/soc/fsl/qe/qe.c index
> 303aa29cb27d..0fb8b59f61ad 100644
> --- a/drivers/soc/fsl/qe/qe.c
> +++ b/drivers/soc/fsl/qe/qe.c
> @@ -56,6 +56,20 @@ static unsigned int qe_num_of_snum;
> 
>  static phys_addr_t qebase = -1;
> 
> +static struct device_node *qe_get_device_node(void) {
> +       struct device_node *qe;
> +
> +       /*
> +        * Newer device trees have an "fsl,qe" compatible property for the
> QE
> +        * node, but we still need to support older device trees.
> +        */
> +       qe = of_find_compatible_node(NULL, NULL, "fsl,qe");
> +       if (qe)
> +               return qe;
> +       return of_find_node_by_type(NULL, "qe"); }
> +
>  static phys_addr_t get_qe_base(void)
>  {
>         struct device_node *qe;
> @@ -65,12 +79,9 @@ static phys_addr_t get_qe_base(void)
>         if (qebase != -1)
>                 return qebase;
> 
> -       qe = of_find_compatible_node(NULL, NULL, "fsl,qe");
> -       if (!qe) {
> -               qe = of_find_node_by_type(NULL, "qe");
> -               if (!qe)
> -                       return qebase;
> -       }
> +       qe = qe_get_device_node();
> +       if (!qe)
> +               return qebase;
> 
>         ret = of_address_to_resource(qe, 0, &res);
>         if (!ret)
> @@ -164,12 +175,9 @@ unsigned int qe_get_brg_clk(void)
>         if (brg_clk)
>                 return brg_clk;
> 
> -       qe = of_find_compatible_node(NULL, NULL, "fsl,qe");
> -       if (!qe) {
> -               qe = of_find_node_by_type(NULL, "qe");
> -               if (!qe)
> -                       return brg_clk;
> -       }
> +       qe = qe_get_device_node();
> +       if (!qe)
> +               return brg_clk;
> 
>         prop = of_get_property(qe, "brg-frequency", &size);
>         if (prop && size == sizeof(*prop)) @@ -557,16 +565,9 @@ struct
> qe_firmware_info *qe_get_firmware_info(void)
> 
>         initialized = 1;
> 
> -       /*
> -        * Newer device trees have an "fsl,qe" compatible property for the QE
> -        * node, but we still need to support older device trees.
> -       */
> -       qe = of_find_compatible_node(NULL, NULL, "fsl,qe");
> -       if (!qe) {
> -               qe = of_find_node_by_type(NULL, "qe");
> -               if (!qe)
> -                       return NULL;
> -       }
> +       qe = qe_get_device_node();
> +       if (!qe)
> +               return NULL;
> 
>         /* Find the 'firmware' child node */
>         fw = of_get_child_by_name(qe, "firmware"); @@ -612,16 +613,9
> @@ unsigned int qe_get_num_of_risc(void)
>         unsigned int num_of_risc = 0;
>         const u32 *prop;
> 
> -       qe = of_find_compatible_node(NULL, NULL, "fsl,qe");
> -       if (!qe) {
> -               /* Older devices trees did not have an "fsl,qe"
> -                * compatible property, so we need to look for
> -                * the QE node by name.
> -                */
> -               qe = of_find_node_by_type(NULL, "qe");
> -               if (!qe)
> -                       return num_of_risc;
> -       }
> +       qe = qe_get_device_node();
> +       if (!qe)
> +               return num_of_risc;
> 
>         prop = of_get_property(qe, "fsl,qe-num-riscs", &size);
>         if (prop && size == sizeof(*prop)) @@ -641,16 +635,9 @@ unsigned
> int qe_get_num_of_snums(void)
>         const u32 *prop;
> 
>         num_of_snums = 28; /* The default number of snum for threads is 28
> */
> -       qe = of_find_compatible_node(NULL, NULL, "fsl,qe");
> -       if (!qe) {
> -               /* Older devices trees did not have an "fsl,qe"
> -                * compatible property, so we need to look for
> -                * the QE node by name.
> -                */
> -               qe = of_find_node_by_type(NULL, "qe");
> -               if (!qe)
> -                       return num_of_snums;
> -       }
> +       qe = qe_get_device_node();
> +       if (!qe)
> +               return num_of_snums;
> 
>         prop = of_get_property(qe, "fsl,qe-num-snums", &size);
>         if (prop && size == sizeof(*prop)) {
> --
> 2.20.1


Best Regards
Qiang Zhao

^ permalink raw reply	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2019-06-04 20:29 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-30 13:36 [PATCH RESEND 0/5] soc/fsl/qe: cleanups and new DT binding Rasmus Villemoes
2019-04-30 13:36 ` [PATCH 1/5] soc/fsl/qe: qe.c: drop useless static qualifier Rasmus Villemoes
2019-04-30 17:03   ` Christophe Leroy
2019-04-30 13:36 ` [PATCH 2/5] soc/fsl/qe: qe.c: reduce static memory footprint by 1.7K Rasmus Villemoes
2019-04-30 17:12   ` Christophe Leroy
2019-05-01  5:51     ` Rasmus Villemoes
2019-04-30 13:36 ` [PATCH 3/5] soc/fsl/qe: qe.c: introduce qe_get_device_node helper Rasmus Villemoes
2019-04-30 17:14   ` Christophe Leroy
2019-04-30 13:36 ` [PATCH 4/5] soc/fsl/qe: qe.c: support fsl,qe-snums property Rasmus Villemoes
2019-04-30 17:19   ` Christophe Leroy
2019-05-01  6:00     ` Rasmus Villemoes
2019-04-30 13:36 ` [PATCH 5/5] soc/fsl/qe: qe.c: fold qe_get_num_of_snums into qe_snums_init Rasmus Villemoes
2019-04-30 17:27   ` Christophe Leroy
2019-05-01  9:29 ` [PATCH v2 0/6] soc/fsl/qe: cleanups and new DT binding Rasmus Villemoes
2019-05-01  9:29   ` [PATCH v2 1/6] soc/fsl/qe: qe.c: drop useless static qualifier Rasmus Villemoes
2019-05-01  9:29   ` [PATCH v2 2/6] soc/fsl/qe: qe.c: reduce static memory footprint by 1.7K Rasmus Villemoes
2019-05-02  4:51     ` Christophe Leroy
2019-05-01  9:29   ` [PATCH v2 3/6] soc/fsl/qe: qe.c: introduce qe_get_device_node helper Rasmus Villemoes
2019-05-01  9:29   ` [PATCH v2 4/6] dt-bindings: soc/fsl: qe: document new fsl,qe-snums binding Rasmus Villemoes
2019-05-01 15:12     ` Joakim Tjernlund
2019-05-01 18:47       ` Rasmus Villemoes
2019-05-01 21:00     ` Rob Herring
2019-05-01  9:29   ` [PATCH v2 5/6] soc/fsl/qe: qe.c: support fsl,qe-snums property Rasmus Villemoes
2019-05-02  4:52     ` Christophe Leroy
2019-05-01  9:29   ` [PATCH v2 6/6] soc/fsl/qe: qe.c: fold qe_get_num_of_snums into qe_snums_init Rasmus Villemoes
2019-05-02  4:54     ` Christophe Leroy
2019-05-09  2:35     ` [EXT] " Qiang Zhao
2019-05-13 11:14   ` [PATCH v3 0/6] soc/fsl/qe: cleanups and new DT binding Rasmus Villemoes
2019-05-13 11:14     ` [PATCH v3 1/6] soc/fsl/qe: qe.c: drop useless static qualifier Rasmus Villemoes
2019-05-13 11:14     ` [PATCH v3 2/6] soc/fsl/qe: qe.c: reduce static memory footprint by 1.7K Rasmus Villemoes
2019-05-13 11:14     ` [PATCH v3 3/6] soc/fsl/qe: qe.c: introduce qe_get_device_node helper Rasmus Villemoes
2019-05-13 11:14     ` [PATCH v3 4/6] dt-bindings: soc/fsl: qe: document new fsl,qe-snums binding Rasmus Villemoes
2019-05-13 11:39       ` Joakim Tjernlund
2019-05-13 17:51       ` Rob Herring
2019-05-13 11:15     ` [PATCH v3 5/6] soc/fsl/qe: qe.c: support fsl,qe-snums property Rasmus Villemoes
2019-05-13 11:15     ` [PATCH v3 6/6] soc/fsl/qe: qe.c: fold qe_get_num_of_snums into qe_snums_init Rasmus Villemoes
2019-06-03 19:53     ` [PATCH v3 0/6] soc/fsl/qe: cleanups and new DT binding Rasmus Villemoes
2019-06-03 19:55       ` Leo Li
2019-06-04 20:29     ` Li Yang
2019-05-09  2:31 [PATCH v2 3/6] soc/fsl/qe: qe.c: introduce qe_get_device_node helper Qiang Zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).