Commit Graph

16 Commits

Author SHA1 Message Date
Shiji Yang
01996b785d ramips: clean up useless dts partition labels
The previous NVMEM eeprom conversions[1][2] left a lot of partition
labels that were no longer used. They can be removed now.

[1] https://github.com/openwrt/openwrt/pull/13584
[2] https://github.com/openwrt/openwrt/pull/13587

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
2024-02-21 13:31:18 +01:00
Christian Marangi
19c45b95db
ramips: convert to new LED color/function format where possible
Initial conversion to new LED color/function format
and drop label format where possible. The same label
is composed at runtime.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-02-07 14:48:43 +01:00
Rosen Penev
0a1d15642f
ramips: mt7628: use nvmem-layout
Will allow using mac-base.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-11-25 23:58:40 +01:00
Shiji Yang
f53fa2a0cb
ramips: convert mt76 PCIe NIC EEPROM to NVMEM format for legacy SoCs
This patch converts MT761{0,2,3} PCIe WiFi calibration data to NVMEM
format for legacy Ralink SoCs (MT7620 and Mt7628). The EEPROM size of
the MT7610 and MT7612 is 0x200. there are only three devices uses
MT7613 NIC, ASUS RT-AC1200 V2, COMFAST CF-WR758AC V2 and Keenetic
KN-1613. The EEPROM size of them is 0x4da8.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
2023-10-17 12:07:27 +02:00
Shiji Yang
e93f41adee
ramips: convert MT7628 EEPROM to NVMEM format
This patch converts MT7628 WiFi calibration data to NVMEM format. The
EEPROM size is 0x400.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
2023-10-17 12:07:26 +02:00
INAGAKI Hiroshi
f7f9e6bd20 ramips: use parser_trx for Buffalo WCR-1166DS
Buffalo WCR-1166DS uses trx-fomatted firmware and the custom magic
number (0x5C436F74, "\Cot") is required for OpenWrt installation from
OEM WebUI.
But the current mtdsplit_trx doesn't support the custom magic number and
fail to parse and split to kernel and rootfs when the factory image is
flashed. Then, the kernel fails to mount rootfs automatically and panics.

Before the commit fddc78bc11, mtdsplit_trx
was patched in ramips target and the device-specific magic number was
supported only for WCR-1166DS[1].
But the patch was not inherited to the later version of the kernel and
deleted by the above commit, then, the custom magic number support was
broken.

[1]: 05d6e92594/target/linux/ramips/patches-4.4/0400-mtd-mtdsplit-add-support-for-custom-trx-magic-for-Buffalo-WCR-1166DS.patch (L27)

log (factory image):

[    1.165312] spi-mt7621 10000b00.spi: sys_freq: 193333333
[    1.195782] spi-nor spi0.0: w25q128 (16384 Kbytes)
[    1.205353] 7 fixed-partitions partitions found on MTD device spi0.0
[    1.217938] Creating 7 MTD partitions on "spi0.0":
[    1.227436] 0x000000000000-0x000000030000 : "u-boot"
[    1.238427] 0x000000030000-0x000000040000 : "u-boot-env"
[    1.250123] 0x000000040000-0x000000050000 : "factory"
[    1.261306] 0x000000050000-0x000000810000 : "firmware"
[    1.282051] 0x000000810000-0x000000fd0000 : "firmware2"
[    1.293594] 0x000000fd0000-0x000000fe0000 : "glbcfg"
[    1.304719] 0x000000fe0000-0x000000ff0000 : "board_data"
...
[    1.452424] /dev/root: Can't open blockdev
[    1.460619] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[    1.475434] Please append a correct "root=" boot option; here are the available partitions:
[    1.491986] 1f00             192 mtdblock0
[    1.491989]  (driver?)
[    1.504938] 1f01              64 mtdblock1
[    1.504941]  (driver?)
[    1.517885] 1f02              64 mtdblock2
[    1.517888]  (driver?)
[    1.530831] 1f03            7936 mtdblock3
[    1.530834]  (driver?)
[    1.543777] 1f04            7936 mtdblock4
[    1.543781]  (driver?)
[    1.556724] 1f05              64 mtdblock5
[    1.556727]  (driver?)
[    1.569672] 1f06              64 mtdblock6
[    1.569675]  (driver?)
[    1.582617] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    1.598976] Rebooting in 1 seconds..

This patch fixes this issue by using parser_trx with specifying custom
magic number in dts instead of mtdsplit_trx.

log (fixed factory image):

