• Home
  • Raw
  • Download

Lines Matching refs:base

68 static void i2c_reset(struct mv_i2c *base)  in i2c_reset()  argument
73 icr_mode = readl(&base->icr) & ICR_MODE_MASK; in i2c_reset()
74 writel(readl(&base->icr) & ~ICR_IUE, &base->icr); /* disable unit */ in i2c_reset()
75 writel(readl(&base->icr) | ICR_UR, &base->icr); /* reset the unit */ in i2c_reset()
77 writel(readl(&base->icr) & ~ICR_IUE, &base->icr); /* disable unit */ in i2c_reset()
81 writel(CONFIG_SYS_I2C_SLAVE, &base->isar); /* set our slave address */ in i2c_reset()
83 writel(I2C_ICR_INIT | icr_mode, &base->icr); in i2c_reset()
84 writel(I2C_ISR_INIT, &base->isr); /* set clear interrupt bits */ in i2c_reset()
85 writel(readl(&base->icr) | ICR_IUE, &base->icr); /* enable unit */ in i2c_reset()
95 static int i2c_isr_set_cleared(struct mv_i2c *base, unsigned long set_mask, in i2c_isr_set_cleared() argument
101 isr = readl(&base->isr); in i2c_isr_set_cleared()
125 static int i2c_transfer(struct mv_i2c *base, struct mv_i2c_msg *msg) in i2c_transfer() argument
135 if (!i2c_isr_set_cleared(base, 0, ISR_IBB)) in i2c_transfer()
139 writel(readl(&base->icr) & ~ICR_START, &base->icr); in i2c_transfer()
140 writel(readl(&base->icr) & ~ICR_STOP, &base->icr); in i2c_transfer()
141 writel(msg->data, &base->idbr); in i2c_transfer()
143 writel(readl(&base->icr) | ICR_START, &base->icr); in i2c_transfer()
145 writel(readl(&base->icr) | ICR_STOP, &base->icr); in i2c_transfer()
147 writel(readl(&base->icr) | ICR_ACKNAK, &base->icr); in i2c_transfer()
149 writel(readl(&base->icr) & ~ICR_ACKNAK, &base->icr); in i2c_transfer()
150 writel(readl(&base->icr) & ~ICR_ALDIE, &base->icr); in i2c_transfer()
151 writel(readl(&base->icr) | ICR_TB, &base->icr); in i2c_transfer()
154 if (!i2c_isr_set_cleared(base, ISR_ITE, 0)) in i2c_transfer()
158 writel(readl(&base->isr) | ISR_ITE, &base->isr); in i2c_transfer()
162 if (!i2c_isr_set_cleared(base, 0, ISR_ACKNAK)) in i2c_transfer()
169 if (!i2c_isr_set_cleared(base, 0, ISR_IBB)) in i2c_transfer()
173 writel(readl(&base->icr) & ~ICR_START, &base->icr); in i2c_transfer()
174 writel(readl(&base->icr) & ~ICR_STOP, &base->icr); in i2c_transfer()
176 writel(readl(&base->icr) | ICR_START, &base->icr); in i2c_transfer()
178 writel(readl(&base->icr) | ICR_STOP, &base->icr); in i2c_transfer()
180 writel(readl(&base->icr) | ICR_ACKNAK, &base->icr); in i2c_transfer()
182 writel(readl(&base->icr) & ~ICR_ACKNAK, &base->icr); in i2c_transfer()
183 writel(readl(&base->icr) & ~ICR_ALDIE, &base->icr); in i2c_transfer()
184 writel(readl(&base->icr) | ICR_TB, &base->icr); in i2c_transfer()
187 if (!i2c_isr_set_cleared(base, ISR_IRF, 0)) in i2c_transfer()
190 msg->data = readl(&base->idbr); in i2c_transfer()
193 writel(readl(&base->isr) | ISR_IRF, &base->isr); in i2c_transfer()
232 debug("i2c_transfer: ISR: 0x%04x\n", readl(&base->isr)); in i2c_transfer()
233 i2c_reset(base); in i2c_transfer()
237 static int __i2c_read(struct mv_i2c *base, uchar chip, u8 *addr, int alen, in __i2c_read() argument
250 i2c_reset(base); in __i2c_read()
259 if (i2c_transfer(base, &msg)) in __i2c_read()
273 if (i2c_transfer(base, &msg)) in __i2c_read()
284 if (i2c_transfer(base, &msg)) in __i2c_read()
299 if (i2c_transfer(base, &msg)) in __i2c_read()
308 i2c_reset(base); in __i2c_read()
313 static int __i2c_write(struct mv_i2c *base, uchar chip, u8 *addr, int alen, in __i2c_write() argument
321 i2c_reset(base); in __i2c_write()
330 if (i2c_transfer(base, &msg)) in __i2c_write()
344 if (i2c_transfer(base, &msg)) in __i2c_write()
362 if (i2c_transfer(base, &msg)) in __i2c_write()
366 i2c_reset(base); in __i2c_write()
375 static void i2c_board_init(struct mv_i2c *base) in i2c_board_init() argument
387 icr = readl(&base->icr); in i2c_board_init()
388 writel(readl(&base->icr) & ~(ICR_SCLE | ICR_IUE), &base->icr); in i2c_board_init()
392 writel(icr, &base->icr); in i2c_board_init()
446 static int __i2c_probe_chip(struct mv_i2c *base, uchar chip) in __i2c_probe_chip() argument
450 i2c_reset(base); in __i2c_probe_chip()
456 if (i2c_transfer(base, &msg)) in __i2c_probe_chip()
463 if (i2c_transfer(base, &msg)) in __i2c_probe_chip()
533 struct mv_i2c *base; member
556 return __i2c_read(i2c->base, dmsg->addr, omsg->buf, in mv_i2c_xfer()
559 return __i2c_write(i2c->base, dmsg->addr, omsg->buf, in mv_i2c_xfer()
572 clrsetbits_le32(&priv->base->icr, ICR_MODE_MASK, val); in mv_i2c_set_bus_speed()
581 priv->base = (void *)devfdt_get_addr_ptr(bus); in mv_i2c_probe()