From: E Shattow <e@freeshell.de>
To: Marek Vasut <marex@denx.de>,
Minda Chen <minda.chen@starfivetech.com>,
Tom Rini <trini@konsulko.com>, Roger Quadros <rogerq@kernel.org>,
Rick Chen <rick@andestech.com>, Leo <ycliang@andestech.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Alexey Romanov <avromanov@salutedevices.com>,
Sumit Garg <sumit.garg@linaro.org>,
Mark Kettenis <kettenis@openbsd.org>, Nishanth Menon <nm@ti.com>
Cc: u-boot@lists.denx.de, Heinrich Schuchardt <xypron.glpk@gmx.de>,
Simon Glass <sjg@chromium.org>
Subject: Re: [PATCH v5 4/8] usb: cdns: starfive: Add cdns USB driver
Date: Sun, 15 Dec 2024 23:37:39 -0800 [thread overview]
Message-ID: <e95e2ea7-580e-4d4a-8478-f340dcef426a@freeshell.de> (raw)
In-Reply-To: <31f013c0-fce7-4d9f-83a5-c7067119a994@denx.de>
On 10/11/24 20:34, Marek Vasut wrote:
> On 10/12/24 5:13 AM, Minda Chen wrote:
>> Add cdns USB3 wrapper driver. And cdns core driver also get
>> dr mode from wrapper devcie dts node to make it is same with
>> Starfive cdns USB Linux kernel driver, preparing for enable
>> OF_UPSTREAM.
>>
>> Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
>> ---
>> drivers/usb/cdns3/Kconfig | 7 ++
>> drivers/usb/cdns3/Makefile | 2 +
>> drivers/usb/cdns3/cdns3-starfive.c | 183 +++++++++++++++++++++++++++++
>> drivers/usb/cdns3/core.c | 3 +
>> 4 files changed, 195 insertions(+)
>> create mode 100644 drivers/usb/cdns3/cdns3-starfive.c
>>
>> diff --git a/drivers/usb/cdns3/Kconfig b/drivers/usb/cdns3/Kconfig
>> index 35b61497d9c..6c9595c3c49 100644
>> --- a/drivers/usb/cdns3/Kconfig
>> +++ b/drivers/usb/cdns3/Kconfig
>> @@ -55,4 +55,11 @@ config USB_CDNS3_TI
>> help
>> Say 'Y' here if you are building for Texas Instruments
>> platforms that contain Cadence USB3 controller core. E.g.: J721e.
>> +
>> +config USB_CDNS3_STARFIVE
>> + tristate "Cadence USB3 support on Starfive platforms"
>> + default y if STARFIVE_JH7110
>> + help
>> + Say 'Y' here if you are building for Starfive platforms
>> + that contain Cadence USB3 controller core. E.g.: JH7110.
>> endif
>
> Keep the list sorted.
>
>> diff --git a/drivers/usb/cdns3/Makefile b/drivers/usb/cdns3/Makefile
>> index 18d7190755d..03d1eadb2ff 100644
>> --- a/drivers/usb/cdns3/Makefile
>> +++ b/drivers/usb/cdns3/Makefile
>> @@ -9,3 +9,5 @@ cdns3-$(CONFIG_$(SPL_)USB_CDNS3_GADGET) += gadget.o
>> ep0.o
>> cdns3-$(CONFIG_$(SPL_)USB_CDNS3_HOST) += host.o
>> obj-$(CONFIG_USB_CDNS3_TI) += cdns3-ti.o
>> +
>> +obj-$(CONFIG_USB_CDNS3_STARFIVE) += cdns3-starfive.o
>
> Keep the list sorted.
>
>> diff --git a/drivers/usb/cdns3/cdns3-starfive.c b/drivers/usb/cdns3/
>> cdns3-starfive.c
>> new file mode 100644
>> index 00000000000..fad05451c80
>> --- /dev/null
>> +++ b/drivers/usb/cdns3/cdns3-starfive.c
>> @@ -0,0 +1,183 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/*
>> + * cdns3-starfive.c - StarFive specific Glue layer for Cadence USB
>> Controller
>> + *
>> + * Copyright (C) 2024 StarFive Technology Co., Ltd.
>> + *
>> + * Author: Minda Chen <minda.chen@starfivetech.com>
>> + */
>> +
>> +#include <asm/io.h>
>> +#include <clk.h>
>> +#include <dm.h>
>> +#include <dm/device_compat.h>
>> +#include <linux/bitops.h>
>> +#include <linux/usb/otg.h>
>> +#include <reset.h>
>> +#include <regmap.h>
>> +#include <syscon.h>
>> +#include <malloc.h>
>> +
>> +#include "core.h"
>> +
>> +#define USB_STRAP_HOST BIT(17)
>> +#define USB_STRAP_DEVICE BIT(18)
>> +#define USB_STRAP_MASK GENMASK(18, 16)
>> +
>> +#define USB_SUSPENDM_HOST BIT(19)
>> +#define USB_SUSPENDM_MASK BIT(19)
>> +
>> +#define USB_MISC_CFG_MASK GENMASK(23, 20)
>> +#define USB_SUSPENDM_BYPS BIT(20)
>> +#define USB_PLL_EN BIT(22)
>> +#define USB_REFCLK_MODE BIT(23)
>> +
>> +struct cdns_starfive {
>> + struct udevice *dev;
>> + struct regmap *stg_syscon;
>> + struct reset_ctl_bulk resets;
>> + struct clk_bulk clks;
>> + u32 stg_usb_mode;
>> + enum usb_dr_mode mode;
>> +};
>> +
>> +static void cdns_mode_init(struct cdns_starfive *data, enum
>> usb_dr_mode mode)
>> +{
>> + unsigned int strap, suspendm;
>> +
>> + regmap_update_bits(data->stg_syscon, data->stg_usb_mode,
>> + USB_MISC_CFG_MASK,
>> + USB_SUSPENDM_BYPS | USB_PLL_EN | USB_REFCLK_MODE);
>> +
>> + switch (mode) {
>> + case USB_DR_MODE_HOST:
>> + strap = USB_STRAP_HOST;
>> + suspendm = USB_SUSPENDM_HOST;
>> + break;
>> +
>
> Drop the newline please.
>
>> + case USB_DR_MODE_PERIPHERAL:
>> + strap = USB_STRAP_DEVICE;
>> + suspendm = 0;
>> + break;
>> + default:
>> + return;
>> + }
>> +
>> + regmap_update_bits(data->stg_syscon, data->stg_usb_mode,
>> + USB_SUSPENDM_MASK | USB_STRAP_MASK,
>> + strap | suspendm);
>> +}
>
> [...]
>
>> diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c
>> index cbe06a9e7b6..9d0a56fd0e7 100644
>> --- a/drivers/usb/cdns3/core.c
>> +++ b/drivers/usb/cdns3/core.c
>> @@ -410,6 +410,9 @@ int cdns3_bind(struct udevice *parent)
>> name = ofnode_get_name(node);
>> dr_mode = usb_get_dr_mode(node);
>> + if (dr_mode == USB_DR_MODE_UNKNOWN)
>> + dr_mode = usb_get_dr_mode(dev_ofnode(parent));
> Separate patch for core changes please.
Hi, Minda, can you send v6 with requested changes by Marek and drop
patch 7/8 ("dts: starfive: Add JH7110 Cadence USB dts node")? Thanks! -E
next prev parent reply other threads:[~2024-12-16 7:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-12 3:13 [PATCH v5 0/8] Add Starfive JH7110 Cadence USB driver Minda Chen
2024-10-12 3:13 ` [PATCH v5 1/8] usb: cdns3: Set USB PHY mode in cdns3_drd_update_mode() Minda Chen
2024-10-12 3:13 ` [PATCH v5 2/8] phy: starfive: Add Starfive JH7110 USB 2.0 PHY driver Minda Chen
2024-10-12 3:13 ` [PATCH v5 3/8] phy: starfive: Add Starfive JH7110 PCIe " Minda Chen
2024-10-12 3:13 ` [PATCH v5 4/8] usb: cdns: starfive: Add cdns USB driver Minda Chen
2024-10-12 3:34 ` Marek Vasut
2024-12-16 7:37 ` E Shattow [this message]
2024-12-19 8:28 ` 回复: " Minda Chen
2024-10-12 3:13 ` [PATCH v5 5/8] spl: starfive: visionfive2: Disable USB overcurrent pin by default Minda Chen
2024-10-12 3:13 ` [PATCH v5 6/8] configs: starfive: Add visionfive2 cadence USB configuration Minda Chen
2024-10-12 3:13 ` [PATCH v5 7/8] dts: starfive: Add JH7110 Cadence USB dts node Minda Chen
2024-12-16 7:31 ` E Shattow
2024-10-12 3:13 ` [PATCH v5 8/8] MAINTAINERS: Update Starfive visionfive2 maintain files Minda Chen
2024-11-22 8:16 ` [PATCH v5 0/8] Add Starfive JH7110 Cadence USB driver E Shattow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e95e2ea7-580e-4d4a-8478-f340dcef426a@freeshell.de \
--to=e@freeshell.de \
--cc=avromanov@salutedevices.com \
--cc=kettenis@openbsd.org \
--cc=marex@denx.de \
--cc=minda.chen@starfivetech.com \
--cc=neil.armstrong@linaro.org \
--cc=nm@ti.com \
--cc=rick@andestech.com \
--cc=rogerq@kernel.org \
--cc=sjg@chromium.org \
--cc=sumit.garg@linaro.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
--cc=xypron.glpk@gmx.de \
--cc=ycliang@andestech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox