diff mbox

[U-Boot,04/10] arm64: a37xx: Handle pin controls in early board init

Message ID 1486993091-15058-5-git-send-email-kostap@marvell.com
State Superseded
Delegated to: Stefan Roese
Headers show

Commit Message

Kostya Porotchkin Feb. 13, 2017, 1:38 p.m. UTC
From: Konstantin Porotchkin <kostap@marvell.com>

Fix the default pin control values in a board-specific
function on early board init stage.
This fix allows the NETA driver to work in RGMII
mode until the full-featured pin control driver gets
introduced.

Signed-off-by: Konstantin Porotchkin <kostap@marvell.com>
Cc: Stefan Roese <sr@denx.de>
Cc: Igal Liberman <igall@marvell.com>
---
 board/Marvell/mvebu_db-88f3720/board.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

Comments

Stefan Roese Feb. 14, 2017, 11:43 a.m. UTC | #1
Hi Kosta,

On 13.02.2017 14:38, kostap@marvell.com wrote:
> From: Konstantin Porotchkin <kostap@marvell.com>
>
> Fix the default pin control values in a board-specific
> function on early board init stage.
> This fix allows the NETA driver to work in RGMII
> mode until the full-featured pin control driver gets
> introduced.
>
> Signed-off-by: Konstantin Porotchkin <kostap@marvell.com>
> Cc: Stefan Roese <sr@denx.de>
> Cc: Igal Liberman <igall@marvell.com>
> ---
>  board/Marvell/mvebu_db-88f3720/board.c | 26 +++++++++++++++++++++++++-
>  1 file changed, 25 insertions(+), 1 deletion(-)
>
> diff --git a/board/Marvell/mvebu_db-88f3720/board.c b/board/Marvell/mvebu_db-88f3720/board.c
> index edf88c7..3337f3f 100644
> --- a/board/Marvell/mvebu_db-88f3720/board.c
> +++ b/board/Marvell/mvebu_db-88f3720/board.c
> @@ -19,9 +19,33 @@ DECLARE_GLOBAL_DATA_PTR;
>  #define I2C_IO_REG_0_SATA_OFF	2
>  #define I2C_IO_REG_0_USB_H_OFF	1
>
> +#define PINCTRL_NB_REG_VALUE	0x000173fa
> +#define PINCTRL_SB_REG_VALUE	0x00007a23
> +

I am aware that this is a temporary solution, but are these values
correct for the A3720-DB or only the ESPRESSBin board?

BTW: You are now using the "Marvell/mvebu_db-88f3720" board directory
for multiple board and not only the A3720-DB. I would prefer to see
a rename of the board directory before this, like we've done to the
A7k/8k directory. What do you think?

>  int board_early_init_f(void)
>  {
> -	/* Nothing to do (yet), perhaps later some pin-muxing etc */
> +	const void *blob = gd->fdt_blob;
> +	const char *bank_name;
> +	const char *compat = "marvell,armada-3700-pinctl";
> +	int off, len;
> +	void __iomem *addr;
> +
> +	/* FIXME
> +	 * Temporary WA for setting correct pin control values
> +	 * until the real pin control driver is awailable.
> +	 */
> +	off = fdt_node_offset_by_compatible(blob, -1, compat);
> +	while (off != -FDT_ERR_NOTFOUND) {
> +		bank_name = fdt_getprop(blob, off, "bank-name", &len);
> +		addr = (void __iomem *)fdtdec_get_addr_size_auto_noparent(
> +				blob, off, "reg", 0, NULL, true);
> +		if (!strncmp(bank_name, "armada-3700-nb", len))
> +			writel(PINCTRL_NB_REG_VALUE, addr);
> +		else if (!strncmp(bank_name, "armada-3700-sb", len))
> +			writel(PINCTRL_SB_REG_VALUE, addr);
> +
> +		off = fdt_node_offset_by_compatible(blob, off, compat);
> +	}
>
>  	return 0;
>  }
>

Thanks,
Stefan
Kostya Porotchkin Feb. 14, 2017, 12:07 p.m. UTC | #2
Hi, Stefan,

