Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 373e68b5 authored by Paul Mundt's avatar Paul Mundt
Browse files

sh: Board updates for I/O routine rework.



This updates the various boards for some of the recent I/O routine
updates.

Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent f647d33f
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -111,10 +111,7 @@ machdir-$(CONFIG_SH_UNKNOWN) := unknown

incdir-y			:= $(notdir $(machdir-y))

incdir-$(CONFIG_SH_SOLUTION_ENGINE)		:= se
incdir-$(CONFIG_SH_7751_SOLUTION_ENGINE)	:= se7751
incdir-$(CONFIG_SH_7300_SOLUTION_ENGINE)        := se7300
incdir-$(CONFIG_SH_73180_SOLUTION_ENGINE)	:= se73180
incdir-$(CONFIG_SH_HP6XX)			:= hp6xx

ifneq ($(machdir-y),)
+91 −68
Original line number Diff line number Diff line
@@ -21,10 +21,8 @@
#include <linux/pci.h>
#include "../../../drivers/pci/pci-sh7751.h"

extern void *area5_io8_base;	/* Area 5 8bit I/O Base address */
extern void *area6_io8_base;	/* Area 6 8bit I/O Base address */
extern void *area5_io16_base;	/* Area 5 16bit I/O Base address */
extern void *area6_io16_base;	/* Area 6 16bit I/O Base address */

/*
 * The 7751R HS7751RVoIP uses the built-in PCI controller (PCIC)
@@ -37,16 +35,10 @@ extern void *area6_io16_base; /* Area 6 16bit I/O Base address */
#define PCIMBR          (volatile long *)PCI_REG(SH7751_PCIMBR)
#define PCI_IO_AREA	SH7751_PCI_IO_BASE
#define PCI_MEM_AREA	SH7751_PCI_CONFIG_BASE

#define PCI_IOMAP(adr)	(PCI_IO_AREA + (adr & ~SH7751_PCIIOBR_MASK))

#if defined(CONFIG_HS7751RVOIP_CODEC)
#define CODEC_IO_BASE	0x1000
#endif

#define maybebadio(name,port) \
  printk("bad PC-like io %s for port 0x%lx at 0x%08x\n", \
	 #name, (port), (__u32) __builtin_return_address(0))
#define CODEC_IOMAP(a)	((unsigned long)area6_io8_base + ((a) - CODEC_IO_BASE))

static inline void delay(void)
{
@@ -61,7 +53,7 @@ static inline unsigned long port2adr(unsigned int port)
		else
			return ((unsigned long)area5_io16_base + 0x800 + ((port-0x1f0) << 1));
	else
		maybebadio(port2adr, (unsigned long)port);
		maybebadio((unsigned long)port);
	return port;
}

@@ -109,15 +101,15 @@ codec_port(unsigned long port)
unsigned char hs7751rvoip_inb(unsigned long port)
{
	if (PXSEG(port))
		return *(volatile unsigned char *)port;
		return ctrl_inb(port);
#if defined(CONFIG_HS7751RVOIP_CODEC)
	else if (codec_port(port))
		return *(volatile unsigned char *)((unsigned long)area6_io8_base+(port-CODEC_IO_BASE));
		return ctrl_inb(CODEC_IOMAP(port));
#endif
	else if (CHECK_SH7751_PCIIO(port) || shifted_port(port))
		return *(volatile unsigned char *)PCI_IOMAP(port);
		return ctrl_inb(PCI_IOMAP(port));
	else
		return (*(volatile unsigned short *)port2adr(port) & 0xff);
		return ctrl_inw(port2adr(port)) & 0xff;
}

unsigned char hs7751rvoip_inb_p(unsigned long port)
@@ -125,15 +117,15 @@ unsigned char hs7751rvoip_inb_p(unsigned long port)
	unsigned char v;

        if (PXSEG(port))
                v = *(volatile unsigned char *)port;
		v = ctrl_inb(port);
#if defined(CONFIG_HS7751RVOIP_CODEC)
	else if (codec_port(port))
		v = *(volatile unsigned char *)((unsigned long)area6_io8_base+(port-CODEC_IO_BASE));
		v = ctrl_inb(CODEC_IOMAP(port));
#endif
	else if (CHECK_SH7751_PCIIO(port) || shifted_port(port))
                v = *(volatile unsigned char *)PCI_IOMAP(port);
		v = ctrl_inb(PCI_IOMAP(port));
	else
		v = (*(volatile unsigned short *)port2adr(port) & 0xff);
		v = ctrl_inw(port2adr(port)) & 0xff;
	delay();
	return v;
}
@@ -141,22 +133,22 @@ unsigned char hs7751rvoip_inb_p(unsigned long port)
unsigned short hs7751rvoip_inw(unsigned long port)
{
        if (PXSEG(port))
                return *(volatile unsigned short *)port;
		return ctrl_inw(port);
	else if (CHECK_SH7751_PCIIO(port) || shifted_port(port))
                return *(volatile unsigned short *)PCI_IOMAP(port);
		return ctrl_inw(PCI_IOMAP(port));
	else
		maybebadio(inw, port);
		maybebadio(port);
	return 0;
}

