Skip to content

Commit

Permalink
[MIPS] rbtx4927: misc cleanups
Browse files Browse the repository at this point in the history
* Merge tx4927_pci.h into tx4927.h
* Kill (broken) external PCI clock frequency reporting
* Kill unnecessary wbflush()
* Kill unnecessary includes
* Kill debug garbages

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
Atsushi Nemoto authored and Ralf Baechle committed Jul 15, 2008
1 parent af3e69c commit b29eee4
Show file tree
Hide file tree
Showing 10 changed files with 266 additions and 828 deletions.
1 change: 0 additions & 1 deletion arch/mips/pci/fixup-rbtx4927.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include <linux/init.h>

#include <asm/tx4927/tx4927.h>
#include <asm/tx4927/tx4927_pci.h>

#undef DEBUG
#ifdef DEBUG
Expand Down
5 changes: 1 addition & 4 deletions arch/mips/pci/ops-tx4927.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@
#include <linux/pci.h>
#include <linux/kernel.h>
#include <linux/init.h>

#include <asm/addrspace.h>
#include <asm/byteorder.h>
#include <asm/tx4927/tx4927_pci.h>
#include <asm/tx4927/tx4927.h>

/* initialize in setup */
struct resource pci_io_resource = {
Expand Down
5 changes: 1 addition & 4 deletions arch/mips/tx4927/common/tx4927_dbgio.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,14 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include <asm/mipsregs.h>
#include <asm/system.h>
#include <linux/types.h>

u8 getDebugChar(void)
{
extern u8 txx9_sio_kdbg_rd(void);
return (txx9_sio_kdbg_rd());
}


int putDebugChar(u8 byte)
{
extern int txx9_sio_kdbg_wr( u8 ch );
Expand Down
8 changes: 2 additions & 6 deletions arch/mips/tx4927/common/tx4927_prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,8 @@
*/

#include <linux/init.h>
#include <linux/mm.h>
#include <linux/sched.h>
#include <linux/bootmem.h>

#include <asm/addrspace.h>
#include <asm/bootinfo.h>
#include <linux/types.h>
#include <linux/io.h>
#include <asm/tx4927/tx4927.h>

static unsigned int __init tx4927_process_sdccr(unsigned long addr)
Expand Down
234 changes: 11 additions & 223 deletions arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
* with this program; if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/


/*
IRQ Device
00 RBTX4927-ISA/00
Expand Down Expand Up @@ -112,76 +110,14 @@ JP7 is not bus master -- do NOT use -- only 4 pci bus master's allowed -- SouthB
*/

#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/mm.h>
#include <linux/swap.h>
#include <linux/ioport.h>
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/timex.h>
#include <asm/bootinfo.h>
#include <asm/page.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/pci.h>
#include <asm/processor.h>
#include <asm/reboot.h>
#include <asm/time.h>
#include <asm/wbflush.h>
#include <linux/bootmem.h>
#include <linux/blkdev.h>
#ifdef CONFIG_TOSHIBA_FPCIB0
#include <asm/i8259.h>
#include <asm/tx4927/smsc_fdc37m81x.h>
#endif
#include <asm/tx4927/toshiba_rbtx4927.h>


#undef TOSHIBA_RBTX4927_IRQ_DEBUG

#ifdef TOSHIBA_RBTX4927_IRQ_DEBUG
#define TOSHIBA_RBTX4927_IRQ_NONE 0x00000000

#define TOSHIBA_RBTX4927_IRQ_INFO ( 1 << 0 )
#define TOSHIBA_RBTX4927_IRQ_WARN ( 1 << 1 )
#define TOSHIBA_RBTX4927_IRQ_EROR ( 1 << 2 )

#define TOSHIBA_RBTX4927_IRQ_IOC_INIT ( 1 << 10 )
#define TOSHIBA_RBTX4927_IRQ_IOC_ENABLE ( 1 << 13 )
#define TOSHIBA_RBTX4927_IRQ_IOC_DISABLE ( 1 << 14 )

#define TOSHIBA_RBTX4927_SETUP_ALL 0xffffffff
#endif


#ifdef TOSHIBA_RBTX4927_IRQ_DEBUG
static const u32 toshiba_rbtx4927_irq_debug_flag =
(TOSHIBA_RBTX4927_IRQ_NONE | TOSHIBA_RBTX4927_IRQ_INFO |
TOSHIBA_RBTX4927_IRQ_WARN | TOSHIBA_RBTX4927_IRQ_EROR
// | TOSHIBA_RBTX4927_IRQ_IOC_INIT
// | TOSHIBA_RBTX4927_IRQ_IOC_ENABLE
// | TOSHIBA_RBTX4927_IRQ_IOC_DISABLE
);
#endif


#ifdef TOSHIBA_RBTX4927_IRQ_DEBUG
#define TOSHIBA_RBTX4927_IRQ_DPRINTK(flag,str...) \
if ( (toshiba_rbtx4927_irq_debug_flag) & (flag) ) \
{ \
char tmp[100]; \
sprintf( tmp, str ); \
printk( "%s(%s:%u)::%s", __func__, __FILE__, __LINE__, tmp ); \
}
#else
#define TOSHIBA_RBTX4927_IRQ_DPRINTK(flag, str...)
#endif




#define TOSHIBA_RBTX4927_IRQ_IOC_RAW_BEG 0
#define TOSHIBA_RBTX4927_IRQ_IOC_RAW_END 7

Expand All @@ -207,39 +143,22 @@ static struct irq_chip toshiba_rbtx4927_irq_ioc_type = {
#define TOSHIBA_RBTX4927_IOC_INTR_ENAB (void __iomem *)0xbc002000UL
#define TOSHIBA_RBTX4927_IOC_INTR_STAT (void __iomem *)0xbc002006UL


u32 bit2num(u32 num)
{
u32 i;

for (i = 0; i < (sizeof(num) * 8); i++) {
if (num & (1 << i)) {
return (i);
}
}
return (0);
}

int toshiba_rbtx4927_irq_nested(int sw_irq)
{
u32 level3;
u8 level3;

level3 = readb(TOSHIBA_RBTX4927_IOC_INTR_STAT) & 0x1f;
if (level3) {
sw_irq = TOSHIBA_RBTX4927_IRQ_IOC_BEG + bit2num(level3);
if (sw_irq != TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_IOC) {
goto RETURN;
}
}
sw_irq = TOSHIBA_RBTX4927_IRQ_IOC_BEG + fls(level3) - 1;
#ifdef CONFIG_TOSHIBA_FPCIB0
if (tx4927_using_backplane) {
int irq = i8259_irq();
if (irq >= 0)
sw_irq = irq;
}
if (sw_irq == TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_IOC &&
tx4927_using_backplane) {
int irq = i8259_irq();
if (irq >= 0)
sw_irq = irq;
}
#endif

RETURN:
}
return (sw_irq);
}

Expand All @@ -250,21 +169,10 @@ static struct irqaction toshiba_rbtx4927_irq_ioc_action = {
.name = TOSHIBA_RBTX4927_IOC_NAME
};


/**********************************************************************************/
/* Functions for ioc */
/**********************************************************************************/


static void __init toshiba_rbtx4927_irq_ioc_init(void)
{
int i;

TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_IOC_INIT,
"beg=%d end=%d\n",
TOSHIBA_RBTX4927_IRQ_IOC_BEG,
TOSHIBA_RBTX4927_IRQ_IOC_END);

for (i = TOSHIBA_RBTX4927_IRQ_IOC_BEG;
i <= TOSHIBA_RBTX4927_IRQ_IOC_END; i++)
set_irq_chip_and_handler(i, &toshiba_rbtx4927_irq_ioc_type,
Expand All @@ -276,45 +184,23 @@ static void __init toshiba_rbtx4927_irq_ioc_init(void)

static void toshiba_rbtx4927_irq_ioc_enable(unsigned int irq)
{
volatile unsigned char v;

TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_IOC_ENABLE,
"irq=%d\n", irq);

if (irq < TOSHIBA_RBTX4927_IRQ_IOC_BEG
|| irq > TOSHIBA_RBTX4927_IRQ_IOC_END) {
TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR,
"bad irq=%d\n", irq);
panic("\n");
}
unsigned char v;

v = readb(TOSHIBA_RBTX4927_IOC_INTR_ENAB);
v |= (1 << (irq - TOSHIBA_RBTX4927_IRQ_IOC_BEG));
writeb(v, TOSHIBA_RBTX4927_IOC_INTR_ENAB);
}


static void toshiba_rbtx4927_irq_ioc_disable(unsigned int irq)
{
volatile unsigned char v;

TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_IOC_DISABLE,
"irq=%d\n", irq);

if (irq < TOSHIBA_RBTX4927_IRQ_IOC_BEG
|| irq > TOSHIBA_RBTX4927_IRQ_IOC_END) {
TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_EROR,
"bad irq=%d\n", irq);
panic("\n");
}
unsigned char v;

