Add INIT_ATTR to i2c_init()

It's usually only called from init() in main.c, so this is safe.

There is one more call in system-dm320.c from system_init(), but
that's also "safe". I don't know if it's okay to call i2c_init()
twice, but presumably it works...

Change-Id: I9c1cd918d162d9955f7cf03209e836cbd5e30c57
This commit is contained in:
Aidan MacDonald 2022-12-03 16:15:20 +00:00
parent 39439f6909
commit 7e5fc4076a
10 changed files with 10 additions and 10 deletions

View file

@ -30,7 +30,7 @@
#include "cpu.h"
void i2c_init(void);
void i2c_init(void) INIT_ATTR;
int i2c_read (volatile unsigned char *iface, unsigned char addr,
unsigned char *buf, int count);
int i2c_write(volatile unsigned char *iface, unsigned char addr,

View file

@ -24,7 +24,7 @@
#include "config.h"
void i2c_init(void);
void i2c_init(void) INIT_ATTR;
int i2c_write(unsigned char slave, int address, int len, const unsigned char *data);
int i2c_read(unsigned char slave, int address, int len, unsigned char *data);

View file

@ -24,7 +24,7 @@
#include "config.h"
void i2c_init(void);
void i2c_init(void) INIT_ATTR;
int i2c_write(unsigned char slave, int address, int len, const unsigned char *data);
int i2c_read(unsigned char slave, int address, int len, unsigned char *data);

View file

@ -24,7 +24,7 @@
#include "config.h"
void i2c_init(void);
void i2c_init(void) INIT_ATTR;
int i2c_write(int bus, unsigned char slave, int address, int len, const unsigned char *data);
int i2c_read(int bus, unsigned char slave, int address, int len, unsigned char *data);

View file

@ -21,7 +21,7 @@
#ifndef I2C_H
#define I2C_H
extern void i2c_init(void);
extern void i2c_init(void) INIT_ATTR;
extern void i2c_begin(void);
extern void i2c_end(void);
extern int i2c_write(int device, const unsigned char* buf, int count );

View file

@ -367,7 +367,7 @@ int i2c_write(struct i2c_node *node, const unsigned char *data,
return -1;
}
void INIT_ATTR i2c_init(void)
void i2c_init(void)
{
/* Do one-time inits for each module that will be used - leave
* module disabled and unclocked until something wants it. */

View file

@ -76,7 +76,7 @@ struct i2c_sync_transfer_desc
};
/* One-time init of i2c driver */
void i2c_init(void);
void i2c_init(void) INIT_ATTR;
/* Enable or disable the node - modules will be switched on/off accordingly. */
void i2c_enable_node(struct i2c_node *node, bool enable);

View file

@ -41,6 +41,6 @@
/* IICLC */
#define I2C_FLT_ENB (1 << 2)
void i2c_init(void);
void i2c_init(void) INIT_ATTR;
void i2c_write(int addr, const unsigned char *data, int count);

View file

@ -24,7 +24,7 @@
#include "system.h"
void i2c_init(void);
void i2c_init(void) INIT_ATTR;
int i2c_write(unsigned short address, const unsigned char *data, int count);
int i2c_read(unsigned short address, unsigned char* buf, int count);

View file

@ -27,7 +27,7 @@
#define I2C_FREQ_100K 100000
#define I2C_FREQ_400K 400000
extern void i2c_init(void);
extern void i2c_init(void) INIT_ATTR;
/* Configure the I2C controller prior to use.
*