All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/2] riscv: spacemit: add i2c support to K1 SoC
@ 2024-10-15  7:51 Troy Mitchell
  2024-10-15  7:51 ` [PATCH v1 1/2] dt-bindings: i2c: spacemit: add support for " Troy Mitchell
  2024-10-15  7:51 ` [PATCH v1 2/2] i2c: spacemit: add support for SpacemiT " Troy Mitchell
  0 siblings, 2 replies; 20+ messages in thread
From: Troy Mitchell @ 2024-10-15  7:51 UTC (permalink / raw)
  To: andi.shyti, robh, krzk+dt, conor+dt
  Cc: troymitchell988, linux-i2c, devicetree, linux-kernel

Hi all,

This patch implements I2C driver for the SpacemiT K1 SoC,
providing basic support for I2C read/write communication which
compatible with standard I2C bus specifications.

In this version, the driver defaults to use fast-speed-mode and
interrupts for transmission, and does not support DMA, high-speed mode, or FIFO.

The docs of I2C can be found here, in chapter 16.1 I2C [1]

Link: https://developer.spacemit.com/documentation?token=Rn9Kw3iFHirAMgkIpTAcV2Arnkf#part5 [1]

Troy Mitchell (2):
  dt-bindings: i2c: spacemit: add support for K1 SoC
  i2c: spacemit: add support for SpacemiT K1 SoC

 .../bindings/i2c/spacemit,k1-i2c.yaml         |  59 ++
 drivers/i2c/busses/Kconfig                    |  18 +
 drivers/i2c/busses/Makefile                   |   1 +
 drivers/i2c/busses/i2c-k1.c                   | 694 ++++++++++++++++++
 4 files changed, 772 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/i2c/spacemit,k1-i2c.yaml
 create mode 100644 drivers/i2c/busses/i2c-k1.c

-- 
2.34.1


^ permalink raw reply	[flat|nested] 20+ messages in thread
* Re: [PATCH v1 2/2] i2c: spacemit: add support for SpacemiT K1 SoC
@ 2024-10-19  6:29 kernel test robot
  0 siblings, 0 replies; 20+ messages in thread
From: kernel test robot @ 2024-10-19  6:29 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20241015075134.1449458-3-TroyMitchell988@gmail.com>
References: <20241015075134.1449458-3-TroyMitchell988@gmail.com>
TO: Troy Mitchell <troymitchell988@gmail.com>
TO: andi.shyti@kernel.org
TO: robh@kernel.org
TO: krzk+dt@kernel.org
TO: conor+dt@kernel.org
CC: troymitchell988@gmail.com
CC: linux-i2c@vger.kernel.org
CC: devicetree@vger.kernel.org
CC: linux-kernel@vger.kernel.org

Hi Troy,

kernel test robot noticed the following build warnings:

