mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Sascha Hauer <sha@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v2 15/21] clk: rpi: add Raspberry Pi 4 support
Date: Thu, 9 Jun 2022 16:15:22 +0200	[thread overview]
Message-ID: <26ed6d0d-29b6-70d3-d408-e4a790213855@pengutronix.de> (raw)
In-Reply-To: <20220609135831.GV1615@pengutronix.de>

On 09.06.22 15:58, Sascha Hauer wrote:
> On Thu, Jun 09, 2022 at 07:59:16AM +0200, Ahmad Fatoum wrote:
>> Our Raspberry Pi block driver is a hack, but it works well enough for
> 
> s/block/clock?

aye.

> 
> Sascha
> 
>> older Rpis and just needs one more clock to support the SD-Card on the
>> Raspberry Pi 4, so add that. In return, we remove bcm2835-cs, which we
>> won't use on Raspberry Pi 4, because we'll leverage the ARM architected
>> timer instead.
>>
>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
>> ---
>>  arch/arm/mach-bcm283x/include/mach/mbox.h |  1 +
>>  drivers/clk/clk-rpi.c                     | 42 +++++++++++++++++------
>>  2 files changed, 32 insertions(+), 11 deletions(-)
>>
>> diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h
>> index a9f06512bc23..46f9dfc9ea65 100644
>> --- a/arch/arm/mach-bcm283x/include/mach/mbox.h
>> +++ b/arch/arm/mach-bcm283x/include/mach/mbox.h
>> @@ -273,6 +273,7 @@ struct bcm2835_mbox_tag_set_power_state {
>>  #define BCM2835_MBOX_CLOCK_ID_SDRAM	8
>>  #define BCM2835_MBOX_CLOCK_ID_PIXEL	9
>>  #define BCM2835_MBOX_CLOCK_ID_PWM	10
>> +#define BCM2835_MBOX_CLOCK_ID_EMMC2	12
>>  
>>  struct bcm2835_mbox_tag_get_clock_rate {
>>  	struct bcm2835_mbox_tag_hdr tag_hdr;
>> diff --git a/drivers/clk/clk-rpi.c b/drivers/clk/clk-rpi.c
>> index 59ae8e59bac5..71badc04c0f0 100644
>> --- a/drivers/clk/clk-rpi.c
>> +++ b/drivers/clk/clk-rpi.c
>> @@ -40,10 +40,29 @@ static struct clk *rpi_register_firmware_clock(u32 clock_id, const char *name)
>>  	return clk_fixed(name, msg->get_clock_rate.body.resp.rate_hz);
>>  }
>>  
>> -static int bcm2835_cprman_probe(struct device_d *dev)
>> +static int bcm2835_cprman_init(struct device_d *dev)
>>  {
>>  	struct clk *clk_cs;
>>  
>> +	clk_cs = clk_fixed("bcm2835-cs", 1 * 1000 * 1000);
>> +	clk_register_clkdev(clk_cs, NULL, "bcm2835-cs");
>> +
>> +	return 0;
>> +}
>> +
>> +static int rpi_cprman_probe(struct device_d *dev)
>> +{
>> +	int (*init)(struct device_d *dev);
>> +
>> +	init = device_get_match_data(dev);
>> +	if (init) {
>> +		int ret;
>> +
>> +		ret = init(dev);
>> +		if (ret)
>> +			return ret;
>> +	}
>> +
>>  	clks[BCM2835_CLOCK_EMMC] =
>>  		rpi_register_firmware_clock(BCM2835_MBOX_CLOCK_ID_EMMC,
>>  					 "bcm2835_mci0");
>> @@ -56,12 +75,15 @@ static int bcm2835_cprman_probe(struct device_d *dev)
>>  	if (IS_ERR(clks[BCM2835_CLOCK_VPU]))
>>  		return PTR_ERR(clks[BCM2835_CLOCK_VPU]);
>>  
>> +	clks[BCM2711_CLOCK_EMMC2] =
>> +		rpi_register_firmware_clock(BCM2835_MBOX_CLOCK_ID_EMMC2,
>> +					 "bcm2711_emmc2");
>> +	if (IS_ERR(clks[BCM2711_CLOCK_EMMC2]))
>> +		return PTR_ERR(clks[BCM2711_CLOCK_EMMC2]);
>> +
>>  	clks[BCM2835_CLOCK_UART] = clk_fixed("uart0-pl0110", 48 * 1000 * 1000);
>>  	clk_register_clkdev(clks[BCM2835_CLOCK_UART], NULL, "uart0-pl0110");
>>  
>> -	clk_cs = clk_fixed("bcm2835-cs", 1 * 1000 * 1000);
>> -	clk_register_clkdev(clk_cs, NULL, "bcm2835-cs");
>> -
>>  	clk_data.clks = clks;
>>  	clk_data.clk_num = BCM2711_CLOCK_END;
>>  	of_clk_add_provider(dev->device_node, of_clk_src_onecell_get, &clk_data);
>> @@ -70,16 +92,14 @@ static int bcm2835_cprman_probe(struct device_d *dev)
>>  }
>>  
>>  static __maybe_unused struct of_device_id bcm2835_cprman_dt_ids[] = {
>> -	{
>> -		.compatible = "brcm,bcm2835-cprman",
>> -	}, {
>> -		/* sentinel */
>> -	}
>> +	{ .compatible = "brcm,bcm2835-cprman", .data = bcm2835_cprman_init },
>> +	{ .compatible = "brcm,bcm2711-cprman" },
>> +	{ /* sentinel */ }
>>  };
>>  
>>  static struct driver_d bcm2835_cprman_driver = {
>> -	.probe	= bcm2835_cprman_probe,
>> -	.name	= "bcm2835-cprman",
>> +	.probe	= rpi_cprman_probe,
>> +	.name	= "raspberrypi-cprman",
>>  	.of_compatible = DRV_OF_COMPAT(bcm2835_cprman_dt_ids),
>>  };
>>  core_platform_driver(bcm2835_cprman_driver);
>> -- 
>> 2.30.2
>>
>>
>> _______________________________________________
>> barebox mailing list
>> barebox@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/barebox
>>
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  reply	other threads:[~2022-06-09 14:16 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09  5:59 [PATCH v2 00/21] ARM: rpi: add basic " Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 01/21] ARM64: asm: implement read_cpuid_id() Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 02/21] dma: add dma_sync nop stubs for PBL Ahmad Fatoum
2022-06-14  8:49   ` Sascha Hauer
2022-06-14  9:00     ` Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 03/21] ARM: rpi: move bcm2835_add_device_sdram() into header Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 04/21] ARM: rpi: support PBL use of mbox Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 05/21] ARM: rpi: split out mbox helpers to share code with PBL Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 06/21] ARM: rpi: switch to ARM_USE_COMPRESSED_DTB Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 07/21] ARM: rpi: add generic Raspberry Pi image Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 08/21] ARM: rpi: support FDT in x0 for 64bit configurations Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 09/21] serial: ns16550: rpi: remove ungating now done by proper clk driver Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 10/21] ARM: cpu: prevent recursive dependencies via CPU_SUPPORTS_64BIT_KERNEL Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 11/21] ARM: cpu: remove unnecessary CONFIG_SYS_SUPPORTS_64BIT_KERNEL Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 12/21] ARM: cpu: remove unused SYS_SUPPORTS_32BIT_KERNEL Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 13/21] ARM: rpi: add Raspberry Pi 3 64-bit build support Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 14/21] ARM: rpi: rpi3: disallow MMU_EARLY && 64BIT Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 15/21] clk: rpi: add Raspberry Pi 4 support Ahmad Fatoum
2022-06-09 13:58   ` Sascha Hauer
2022-06-09 14:15     ` Ahmad Fatoum [this message]
2022-06-09  5:59 ` [PATCH v2 16/21] mci: bcm2835: add bcm2711-emmc2 (Rpi4) support Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 17/21] clocksource: bcm2835: bump below architeced timer for AArch64 Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 18/21] ARM: rpi: add Raspberry Pi 4 support Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 19/21] ARM: rpi: add debug_ll support for Raspberry Pi 4 Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 20/21] doc: bcm283x: reference newer firmware Ahmad Fatoum
2022-06-09  5:59 ` [PATCH v2 21/21] ARM: rpi: use correct kernel8.img as name for 64-bit Ahmad Fatoum
2022-06-10  8:33 ` [PATCH v2 00/21] ARM: rpi: add basic Raspberry Pi 4 support Sascha Hauer

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=26ed6d0d-29b6-70d3-d408-e4a790213855@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=sha@pengutronix.de \
    /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