public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Thomas Chou <thomas@wytron.com.tw>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] nios2: convert nios2 cpu to driver model
Date: Tue, 29 Sep 2015 15:18:05 +0800	[thread overview]
Message-ID: <560A3B2D.9000404@wytron.com.tw> (raw)
In-Reply-To: <201509290445.28107.marex@denx.de>

Hi Marek,

On 09/29/2015 10:45 AM, Marek Vasut wrote:
>> --- a/arch/Kconfig
>> +++ b/arch/Kconfig
>> @@ -64,6 +64,9 @@ config NIOS2
>>   	select HAVE_GENERIC_BOARD
>>   	select SYS_GENERIC_BOARD
>>   	select SUPPORT_OF_CONTROL
>> +	select OF_CONTROL
>> +	select DM
>> +	select CPU
>
> What's this CONFIG_CPU for please ?

drivers/cpu/Kconfig

It is "Enable CPU drivers using Driver Model". I think it should have 
been named as CONFIG_DM_CPU to avoid confusion.

>> -int arch_cpu_init(void)
>> +int arch_cpu_init_dm(void)
>>   {
>> -	gd->cpu_clk = CONFIG_SYS_CLK_FREQ;
>> +	struct udevice *dev;
>> +
>> +	uclass_first_device(UCLASS_CPU, &dev);
>> +	if (!dev)
>> +		return -ENODEV;
>> +
>> +	gd->cpu_clk = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
>> +		"clock-frequency", 0);
>> +	gd->arch.dcache_line_size = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
>> +		"dcache-line-size", 0);
>> +	gd->arch.icache_line_size = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
>> +		"icache-line-size", 0);
>> +	gd->arch.dcache_size = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
>> +		"dcache-size", 0);
>> +	gd->arch.icache_size = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
>> +		"icache-size", 0);
>> +	gd->arch.reset_addr = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
>> +		"altr,reset-addr", 0);
>> +	gd->arch.exception_addr = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
>> +		"altr,exception-addr", 0);
>> +	gd->arch.has_mmu = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
>> +		"altr,has-mmu", 0);
>
> Shouldn't there be some sort of return value checking here ?

There might be some. Though I would like to depend upon the sopc2dts 
which generates the dts. I don't think these values should be tweaked by 
a human. :)

>
>> +	info->features = 1 << CPU_FEAT_L1_CACHE
>> +		| (gd->arch.has_mmu ? 1 << CPU_FEAT_MMU : 0);
>
> I'd add parenthesis around the bitshifts, for the sake of clarity.
> Also, please put the ORR operator at the end of the line.

Will do as suggested.

Thanks a lot for your review.

Best regards,
Thomas Chou

  reply	other threads:[~2015-09-29  7:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-28  0:31 [U-Boot] [PATCH] nios2: convert nios2 cpu to driver model Thomas Chou
2015-09-29  1:28 ` [U-Boot] [PATCH v2] " Thomas Chou
2015-09-29  2:45   ` Marek Vasut
2015-09-29  7:18     ` Thomas Chou [this message]
2015-09-29 14:28       ` Bin Meng
2015-09-29 14:29         ` Bin Meng
2015-09-29 14:52           ` Simon Glass
2015-09-29 12:15 ` [U-Boot] [PATCH v3] " Thomas Chou
2015-09-29 14:08   ` Simon Glass
2015-10-01  2:14     ` Thomas Chou
2015-10-01  2:31 ` [U-Boot] [PATCH] " Thomas Chou
2015-10-02  7:06   ` Simon Glass
2015-10-04 11:49   ` Thomas Chou

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=560A3B2D.9000404@wytron.com.tw \
    --to=thomas@wytron.com.tw \
    --cc=u-boot@lists.denx.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