On 2/14/2017 13:43, Stefan Roese wrote:
> Hi Kosta,
>
> On 13.02.2017 14:38, kostap@marvell.com wrote:
>> From: Konstantin Porotchkin <kostap@marvell.com>
>>
>> Fix the default pin control values in a board-specific
>> function on early board init stage.
>> This fix allows the NETA driver to work in RGMII
>> mode until the full-featured pin control driver gets
>> introduced.
>>
>> Signed-off-by: Konstantin Porotchkin <kostap@marvell.com>
>> Cc: Stefan Roese <sr@denx.de>
>> Cc: Igal Liberman <igall@marvell.com>
>> ---
>>  board/Marvell/mvebu_db-88f3720/board.c | 26 +++++++++++++++++++++++++-
>>  1 file changed, 25 insertions(+), 1 deletion(-)
>>
>> diff --git a/board/Marvell/mvebu_db-88f3720/board.c
>> b/board/Marvell/mvebu_db-88f3720/board.c
>> index edf88c7..3337f3f 100644
>> --- a/board/Marvell/mvebu_db-88f3720/board.c
>> +++ b/board/Marvell/mvebu_db-88f3720/board.c
>> @@ -19,9 +19,33 @@ DECLARE_GLOBAL_DATA_PTR;
>>  #define I2C_IO_REG_0_SATA_OFF    2
>>  #define I2C_IO_REG_0_USB_H_OFF    1
>>
>> +#define PINCTRL_NB_REG_VALUE    0x000173fa
>> +#define PINCTRL_SB_REG_VALUE    0x00007a23
>> +
>
> I am aware that this is a temporary solution, but are these values
> correct for the A3720-DB or only the ESPRESSBin board?
They are good for the DB board as well. Actually without this change the 
NETA driver will crash if we try to ping the server.

>
> BTW: You are now using the "Marvell/mvebu_db-88f3720" board directory
> for multiple board and not only the A3720-DB. I would prefer to see
> a rename of the board directory before this, like we've done to the
> A7k/8k directory. What do you think?
Agree, I can do it. Should we change it in this patch series or 
introduce an additional patch later?

>
>>  int board_early_init_f(void)
>>  {
>> -    /* Nothing to do (yet), perhaps later some pin-muxing etc */
>> +    const void *blob = gd->fdt_blob;
>> +    const char *bank_name;
>> +    const char *compat = "marvell,armada-3700-pinctl";
>> +    int off, len;
>> +    void __iomem *addr;
>> +
>> +    /* FIXME
>> +     * Temporary WA for setting correct pin control values
>> +     * until the real pin control driver is awailable.
>> +     */
>> +    off = fdt_node_offset_by_compatible(blob, -1, compat);
>> +    while (off != -FDT_ERR_NOTFOUND) {
>> +        bank_name = fdt_getprop(blob, off, "bank-name", &len);
>> +        addr = (void __iomem *)fdtdec_get_addr_size_auto_noparent(
>> +                blob, off, "reg", 0, NULL, true);
>> +        if (!strncmp(bank_name, "armada-3700-nb", len))
>> +            writel(PINCTRL_NB_REG_VALUE, addr);
>> +        else if (!strncmp(bank_name, "armada-3700-sb", len))
>> +            writel(PINCTRL_SB_REG_VALUE, addr);
>> +
>> +        off = fdt_node_offset_by_compatible(blob, off, compat);
>> +    }
>>
>>      return 0;
>>  }
>>
>
> Thanks,
> Stefan
Stefan Roese Feb. 14, 2017, 12:21 p.m. UTC | #3
On 14.02.2017 13:07, Konstantin Porotchkin wrote:
> Hi, Stefan,
>
> On 2/14/2017 13:43, Stefan Roese wrote:
>> Hi Kosta,
>>
>> On 13.02.2017 14:38, kostap@marvell.com wrote:
>>> From: Konstantin Porotchkin <kostap@marvell.com>
>>>
>>> Fix the default pin control values in a board-specific
>>> function on early board init stage.
>>> This fix allows the NETA driver to work in RGMII
>>> mode until the full-featured pin control driver gets
>>> introduced.
>>>
>>> Signed-off-by: Konstantin Porotchkin <kostap@marvell.com>
>>> Cc: Stefan Roese <sr@denx.de>
>>> Cc: Igal Liberman <igall@marvell.com>
>>> ---
>>>  board/Marvell/mvebu_db-88f3720/board.c | 26 +++++++++++++++++++++++++-
>>>  1 file changed, 25 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/board/Marvell/mvebu_db-88f3720/board.c
>>> b/board/Marvell/mvebu_db-88f3720/board.c
>>> index edf88c7..3337f3f 100644
>>> --- a/board/Marvell/mvebu_db-88f3720/board.c
>>> +++ b/board/Marvell/mvebu_db-88f3720/board.c
>>> @@ -19,9 +19,33 @@ DECLARE_GLOBAL_DATA_PTR;
>>>  #define I2C_IO_REG_0_SATA_OFF    2
>>>  #define I2C_IO_REG_0_USB_H_OFF    1
>>>
>>> +#define PINCTRL_NB_REG_VALUE    0x000173fa
>>> +#define PINCTRL_SB_REG_VALUE    0x00007a23
>>> +
>>
>> I am aware that this is a temporary solution, but are these values
>> correct for the A3720-DB or only the ESPRESSBin board?
> They are good for the DB board as well. Actually without this change the
> NETA driver will crash if we try to ping the server.

