Enabling the clock ( spi and sclk ) using function devm_clk_get fails

Hi Team ,

Could team please provide some pointers as to probable cause of “spi-tegra.c”
platform driver failure for tspi->clk = devm_clk_get(&pdev->dev, “spi”);
The changes i did were changing the driver & device name to "spi_tegra_0 " from
default “spi_tegra”

This i did because with the name of “spi_tegra” the probe of function was getting called multiple time with default name.

Thanks ,
Ashish Kumar Mishra.

Could team please provide some pointers as to probable cause of “spi-tegra.c” platform driver failure for tspi->clk = devm_clk_get(&pdev->dev, “spi”); The changes i did were changing the driver & device name to "spi_tegra_0 " from default “spi_tegra”

Just grepping for spi_tegra should have revealed that one.

This i did because with the name of “spi_tegra” the probe of function was getting called multiple time with default name.

Yes, of course as there are multiple instances of that same SPI IP present.

Dear Marcel ,

Have not gone through this particular file but will check it once , THANKS for file

I solved the problem with below mentioned workaround, mentioning so that it can help others if they faced similar problem.

Mentioning the workaround i did :-

1) w.r.t SPI clock

Debugging the behavior i got an idea that the allocation depends on the name passed for the driver . Going through the code of clk_get function i got that info. As the code traverse “SOME CLK TABLE” for the passed string . ( somehow file having clock shared by MARCEL got missed by me ) . Hence i reverted back the name string to default “spi_tegra”

2) w.r.t PROBE getting called multiple times

This was because there are multiple devices created with same naem “spi-tegra” , line 452 of
https://android.googlesource.com/kernel/tegra.git/+/android-tegra-3.10/arch/arm/mach-tegra/devices.c

For this i changed the devices name of all other instance of devices but retained the spi-0 name.

This both allowed to get clock & probe was called only once .
But will check the file shared by Marcel as it can help understanding point-1 much better now.

Thanks ,

Ashish Kumar Mishra

You are very welcome. BTW: Are you really running Google’s Linux 3.10 Android kernel on our module?

No , i am using the default linux distro cretaed by Yocto build.
The mach-tegra/devices.c link was the one i had bookmarked for my reference internally & hence shared .
Apologies if it caused any un-wanted confusion.