9 Commits
Author SHA1 Message Date
Bartosz Golaszewski 8feae54f72 gpio: loongson1: allow building the module with COMPILE_TEST enabled
Increase build coverage by allowing the module to be built with
COMPILE_TEST=y.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250910-gpio-mmio-gpio-conv-part4-v2-1-f3d1a4c57124@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: maoxiaochuan <maoxiaochuan@loongson.cn>
2026-02-04 16:41:12 +08:00
Binbin Zhou ea41b4ca13 gpio: loongson-64bit: Extend GPIO irq support
Add the interrupt enable register offset (inten_offset) so that GPIO
interrupts can be enabled normally on more models.

According to the latest interface specifications, the definition of GPIO
interrupts in ACPI is similar to that in FDT. The GPIO interrupts are
listed one by one according to the GPIO number, and the corresponding
interrupt number can be obtained directly through the GPIO number
specified by the consumer.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Link: https://lore.kernel.org/r/20250714064542.2276247-1-zhoubinbin@loongson.cn
[Bartosz: tweaked the commit message]
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: maoxiaochuan <maoxiaochuan@loongson.cn>
2026-02-04 16:41:05 +08:00
maoxiaochuan d9fafb4da9 gpio:fix crash when irq map fail
[    1.112617] Warning: unable to open an initial console.
[    1.128648] Waiting for root device /dev/mmcblk0p1...
[   11.439784] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
[   11.449431] gpio-lsirq 16104000.gpio: IRQ Pin Map fail
[   11.459605] gpio-lsirq 16104000.gpio: probe with driver gpio-lsirq failed with error -1
[   11.467761] Unhandled kernel unaligned access[#1]:
[   11.472606] CPU: 0 UID: 0 PID: 79 Comm: kworker/u4:2 Not tainted 6.12.0.lsgd #1
[   11.479994] Hardware name: Loongson LS2K300/LS2K300-PAI, BIOS 2022.04-v2.0.0-00572-gfaaca55a 04/01/2022
[   11.489483] Workqueue: events_unbound deferred_probe_work_func
[   11.495394] pc 90000000008683a8 ra 9000000000868398 tp 9000000006954000 sp 9000000006957b60
[   11.503832] a0 9000000001860338 a1 90000000066a0230 a2 9000000006957b98 a3 0000000000000004
[   11.512267] a4 00000000000000b4 a5 0000000000000040 a6 0000000000000000 a7 9000000006018410
[   11.520703] t0 0000000000000122 t1 9000000001860240 t2 90000000068b2f40 t3 0000000000000000
[   11.529137] t4 900000000618a658 t5 900000000618a658 t6 90000000009f0eb4 t7 90000000009f1154
[   11.537571] t8 0000000000000000 u0 006f6970672e3030 s9 90000000066ce500 s0 9000000006c1d440
[   11.546005] s1 9000000006c1e400 s2 9000000001860240 s3 9000000001860338 s4 0000000000000003
[   11.554440] s5 90000000013ea000 s6 90000000066ce4c0 s7 90000000013f2000 s8 90000000060e5e80
[   11.562874]    ra: 9000000000868398 gpiochip_remove+0x44/0xd4
[   11.568693]   ERA: 90000000008683a8 gpiochip_remove+0x54/0xd4
[   11.574504]  CRMD: 000000b0 (PLV0 -IE -DA +PG DACF=CC DACM=CC -WE)
[   11.580774]  PRMD: 00000004 (PPLV0 +PIE -PWE)
[   11.585182]  EUEN: 00000000 (-FPE -SXE -ASXE -BTE)
[   11.590033]  ECFG: 00071c1d (LIE=0,2-4,10-12 VS=7)
[   11.594882] ESTAT: 00090000 [ALE] (IS= ECode=9 EsubCode=0)
[   11.600428]  BADV: 0000000000000122
[   11.603946]  PRID: 0014a030 (Loongson-64bit, )
[   11.608431] Modules linked in:
[   11.611512] Process kworker/u4:2 (pid: 79, threadinfo=(____ptrval____), task=(____ptrval____))
[   11.620213] Stack : 9000000006196ca0 9000000006957b98 900000000618a410 90000000066d7b40
[   11.628313]         90000000066a0200 90000000009f276c 90000000013ea000 90000000066d7420
[   11.636412]         90000000066a0200 db47c55fde642c00 90000000013ea000 90000000009ec89c
[   11.644510]         90000000013ea000 0000000000000000 9000000001860e00 0000000000000001
[   11.652608]         900000000618a410 90000000009ebae8 900000000618a410 90000000009ec3e8
[   11.660707]         900000000618a410 0000000000000003 900000000618a410 9000000001860e00
[   11.668805]         900000000618a410 90000000009ec63c 900000000618a410 9000000001860e00
[   11.676904]         9000000001c91e18 90000000009ec7fc 9000000001860e00 900000000618a410
[   11.685002]         9000000006957d18 9000000001860e00 0000000000000001 90000000009ec968
[   11.693100]         90000000013ea000 9000000006957d18 900000000608f800 9000000006957cb8
[   11.701199]         ...
[   11.703668] Call Trace:
[   11.703675] [<90000000008683a8>] gpiochip_remove+0x54/0xd4
[   11.711688] [<90000000009f2768>] devres_release_all+0xb4/0x12c
[   11.717594] [<90000000009ebae4>] device_unbind_cleanup+0x10/0x5c
[   11.723667] [<90000000009ec3e4>] really_probe+0x1e0/0x3ac
[   11.729126] [<90000000009ec638>] __driver_probe_device+0x88/0x160
[   11.735285] [<90000000009ec7f8>] driver_probe_device+0x34/0xd8
[   11.741181] [<90000000009ec964>] __device_attach_driver+0xc8/0x178
[   11.747430] [<90000000009e9d7c>] bus_for_each_drv+0x8c/0xf0
[   11.753073] [<90000000009ecda8>] __device_attach+0xa4/0x1b4
[   11.758705] [<90000000009eaf60>] bus_probe_device+0xa8/0xd0
[   11.764339] [<90000000009eb5f4>] deferred_probe_work_func+0x9c/0xf0
[   11.770674] [<9000000000259084>] process_one_work+0x178/0x2f4
[   11.776492] [<9000000000259fa0>] worker_thread+0x390/0x4c8
[   11.782041] [<9000000000261028>] kthread+0x104/0x114
[   11.787066] [<9000000000f1c764>] ret_from_kernel_thread+0x28/0x48
[   11.793229] [<9000000000221024>] ret_from_kernel_thread_asm+0xc/0x88
[   11.799654]
[   11.801153] Code: 28cd630c  00150344  29c021ac <2700018d> 0284880c  29cd630c  5789441a  02c04324  56f96fe8
[   11.811031]
[   11.812564] ---[ end trace 0000000000000000 ]---
[  119.451577] random: crng init done
2025-11-20 16:59:02 +08:00
Binbin Zhou 9eac290915 gpio: loongson-64bit: Correct Loongson-7A2000 ACPI GPIO access mode
According to the description of the Loongson-7A2000 ACPI GPIO register in
the manual, its access mode should be BIT_CTRL_MODE, otherwise there maybe
some unpredictable behavior.

Cc: stable@vger.kernel.org
Fixes: 44fe79020b91 ("gpio: loongson-64bit: Add more gpio chip support")
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Link: https://lore.kernel.org/r/20250610115926.347845-1-zhoubinbin@loongson.cn
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: maoxiaochuan <maoxiaochuan@loongson.cn>
2025-06-20 08:44:44 +08:00
Binbin Zhou 45e4bc304e gpio: loongson-64bit: Add more gpio chip support
The Loongson-7A2000 and Loongson-3A6000 share the same gpio chip model.
Just add them through driver_data.

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Acked-by: Huacai Chen <chenhuacai@loongson.cn>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250303074552.3335186-2-zhoubinbin@loongson.cn
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: maoxiaochuan <maoxiaochuan@loongson.cn>
2025-05-30 15:52:38 +08:00
Andy Shevchenko 7bd1154c2e gpio: loongson-64bit: Remove unneeded ngpio assignment
The GPIO library will parse the respective property to fill ngpio.
No need to repeat it in the driver.

While at it, drop unused fwnode field.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2025-03-26 12:55:15 +08:00
maoxiaochuan 7ffd18ab9d Update to 14fc3074cfe039
1. 添加带irq处理的gpio驱动
2. 龙芯2k系列添加mmc驱动支持
3. 添加看门狗驱动
4. dtb支持从command line中的board_name字段判断
5. 支持内存分布描述数据从固件传入的数据获取
6. 支持从bootcmdline获取ramdisk启动的地址和所用大小
7. 添加2k300的i2c总线驱动
8. 2k300使用新的spi 和 spi-io 驱动
9. CPU芯片温度传感器支持2k300的计算方式
10. 添加2k300的adc驱动
11. pwm: update default pwm freq to 50Mhz
12. loongson pwm 驱动支持dts使用clock-frequency形式声明频率
13. loongson pwm 确保disable时输出的电平为空闲电平
14. 2k300编译配置使能pwm leds功能
15. 2k300的gmac的phy-mode默认使用rgmii-id
16. 2k300先锋派设置YT8531的内部延迟
17. YT8531 phy 支持设置led的工作模式
18. LCD屏幕 支持cmdline的panel属性选择某一款板卡的dts配置,实现屏幕切换
19. 添加脚本用于快速选择板卡配置文件
20. 添加CAN驱动
21. 添加音频驱动
22. 优化OTG兼容性

Signed-off-by: maoxiaochuan <maoxiaochuan@loongson.cn>
2025-02-13 16:03:32 +08:00
Binbin Zhou b32fef8b74 gpio: loongson: Fix Loongson-2K2000 ACPI GPIO register offset
Since commit 3feb70a61740 ("gpio: loongson: add more gpio chip
support"), the Loongson-2K2000 GPIO is supported.

However, according to the firmware development specification, the
Loongson-2K2000 ACPI GPIO register offsets in the driver do not match
the register base addresses in the firmware, resulting in the registers
not being accessed properly.

Now, we fix it to ensure the GPIO function works properly.

Cc: stable@vger.kernel.org
Cc: Yinbo Zhu <zhuyinbo@loongson.cn>
Fixes: 3feb70a61740 ("gpio: loongson: add more gpio chip support")
Co-developed-by: Hongliang Wang <wanghongliang@loongson.cn>
Signed-off-by: Hongliang Wang <wanghongliang@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Link: https://lore.kernel.org/r/20250107103856.1037222-1-zhoubinbin@loongson.cn
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: maoxiaochuan <maoxiaochuan@loongson.cn>
2025-02-13 14:28:29 +08:00
maoxiaochuan 8b074cffbf init src (linux-6.12.0) 2025-02-13 14:11:16 +08:00