unsigned int hs7751rvoip_inl(unsigned long port)
{
        if (PXSEG(port))
                return *(volatile unsigned long *)port;
		return ctrl_inl(port);
	else if (CHECK_SH7751_PCIIO(port) || shifted_port(port))
                return *(volatile unsigned long *)PCI_IOMAP(port);
		return ctrl_inl(PCI_IOMAP(port));
	else
		maybebadio(inl, port);
		maybebadio(port);
	return 0;
}

@@ -164,137 +156,168 @@ void hs7751rvoip_outb(unsigned char value, unsigned long port)
{

        if (PXSEG(port))
                *(volatile unsigned char *)port = value;
		ctrl_outb(value, port);
#if defined(CONFIG_HS7751RVOIP_CODEC)
	else if (codec_port(port))
		*(volatile unsigned char *)((unsigned long)area6_io8_base+(port-CODEC_IO_BASE)) = value;
		ctrl_outb(value, CODEC_IOMAP(port));
#endif
	else if (CHECK_SH7751_PCIIO(port) || shifted_port(port))
        	*(unsigned char *)PCI_IOMAP(port) = value;
		ctrl_outb(value, PCI_IOMAP(port));
	else
		*(volatile unsigned short *)port2adr(port) = value;
		ctrl_outb(value, port2adr(port));
}

void hs7751rvoip_outb_p(unsigned char value, unsigned long port)
{
        if (PXSEG(port))
                *(volatile unsigned char *)port = value;
		ctrl_outb(value, port);
#if defined(CONFIG_HS7751RVOIP_CODEC)
	else if (codec_port(port))
		*(volatile unsigned char *)((unsigned long)area6_io8_base+(port-CODEC_IO_BASE)) = value;
		ctrl_outb(value, CODEC_IOMAP(port));
#endif
	else if (CHECK_SH7751_PCIIO(port) || shifted_port(port))
        	*(unsigned char *)PCI_IOMAP(port) = value;
		ctrl_outb(value, PCI_IOMAP(port));
	else
		*(volatile unsigned short *)port2adr(port) = value;
		ctrl_outw(value, port2adr(port));

	delay();
}

void hs7751rvoip_outw(unsigned short value, unsigned long port)
{
        if (PXSEG(port))
                *(volatile unsigned short *)port = value;
		ctrl_outw(value, port);
	else if (CHECK_SH7751_PCIIO(port) || shifted_port(port))
        	*(unsigned short *)PCI_IOMAP(port) = value;
		ctrl_outw(value, PCI_IOMAP(port));
	else
		maybebadio(outw, port);
		maybebadio(port);
}

void hs7751rvoip_outl(unsigned int value, unsigned long port)
{
        if (PXSEG(port))
                *(volatile unsigned long *)port = value;
		ctrl_outl(value, port);
	else if (CHECK_SH7751_PCIIO(port) || shifted_port(port))
        	*((unsigned long *)PCI_IOMAP(port)) = value;
		ctrl_outl(value, PCI_IOMAP(port));
	else
		maybebadio(outl, port);
		maybebadio(port);
}