Okay. And do you have any ideas on when this pinctrl driver might be
available?

>>
>> BTW: You are now using the "Marvell/mvebu_db-88f3720" board directory
>> for multiple board and not only the A3720-DB. I would prefer to see
>> a rename of the board directory before this, like we've done to the
>> A7k/8k directory. What do you think?
> Agree, I can do it. Should we change it in this patch series or
> introduce an additional patch later?

We have no chance to get this patchset into this release, so we have
a bit of time for the next one. I would prefer a clean switch and
add this rename as one of the first patches in the next version of
this patchset.

Thanks,
Stefan
Kostya Porotchkin Feb. 14, 2017, 12:25 p.m. UTC | #4
On 2/14/2017 14:21, Stefan Roese wrote:
> On 14.02.2017 13:07, Konstantin Porotchkin wrote:
>> Hi, Stefan,
>>
>> On 2/14/2017 13:43, Stefan Roese wrote:
>>> Hi Kosta,
>>>
>>> On 13.02.2017 14:38, kostap@marvell.com wrote:
>>>> From: Konstantin Porotchkin <kostap@marvell.com>
>>>>
>>>> Fix the default pin control values in a board-specific
>>>> function on early board init stage.
>>>> This fix allows the NETA driver to work in RGMII
>>>> mode until the full-featured pin control driver gets
>>>> introduced.
>>>>
>>>> Signed-off-by: Konstantin Porotchkin <kostap@marvell.com>
>>>> Cc: Stefan Roese <sr@denx.de>
>>>> Cc: Igal Liberman <igall@marvell.com>
>>>> ---
>>>>  board/Marvell/mvebu_db-88f3720/board.c | 26 +++++++++++++++++++++++++-
>>>>  1 file changed, 25 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/board/Marvell/mvebu_db-88f3720/board.c
>>>> b/board/Marvell/mvebu_db-88f3720/board.c
>>>> index edf88c7..3337f3f 100644
>>>> --- a/board/Marvell/mvebu_db-88f3720/board.c
>>>> +++ b/board/Marvell/mvebu_db-88f3720/board.c
>>>> @@ -19,9 +19,33 @@ DECLARE_GLOBAL_DATA_PTR;
>>>>  #define I2C_IO_REG_0_SATA_OFF    2
>>>>  #define I2C_IO_REG_0_USB_H_OFF    1
>>>>
>>>> +#define PINCTRL_NB_REG_VALUE    0x000173fa
>>>> +#define PINCTRL_SB_REG_VALUE    0x00007a23
>>>> +
>>>
>>> I am aware that this is a temporary solution, but are these values
>>> correct for the A3720-DB or only the ESPRESSBin board?
>> They are good for the DB board as well. Actually without this change the
>> NETA driver will crash if we try to ping the server.
>
> Okay. And do you have any ideas on when this pinctrl driver might be
> available?
I will query our team that is responsible for A37xx features. I think 
they are currently working on SATA/SCSI issues discovered when moved to 
the new code base. Hope the pin control will be the next task, but I 
have to ensure it.

>
>>>
>>> BTW: You are now using the "Marvell/mvebu_db-88f3720" board directory
>>> for multiple board and not only the A3720-DB. I would prefer to see
>>> a rename of the board directory before this, like we've done to the
>>> A7k/8k directory. What do you think?
>> Agree, I can do it. Should we change it in this patch series or
>> introduce an additional patch later?
>
> We have no chance to get this patchset into this release, so we have
> a bit of time for the next one. I would prefer a clean switch and
> add this rename as one of the first patches in the next version of
> this patchset.
Ok, got you, I will work on this change.

