From patchwork Mon Jul 23 03:40:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 142532 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp5581671ljj; Sun, 22 Jul 2018 20:41:08 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeGVvOAjxRjfwPjJvtiRy5gk3JfPUoqwOxdOXDv1Fp2o/5HWTMxmU9o9okks57JLc4/I3EK X-Received: by 2002:a63:383:: with SMTP id 125-v6mr10731933pgd.421.1532317268489; Sun, 22 Jul 2018 20:41:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532317268; cv=none; d=google.com; s=arc-20160816; b=yn2si+STrHrvKaa0UssOVVZo4yIscug4ks61mzTsP8EZZRXN8LkuDM2uHLCHOoS90X CxxMuXN33qPqwXcItGdkeHalNDwldQQX1N9AENcGwA6hSOVfgS9bmx6KQ4sCjtGGj6NL 2lYpbnqGG8uiFHtH2NDcGAhJ4rkRURPULHjSobPcZ9qoojYBv9H8chP7CYfyc1uKTw4d tKVCNrxTChWzfGsFsZxdgW6gkuxmmYWmQ8iK9MYfoxi/U0bWYGlhIe+uNzD1gT+m2x+s 7WA1A1swLTM+v05BI6o4M7v7VgqJjPaD5E/JBWJ4ePvTa51VLzjl9UzeOwueu8t4UzZv uXkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=zRjVvqjJt4gC+GOWytaTnaFxj/Ad91TkU6fQHDgDuMg=; b=RCHsQDTo708hlijEshvb4ixWXrXmgdGhkNjGM/U0QjTgoms3GbdGZfNa2KZSi/CJH6 HeCsrlrA9OLeZF93fkPPUgRpZ3T705sv1VtkDfmypyOjKVmg/DXVj/ixlJm5TmvZOadP AReh+0+3nP4TvOOEiBJ8VxTZL8qgCj+DUn05RxEPfA1cSVTNuQbslOTZ7KdLwQBi4ce5 8JXBLX4BbiAFKpnxbxU8jndcqClF6eUQU39NOcwpHVOKthzaVeGcVXAme9JIK7NUfvST tg6Nvj06QavQLaYiNyMkTeEEwaSfYipJ04D6Qc/+c3bl0Os91JM/mYMTqxF52roDYTY/ dYhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SBHvKi4p; spf=pass (google.com: best guess record for domain of linux-i2c-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-i2c-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g3-v6si7163755pld.309.2018.07.22.20.41.08; Sun, 22 Jul 2018 20:41:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-i2c-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SBHvKi4p; spf=pass (google.com: best guess record for domain of linux-i2c-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-i2c-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727543AbeGWEkN (ORCPT + 2 others); Mon, 23 Jul 2018 00:40:13 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:41665 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726619AbeGWEkM (ORCPT ); Mon, 23 Jul 2018 00:40:12 -0400 Received: by mail-pg1-f195.google.com with SMTP id z8-v6so11214545pgu.8 for ; Sun, 22 Jul 2018 20:41:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=zRjVvqjJt4gC+GOWytaTnaFxj/Ad91TkU6fQHDgDuMg=; b=SBHvKi4px2LnhpeL69gply/AzJrf3bQ90YaP69n4J8L1dsmMZ7ggWtqGaJMEtqzeoh dUmMZidhIwOybPQf5pSCA4KJawX6+TMsZppdyirzkzWVqxWMPtBlTRemGL8CkNBkTqKu /aBXt9BLESOhoO47Gd9hSw2ooemlRvfw4PP9A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=zRjVvqjJt4gC+GOWytaTnaFxj/Ad91TkU6fQHDgDuMg=; b=LeTPchXU2Y7fKcZrPtyL9otXEQWwMoWH79MausIBwLcu9j8l5aTWDj4LKz9IgzBmZi rHupkvtbanrXoE68paCLEaUwam1XVks/2+QVrllwG5VOpq/iJnBoufDr9A2j+S2keM/2 TknzDnjf037jEcXUIqhLF4WcntvtnwroWxugO1amofSMczNkVlpdliacnvgzG0Y54LHp PilzzdjTyHwSW/ONCz8KxodzBteKcjiJTO1KGILqOxZwlIYT6x4o+b0PF0cqN6KARgxN F9RFy8HligaOQPjY7S3jszk6CBg8tXZ9bz0bqVr0i0XLE9wifXyScCGjRcMFoGSrOZ2i gHeA== X-Gm-Message-State: AOUpUlGSVVulCrfwO2u0zWlZY7ucHDEOf+BjBYJgZknsIHiVVKHN/EYL V96DMZ67g0uUlmu1IWd8M64z X-Received: by 2002:a63:c44a:: with SMTP id m10-v6mr10693538pgg.416.1532317266452; Sun, 22 Jul 2018 20:41:06 -0700 (PDT) Received: from localhost.localdomain ([2409:4072:802:a98c:b568:c01f:49a2:2aa5]) by smtp.gmail.com with ESMTPSA id s184-v6sm11340248pfb.56.2018.07.22.20.40.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Jul 2018 20:41:05 -0700 (PDT) From: Manivannan Sadhasivam To: wsa@the-dreams.de, robh+dt@kernel.org, afaerber@suse.de Cc: linus.walleij@linaro.org, linux-i2c@vger.kernel.org, liuwei@actions-semi.com, mp-cs@actions-semi.com, 96boards@ucrobotics.com, devicetree@vger.kernel.org, andy.shevchenko@gmail.com, daniel.thompson@linaro.org, amit.kucheria@linaro.org, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, hzhang@ucrobotics.com, bdong@ucrobotics.com, manivannanece23@gmail.com, thomas.liau@actions-semi.com, jeff.chen@actions-semi.com, Manivannan Sadhasivam Subject: [PATCH v6 0/6] Add Actions Semiconductor Owl S900 I2C support Date: Mon, 23 Jul 2018 09:10:19 +0530 Message-Id: <20180723034025.5763-1-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org This patchset adds I2C controller support for Actions Semiconductor S900 SoC. This driver has been structured in a way such that there will be only one controller driver for the whole Owl family series (S500, S700 and S900 SoCs). There are 6 I2C controllers with separate memory mapped register space. The I2C controller can handle atmost two messages concatenated by a repeated start via its internal address feature. Hence the driver uses this feature for messages of length greater than 1. In those cases, the first message of the combined message should be a `write` with maximum message length 6 and the second message's maximum length should be 240 bytes. As far as the bus speed is concerned, this driver only supports Standard (100KHz) and High speed (400KHz) for now. The pinctrl definitions are only available for I2C0, I2C1 and I2C2. With the mux option available only for I2C0. For Bubblegum-96 board utilizing the S900 SoC, only I2C1 and I2C2 which are exposed on the Low speed expansion connector are enabled. This series depends on the pinctrl patch [1] is still not merged by the platform maintainer Andreas but it has been reviewed by the pinctrl maintainer Linus Walleij. For the reference, I have queued up all reviewed dts patches in my tree [2] from which Andreas is picking them for 4.19. For this series, since the dts patches will go through the ARM SoC tree, Andreas will pick it up once it is reviewed. Thanks, Mani [1] https://patchwork.kernel.org/patch/10322937/ [2] https://git.linaro.org/people/manivannan.sadhasivam/linux.git/log/?h=s900-for-next Changes in v6: As per Peter's review: * Added missing newlines for error and debug outputs * Fixed further multi-line misalignments Changes in v5: * Cleaned up the multi-line codes and reordered the error paths as per Peter's review * Added Acked-by tag from Peter for driver patch * Added Reviewed-by tag from Rob for bindings patch Changes in v4: As per Andy and Peter review: * Used spinlock for accessing most of the register access (only parts involved sleep/long-busy-wait has been excluded) * Removed returning 0 and added -ENXIO if the msg_ptr not equals to message length * Added DIV_ROUND_UP for setting clock frequency * Changed one non-atomic mdelay instance to usleep_range * Moved pinctrl definition patch before dts patch * Fixed the driver to support only 100KHz and 400KHz frequencies Changes in v3: As per Peter, Andy and Andreas review: * Removed owl_i2c_reset function from interrupt handler since it involves the use of delays. * Fixed the return path in owl_i2c_master_xfer and added a note * Changed "base" parameter to "reg" in owl_i2c_update_reg for better understandability * Ordered the includes in alphabetical order * Small changes to defines and added comma at the end of struct members * Removed rendundant 0 assignment in owl_i2c_master_xfer * Changed all OWL naming convention to Owl and also changed Actions Semi naming to Actions Semiconductor Changes in v2: As per Andy's review: * Modified infinite loops to fixed number of retries * Used i2c_8bit_addr_from_msg for constructing the slave address * Removed unnecessary parenthesis around defines * Modified certain dev_warn to dev_dbg * Modified the error handling to more generic pattern * Fixed the return value in owl_i2c_master_xfer * Added MAINTAINERS patch for I2C driver and its binding Manivannan Sadhasivam (6): dt-bindings: i2c: Add binding for Actions Semiconductor Owl I2C controller arm64: dts: actions: Add pinctrl definition for S900 I2C controller arm64: dts: actions: Add Actions Semiconductor S900 I2C controller nodes arm64: dts: actions: Enable I2C1 and I2C2 in Bubblegum-96 board i2c: Add Actions Semiconductor Owl family S900 I2C driver MAINTAINERS: Add entry for Actions Semiconductor Owl I2C driver .../devicetree/bindings/i2c/i2c-owl.txt | 27 + MAINTAINERS | 2 + .../dts/actions/s900-bubblegum-96-pins.dtsi | 29 + .../boot/dts/actions/s900-bubblegum-96.dts | 11 + arch/arm64/boot/dts/actions/s900.dtsi | 60 +++ drivers/i2c/busses/Kconfig | 7 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-owl.c | 495 ++++++++++++++++++ 8 files changed, 632 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-owl.txt create mode 100644 arch/arm64/boot/dts/actions/s900-bubblegum-96-pins.dtsi create mode 100644 drivers/i2c/busses/i2c-owl.c -- 2.17.1