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

Commit c314dfdc authored by David Woodhouse's avatar David Woodhouse
Browse files

[MTD] [NOR] Rename and export new cfi_qry_*() functions



They need to be exported, so let's give them less generic-sounding names
while we're at it.

Original export patch, along with the suggestion about the nomenclature,
from Stephen Rothwell.

Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 8c64038e
Loading
Loading
Loading
Loading
+10 −10
Original line number Original line Diff line number Diff line
@@ -44,14 +44,14 @@ do { \


#define xip_enable(base, map, cfi) \
#define xip_enable(base, map, cfi) \
do { \
do { \
	qry_mode_off(base, map, cfi); \
	cfi_qry_mode_off(base, map, cfi);		\
	xip_allowed(base, map); \
	xip_allowed(base, map); \
} while (0)
} while (0)


#define xip_disable_qry(base, map, cfi) \
#define xip_disable_qry(base, map, cfi) \
do { \
do { \
	xip_disable(); \
	xip_disable(); \
	qry_mode_on(base, map, cfi); \
	cfi_qry_mode_on(base, map, cfi); \
} while (0)
} while (0)


#else
#else
@@ -87,7 +87,7 @@ static int __xipram cfi_probe_chip(struct map_info *map, __u32 base,
	}
	}


	xip_disable();
	xip_disable();
	if (!qry_mode_on(base, map, cfi)) {
	if (!cfi_qry_mode_on(base, map, cfi)) {
		xip_enable(base, map, cfi);
		xip_enable(base, map, cfi);
		return 0;
		return 0;
	}
	}
