diff mbox series

ARM: amlogic: add JetHub D1 eth mac generation with manufacturer OUI

Message ID 20211029070820.3607994-1-adeep@lexina.in
State Deferred
Delegated to: Tom Rini
Headers show
Series ARM: amlogic: add JetHub D1 eth mac generation with manufacturer OUI | expand

Commit Message

Viacheslav Oct. 29, 2021, 7:08 a.m. UTC
JetHome has own MAC OUI. Add jethub-j100 board file. Update config.

Signed-off-by: Vyacheslav Bocharov <adeep@lexina.in>
---
 board/amlogic/jethub-j100/MAINTAINERS   |  8 +++++
 board/amlogic/jethub-j100/Makefile      |  6 ++++
 board/amlogic/jethub-j100/jethub-j100.c | 41 +++++++++++++++++++++++++
 board/amlogic/jethub-j80/MAINTAINERS    |  3 +-
 configs/jethub_j100_defconfig           |  1 +
 5 files changed, 57 insertions(+), 2 deletions(-)
 create mode 100644 board/amlogic/jethub-j100/MAINTAINERS
 create mode 100644 board/amlogic/jethub-j100/Makefile
 create mode 100644 board/amlogic/jethub-j100/jethub-j100.c

Comments

Neil Armstrong Oct. 29, 2021, 12:08 p.m. UTC | #1
On 29/10/2021 09:08, Vyacheslav Bocharov wrote:
> JetHome has own MAC OUI. Add jethub-j100 board file. Update config.
> 
> Signed-off-by: Vyacheslav Bocharov <adeep@lexina.in>
> ---
>  board/amlogic/jethub-j100/MAINTAINERS   |  8 +++++
>  board/amlogic/jethub-j100/Makefile      |  6 ++++
>  board/amlogic/jethub-j100/jethub-j100.c | 41 +++++++++++++++++++++++++
>  board/amlogic/jethub-j80/MAINTAINERS    |  3 +-
>  configs/jethub_j100_defconfig           |  1 +
>  5 files changed, 57 insertions(+), 2 deletions(-)
>  create mode 100644 board/amlogic/jethub-j100/MAINTAINERS
>  create mode 100644 board/amlogic/jethub-j100/Makefile
>  create mode 100644 board/amlogic/jethub-j100/jethub-j100.c
> 
> diff --git a/board/amlogic/jethub-j100/MAINTAINERS b/board/amlogic/jethub-j100/MAINTAINERS
> new file mode 100644
> index 0000000000..43f6a5fc86
> --- /dev/null
> +++ b/board/amlogic/jethub-j100/MAINTAINERS
> @@ -0,0 +1,8 @@
> +JetHome JetHub
> +M:	Vyacheslav Bocharov <adeep@lexina.in>
> +S:	Maintained
> +L:	u-boot-amlogic@groups.io
> +F:	board/amlogic/jethub-j100/
> +F:	configs/jethub_j100_defconfig
> +F:	doc/board/amlogic/jethub-j100.rst
> +F:	include/configs/jethub.h
> diff --git a/board/amlogic/jethub-j100/Makefile b/board/amlogic/jethub-j100/Makefile
> new file mode 100644
> index 0000000000..4d935af984
> --- /dev/null
> +++ b/board/amlogic/jethub-j100/Makefile
> @@ -0,0 +1,6 @@
> +# SPDX-License-Identifier: GPL-2.0+
> +#
> +# (C) Copyright 2021 Vyacheslav Bocharov
> +# Author: Vyacheslav Bocharov <adeep@lexina.in>
> +
> +obj-y	:= jethub-j100.o
> diff --git a/board/amlogic/jethub-j100/jethub-j100.c b/board/amlogic/jethub-j100/jethub-j100.c
> new file mode 100644
> index 0000000000..575bb31573
> --- /dev/null
> +++ b/board/amlogic/jethub-j100/jethub-j100.c
> @@ -0,0 +1,41 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +/*
> + * Copyright (C) 2021 Vyacheslav Bocharov
> + * Author: Vyacheslav Bocharov <adeep@lexina.in>
> + */
> +
> +#include <common.h>
> +#include <dm.h>
> +#include <init.h>
> +#include <net.h>
> +#include <asm/io.h>
> +#include <asm/arch/axg.h>
> +#include <asm/arch/sm.h>
> +#include <asm/arch/eth.h>
> +#include <asm/arch/mem.h>
> +
> +int misc_init_r(void)
> +{
> +	u8 mac_addr[ARP_HLEN];
> +	char serial[SM_SERIAL_SIZE];
> +	u32 sid;
> +
> +	if (!meson_sm_get_serial(serial, SM_SERIAL_SIZE)) {
> +		sid = crc32(0, (unsigned char *)serial, SM_SERIAL_SIZE);
> +		/* Ensure the NIC specific bytes of the mac are not all 0 */
> +		if ((sid & 0xffff) == 0)
> +			sid |= 0x800000;
> +
> +		/* OUI registered MAC address */
> +		mac_addr[0] = 0x10;
> +		mac_addr[1] = 0x27;
> +		mac_addr[2] = 0xBE;
> +		mac_addr[3] = (sid >> 16) & 0xff;
> +		mac_addr[4] = (sid >>  8) & 0xff;
> +		mac_addr[5] = (sid >>  0) & 0xff;
> +
> +		eth_env_set_enetaddr("ethaddr", mac_addr);
> +	}
> +
> +	return 0;
> +}
> diff --git a/board/amlogic/jethub-j80/MAINTAINERS b/board/amlogic/jethub-j80/MAINTAINERS
> index 459e9f89da..a899153117 100644
> --- a/board/amlogic/jethub-j80/MAINTAINERS
> +++ b/board/amlogic/jethub-j80/MAINTAINERS
> @@ -4,6 +4,5 @@ S:	Maintained
>  L:	u-boot-amlogic@groups.io
>  F:	board/amlogic/jethub-j80/
>  F:	configs/jethub_j80_defconfig
> -F:	configs/jethub_j100_defconfig
>  F:	doc/board/amlogic/jethub-j80.rst
> -F:	doc/board/amlogic/jethub-j100.rst
> +F:	include/configs/jethub.h
> diff --git a/configs/jethub_j100_defconfig b/configs/jethub_j100_defconfig
> index 290ce4db85..ad026a89e0 100644
> --- a/configs/jethub_j100_defconfig
> +++ b/configs/jethub_j100_defconfig
> @@ -1,4 +1,5 @@
>  CONFIG_ARM=y
> +CONFIG_SYS_BOARD="jethub-j100"
>  CONFIG_SYS_CONFIG_NAME="jethub"
>  CONFIG_ARCH_MESON=y
>  CONFIG_SYS_TEXT_BASE=0x01000000
> 

