aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mv78xx0/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-mv78xx0/common.c')
-rw-r--r--arch/arm/mach-mv78xx0/common.c132
1 files changed, 131 insertions, 1 deletions
diff --git a/arch/arm/mach-mv78xx0/common.c b/arch/arm/mach-mv78xx0/common.c
index b0e4e0d8f506..a575daaa62d1 100644
--- a/arch/arm/mach-mv78xx0/common.c
+++ b/arch/arm/mach-mv78xx0/common.c
@@ -14,7 +14,9 @@
14#include <linux/serial_8250.h> 14#include <linux/serial_8250.h>
15#include <linux/mbus.h> 15#include <linux/mbus.h>
16#include <linux/mv643xx_eth.h> 16#include <linux/mv643xx_eth.h>
17#include <linux/mv643xx_i2c.h>
17#include <linux/ata_platform.h> 18#include <linux/ata_platform.h>
19#include <linux/ethtool.h>
18#include <asm/mach/map.h> 20#include <asm/mach/map.h>
19#include <asm/mach/time.h> 21#include <asm/mach/time.h>
20#include <mach/mv78xx0.h> 22#include <mach/mv78xx0.h>
@@ -430,9 +432,22 @@ static struct platform_device mv78xx0_ge10 = {
430 432
431void __init mv78xx0_ge10_init(struct mv643xx_eth_platform_data *eth_data) 433void __init mv78xx0_ge10_init(struct mv643xx_eth_platform_data *eth_data)
432{ 434{
435 u32 dev, rev;
436
433 eth_data->shared = &mv78xx0_ge10_shared; 437 eth_data->shared = &mv78xx0_ge10_shared;
434 mv78xx0_ge10.dev.platform_data = eth_data; 438 mv78xx0_ge10.dev.platform_data = eth_data;
435 439
440 /*
441 * On the Z0, ge10 and ge11 are internally connected back
442 * to back, and not brought out.
443 */
444 mv78xx0_pcie_id(&dev, &rev);
445 if (dev == MV78X00_Z0_DEV_ID) {
446 eth_data->phy_addr = MV643XX_ETH_PHY_NONE;
447 eth_data->speed = SPEED_1000;
448 eth_data->duplex = DUPLEX_FULL;
449 }
450
436 platform_device_register(&mv78xx0_ge10_shared); 451 platform_device_register(&mv78xx0_ge10_shared);
437 platform_device_register(&mv78xx0_ge10); 452 platform_device_register(&mv78xx0_ge10);
438} 453}
@@ -484,13 +499,101 @@ static struct platform_device mv78xx0_ge11 = {
484 499
485void __init mv78xx0_ge11_init(struct mv643xx_eth_platform_data *eth_data) 500void __init mv78xx0_ge11_init(struct mv643xx_eth_platform_data *eth_data)
486{ 501{
502 u32 dev, rev;
503
487 eth_data->shared = &mv78xx0_ge11_shared; 504 eth_data->shared = &mv78xx0_ge11_shared;
488 mv78xx0_ge11.dev.platform_data = eth_data; 505 mv78xx0_ge11.dev.platform_data = eth_data;
489 506
507 /*
508 * On the Z0, ge10 and ge11 are internally connected back
509 * to back, and not brought out.
510 */
511 mv78xx0_pcie_id(&dev, &rev);
512 if (dev == MV78X00_Z0_DEV_ID) {
513 eth_data->phy_addr = MV643XX_ETH_PHY_NONE;
514 eth_data->speed = SPEED_1000;
515 eth_data->duplex = DUPLEX_FULL;
516 }
517
490 platform_device_register(&mv78xx0_ge11_shared); 518 platform_device_register(&mv78xx0_ge11_shared);
491 platform_device_register(&mv78xx0_ge11); 519 platform_device_register(&mv78xx0_ge11);
492} 520}
493 521
522/*****************************************************************************
523 * I2C bus 0
524 ****************************************************************************/
525
526static struct mv64xxx_i2c_pdata mv78xx0_i2c_0_pdata = {
527 .freq_m = 8, /* assumes 166 MHz TCLK */
528 .freq_n = 3,
529 .timeout = 1000, /* Default timeout of 1 second */
530};
531
532static struct resource mv78xx0_i2c_0_resources[] = {
533 {
534 .name = "i2c 0 base",
535 .start = I2C_0_PHYS_BASE,
536 .end = I2C_0_PHYS_BASE + 0x1f,
537 .flags = IORESOURCE_MEM,
538 }, {
539 .name = "i2c 0 irq",
540 .start = IRQ_MV78XX0_I2C_0,
541 .end = IRQ_MV78XX0_I2C_0,
542 .flags = IORESOURCE_IRQ,
543 },
544};
545
546
547static struct platform_device mv78xx0_i2c_0 = {
548 .name = MV64XXX_I2C_CTLR_NAME,
549 .id = 0,
550 .num_resources = ARRAY_SIZE(mv78xx0_i2c_0_resources),
551 .resource = mv78xx0_i2c_0_resources,
552 .dev = {
553 .platform_data = &mv78xx0_i2c_0_pdata,
554 },
555};
556
557/*****************************************************************************
558 * I2C bus 1
559 ****************************************************************************/
560
561static struct mv64xxx_i2c_pdata mv78xx0_i2c_1_pdata = {
562 .freq_m = 8, /* assumes 166 MHz TCLK */
563 .freq_n = 3,
564 .timeout = 1000, /* Default timeout of 1 second */
565};
566
567static struct resource mv78xx0_i2c_1_resources[] = {
568 {
569 .name = "i2c 1 base",
570 .start = I2C_1_PHYS_BASE,
571 .end = I2C_1_PHYS_BASE + 0x1f,
572 .flags = IORESOURCE_MEM,
573 }, {
574 .name = "i2c 1 irq",
575 .start = IRQ_MV78XX0_I2C_1,
576 .end = IRQ_MV78XX0_I2C_1,
577 .flags = IORESOURCE_IRQ,
578 },
579};
580
581
582static struct platform_device mv78xx0_i2c_1 = {
583 .name = MV64XXX_I2C_CTLR_NAME,
584 .id = 1,
585 .num_resources = ARRAY_SIZE(mv78xx0_i2c_1_resources),
586 .resource = mv78xx0_i2c_1_resources,
587 .dev = {
588 .platform_data = &mv78xx0_i2c_1_pdata,
589 },
590};
591
592void __init mv78xx0_i2c_init(void)
593{
594 platform_device_register(&mv78xx0_i2c_0);
595 platform_device_register(&mv78xx0_i2c_1);
596}
494 597
495/***************************************************************************** 598/*****************************************************************************
496 * SATA 599 * SATA
@@ -719,6 +822,32 @@ struct sys_timer mv78xx0_timer = {
719/***************************************************************************** 822/*****************************************************************************
720 * General 823 * General
721 ****************************************************************************/ 824 ****************************************************************************/
825static char * __init mv78xx0_id(void)
826{
827 u32 dev, rev;
828
829 mv78xx0_pcie_id(&dev, &rev);
830
831 if (dev == MV78X00_Z0_DEV_ID) {
832 if (rev == MV78X00_REV_Z0)
833 return "MV78X00-Z0";
834 else
835 return "MV78X00-Rev-Unsupported";
836 } else if (dev == MV78100_DEV_ID) {
837 if (rev == MV78100_REV_A0)
838 return "MV78100-A0";
839 else
840 return "MV78100-Rev-Unsupported";
841 } else if (dev == MV78200_DEV_ID) {
842 if (rev == MV78100_REV_A0)
843 return "MV78200-A0";
844 else
845 return "MV78200-Rev-Unsupported";
846 } else {
847 return "Device-Unknown";
848 }
849}
850
722static int __init is_l2_writethrough(void) 851static int __init is_l2_writethrough(void)
723{ 852{
724 return !!(readl(CPU_CONTROL) & L2_WRITETHROUGH); 853 return !!(readl(CPU_CONTROL) & L2_WRITETHROUGH);
@@ -737,7 +866,8 @@ void __init mv78xx0_init(void)
737 get_pclk_l2clk(hclk, core_index, &pclk, &l2clk); 866 get_pclk_l2clk(hclk, core_index, &pclk, &l2clk);
738 tclk = get_tclk(); 867 tclk = get_tclk();
739 868
740 printk(KERN_INFO "MV78xx0 core #%d, ", core_index); 869 printk(KERN_INFO "%s ", mv78xx0_id());
870 printk("core #%d, ", core_index);
741 printk("PCLK = %dMHz, ", (pclk + 499999) / 1000000); 871 printk("PCLK = %dMHz, ", (pclk + 499999) / 1000000);
742 printk("L2 = %dMHz, ", (l2clk + 499999) / 1000000); 872 printk("L2 = %dMHz, ", (l2clk + 499999) / 1000000);
743 printk("HCLK = %dMHz, ", (hclk + 499999) / 1000000); 873 printk("HCLK = %dMHz, ", (hclk + 499999) / 1000000);