Skip to contentSkip to conversation

drivers/fsi: Don't scan hub on probe

PATCH In review Christopher Bostic 2 participants 5 messages Aug 3, 2017 – Aug 4, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover drivers/fsi: Don't scan hub on probe

Prevent hub master from scanning its devices during probe time. This is necessary to prevent bus contention issues with hostboot on hub links.

Christopher Bostic (2):
drivers/fsi: Defer hub master scan on probe
ARM: dts: fsi: Add hub master no scan on probe attribute

Signature · 1 line
1.8.2.2
#1 lore raw

PATCH 1/2 drivers/fsi: Defer hub master scan on probe

Prevent hub master from scanning its connected links/slaves at probe time. Needed to keep from creating arbitration conflicts on the hub connected links during host boot FSI bus accesses.

---
 drivers/fsi/fsi-core.c        | 3 +++
 drivers/fsi/fsi-master-gpio.c | 1 +
 drivers/fsi/fsi-master-hub.c  | 7 +++++++
 drivers/fsi/fsi-master.h      | 1 +
 4 files changed, 12 insertions(+)
drivers/fsi/fsi-core.c +3 -0
index 9b83f1a..3e00398 100644
@@ -927,6 +927,9 @@ int fsi_master_register(struct fsi_master *master)
 		return rc;
 	}
 
+	if (master->no_scan_on_probe)
+		return 0;
+
 	fsi_master_scan(master);
 
 	return 0;
drivers/fsi/fsi-master-gpio.c +1 -0
index 9e7a2ed..4e07b64 100644
@@ -650,6 +650,7 @@ static int fsi_master_gpio_probe(struct platform_device *pdev)
 	master->master.term = fsi_master_gpio_term;
 	master->master.send_break = fsi_master_gpio_break;
 	master->master.link_enable = fsi_master_gpio_link_enable;
+	master->master.no_scan_on_probe = false;
 	platform_set_drvdata(pdev, master);
 
 	fsi_master_gpio_init(master);