>
> Thanks,
> Stefan
Kostya Porotchkin Feb. 15, 2017, 9:09 a.m. UTC | #5
On 02/14/2017 02:25 PM, Konstantin Porotchkin wrote:
>
>
> On 2/14/2017 14:21, Stefan Roese wrote:
>> On 14.02.2017 13:07, Konstantin Porotchkin wrote:
>>> Hi, Stefan,
>>>
>>> On 2/14/2017 13:43, Stefan Roese wrote:
>>>> Hi Kosta,
>>>>
>>>> On 13.02.2017 14:38, kostap@marvell.com wrote:
>>>>> From: Konstantin Porotchkin <kostap@marvell.com>
>>>>>
>>>>> Fix the default pin control values in a board-specific
>>>>> function on early board init stage.
>>>>> This fix allows the NETA driver to work in RGMII
>>>>> mode until the full-featured pin control driver gets
>>>>> introduced.
>>>>>
>>>>> Signed-off-by: Konstantin Porotchkin <kostap@marvell.com>
>>>>> Cc: Stefan Roese <sr@denx.de>
>>>>> Cc: Igal Liberman <igall@marvell.com>
>>>>> ---
>>>>>  board/Marvell/mvebu_db-88f3720/board.c | 26
>>>>> +++++++++++++++++++++++++-
>>>>>  1 file changed, 25 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/board/Marvell/mvebu_db-88f3720/board.c
>>>>> b/board/Marvell/mvebu_db-88f3720/board.c
>>>>> index edf88c7..3337f3f 100644
>>>>> --- a/board/Marvell/mvebu_db-88f3720/board.c
>>>>> +++ b/board/Marvell/mvebu_db-88f3720/board.c
>>>>> @@ -19,9 +19,33 @@ DECLARE_GLOBAL_DATA_PTR;
>>>>>  #define I2C_IO_REG_0_SATA_OFF    2
>>>>>  #define I2C_IO_REG_0_USB_H_OFF    1
>>>>>
>>>>> +#define PINCTRL_NB_REG_VALUE    0x000173fa
>>>>> +#define PINCTRL_SB_REG_VALUE    0x00007a23
>>>>> +
>>>>
>>>> I am aware that this is a temporary solution, but are these values
>>>> correct for the A3720-DB or only the ESPRESSBin board?
>>> They are good for the DB board as well. Actually without this change the
>>> NETA driver will crash if we try to ping the server.
>>
>> Okay. And do you have any ideas on when this pinctrl driver might be
>> available?
> I will query our team that is responsible for A37xx features. I think
> they are currently working on SATA/SCSI issues discovered when moved to
> the new code base. Hope the pin control will be the next task, but I
> have to ensure it.

Just got an update - the pin control driver task is scheduled to March.
>
>>
>>>>
>>>> BTW: You are now using the "Marvell/mvebu_db-88f3720" board directory
>>>> for multiple board and not only the A3720-DB. I would prefer to see
>>>> a rename of the board directory before this, like we've done to the
>>>> A7k/8k directory. What do you think?
>>> Agree, I can do it. Should we change it in this patch series or
>>> introduce an additional patch later?
>>
>> We have no chance to get this patchset into this release, so we have
>> a bit of time for the next one. I would prefer a clean switch and
>> add this rename as one of the first patches in the next version of
>> this patchset.
> Ok, got you, I will work on this change.
>
>>
>> Thanks,
>> Stefan
diff mbox

Patch

diff --git a/board/Marvell/mvebu_db-88f3720/board.c b/board/Marvell/mvebu_db-88f3720/board.c
index edf88c7..3337f3f 100644
--- a/board/Marvell/mvebu_db-88f3720/board.c
+++ b/board/Marvell/mvebu_db-88f3720/board.c
@@ -19,9 +19,33 @@  DECLARE_GLOBAL_DATA_PTR;
 #define I2C_IO_REG_0_SATA_OFF	2
 #define I2C_IO_REG_0_USB_H_OFF	1
 
+#define PINCTRL_NB_REG_VALUE	0x000173fa
+#define PINCTRL_SB_REG_VALUE	0x00007a23
+
 int board_early_init_f(void)
 {
-	/* Nothing to do (yet), perhaps later some pin-muxing etc */
+	const void *blob = gd->fdt_blob;
+	const char *bank_name;
+	const char *compat = "marvell,armada-3700-pinctl";
+	int off, len;
+	void __iomem *addr;
+
+	/* FIXME
+	 * Temporary WA for setting correct pin control values
+	 * until the real pin control driver is awailable.
+	 */
+	off = fdt_node_offset_by_compatible(blob, -1, compat);
+	while (off != -FDT_ERR_NOTFOUND) {
+		bank_name = fdt_getprop(blob, off, "bank-name", &len);
+		addr = (void __iomem *)fdtdec_get_addr_size_auto_noparent(
+				blob, off, "reg", 0, NULL, true);
+		if (!strncmp(bank_name, "armada-3700-nb", len))
+			writel(PINCTRL_NB_REG_VALUE, addr);
+		else if (!strncmp(bank_name, "armada-3700-sb", len))
+			writel(PINCTRL_SB_REG_VALUE, addr);
+
+		off = fdt_node_offset_by_compatible(blob, off, compat);
+	}
 
 	return 0;
 }