v = readb(TOSHIBA_RBTX4927_IOC_INTR_ENAB);
v &= ~(1 << (irq - TOSHIBA_RBTX4927_IRQ_IOC_BEG));
writeb(v, TOSHIBA_RBTX4927_IOC_INTR_ENAB);
mmiowb();
}


void __init arch_init_irq(void)
{
extern void tx4927_irq_init(void);
Expand All @@ -327,102 +213,4 @@ void __init arch_init_irq(void)
#endif
/* Onboard 10M Ether: High Active */
set_irq_type(RBTX4927_RTL_8019_IRQ, IRQF_TRIGGER_HIGH);

wbflush();
}

void toshiba_rbtx4927_irq_dump(char *key)
{
#ifdef TOSHIBA_RBTX4927_IRQ_DEBUG
{
u32 i, j = 0;
for (i = 0; i < NR_IRQS; i++) {
if (strcmp(irq_desc[i].chip->name, "none")
== 0)
continue;

if ((i >= 1)
&& (irq_desc[i - 1].chip->name ==
irq_desc[i].chip->name)) {
j++;
} else {
j = 0;
}
TOSHIBA_RBTX4927_IRQ_DPRINTK
(TOSHIBA_RBTX4927_IRQ_INFO,
"%s irq=0x%02x/%3d s=0x%08x h=0x%08x a=0x%08x ah=0x%08x d=%1d n=%s/%02d\n",
key, i, i, irq_desc[i].status,
(u32) irq_desc[i].chip,
(u32) irq_desc[i].action,
(u32) (irq_desc[i].action ? irq_desc[i].
action->handler : 0),
irq_desc[i].depth,
irq_desc[i].chip->name, j);
}
}
#endif
}

