mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 06:31:31 +00:00
ppc: m68k: Move i2c1_clk, i2c2_clk to arch_global_data
Move these fields into arch_global_data and tidy up. This is needed for both ppc and m68k since they share the i2c driver. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
67ac13b1b9
commit
609e6ec3f6
12 changed files with 35 additions and 31 deletions
|
@ -135,7 +135,7 @@ int get_clocks(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_FSL_I2C
|
#ifdef CONFIG_FSL_I2C
|
||||||
gd->i2c1_clk = gd->bus_clk;
|
gd->arch.i2c1_clk = gd->bus_clk;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
|
|
@ -48,7 +48,7 @@ int get_clocks(void)
|
||||||
gd->cpu_clk = (gd->bus_clk * 2);
|
gd->cpu_clk = (gd->bus_clk * 2);
|
||||||
|
|
||||||
#ifdef CONFIG_FSL_I2C
|
#ifdef CONFIG_FSL_I2C
|
||||||
gd->i2c1_clk = gd->bus_clk;
|
gd->arch.i2c1_clk = gd->bus_clk;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
|
|
@ -91,9 +91,9 @@ int get_clocks (void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_FSL_I2C
|
#ifdef CONFIG_FSL_I2C
|
||||||
gd->i2c1_clk = gd->bus_clk;
|
gd->arch.i2c1_clk = gd->bus_clk;
|
||||||
#ifdef CONFIG_SYS_I2C2_OFFSET
|
#ifdef CONFIG_SYS_I2C2_OFFSET
|
||||||
gd->i2c2_clk = gd->bus_clk;
|
gd->arch.i2c2_clk = gd->bus_clk;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -271,7 +271,7 @@ int get_clocks(void)
|
||||||
gd->cpu_clk = (gd->bus_clk * 3);
|
gd->cpu_clk = (gd->bus_clk * 3);
|
||||||
|
|
||||||
#ifdef CONFIG_FSL_I2C
|
#ifdef CONFIG_FSL_I2C
|
||||||
gd->i2c1_clk = gd->bus_clk;
|
gd->arch.i2c1_clk = gd->bus_clk;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
|
|
@ -274,7 +274,7 @@ void setup_5445x_clocks(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_FSL_I2C
|
#ifdef CONFIG_FSL_I2C
|
||||||
gd->i2c1_clk = gd->bus_clk;
|
gd->arch.i2c1_clk = gd->bus_clk;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -290,7 +290,7 @@ int get_clocks(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_FSL_I2C
|
#ifdef CONFIG_FSL_I2C
|
||||||
gd->i2c1_clk = gd->bus_clk;
|
gd->arch.i2c1_clk = gd->bus_clk;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
|
|
@ -41,7 +41,7 @@ int get_clocks(void)
|
||||||
gd->cpu_clk = (gd->bus_clk * 2);
|
gd->cpu_clk = (gd->bus_clk * 2);
|
||||||
|
|
||||||
#ifdef CONFIG_FSL_I2C
|
#ifdef CONFIG_FSL_I2C
|
||||||
gd->i2c1_clk = gd->bus_clk;
|
gd->arch.i2c1_clk = gd->bus_clk;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
|
|
@ -26,6 +26,10 @@
|
||||||
|
|
||||||
/* Architecture-specific global data */
|
/* Architecture-specific global data */
|
||||||
struct arch_global_data {
|
struct arch_global_data {
|
||||||
|
#ifdef CONFIG_FSL_I2C
|
||||||
|
unsigned long i2c1_clk;
|
||||||
|
unsigned long i2c2_clk;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -49,10 +53,6 @@ typedef struct global_data {
|
||||||
unsigned long inp_clk;
|
unsigned long inp_clk;
|
||||||
unsigned long vco_clk;
|
unsigned long vco_clk;
|
||||||
unsigned long flb_clk;
|
unsigned long flb_clk;
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_FSL_I2C
|
|
||||||
unsigned long i2c1_clk;
|
|
||||||
unsigned long i2c2_clk;
|
|
||||||
#endif
|
#endif
|
||||||
phys_size_t ram_size; /* RAM size */
|
phys_size_t ram_size; /* RAM size */
|
||||||
unsigned long reloc_off; /* Relocation Offset */
|
unsigned long reloc_off; /* Relocation Offset */
|
||||||
|
|
|
@ -481,9 +481,9 @@ int get_clocks(void)
|
||||||
gd->sdhc_clk = sdhc_clk;
|
gd->sdhc_clk = sdhc_clk;
|
||||||
#endif
|
#endif
|
||||||
gd->arch.core_clk = core_clk;
|
gd->arch.core_clk = core_clk;
|
||||||
gd->i2c1_clk = i2c1_clk;
|
gd->arch.i2c1_clk = i2c1_clk;
|
||||||
#if !defined(CONFIG_MPC832x)
|
#if !defined(CONFIG_MPC832x)
|
||||||
gd->i2c2_clk = i2c2_clk;
|
gd->arch.i2c2_clk = i2c2_clk;
|
||||||
#endif
|
#endif
|
||||||
#if !defined(CONFIG_MPC8309)
|
#if !defined(CONFIG_MPC8309)
|
||||||
gd->arch.enc_clk = enc_clk;
|
gd->arch.enc_clk = enc_clk;
|
||||||
|
@ -558,9 +558,11 @@ static int do_clocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||||
printf(" SEC: %-4s MHz\n",
|
printf(" SEC: %-4s MHz\n",
|
||||||
strmhz(buf, gd->arch.enc_clk));
|
strmhz(buf, gd->arch.enc_clk));
|
||||||
#endif
|
#endif
|
||||||
printf(" I2C1: %-4s MHz\n", strmhz(buf, gd->i2c1_clk));
|
printf(" I2C1: %-4s MHz\n",
|
||||||
|
strmhz(buf, gd->arch.i2c1_clk));
|
||||||
#if !defined(CONFIG_MPC832x)
|
#if !defined(CONFIG_MPC832x)
|
||||||
printf(" I2C2: %-4s MHz\n", strmhz(buf, gd->i2c2_clk));
|
printf(" I2C2: %-4s MHz\n",
|
||||||
|
strmhz(buf, gd->arch.i2c2_clk));
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_MPC8315)
|
#if defined(CONFIG_MPC8315)
|
||||||
printf(" TDM: %-4s MHz\n",
|
printf(" TDM: %-4s MHz\n",
|
||||||
|
|
|
@ -406,7 +406,7 @@ int get_clocks (void)
|
||||||
*/
|
*/
|
||||||
#if defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \
|
#if defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \
|
||||||
defined(CONFIG_MPC8560) || defined(CONFIG_MPC8555)
|
defined(CONFIG_MPC8560) || defined(CONFIG_MPC8555)
|
||||||
gd->i2c1_clk = sys_info.freqSystemBus;
|
gd->arch.i2c1_clk = sys_info.freqSystemBus;
|
||||||
#elif defined(CONFIG_MPC8544)
|
#elif defined(CONFIG_MPC8544)
|
||||||
/*
|
/*
|
||||||
* On the 8544, the I2C clock is the same as the SEC clock. This can be
|
* On the 8544, the I2C clock is the same as the SEC clock. This can be
|
||||||
|
@ -416,14 +416,14 @@ int get_clocks (void)
|
||||||
* PORDEVSR2_SEC_CFG bit is 0 on all 85xx boards that are not an 8544.
|
* PORDEVSR2_SEC_CFG bit is 0 on all 85xx boards that are not an 8544.
|
||||||
*/
|
*/
|
||||||
if (gur->pordevsr2 & MPC85xx_PORDEVSR2_SEC_CFG)
|
if (gur->pordevsr2 & MPC85xx_PORDEVSR2_SEC_CFG)
|
||||||
gd->i2c1_clk = sys_info.freqSystemBus / 3;
|
gd->arch.i2c1_clk = sys_info.freqSystemBus / 3;
|
||||||
else
|
else
|
||||||
gd->i2c1_clk = sys_info.freqSystemBus / 2;
|
gd->arch.i2c1_clk = sys_info.freqSystemBus / 2;
|
||||||
#else
|
#else
|
||||||
/* Most 85xx SOCs use CCB/2, so this is the default behavior. */
|
/* Most 85xx SOCs use CCB/2, so this is the default behavior. */
|
||||||
gd->i2c1_clk = sys_info.freqSystemBus / 2;
|
gd->arch.i2c1_clk = sys_info.freqSystemBus / 2;
|
||||||
#endif
|
#endif
|
||||||
gd->i2c2_clk = gd->i2c1_clk;
|
gd->arch.i2c2_clk = gd->arch.i2c1_clk;
|
||||||
|
|
||||||
#if defined(CONFIG_FSL_ESDHC)
|
#if defined(CONFIG_FSL_ESDHC)
|
||||||
#if defined(CONFIG_MPC8569) || defined(CONFIG_P1010) ||\
|
#if defined(CONFIG_MPC8569) || defined(CONFIG_P1010) ||\
|
||||||
|
|
|
@ -130,11 +130,11 @@ int get_clocks(void)
|
||||||
* AN2919.
|
* AN2919.
|
||||||
*/
|
*/
|
||||||
#ifdef CONFIG_MPC8610
|
#ifdef CONFIG_MPC8610
|
||||||
gd->i2c1_clk = sys_info.freqSystemBus;
|
gd->arch.i2c1_clk = sys_info.freqSystemBus;
|
||||||
#else
|
#else
|
||||||
gd->i2c1_clk = sys_info.freqSystemBus / 2;
|
gd->arch.i2c1_clk = sys_info.freqSystemBus / 2;
|
||||||
#endif
|
#endif
|
||||||
gd->i2c2_clk = gd->i2c1_clk;
|
gd->arch.i2c2_clk = gd->arch.i2c1_clk;
|
||||||
|
|
||||||
if (gd->cpu_clk != 0)
|
if (gd->cpu_clk != 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -80,6 +80,11 @@ struct arch_global_data {
|
||||||
u32 lbc_clk;
|
u32 lbc_clk;
|
||||||
void *cpu;
|
void *cpu;
|
||||||
#endif /* CONFIG_MPC85xx || CONFIG_MPC86xx */
|
#endif /* CONFIG_MPC85xx || CONFIG_MPC86xx */
|
||||||
|
#if defined(CONFIG_MPC83xx) || defined(CONFIG_MPC85xx) || \
|
||||||
|
defined(CONFIG_MPC86xx)
|
||||||
|
u32 i2c1_clk;
|
||||||
|
u32 i2c2_clk;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -102,10 +107,6 @@ typedef struct global_data {
|
||||||
#if defined(CONFIG_FSL_ESDHC)
|
#if defined(CONFIG_FSL_ESDHC)
|
||||||
u32 sdhc_clk;
|
u32 sdhc_clk;
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_MPC83xx) || defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
|
|
||||||
u32 i2c1_clk;
|
|
||||||
u32 i2c2_clk;
|
|
||||||
#endif
|
|
||||||
#if defined(CONFIG_QE)
|
#if defined(CONFIG_QE)
|
||||||
u32 qe_clk;
|
u32 qe_clk;
|
||||||
uint mp_alloc_base;
|
uint mp_alloc_base;
|
||||||
|
|
|
@ -217,9 +217,9 @@ static unsigned int set_i2c_bus_speed(const struct fsl_i2c *dev,
|
||||||
static unsigned int get_i2c_clock(int bus)
|
static unsigned int get_i2c_clock(int bus)
|
||||||
{
|
{
|
||||||
if (bus)
|
if (bus)
|
||||||
return gd->i2c2_clk; /* I2C2 clock */
|
return gd->arch.i2c2_clk; /* I2C2 clock */
|
||||||
else
|
else
|
||||||
return gd->i2c1_clk; /* I2C1 clock */
|
return gd->arch.i2c1_clk; /* I2C1 clock */
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -468,7 +468,8 @@ int i2c_set_bus_num(unsigned int bus)
|
||||||
|
|
||||||
int i2c_set_bus_speed(unsigned int speed)
|
int i2c_set_bus_speed(unsigned int speed)
|
||||||
{
|
{
|
||||||
unsigned int i2c_clk = (i2c_bus_num == 1) ? gd->i2c2_clk : gd->i2c1_clk;
|
unsigned int i2c_clk = (i2c_bus_num == 1)
|
||||||
|
? gd->arch.i2c2_clk : gd->arch.i2c1_clk;
|
||||||
|
|
||||||
writeb(0, &i2c_dev[i2c_bus_num]->cr); /* stop controller */
|
writeb(0, &i2c_dev[i2c_bus_num]->cr); /* stop controller */
|
||||||
i2c_bus_speed[i2c_bus_num] =
|
i2c_bus_speed[i2c_bus_num] =
|
||||||
|
|
Loading…
Add table
Reference in a new issue