16 #include <linux/netdevice.h>
18 #include <linux/device.h>
19 #include <linux/ethtool.h>
21 #include <linux/ptrace.h>
24 #include <asm/bootinfo.h>
25 #include <asm/reboot.h>
26 #include <asm/traps.h>
34 static void __init tx4939_wdr_init(
void)
38 pr_warning(
"Watchdog reset detected at 0x%lx\n",
51 static void tx4939_machine_restart(
char *
command)
54 pr_emerg(
"Rebooting (with %s watchdog reset)...\n",
56 "external" :
"internal");
64 pr_emerg(
"Rebooting (with internal watchdog reset)...\n");
73 static int tx4939_be_handler(
struct pt_regs *
regs,
int is_fixup)
77 pr_err(
"%cBE exception at %#lx\n",
78 data ?
'D' :
'I', regs->
cp0_epc);
79 pr_err(
"ccfg:%llx, toea:%llx\n",
88 static void __init tx4939_be_init(
void)
93 static struct resource tx4939_sdram_resource[4];
94 static struct resource tx4939_sram_resource;
95 #define TX4939_SRAM_SIZE 0x800
103 for (i = 0; i < 4; i++) {
107 start = (
unsigned long)(win >> 48);
108 size = (((
unsigned long)(win >> 32) & 0xffff) + 1) -
start;
118 unsigned int cpuclk = 0;
125 for (i = 0; i < 4; i++) {
142 cpuclk = cpuclk / 3 * 4 ;
break;
144 cpuclk = cpuclk / 2 * 3 ;
break;
146 cpuclk = cpuclk / 3 * 5 ;
break;
148 cpuclk = cpuclk / 6 * 11;
break;
150 cpuclk = cpuclk * 2 ;
break;
152 cpuclk = cpuclk / 6 * 13;
break;
154 cpuclk = cpuclk / 3 * 7 ;
break;
156 cpuclk = cpuclk / 2 * 5 ;
break;
218 pr_info(
"%s -- %dMHz(M%dMHz,G%dMHz) CRIR:%08x CCFG:%llx PCFG:%llx\n",
220 (cpuclk + 500000) / 1000000,
229 for (i = 0; i < 4; i++) {
234 tx4939_sdram_resource[
i].name =
"DDR SDRAM";
235 tx4939_sdram_resource[
i].start =
236 (
unsigned long)(win >> 48) << 20;
237 tx4939_sdram_resource[
i].end =
238 ((((
unsigned long)(win >> 32) & 0xffff) + 1) <<
248 tx4939_sram_resource.name =
"SRAM";
249 tx4939_sram_resource.start =
252 tx4939_sram_resource.end =
301 unsigned int ch_mask = 0;
311 for (i = 0; i < 4; i++) {
312 if ((1 << i) & ch_mask)
316 i, sclk, (1 << i) & cts_mask);
320 #if IS_ENABLED(CONFIG_TC35815)
327 return ethtool_cmd_speed(&
cmd);
342 if (tx4939_get_eth_speed(dev) == 100)
385 #define TX4939_ATA_REG_PHYS(ch) (TX4939_ATA_REG(ch) & 0xfffffffffULL)
388 static struct resource ata0_res[] = {
398 static struct resource ata1_res[] = {
412 .resource = ata0_res,
418 .resource = ata1_res,
425 TX4939_PCFG_ET1MODE |
453 unsigned char ch_mask,
unsigned char wide_mask)
475 for (i = 0; i < 2; i++) {
476 plat_data.
memcpy_chan = i ? memcpy_chan1 : memcpy_chan0;
494 if (tx4939_sram_resource.start)
506 .
name =
"tx4939-rng",
515 static void __init tx4939_stop_unused_modules(
void)
529 if ((pcfg & TX4939_PCFG_I2SMODE_MASK) !=
531 (pcfg & TX4939_PCFG_I2SMODE_MASK) !=
576 static int __init tx4939_late_init(
void)
580 tx4939_stop_unused_modules();