void hs7751rvoip_insb(unsigned long port, void *addr, unsigned long count)
{
	u8 *buf = addr;

	if (PXSEG(port))
		while (count--) *((unsigned char *) addr)++ = *(volatile unsigned char *)port;
		while (count--)
			*buf++ = ctrl_inb(port);
#if defined(CONFIG_HS7751RVOIP_CODEC)
	else if (codec_port(port))
		while (count--) *((unsigned char *) addr)++ = *(volatile unsigned char *)((unsigned long)area6_io8_base+(port-CODEC_IO_BASE));
		while (count--)
			*buf++ = ctrl_inb(CODEC_IOMAP(port));
#endif
	else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
		volatile __u8 *bp = (__u8 *)PCI_IOMAP(port);
		volatile u8 *bp = (volatile u8 *)PCI_IOMAP(port);

		while (count--) *((volatile unsigned char *) addr)++ = *bp;
		while (count--)
			*buf++ = *bp;
	} else {
		volatile __u16 *p = (volatile unsigned short *)port2adr(port);
		volatile u16 *p = (volatile u16 *)port2adr(port);

		while (count--) *((unsigned char *) addr)++ = *p & 0xff;
		while (count--)
			*buf++ = *p & 0xff;
	}
}

void hs7751rvoip_insw(unsigned long port, void *addr, unsigned long count)
{
	volatile __u16 *p;
	volatile u16 *p;
	u16 *buf = addr;

	if (PXSEG(port))
		p = (volatile unsigned short *)port;
		p = (volatile u16 *)port;
	else if (CHECK_SH7751_PCIIO(port) || shifted_port(port))
		p = (volatile unsigned short *)PCI_IOMAP(port);
		p = (volatile u16 *)PCI_IOMAP(port);
	else
		p = (volatile unsigned short *)port2adr(port);
	while (count--) *((__u16 *) addr)++ = *p;
		p = (volatile u16 *)port2adr(port);
	while (count--)
		*buf++ = *p;
}

void hs7751rvoip_insl(unsigned long port, void *addr, unsigned long count)
{

	if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
		volatile __u32 *p = (__u32 *)PCI_IOMAP(port);
		volatile u32 *p = (volatile u32 *)PCI_IOMAP(port);
		u32 *buf = addr;

		while (count--) *((__u32 *) addr)++ = *p;
		while (count--)
			*buf++ = *p;
	} else
		maybebadio(insl, port);
		maybebadio(port);
}

void hs7751rvoip_outsb(unsigned long port, const void *addr, unsigned long count)
{
	const u8 *buf = addr;

	if (PXSEG(port))
		while (count--) *(volatile unsigned char *)port = *((unsigned char *) addr)++;
		while (count--)
			ctrl_outb(*buf++, port);
#if defined(CONFIG_HS7751RVOIP_CODEC)
	else if (codec_port(port))
		while (count--) *(volatile unsigned char *)((unsigned long)area6_io8_base+(port-CODEC_IO_BASE)) = *((unsigned char *) addr)++;
		while (count--)
			ctrl_outb(*buf++, CODEC_IOMAP(port));
#endif
	else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
		volatile __u8 *bp = (__u8 *)PCI_IOMAP(port);
		volatile u8 *bp = (volatile u8 *)PCI_IOMAP(port);

		while (count--) *bp = *((volatile unsigned char *) addr)++;
		while (count--)
			*bp = *buf++;
	} else {
		volatile __u16 *p = (volatile unsigned short *)port2adr(port);
		volatile u16 *p = (volatile u16 *)port2adr(port);

		while (count--) *p = *((unsigned char *) addr)++;
		while (count--)
			*p = *buf++;
	}
}

