Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 36263
b: refs/heads/master
c: 373e68b
h: refs/heads/master
i:
  36261: d6ff816
  36259: ea1be8b
  36255: 0acd33a
v: v3
  • Loading branch information
Paul Mundt committed Sep 27, 2006
1 parent a78f0ed commit cbbb3c7
Show file tree
Hide file tree
Showing 44 changed files with 202 additions and 672 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f647d33f879d258de4ab2559975bd6eebda2033e
refs/heads/master: 373e68b5472d421cbd2703e7a77caf053f78c005
3 changes: 0 additions & 3 deletions trunk/arch/sh/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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),)
Expand Down
159 changes: 91 additions & 68 deletions trunk/arch/sh/boards/renesas/hs7751rvoip/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
{
Expand All @@ -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;
}

Expand Down Expand Up @@ -109,192 +101,223 @@ 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)
{
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;
}

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;
}

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);
}
5 changes: 2 additions & 3 deletions trunk/arch/sh/boards/renesas/hs7751rvoip/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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)

Expand Down
Loading

0 comments on commit cbbb3c7

Please sign in to comment.