@@ -108,13 +108,13 @@ static int __xipram cfi_probe_chip(struct map_info *map, __u32 base,
 		start = i << cfi->chipshift;
 		start = i << cfi->chipshift;
		/* This chip should be in read mode if it's one
		/* This chip should be in read mode if it's one
		   we've already touched. */
		   we've already touched. */
		if (qry_present(map, start, cfi)) {
		if (cfi_qry_present(map, start, cfi)) {
			/* Eep. This chip also had the QRY marker.
			/* Eep. This chip also had the QRY marker.
			 * Is it an alias for the new one? */
			 * Is it an alias for the new one? */
			qry_mode_off(start, map, cfi);
			cfi_qry_mode_off(start, map, cfi);


			/* If the QRY marker goes away, it's an alias */
			/* If the QRY marker goes away, it's an alias */
			if (!qry_present(map, start, cfi)) {
			if (!cfi_qry_present(map, start, cfi)) {
				xip_allowed(base, map);
				xip_allowed(base, map);
				printk(KERN_DEBUG "%s: Found an alias at 0x%x for the chip at 0x%lx\n",
				printk(KERN_DEBUG "%s: Found an alias at 0x%x for the chip at 0x%lx\n",
				       map->name, base, start);
				       map->name, base, start);
@@ -124,9 +124,9 @@ static int __xipram cfi_probe_chip(struct map_info *map, __u32 base,
			 * unfortunate. Stick the new chip in read mode
			 * unfortunate. Stick the new chip in read mode
			 * too and if it's the same, assume it's an alias. */
			 * too and if it's the same, assume it's an alias. */
			/* FIXME: Use other modes to do a proper check */
			/* FIXME: Use other modes to do a proper check */
			qry_mode_off(base, map, cfi);
			cfi_qry_mode_off(base, map, cfi);


			if (qry_present(map, base, cfi)) {
			if (cfi_qry_present(map, base, cfi)) {
				xip_allowed(base, map);
				xip_allowed(base, map);
				printk(KERN_DEBUG "%s: Found an alias at 0x%x for the chip at 0x%lx\n",
				printk(KERN_DEBUG "%s: Found an alias at 0x%x for the chip at 0x%lx\n",
				       map->name, base, start);
				       map->name, base, start);
@@ -141,7 +141,7 @@ static int __xipram cfi_probe_chip(struct map_info *map, __u32 base,
	cfi->numchips++;
	cfi->numchips++;


	/* Put it back into Read Mode */
	/* Put it back into Read Mode */
	qry_mode_off(base, map, cfi);
	cfi_qry_mode_off(base, map, cfi);
	xip_allowed(base, map);
	xip_allowed(base, map);


	printk(KERN_INFO "%s: Found %d x%d devices at 0x%x in %d-bit bank\n",
	printk(KERN_INFO "%s: Found %d x%d devices at 0x%x in %d-bit bank\n",
@@ -201,7 +201,7 @@ static int __xipram cfi_chip_setup(struct map_info *map,
			  cfi_read_query(map, base + 0xf * ofs_factor);
			  cfi_read_query(map, base + 0xf * ofs_factor);


	/* Put it back into Read Mode */
	/* Put it back into Read Mode */
	qry_mode_off(base, map, cfi);
	cfi_qry_mode_off(base, map, cfi);
	xip_allowed(base, map);
	xip_allowed(base, map);


	/* Do any necessary byteswapping */
	/* Do any necessary byteswapping */
+15 −11
Original line number Original line Diff line number Diff line
@@ -24,7 +24,7 @@
#include <linux/mtd/cfi.h>
#include <linux/mtd/cfi.h>
#include <linux/mtd/compatmac.h>
#include <linux/mtd/compatmac.h>


int __xipram qry_present(struct map_info *map, __u32 base,
int __xipram cfi_qry_present(struct map_info *map, __u32 base,
			     struct cfi_private *cfi)
			     struct cfi_private *cfi)
{
{
	int osf = cfi->interleave * cfi->device_type;	/* scale factor */
	int osf = cfi->interleave * cfi->device_type;	/* scale factor */
@@ -50,35 +50,39 @@ int __xipram qry_present(struct map_info *map, __u32 base,


	return 1; 	/* "QRY" found */
	return 1; 	/* "QRY" found */
}
}
EXPORT_SYMBOL_GPL(cfi_qry_present);


int __xipram qry_mode_on(uint32_t base, struct map_info *map,
int __xipram cfi_qry_mode_on(uint32_t base, struct map_info *map,
			     struct cfi_private *cfi)
			     struct cfi_private *cfi)
{
{
	cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL);
	cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL);
	cfi_send_gen_cmd(0x98, 0x55, base, map, cfi, cfi->device_type, NULL);
	cfi_send_gen_cmd(0x98, 0x55, base, map, cfi, cfi->device_type, NULL);
	if (qry_present(map, base, cfi))
	if (cfi_qry_present(map, base, cfi))
		return 1;
		return 1;
	/* QRY not found probably we deal with some odd CFI chips */
	/* QRY not found probably we deal with some odd CFI chips */
	/* Some revisions of some old Intel chips? */
	/* Some revisions of some old Intel chips? */
	cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL);
	cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL);
	cfi_send_gen_cmd(0xFF, 0, base, map, cfi, cfi->device_type, NULL);
	cfi_send_gen_cmd(0xFF, 0, base, map, cfi, cfi->device_type, NULL);
	cfi_send_gen_cmd(0x98, 0x55, base, map, cfi, cfi->device_type, NULL);
	cfi_send_gen_cmd(0x98, 0x55, base, map, cfi, cfi->device_type, NULL);
	if (qry_present(map, base, cfi))
	if (cfi_qry_present(map, base, cfi))
		return 1;
		return 1;
	/* ST M29DW chips */
	/* ST M29DW chips */
	cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL);
	cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL);
	cfi_send_gen_cmd(0x98, 0x555, base, map, cfi, cfi->device_type, NULL);
	cfi_send_gen_cmd(0x98, 0x555, base, map, cfi, cfi->device_type, NULL);
	if (qry_present(map, base, cfi))
	if (cfi_qry_present(map, base, cfi))
		return 1;
		return 1;
	/* QRY not found */
	/* QRY not found */
	return 0;
	return 0;
}
}
void __xipram qry_mode_off(uint32_t base, struct map_info *map,
EXPORT_SYMBOL_GPL(cfi_qry_mode_on);

void __xipram cfi_qry_mode_off(uint32_t base, struct map_info *map,
			       struct cfi_private *cfi)
			       struct cfi_private *cfi)
{
{
	cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL);
	cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL);
	cfi_send_gen_cmd(0xFF, 0, base, map, cfi, cfi->device_type, NULL);
	cfi_send_gen_cmd(0xFF, 0, base, map, cfi, cfi->device_type, NULL);
}
}
EXPORT_SYMBOL_GPL(cfi_qry_mode_off);


struct cfi_extquery *
struct cfi_extquery *
__xipram cfi_read_pri(struct map_info *map, __u16 adr, __u16 size, const char* name)
__xipram cfi_read_pri(struct map_info *map, __u16 adr, __u16 size, const char* name)
@@ -104,7 +108,7 @@ __xipram cfi_read_pri(struct map_info *map, __u16 adr, __u16 size, const char* n
#endif
#endif


	/* Switch it into Query Mode */
	/* Switch it into Query Mode */
	qry_mode_on(base, map, cfi);
	cfi_qry_mode_on(base, map, cfi);
	/* Read in the Extended Query Table */
	/* Read in the Extended Query Table */
	for (i=0; i<size; i++) {
	for (i=0; i<size; i++) {
		((unsigned char *)extp)[i] =
		((unsigned char *)extp)[i] =
@@ -112,7 +116,7 @@ __xipram cfi_read_pri(struct map_info *map, __u16 adr, __u16 size, const char* n
	}
	}


	/* Make sure it returns to read mode */
	/* Make sure it returns to read mode */
	qry_mode_off(base, map, cfi);
	cfi_qry_mode_off(base, map, cfi);


#ifdef CONFIG_MTD_XIP
#ifdef CONFIG_MTD_XIP
	(void) map_read(map, base);
	(void) map_read(map, base);
+6 −6
Original line number Original line Diff line number Diff line
@@ -483,11 +483,11 @@ static inline void cfi_udelay(int us)
	}
	}
}
}


int __xipram qry_present(struct map_info *map, __u32 base,
int __xipram cfi_qry_present(struct map_info *map, __u32 base,
			     struct cfi_private *cfi);
			     struct cfi_private *cfi);
int __xipram qry_mode_on(uint32_t base, struct map_info *map,
int __xipram cfi_qry_mode_on(uint32_t base, struct map_info *map,
			     struct cfi_private *cfi);
			     struct cfi_private *cfi);
void __xipram qry_mode_off(uint32_t base, struct map_info *map,
void __xipram cfi_qry_mode_off(uint32_t base, struct map_info *map,
			       struct cfi_private *cfi);
			       struct cfi_private *cfi);


struct cfi_extquery *cfi_read_pri(struct map_info *map, uint16_t adr, uint16_t size,
struct cfi_extquery *cfi_read_pri(struct map_info *map, uint16_t adr, uint16_t size,