| From 2ddd34b6838e836cf94a9da2f65cd01a21252846 Mon Sep 17 00:00:00 2001 |
| From: Emekcan Aras <emekcan.aras@arm.com> |
| Date: Wed, 15 Nov 2023 16:04:06 +0000 |
| Subject: [PATCH] corstone1000: enable virtio-net support |
| |
| Adds virtio-net support in corstone1000-fvp. |
| |
| Signed-off-by: Emekcan Aras <emekcan.aras@arm.com> |
| Upstream-Status: Pending [Not submitted to upstream yet] |
| --- |
| arch/arm/dts/corstone1000-fvp.dts | 6 ++++++ |
| board/armltd/corstone1000/corstone1000.c | 24 +++++++++++++++++++++++- |
| configs/corstone1000_defconfig | 2 ++ |
| 3 files changed, 31 insertions(+), 1 deletion(-) |
| |
| diff --git a/arch/arm/dts/corstone1000-fvp.dts b/arch/arm/dts/corstone1000-fvp.dts |
| index 26b0f1b3ce..8e54a40113 100644 |
| --- a/arch/arm/dts/corstone1000-fvp.dts |
| +++ b/arch/arm/dts/corstone1000-fvp.dts |
| @@ -21,6 +21,12 @@ |
| reg-io-width = <2>; |
| }; |
| |
| + virtio: virtio-net@40400000 { |
| + compatible = "virtio,mmio"; |
| + reg = <0x40400000 0x10000>; |
| + interrupts = <145>; |
| + }; |
| + |
| vmmc_v3_3d: fixed_v3_3d { |
| compatible = "regulator-fixed"; |
| regulator-name = "vmmc_supply"; |
| diff --git a/board/armltd/corstone1000/corstone1000.c b/board/armltd/corstone1000/corstone1000.c |
| index e3c0e5bf50..ef74dc9032 100644 |
| --- a/board/armltd/corstone1000/corstone1000.c |
| +++ b/board/armltd/corstone1000/corstone1000.c |
| @@ -18,6 +18,7 @@ |
| #include <dm/platform_data/serial_pl01x.h> |
| #include <asm/armv8/mmu.h> |
| #include <asm/global_data.h> |
| +#include <generated/dt.h> |
| |
| /* remove the DT nodes not needed in Linux */ |
| DT_NON_COMPLIANT_PURGE_LIST(foo) = { |
| @@ -101,6 +102,14 @@ static struct mm_region corstone1000_mem_map[] = { |
| .size = 0x80000000UL, |
| .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | |
| PTE_BLOCK_INNER_SHARE |
| + }, { |
| + /* ethernet */ |
| + .virt = 0x40400000UL, |
| + .phys = 0x40400000UL, |
| + .size = 0x00100000UL, |
| + .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | |
| + PTE_BLOCK_NON_SHARE | |
| + PTE_BLOCK_PXN | PTE_BLOCK_UXN |
| }, { |
| /* List terminator */ |
| 0, |
| @@ -150,10 +159,23 @@ void fwu_plat_get_bootidx(uint *boot_idx) |
| int board_late_init(void) |
| { |
| struct disk_partition part_info; |
| - struct udevice *dev, *bdev; |
| + struct udevice *dev, *bdev,*virtio_bus, *virtio_child;; |
| struct nvmxip_plat *plat; |
| struct blk_desc *desc; |
| int ret; |
| + const char *cmp_dtb = DEVICE_TREE; |
| + |
| + if (!strcmp(cmp_dtb, "corstone1000-fvp")) { |
| + ret = uclass_first_device_err(UCLASS_VIRTIO, &virtio_bus); |
| + if (!virtio_bus){ |
| + log_err("Cannot find virtio device\n"); |
| + return ret; |
| + } |
| + while (virtio_bus) { |
| + device_foreach_child_probe(virtio_child, virtio_bus); |
| + uclass_next_device(&virtio_bus); |
| + } |
| + } |
| |
| ret = uclass_first_device_err(UCLASS_NVMXIP, &dev); |
| if (ret < 0) { |
| diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig |
| index 2de3f5d7b3..8770b474e2 100644 |
| --- a/configs/corstone1000_defconfig |
| +++ b/configs/corstone1000_defconfig |
| @@ -78,3 +78,5 @@ CONFIG_DM_GPIO=y |
| CONFIG_SYSRESET_PSCI=y |
| CONFIG_EFI_SET_TIME=y |
| CONFIG_EFI_GET_TIME=y |
| +CONFIG_VIRTIO_NET=y |
| +CONFIG_VIRTIO_MMIO=y |
| -- |
| 2.25.1 |
| |