summaryrefslogtreecommitdiffstats
path: root/target/linux/ifxmips/files/arch/mips/ifxmips
diff options
context:
space:
mode:
authorblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-06-29 00:42:45 +0000
committerblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-06-29 00:42:45 +0000
commitb6fb9a7180b9b173ebf5e369fe8cd28613d6742d (patch)
tree180f825f87946233678fd17a154c452e8ec2f91d /target/linux/ifxmips/files/arch/mips/ifxmips
parent9309132bb9c4f6af333ae2e6d96d370ba2e9bf1a (diff)
lots of ifxmips cleanups
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@11607 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ifxmips/files/arch/mips/ifxmips')
-rw-r--r--target/linux/ifxmips/files/arch/mips/ifxmips/Kconfig4
-rw-r--r--target/linux/ifxmips/files/arch/mips/ifxmips/board.c45
-rw-r--r--target/linux/ifxmips/files/arch/mips/ifxmips/clock.c43
-rw-r--r--target/linux/ifxmips/files/arch/mips/ifxmips/gpio.c3
-rw-r--r--target/linux/ifxmips/files/arch/mips/ifxmips/interrupt.c1
-rw-r--r--target/linux/ifxmips/files/arch/mips/ifxmips/setup.c61
6 files changed, 90 insertions, 67 deletions
diff --git a/target/linux/ifxmips/files/arch/mips/ifxmips/Kconfig b/target/linux/ifxmips/files/arch/mips/ifxmips/Kconfig
index d4e96af32..621020f83 100644
--- a/target/linux/ifxmips/files/arch/mips/ifxmips/Kconfig
+++ b/target/linux/ifxmips/files/arch/mips/ifxmips/Kconfig
@@ -18,6 +18,10 @@ config IFXMIPS_MEI
bool "IFXMips mei"
default y
+config IFXMIPS_GPIO_RST_BTN
+ bool "Reset Button"
+ default y
+
choice
prompt "prom_printf ASC"
help
diff --git a/target/linux/ifxmips/files/arch/mips/ifxmips/board.c b/target/linux/ifxmips/files/arch/mips/ifxmips/board.c
index 8d12ebdaf..b7e0387e3 100644
--- a/target/linux/ifxmips/files/arch/mips/ifxmips/board.c
+++ b/target/linux/ifxmips/files/arch/mips/ifxmips/board.c
@@ -30,7 +30,9 @@
#include <asm/time.h>
#include <asm/irq.h>
#include <asm/io.h>
+#include <linux/etherdevice.h>
#include <asm/ifxmips/ifxmips.h>
+#include <asm/ifxmips/ifxmips_mii0.h>
#define MAX_IFXMIPS_DEVS 9
@@ -42,10 +44,13 @@
static unsigned int chiprev;
static struct platform_device *ifxmips_devs[MAX_IFXMIPS_DEVS];
+static int cmdline_mac = 0;
spinlock_t ebu_lock = SPIN_LOCK_UNLOCKED;
EXPORT_SYMBOL_GPL(ebu_lock);
+static struct ifxmips_mac ifxmips_mii_mac;
+
static struct platform_device
ifxmips_led[] =
{
@@ -70,6 +75,9 @@ ifxmips_mii[] =
{
.id = 0,
.name = "ifxmips_mii0",
+ .dev = {
+ .platform_data = &ifxmips_mii_mac,
+ }
},
};
@@ -82,11 +90,6 @@ ifxmips_wdt[] =
},
};
-static struct physmap_flash_data
-ifxmips_mtd_data = {
- .width = 2,
-};
-
static struct resource
ifxmips_mtd_resource = {
.start = IFXMIPS_FLASH_START,
@@ -100,9 +103,6 @@ ifxmips_mtd[] =
{
.id = 0,
.name = "ifxmips_mtd",
- .dev = {
- .platform_data = &ifxmips_mtd_data,
- },
.num_resources = 1,
.resource = &ifxmips_mtd_resource,
},
@@ -148,11 +148,40 @@ get_system_type(void)
return BOARD_SYSTEM_TYPE;
}
+#define IS_HEX(x) (((x >='0' && x <= '9') || (x >='a' && x <= 'f') || (x >='A' && x <= 'F'))?(1):(0))
+static int __init
+ifxmips_set_mii0_mac(char *str)
+{
+ int i;
+ str = strchr(str, '=');
+ if(!str)
+ goto out;
+ str++;
+ if(strlen(str) != 17)
+ goto out;
+ for(i = 0; i < 6; i++)
+ {
+ if(!IS_HEX(str[3 * i]) || !IS_HEX(str[(3 * i) + 1]))
+ goto out;
+ if((i != 5) && (str[(3 * i) + 2] != ':'))
+ goto out;
+ ifxmips_mii_mac.mac[i] = simple_strtoul(&str[3 * i], NULL, 16);
+ }
+ if(is_valid_ether_addr(ifxmips_mii_mac.mac))
+ cmdline_mac = 1;
+out:
+ return 1;
+}
+__setup("mii0_mac", ifxmips_set_mii0_mac);
+
int __init
ifxmips_init_devices(void)
{
int dev = 0;
+ if(!cmdline_mac)
+ random_ether_addr(ifxmips_mii_mac.mac);
+
ifxmips_devs[dev++] = ifxmips_led;
ifxmips_devs[dev++] = ifxmips_gpio;
ifxmips_devs[dev++] = ifxmips_mii;
diff --git a/target/linux/ifxmips/files/arch/mips/ifxmips/clock.c b/target/linux/ifxmips/files/arch/mips/ifxmips/clock.c
index d1e2ff4fa..c86b70cc0 100644
--- a/target/linux/ifxmips/files/arch/mips/ifxmips/clock.c
+++ b/target/linux/ifxmips/files/arch/mips/ifxmips/clock.c
@@ -429,3 +429,46 @@ void cgu_setup_pci_clk(int external_clock)
ifxmips_w32((1 << 31) | (1 << 30), IFXMIPS_CGU_PCICR);
}
}
+
+unsigned int
+ifxmips_get_ddr_hz(void)
+{
+ switch(ifxmips_r32(IFXMIPS_CGU_SYS) & 0x3)
+ {
+ case 0:
+ return CLOCK_167M;
+ case 1:
+ return CLOCK_133M;
+ case 2:
+ return CLOCK_111M;
+ }
+ return CLOCK_83M;
+}
+EXPORT_SYMBOL(ifxmips_get_ddr_hz);
+
+unsigned int
+ifxmips_get_cpu_hz(void)
+{
+ unsigned int ddr_clock = ifxmips_get_ddr_hz();
+ switch(ifxmips_r32(IFXMIPS_CGU_SYS) & 0xc)
+ {
+ case 0:
+ return CLOCK_333M;
+ case 4:
+ return ddr_clock;
+ }
+ return ddr_clock << 1;
+}
+EXPORT_SYMBOL(ifxmips_get_cpu_hz);
+
+unsigned int
+ifxmips_get_fpi_hz(void)
+{
+ unsigned int ddr_clock = ifxmips_get_ddr_hz();
+ if(ifxmips_r32(IFXMIPS_CGU_SYS) & 0x40)
+ return ddr_clock >> 1;
+ return ddr_clock;
+}
+EXPORT_SYMBOL(ifxmips_get_fpi_hz);
+
+
diff --git a/target/linux/ifxmips/files/arch/mips/ifxmips/gpio.c b/target/linux/ifxmips/files/arch/mips/ifxmips/gpio.c
index 931d3ac1d..01212d1ae 100644
--- a/target/linux/ifxmips/files/arch/mips/ifxmips/gpio.c
+++ b/target/linux/ifxmips/files/arch/mips/ifxmips/gpio.c
@@ -303,7 +303,7 @@ reset_button_poll(unsigned long unused)
{
struct event_t *event;
- rst_button_timer.expires = jiffies + HZ;
+ rst_button_timer.expires = jiffies + (HZ / 4);
add_timer(&rst_button_timer);
if (pressed != ifxmips_port_get_input(IFXMIPS_RST_PORT, IFXMIPS_RST_PIN))
@@ -312,7 +312,6 @@ reset_button_poll(unsigned long unused)
pressed = 0;
else
pressed = 1;
- printk("reset button was %s\n", (pressed ? "pressed" : "released"));
event = (struct event_t *) kzalloc(sizeof(struct event_t), GFP_ATOMIC);
if (!event)
{
diff --git a/target/linux/ifxmips/files/arch/mips/ifxmips/interrupt.c b/target/linux/ifxmips/files/arch/mips/ifxmips/interrupt.c
index e7557cef6..b47074d79 100644
--- a/target/linux/ifxmips/files/arch/mips/ifxmips/interrupt.c
+++ b/target/linux/ifxmips/files/arch/mips/ifxmips/interrupt.c
@@ -141,6 +141,7 @@ ifxmips_hw_irqdispatch(int module)
if(irq == 0)
return;
+ /* we need to do this due to a silicon bug */
irq = ls1bit32(irq);
do_IRQ((int)irq + INT_NUM_IM0_IRL0 + (INT_NUM_IM_OFFSET * module));
diff --git a/target/linux/ifxmips/files/arch/mips/ifxmips/setup.c b/target/linux/ifxmips/files/arch/mips/ifxmips/setup.c
index 7093b7f7e..a29a54d28 100644
--- a/target/linux/ifxmips/files/arch/mips/ifxmips/setup.c
+++ b/target/linux/ifxmips/files/arch/mips/ifxmips/setup.c
@@ -27,6 +27,7 @@
#include <asm/ifxmips/ifxmips.h>
#include <asm/ifxmips/ifxmips_irq.h>
#include <asm/ifxmips/ifxmips_pmu.h>
+#include <asm/ifxmips/ifxmips_cgu.h>
#include <asm/ifxmips/ifxmips_prom.h>
static unsigned int r4k_offset;
@@ -35,50 +36,9 @@ static unsigned int r4k_cur;
extern void ifxmips_reboot_setup(void);
unsigned int
-ifxmips_get_ddr_hz(void)
-{
- switch(ifxmips_r32(IFXMIPS_CGU_SYS) & 0x3)
- {
- case 0:
- return CLOCK_167M;
- case 1:
- return CLOCK_133M;
- case 2:
- return CLOCK_111M;
- }
- return CLOCK_83M;
-}
-EXPORT_SYMBOL(ifxmips_get_ddr_hz);
-
-unsigned int
-ifxmips_get_cpu_hz(void)
-{
- unsigned int ddr_clock = ifxmips_get_ddr_hz();
- switch(ifxmips_r32(IFXMIPS_CGU_SYS) & 0xc)
- {
- case 0:
- return CLOCK_333M;
- case 4:
- return ddr_clock;
- }
- return ddr_clock << 1;
-}
-EXPORT_SYMBOL(ifxmips_get_cpu_hz);
-
-unsigned int
-ifxmips_get_fpi_hz(void)
-{
- unsigned int ddr_clock = ifxmips_get_ddr_hz();
- if(ifxmips_r32(IFXMIPS_CGU_SYS) & 0x40)
- return ddr_clock >> 1;
- return ddr_clock;
-}
-EXPORT_SYMBOL(ifxmips_get_fpi_hz);
-
-unsigned int
ifxmips_get_cpu_ver(void)
{
- return ifxmips_r32(IFXMIPS_MCD_CHIPID) & 0xFFFFF000;
+ return (ifxmips_r32(IFXMIPS_MPS_CHIPID) & 0xF0000000) >> 28;
}
EXPORT_SYMBOL(ifxmips_get_cpu_ver);
@@ -100,27 +60,15 @@ ifxmips_get_counter_resolution(void)
return res;
}
-int
-ifxmips_be_handler(struct pt_regs *regs, int is_fixup)
-{
- /*TODO*/
- printk(KERN_ERR "TODO: BUS error\n");
-
- return MIPS_BE_FATAL;
-}
-
void __init
plat_time_init(void)
{
mips_hpt_frequency = ifxmips_get_cpu_hz() / ifxmips_get_counter_resolution();
r4k_cur = (read_c0_count() + r4k_offset);
write_c0_compare(r4k_cur);
- ifxmips_pmu_enable(IFXMIPS_PMU_PWDCR_GPT | IFXMIPS_PMU_PWDCR_FPI);
- ifxmips_w32(0x100, IFXMIPS_GPTU_GPT_CLC);
-
- ifxmips_w32(0xffff, IFXMIPS_GPTU_GPT_CAPREL);
- ifxmips_w32(0x80C0, IFXMIPS_GPTU_GPT_T6CON);
+ ifxmips_pmu_enable(IFXMIPS_PMU_PWDCR_GPT | IFXMIPS_PMU_PWDCR_FPI);
+ ifxmips_w32(0x100, IFXMIPS_GPTU_GPT_CLC); // set clock divider to 1
}
void __init
@@ -134,7 +82,6 @@ plat_mem_setup(void)
write_c0_status(status);
ifxmips_reboot_setup();
- board_be_handler = &ifxmips_be_handler;
ioport_resource.start = IOPORT_RESOURCE_START;
ioport_resource.end = IOPORT_RESOURCE_END;