void hs7751rvoip_outsw(unsigned long port, const void *addr, unsigned long count)
{
	volatile __u16 *p;
	volatile u16 *p;
	const u16 *buf = addr;

	if (PXSEG(port))
		p = (volatile unsigned short *)port;
		p = (volatile u16 *)port;
	else if (CHECK_SH7751_PCIIO(port) || shifted_port(port))
		p = (volatile unsigned short *)PCI_IOMAP(port);
		p = (volatile u16 *)PCI_IOMAP(port);
	else
		p = (volatile unsigned short *)port2adr(port);
	while (count--) *p = *((__u16 *) addr)++;
		p = (volatile u16 *)port2adr(port);

	while (count--)
		*p = *buf++;
}

void hs7751rvoip_outsl(unsigned long port, const void *addr, unsigned long count)
{
	const u32 *buf = addr;

	if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
		volatile __u32 *p = (__u32 *)PCI_IOMAP(port);
		volatile u32 *p = (volatile u32 *)PCI_IOMAP(port);

		while (count--) *p = *((__u32 *) addr)++;
		while (count--)
			*p = *buf++;
	} else
		maybebadio(outsl, port);
		maybebadio(port);
}

unsigned long hs7751rvoip_isa_port2addr(unsigned long offset)
void __iomem *hs7751rvoip_ioport_map(unsigned long port, unsigned int size)
{
	return port2adr(offset);
        if (PXSEG(port))
                return (void __iomem *)port;
	else if (unlikely(codec_port(port) && (size == 1)))
		return (void __iomem *)CODEC_IOMAP(port);
        else if (CHECK_SH7751_PCIIO(port))
                return (void __iomem *)PCI_IOMAP(port);

        return (void __iomem *)port2adr(port);
}
+2 −3
Original line number Diff line number Diff line
@@ -17,9 +17,8 @@
#include <linux/hdreg.h>
#include <linux/ide.h>
#include <linux/pm.h>
#include <asm/hs7751rvoip/hs7751rvoip.h>
#include <asm/hs7751rvoip/io.h>
#include <asm/io.h>
#include <asm/hs7751rvoip/hs7751rvoip.h>
#include <asm/machvec.h>
#include <asm/rtc.h>
#include <asm/irq.h>
@@ -60,8 +59,8 @@ struct sh_machine_vector mv_hs7751rvoip __initmv = {
	.mv_outsw		= hs7751rvoip_outsw,
	.mv_outsl		= hs7751rvoip_outsl,

	.mv_isa_port2addr	= hs7751rvoip_isa_port2addr,
	.mv_init_irq		= hs7751rvoip_init_irq,
	.mv_ioport_map		= hs7751rvoip_ioport_map,
};
ALIAS_MV(hs7751rvoip)

+9 −87
Original line number Diff line number Diff line
@@ -10,11 +10,10 @@

#include <linux/kernel.h>
#include <linux/types.h>
#include <asm/systemh/7751systemh.h>
#include <linux/pci.h>
#include <asm/systemh7751.h>
#include <asm/addrspace.h>
#include <asm/io.h>

#include <linux/pci.h>
#include "../../../drivers/pci/pci-sh7751.h"

/*
@@ -31,11 +30,6 @@
#define PCI_IOMAP(adr)	(PCI_IO_AREA + (adr & ~SH7751_PCIIOBR_MASK))
#define ETHER_IOMAP(adr) (0xB3000000 + (adr)) /*map to 16bits access area
                                                of smc lan chip*/

#define maybebadio(name,port) \
  printk("bad PC-like io %s for port 0x%lx at 0x%08x\n", \
	 #name, (port), (__u32) __builtin_return_address(0))

static inline void delay(void)
{
	ctrl_inw(0xa0000000);
@@ -46,11 +40,7 @@ port2adr(unsigned int port)
{
	if (port >= 0x2000)
		return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000));
#if 0
	else
		return (volatile __u16 *) (PA_SUPERIO + (port << 1));
#endif
	maybebadio(name,(unsigned long)port);
	maybebadio((unsigned long)port);
	return (volatile __u16*)port;
}

