Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5fbf0e00 authored by Tarun Gupta's avatar Tarun Gupta
Browse files

USB: ice40: Add changes to support static compilation of ice40 driver



Userspace will come to know about uicc card insertion and use sysfs
interface to activate driver and binds driver. Add the requires module
parameter and fail the probe for uicc card till userspace activates this
driver through sysfs.

Userspace has to run following commands to activate driver:
	1. echo Y > /sys/module/ice40_hcd/parameters/uicc_card_present
	2. echo spi0.0 > /sys/bus/spi/drivers/ice40_spi/bind
Userspace has to run following commands to deactivate driver:
	1. echo spi0.0 > /sys/bus/spi/drivers/ice40_spi/unbind
	2. echo N > /sys/module/ice40_hcd/parameters/uicc_card_present

CRs-Fixed: 693926
Change-Id: I89db6d26c3cc13f73e4e5db6861a3d3cfaf35f8d
Signed-off-by: default avatarTarun Gupta <tarung@codeaurora.org>
parent 0d2b75a7
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -212,6 +212,10 @@ static bool debugger;
module_param(debugger, bool, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(debugger, "true to use the debug port");

static bool uicc_card_present;
module_param(uicc_card_present, bool, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(uicc_card_present, "UICC card is inserted");

static inline struct ice40_hcd *hcd_to_ihcd(struct usb_hcd *hcd)
{
	return *((struct ice40_hcd **) hcd->hcd_priv);
@@ -2276,6 +2280,12 @@ static int ice40_spi_probe(struct spi_device *spi)
	struct ice40_hcd *ihcd;
	int ret, i;

	if (!uicc_card_present) {
		pr_debug("UICC card is not inserted\n");
		ret = -ENODEV;
		goto out;
	}

	ihcd = devm_kzalloc(&spi->dev, sizeof(*ihcd), GFP_KERNEL);
	if (!ihcd) {
		pr_err("fail to allocate ihcd\n");