void toshiba_rbtx4927_irq_dump_pics(char *s)
{
u32 level0_m;
u32 level0_s;
u32 level1_m;
u32 level1_s;
u32 level2;
u32 level2_p;
u32 level2_s;
u32 level3_m;
u32 level3_s;
u32 level4_m;
u32 level4_s;
u32 level5_m;
u32 level5_s;

if (s == NULL)
s = "null";

level0_m = (read_c0_status() & 0x0000ff00) >> 8;
level0_s = (read_c0_cause() & 0x0000ff00) >> 8;

level1_m = level0_m;
level1_s = level0_s & 0x87;

level2 = __raw_readl((void __iomem *)0xff1ff6a0UL);
level2_p = (((level2 & 0x10000)) ? 0 : 1);
level2_s = (((level2 & 0x1f) == 0x1f) ? 0 : (level2 & 0x1f));

level3_m = readb(TOSHIBA_RBTX4927_IOC_INTR_ENAB) & 0x1f;
level3_s = readb(TOSHIBA_RBTX4927_IOC_INTR_STAT) & 0x1f;

level4_m = inb(0x21);
outb(0x0A, 0x20);
level4_s = inb(0x20);

level5_m = inb(0xa1);
outb(0x0A, 0xa0);
level5_s = inb(0xa0);

TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_INFO,
"dump_raw_pic() ");
TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_INFO,
"cp0:m=0x%02x/s=0x%02x ", level0_m,
level0_s);
TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_INFO,
"cp0:m=0x%02x/s=0x%02x ", level1_m,
level1_s);
TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_INFO,
"pic:e=0x%02x/s=0x%02x ", level2_p,
level2_s);
TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_INFO,
"ioc:m=0x%02x/s=0x%02x ", level3_m,
level3_s);
TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_INFO,
"sbm:m=0x%02x/s=0x%02x ", level4_m,
level4_s);
TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_INFO,
"sbs:m=0x%02x/s=0x%02x ", level5_m,
level5_s);
TOSHIBA_RBTX4927_IRQ_DPRINTK(TOSHIBA_RBTX4927_IRQ_INFO, "[%s]\n",
s);
}
7 changes: 2 additions & 5 deletions arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,10 @@
* 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/sched.h>
#include <linux/bootmem.h>

#include <asm/addrspace.h>
#include <linux/string.h>
#include <asm/bootinfo.h>
#include <asm/cpu.h>
#include <asm/mipsregs.h>
#include <asm/tx4927/tx4927.h>

void __init prom_init_cmdline(void)
Expand Down
Loading

0 comments on commit b29eee4

Please sign in to comment.