Re: [net-next 15/19] can: tcan4x5x: rework SPI access

2021-01-12 Thread Marc Kleine-Budde
On 1/8/21 10:53 PM, David Laight wrote: >> On 1/7/21 8:06 PM, Jakub Kicinski wrote: >>> On Thu, 7 Jan 2021 11:00:35 -0800 Jakub Kicinski wrote: On Thu, 7 Jan 2021 10:48:56 +0100 Marc Kleine-Budde wrote: > +struct __packed tcan4x5x_map_buf { > + struct tcan4x5x_buf_cmd cmd; > + u8

Re: [net-next 15/19] can: tcan4x5x: rework SPI access

2021-01-12 Thread Marc Kleine-Budde
On 1/7/21 11:38 PM, Jakub Kicinski wrote: > On Thu, 7 Jan 2021 22:17:15 +0100 Marc Kleine-Budde wrote: >>> +struct __packed tcan4x5x_buf_cmd { >>> + u8 cmd; >>> + __be16 addr; >>> + u8 len; >>> +}; >> >> This has to be packed, as I assume the compiler would add some space after >> the

Re: [net-next 15/19] can: tcan4x5x: rework SPI access

2021-01-11 Thread Jakub Kicinski
On Mon, 11 Jan 2021 16:35:30 +0100 Ahmad Fatoum wrote: > Hello Jakub, > > On 08.01.21 17:32, Jakub Kicinski wrote: > > On Fri, 8 Jan 2021 11:07:26 +0100 Ahmad Fatoum wrote: > > +struct __packed tcan4x5x_map_buf { > > + struct tcan4x5x_buf_cmd cmd; > > + u8 data[256 * si

Re: [net-next 15/19] can: tcan4x5x: rework SPI access

2021-01-11 Thread Ahmad Fatoum
Hello Jakub, On 08.01.21 17:32, Jakub Kicinski wrote: > On Fri, 8 Jan 2021 11:07:26 +0100 Ahmad Fatoum wrote: > +struct __packed tcan4x5x_map_buf { > + struct tcan4x5x_buf_cmd cmd; > + u8 data[256 * sizeof(u32)]; > +} cacheline_aligned; Due to the packing of t

RE: [net-next 15/19] can: tcan4x5x: rework SPI access

2021-01-08 Thread David Laight
From: Marc Kleine-Budde > Sent: 07 January 2021 21:17 > > On 1/7/21 8:06 PM, Jakub Kicinski wrote: > > On Thu, 7 Jan 2021 11:00:35 -0800 Jakub Kicinski wrote: > >> On Thu, 7 Jan 2021 10:48:56 +0100 Marc Kleine-Budde wrote: > >>> +struct __packed tcan4x5x_map_buf { > >>> + struct tcan4x5x_buf_cmd

Re: [net-next 15/19] can: tcan4x5x: rework SPI access

2021-01-08 Thread Jakub Kicinski
On Fri, 8 Jan 2021 11:07:26 +0100 Ahmad Fatoum wrote: > >>> +struct __packed tcan4x5x_map_buf { > >>> + struct tcan4x5x_buf_cmd cmd; > >>> + u8 data[256 * sizeof(u32)]; > >>> +} cacheline_aligned; > >> > >> Due to the packing of the struct tcan4x5x_buf_cmd it should have a length > >>

Re: [net-next 15/19] can: tcan4x5x: rework SPI access

2021-01-08 Thread Ahmad Fatoum
On 07.01.21 23:38, Jakub Kicinski wrote: > On Thu, 7 Jan 2021 22:17:15 +0100 Marc Kleine-Budde wrote: >>> +struct __packed tcan4x5x_buf_cmd { >>> + u8 cmd; >>> + __be16 addr; >>> + u8 len; >>> +}; >> >> This has to be packed, as I assume the compiler would add some space after >> the

Re: [net-next 15/19] can: tcan4x5x: rework SPI access

2021-01-07 Thread Jakub Kicinski
On Thu, 7 Jan 2021 22:17:15 +0100 Marc Kleine-Budde wrote: > > +struct __packed tcan4x5x_buf_cmd { > > + u8 cmd; > > + __be16 addr; > > + u8 len; > > +}; > > This has to be packed, as I assume the compiler would add some space after the > "u8 cmd" to align the __be16 naturally. Ack,

Re: [net-next 15/19] can: tcan4x5x: rework SPI access

2021-01-07 Thread Marc Kleine-Budde
On 1/7/21 8:00 PM, Jakub Kicinski wrote: > On Thu, 7 Jan 2021 10:48:56 +0100 Marc Kleine-Budde wrote: >> +struct __packed tcan4x5x_map_buf { >> +struct tcan4x5x_buf_cmd cmd; >> +u8 data[256 * sizeof(u32)]; >> +} cacheline_aligned; > > Interesting attribute combo, I must say. __packed

Re: [net-next 15/19] can: tcan4x5x: rework SPI access

2021-01-07 Thread Marc Kleine-Budde
On 1/7/21 8:06 PM, Jakub Kicinski wrote: > On Thu, 7 Jan 2021 11:00:35 -0800 Jakub Kicinski wrote: >> On Thu, 7 Jan 2021 10:48:56 +0100 Marc Kleine-Budde wrote: >>> +struct __packed tcan4x5x_map_buf { >>> + struct tcan4x5x_buf_cmd cmd; >>> + u8 data[256 * sizeof(u32)]; >>> +} cacheline_ali

Re: [net-next 15/19] can: tcan4x5x: rework SPI access

2021-01-07 Thread Jakub Kicinski
On Thu, 7 Jan 2021 11:00:35 -0800 Jakub Kicinski wrote: > On Thu, 7 Jan 2021 10:48:56 +0100 Marc Kleine-Budde wrote: > > +struct __packed tcan4x5x_map_buf { > > + struct tcan4x5x_buf_cmd cmd; > > + u8 data[256 * sizeof(u32)]; > > +} cacheline_aligned; > > Interesting attribute combo, I

Re: [net-next 15/19] can: tcan4x5x: rework SPI access

2021-01-07 Thread Jakub Kicinski
On Thu, 7 Jan 2021 10:48:56 +0100 Marc Kleine-Budde wrote: > +struct __packed tcan4x5x_map_buf { > + struct tcan4x5x_buf_cmd cmd; > + u8 data[256 * sizeof(u32)]; > +} cacheline_aligned; Interesting attribute combo, I must say.

[net-next 15/19] can: tcan4x5x: rework SPI access

2021-01-07 Thread Marc Kleine-Budde
This patch reworks the SPI access and fixes several probems: - tcan4x5x_regmap_gather_write(), tcan4x5x_regmap_read(): Do not place variable "addr" on stack and use it as buffer for SPI transfer. Buffers for SPI transfers must be allocated from DMA save memory. - tcan4x5x_regmap_gather_write(