Re: [PATCH V14 3/5] i2c: tegra: Add DMA support

2019-02-07 Thread Dmitry Osipenko
06.02.2019 22:16, Sowjanya Komatineni пишет: > + if (!i2c_dev->msg_read) { > + if (dma) { > + memcpy(buffer, msg->buf, msg->len); > + dma_sync_single_for_device(i2c_dev->dev, > +i2c_dev->dma_phys

Re: [PATCH V14 3/5] i2c: tegra: Add DMA support

2019-02-07 Thread Dmitry Osipenko
07.02.2019 22:14, Dmitry Osipenko пишет: > 06.02.2019 22:16, Sowjanya Komatineni пишет: >> +static void tegra_i2c_config_fifo_trig(struct tegra_i2c_dev *i2c_dev, >> + size_t len) >> +{ >> +u32 val = 0, reg; >> +u8 dma_burst = 0; There is no need to set dma

RE: [PATCH V14 3/5] i2c: tegra: Add DMA support

2019-02-07 Thread Sowjanya Komatineni
> >>> static const struct tegra_i2c_hw_feature tegra210_i2c_hw = { @@ > >>> -980,6 +1302,7 @@ static const struct tegra_i2c_hw_feature > >>> tegra210_i2c_hw = { > >>> .has_mst_fifo = false, > >>> .quirks = &tegra_i2c_quirks, > >>> .supports_bus_clear = true, > >>> + .has_apb_dma = true,

Re: [PATCH V14 3/5] i2c: tegra: Add DMA support

2019-02-07 Thread Dmitry Osipenko
06.02.2019 22:16, Sowjanya Komatineni пишет: > +static void tegra_i2c_config_fifo_trig(struct tegra_i2c_dev *i2c_dev, > +size_t len) > +{ > + u32 val = 0, reg; > + u8 dma_burst = 0; > + struct dma_slave_config slv_config = {0}; > + struct dma_chan

Re: [PATCH V14 3/5] i2c: tegra: Add DMA support

2019-02-07 Thread Dmitry Osipenko
07.02.2019 21:56, Sowjanya Komatineni пишет: > >>> static const struct tegra_i2c_hw_feature tegra210_i2c_hw = { @@ >>> -980,6 +1302,7 @@ static const struct tegra_i2c_hw_feature tegra210_i2c_hw >>> = { >>> .has_mst_fifo = false, >>> .quirks = &tegra_i2c_quirks, >>> .supports_bus_cl

RE: [PATCH V14 3/5] i2c: tegra: Add DMA support

2019-02-07 Thread Sowjanya Komatineni
> > static const struct tegra_i2c_hw_feature tegra210_i2c_hw = { @@ > > -980,6 +1302,7 @@ static const struct tegra_i2c_hw_feature tegra210_i2c_hw > > = { > > .has_mst_fifo = false, > > .quirks = &tegra_i2c_quirks, > > .supports_bus_clear = true, > > + .has_apb_dma = true, > > }

Re: [PATCH V14 3/5] i2c: tegra: Add DMA support

2019-02-07 Thread Dmitry Osipenko
06.02.2019 22:16, Sowjanya Komatineni пишет: > /** > @@ -191,6 +207,7 @@ struct tegra_i2c_hw_feature { > * @fast_clk: clock reference for fast clock of I2C controller > * @rst: reset control for the I2C controller > * @base: ioremapped registers cookie > + * @base_phys: Physical base address

Re: [PATCH V14 3/5] i2c: tegra: Add DMA support

2019-02-07 Thread Dmitry Osipenko
06.02.2019 22:16, Sowjanya Komatineni пишет: > @@ -920,6 +1238,7 @@ static const struct tegra_i2c_hw_feature tegra20_i2c_hw > = { > .has_mst_fifo = false, > .quirks = &tegra_i2c_quirks, > .supports_bus_clear = false, > + .has_apb_dma = true, > }; > > static const struct t

Re: [PATCH V14 3/5] i2c: tegra: Add DMA support

2019-02-07 Thread Dmitry Osipenko
06.02.2019 22:16, Sowjanya Komatineni пишет: > + if (i2c_dev->msg_read && i2c_dev->msg_err == I2C_ERR_NONE) { > + dma_sync_single_for_cpu(i2c_dev->dev, > + i2c_dev->dma_phys, > +

Re: [PATCH V14 3/5] i2c: tegra: Add DMA support

2019-02-07 Thread Dmitry Osipenko
07.02.2019 21:02, Sowjanya Komatineni пишет: > >>> It became apparent to me that there is a problem here. The size of >>> dma_buf is 4096 bytes and maximum message length is 4096 too, we have >>> pushed 12 bytes packet_header to the buffer >and now there are 4084 >>> bytes left

RE: [PATCH V14 3/5] i2c: tegra: Add DMA support

2019-02-07 Thread Sowjanya Komatineni
> > It became apparent to me that there is a problem here. The size of > > dma_buf is 4096 bytes and maximum message length is 4096 too, we have > > pushed 12 bytes packet_header to the buffer >and now there are 4084 > > bytes left for the message in the buffer. Hence transfer o

Re: [PATCH V14 3/5] i2c: tegra: Add DMA support

2019-02-07 Thread Dmitry Osipenko
07.02.2019 19:08, Sowjanya Komatineni пишет: > > It became apparent to me that there is a problem here. The size of > dma_buf is 4096 bytes and maximum message length is 4096 too, we have > pushed 12 bytes packet_header to the buffer >and now there are 4084 bytes > left for the

RE: [PATCH V14 3/5] i2c: tegra: Add DMA support

2019-02-07 Thread Sowjanya Komatineni
> > >> It became apparent to me that there is a problem here. The size of > > >> dma_buf is 4096 bytes and maximum message length is 4096 too, we have > > >> pushed 12 bytes packet_header to the buffer >and now there are 4084 > > >> bytes left for the message in the buffer. Hence transfer of 4K

Re: [PATCH V14 3/5] i2c: tegra: Add DMA support

2019-02-07 Thread Thierry Reding
On Thu, Feb 07, 2019 at 07:01:45PM +0300, Dmitry Osipenko wrote: > 07.02.2019 18:23, Sowjanya Komatineni пишет: > > > >> It became apparent to me that there is a problem here. The size of dma_buf > >> is 4096 bytes and maximum message length is 4096 too, we have pushed 12 > >> bytes packet_heade

Re: [PATCH V14 3/5] i2c: tegra: Add DMA support

2019-02-07 Thread Thierry Reding
On Thu, Feb 07, 2019 at 03:11:06PM +, Sowjanya Komatineni wrote: > > > > > > > @@ -1124,6 +1453,10 @@ static int tegra_i2c_probe(struct platform_device > > > *pdev) > > > } > > > } > > > > > > + ret = tegra_i2c_init_dma(i2c_dev); > > > + if (ret < 0) > > > + goto disabl

Re: [PATCH V14 3/5] i2c: tegra: Add DMA support

2019-02-07 Thread Dmitry Osipenko
07.02.2019 18:23, Sowjanya Komatineni пишет: > >> It became apparent to me that there is a problem here. The size of dma_buf >> is 4096 bytes and maximum message length is 4096 too, we have pushed 12 >> bytes packet_header to the buffer >and now there are 4084 bytes left for the >> message in t

Re: [PATCH V14 3/5] i2c: tegra: Add DMA support

2019-02-07 Thread Dmitry Osipenko
07.02.2019 18:17, Sowjanya Komatineni пишет: >>> @@ -1124,6 +1453,10 @@ static int tegra_i2c_probe(struct platform_device *pdev) } } + ret = tegra_i2c_init_dma(i2c_dev); + if (ret < 0) + goto disable_div_clk; + ret = t

RE: [PATCH V14 3/5] i2c: tegra: Add DMA support

2019-02-07 Thread Sowjanya Komatineni
>It became apparent to me that there is a problem here. The size of dma_buf is >4096 bytes and maximum message length is 4096 too, we have pushed 12 bytes >packet_header to the buffer >and now there are 4084 bytes left for the message >in the buffer. Hence transfer of 4KB will cause buffer over

RE: [PATCH V14 3/5] i2c: tegra: Add DMA support

2019-02-07 Thread Sowjanya Komatineni
> > > > > @@ -1124,6 +1453,10 @@ static int tegra_i2c_probe(struct platform_device > > > *pdev) > > > } > > > } > > > > > > + ret = tegra_i2c_init_dma(i2c_dev); > > > + if (ret < 0) > > > + goto disable_div_clk; > > > + > > > ret = tegra_i2c_init(i2c_dev); > > > if (ret)

Re: [PATCH V14 3/5] i2c: tegra: Add DMA support

2019-02-07 Thread Dmitry Osipenko
07.02.2019 18:11, Sowjanya Komatineni пишет: >> >> >>> @@ -1124,6 +1453,10 @@ static int tegra_i2c_probe(struct platform_device >>> *pdev) >>> } >>> } >>> >>> + ret = tegra_i2c_init_dma(i2c_dev); >>> + if (ret < 0) >>> + goto disable_div_clk; >>> + >>> ret = teg

RE: [PATCH V14 3/5] i2c: tegra: Add DMA support

2019-02-07 Thread Sowjanya Komatineni
> > > > @@ -1124,6 +1453,10 @@ static int tegra_i2c_probe(struct platform_device > > *pdev) > > } > > } > > > > + ret = tegra_i2c_init_dma(i2c_dev); > > + if (ret < 0) > > + goto disable_div_clk; > > + > > ret = tegra_i2c_init(i2c_dev); > > if (ret) { > >

Re: [PATCH V14 3/5] i2c: tegra: Add DMA support

2019-02-07 Thread Dmitry Osipenko
06.02.2019 22:16, Sowjanya Komatineni пишет: > This patch adds DMA support for Tegra I2C. > > Tegra I2C TX and RX FIFO depth is 8 words. PIO mode is used for > transfer size of the max FIFO depth and DMA mode is used for > transfer size higher than max FIFO depth to save CPU overhead. > > PIO mod

Re: [PATCH V14 3/5] i2c: tegra: Add DMA support

2019-02-07 Thread Dmitry Osipenko
06.02.2019 22:16, Sowjanya Komatineni пишет: > This patch adds DMA support for Tegra I2C. > > Tegra I2C TX and RX FIFO depth is 8 words. PIO mode is used for > transfer size of the max FIFO depth and DMA mode is used for > transfer size higher than max FIFO depth to save CPU overhead. > > PIO mod

Re: [PATCH V14 3/5] i2c: tegra: Add DMA support

2019-02-07 Thread Thierry Reding
On Wed, Feb 06, 2019 at 11:16:07AM -0800, Sowjanya Komatineni wrote: > This patch adds DMA support for Tegra I2C. > > Tegra I2C TX and RX FIFO depth is 8 words. PIO mode is used for > transfer size of the max FIFO depth and DMA mode is used for > transfer size higher than max FIFO depth to save CP