@@ -111,7 +101,7 @@ unsigned short sh7751systemh_inw(unsigned long port)
	else if (port <= 0x3F1)
		return *(volatile unsigned int *)ETHER_IOMAP(port);
	else
		maybebadio(inw, port);
		maybebadio(port);
	return 0;
}

@@ -126,7 +116,7 @@ unsigned int sh7751systemh_inl(unsigned long port)
	else if (port <= 0x3F1)
		return *(volatile unsigned int *)ETHER_IOMAP(port);
	else
		maybebadio(inl, port);
		maybebadio(port);
	return 0;
}

@@ -167,7 +157,7 @@ void sh7751systemh_outw(unsigned short value, unsigned long port)
	else if (port <= 0x3F1)
		*(volatile unsigned short *)ETHER_IOMAP(port) = value;
	else
		maybebadio(outw, port);
		maybebadio(port);
}

void sh7751systemh_outl(unsigned int value, unsigned long port)
@@ -177,7 +167,7 @@ void sh7751systemh_outl(unsigned int value, unsigned long port)
	else if (CHECK_SH7751_PCIIO(port))
        	*((unsigned long*)PCI_IOMAP(port)) = value;
	else
		maybebadio(outl, port);
		maybebadio(port);
}

void sh7751systemh_insb(unsigned long port, void *addr, unsigned long count)
@@ -194,7 +184,7 @@ void sh7751systemh_insw(unsigned long port, void *addr, unsigned long count)

void sh7751systemh_insl(unsigned long port, void *addr, unsigned long count)
{
	maybebadio(insl, port);
	maybebadio(port);
}

void sh7751systemh_outsb(unsigned long port, const void *addr, unsigned long count)
@@ -211,73 +201,5 @@ void sh7751systemh_outsw(unsigned long port, const void *addr, unsigned long cou

void sh7751systemh_outsl(unsigned long port, const void *addr, unsigned long count)
{
	maybebadio(outsw, port);
}

/* For read/write calls, just copy generic (pass-thru); PCIMBR is  */
/* already set up.  For a larger memory space, these would need to */
/* reset PCIMBR as needed on a per-call basis...                   */

unsigned char sh7751systemh_readb(unsigned long addr)
{
	return *(volatile unsigned char*)addr;
}

unsigned short sh7751systemh_readw(unsigned long addr)
{
	return *(volatile unsigned short*)addr;
}

unsigned int sh7751systemh_readl(unsigned long addr)
{
	return *(volatile unsigned long*)addr;
}

void sh7751systemh_writeb(unsigned char b, unsigned long addr)
{
	*(volatile unsigned char*)addr = b;
}

void sh7751systemh_writew(unsigned short b, unsigned long addr)
{
	*(volatile unsigned short*)addr = b;
}

void sh7751systemh_writel(unsigned int b, unsigned long addr)
{
        *(volatile unsigned long*)addr = b;
}



/* Map ISA bus address to the real address. Only for PCMCIA.  */

/* ISA page descriptor.  */
static __u32 sh_isa_memmap[256];

#if 0
static int
sh_isa_mmap(__u32 start, __u32 length, __u32 offset)
{
	int idx;

	if (start >= 0x100000 || (start & 0xfff) || (length != 0x1000))
		return -1;

	idx = start >> 12;
	sh_isa_memmap[idx] = 0xb8000000 + (offset &~ 0xfff);
	printk("sh_isa_mmap: start %x len %x offset %x (idx %x paddr %x)\n",
	       start, length, offset, idx, sh_isa_memmap[idx]);
	return 0;
}
#endif

unsigned long
sh7751systemh_isa_port2addr(unsigned long offset)
{
	int idx;

	idx = (offset >> 12) & 0xff;
	offset &= 0xfff;
	return sh_isa_memmap[idx] + offset;
	maybebadio(port);
}
+1 −1
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
#include <linux/hdreg.h>
#include <linux/ide.h>
#include <asm/io.h>
#include <asm/mach/7751systemh.h>
#include <asm/systemh7751.h>
#include <asm/smc37c93x.h>

/* address of external interrupt mask register
Loading