From patchwork Mon Feb 29 09:21:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramesh Shanmugasundaram X-Patchwork-Id: 8450671 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-renesas-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 329609F52D for ; Mon, 29 Feb 2016 09:26:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6266620254 for ; Mon, 29 Feb 2016 09:26:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 629882022A for ; Mon, 29 Feb 2016 09:26:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753329AbcB2JZy (ORCPT ); Mon, 29 Feb 2016 04:25:54 -0500 Received: from relmlor2.renesas.com ([210.160.252.172]:63394 "EHLO relmlie1.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753289AbcB2JZw (ORCPT ); Mon, 29 Feb 2016 04:25:52 -0500 Received: from unknown (HELO relmlir2.idc.renesas.com) ([10.200.68.152]) by relmlie1.idc.renesas.com with ESMTP; 29 Feb 2016 18:25:50 +0900 Received: from relmlac4.idc.renesas.com (relmlac4.idc.renesas.com [10.200.69.24]) by relmlir2.idc.renesas.com (Postfix) with ESMTP id 1C6584C078; Mon, 29 Feb 2016 18:25:50 +0900 (JST) Received: by relmlac4.idc.renesas.com (Postfix, from userid 0) id 11935480A4; Mon, 29 Feb 2016 18:25:50 +0900 (JST) Received: from relmlac4.idc.renesas.com (localhost [127.0.0.1]) by relmlac4.idc.renesas.com (Postfix) with ESMTP id 0C86B480A3; Mon, 29 Feb 2016 18:25:50 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac4.idc.renesas.com with ESMTP id UAD28540; Mon, 29 Feb 2016 18:25:50 +0900 X-IronPort-AV: E=Sophos;i="5.22,520,1449500400"; d="scan'208";a="206653180" Received: from unknown (HELO localhost.localdomain) ([172.29.43.62]) by relmlii2.idc.renesas.com with ESMTP; 29 Feb 2016 18:25:40 +0900 From: Ramesh Shanmugasundaram To: mkl@pengutronix.de, wg@grandegger.com, horms@verge.net.au, magnus.damm@gmail.com, robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, ijc+devicetree@hellion.org.uk, galak@codeaurora.org Cc: linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-can@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, chris.paterson2@renesas.com, Ramesh Shanmugasundaram Subject: [PATCH 1/2] can: rcar_can: Add r8a7795 support Date: Mon, 29 Feb 2016 09:21:00 +0000 Message-Id: <1456737661-20538-2-git-send-email-ramesh.shanmugasundaram@bp.renesas.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1456737661-20538-1-git-send-email-ramesh.shanmugasundaram@bp.renesas.com> References: <1456737661-20538-1-git-send-email-ramesh.shanmugasundaram@bp.renesas.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Added r8a7795 SoC support. For smoother bit timing calculation, the rounded clock frequency is used. Signed-off-by: Ramesh Shanmugasundaram --- Documentation/devicetree/bindings/net/can/rcar_can.txt | 12 ++++++++++++ drivers/net/can/Kconfig | 2 +- drivers/net/can/rcar_can.c | 7 ++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/net/can/rcar_can.txt b/Documentation/devicetree/bindings/net/can/rcar_can.txt index 002d844..7f1305f 100644 --- a/Documentation/devicetree/bindings/net/can/rcar_can.txt +++ b/Documentation/devicetree/bindings/net/can/rcar_can.txt @@ -6,6 +6,9 @@ Required properties: "renesas,can-r8a7779" if CAN controller is a part of R8A7779 SoC. "renesas,can-r8a7790" if CAN controller is a part of R8A7790 SoC. "renesas,can-r8a7791" if CAN controller is a part of R8A7791 SoC. + "renesas,can-r8a7795" if CAN controller is a part of R8A7795 SoC. + "renesas,rcar-gen3-can" for a generic R-Car Gen3 compatible device. + - reg: physical base address and size of the R-Car CAN register map. - interrupts: interrupt specifier for the sole interrupt. - clocks: phandles and clock specifiers for 3 CAN clock inputs. @@ -13,6 +16,15 @@ Required properties: - pinctrl-0: pin control group to be used for this controller. - pinctrl-names: must be "default". +Required properties for "renesas,can-r8a7795" compatible: +In R8A7795 SoC, "clkp2" can be CANFD clock. This is a div6 clock and can be +used by both CAN and CAN FD controller at the same time. It needs to be scaled +to maximum frequency if any of these controllers use it. This is done using +the below properties. + +- assigned-clocks: phandle of clkp2(CANFD) clock. +- assigned-clock-rates: maximum frequency of this clock. + Optional properties: - renesas,can-clock-select: R-Car CAN Clock Source Select. Valid values are: <0x0> (default) : Peripheral clock (clkp1) diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig index 164ccde..0d40aef 100644 --- a/drivers/net/can/Kconfig +++ b/drivers/net/can/Kconfig @@ -106,7 +106,7 @@ config CAN_JANZ_ICAN3 config CAN_RCAR tristate "Renesas R-Car CAN controller" - depends on ARM + depends on ARCH_RENESAS || ARM ---help--- Say Y here if you want to use CAN controller found on Renesas R-Car SoCs. diff --git a/drivers/net/can/rcar_can.c b/drivers/net/can/rcar_can.c index bc46be3..55e34de 100644 --- a/drivers/net/can/rcar_can.c +++ b/drivers/net/can/rcar_can.c @@ -808,6 +808,10 @@ static int rcar_can_probe(struct platform_device *pdev) priv->regs = addr; priv->clock_select = clock_select; priv->can.clock.freq = clk_get_rate(priv->can_clk); + + /* Use the rounded clock value (nearest kHz) */ + priv->can.clock.freq = 1000 * DIV_ROUND_UP(priv->can.clock.freq, 1000); + priv->can.bittiming_const = &rcar_can_bittiming_const; priv->can.do_set_mode = rcar_can_do_set_mode; priv->can.do_get_berr_counter = rcar_can_get_berr_counter; @@ -904,7 +908,8 @@ static const struct of_device_id rcar_can_of_table[] __maybe_unused = { { .compatible = "renesas,can-r8a7779" }, { .compatible = "renesas,can-r8a7790" }, { .compatible = "renesas,can-r8a7791" }, - { } + { .compatible = "renesas,rcar-gen3-can" }, + { }, }; MODULE_DEVICE_TABLE(of, rcar_can_of_table);