From patchwork Fri Mar 15 18:39:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13593872 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 660701D553; Fri, 15 Mar 2024 18:39:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710527979; cv=none; b=BWSjSijWG/kasfynTqsO9mbFOC1ZFjtqdIIKDmRhX28cQ06wraDMuO9xVK1GWqDrFWMp/0q0ygu9hNOXXIuM0sptEj2gpR5rrw4e+qBlnPnrD/VzFtvjCmr1ZOSPTlREcjeItLpsv5Jh0v5i4T1hCpdEmB65FSWG2FdYgzGOfBg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710527979; c=relaxed/simple; bh=Uaj2gn6s7btN5jyWi8u2YpJxAI5G6lZ3D3I7G66i08I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=WbPYugIp5EOxnIlcNrMJU+HAR6higgJwq4ZH4hJKp4Ja8q1Pl6/uhcGgxgiYkFRTrdOFQWZI4eZmO7Plo8ePrFmXYj5wnufnUeh3G8XNd9mz2Mvv2ZL1T/istPbe2FDU7mmEErU+sjBHCA1uSEk7oMaKmrEudwZoW/NNaaf8c4k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-IronPort-AV: E=Sophos;i="6.07,129,1708354800"; d="scan'208";a="201861063" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 16 Mar 2024 03:39:33 +0900 Received: from localhost.localdomain (unknown [10.226.93.102]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 9D56B4066236; Sat, 16 Mar 2024 03:39:29 +0900 (JST) From: Biju Das To: Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Biju Das , Greg Kroah-Hartman , Geert Uytterhoeven , Magnus Damm , Yoshihiro Shimoda , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Prabhakar Mahadev Lad , Biju Das , Krzysztof Kozlowski Subject: [PATCH v3 1/7] dt-bindings: usb: renesas,usbhs: Document RZ/G2L family compatible Date: Fri, 15 Mar 2024 18:39:15 +0000 Message-Id: <20240315183921.375751-2-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240315183921.375751-1-biju.das.jz@bp.renesas.com> References: <20240315183921.375751-1-biju.das.jz@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The USBHS IP found on RZ/G2L SoCs only has 10 pipe buffers compared to 16 pipe buffers on RZ/A2M. Document renesas,rzg2l-usbhs family compatible to handle this difference for RZ/G2L family SoCs. Signed-off-by: Biju Das Acked-by: Krzysztof Kozlowski Reviewed-by: Geert Uytterhoeven --- v2->v3: * Added Rb tag from Geert. v1->v2: * Added Ack from Krzysztof Kozlowski. --- Documentation/devicetree/bindings/usb/renesas,usbhs.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/usb/renesas,usbhs.yaml b/Documentation/devicetree/bindings/usb/renesas,usbhs.yaml index 40ada78f2328..c63db3ebd07b 100644 --- a/Documentation/devicetree/bindings/usb/renesas,usbhs.yaml +++ b/Documentation/devicetree/bindings/usb/renesas,usbhs.yaml @@ -19,10 +19,14 @@ properties: - items: - enum: - renesas,usbhs-r7s9210 # RZ/A2 + - const: renesas,rza2-usbhs + + - items: + - enum: - renesas,usbhs-r9a07g043 # RZ/G2UL and RZ/Five - renesas,usbhs-r9a07g044 # RZ/G2{L,LC} - renesas,usbhs-r9a07g054 # RZ/V2L - - const: renesas,rza2-usbhs + - const: renesas,rzg2l-usbhs - items: - enum: From patchwork Fri Mar 15 18:41:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13593877 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 765234F5FA; Fri, 15 Mar 2024 18:41:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710528105; cv=none; b=eZoENi5hu4+o4oQnAvQV8p+bRoK3UYSLbqDYIxhZ7Ex2SYE4660qd2cH6A12Gn96KTkH62rxmVvzvTD61lILukXAauD+8wGHk1SCiPRmfwSZP64kFcjOg3acBt5TQKTMGPd4SQjj9+SLJT/Klr3jaFdbUiuIMqtqOYt8zDsx65A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710528105; c=relaxed/simple; bh=3TTfsFW0oRjIM/ny7kCePQLf+iRUVD0NSZl63OG8Xdo=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=FjrpZ+UXtN+DaI4v8Bf/8NGL6sjhDXo8OFRpkqU7hesoii9HvYD56FdCJOjVu0HdofC6J3g8iixvZoDH4oUWPLreSLgz06xkZho+lq9P6P5W8qM3Vx2fN65DqD4M2OvhwTPO7CkC4LHPJXyg0zIUuEx6lvSccVtSa8y7WuBDM6w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-IronPort-AV: E=Sophos;i="6.07,129,1708354800"; d="scan'208";a="197917802" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 16 Mar 2024 03:41:41 +0900 Received: from localhost.localdomain (unknown [10.226.93.102]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id C120C40061BF; Sat, 16 Mar 2024 03:41:37 +0900 (JST) From: Biju Das To: Greg Kroah-Hartman Cc: Biju Das , Geert Uytterhoeven , Magnus Damm , Rob Herring , Yoshihiro Shimoda , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-?= =?utf-8?q?K=C3=B6nig?= , linux-usb@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Prabhakar Mahadev Lad , Biju Das Subject: [PATCH v3 2/7] usb: renesas_usbhs: Simplify obtaining device data Date: Fri, 15 Mar 2024 18:41:35 +0000 Message-Id: <20240315184135.375916-1-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Simplify probe() by removing redundant dev->of_node check. While at it, replace dev_err->dev_err_probe for error path. Signed-off-by: Biju Das Reviewed-by: Geert Uytterhoeven --- v2->v3: * Added Rb tag from Geert. v2: * New patch. --- drivers/usb/renesas_usbhs/common.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c index dd1c17542439..0c62e4c6c88d 100644 --- a/drivers/usb/renesas_usbhs/common.c +++ b/drivers/usb/renesas_usbhs/common.c @@ -595,16 +595,11 @@ static int usbhs_probe(struct platform_device *pdev) u32 tmp; int irq; - /* check device node */ - if (dev_of_node(dev)) - info = of_device_get_match_data(dev); - else - info = renesas_usbhs_get_info(pdev); - - /* check platform information */ + info = of_device_get_match_data(dev); if (!info) { - dev_err(dev, "no platform information\n"); - return -EINVAL; + info = renesas_usbhs_get_info(pdev); + if (!info) + return dev_err_probe(dev, -EINVAL, "no platform info\n"); } /* platform data */ From patchwork Fri Mar 15 18:39:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13593873 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E44B71EF1A; Fri, 15 Mar 2024 18:39:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710527984; cv=none; b=tkGyFaJMGlIs/y2KtuYYiiKFKJJtXkCXdo6NiK9Bmo75WqKHfzTS3s7LOMZwxxinDYKkff6L7TxaQRErWbtaL5cU0D9rFTR9zGvbYYk5zCLvdlnPdemQcn8B6In1jOPzxI+ThBtHMSDqYDBLbMcoEQcdD3uunq8UdjwnCfvJCqc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710527984; c=relaxed/simple; bh=C7kyR2ki1djI2qeuMUNpOihBcNvbesmD4ziXi1Fyq38=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Dx+guNjghsrq+TalFLRQc++Hz5oMZYcRkksUb1n0S93ZtQTPLFF8/BG/6WeV+avdat+E6Ae9j0907dL4TB9z6XtmJmv6sFtyeh2B21bNSxYNWjQq3ZhoX1ugdzgN/ttV78lyxj7VNUAqxKr0GanN+ABra9Y2qLh3IjHWdqkwJp0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-IronPort-AV: E=Sophos;i="6.07,129,1708354800"; d="scan'208";a="197917684" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 16 Mar 2024 03:39:39 +0900 Received: from localhost.localdomain (unknown [10.226.93.102]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id C2D4A4066236; Sat, 16 Mar 2024 03:39:35 +0900 (JST) From: Biju Das To: Greg Kroah-Hartman Cc: Biju Das , Geert Uytterhoeven , Magnus Damm , Rob Herring , Yoshihiro Shimoda , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-?= =?utf-8?q?K=C3=B6nig?= , linux-usb@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Prabhakar Mahadev Lad , Biju Das Subject: [PATCH v3 3/7] usb: renesas_usbhs: Improve usbhsc_default_pipe[] for isochronous transfers Date: Fri, 15 Mar 2024 18:39:17 +0000 Message-Id: <20240315183921.375751-4-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240315183921.375751-1-biju.das.jz@bp.renesas.com> References: <20240315183921.375751-1-biju.das.jz@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 As per the hardware manual, double buffer setting results in fewer interrupts for high-speed data transfers. Improve usbhsc_default_pipe[] for isochronous transfers by updating the table from single->double buffering and update the pipe number accordingly. Suggested-by: Geert Uytterhoeven Signed-off-by: Biju Das Reviewed-by: Geert Uytterhoeven --- v3: * New patch --- drivers/usb/renesas_usbhs/common.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c index 0c62e4c6c88d..177fa3144a47 100644 --- a/drivers/usb/renesas_usbhs/common.c +++ b/drivers/usb/renesas_usbhs/common.c @@ -366,11 +366,11 @@ static void usbhsc_clk_disable_unprepare(struct usbhs_priv *priv) /* commonly used on old SH-Mobile SoCs */ static struct renesas_usbhs_driver_pipe_config usbhsc_default_pipe[] = { RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_CONTROL, 64, 0x00, false), - RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_ISOC, 1024, 0x08, false), - RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_ISOC, 1024, 0x18, false), - RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x28, true), - RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x38, true), + RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_ISOC, 1024, 0x08, true), + RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_ISOC, 1024, 0x28, true), RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x48, true), + RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x58, true), + RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_BULK, 512, 0x68, true), RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x04, false), RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x05, false), RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_INT, 64, 0x06, false), From patchwork Fri Mar 15 18:39:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13593874 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 90F0043AC5; Fri, 15 Mar 2024 18:39:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710527988; cv=none; b=U+arDIfN9SVBtCky6tasAyp4K5OlLaRxdFmvq0TgoukgXTPx1Mq3y9xnExc/3qCPaL3G26Hth53wGNobskBn4P7s+F1V4uyl7/5uVLeqdcqUQOQ0kBXXielhAGyL3SWj3lt3RFJIOxlX45FFhzxfzvKujIMebZoPbo0zWFZy/0I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710527988; c=relaxed/simple; bh=5mKg1D2/N9WmO+ZmUupePx/E4JWaLPFDqevm1TsLp5c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YhWKU6+NtLg39Rd+B3qskzt3IFebO0eeTTSc81dAygi3VnNVhkzab7RUb80pmiVNEsv0Tkonk6UN6KwD+qJo86Oorimt+o0/3pNgnTSBcB7plbAb3AjTcvIOsbLLgoHCbUdq/94JH91AFLtYtJNeHTYNF8U7E55psgxzD68+NC4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-IronPort-AV: E=Sophos;i="6.07,129,1708354800"; d="scan'208";a="197917687" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 16 Mar 2024 03:39:43 +0900 Received: from localhost.localdomain (unknown [10.226.93.102]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id F1E0F4066237; Sat, 16 Mar 2024 03:39:39 +0900 (JST) From: Biju Das To: Greg Kroah-Hartman Cc: Biju Das , Geert Uytterhoeven , Magnus Damm , Rob Herring , Yoshihiro Shimoda , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-?= =?utf-8?q?K=C3=B6nig?= , linux-usb@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Prabhakar Mahadev Lad , Biju Das Subject: [PATCH v3 4/7] usb: renesas_usbhs: Drop has_new_pipe_configs from struct renesas_usbhs_driver_param Date: Fri, 15 Mar 2024 18:39:18 +0000 Message-Id: <20240315183921.375751-5-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240315183921.375751-1-biju.das.jz@bp.renesas.com> References: <20240315183921.375751-1-biju.das.jz@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Drop has_new_pipe_configs variable from struct renesas_usbhs_driver_param and use info for getting device pipe configuration data by renaming usbhs_new_pipe[]->usbhs_rcar_pipe[] and changing the static qualifier to global so that struct renesas_usbhs_platform_info can be filled by respective devices. Signed-off-by: Biju Das --- v3: * New patch --- drivers/usb/renesas_usbhs/common.c | 9 ++++----- drivers/usb/renesas_usbhs/common.h | 2 ++ drivers/usb/renesas_usbhs/rcar2.c | 3 ++- drivers/usb/renesas_usbhs/rcar3.c | 6 ++++-- drivers/usb/renesas_usbhs/rza.c | 3 ++- drivers/usb/renesas_usbhs/rza2.c | 3 ++- include/linux/usb/renesas_usbhs.h | 1 - 7 files changed, 16 insertions(+), 11 deletions(-) diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c index 177fa3144a47..013bc1583610 100644 --- a/drivers/usb/renesas_usbhs/common.c +++ b/drivers/usb/renesas_usbhs/common.c @@ -378,7 +378,7 @@ static struct renesas_usbhs_driver_pipe_config usbhsc_default_pipe[] = { }; /* commonly used on newer SH-Mobile and R-Car SoCs */ -static struct renesas_usbhs_driver_pipe_config usbhsc_new_pipe[] = { +struct renesas_usbhs_driver_pipe_config usbhsc_rcar_pipe[] = { RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_CONTROL, 64, 0x00, false), RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_ISOC, 1024, 0x08, true), RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_ISOC, 1024, 0x28, true), @@ -639,10 +639,9 @@ static int usbhs_probe(struct platform_device *pdev) priv->pfunc = &info->platform_callback; /* set default param if platform doesn't have */ - if (usbhs_get_dparam(priv, has_new_pipe_configs)) { - priv->dparam.pipe_configs = usbhsc_new_pipe; - priv->dparam.pipe_size = ARRAY_SIZE(usbhsc_new_pipe); - } else if (!priv->dparam.pipe_configs) { + priv->dparam.pipe_configs = info->driver_param.pipe_configs; + priv->dparam.pipe_size = info->driver_param.pipe_size; + if (!priv->dparam.pipe_configs) { priv->dparam.pipe_configs = usbhsc_default_pipe; priv->dparam.pipe_size = ARRAY_SIZE(usbhsc_default_pipe); } diff --git a/drivers/usb/renesas_usbhs/common.h b/drivers/usb/renesas_usbhs/common.h index 3fb5bc94dc0d..f6f527ca9b45 100644 --- a/drivers/usb/renesas_usbhs/common.h +++ b/drivers/usb/renesas_usbhs/common.h @@ -343,4 +343,6 @@ struct usbhs_priv *usbhs_pdev_to_priv(struct platform_device *pdev); #define usbhs_priv_to_dev(priv) (&priv->pdev->dev) #define usbhs_priv_to_lock(priv) (&priv->lock) +extern struct renesas_usbhs_driver_pipe_config usbhsc_rcar_pipe[]; + #endif /* RENESAS_USB_DRIVER_H */ diff --git a/drivers/usb/renesas_usbhs/rcar2.c b/drivers/usb/renesas_usbhs/rcar2.c index 52756fc2ac9c..170584f8de74 100644 --- a/drivers/usb/renesas_usbhs/rcar2.c +++ b/drivers/usb/renesas_usbhs/rcar2.c @@ -69,7 +69,8 @@ const struct renesas_usbhs_platform_info usbhs_rcar_gen2_plat_info = { .get_id = usbhs_get_id_as_gadget, }, .driver_param = { + .pipe_configs = usbhsc_rcar_pipe, + .pipe_size = 16, .has_usb_dmac = 1, - .has_new_pipe_configs = 1, }, }; diff --git a/drivers/usb/renesas_usbhs/rcar3.c b/drivers/usb/renesas_usbhs/rcar3.c index c181b2a0b9d3..da5c013cfd07 100644 --- a/drivers/usb/renesas_usbhs/rcar3.c +++ b/drivers/usb/renesas_usbhs/rcar3.c @@ -101,9 +101,10 @@ const struct renesas_usbhs_platform_info usbhs_rcar_gen3_plat_info = { .get_id = usbhs_get_id_as_gadget, }, .driver_param = { + .pipe_configs = usbhsc_rcar_pipe, + .pipe_size = 16, .has_usb_dmac = 1, .multi_clks = 1, - .has_new_pipe_configs = 1, }, }; @@ -113,8 +114,9 @@ const struct renesas_usbhs_platform_info usbhs_rcar_gen3_with_pll_plat_info = { .get_id = usbhs_get_id_as_gadget, }, .driver_param = { + .pipe_configs = usbhsc_rcar_pipe, + .pipe_size = 16, .has_usb_dmac = 1, .multi_clks = 1, - .has_new_pipe_configs = 1, }, }; diff --git a/drivers/usb/renesas_usbhs/rza.c b/drivers/usb/renesas_usbhs/rza.c index 97b5217c5a90..91c1971c3949 100644 --- a/drivers/usb/renesas_usbhs/rza.c +++ b/drivers/usb/renesas_usbhs/rza.c @@ -51,6 +51,7 @@ const struct renesas_usbhs_platform_info usbhs_rza1_plat_info = { .get_id = usbhs_get_id_as_gadget, }, .driver_param = { - .has_new_pipe_configs = 1, + .pipe_configs = usbhsc_rcar_pipe, + .pipe_size = 16, }, }; diff --git a/drivers/usb/renesas_usbhs/rza2.c b/drivers/usb/renesas_usbhs/rza2.c index f079817250bb..f6660628eea9 100644 --- a/drivers/usb/renesas_usbhs/rza2.c +++ b/drivers/usb/renesas_usbhs/rza2.c @@ -66,8 +66,9 @@ const struct renesas_usbhs_platform_info usbhs_rza2_plat_info = { .get_id = usbhs_get_id_as_gadget, }, .driver_param = { + .pipe_configs = usbhsc_rcar_pipe, + .pipe_size = 16, .has_cnen = 1, .cfifo_byte_addr = 1, - .has_new_pipe_configs = 1, }, }; diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h index 372898d9eeb0..41f58cfbd876 100644 --- a/include/linux/usb/renesas_usbhs.h +++ b/include/linux/usb/renesas_usbhs.h @@ -169,7 +169,6 @@ struct renesas_usbhs_driver_param { u32 cfifo_byte_addr:1; /* CFIFO is byte addressable */ #define USBHS_USB_DMAC_XFER_SIZE 32 /* hardcode the xfer size */ u32 multi_clks:1; - u32 has_new_pipe_configs:1; }; /* From patchwork Fri Mar 15 18:39:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13593875 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 537EC1D553; Fri, 15 Mar 2024 18:39:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710527992; cv=none; b=Z6sKV1BRnjm/FYxPz7Adhj7YPLONnBEvV9KSwdcZc6Hv/GLJ/ZTS6wZ9EYm6hL8AFQV6jQGnVmYRCLcbEqcdtgZUVYH5Ndq5SRuNHEK9bwtzIVNlND5h/QtOSf5yohC0Q03X7+V64LDXuIzHq8MQ/+gWDLz3YlNv/Vy0uSqoA8U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710527992; c=relaxed/simple; bh=3PIwwpwwWVl2o8F0ie8MiD/RJToWhQwtHG9MopDzHH4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=l9lEk278uCgN2v6IX6QsWmT/UozKt78Xx50Ko6mwo+sPVXZU63SiJMmWiN6uEWK3oiDg9f3Buospr+CtbvWkoZxLXsu1GNRgCRsMtQutoaYy1khS0PoWft0uLhRUF77QkXbB9F29yv5pSb6o1FqrOeALHiUarLWJPawzUWDAnPY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-IronPort-AV: E=Sophos;i="6.07,129,1708354800"; d="scan'208";a="201861075" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 16 Mar 2024 03:39:48 +0900 Received: from localhost.localdomain (unknown [10.226.93.102]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 2ECE24066236; Sat, 16 Mar 2024 03:39:43 +0900 (JST) From: Biju Das To: Greg Kroah-Hartman Cc: Biju Das , Geert Uytterhoeven , Magnus Damm , Huy Nguyen , Rob Herring , Yoshihiro Shimoda , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-?= =?utf-8?q?K=C3=B6nig?= , linux-usb@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Prabhakar Mahadev Lad , Biju Das Subject: [PATCH v3 5/7] usb: renesas_usbhs: Update usbhs pipe configuration for RZ/G2L family Date: Fri, 15 Mar 2024 18:39:19 +0000 Message-Id: <20240315183921.375751-6-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240315183921.375751-1-biju.das.jz@bp.renesas.com> References: <20240315183921.375751-1-biju.das.jz@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The RZ/G2L family SoCs has 10 PIPE buffers compared to 16 pipe buffers on RZ/A2M. Update the pipe configuration for RZ/G2L family SoCs and use family SoC specific compatible to handle this difference. Added SoC specific compatible to OF table to avoid ABI breakage with old DTB. To optimize memory usage the SoC specific compatible will be removed later. The pipe configuration of RZ/G2L is same as the default one, so reuse the common table by renaming usbhs_default_pipe[]->usbhs_rcar_default_pipe[] and changing static qualifier to global to fill the pipe configuration data. Signed-off-by: Huy Nguyen Signed-off-by: Biju Das --- v2->v3: * Updated commit description * Dropped usbhsc_rzg2l_pipe[] and reusing the default_pipe[]. v1->v2: * Dropped using of_device_is_compatible() in probe. * Added usbhs_rzg2l_plat_info and replaced the device data for RZ/G2L from usbhs_rza2_plat_info->usbhs_rzg2l_plat_info. * Moved usbhsc_rzg2l_pipe table near to the user. * Updated commit description. --- drivers/usb/renesas_usbhs/common.c | 24 ++++++++++++++++++++---- drivers/usb/renesas_usbhs/common.h | 1 + drivers/usb/renesas_usbhs/rza.h | 1 + drivers/usb/renesas_usbhs/rza2.c | 15 +++++++++++++++ 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c index 013bc1583610..3c67cd9c4406 100644 --- a/drivers/usb/renesas_usbhs/common.c +++ b/drivers/usb/renesas_usbhs/common.c @@ -363,8 +363,8 @@ static void usbhsc_clk_disable_unprepare(struct usbhs_priv *priv) * platform default param */ -/* commonly used on old SH-Mobile SoCs */ -static struct renesas_usbhs_driver_pipe_config usbhsc_default_pipe[] = { +/* commonly used on old SH-Mobile and RZ/G2L family SoCs */ +struct renesas_usbhs_driver_pipe_config usbhsc_rcar_default_pipe[] = { RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_CONTROL, 64, 0x00, false), RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_ISOC, 1024, 0x08, true), RENESAS_USBHS_PIPE(USB_ENDPOINT_XFER_ISOC, 1024, 0x28, true), @@ -565,6 +565,18 @@ static const struct of_device_id usbhs_of_match[] = { .compatible = "renesas,usbhs-r8a77995", .data = &usbhs_rcar_gen3_with_pll_plat_info, }, + { + .compatible = "renesas,usbhs-r9a07g043", + .data = &usbhs_rzg2l_plat_info, + }, + { + .compatible = "renesas,usbhs-r9a07g044", + .data = &usbhs_rzg2l_plat_info, + }, + { + .compatible = "renesas,usbhs-r9a07g054", + .data = &usbhs_rzg2l_plat_info, + }, { .compatible = "renesas,rcar-gen2-usbhs", .data = &usbhs_rcar_gen2_plat_info, @@ -581,6 +593,10 @@ static const struct of_device_id usbhs_of_match[] = { .compatible = "renesas,rza2-usbhs", .data = &usbhs_rza2_plat_info, }, + { + .compatible = "renesas,rzg2l-usbhs", + .data = &usbhs_rzg2l_plat_info, + }, { }, }; MODULE_DEVICE_TABLE(of, usbhs_of_match); @@ -642,8 +658,8 @@ static int usbhs_probe(struct platform_device *pdev) priv->dparam.pipe_configs = info->driver_param.pipe_configs; priv->dparam.pipe_size = info->driver_param.pipe_size; if (!priv->dparam.pipe_configs) { - priv->dparam.pipe_configs = usbhsc_default_pipe; - priv->dparam.pipe_size = ARRAY_SIZE(usbhsc_default_pipe); + priv->dparam.pipe_configs = usbhsc_rcar_default_pipe; + priv->dparam.pipe_size = ARRAY_SIZE(usbhsc_rcar_default_pipe); } if (!priv->dparam.pio_dma_border) priv->dparam.pio_dma_border = 64; /* 64byte */ diff --git a/drivers/usb/renesas_usbhs/common.h b/drivers/usb/renesas_usbhs/common.h index f6f527ca9b45..6b4b6f43d823 100644 --- a/drivers/usb/renesas_usbhs/common.h +++ b/drivers/usb/renesas_usbhs/common.h @@ -343,6 +343,7 @@ struct usbhs_priv *usbhs_pdev_to_priv(struct platform_device *pdev); #define usbhs_priv_to_dev(priv) (&priv->pdev->dev) #define usbhs_priv_to_lock(priv) (&priv->lock) +extern struct renesas_usbhs_driver_pipe_config usbhsc_rcar_default_pipe[]; extern struct renesas_usbhs_driver_pipe_config usbhsc_rcar_pipe[]; #endif /* RENESAS_USB_DRIVER_H */ diff --git a/drivers/usb/renesas_usbhs/rza.h b/drivers/usb/renesas_usbhs/rza.h index a29b75fef057..8b879aa34a20 100644 --- a/drivers/usb/renesas_usbhs/rza.h +++ b/drivers/usb/renesas_usbhs/rza.h @@ -3,3 +3,4 @@ extern const struct renesas_usbhs_platform_info usbhs_rza1_plat_info; extern const struct renesas_usbhs_platform_info usbhs_rza2_plat_info; +extern const struct renesas_usbhs_platform_info usbhs_rzg2l_plat_info; diff --git a/drivers/usb/renesas_usbhs/rza2.c b/drivers/usb/renesas_usbhs/rza2.c index f6660628eea9..de96c226c826 100644 --- a/drivers/usb/renesas_usbhs/rza2.c +++ b/drivers/usb/renesas_usbhs/rza2.c @@ -72,3 +72,18 @@ const struct renesas_usbhs_platform_info usbhs_rza2_plat_info = { .cfifo_byte_addr = 1, }, }; + +const struct renesas_usbhs_platform_info usbhs_rzg2l_plat_info = { + .platform_callback = { + .hardware_init = usbhs_rza2_hardware_init, + .hardware_exit = usbhs_rza2_hardware_exit, + .power_ctrl = usbhs_rza2_power_ctrl, + .get_id = usbhs_get_id_as_gadget, + }, + .driver_param = { + .pipe_configs = usbhsc_rcar_default_pipe, + .pipe_size = 10, + .has_cnen = 1, + .cfifo_byte_addr = 1, + }, +}; From patchwork Fri Mar 15 18:39:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13593876 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CDB281D553; Fri, 15 Mar 2024 18:39:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710527997; cv=none; b=SZXAn+9eV/nBoWo+1zgahoMTHAW+Jk06fkvnWoQ2DkGN+lT1XsjxqoJOL+tzBzgBbQy5hbIONJK/o6ZMAaUFFOTv1q9b+uCIsfbVgDRuhsCAnUnTLhBSl0+PJWDHEmKVDOA3wxrLLxpbxwE2x9vnj+fqnrRbN21L1FUtXThOyKA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710527997; c=relaxed/simple; bh=uic3T7rQvfFIXFjVObfPlrCqUs+JYzxI/5uyaUolwLU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tZH+A3QxmYrMmivnnQHTELG958KpvoFRUKMvZszeo6BZ5t1/5pOdLqozRGGTGTw+nwGedwtmdfEbpSGOBM8ob5/XJjptRjOz8TsWkgnWJiRLINTCtqeqoucUVIiTyUBnP1Mqpr+p5eAgUn54OSvH1hMPHGjy3XMsS7m50AxjmOQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-IronPort-AV: E=Sophos;i="6.07,129,1708354800"; d="scan'208";a="197917693" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 16 Mar 2024 03:39:52 +0900 Received: from localhost.localdomain (unknown [10.226.93.102]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id BC2D64066237; Sat, 16 Mar 2024 03:39:48 +0900 (JST) From: Biju Das To: Greg Kroah-Hartman Cc: Biju Das , Geert Uytterhoeven , Magnus Damm , Huy Nguyen , Rob Herring , Yoshihiro Shimoda , Krzysztof Kozlowski , =?utf-8?q?Uwe_Kleine-?= =?utf-8?q?K=C3=B6nig?= , linux-usb@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Prabhakar Mahadev Lad , Biju Das Subject: [PATCH v3 6/7] usb: renesas_usbhs: Remove trailing comma in the terminator entry for OF table Date: Fri, 15 Mar 2024 18:39:20 +0000 Message-Id: <20240315183921.375751-7-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240315183921.375751-1-biju.das.jz@bp.renesas.com> References: <20240315183921.375751-1-biju.das.jz@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Remove the trailing comma in the terminator entry for the OF table making code robust against (theoretical) misrebases or other similar things where the new entry goes _after_ the termination without the compiler noticing. Signed-off-by: Biju Das Reviewed-by: Geert Uytterhoeven --- v2->v3: * No change. v1->v2: * Added Rb tag from Geert. --- drivers/usb/renesas_usbhs/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c index 3c67cd9c4406..2c9c989a222a 100644 --- a/drivers/usb/renesas_usbhs/common.c +++ b/drivers/usb/renesas_usbhs/common.c @@ -597,7 +597,7 @@ static const struct of_device_id usbhs_of_match[] = { .compatible = "renesas,rzg2l-usbhs", .data = &usbhs_rzg2l_plat_info, }, - { }, + { } }; MODULE_DEVICE_TABLE(of, usbhs_of_match);