Applied to u-boot-amlogic

I will probably send it next week along `add sm efuse write support and cmd for read/write efuse`

Thanks,
Neil
Viacheslav Oct. 29, 2021, 12:21 p.m. UTC | #2
Thanks.

29.10.2021 15:08, Neil Armstrong пишет:
> On 29/10/2021 09:08, Vyacheslav Bocharov wrote:
>> JetHome has own MAC OUI. Add jethub-j100 board file. Update config.
>>
>> Signed-off-by: Vyacheslav Bocharov <adeep@lexina.in>
>> ---
>>   board/amlogic/jethub-j100/MAINTAINERS   |  8 +++++
>>   board/amlogic/jethub-j100/Makefile      |  6 ++++
>>   board/amlogic/jethub-j100/jethub-j100.c | 41 +++++++++++++++++++++++++
>>   board/amlogic/jethub-j80/MAINTAINERS    |  3 +-
>>   configs/jethub_j100_defconfig           |  1 +
>>   5 files changed, 57 insertions(+), 2 deletions(-)
>>   create mode 100644 board/amlogic/jethub-j100/MAINTAINERS
>>   create mode 100644 board/amlogic/jethub-j100/Makefile
>>   create mode 100644 board/amlogic/jethub-j100/jethub-j100.c
>>
>> diff --git a/board/amlogic/jethub-j100/MAINTAINERS b/board/amlogic/jethub-j100/MAINTAINERS
>> new file mode 100644
>> index 0000000000..43f6a5fc86
>> --- /dev/null
>> +++ b/board/amlogic/jethub-j100/MAINTAINERS
>> @@ -0,0 +1,8 @@
>> +JetHome JetHub
>> +M:	Vyacheslav Bocharov <adeep@lexina.in>
>> +S:	Maintained
>> +L:	u-boot-amlogic@groups.io
>> +F:	board/amlogic/jethub-j100/
>> +F:	configs/jethub_j100_defconfig
>> +F:	doc/board/amlogic/jethub-j100.rst
>> +F:	include/configs/jethub.h
>> diff --git a/board/amlogic/jethub-j100/Makefile b/board/amlogic/jethub-j100/Makefile
>> new file mode 100644
>> index 0000000000..4d935af984
>> --- /dev/null
>> +++ b/board/amlogic/jethub-j100/Makefile
>> @@ -0,0 +1,6 @@
>> +# SPDX-License-Identifier: GPL-2.0+
>> +#
>> +# (C) Copyright 2021 Vyacheslav Bocharov
>> +# Author: Vyacheslav Bocharov <adeep@lexina.in>
>> +
>> +obj-y	:= jethub-j100.o
>> diff --git a/board/amlogic/jethub-j100/jethub-j100.c b/board/amlogic/jethub-j100/jethub-j100.c
>> new file mode 100644
>> index 0000000000..575bb31573
>> --- /dev/null
>> +++ b/board/amlogic/jethub-j100/jethub-j100.c
>> @@ -0,0 +1,41 @@
>> +// SPDX-License-Identifier: GPL-2.0+
>> +/*
>> + * Copyright (C) 2021 Vyacheslav Bocharov
>> + * Author: Vyacheslav Bocharov <adeep@lexina.in>
>> + */
>> +
>> +#include <common.h>
>> +#include <dm.h>
>> +#include <init.h>
>> +#include <net.h>
>> +#include <asm/io.h>
>> +#include <asm/arch/axg.h>
>> +#include <asm/arch/sm.h>
>> +#include <asm/arch/eth.h>
>> +#include <asm/arch/mem.h>
>> +
>> +int misc_init_r(void)
>> +{
>> +	u8 mac_addr[ARP_HLEN];
>> +	char serial[SM_SERIAL_SIZE];
>> +	u32 sid;
>> +
>> +	if (!meson_sm_get_serial(serial, SM_SERIAL_SIZE)) {
>> +		sid = crc32(0, (unsigned char *)serial, SM_SERIAL_SIZE);
>> +		/* Ensure the NIC specific bytes of the mac are not all 0 */
>> +		if ((sid & 0xffff) == 0)
>> +			sid |= 0x800000;
>> +
>> +		/* OUI registered MAC address */
>> +		mac_addr[0] = 0x10;
>> +		mac_addr[1] = 0x27;
>> +		mac_addr[2] = 0xBE;
>> +		mac_addr[3] = (sid >> 16) & 0xff;
>> +		mac_addr[4] = (sid >>  8) & 0xff;
>> +		mac_addr[5] = (sid >>  0) & 0xff;
>> +
>> +		eth_env_set_enetaddr("ethaddr", mac_addr);
>> +	}
>> +
>> +	return 0;
>> +}
>> diff --git a/board/amlogic/jethub-j80/MAINTAINERS b/board/amlogic/jethub-j80/MAINTAINERS
>> index 459e9f89da..a899153117 100644
>> --- a/board/amlogic/jethub-j80/MAINTAINERS
>> +++ b/board/amlogic/jethub-j80/MAINTAINERS
>> @@ -4,6 +4,5 @@ S:	Maintained
>>   L:	u-boot-amlogic@groups.io
>>   F:	board/amlogic/jethub-j80/
>>   F:	configs/jethub_j80_defconfig
>> -F:	configs/jethub_j100_defconfig
>>   F:	doc/board/amlogic/jethub-j80.rst
>> -F:	doc/board/amlogic/jethub-j100.rst
>> +F:	include/configs/jethub.h
>> diff --git a/configs/jethub_j100_defconfig b/configs/jethub_j100_defconfig
>> index 290ce4db85..ad026a89e0 100644
>> --- a/configs/jethub_j100_defconfig
>> +++ b/configs/jethub_j100_defconfig
>> @@ -1,4 +1,5 @@
>>   CONFIG_ARM=y
>> +CONFIG_SYS_BOARD="jethub-j100"
>>   CONFIG_SYS_CONFIG_NAME="jethub"
>>   CONFIG_ARCH_MESON=y
>>   CONFIG_SYS_TEXT_BASE=0x01000000
>>
> 
> Applied to u-boot-amlogic
> 
> I will probably send it next week along `add sm efuse write support and cmd for read/write efuse`
> 
> Thanks,
> Neil
Neil Armstrong Oct. 29, 2021, 1:53 p.m. UTC | #3
Hi,

