aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ifxmips/files
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/ifxmips/files')
-rw-r--r--target/linux/ifxmips/files/arch/mips/ifxmips/Kconfig14
-rw-r--r--target/linux/ifxmips/files/arch/mips/ifxmips/board.c22
-rw-r--r--target/linux/ifxmips/files/arch/mips/ifxmips/cgu.c16
-rw-r--r--target/linux/ifxmips/files/arch/mips/ifxmips/prom.c3
-rw-r--r--target/linux/ifxmips/files/arch/mips/pci/pci-ifxmips.c53
-rw-r--r--target/linux/ifxmips/files/drivers/leds/leds-ifxmips.c (renamed from target/linux/ifxmips/files/drivers/char/ifxmips_led.c)0
-rw-r--r--target/linux/ifxmips/files/drivers/serial/ifxmips_asc.c83
-rw-r--r--target/linux/ifxmips/files/include/asm-mips/ifxmips/ifxmips_cgu.h1
8 files changed, 115 insertions, 77 deletions
diff --git a/target/linux/ifxmips/files/arch/mips/ifxmips/Kconfig b/target/linux/ifxmips/files/arch/mips/ifxmips/Kconfig
index f01fcd3625..3e68f7f9b9 100644
--- a/target/linux/ifxmips/files/arch/mips/ifxmips/Kconfig
+++ b/target/linux/ifxmips/files/arch/mips/ifxmips/Kconfig
@@ -2,24 +2,10 @@
menu "IFXMips built-in"
-config IFXMIPS_ASC_UART
- bool "IFXMips asc uart"
- select SERIAL_CORE
- select SERIAL_CORE_CONSOLE
- default y
-
config MTD_IFXMIPS
bool "IFXMips flash map"
default y
-config IFXMIPS_WDT
- bool "IFXMips watchdog"
- default y
-
-config IFXMIPS_LED
- bool "IFXMips led"
- default y
-
config IFXMIPS_SSC
bool "IFXMips ssc"
default y
diff --git a/target/linux/ifxmips/files/arch/mips/ifxmips/board.c b/target/linux/ifxmips/files/arch/mips/ifxmips/board.c
index aabcb5fce8..28f2e263c1 100644
--- a/target/linux/ifxmips/files/arch/mips/ifxmips/board.c
+++ b/target/linux/ifxmips/files/arch/mips/ifxmips/board.c
@@ -32,7 +32,7 @@
#include <asm/io.h>
#include <asm/ifxmips/ifxmips.h>
-#define MAX_IFXMIPS_DEVS 7
+#define MAX_IFXMIPS_DEVS 9
#define BOARD_DANUBE "Danube"
#define BOARD_DANUBE_CHIPID 0x10129083
@@ -79,6 +79,24 @@ ifxmips_wdt[] =
},
};
+static struct platform_device
+ifxmips_asc0[] =
+{
+ {
+ .id = 0,
+ .name = "ifxmips_asc",
+ },
+};
+
+static struct platform_device
+ifxmips_asc1[] =
+{
+ {
+ .id = 1,
+ .name = "ifxmips_asc",
+ },
+};
+
static struct physmap_flash_data
ifxmips_mtd_data = {
.width = 2,
@@ -155,6 +173,8 @@ ifxmips_init_devices(void)
ifxmips_devs[dev++] = ifxmips_mii;
ifxmips_devs[dev++] = ifxmips_mtd;
ifxmips_devs[dev++] = ifxmips_wdt;
+ //ifxmips_devs[dev++] = ifxmips_asc0;
+ ifxmips_devs[dev++] = ifxmips_asc1;
#ifdef CONFIG_GPIO_DEVICE
ifxmips_devs[dev++] = ifxmips_gpio_dev;
#endif
diff --git a/target/linux/ifxmips/files/arch/mips/ifxmips/cgu.c b/target/linux/ifxmips/files/arch/mips/ifxmips/cgu.c
index 3dec89e7c1..d1e2ff4fad 100644
--- a/target/linux/ifxmips/files/arch/mips/ifxmips/cgu.c
+++ b/target/linux/ifxmips/files/arch/mips/ifxmips/cgu.c
@@ -413,3 +413,19 @@ cgu_get_clockout(int clkout)
}
return 0;
}
+
+void cgu_setup_pci_clk(int external_clock)
+{
+ //set clock to 33Mhz
+ ifxmips_w32(ifxmips_r32(IFXMIPS_CGU_IFCCR) & ~0xf00000, IFXMIPS_CGU_IFCCR);
+ ifxmips_w32(ifxmips_r32(IFXMIPS_CGU_IFCCR) | 0x800000, IFXMIPS_CGU_IFCCR);
+ // internal or external clock
+ if(external_clock)
+ {
+ ifxmips_w32(ifxmips_r32(IFXMIPS_CGU_IFCCR) & ~ (1 << 16), IFXMIPS_CGU_IFCCR);
+ ifxmips_w32((1 << 30), IFXMIPS_CGU_PCICR);
+ } else {
+ ifxmips_w32(ifxmips_r32(IFXMIPS_CGU_IFCCR) | (1 << 16), IFXMIPS_CGU_IFCCR);
+ ifxmips_w32((1 << 31) | (1 << 30), IFXMIPS_CGU_PCICR);
+ }
+}
diff --git a/target/linux/ifxmips/files/arch/mips/ifxmips/prom.c b/target/linux/ifxmips/files/arch/mips/ifxmips/prom.c
index 95630ae368..4e307d0443 100644
--- a/target/linux/ifxmips/files/arch/mips/ifxmips/prom.c
+++ b/target/linux/ifxmips/files/arch/mips/ifxmips/prom.c
@@ -125,8 +125,7 @@ prom_init(void)
memsize -= prom_cp1_size;
prom_cp1_base = (unsigned int*)(0xA0000000 + (memsize * 1024 * 1024));
- prom_printf(KERN_INFO "Using %dMB Ram and reserving %dMB for cp1\n",
- memsize, prom_cp1_size);
+ prom_printf("Using %dMB Ram and reserving %dMB for cp1\n", memsize, prom_cp1_size);
memsize *= 1024 * 1024;
if(!*arcs_cmdline)
diff --git a/target/linux/ifxmips/files/arch/mips/pci/pci-ifxmips.c b/target/linux/ifxmips/files/arch/mips/pci/pci-ifxmips.c
index 092a80ec4c..bd500bdec0 100644
--- a/target/linux/ifxmips/files/arch/mips/pci/pci-ifxmips.c
+++ b/target/linux/ifxmips/files/arch/mips/pci/pci-ifxmips.c
@@ -6,6 +6,7 @@
#include <linux/mm.h>
#include <asm/ifxmips/ifxmips.h>
#include <asm/ifxmips/ifxmips_irq.h>
+#include <asm/ifxmips/ifxmips_cgu.h>
#include <asm/addrspace.h>
#include <linux/vmalloc.h>
@@ -17,26 +18,30 @@
extern int ifxmips_pci_read_config_dword(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val);
extern int ifxmips_pci_write_config_dword(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 val);
-struct pci_ops ifxmips_pci_ops = {
+struct pci_ops ifxmips_pci_ops =
+{
.read = ifxmips_pci_read_config_dword,
.write = ifxmips_pci_write_config_dword
};
-static struct resource pci_io_resource = {
+static struct resource pci_io_resource =
+{
.name = "io pci IO space",
.start = IFXMIPS_PCI_IO_BASE,
.end = IFXMIPS_PCI_IO_BASE + IFXMIPS_PCI_IO_SIZE - 1,
.flags = IORESOURCE_IO
};
-static struct resource pci_mem_resource = {
+static struct resource pci_mem_resource =
+{
.name = "ext pci memory space",
.start = IFXMIPS_PCI_MEM_BASE,
.end = IFXMIPS_PCI_MEM_BASE + IFXMIPS_PCI_MEM_SIZE - 1,
.flags = IORESOURCE_MEM
};
-static struct pci_controller ifxmips_pci_controller = {
+static struct pci_controller ifxmips_pci_controller =
+{
.pci_ops = &ifxmips_pci_ops,
.mem_resource = &pci_mem_resource,
.mem_offset = 0x00000000UL,
@@ -45,12 +50,25 @@ static struct pci_controller ifxmips_pci_controller = {
};
u32 ifxmips_pci_mapped_cfg;
+u32 ifxmips_pci_external_clock = 0;
+
+static int __init
+ifxmips_pci_set_external_clk(char *str)
+{
+ printk("cgu: setting up external pci clock\n");
+ ifxmips_pci_external_clock = 1;
+ return 1;
+}
+__setup("pci_external_clk", ifxmips_pci_set_external_clk);
-int pcibios_plat_dev_init(struct pci_dev *dev){
+int
+pcibios_plat_dev_init(struct pci_dev *dev)
+{
u8 pin;
pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
- switch(pin) {
+ switch(pin)
+ {
case 0:
break;
case 1:
@@ -69,12 +87,13 @@ int pcibios_plat_dev_init(struct pci_dev *dev){
return 0;
}
-static void __init ifxmips_pci_startup (void){
+static void __init
+ifxmips_pci_startup(void)
+{
u32 temp_buffer;
- ifxmips_w32(ifxmips_r32(IFXMIPS_CGU_IFCCR) & ~0xf00000, IFXMIPS_CGU_IFCCR);
- ifxmips_w32(ifxmips_r32(IFXMIPS_CGU_IFCCR) | 0x800000, IFXMIPS_CGU_IFCCR);
- ifxmips_w32(ifxmips_r32(IFXMIPS_CGU_IFCCR) | (1 << 16), IFXMIPS_CGU_IFCCR);
- ifxmips_w32((1 << 31) | (1 << 30), IFXMIPS_CGU_PCICR);
+
+ cgu_setup_pci_clk(ifxmips_pci_external_clock);
+
ifxmips_w32(ifxmips_r32(IFXMIPS_GPIO_P1_OUT) | (1 << 5), IFXMIPS_GPIO_P1_OUT);
ifxmips_w32(ifxmips_r32(IFXMIPS_GPIO_P1_OD) | (1 << 5), IFXMIPS_GPIO_P1_OD);
ifxmips_w32(ifxmips_r32(IFXMIPS_GPIO_P1_DIR) | (1 << 5), IFXMIPS_GPIO_P1_DIR);
@@ -138,8 +157,10 @@ static void __init ifxmips_pci_startup (void){
ifxmips_w32(ifxmips_r32(IFXMIPS_GPIO_P1_OUT) | (1 << 5), IFXMIPS_GPIO_P1_OUT);
}
-int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin){
- switch (slot) {
+int __init
+pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin){
+ switch(slot)
+ {
case 13:
/* IDSEL = AD29 --> USB Host Controller */
return (INT_NUM_IM1_IRL0 + 17);
@@ -152,11 +173,13 @@ int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin){
}
}
-int pcibios_init(void){
+int
+pcibios_init(void)
+{
extern int pci_probe_only;
pci_probe_only = 0;
- printk ("PCI: Probing PCI hardware on host bus 0.\n");
+ printk("PCI: Probing PCI hardware on host bus 0.\n");
ifxmips_pci_startup ();
// IFXMIPS_PCI_REG32(PCI_CR_CLK_CTRL_REG) &= (~8);
ifxmips_pci_mapped_cfg = (u32)ioremap_nocache(0x17000000, 0x800 * 16);
diff --git a/target/linux/ifxmips/files/drivers/char/ifxmips_led.c b/target/linux/ifxmips/files/drivers/leds/leds-ifxmips.c
index 090516c5ad..090516c5ad 100644
--- a/target/linux/ifxmips/files/drivers/char/ifxmips_led.c
+++ b/target/linux/ifxmips/files/drivers/leds/leds-ifxmips.c
diff --git a/target/linux/ifxmips/files/drivers/serial/ifxmips_asc.c b/target/linux/ifxmips/files/drivers/serial/ifxmips_asc.c
index 63a4c2af9e..17d933c20b 100644
--- a/target/linux/ifxmips/files/drivers/serial/ifxmips_asc.c
+++ b/target/linux/ifxmips/files/drivers/serial/ifxmips_asc.c
@@ -41,7 +41,7 @@
#include <linux/console.h>
#include <linux/sysrq.h>
#include <linux/irq.h>
-
+#include <linux/platform_device.h>
#include <asm/system.h>
#include <asm/io.h>
#include <asm/uaccess.h>
@@ -60,7 +60,6 @@ static void ifxmipsasc_tx_chars(struct uart_port *port);
extern void prom_printf(const char * fmt, ...);
static struct uart_port ifxmipsasc_port[2];
static struct uart_driver ifxmipsasc_reg;
-static unsigned int uartclk = 0;
extern unsigned int ifxmips_get_fpi_hz(void);
static void
@@ -155,7 +154,6 @@ static void
ifxmipsasc_tx_chars(struct uart_port *port)
{
struct circ_buf *xmit = &port->info->xmit;
-
if(uart_tx_stopped(port))
{
ifxmipsasc_stop_tx(port);
@@ -245,10 +243,7 @@ ifxmipsasc_startup(struct uart_port *port)
unsigned long flags;
int retval;
- if(uartclk == 0)
- uartclk = ifxmips_get_fpi_hz();
-
- port->uartclk = uartclk;
+ port->uartclk = ifxmips_get_fpi_hz();
ifxmips_w32(ifxmips_r32(port->membase + IFXMIPS_ASC_CLC) & ~IFXMIPS_ASC_CLC_DISS, port->membase + IFXMIPS_ASC_CLC);
ifxmips_w32(((ifxmips_r32(port->membase + IFXMIPS_ASC_CLC) & ~ASCCLC_RMCMASK)) | (1 << ASCCLC_RMCOFFSET), port->membase + IFXMIPS_ASC_CLC);
@@ -260,17 +255,17 @@ ifxmipsasc_startup(struct uart_port *port)
local_irq_save(flags);
- retval = request_irq(port->irq, ifxmipsasc_rx_int, IRQF_DISABLED, "asc_rx", port);
+ retval = request_irq(port->irq, ifxmipsasc_tx_int, IRQF_DISABLED, "asc_tx", port);
if(retval)
{
- printk("failed to request ifxmipsasc_rx_int\n");
+ printk("failed to request ifxmipsasc_tx_int\n");
return retval;
}
- retval = request_irq(port->irq + 2, ifxmipsasc_tx_int, IRQF_DISABLED, "asc_tx", port);
+ retval = request_irq(port->irq + 2, ifxmipsasc_rx_int, IRQF_DISABLED, "asc_rx", port);
if(retval)
{
- printk("failed to request ifxmipsasc_tx_int\n");
+ printk("failed to request ifxmipsasc_rx_int\n");
goto err1;
}
@@ -402,7 +397,15 @@ static void ifxmipsasc_set_termios(struct uart_port *port, struct ktermios *new,
static const char*
ifxmipsasc_type(struct uart_port *port)
{
- return port->type == PORT_IFXMIPSASC ? "IFXMIPSASC" : NULL;
+ if(port->type == PORT_IFXMIPSASC)
+ {
+ if(port->membase == IFXMIPS_ASC_BASE_ADDR)
+ return "asc0";
+ else
+ return "asc1";
+ } else {
+ return NULL;
+ }
}
static void
@@ -465,54 +468,53 @@ static struct uart_port ifxmipsasc_port[2] =
membase: (void *)IFXMIPS_ASC_BASE_ADDR,
mapbase: IFXMIPS_ASC_BASE_ADDR,
iotype: SERIAL_IO_MEM,
- irq: IFXMIPSASC_RIR(0),
+ irq: IFXMIPSASC_TIR(0),
uartclk: 0,
fifosize: 16,
type: PORT_IFXMIPSASC,
ops: &ifxmipsasc_pops,
flags: ASYNC_BOOT_AUTOCONF,
+ line: 0
}, {
membase: (void *)(IFXMIPS_ASC_BASE_ADDR + IFXMIPS_ASC_BASE_DIFF),
mapbase: IFXMIPS_ASC_BASE_ADDR + IFXMIPS_ASC_BASE_DIFF,
iotype: SERIAL_IO_MEM,
- irq: IFXMIPSASC_RIR(1),
+ irq: IFXMIPSASC_TIR(1),
uartclk: 0,
fifosize: 16,
type: PORT_IFXMIPSASC,
ops: &ifxmipsasc_pops,
flags: ASYNC_BOOT_AUTOCONF,
+ line: 1
}
};
static void
ifxmipsasc_console_write(struct console *co, const char *s, u_int count)
{
+ int port = co->index;
int i, fifocnt;
unsigned long flags;
-
local_irq_save(flags);
for(i = 0; i < count; i++)
{
- /* wait until the FIFO is not full */
- do
- {
- fifocnt = (ifxmips_r32((u32*)(IFXMIPS_ASC_BASE_ADDR + (co->index * IFXMIPS_ASC_BASE_DIFF) + IFXMIPS_ASC_FSTAT)) & ASCFSTAT_TXFFLMASK)
+ do {
+ fifocnt = (ifxmips_r32((u32*)(IFXMIPS_ASC_BASE_ADDR + (port * IFXMIPS_ASC_BASE_DIFF) + IFXMIPS_ASC_FSTAT)) & ASCFSTAT_TXFFLMASK)
>> ASCFSTAT_TXFFLOFF;
- }while(fifocnt == IFXMIPSASC_TXFIFO_FULL);
+ } while(fifocnt == IFXMIPSASC_TXFIFO_FULL);
if(s[i] == '\0')
break;
if(s[i] == '\n')
{
- ifxmips_w32('\r', (u32*)(IFXMIPS_ASC_BASE_ADDR + (co->index * IFXMIPS_ASC_BASE_DIFF) + IFXMIPS_ASC_TBUF));
- do
- {
- fifocnt = (ifxmips_r32((u32*)(IFXMIPS_ASC_BASE_ADDR + (co->index * IFXMIPS_ASC_BASE_DIFF) + IFXMIPS_ASC_FSTAT)) & ASCFSTAT_TXFFLMASK)
+ ifxmips_w32('\r', (u32*)(IFXMIPS_ASC_BASE_ADDR + (port * IFXMIPS_ASC_BASE_DIFF) + IFXMIPS_ASC_TBUF));
+ do {
+ fifocnt = (ifxmips_r32((u32*)(IFXMIPS_ASC_BASE_ADDR + (port * IFXMIPS_ASC_BASE_DIFF) + IFXMIPS_ASC_FSTAT)) & ASCFSTAT_TXFFLMASK)
>> ASCFSTAT_TXFFLOFF;
} while(fifocnt == IFXMIPSASC_TXFIFO_FULL);
}
- ifxmips_w32(s[i], (u32*)(IFXMIPS_ASC_BASE_ADDR + (co->index * IFXMIPS_ASC_BASE_DIFF) + IFXMIPS_ASC_TBUF));
+ ifxmips_w32(s[i], (u32*)(IFXMIPS_ASC_BASE_ADDR + (port * IFXMIPS_ASC_BASE_DIFF) + IFXMIPS_ASC_TBUF));
}
local_irq_restore(flags);
@@ -521,23 +523,16 @@ ifxmipsasc_console_write(struct console *co, const char *s, u_int count)
static int __init
ifxmipsasc_console_setup(struct console *co, char *options)
{
- struct uart_port *port;
+ int port = co->index;
int baud = 115200;
int bits = 8;
int parity = 'n';
int flow = 'n';
-
- if(uartclk == 0)
- uartclk = ifxmips_get_fpi_hz();
- co->index = 0;
- port = &ifxmipsasc_port[co->index];
- ifxmipsasc_port[co->index].uartclk = uartclk;
- ifxmipsasc_port[co->index].type = PORT_IFXMIPSASC;
-
+ ifxmipsasc_port[port].uartclk = ifxmips_get_fpi_hz();
+ ifxmipsasc_port[port].type = PORT_IFXMIPSASC;
if(options)
uart_parse_options(options, &baud, &parity, &bits, &flow);
-
- return uart_set_options(port, co, baud, parity, bits, flow);
+ return uart_set_options(&ifxmipsasc_port[port], co, baud, parity, bits, flow);
}
static struct console ifxmipsasc_console[2] =
@@ -578,22 +573,20 @@ static struct uart_driver ifxmipsasc_reg =
.major = TTY_MAJOR,
.minor = 64,
.nr = 2,
- .cons = ifxmipsasc_console,
+ .cons = &ifxmipsasc_console[1],
};
-static int __init
+int __init
ifxmipsasc_init(void)
{
- unsigned char res;
-
+ int ret;
uart_register_driver(&ifxmipsasc_reg);
- res = uart_add_one_port(&ifxmipsasc_reg, &ifxmipsasc_port[0]);
- res = uart_add_one_port(&ifxmipsasc_reg, &ifxmipsasc_port[1]);
-
- return res;
+ ret = uart_add_one_port(&ifxmipsasc_reg, &ifxmipsasc_port[0]);
+ ret = uart_add_one_port(&ifxmipsasc_reg, &ifxmipsasc_port[1]);
+ return 0;
}
-static void __exit
+void __exit
ifxmipsasc_exit(void)
{
uart_unregister_driver(&ifxmipsasc_reg);
diff --git a/target/linux/ifxmips/files/include/asm-mips/ifxmips/ifxmips_cgu.h b/target/linux/ifxmips/files/include/asm-mips/ifxmips/ifxmips_cgu.h
index 99ad9a7c8e..cf1cbba939 100644
--- a/target/linux/ifxmips/files/include/asm-mips/ifxmips/ifxmips_cgu.h
+++ b/target/linux/ifxmips/files/include/asm-mips/ifxmips/ifxmips_cgu.h
@@ -8,4 +8,5 @@ u32 cgu_get_pp32_clock(void);
u32 cgu_get_ethernet_clock(int mii);
u32 cgu_get_usb_clock(void);
u32 cgu_get_clockout(int clkout);
+void cgu_setup_pci_clk(int internal_clock);
#endif