projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
command: Remove the cmd_tbl_t typedef
[oweals/u-boot.git]
/
cmd
/
i2c.c
diff --git
a/cmd/i2c.c
b/cmd/i2c.c
index 56df8eb3bca589e28c5bf23976a41a5652f342f7..9ebbdd312840242728607d8e1a705d9a2f61af27 100644
(file)
--- a/
cmd/i2c.c
+++ b/
cmd/i2c.c
@@
-71,12
+71,12
@@
#include <console.h>
#include <dm.h>
#include <edid.h>
#include <console.h>
#include <dm.h>
#include <edid.h>
-#include <environment.h>
#include <errno.h>
#include <i2c.h>
#include <malloc.h>
#include <asm/byteorder.h>
#include <linux/compiler.h>
#include <errno.h>
#include <i2c.h>
#include <malloc.h>
#include <asm/byteorder.h>
#include <linux/compiler.h>
+#include <u-boot/crc.h>
/* Display values from last command.
* Memory modify remembered values are different from display memory.
/* Display values from last command.
* Memory modify remembered values are different from display memory.
@@
-288,7
+288,8
@@
static int i2c_report_err(int ret, enum i2c_err_op op)
* Syntax:
* i2c read {i2c_chip} {devaddr}{.0, .1, .2} {len} {memaddr}
*/
* Syntax:
* i2c read {i2c_chip} {devaddr}{.0, .1, .2} {len} {memaddr}
*/
-static int do_i2c_read ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c_read(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
{
uint chip;
uint devaddr, length;
{
uint chip;
uint devaddr, length;
@@
-341,7
+342,8
@@
static int do_i2c_read ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv
return 0;
}
return 0;
}
-static int do_i2c_write(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c_write(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
{
uint chip;
uint devaddr, length;
{
uint chip;
uint devaddr, length;
@@
-432,7
+434,7
@@
static int do_i2c_write(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[
}
#ifdef CONFIG_DM_I2C
}
#ifdef CONFIG_DM_I2C
-static int do_i2c_flags(
cmd_tbl_t
*cmdtp, int flag, int argc,
+static int do_i2c_flags(
struct cmd_tbl
*cmdtp, int flag, int argc,
char *const argv[])
{
struct udevice *dev;
char *const argv[])
{
struct udevice *dev;
@@
-462,7
+464,8
@@
static int do_i2c_flags(cmd_tbl_t *cmdtp, int flag, int argc,
return 0;
}
return 0;
}
-static int do_i2c_olen(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_i2c_olen(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
{
struct udevice *dev;
uint olen;
{
struct udevice *dev;
uint olen;
@@
-507,7
+510,8
@@
static int do_i2c_olen(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
* Syntax:
* i2c md {i2c_chip} {addr}{.0, .1, .2} {len}
*/
* Syntax:
* i2c md {i2c_chip} {addr}{.0, .1, .2} {len}
*/
-static int do_i2c_md ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c_md(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
{
uint chip;
uint addr, length;
{
uint chip;
uint addr, length;
@@
-626,7
+630,8
@@
static int do_i2c_md ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
* Syntax:
* i2c mw {i2c_chip} {addr}{.0, .1, .2} {data} [{count}]
*/
* Syntax:
* i2c mw {i2c_chip} {addr}{.0, .1, .2} {data} [{count}]
*/
-static int do_i2c_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c_mw(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
{
uint chip;
ulong addr;
{
uint chip;
ulong addr;
@@
-712,7
+717,8
@@
static int do_i2c_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
* Syntax:
* i2c crc32 {i2c_chip} {addr}{.0, .1, .2} {count}
*/
* Syntax:
* i2c crc32 {i2c_chip} {addr}{.0, .1, .2} {count}
*/
-static int do_i2c_crc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c_crc(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
{
uint chip;
ulong addr;
{
uint chip;
ulong addr;
@@
-769,7
+775,7
@@
static int do_i2c_crc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
#endif
if (ret)
err++;
#endif
if (ret)
err++;
- crc = crc32
(crc, &byte, 1);
+ crc = crc32(crc, &byte, 1);
addr++;
}
if (err > 0)
addr++;
}
if (err > 0)
@@
-796,8
+802,8
@@
static int do_i2c_crc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]
* i2c mm{.b, .w, .l} {i2c_chip} {addr}{.0, .1, .2}
* i2c nm{.b, .w, .l} {i2c_chip} {addr}{.0, .1, .2}
*/
* i2c mm{.b, .w, .l} {i2c_chip} {addr}{.0, .1, .2}
* i2c nm{.b, .w, .l} {i2c_chip} {addr}{.0, .1, .2}
*/
-static int
-
mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *
const argv[])
+static int
mod_i2c_mem(struct cmd_tbl *cmdtp, int incrflag, int flag, int argc,
+
char *
const argv[])
{
uint chip;
ulong addr;
{
uint chip;
ulong addr;
@@
-945,7
+951,8
@@
mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg
*
* Returns zero (success) if one or more I2C devices was found
*/
*
* Returns zero (success) if one or more I2C devices was found
*/
-static int do_i2c_probe (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c_probe(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
{
int j;
int addr = -1;
{
int j;
int addr = -1;
@@
-1020,7
+1027,8
@@
static int do_i2c_probe (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv
* {length} - Number of bytes to read
* {delay} - A DECIMAL number and defaults to 1000 uSec
*/
* {length} - Number of bytes to read
* {delay} - A DECIMAL number and defaults to 1000 uSec
*/
-static int do_i2c_loop(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c_loop(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
{
uint chip;
int alen;
{
uint chip;
int alen;
@@
-1146,7
+1154,8
@@
static void decode_bits (u_char const b, char const *str[], int const do_once)
* Syntax:
* i2c sdram {i2c_chip}
*/
* Syntax:
* i2c sdram {i2c_chip}
*/
-static int do_sdram (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static int do_sdram(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
{
enum { unknown, EDO, SDRAM, DDR, DDR2, DDR3, DDR4 } type;
{
enum { unknown, EDO, SDRAM, DDR, DDR2, DDR3, DDR4 } type;
@@
-1648,7
+1657,7
@@
static int do_sdram (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
* i2c edid {i2c_chip}
*/
#if defined(CONFIG_I2C_EDID)
* i2c edid {i2c_chip}
*/
#if defined(CONFIG_I2C_EDID)
-int do_edid(
cmd_tbl_t
*cmdtp, int flag, int argc, char *const argv[])
+int do_edid(
struct cmd_tbl
*cmdtp, int flag, int argc, char *const argv[])
{
uint chip;
struct edid1_info edid;
{
uint chip;
struct edid1_info edid;
@@
-1715,8
+1724,8
@@
static void show_bus(struct udevice *bus)
* Returns zero always.
*/
#if defined(CONFIG_SYS_I2C) || defined(CONFIG_DM_I2C)
* Returns zero always.
*/
#if defined(CONFIG_SYS_I2C) || defined(CONFIG_DM_I2C)
-static int do_i2c_show_bus(
cmd_tbl_t
*cmdtp, int flag, int argc,
-
char *
const argv[])
+static int do_i2c_show_bus(
struct cmd_tbl
*cmdtp, int flag, int argc,
+
char *
const argv[])
{
if (argc == 1) {
/* show all busses */
{
if (argc == 1) {
/* show all busses */
@@
-1802,8
+1811,8
@@
static int do_i2c_show_bus(cmd_tbl_t *cmdtp, int flag, int argc,
*/
#if defined(CONFIG_SYS_I2C) || defined(CONFIG_I2C_MULTI_BUS) || \
defined(CONFIG_DM_I2C)
*/
#if defined(CONFIG_SYS_I2C) || defined(CONFIG_I2C_MULTI_BUS) || \
defined(CONFIG_DM_I2C)
-static int do_i2c_bus_num(
cmd_tbl_t
*cmdtp, int flag, int argc,
-
char *
const argv[])
+static int do_i2c_bus_num(
struct cmd_tbl
*cmdtp, int flag, int argc,
+
char *
const argv[])
{
int ret = 0;
int bus_no;
{
int ret = 0;
int bus_no;
@@
-1853,7
+1862,8
@@
static int do_i2c_bus_num(cmd_tbl_t *cmdtp, int flag, int argc,
* Returns zero on success, CMD_RET_USAGE in case of misuse and negative
* on error.
*/
* Returns zero on success, CMD_RET_USAGE in case of misuse and negative
* on error.
*/
-static int do_i2c_bus_speed(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c_bus_speed(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
{
int speed, ret=0;
{
int speed, ret=0;
@@
-1896,7
+1906,8
@@
static int do_i2c_bus_speed(cmd_tbl_t * cmdtp, int flag, int argc, char * const
* Returns zero on success, CMD_RET_USAGE in case of misuse and negative
* on error.
*/
* Returns zero on success, CMD_RET_USAGE in case of misuse and negative
* on error.
*/
-static int do_i2c_mm(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c_mm(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
{
return mod_i2c_mem (cmdtp, 1, flag, argc, argv);
}
{
return mod_i2c_mem (cmdtp, 1, flag, argc, argv);
}
@@
-1911,7
+1922,8
@@
static int do_i2c_mm(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
* Returns zero on success, CMD_RET_USAGE in case of misuse and negative
* on error.
*/
* Returns zero on success, CMD_RET_USAGE in case of misuse and negative
* on error.
*/
-static int do_i2c_nm(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c_nm(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
{
return mod_i2c_mem (cmdtp, 0, flag, argc, argv);
}
{
return mod_i2c_mem (cmdtp, 0, flag, argc, argv);
}
@@
-1925,7
+1937,8
@@
static int do_i2c_nm(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
*
* Returns zero always.
*/
*
* Returns zero always.
*/
-static int do_i2c_reset(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c_reset(struct cmd_tbl *cmdtp, int flag, int argc,
+ char *const argv[])
{
#if defined(CONFIG_DM_I2C)
struct udevice *bus;
{
#if defined(CONFIG_DM_I2C)
struct udevice *bus;
@@
-1944,7
+1957,7
@@
static int do_i2c_reset(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv
return 0;
}
return 0;
}
-static
cmd_tbl_t
cmd_i2c_sub[] = {
+static
struct cmd_tbl
cmd_i2c_sub[] = {
#if defined(CONFIG_SYS_I2C) || defined(CONFIG_DM_I2C)
U_BOOT_CMD_MKENT(bus, 1, 1, do_i2c_show_bus, "", ""),
#endif
#if defined(CONFIG_SYS_I2C) || defined(CONFIG_DM_I2C)
U_BOOT_CMD_MKENT(bus, 1, 1, do_i2c_show_bus, "", ""),
#endif
@@
-1995,9
+2008,9
@@
static __maybe_unused void i2c_reloc(void)
* Returns zero on success, CMD_RET_USAGE in case of misuse and negative
* on error.
*/
* Returns zero on success, CMD_RET_USAGE in case of misuse and negative
* on error.
*/
-static int do_i2c(
cmd_tbl_t * cmdtp, int flag, int argc, char *
const argv[])
+static int do_i2c(
struct cmd_tbl *cmdtp, int flag, int argc, char *
const argv[])
{
{
-
cmd_tbl_t
*c;
+
struct cmd_tbl
*c;
#ifdef CONFIG_NEEDS_MANUAL_RELOC
i2c_reloc();
#ifdef CONFIG_NEEDS_MANUAL_RELOC
i2c_reloc();
@@
-2023,6
+2036,7
@@
static int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
static char i2c_help_text[] =
#if defined(CONFIG_SYS_I2C) || defined(CONFIG_DM_I2C)
"bus [muxtype:muxaddr:muxchannel] - show I2C bus info\n"
static char i2c_help_text[] =
#if defined(CONFIG_SYS_I2C) || defined(CONFIG_DM_I2C)
"bus [muxtype:muxaddr:muxchannel] - show I2C bus info\n"
+ "i2c " /* That's the prefix for the crc32 command below. */
#endif
"crc32 chip address[.0, .1, .2] count - compute CRC32 checksum\n"
#if defined(CONFIG_SYS_I2C) || \
#endif
"crc32 chip address[.0, .1, .2] count - compute CRC32 checksum\n"
#if defined(CONFIG_SYS_I2C) || \