Ci fails with :

+board/amlogic/jethub-j100/jethub-j100.c: In function 'misc_init_r':
1516+board/amlogic/jethub-j100/jethub-j100.c:24:23: error: implicit declaration of function 'crc32' [-Werror=implicit-function-declaration]
1517+   24 |                 sid = crc32(0, (unsigned char *)serial, SM_SERIAL_SIZE);
1518+      |

Can you send a fix I can squash on the commit ?

Neil

On 29/10/2021 14:21, Vyacheslav wrote:
> Thanks.
> 
> 29.10.2021 15:08, Neil Armstrong пишет:
>> On 29/10/2021 09:08, Vyacheslav Bocharov wrote:
>>> JetHome has own MAC OUI. Add jethub-j100 board file. Update config.
>>>
>>> Signed-off-by: Vyacheslav Bocharov <adeep@lexina.in>
>>> ---
>>>   board/amlogic/jethub-j100/MAINTAINERS   |  8 +++++
>>>   board/amlogic/jethub-j100/Makefile      |  6 ++++
>>>   board/amlogic/jethub-j100/jethub-j100.c | 41 +++++++++++++++++++++++++
>>>   board/amlogic/jethub-j80/MAINTAINERS    |  3 +-
>>>   configs/jethub_j100_defconfig           |  1 +
>>>   5 files changed, 57 insertions(+), 2 deletions(-)
>>>   create mode 100644 board/amlogic/jethub-j100/MAINTAINERS
>>>   create mode 100644 board/amlogic/jethub-j100/Makefile
>>>   create mode 100644 board/amlogic/jethub-j100/jethub-j100.c
>>>
>>> diff --git a/board/amlogic/jethub-j100/MAINTAINERS b/board/amlogic/jethub-j100/MAINTAINERS
>>> new file mode 100644
>>> index 0000000000..43f6a5fc86
>>> --- /dev/null
>>> +++ b/board/amlogic/jethub-j100/MAINTAINERS
>>> @@ -0,0 +1,8 @@
>>> +JetHome JetHub
>>> +M:    Vyacheslav Bocharov <adeep@lexina.in>
>>> +S:    Maintained
>>> +L:    u-boot-amlogic@groups.io
>>> +F:    board/amlogic/jethub-j100/
>>> +F:    configs/jethub_j100_defconfig
>>> +F:    doc/board/amlogic/jethub-j100.rst
>>> +F:    include/configs/jethub.h
>>> diff --git a/board/amlogic/jethub-j100/Makefile b/board/amlogic/jethub-j100/Makefile
>>> new file mode 100644
>>> index 0000000000..4d935af984
>>> --- /dev/null
>>> +++ b/board/amlogic/jethub-j100/Makefile
>>> @@ -0,0 +1,6 @@
>>> +# SPDX-License-Identifier: GPL-2.0+
>>> +#
>>> +# (C) Copyright 2021 Vyacheslav Bocharov
>>> +# Author: Vyacheslav Bocharov <adeep@lexina.in>
>>> +
>>> +obj-y    := jethub-j100.o
>>> diff --git a/board/amlogic/jethub-j100/jethub-j100.c b/board/amlogic/jethub-j100/jethub-j100.c
>>> new file mode 100644
>>> index 0000000000..575bb31573
>>> --- /dev/null
>>> +++ b/board/amlogic/jethub-j100/jethub-j100.c
>>> @@ -0,0 +1,41 @@
>>> +// SPDX-License-Identifier: GPL-2.0+
>>> +/*
>>> + * Copyright (C) 2021 Vyacheslav Bocharov
>>> + * Author: Vyacheslav Bocharov <adeep@lexina.in>
>>> + */
>>> +
>>> +#include <common.h>
>>> +#include <dm.h>
>>> +#include <init.h>
>>> +#include <net.h>
>>> +#include <asm/io.h>
>>> +#include <asm/arch/axg.h>
>>> +#include <asm/arch/sm.h>
>>> +#include <asm/arch/eth.h>
>>> +#include <asm/arch/mem.h>
>>> +
>>> +int misc_init_r(void)
>>> +{
>>> +    u8 mac_addr[ARP_HLEN];
>>> +    char serial[SM_SERIAL_SIZE];
>>> +    u32 sid;
>>> +
>>> +    if (!meson_sm_get_serial(serial, SM_SERIAL_SIZE)) {
>>> +        sid = crc32(0, (unsigned char *)serial, SM_SERIAL_SIZE);
>>> +        /* Ensure the NIC specific bytes of the mac are not all 0 */
>>> +        if ((sid & 0xffff) == 0)
>>> +            sid |= 0x800000;
>>> +
>>> +        /* OUI registered MAC address */
>>> +        mac_addr[0] = 0x10;
>>> +        mac_addr[1] = 0x27;
>>> +        mac_addr[2] = 0xBE;
>>> +        mac_addr[3] = (sid >> 16) & 0xff;
>>> +        mac_addr[4] = (sid >>  8) & 0xff;
>>> +        mac_addr[5] = (sid >>  0) & 0xff;
>>> +
>>> +        eth_env_set_enetaddr("ethaddr", mac_addr);
>>> +    }
>>> +
>>> +    return 0;
>>> +}
>>> diff --git a/board/amlogic/jethub-j80/MAINTAINERS b/board/amlogic/jethub-j80/MAINTAINERS
>>> index 459e9f89da..a899153117 100644
>>> --- a/board/amlogic/jethub-j80/MAINTAINERS
>>> +++ b/board/amlogic/jethub-j80/MAINTAINERS
>>> @@ -4,6 +4,5 @@ S:    Maintained
>>>   L:    u-boot-amlogic@groups.io
>>>   F:    board/amlogic/jethub-j80/
>>>   F:    configs/jethub_j80_defconfig
>>> -F:    configs/jethub_j100_defconfig
>>>   F:    doc/board/amlogic/jethub-j80.rst
>>> -F:    doc/board/amlogic/jethub-j100.rst
>>> +F:    include/configs/jethub.h
>>> diff --git a/configs/jethub_j100_defconfig b/configs/jethub_j100_defconfig
>>> index 290ce4db85..ad026a89e0 100644
>>> --- a/configs/jethub_j100_defconfig
>>> +++ b/configs/jethub_j100_defconfig
>>> @@ -1,4 +1,5 @@
>>>   CONFIG_ARM=y
>>> +CONFIG_SYS_BOARD="jethub-j100"
>>>   CONFIG_SYS_CONFIG_NAME="jethub"
>>>   CONFIG_ARCH_MESON=y
>>>   CONFIG_SYS_TEXT_BASE=0x01000000
>>>
>>
>> Applied to u-boot-amlogic
>>
>> I will probably send it next week along `add sm efuse write support and cmd for read/write efuse`
>>
>> Thanks,
>> Neil
Viacheslav Oct. 29, 2021, 2:49 p.m. UTC | #4
Fix build warning in misc_init_r jethub-j100.c

