Skip to content

Commit

Permalink
sh: Integrate the SH-5 onchip_remap() more coherently.
Browse files Browse the repository at this point in the history
Presently this is special-cased for early initialization. While there are
situations where these static early initializations are still necessary,
with minor changes it is possible to use this for the regular ioremap
implementation as well. This allows us to kill off the special-casing for
the remap completely and to start tidying up all of the SH-5
special-casing in drivers.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
Paul Mundt committed May 7, 2009
1 parent ae318a1 commit 0fb849b
Show file tree
Hide file tree
Showing 12 changed files with 155 additions and 196 deletions.
2 changes: 1 addition & 1 deletion arch/sh/boards/mach-cayman/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ void init_cayman_irq(void)
{
int i;

epld_virt = onchip_remap(EPLD_BASE, 1024, "EPLD");
epld_virt = (unsigned long)ioremap_nocache(EPLD_BASE, 1024);
if (!epld_virt) {
printk(KERN_ERR "Cayman IRQ: Unable to remap EPLD\n");
return;
Expand Down
2 changes: 1 addition & 1 deletion arch/sh/boards/mach-cayman/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ static int __init smsc_superio_setup(void)
{
unsigned char devid, devrev;

smsc_superio_virt = onchip_remap(SMSC_SUPERIO_BASE, 1024, "SMSC SuperIO");
smsc_superio_virt = (unsigned long)ioremap_nocache(SMSC_SUPERIO_BASE, 1024);
if (!smsc_superio_virt) {
panic("Unable to remap SMSC SuperIO\n");
}
Expand Down
4 changes: 2 additions & 2 deletions arch/sh/drivers/pci/pci-sh5.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ static int __init sh5pci_init(void)
return -EINVAL;
}

pcicr_virt = onchip_remap(SH5PCI_ICR_BASE, 1024, "PCICR");
pcicr_virt = (unsigned long)ioremap_nocache(SH5PCI_ICR_BASE, 1024);
if (!pcicr_virt) {
panic("Unable to remap PCICR\n");
}

PCI_IO_AREA = onchip_remap(SH5PCI_IO_BASE, 0x10000, "PCIIO");
PCI_IO_AREA = (unsigned long)ioremap_nocache(SH5PCI_IO_BASE, 0x10000);
if (!PCI_IO_AREA) {
panic("Unable to remap PCIIO\n");
}
Expand Down
7 changes: 0 additions & 7 deletions arch/sh/include/asm/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,6 @@ void __iomem *__ioremap(unsigned long offset, unsigned long size,
unsigned long flags);
void __iounmap(void __iomem *addr);

/* arch/sh/mm/ioremap_64.c */
unsigned long onchip_remap(unsigned long addr, unsigned long size,
const char *name);
extern void onchip_unmap(unsigned long vaddr);

static inline void __iomem *
__ioremap_mode(unsigned long offset, unsigned long size, unsigned long flags)
{
Expand Down Expand Up @@ -263,8 +258,6 @@ __ioremap_mode(unsigned long offset, unsigned long size, unsigned long flags)
return __ioremap(offset, size, flags);
}
#else
#define onchip_remap(addr, size, name) (addr)
#define onchip_unmap(addr) do { } while (0)
#define __ioremap_mode(offset, size, flags) ((void __iomem *)(offset))
#define __iounmap(addr) do { } while (0)
#endif /* CONFIG_MMU */
Expand Down
2 changes: 1 addition & 1 deletion arch/sh/kernel/cpu/irq/intc-sh5.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ void __init plat_irq_setup(void)
unsigned long reg;
int i;

intc_virt = onchip_remap(INTC_BASE, 1024, "INTC");
intc_virt = (unsigned long)ioremap_nocache(INTC_BASE, 1024);
if (!intc_virt) {
panic("Unable to remap INTC\n");
}
Expand Down
3 changes: 3 additions & 0 deletions arch/sh/kernel/cpu/sh5/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ obj-y := entry.o probe.o switchto.o
obj-$(CONFIG_SH_FPU) += fpu.o
obj-$(CONFIG_KALLSYMS) += unwind.o

# CPU subtype setup
obj-$(CONFIG_CPU_SH5) += setup-sh5.o

# Primary on-chip clocks (common)
clock-$(CONFIG_CPU_SH5) := clock-sh5.o

Expand Down
2 changes: 1 addition & 1 deletion arch/sh/kernel/cpu/sh5/clock-sh5.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static struct clk_ops *sh5_clk_ops[] = {

void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
{
cprc_base = onchip_remap(CPRC_BASE, 1024, "CPRC");
cprc_base = (unsigned long)ioremap_nocache(CPRC_BASE, 1024);
BUG_ON(!cprc_base);

if (idx < ARRAY_SIZE(sh5_clk_ops))
Expand Down
8 changes: 4 additions & 4 deletions arch/sh/kernel/cpu/sh5/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -1410,8 +1410,8 @@ peek_real_address_q:
r2(out) : result quadword
This is provided as a cheapskate way of manipulating device
registers for debugging (to avoid the need to onchip_remap the debug
module, and to avoid the need to onchip_remap the watchpoint
registers for debugging (to avoid the need to ioremap the debug
module, and to avoid the need to ioremap the watchpoint
controller in a way that identity maps sufficient bits to avoid the
SH5-101 cut2 silicon defect).
Expand Down Expand Up @@ -1459,8 +1459,8 @@ poke_real_address_q:
r3 : quadword value to write.
This is provided as a cheapskate way of manipulating device
registers for debugging (to avoid the need to onchip_remap the debug
module, and to avoid the need to onchip_remap the watchpoint
registers for debugging (to avoid the need to ioremap the debug
module, and to avoid the need to ioremap the watchpoint
controller in a way that identity maps sufficient bits to avoid the
SH5-101 cut2 silicon defect).
Expand Down
46 changes: 46 additions & 0 deletions arch/sh/kernel/cpu/sh5/setup-sh5.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* SH5-101/SH5-103 CPU Setup
*
* Copyright (C) 2009 Paul Mundt
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/
#include <linux/platform_device.h>
#include <linux/init.h>
#include <linux/serial.h>
#include <linux/serial_sci.h>
#include <linux/io.h>
#include <linux/mm.h>
#include <asm/addrspace.h>

static struct plat_sci_port sci_platform_data[] = {
{
.mapbase = PHYS_PERIPHERAL_BLOCK + 0x01030000,
.flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP,
.type = PORT_SCIF,
.irqs = { 39, 40, 42, 0 },
}, {
.flags = 0,
}
};

static struct platform_device sci_device = {
.name = "sh-sci",
.id = -1,
.dev = {
.platform_data = sci_platform_data,
},
};

static struct platform_device *sh5_devices[] __initdata = {
&sci_device,
};

static int __init sh5_devices_setup(void)
{
return platform_add_devices(sh5_devices,
ARRAY_SIZE(sh5_devices));
}
__initcall(sh5_devices_setup);
4 changes: 2 additions & 2 deletions arch/sh/kernel/time_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,12 @@ void __init time_init(void)
unsigned long interval;
struct clk *clk;

tmu_base = onchip_remap(TMU_BASE, 1024, "TMU");
tmu_base = (unsigned long)ioremap_nocache(TMU_BASE, 1024);
if (!tmu_base) {
panic("Unable to remap TMU\n");
}

rtc_base = onchip_remap(RTC_BASE, 1024, "RTC");
rtc_base = (unsigned long)ioremap_nocache(RTC_BASE, 1024);
if (!rtc_base) {
panic("Unable to remap RTC\n");
}
Expand Down
Loading

0 comments on commit 0fb849b

Please sign in to comment.