Hello Justin,
I am sorry, checkpatch drops some warnings, can you please fix them?
Thanks!
bye,
Heiko
[1] checkpatch warnings
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#233:
new file mode 100644
ERROR: Do not add common.h to files
#260: FILE: drivers/i2c/mt7621_i2c.c:23:
+#include <common.h>
CHECK: Prefer using the BIT macro
#281: FILE: drivers/i2c/mt7621_i2c.c:44:
+#define SM0CTL1_START (1 << 4)
ERROR: open brace '{' following struct go on the same line
#294: FILE: drivers/i2c/mt7621_i2c.c:57:
+struct mt7621_i2c_priv
+{
ERROR: trailing whitespace
#323: FILE: drivers/i2c/mt7621_i2c.c:86:
+^I$
ERROR: trailing whitespace
#327: FILE: drivers/i2c/mt7621_i2c.c:90:
+^I$
WARNING: Use of volatile is usually wrong: see
Documentation/process/volatile-considered-harmful.rst
#409: FILE: drivers/i2c/mt7621_i2c.c:172:
+ u32 status = *(volatile u32 *)(priv->base + REG_SM0CTL1);
ERROR: trailing whitespace
#415: FILE: drivers/i2c/mt7621_i2c.c:178:
+^I$
ERROR: trailing whitespace
#464: FILE: drivers/i2c/mt7621_i2c.c:227:
+^I^I$
ERROR: trailing whitespace
#468: FILE: drivers/i2c/mt7621_i2c.c:231:
+^I^I$
ERROR: trailing whitespace
#481: FILE: drivers/i2c/mt7621_i2c.c:244:
+^I$
ERROR: trailing whitespace
#484: FILE: drivers/i2c/mt7621_i2c.c:247:
+^I^I$
ERROR: trailing whitespace
#488: FILE: drivers/i2c/mt7621_i2c.c:251:
+^I^I$
ERROR: trailing whitespace
#492: FILE: drivers/i2c/mt7621_i2c.c:255:
+^I^I$
ERROR: trailing whitespace
#496: FILE: drivers/i2c/mt7621_i2c.c:259:
+^I^I$
ERROR: trailing whitespace
#500: FILE: drivers/i2c/mt7621_i2c.c:263:
+^I^I$
ERROR: trailing whitespace
#511: FILE: drivers/i2c/mt7621_i2c.c:274:
+^I$
ERROR: trailing whitespace
#519: FILE: drivers/i2c/mt7621_i2c.c:282:
+^I$
ERROR: trailing whitespace
#521: FILE: drivers/i2c/mt7621_i2c.c:284:
+^I$
ERROR: trailing whitespace
#546: FILE: drivers/i2c/mt7621_i2c.c:309:
+^I$
total: 17 errors, 2 warnings, 1 checks, 395 lines checked
On 27.10.25 05:49, Heiko Schocher wrote:
Hello Justin,
On 08.10.25 13:48, Justin Swartz wrote:
This commit introduces a port of the Linux kernel's driver for the
Mediatek's MT7621 I2C controller.
The port was undertaken as the existing driver intended for Mediatek
I2C controllers (mtk_i2c.c) is not compatible with the MT7621.
To use the driver:
1. Ensure that the mode of the i2c pin group is
configured for "i2c" rather than "gpio".
2. Delete the existing (bitbanged) i2c node from
arch/mips/dts/mt7621.dtsi, or specify:
/delete-node/ &i2c;
3. Declare:
i2c: i2c@1e000900 {
compatible = "mediatek,mt7621-i2c";
reg = <0x1e000900 0x100>;
clocks = <&clk50m>;
clock-names = "sys_clock";
resets = <&rstctrl RST_I2C>;
reset-names = "i2c_reset";
pinctrl-names = "default";
pinctrl-0 = <&i2c_pins>;
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
};
Signed-off-by: Justin Swartz <[email protected]>
---
Notes:
[PATCH v3]
- Add an empty line between variable declaration and code to
functions that did not have this separation.
- Condense multi-line closing brace / else / opening brace
sequences into single lines consisting of "} else {" instead.
- Relocate mt7621_i2c_check_ack()'s I2C_M_IGNORE_NAK flag check
to just after the last variable declaration.
[PATCH v2]
- Add "REG_" prefix to I2C (Serial Master 0) register definitions.
- Remove unused "PINT" (Peripheral Interrupt) register definitions.
- Adjust function definition style.
- Refactor mt7621_i2c_check_ack() to accept the number of bytes
expected to have been acknowledged, instead of accepting a
literal value (which represents the acknowledgement status of
(up to) 8 bytes, encoded as 8 independent bit values) expected
in the SM0_ACK field (bits 23:16) of the SM0CTL1 register.
drivers/i2c/Kconfig | 7 +
drivers/i2c/Makefile | 1 +
drivers/i2c/mt7621_i2c.c | 375 +++++++++++++++++++++++++++++++++++++++
3 files changed, 383 insertions(+)
create mode 100644 drivers/i2c/mt7621_i2c.c
Reviewed-by: Heiko Schocher <[email protected]>
bye,
Heiko
--
Nabla Software Engineering
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: [email protected]
Geschäftsführer : Stefano Babic