linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
To: Maxime Ripard <maxime@cerno.tech>
Cc: linux-rpi-kernel@lists.infradead.org,
	bcm-kernel-feedback-list@broadcom.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Dave Stevenson <dave.stevenson@raspberrypi.com>,
	Tim Gover <tim.gover@raspberrypi.com>,
	Phil Elwell <phil@raspberrypi.com>
Subject: Re: [PATCH v3 20/25] clk: bcm: rpi: Add an enum for the firmware clocks
Date: Fri, 05 Jun 2020 15:09:15 +0200	[thread overview]
Message-ID: <ef54a57d7a7475a3e052805d1d1d3cd81e36569d.camel@suse.de> (raw)
In-Reply-To: <d8be3a45491224e0c91355131a9bcf605f38fb76.camel@suse.de>

[-- Attachment #1: Type: text/plain, Size: 2658 bytes --]

Hi Maxime,

On Fri, 2020-06-05 at 14:04 +0200, Nicolas Saenz Julienne wrote:
> On Wed, 2020-05-27 at 17:45 +0200, Maxime Ripard wrote:
> > While the firmware allows us to discover the available clocks, we need to
> > discriminate those clocks to only register the ones meaningful to Linux.
> > The firmware also doesn't provide a clock name, so having a list of the ID
> > will help us to give clocks a proper name later on.
> > 
> > Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> > ---
> >  drivers/clk/bcm/clk-raspberrypi.c | 23 +++++++++++++++++++----
> >  1 file changed, 19 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/clk/bcm/clk-raspberrypi.c b/drivers/clk/bcm/clk-
> > raspberrypi.c
> > index 5f4e2d49432f..eebd16040f8a 100644
> > --- a/drivers/clk/bcm/clk-raspberrypi.c
> > +++ b/drivers/clk/bcm/clk-raspberrypi.c
> > @@ -18,7 +18,23 @@
> >  
> >  #include <soc/bcm2835/raspberrypi-firmware.h>
> >  
> > -#define RPI_FIRMWARE_ARM_CLK_ID		0x00000003
> > +enum rpi_firmware_clk_id {
> > +	RPI_FIRMWARE_EMMC_CLK_ID = 1,
> > +	RPI_FIRMWARE_UART_CLK_ID,
> > +	RPI_FIRMWARE_ARM_CLK_ID,
> > +	RPI_FIRMWARE_CORE_CLK_ID,
> > +	RPI_FIRMWARE_V3D_CLK_ID,
> > +	RPI_FIRMWARE_H264_CLK_ID,
> > +	RPI_FIRMWARE_ISP_CLK_ID,
> > +	RPI_FIRMWARE_SDRAM_CLK_ID,
> > +	RPI_FIRMWARE_PIXEL_CLK_ID,
> > +	RPI_FIRMWARE_PWM_CLK_ID,
> > +	RPI_FIRMWARE_HEVC_CLK_ID,
> > +	RPI_FIRMWARE_EMMC2_CLK_ID,
> > +	RPI_FIRMWARE_M2MC_CLK_ID,
> > +	RPI_FIRMWARE_PIXEL_BVB_CLK_ID,
> > +	RPI_FIRMWARE_NUM_CLK_ID,
> > +};
> >  
> >  #define RPI_FIRMWARE_STATE_ENABLE_BIT	BIT(0)
> >  #define RPI_FIRMWARE_STATE_WAIT_BIT	BIT(1)
> > @@ -31,8 +47,6 @@
> >  
> >  #define A2W_PLL_FRAC_BITS		20
> >  
> > -#define NUM_FW_CLKS			16
> > -
> >  struct raspberrypi_clk {
> >  	struct device *dev;
> >  	struct rpi_firmware *firmware;
> > @@ -320,7 +334,8 @@ static int raspberrypi_clk_probe(struct platform_device
> > *pdev)
> >  	rpi->firmware = firmware;
> >  	platform_set_drvdata(pdev, rpi);
> >  
> > -	clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, NUM_FW_CLKS),
> > +	clk_data = devm_kzalloc(dev, struct_size(clk_data, hws,
> > +						 RPI_FIRMWARE_NUM_CLK_ID),
> 
> nit: you're allocating one structure too many right?

Nevermind this comment, as pointed out privately by Phil Elwell, I forgot the
firmware clk description structure starts at 0. So we need to make space for
that.

It would maybe make sense to add RPI_FIRMWARE_RESERVED_CLK_ID above the EMMC
clk entry. Although it's just a suggestion.

> Acked-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
> 
> Regards,
> Nicolas
> 


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2020-06-05 13:09 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-27 15:44 [PATCH v3 00/25] clk: bcm: rpi: Add support for BCM2711 firmware clocks Maxime Ripard
2020-05-27 15:44 ` [PATCH v3 01/25] dt-bindings: arm: bcm: Convert BCM2835 firmware binding to YAML Maxime Ripard
2020-05-27 15:44 ` [PATCH v3 02/25] dt-bindings: clock: Add a binding for the RPi Firmware clocks Maxime Ripard
2020-05-29 18:14   ` Rob Herring
2020-05-29 21:17   ` Stephen Boyd
2020-05-30 16:23     ` Maxime Ripard
2020-05-27 15:44 ` [PATCH v3 03/25] firmware: rpi: Only create clocks device if we don't have a node for it Maxime Ripard
2020-06-04 17:50   ` Nicolas Saenz Julienne
2020-05-27 15:45 ` [PATCH v3 04/25] clk: bcm: rpi: Allow the driver to be probed by DT Maxime Ripard
2020-05-29 21:17   ` Stephen Boyd
2020-06-04 17:52   ` Nicolas Saenz Julienne
2020-05-27 15:45 ` [PATCH v3 05/25] clk: bcm: rpi: Statically init clk_init_data Maxime Ripard
2020-05-27 15:45 ` [PATCH v3 06/25] clk: bcm: rpi: Use clk_hw_register for pllb_arm Maxime Ripard
2020-05-27 15:45 ` [PATCH v3 07/25] clk: bcm: rpi: Remove global pllb_arm clock pointer Maxime Ripard
2020-05-27 15:45 ` [PATCH v3 08/25] clk: bcm: rpi: Make sure pllb_arm is removed Maxime Ripard
2020-05-27 15:45 ` [PATCH v3 09/25] clk: bcm: rpi: Remove pllb_arm_lookup global pointer Maxime Ripard
2020-05-27 15:45 ` [PATCH v3 10/25] clk: bcm: rpi: Switch to clk_hw_register_clkdev Maxime Ripard
2020-05-27 15:45 ` [PATCH v3 11/25] clk: bcm: rpi: Make sure the clkdev lookup is removed Maxime Ripard
2020-05-27 15:45 ` [PATCH v3 12/25] clk: bcm: rpi: Use CCF boundaries instead of rolling our own Maxime Ripard
2020-06-04 18:02   ` Nicolas Saenz Julienne
2020-06-05  9:28     ` Maxime Ripard
2020-06-05  9:34       ` Nicolas Saenz Julienne
2020-05-27 15:45 ` [PATCH v3 13/25] clk: bcm: rpi: Create a data structure for the clocks Maxime Ripard
2020-05-27 15:45 ` [PATCH v3 14/25] clk: bcm: rpi: Add clock id to data Maxime Ripard
2020-05-27 15:45 ` [PATCH v3 15/25] clk: bcm: rpi: Pass the clocks data to the firmware function Maxime Ripard
2020-05-27 15:45 ` [PATCH v3 16/25] clk: bcm: rpi: Rename is_prepared function Maxime Ripard
2020-05-27 15:45 ` [PATCH v3 17/25] clk: bcm: rpi: Split pllb clock hooks Maxime Ripard
2020-06-05 10:34   ` Nicolas Saenz Julienne
2020-05-27 15:45 ` [PATCH v3 18/25] clk: bcm: rpi: Make the PLLB registration function return a clk_hw Maxime Ripard
2020-06-05 10:38   ` Nicolas Saenz Julienne
2020-05-27 15:45 ` [PATCH v3 19/25] clk: bcm: rpi: Add DT provider for the clocks Maxime Ripard
2020-06-05 10:42   ` Nicolas Saenz Julienne
2020-05-27 15:45 ` [PATCH v3 20/25] clk: bcm: rpi: Add an enum for the firmware clocks Maxime Ripard
2020-06-05 12:04   ` Nicolas Saenz Julienne
2020-06-05 13:09     ` Nicolas Saenz Julienne [this message]
2020-05-27 15:45 ` [PATCH v3 21/25] clk: bcm: rpi: Discover " Maxime Ripard
2020-06-05 12:45   ` Nicolas Saenz Julienne
2020-05-27 15:45 ` [PATCH v3 22/25] clk: bcm: rpi: Give firmware clocks a name Maxime Ripard
2020-06-05 12:49   ` Nicolas Saenz Julienne
2020-05-27 15:45 ` [PATCH v3 23/25] Revert "clk: bcm2835: remove pllb" Maxime Ripard
2020-05-27 15:45 ` [PATCH v3 24/25] clk: bcm: rpi: Remove the quirks for the CPU clock Maxime Ripard
2020-05-27 15:45 ` [PATCH v3 25/25] ARM: dts: bcm2711: Add firmware clocks node Maxime Ripard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ef54a57d7a7475a3e052805d1d1d3cd81e36569d.camel@suse.de \
    --to=nsaenzjulienne@suse.de \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=maxime@cerno.tech \
    --cc=phil@raspberrypi.com \
    --cc=tim.gover@raspberrypi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).