spi: tegra114: add spi driver
Subsystems (4)
Laxman Dewangan
maintainerPATCH 1/1 spi: tegra114: add spi driver
Add spi driver for NVIDIA's Tegra114 spi controller. This controller is different than the older SoCs spi controller in internal design as well as register interface.
This driver supports the:
- non DMA based transfer for smaller transfer i.e. less than FIFO depth.
- APB DMA based transfer for lager transfer i.e. more than FIFO depth.
- Clock gating through runtime PM callbacks.
- registration through DT only.
--- .../bindings/spi/nvidia,spi-tegra114.txt | 25 + drivers/spi/Kconfig | 8 + drivers/spi/Makefile | 1 + drivers/spi/spi-tegra114.c | 1259 ++++++++++++++++++++ 4 files changed, 1293 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/spi/nvidia,spi-tegra114.txt create mode 100644 drivers/spi/spi-tegra114.c
Documentation/devicetree/bindings/spi/nvidia,spi-tegra114.txt new file +25 -0
@@ -0,0 +1,25 @@ +NVIDIA Tegra114 SPI controller. + +Required properties: +- compatible : should be "nvidia,tegra114-spi". +- reg: Should contain SPI registers location and length. +- interrupts: Should contain SPI interrupts. +- nvidia,dma-request-selector : The Tegra DMA controller's phandle and + request selector for this SPI controller. + +Recommended properties: +- spi-max-frequency: Definition as per + Documentation/devicetree/bindings/spi/spi-bus.txt +Example: + +spi@7000d600 { + compatible = "nvidia,tegra114-spi"; + reg = <0x7000d600 0x200>; + interrupts = <0 82 0x04>; + nvidia,dma-request-selector = <&apbdma 16>; + spi-max-frequency = <25000000>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; +}; +
drivers/spi/Kconfig +8 -0
@@ -405,6 +405,14 @@ config SPI_TEGRA20_SFLASH The main usecase of this controller is to use spi flash as boot device. +config SPI_TEGRA114 + tristate "Nvidia Tegra114 SPI Controller" + depends on ARCH_TEGRA && TEGRA20_APB_DMA + help + SPI driver for Nvidia Tegra114 SPI Controller interface. This controller + is different than the older SoCs spi controller and also register interface + get changed with this controller. + config SPI_TEGRA20_SLINK tristate "Nvidia Tegra20/Tegra30 SLINK Controller" depends on ARCH_TEGRA && TEGRA20_APB_DMA
drivers/spi/Makefile +1 -0
@@ -64,6 +64,7 @@ obj-$(CONFIG_SPI_SH_MSIOF) += spi-sh-msiof.o obj-$(CONFIG_SPI_SH_SCI) += spi-sh-sci.o obj-$(CONFIG_SPI_SIRF) += spi-sirf.o obj-$(CONFIG_SPI_TEGRA20_SFLASH) += spi-tegra20-sflash.o +obj-$(CONFIG_SPI_TEGRA114) += spi-tegra114.o obj-$(CONFIG_SPI_TEGRA20_SLINK) += spi-tegra20-slink.o obj-$(CONFIG_SPI_TI_SSP) += spi-ti-ssp.o obj-$(CONFIG_SPI_TLE62X0) += spi-tle62x0.o
drivers/spi/spi-tegra114.c new file +1259 -0
1,259 lines not on this page · raw message
Signature · 1 line
1.7.1.1
Quoted 3 lines · Laxman Dewangan
Add spi driver for NVIDIA's Tegra114 spi controller. This controller is different than the older SoCs spi controller in internal design as well as register interface.
Nit: SPI should be capitalized. Also in Kconfig below.
Documentation/devicetree/bindings/spi/nvidia,spi-tegra114.txt
Quoted 1 line
Documentation/devicetree/bindings/spi/nvidia,spi-tegra114.txt +0
-0
This file should be named nvidia,tegra114-spi.txt, so that it matches the compatible value it describes.
drivers/spi/Kconfig config SPI_TEGRA20_SFLASH · line 409
Quoted 4 lines
drivers/spi/Kconfig +2
-0+config SPI_TEGRA114 + tristate "Nvidia Tegra114 SPI Controller"
NVIDIA should be capitalized. Also in the help description below.
drivers/spi/Makefile obj-$(CONFIG_SPI_SH_MSIOF) += spi-sh-msiof.o · line 69
Quoted 7 lines
drivers/spi/Makefile +1
-0obj-$(CONFIG_SPI_SIRF) += spi-sirf.o obj-$(CONFIG_SPI_TEGRA20_SFLASH) += spi-tegra20-sflash.o +obj-$(CONFIG_SPI_TEGRA114) += spi-tegra114.o obj-$(CONFIG_SPI_TEGRA20_SLINK) += spi-tegra20-slink.o obj-$(CONFIG_SPI_TI_SSP) += spi-ti-ssp.o
The Makefile should be sorted; Tegra114 comes before Tegra20*.
Quoted 3 lines
drivers/spi/spi-tegra114.c +1
-0+static unsigned tegra_spi_calculate_curr_xfer_param(
...
drivers/spi/spi-tegra114.c line 271
Quoted 2 lines
drivers/spi/spi-tegra114.c +2
-0+ bits_per_word = t->bits_per_word ? t->bits_per_word : + spi->bits_per_word;
I thought I'd seen patches so this conditional wasn't needed any more; isn't t->bit_per_word always set correctly by the SPI core now? Certainly the existing spi-tegra20-slink.c doesn't seem to have any conditional here.
A similar comment applies in tegra_spi_read_rx_fifo_to_client_rxbuf() and tegra_spi_copy_spi_rxbuf_to_client_rxbuf().
drivers/spi/spi-tegra114.c line 285
Quoted 1 line
drivers/spi/spi-tegra114.c +1
-0+ total_fifo_words = (max_len +3 )/4 ;
Need spaces around /. The same comment applies in some other places; please search for them. Was checkpatch run? I'm not sure if catches this.
spi-tegra20-slink.c doesn't have that rounding; is just says:
total_fifo_words = max_len / 4;
Is that a bug in the old driver?
Quoted 2 lines
drivers/spi/spi-tegra114.c +2
-0+static int tegra_spi_start_dma_based_transfer ( +struct tegra_spi_data *tspi,struct spi_transfer *t)
...
drivers/spi/spi-tegra114.c line 535
Quoted 3 lines
drivers/spi/spi-tegra114.c +3
-0+if (tspi->cur_direction &DATA_DIR_TX ) { +tegra_spi_copy_client_txbuf_to_spi_txbuf (tspi, t); + ret =tegra_spi_start_tx_dma (tspi, len);
In spi-tegra20-slink.c, there's a wmb() right between those last two lines. Is it needed here?
Quoted 3 lines
drivers/spi/spi-tegra114.c +3
-0+static int tegra_spi_start_transfer_one (struct spi_device *spi, +struct spi_transfer *t,bool is_first_of_msg, +bool is_single_xfer)
...
drivers/spi/spi-tegra114.c line 730
Quoted 6 lines
drivers/spi/spi-tegra114.c +6
-0+/* possibly use the hw based chip select */ + command1 |=SPI_CS_SW_HW ; +if (spi->mode &SPI_CS_HIGH ) + command1 |=SPI_CS_SS_VAL ; +else + command1 &= ~SPI_CS_SS_VAL ;
Why "possibly"; the code seems to always use HW chip select.
Quoted 2 lines
drivers/spi/spi-tegra114.c +2
-0+static int tegra_spi_transfer_one_message (struct spi_master *master, +struct spi_message *msg)
...
drivers/spi/spi-tegra114.c line 829
Quoted 7 lines
drivers/spi/spi-tegra114.c +7
-0+ ret =pm_runtime_get_sync (tspi->dev); +if (ret <0 ) { +dev_err (tspi->dev,"runtime PM get failed: %d\n" , ret); + msg->status = ret; +spi_finalize_current_message (master); +return ret; + }
In the older Tegra SPI drivers, the PM runtime logic was was of master->{un,}prepare_transfer. I'm curious why it's implemented differently here.
Quoted 2 lines
drivers/spi/spi-tegra114.c +2
-0+static void tegra_spi_parse_dt (struct platform_device *pdev, +struct tegra_spi_data *tspi)
...
drivers/spi/spi-tegra114.c line 1028
Quoted 3 lines
drivers/spi/spi-tegra114.c +3
-0+ prop =of_get_property (np,"spi-max-frequency" ,NULL ); +if (prop) + tspi->spi_max_frequency =be32_to_cpup (prop);
The following might be better:
if (of_property_read_u32(np, "spi-max-frequency",
&tspi->spi_max_frequency))
tspi->spi_max_frequency = 25000000; /* 25MHz */(and you can remove the check of !tspi->spi_max_frequency from probe() then too)
Quoted 1 line
+static int
tegra_spi_probe(struct platform_device *pdev)
...
drivers/spi/spi-tegra114.c line 1047
Quoted 4 lines
drivers/spi/spi-tegra114.c +4
-0+if (!pdev->dev.of_node) { +dev_err (&pdev->dev,"Driver support DT registration only\n" ); +return -ENODEV ; + }
I don't think there's much point checking that; see the Tegra20 SPI cleanup patches I posted a couple days ago.
drivers/spi/spi-tegra114.c line 1081
Quoted 2 lines
drivers/spi/spi-tegra114.c +2
-0+ tspi->base =devm_request_and_ioremap (&pdev->dev, r); +if (!tspi->base) {
The existing Tegra20 driver checks if (IS_ERR(tspi->base)) here. Which is wrong?
drivers/spi/spi-tegra114.c line 1099
Quoted 1 line
drivers/spi/spi-tegra114.c +1
-0+ tspi->clk =devm_clk_get (&pdev->dev,"spi" );
Does this HW block use multiple clocks? If not, I think s/"spi"/NULL/ there, just like the Tegra20 driver.
As an overall comment, this driver is textually perhaps 80-90% the same as spi-tegra20-slink.c. Instead of creating a completely new driver, how nasty would a unified driver look; one which contained some runtime conditionals for the register layout and programming differences? It might be worth looking at, although perhaps it would turn out to be a crazy mess, so a separate driver really is appropriate.
Laxman Dewangan
maintainerQuoted 7 lines · Stephen Warren
drivers/spi/spi-tegra114.c line 271
Quoted 2 lines · Laxman Dewangan
drivers/spi/spi-tegra114.c new file +2
-0+ bits_per_word = t->bits_per_word ? t->bits_per_word : + spi->bits_per_word;I thought I'd seen patches so this conditional wasn't needed any more; isn't
t->bit_per_wordalways set correctly by the SPI core now? Certainly the existingspi-tegra20-slink.cdoesn't seem to have any conditional here.
Yes, core have changes. I will remove this check.
Quoted 8 lines
A similar comment applies in
tegra_spi_read_rx_fifo_to_client_rxbuf()andtegra_spi_copy_spi_rxbuf_to_client_rxbuf().drivers/spi/spi-tegra114.c line 285
Quoted 1 line
drivers/spi/spi-tegra114.c new file +1
-0+ total_fifo_words = (max_len +3 )/4 ;Need spaces around /. The same comment applies in some other places; please search for them. Was checkpatch run? I'm not sure if catches this.
Quoted 5 lines
spi-tegra20-slink.cdoesn't have that rounding; is just says:total_fifo_words = max_len / 4;Is that a bug in the old driver?
I will check and fix the either place.
Quoted 6 lines
drivers/spi/spi-tegra114.c line 535
Quoted 4 lines
drivers/spi/spi-tegra114.c new file +3
-0+if (tspi->cur_direction &DATA_DIR_TX ) { +tegra_spi_copy_client_txbuf_to_spi_txbuf (tspi, t); + ret =tegra_spi_start_tx_dma (tspi, len);In
spi-tegra20-slink.c, there's awmb()right between those last two lines. Is it needed here?
I think wmb() is no require and hence not keeping here. Perhaps I got the review feedback when I was working on serial tegra driver.
Quoted 5 lines
Quoted 4 lines
drivers/spi/spi-tegra114.c new file +3
-0+static int tegra_spi_start_transfer_one (struct spi_device *spi, +struct spi_transfer *t,bool is_first_of_msg, +bool is_single_xfer)...
Quoted 7 lines
drivers/spi/spi-tegra114.c line 730
Quoted 6 lines
drivers/spi/spi-tegra114.c new file +6
-0+/* possibly use the hw based chip select */ + command1 |=SPI_CS_SW_HW ; +if (spi->mode &SPI_CS_HIGH ) + command1 |=SPI_CS_SS_VAL ; +else + command1 &= ~SPI_CS_SS_VAL ;Why "possibly"; the code seems to always use HW chip select.
Yes, wrong comment. Remove the controller_data from driver but forgot to remove this comment.
Quoted 10 lines
drivers/spi/spi-tegra114.c line 829
Quoted 7 lines
drivers/spi/spi-tegra114.c new file +7
-0+ ret =pm_runtime_get_sync (tspi->dev); +if (ret <0 ) { +dev_err (tspi->dev,"runtime PM get failed: %d\n" , ret); + msg->status = ret; +spi_finalize_current_message (master); +return ret; + }In the older Tegra SPI drivers, the PM runtime logic was was of master->{un,}prepare_transfer. I'm curious why it's implemented differently here.
The prepare is called in atomic context and in this we are calling pm_runtime_get_sync() which is blocking and it can cause issue.
I have already bug reported by you that sometimes you saw locking in tegra20 slink driver which we need to fix. When testing this, I ran into similar case and hence now moving this out or prepare.
I will push the change for fixing this in tegra20_slink driver also.
Quoted 11 lines
drivers/spi/spi-tegra114.c line 1028
Quoted 3 lines
drivers/spi/spi-tegra114.c new file +3
-0+ prop =of_get_property (np,"spi-max-frequency" ,NULL ); +if (prop) + tspi->spi_max_frequency =be32_to_cpup (prop);The following might be better:
if (of_property_read_u32(np, "spi-max-frequency", &tspi->spi_max_frequency)) tspi->spi_max_frequency = 25000000; /* 25MHz */(and you can remove the check of !tspi->spi_max_frequency from
probe()then too)
Yes, Agree. Will do.
Quoted 10 lines
Quoted 2 lines
+static int
tegra_spi_probe(struct platform_device *pdev)...
drivers/spi/spi-tegra114.c line 1047
Quoted 4 lines
drivers/spi/spi-tegra114.c new file +4
-0+if (!pdev->dev.of_node) { +dev_err (&pdev->dev,"Driver support DT registration only\n" ); +return -ENODEV ; + }I don't think there's much point checking that; see the Tegra20 SPI cleanup patches I posted a couple days ago.
Quoted 4 lines
drivers/spi/spi-tegra114.c line 1081
Quoted 2 lines
drivers/spi/spi-tegra114.c new file +2
-0+ tspi->base =devm_request_and_ioremap (&pdev->dev, r); +if (!tspi->base) {The existing Tegra20 driver checks if (
IS_ERR(tspi->base)) here. Which is wrong?
The tegra20 driver use the devm_ioremap_resource() which is new API get added recently. I will change this driver to use this one.
Quoted 3 lines
drivers/spi/spi-tegra114.c line 1099
Quoted 1 line
drivers/spi/spi-tegra114.c new file +1
-0+ tspi->clk =devm_clk_get (&pdev->dev,"spi" );Does this HW block use multiple clocks? If not, I think s/"spi"/NULL/ there, just like the Tegra20 driver.
No, spi controller uses the only one clock. I will change to NULL.
Quoted 7 lines
As an overall comment, this driver is textually perhaps 80-90% the same as
spi-tegra20-slink.c. Instead of creating a completely new driver, how nasty would a unified driver look; one which contained some runtime conditionals for the register layout and programming differences? It might be worth looking at, although perhaps it would turn out to be a crazy mess, so a separate driver really is appropriate.
We had created the similarly in past where common part is in same file and controller specific is in the different file as hal file but the driver becomes complex. It was not easy to add any feature as the require api need to be added in all places for hal. We were about to split the driver separately but before then we moved to Linux.
So first look, it is great but adding feature/maintaining/enhancing is difficult. I like to go with separate driver until there is much pushback to make it one.
Quoted 6 lines · Laxman Dewangan
Quoted 3 lines · Stephen Warren
In the older Tegra SPI drivers, the PM runtime logic was was of master->{un,}prepare_transfer. I'm curious why it's implemented differently here.
Quoted 8 lines
The prepare is called in atomic context and in this we are calling
pm_runtime_get_sync()which is blocking and it can cause issue.I have already bug reported by you that sometimes you saw locking in tegra20 slink driver which we need to fix. When testing this, I ran into similar case and hence now moving this out or prepare.
I will push the change for fixing this in
tegra20_slinkdriver also.
As I think I've said before I keep thinking we ought to just have some basic runtime PM code in the core - a substantial proportion of drivers end up following the same pattern, it'd be surprising to see hardware that needed a different pattern.
Quoted 6 lines
Quoted 4 lines
drivers/spi/spi-tegra114.c line 1099
Quoted 1 line
drivers/spi/spi-tegra114.c new file +1
-0+ tspi->clk =devm_clk_get (&pdev->dev,"spi" );Does this HW block use multiple clocks? If not, I think s/"spi"/NULL/ there, just like the Tegra20 driver.
No, spi controller uses the only one clock. I will change to NULL.
I'm never convinced that NULL is a helpful clock name to pick, it's not awesome if you ever acquire a second clock.
_______________________________________________
devicetree-discuss mailing list devicetree-discuss-uLR06cmDAlY/[email protected]
https://lists.ozlabs.org/listinfo/devicetree-discuss
Laxman Dewangan
maintainerQuoted 9 lines · Mark Brown
* PGP Signed by an unknown key
Quoted 4 lines · Laxman Dewangan
Quoted 3 lines
drivers/spi/spi-tegra114.c line 1099
Quoted 1 line
drivers/spi/spi-tegra114.c new file +1
-0+ tspi->clk =devm_clk_get (&pdev->dev,"spi" );Does this HW block use multiple clocks? If not, I think s/"spi"/NULL/ there, just like the Tegra20 driver.
No, spi controller uses the only one clock. I will change to NULL.
I'm never convinced that NULL is a helpful clock name to pick, it's not awesome if you ever acquire a second clock.
I had other idea of okeeping clock name here for power optimization.
Spi controller can take the power source ffrom different clock source say clk_m (crystal) and pllp.
I want to set the parent clock dynamically based on required speed so that if the desire speed can be meet from clk_m, no need to increase pll count and possible we may endup with siwtchng off pllp which can save power.
So for this I may require
spi_clk = devm_clk_get(&pdev->dev, "spi");spi_clkm = devm_clk_get(&pdev->dev, "clmkm");spi_pllp = devm_clk_get(&pdev->dev, "pllp");
and call clk_set_parent(spi_clk, spi_clkm) or clk_set_parent(spi_clk, spi_pllp).
Quoted 5 lines · Laxman Dewangan
spi_clk=devm_clk_get(&pdev->dev, "spi");spi_clkm=devm_clk_get(&pdev->dev, "clmkm");spi_pllp=devm_clk_get(&pdev->dev, "pllp");and call
clk_set_parent(spi_clk, spi_clkm)orclk_set_parent(spi_clk, spi_pllp).
This also seems like something that ought to be factorable out, ideally it'd all Just Work(tm) with the clock framework but...
Quoted 20 lines · Laxman Dewangan
Quoted 9 lines · Mark Brown
* PGP Signed by an unknown key
Quoted 4 lines · Laxman Dewangan
Quoted 3 lines
Quoted 1 line
+
tspi->clk=devm_clk_get(&pdev->dev, "spi");Does this HW block use multiple clocks? If not, I think s/"spi"/NULL/ there, just like the Tegra20 driver.
No, spi controller uses the only one clock. I will change to NULL.
I'm never convinced that NULL is a helpful clock name to pick, it's not awesome if you ever acquire a second clock.
I had other idea of okeeping clock name here for power optimization. Spi controller can take the power source ffrom different clock source say
clk_m(crystal) and pllp.I want to set the parent clock dynamically based on required speed so that if the desire speed can be meet from
clk_m, no need to increase pll count and possible we may endup with siwtchng off pllp which can save power.
Quoted 8 lines
So for this I may require
spi_clk=devm_clk_get(&pdev->dev, "spi");spi_clkm=devm_clk_get(&pdev->dev, "clmkm");spi_pllp=devm_clk_get(&pdev->dev, "pllp");and call
clk_set_parent(spi_clk, spi_clkm)orclk_set_parent(spi_clk, spi_pllp).
OK, so that's certainly an argument for requesting a specific clock name rather than NULL.
But, please do think this approach through fully. The DT binding needs to define which clock-names the driver requires to be present, and any optional clock names. DT bindings are supposed to be immutable, or perhaps extendible in a completely backwards-compatible fashion. This implies that you need to have thought through the entire list of clocks that the driver might want in the DT clock-names property when you first write the DT binding documentation...
Quoted 7 lines · Stephen Warren
But, please do think this approach through fully. The DT binding needs to define which clock-names the driver requires to be present, and any optional clock names. DT bindings are supposed to be immutable, or perhaps extendible in a completely backwards-compatible fashion. This implies that you need to have thought through the entire list of clocks that the driver might want in the DT clock-names property when you first write the DT binding documentation...
Since we can extend the list of clocks it doesn't seem like there's much issue here, especially if some of them are optional?
Though in general it seems like this sort of mux really should be in the clock stuff anyway.
Quoted 11 lines · Mark Brown
Quoted 8 lines · Stephen Warren
But, please do think this approach through fully. The DT binding needs to define which clock-names the driver requires to be present, and any optional clock names. DT bindings are supposed to be immutable, or perhaps extendible in a completely backwards-compatible fashion. This implies that you need to have thought through the entire list of clocks that the driver might want in the DT clock-names property when you first write the DT binding documentation...
Quoted 2 lines
Since we can extend the list of clocks it doesn't seem like there's much issue here, especially if some of them are optional?
Yes, there's certainly a way to extend the binding in a backwards-compatible way.
However, I have seen in Rob and/or Grant push back on not fully defining bindings in the past - i.e. actively planning to initially create a minimal binding and extend it in the future, rather than completely defining it up-front.
I don't know how strong of a rule they intend that to be though. If we get to the point of moving the DT bindings out of the kernel, it'd be good to get a concrete definition of what can and can't be changed in bindings.
Quoted 2 lines
Though in general it seems like this sort of mux really should be in the clock stuff anyway.
How do you see that working: something automatic inside clk_set_rate() seeing that some other parent could provide the rate, so the clock could be reparented, or ...?
Quoted 5 lines · Stephen Warren
Quoted 2 lines · Mark Brown
Since we can extend the list of clocks it doesn't seem like there's much issue here, especially if some of them are optional?
Quoted 7 lines
Yes, there's certainly a way to extend the binding in a backwards-compatible way.
However, I have seen in Rob and/or Grant push back on not fully defining bindings in the past - i.e. actively planning to initially create a minimal binding and extend it in the future, rather than completely defining it up-front.
That sounds like the current stuff with a minimal definition is OK?
Quoted 6 lines
Quoted 2 lines
Though in general it seems like this sort of mux really should be in the clock stuff anyway.
How do you see that working: something automatic inside
clk_set_rate()seeing that some other parent could provide the rate, so the clock could be reparented, or ...?
That'd certainly be nice as a feature, but it'd also be good to just be able to define this sort of multi-parent mux in a generic way in DT since it's pretty common even if the actual implementation of picking a parent ends up getting open coded in individual drivers. A library function might also be a way of handling it short term.
_______________________________________________
devicetree-discuss mailing list devicetree-discuss-uLR06cmDAlY/[email protected]
https://lists.ozlabs.org/listinfo/devicetree-discuss
Quoted 10 lines · Mark Brown
Quoted 8 lines · Stephen Warren
Quoted 3 lines · Mark Brown
Since we can extend the list of clocks it doesn't seem like there's much issue here, especially if some of them are optional?
Yes, there's certainly a way to extend the binding in a backwards-compatible way.
Quoted 7 lines
Quoted 4 lines
However, I have seen in Rob and/or Grant push back on not fully defining bindings in the past - i.e. actively planning to initially create a minimal binding and extend it in the future, rather than completely defining it up-front.
That sounds like the current stuff with a minimal definition is OK?
I'm personally OK with defining a minimal binding first and extending it later. But, I'm worried if when we actually try to extend the binding later, we'll get push-back.
Laxman Dewangan
maintainerQuoted 12 lines · Stephen Warren
Quoted 11 lines · Mark Brown
Quoted 10 lines · Stephen Warren
Quoted 3 lines · Mark Brown
Since we can extend the list of clocks it doesn't seem like there's much issue here, especially if some of them are optional?
Yes, there's certainly a way to extend the binding in a backwards-compatible way.
However, I have seen in Rob and/or Grant push back on not fully defining bindings in the past - i.e. actively planning to initially create a minimal binding and extend it in the future, rather than completely defining it up-front.
Quoted 5 lines
Quoted 2 lines
That sounds like the current stuff with a minimal definition is OK?
I'm personally OK with defining a minimal binding first and extending it later. But, I'm worried if when we actually try to extend the binding later, we'll get push-back.
Yes, for a given controller there is lots of input sources which can be mux but we can not use all option as some of source is changeable based on DVFS policy or other constraints. Like one of controller has the input clock source as PLLC which is again used by CPU and it varies for requested CPU frequency. In this context, we would like to not choose PLLC as clock source for given controller.
So we may need to provide the list of valid clock source/option from DT file and clock muxing should be done from that source list only in place of super set supported by SoCs.
Quoted 27 lines · Stephen Warren
Quoted 26 lines · Laxman Dewangan
Quoted 9 lines · Mark Brown
* PGP Signed by an unknown key
Quoted 4 lines · Laxman Dewangan
Quoted 3 lines
Quoted 1 line
+
tspi->clk=devm_clk_get(&pdev->dev, "spi");Does this HW block use multiple clocks? If not, I think s/"spi"/NULL/ there, just like the Tegra20 driver.
No, spi controller uses the only one clock. I will change to NULL.
I'm never convinced that NULL is a helpful clock name to pick, it's not awesome if you ever acquire a second clock.
I had other idea of okeeping clock name here for power optimization. Spi controller can take the power source ffrom different clock source say
clk_m(crystal) and pllp.I want to set the parent clock dynamically based on required speed so that if the desire speed can be meet from
clk_m, no need to increase pll count and possible we may endup with siwtchng off pllp which can save power.So for this I may require
spi_clk=devm_clk_get(&pdev->dev, "spi");spi_clkm=devm_clk_get(&pdev->dev, "clmkm");spi_pllp=devm_clk_get(&pdev->dev, "pllp");
Quoted 6 lines
Quoted 2 lines
and call
clk_set_parent(spi_clk, spi_clkm)orclk_set_parent(spi_clk, spi_pllp).OK, so that's certainly an argument for requesting a specific clock name rather than NULL.
The list of possible parents for each clock is determined by the SoC and is already known to CCF, so maybe we just need to add a function to CCF to allow the drivers to query the list of possible parents?
Cheers,
Peter.
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
Quoted 8 lines · Peter De Schrijver
Quoted 2 lines · Stephen Warren
OK, so that's certainly an argument for requesting a specific clock name rather than NULL.
The list of possible parents for each clock is determined by the SoC and is already known to CCF, so maybe we just need to add a function to CCF to allow the drivers to query the list of possible parents?
Assuming that "CCF" is the clock framework that's pretty much what I was suggesting, yes.