Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 56d01067 authored by Dmitry Shmidt's avatar Dmitry Shmidt
Browse files

ANDROID: mmc: Add sdio_readb_ext() function

Change-Id: I9b410c8a13724795b23764012fd3be8f53747299
parent 2b6be3a2
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
@@ -389,6 +389,39 @@ u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret)
}
EXPORT_SYMBOL_GPL(sdio_readb);

/**
 *	sdio_readb_ext - read a single byte from a SDIO function
 *	@func: SDIO function to access
 *	@addr: address to read
 *	@err_ret: optional status value from transfer
 *	@in: value to add to argument
 *
 *	Reads a single byte from the address space of a given SDIO
 *	function. If there is a problem reading the address, 0xff
 *	is returned and @err_ret will contain the error code.
 */
unsigned char sdio_readb_ext(struct sdio_func *func, unsigned int addr,
	int *err_ret, unsigned in)
{
	int ret;
	unsigned char val;

	BUG_ON(!func);

	if (err_ret)
		*err_ret = 0;

	ret = mmc_io_rw_direct(func->card, 0, func->num, addr, (u8)in, &val);
	if (ret) {
		if (err_ret)
			*err_ret = ret;
		return 0xFF;
	}

	return val;
}
EXPORT_SYMBOL_GPL(sdio_readb_ext);

/**
 *	sdio_writeb - write a single byte to a SDIO function
 *	@func: SDIO function to access
+2 −0
Original line number Diff line number Diff line
@@ -136,6 +136,8 @@ extern int sdio_release_irq(struct sdio_func *func);
extern unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz);

extern u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret);
extern u8 sdio_readb_ext(struct sdio_func *func, unsigned int addr, int *err_ret,
	unsigned in);
extern u16 sdio_readw(struct sdio_func *func, unsigned int addr, int *err_ret);
extern u32 sdio_readl(struct sdio_func *func, unsigned int addr, int *err_ret);