mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: "Thomas Hämmerle" <Thomas.Haemmerle@wolfvision.net>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: "barebox@lists.infradead.org" <barebox@lists.infradead.org>
Subject: Re: [PATCH] firmware-zynqmp: port from linux
Date: Thu, 14 Feb 2019 14:35:00 +0000	[thread overview]
Message-ID: <79e74d64-d8f3-626b-cefc-1ea810242ec2@wolfvision.net> (raw)
In-Reply-To: <20190212083148.w23wpevefvm3pezv@pengutronix.de>

Hi Sascha,

On 12.02.19 09:31, Sascha Hauer wrote:
> Hi Thomas,
> 
> On Mon, Feb 11, 2019 at 02:10:40PM +0000, Thomas Hämmerle wrote:
>> From: Thomas Haemmerle <thomas.haemmerle@wolfvision.net>
>>
>> Port Xilinx Zynq MPSoC Firmware layer driver from linux.
>>
>> Signed-off-by: Thomas Haemmerle <thomas.haemmerle@wolfvision.net>
>> ---
>>   arch/arm/Kconfig                                   |   1 +
>>   arch/arm/mach-zynqmp/Makefile                      |   2 +-
>>   arch/arm/mach-zynqmp/firmware-zynqmp.c             | 601 +++++++++++++++++++++
>>   .../arm/mach-zynqmp/include/mach/firmware-zynqmp.h |  66 +++
>>   4 files changed, 669 insertions(+), 1 deletion(-)
>>   create mode 100644 arch/arm/mach-zynqmp/firmware-zynqmp.c
>>   create mode 100644 arch/arm/mach-zynqmp/include/mach/firmware-zynqmp.h
>>
>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>> index c1f385b..fdbe5b7 100644
>> --- a/arch/arm/Kconfig
>> +++ b/arch/arm/Kconfig
>> @@ -250,6 +250,7 @@ config ARCH_ZYNQMP
>>   	select CPU_V8
>>   	select HAS_DEBUG_LL
>>   	select HAVE_PBL_MULTI_IMAGES
>> +	select ARM_SMCCC
>>   	select COMMON_CLK
>>   	select COMMON_CLK_OF_PROVIDER
>>   	select CLKDEV_LOOKUP
>> diff --git a/arch/arm/mach-zynqmp/Makefile b/arch/arm/mach-zynqmp/Makefile
>> index c601374..021efc9 100644
>> --- a/arch/arm/mach-zynqmp/Makefile
>> +++ b/arch/arm/mach-zynqmp/Makefile
>> @@ -1,2 +1,2 @@
>>   # SPDX-License-Identifier: GPL-2.0-or-later
>> -obj- := __dummy__.o
>> +obj-y += firmware-zynqmp.o
>> diff --git a/arch/arm/mach-zynqmp/firmware-zynqmp.c b/arch/arm/mach-zynqmp/firmware-zynqmp.c
> 
> 
> Maybe drivers/firmware/ would be a more appropriate directory to put
> this driver in.

I was not sure where to put the this driver in:

In linux drivers/firmware is the location for drivers which communicate
with a firmware (like this one).

In barebox, this directory contains drivers to load firmware to devices
(socfpga.c for example). Since I will also create a driver to load the
PL (programmable logic) of ZynqMP which I will place in
drivers/firmware, I decided to put this driver to arch/arm.

> 
>> +static int zynqmp_firmware_probe(struct device_d *dev)
>> +{
>> +	int ret;
>> +
>> +	ret = get_set_conduit_method(dev->device_node);
>> +	if (ret)
>> +		goto out;
>> +
>> +	zynqmp_pm_get_api_version(&pm_api_version);
>> +	if (pm_api_version < ZYNQMP_PM_VERSION) {
>> +		dev_err(dev, "Platform Management API version error."
>> +				"Expected: v%d.%d - Found: v%d.%d\n",
>> +				ZYNQMP_PM_VERSION_MAJOR,
>> +				ZYNQMP_PM_VERSION_MINOR,
>> +				pm_api_version >> 16, pm_api_version & 0xFFFF);
>> +		ret = -1;
>> +		goto out;
> 
> -1 is -EPERM which is not a meaningful error code here. Please pick
> something appropriate from errno.h.

Of course - will fix this.

> 
> Otherwise looks good. This looks like clock support. Are you planning to
> create a clk driver aswell?

Yes, a clk driver is also planned.

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

  reply	other threads:[~2019-02-14 14:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-11 14:10 Thomas Hämmerle
2019-02-12  8:31 ` Sascha Hauer
2019-02-14 14:35   ` Thomas Hämmerle [this message]
2019-02-19  9:03     ` 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=79e74d64-d8f3-626b-cefc-1ea810242ec2@wolfvision.net \
    --to=thomas.haemmerle@wolfvision.net \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@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