wireless: introduce POWEROF2_BLOCKSIZE_ONLY option
PATCH 1/1 wireless: introduce POWEROF2_BLOCKSIZE_ONLY option
From: Cliff Cai <[email protected]>
Introduce POWEROF2_BLOCKSIZE_ONLY option for those SD/SDIO host which only support transferring block with size of power-of-2
[ Bryan Wu <[email protected]>:
- remove some useless coding style cleanup
- using roundup() function as upstream does
]
--- drivers/net/wireless/Kconfig | 6 ++++++ drivers/net/wireless/libertas/if_sdio.c | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-)
drivers/net/wireless/Kconfig +6 -0
@@ -151,6 +151,12 @@ config LIBERTAS_SDIO ---help--- A driver for Marvell Libertas 8385 and 8686 SDIO devices. +config POWEROF2_BLOCKSIZE_ONLY + bool "Support transferring block with size of power-of-2 only" + depends on LIBERTAS_SDIO + ---help--- + For SD/SDIO host which only supports transferring block with size of power-of-2. + config LIBERTAS_DEBUG bool "Enable full debugging output in the Libertas module." depends on LIBERTAS
drivers/net/wireless/libertas/if_sdio.c +16 -0
@@ -272,6 +272,11 @@ static int if_sdio_card_to_host(struct if_sdio_card *card)*/ chunk =sdio_align_size (card->func, size); +/* For SD/SDIO host which only supports transferring block with size of power-of-2 */ +#if defined(CONFIG_POWEROF2_BLOCKSIZE_ONLY ) + chunk = (chunk + card->func->cur_blksize -1 ) / + card->func->cur_blksize * card->func->cur_blksize; +#endif ret =sdio_readsb (card->func, card->buffer, card->ioport, chunk);if (ret) goto out;
@@ -581,8 +586,14 @@ static int if_sdio_prog_real(struct if_sdio_card *card)lbs_deb_sdio("sending %d bytes (%d bytes) chunk\n", chunk_size, (chunk_size + 31) / 32 * 32); */ +/* For SD/SDIO host which only supports transferring block with size of power-of-2 */ +#if defined(CONFIG_POWEROF2_BLOCKSIZE_ONLY ) + ret =sdio_writesb (card->func, card->ioport, + chunk_buffer, roundup(chunk_size, 256); +#else ret =sdio_writesb (card->func, card->ioport, chunk_buffer,roundup (chunk_size,32 )); +#endif if (ret) goto release;
@@ -699,6 +710,11 @@ static int if_sdio_host_to_card(struct lbs_private *priv,*/ size =sdio_align_size (card->func, nb +4 ); +/* For SD/SDIO host which only supports transferring block with size of power-of-2 */ +#if defined(CONFIG_POWEROF2_BLOCKSIZE_ONLY ) + size = (size + card->func->cur_blksize -1 ) / + card->func->cur_blksize * card->func->cur_blksize; +#endif packet =kzalloc (sizeof (struct if_sdio_packet ) + size,GFP_ATOMIC );if (!packet) {
Signature · 1 line
1.5.6.3
Quoted 4 lines · Bryan Wu
From: Cliff Cai <[email protected]>
Introduce
POWEROF2_BLOCKSIZE_ONLYoption for those SD/SDIO host which only support transferring block with size of power-of-2
Is the point here to avoid copying in the controller code? As with the other patches on libertas-dev, I really dislike adding code to *every SDIO driver* just because the host has certain restrictions. I'd much rather that the host/controller code became aware of it's own restrictions, and exposed those generically to drivers above it. Without a KConfig option.
Seriously. The host knows what it needs. The code to handle that should go in the host.
How about adding a method like "sdio_align_size" that takes the controller's constraints into account? That seems a lot cleaner than adding #define/KConfig junk to every SDIO driver in the kernel. One less codepath to test, makes your life and all our lives easier.
Dan
Quoted 72 lines
[ Bryan Wu <[email protected]>:
- remove some useless coding style cleanup
- usingroundup()function as upstream does
]Signed-off-by Cliff Cai <[email protected]>Signed-off-by Bryan Wu <[email protected]>--- drivers/net/wireless/Kconfig | 6 ++++++ drivers/net/wireless/libertas/if_sdio.c | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-)drivers/net/wireless/Kconfig +6
-0@@ -151,6 +151,12 @@ config LIBERTAS_SDIO ---help--- A driver for Marvell Libertas 8385 and 8686 SDIO devices. +config POWEROF2_BLOCKSIZE_ONLY + bool "Support transferring block with size of power-of-2 only" + depends on LIBERTAS_SDIO + ---help--- + For SD/SDIO host which only supports transferring block with size of power-of-2. + config LIBERTAS_DEBUG bool "Enable full debugging output in the Libertas module." depends on LIBERTASdrivers/net/wireless/libertas/if_sdio.c +16
-0@@ -272,6 +272,11 @@ static int if_sdio_card_to_host(struct if_sdio_card *card)*/ chunk =sdio_align_size (card->func, size); +/* For SD/SDIO host which only supports transferring block with size of power-of-2 */ +#if defined(CONFIG_POWEROF2_BLOCKSIZE_ONLY ) + chunk = (chunk + card->func->cur_blksize -1 ) / + card->func->cur_blksize * card->func->cur_blksize; +#endif ret =sdio_readsb (card->func, card->buffer, card->ioport, chunk);if (ret) goto out;@@ -581,8 +586,14 @@ static int if_sdio_prog_real(struct if_sdio_card *card)lbs_deb_sdio("sending %d bytes (%d bytes) chunk\n", chunk_size, (chunk_size + 31) / 32 * 32); */ +/* For SD/SDIO host which only supports transferring block with size of power-of-2 */ +#if defined(CONFIG_POWEROF2_BLOCKSIZE_ONLY ) + ret =sdio_writesb (card->func, card->ioport, + chunk_buffer, roundup(chunk_size, 256); +#else ret =sdio_writesb (card->func, card->ioport, chunk_buffer,roundup (chunk_size,32 )); +#endif if (ret) goto release;@@ -699,6 +710,11 @@ static int if_sdio_host_to_card(struct lbs_private *priv,*/ size =sdio_align_size (card->func, nb +4 ); +/* For SD/SDIO host which only supports transferring block with size of power-of-2 */ +#if defined(CONFIG_POWEROF2_BLOCKSIZE_ONLY ) + size = (size + card->func->cur_blksize -1 ) / + card->func->cur_blksize * card->func->cur_blksize; +#endif packet =kzalloc (sizeof (struct if_sdio_packet ) + size,GFP_ATOMIC );if (!packet) {
Quoted 13 lines · Dan Williams
Quoted 4 lines · Bryan Wu
From: Cliff Cai <[email protected]>
Introduce
POWEROF2_BLOCKSIZE_ONLYoption for those SD/SDIO host which only support transferring block with size of power-of-2Is the point here to avoid copying in the controller code? As with the other patches on libertas-dev, I really dislike adding code to *every SDIO driver* just because the host has certain restrictions. I'd much rather that the host/controller code became aware of it's own restrictions, and exposed those generically to drivers above it. Without a KConfig option.
Quoted 3 lines
Seriously. The host knows what it needs. The code to handle that should go in the host.
I agree here.
Quoted 5 lines
How about adding a method like "
sdio_align_size" that takes the controller's constraints into account? That seems a lot cleaner than adding #define/KConfig junk to every SDIO driver in the kernel. One less codepath to test, makes your life and all our lives easier.
So we plan to add method ".sdio_align_size" to SDIO stack. And Blackfin host driver will implement this method while others will implement this as a dummy function.
In libertas, we need to call this method to take this constraints into account.
Thanks
-Bryan
Quoted 74 lines
Quoted 72 lines
[ Bryan Wu <[email protected]>:
- remove some useless coding style cleanup
- usingroundup()function as upstream does
]Signed-off-by Cliff Cai <[email protected]>Signed-off-by Bryan Wu <[email protected]>--- drivers/net/wireless/Kconfig | 6 ++++++ drivers/net/wireless/libertas/if_sdio.c | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-)drivers/net/wireless/Kconfig +6
-0@@ -151,6 +151,12 @@ config LIBERTAS_SDIO ---help--- A driver for Marvell Libertas 8385 and 8686 SDIO devices. +config POWEROF2_BLOCKSIZE_ONLY + bool "Support transferring block with size of power-of-2 only" + depends on LIBERTAS_SDIO + ---help--- + For SD/SDIO host which only supports transferring block with size of power-of-2. + config LIBERTAS_DEBUG bool "Enable full debugging output in the Libertas module." depends on LIBERTASdrivers/net/wireless/libertas/if_sdio.c +16
-0@@ -272,6 +272,11 @@ static int if_sdio_card_to_host(struct if_sdio_card *card)*/ chunk =sdio_align_size (card->func, size); +/* For SD/SDIO host which only supports transferring block with size of power-of-2 */ +#if defined(CONFIG_POWEROF2_BLOCKSIZE_ONLY ) + chunk = (chunk + card->func->cur_blksize -1 ) / + card->func->cur_blksize * card->func->cur_blksize; +#endif ret =sdio_readsb (card->func, card->buffer, card->ioport, chunk);if (ret) goto out;@@ -581,8 +586,14 @@ static int if_sdio_prog_real(struct if_sdio_card *card)lbs_deb_sdio("sending %d bytes (%d bytes) chunk\n", chunk_size, (chunk_size + 31) / 32 * 32); */ +/* For SD/SDIO host which only supports transferring block with size of power-of-2 */ +#if defined(CONFIG_POWEROF2_BLOCKSIZE_ONLY ) + ret =sdio_writesb (card->func, card->ioport, + chunk_buffer, roundup(chunk_size, 256); +#else ret =sdio_writesb (card->func, card->ioport, chunk_buffer,roundup (chunk_size,32 )); +#endif if (ret) goto release;@@ -699,6 +710,11 @@ static int if_sdio_host_to_card(struct lbs_private *priv,*/ size =sdio_align_size (card->func, nb +4 ); +/* For SD/SDIO host which only supports transferring block with size of power-of-2 */ +#if defined(CONFIG_POWEROF2_BLOCKSIZE_ONLY ) + size = (size + card->func->cur_blksize -1 ) / + card->func->cur_blksize * card->func->cur_blksize; +#endif packet =kzalloc (sizeof (struct if_sdio_packet ) + size,GFP_ATOMIC );if (!packet) {
Quoted 26 lines · Bryan Wu
Quoted 13 lines · Dan Williams
Quoted 4 lines · Bryan Wu
From: Cliff Cai <[email protected]>
Introduce
POWEROF2_BLOCKSIZE_ONLYoption for those SD/SDIO host which only support transferring block with size of power-of-2Is the point here to avoid copying in the controller code? As with the other patches on libertas-dev, I really dislike adding code to *every SDIO driver* just because the host has certain restrictions. I'd much rather that the host/controller code became aware of it's own restrictions, and exposed those generically to drivers above it. Without a KConfig option.
Quoted 3 lines
Seriously. The host knows what it needs. The code to handle that should go in the host.
I agree here.
Quoted 5 lines
How about adding a method like "
sdio_align_size" that takes the controller's constraints into account? That seems a lot cleaner than adding #define/KConfig junk to every SDIO driver in the kernel. One less codepath to test, makes your life and all our lives easier.
Quoted 4 lines
So we plan to add method ".sdio_align_size" to SDIO stack. And Blackfin host driver will implement this method while others will implement this as a dummy function.
sdio_align_size is already in SDIO stack, so we just need to add our constraints to this function.
Thanks
-Bryan
Quoted 76 lines
Quoted 75 lines
Quoted 73 lines
[ Bryan Wu <[email protected]>:
- remove some useless coding style cleanup
- usingroundup()function as upstream does
]Signed-off-by Cliff Cai <[email protected]>Signed-off-by Bryan Wu <[email protected]>--- drivers/net/wireless/Kconfig | 6 ++++++ drivers/net/wireless/libertas/if_sdio.c | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-)drivers/net/wireless/Kconfig +6
-0@@ -151,6 +151,12 @@ config LIBERTAS_SDIO ---help--- A driver for Marvell Libertas 8385 and 8686 SDIO devices. +config POWEROF2_BLOCKSIZE_ONLY + bool "Support transferring block with size of power-of-2 only" + depends on LIBERTAS_SDIO + ---help--- + For SD/SDIO host which only supports transferring block with size of power-of-2. + config LIBERTAS_DEBUG bool "Enable full debugging output in the Libertas module." depends on LIBERTASdrivers/net/wireless/libertas/if_sdio.c +16
-0@@ -272,6 +272,11 @@ static int if_sdio_card_to_host(struct if_sdio_card *card)*/ chunk =sdio_align_size (card->func, size); +/* For SD/SDIO host which only supports transferring block with size of power-of-2 */ +#if defined(CONFIG_POWEROF2_BLOCKSIZE_ONLY ) + chunk = (chunk + card->func->cur_blksize -1 ) / + card->func->cur_blksize * card->func->cur_blksize; +#endif ret =sdio_readsb (card->func, card->buffer, card->ioport, chunk);if (ret) goto out;@@ -581,8 +586,14 @@ static int if_sdio_prog_real(struct if_sdio_card *card)lbs_deb_sdio("sending %d bytes (%d bytes) chunk\n", chunk_size, (chunk_size + 31) / 32 * 32); */ +/* For SD/SDIO host which only supports transferring block with size of power-of-2 */ +#if defined(CONFIG_POWEROF2_BLOCKSIZE_ONLY ) + ret =sdio_writesb (card->func, card->ioport, + chunk_buffer, roundup(chunk_size, 256); +#else ret =sdio_writesb (card->func, card->ioport, chunk_buffer,roundup (chunk_size,32 )); +#endif if (ret) goto release;@@ -699,6 +710,11 @@ static int if_sdio_host_to_card(struct lbs_private *priv,*/ size =sdio_align_size (card->func, nb +4 ); +/* For SD/SDIO host which only supports transferring block with size of power-of-2 */ +#if defined(CONFIG_POWEROF2_BLOCKSIZE_ONLY ) + size = (size + card->func->cur_blksize -1 ) / + card->func->cur_blksize * card->func->cur_blksize; +#endif packet =kzalloc (sizeof (struct if_sdio_packet ) + size,GFP_ATOMIC );if (!packet) {
Quoted 27 lines · Bryan Wu
Quoted 26 lines · Bryan Wu
Quoted 13 lines · Dan Williams
Quoted 4 lines · Bryan Wu
From: Cliff Cai <[email protected]>
Introduce
POWEROF2_BLOCKSIZE_ONLYoption for those SD/SDIO host which only support transferring block with size of power-of-2Is the point here to avoid copying in the controller code? As with the other patches on libertas-dev, I really dislike adding code to *every SDIO driver* just because the host has certain restrictions. I'd much rather that the host/controller code became aware of it's own restrictions, and exposed those generically to drivers above it. Without a KConfig option.
Quoted 3 lines
Seriously. The host knows what it needs. The code to handle that should go in the host.
I agree here.
Quoted 5 lines
How about adding a method like "
sdio_align_size" that takes the controller's constraints into account? That seems a lot cleaner than adding #define/KConfig junk to every SDIO driver in the kernel. One less codepath to test, makes your life and all our lives easier.
Quoted 7 lines
Quoted 4 lines
So we plan to add method ".sdio_align_size" to SDIO stack. And Blackfin host driver will implement this method while others will implement this as a dummy function.
sdio_align_sizeis already in SDIO stack, so we just need to add our constraints to this function.
I'm reading this as "this patch is unnecessary or will be replaced by something better", so I'm dropping it. If I misread that, feel free to repost...thanks!
John
Signature · 2 lines
John W. Linville Someday the world will need a hero, and you [email protected] might be all we have. Be ready.
Quoted 33 lines · John W. Linville
Quoted 32 lines · Bryan Wu
Quoted 30 lines · Bryan Wu
Quoted 13 lines · Dan Williams
Quoted 4 lines · Bryan Wu
From: Cliff Cai <[email protected]>
Introduce
POWEROF2_BLOCKSIZE_ONLYoption for those SD/SDIO host which only support transferring block with size of power-of-2Is the point here to avoid copying in the controller code? As with the other patches on libertas-dev, I really dislike adding code to *every SDIO driver* just because the host has certain restrictions. I'd much rather that the host/controller code became aware of it's own restrictions, and exposed those generically to drivers above it. Without a KConfig option.
Quoted 3 lines
Seriously. The host knows what it needs. The code to handle that should go in the host.
I agree here.
Quoted 5 lines
How about adding a method like "
sdio_align_size" that takes the controller's constraints into account? That seems a lot cleaner than adding #define/KConfig junk to every SDIO driver in the kernel. One less codepath to test, makes your life and all our lives easier.So we plan to add method ".sdio_align_size" to SDIO stack. And Blackfin host driver will implement this method while others will implement this as a dummy function.
Quoted 6 lines
Quoted 2 lines
sdio_align_sizeis already in SDIO stack, so we just need to add our constraints to this function.I'm reading this as "this patch is unnecessary or will be replaced by something better", so I'm dropping it. If I misread that, feel free to repost...thanks!
Yeah, some patches got posted to the MMC lists that do what this patch would do, but do it in a somewhat better manner.
Dan
Quoted 37 lines · Dan Williams
Quoted 36 lines · John W. Linville
Quoted 34 lines · Bryan Wu
Quoted 26 lines · Bryan Wu
Quoted 13 lines · Dan Williams
Quoted 4 lines · Bryan Wu
From: Cliff Cai <[email protected]>
Introduce
POWEROF2_BLOCKSIZE_ONLYoption for those SD/SDIO host which only support transferring block with size of power-of-2Is the point here to avoid copying in the controller code? As with the other patches on libertas-dev, I really dislike adding code to *every SDIO driver* just because the host has certain restrictions. I'd much rather that the host/controller code became aware of it's own restrictions, and exposed those generically to drivers above it. Without a KConfig option.
Quoted 3 lines
Seriously. The host knows what it needs. The code to handle that should go in the host.
I agree here.
Quoted 5 lines
How about adding a method like "
sdio_align_size" that takes the controller's constraints into account? That seems a lot cleaner than adding #define/KConfig junk to every SDIO driver in the kernel. One less codepath to test, makes your life and all our lives easier.Quoted 4 lines
So we plan to add method ".sdio_align_size" to SDIO stack. And Blackfin host driver will implement this method while others will implement this as a dummy function.
sdio_align_sizeis already in SDIO stack, so we just need to add our constraints to this function.
Quoted 7 lines
Quoted 3 lines
I'm reading this as "this patch is unnecessary or will be replaced by something better", so I'm dropping it. If I misread that, feel free to repost...thanks!
Yeah, some patches got posted to the MMC lists that do what this patch would do, but do it in a somewhat better manner.
Exactly, Cliff will redesign a new patches for MMC/SD stack to fix this.
Thanks
-Bryan