forked from Imagelibrary/rtems
bsp/aarch64/raspberrypi: Add genet support
- Add genet FDT support. Main reference: https://www.kernel.org/doc/Documentation/devicetree/bindings/net/brcm%2Cbcmgenet.yaml - Add genet mmu - Add raspberrypi4 nocache area
This commit is contained in:
79
bsps/aarch64/raspberrypi/fdt/bcm2711-rpi-4-b.dts
Normal file
79
bsps/aarch64/raspberrypi/fdt/bcm2711-rpi-4-b.dts
Normal file
@@ -0,0 +1,79 @@
|
||||
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @ingroup RTEMSBSPsAArch64Raspberrypi4
|
||||
*
|
||||
* @brief This file provides the base Raspberrypi4 device tree
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2024 Ning Yang
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
|
||||
/ {
|
||||
#address-cells = <2>;
|
||||
#size-cells = <1>;
|
||||
|
||||
amba@7c000000 {
|
||||
compatible = "simple-bus";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
ranges = <0x7c000000 0x00 0xfc000000 0x3800000>, <0x40000000 0x00 0xff800000 0x800000>;
|
||||
|
||||
interrupt-controller@40041000 {
|
||||
compatible = "arm,gic-400";
|
||||
#address-cells = <2>;
|
||||
#interrupt-cells = <3>;
|
||||
reg = <0x40041000 0x1000>, <0x40042000 0x2000>, <0x40044000 0x2000>, <0x40046000 0x2000>;
|
||||
interrupt-controller;
|
||||
phandle = <1>;
|
||||
};
|
||||
|
||||
ethernet@7d580000 {
|
||||
phy-mode = "rgmii-rxid";
|
||||
phy-handle = <&phy0>;
|
||||
compatible = "brcm,bcm2711-genet-v5";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
reg = <0x7d580000 0x10000>;
|
||||
interrupt-parent = <1>;
|
||||
interrupts = <0x0 0x9d 0x4> , <0x0 0x9e 0x4>;
|
||||
|
||||
mdio@e14 {
|
||||
compatible = "brcm,genet-mdio-v5";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
reg = <0xe14 0x8>;
|
||||
|
||||
phy0: ethernet-phy@1 {
|
||||
reg = <0x1>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
50
bsps/aarch64/raspberrypi/fdt/bsp_fdt.c
Normal file
50
bsps/aarch64/raspberrypi/fdt/bsp_fdt.c
Normal file
@@ -0,0 +1,50 @@
|
||||
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* @ingroup RTEMSBSPsAArch64Raspberrypi4
|
||||
*
|
||||
* @brief This source file contains the implementatin of bsp_fdt_get().
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2024 Ning Yang
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <bsp.h>
|
||||
#include <bsp/fdt.h>
|
||||
|
||||
const void *bsp_fdt_get(void)
|
||||
{
|
||||
return bcm2711_rpi_4_b_dtb;
|
||||
}
|
||||
|
||||
uint32_t bsp_fdt_map_intr(const uint32_t *intr, size_t icells)
|
||||
{
|
||||
if (icells != 3) {
|
||||
return 0;
|
||||
}
|
||||
return (intr[0] == 0 ? 32 : 16) + intr[1];
|
||||
}
|
||||
88
bsps/aarch64/raspberrypi/fdt/rpi4b_dtb.c
Normal file
88
bsps/aarch64/raspberrypi/fdt/rpi4b_dtb.c
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Declarations for C structure representing binary file bcm2711-rpi-4-b.dtb
|
||||
*
|
||||
* WARNING: Automatically generated -- do not edit!
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
const unsigned char bcm2711_rpi_4_b_dtb[] = {
|
||||
0xd0, 0x0d, 0xfe, 0xed, 0x00, 0x00, 0x03, 0x8b, 0x00, 0x00, 0x00, 0x38,
|
||||
0x00, 0x00, 0x02, 0xfc, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x11,
|
||||
0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f,
|
||||
0x00, 0x00, 0x02, 0xc4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03,
|
||||
0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x01, 0x61, 0x6d, 0x62, 0x61, 0x40, 0x37, 0x63, 0x30,
|
||||
0x30, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
|
||||
0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x1b, 0x73, 0x69, 0x6d, 0x70,
|
||||
0x6c, 0x65, 0x2d, 0x62, 0x75, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
|
||||
0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f,
|
||||
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x20,
|
||||
0x00, 0x00, 0x00, 0x26, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xfc, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xff, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x01, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x72, 0x75, 0x70,
|
||||
0x74, 0x2d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72,
|
||||
0x40, 0x34, 0x30, 0x30, 0x34, 0x31, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x1b,
|
||||
0x61, 0x72, 0x6d, 0x2c, 0x67, 0x69, 0x63, 0x2d, 0x34, 0x30, 0x30, 0x00,
|
||||
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04,
|
||||
0x00, 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03,
|
||||
0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x3e, 0x40, 0x04, 0x10, 0x00,
|
||||
0x00, 0x00, 0x10, 0x00, 0x40, 0x04, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00,
|
||||
0x40, 0x04, 0x40, 0x00, 0x00, 0x00, 0x20, 0x00, 0x40, 0x04, 0x60, 0x00,
|
||||
0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04,
|
||||
0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02,
|
||||
0x00, 0x00, 0x00, 0x01, 0x65, 0x74, 0x68, 0x65, 0x72, 0x6e, 0x65, 0x74,
|
||||
0x40, 0x37, 0x64, 0x35, 0x38, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x5f,
|
||||
0x72, 0x67, 0x6d, 0x69, 0x69, 0x2d, 0x72, 0x78, 0x69, 0x64, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x68,
|
||||
0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x16,
|
||||
0x00, 0x00, 0x00, 0x1b, 0x62, 0x72, 0x63, 0x6d, 0x2c, 0x62, 0x63, 0x6d,
|
||||
0x32, 0x37, 0x31, 0x31, 0x2d, 0x67, 0x65, 0x6e, 0x65, 0x74, 0x2d, 0x76,
|
||||
0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03,
|
||||
0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3e,
|
||||
0x7d, 0x58, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
|
||||
0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x73, 0x00, 0x00, 0x00, 0x01,
|
||||
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x84,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x04,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, 0x00, 0x00, 0x00, 0x04,
|
||||
0x00, 0x00, 0x00, 0x01, 0x6d, 0x64, 0x69, 0x6f, 0x40, 0x65, 0x31, 0x34,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13,
|
||||
0x00, 0x00, 0x00, 0x1b, 0x62, 0x72, 0x63, 0x6d, 0x2c, 0x67, 0x65, 0x6e,
|
||||
0x65, 0x74, 0x2d, 0x6d, 0x64, 0x69, 0x6f, 0x2d, 0x76, 0x35, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04,
|
||||
0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
|
||||
0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x0e, 0x14,
|
||||
0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x65, 0x74, 0x68, 0x65,
|
||||
0x72, 0x6e, 0x65, 0x74, 0x2d, 0x70, 0x68, 0x79, 0x40, 0x31, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x3e,
|
||||
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04,
|
||||
0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02,
|
||||
0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02,
|
||||
0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x09, 0x23, 0x61, 0x64, 0x64,
|
||||
0x72, 0x65, 0x73, 0x73, 0x2d, 0x63, 0x65, 0x6c, 0x6c, 0x73, 0x00, 0x23,
|
||||
0x73, 0x69, 0x7a, 0x65, 0x2d, 0x63, 0x65, 0x6c, 0x6c, 0x73, 0x00, 0x63,
|
||||
0x6f, 0x6d, 0x70, 0x61, 0x74, 0x69, 0x62, 0x6c, 0x65, 0x00, 0x72, 0x61,
|
||||
0x6e, 0x67, 0x65, 0x73, 0x00, 0x23, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x72,
|
||||
0x75, 0x70, 0x74, 0x2d, 0x63, 0x65, 0x6c, 0x6c, 0x73, 0x00, 0x72, 0x65,
|
||||
0x67, 0x00, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x72, 0x75, 0x70, 0x74, 0x2d,
|
||||
0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x00, 0x70,
|
||||
0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x00, 0x70, 0x68, 0x79, 0x2d, 0x6d,
|
||||
0x6f, 0x64, 0x65, 0x00, 0x70, 0x68, 0x79, 0x2d, 0x68, 0x61, 0x6e, 0x64,
|
||||
0x6c, 0x65, 0x00, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x72, 0x75, 0x70, 0x74,
|
||||
0x2d, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x00, 0x69, 0x6e, 0x74, 0x65,
|
||||
0x72, 0x72, 0x75, 0x70, 0x74, 0x73, 0x00,
|
||||
};
|
||||
|
||||
const size_t bcm2711_rpi_4_b_dtb_size = sizeof(bcm2711_rpi_4_b_dtb);
|
||||
@@ -59,6 +59,10 @@ BSP_START_TEXT_SECTION void raspberrypi_4_setup_mmu_and_cache(void);
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define BSP_FDT_IS_SUPPORTED
|
||||
extern const unsigned char bcm2711_rpi_4_b_dtb[];
|
||||
extern const size_t bcm2711_rpi_4_b_dtb_size;
|
||||
|
||||
#define BSP_ARM_GIC_CPUIF_BASE 0xFF842000
|
||||
#define BSP_ARM_GIC_DIST_BASE 0xFF841000
|
||||
|
||||
|
||||
@@ -61,6 +61,12 @@ raspberrypi_4_mmu_config_table[] = {
|
||||
.begin = 0xFF800000U,
|
||||
.end = 0xFFA00000U,
|
||||
.flags = AARCH64_MMU_DEVICE
|
||||
},
|
||||
|
||||
{ /* RPI genet address */
|
||||
.begin = (unsigned)0xFD580000,
|
||||
.end = (unsigned)0xFD580000 + (unsigned)0x10000,
|
||||
.flags = AARCH64_MMU_DEVICE
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -64,6 +64,8 @@ links:
|
||||
- role: build-dependency
|
||||
uid: objwatchdog
|
||||
source:
|
||||
- bsps/aarch64/raspberrypi/fdt/bsp_fdt.c
|
||||
- bsps/aarch64/raspberrypi/fdt/rpi4b_dtb.c
|
||||
- bsps/aarch64/raspberrypi/start/bspstart.c
|
||||
- bsps/aarch64/raspberrypi/start/bspstarthooks.c
|
||||
- bsps/aarch64/raspberrypi/start/bspstartmmu.c
|
||||
|
||||
@@ -30,7 +30,8 @@ content: |
|
||||
|
||||
MEMORY {
|
||||
RAM_MMU : ORIGIN = 0x0, LENGTH = (0x1000 * ${AARCH64_MMU_TRANSLATION_TABLE_PAGES})
|
||||
RAM : ORIGIN = 0x80000, LENGTH = 1024M
|
||||
RAM : ORIGIN = 0x80000, LENGTH = 1024M - 0x80000 - 16M
|
||||
RAM_NOCACHE : ORIGIN = 0x40000000 - 16M, LENGTH = 16M
|
||||
}
|
||||
|
||||
REGION_ALIAS ("REGION_START", RAM);
|
||||
@@ -48,8 +49,8 @@ content: |
|
||||
REGION_ALIAS ("REGION_BSS", RAM);
|
||||
REGION_ALIAS ("REGION_WORK", RAM);
|
||||
REGION_ALIAS ("REGION_STACK", RAM);
|
||||
REGION_ALIAS ("REGION_NOCACHE", RAM);
|
||||
REGION_ALIAS ("REGION_NOCACHE_LOAD", RAM);
|
||||
REGION_ALIAS ("REGION_NOCACHE", RAM_NOCACHE);
|
||||
REGION_ALIAS ("REGION_NOCACHE_LOAD", RAM_NOCACHE);
|
||||
|
||||
bsp_stack_abt_size = DEFINED (bsp_stack_abt_size) ? bsp_stack_abt_size : 1024;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user