Lines Matching +full:offset +full:- +full:y

4  * SPDX-License-Identifier:	GPL-2.0+
8 #include "tdx-cfg-block.h"
16 #include <asm/arch-pxa/pxa.h>
26 #include <asm/mach-types.h>
102 int offset = CONFIG_TDX_CFG_BLOCK_OFFSET; in tdx_cfg_block_mmc_storage() local
111 ret = -ENODEV; in tdx_cfg_block_mmc_storage()
114 if (part != mmc_get_blk_desc(mmc)->hwpart) { in tdx_cfg_block_mmc_storage()
117 ret = -ENODEV; in tdx_cfg_block_mmc_storage()
121 if (offset < 0) in tdx_cfg_block_mmc_storage()
122 offset += mmc->capacity; in tdx_cfg_block_mmc_storage()
123 blk_start = ALIGN(offset, mmc->write_bl_len) / mmc->write_bl_len; in tdx_cfg_block_mmc_storage()
129 ret = -EIO; in tdx_cfg_block_mmc_storage()
136 ret = -EIO; in tdx_cfg_block_mmc_storage()
196 int offset; in read_tdx_cfg_block() local
202 return -ENOMEM; in read_tdx_cfg_block()
214 ret = -EINVAL; in read_tdx_cfg_block()
221 if (tag->flags != TAG_FLAG_VALID || tag->id != TAG_VALID) { in read_tdx_cfg_block()
223 ret = -EINVAL; in read_tdx_cfg_block()
227 offset = 4; in read_tdx_cfg_block()
229 while (offset < TDX_CFG_BLOCK_MAX_SIZE) { in read_tdx_cfg_block()
230 tag = (struct toradex_tag *)(config_block + offset); in read_tdx_cfg_block()
231 offset += 4; in read_tdx_cfg_block()
232 if (tag->id == TAG_INVALID) in read_tdx_cfg_block()
235 if (tag->flags == TAG_FLAG_VALID) { in read_tdx_cfg_block()
236 switch (tag->id) { in read_tdx_cfg_block()
238 memcpy(&tdx_eth_addr, config_block + offset, in read_tdx_cfg_block()
245 memcpy(&tdx_hw_tag, config_block + offset, 8); in read_tdx_cfg_block()
251 offset += tag->len * 4; in read_tdx_cfg_block()
272 sprintf(message, "Is the module the 312 MHz version? [y/N] "); in get_cfgblock_interactive()
274 sprintf(message, "Is the module an IT version? [y/N] "); in get_cfgblock_interactive()
282 if (it == 'y' || it == 'Y') in get_cfgblock_interactive()
293 if (it == 'y' || it == 'Y') in get_cfgblock_interactive()
309 if (it == 'y' || it == 'Y') in get_cfgblock_interactive()
310 if (gd->ram_size == 0x10000000) in get_cfgblock_interactive()
315 if (gd->ram_size == 0x10000000) in get_cfgblock_interactive()
320 if (it == 'y' || it == 'Y') in get_cfgblock_interactive()
327 if (it == 'y' || it == 'Y') in get_cfgblock_interactive()
330 if (gd->ram_size == 0x40000000) in get_cfgblock_interactive()
335 if (it == 'y' || it == 'Y') in get_cfgblock_interactive()
344 if (it == 'y' || it == 'Y') in get_cfgblock_interactive()
349 if (it == 'y' || it == 'Y') in get_cfgblock_interactive()
355 return -1; in get_cfgblock_interactive()
363 tdx_hw_tag.ver_major = console_buffer[0] - '0'; in get_cfgblock_interactive()
364 tdx_hw_tag.ver_minor = console_buffer[2] - '0'; in get_cfgblock_interactive()
365 tdx_hw_tag.ver_assembly = console_buffer[3] - 'A'; in get_cfgblock_interactive()
368 tdx_hw_tag.prodid -= (COLIBRI_PXA270_312MHZ - in get_cfgblock_interactive()
385 return -1; in get_cfgblock_barcode()
389 tdx_hw_tag.ver_major = barcode[4] - '0'; in get_cfgblock_barcode()
390 tdx_hw_tag.ver_minor = barcode[5] - '0'; in get_cfgblock_barcode()
391 tdx_hw_tag.ver_assembly = barcode[7] - '0'; in get_cfgblock_barcode()
409 int offset = 0; in do_cfgblock_create() local
431 get_nand_dev_by_index(0)->erasesize); in do_cfgblock_create()
438 …printf("NOR sector at offset 0x%02x need to be erased and unprotected before creating a Toradex co… in do_cfgblock_create()
444 "A valid Toradex config block is present, still recreate? [y/N] "); in do_cfgblock_create()
449 if (console_buffer[0] != 'y' && console_buffer[0] != 'Y') in do_cfgblock_create()
471 tag->id = TAG_VALID; in do_cfgblock_create()
472 tag->flags = TAG_FLAG_VALID; in do_cfgblock_create()
473 tag->len = 0; in do_cfgblock_create()
474 offset += 4; in do_cfgblock_create()
477 tag = (struct toradex_tag *)(config_block + offset); in do_cfgblock_create()
478 tag->id = TAG_HW; in do_cfgblock_create()
479 tag->flags = TAG_FLAG_VALID; in do_cfgblock_create()
480 tag->len = 2; in do_cfgblock_create()
481 offset += 4; in do_cfgblock_create()
483 memcpy(config_block + offset, &tdx_hw_tag, 8); in do_cfgblock_create()
484 offset += 8; in do_cfgblock_create()
487 tag = (struct toradex_tag *)(config_block + offset); in do_cfgblock_create()
488 tag->id = TAG_MAC; in do_cfgblock_create()
489 tag->flags = TAG_FLAG_VALID; in do_cfgblock_create()
490 tag->len = 2; in do_cfgblock_create()
491 offset += 4; in do_cfgblock_create()
493 memcpy(config_block + offset, &tdx_eth_addr, 6); in do_cfgblock_create()
494 offset += 6; in do_cfgblock_create()
495 memset(config_block + offset, 0, 32 - offset); in do_cfgblock_create()
504 err = -EINVAL; in do_cfgblock_create()
545 "create [barcode] - (Re-)create Toradex config block\n"
546 "cfgblock reload - Reload Toradex config block from flash"