/* Assemble the address part of a command for AT45 devices in non-power-of-two page size mode.  */
static void at45_build_address(struct atmel_spi_flash *asf, u8 *cmd, u32 offset)
/* Assemble the address part of a command for AT45 devices in non-power-of-two page size mode.  */
static void at45_build_address(struct atmel_spi_flash *asf, u8 *cmd, u32 offset)
{
	unsigned long page_addr;
	unsigned long byte_addr;
	unsigned long page_size;
	unsigned int page_shift;
	page_shift = asf->params->l2_page_size;
	page_size = (1 << page_shift) + (1 << (page_shift - 5));
	page_shift++;
	page_addr = offset / page_size;
	byte_addr = offset % page_size;
	cmd[0] = page_addr >> (16 - page_shift);
	cmd[1] = page_addr << (page_shift - 8) | (byte_addr >> 8);
	cmd[2] = byte_addr;
}