From 8619d7af67c28ff974373c9a2937da1025cd81e5 Mon Sep 17 00:00:00 2001 From: Zoltan HERPAI Date: Fri, 5 Jan 2024 18:42:53 +0100 Subject: [PATCH] kirkwood: add D-Link DNS-320L support Dual-slot NAS based on Marvell Kirkwood. Specifications: - Marvell 88F6702 @1GHz - 256Mb RAM - 128Mb NAND - 1x GbE LAN (Marvell 88E1318R) - 1x USB 2.0 - 2x SATA - Weltrend WT69P3 ("supervisor" MCU chip) - Serial on J2 (115200,8n1) - Newer bootROM so kwboot-ing via serial is possible Notes: - The Weltrend MCU is controlled by the package added in utils/dns320l-mcu. - The original MAC address is stored in the "mini firmware" image's first 17 bytes. - Compared to the original MTD layout, the uImage+rootfs are now stored in a common ubi partition. Installation: 1. Serial console - Connect your levelshifter to the serial console on J2 (refer to the wiki page for pinout) 2. Update u-boot - Download the u-boot.kwb image for the device - Powercycle the NAS - Run "kwboot -b u-boot-dns320l/u-boot.kwb /dev/ttyUSB0 -p" - Connect to the serial console with minicom - tftp 0x0800000 u-boot-dns320l/u-boot.kwb (Please note that "PHY reset timed out" seems to be customary on kirkwood devices, the egiga0 interface works regardless.) - nand erase 0x0 100000 - nand write 0x0800000 0x0 0x100000 - reset 3. Install OpenWrt - Boot up the initramfs image - tftpboot 0x800000 openwrt-kirkwood-generic-dlink_dns320l-initramfs-uImage; bootm 0x800000 - Download the sysupgrade image and perform sysupgrade Signed-off-by: Zoltan HERPAI Reviewed-by: Pawel Dembicki --- package/boot/uboot-envtools/Makefile | 2 +- package/boot/uboot-envtools/files/kirkwood | 1 + package/boot/uboot-kirkwood/Makefile | 8 +- .../uboot-kirkwood/patches/190-dns-320l.patch | 387 ++++++++++++++++++ package/utils/dns320l-mcu/Makefile | 36 ++ .../utils/dns320l-mcu/files/dns320l-mcu.init | 14 + .../base-files/etc/board.d/02_network | 4 + .../arch/arm/boot/dts/kirkwood-dns320l.dts | 202 +++++++++ .../arm/boot/dts/marvell/kirkwood-dns320l.dts | 202 +++++++++ target/linux/kirkwood/image/Makefile | 8 + .../kirkwood/patches-6.1/118-dns-320l.patch | 35 ++ .../kirkwood/patches-6.6/118-dns-320l.patch | 35 ++ 12 files changed, 932 insertions(+), 2 deletions(-) create mode 100644 package/boot/uboot-kirkwood/patches/190-dns-320l.patch create mode 100644 package/utils/dns320l-mcu/Makefile create mode 100644 package/utils/dns320l-mcu/files/dns320l-mcu.init create mode 100644 target/linux/kirkwood/files-6.1/arch/arm/boot/dts/kirkwood-dns320l.dts create mode 100644 target/linux/kirkwood/files-6.6/arch/arm/boot/dts/marvell/kirkwood-dns320l.dts create mode 100644 target/linux/kirkwood/patches-6.1/118-dns-320l.patch create mode 100644 target/linux/kirkwood/patches-6.6/118-dns-320l.patch diff --git a/package/boot/uboot-envtools/Makefile b/package/boot/uboot-envtools/Makefile index 00aa4241625f..d4446167b73a 100644 --- a/package/boot/uboot-envtools/Makefile +++ b/package/boot/uboot-envtools/Makefile @@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uboot-envtools PKG_DISTNAME:=u-boot PKG_VERSION:=2024.01 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:= \ diff --git a/package/boot/uboot-envtools/files/kirkwood b/package/boot/uboot-envtools/files/kirkwood index 1b07640cd36c..b6b483ac4f7d 100644 --- a/package/boot/uboot-envtools/files/kirkwood +++ b/package/boot/uboot-envtools/files/kirkwood @@ -15,6 +15,7 @@ case "$board" in checkpoint,l-50|\ cloudengines,pogoe02|\ cloudengines,pogoplugv4|\ +dlink,dns320l|\ globalscale,sheevaplug|\ iom,ix2-200|\ iom,ix4-200d|\ diff --git a/package/boot/uboot-kirkwood/Makefile b/package/boot/uboot-kirkwood/Makefile index 92a814ac4f61..7338e5d86811 100644 --- a/package/boot/uboot-kirkwood/Makefile +++ b/package/boot/uboot-kirkwood/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_VERSION:=2020.04 -PKG_RELEASE:=9 +PKG_RELEASE:=10 PKG_HASH:=fe732aaf037d9cc3c0909bad8362af366ae964bbdac6913a34081ff4ad565372 @@ -20,6 +20,11 @@ define U-Boot/Default BUILD_SUBTARGET:=generic endef +define U-Boot/dns320l + NAME:=D-Link DNS-320L + BUILD_DEVICES:=dlink_dns320l +endef + define U-Boot/dockstar NAME:=Seagate DockStar BUILD_DEVICES:=seagate_dockstar @@ -106,6 +111,7 @@ define U-Boot/sheevaplug endef UBOOT_TARGETS := \ + dns320l \ dockstar dockstar_second_stage \ goflexhome \ ib62x0 ib62x0_second_stage \ diff --git a/package/boot/uboot-kirkwood/patches/190-dns-320l.patch b/package/boot/uboot-kirkwood/patches/190-dns-320l.patch new file mode 100644 index 000000000000..3cf642e17407 --- /dev/null +++ b/package/boot/uboot-kirkwood/patches/190-dns-320l.patch @@ -0,0 +1,387 @@ +--- a/arch/arm/mach-kirkwood/Kconfig ++++ b/arch/arm/mach-kirkwood/Kconfig +@@ -28,6 +28,9 @@ config TARGET_POGO_E02 + config TARGET_POGOPLUGV4 + bool "Pogoplug V4 Board" + ++config TARGET_DNS320L ++ bool "dns320l Board" ++ + config TARGET_DNS325 + bool "dns325 Board" + +@@ -93,6 +96,7 @@ source "board/Marvell/sheevaplug/Kconfig + source "board/buffalo/lsxl/Kconfig" + source "board/cloudengines/pogo_e02/Kconfig" + source "board/cloudengines/pogoplugv4/Kconfig" ++source "board/d-link/dns320l/Kconfig" + source "board/d-link/dns325/Kconfig" + source "board/iomega/iconnect/Kconfig" + source "board/keymile/Kconfig" +--- /dev/null ++++ b/board/d-link/dns320l/dns320l.c +@@ -0,0 +1,113 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Copyright (C) 2015 ++ * Gerald Kerma ++ * Tony Dinh ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "dns320l.h" ++ ++DECLARE_GLOBAL_DATA_PTR; ++ ++int board_early_init_f(void) ++{ ++ /* ++ * default gpio configuration ++ * There are maximum 64 gpios controlled through 2 sets of registers ++ * the below configuration configures mainly initial LED status ++ */ ++ mvebu_config_gpio(DNS320L_OE_VAL_LOW, DNS320L_OE_VAL_HIGH, ++ DNS320L_OE_LOW, DNS320L_OE_HIGH); ++ ++ /* (all LEDs & power off active high) */ ++ /* Multi-Purpose Pins Functionality configuration */ ++ static const u32 kwmpp_config[] = { ++ MPP0_NF_IO2, ++ MPP1_NF_IO3, ++ MPP2_NF_IO4, ++ MPP3_NF_IO5, ++ MPP4_NF_IO6, ++ MPP5_NF_IO7, ++ MPP6_SYSRST_OUTn, ++ MPP7_GPO, ++ MPP8_TW_SDA, ++ MPP9_TW_SCK, ++ MPP10_UART0_TXD, ++ MPP11_UART0_RXD, ++ MPP12_GPO, ++ MPP13_GPIO, ++ MPP14_GPIO, ++ MPP15_GPIO, ++ MPP16_GPIO, ++ MPP17_GPIO, ++ MPP18_NF_IO0, ++ MPP19_NF_IO1, ++ MPP20_SATA1_ACTn, /* sata1(left) status led */ ++ MPP21_SATA0_ACTn, /* sata0(right) status led */ ++ MPP22_GPIO, ++ MPP23_GPIO, ++ MPP24_GPIO, ++ MPP25_GPIO, ++ MPP26_GPIO, ++ MPP27_GPIO, ++ MPP28_GPIO, ++ MPP29_GPIO, ++ MPP30_GPIO, ++ MPP31_GPIO, ++ MPP32_GPIO, ++ 0 ++ }; ++ kirkwood_mpp_conf(kwmpp_config, NULL); ++ ++ kw_gpio_set_value(DNS320L_GPIO_SATA_EN , 1); ++ ++ return 0; ++} ++ ++int board_init(void) ++{ ++ /* address of boot parameters */ ++ gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100; ++ ++ return 0; ++} ++ ++#ifdef CONFIG_RESET_PHY_R ++/* Configure and initialize PHY */ ++void reset_phy(void) ++{ ++ u16 reg; ++ u16 phyaddr; ++ char *name = "egiga0"; ++ ++ if (miiphy_set_current_dev(name)) ++ return; ++ ++ /* read PHY dev address */ ++ if (miiphy_read(name, 0xee, 0xee, (u16 *) &phyaddr)) { ++ printf("could not read PHY dev address\n"); ++ return; ++ } ++ ++ /* set RGMII delay */ ++ miiphy_write(name, phyaddr, MV88E1318_PGADR_REG, MV88E1318_MAC_CTRL_PG); ++ miiphy_read(name, phyaddr, MV88E1318_MAC_CTRL_REG, ®); ++ reg |= (MV88E1318_RGMII_RX_CTRL | MV88E1318_RGMII_TX_CTRL); ++ miiphy_write(name, phyaddr, MV88E1318_MAC_CTRL_REG, reg); ++ miiphy_write(name, phyaddr, MV88E1318_PGADR_REG, 0); ++ ++ /* reset PHY */ ++ if (miiphy_reset(name, phyaddr)) ++ return; ++ ++ printf("MV88E1318 PHY initialized on %s\n", name); ++} ++#endif /* CONFIG_RESET_PHY_R */ +--- /dev/null ++++ b/board/d-link/dns320l/dns320l.h +@@ -0,0 +1,39 @@ ++/* SPDX-License-Identifier: GPL-2.0+ */ ++/* ++ * Copyright (C) 2011 ++ * Stefan Herbrechtsmeier ++ * ++ * Based on Kirkwood support: ++ * (C) Copyright 2009 ++ * Marvell Semiconductor ++ * Written-by: Prafulla Wadaskar ++ */ ++ ++#ifndef __DNS320L_H ++#define __DNS320L_H ++ ++/* GPIO configuration */ ++#define DNS320L_GPIO_SATA_EN 24 ++#define HDD_L_GREEN_LED (1 << 22) ++#define HDD_R_GREEN_LED (1 << 23) ++#define USB_BLUE_LED (1 << 25) ++#define USB_ORANGE_LED (1 << 26) ++ ++#define DNS320L_OE_LOW (~(HDD_L_GREEN_LED | HDD_R_GREEN_LED | \ ++ USB_BLUE_LED | USB_ORANGE_LED)) ++#define DNS320L_OE_VAL_LOW (0) ++ ++/* high GPIO's */ ++#define WATCHDOG_SIGNAL (1 << 14) ++ ++#define DNS320L_OE_HIGH (~(WATCHDOG_SIGNAL)) ++#define DNS320L_OE_VAL_HIGH ((WATCHDOG_SIGNAL)) ++ ++/* PHY related */ ++#define MV88E1318_PGADR_REG 22 ++#define MV88E1318_MAC_CTRL_PG 2 ++#define MV88E1318_MAC_CTRL_REG 21 ++#define MV88E1318_RGMII_TX_CTRL (1 << 4) ++#define MV88E1318_RGMII_RX_CTRL (1 << 5) ++ ++#endif /* __DNS320L_H */ +--- /dev/null ++++ b/board/d-link/dns320l/Kconfig +@@ -0,0 +1,18 @@ ++# SPDX-License-Identifier: GPL-2.0+ ++# ++# Copyright (C) 2015 ++# Gerald Kerma ++# Tony Dinh ++ ++if TARGET_DNS320L ++ ++config SYS_BOARD ++ default "dns320l" ++ ++config SYS_VENDOR ++ default "d-link" ++ ++config SYS_CONFIG_NAME ++ default "dns320l" ++ ++endif +--- /dev/null ++++ b/board/d-link/dns320l/kwbimage.cfg +@@ -0,0 +1,41 @@ ++# SPDX-License-Identifier: GPL-2.0+ ++# ++# Copyright (C) 2015 ++# Gerald Kerma ++# Tony Dinh ++# Refer to doc/README.kwbimage for more details about how-to ++# configure and create kirkwood boot images. ++# ++ ++# Boot Media configurations ++BOOT_FROM nand ++NAND_ECC_MODE default ++NAND_PAGE_SIZE 0x0800 ++ ++# Configure RGMII-0 interface pad voltage to 1.8V ++DATA 0xFFD100e0 0x1b1b1b9b ++ ++DATA 0xFFD01400 0x43010c30 ++DATA 0xFFD01404 0x39543000 ++DATA 0xFFD01408 0x22125451 ++DATA 0xFFD0140C 0x00000833 ++DATA 0xFFD01410 0x0000000C ++DATA 0xFFD01414 0x00000000 ++DATA 0xFFD01418 0x00000000 ++DATA 0xFFD0141C 0x00000652 ++DATA 0xFFD01420 0x00000004 ++DATA 0xFFD01424 0x0000F17F ++DATA 0xFFD01428 0x00085520 ++DATA 0xFFD0147c 0x00008552 ++DATA 0xFFD01504 0x0FFFFFF1 ++DATA 0xFFD01508 0x10000000 ++DATA 0xFFD0150C 0x00000000 ++DATA 0xFFD01514 0x00000000 ++DATA 0xFFD0151C 0x00000000 ++DATA 0xFFD01494 0x00010000 ++DATA 0xFFD01498 0x00000000 ++DATA 0xFFD0149C 0x0000E403 ++DATA 0xFFD01480 0x00000001 ++DATA 0xFFD20134 0x66666666 ++DATA 0xFFD20138 0x66666666 ++DATA 0x0 0x0 +--- /dev/null ++++ b/board/d-link/dns320l/MAINTAINERS +@@ -0,0 +1,8 @@ ++NSA310S BOARD ++M: Gerald Kerma ++M: Tony Dinh ++M: Luka Perkov ++S: Maintained ++F: board/d-link/dns320l/ ++F: include/configs/dns320l.h ++F: configs/dns320l_defconfig +--- /dev/null ++++ b/board/d-link/dns320l/Makefile +@@ -0,0 +1,7 @@ ++# SPDX-License-Identifier: GPL-2.0+ ++# ++# Copyright (C) 2015 ++# Gerald Kerma ++# Tony Dinh ++ ++obj-y := dns320l.o +--- /dev/null ++++ b/configs/dns320l_defconfig +@@ -0,0 +1,48 @@ ++CONFIG_ARM=y ++CONFIG_SYS_DCACHE_OFF=y ++CONFIG_ARCH_CPU_INIT=y ++CONFIG_KIRKWOOD=y ++CONFIG_SYS_TEXT_BASE=0x600000 ++CONFIG_TARGET_DNS320L=y ++CONFIG_ENV_SIZE=0x20000 ++CONFIG_ENV_OFFSET=0x100000 ++CONFIG_NR_DRAM_BANKS=2 ++CONFIG_BOOTDELAY=3 ++CONFIG_USE_PREBOOT=y ++# CONFIG_DISPLAY_BOARDINFO is not set ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_PROMPT="dns320l => " ++CONFIG_CMD_BOOTZ=y ++# CONFIG_CMD_FLASH is not set ++CONFIG_CMD_IDE=y ++CONFIG_CMD_NAND=y ++CONFIG_CMD_USB=y ++# CONFIG_CMD_SETEXPR is not set ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_MII=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_EXT2=y ++CONFIG_CMD_FAT=y ++CONFIG_CMD_JFFS2=y ++CONFIG_CMD_MTDPARTS=y ++CONFIG_MTDPARTS_DEFAULT="mtdparts=orion_nand:0x100000@0x0(uboot),0x20000@0x100000(ubootenv),0x6de0000@0x120000(ubi),0xa00000@0x6f00000(mini),0x500000@0x7900000(config),0x200000@0x7e00000(my-dlink)" ++CONFIG_CMD_UBI=y ++CONFIG_ISO_PARTITION=y ++CONFIG_ENV_IS_IN_NAND=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_MVSATA_IDE=y ++# CONFIG_MMC is not set ++CONFIG_MTD=y ++CONFIG_MTD_RAW_NAND=y ++CONFIG_MVGBE=y ++CONFIG_MII=y ++CONFIG_SYS_NS16550=y ++CONFIG_USB=y ++CONFIG_USB_EHCI_HCD=y ++CONFIG_USB_STORAGE=y ++CONFIG_FIT=y ++CONFIG_FIT_VERBOSE=y ++CONFIG_LZMA=y ++CONFIG_LZO=y ++CONFIG_OF_LIBFDT=y ++CONFIG_NET_RANDOM_ETHADDR=y +--- /dev/null ++++ b/include/configs/dns320l.h +@@ -0,0 +1,69 @@ ++/* SPDX-License-Identifier: GPL-2.0+ */ ++/* ++ * Copyright (C) 2015 ++ * Gerald Kerma ++ * Tony Dinh ++ * Luka Perkov ++ */ ++ ++#ifndef _CONFIG_DNS320L_H ++#define _CONFIG_DNS320L_H ++ ++/* high level configuration options */ ++#define CONFIG_FEROCEON_88FR131 1 /* CPU Core subversion */ ++#define CONFIG_KW88F6192 1 /* SOC Name */ ++#define CONFIG_KW88F6702 1 /* SOC Name */ ++#define CONFIG_SKIP_LOWLEVEL_INIT /* disable board lowlevel_init */ ++ ++/* compression configuration */ ++#define CONFIG_BZIP2 ++ ++/* commands configuration */ ++ ++/* ++ * mv-common.h should be defined after CMD configs since it used them ++ * to enable certain macros ++ */ ++#include "mv-common.h" ++ ++/* environment variables configuration */ ++ ++/* default environment variables */ ++#define CONFIG_BOOTCOMMAND \ ++ "ubi part ubi; " \ ++ "ubi read 0x800000 kernel; " \ ++ "bootm 0x800000" ++ ++#define CONFIG_EXTRA_ENV_SETTINGS \ ++ "console=console=ttyS0,115200\0" \ ++ "mtdids=nand0=orion_nand\0" \ ++ "mtdparts="CONFIG_MTDPARTS_DEFAULT "\0" \ ++ "bootargs_root=ubi.mtd=2 root=ubi0:rootfs rootfstype=ubifs rw\0" ++ ++/* Ethernet driver configuration */ ++#ifdef CONFIG_CMD_NET ++#define CONFIG_NETCONSOLE ++#define CONFIG_MVGBE_PORTS {1, 0} /* enable port 0 only */ ++#define CONFIG_PHY_BASE_ADR 1 ++#define CONFIG_RESET_PHY_R ++#endif /* CONFIG_CMD_NET */ ++ ++/* SATA driver configuration */ ++#ifdef CONFIG_IDE ++#define __io ++#define CONFIG_IDE_PREINIT ++#define CONFIG_MVSATA_IDE_USE_PORT0 ++#define CONFIG_SYS_ATA_IDE0_OFFSET MV_SATA_PORT0_OFFSET ++#endif /* CONFIG_IDE */ ++ ++/* ++ * Enable GPI0 support ++*/ ++#define CONFIG_KIRKWOOD_GPIO ++ ++/* RTC driver configuration */ ++#ifdef CONFIG_CMD_DATE ++#define CONFIG_RTC_MV ++#endif /* CONFIG_CMD_DATE */ ++ ++#endif /* _CONFIG_DNS320L_H */ diff --git a/package/utils/dns320l-mcu/Makefile b/package/utils/dns320l-mcu/Makefile new file mode 100644 index 000000000000..724a664a8b25 --- /dev/null +++ b/package/utils/dns320l-mcu/Makefile @@ -0,0 +1,36 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=dns320l-mcu +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL=https://github.com/wigyori/dns320l-daemon.git +PKG_SOURCE_DATE:=2024-05-11 +PKG_SOURCE_VERSION:=c74941880e0a8d2bc0344b3256b984397512e8c3 +PKG_MIRROR_HASH:=e0f186a0c139ccfac3d311f49e2fecdbd02fa3f9fe6ced4b1ce0baa603d49fc3 +PKG_MAINTAINER:=Zoltan HERPAI +PKG_LICENSE:=GPL-3.0+ + +include $(INCLUDE_DIR)/package.mk + +define Package/dns320l-mcu + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Utility to control the MCU on DNS-320L + DEPENDS:=@TARGET_kirkwood + URL:=https://github.com/wigyori/dns320l-mcu +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + CC="$(TARGET_CC)" \ + CFLAGS="$(TARGET_CFLAGS) -Wall" +endef + +define Package/dns320l-mcu/install + $(INSTALL_DIR) $(1)/usr/bin $(1)/etc/init.d + $(INSTALL_BIN) ./files/dns320l-mcu.init $(1)/etc/init.d/dns320l-mcu + $(INSTALL_BIN) $(PKG_BUILD_DIR)/dns320l-daemon $(1)/usr/bin/dns320l-mcu +endef + +$(eval $(call BuildPackage,dns320l-mcu)) diff --git a/package/utils/dns320l-mcu/files/dns320l-mcu.init b/package/utils/dns320l-mcu/files/dns320l-mcu.init new file mode 100644 index 000000000000..eb1c579907e7 --- /dev/null +++ b/package/utils/dns320l-mcu/files/dns320l-mcu.init @@ -0,0 +1,14 @@ +#!/bin/sh /etc/rc.common +# Copyright (c) 2024 OpenWrt.org + +START=99 + +USE_PROCD=1 +PROG=/usr/bin/dns320l-mcu + +start_service() { + procd_open_instance + procd_set_param command "$PROG" + procd_set_param respawn + procd_close_instance +} diff --git a/target/linux/kirkwood/base-files/etc/board.d/02_network b/target/linux/kirkwood/base-files/etc/board.d/02_network index 3ed2fa94b07e..ff7897fe1395 100644 --- a/target/linux/kirkwood/base-files/etc/board.d/02_network +++ b/target/linux/kirkwood/base-files/etc/board.d/02_network @@ -19,6 +19,7 @@ kirkwood_setup_interfaces() cloudengines,pogoe02|\ cloudengines,pogoplugv4|\ ctera,c200-v1|\ + dlink,dns320l|\ globalscale,sheevaplug|\ iom,iconnect-1.1|\ iom,ix2-200|\ @@ -60,6 +61,9 @@ kirkwood_setup_macs() local label_mac="" case "$board" in + dlink,dns320l) + lan_mac=$(mtd_get_mac_text "mini firmware") + ;; iptime,nas1) lan_mac=$(mtd_get_mac_binary u-boot 0x3ffa8) label_mac=$lan_mac diff --git a/target/linux/kirkwood/files-6.1/arch/arm/boot/dts/kirkwood-dns320l.dts b/target/linux/kirkwood/files-6.1/arch/arm/boot/dts/kirkwood-dns320l.dts new file mode 100644 index 000000000000..bd86c04ea737 --- /dev/null +++ b/target/linux/kirkwood/files-6.1/arch/arm/boot/dts/kirkwood-dns320l.dts @@ -0,0 +1,202 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Device Tree file for DLINK DNS-320L + * + * Copyright (C) 2024, Zoltan HERPAI + * Copyright (C) 2015, Sunke Schlüters + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * This file is based on the works of: + * - Sunke Schlüters + * - https://github.com/scus1/dns320l/blob/master/kernel/dts/kirkwood-dns320l.dts + * - Andreas Böhler : + * - http://www.aboehler.at/doku/doku.php/projects:dns320l + * - http://www.aboehler.at/hg/linux-dns320l/file/ba7a60ad7687/linux-3.12/kirkwood-dns320l.dts + */ + +/dts-v1/; + +#include "kirkwood.dtsi" +#include "kirkwood-6281.dtsi" + +/ { + model = "D-Link DNS-320L"; + compatible = "dlink,dns320l", "marvell,kirkwood-88f6702", "marvell,kirkwood"; + + memory { + device_type = "memory"; + reg = <0x00000000 0x10000000>; + }; + + chosen { + bootargs = "console=ttyS0,115200n8 earlyprintk"; + stdout-path = &uart0; + }; + + gpio-keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-0 = <&pmx_buttons>; + pinctrl-names = "default"; + + button@1 { + label = "Reset push button"; + linux,code = ; + gpios = <&gpio0 28 1>; + }; + + button@2 { + label = "USB unmount button"; + linux,code = ; + gpios = <&gpio0 27 1>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + pinctrl-0 = <&pmx_leds>; + pinctrl-names = "default"; + + blue-usb { + label = "dns320l:usb:blue"; + gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "usbport"; + }; + + orange-usb { + label = "dns320l:usb:orange"; + gpios = <&gpio0 26 GPIO_ACTIVE_HIGH>; + }; + + orange-l-hdd { + label = "dns320l:orange:l_hdd"; + gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>; + }; + + orange-r-hdd { + label = "dns320l:orange:r_hdd"; + gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>; + }; + }; + + ocp@f1000000 { + sata@80000 { + status = "okay"; + nr-ports = <2>; + }; + + serial@12000 { + status = "okay"; + }; + + serial@12100 { + pinctrl-0 = <&pmx_uart1>; + pinctrl-names = "default"; + status = "okay"; + }; + }; + + regulators { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-0 = <&pmx_power_sata>; + pinctrl-names = "default"; + + sata_power: regulator@1 { + compatible = "regulator-fixed"; + reg = <1>; + regulator-name = "SATA Power"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + enable-active-high; + regulator-always-on; + regulator-boot-on; + gpio = <&gpio0 24 0>; + }; + }; +}; + +&nand { + pinctrl-0 = <&pmx_nand>; + pinctrl-names = "default"; + chip-delay = <40>; + status = "okay"; + + partition@0 { + label = "u-boot"; + reg = <0x0000000 0x100000>; + }; + + partition@100000 { + label = "ubootenv"; + reg = <0x100000 0x20000>; + }; + + partition@120000 { + label = "ubi"; + reg = <0x120000 0x6de0000>; + }; + + partition@6f00000 { + label = "mini firmware"; + reg = <0x6f00000 0xa00000>; + }; + + partition@7900000 { + label = "config"; + reg = <0x7900000 0x500000>; + }; + + partition@7e00000 { + label = "my-dlink"; + reg = <0x7e00000 0x200000>; + }; +}; + +&mdio { + status = "okay"; + + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + +&pinctrl { + pmx_sata1: pmx-sata1 { + marvell,pins = "mpp20"; + marvell,function = "sata1"; + }; + + pmx_sata0: pmx-sata0 { + marvell,pins = "mpp21"; + marvell,function = "sata0"; + }; + + pmx_power_sata: pmx-power-sata { + marvell,pins = "mpp24"; + marvell,function = "gpio"; + }; + + pmx_leds: pmx-leds { + marvell,pins = "mpp22", "mpp23", "mpp25", "mpp26"; + marvell,function = "gpio"; + }; + + pmx_buttons: pmx-buttons { + marvell,pins = "mpp27", "mpp28", "mpp29"; + marvell,function = "gpio"; + }; +}; + +ð0 { + status = "okay"; + ethernet0-port@0 { + phy-handle = <ðphy0>; + }; +}; diff --git a/target/linux/kirkwood/files-6.6/arch/arm/boot/dts/marvell/kirkwood-dns320l.dts b/target/linux/kirkwood/files-6.6/arch/arm/boot/dts/marvell/kirkwood-dns320l.dts new file mode 100644 index 000000000000..bd86c04ea737 --- /dev/null +++ b/target/linux/kirkwood/files-6.6/arch/arm/boot/dts/marvell/kirkwood-dns320l.dts @@ -0,0 +1,202 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Device Tree file for DLINK DNS-320L + * + * Copyright (C) 2024, Zoltan HERPAI + * Copyright (C) 2015, Sunke Schlüters + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * This file is based on the works of: + * - Sunke Schlüters + * - https://github.com/scus1/dns320l/blob/master/kernel/dts/kirkwood-dns320l.dts + * - Andreas Böhler : + * - http://www.aboehler.at/doku/doku.php/projects:dns320l + * - http://www.aboehler.at/hg/linux-dns320l/file/ba7a60ad7687/linux-3.12/kirkwood-dns320l.dts + */ + +/dts-v1/; + +#include "kirkwood.dtsi" +#include "kirkwood-6281.dtsi" + +/ { + model = "D-Link DNS-320L"; + compatible = "dlink,dns320l", "marvell,kirkwood-88f6702", "marvell,kirkwood"; + + memory { + device_type = "memory"; + reg = <0x00000000 0x10000000>; + }; + + chosen { + bootargs = "console=ttyS0,115200n8 earlyprintk"; + stdout-path = &uart0; + }; + + gpio-keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-0 = <&pmx_buttons>; + pinctrl-names = "default"; + + button@1 { + label = "Reset push button"; + linux,code = ; + gpios = <&gpio0 28 1>; + }; + + button@2 { + label = "USB unmount button"; + linux,code = ; + gpios = <&gpio0 27 1>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + pinctrl-0 = <&pmx_leds>; + pinctrl-names = "default"; + + blue-usb { + label = "dns320l:usb:blue"; + gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "usbport"; + }; + + orange-usb { + label = "dns320l:usb:orange"; + gpios = <&gpio0 26 GPIO_ACTIVE_HIGH>; + }; + + orange-l-hdd { + label = "dns320l:orange:l_hdd"; + gpios = <&gpio0 23 GPIO_ACTIVE_HIGH>; + }; + + orange-r-hdd { + label = "dns320l:orange:r_hdd"; + gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>; + }; + }; + + ocp@f1000000 { + sata@80000 { + status = "okay"; + nr-ports = <2>; + }; + + serial@12000 { + status = "okay"; + }; + + serial@12100 { + pinctrl-0 = <&pmx_uart1>; + pinctrl-names = "default"; + status = "okay"; + }; + }; + + regulators { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-0 = <&pmx_power_sata>; + pinctrl-names = "default"; + + sata_power: regulator@1 { + compatible = "regulator-fixed"; + reg = <1>; + regulator-name = "SATA Power"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + enable-active-high; + regulator-always-on; + regulator-boot-on; + gpio = <&gpio0 24 0>; + }; + }; +}; + +&nand { + pinctrl-0 = <&pmx_nand>; + pinctrl-names = "default"; + chip-delay = <40>; + status = "okay"; + + partition@0 { + label = "u-boot"; + reg = <0x0000000 0x100000>; + }; + + partition@100000 { + label = "ubootenv"; + reg = <0x100000 0x20000>; + }; + + partition@120000 { + label = "ubi"; + reg = <0x120000 0x6de0000>; + }; + + partition@6f00000 { + label = "mini firmware"; + reg = <0x6f00000 0xa00000>; + }; + + partition@7900000 { + label = "config"; + reg = <0x7900000 0x500000>; + }; + + partition@7e00000 { + label = "my-dlink"; + reg = <0x7e00000 0x200000>; + }; +}; + +&mdio { + status = "okay"; + + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + +&pinctrl { + pmx_sata1: pmx-sata1 { + marvell,pins = "mpp20"; + marvell,function = "sata1"; + }; + + pmx_sata0: pmx-sata0 { + marvell,pins = "mpp21"; + marvell,function = "sata0"; + }; + + pmx_power_sata: pmx-power-sata { + marvell,pins = "mpp24"; + marvell,function = "gpio"; + }; + + pmx_leds: pmx-leds { + marvell,pins = "mpp22", "mpp23", "mpp25", "mpp26"; + marvell,function = "gpio"; + }; + + pmx_buttons: pmx-buttons { + marvell,pins = "mpp27", "mpp28", "mpp29"; + marvell,function = "gpio"; + }; +}; + +ð0 { + status = "okay"; + ethernet0-port@0 { + phy-handle = <ðphy0>; + }; +}; diff --git a/target/linux/kirkwood/image/Makefile b/target/linux/kirkwood/image/Makefile index cc136488905f..48de5bee2b84 100644 --- a/target/linux/kirkwood/image/Makefile +++ b/target/linux/kirkwood/image/Makefile @@ -182,6 +182,14 @@ define Device/ctera_c200-v1 endef TARGET_DEVICES += ctera_c200-v1 +define Device/dlink_dns320l + DEVICE_VENDOR := D-Link + DEVICE_MODEL := DNS-320L + DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 kmod-gpio-button-hotplug \ + kmod-usb-storage kmod-usb-ledtrig-usbport dns320l-mcu +endef +TARGET_DEVICES += dlink_dns320l + define Device/endian_4i-edge-200 DEVICE_VENDOR := Endian DEVICE_MODEL := 4i Edge 200 diff --git a/target/linux/kirkwood/patches-6.1/118-dns-320l.patch b/target/linux/kirkwood/patches-6.1/118-dns-320l.patch new file mode 100644 index 000000000000..d6c84e2c59d9 --- /dev/null +++ b/target/linux/kirkwood/patches-6.1/118-dns-320l.patch @@ -0,0 +1,35 @@ +--- a/arch/arm/boot/dts/Makefile ++++ b/arch/arm/boot/dts/Makefile +@@ -310,6 +310,7 @@ dtb-$(CONFIG_MACH_KIRKWOOD) += \ + kirkwood-db-88f6282.dtb \ + kirkwood-dir665.dtb \ + kirkwood-dns320.dtb \ ++ kirkwood-dns320l.dtb \ + kirkwood-dns325.dtb \ + kirkwood-dockstar.dtb \ + kirkwood-dreamplug.dtb \ +--- a/arch/arm/boot/dts/kirkwood-dns320l.dts ++++ b/arch/arm/boot/dts/kirkwood-dns320l.dts +@@ -32,6 +32,13 @@ + reg = <0x00000000 0x10000000>; + }; + ++ aliases { ++ led-boot = &led_orange_usb; ++ led-failsafe = &led_orange_usb; ++ led-running = &led_orange_usb; ++ led-upgrade = &led_orange_usb; ++ }; ++ + chosen { + bootargs = "console=ttyS0,115200n8 earlyprintk"; + stdout-path = &uart0; +@@ -68,7 +75,7 @@ + linux,default-trigger = "usbport"; + }; + +- orange-usb { ++ led_orange_usb: orange-usb { + label = "dns320l:usb:orange"; + gpios = <&gpio0 26 GPIO_ACTIVE_HIGH>; + }; diff --git a/target/linux/kirkwood/patches-6.6/118-dns-320l.patch b/target/linux/kirkwood/patches-6.6/118-dns-320l.patch new file mode 100644 index 000000000000..8f19441bbeb1 --- /dev/null +++ b/target/linux/kirkwood/patches-6.6/118-dns-320l.patch @@ -0,0 +1,35 @@ +--- a/arch/arm/boot/dts/marvell/Makefile ++++ b/arch/arm/boot/dts/marvell/Makefile +@@ -92,6 +92,7 @@ dtb-$(CONFIG_MACH_KIRKWOOD) += \ + kirkwood-db-88f6282.dtb \ + kirkwood-dir665.dtb \ + kirkwood-dns320.dtb \ ++ kirkwood-dns320l.dtb \ + kirkwood-dns325.dtb \ + kirkwood-dockstar.dtb \ + kirkwood-dreamplug.dtb \ +--- a/arch/arm/boot/dts/marvell/kirkwood-dns320l.dts ++++ b/arch/arm/boot/dts/marvell/kirkwood-dns320l.dts +@@ -32,6 +32,13 @@ + reg = <0x00000000 0x10000000>; + }; + ++ aliases { ++ led-boot = &led_orange_usb; ++ led-failsafe = &led_orange_usb; ++ led-running = &led_orange_usb; ++ led-upgrade = &led_orange_usb; ++ }; ++ + chosen { + bootargs = "console=ttyS0,115200n8 earlyprintk"; + stdout-path = &uart0; +@@ -68,7 +75,7 @@ + linux,default-trigger = "usbport"; + }; + +- orange-usb { ++ led_orange_usb: orange-usb { + label = "dns320l:usb:orange"; + gpios = <&gpio0 26 GPIO_ACTIVE_HIGH>; + }; -- 2.30.2