[    1.202044] spi-mt7621 10000b00.spi: sys_freq: 193333333
[    1.225369] spi-nor spi0.0: w25q128 (16384 Kbytes)
[    1.235015] 7 fixed-partitions partitions found on MTD device spi0.0
[    1.247603] Creating 7 MTD partitions on "spi0.0":
[    1.257106] 0x000000000000-0x000000030000 : "u-boot"
[    1.269447] 0x000000030000-0x000000040000 : "u-boot-env"
[    1.281192] 0x000000040000-0x000000050000 : "factory"
[    1.294208] 0x000000050000-0x000000810000 : "firmware"
[    1.305774] 2 trx partitions found on MTD device firmware
[    1.316540] Creating 2 MTD partitions on "firmware":
[    1.326399] 0x00000000001c-0x000000214754 : "linux"
[    1.336063] mtd: partition "linux" doesn't start on an erase/write block boundary -- force read-only
[    1.357070] 0x000000214754-0x0000007c0000 : "rootfs"
[    1.366994] mtd: partition "rootfs" doesn't start on an erase/write block boundary -- force read-only
[    1.386368] mtd: device 5 (rootfs) set to be root filesystem
[    1.398700] 1 squashfs-split partitions found on MTD device rootfs
[    1.411027] 0x000000520000-0x0000007c0000 : "rootfs_data"
[    1.422841] 0x000000810000-0x000000fd0000 : "firmware2"
[    1.436282] 0x000000fd0000-0x000000fe0000 : "glbcfg"
[    1.447408] 0x000000fe0000-0x000000ff0000 : "board_data"
...
[    1.611216] VFS: Mounted root (squashfs filesystem) readonly on device 31:5.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2022-03-06 20:40:35 +01:00
INAGAKI Hiroshi
621d88d741 ramips: increase spi frequency for Buffalo WCR-1166DS
Use higher frequency than current and up the speed to access to the
flash on WCR-1166DS.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
2022-03-06 20:05:45 +01:00
Adrian Schmutzler
ad6b077049 ramips: mt7628: move mtd-eeprom out of root DTSI
The mt76x8 subtarget is the only one in ramips that stores the
mediatek,mtd-eeprom property directly in the "root" mt7628an.dtsi.

This is not optimal for a few different reasons:

 * If you don't really know it or are used to other (sub)targets,
   the property will be set somewhat magically.
 * The property is set based on &factory partition before (if at all)
   this partition is defined.
 * There are several devices that have different offset or even
   different partitions to read from, which will then be overwritten
   in the DTS files. Thus, definitions are scattered between root
   DTSI and individual files.

Based on these circumstances, the "root" definition is removed and
the property is added to the device-based DTS(I) files where needed
and applicable. This should be easier to grasp for unexperienced
developers and will move the property closer to the partition
definitions.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-08-17 18:41:17 +02:00
Adrian Schmutzler
c846dd91f0 ramips: remove model name from LED labels
Like in the previous patch for ath79 target, this will remove the
"devicename" from LED labels in ramips as well.

The devicename is removed in DTS files and 01_leds, consolidation
of definitions into DTSI files is done where (easily) possible,
and migration scripts are updated.

For the latter, all existing definitions were actually just
devicename migrations anyway. Therefore, those are removed and
a common migration file is created in target base-files. This is
actually another example of how the devicename removal makes things
easier.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-02 14:51:57 +02:00
Adrian Schmutzler
621297e867 ramips: move dts-v1 statement to top-level DTSI files
The "/dts-v1/;" identifier is supposed to be present once at the
top of a device tree file after the includes have been processed.

In ramips, we therefore requested to have in the DTS files so far,
and omit it in the DTSI files. However, essentially the syntax of
the parent mtxxxx/rtxxxx DTSI files already determines the DTS
version, so putting it into the DTS files is just a useless repetition.

Consequently, this patch puts the dts-v1 statement into the top-level
SoC-based DTSI files, and removes all other occurences.
Since the dts-v1 statement needs to be before any other definitions,
this also moves the includes accordingly where necessary.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-09-25 23:26:40 +02:00
Sungbo Eo
1eceab3fc0 ramips: dts: use generic node name for flash
In DTS Checklist[1] we're now demanding proper generic node names, as
the name of a node should reflect the function of the device and use
generic name for that[2]. Everybody seems to be copy&pasting from DTS
files available in the repository today, so let's unify that naming
there as well and provide proper examples.

While at it, remove unused m25p80 label.

Tested on rt5350 (for spi-nor) and rt3662 (for cfi-flash).

1. https://openwrt.org/submitting-patches#dts_checklist
2. https://github.com/devicetree-org/devicetree-specification/blob/master/source/devicetree-basics.rst#generic-names-recommendation

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2020-05-09 14:48:50 +02:00
Chuanhong Guo
b756ea2a90 ramips: replace pinctrl property names
Upstream pinctrl driver in drivers/staging uses
groups/function/ralink,num-gpios instead of
ralink,group/ralink,function/ralink,nr-gpio
Replace these properties in dts as well as the pinctrl driver in
patches-4.14.
This commit is created using:
sed -i 's/ralink,group/groups/g'
sed -i 's/ralink,function/function/g'
sed -i 's/ralink,nr-gpio/ralink,num-gpios/g'

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
2020-04-12 22:29:17 +08:00
Chuanhong Guo
0b68d081eb ramips: mt7628: update dts for upstream gpio-mt7621 driver
upstream driver merged 3 separated gpio banks into one gpio node.
and gpioX Y in our local driver should be replaced with gpio X*32+Y.

This patch is created using the following sed command:
sed -i -r 's/(.*)gpio([0-9]) ([0-9]+)(.*)/echo "\1gpio $((\2*32+\3))\4"/ge'

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
2020-04-12 22:27:18 +08:00
Adrian Schmutzler
e4ce3109f2 ramips: simplify state_default/pinctrl0 in device DTS files
The node pinctrl0 is already set up in the SOC DTSI files, but
defined again as member of pinctrl in most of the device DTS(I)
files. This patch removes this redundancy for the entire ramips
target.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2019-12-23 02:24:55 +01:00
Adrian Schmutzler
556ff09875 ramips/mt762x: convert devices to interrupt-driven gpio-keys
This converts all remaining devices to use interrupt-driven
gpio-keys compatible instead of gpio-keys-polled.
The poll-interval is removed.

While at it, add/remove newlines in keys and leds node where
necessary.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2019-10-21 14:19:32 +02:00
Adrian Schmutzler
b97a99256f ramips/mt76x8: Name DTS files based on scheme
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2019-07-10 17:36:29 +02:00