Skip to contentSkip to conversation

mmc: mmc_spi: add spi:mmc-spi-slot alias

PATCH In review Andreas Schwab 3 participants 15 messages Jul 21, 2021 – Jul 22, 2021

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

PATCH 1/1 mmc: mmc_spi: add spi:mmc-spi-slot alias

This allows the driver to be auto loaded.

---
 drivers/mmc/host/mmc_spi.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mmc/host/mmc_spi.c +1 -0
index 65c65bb5737f..103c450773df 100644
@@ -1542,3 +1542,4 @@ MODULE_AUTHOR("Mike Lavender, David Brownell, Hans-Peter Nilsson, Jan Nikitenko"
 MODULE_DESCRIPTION("SPI SD/MMC host driver");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("spi:mmc_spi");
+MODULE_ALIAS("spi:mmc-spi-slot");
Signature · 7 lines
2.32.0


-- 
Andreas Schwab, SUSE Labs, [email protected]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
#1 lore raw
Quoted 1 line · Andreas Schwab

This allows the driver to be auto loaded.

Can you elaborate a bit?

The driver has OF compatible strings and should be loaded automatically.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#2 lore raw
Quoted 1 line · Andy Shevchenko

The driver has OF compatible strings and should be loaded automatically.

They are never being used.

# udevadm info /sys/devices/platform/soc/10050000.spi/spi_master/spi1/spi1.0
P: /devices/platform/soc/10050000.spi/spi_master/spi1/spi1.0
L: 0
E: DEVPATH=/devices/platform/soc/10050000.spi/spi_master/spi1/spi1.0
E: DRIVER=mmc_spi
E: OF_NAME=mmc
E: OF_FULLNAME=/soc/spi@10050000/mmc@0
E: OF_COMPATIBLE_0=mmc-spi-slot
E: OF_COMPATIBLE_N=1
E: MODALIAS=spi:mmc-spi-slot
E: SUBSYSTEM=spi

Andreas.

Signature · 3 lines
Andreas Schwab, SUSE Labs, [email protected]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
#3 lore raw
Quoted 5 lines · Andreas Schwab
Quoted 1 line · Andy Shevchenko

The driver has OF compatible strings and should be loaded automatically.

They are never being used.

What do you mean by that?

Can you explain what is the _practical_ issue here? What is your HW setup and what you are trying to do?

Quoted 11 lines
# udevadm info /sys/devices/platform/soc/10050000.spi/spi_master/spi1/spi1.0
P: /devices/platform/soc/10050000.spi/spi_master/spi1/spi1.0
L: 0
E: DEVPATH=/devices/platform/soc/10050000.spi/spi_master/spi1/spi1.0
E: DRIVER=mmc_spi
E: OF_NAME=mmc
E: OF_FULLNAME=/soc/spi@10050000/mmc@0
E: OF_COMPATIBLE_0=mmc-spi-slot
E: OF_COMPATIBLE_N=1
E: MODALIAS=spi:mmc-spi-slot
E: SUBSYSTEM=spi
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw
Quoted 1 line · Andy Shevchenko

Can you explain what is the _practical_ issue here?

The module is not loaded by udev.

Quoted 1 line

What is your HW setup and what you are trying to do?

Booting the HiFive board without having to force loading the mmc_spi module.

Andreas.

Signature · 3 lines
Andreas Schwab, SUSE Labs, [email protected]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
#5 lore raw
Quoted 8 lines · Andreas Schwab
Quoted 1 line · Andy Shevchenko

Can you explain what is the _practical_ issue here?

The module is not loaded by udev.

Quoted 1 line

What is your HW setup and what you are trying to do?

Booting the HiFive board without having to force loading the mmc_spi module.

What is your DT excerpt for it?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#6 lore raw
Quoted 1 line · Andy Shevchenko

What is your DT excerpt for it?

arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts:

&qspi2 {
	status = "okay";
	mmc@0 {
		compatible = "mmc-spi-slot";
		reg = <0>;
		spi-max-frequency = <20000000>;
		voltage-ranges = <3300 3300>;
		disable-wp;
	};
};

Andreas.

Signature · 3 lines
Andreas Schwab, SUSE Labs, [email protected]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
#7 lore raw
Quoted 6 lines · Andreas Schwab
Quoted 1 line · Andy Shevchenko

What is your DT excerpt for it?

arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts:

Quoted 10 lines
&qspi2 {
	status = "okay";
	mmc@0 {
		compatible = "mmc-spi-slot";
		reg = <0>;
		spi-max-frequency = <20000000>;
		voltage-ranges = <3300 3300>;
		disable-wp;
	};
};

Hmm...

I have counted 89 device drivers in the kernel that have OF ID table without SPI ID table. I'm wondering if all of them need to be fixed.

Or problem is somewhere else?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#8 lore raw
Quoted 2 lines · Andy Shevchenko

I have counted 89 device drivers in the kernel that have OF ID table without SPI ID table. I'm wondering if all of them need to be fixed.

How does a SPI ID table look like?

Andreas.

Signature · 3 lines
Andreas Schwab, SUSE Labs, [email protected]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
#9 lore raw
Quoted 7 lines · Andreas Schwab
Quoted 2 lines · Andy Shevchenko

I have counted 89 device drivers in the kernel that have OF ID table without SPI ID table. I'm wondering if all of them need to be fixed.

How does a SPI ID table look like?

Plenty examples [1], like [2].

[1]: https://elixir.bootlin.com/linux/latest/A/ident/spi_device_id
[2]: https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/tiny/mi0283qt.c#L174

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#10 lore raw
In reply to Andy Shevchenko
Quoted 1 line · Andy Shevchenko

Or problem is somewhere else?

I don't know. Why does the spi subsystem put "spi:mmc-spi-slot" into the modalias file, instead of "of:N(null)T(null)Cmmc-spi-slot" or similar? The same problem exists with the other spi port on the board, which has a jedec,spi-nor instance attached, also not auto loading.

Andreas.

Signature · 3 lines
Andreas Schwab, SUSE Labs, [email protected]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
#11 lore raw
Quoted 8 lines · Andreas Schwab
Quoted 1 line · Andy Shevchenko

Or problem is somewhere else?

I don't know. Why does the spi subsystem put "spi:mmc-spi-slot" into the modalias file, instead of "of:N(null)T(null)Cmmc-spi-slot" or similar? The same problem exists with the other spi port on the board, which has a jedec,spi-nor instance attached, also not auto loading.

You see, there are two unrelated drivers that share the same issue (the common denominator is that they are SPI devices). I believe the issue is somewhere in the SPI core rather than here.

Compare the code of
https://elixir.bootlin.com/linux/latest/source/drivers/i2c/i2c-core-base.c#L649
vs.
https://elixir.bootlin.com/linux/latest/source/drivers/spi/spi.c#L56

and

https://elixir.bootlin.com/linux/latest/source/drivers/i2c/i2c-core-base.c#L139
vs.
https://elixir.bootlin.com/linux/latest/source/drivers/spi/spi.c#L361

The culprit is this one:
https://lore.kernel.org/lkml/[email protected]/

and in my humble opinion must be reverted.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#12 lore raw
Quoted 26 lines · Andy Shevchenko
Quoted 8 lines · Andreas Schwab
Quoted 1 line · Andy Shevchenko

Or problem is somewhere else?

I don't know. Why does the spi subsystem put "spi:mmc-spi-slot" into the modalias file, instead of "of:N(null)T(null)Cmmc-spi-slot" or similar? The same problem exists with the other spi port on the board, which has a jedec,spi-nor instance attached, also not auto loading.

You see, there are two unrelated drivers that share the same issue (the common denominator is that they are SPI devices). I believe the issue is somewhere in the SPI core rather than here.

Compare the code of
https://elixir.bootlin.com/linux/latest/source/drivers/i2c/i2c-core-base.c#L649
vs.
https://elixir.bootlin.com/linux/latest/source/drivers/spi/spi.c#L56

and

https://elixir.bootlin.com/linux/latest/source/drivers/i2c/i2c-core-base.c#L139
vs.
https://elixir.bootlin.com/linux/latest/source/drivers/spi/spi.c#L361

Quoted 4 lines

The culprit is this one:
https://lore.kernel.org/lkml/[email protected]/

and in my humble opinion must be reverted.

Oops, I have been too fast. It's not related to SPI in general, sorry guys. But the idea you have got from above, I believe.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#13 lore raw
In reply to Andy Shevchenko
Quoted 10 lines · Andy Shevchenko

Compare the code of
https://elixir.bootlin.com/linux/latest/source/drivers/i2c/i2c-core-base.c#L649
vs.
https://elixir.bootlin.com/linux/latest/source/drivers/spi/spi.c#L56

and

https://elixir.bootlin.com/linux/latest/source/drivers/i2c/i2c-core-base.c#L139
vs.
https://elixir.bootlin.com/linux/latest/source/drivers/spi/spi.c#L361

Thanks, I think I now know how to fix it correctly.

Andreas.

Signature · 3 lines
Andreas Schwab, SUSE Labs, [email protected]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
#14 lore raw
Quoted 7 lines · Andreas Schwab
Quoted 5 lines · Andy Shevchenko

Compare the code of
https://elixir.bootlin.com/linux/latest/source/drivers/i2c/i2c-core-base.c#L649
vs.
https://elixir.bootlin.com/linux/latest/source/drivers/spi/spi.c#L56

Quoted 7 lines
Quoted 5 lines

and

https://elixir.bootlin.com/linux/latest/source/drivers/i2c/i2c-core-base.c#L139
vs.
https://elixir.bootlin.com/linux/latest/source/drivers/spi/spi.c#L361

Thanks, I think I now know how to fix it correctly.

In fact, the correct fix has already been installed in commit 3ce6c9e2617e ("spi: add of_device_uevent_modalias support"), which is part of -rc1, just incomplete, which explains the inconsistency above.

Andreas.

Signature · 3 lines
Andreas Schwab, SUSE Labs, [email protected]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."