gateboard-one.patch 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613
  1. From 09516f5f61930eb2a54388da04ca5363cb514792 Mon Sep 17 00:00:00 2001
  2. From: kiddin9 <[email protected]>
  3. Date: Fri, 1 Dec 2023 06:28:22 +0800
  4. Subject: [PATCH] update
  5. ---
  6. scripts/gen-rddependencies.sh | 13 +
  7. target/linux/ramips/Makefile | 2 +-
  8. .../dts/mt7621_hatlab_gateboard-one.dts | 390 ++++++++++++++++++
  9. target/linux/ramips/image/mt7621.mk | 36 ++
  10. .../mt7621/base-files/etc/board.d/02_network | 3 +
  11. .../mt7621/base-files/lib/upgrade/platform.sh | 6 +
  12. .../mt7621/base-files/sbin/fixup-mac-address | 4 +
  13. target/linux/ramips/mt7621/config-5.15 | 1 +
  14. ...spi-nor-Add-support-for-Puya-p25d40h.patch | 47 +++
  15. 9 files changed, 501 insertions(+), 1 deletion(-)
  16. create mode 100755 scripts/gen-rddependencies.sh
  17. create mode 100644 target/linux/ramips/dts/mt7621_hatlab_gateboard-one.dts
  18. create mode 100644 target/linux/ramips/patches-5.15/406-mtd-spi-nor-Add-support-for-Puya-p25d40h.patch
  19. diff --git a/scripts/gen-rddependencies.sh b/scripts/gen-rddependencies.sh
  20. new file mode 100755
  21. index 0000000000000..509d6a4fa67e4
  22. --- /dev/null
  23. +++ b/scripts/gen-rddependencies.sh
  24. @@ -0,0 +1,13 @@
  25. +#!/bin/sh
  26. +
  27. +TARGETS=$*
  28. +READELF="${READELF:-readelf}"
  29. +XARGS="${XARGS:-xargs -r}"
  30. +
  31. +find $TARGETS -type f -a -exec file {} \; | \
  32. + sed -n -e 's/^\(.*\):.*ELF.*\(executable\|shared object\).*,.*/\1/p' | \
  33. + $XARGS -n1 $READELF -l | grep 'Requesting' | cut -d':' -f2 | tr -d ' ]' | \
  34. + $XARGS basename
  35. +
  36. +cd `dirname ${0}`
  37. +./gen-dependencies.sh ${TARGETS}
  38. diff --git a/target/linux/ramips/Makefile b/target/linux/ramips/Makefile
  39. index 77b82d5334c22..caf5099d1a116 100644
  40. --- a/target/linux/ramips/Makefile
  41. +++ b/target/linux/ramips/Makefile
  42. @@ -8,7 +8,7 @@ ARCH:=mipsel
  43. BOARD:=ramips
  44. BOARDNAME:=MediaTek Ralink MIPS
  45. SUBTARGETS:=mt7620 mt7621 mt76x8 rt288x rt305x rt3883
  46. -FEATURES:=squashfs gpio
  47. +FEATURES:=squashfs gpio boot-part rootfs-part
  48. KERNEL_PATCHVER:=5.15
  49. diff --git a/target/linux/ramips/dts/mt7621_hatlab_gateboard-one.dts b/target/linux/ramips/dts/mt7621_hatlab_gateboard-one.dts
  50. new file mode 100644
  51. index 0000000000000..e982afaac511a
  52. --- /dev/null
  53. +++ b/target/linux/ramips/dts/mt7621_hatlab_gateboard-one.dts
  54. @@ -0,0 +1,390 @@
  55. +#include "mt7621.dtsi"
  56. +
  57. +#include <dt-bindings/gpio/gpio.h>
  58. +#include <dt-bindings/input/input.h>
  59. +#include <dt-bindings/thermal/thermal.h>
  60. +
  61. +/ {
  62. + compatible = "hatlab,gateboard-one", "mediatek,mt7621-soc";
  63. + model = "HATLab GateBoard-One";
  64. +
  65. + chosen {
  66. + bootargs = "console=ttyS0,115200";
  67. + };
  68. +
  69. + aliases {
  70. + led-boot = &led_sys;
  71. + led-failsafe = &led_sys;
  72. + led-running = &led_sys;
  73. + led-upgrade = &led_sys;
  74. + };
  75. +
  76. + leds {
  77. + compatible = "gpio-leds";
  78. +
  79. + led_sys: sys {
  80. + label = "green:sys";
  81. + gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
  82. + };
  83. +
  84. + usb {
  85. + label = "blue:usb";
  86. + gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
  87. + trigger-sources = <&xhci_ehci_port1>;
  88. + linux,default-trigger = "usbport";
  89. + };
  90. + };
  91. +
  92. + keys {
  93. + compatible = "gpio-keys";
  94. +
  95. + reset {
  96. + label = "reset";
  97. + gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
  98. + linux,code = <KEY_RESTART>;
  99. + };
  100. + };
  101. +
  102. + gpio_export {
  103. + compatible = "gpio-export";
  104. + #size-cells = <0>;
  105. +
  106. + power_peripheral {
  107. + gpio-export,name = "power_peripheral";
  108. + gpio-export,output = <0>;
  109. + gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
  110. + };
  111. + };
  112. +
  113. + cpu_fan: cpu_fan {
  114. + compatible = "gpio-fan";
  115. + gpios = <&gpio 13 GPIO_ACTIVE_HIGH
  116. + &gpio 14 GPIO_ACTIVE_HIGH>;
  117. + gpio-fan,speed-map = < 0 0
  118. + 2000 1
  119. + 4000 2
  120. + 6000 3>;
  121. + #cooling-cells = <2>;
  122. + };
  123. +
  124. + thermal-zones {
  125. + cpu-thermal {
  126. + polling-delay = <1000>;
  127. + polling-delay-passive = <250>;
  128. +
  129. + thermal-sensors = <&cpu_sensor>;
  130. +
  131. + trips {
  132. + cpu_warm: cpu-warm {
  133. + temperature = <26000>;
  134. + hysteresis = <2000>;
  135. + type = "passive";
  136. + };
  137. +
  138. + cpu_hot: cpu-hot {
  139. + temperature = <37000>;
  140. + hysteresis = <2000>;
  141. + type = "active";
  142. + };
  143. +
  144. + cpu_alert: cpu-alert {
  145. + temperature = <75000>;
  146. + hysteresis = <2000>;
  147. + type = "hot";
  148. + };
  149. + };
  150. +
  151. + cooling-maps {
  152. + map0 {
  153. + trip = <&cpu_warm>;
  154. + cooling-device = <&cpu_fan THERMAL_NO_LIMIT 2>;
  155. + };
  156. +
  157. + map1 {
  158. + trip = <&cpu_hot>;
  159. + cooling-device = <&cpu_fan 3 THERMAL_NO_LIMIT>;
  160. + };
  161. + };
  162. + };
  163. + };
  164. +
  165. + crypto: crypto@1e004000 {
  166. + status = "okay";
  167. +
  168. + compatible = "mediatek,mtk-eip93";
  169. + reg = <0x1e004000 0x1000>;
  170. +
  171. + interrupt-parent = <&gic>;
  172. + interrupts = <GIC_SHARED 19 IRQ_TYPE_LEVEL_HIGH>;
  173. + };
  174. +
  175. + i2c_gpio: i2c-gpio {
  176. + compatible = "i2c-gpio";
  177. +
  178. + sda-gpios = <&gpio 3 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
  179. + scl-gpios = <&gpio 4 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
  180. +
  181. + #address-cells = <1>;
  182. + #size-cells = <0>;
  183. +
  184. + status = "disabled";
  185. + };
  186. +
  187. + i2c_sfp: i2c-sfp {
  188. + compatible = "i2c-gpio";
  189. +
  190. + sda-gpios = <&expender0 1 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
  191. + scl-gpios = <&expender0 2 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
  192. +
  193. + #address-cells = <1>;
  194. + #size-cells = <0>;
  195. + };
  196. +
  197. + i2c_sfp_alias_0: i2c-sfp-alias-0 {
  198. + compatible = "i2c-gpio";
  199. +
  200. + sda-gpios = <&expender0_alias_0 1 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
  201. + scl-gpios = <&expender0_alias_0 2 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
  202. +
  203. + #address-cells = <1>;
  204. + #size-cells = <0>;
  205. + };
  206. +
  207. + sfp: sfp {
  208. + compatible = "sff,sfp";
  209. + i2c-bus = <&i2c_sfp>;
  210. +
  211. + maximum-power-milliwatt = <5000>;
  212. +
  213. + mod-def0-gpios = <&expender0 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
  214. +
  215. + // los-gpios = <&expender0 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
  216. + // rate-select0-gpios = <&expender0 4 GPIO_ACTIVE_HIGH>;
  217. + // tx-disable-gpios = <&expender0 6 GPIO_ACTIVE_HIGH>;
  218. + // tx-fault-gpios = <&expender0 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
  219. + };
  220. +
  221. + sfp_alias_0: sfp-alias-0 {
  222. + compatible = "sff,sfp";
  223. + i2c-bus = <&i2c_sfp_alias_0>;
  224. +
  225. + maximum-power-milliwatt = <5000>;
  226. +
  227. + mod-def0-gpios = <&expender0_alias_0 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
  228. +
  229. + // los-gpios = <&expender0_alias_0 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
  230. + // rate-select0-gpios = <&expender0_alias_0 4 GPIO_ACTIVE_HIGH>;
  231. + // tx-disable-gpios = <&expender0_alias_0 6 GPIO_ACTIVE_HIGH>;
  232. + // tx-fault-gpios = <&expender0_alias_0 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
  233. + };
  234. +};
  235. +
  236. +&spi0 {
  237. + status = "okay";
  238. +
  239. + spi-nor@0 {
  240. + compatible = "jedec,spi-nor";
  241. + reg = <0>;
  242. + spi-max-frequency = <30000000>;
  243. +
  244. + partitions@0 {
  245. + compatible = "fixed-partitions";
  246. + #address-cells = <1>;
  247. + #size-cells = <1>;
  248. +
  249. + partition@0 {
  250. + label = "u-boot";
  251. + reg = <0x0 0x70000>;
  252. + read-only;
  253. + };
  254. +
  255. + partition@70000 {
  256. + label = "u-boot-env";
  257. + reg = <0x70000 0x8000>;
  258. + };
  259. +
  260. + factory: partition@78000 {
  261. + label = "factory";
  262. + reg = <0x78000 0x8000>;
  263. + };
  264. + };
  265. + };
  266. +
  267. + spi-nand@1 {
  268. + #address-cells = <1>;
  269. + #size-cells = <1>;
  270. + compatible = "spi-nand";
  271. + reg = <1>;
  272. + spi-max-frequency = <30000000>;
  273. +
  274. + partition@0 {
  275. + label = "nand0-ubi";
  276. + reg = <0x0 0x0>;
  277. + };
  278. + };
  279. +};
  280. +
  281. +&uartlite2 {
  282. + status = "okay";
  283. +};
  284. +
  285. +&uartlite3 {
  286. + status = "okay";
  287. +};
  288. +
  289. +&state_default {
  290. + gpio {
  291. + groups = "wdt", "jtag", "i2c";
  292. + function = "gpio";
  293. + };
  294. +};
  295. +
  296. +&pcie {
  297. + status = "okay";
  298. +};
  299. +
  300. +&pcie0 {
  301. + mt76@0,0 {
  302. + reg = <0x0000 0 0 0 0>;
  303. + mediatek,eeprom-file = "mt76.pcie0.eeprom";
  304. + };
  305. +};
  306. +
  307. +&pcie1 {
  308. + mt76@0,0 {
  309. + reg = <0x0000 0 0 0 0>;
  310. + mediatek,eeprom-file = "mt76.pcie1.eeprom";
  311. + };
  312. +};
  313. +
  314. +&pcie2 {
  315. + mt76@0,0 {
  316. + reg = <0x0000 0 0 0 0>;
  317. + mediatek,eeprom-file = "mt76.pcie2.eeprom";
  318. + };
  319. +};
  320. +
  321. +&sdhci {
  322. + status = "okay";
  323. + max-frequency = <20000000>;
  324. +};
  325. +
  326. +&mdio {
  327. + ephy7: ethernet-phy@7 {
  328. + reg = <7>;
  329. + eee-broken-1000t;
  330. + eee-broken-100tx;
  331. + realtek,autotxid;
  332. + };
  333. +};
  334. +
  335. +&gmac0 {
  336. + label = "dsa0";
  337. + nvmem-cells = <&macaddr_factory_0>;
  338. + nvmem-cell-names = "mac-address";
  339. + phy-mode = "trgmii";
  340. +};
  341. +
  342. +&gmac1 {
  343. + status = "okay";
  344. + label = "eth5";
  345. +
  346. + nvmem-cells = <&macaddr_factory_0>;
  347. + nvmem-cell-names = "mac-address";
  348. + mac-address-increment = <6>;
  349. +
  350. + phy-handle = <&ephy7>;
  351. + phy-mode = "rgmii-rxid";
  352. +};
  353. +
  354. +&switch0 {
  355. + ports {
  356. + port@0 {
  357. + status = "okay";
  358. + label = "eth0";
  359. + nvmem-cells = <&macaddr_factory_0>;
  360. + nvmem-cell-names = "mac-address";
  361. + mac-address-increment = <1>;
  362. + };
  363. +
  364. + port@1 {
  365. + status = "okay";
  366. + label = "eth1";
  367. + nvmem-cells = <&macaddr_factory_0>;
  368. + nvmem-cell-names = "mac-address";
  369. + mac-address-increment = <2>;
  370. + };
  371. +
  372. + port@2 {
  373. + status = "okay";
  374. + label = "eth2";
  375. + nvmem-cells = <&macaddr_factory_0>;
  376. + nvmem-cell-names = "mac-address";
  377. + mac-address-increment = <3>;
  378. + };
  379. +
  380. + port@3 {
  381. + status = "okay";
  382. + label = "eth3";
  383. + nvmem-cells = <&macaddr_factory_0>;
  384. + nvmem-cell-names = "mac-address";
  385. + mac-address-increment = <4>;
  386. + };
  387. +
  388. + port@4 {
  389. + status = "okay";
  390. + label = "eth4";
  391. + nvmem-cells = <&macaddr_factory_0>;
  392. + nvmem-cell-names = "mac-address";
  393. + mac-address-increment = <5>;
  394. + };
  395. + };
  396. +};
  397. +
  398. +&i2c_gpio {
  399. + status = "okay";
  400. +
  401. + expender0: pcf8574a@38 {
  402. + compatible = "nxp,pcf8574a";
  403. + reg = <0x38>;
  404. + interrupt-parent = <&gpio>;
  405. + interrupts = <15 IRQ_TYPE_EDGE_FALLING>;
  406. + gpio-controller;
  407. + #gpio-cells = <2>;
  408. + interrupt-controller;
  409. + #interrupt-cells = <2>;
  410. + };
  411. +
  412. + expender0_alias_0: pcf8574@20 {
  413. + compatible = "nxp,pcf8574";
  414. + reg = <0x20>;
  415. + interrupt-parent = <&gpio>;
  416. + interrupts = <15 IRQ_TYPE_EDGE_FALLING>;
  417. + gpio-controller;
  418. + #gpio-cells = <2>;
  419. + interrupt-controller;
  420. + #interrupt-cells = <2>;
  421. + };
  422. +
  423. + rtc0: pcf8563@51 {
  424. + compatible = "nxp,pcf8563";
  425. + reg = <0x51>;
  426. + };
  427. +
  428. + cpu_sensor: lm75@4f {
  429. + compatible = "national,lm75";
  430. + reg = <0x4f>;
  431. + #thermal-sensor-cells = <0>;
  432. + };
  433. +};
  434. +
  435. +&factory {
  436. + compatible = "nvmem-cells";
  437. + #address-cells = <1>;
  438. + #size-cells = <1>;
  439. + #mtd-mac-address = <&factory 0x0>;
  440. +
  441. + macaddr_factory_0: macaddr@0 {
  442. + reg = <0x0 0x6>;
  443. + };
  444. +};
  445. diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
  446. index d456176a0178e..0f81321a52248 100644
  447. --- a/target/linux/ramips/image/mt7621.mk
  448. +++ b/target/linux/ramips/image/mt7621.mk
  449. @@ -42,6 +42,20 @@ define Build/haier-sim_wr1800k-factory
  450. rm -rf "[email protected]" "[email protected]"
  451. endef
  452. +define Build/hatlab-gateboard-combined
  453. + rm -fR [email protected]
  454. +
  455. + mkfs.fat [email protected] -C 16384
  456. + mcopy -i [email protected] $(IMAGE_KERNEL) ::vmlinux.itb
  457. +
  458. + PADDING="1" SIGNATURE="$(IMG_PART_SIGNATURE)" \
  459. + GUID="$(IMG_PART_DISKGUID)" $(SCRIPT_DIR)/gen_image_generic.sh \
  460. + $@ \
  461. + $(CONFIG_TARGET_KERNEL_PARTSIZE) [email protected] \
  462. + $(CONFIG_TARGET_ROOTFS_PARTSIZE) $(IMAGE_ROOTFS) \
  463. + 256
  464. +endef
  465. +
  466. define Build/iodata-mstc-header
  467. ( \
  468. data_size_crc="$$(dd if=$@ ibs=64 skip=1 2>/dev/null | gzip -c | \
  469. @@ -1123,6 +1137,28 @@ define Device/haier_har-20s2u1
  470. endef
  471. TARGET_DEVICES += haier_har-20s2u1
  472. +define Device/hatlab_gateboard-one
  473. + $(Device/dsa-migration)
  474. + DEVICE_VENDOR := HATLab
  475. + DEVICE_MODEL := GateBoard-One
  476. + DEVICE_PACKAGES := kmod-i2c-gpio kmod-gpio-pcf857x kmod-sdhci-mt7620 kmod-usb3 kmod-usb-storage kmod-usb-ledtrig-usbport kmod-fs-ext4 kmod-hwmon-lm75 kmod-thermal kmod-hwmon-gpiofan kmod-rtc-pcf8563 kmod-phy-realtek kmod-sfp
  477. + MKUBIFS_OPTS := -m 2048 -e 124KiB -c 1024
  478. + KERNEL := kernel-bin | gzip | fit gzip $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
  479. + IMAGE/kernel.itb := append-kernel
  480. + IMAGE/rootfs.img := append-rootfs
  481. + IMAGE/rootfs.img.gz := append-rootfs | gzip
  482. + IMAGE/combined.img := hatlab-gateboard-combined | append-metadata
  483. + IMAGE/combined.img.gz := hatlab-gateboard-combined | gzip | append-metadata
  484. + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
  485. + IMAGES := kernel.itb sysupgrade.bin
  486. + ifeq ($(CONFIG_TARGET_IMAGES_GZIP),y)
  487. + IMAGES += rootfs.img.gz combined.img.gz
  488. + else
  489. + IMAGES += rootfs.img combined.img
  490. + endif
  491. +endef
  492. +TARGET_DEVICES += hatlab_gateboard-one
  493. +
  494. define Device/hilink_hlk-7621a-evb
  495. $(Device/dsa-migration)
  496. $(Device/uimage-lzma-loader)
  497. diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
  498. index 4b23afc1cf291..dca281172348f 100644
  499. --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
  500. +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network
  501. @@ -150,6 +150,9 @@ ramips_setup_interfaces()
  502. meig,slt866)
  503. ucidef_set_interfaces_lan_wan "lan" "wan"
  504. ;;
  505. + hatlab,gateboard-one)
  506. + ucidef_set_interfaces_lan_wan "eth0 eth1 eth2 eth3 eth4" "eth5"
  507. + ;;
  508. *)
  509. ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
  510. ;;
  511. diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
  512. index 5d8305b788cce..b38fe16145ad9 100755
  513. --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
  514. +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
  515. @@ -160,6 +160,12 @@ platform_do_upgrade() {
  516. ;;
  517. zyxel,wsm20)
  518. zyxel_mstc_upgrade_prepare
  519. + nand_do_upgrade "$1"
  520. + ;;
  521. + hatlab,gateboard-one)
  522. + CI_KERNPART="vmlinux.itb"
  523. + CI_UBIPART="nand0-ubi"
  524. +
  525. nand_do_upgrade "$1"
  526. ;;
  527. *)
  528. diff --git a/target/linux/ramips/mt7621/base-files/sbin/fixup-mac-address b/target/linux/ramips/mt7621/base-files/sbin/fixup-mac-address
  529. index dad15c584216d..375db51647b70 100755
  530. --- a/target/linux/ramips/mt7621/base-files/sbin/fixup-mac-address
  531. +++ b/target/linux/ramips/mt7621/base-files/sbin/fixup-mac-address
  532. @@ -13,6 +13,10 @@ case $board in
  533. partname=factory
  534. offset=$((0xe000))
  535. ;;
  536. + hatlab,gateboard-one)
  537. + partname=factory
  538. + offset=$((0x0))
  539. + ;;
  540. *)
  541. echo "Unsupported board"
  542. exit 1
  543. diff --git a/target/linux/ramips/mt7621/config-5.15 b/target/linux/ramips/mt7621/config-5.15
  544. index 05e4c1ce87799..b93159ed079ef 100644
  545. --- a/target/linux/ramips/mt7621/config-5.15
  546. +++ b/target/linux/ramips/mt7621/config-5.15
  547. @@ -156,6 +156,7 @@ CONFIG_MTD_PHYSMAP=y
  548. CONFIG_MTD_RAW_NAND=y
  549. CONFIG_MTD_ROUTERBOOT_PARTS=y
  550. CONFIG_MTD_SERCOMM_PARTS=y
  551. +CONFIG_MTD_SPI_NAND=y
  552. CONFIG_MTD_SPI_NOR=y
  553. CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE=y
  554. CONFIG_MTD_SPLIT_FIT_FW=y
  555. diff --git a/target/linux/ramips/patches-5.15/406-mtd-spi-nor-Add-support-for-Puya-p25d40h.patch b/target/linux/ramips/patches-5.15/406-mtd-spi-nor-Add-support-for-Puya-p25d40h.patch
  556. new file mode 100644
  557. index 0000000000000..88ae591fca963
  558. --- /dev/null
  559. +++ b/target/linux/ramips/patches-5.15/406-mtd-spi-nor-Add-support-for-Puya-p25d40h.patch
  560. @@ -0,0 +1,47 @@
  561. +--- a/drivers/mtd/spi-nor/Makefile
  562. ++++ b/drivers/mtd/spi-nor/Makefile
  563. +@@ -12,6 +12,7 @@ spi-nor-objs += intel.o
  564. + spi-nor-objs += issi.o
  565. + spi-nor-objs += macronix.o
  566. + spi-nor-objs += micron-st.o
  567. ++spi-nor-objs += puya.o
  568. + spi-nor-objs += spansion.o
  569. + spi-nor-objs += sst.o
  570. + spi-nor-objs += winbond.o
  571. +--- /dev/null
  572. ++++ b/drivers/mtd/spi-nor/puya.c
  573. +@@ -0,0 +1,14 @@
  574. ++#include <linux/mtd/spi-nor.h>
  575. ++
  576. ++#include "core.h"
  577. ++
  578. ++static const struct flash_info puya_parts[] = {
  579. ++ /* PUYA */
  580. ++ { "p25d40h", INFO(0x856013, 0, 64 * 1024, 8, SECT_4K) },
  581. ++};
  582. ++
  583. ++const struct spi_nor_manufacturer spi_nor_puya = {
  584. ++ .name = "puya",
  585. ++ .parts = puya_parts,
  586. ++ .nparts = ARRAY_SIZE(puya_parts),
  587. ++};
  588. +--- a/drivers/mtd/spi-nor/core.c
  589. ++++ b/drivers/mtd/spi-nor/core.c
  590. +@@ -1852,6 +1852,7 @@ static const struct spi_nor_manufacturer
  591. + &spi_nor_issi,
  592. + &spi_nor_macronix,
  593. + &spi_nor_micron,
  594. ++ &spi_nor_puya,
  595. + &spi_nor_st,
  596. + &spi_nor_spansion,
  597. + &spi_nor_sst,
  598. +--- a/drivers/mtd/spi-nor/core.h
  599. ++++ b/drivers/mtd/spi-nor/core.h
  600. +@@ -483,6 +483,7 @@ extern const struct spi_nor_manufacturer
  601. + extern const struct spi_nor_manufacturer spi_nor_issi;
  602. + extern const struct spi_nor_manufacturer spi_nor_macronix;
  603. + extern const struct spi_nor_manufacturer spi_nor_micron;
  604. ++extern const struct spi_nor_manufacturer spi_nor_puya;
  605. + extern const struct spi_nor_manufacturer spi_nor_st;
  606. + extern const struct spi_nor_manufacturer spi_nor_spansion;
  607. + extern const struct spi_nor_manufacturer spi_nor_sst;