drivers/fsi/fsi-master-hub.c +7 -0
index 3223a67..94a61fc 100644
@@ -244,6 +244,7 @@ static int hub_master_probe(struct device *dev)
 {
 	struct fsi_device *fsi_dev = to_fsi_dev(dev);
 	struct fsi_master_hub *hub;
+	struct device_node *np;
 	uint32_t reg, links;
 	__be32 __reg;
 	int rc;
@@ -283,6 +284,12 @@ static int hub_master_probe(struct device *dev)
 	hub->master.send_break = hub_master_break;
 	hub->master.link_enable = hub_master_link_enable;
 
+	np = dev->of_node;
+	if (of_property_read_bool(np, "no-scan-on-probe"))
+		hub->master.no_scan_on_probe = true;
+	else
+		hub->master.no_scan_on_probe = false;
+
 	dev_set_drvdata(dev, hub);
 
 	hub_master_init(hub);
drivers/fsi/fsi-master.h +1 -0
index 546257d..7f8e288 100644
@@ -26,6 +26,7 @@ struct fsi_master {
 	int		idx;
 	int		n_links;
 	int		flags;
+	bool		no_scan_on_probe;
 	int		(*read)(struct fsi_master *, int link, uint8_t id,
 				uint32_t addr, void *val, size_t size);
 	int		(*write)(struct fsi_master *, int link, uint8_t id,
Signature · 1 line
1.8.2.2
#4 lore raw

PATCH 2/2 ARM: dts: fsi: Add hub master no scan on probe attribute

In reply to Christopher Bostic

Create a new hub master attribute to specify if it should scan its connected devices at probe time.

---
 arch/arm/boot/dts/ibm-power9-cfam.dtsi | 1 +
 1 file changed, 1 insertion(+)
arch/arm/boot/dts/ibm-power9-cfam.dtsi +1 -0
index 5630e02..cb4f99f 100644
@@ -127,6 +127,7 @@
 			reg = <0x3400 0x400>;
 			#address-cells = <2>;
 			#size-cells = <0>;
+			no-scan-on-probe;
 
 			cfam@1,0 {
 				reg = <1 0>;
Signature · 1 line
1.8.2.2
#2 lore raw

Re: [PATCH linux dev-4.10 1/2] drivers/fsi: Defer hub master scan on probe

In reply to Christopher Bostic

Hi Chris,

Quoted 4 lines

Prevent hub master from scanning its connected links/slaves at probe time. Needed to keep from creating arbitration conflicts on the hub connected links during host boot FSI bus accesses.

This change doesn't need to be specific to the hub code - this just makes it more complex.

As I mentioned yesterday, this can be done entirely in the fsi core. When a master is registered, it has a reference to the of_node; just check that. This way, we don't need to a) assume behaviour of different master types, or 2) implement this logic in every master.

So, the basis of the change will just be something like:

    diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
    --- a/drivers/fsi/fsi-core.c
    +++ b/drivers/fsi/fsi-core.c
    @@ -927,7 +927,9 @@ int fsi_master_register(struct fsi_master *master)
     		return rc;
     	}

    -	fsi_master_scan(master);
    +	np = dev_of_node(&master->dev);
    +	if (!np || !of_property_read_bool(np, "no-scan-on-init"))
    +		fsi_master_scan(master);

     	return 0;
     }

This way, the no-scan-on-init (or whatever would be a better name) node applies to the core, rather than every master implementation. Consequently, this property is related to compatible = fsi-master and not fsi-master-gpio or fsi-master-whatever-else.

[Also, don't forget to add this to the binding doc; it'd go in fsi.txt, under the "FSI Masters" section].

Regarding names, I wouldn't use "probe" in the property name, as it's a linux implementation detail. Some ideas:

- no-scan-on-init
- explicit-scan
- arbitration-required
- multiple-access

: the latter two indicating that other entities can access the device, so we need to be careful when scanning, and scan explicitly. Or, anything else that you think is appropriate (but doesn't imply any specific OS implementation.

Cheers,

Jeremy

#3 lore raw

Re: [PATCH linux dev-4.10 1/2] drivers/fsi: Defer hub master scan on probe

Quoted 47 lines · Jeremy Kerr

Hi Chris,

Quoted 4 lines

Prevent hub master from scanning its connected links/slaves at probe time. Needed to keep from creating arbitration conflicts on the hub connected links during host boot FSI bus accesses.

This change doesn't need to be specific to the hub code - this just makes it more complex.

As I mentioned yesterday, this can be done entirely in the fsi core. When a master is registered, it has a reference to the of_node; just check that. This way, we don't need to a) assume behaviour of different master types, or 2) implement this logic in every master.

So, the basis of the change will just be something like:

     diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
     --- a/drivers/fsi/fsi-core.c
     +++ b/drivers/fsi/fsi-core.c
     @@ -927,7 +927,9 @@ int fsi_master_register(struct fsi_master *master)
      		return rc;
      	}

     -	fsi_master_scan(master);
     +	np = dev_of_node(&master->dev);
     +	if (!np || !of_property_read_bool(np, "no-scan-on-init"))
     +		fsi_master_scan(master);

      	return 0;
      }

This way, the no-scan-on-init (or whatever would be a better name) node applies to the core, rather than every master implementation. Consequently, this property is related to compatible = fsi-master and not fsi-master-gpio or fsi-master-whatever-else.

[Also, don't forget to add this to the binding doc; it'd go in fsi.txt, under the "FSI Masters" section].

Regarding names, I wouldn't use "probe" in the property name, as it's a linux implementation detail. Some ideas:

- no-scan-on-init
- explicit-scan
- arbitration-required
- multiple-access

Quoted 4 lines

: the latter two indicating that other entities can access the device, so we need to be careful when scanning, and scan explicitly. Or, anything else that you think is appropriate (but doesn't imply any specific OS implementation.

Hi Jeremy,

Ok thanks for the detailed description. Will get version 2 out shortly.

Thanks,
Chris

Quoted 5 lines

Cheers,

Jeremy