All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 2/2] arm: add initial support for Amlogic Meson and ODROID-C2
Date: Mon, 11 Apr 2016 23:08:02 +0200	[thread overview]
Message-ID: <570C1232.1070908@denx.de> (raw)
In-Reply-To: <20160411210211.GB22294@gmail.com>

On 04/11/2016 11:02 PM, Beniamino Galvani wrote:
> On Mon, Apr 11, 2016 at 02:08:56AM +0200, Marek Vasut wrote:
>>
>>> +#define GXBB_GPIO_0_EN		GXBB_PERIPHS_ADDR(0x0c)
>>> +#define GXBB_GPIO_0_OUT		GXBB_PERIPHS_ADDR(0x0d)
>>> +#define GXBB_GPIO_0_IN		GXBB_PERIPHS_ADDR(0x0e)
>>
>> You can also define this as
>> GXBB_GPIO_EN(n)  (0xc + 3 * (n) + 0)
>> GXBB_GPIO_OUT(n) (0xc + 3 * (n) + 1)
>> GXBB_GPIO_IN(n)  (0xc + 3 * (n) + 2)
> 
> This would work well if GPIO_6 didn't exist :)

Hrm, good point. You can probably special-case the gpio 6 with ternary
operator then .

>>> +#define GXBB_GPIO_1_EN		GXBB_PERIPHS_ADDR(0x0f)
>>> +#define GXBB_GPIO_1_OUT		GXBB_PERIPHS_ADDR(0x10)
>>> +#define GXBB_GPIO_1_IN		GXBB_PERIPHS_ADDR(0x11)
>>> +#define GXBB_GPIO_2_EN		GXBB_PERIPHS_ADDR(0x12)
>>> +#define GXBB_GPIO_2_OUT		GXBB_PERIPHS_ADDR(0x13)
>>> +#define GXBB_GPIO_2_IN		GXBB_PERIPHS_ADDR(0x14)
>>> +#define GXBB_GPIO_3_EN		GXBB_PERIPHS_ADDR(0x15)
>>> +#define GXBB_GPIO_3_OUT		GXBB_PERIPHS_ADDR(0x16)
>>> +#define GXBB_GPIO_3_IN		GXBB_PERIPHS_ADDR(0x17)
>>> +#define GXBB_GPIO_4_EN		GXBB_PERIPHS_ADDR(0x18)
>>> +#define GXBB_GPIO_4_OUT		GXBB_PERIPHS_ADDR(0x19)
>>> +#define GXBB_GPIO_4_IN		GXBB_PERIPHS_ADDR(0x1a)
>>> +#define GXBB_GPIO_5_EN		GXBB_PERIPHS_ADDR(0x1b)
>>> +#define GXBB_GPIO_5_OUT		GXBB_PERIPHS_ADDR(0x1c)
>>> +#define GXBB_GPIO_5_IN		GXBB_PERIPHS_ADDR(0x1d)
>>> +#define GXBB_GPIO_6_EN		GXBB_PERIPHS_ADDR(0x08)
>>> +#define GXBB_GPIO_6_OUT		GXBB_PERIPHS_ADDR(0x09)
>>> +#define GXBB_GPIO_6_IN		GXBB_PERIPHS_ADDR(0x0a)
> 
>> It'd be nice to have base addresses somewhere at the beginning instead
>> of having them mixed with the bit macros, but that's a matter of taste.
> 
> I agree, I'll change this.
> 
>>> +	val = fdt_getprop(gd->fdt_blob, offset, "reg", &len);
>>> +	if (len < sizeof(*val) * 4)
>>> +		return -EINVAL;
>>> +
>>> +	/* Don't use fdt64_t to avoid unaligned access */
>>
>> This looks iffy, can you elaborate on this issue ?
> 
> I was getting a "Synchronous Abort handler, esr 0x96000021" which
> seemed to indicate a alignment fault, but thinking again about it I'm
> not sure anymore of the real cause. fdt64_t and fdt64_to_cpu() don't
> work here, I will try to investigate better why. Suggestions are
> welcome :)

Toolchain issues ? Stack alignment issue ?

>>> +	/* Reserve first 16 MiB of RAM */
>>
>> Why ?
> 
> I'll add a comment, first 16 MiB seems to be reserved for firmware.

Thanks.

>>> +void reset_cpu(ulong addr)
>>> +{
>>
>> How does the system reboot then ?
> 
> The system reboots through a call to secure monitor, which is not
> implemented in this submission.

Ha, either implement the call or add comment please.

>>> +struct mm_region *mem_map = gxbb_mem_map;
>>
>> This looks super-iffy, I wouldn't be surprised if this started being
>> optimized away at some point.
> 
> I don't understand, why that should happen?

If you link the file alone, nothing references the symbols, so they can
be optimized away. But this is luckily not the case here.

>>> +	/* Reset PHY on GPIOZ_14 */
>>> +	clrbits_le32(GXBB_GPIO_3_EN, BIT(14));
>>> +	clrbits_le32(GXBB_GPIO_3_OUT, BIT(14));
>>> +	udelay(100000);
>>
>> mdelay(100); , though that is quite some wait.
> 
> Will change and decrease the timeout.
> 
>>> diff --git a/drivers/serial/serial_meson.c b/drivers/serial/serial_meson.c
>>
>> This should go in a separate patch.
> 
> I originally submitted the driver as separate patch, then Tom
> suggested that the initial platform patch should contain everything
> needed to perform a boot, so UART, DDR, board file and DTS.

Meh, I politely disagree with Tom ;-)

> Thanks for the review,
> 
> Beniamino
> 


-- 
Best regards,
Marek Vasut

  reply	other threads:[~2016-04-11 21:08 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-10 15:30 [U-Boot] [PATCH v3 0/2] Amlogic Meson GXBaby and ODROID-C2 support Beniamino Galvani
2016-04-10 15:30 ` [U-Boot] [PATCH v3 1/2] net: designware: fix descriptor layout and warnings on 64-bit archs Beniamino Galvani
2016-04-10 23:59   ` Marek Vasut
2016-04-11 20:46     ` Beniamino Galvani
2016-04-10 15:30 ` [U-Boot] [PATCH v3 2/2] arm: add initial support for Amlogic Meson and ODROID-C2 Beniamino Galvani
2016-04-11  0:08   ` Marek Vasut
2016-04-11 21:02     ` Beniamino Galvani
2016-04-11 21:08       ` Marek Vasut [this message]
2016-04-12 21:50         ` Beniamino Galvani
2016-04-12 22:26           ` Marek Vasut
2016-04-13 11:22             ` Beniamino Galvani
2016-04-13 11:52               ` Marek Vasut
2016-04-13 21:38                 ` Alexander Graf
2016-04-13 22:34                   ` Tom Rini
2016-04-13 22:42                     ` Alexander Graf
2016-04-13 22:51                       ` Tom Rini
2016-04-13 22:53                         ` Alexander Graf
2016-04-13 23:12                           ` Marek Vasut
2016-04-14  7:08                             ` Alexander Graf

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=570C1232.1070908@denx.de \
    --to=marex@denx.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.