use {read,write}l_relaxed instead of the plain __raw_{read,write}l variants.
SVN-Revision: 33330
if (!clk->enable_reg)
return 0;
- tmp = __raw_readl(mcs814x_sysdbg_base + clk->enable_reg);
+ tmp = readl_relaxed(mcs814x_sysdbg_base + clk->enable_reg);
if (!enable)
tmp &= ~clk->enable_mask;
else
tmp |= clk->enable_mask;
- __raw_writel(tmp, mcs814x_sysdbg_base + clk->enable_reg);
+ writel_relaxed(tmp, mcs814x_sysdbg_base + clk->enable_reg);
return 0;
}
clkdev_add_table(mcs814x_chip_clks, ARRAY_SIZE(mcs814x_chip_clks));
/* read the bootstrap registers to know the exact clocking scheme */
- bs1 = __raw_readl(mcs814x_sysdbg_base + SYSDBG_BS1);
+ bs1 = readl_relaxed(mcs814x_sysdbg_base + SYSDBG_BS1);
cpu_freq = (bs1 >> CPU_FREQ_SHIFT) & CPU_FREQ_MASK;
pr_info("CPU frequency: %lu (kHz)\n", cpu_freq_table[cpu_freq]);
{
u32 reg;
- reg = __raw_readl(MCS814X_VIRT_BASE + MCS814X_DBGLED);
+ reg = readl_relaxed(MCS814X_VIRT_BASE + MCS814X_DBGLED);
if (value)
reg |= 0x80;
else
reg &= ~0x80;
- __raw_writel(reg, MCS814X_VIRT_BASE + MCS814X_DBGLED);
+ writel_relaxed(reg, MCS814X_VIRT_BASE + MCS814X_DBGLED);
}
static void mcs814x_eth_led_cfg_set(u8 cfg)
{
u32 reg;
- reg = __raw_readl(mcs814x_sysdbg_base + SYSDBG_BS2);
+ reg = readl_relaxed(mcs814x_sysdbg_base + SYSDBG_BS2);
reg &= ~LED_CFG_MASK;
reg |= cfg;
- __raw_writel(reg, mcs814x_sysdbg_base + SYSDBG_BS2);
+ writel_relaxed(reg, mcs814x_sysdbg_base + SYSDBG_BS2);
}
static void mcs814x_eth_buffer_shifting_set(u8 value)
u32 bs2, cpu_mode;
int gpio;
- bs2 = __raw_readl(mcs814x_sysdbg_base + SYSDBG_BS2);
+ bs2 = readl_relaxed(mcs814x_sysdbg_base + SYSDBG_BS2);
cpu_mode = (bs2 >> CPU_MODE_SHIFT) & CPU_MODE_MASK;
pr_info("CPU mode: %s\n", cpu_modes[cpu_mode].name);
void mcs814x_restart(char mode, const char *cmd)
{
- __raw_writel(~(1 << 31), mcs814x_sysdbg_base);
+ writel_relaxed(~(1 << 31), mcs814x_sysdbg_base);
}
IRQ_NOREQUEST, 0);
/* Clear all interrupts */
- __raw_writel(0xffffffff, base + MCS814X_IRQ_ICR);
+ writel_relaxed(0xffffffff, base + MCS814X_IRQ_ICR);
}
static const struct of_device_id mcs814x_intc_ids[] = {
{
u32 host_status;
- host_status = __raw_readl(mcs8140_pci_master_base + PCI_IF_CONFIG);
+ host_status = readl_relaxed(mcs8140_pci_master_base + PCI_IF_CONFIG);
if (host_status & PCI_FATAL_ERROR) {
- __raw_writel(host_status & 0xfffffff0,
+ writel_relaxed(host_status & 0xfffffff0,
mcs8140_pci_master_base + PCI_IF_CONFIG);
/* flush write */
host_status =
- __raw_readl(mcs8140_pci_master_base + PCI_IF_CONFIG);
+ readl_relaxed(mcs8140_pci_master_base + PCI_IF_CONFIG);
return 1;
}
break;
default:
addr &= ~3;
- v = __raw_readl(addr);
+ v = readl_relaxed(addr);
break;
}
} else
static void mcs8140_eeprom_emu_init(void)
{
- __raw_writel(0x0000000F, mcs8140_eeprom_emu_base + EPRM_SDRAM_FUNC0);
- __raw_writel(0x08000000, MCS8140_PCI_CFG_VIRT_BASE + 0x10);
+ writel_relaxed(0x0000000F, mcs8140_eeprom_emu_base + EPRM_SDRAM_FUNC0);
+ writel_relaxed(0x08000000, MCS8140_PCI_CFG_VIRT_BASE + 0x10);
/* Set the DONE bit of the EEPROM emulator */
- __raw_writel(0x01, mcs8140_eeprom_emu_base + EPRM_DONE);
+ writel_relaxed(0x01, mcs8140_eeprom_emu_base + EPRM_DONE);
}
static int mcs8140_pci_write_config(struct pci_bus *bus,
__raw_writew((u16)val, addr);
break;
case 4:
- __raw_writel(val, addr);
+ writel_relaxed(val, addr);
break;
}
}
goto out;
}
- val = __raw_readl(MCS8140_PCI_CFG_VIRT_BASE);
+ val = readl_relaxed(MCS8140_PCI_CFG_VIRT_BASE);
if (val != MCS8140_PCI_DEVICE_ID) {
pr_err("cannot find MCS8140 PCI Core: %08x\n", val);
ret = -EIO;
pr_info("MCS8140 PCI core found\n");
- val = __raw_readl(MCS8140_PCI_CFG_VIRT_BASE + PCI_COMMAND);
+ val = readl_relaxed(MCS8140_PCI_CFG_VIRT_BASE + PCI_COMMAND);
/* Added to support wireless cards */
- __raw_writel(0, MCS8140_PCI_CFG_VIRT_BASE + 0x40);
- __raw_writel(val | 0x147, MCS8140_PCI_CFG_VIRT_BASE + PCI_COMMAND);
- val = __raw_readl(MCS8140_PCI_CFG_VIRT_BASE + PCI_COMMAND);
+ writel_relaxed(0, MCS8140_PCI_CFG_VIRT_BASE + 0x40);
+ writel_relaxed(val | 0x147, MCS8140_PCI_CFG_VIRT_BASE + PCI_COMMAND);
+ val = readl_relaxed(MCS8140_PCI_CFG_VIRT_BASE + PCI_COMMAND);
ret = 1;
out:
return ret;
{
u32 word;
- word = __raw_readl(mcs8140_pci_master_base + PCI_IF_CONFIG);
+ word = readl_relaxed(mcs8140_pci_master_base + PCI_IF_CONFIG);
if (!(word & (1 << 24)))
return IRQ_NONE;
- __raw_writel(word & 0xfffffff0,
+ writel_relaxed(word & 0xfffffff0,
mcs8140_pci_master_base + PCI_IF_CONFIG);
/* flush write */
- word = __raw_readl(mcs8140_pci_master_base + PCI_IF_CONFIG);
+ word = readl_relaxed(mcs8140_pci_master_base + PCI_IF_CONFIG);
return IRQ_HANDLED;
}
u32 word;
/* Enable Interrupt in PCI Master Core */
- word = __raw_readl(mcs8140_pci_master_base + PCI_IF_CONFIG);
+ word = readl_relaxed(mcs8140_pci_master_base + PCI_IF_CONFIG);
word |= (1 << 24);
- __raw_writel(word, mcs8140_pci_master_base + PCI_IF_CONFIG);
+ writel_relaxed(word, mcs8140_pci_master_base + PCI_IF_CONFIG);
/* flush write */
- word = __raw_readl(mcs8140_pci_master_base + PCI_IF_CONFIG);
+ word = readl_relaxed(mcs8140_pci_master_base + PCI_IF_CONFIG);
return request_irq(irq, mcs8140_pci_abort_interrupt, 0,
"PCI abort", NULL);
/* Timer block registers */
#define TIMER_VAL 0x00
#define TIMER_CTL 0x04
+#define TIMER_CTL_EN 0x01
+#define TIMER_CTL_DBG 0x02
static u32 last_reload;
static u32 timer_correct;
*/
static unsigned long mcs814x_gettimeoffset(void)
{
- u32 ticks = __raw_readl(mcs814x_timer_base + TIMER_VAL);
+ u32 ticks = readl_relaxed(mcs814x_timer_base + TIMER_VAL);
if (ticks < last_reload)
return ticks2usecs(ticks + (u32)(0xffffffff - last_reload));
static irqreturn_t mcs814x_timer_interrupt(int irq, void *dev_id)
{
- u32 count = __raw_readl(mcs814x_timer_base + TIMER_VAL);
+ u32 count = readl_relaxed(mcs814x_timer_base + TIMER_VAL);
/* take into account delay up to this moment */
last_reload = count + timer_correct + timer_reload_value;
last_reload = timer_reload_value;
} else {
if (timer_correct == 0)
- timer_correct = __raw_readl(mcs814x_timer_base + TIMER_VAL) - count;
+ timer_correct = readl_relaxed(mcs814x_timer_base + TIMER_VAL) - count;
}
- __raw_writel(last_reload, mcs814x_timer_base + TIMER_VAL);
+ writel_relaxed(last_reload, mcs814x_timer_base + TIMER_VAL);
timer_tick();
timer_reload_value = 0xffffffff - (clock_rate / HZ);
/* disable timer */
- __raw_writel(0, mcs814x_timer_base + TIMER_CTL);
- __raw_writel(timer_reload_value, mcs814x_timer_base + TIMER_VAL);
+ writel_relaxed(~TIMER_CTL_EN, mcs814x_timer_base + TIMER_CTL);
+ writel_relaxed(timer_reload_value, mcs814x_timer_base + TIMER_VAL);
last_reload = timer_reload_value;
setup_irq(mcs814x_timer_irq.irq, &mcs814x_timer_irq);
/* enable timer, stop timer in debug mode */
- __raw_writel(0x03, mcs814x_timer_base + TIMER_CTL);
+ writel_relaxed(TIMER_CTL_EN | TIMER_CTL_DBG,
+ mcs814x_timer_base + TIMER_CTL);
}
struct sys_timer mcs814x_timer = {
{
struct mcs814x_rng_priv *priv = (struct mcs814x_rng_priv *)rng->priv;
- *buffer = __raw_readl(priv->regs + RND);
+ *buffer = readl_relaxed(priv->regs + RND);
return 4;
}
{
struct mcs814x_gpio_chip *mcs814x = to_mcs814x_gpio_chip(chip);
- return __raw_readl(mcs814x->regs + GPIO_PIN) & (1 << offset);
+ return readl_relaxed(mcs814x->regs + GPIO_PIN) & (1 << offset);
}
static void mcs814x_gpio_set(struct gpio_chip *chip,
struct mcs814x_gpio_chip *mcs814x = to_mcs814x_gpio_chip(chip);
u32 mask;
- mask = __raw_readl(mcs814x->regs + GPIO_PIN);
+ mask = readl_relaxed(mcs814x->regs + GPIO_PIN);
if (value)
mask |= (1 << offset);
else
mask &= ~(1 << offset);
- __raw_writel(mask, mcs814x->regs + GPIO_PIN);
+ writel_relaxed(mask, mcs814x->regs + GPIO_PIN);
}
static int mcs814x_gpio_direction_output(struct gpio_chip *chip,
struct mcs814x_gpio_chip *mcs814x = to_mcs814x_gpio_chip(chip);
u32 mask;
- mask = __raw_readl(mcs814x->regs + GPIO_DIR);
+ mask = readl_relaxed(mcs814x->regs + GPIO_DIR);
mask &= ~(1 << offset);
- __raw_writel(mask, mcs814x->regs + GPIO_DIR);
+ writel_relaxed(mask, mcs814x->regs + GPIO_DIR);
return 0;
}
struct mcs814x_gpio_chip *mcs814x = to_mcs814x_gpio_chip(chip);
u32 mask;
- mask = __raw_readl(mcs814x->regs + GPIO_DIR);
+ mask = readl_relaxed(mcs814x->regs + GPIO_DIR);
mask |= (1 << offset);
- __raw_writel(mask, mcs814x->regs + GPIO_DIR);
+ writel_relaxed(mask, mcs814x->regs + GPIO_DIR);
return 0;
}
static inline u32 nuport_mac_readl(void __iomem *reg)
{
- return __raw_readl(reg);
+ return readl_relaxed(reg);
}
static inline u8 nuport_mac_readb(void __iomem *reg)
static inline void nuport_mac_writel(u32 value, void __iomem *reg)
{
- __raw_writel(value, reg);
+ writel_relaxed(value, reg);
}
static inline void nuport_mac_writeb(u8 value, void __iomem *reg)
{
- __raw_writel(value, reg);
+ writel_relaxed(value, reg);
}
/* MAC private data */
u32 reg;
spin_lock(&wdt->lock);
- reg = __raw_readl(wdt->regs + WDT_CTRL);
+ reg = readl_relaxed(wdt->regs + WDT_CTRL);
reg |= WDT_CTRL_EN;
- __raw_writel(reg, wdt->regs + WDT_CTRL);
+ writel_relaxed(reg, wdt->regs + WDT_CTRL);
spin_unlock(&wdt->lock);
return 0;
u32 reg;
spin_lock(&wdt->lock);
- reg = __raw_readl(wdt->regs + WDT_CTRL);
+ reg = readl_relaxed(wdt->regs + WDT_CTRL);
reg &= ~WDT_CTRL_EN;
- __raw_writel(reg, wdt->regs + WDT_CTRL);
+ writel_relaxed(reg, wdt->regs + WDT_CTRL);
spin_unlock(&wdt->lock);
return 0;
/* watchdog counts upward and rollover (0xfffffff -> 0)
* triggers the reboot
*/
- __raw_writel(WDT_MAX_VALUE - (new_timeout * clk_get_rate(wdt->clk)),
+ writel_relaxed(WDT_MAX_VALUE - (new_timeout * clk_get_rate(wdt->clk)),
wdt->regs + WDT_COUNT);
spin_unlock(&wdt->lock);