[auto build test WARNING on andi-shyti/i2c/i2c-host]
[also build test WARNING on robh/for-next linus/master v6.12-rc3 next-20241018]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Troy-Mitchell/dt-bindings-i2c-spacemit-add-support-for-K1-SoC/20241015-155402
base:   https://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git i2c/i2c-host
patch link:    https://lore.kernel.org/r/20241015075134.1449458-3-TroyMitchell988%40gmail.com
patch subject: [PATCH v1 2/2] i2c: spacemit: add support for SpacemiT K1 SoC
:::::: branch date: 4 days ago
:::::: commit date: 4 days ago
config: alpha-randconfig-r071-20241019 (https://download.01.org/0day-ci/archive/20241019/202410191416.NyqQCvE3-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 13.3.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202410191416.NyqQCvE3-lkp@intel.com/

smatch warnings:
drivers/i2c/busses/i2c-k1.c:621 spacemit_i2c_probe() warn: passing zero to 'PTR_ERR'
drivers/i2c/busses/i2c-k1.c:622 spacemit_i2c_probe() warn: passing zero to 'dev_err_probe'

vim +/PTR_ERR +621 drivers/i2c/busses/i2c-k1.c

aede17b17b7dfb Troy Mitchell 2024-10-15  603  
aede17b17b7dfb Troy Mitchell 2024-10-15  604  static int spacemit_i2c_probe(struct platform_device *pdev)
aede17b17b7dfb Troy Mitchell 2024-10-15  605  {
aede17b17b7dfb Troy Mitchell 2024-10-15  606  	struct spacemit_i2c_dev *i2c;
aede17b17b7dfb Troy Mitchell 2024-10-15  607  	struct device_node *of_node = pdev->dev.of_node;
aede17b17b7dfb Troy Mitchell 2024-10-15  608  	struct clk *clk;
aede17b17b7dfb Troy Mitchell 2024-10-15  609  	int ret = 0;
aede17b17b7dfb Troy Mitchell 2024-10-15  610  
aede17b17b7dfb Troy Mitchell 2024-10-15  611  	i2c = devm_kzalloc(&pdev->dev,
aede17b17b7dfb Troy Mitchell 2024-10-15  612  			   sizeof(struct spacemit_i2c_dev),
aede17b17b7dfb Troy Mitchell 2024-10-15  613  			   GFP_KERNEL);
aede17b17b7dfb Troy Mitchell 2024-10-15  614  	if (!i2c)
aede17b17b7dfb Troy Mitchell 2024-10-15  615  		return -ENOMEM;
aede17b17b7dfb Troy Mitchell 2024-10-15  616  
aede17b17b7dfb Troy Mitchell 2024-10-15  617  	i2c->dev = &pdev->dev;
aede17b17b7dfb Troy Mitchell 2024-10-15  618  
aede17b17b7dfb Troy Mitchell 2024-10-15  619  	i2c->base = devm_platform_ioremap_resource(pdev, 0);
aede17b17b7dfb Troy Mitchell 2024-10-15  620  	if (!i2c->base) {
aede17b17b7dfb Troy Mitchell 2024-10-15 @621  		ret = PTR_ERR(i2c->base);
aede17b17b7dfb Troy Mitchell 2024-10-15 @622  		return dev_err_probe(&pdev->dev, ret, "failed to do ioremap");
aede17b17b7dfb Troy Mitchell 2024-10-15  623  	}
aede17b17b7dfb Troy Mitchell 2024-10-15  624  
aede17b17b7dfb Troy Mitchell 2024-10-15  625  	i2c->irq = platform_get_irq(pdev, 0);
aede17b17b7dfb Troy Mitchell 2024-10-15  626  	if (i2c->irq < 0) {
aede17b17b7dfb Troy Mitchell 2024-10-15  627  		ret = i2c->irq;
aede17b17b7dfb Troy Mitchell 2024-10-15  628  		return dev_err_probe(&pdev->dev, ret, "failed to get irq resource");
aede17b17b7dfb Troy Mitchell 2024-10-15  629  	}
aede17b17b7dfb Troy Mitchell 2024-10-15  630  
aede17b17b7dfb Troy Mitchell 2024-10-15  631  	ret = devm_request_irq(i2c->dev, i2c->irq,
aede17b17b7dfb Troy Mitchell 2024-10-15  632  			       spacemit_i2c_irq_handler,
aede17b17b7dfb Troy Mitchell 2024-10-15  633  			       IRQF_NO_SUSPEND | IRQF_ONESHOT,
aede17b17b7dfb Troy Mitchell 2024-10-15  634  			       dev_name(i2c->dev), i2c);
aede17b17b7dfb Troy Mitchell 2024-10-15  635  
aede17b17b7dfb Troy Mitchell 2024-10-15  636  	if (ret)
aede17b17b7dfb Troy Mitchell 2024-10-15  637  		return dev_err_probe(&pdev->dev, ret, "failed to request irq");
aede17b17b7dfb Troy Mitchell 2024-10-15  638  
aede17b17b7dfb Troy Mitchell 2024-10-15  639  	disable_irq(i2c->irq);
aede17b17b7dfb Troy Mitchell 2024-10-15  640  
aede17b17b7dfb Troy Mitchell 2024-10-15  641  	clk = devm_clk_get_enabled(&pdev->dev, NULL);
aede17b17b7dfb Troy Mitchell 2024-10-15  642  	if (IS_ERR(clk)) {
aede17b17b7dfb Troy Mitchell 2024-10-15  643  		ret = PTR_ERR(clk);
aede17b17b7dfb Troy Mitchell 2024-10-15  644  		return dev_err_probe(&pdev->dev, ret, "failed to enable clock");
aede17b17b7dfb Troy Mitchell 2024-10-15  645  	}
aede17b17b7dfb Troy Mitchell 2024-10-15  646  
aede17b17b7dfb Troy Mitchell 2024-10-15  647  	i2c_set_adapdata(&i2c->adapt, i2c);
aede17b17b7dfb Troy Mitchell 2024-10-15  648  	i2c->adapt.owner = THIS_MODULE;
aede17b17b7dfb Troy Mitchell 2024-10-15  649  	i2c->adapt.algo = &spacemit_i2c_algo;
aede17b17b7dfb Troy Mitchell 2024-10-15  650  	i2c->adapt.dev.parent = i2c->dev;
aede17b17b7dfb Troy Mitchell 2024-10-15  651  	i2c->adapt.nr = pdev->id;
aede17b17b7dfb Troy Mitchell 2024-10-15  652  
aede17b17b7dfb Troy Mitchell 2024-10-15  653  	i2c->adapt.dev.of_node = of_node;
aede17b17b7dfb Troy Mitchell 2024-10-15  654  	i2c->adapt.algo_data = i2c;
aede17b17b7dfb Troy Mitchell 2024-10-15  655  
aede17b17b7dfb Troy Mitchell 2024-10-15  656  	strscpy(i2c->adapt.name, "spacemit-i2c-adapter", sizeof(i2c->adapt.name));
aede17b17b7dfb Troy Mitchell 2024-10-15  657  
aede17b17b7dfb Troy Mitchell 2024-10-15  658  	init_completion(&i2c->complete);
aede17b17b7dfb Troy Mitchell 2024-10-15  659  
aede17b17b7dfb Troy Mitchell 2024-10-15  660  	ret = i2c_add_numbered_adapter(&i2c->adapt);
aede17b17b7dfb Troy Mitchell 2024-10-15  661  
aede17b17b7dfb Troy Mitchell 2024-10-15  662  	if (ret)
aede17b17b7dfb Troy Mitchell 2024-10-15  663  		return dev_err_probe(&pdev->dev, ret, "failed to add i2c adapter");
aede17b17b7dfb Troy Mitchell 2024-10-15  664  
aede17b17b7dfb Troy Mitchell 2024-10-15  665  	platform_set_drvdata(pdev, i2c);
aede17b17b7dfb Troy Mitchell 2024-10-15  666  
aede17b17b7dfb Troy Mitchell 2024-10-15  667  	return 0;
aede17b17b7dfb Troy Mitchell 2024-10-15  668  }
aede17b17b7dfb Troy Mitchell 2024-10-15  669  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2024-10-21  7:22 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-15  7:51 [PATCH v1 0/2] riscv: spacemit: add i2c support to K1 SoC Troy Mitchell
2024-10-15  7:51 ` [PATCH v1 1/2] dt-bindings: i2c: spacemit: add support for " Troy Mitchell
2024-10-15  8:02   ` Krzysztof Kozlowski
2024-10-15 16:47     ` Conor Dooley
2024-10-16  2:45     ` Troy Mitchell
2024-10-16  7:44       ` Krzysztof Kozlowski
2024-10-15  9:22   ` Rob Herring (Arm)
2024-10-15  7:51 ` [PATCH v1 2/2] i2c: spacemit: add support for SpacemiT " Troy Mitchell
2024-10-15  8:08   ` Krzysztof Kozlowski
2024-10-15  9:21     ` Wolfram Sang
2024-10-18  5:17     ` Troy Mitchell
2024-10-18  6:05       ` Krzysztof Kozlowski
2024-10-18  8:33         ` Troy Mitchell
2024-10-18  8:39           ` Krzysztof Kozlowski
2024-10-15  9:17   ` Wolfram Sang
2024-10-16  2:26     ` Troy Mitchell
2024-10-16  7:06       ` Wolfram Sang
2024-10-16  9:39   ` Uwe Kleine-König
2024-10-21  7:22   ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2024-10-19  6:29 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.