sh_eth: fix EESIPR values for SH77{34|63}
[linux/fpc-iii.git] / drivers / media / pci / tw5864 / tw5864-util.c
blob771eef235755785c7f6e115f484d5764aed01e1b
1 #include "tw5864.h"
3 void tw5864_indir_writeb(struct tw5864_dev *dev, u16 addr, u8 data)
5 int retries = 30000;
7 while (tw_readl(TW5864_IND_CTL) & BIT(31) && --retries)
9 if (!retries)
10 dev_err(&dev->pci->dev,
11 "tw_indir_writel() retries exhausted before writing\n");
13 tw_writel(TW5864_IND_DATA, data);
14 tw_writel(TW5864_IND_CTL, addr << 2 | TW5864_RW | TW5864_ENABLE);
17 u8 tw5864_indir_readb(struct tw5864_dev *dev, u16 addr)
19 int retries = 30000;
21 while (tw_readl(TW5864_IND_CTL) & BIT(31) && --retries)
23 if (!retries)
24 dev_err(&dev->pci->dev,
25 "tw_indir_readl() retries exhausted before reading\n");
27 tw_writel(TW5864_IND_CTL, addr << 2 | TW5864_ENABLE);
29 retries = 30000;
30 while (tw_readl(TW5864_IND_CTL) & BIT(31) && --retries)
32 if (!retries)
33 dev_err(&dev->pci->dev,
34 "tw_indir_readl() retries exhausted at reading\n");
36 return tw_readl(TW5864_IND_DATA);