/* Set block size of SDIO function. 
Set desired block size for SDIO function, used by block transfers to SDIO registers.  */
int sdio_set_block_size(struct sdio_func *func, uint16_t bsize)
/* Set block size of SDIO function. 
Set desired block size for SDIO function, used by block transfers to SDIO registers.  */
int sdio_set_block_size(struct sdio_func *func, uint16_t bsize)
{
	int ret;
	uint8_t reg;
	if (func->cis.max_blk_size < bsize) {
		return -EINVAL;
	}
	for (int i = 0; i < 2; i++) {
		reg = (bsize >> (i * 8));
		ret = sdio_io_rw_direct(func->card, SDIO_IO_WRITE, SDIO_FUNC_NUM_0,
			SDIO_FBR_BASE(func->num) + SDIO_FBR_BLK_SIZE + i, reg, NULL);
		if (ret) {
			return ret;
		}
	}
	func->block_size = bsize;
	return 0;
}