diff options
author | Linaro CI <ci_notify@linaro.org> | 2020-11-16 01:09:22 +0000 |
---|---|---|
committer | Linaro CI <ci_notify@linaro.org> | 2020-11-16 01:09:22 +0000 |
commit | a26ea57917516e66b4c9d47dad3f2e02b792da7d (patch) | |
tree | 38a05871f2d5e4d015926eacb75df23c351222bd | |
parent | 2594a943310fbd099ecd8dc02115ca1e63e62aa4 (diff) | |
parent | a4fd2fc7f1653f702a9edbbc7d4667b0edb7d284 (diff) |
Merge remote-tracking branch 'sdm845-usb/tracking-qcomlt-usb-renesas' into integration-linux-qcomlt
-rw-r--r-- | drivers/usb/host/xhci-pci-renesas.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/usb/host/xhci-pci-renesas.c b/drivers/usb/host/xhci-pci-renesas.c index f97ac9f52bf4..787f2605e5d9 100644 --- a/drivers/usb/host/xhci-pci-renesas.c +++ b/drivers/usb/host/xhci-pci-renesas.c @@ -2,6 +2,7 @@ /* Copyright (C) 2019-2020 Linaro Limited */ #include <linux/acpi.h> +#include <linux/debugfs.h> #include <linux/firmware.h> #include <linux/module.h> #include <linux/pci.h> @@ -156,6 +157,8 @@ static int renesas_fw_verify(const void *fw_data, return 0; } +static void debugfs_init(struct pci_dev *pdev); + static bool renesas_check_rom(struct pci_dev *pdev) { u16 rom_status; @@ -169,6 +172,7 @@ static bool renesas_check_rom(struct pci_dev *pdev) rom_status &= RENESAS_ROM_STATUS_ROM_EXISTS; if (rom_status) { dev_dbg(&pdev->dev, "External ROM exists\n"); + debugfs_init(pdev); return true; /* External ROM exists */ } @@ -432,6 +436,34 @@ static void renesas_rom_erase(struct pci_dev *pdev) dev_dbg(&pdev->dev, "ROM Erase... Done success\n"); } +static int debugfs_rom_erase(void *data, u64 value) +{ + struct pci_dev *pdev = data; + + if (value == 1) { + dev_dbg(&pdev->dev, "Userspace requested ROM erase\n"); + renesas_rom_erase(pdev); + return 0; + } + return -EINVAL; +} +DEFINE_DEBUGFS_ATTRIBUTE(rom_erase_ops, NULL, debugfs_rom_erase, "%llu\n"); + +static struct dentry *debugfs_root; + +static void debugfs_init(struct pci_dev *pdev) +{ + debugfs_root = debugfs_create_dir("renesas_usb", NULL); + + debugfs_create_file("rom_erase", 0200, debugfs_root, + pdev, &rom_erase_ops); +} + +static void debugfs_exit(void) +{ + debugfs_remove_recursive(debugfs_root); +} + static bool renesas_setup_rom(struct pci_dev *pdev, const struct firmware *fw) { const u32 *fw_data = (const u32 *)fw->data; @@ -622,6 +654,7 @@ EXPORT_SYMBOL_GPL(renesas_xhci_check_request_fw); void renesas_xhci_pci_exit(struct pci_dev *dev) { + debugfs_exit(); } EXPORT_SYMBOL_GPL(renesas_xhci_pci_exit); |