[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220423122756.GM374560@thinkpad>
Date: Sat, 23 Apr 2022 17:57:56 +0530
From: Manivannan Sadhasivam <mani@...nel.org>
To: Jeffrey Hugo <quic_jhugo@...cinc.com>
Cc: quic_hemantk@...cinc.com, quic_bbhatt@...cinc.com,
mhi@...ts.linux.dev, linux-arm-msm@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] bus: mhi: host: Add soc_reset sysfs
On Mon, Apr 18, 2022 at 11:18:47AM -0600, Jeffrey Hugo wrote:
> The MHI bus supports a standardized hardware reset, which is known as the
> "SoC Reset". This reset is similar to the reset sysfs for PCI devices -
> a hardware mechanism to reset the state back to square one.
>
> The MHI SoC Reset is described in the spec as a reset of last resort. If
> some unrecoverable error has occurred where other resets have failed, SoC
> Reset is the "big hammer" that ungracefully resets the device. This is
> effectivly the same as yanking the power on the device, and reapplying it.
> However, depending on the nature of the particular issue, the underlying
> transport link may remain active and configured. If the link remains up,
> the device will flag a MHI system error early in the boot process after
> the reset is executed, which allows the MHI bus to process a fatal error
> event, and clean up appropiately.
>
> While the SoC Reset is generally intended as a means of recovery when all
> else has failed, it can be useful in non-error scenarios. For example,
> if the device loads firmware from the host filesystem, the device may need
> to be fully rebooted inorder to pick up the new firmware. In this
> scenario, the system administrator may use the soc_reset sysfs to cause
> the device to pick up the new firmware that the admin placed on the
> filesystem.
>
> Signed-off-by: Jeffrey Hugo <quic_jhugo@...cinc.com>
> Reviewed-by: Bhaumik Bhatt <quic_bbhatt@...cinc.com>
> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
Applied to mhi-next!
Thanks,
Mani
> ---
>
> v3:
> Cleanup email domain change
>
> v2:
> Rebase
>
> Documentation/ABI/stable/sysfs-bus-mhi | 10 ++++++++++
> drivers/bus/mhi/host/init.c | 14 ++++++++++++++
> 2 files changed, 24 insertions(+)
>
> diff --git a/Documentation/ABI/stable/sysfs-bus-mhi b/Documentation/ABI/stable/sysfs-bus-mhi
> index ecfe766..96ccc33 100644
> --- a/Documentation/ABI/stable/sysfs-bus-mhi
> +++ b/Documentation/ABI/stable/sysfs-bus-mhi
> @@ -19,3 +19,13 @@ Description: The file holds the OEM PK Hash value of the endpoint device
> read without having the device power on at least once, the file
> will read all 0's.
> Users: Any userspace application or clients interested in device info.
> +
> +What: /sys/bus/mhi/devices/.../soc_reset
> +Date: April 2022
> +KernelVersion: 5.19
> +Contact: mhi@...ts.linux.dev
> +Description: Initiates a SoC reset on the MHI controller. A SoC reset is
> + a reset of last resort, and will require a complete re-init.
> + This can be useful as a method of recovery if the device is
> + non-responsive, or as a means of loading new firmware as a
> + system administration task.
> diff --git a/drivers/bus/mhi/host/init.c b/drivers/bus/mhi/host/init.c
> index a665b8e..a8c18c5f 100644
> --- a/drivers/bus/mhi/host/init.c
> +++ b/drivers/bus/mhi/host/init.c
> @@ -108,9 +108,23 @@ static ssize_t oem_pk_hash_show(struct device *dev,
> }
> static DEVICE_ATTR_RO(oem_pk_hash);
>
> +static ssize_t soc_reset_store(struct device *dev,
> + struct device_attribute *attr,
> + const char *buf,
> + size_t count)
> +{
> + struct mhi_device *mhi_dev = to_mhi_device(dev);
> + struct mhi_controller *mhi_cntrl = mhi_dev->mhi_cntrl;
> +
> + mhi_soc_reset(mhi_cntrl);
> + return count;
> +}
> +static DEVICE_ATTR_WO(soc_reset);
> +
> static struct attribute *mhi_dev_attrs[] = {
> &dev_attr_serial_number.attr,
> &dev_attr_oem_pk_hash.attr,
> + &dev_attr_soc_reset.attr,
> NULL,
> };
> ATTRIBUTE_GROUPS(mhi_dev);
> --
> 2.7.4
>
Powered by blists - more mailing lists