Signed-off-by: Vyacheslav Bocharov <adeep@lexina.in>

---
  board/amlogic/jethub-j100/jethub-j100.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/board/amlogic/jethub-j100/jethub-j100.c 
b/board/amlogic/jethub-j100/jethub-j100.c
index 575bb31573..6a2c4ad4c3 100644
--- a/board/amlogic/jethub-j100/jethub-j100.c
+++ b/board/amlogic/jethub-j100/jethub-j100.c
@@ -13,6 +13,7 @@
  #include <asm/arch/sm.h>
  #include <asm/arch/eth.h>
  #include <asm/arch/mem.h>
+#include <u-boot/crc.h>

  int misc_init_r(void)
  {
--
2.30.2
Neil Armstrong Oct. 29, 2021, 5:16 p.m. UTC | #5
On 29/10/2021 16:49, Vyacheslav wrote:
> #include <u-boot/crc.h>

Thanks,
Applied & squashed !

Neil
diff mbox series

Patch

diff --git a/board/amlogic/jethub-j100/MAINTAINERS b/board/amlogic/jethub-j100/MAINTAINERS
new file mode 100644
index 0000000000..43f6a5fc86
--- /dev/null
+++ b/board/amlogic/jethub-j100/MAINTAINERS
@@ -0,0 +1,8 @@ 
+JetHome JetHub
+M:	Vyacheslav Bocharov <adeep@lexina.in>
+S:	Maintained
+L:	u-boot-amlogic@groups.io
+F:	board/amlogic/jethub-j100/
+F:	configs/jethub_j100_defconfig
+F:	doc/board/amlogic/jethub-j100.rst
+F:	include/configs/jethub.h
diff --git a/board/amlogic/jethub-j100/Makefile b/board/amlogic/jethub-j100/Makefile
new file mode 100644
index 0000000000..4d935af984
--- /dev/null
+++ b/board/amlogic/jethub-j100/Makefile
@@ -0,0 +1,6 @@ 
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2021 Vyacheslav Bocharov
+# Author: Vyacheslav Bocharov <adeep@lexina.in>
+
+obj-y	:= jethub-j100.o
diff --git a/board/amlogic/jethub-j100/jethub-j100.c b/board/amlogic/jethub-j100/jethub-j100.c
new file mode 100644
index 0000000000..575bb31573
--- /dev/null
+++ b/board/amlogic/jethub-j100/jethub-j100.c
@@ -0,0 +1,41 @@ 
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2021 Vyacheslav Bocharov
+ * Author: Vyacheslav Bocharov <adeep@lexina.in>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <init.h>
+#include <net.h>
+#include <asm/io.h>
+#include <asm/arch/axg.h>
+#include <asm/arch/sm.h>
+#include <asm/arch/eth.h>
+#include <asm/arch/mem.h>
+
+int misc_init_r(void)
+{
+	u8 mac_addr[ARP_HLEN];
+	char serial[SM_SERIAL_SIZE];
+	u32 sid;
+
+	if (!meson_sm_get_serial(serial, SM_SERIAL_SIZE)) {
+		sid = crc32(0, (unsigned char *)serial, SM_SERIAL_SIZE);
+		/* Ensure the NIC specific bytes of the mac are not all 0 */
+		if ((sid & 0xffff) == 0)
+			sid |= 0x800000;
+
+		/* OUI registered MAC address */
+		mac_addr[0] = 0x10;
+		mac_addr[1] = 0x27;
+		mac_addr[2] = 0xBE;
+		mac_addr[3] = (sid >> 16) & 0xff;
+		mac_addr[4] = (sid >>  8) & 0xff;
+		mac_addr[5] = (sid >>  0) & 0xff;
+
+		eth_env_set_enetaddr("ethaddr", mac_addr);
+	}
+
+	return 0;
+}
diff --git a/board/amlogic/jethub-j80/MAINTAINERS b/board/amlogic/jethub-j80/MAINTAINERS
index 459e9f89da..a899153117 100644
--- a/board/amlogic/jethub-j80/MAINTAINERS
+++ b/board/amlogic/jethub-j80/MAINTAINERS
@@ -4,6 +4,5 @@  S:	Maintained
 L:	u-boot-amlogic@groups.io
 F:	board/amlogic/jethub-j80/
 F:	configs/jethub_j80_defconfig
-F:	configs/jethub_j100_defconfig
 F:	doc/board/amlogic/jethub-j80.rst
-F:	doc/board/amlogic/jethub-j100.rst
+F:	include/configs/jethub.h
diff --git a/configs/jethub_j100_defconfig b/configs/jethub_j100_defconfig
index 290ce4db85..ad026a89e0 100644
--- a/configs/jethub_j100_defconfig
+++ b/configs/jethub_j100_defconfig
@@ -1,4 +1,5 @@ 
 CONFIG_ARM=y
+CONFIG_SYS_BOARD="jethub-j100"
 CONFIG_SYS_CONFIG_NAME="jethub"
 CONFIG_ARCH_MESON=y
 CONFIG_SYS_TEXT_BASE=0x01000000