mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2025-12-10 06:24:40 +01:00
Microchip EV23X71A is a LAN9696 based EVB. Specifications: * CPU: Microchip LAN9696 switch SoC * DRAM: 1GB DDR4 * Storage: * 2MB QSPI NOR * 4GB eMMC * Networking: * 24 x 10/100/1000 RJ45 via LAN8814 Quad PHY-s over QSGMII * 4 x 100/1000/2500/5000/10000 SFP+ ports * 1 x 10/100/1000 management RJ45 via LAN8840 PHY over RGMII (U-Boot too) * USB: 1 x USB2.0 Type-A * Management via USB-C (MCP2200): * UART @ 115200 baud * GPIO-s for bootstrap, reset and clock selection * DIP switch for boostrap configuration * LED-s: * 2 per networking port (Green and Yellow) * Green status LED * Yellow reset LED * Hard reset button * Power: * 12V DC barrel jack * 48/56V DC screw terminal * Selectable via toggle switch * PTP support: * Sync-E DPLL ZL30732B to generate the board required clocks * Two SMAs for PTP and two for Station clock inputs and outputs * Two ITU-T G.8275-compliant RS-422 interfaces for PTP applications * External PoE: * Option for PoE add-on, like EV14Y36A (IEEE 802.3af/at/bt Type 4 standard com-pliant) * Option for external CPU control via SPI and PCIe Installation instructions: 1. Connect to UART via the USB-C port 2. Connect the management port 3. Boot and interrupt U-Boot 4. TFTP the OpenWrt initramfs image and boot it 5. SCP the OpenWrt eMMC GPT image to a running OpenWrt initramfs to /tmp openwrt-microchipsw-lan969x-microchip_ev23x71a-squashfs-emmc-gpt.img.gz And decompress it via: gzip -d /tmp/openwrt-microchipsw-lan969x-microchip_ev23x71a-squashfs-emmc-gpt.img.gz 6. Wipe eMMC with: dd if=/dev/zero of=/dev/mmcblk0 bs=1M 7. Flash OpenWrt eMMC image with: dd if=/tmp/openwrt-microchipsw-lan969x-microchip_ev23x71a-squashfs-emmc-gpt.img of=/dev/mmcblk0 After a restart OpenWrt will boot, and then regular sysupgrade can be used for upgrades. Signed-off-by: Robert Marko <robert.marko@sartura.hr>
139 lines
3.4 KiB
Diff
139 lines
3.4 KiB
Diff
--- a/cmd/bootm.c
|
|
+++ b/cmd/bootm.c
|
|
@@ -260,6 +260,76 @@ U_BOOT_CMD(
|
|
/* iminfo - print header info for a requested image */
|
|
/*******************************************************************/
|
|
#if defined(CONFIG_CMD_IMI)
|
|
+#define SECTOR_SHIFT 9
|
|
+static int image_totalsize(struct cmd_tbl *cmdtp, int flag, int argc,
|
|
+ char *const argv[], short int in_blocks)
|
|
+{
|
|
+ ulong addr;
|
|
+ void *hdr;
|
|
+ uint32_t bsize, tsize = 0;
|
|
+ char buf[16];
|
|
+
|
|
+ if (argc >= 2)
|
|
+ addr = simple_strtoul(argv[1], NULL, 16);
|
|
+ else
|
|
+ addr = image_load_addr;
|
|
+
|
|
+ hdr = (void *)map_sysmem(addr, 0);
|
|
+
|
|
+ switch (genimg_get_format(hdr)) {
|
|
+ case IMAGE_FORMAT_LEGACY:
|
|
+ if(CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT))
|
|
+ tsize = image_get_image_size(hdr);
|
|
+ break;
|
|
+ case IMAGE_FORMAT_FIT:
|
|
+ if(CONFIG_IS_ENABLED(FIT))
|
|
+ tsize = fit_get_totalsize(hdr);
|
|
+ break;
|
|
+ }
|
|
+
|
|
+ unmap_sysmem(hdr);
|
|
+ if (tsize == 0)
|
|
+ return 1;
|
|
+
|
|
+ bsize = (tsize >> SECTOR_SHIFT) + ((tsize & ((1 << SECTOR_SHIFT) - 1))?1:0);
|
|
+
|
|
+ if (!in_blocks)
|
|
+ snprintf(buf, sizeof(buf), "%x", tsize);
|
|
+ else
|
|
+ snprintf(buf, sizeof(buf), "%x", bsize);
|
|
+
|
|
+ if (argc >= 3)
|
|
+ return env_set(argv[2], buf);
|
|
+ else
|
|
+ printf("%s\n", buf);
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+static int do_imsz(struct cmd_tbl *cmdtp, int flag, int argc,
|
|
+ char *const argv[])
|
|
+{
|
|
+ return image_totalsize(cmdtp, flag, argc, argv, 0);
|
|
+}
|
|
+
|
|
+static int do_imszb(struct cmd_tbl *cmdtp, int flag, int argc,
|
|
+ char *const argv[])
|
|
+{
|
|
+ return image_totalsize(cmdtp, flag, argc, argv, 1);
|
|
+}
|
|
+
|
|
+U_BOOT_CMD(
|
|
+ imsz, CONFIG_SYS_MAXARGS, 1, do_imsz,
|
|
+ "get image total size (in bytes)",
|
|
+ "addr [maxhdrlen] [varname]\n"
|
|
+);
|
|
+
|
|
+U_BOOT_CMD(
|
|
+ imszb, CONFIG_SYS_MAXARGS, 1, do_imszb,
|
|
+ "get image total size (in blocks)",
|
|
+ "addr [maxhdrlen] [varname]\n"
|
|
+);
|
|
+
|
|
static int do_iminfo(struct cmd_tbl *cmdtp, int flag, int argc,
|
|
char *const argv[])
|
|
{
|
|
--- a/boot/image-fit.c
|
|
+++ b/boot/image-fit.c
|
|
@@ -2054,6 +2054,47 @@ static const char *fit_get_image_type_pr
|
|
return "unknown";
|
|
}
|
|
|
|
+size_t fit_get_totalsize(const void *fit)
|
|
+{
|
|
+ int ret, ndepth, noffset, images_noffset;
|
|
+ size_t data_size, hdrsize, img_total, max_size = 0;
|
|
+ const void *data;
|
|
+
|
|
+ ret = fdt_check_header(fit);
|
|
+ if (ret) {
|
|
+ debug("Wrong FIT format: not a flattened device tree (err=%d)\n",
|
|
+ ret);
|
|
+ return 0;
|
|
+ }
|
|
+
|
|
+ hdrsize = fdt_totalsize(fit);
|
|
+
|
|
+ /* take care of simple FIT with internal images */
|
|
+ max_size = hdrsize;
|
|
+
|
|
+ images_noffset = fdt_path_offset(fit, FIT_IMAGES_PATH);
|
|
+ if (images_noffset < 0)
|
|
+ goto out;
|
|
+
|
|
+ for (ndepth = 0,
|
|
+ noffset = fdt_next_node(fit, images_noffset, &ndepth);
|
|
+ (noffset >= 0) && (ndepth > 0);
|
|
+ noffset = fdt_next_node(fit, noffset, &ndepth)) {
|
|
+ if (ndepth == 1) {
|
|
+ ret = fit_image_get_data(fit, noffset, &data, &data_size);
|
|
+ if (ret)
|
|
+ goto out;
|
|
+
|
|
+ img_total = data_size + (data - fit);
|
|
+
|
|
+ max_size = (max_size > img_total) ? max_size : img_total;
|
|
+ }
|
|
+ }
|
|
+
|
|
+out:
|
|
+ return max_size;
|
|
+}
|
|
+
|
|
int fit_image_load(struct bootm_headers *images, ulong addr,
|
|
const char **fit_unamep, const char **fit_uname_configp,
|
|
int arch, int ph_type, int bootstage_id,
|
|
--- a/include/image.h
|
|
+++ b/include/image.h
|
|
@@ -1113,6 +1113,7 @@ int fit_parse_subimage(const char *spec,
|
|
ulong *addr, const char **image_name);
|
|
|
|
int fit_get_subimage_count(const void *fit, int images_noffset);
|
|
+size_t fit_get_totalsize(const void *fit);
|
|
void fit_print_contents(const void *fit);
|
|
void fit_image_print(const void *fit, int noffset, const char *p);
|
|
|