mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 16:52:14 +02:00
Coding Style cleanup: replace leading SPACEs by TABs
Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Drop changes for PEP 4 following python tools] Signed-off-by: Tom Rini <trini@ti.com>
This commit is contained in:
@@ -94,12 +94,12 @@ Pavel Herrmann <morpheus.ibis@gmail.com>
|
||||
driver_activate(instance *inst);
|
||||
This call will recursively activate all devices necessary for using the
|
||||
specified device. the code could be simplified as:
|
||||
{
|
||||
if (is_activated(inst))
|
||||
return;
|
||||
driver_activate(inst->bus);
|
||||
get_driver(inst)->probe(inst);
|
||||
}
|
||||
{
|
||||
if (is_activated(inst))
|
||||
return;
|
||||
driver_activate(inst->bus);
|
||||
get_driver(inst)->probe(inst);
|
||||
}
|
||||
|
||||
The case with multiple parents will need to be handled here as well.
|
||||
get_driver is an accessor to available drivers, which will get struct
|
||||
@@ -107,12 +107,12 @@ Pavel Herrmann <morpheus.ibis@gmail.com>
|
||||
|
||||
i2c_write(instance *inst, ...);
|
||||
An actual call to some method of the driver. This code will look like:
|
||||
{
|
||||
driver_activate(inst);
|
||||
struct instance *core = get_core_instance(CORE_I2C);
|
||||
device_ops = get_ops(inst);
|
||||
device_ops->write(...);
|
||||
}
|
||||
{
|
||||
driver_activate(inst);
|
||||
struct instance *core = get_core_instance(CORE_I2C);
|
||||
device_ops = get_ops(inst);
|
||||
device_ops->write(...);
|
||||
}
|
||||
|
||||
get_ops will not be an exported function, it will be internal and specific
|
||||
to the core, as it needs to know how are the ops stored, and what type
|
||||
|
@@ -87,7 +87,7 @@ III) The drivers
|
||||
of the cores.
|
||||
|
||||
FIXME: Should *cores[] be really struct driver, pointing to drivers that
|
||||
represent the cores? Shouldn't it be core instance pointer?
|
||||
represent the cores? Shouldn't it be core instance pointer?
|
||||
|
||||
2) Instantiation of a driver
|
||||
----------------------------
|
||||
@@ -101,7 +101,7 @@ III) The drivers
|
||||
functions.
|
||||
|
||||
FIXME: We need some functions that will return list of busses of certain type
|
||||
registered with the system so the user can find proper instance even if
|
||||
registered with the system so the user can find proper instance even if
|
||||
he has no bus pointer (this will come handy if the user isn't
|
||||
registering the driver from board init function, but somewhere else).
|
||||
|
||||
@@ -183,12 +183,12 @@ III) The drivers
|
||||
int driver_bind(struct instance *in)
|
||||
{
|
||||
...
|
||||
core_bind(&core_i2c_static_instance, in, i2c_bus_funcs);
|
||||
...
|
||||
core_bind(&core_i2c_static_instance, in, i2c_bus_funcs);
|
||||
...
|
||||
}
|
||||
|
||||
FIXME: What if we need to run-time determine, depending on some hardware
|
||||
register, what kind of i2c_bus_funcs to pass?
|
||||
register, what kind of i2c_bus_funcs to pass?
|
||||
|
||||
This makes the i2c core aware of a new bus. The i2c_bus_funcs is a constant
|
||||
structure of functions any i2c bus driver must provide to work. This will
|
||||
@@ -196,7 +196,7 @@ III) The drivers
|
||||
the pointer to the instance of a core this driver provides function to.
|
||||
|
||||
FIXME: Maybe replace "core-i2c" with CORE_I2C global pointer to an instance of
|
||||
the core?
|
||||
the core?
|
||||
|
||||
4) The instantiation of a core driver
|
||||
-------------------------------------
|
||||
|
@@ -56,11 +56,11 @@ II) Approach
|
||||
|
||||
struct gpio_driver_ops {
|
||||
int (*gpio_request)(struct instance *i, unsigned gpio,
|
||||
const char *label);
|
||||
const char *label);
|
||||
int (*gpio_free)(struct instance *i, unsigned gpio);
|
||||
int (*gpio_direction_input)(struct instance *i, unsigned gpio);
|
||||
int (*gpio_direction_output)(struct instance *i, unsigned gpio,
|
||||
int value);
|
||||
int value);
|
||||
int (*gpio_get_value)(struct instance *i, unsigned gpio);
|
||||
void (*gpio_set_value)(struct instance *i, unsigned gpio, int value);
|
||||
}
|
||||
|
@@ -36,15 +36,15 @@ II) Approach
|
||||
In the UDM each hwmon driver would register itself by a function
|
||||
|
||||
int hwmon_device_register(struct instance *i,
|
||||
struct hwmon_device_ops *o);
|
||||
struct hwmon_device_ops *o);
|
||||
|
||||
The structure being defined as follows:
|
||||
|
||||
struct hwmon_device_ops {
|
||||
int (*read)(struct instance *i, int sensor, int reg);
|
||||
int (*write)(struct instance *i, int sensor, int reg,
|
||||
int val);
|
||||
int (*get_temp)(struct instance *i, int sensor);
|
||||
int (*read)(struct instance *i, int sensor, int reg);
|
||||
int (*write)(struct instance *i, int sensor, int reg,
|
||||
int val);
|
||||
int (*get_temp)(struct instance *i, int sensor);
|
||||
};
|
||||
|
||||
|
||||
|
@@ -107,7 +107,7 @@ struct mmc {
|
||||
|
||||
/* DRIVER: Function used to submit command to the card */
|
||||
int (*send_cmd)(struct mmc *mmc,
|
||||
struct mmc_cmd *cmd, struct mmc_data *data);
|
||||
struct mmc_cmd *cmd, struct mmc_data *data);
|
||||
|
||||
/* DRIVER: Function used to configure the host */
|
||||
void (*set_ios)(struct mmc *mmc);
|
||||
@@ -139,7 +139,7 @@ provided by the MMC driver:
|
||||
struct mmc_driver_ops {
|
||||
/* Function used to submit command to the card */
|
||||
int (*send_cmd)(struct mmc *mmc,
|
||||
struct mmc_cmd *cmd, struct mmc_data *data);
|
||||
struct mmc_cmd *cmd, struct mmc_data *data);
|
||||
/* DRIVER: Function used to configure the host */
|
||||
void (*set_ios)(struct mmc *mmc);
|
||||
/* Function used to initialize the host */
|
||||
@@ -206,7 +206,7 @@ struct mmc_card_props {
|
||||
The probe() function will then register the MMC driver by calling:
|
||||
|
||||
mmc_device_register(struct instance *i, struct mmc_driver_ops *o,
|
||||
struct mmc_driver_params *p);
|
||||
struct mmc_driver_params *p);
|
||||
|
||||
The struct mmc_driver_params will have to be dynamic in some cases, but the
|
||||
driver shouldn't modify it's contents elsewhere than in probe() call.
|
||||
|
@@ -57,20 +57,20 @@ III) Analysis of in-tree drivers
|
||||
All methods of this file are moved to another location.
|
||||
void ftpmu010_32768osc_enable(void): Move to boards hacks
|
||||
void ftpmu010_mfpsr_select_dev(unsigned int dev): Move to board file
|
||||
arch/nds32/lib/board.c
|
||||
arch/nds32/lib/board.c
|
||||
void ftpmu010_mfpsr_diselect_dev(unsigned int dev): Dead code
|
||||
void ftpmu010_dlldis_disable(void): Dead code
|
||||
void ftpmu010_sdram_clk_disable(unsigned int cr0): Move to board file
|
||||
arch/nds32/lib/board.c
|
||||
arch/nds32/lib/board.c
|
||||
void ftpmu010_sdramhtc_set(unsigned int val): Move to board file
|
||||
arch/nds32/lib/board.c
|
||||
arch/nds32/lib/board.c
|
||||
|
||||
2) twl4030.c
|
||||
------------
|
||||
All methods of this file are moved to another location.
|
||||
void twl4030_power_reset_init(void): Move to board hacks
|
||||
void twl4030_pmrecv_vsel_cfg(u8 vsel_reg, u8 vsel_val, u8 dev_grp,
|
||||
u8 dev_grp_sel): Move to board hacks
|
||||
u8 dev_grp_sel): Move to board hacks
|
||||
void twl4030_power_init(void): Move to board hacks
|
||||
void twl4030_power_mmc_init(void): Move to board hacks
|
||||
|
||||
@@ -83,6 +83,6 @@ III) Analysis of in-tree drivers
|
||||
int twl6030_get_battery_voltage(void): Convert to new API
|
||||
void twl6030_init_battery_charging(void): Convert to new API
|
||||
void twl6030_power_mmc_init(): Move to board file
|
||||
drivers/mmc/omap_hsmmc.c
|
||||
drivers/mmc/omap_hsmmc.c
|
||||
void twl6030_usb_device_settings(): Move to board file
|
||||
drivers/usb/musb/omap3.c
|
||||
drivers/usb/musb/omap3.c
|
||||
|
@@ -12,15 +12,15 @@ U-Boot currently implements one common API for RTC devices. The interface
|
||||
is defined in include/rtc.h and comprises of functions and structures:
|
||||
|
||||
struct rtc_time {
|
||||
int tm_sec;
|
||||
int tm_min;
|
||||
int tm_hour;
|
||||
int tm_mday;
|
||||
int tm_mon;
|
||||
int tm_year;
|
||||
int tm_wday;
|
||||
int tm_yday;
|
||||
int tm_isdst;
|
||||
int tm_sec;
|
||||
int tm_min;
|
||||
int tm_hour;
|
||||
int tm_mday;
|
||||
int tm_mon;
|
||||
int tm_year;
|
||||
int tm_wday;
|
||||
int tm_yday;
|
||||
int tm_isdst;
|
||||
};
|
||||
|
||||
int rtc_get (struct rtc_time *);
|
||||
@@ -42,14 +42,14 @@ II) Approach
|
||||
In the UDM each rtc driver would register itself by a function
|
||||
|
||||
int rtc_device_register(struct instance *i,
|
||||
struct rtc_device_ops *o);
|
||||
struct rtc_device_ops *o);
|
||||
|
||||
The structure being defined as follows:
|
||||
|
||||
struct rtc_device_ops {
|
||||
int (*get_time)(struct instance *i, struct rtc_time *t);
|
||||
int (*set_time)(struct instance *i, struct rtc_time *t);
|
||||
int (*reset)(struct instance *i);
|
||||
int (*get_time)(struct instance *i, struct rtc_time *t);
|
||||
int (*set_time)(struct instance *i, struct rtc_time *t);
|
||||
int (*reset)(struct instance *i);
|
||||
};
|
||||
|
||||
|
||||
|
@@ -15,12 +15,12 @@ I) Overview
|
||||
|
||||
void spi_init(void);
|
||||
struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
|
||||
unsigned int max_hz, unsigned int mode);
|
||||
unsigned int max_hz, unsigned int mode);
|
||||
void spi_free_slave(struct spi_slave *slave);
|
||||
int spi_claim_bus(struct spi_slave *slave);
|
||||
void spi_release_bus(struct spi_slave *slave);
|
||||
int spi_xfer(struct spi_slave *slave, unsigned int bitlen,
|
||||
const void *dout, void *din, unsigned long flags);
|
||||
const void *dout, void *din, unsigned long flags);
|
||||
int spi_cs_is_valid(unsigned int bus, unsigned int cs);
|
||||
void spi_cs_activate(struct spi_slave *slave);
|
||||
void spi_cs_deactivate(struct spi_slave *slave);
|
||||
@@ -69,13 +69,13 @@ II) Approach
|
||||
|
||||
struct ops {
|
||||
int (*spi_request_bus)(struct instance *i, unsigned int bus,
|
||||
unsigned int cs, unsigned int max_hz,
|
||||
unsigned int mode);
|
||||
unsigned int cs, unsigned int max_hz,
|
||||
unsigned int mode);
|
||||
void (*spi_release_bus)(struct instance *i);
|
||||
int (*spi_xfer) (struct instance *i, unsigned int bitlen,
|
||||
const void *dout, void *din, unsigned long flags);
|
||||
const void *dout, void *din, unsigned long flags);
|
||||
int (*spi_cs_is_valid)(struct instance *i, unsigned int bus,
|
||||
unsigned int cs);
|
||||
unsigned int cs);
|
||||
void (*spi_cs_activate)(struct instance *i);
|
||||
void (*spi_cs_deactivate)(struct instance *i);
|
||||
void (*spi_set_speed)(struct instance *i, uint hz);
|
||||
|
@@ -17,29 +17,29 @@ Each device that wants to register with STDIO subsystem has to define struct
|
||||
stdio_dev, defined in include/stdio_dev.h and containing the following fields:
|
||||
|
||||
struct stdio_dev {
|
||||
int flags; /* Device flags: input/output/system */
|
||||
int ext; /* Supported extensions */
|
||||
char name[16]; /* Device name */
|
||||
int flags; /* Device flags: input/output/system */
|
||||
int ext; /* Supported extensions */
|
||||
char name[16]; /* Device name */
|
||||
|
||||
/* GENERAL functions */
|
||||
|
||||
int (*start) (void); /* To start the device */
|
||||
int (*stop) (void); /* To stop the device */
|
||||
int (*start) (void); /* To start the device */
|
||||
int (*stop) (void); /* To stop the device */
|
||||
|
||||
/* OUTPUT functions */
|
||||
|
||||
void (*putc) (const char c); /* To put a char */
|
||||
void (*puts) (const char *s); /* To put a string (accelerator) */
|
||||
void (*putc) (const char c); /* To put a char */
|
||||
void (*puts) (const char *s); /* To put a string (accelerator) */
|
||||
|
||||
/* INPUT functions */
|
||||
|
||||
int (*tstc) (void); /* To test if a char is ready... */
|
||||
int (*getc) (void); /* To get that char */
|
||||
int (*tstc) (void); /* To test if a char is ready... */
|
||||
int (*getc) (void); /* To get that char */
|
||||
|
||||
/* Other functions */
|
||||
|
||||
void *priv; /* Private extensions */
|
||||
struct list_head list;
|
||||
void *priv; /* Private extensions */
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
Currently used flags are DEV_FLAGS_INPUT, DEV_FLAGS_OUTPUT and DEV_FLAGS_SYSTEM,
|
||||
@@ -139,13 +139,13 @@ II) Approach
|
||||
purpose. The following flags will be defined:
|
||||
|
||||
STDIO_FLG_STDIN ..... This device will be used as an input device. All input
|
||||
from all devices with this flag set will be received
|
||||
from all devices with this flag set will be received
|
||||
and passed to the upper layers.
|
||||
STDIO_FLG_STDOUT .... This device will be used as an output device. All
|
||||
output sent to stdout will be routed to all devices
|
||||
output sent to stdout will be routed to all devices
|
||||
with this flag set.
|
||||
STDIO_FLG_STDERR .... This device will be used as an standard error output
|
||||
device. All output sent to stderr will be routed to
|
||||
device. All output sent to stderr will be routed to
|
||||
all devices with this flag set.
|
||||
|
||||
The "list" member of this structure allows to have a linked list of all
|
||||
|
@@ -14,7 +14,7 @@ controlling it is very much based on this. The API is very simple:
|
||||
int tis_open(void);
|
||||
int tis_close(void);
|
||||
int tis_sendrecv(const u8 *sendbuf, size_t send_size,
|
||||
u8 *recvbuf, size_t *recv_len);
|
||||
u8 *recvbuf, size_t *recv_len);
|
||||
|
||||
The command operating the TPM chip only provides operations to send and receive
|
||||
bytes from the chip.
|
||||
|
@@ -41,13 +41,13 @@ II) Approach
|
||||
In the UDM each watchdog driver would register itself by a function
|
||||
|
||||
int watchdog_device_register(struct instance *i,
|
||||
const struct watchdog_device_ops *o);
|
||||
const struct watchdog_device_ops *o);
|
||||
|
||||
The structure being defined as follows:
|
||||
|
||||
struct watchdog_device_ops {
|
||||
int (*disable)(struct instance *i);
|
||||
void (*reset)(struct instance *i);
|
||||
int (*disable)(struct instance *i);
|
||||
void (*reset)(struct instance *i);
|
||||
};
|
||||
|
||||
The watchdog_init() function will be dissolved into probe() function.
|
||||
|
Reference in New Issue
Block a user