* [PATCH 4/8] mfd: stm32-timers: add support for dmas [not found] ` <1516106631-18722-5-git-send-email-fabrice.gasnier@st.com> @ 2018-01-23 13:32 ` Lee Jones 2018-01-23 13:57 ` Fabrice Gasnier 0 siblings, 1 reply; 9+ messages in thread From: Lee Jones @ 2018-01-23 13:32 UTC (permalink / raw) To: linux-arm-kernel On Tue, 16 Jan 2018, Fabrice Gasnier wrote: > STM32 Timers can support up to 7 dma requests: > 4 channels, update, compare and trigger. > Optionally request part, or all dmas from stm32-timers MFD core. > Also, keep reference of device's bus address to allow child drivers to > transfer data from/to device by using dma. > > Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> > --- > drivers/mfd/stm32-timers.c | 37 ++++++++++++++++++++++++++++++++++++- > include/linux/mfd/stm32-timers.h | 14 ++++++++++++++ > 2 files changed, 50 insertions(+), 1 deletion(-) > > diff --git a/drivers/mfd/stm32-timers.c b/drivers/mfd/stm32-timers.c > index a6675a4..372b51e 100644 > --- a/drivers/mfd/stm32-timers.c > +++ b/drivers/mfd/stm32-timers.c > @@ -29,6 +29,23 @@ static void stm32_timers_get_arr_size(struct stm32_timers *ddata) > regmap_write(ddata->regmap, TIM_ARR, 0x0); > } > > +static void stm32_timers_dma_probe(struct device *dev, > + struct stm32_timers *ddata) > +{ > + int i; > + char name[4]; > + > + for (i = STM32_TIMERS_DMA_CH1; i <= STM32_TIMERS_DMA_CH4; i++) { > + snprintf(name, ARRAY_SIZE(name), "ch%1d", i + 1); > + ddata->dmas[i] = dma_request_slave_channel(dev, name); And if any of them fail? > + } > + ddata->dmas[STM32_TIMERS_DMA_UP] = dma_request_slave_channel(dev, "up"); > + ddata->dmas[STM32_TIMERS_DMA_TRIG] = > + dma_request_slave_channel(dev, "trig"); > + ddata->dmas[STM32_TIMERS_DMA_COM] = > + dma_request_slave_channel(dev, "com"); Can you format these in the same why. This hurts my eyes. > +} > + > static int stm32_timers_probe(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > @@ -44,6 +61,7 @@ static int stm32_timers_probe(struct platform_device *pdev) > mmio = devm_ioremap_resource(dev, res); > if (IS_ERR(mmio)) > return PTR_ERR(mmio); > + ddata->phys_base = res->start; What do you use this for? > ddata->regmap = devm_regmap_init_mmio_clk(dev, "int", mmio, > &stm32_timers_regmap_cfg); > @@ -56,9 +74,25 @@ static int stm32_timers_probe(struct platform_device *pdev) > > stm32_timers_get_arr_size(ddata); > > + stm32_timers_dma_probe(dev, ddata); > + Surely this can fail? > platform_set_drvdata(pdev, ddata); > > - return devm_of_platform_populate(&pdev->dev); > + return of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); > +} > + > +static int stm32_timers_remove(struct platform_device *pdev) > +{ > + struct stm32_timers *ddata = platform_get_drvdata(pdev); > + int i; > + > + of_platform_depopulate(&pdev->dev); > + > + for (i = 0; i < STM32_TIMERS_MAX_DMAS; i++) > + if (ddata->dmas[i]) > + dma_release_channel(ddata->dmas[i]); > + > + return 0; > } > > static const struct of_device_id stm32_timers_of_match[] = { > @@ -69,6 +103,7 @@ static int stm32_timers_probe(struct platform_device *pdev) > > static struct platform_driver stm32_timers_driver = { > .probe = stm32_timers_probe, > + .remove = stm32_timers_remove, > .driver = { > .name = "stm32-timers", > .of_match_table = stm32_timers_of_match, > diff --git a/include/linux/mfd/stm32-timers.h b/include/linux/mfd/stm32-timers.h > index ce7346e..2b4ffb9 100644 > --- a/include/linux/mfd/stm32-timers.h > +++ b/include/linux/mfd/stm32-timers.h > @@ -10,6 +10,7 @@ > #define _LINUX_STM32_GPTIMER_H_ > > #include <linux/clk.h> > +#include <linux/dmaengine.h> > #include <linux/regmap.h> > > #define TIM_CR1 0x00 /* Control Register 1 */ > @@ -67,9 +68,22 @@ > #define TIM_BDTR_BKF_SHIFT 16 > #define TIM_BDTR_BK2F_SHIFT 20 > > +enum stm32_timers_dmas { > + STM32_TIMERS_DMA_CH1, > + STM32_TIMERS_DMA_CH2, > + STM32_TIMERS_DMA_CH3, > + STM32_TIMERS_DMA_CH4, > + STM32_TIMERS_DMA_UP, > + STM32_TIMERS_DMA_TRIG, > + STM32_TIMERS_DMA_COM, > + STM32_TIMERS_MAX_DMAS, > +}; > + > struct stm32_timers { > struct clk *clk; > struct regmap *regmap; > + phys_addr_t phys_base; > u32 max_arr; > + struct dma_chan *dmas[STM32_TIMERS_MAX_DMAS]; > }; > #endif -- Lee Jones Linaro Services Technical Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 4/8] mfd: stm32-timers: add support for dmas 2018-01-23 13:32 ` [PATCH 4/8] mfd: stm32-timers: add support for dmas Lee Jones @ 2018-01-23 13:57 ` Fabrice Gasnier 2018-01-23 15:30 ` Lee Jones 0 siblings, 1 reply; 9+ messages in thread From: Fabrice Gasnier @ 2018-01-23 13:57 UTC (permalink / raw) To: linux-arm-kernel On 01/23/2018 02:32 PM, Lee Jones wrote: > On Tue, 16 Jan 2018, Fabrice Gasnier wrote: > >> STM32 Timers can support up to 7 dma requests: >> 4 channels, update, compare and trigger. >> Optionally request part, or all dmas from stm32-timers MFD core. >> Also, keep reference of device's bus address to allow child drivers to >> transfer data from/to device by using dma. >> >> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> >> --- >> drivers/mfd/stm32-timers.c | 37 ++++++++++++++++++++++++++++++++++++- >> include/linux/mfd/stm32-timers.h | 14 ++++++++++++++ >> 2 files changed, 50 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/mfd/stm32-timers.c b/drivers/mfd/stm32-timers.c >> index a6675a4..372b51e 100644 >> --- a/drivers/mfd/stm32-timers.c >> +++ b/drivers/mfd/stm32-timers.c >> @@ -29,6 +29,23 @@ static void stm32_timers_get_arr_size(struct stm32_timers *ddata) >> regmap_write(ddata->regmap, TIM_ARR, 0x0); >> } >> >> +static void stm32_timers_dma_probe(struct device *dev, >> + struct stm32_timers *ddata) >> +{ >> + int i; >> + char name[4]; >> + >> + for (i = STM32_TIMERS_DMA_CH1; i <= STM32_TIMERS_DMA_CH4; i++) { >> + snprintf(name, ARRAY_SIZE(name), "ch%1d", i + 1); >> + ddata->dmas[i] = dma_request_slave_channel(dev, name); > > And if any of them fail? Hi Lee, If some of these fails, reference will be NULL. It is checked in child driver (pwm for instance) at runtime. Support is being added as an option: pwm capture will simply be unavailable in this case (fail with error). > >> + } >> + ddata->dmas[STM32_TIMERS_DMA_UP] = dma_request_slave_channel(dev, "up"); >> + ddata->dmas[STM32_TIMERS_DMA_TRIG] = >> + dma_request_slave_channel(dev, "trig"); >> + ddata->dmas[STM32_TIMERS_DMA_COM] = >> + dma_request_slave_channel(dev, "com"); > > Can you format these in the same why. This hurts my eyes. I use enum values and try to match as possible with reference manual for "up", "trig" & "com" names. Would have some suggestion to beautify this? > >> +} >> + >> static int stm32_timers_probe(struct platform_device *pdev) >> { >> struct device *dev = &pdev->dev; >> @@ -44,6 +61,7 @@ static int stm32_timers_probe(struct platform_device *pdev) >> mmio = devm_ioremap_resource(dev, res); >> if (IS_ERR(mmio)) >> return PTR_ERR(mmio); >> + ddata->phys_base = res->start; > > What do you use this for? This is used in in child driver (pwm) for capture data transfer by dma. > >> ddata->regmap = devm_regmap_init_mmio_clk(dev, "int", mmio, >> &stm32_timers_regmap_cfg); >> @@ -56,9 +74,25 @@ static int stm32_timers_probe(struct platform_device *pdev) >> >> stm32_timers_get_arr_size(ddata); >> >> + stm32_timers_dma_probe(dev, ddata); >> + > > Surely this can fail? Yes. Same as above. Thanks for reviewing, Best Regards, Fabrice > >> platform_set_drvdata(pdev, ddata); >> >> - return devm_of_platform_populate(&pdev->dev); >> + return of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); >> +} >> + >> +static int stm32_timers_remove(struct platform_device *pdev) >> +{ >> + struct stm32_timers *ddata = platform_get_drvdata(pdev); >> + int i; >> + >> + of_platform_depopulate(&pdev->dev); >> + >> + for (i = 0; i < STM32_TIMERS_MAX_DMAS; i++) >> + if (ddata->dmas[i]) >> + dma_release_channel(ddata->dmas[i]); >> + >> + return 0; >> } >> >> static const struct of_device_id stm32_timers_of_match[] = { >> @@ -69,6 +103,7 @@ static int stm32_timers_probe(struct platform_device *pdev) >> >> static struct platform_driver stm32_timers_driver = { >> .probe = stm32_timers_probe, >> + .remove = stm32_timers_remove, >> .driver = { >> .name = "stm32-timers", >> .of_match_table = stm32_timers_of_match, >> diff --git a/include/linux/mfd/stm32-timers.h b/include/linux/mfd/stm32-timers.h >> index ce7346e..2b4ffb9 100644 >> --- a/include/linux/mfd/stm32-timers.h >> +++ b/include/linux/mfd/stm32-timers.h >> @@ -10,6 +10,7 @@ >> #define _LINUX_STM32_GPTIMER_H_ >> >> #include <linux/clk.h> >> +#include <linux/dmaengine.h> >> #include <linux/regmap.h> >> >> #define TIM_CR1 0x00 /* Control Register 1 */ >> @@ -67,9 +68,22 @@ >> #define TIM_BDTR_BKF_SHIFT 16 >> #define TIM_BDTR_BK2F_SHIFT 20 >> >> +enum stm32_timers_dmas { >> + STM32_TIMERS_DMA_CH1, >> + STM32_TIMERS_DMA_CH2, >> + STM32_TIMERS_DMA_CH3, >> + STM32_TIMERS_DMA_CH4, >> + STM32_TIMERS_DMA_UP, >> + STM32_TIMERS_DMA_TRIG, >> + STM32_TIMERS_DMA_COM, >> + STM32_TIMERS_MAX_DMAS, >> +}; >> + >> struct stm32_timers { >> struct clk *clk; >> struct regmap *regmap; >> + phys_addr_t phys_base; >> u32 max_arr; >> + struct dma_chan *dmas[STM32_TIMERS_MAX_DMAS]; >> }; >> #endif > ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 4/8] mfd: stm32-timers: add support for dmas 2018-01-23 13:57 ` Fabrice Gasnier @ 2018-01-23 15:30 ` Lee Jones 2018-01-23 15:52 ` Fabrice Gasnier 0 siblings, 1 reply; 9+ messages in thread From: Lee Jones @ 2018-01-23 15:30 UTC (permalink / raw) To: linux-arm-kernel On Tue, 23 Jan 2018, Fabrice Gasnier wrote: > On 01/23/2018 02:32 PM, Lee Jones wrote: > > On Tue, 16 Jan 2018, Fabrice Gasnier wrote: > > > >> STM32 Timers can support up to 7 dma requests: > >> 4 channels, update, compare and trigger. > >> Optionally request part, or all dmas from stm32-timers MFD core. > >> Also, keep reference of device's bus address to allow child drivers to > >> transfer data from/to device by using dma. > >> > >> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> > >> --- > >> drivers/mfd/stm32-timers.c | 37 ++++++++++++++++++++++++++++++++++++- > >> include/linux/mfd/stm32-timers.h | 14 ++++++++++++++ > >> 2 files changed, 50 insertions(+), 1 deletion(-) > >> > >> diff --git a/drivers/mfd/stm32-timers.c b/drivers/mfd/stm32-timers.c > >> index a6675a4..372b51e 100644 > >> --- a/drivers/mfd/stm32-timers.c > >> +++ b/drivers/mfd/stm32-timers.c > >> @@ -29,6 +29,23 @@ static void stm32_timers_get_arr_size(struct stm32_timers *ddata) > >> regmap_write(ddata->regmap, TIM_ARR, 0x0); > >> } > >> > >> +static void stm32_timers_dma_probe(struct device *dev, > >> + struct stm32_timers *ddata) > >> +{ > >> + int i; > >> + char name[4]; > >> + > >> + for (i = STM32_TIMERS_DMA_CH1; i <= STM32_TIMERS_DMA_CH4; i++) { > >> + snprintf(name, ARRAY_SIZE(name), "ch%1d", i + 1); > >> + ddata->dmas[i] = dma_request_slave_channel(dev, name); > > > > And if any of them fail? > > Hi Lee, > > If some of these fails, reference will be NULL. It is checked in child > driver (pwm for instance) at runtime. Support is being added as an > option: pwm capture will simply be unavailable in this case (fail with > error). Can you place a simple one-line comment in here please. Or else someone will come along and add error handling for you. > >> + } > >> + ddata->dmas[STM32_TIMERS_DMA_UP] = dma_request_slave_channel(dev, "up"); > >> + ddata->dmas[STM32_TIMERS_DMA_TRIG] = > >> + dma_request_slave_channel(dev, "trig"); > >> + ddata->dmas[STM32_TIMERS_DMA_COM] = > >> + dma_request_slave_channel(dev, "com"); > > > > Can you format these in the same why. This hurts my eyes. > > I use enum values and try to match as possible with reference manual for > "up", "trig" & "com" names. > Would have some suggestion to beautify this? I just mean, can you push the first dma_request_slave_channel() call on to the next line, so each of the calls are formatted in the same manner please? > >> +} > >> + > >> static int stm32_timers_probe(struct platform_device *pdev) > >> { > >> struct device *dev = &pdev->dev; > >> @@ -44,6 +61,7 @@ static int stm32_timers_probe(struct platform_device *pdev) > >> mmio = devm_ioremap_resource(dev, res); > >> if (IS_ERR(mmio)) > >> return PTR_ERR(mmio); > >> + ddata->phys_base = res->start; > > > > What do you use this for? > > This is used in in child driver (pwm) for capture data transfer by dma. Might be worth being clear about that. Perhaps pass in 'dma_base' (phys_base + offset) instead? -- Lee Jones Linaro Services Technical Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 4/8] mfd: stm32-timers: add support for dmas 2018-01-23 15:30 ` Lee Jones @ 2018-01-23 15:52 ` Fabrice Gasnier 2018-01-23 16:41 ` Lee Jones 0 siblings, 1 reply; 9+ messages in thread From: Fabrice Gasnier @ 2018-01-23 15:52 UTC (permalink / raw) To: linux-arm-kernel On 01/23/2018 04:30 PM, Lee Jones wrote: > On Tue, 23 Jan 2018, Fabrice Gasnier wrote: > >> On 01/23/2018 02:32 PM, Lee Jones wrote: >>> On Tue, 16 Jan 2018, Fabrice Gasnier wrote: >>> >>>> STM32 Timers can support up to 7 dma requests: >>>> 4 channels, update, compare and trigger. >>>> Optionally request part, or all dmas from stm32-timers MFD core. >>>> Also, keep reference of device's bus address to allow child drivers to >>>> transfer data from/to device by using dma. >>>> >>>> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> >>>> --- >>>> drivers/mfd/stm32-timers.c | 37 ++++++++++++++++++++++++++++++++++++- >>>> include/linux/mfd/stm32-timers.h | 14 ++++++++++++++ >>>> 2 files changed, 50 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/mfd/stm32-timers.c b/drivers/mfd/stm32-timers.c >>>> index a6675a4..372b51e 100644 >>>> --- a/drivers/mfd/stm32-timers.c >>>> +++ b/drivers/mfd/stm32-timers.c >>>> @@ -29,6 +29,23 @@ static void stm32_timers_get_arr_size(struct stm32_timers *ddata) >>>> regmap_write(ddata->regmap, TIM_ARR, 0x0); >>>> } >>>> >>>> +static void stm32_timers_dma_probe(struct device *dev, >>>> + struct stm32_timers *ddata) >>>> +{ >>>> + int i; >>>> + char name[4]; >>>> + >>>> + for (i = STM32_TIMERS_DMA_CH1; i <= STM32_TIMERS_DMA_CH4; i++) { >>>> + snprintf(name, ARRAY_SIZE(name), "ch%1d", i + 1); >>>> + ddata->dmas[i] = dma_request_slave_channel(dev, name); >>> >>> And if any of them fail? >> >> Hi Lee, >> >> If some of these fails, reference will be NULL. It is checked in child >> driver (pwm for instance) at runtime. Support is being added as an >> option: pwm capture will simply be unavailable in this case (fail with >> error). > > Can you place a simple one-line comment in here please. Or else > someone will come along and add error handling for you. Hi Lee, Ok, I'll add a comment in v2. > >>>> + } >>>> + ddata->dmas[STM32_TIMERS_DMA_UP] = dma_request_slave_channel(dev, "up"); >>>> + ddata->dmas[STM32_TIMERS_DMA_TRIG] = >>>> + dma_request_slave_channel(dev, "trig"); >>>> + ddata->dmas[STM32_TIMERS_DMA_COM] = >>>> + dma_request_slave_channel(dev, "com"); >>> >>> Can you format these in the same why. This hurts my eyes. >> >> I use enum values and try to match as possible with reference manual for >> "up", "trig" & "com" names. >> Would have some suggestion to beautify this? > > I just mean, can you push the first dma_request_slave_channel() call > on to the next line, so each of the calls are formatted in the same > manner please? Ok, got it now. I'll do this in v2. > >>>> +} >>>> + >>>> static int stm32_timers_probe(struct platform_device *pdev) >>>> { >>>> struct device *dev = &pdev->dev; >>>> @@ -44,6 +61,7 @@ static int stm32_timers_probe(struct platform_device *pdev) >>>> mmio = devm_ioremap_resource(dev, res); >>>> if (IS_ERR(mmio)) >>>> return PTR_ERR(mmio); >>>> + ddata->phys_base = res->start; >>> >>> What do you use this for? >> >> This is used in in child driver (pwm) for capture data transfer by dma. > > Might be worth being clear about that. > > Perhaps pass in 'dma_base' (phys_base + offset) instead? > I guess you've had a look at [PATCH 5/8] pwm: stm32: add capture support. Are you talking about passing phys_base + TIM_DMAR ? If this is the case, I'd prefer to keep phys base only if you don't mind, and handle TIM_DMAR offset in pwm driver. This way, all dma slave config is kept locally at one place. Or do you mean something else ? Maybe I can add a comment here about this ? Something like: /* phys_base to be used by child driver, e.g. DMA burst mode */ Please advise, Thanks, Fabrice ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 4/8] mfd: stm32-timers: add support for dmas 2018-01-23 15:52 ` Fabrice Gasnier @ 2018-01-23 16:41 ` Lee Jones 2018-01-24 8:40 ` Fabrice Gasnier 0 siblings, 1 reply; 9+ messages in thread From: Lee Jones @ 2018-01-23 16:41 UTC (permalink / raw) To: linux-arm-kernel On Tue, 23 Jan 2018, Fabrice Gasnier wrote: > On 01/23/2018 04:30 PM, Lee Jones wrote: > > On Tue, 23 Jan 2018, Fabrice Gasnier wrote: > > > >> On 01/23/2018 02:32 PM, Lee Jones wrote: > >>> On Tue, 16 Jan 2018, Fabrice Gasnier wrote: > >>> > >>>> STM32 Timers can support up to 7 dma requests: > >>>> 4 channels, update, compare and trigger. > >>>> Optionally request part, or all dmas from stm32-timers MFD core. > >>>> Also, keep reference of device's bus address to allow child drivers to > >>>> transfer data from/to device by using dma. > >>>> > >>>> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> > >>>> --- > >>>> drivers/mfd/stm32-timers.c | 37 ++++++++++++++++++++++++++++++++++++- > >>>> include/linux/mfd/stm32-timers.h | 14 ++++++++++++++ > >>>> 2 files changed, 50 insertions(+), 1 deletion(-) > >>>> > >>>> diff --git a/drivers/mfd/stm32-timers.c b/drivers/mfd/stm32-timers.c > >>>> static int stm32_timers_probe(struct platform_device *pdev) > >>>> { > >>>> struct device *dev = &pdev->dev; > >>>> @@ -44,6 +61,7 @@ static int stm32_timers_probe(struct platform_device *pdev) > >>>> mmio = devm_ioremap_resource(dev, res); > >>>> if (IS_ERR(mmio)) > >>>> return PTR_ERR(mmio); > >>>> + ddata->phys_base = res->start; > >>> > >>> What do you use this for? > >> > >> This is used in in child driver (pwm) for capture data transfer by dma. > > > > Might be worth being clear about that. > > > > Perhaps pass in 'dma_base' (phys_base + offset) instead? > > I guess you've had a look at [PATCH 5/8] pwm: stm32: add capture > support. Are you talking about passing phys_base + TIM_DMAR ? I have and I am. > If this is the case, I'd prefer to keep phys base only if you don't > mind, and handle TIM_DMAR offset in pwm driver. This way, all dma slave > config is kept locally at one place. > Or do you mean something else ? > > Maybe I can add a comment here about this ? > Something like: > /* phys_base to be used by child driver, e.g. DMA burst mode */ I haven't seen the memory map for this device, so it's not easy for me to comment, but passing in the physical address of the parent MFD into a child device doesn't quite sit right with me. At what level does TIM_DMAR sit? Is it a child (PWM) specific property, or is it described at parent (Timer) level? -- Lee Jones Linaro Services Technical Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 4/8] mfd: stm32-timers: add support for dmas 2018-01-23 16:41 ` Lee Jones @ 2018-01-24 8:40 ` Fabrice Gasnier 2018-01-24 14:56 ` Lee Jones 0 siblings, 1 reply; 9+ messages in thread From: Fabrice Gasnier @ 2018-01-24 8:40 UTC (permalink / raw) To: linux-arm-kernel On 01/23/2018 05:41 PM, Lee Jones wrote: > On Tue, 23 Jan 2018, Fabrice Gasnier wrote: >> On 01/23/2018 04:30 PM, Lee Jones wrote: >>> On Tue, 23 Jan 2018, Fabrice Gasnier wrote: >>> >>>> On 01/23/2018 02:32 PM, Lee Jones wrote: >>>>> On Tue, 16 Jan 2018, Fabrice Gasnier wrote: >>>>> >>>>>> STM32 Timers can support up to 7 dma requests: >>>>>> 4 channels, update, compare and trigger. >>>>>> Optionally request part, or all dmas from stm32-timers MFD core. >>>>>> Also, keep reference of device's bus address to allow child drivers to >>>>>> transfer data from/to device by using dma. >>>>>> >>>>>> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> >>>>>> --- >>>>>> drivers/mfd/stm32-timers.c | 37 ++++++++++++++++++++++++++++++++++++- >>>>>> include/linux/mfd/stm32-timers.h | 14 ++++++++++++++ >>>>>> 2 files changed, 50 insertions(+), 1 deletion(-) >>>>>> >>>>>> diff --git a/drivers/mfd/stm32-timers.c b/drivers/mfd/stm32-timers.c >>>>>> static int stm32_timers_probe(struct platform_device *pdev) >>>>>> { >>>>>> struct device *dev = &pdev->dev; >>>>>> @@ -44,6 +61,7 @@ static int stm32_timers_probe(struct platform_device *pdev) >>>>>> mmio = devm_ioremap_resource(dev, res); >>>>>> if (IS_ERR(mmio)) >>>>>> return PTR_ERR(mmio); >>>>>> + ddata->phys_base = res->start; >>>>> >>>>> What do you use this for? >>>> >>>> This is used in in child driver (pwm) for capture data transfer by dma. >>> >>> Might be worth being clear about that. >>> >>> Perhaps pass in 'dma_base' (phys_base + offset) instead? >> >> I guess you've had a look at [PATCH 5/8] pwm: stm32: add capture >> support. Are you talking about passing phys_base + TIM_DMAR ? > > I have and I am. > >> If this is the case, I'd prefer to keep phys base only if you don't >> mind, and handle TIM_DMAR offset in pwm driver. This way, all dma slave >> config is kept locally at one place. >> Or do you mean something else ? >> >> Maybe I can add a comment here about this ? >> Something like: >> /* phys_base to be used by child driver, e.g. DMA burst mode */ > > I haven't seen the memory map for this device, so it's not easy for me > to comment, but passing in the physical address of the parent MFD into > a child device doesn't quite sit right with me. > > At what level does TIM_DMAR sit? Is it a child (PWM) specific > property, or is it described at parent (Timer) level? > Hi Lee, This isn't child (PWM) specific. TIM_DMAR is described at timer level as well as all timers DMA requests lines. Current patchset make it useful for PWM capture. Basically, I think this can be seen as interrupts, as each (0..7) dma request has an enable bit (in DIER: interrupt enable register). This is similar as interrupts at timer level. So, I understand your point regarding passing physical address of the parent MFD... Speaking of interrupts, I'd probably have looked at irq_chip. Regarding dma, i'm not sure what is preferred way ? Another way maybe to export a routine (export symbol) from MFD core, to handle dma transfer from there? By looking into drivers/mfd, I found similar approach, e.g. rtsx_pci_dma_transfer(). Do you think this is better approach ? Please let me know your opinion. Best Regards, Fabrice ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 4/8] mfd: stm32-timers: add support for dmas 2018-01-24 8:40 ` Fabrice Gasnier @ 2018-01-24 14:56 ` Lee Jones 2018-01-24 15:30 ` Fabrice Gasnier 0 siblings, 1 reply; 9+ messages in thread From: Lee Jones @ 2018-01-24 14:56 UTC (permalink / raw) To: linux-arm-kernel On Wed, 24 Jan 2018, Fabrice Gasnier wrote: > On 01/23/2018 05:41 PM, Lee Jones wrote: > > On Tue, 23 Jan 2018, Fabrice Gasnier wrote: > >> On 01/23/2018 04:30 PM, Lee Jones wrote: > >>> On Tue, 23 Jan 2018, Fabrice Gasnier wrote: > >>> > >>>> On 01/23/2018 02:32 PM, Lee Jones wrote: > >>>>> On Tue, 16 Jan 2018, Fabrice Gasnier wrote: > >>>>> > >>>>>> STM32 Timers can support up to 7 dma requests: > >>>>>> 4 channels, update, compare and trigger. > >>>>>> Optionally request part, or all dmas from stm32-timers MFD core. > >>>>>> Also, keep reference of device's bus address to allow child drivers to > >>>>>> transfer data from/to device by using dma. > >>>>>> > >>>>>> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> > >>>>>> --- > >>>>>> drivers/mfd/stm32-timers.c | 37 ++++++++++++++++++++++++++++++++++++- > >>>>>> include/linux/mfd/stm32-timers.h | 14 ++++++++++++++ > >>>>>> 2 files changed, 50 insertions(+), 1 deletion(-) > >>>>>> > >>>>>> diff --git a/drivers/mfd/stm32-timers.c b/drivers/mfd/stm32-timers.c > >>>>>> static int stm32_timers_probe(struct platform_device *pdev) > >>>>>> { > >>>>>> struct device *dev = &pdev->dev; > >>>>>> @@ -44,6 +61,7 @@ static int stm32_timers_probe(struct platform_device *pdev) > >>>>>> mmio = devm_ioremap_resource(dev, res); > >>>>>> if (IS_ERR(mmio)) > >>>>>> return PTR_ERR(mmio); > >>>>>> + ddata->phys_base = res->start; > >>>>> > >>>>> What do you use this for? > >>>> > >>>> This is used in in child driver (pwm) for capture data transfer by dma. > >>> > >>> Might be worth being clear about that. > >>> > >>> Perhaps pass in 'dma_base' (phys_base + offset) instead? > >> > >> I guess you've had a look at [PATCH 5/8] pwm: stm32: add capture > >> support. Are you talking about passing phys_base + TIM_DMAR ? > > > > I have and I am. > > > >> If this is the case, I'd prefer to keep phys base only if you don't > >> mind, and handle TIM_DMAR offset in pwm driver. This way, all dma slave > >> config is kept locally at one place. > >> Or do you mean something else ? > >> > >> Maybe I can add a comment here about this ? > >> Something like: > >> /* phys_base to be used by child driver, e.g. DMA burst mode */ > > > > I haven't seen the memory map for this device, so it's not easy for me > > to comment, but passing in the physical address of the parent MFD into > > a child device doesn't quite sit right with me. > > > > At what level does TIM_DMAR sit? Is it a child (PWM) specific > > property, or is it described at parent (Timer) level? > > > Hi Lee, > > This isn't child (PWM) specific. TIM_DMAR is described at timer level as > well as all timers DMA requests lines. Current patchset make it useful > for PWM capture. Basically, I think this can be seen as interrupts, as > each (0..7) dma request has an enable bit (in DIER: interrupt enable > register). This is similar as interrupts at timer level. > > So, I understand your point regarding passing physical address of the > parent MFD... Speaking of interrupts, I'd probably have looked at > irq_chip. Regarding dma, i'm not sure what is preferred way ? > > Another way maybe to export a routine (export symbol) from MFD core, to > handle dma transfer from there? > By looking into drivers/mfd, I found similar approach, e.g. > rtsx_pci_dma_transfer(). Do you think this is better approach ? > > Please let me know your opinion. It sounds fine in principle. You are in a better position to make that decision as you know the H/W more intimately than I, however it does sound like a good idea to abstract the DMA handling from the device if these aren't device-{level|specific} operations. -- Lee Jones Linaro Services Technical Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 4/8] mfd: stm32-timers: add support for dmas 2018-01-24 14:56 ` Lee Jones @ 2018-01-24 15:30 ` Fabrice Gasnier 2018-01-24 15:43 ` cas 0 siblings, 1 reply; 9+ messages in thread From: Fabrice Gasnier @ 2018-01-24 15:30 UTC (permalink / raw) To: linux-arm-kernel On 01/24/2018 03:56 PM, Lee Jones wrote: > On Wed, 24 Jan 2018, Fabrice Gasnier wrote: >> On 01/23/2018 05:41 PM, Lee Jones wrote: >>> On Tue, 23 Jan 2018, Fabrice Gasnier wrote: >>>> On 01/23/2018 04:30 PM, Lee Jones wrote: >>>>> On Tue, 23 Jan 2018, Fabrice Gasnier wrote: >>>>> >>>>>> On 01/23/2018 02:32 PM, Lee Jones wrote: >>>>>>> On Tue, 16 Jan 2018, Fabrice Gasnier wrote: >>>>>>> >>>>>>>> STM32 Timers can support up to 7 dma requests: >>>>>>>> 4 channels, update, compare and trigger. >>>>>>>> Optionally request part, or all dmas from stm32-timers MFD core. >>>>>>>> Also, keep reference of device's bus address to allow child drivers to >>>>>>>> transfer data from/to device by using dma. >>>>>>>> >>>>>>>> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> >>>>>>>> --- >>>>>>>> drivers/mfd/stm32-timers.c | 37 ++++++++++++++++++++++++++++++++++++- >>>>>>>> include/linux/mfd/stm32-timers.h | 14 ++++++++++++++ >>>>>>>> 2 files changed, 50 insertions(+), 1 deletion(-) >>>>>>>> >>>>>>>> diff --git a/drivers/mfd/stm32-timers.c b/drivers/mfd/stm32-timers.c >>>>>>>> static int stm32_timers_probe(struct platform_device *pdev) >>>>>>>> { >>>>>>>> struct device *dev = &pdev->dev; >>>>>>>> @@ -44,6 +61,7 @@ static int stm32_timers_probe(struct platform_device *pdev) >>>>>>>> mmio = devm_ioremap_resource(dev, res); >>>>>>>> if (IS_ERR(mmio)) >>>>>>>> return PTR_ERR(mmio); >>>>>>>> + ddata->phys_base = res->start; >>>>>>> >>>>>>> What do you use this for? >>>>>> >>>>>> This is used in in child driver (pwm) for capture data transfer by dma. >>>>> >>>>> Might be worth being clear about that. >>>>> >>>>> Perhaps pass in 'dma_base' (phys_base + offset) instead? >>>> >>>> I guess you've had a look at [PATCH 5/8] pwm: stm32: add capture >>>> support. Are you talking about passing phys_base + TIM_DMAR ? >>> >>> I have and I am. >>> >>>> If this is the case, I'd prefer to keep phys base only if you don't >>>> mind, and handle TIM_DMAR offset in pwm driver. This way, all dma slave >>>> config is kept locally at one place. >>>> Or do you mean something else ? >>>> >>>> Maybe I can add a comment here about this ? >>>> Something like: >>>> /* phys_base to be used by child driver, e.g. DMA burst mode */ >>> >>> I haven't seen the memory map for this device, so it's not easy for me >>> to comment, but passing in the physical address of the parent MFD into >>> a child device doesn't quite sit right with me. >>> >>> At what level does TIM_DMAR sit? Is it a child (PWM) specific >>> property, or is it described at parent (Timer) level? >>> >> Hi Lee, >> >> This isn't child (PWM) specific. TIM_DMAR is described at timer level as >> well as all timers DMA requests lines. Current patchset make it useful >> for PWM capture. Basically, I think this can be seen as interrupts, as >> each (0..7) dma request has an enable bit (in DIER: interrupt enable >> register). This is similar as interrupts at timer level. >> >> So, I understand your point regarding passing physical address of the >> parent MFD... Speaking of interrupts, I'd probably have looked at >> irq_chip. Regarding dma, i'm not sure what is preferred way ? >> >> Another way maybe to export a routine (export symbol) from MFD core, to >> handle dma transfer from there? >> By looking into drivers/mfd, I found similar approach, e.g. >> rtsx_pci_dma_transfer(). Do you think this is better approach ? >> >> Please let me know your opinion. > > It sounds fine in principle. You are in a better position to make > that decision as you know the H/W more intimately than I, however it > does sound like a good idea to abstract the DMA handling from the > device if these aren't device-{level|specific} operations. > Hi Lee, Thanks, I'll rework this in v2 to follow your advice. Best Regards, Fabrice ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 4/8] mfd: stm32-timers: add support for dmas 2018-01-24 15:30 ` Fabrice Gasnier @ 2018-01-24 15:43 ` cas 0 siblings, 0 replies; 9+ messages in thread From: cas @ 2018-01-24 15:43 UTC (permalink / raw) To: linux-arm-kernel Apologies for interrupting any work/messages being undertaken. I am a newbie here (1st post) and felt this was the only way to get this information to Linus Torvalds. ____ The following was posted on a forum on the 22nd March 2017: 'I've been working at Intel for the last 15 years as an electrical engineer. 3 years ago I [got] bored with my job and wanted to move to a different department. Intel is pretty good about letting employees move around within the company. An opening came up on the Management Engine team, and since I have experience with micro-controllers I figured I'd give it a shot. The interview went great and they wanted me on board, but the final step was to get securuty clearance. I asked them WTF I need a security clearance for, and they said they couldn't tell me unitl I was on the team. Thus began a 3 year trip down the fucking rabbit hole. I'm coming forward today because of the news that Trump was spied on. I know exactly how it was done because I spent the last three years adding backdoors into the ME. For those of you that are unaware, the ME is ona separate CPU and cannot be disabled, and it exists at a level below the operating system. Intel has been working with the intelligence community for years to get backdoors into physical hardware so they don't have to worry about finding OS exploits. If the hardware itself is compromised then the whole machine is compromised. ----Next post---- The ME has full access to memory without the parent CPU having any knowledge, it has full access to the TCP/IP stacl, and full access to every peripheral connected to the computer. It also runs when the computer is hibernating. It doesn't matter if you're using Windows, Linux, Mac OS X, Whonix, Tails, Qubes OS, or Subgraph. If you have an i3, i5, or i7 hen you're completely owned by the intelligence community. We added similar finctionality to Samsung's WEEPING ANGEL, except the intelligence community calls our project ODIN'S EYE. Through the ME we can activate the mic and webcam even though the computer appears to be off or sleeping. Evidence of surveillance on Trump, his family, and key people in his campaign will come out eventually. I know the surveillance happened for a fact. Future leaks are coming, watch out for ODIN'S EYE.' ---END POST--- Jim Stone over at 82.221.129.208/.zj3.html has the image of the text of the above (you need to scroll down a bit). He also mentioned this stuff, and more, over 7 years ago, though not in the same exact terms as the above, and states that this has actually occured since the Centrino processor, which is where the first backdoors started to be placed. I am here to pass on the information to all of you, if you do not already have it (and since I have just joined to explicitly to send this I have no idea if any of you know this or not), and primarily to get this information to Linus Torvalds who has been quoted by RT very recently as saying that the patches announced by intel (for the Spectre and Meltdown bug) are 'garbage'. I hope that the above information can now be used to understand the real extent of the problem. [Note: if one is not able to find the image of the text at the above site you can find it here: liferepairspecialist.com/Memes/ look for the image called 'inteladmission' - it is in this folder and not in any subfolders.] ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2018-01-24 15:43 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1516106631-18722-1-git-send-email-fabrice.gasnier@st.com>
[not found] ` <1516106631-18722-5-git-send-email-fabrice.gasnier@st.com>
2018-01-23 13:32 ` [PATCH 4/8] mfd: stm32-timers: add support for dmas Lee Jones
2018-01-23 13:57 ` Fabrice Gasnier
2018-01-23 15:30 ` Lee Jones
2018-01-23 15:52 ` Fabrice Gasnier
2018-01-23 16:41 ` Lee Jones
2018-01-24 8:40 ` Fabrice Gasnier
2018-01-24 14:56 ` Lee Jones
2018-01-24 15:30 ` Fabrice Gasnier
2018-01-24 15:43 ` cas
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox