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

Commit fe2ee139 authored by Hariprasad Shenai's avatar Hariprasad Shenai Committed by David S. Miller
Browse files

cxgb4: Add support to S25FL032P flash



Add support for Spansion S25FL032P flash
Based on original work by Dimitris Michailidis

Signed-off-by: default avatarHariprasad Shenai <hariprasad@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 60d42bf6
Loading
Loading
Loading
Loading
+20 −0
Original line number Original line Diff line number Diff line
@@ -3850,8 +3850,20 @@ int t4_wait_dev_ready(struct adapter *adap)
	return t4_read_reg(adap, PL_WHOAMI) != 0xffffffff ? 0 : -EIO;
	return t4_read_reg(adap, PL_WHOAMI) != 0xffffffff ? 0 : -EIO;
}
}


struct flash_desc {
	u32 vendor_and_model_id;
	u32 size_mb;
};

static int get_flash_params(struct adapter *adap)
static int get_flash_params(struct adapter *adap)
{
{
	/* Table for non-Numonix supported flash parts.  Numonix parts are left
	 * to the preexisting code.  All flash parts have 64KB sectors.
	 */
	static struct flash_desc supported_flash[] = {
		{ 0x150201, 4 << 20 },       /* Spansion 4MB S25FL032P */
	};

	int ret;
	int ret;
	u32 info;
	u32 info;


@@ -3862,6 +3874,14 @@ static int get_flash_params(struct adapter *adap)
	if (ret)
	if (ret)
		return ret;
		return ret;


	for (ret = 0; ret < ARRAY_SIZE(supported_flash); ++ret)
		if (supported_flash[ret].vendor_and_model_id == info) {
			adap->params.sf_size = supported_flash[ret].size_mb;
			adap->params.sf_nsec =
				adap->params.sf_size / SF_SEC_SIZE;
			return 0;
		}

	if ((info & 0xff) != 0x20)             /* not a Numonix flash */
	if ((info & 0xff) != 0x20)             /* not a Numonix flash */
		return -EINVAL;
		return -EINVAL;
	info >>= 16;                           /* log2 of size */
	info >>= 16;                           /* log2 of size */