Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'davinci-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci

* 'davinci-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-davinci: (40 commits)
DaVinci DM365: Adding support for SPI EEPROM
DaVinci DM365: Adding DM365 SPI support
DaVinci DM355: Modifications to DM355 SPI support
DaVinci: SPI: Adding header file for SPI support.
davinci: dm646x: CDCE clocks: davinci_clk converted to clk_lookup
davinci: clkdev cleanup: remove clk_lookup wrapper, use clkdev_add_table()
DaVinci: DM365: Voice codec support for the DM365 SoC
davinci: clock: let clk->set_rate function sleep
Add SDA and SCL pin numbers to i2c platform data
davinci: da8xx/omap-l1xx: Add EDMA platform data for da850/omap-l138
davinci: build list of unused EDMA events dynamically
davinci: Fix edma_alloc_channel api for EDMA_CHANNEL_ANY case
davinci: Keep count of channel controllers on a platform
davinci: Correct return value of edma_alloc_channel api
davinci: add CDCE949 support on DM6467 EVM
davinci: add support for CDCE949 clock synthesizer
davinci: da850/omap-l138 EVM: register for suspend support
davinci: da850/omap-l138: add support for SoC suspend
davinci: add power management support
DaVinci: DM365: Changing default queue for DM365.
...

+1534 -295
+4
arch/arm/mach-davinci/Kconfig
··· 91 91 bool "TI DM6467 EVM" 92 92 default ARCH_DAVINCI_DM646x 93 93 depends on ARCH_DAVINCI_DM646x 94 + select MACH_DAVINCI_DM6467TEVM 94 95 help 95 96 Configure this option to specify the whether the board used 96 97 for development is a DM6467 EVM 98 + 99 + config MACH_DAVINCI_DM6467TEVM 100 + bool 97 101 98 102 config MACH_DAVINCI_DM365_EVM 99 103 bool "TI DM365 EVM"
+2 -1
arch/arm/mach-davinci/Makefile
··· 26 26 obj-$(CONFIG_MACH_NEUROS_OSD2) += board-neuros-osd2.o 27 27 obj-$(CONFIG_MACH_DAVINCI_DM355_EVM) += board-dm355-evm.o 28 28 obj-$(CONFIG_MACH_DM355_LEOPARD) += board-dm355-leopard.o 29 - obj-$(CONFIG_MACH_DAVINCI_DM6467_EVM) += board-dm646x-evm.o 29 + obj-$(CONFIG_MACH_DAVINCI_DM6467_EVM) += board-dm646x-evm.o cdce949.o 30 30 obj-$(CONFIG_MACH_DAVINCI_DM365_EVM) += board-dm365-evm.o 31 31 obj-$(CONFIG_MACH_DAVINCI_DA830_EVM) += board-da830-evm.o 32 32 obj-$(CONFIG_MACH_DAVINCI_DA850_EVM) += board-da850-evm.o ··· 34 34 # Power Management 35 35 obj-$(CONFIG_CPU_FREQ) += cpufreq.o 36 36 obj-$(CONFIG_CPU_IDLE) += cpuidle.o 37 + obj-$(CONFIG_SUSPEND) += pm.o sleep.o
+2 -2
arch/arm/mach-davinci/board-da830-evm.c
··· 112 112 * Set up USB clock/mode in the CFGCHIP2 register. 113 113 * FYI: CFGCHIP2 is 0x0000ef00 initially. 114 114 */ 115 - cfgchip2 = __raw_readl(DA8XX_SYSCFG_VIRT(DA8XX_CFGCHIP2_REG)); 115 + cfgchip2 = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG)); 116 116 117 117 /* USB2.0 PHY reference clock is 24 MHz */ 118 118 cfgchip2 &= ~CFGCHIP2_REFFREQ; ··· 139 139 cfgchip2 |= CFGCHIP2_SESENDEN | CFGCHIP2_VBDTCTEN; 140 140 #endif 141 141 142 - __raw_writel(cfgchip2, DA8XX_SYSCFG_VIRT(DA8XX_CFGCHIP2_REG)); 142 + __raw_writel(cfgchip2, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG)); 143 143 144 144 /* USB_REFCLKIN is not used. */ 145 145 ret = davinci_cfg_reg(DA830_USB0_DRVVBUS);
+32 -2
arch/arm/mach-davinci/board-da850-evm.c
··· 46 46 47 47 static struct mtd_partition da850_evm_norflash_partition[] = { 48 48 { 49 - .name = "NOR filesystem", 49 + .name = "bootloaders + env", 50 50 .offset = 0, 51 + .size = SZ_512K, 52 + .mask_flags = MTD_WRITEABLE, 53 + }, 54 + { 55 + .name = "kernel", 56 + .offset = MTDPART_OFS_APPEND, 57 + .size = SZ_2M, 58 + .mask_flags = 0, 59 + }, 60 + { 61 + .name = "filesystem", 62 + .offset = MTDPART_OFS_APPEND, 51 63 .size = MTDPART_SIZ_FULL, 52 64 .mask_flags = 0, 53 65 }, ··· 87 75 }, 88 76 .num_resources = 1, 89 77 .resource = da850_evm_norflash_resource, 78 + }; 79 + 80 + static struct davinci_pm_config da850_pm_pdata = { 81 + .sleepcount = 128, 82 + }; 83 + 84 + static struct platform_device da850_pm_device = { 85 + .name = "pm-davinci", 86 + .dev = { 87 + .platform_data = &da850_pm_pdata, 88 + }, 89 + .id = -1, 90 90 }; 91 91 92 92 /* DA850/OMAP-L138 EVM includes a 512 MByte large-page NAND flash ··· 143 119 .parts = da850_evm_nandflash_partition, 144 120 .nr_parts = ARRAY_SIZE(da850_evm_nandflash_partition), 145 121 .ecc_mode = NAND_ECC_HW, 122 + .ecc_bits = 4, 146 123 .options = NAND_USE_FLASH_BBT, 147 124 }; 148 125 ··· 562 537 if (!machine_is_davinci_da850_evm()) 563 538 return 0; 564 539 565 - cfg_chip3_base = DA8XX_SYSCFG_VIRT(DA8XX_CFGCHIP3_REG); 540 + cfg_chip3_base = DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG); 566 541 567 542 val = __raw_readl(cfg_chip3_base); 568 543 ··· 720 695 ret = da8xx_register_cpuidle(); 721 696 if (ret) 722 697 pr_warning("da850_evm_init: cpuidle registration failed: %d\n", 698 + ret); 699 + 700 + ret = da850_register_pm(&da850_pm_device); 701 + if (ret) 702 + pr_warning("da850_evm_init: suspend registration failed: %d\n", 723 703 ret); 724 704 } 725 705
+2
arch/arm/mach-davinci/board-dm355-evm.c
··· 111 111 static struct davinci_i2c_platform_data i2c_pdata = { 112 112 .bus_freq = 400 /* kHz */, 113 113 .bus_delay = 0 /* usec */, 114 + .sda_pin = 15, 115 + .scl_pin = 14, 114 116 }; 115 117 116 118 static struct snd_platform_data dm355_evm_snd_data;
+23
arch/arm/mach-davinci/board-dm365-evm.c
··· 24 24 #include <linux/mtd/partitions.h> 25 25 #include <linux/mtd/nand.h> 26 26 #include <linux/input.h> 27 + #include <linux/spi/spi.h> 28 + #include <linux/spi/eeprom.h> 27 29 28 30 #include <asm/mach-types.h> 29 31 #include <asm/mach/arch.h> ··· 573 571 dm365_init(); 574 572 } 575 573 574 + static struct spi_eeprom at25640 = { 575 + .byte_len = SZ_64K / 8, 576 + .name = "at25640", 577 + .page_size = 32, 578 + .flags = EE_ADDR2, 579 + }; 580 + 581 + static struct spi_board_info dm365_evm_spi_info[] __initconst = { 582 + { 583 + .modalias = "at25", 584 + .platform_data = &at25640, 585 + .max_speed_hz = 10 * 1000 * 1000, 586 + .bus_num = 0, 587 + .chip_select = 0, 588 + .mode = SPI_MODE_0, 589 + }, 590 + }; 591 + 576 592 static __init void dm365_evm_init(void) 577 593 { 578 594 evm_init_i2c(); ··· 607 587 dm365_init_asp(&dm365_evm_snd_data); 608 588 dm365_init_rtc(); 609 589 dm365_init_ks(&dm365evm_ks_data); 590 + 591 + dm365_init_spi0(BIT(0), dm365_evm_spi_info, 592 + ARRAY_SIZE(dm365_evm_spi_info)); 610 593 } 611 594 612 595 static __init void dm365_evm_irq_init(void)
+2
arch/arm/mach-davinci/board-dm644x-evm.c
··· 629 629 static struct davinci_i2c_platform_data i2c_pdata = { 630 630 .bus_freq = 20 /* kHz */, 631 631 .bus_delay = 100 /* usec */, 632 + .sda_pin = 44, 633 + .scl_pin = 43, 632 634 }; 633 635 634 636 static void __init evm_init_i2c(void)
+99 -44
arch/arm/mach-davinci/board-dm646x-evm.c
··· 30 30 #include <linux/mtd/mtd.h> 31 31 #include <linux/mtd/nand.h> 32 32 #include <linux/mtd/partitions.h> 33 + #include <linux/clk.h> 33 34 34 35 #include <asm/mach-types.h> 35 36 #include <asm/mach/arch.h> ··· 40 39 #include <mach/serial.h> 41 40 #include <mach/i2c.h> 42 41 #include <mach/nand.h> 42 + #include <mach/clock.h> 43 + #include <mach/cdce949.h> 43 44 44 - #if defined(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \ 45 - defined(CONFIG_BLK_DEV_PALMCHIP_BK3710_MODULE) 46 - #define HAS_ATA 1 47 - #else 48 - #define HAS_ATA 0 49 - #endif 50 - 51 - #define DAVINCI_ASYNC_EMIF_CONTROL_BASE 0x20008000 52 - #define DAVINCI_ASYNC_EMIF_DATA_CE0_BASE 0x42000000 45 + #include "clock.h" 53 46 54 47 #define NAND_BLOCK_SIZE SZ_128K 55 - 56 - /* CPLD Register 0 bits to control ATA */ 57 - #define DM646X_EVM_ATA_RST BIT(0) 58 - #define DM646X_EVM_ATA_PWD BIT(1) 59 - 60 - #define DM646X_EVM_PHY_MASK (0x2) 61 - #define DM646X_EVM_MDIO_FREQUENCY (2200000) /* PHY bus frequency */ 62 - 63 - #define VIDCLKCTL_OFFSET (DAVINCI_SYSTEM_MODULE_BASE + 0x38) 64 - #define VSCLKDIS_OFFSET (DAVINCI_SYSTEM_MODULE_BASE + 0x6c) 65 - #define VCH2CLK_MASK (BIT_MASK(10) | BIT_MASK(9) | BIT_MASK(8)) 66 - #define VCH2CLK_SYSCLK8 (BIT(9)) 67 - #define VCH2CLK_AUXCLK (BIT(9) | BIT(8)) 68 - #define VCH3CLK_MASK (BIT_MASK(14) | BIT_MASK(13) | BIT_MASK(12)) 69 - #define VCH3CLK_SYSCLK8 (BIT(13)) 70 - #define VCH3CLK_AUXCLK (BIT(14) | BIT(13)) 71 - 72 - #define VIDCH2CLK (BIT(10)) 73 - #define VIDCH3CLK (BIT(11)) 74 - #define VIDCH1CLK (BIT(4)) 75 - #define TVP7002_INPUT (BIT(4)) 76 - #define TVP5147_INPUT (~BIT(4)) 77 - #define VPIF_INPUT_ONE_CHANNEL (BIT(5)) 78 - #define VPIF_INPUT_TWO_CHANNEL (~BIT(5)) 79 - #define TVP5147_CH0 "tvp514x-0" 80 - #define TVP5147_CH1 "tvp514x-1" 81 - 82 - static void __iomem *vpif_vidclkctl_reg; 83 - static void __iomem *vpif_vsclkdis_reg; 84 - /* spin lock for updating above registers */ 85 - static spinlock_t vpif_reg_lock; 86 - 87 - static struct davinci_uart_config uart_config __initdata = { 88 - .enabled_uarts = (1 << 0), 89 - }; 90 48 91 49 /* Note: We are setting first partition as 'bootloader' constituting UBL, U-Boot 92 50 * and U-Boot environment this avoids dependency on any particular combination ··· 80 120 .options = 0, 81 121 }; 82 122 123 + #define DAVINCI_ASYNC_EMIF_CONTROL_BASE 0x20008000 124 + #define DAVINCI_ASYNC_EMIF_DATA_CE0_BASE 0x42000000 125 + 83 126 static struct resource davinci_nand_resources[] = { 84 127 { 85 128 .start = DAVINCI_ASYNC_EMIF_DATA_CE0_BASE, ··· 106 143 .platform_data = &davinci_nand_data, 107 144 }, 108 145 }; 146 + 147 + #if defined(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \ 148 + defined(CONFIG_BLK_DEV_PALMCHIP_BK3710_MODULE) 149 + #define HAS_ATA 1 150 + #else 151 + #define HAS_ATA 0 152 + #endif 153 + 154 + /* CPLD Register 0 bits to control ATA */ 155 + #define DM646X_EVM_ATA_RST BIT(0) 156 + #define DM646X_EVM_ATA_PWD BIT(1) 109 157 110 158 /* CPLD Register 0 Client: used for I/O Control */ 111 159 static int cpld_reg0_probe(struct i2c_client *client, ··· 391 417 { 392 418 I2C_BOARD_INFO("cpld_video", 0x3b), 393 419 }, 420 + { 421 + I2C_BOARD_INFO("cdce949", 0x6c), 422 + }, 394 423 }; 395 424 396 425 static struct davinci_i2c_platform_data i2c_pdata = { 397 426 .bus_freq = 100 /* kHz */, 398 427 .bus_delay = 0 /* usec */, 399 428 }; 429 + 430 + #define VIDCLKCTL_OFFSET (DAVINCI_SYSTEM_MODULE_BASE + 0x38) 431 + #define VSCLKDIS_OFFSET (DAVINCI_SYSTEM_MODULE_BASE + 0x6c) 432 + #define VCH2CLK_MASK (BIT_MASK(10) | BIT_MASK(9) | BIT_MASK(8)) 433 + #define VCH2CLK_SYSCLK8 (BIT(9)) 434 + #define VCH2CLK_AUXCLK (BIT(9) | BIT(8)) 435 + #define VCH3CLK_MASK (BIT_MASK(14) | BIT_MASK(13) | BIT_MASK(12)) 436 + #define VCH3CLK_SYSCLK8 (BIT(13)) 437 + #define VCH3CLK_AUXCLK (BIT(14) | BIT(13)) 438 + 439 + #define VIDCH2CLK (BIT(10)) 440 + #define VIDCH3CLK (BIT(11)) 441 + #define VIDCH1CLK (BIT(4)) 442 + #define TVP7002_INPUT (BIT(4)) 443 + #define TVP5147_INPUT (~BIT(4)) 444 + #define VPIF_INPUT_ONE_CHANNEL (BIT(5)) 445 + #define VPIF_INPUT_TWO_CHANNEL (~BIT(5)) 446 + #define TVP5147_CH0 "tvp514x-0" 447 + #define TVP5147_CH1 "tvp514x-1" 448 + 449 + static void __iomem *vpif_vidclkctl_reg; 450 + static void __iomem *vpif_vsclkdis_reg; 451 + /* spin lock for updating above registers */ 452 + static spinlock_t vpif_reg_lock; 400 453 401 454 static int set_vpif_clock(int mux_mode, int hd) 402 455 { ··· 686 685 evm_init_video(); 687 686 } 688 687 688 + #define CDCE949_XIN_RATE 27000000 689 + 690 + /* CDCE949 support - "lpsc" field is overridden to work as clock number */ 691 + static struct clk cdce_clk_in = { 692 + .name = "cdce_xin", 693 + .rate = CDCE949_XIN_RATE, 694 + }; 695 + 696 + static struct clk_lookup cdce_clks[] = { 697 + CLK(NULL, "xin", &cdce_clk_in), 698 + CLK(NULL, NULL, NULL), 699 + }; 700 + 701 + static void __init cdce_clk_init(void) 702 + { 703 + struct clk_lookup *c; 704 + struct clk *clk; 705 + 706 + for (c = cdce_clks; c->clk; c++) { 707 + clk = c->clk; 708 + clkdev_add(c); 709 + clk_register(clk); 710 + } 711 + } 712 + 689 713 static void __init davinci_map_io(void) 690 714 { 691 715 dm646x_init(); 716 + cdce_clk_init(); 692 717 } 718 + 719 + static struct davinci_uart_config uart_config __initdata = { 720 + .enabled_uarts = (1 << 0), 721 + }; 722 + 723 + #define DM646X_EVM_PHY_MASK (0x2) 724 + #define DM646X_EVM_MDIO_FREQUENCY (2200000) /* PHY bus frequency */ 693 725 694 726 static __init void evm_init(void) 695 727 { ··· 747 713 davinci_irq_init(); 748 714 } 749 715 716 + #define DM646X_EVM_REF_FREQ 27000000 717 + #define DM6467T_EVM_REF_FREQ 33000000 718 + 719 + void __init dm646x_board_setup_refclk(struct clk *clk) 720 + { 721 + if (machine_is_davinci_dm6467tevm()) 722 + clk->rate = DM6467T_EVM_REF_FREQ; 723 + else 724 + clk->rate = DM646X_EVM_REF_FREQ; 725 + } 726 + 750 727 MACHINE_START(DAVINCI_DM6467_EVM, "DaVinci DM646x EVM") 728 + .phys_io = IO_PHYS, 729 + .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc, 730 + .boot_params = (0x80000100), 731 + .map_io = davinci_map_io, 732 + .init_irq = davinci_dm646x_evm_irq_init, 733 + .timer = &davinci_timer, 734 + .init_machine = evm_init, 735 + MACHINE_END 736 + 737 + MACHINE_START(DAVINCI_DM6467TEVM, "DaVinci DM6467T EVM") 751 738 .phys_io = IO_PHYS, 752 739 .io_pg_offst = (__IO_ADDRESS(IO_PHYS) >> 18) & 0xfffc, 753 740 .boot_params = (0x80000100),
+293
arch/arm/mach-davinci/cdce949.c
··· 1 + /* 2 + * TI CDCE949 clock synthesizer driver 3 + * 4 + * Note: This implementation assumes an input of 27MHz to the CDCE. 5 + * This is by no means constrained by CDCE hardware although the datasheet 6 + * does use this as an example for all illustrations and more importantly: 7 + * that is the crystal input on boards it is currently used on. 8 + * 9 + * Copyright (C) 2009 Texas Instruments Incorporated. http://www.ti.com/ 10 + * 11 + * This program is free software; you can redistribute it and/or modify 12 + * it under the terms of the GNU General Public License version 2 as 13 + * published by the Free Software Foundation. 14 + * 15 + */ 16 + #include <linux/kernel.h> 17 + #include <linux/clk.h> 18 + #include <linux/platform_device.h> 19 + #include <linux/i2c.h> 20 + 21 + #include <mach/clock.h> 22 + 23 + #include "clock.h" 24 + 25 + static struct i2c_client *cdce_i2c_client; 26 + static DEFINE_MUTEX(cdce_mutex); 27 + 28 + /* CDCE register descriptor */ 29 + struct cdce_reg { 30 + u8 addr; 31 + u8 val; 32 + }; 33 + 34 + /* Per-Output (Y1, Y2 etc.) frequency descriptor */ 35 + struct cdce_freq { 36 + /* Frequency in KHz */ 37 + unsigned long frequency; 38 + /* 39 + * List of registers to program to obtain a particular frequency. 40 + * 0x0 in register address and value is the end of list marker. 41 + */ 42 + struct cdce_reg *reglist; 43 + }; 44 + 45 + #define CDCE_FREQ_TABLE_ENTRY(line, out) \ 46 + { \ 47 + .reglist = cdce_y ##line## _ ##out, \ 48 + .frequency = out, \ 49 + } 50 + 51 + /* List of CDCE outputs */ 52 + struct cdce_output { 53 + /* List of frequencies on this output */ 54 + struct cdce_freq *freq_table; 55 + /* Number of possible frequencies */ 56 + int size; 57 + }; 58 + 59 + /* 60 + * Finding out the values to program into CDCE949 registers for a particular 61 + * frequency output is not a simple calculation. Have a look at the datasheet 62 + * for the details. There is desktop software available to help users with 63 + * the calculations. Here, we just depend on the output of that software 64 + * (or hand calculations) instead trying to runtime calculate the register 65 + * values and inflicting misery on ourselves. 66 + */ 67 + static struct cdce_reg cdce_y1_148500[] = { 68 + { 0x13, 0x00 }, 69 + /* program PLL1_0 multiplier */ 70 + { 0x18, 0xaf }, 71 + { 0x19, 0x50 }, 72 + { 0x1a, 0x02 }, 73 + { 0x1b, 0xc9 }, 74 + /* program PLL1_11 multiplier */ 75 + { 0x1c, 0x00 }, 76 + { 0x1d, 0x40 }, 77 + { 0x1e, 0x02 }, 78 + { 0x1f, 0xc9 }, 79 + /* output state selection */ 80 + { 0x15, 0x00 }, 81 + { 0x14, 0xef }, 82 + /* switch MUX to PLL1 output */ 83 + { 0x14, 0x6f }, 84 + { 0x16, 0x06 }, 85 + /* set P2DIV divider, P3DIV and input crystal */ 86 + { 0x17, 0x06 }, 87 + { 0x01, 0x00 }, 88 + { 0x05, 0x48 }, 89 + { 0x02, 0x80 }, 90 + /* enable and disable PLL */ 91 + { 0x02, 0xbc }, 92 + { 0x03, 0x01 }, 93 + { }, 94 + }; 95 + 96 + static struct cdce_reg cdce_y1_74250[] = { 97 + { 0x13, 0x00 }, 98 + { 0x18, 0xaf }, 99 + { 0x19, 0x50 }, 100 + { 0x1a, 0x02 }, 101 + { 0x1b, 0xc9 }, 102 + { 0x1c, 0x00 }, 103 + { 0x1d, 0x40 }, 104 + { 0x1e, 0x02 }, 105 + { 0x1f, 0xc9 }, 106 + /* output state selection */ 107 + { 0x15, 0x00 }, 108 + { 0x14, 0xef }, 109 + /* switch MUX to PLL1 output */ 110 + { 0x14, 0x6f }, 111 + { 0x16, 0x06 }, 112 + /* set P2DIV divider, P3DIV and input crystal */ 113 + { 0x17, 0x06 }, 114 + { 0x01, 0x00 }, 115 + { 0x05, 0x48 }, 116 + { 0x02, 0x80 }, 117 + /* enable and disable PLL */ 118 + { 0x02, 0xbc }, 119 + { 0x03, 0x02 }, 120 + { }, 121 + }; 122 + 123 + static struct cdce_reg cdce_y1_27000[] = { 124 + { 0x13, 0x00 }, 125 + { 0x18, 0x00 }, 126 + { 0x19, 0x40 }, 127 + { 0x1a, 0x02 }, 128 + { 0x1b, 0x08 }, 129 + { 0x1c, 0x00 }, 130 + { 0x1d, 0x40 }, 131 + { 0x1e, 0x02 }, 132 + { 0x1f, 0x08 }, 133 + { 0x15, 0x02 }, 134 + { 0x14, 0xed }, 135 + { 0x16, 0x01 }, 136 + { 0x17, 0x01 }, 137 + { 0x01, 0x00 }, 138 + { 0x05, 0x50 }, 139 + { 0x02, 0xb4 }, 140 + { 0x03, 0x01 }, 141 + { }, 142 + }; 143 + 144 + static struct cdce_freq cdce_y1_freqs[] = { 145 + CDCE_FREQ_TABLE_ENTRY(1, 148500), 146 + CDCE_FREQ_TABLE_ENTRY(1, 74250), 147 + CDCE_FREQ_TABLE_ENTRY(1, 27000), 148 + }; 149 + 150 + static struct cdce_reg cdce_y5_13500[] = { 151 + { 0x27, 0x08 }, 152 + { 0x28, 0x00 }, 153 + { 0x29, 0x40 }, 154 + { 0x2a, 0x02 }, 155 + { 0x2b, 0x08 }, 156 + { 0x24, 0x6f }, 157 + { }, 158 + }; 159 + 160 + static struct cdce_reg cdce_y5_16875[] = { 161 + { 0x27, 0x08 }, 162 + { 0x28, 0x9f }, 163 + { 0x29, 0xb0 }, 164 + { 0x2a, 0x02 }, 165 + { 0x2b, 0x89 }, 166 + { 0x24, 0x6f }, 167 + { }, 168 + }; 169 + 170 + static struct cdce_reg cdce_y5_27000[] = { 171 + { 0x27, 0x04 }, 172 + { 0x28, 0x00 }, 173 + { 0x29, 0x40 }, 174 + { 0x2a, 0x02 }, 175 + { 0x2b, 0x08 }, 176 + { 0x24, 0x6f }, 177 + { }, 178 + }; 179 + static struct cdce_reg cdce_y5_54000[] = { 180 + { 0x27, 0x04 }, 181 + { 0x28, 0xff }, 182 + { 0x29, 0x80 }, 183 + { 0x2a, 0x02 }, 184 + { 0x2b, 0x07 }, 185 + { 0x24, 0x6f }, 186 + { }, 187 + }; 188 + 189 + static struct cdce_reg cdce_y5_81000[] = { 190 + { 0x27, 0x02 }, 191 + { 0x28, 0xbf }, 192 + { 0x29, 0xa0 }, 193 + { 0x2a, 0x03 }, 194 + { 0x2b, 0x0a }, 195 + { 0x24, 0x6f }, 196 + { }, 197 + }; 198 + 199 + static struct cdce_freq cdce_y5_freqs[] = { 200 + CDCE_FREQ_TABLE_ENTRY(5, 13500), 201 + CDCE_FREQ_TABLE_ENTRY(5, 16875), 202 + CDCE_FREQ_TABLE_ENTRY(5, 27000), 203 + CDCE_FREQ_TABLE_ENTRY(5, 54000), 204 + CDCE_FREQ_TABLE_ENTRY(5, 81000), 205 + }; 206 + 207 + 208 + static struct cdce_output output_list[] = { 209 + [1] = { cdce_y1_freqs, ARRAY_SIZE(cdce_y1_freqs) }, 210 + [5] = { cdce_y5_freqs, ARRAY_SIZE(cdce_y5_freqs) }, 211 + }; 212 + 213 + int cdce_set_rate(struct clk *clk, unsigned long rate) 214 + { 215 + int i, ret = 0; 216 + struct cdce_freq *freq_table = output_list[clk->lpsc].freq_table; 217 + struct cdce_reg *regs = NULL; 218 + 219 + if (!cdce_i2c_client) 220 + return -ENODEV; 221 + 222 + if (!freq_table) 223 + return -EINVAL; 224 + 225 + for (i = 0; i < output_list[clk->lpsc].size; i++) { 226 + if (freq_table[i].frequency == rate / 1000) { 227 + regs = freq_table[i].reglist; 228 + break; 229 + } 230 + } 231 + 232 + if (!regs) 233 + return -EINVAL; 234 + 235 + mutex_lock(&cdce_mutex); 236 + for (i = 0; regs[i].addr; i++) { 237 + ret = i2c_smbus_write_byte_data(cdce_i2c_client, 238 + regs[i].addr | 0x80, regs[i].val); 239 + if (ret) 240 + break; 241 + } 242 + mutex_unlock(&cdce_mutex); 243 + 244 + if (!ret) 245 + clk->rate = rate; 246 + 247 + return ret; 248 + } 249 + 250 + static int cdce_probe(struct i2c_client *client, 251 + const struct i2c_device_id *id) 252 + { 253 + cdce_i2c_client = client; 254 + return 0; 255 + } 256 + 257 + static int __devexit cdce_remove(struct i2c_client *client) 258 + { 259 + cdce_i2c_client = NULL; 260 + return 0; 261 + } 262 + 263 + static const struct i2c_device_id cdce_id[] = { 264 + {"cdce949", 0}, 265 + {}, 266 + }; 267 + MODULE_DEVICE_TABLE(i2c, cdce_id); 268 + 269 + static struct i2c_driver cdce_driver = { 270 + .driver = { 271 + .owner = THIS_MODULE, 272 + .name = "cdce949", 273 + }, 274 + .probe = cdce_probe, 275 + .remove = __devexit_p(cdce_remove), 276 + .id_table = cdce_id, 277 + }; 278 + 279 + static int __init cdce_init(void) 280 + { 281 + return i2c_add_driver(&cdce_driver); 282 + } 283 + subsys_initcall(cdce_init); 284 + 285 + static void __exit cdce_exit(void) 286 + { 287 + i2c_del_driver(&cdce_driver); 288 + } 289 + module_exit(cdce_exit); 290 + 291 + MODULE_AUTHOR("Texas Instruments"); 292 + MODULE_DESCRIPTION("CDCE949 clock synthesizer driver"); 293 + MODULE_LICENSE("GPL v2");
+39 -54
arch/arm/mach-davinci/clock.c
··· 49 49 { 50 50 if (WARN_ON(clk->usecount == 0)) 51 51 return; 52 - if (--clk->usecount == 0 && !(clk->flags & CLK_PLL)) 52 + if (--clk->usecount == 0 && !(clk->flags & CLK_PLL) && 53 + (clk->flags & CLK_PSC)) 53 54 davinci_psc_config(psc_domain(clk), clk->gpsc, clk->lpsc, 0); 54 55 if (clk->parent) 55 56 __clk_disable(clk->parent); ··· 125 124 if (clk == NULL || IS_ERR(clk)) 126 125 return ret; 127 126 128 - spin_lock_irqsave(&clockfw_lock, flags); 129 127 if (clk->set_rate) 130 128 ret = clk->set_rate(clk, rate); 129 + 130 + spin_lock_irqsave(&clockfw_lock, flags); 131 131 if (ret == 0) { 132 132 if (clk->recalc) 133 133 clk->rate = clk->recalc(clk); ··· 365 363 { 366 364 u32 ctrl; 367 365 unsigned int locktime; 366 + unsigned long flags; 368 367 369 368 if (pll->base == NULL) 370 369 return -EINVAL; ··· 379 376 locktime = ((2000 * prediv) / 100); 380 377 prediv = (prediv - 1) | PLLDIV_EN; 381 378 } else { 382 - locktime = 20; 379 + locktime = PLL_LOCK_TIME; 383 380 } 384 381 if (postdiv) 385 382 postdiv = (postdiv - 1) | PLLDIV_EN; 386 383 if (mult) 387 384 mult = mult - 1; 385 + 386 + /* Protect against simultaneous calls to PLL setting seqeunce */ 387 + spin_lock_irqsave(&clockfw_lock, flags); 388 388 389 389 ctrl = __raw_readl(pll->base + PLLCTL); 390 390 ··· 395 389 ctrl &= ~(PLLCTL_PLLENSRC | PLLCTL_PLLEN); 396 390 __raw_writel(ctrl, pll->base + PLLCTL); 397 391 398 - /* 399 - * Wait for 4 OSCIN/CLKIN cycles to ensure that the PLLC has switched 400 - * to bypass mode. Delay of 1us ensures we are good for all > 4MHz 401 - * OSCIN/CLKIN inputs. Typically the input is ~25MHz. 402 - */ 403 - udelay(1); 392 + udelay(PLL_BYPASS_TIME); 404 393 405 394 /* Reset and enable PLL */ 406 395 ctrl &= ~(PLLCTL_PLLRST | PLLCTL_PLLDIS); ··· 409 408 if (pll->flags & PLL_HAS_POSTDIV) 410 409 __raw_writel(postdiv, pll->base + POSTDIV); 411 410 412 - /* 413 - * Wait for PLL to reset properly, OMAP-L138 datasheet says 414 - * 'min' time = 125ns 415 - */ 416 - udelay(1); 411 + udelay(PLL_RESET_TIME); 417 412 418 413 /* Bring PLL out of reset */ 419 414 ctrl |= PLLCTL_PLLRST; ··· 421 424 ctrl |= PLLCTL_PLLEN; 422 425 __raw_writel(ctrl, pll->base + PLLCTL); 423 426 427 + spin_unlock_irqrestore(&clockfw_lock, flags); 428 + 424 429 return 0; 425 430 } 426 431 EXPORT_SYMBOL(davinci_set_pllrate); 427 432 428 - int __init davinci_clk_init(struct davinci_clk *clocks) 433 + int __init davinci_clk_init(struct clk_lookup *clocks) 429 434 { 430 - struct davinci_clk *c; 435 + struct clk_lookup *c; 431 436 struct clk *clk; 437 + size_t num_clocks = 0; 432 438 433 - for (c = clocks; c->lk.clk; c++) { 434 - clk = c->lk.clk; 439 + for (c = clocks; c->clk; c++) { 440 + clk = c->clk; 435 441 436 442 if (!clk->recalc) { 437 443 ··· 457 457 if (clk->lpsc) 458 458 clk->flags |= CLK_PSC; 459 459 460 - clkdev_add(&c->lk); 461 460 clk_register(clk); 461 + num_clocks++; 462 462 463 463 /* Turn on clocks that Linux doesn't otherwise manage */ 464 464 if (clk->flags & ALWAYS_ENABLED) 465 465 clk_enable(clk); 466 466 } 467 467 468 + clkdev_add_table(clocks, num_clocks); 469 + 468 470 return 0; 469 471 } 470 472 471 - #ifdef CONFIG_PROC_FS 472 - #include <linux/proc_fs.h> 473 + #ifdef CONFIG_DEBUG_FS 474 + 475 + #include <linux/debugfs.h> 473 476 #include <linux/seq_file.h> 474 - 475 - static void *davinci_ck_start(struct seq_file *m, loff_t *pos) 476 - { 477 - return *pos < 1 ? (void *)1 : NULL; 478 - } 479 - 480 - static void *davinci_ck_next(struct seq_file *m, void *v, loff_t *pos) 481 - { 482 - ++*pos; 483 - return NULL; 484 - } 485 - 486 - static void davinci_ck_stop(struct seq_file *m, void *v) 487 - { 488 - } 489 477 490 478 #define CLKNAME_MAX 10 /* longest clock name */ 491 479 #define NEST_DELTA 2 ··· 513 525 514 526 static int davinci_ck_show(struct seq_file *m, void *v) 515 527 { 516 - /* Show clock tree; we know the main oscillator is first. 517 - * We trust nonzero usecounts equate to PSC enables... 528 + struct clk *clk; 529 + 530 + /* 531 + * Show clock tree; We trust nonzero usecounts equate to PSC enables... 518 532 */ 519 533 mutex_lock(&clocks_mutex); 520 - if (!list_empty(&clocks)) 521 - dump_clock(m, 0, list_first_entry(&clocks, struct clk, node)); 534 + list_for_each_entry(clk, &clocks, node) 535 + if (!clk->parent) 536 + dump_clock(m, 0, clk); 522 537 mutex_unlock(&clocks_mutex); 523 538 524 539 return 0; 525 540 } 526 541 527 - static const struct seq_operations davinci_ck_op = { 528 - .start = davinci_ck_start, 529 - .next = davinci_ck_next, 530 - .stop = davinci_ck_stop, 531 - .show = davinci_ck_show 532 - }; 533 - 534 542 static int davinci_ck_open(struct inode *inode, struct file *file) 535 543 { 536 - return seq_open(file, &davinci_ck_op); 544 + return single_open(file, davinci_ck_show, NULL); 537 545 } 538 546 539 - static const struct file_operations proc_davinci_ck_operations = { 547 + static const struct file_operations davinci_ck_operations = { 540 548 .open = davinci_ck_open, 541 549 .read = seq_read, 542 550 .llseek = seq_lseek, 543 - .release = seq_release, 551 + .release = single_release, 544 552 }; 545 553 546 - static int __init davinci_ck_proc_init(void) 554 + static int __init davinci_clk_debugfs_init(void) 547 555 { 548 - proc_create("davinci_clocks", 0, NULL, &proc_davinci_ck_operations); 556 + debugfs_create_file("davinci_clocks", S_IFREG | S_IRUGO, NULL, NULL, 557 + &davinci_ck_operations); 549 558 return 0; 550 559 551 560 } 552 - __initcall(davinci_ck_proc_init); 553 - #endif /* CONFIG_DEBUG_PROC_FS */ 561 + device_initcall(davinci_clk_debugfs_init); 562 + #endif /* CONFIG_DEBUG_FS */
+29 -16
arch/arm/mach-davinci/clock.h
··· 12 12 #ifndef __ARCH_ARM_DAVINCI_CLOCK_H 13 13 #define __ARCH_ARM_DAVINCI_CLOCK_H 14 14 15 - #include <linux/list.h> 16 - #include <asm/clkdev.h> 17 - 18 15 #define DAVINCI_PLL1_BASE 0x01c40800 19 16 #define DAVINCI_PLL2_BASE 0x01c40c00 20 17 #define MAX_PLL 2 ··· 50 53 #define PLLDIV_EN BIT(15) 51 54 #define PLLDIV_RATIO_MASK 0x1f 52 55 56 + /* 57 + * OMAP-L138 system reference guide recommends a wait for 4 OSCIN/CLKIN 58 + * cycles to ensure that the PLLC has switched to bypass mode. Delay of 1us 59 + * ensures we are good for all > 4MHz OSCIN/CLKIN inputs. Typically the input 60 + * is ~25MHz. Units are micro seconds. 61 + */ 62 + #define PLL_BYPASS_TIME 1 63 + /* From OMAP-L138 datasheet table 6-4. Units are micro seconds */ 64 + #define PLL_RESET_TIME 1 65 + /* 66 + * From OMAP-L138 datasheet table 6-4; assuming prediv = 1, sqrt(pllm) = 4 67 + * Units are micro seconds. 68 + */ 69 + #define PLL_LOCK_TIME 20 70 + 71 + #ifndef __ASSEMBLER__ 72 + 73 + #include <linux/list.h> 74 + #include <asm/clkdev.h> 75 + 53 76 struct pll_data { 54 77 u32 phys_base; 55 78 void __iomem *base; ··· 106 89 #define CLK_PLL BIT(4) /* PLL-derived clock */ 107 90 #define PRE_PLL BIT(5) /* source is before PLL mult/div */ 108 91 109 - struct davinci_clk { 110 - struct clk_lookup lk; 111 - }; 92 + #define CLK(dev, con, ck) \ 93 + { \ 94 + .dev_id = dev, \ 95 + .con_id = con, \ 96 + .clk = ck, \ 97 + } \ 112 98 113 - #define CLK(dev, con, ck) \ 114 - { \ 115 - .lk = { \ 116 - .dev_id = dev, \ 117 - .con_id = con, \ 118 - .clk = ck, \ 119 - }, \ 120 - } 121 - 122 - int davinci_clk_init(struct davinci_clk *clocks); 99 + int davinci_clk_init(struct clk_lookup *clocks); 123 100 int davinci_set_pllrate(struct pll_data *pll, unsigned int prediv, 124 101 unsigned int mult, unsigned int postdiv); 125 102 126 103 extern struct platform_device davinci_wdt_device; 104 + 105 + #endif 127 106 128 107 #endif
+1 -1
arch/arm/mach-davinci/common.c
··· 11 11 #include <linux/module.h> 12 12 #include <linux/io.h> 13 13 #include <linux/etherdevice.h> 14 + #include <linux/davinci_emac.h> 14 15 15 16 #include <asm/tlb.h> 16 17 #include <asm/mach/map.h> 17 18 18 19 #include <mach/common.h> 19 20 #include <mach/cputype.h> 20 - #include <mach/emac.h> 21 21 22 22 #include "clock.h" 23 23
+5 -33
arch/arm/mach-davinci/cpuidle.c
··· 19 19 #include <asm/proc-fns.h> 20 20 21 21 #include <mach/cpuidle.h> 22 + #include <mach/memory.h> 22 23 23 24 #define DAVINCI_CPUIDLE_MAX_STATES 2 24 25 ··· 39 38 40 39 static DEFINE_PER_CPU(struct cpuidle_device, davinci_cpuidle_device); 41 40 static void __iomem *ddr2_reg_base; 42 - 43 - #define DDR2_SDRCR_OFFSET 0xc 44 - #define DDR2_SRPD_BIT BIT(23) 45 - #define DDR2_LPMODEN_BIT BIT(31) 46 41 47 42 static void davinci_save_ddr_power(int enter, bool pdown) 48 43 { ··· 106 109 int ret; 107 110 struct cpuidle_device *device; 108 111 struct davinci_cpuidle_config *pdata = pdev->dev.platform_data; 109 - struct resource *ddr2_regs; 110 - resource_size_t len; 111 112 112 113 device = &per_cpu(davinci_cpuidle_device, smp_processor_id()); 113 114 ··· 114 119 return -ENOENT; 115 120 } 116 121 117 - ddr2_regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); 118 - if (!ddr2_regs) { 119 - dev_err(&pdev->dev, "cannot get DDR2 controller register base"); 120 - return -ENODEV; 121 - } 122 - 123 - len = resource_size(ddr2_regs); 124 - 125 - ddr2_regs = request_mem_region(ddr2_regs->start, len, ddr2_regs->name); 126 - if (!ddr2_regs) 127 - return -EBUSY; 128 - 129 - ddr2_reg_base = ioremap(ddr2_regs->start, len); 130 - if (!ddr2_reg_base) { 131 - ret = -ENOMEM; 132 - goto ioremap_fail; 133 - } 122 + ddr2_reg_base = pdata->ddr2_ctlr_base; 134 123 135 124 ret = cpuidle_register_driver(&davinci_idle_driver); 136 125 if (ret) { 137 126 dev_err(&pdev->dev, "failed to register driver\n"); 138 - goto driver_register_fail; 127 + return ret; 139 128 } 140 129 141 130 /* Wait for interrupt state */ ··· 146 167 ret = cpuidle_register_device(device); 147 168 if (ret) { 148 169 dev_err(&pdev->dev, "failed to register device\n"); 149 - goto device_register_fail; 170 + cpuidle_unregister_driver(&davinci_idle_driver); 171 + return ret; 150 172 } 151 173 152 174 return 0; 153 - 154 - device_register_fail: 155 - cpuidle_unregister_driver(&davinci_idle_driver); 156 - driver_register_fail: 157 - iounmap(ddr2_reg_base); 158 - ioremap_fail: 159 - release_mem_region(ddr2_regs->start, len); 160 - return ret; 161 175 } 162 176 163 177 static struct platform_driver davinci_cpuidle_driver = {
+5 -5
arch/arm/mach-davinci/da830.c
··· 371 371 .parent = &pll0_sysclk7, 372 372 }; 373 373 374 - static struct davinci_clk da830_clks[] = { 374 + static struct clk_lookup da830_clks[] = { 375 375 CLK(NULL, "ref", &ref_clk), 376 376 CLK(NULL, "pll0", &pll0_clk), 377 377 CLK(NULL, "pll0_aux", &pll0_aux_clk), ··· 1208 1208 1209 1209 void __init da830_init(void) 1210 1210 { 1211 - da8xx_syscfg_base = ioremap(DA8XX_SYSCFG_BASE, SZ_4K); 1212 - if (WARN(!da8xx_syscfg_base, "Unable to map syscfg module")) 1211 + da8xx_syscfg0_base = ioremap(DA8XX_SYSCFG0_BASE, SZ_4K); 1212 + if (WARN(!da8xx_syscfg0_base, "Unable to map syscfg0 module")) 1213 1213 return; 1214 1214 1215 1215 davinci_soc_info_da830.jtag_id_base = 1216 - DA8XX_SYSCFG_VIRT(DA8XX_JTAG_ID_REG); 1217 - davinci_soc_info_da830.pinmux_base = DA8XX_SYSCFG_VIRT(0x120); 1216 + DA8XX_SYSCFG0_VIRT(DA8XX_JTAG_ID_REG); 1217 + davinci_soc_info_da830.pinmux_base = DA8XX_SYSCFG0_VIRT(0x120); 1218 1218 1219 1219 davinci_common_init(&davinci_soc_info_da830); 1220 1220 }
+74 -16
arch/arm/mach-davinci/da850.c
··· 26 26 #include <mach/time.h> 27 27 #include <mach/da8xx.h> 28 28 #include <mach/cpufreq.h> 29 + #include <mach/pm.h> 29 30 30 31 #include "clock.h" 31 32 #include "mux.h" ··· 41 40 #define DA850_REF_FREQ 24000000 42 41 43 42 #define CFGCHIP3_ASYNC3_CLKSRC BIT(4) 43 + #define CFGCHIP3_PLL1_MASTER_LOCK BIT(5) 44 44 #define CFGCHIP0_PLL_MASTER_LOCK BIT(4) 45 45 46 46 static int da850_set_armrate(struct clk *clk, unsigned long rate); ··· 335 333 .flags = ALWAYS_ENABLED, 336 334 }; 337 335 338 - static struct davinci_clk da850_clks[] = { 336 + static struct clk_lookup da850_clks[] = { 339 337 CLK(NULL, "ref", &ref_clk), 340 338 CLK(NULL, "pll0", &pll0_clk), 341 339 CLK(NULL, "pll0_aux", &pll0_aux_clk), ··· 537 535 MUX_CFG(DA850, GPIO2_15, 5, 0, 15, 8, false) 538 536 MUX_CFG(DA850, GPIO4_0, 10, 28, 15, 8, false) 539 537 MUX_CFG(DA850, GPIO4_1, 10, 24, 15, 8, false) 538 + MUX_CFG(DA850, RTC_ALARM, 0, 28, 15, 2, false) 540 539 #endif 541 540 }; 542 541 ··· 773 770 .length = DA8XX_CP_INTC_SIZE, 774 771 .type = MT_DEVICE 775 772 }, 773 + { 774 + .virtual = SRAM_VIRT, 775 + .pfn = __phys_to_pfn(DA8XX_ARM_RAM_BASE), 776 + .length = SZ_8K, 777 + .type = MT_DEVICE 778 + }, 776 779 }; 777 780 778 781 static void __iomem *da850_psc_bases[] = { ··· 834 825 static void da850_set_async3_src(int pllnum) 835 826 { 836 827 struct clk *clk, *newparent = pllnum ? &pll1_sysclk2 : &pll0_sysclk2; 837 - struct davinci_clk *c; 828 + struct clk_lookup *c; 838 829 unsigned int v; 839 830 int ret; 840 831 841 - for (c = da850_clks; c->lk.clk; c++) { 842 - clk = c->lk.clk; 832 + for (c = da850_clks; c->clk; c++) { 833 + clk = c->clk; 843 834 if (clk->flags & DA850_CLK_ASYNC3) { 844 835 ret = clk_set_parent(clk, newparent); 845 836 WARN(ret, "DA850: unable to re-parent clock %s", ··· 847 838 } 848 839 } 849 840 850 - v = __raw_readl(DA8XX_SYSCFG_VIRT(DA8XX_CFGCHIP3_REG)); 841 + v = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG)); 851 842 if (pllnum) 852 843 v |= CFGCHIP3_ASYNC3_CLKSRC; 853 844 else 854 845 v &= ~CFGCHIP3_ASYNC3_CLKSRC; 855 - __raw_writel(v, DA8XX_SYSCFG_VIRT(DA8XX_CFGCHIP3_REG)); 846 + __raw_writel(v, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG)); 856 847 } 857 848 858 849 #ifdef CONFIG_CPU_FREQ ··· 996 987 unsigned int prediv, mult, postdiv; 997 988 struct da850_opp *opp; 998 989 struct pll_data *pll = clk->pll_data; 999 - unsigned int v; 1000 990 int ret; 1001 991 1002 992 opp = (struct da850_opp *) da850_freq_table[index].index; 1003 993 prediv = opp->prediv; 1004 994 mult = opp->mult; 1005 995 postdiv = opp->postdiv; 1006 - 1007 - /* Unlock writing to PLL registers */ 1008 - v = __raw_readl(DA8XX_SYSCFG_VIRT(DA8XX_CFGCHIP0_REG)); 1009 - v &= ~CFGCHIP0_PLL_MASTER_LOCK; 1010 - __raw_writel(v, DA8XX_SYSCFG_VIRT(DA8XX_CFGCHIP0_REG)); 1011 996 1012 997 ret = davinci_set_pllrate(pll, prediv, mult, postdiv); 1013 998 if (WARN_ON(ret)) ··· 1031 1028 } 1032 1029 #endif 1033 1030 1031 + int da850_register_pm(struct platform_device *pdev) 1032 + { 1033 + int ret; 1034 + struct davinci_pm_config *pdata = pdev->dev.platform_data; 1035 + 1036 + ret = davinci_cfg_reg(DA850_RTC_ALARM); 1037 + if (ret) 1038 + return ret; 1039 + 1040 + pdata->ddr2_ctlr_base = da8xx_get_mem_ctlr(); 1041 + pdata->deepsleep_reg = DA8XX_SYSCFG1_VIRT(DA8XX_DEEPSLEEP_REG); 1042 + pdata->ddrpsc_num = DA8XX_LPSC1_EMIF3C; 1043 + 1044 + pdata->cpupll_reg_base = ioremap(DA8XX_PLL0_BASE, SZ_4K); 1045 + if (!pdata->cpupll_reg_base) 1046 + return -ENOMEM; 1047 + 1048 + pdata->ddrpll_reg_base = ioremap(DA8XX_PLL1_BASE, SZ_4K); 1049 + if (!pdata->ddrpll_reg_base) { 1050 + ret = -ENOMEM; 1051 + goto no_ddrpll_mem; 1052 + } 1053 + 1054 + pdata->ddrpsc_reg_base = ioremap(DA8XX_PSC1_BASE, SZ_4K); 1055 + if (!pdata->ddrpsc_reg_base) { 1056 + ret = -ENOMEM; 1057 + goto no_ddrpsc_mem; 1058 + } 1059 + 1060 + return platform_device_register(pdev); 1061 + 1062 + no_ddrpsc_mem: 1063 + iounmap(pdata->ddrpll_reg_base); 1064 + no_ddrpll_mem: 1065 + iounmap(pdata->cpupll_reg_base); 1066 + return ret; 1067 + } 1034 1068 1035 1069 static struct davinci_soc_info davinci_soc_info_da850 = { 1036 1070 .io_desc = da850_io_desc, ··· 1089 1049 .gpio_irq = IRQ_DA8XX_GPIO0, 1090 1050 .serial_dev = &da8xx_serial_device, 1091 1051 .emac_pdata = &da8xx_emac_pdata, 1052 + .sram_dma = DA8XX_ARM_RAM_BASE, 1053 + .sram_len = SZ_8K, 1092 1054 }; 1093 1055 1094 1056 void __init da850_init(void) 1095 1057 { 1096 - da8xx_syscfg_base = ioremap(DA8XX_SYSCFG_BASE, SZ_4K); 1097 - if (WARN(!da8xx_syscfg_base, "Unable to map syscfg module")) 1058 + unsigned int v; 1059 + 1060 + da8xx_syscfg0_base = ioremap(DA8XX_SYSCFG0_BASE, SZ_4K); 1061 + if (WARN(!da8xx_syscfg0_base, "Unable to map syscfg0 module")) 1062 + return; 1063 + 1064 + da8xx_syscfg1_base = ioremap(DA8XX_SYSCFG1_BASE, SZ_4K); 1065 + if (WARN(!da8xx_syscfg1_base, "Unable to map syscfg1 module")) 1098 1066 return; 1099 1067 1100 1068 davinci_soc_info_da850.jtag_id_base = 1101 - DA8XX_SYSCFG_VIRT(DA8XX_JTAG_ID_REG); 1102 - davinci_soc_info_da850.pinmux_base = DA8XX_SYSCFG_VIRT(0x120); 1069 + DA8XX_SYSCFG0_VIRT(DA8XX_JTAG_ID_REG); 1070 + davinci_soc_info_da850.pinmux_base = DA8XX_SYSCFG0_VIRT(0x120); 1103 1071 1104 1072 davinci_common_init(&davinci_soc_info_da850); 1105 1073 ··· 1119 1071 * be any noticible change even in non-DVFS use cases. 1120 1072 */ 1121 1073 da850_set_async3_src(1); 1074 + 1075 + /* Unlock writing to PLL0 registers */ 1076 + v = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP0_REG)); 1077 + v &= ~CFGCHIP0_PLL_MASTER_LOCK; 1078 + __raw_writel(v, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP0_REG)); 1079 + 1080 + /* Unlock writing to PLL1 registers */ 1081 + v = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG)); 1082 + v &= ~CFGCHIP3_PLL1_MASTER_LOCK; 1083 + __raw_writel(v, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG)); 1122 1084 }
+131 -15
arch/arm/mach-davinci/devices-da8xx.c
··· 24 24 #include "clock.h" 25 25 26 26 #define DA8XX_TPCC_BASE 0x01c00000 27 + #define DA850_TPCC1_BASE 0x01e30000 27 28 #define DA8XX_TPTC0_BASE 0x01c08000 28 29 #define DA8XX_TPTC1_BASE 0x01c08400 30 + #define DA850_TPTC2_BASE 0x01e38000 29 31 #define DA8XX_WDOG_BASE 0x01c21000 /* DA8XX_TIMER64P1_BASE */ 30 32 #define DA8XX_I2C0_BASE 0x01c22000 31 33 #define DA8XX_RTC_BASE 0x01C23000 ··· 44 42 #define DA8XX_MDIO_REG_OFFSET 0x4000 45 43 #define DA8XX_EMAC_CTRL_RAM_SIZE SZ_8K 46 44 47 - void __iomem *da8xx_syscfg_base; 45 + void __iomem *da8xx_syscfg0_base; 46 + void __iomem *da8xx_syscfg1_base; 48 47 49 48 static struct plat_serial8250_port da8xx_serial_pdata[] = { 50 49 { ··· 85 82 }, 86 83 }; 87 84 88 - static const s8 da8xx_dma_chan_no_event[] = { 89 - 20, 21, 90 - -1 91 - }; 92 - 93 85 static const s8 da8xx_queue_tc_mapping[][2] = { 94 86 /* {event queue no, TC no} */ 95 87 {0, 0}, ··· 99 101 {-1, -1} 100 102 }; 101 103 102 - static struct edma_soc_info da8xx_edma_info[] = { 104 + static const s8 da850_queue_tc_mapping[][2] = { 105 + /* {event queue no, TC no} */ 106 + {0, 0}, 107 + {-1, -1} 108 + }; 109 + 110 + static const s8 da850_queue_priority_mapping[][2] = { 111 + /* {event queue no, Priority} */ 112 + {0, 3}, 113 + {-1, -1} 114 + }; 115 + 116 + static struct edma_soc_info da830_edma_info[] = { 103 117 { 104 118 .n_channel = 32, 105 119 .n_region = 4, 106 120 .n_slot = 128, 107 121 .n_tc = 2, 108 122 .n_cc = 1, 109 - .noevent = da8xx_dma_chan_no_event, 110 123 .queue_tc_mapping = da8xx_queue_tc_mapping, 111 124 .queue_priority_mapping = da8xx_queue_priority_mapping, 112 125 }, 113 126 }; 114 127 115 - static struct resource da8xx_edma_resources[] = { 128 + static struct edma_soc_info da850_edma_info[] = { 129 + { 130 + .n_channel = 32, 131 + .n_region = 4, 132 + .n_slot = 128, 133 + .n_tc = 2, 134 + .n_cc = 1, 135 + .queue_tc_mapping = da8xx_queue_tc_mapping, 136 + .queue_priority_mapping = da8xx_queue_priority_mapping, 137 + }, 138 + { 139 + .n_channel = 32, 140 + .n_region = 4, 141 + .n_slot = 128, 142 + .n_tc = 1, 143 + .n_cc = 1, 144 + .queue_tc_mapping = da850_queue_tc_mapping, 145 + .queue_priority_mapping = da850_queue_priority_mapping, 146 + }, 147 + }; 148 + 149 + static struct resource da830_edma_resources[] = { 116 150 { 117 151 .name = "edma_cc0", 118 152 .start = DA8XX_TPCC_BASE, ··· 175 145 }, 176 146 }; 177 147 178 - static struct platform_device da8xx_edma_device = { 148 + static struct resource da850_edma_resources[] = { 149 + { 150 + .name = "edma_cc0", 151 + .start = DA8XX_TPCC_BASE, 152 + .end = DA8XX_TPCC_BASE + SZ_32K - 1, 153 + .flags = IORESOURCE_MEM, 154 + }, 155 + { 156 + .name = "edma_tc0", 157 + .start = DA8XX_TPTC0_BASE, 158 + .end = DA8XX_TPTC0_BASE + SZ_1K - 1, 159 + .flags = IORESOURCE_MEM, 160 + }, 161 + { 162 + .name = "edma_tc1", 163 + .start = DA8XX_TPTC1_BASE, 164 + .end = DA8XX_TPTC1_BASE + SZ_1K - 1, 165 + .flags = IORESOURCE_MEM, 166 + }, 167 + { 168 + .name = "edma_cc1", 169 + .start = DA850_TPCC1_BASE, 170 + .end = DA850_TPCC1_BASE + SZ_32K - 1, 171 + .flags = IORESOURCE_MEM, 172 + }, 173 + { 174 + .name = "edma_tc2", 175 + .start = DA850_TPTC2_BASE, 176 + .end = DA850_TPTC2_BASE + SZ_1K - 1, 177 + .flags = IORESOURCE_MEM, 178 + }, 179 + { 180 + .name = "edma0", 181 + .start = IRQ_DA8XX_CCINT0, 182 + .flags = IORESOURCE_IRQ, 183 + }, 184 + { 185 + .name = "edma0_err", 186 + .start = IRQ_DA8XX_CCERRINT, 187 + .flags = IORESOURCE_IRQ, 188 + }, 189 + { 190 + .name = "edma1", 191 + .start = IRQ_DA850_CCINT1, 192 + .flags = IORESOURCE_IRQ, 193 + }, 194 + { 195 + .name = "edma1_err", 196 + .start = IRQ_DA850_CCERRINT1, 197 + .flags = IORESOURCE_IRQ, 198 + }, 199 + }; 200 + 201 + static struct platform_device da830_edma_device = { 179 202 .name = "edma", 180 203 .id = -1, 181 204 .dev = { 182 - .platform_data = da8xx_edma_info, 205 + .platform_data = da830_edma_info, 183 206 }, 184 - .num_resources = ARRAY_SIZE(da8xx_edma_resources), 185 - .resource = da8xx_edma_resources, 207 + .num_resources = ARRAY_SIZE(da830_edma_resources), 208 + .resource = da830_edma_resources, 209 + }; 210 + 211 + static struct platform_device da850_edma_device = { 212 + .name = "edma", 213 + .id = -1, 214 + .dev = { 215 + .platform_data = da850_edma_info, 216 + }, 217 + .num_resources = ARRAY_SIZE(da850_edma_resources), 218 + .resource = da850_edma_resources, 186 219 }; 187 220 188 221 int __init da8xx_register_edma(void) 189 222 { 190 - return platform_device_register(&da8xx_edma_device); 223 + struct platform_device *pdev; 224 + 225 + if (cpu_is_davinci_da830()) 226 + pdev = &da830_edma_device; 227 + else if (cpu_is_davinci_da850()) 228 + pdev = &da850_edma_device; 229 + else 230 + return -ENODEV; 231 + 232 + return platform_device_register(pdev); 191 233 } 192 234 193 235 static struct resource da8xx_i2c_resources0[] = { ··· 597 495 return ret; 598 496 } 599 497 498 + static void __iomem *da8xx_ddr2_ctlr_base; 499 + void __iomem * __init da8xx_get_mem_ctlr(void) 500 + { 501 + if (da8xx_ddr2_ctlr_base) 502 + return da8xx_ddr2_ctlr_base; 503 + 504 + da8xx_ddr2_ctlr_base = ioremap(DA8XX_DDR2_CTL_BASE, SZ_32K); 505 + if (!da8xx_ddr2_ctlr_base) 506 + pr_warning("%s: Unable to map DDR2 controller", __func__); 507 + 508 + return da8xx_ddr2_ctlr_base; 509 + } 510 + 600 511 static struct resource da8xx_cpuidle_resources[] = { 601 512 { 602 513 .start = DA8XX_DDR2_CTL_BASE, ··· 635 520 636 521 int __init da8xx_register_cpuidle(void) 637 522 { 523 + da8xx_cpuidle_pdata.ddr2_ctlr_base = da8xx_get_mem_ctlr(); 524 + 638 525 return platform_device_register(&da8xx_cpuidle_device); 639 526 } 640 -
+29 -20
arch/arm/mach-davinci/dm355.c
··· 29 29 #include <mach/serial.h> 30 30 #include <mach/common.h> 31 31 #include <mach/asp.h> 32 + #include <mach/spi.h> 32 33 33 34 #include "clock.h" 34 35 #include "mux.h" ··· 335 334 .lpsc = DAVINCI_LPSC_USB, 336 335 }; 337 336 338 - static struct davinci_clk dm355_clks[] = { 337 + static struct clk_lookup dm355_clks[] = { 339 338 CLK(NULL, "ref", &ref_clk), 340 339 CLK(NULL, "pll1", &pll1_clk), 341 340 CLK(NULL, "pll1_sysclk1", &pll1_sysclk1), ··· 363 362 CLK("davinci-asp.1", NULL, &asp1_clk), 364 363 CLK("davinci_mmc.0", NULL, &mmcsd0_clk), 365 364 CLK("davinci_mmc.1", NULL, &mmcsd1_clk), 366 - CLK(NULL, "spi0", &spi0_clk), 367 - CLK(NULL, "spi1", &spi1_clk), 368 - CLK(NULL, "spi2", &spi2_clk), 365 + CLK("spi_davinci.0", NULL, &spi0_clk), 366 + CLK("spi_davinci.1", NULL, &spi1_clk), 367 + CLK("spi_davinci.2", NULL, &spi2_clk), 369 368 CLK(NULL, "gpio", &gpio_clk), 370 369 CLK(NULL, "aemif", &aemif_clk), 371 370 CLK(NULL, "pwm0", &pwm0_clk), ··· 392 391 .flags = IORESOURCE_MEM, 393 392 }, 394 393 { 395 - .start = IRQ_DM355_SPINT0_1, 394 + .start = IRQ_DM355_SPINT0_0, 396 395 .flags = IORESOURCE_IRQ, 397 396 }, 398 - /* Not yet used, so not included: 399 - * IORESOURCE_IRQ: 400 - * - IRQ_DM355_SPINT0_0 401 - * IORESOURCE_DMA: 402 - * - DAVINCI_DMA_SPI_SPIX 403 - * - DAVINCI_DMA_SPI_SPIR 404 - */ 397 + { 398 + .start = 17, 399 + .flags = IORESOURCE_DMA, 400 + }, 401 + { 402 + .start = 16, 403 + .flags = IORESOURCE_DMA, 404 + }, 405 + { 406 + .start = EVENTQ_1, 407 + .flags = IORESOURCE_DMA, 408 + }, 405 409 }; 406 410 411 + static struct davinci_spi_platform_data dm355_spi0_pdata = { 412 + .version = SPI_VERSION_1, 413 + .num_chipselect = 2, 414 + .clk_internal = 1, 415 + .cs_hold = 1, 416 + .intr_level = 0, 417 + .poll_mode = 1, /* 0 -> interrupt mode 1-> polling mode */ 418 + .c2tdelay = 0, 419 + .t2cdelay = 0, 420 + }; 407 421 static struct platform_device dm355_spi0_device = { 408 422 .name = "spi_davinci", 409 423 .id = 0, 410 424 .dev = { 411 425 .dma_mask = &dm355_spi0_dma_mask, 412 426 .coherent_dma_mask = DMA_BIT_MASK(32), 427 + .platform_data = &dm355_spi0_pdata, 413 428 }, 414 429 .num_resources = ARRAY_SIZE(dm355_spi0_resources), 415 430 .resource = dm355_spi0_resources, ··· 580 563 581 564 /*----------------------------------------------------------------------*/ 582 565 583 - static const s8 dma_chan_dm355_no_event[] = { 584 - 12, 13, 24, 56, 57, 585 - 58, 59, 60, 61, 62, 586 - 63, 587 - -1 588 - }; 589 - 590 566 static const s8 591 567 queue_tc_mapping[][2] = { 592 568 /* {event queue no, TC no} */ ··· 603 593 .n_slot = 128, 604 594 .n_tc = 2, 605 595 .n_cc = 1, 606 - .noevent = dma_chan_dm355_no_event, 607 596 .queue_tc_mapping = queue_tc_mapping, 608 597 .queue_priority_mapping = queue_priority_mapping, 609 598 },
+108 -3
arch/arm/mach-davinci/dm365.c
··· 18 18 #include <linux/platform_device.h> 19 19 #include <linux/dma-mapping.h> 20 20 #include <linux/gpio.h> 21 + #include <linux/spi/spi.h> 21 22 22 23 #include <asm/mach/map.h> 23 24 ··· 33 32 #include <mach/common.h> 34 33 #include <mach/asp.h> 35 34 #include <mach/keyscan.h> 35 + #include <mach/spi.h> 36 + 36 37 37 38 #include "clock.h" 38 39 #include "mux.h" ··· 406 403 .lpsc = DM365_LPSC_MJCP, 407 404 }; 408 405 409 - static struct davinci_clk dm365_clks[] = { 406 + static struct clk_lookup dm365_clks[] = { 410 407 CLK(NULL, "ref", &ref_clk), 411 408 CLK(NULL, "pll1", &pll1_clk), 412 409 CLK(NULL, "pll1_aux", &pll1_aux_clk), ··· 458 455 CLK(NULL, "timer3", &timer3_clk), 459 456 CLK(NULL, "usb", &usb_clk), 460 457 CLK("davinci_emac.1", NULL, &emac_clk), 461 - CLK("voice_codec", NULL, &voicecodec_clk), 458 + CLK("davinci_voicecodec", NULL, &voicecodec_clk), 462 459 CLK("davinci-asp.0", NULL, &asp0_clk), 463 460 CLK(NULL, "rto", &rto_clk), 464 461 CLK(NULL, "mjcp", &mjcp_clk), ··· 609 606 610 607 EVT_CFG(DM365, EVT2_ASP_TX, 0, 1, 0, false) 611 608 EVT_CFG(DM365, EVT3_ASP_RX, 1, 1, 0, false) 609 + EVT_CFG(DM365, EVT2_VC_TX, 0, 1, 1, false) 610 + EVT_CFG(DM365, EVT3_VC_RX, 1, 1, 1, false) 612 611 #endif 613 612 }; 613 + 614 + static u64 dm365_spi0_dma_mask = DMA_BIT_MASK(32); 615 + 616 + static struct davinci_spi_platform_data dm365_spi0_pdata = { 617 + .version = SPI_VERSION_1, 618 + .num_chipselect = 2, 619 + .clk_internal = 1, 620 + .cs_hold = 1, 621 + .intr_level = 0, 622 + .poll_mode = 1, /* 0 -> interrupt mode 1-> polling mode */ 623 + .c2tdelay = 0, 624 + .t2cdelay = 0, 625 + }; 626 + 627 + static struct resource dm365_spi0_resources[] = { 628 + { 629 + .start = 0x01c66000, 630 + .end = 0x01c667ff, 631 + .flags = IORESOURCE_MEM, 632 + }, 633 + { 634 + .start = IRQ_DM365_SPIINT0_0, 635 + .flags = IORESOURCE_IRQ, 636 + }, 637 + { 638 + .start = 17, 639 + .flags = IORESOURCE_DMA, 640 + }, 641 + { 642 + .start = 16, 643 + .flags = IORESOURCE_DMA, 644 + }, 645 + { 646 + .start = EVENTQ_3, 647 + .flags = IORESOURCE_DMA, 648 + }, 649 + }; 650 + 651 + static struct platform_device dm365_spi0_device = { 652 + .name = "spi_davinci", 653 + .id = 0, 654 + .dev = { 655 + .dma_mask = &dm365_spi0_dma_mask, 656 + .coherent_dma_mask = DMA_BIT_MASK(32), 657 + .platform_data = &dm365_spi0_pdata, 658 + }, 659 + .num_resources = ARRAY_SIZE(dm365_spi0_resources), 660 + .resource = dm365_spi0_resources, 661 + }; 662 + 663 + void __init dm365_init_spi0(unsigned chipselect_mask, 664 + struct spi_board_info *info, unsigned len) 665 + { 666 + davinci_cfg_reg(DM365_SPI0_SCLK); 667 + davinci_cfg_reg(DM365_SPI0_SDI); 668 + davinci_cfg_reg(DM365_SPI0_SDO); 669 + 670 + /* not all slaves will be wired up */ 671 + if (chipselect_mask & BIT(0)) 672 + davinci_cfg_reg(DM365_SPI0_SDENA0); 673 + if (chipselect_mask & BIT(1)) 674 + davinci_cfg_reg(DM365_SPI0_SDENA1); 675 + 676 + spi_register_board_info(info, len); 677 + 678 + platform_device_register(&dm365_spi0_device); 679 + } 614 680 615 681 static struct emac_platform_data dm365_emac_pdata = { 616 682 .ctrl_reg_offset = DM365_EMAC_CNTRL_OFFSET, ··· 826 754 .n_cc = 1, 827 755 .queue_tc_mapping = dm365_queue_tc_mapping, 828 756 .queue_priority_mapping = dm365_queue_priority_mapping, 829 - .default_queue = EVENTQ_2, 757 + .default_queue = EVENTQ_3, 830 758 }, 831 759 }; 832 760 ··· 905 833 .id = 0, 906 834 .num_resources = ARRAY_SIZE(dm365_asp_resources), 907 835 .resource = dm365_asp_resources, 836 + }; 837 + 838 + static struct resource dm365_vc_resources[] = { 839 + { 840 + .start = DAVINCI_DM365_VC_BASE, 841 + .end = DAVINCI_DM365_VC_BASE + SZ_1K - 1, 842 + .flags = IORESOURCE_MEM, 843 + }, 844 + { 845 + .start = DAVINCI_DMA_VC_TX, 846 + .end = DAVINCI_DMA_VC_TX, 847 + .flags = IORESOURCE_DMA, 848 + }, 849 + { 850 + .start = DAVINCI_DMA_VC_RX, 851 + .end = DAVINCI_DMA_VC_RX, 852 + .flags = IORESOURCE_DMA, 853 + }, 854 + }; 855 + 856 + static struct platform_device dm365_vc_device = { 857 + .name = "davinci_voicecodec", 858 + .id = -1, 859 + .num_resources = ARRAY_SIZE(dm365_vc_resources), 860 + .resource = dm365_vc_resources, 908 861 }; 909 862 910 863 static struct resource dm365_rtc_resources[] = { ··· 1086 989 davinci_cfg_reg(DM365_EVT3_ASP_RX); 1087 990 dm365_asp_device.dev.platform_data = pdata; 1088 991 platform_device_register(&dm365_asp_device); 992 + } 993 + 994 + void __init dm365_init_vc(struct snd_platform_data *pdata) 995 + { 996 + davinci_cfg_reg(DM365_EVT2_VC_TX); 997 + davinci_cfg_reg(DM365_EVT3_VC_RX); 998 + dm365_vc_device.dev.platform_data = pdata; 999 + platform_device_register(&dm365_vc_device); 1089 1000 } 1090 1001 1091 1002 void __init dm365_init_ks(struct davinci_ks_platform_data *pdata)
+1 -11
arch/arm/mach-davinci/dm644x.c
··· 277 277 .usecount = 1, /* REVISIT: why cant' this be disabled? */ 278 278 }; 279 279 280 - struct davinci_clk dm644x_clks[] = { 280 + struct clk_lookup dm644x_clks[] = { 281 281 CLK(NULL, "ref", &ref_clk), 282 282 CLK(NULL, "pll1", &pll1_clk), 283 283 CLK(NULL, "pll1_sysclk1", &pll1_sysclk1), ··· 479 479 480 480 /*----------------------------------------------------------------------*/ 481 481 482 - static const s8 dma_chan_dm644x_no_event[] = { 483 - 0, 1, 12, 13, 14, 484 - 15, 25, 30, 31, 45, 485 - 46, 47, 55, 56, 57, 486 - 58, 59, 60, 61, 62, 487 - 63, 488 - -1 489 - }; 490 - 491 482 static const s8 492 483 queue_tc_mapping[][2] = { 493 484 /* {event queue no, TC no} */ ··· 502 511 .n_slot = 128, 503 512 .n_tc = 2, 504 513 .n_cc = 1, 505 - .noevent = dma_chan_dm644x_no_event, 506 514 .queue_tc_mapping = queue_tc_mapping, 507 515 .queue_priority_mapping = queue_priority_mapping, 508 516 },
+2 -12
arch/arm/mach-davinci/dm646x.c
··· 42 42 /* 43 43 * Device specific clocks 44 44 */ 45 - #define DM646X_REF_FREQ 27000000 46 45 #define DM646X_AUX_FREQ 24000000 47 46 48 47 static struct pll_data pll1_data = { ··· 56 57 57 58 static struct clk ref_clk = { 58 59 .name = "ref_clk", 59 - .rate = DM646X_REF_FREQ, 60 60 }; 61 61 62 62 static struct clk aux_clkin = { ··· 311 313 .flags = ALWAYS_ENABLED, 312 314 }; 313 315 314 - struct davinci_clk dm646x_clks[] = { 316 + struct clk_lookup dm646x_clks[] = { 315 317 CLK(NULL, "ref", &ref_clk), 316 318 CLK(NULL, "aux", &aux_clkin), 317 319 CLK(NULL, "pll1", &pll1_clk), ··· 511 513 512 514 /*----------------------------------------------------------------------*/ 513 515 514 - static const s8 dma_chan_dm646x_no_event[] = { 515 - 0, 1, 2, 3, 13, 516 - 14, 15, 24, 25, 26, 517 - 27, 30, 31, 54, 55, 518 - 56, 519 - -1 520 - }; 521 - 522 516 /* Four Transfer Controllers on DM646x */ 523 517 static const s8 524 518 dm646x_queue_tc_mapping[][2] = { ··· 539 549 .n_slot = 512, 540 550 .n_tc = 4, 541 551 .n_cc = 1, 542 - .noevent = dma_chan_dm646x_no_event, 543 552 .queue_tc_mapping = dm646x_queue_tc_mapping, 544 553 .queue_priority_mapping = dm646x_queue_priority_mapping, 545 554 }, ··· 914 925 915 926 void __init dm646x_init(void) 916 927 { 928 + dm646x_board_setup_refclk(&ref_clk); 917 929 davinci_common_init(&davinci_soc_info_dm646x); 918 930 } 919 931
+51 -16
arch/arm/mach-davinci/dma.c
··· 226 226 */ 227 227 DECLARE_BITMAP(edma_inuse, EDMA_MAX_PARAMENTRY); 228 228 229 - /* The edma_noevent bit for each channel is clear unless 230 - * it doesn't trigger DMA events on this platform. It uses a 231 - * bit of SOC-specific initialization code. 229 + /* The edma_unused bit for each channel is clear unless 230 + * it is not being used on this platform. It uses a bit 231 + * of SOC-specific initialization code. 232 232 */ 233 - DECLARE_BITMAP(edma_noevent, EDMA_MAX_DMACH); 233 + DECLARE_BITMAP(edma_unused, EDMA_MAX_DMACH); 234 234 235 235 unsigned irq_res_start; 236 236 unsigned irq_res_end; ··· 243 243 }; 244 244 245 245 static struct edma *edma_info[EDMA_MAX_CC]; 246 + static int arch_num_cc; 246 247 247 248 /* dummy param set used to (re)initialize parameter RAM slots */ 248 249 static const struct edmacc_param dummy_paramset = { ··· 556 555 return EDMA_CTLR_CHAN(ctlr, i - num_slots + 1); 557 556 } 558 557 558 + static int prepare_unused_channel_list(struct device *dev, void *data) 559 + { 560 + struct platform_device *pdev = to_platform_device(dev); 561 + int i, ctlr; 562 + 563 + for (i = 0; i < pdev->num_resources; i++) { 564 + if ((pdev->resource[i].flags & IORESOURCE_DMA) && 565 + (int)pdev->resource[i].start >= 0) { 566 + ctlr = EDMA_CTLR(pdev->resource[i].start); 567 + clear_bit(EDMA_CHAN_SLOT(pdev->resource[i].start), 568 + edma_info[ctlr]->edma_unused); 569 + } 570 + } 571 + 572 + return 0; 573 + } 574 + 559 575 /*-----------------------------------------------------------------------*/ 576 + 577 + static bool unused_chan_list_done; 560 578 561 579 /* Resource alloc/free: dma channels, parameter RAM slots */ 562 580 ··· 614 594 void *data, 615 595 enum dma_event_q eventq_no) 616 596 { 617 - unsigned i, done, ctlr = 0; 597 + unsigned i, done = 0, ctlr = 0; 598 + int ret = 0; 599 + 600 + if (!unused_chan_list_done) { 601 + /* 602 + * Scan all the platform devices to find out the EDMA channels 603 + * used and clear them in the unused list, making the rest 604 + * available for ARM usage. 605 + */ 606 + ret = bus_for_each_dev(&platform_bus_type, NULL, NULL, 607 + prepare_unused_channel_list); 608 + if (ret < 0) 609 + return ret; 610 + 611 + unused_chan_list_done = true; 612 + } 618 613 619 614 if (channel >= 0) { 620 615 ctlr = EDMA_CTLR(channel); ··· 637 602 } 638 603 639 604 if (channel < 0) { 640 - for (i = 0; i < EDMA_MAX_CC; i++) { 605 + for (i = 0; i < arch_num_cc; i++) { 641 606 channel = 0; 642 607 for (;;) { 643 608 channel = find_next_bit(edma_info[i]-> 644 - edma_noevent, 609 + edma_unused, 645 610 edma_info[i]->num_channels, 646 611 channel); 647 612 if (channel == edma_info[i]->num_channels) 648 - return -ENOMEM; 613 + break; 649 614 if (!test_and_set_bit(channel, 650 615 edma_info[i]->edma_inuse)) { 651 616 done = 1; ··· 657 622 if (done) 658 623 break; 659 624 } 625 + if (!done) 626 + return -ENOMEM; 660 627 } else if (channel >= edma_info[ctlr]->num_channels) { 661 628 return -EINVAL; 662 629 } else if (test_and_set_bit(channel, edma_info[ctlr]->edma_inuse)) { ··· 679 642 680 643 map_dmach_queue(ctlr, channel, eventq_no); 681 644 682 - return channel; 645 + return EDMA_CTLR_CHAN(ctlr, channel); 683 646 } 684 647 EXPORT_SYMBOL(edma_alloc_channel); 685 648 ··· 1256 1219 unsigned int mask = (1 << (channel & 0x1f)); 1257 1220 1258 1221 /* EDMA channels without event association */ 1259 - if (test_bit(channel, edma_info[ctlr]->edma_noevent)) { 1222 + if (test_bit(channel, edma_info[ctlr]->edma_unused)) { 1260 1223 pr_debug("EDMA: ESR%d %08x\n", j, 1261 1224 edma_shadow0_read_array(ctlr, SH_ESR, j)); 1262 1225 edma_shadow0_write_array(ctlr, SH_ESR, j, mask); ··· 1381 1344 const s8 (*queue_tc_mapping)[2]; 1382 1345 int i, j, found = 0; 1383 1346 int status = -1; 1384 - const s8 *noevent; 1385 1347 int irq[EDMA_MAX_CC] = {0, 0}; 1386 1348 int err_irq[EDMA_MAX_CC] = {0, 0}; 1387 1349 struct resource *r[EDMA_MAX_CC] = {NULL}; ··· 1443 1407 memcpy_toio(edmacc_regs_base[j] + PARM_OFFSET(i), 1444 1408 &dummy_paramset, PARM_SIZE); 1445 1409 1446 - noevent = info[j].noevent; 1447 - if (noevent) { 1448 - while (*noevent != -1) 1449 - set_bit(*noevent++, edma_info[j]->edma_noevent); 1450 - } 1410 + /* Mark all channels as unused */ 1411 + memset(edma_info[j]->edma_unused, 0xff, 1412 + sizeof(edma_info[j]->edma_unused)); 1451 1413 1452 1414 sprintf(irq_name, "edma%d", j); 1453 1415 irq[j] = platform_get_irq_byname(pdev, irq_name); ··· 1501 1467 edma_write_array2(j, EDMA_DRAE, i, 1, 0x0); 1502 1468 edma_write_array(j, EDMA_QRAE, i, 0x0); 1503 1469 } 1470 + arch_num_cc++; 1504 1471 } 1505 1472 1506 1473 if (tc_errs_handled) {
+19
arch/arm/mach-davinci/include/mach/cdce949.h
··· 1 + /* 2 + * TI CDCE949 off-chip clock synthesizer support 3 + * 4 + * 2009 (C) Texas Instruments, Inc. http://www.ti.com/ 5 + * 6 + * This file is licensed under the terms of the GNU General Public License 7 + * version 2. This program is licensed "as is" without any warranty of any 8 + * kind, whether express or implied. 9 + */ 10 + #ifndef _MACH_DAVINCI_CDCE949_H 11 + #define _MACH_DAVINCI_CDCE949_H 12 + 13 + #include <linux/clk.h> 14 + 15 + #include <mach/clock.h> 16 + 17 + int cdce_set_rate(struct clk *clk, unsigned long rate); 18 + 19 + #endif
+1 -1
arch/arm/mach-davinci/include/mach/common.h
··· 43 43 void __iomem *jtag_id_base; 44 44 struct davinci_id *ids; 45 45 unsigned long ids_num; 46 - struct davinci_clk *cpu_clks; 46 + struct clk_lookup *cpu_clks; 47 47 void __iomem **psc_bases; 48 48 unsigned long psc_bases_num; 49 49 void __iomem *pinmux_base;
+1
arch/arm/mach-davinci/include/mach/cpuidle.h
··· 12 12 13 13 struct davinci_cpuidle_config { 14 14 u32 ddr2_pdown; 15 + void __iomem *ddr2_ctlr_base; 15 16 }; 16 17 17 18 #endif
+14 -4
arch/arm/mach-davinci/include/mach/da8xx.h
··· 13 13 14 14 #include <video/da8xx-fb.h> 15 15 16 + #include <linux/davinci_emac.h> 16 17 #include <mach/serial.h> 17 18 #include <mach/edma.h> 18 19 #include <mach/i2c.h> 19 - #include <mach/emac.h> 20 20 #include <mach/asp.h> 21 21 #include <mach/mmc.h> 22 22 #include <mach/usb.h> 23 + #include <mach/pm.h> 23 24 24 - extern void __iomem *da8xx_syscfg_base; 25 + extern void __iomem *da8xx_syscfg0_base; 26 + extern void __iomem *da8xx_syscfg1_base; 25 27 26 28 /* 27 29 * The cp_intc interrupt controller for the da8xx isn't in the same ··· 36 34 #define DA8XX_CP_INTC_SIZE SZ_8K 37 35 #define DA8XX_CP_INTC_VIRT (IO_VIRT - DA8XX_CP_INTC_SIZE - SZ_4K) 38 36 39 - #define DA8XX_SYSCFG_BASE (IO_PHYS + 0x14000) 40 - #define DA8XX_SYSCFG_VIRT(x) (da8xx_syscfg_base + (x)) 37 + #define DA8XX_SYSCFG0_BASE (IO_PHYS + 0x14000) 38 + #define DA8XX_SYSCFG0_VIRT(x) (da8xx_syscfg0_base + (x)) 41 39 #define DA8XX_JTAG_ID_REG 0x18 42 40 #define DA8XX_CFGCHIP0_REG 0x17c 43 41 #define DA8XX_CFGCHIP2_REG 0x184 44 42 #define DA8XX_CFGCHIP3_REG 0x188 43 + 44 + #define DA8XX_SYSCFG1_BASE (IO_PHYS + 0x22C000) 45 + #define DA8XX_SYSCFG1_VIRT(x) (da8xx_syscfg1_base + (x)) 46 + #define DA8XX_DEEPSLEEP_REG 0x8 45 47 46 48 #define DA8XX_PSC0_BASE 0x01c10000 47 49 #define DA8XX_PLL0_BASE 0x01c11000 ··· 54 48 #define DA8XX_GPIO_BASE 0x01e26000 55 49 #define DA8XX_PSC1_BASE 0x01e27000 56 50 #define DA8XX_LCD_CNTRL_BASE 0x01e13000 51 + #define DA8XX_PLL1_BASE 0x01e1a000 57 52 #define DA8XX_MMCSD0_BASE 0x01c40000 58 53 #define DA8XX_AEMIF_CS2_BASE 0x60000000 59 54 #define DA8XX_AEMIF_CS3_BASE 0x62000000 60 55 #define DA8XX_AEMIF_CTL_BASE 0x68000000 61 56 #define DA8XX_DDR2_CTL_BASE 0xb0000000 57 + #define DA8XX_ARM_RAM_BASE 0xffff0000 62 58 63 59 #define PINMUX0 0x00 64 60 #define PINMUX1 0x04 ··· 98 90 int da8xx_register_rtc(void); 99 91 int da850_register_cpufreq(void); 100 92 int da8xx_register_cpuidle(void); 93 + void __iomem * __init da8xx_get_mem_ctlr(void); 94 + int da850_register_pm(struct platform_device *pdev); 101 95 102 96 extern struct platform_device da8xx_serial_device; 103 97 extern struct emac_platform_data da8xx_emac_pdata;
+8 -1
arch/arm/mach-davinci/include/mach/dm365.h
··· 14 14 #define __ASM_ARCH_DM665_H 15 15 16 16 #include <linux/platform_device.h> 17 + #include <linux/davinci_emac.h> 17 18 #include <mach/hardware.h> 18 - #include <mach/emac.h> 19 19 #include <mach/asp.h> 20 20 #include <mach/keyscan.h> 21 21 #include <media/davinci/vpfe_capture.h> ··· 32 32 33 33 #define DM365_RTC_BASE (0x01C69000) 34 34 35 + #define DAVINCI_DM365_VC_BASE (0x01D0C000) 36 + #define DAVINCI_DMA_VC_TX 2 37 + #define DAVINCI_DMA_VC_RX 3 38 + 35 39 void __init dm365_init(void); 36 40 void __init dm365_init_asp(struct snd_platform_data *pdata); 41 + void __init dm365_init_vc(struct snd_platform_data *pdata); 37 42 void __init dm365_init_ks(struct davinci_ks_platform_data *pdata); 38 43 void __init dm365_init_rtc(void); 44 + void dm365_init_spi0(unsigned chipselect_mask, 45 + struct spi_board_info *info, unsigned len); 39 46 40 47 void dm365_set_vpfe_config(struct vpfe_config *cfg); 41 48 #endif /* __ASM_ARCH_DM365_H */
+1 -1
arch/arm/mach-davinci/include/mach/dm644x.h
··· 22 22 #ifndef __ASM_ARCH_DM644X_H 23 23 #define __ASM_ARCH_DM644X_H 24 24 25 + #include <linux/davinci_emac.h> 25 26 #include <mach/hardware.h> 26 - #include <mach/emac.h> 27 27 #include <mach/asp.h> 28 28 #include <media/davinci/vpfe_capture.h> 29 29
+3 -1
arch/arm/mach-davinci/include/mach/dm646x.h
··· 12 12 #define __ASM_ARCH_DM646X_H 13 13 14 14 #include <mach/hardware.h> 15 - #include <mach/emac.h> 16 15 #include <mach/asp.h> 17 16 #include <linux/i2c.h> 18 17 #include <linux/videodev2.h> 18 + #include <linux/clk.h> 19 + #include <linux/davinci_emac.h> 19 20 20 21 #define DM646X_EMAC_BASE (0x01C80000) 21 22 #define DM646X_EMAC_CNTRL_OFFSET (0x0000) ··· 31 30 void __init dm646x_init_ide(void); 32 31 void __init dm646x_init_mcasp0(struct snd_platform_data *pdata); 33 32 void __init dm646x_init_mcasp1(struct snd_platform_data *pdata); 33 + void __init dm646x_board_setup_refclk(struct clk *clk); 34 34 35 35 void dm646x_video_init(void); 36 36
-2
arch/arm/mach-davinci/include/mach/edma.h
··· 280 280 unsigned n_cc; 281 281 enum dma_event_q default_queue; 282 282 283 - /* list of channels with no even trigger; terminated by "-1" */ 284 - const s8 *noevent; 285 283 const s8 (*queue_tc_mapping)[2]; 286 284 const s8 (*queue_priority_mapping)[2]; 287 285 };
+5 -2
arch/arm/mach-davinci/include/mach/emac.h include/linux/davinci_emac.h
··· 8 8 * is licensed "as is" without any warranty of any kind, whether express 9 9 * or implied. 10 10 */ 11 - #ifndef _MACH_DAVINCI_EMAC_H 12 - #define _MACH_DAVINCI_EMAC_H 11 + #ifndef _LINUX_DAVINCI_EMAC_H 12 + #define _LINUX_DAVINCI_EMAC_H 13 13 14 14 #include <linux/if_ether.h> 15 15 #include <linux/memory.h> ··· 19 19 u32 ctrl_reg_offset; 20 20 u32 ctrl_mod_reg_offset; 21 21 u32 ctrl_ram_offset; 22 + u32 hw_ram_addr; 22 23 u32 mdio_reg_offset; 23 24 u32 ctrl_ram_size; 24 25 u32 phy_mask; 25 26 u32 mdio_max_freq; 26 27 u8 rmii_en; 27 28 u8 version; 29 + void (*interrupt_enable) (void); 30 + void (*interrupt_disable) (void); 28 31 }; 29 32 30 33 enum {
+2
arch/arm/mach-davinci/include/mach/i2c.h
··· 16 16 struct davinci_i2c_platform_data { 17 17 unsigned int bus_freq; /* standard bus frequency (kHz) */ 18 18 unsigned int bus_delay; /* post-transaction delay (usec) */ 19 + unsigned int sda_pin; /* GPIO pin ID to use for SDA */ 20 + unsigned int scl_pin; /* GPIO pin ID to use for SCL */ 19 21 }; 20 22 21 23 /* for board setup code */
+5
arch/arm/mach-davinci/include/mach/memory.h
··· 31 31 #define PHYS_OFFSET DAVINCI_DDR_BASE 32 32 #endif 33 33 34 + #define DDR2_SDRCR_OFFSET 0xc 35 + #define DDR2_SRPD_BIT BIT(23) 36 + #define DDR2_MCLKSTOPEN_BIT BIT(30) 37 + #define DDR2_LPMODEN_BIT BIT(31) 38 + 34 39 /* 35 40 * Increase size of DMA-consistent memory region 36 41 */
+3
arch/arm/mach-davinci/include/mach/mux.h
··· 327 327 /* EDMA event muxing */ 328 328 DM365_EVT2_ASP_TX, 329 329 DM365_EVT3_ASP_RX, 330 + DM365_EVT2_VC_TX, 331 + DM365_EVT3_VC_RX, 330 332 DM365_EVT26_MMC0_RX, 331 333 }; 332 334 ··· 901 899 DA850_GPIO2_15, 902 900 DA850_GPIO4_0, 903 901 DA850_GPIO4_1, 902 + DA850_RTC_ALARM, 904 903 }; 905 904 906 905 #ifdef CONFIG_DAVINCI_MUX
+54
arch/arm/mach-davinci/include/mach/pm.h
··· 1 + /* 2 + * TI DaVinci platform support for power management. 3 + * 4 + * Copyright (C) 2009 Texas Instruments, Inc. http://www.ti.com/ 5 + * 6 + * This program is free software; you can redistribute it and/or 7 + * modify it under the terms of the GNU General Public License as 8 + * published by the Free Software Foundation version 2. 9 + * 10 + * This program is distributed "as is" WITHOUT ANY WARRANTY of any 11 + * kind, whether express or implied; without even the implied warranty 12 + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 + * GNU General Public License for more details. 14 + */ 15 + #ifndef _MACH_DAVINCI_PM_H 16 + #define _MACH_DAVINCI_PM_H 17 + 18 + /* 19 + * Caution: Assembly code in sleep.S makes assumtion on the order 20 + * of the members of this structure. 21 + */ 22 + struct davinci_pm_config { 23 + void __iomem *ddr2_ctlr_base; 24 + void __iomem *ddrpsc_reg_base; 25 + int ddrpsc_num; 26 + void __iomem *ddrpll_reg_base; 27 + void __iomem *deepsleep_reg; 28 + void __iomem *cpupll_reg_base; 29 + /* 30 + * Note on SLEEPCOUNT: 31 + * The SLEEPCOUNT feature is mainly intended for cases in which 32 + * the internal oscillator is used. The internal oscillator is 33 + * fully disabled in deep sleep mode. When you exist deep sleep 34 + * mode, the oscillator will be turned on and will generate very 35 + * small oscillations which will not be detected by the deep sleep 36 + * counter. Eventually those oscillations will grow to an amplitude 37 + * large enough to start incrementing the deep sleep counter. 38 + * In this case recommendation from hardware engineers is that the 39 + * SLEEPCOUNT be set to 4096. This means that 4096 valid clock cycles 40 + * must be detected before the clock is passed to the rest of the 41 + * system. 42 + * In the case that the internal oscillator is not used and the 43 + * clock is generated externally, the SLEEPCOUNT value can be very 44 + * small since the clock input is assumed to be stable before SoC 45 + * is taken out of deepsleep mode. A value of 128 would be more than 46 + * adequate. 47 + */ 48 + int sleepcount; 49 + }; 50 + 51 + extern unsigned int davinci_cpu_suspend_sz; 52 + extern void davinci_cpu_suspend(struct davinci_pm_config *); 53 + 54 + #endif
+15
arch/arm/mach-davinci/include/mach/psc.h
··· 180 180 #define DA8XX_LPSC1_CR_P3_SS 26 181 181 #define DA8XX_LPSC1_L3_CBA_RAM 31 182 182 183 + /* PSC register offsets */ 184 + #define EPCPR 0x070 185 + #define PTCMD 0x120 186 + #define PTSTAT 0x128 187 + #define PDSTAT 0x200 188 + #define PDCTL1 0x304 189 + #define MDSTAT 0x800 190 + #define MDCTL 0xA00 191 + 192 + #define MDSTAT_STATE_MASK 0x1f 193 + 194 + #ifndef __ASSEMBLER__ 195 + 183 196 extern int davinci_psc_is_clk_active(unsigned int ctlr, unsigned int id); 184 197 extern void davinci_psc_config(unsigned int domain, unsigned int ctlr, 185 198 unsigned int id, char enable); 199 + 200 + #endif 186 201 187 202 #endif /* __ASM_ARCH_PSC_H */
+44
arch/arm/mach-davinci/include/mach/spi.h
··· 1 + /* 2 + * Copyright 2009 Texas Instruments. 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License as published by 6 + * the Free Software Foundation; either version 2 of the License, or 7 + * (at your option) any later version. 8 + * 9 + * This program is distributed in the hope that it will be useful, 10 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 + * GNU General Public License for more details. 13 + * 14 + * You should have received a copy of the GNU General Public License 15 + * along with this program; if not, write to the Free Software 16 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 17 + */ 18 + 19 + #ifndef __ARCH_ARM_DAVINCI_SPI_H 20 + #define __ARCH_ARM_DAVINCI_SPI_H 21 + 22 + enum { 23 + SPI_VERSION_1, /* For DM355/DM365/DM6467 */ 24 + SPI_VERSION_2, /* For DA8xx */ 25 + }; 26 + 27 + struct davinci_spi_platform_data { 28 + u8 version; 29 + u8 num_chipselect; 30 + u8 wdelay; 31 + u8 odd_parity; 32 + u8 parity_enable; 33 + u8 wait_enable; 34 + u8 timer_disable; 35 + u8 clk_internal; 36 + u8 cs_hold; 37 + u8 intr_level; 38 + u8 poll_mode; 39 + u8 use_dma; 40 + u8 c2tdelay; 41 + u8 t2cdelay; 42 + }; 43 + 44 + #endif /* __ARCH_ARM_DAVINCI_SPI_H */
+6 -1
arch/arm/mach-davinci/include/mach/timex.h
··· 11 11 #ifndef __ASM_ARCH_TIMEX_H 12 12 #define __ASM_ARCH_TIMEX_H 13 13 14 - /* The source frequency for the timers is the 27MHz clock */ 14 + /* 15 + * Alert: Not all timers of the DaVinci family run at a frequency of 27MHz, 16 + * but we should be fine as long as CLOCK_TICK_RATE or LATCH (see include/ 17 + * linux/jiffies.h) are not used directly in code. Currently none of the 18 + * code relevant to DaVinci platform depends on these values directly. 19 + */ 15 20 #define CLOCK_TICK_RATE 27000000 16 21 17 22 #endif /* __ASM_ARCH_TIMEX_H__ */
+158
arch/arm/mach-davinci/pm.c
··· 1 + /* 2 + * DaVinci Power Management Routines 3 + * 4 + * Copyright (C) 2009 Texas Instruments, Inc. http://www.ti.com/ 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License version 2 as 8 + * published by the Free Software Foundation. 9 + */ 10 + 11 + #include <linux/pm.h> 12 + #include <linux/suspend.h> 13 + #include <linux/module.h> 14 + #include <linux/platform_device.h> 15 + #include <linux/clk.h> 16 + #include <linux/spinlock.h> 17 + 18 + #include <asm/cacheflush.h> 19 + #include <asm/delay.h> 20 + 21 + #include <mach/da8xx.h> 22 + #include <mach/sram.h> 23 + #include <mach/pm.h> 24 + 25 + #include "clock.h" 26 + 27 + #define DEEPSLEEP_SLEEPCOUNT_MASK 0xFFFF 28 + 29 + static void (*davinci_sram_suspend) (struct davinci_pm_config *); 30 + static struct davinci_pm_config *pdata; 31 + 32 + static void davinci_sram_push(void *dest, void *src, unsigned int size) 33 + { 34 + memcpy(dest, src, size); 35 + flush_icache_range((unsigned long)dest, (unsigned long)(dest + size)); 36 + } 37 + 38 + static void davinci_pm_suspend(void) 39 + { 40 + unsigned val; 41 + 42 + if (pdata->cpupll_reg_base != pdata->ddrpll_reg_base) { 43 + 44 + /* Switch CPU PLL to bypass mode */ 45 + val = __raw_readl(pdata->cpupll_reg_base + PLLCTL); 46 + val &= ~(PLLCTL_PLLENSRC | PLLCTL_PLLEN); 47 + __raw_writel(val, pdata->cpupll_reg_base + PLLCTL); 48 + 49 + udelay(PLL_BYPASS_TIME); 50 + 51 + /* Powerdown CPU PLL */ 52 + val = __raw_readl(pdata->cpupll_reg_base + PLLCTL); 53 + val |= PLLCTL_PLLPWRDN; 54 + __raw_writel(val, pdata->cpupll_reg_base + PLLCTL); 55 + } 56 + 57 + /* Configure sleep count in deep sleep register */ 58 + val = __raw_readl(pdata->deepsleep_reg); 59 + val &= ~DEEPSLEEP_SLEEPCOUNT_MASK, 60 + val |= pdata->sleepcount; 61 + __raw_writel(val, pdata->deepsleep_reg); 62 + 63 + /* System goes to sleep in this call */ 64 + davinci_sram_suspend(pdata); 65 + 66 + if (pdata->cpupll_reg_base != pdata->ddrpll_reg_base) { 67 + 68 + /* put CPU PLL in reset */ 69 + val = __raw_readl(pdata->cpupll_reg_base + PLLCTL); 70 + val &= ~PLLCTL_PLLRST; 71 + __raw_writel(val, pdata->cpupll_reg_base + PLLCTL); 72 + 73 + /* put CPU PLL in power down */ 74 + val = __raw_readl(pdata->cpupll_reg_base + PLLCTL); 75 + val &= ~PLLCTL_PLLPWRDN; 76 + __raw_writel(val, pdata->cpupll_reg_base + PLLCTL); 77 + 78 + /* wait for CPU PLL reset */ 79 + udelay(PLL_RESET_TIME); 80 + 81 + /* bring CPU PLL out of reset */ 82 + val = __raw_readl(pdata->cpupll_reg_base + PLLCTL); 83 + val |= PLLCTL_PLLRST; 84 + __raw_writel(val, pdata->cpupll_reg_base + PLLCTL); 85 + 86 + /* Wait for CPU PLL to lock */ 87 + udelay(PLL_LOCK_TIME); 88 + 89 + /* Remove CPU PLL from bypass mode */ 90 + val = __raw_readl(pdata->cpupll_reg_base + PLLCTL); 91 + val &= ~PLLCTL_PLLENSRC; 92 + val |= PLLCTL_PLLEN; 93 + __raw_writel(val, pdata->cpupll_reg_base + PLLCTL); 94 + } 95 + } 96 + 97 + static int davinci_pm_enter(suspend_state_t state) 98 + { 99 + int ret = 0; 100 + 101 + switch (state) { 102 + case PM_SUSPEND_STANDBY: 103 + case PM_SUSPEND_MEM: 104 + davinci_pm_suspend(); 105 + break; 106 + default: 107 + ret = -EINVAL; 108 + } 109 + 110 + return ret; 111 + } 112 + 113 + static struct platform_suspend_ops davinci_pm_ops = { 114 + .enter = davinci_pm_enter, 115 + .valid = suspend_valid_only_mem, 116 + }; 117 + 118 + static int __init davinci_pm_probe(struct platform_device *pdev) 119 + { 120 + pdata = pdev->dev.platform_data; 121 + if (!pdata) { 122 + dev_err(&pdev->dev, "cannot get platform data\n"); 123 + return -ENOENT; 124 + } 125 + 126 + davinci_sram_suspend = sram_alloc(davinci_cpu_suspend_sz, NULL); 127 + if (!davinci_sram_suspend) { 128 + dev_err(&pdev->dev, "cannot allocate SRAM memory\n"); 129 + return -ENOMEM; 130 + } 131 + 132 + davinci_sram_push(davinci_sram_suspend, davinci_cpu_suspend, 133 + davinci_cpu_suspend_sz); 134 + 135 + suspend_set_ops(&davinci_pm_ops); 136 + 137 + return 0; 138 + } 139 + 140 + static int __exit davinci_pm_remove(struct platform_device *pdev) 141 + { 142 + sram_free(davinci_sram_suspend, davinci_cpu_suspend_sz); 143 + return 0; 144 + } 145 + 146 + static struct platform_driver davinci_pm_driver = { 147 + .driver = { 148 + .name = "pm-davinci", 149 + .owner = THIS_MODULE, 150 + }, 151 + .remove = __exit_p(davinci_pm_remove), 152 + }; 153 + 154 + static int __init davinci_pm_init(void) 155 + { 156 + return platform_driver_probe(&davinci_pm_driver, davinci_pm_probe); 157 + } 158 + late_initcall(davinci_pm_init);
-11
arch/arm/mach-davinci/psc.c
··· 25 25 #include <mach/cputype.h> 26 26 #include <mach/psc.h> 27 27 28 - /* PSC register offsets */ 29 - #define EPCPR 0x070 30 - #define PTCMD 0x120 31 - #define PTSTAT 0x128 32 - #define PDSTAT 0x200 33 - #define PDCTL1 0x304 34 - #define MDSTAT 0x800 35 - #define MDCTL 0xA00 36 - 37 - #define MDSTAT_STATE_MASK 0x1f 38 - 39 28 /* Return nonzero iff the domain's clock is active */ 40 29 int __init davinci_psc_is_clk_active(unsigned int ctlr, unsigned int id) 41 30 {
+224
arch/arm/mach-davinci/sleep.S
··· 1 + /* 2 + * (C) Copyright 2009, Texas Instruments, Inc. http://www.ti.com/ 3 + * 4 + * This program is free software; you can redistribute it and/or 5 + * modify it under the terms of the GNU General Public License 6 + * version 2 as published by the Free Software Foundation. 7 + * 8 + * This program is distributed in the hope that it will be useful, 9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR /PURPOSE. See the 11 + * GNU General Public License for more details. 12 + * 13 + * You should have received a copy of the GNU General Public License 14 + * along with this program; if not, write to the Free Software 15 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 16 + * MA 02111-1307 USA 17 + */ 18 + 19 + /* replicated define because linux/bitops.h cannot be included in assembly */ 20 + #define BIT(nr) (1 << (nr)) 21 + 22 + #include <linux/linkage.h> 23 + #include <asm/assembler.h> 24 + #include <mach/psc.h> 25 + #include <mach/memory.h> 26 + 27 + #include "clock.h" 28 + 29 + /* Arbitrary, hardware currently does not update PHYRDY correctly */ 30 + #define PHYRDY_CYCLES 0x1000 31 + 32 + /* Assume 25 MHz speed for the cycle conversions since PLLs are bypassed */ 33 + #define PLL_BYPASS_CYCLES (PLL_BYPASS_TIME * 25) 34 + #define PLL_RESET_CYCLES (PLL_RESET_TIME * 25) 35 + #define PLL_LOCK_CYCLES (PLL_LOCK_TIME * 25) 36 + 37 + #define DEEPSLEEP_SLEEPENABLE_BIT BIT(31) 38 + 39 + .text 40 + /* 41 + * Move DaVinci into deep sleep state 42 + * 43 + * Note: This code is copied to internal SRAM by PM code. When the DaVinci 44 + * wakes up it continues execution at the point it went to sleep. 45 + * Register Usage: 46 + * r0: contains virtual base for DDR2 controller 47 + * r1: contains virtual base for DDR2 Power and Sleep controller (PSC) 48 + * r2: contains PSC number for DDR2 49 + * r3: contains virtual base DDR2 PLL controller 50 + * r4: contains virtual address of the DEEPSLEEP register 51 + */ 52 + ENTRY(davinci_cpu_suspend) 53 + stmfd sp!, {r0-r12, lr} @ save registers on stack 54 + 55 + ldr ip, CACHE_FLUSH 56 + blx ip 57 + 58 + ldmia r0, {r0-r4} 59 + 60 + /* 61 + * Switch DDR to self-refresh mode. 62 + */ 63 + 64 + /* calculate SDRCR address */ 65 + ldr ip, [r0, #DDR2_SDRCR_OFFSET] 66 + bic ip, ip, #DDR2_SRPD_BIT 67 + orr ip, ip, #DDR2_LPMODEN_BIT 68 + str ip, [r0, #DDR2_SDRCR_OFFSET] 69 + 70 + ldr ip, [r0, #DDR2_SDRCR_OFFSET] 71 + orr ip, ip, #DDR2_MCLKSTOPEN_BIT 72 + str ip, [r0, #DDR2_SDRCR_OFFSET] 73 + 74 + mov ip, #PHYRDY_CYCLES 75 + 1: subs ip, ip, #0x1 76 + bne 1b 77 + 78 + /* Disable DDR2 LPSC */ 79 + mov r7, r0 80 + mov r0, #0x2 81 + bl davinci_ddr_psc_config 82 + mov r0, r7 83 + 84 + /* Disable clock to DDR PHY */ 85 + ldr ip, [r3, #PLLDIV1] 86 + bic ip, ip, #PLLDIV_EN 87 + str ip, [r3, #PLLDIV1] 88 + 89 + /* Put the DDR PLL in bypass and power down */ 90 + ldr ip, [r3, #PLLCTL] 91 + bic ip, ip, #PLLCTL_PLLENSRC 92 + bic ip, ip, #PLLCTL_PLLEN 93 + str ip, [r3, #PLLCTL] 94 + 95 + /* Wait for PLL to switch to bypass */ 96 + mov ip, #PLL_BYPASS_CYCLES 97 + 2: subs ip, ip, #0x1 98 + bne 2b 99 + 100 + /* Power down the PLL */ 101 + ldr ip, [r3, #PLLCTL] 102 + orr ip, ip, #PLLCTL_PLLPWRDN 103 + str ip, [r3, #PLLCTL] 104 + 105 + /* Go to deep sleep */ 106 + ldr ip, [r4] 107 + orr ip, ip, #DEEPSLEEP_SLEEPENABLE_BIT 108 + /* System goes to sleep beyond after this instruction */ 109 + str ip, [r4] 110 + 111 + /* Wake up from sleep */ 112 + 113 + /* Clear sleep enable */ 114 + ldr ip, [r4] 115 + bic ip, ip, #DEEPSLEEP_SLEEPENABLE_BIT 116 + str ip, [r4] 117 + 118 + /* initialize the DDR PLL controller */ 119 + 120 + /* Put PLL in reset */ 121 + ldr ip, [r3, #PLLCTL] 122 + bic ip, ip, #PLLCTL_PLLRST 123 + str ip, [r3, #PLLCTL] 124 + 125 + /* Clear PLL power down */ 126 + ldr ip, [r3, #PLLCTL] 127 + bic ip, ip, #PLLCTL_PLLPWRDN 128 + str ip, [r3, #PLLCTL] 129 + 130 + mov ip, #PLL_RESET_CYCLES 131 + 3: subs ip, ip, #0x1 132 + bne 3b 133 + 134 + /* Bring PLL out of reset */ 135 + ldr ip, [r3, #PLLCTL] 136 + orr ip, ip, #PLLCTL_PLLRST 137 + str ip, [r3, #PLLCTL] 138 + 139 + /* Wait for PLL to lock (assume prediv = 1, 25MHz OSCIN) */ 140 + mov ip, #PLL_LOCK_CYCLES 141 + 4: subs ip, ip, #0x1 142 + bne 4b 143 + 144 + /* Remove PLL from bypass mode */ 145 + ldr ip, [r3, #PLLCTL] 146 + bic ip, ip, #PLLCTL_PLLENSRC 147 + orr ip, ip, #PLLCTL_PLLEN 148 + str ip, [r3, #PLLCTL] 149 + 150 + /* Start 2x clock to DDR2 */ 151 + 152 + ldr ip, [r3, #PLLDIV1] 153 + orr ip, ip, #PLLDIV_EN 154 + str ip, [r3, #PLLDIV1] 155 + 156 + /* Enable VCLK */ 157 + 158 + /* Enable DDR2 LPSC */ 159 + mov r7, r0 160 + mov r0, #0x3 161 + bl davinci_ddr_psc_config 162 + mov r0, r7 163 + 164 + /* clear MCLKSTOPEN */ 165 + 166 + ldr ip, [r0, #DDR2_SDRCR_OFFSET] 167 + bic ip, ip, #DDR2_MCLKSTOPEN_BIT 168 + str ip, [r0, #DDR2_SDRCR_OFFSET] 169 + 170 + ldr ip, [r0, #DDR2_SDRCR_OFFSET] 171 + bic ip, ip, #DDR2_LPMODEN_BIT 172 + str ip, [r0, #DDR2_SDRCR_OFFSET] 173 + 174 + /* Restore registers and return */ 175 + ldmfd sp!, {r0-r12, pc} 176 + 177 + ENDPROC(davinci_cpu_suspend) 178 + 179 + /* 180 + * Disables or Enables DDR2 LPSC 181 + * Register Usage: 182 + * r0: Enable or Disable LPSC r0 = 0x3 => Enable, r0 = 0x2 => Disable LPSC 183 + * r1: contains virtual base for DDR2 Power and Sleep controller (PSC) 184 + * r2: contains PSC number for DDR2 185 + */ 186 + ENTRY(davinci_ddr_psc_config) 187 + /* Set next state in mdctl for DDR2 */ 188 + mov r6, #MDCTL 189 + add r6, r6, r2, lsl #2 190 + ldr ip, [r1, r6] 191 + bic ip, ip, #MDSTAT_STATE_MASK 192 + orr ip, ip, r0 193 + str ip, [r1, r6] 194 + 195 + /* Enable the Power Domain Transition Command */ 196 + ldr ip, [r1, #PTCMD] 197 + orr ip, ip, #0x1 198 + str ip, [r1, #PTCMD] 199 + 200 + /* Check for Transition Complete (PTSTAT) */ 201 + ptstat_done: 202 + ldr ip, [r1, #PTSTAT] 203 + and ip, ip, #0x1 204 + cmp ip, #0x0 205 + bne ptstat_done 206 + 207 + /* Check for DDR2 clock disable completion; */ 208 + mov r6, #MDSTAT 209 + add r6, r6, r2, lsl #2 210 + ddr2clk_stop_done: 211 + ldr ip, [r1, r6] 212 + and ip, ip, #MDSTAT_STATE_MASK 213 + cmp ip, r0 214 + bne ddr2clk_stop_done 215 + 216 + mov pc, lr 217 + ENDPROC(davinci_ddr_psc_config) 218 + 219 + CACHE_FLUSH: 220 + .word arm926_flush_kern_cache_all 221 + 222 + ENTRY(davinci_cpu_suspend_sz) 223 + .word . - davinci_cpu_suspend 224 + ENDPROC(davinci_cpu_suspend_sz)
+1 -1
drivers/net/Kconfig
··· 920 920 921 921 config TI_DAVINCI_EMAC 922 922 tristate "TI DaVinci EMAC Support" 923 - depends on ARM && ARCH_DAVINCI 923 + depends on ARM && ( ARCH_DAVINCI || ARCH_OMAP3 ) 924 924 select PHYLIB 925 925 help 926 926 This driver supports TI's DaVinci Ethernet .
+36 -19
drivers/net/davinci_emac.c
··· 62 62 #include <linux/bitops.h> 63 63 #include <linux/io.h> 64 64 #include <linux/uaccess.h> 65 + #include <linux/davinci_emac.h> 65 66 66 67 #include <asm/irq.h> 67 68 #include <asm/page.h> 68 - 69 - #include <mach/emac.h> 70 69 71 70 static int debug_level; 72 71 module_param(debug_level, int, 0); ··· 464 465 void __iomem *ctrl_base; 465 466 void __iomem *emac_ctrl_ram; 466 467 u32 ctrl_ram_size; 468 + u32 hw_ram_addr; 467 469 struct emac_txch *txch[EMAC_DEF_MAX_TX_CH]; 468 470 struct emac_rxch *rxch[EMAC_DEF_MAX_RX_CH]; 469 471 u32 link; /* 1=link on, 0=link off */ ··· 488 488 struct mii_bus *mii_bus; 489 489 struct phy_device *phydev; 490 490 spinlock_t lock; 491 + /*platform specific members*/ 492 + void (*int_enable) (void); 493 + void (*int_disable) (void); 491 494 }; 492 495 493 496 /* clock frequency for EMAC */ ··· 498 495 static unsigned long emac_bus_frequency; 499 496 static unsigned long mdio_max_freq; 500 497 501 - /* EMAC internal utility function */ 502 - static inline u32 emac_virt_to_phys(void __iomem *addr) 503 - { 504 - return (u32 __force) io_v2p(addr); 505 - } 498 + #define emac_virt_to_phys(addr, priv) \ 499 + (((u32 __force)(addr) - (u32 __force)(priv->emac_ctrl_ram)) \ 500 + + priv->hw_ram_addr) 506 501 507 502 /* Cache macros - Packet buffers would be from skb pool which is cached */ 508 503 #define EMAC_VIRT_NOCACHE(addr) (addr) ··· 1003 1002 emac_ctrl_write(EMAC_DM646X_CMRXINTEN, 0x0); 1004 1003 emac_ctrl_write(EMAC_DM646X_CMTXINTEN, 0x0); 1005 1004 /* NOTE: Rx Threshold and Misc interrupts are not disabled */ 1005 + if (priv->int_disable) 1006 + priv->int_disable(); 1006 1007 1007 1008 local_irq_restore(flags); 1008 1009 ··· 1024 1021 static void emac_int_enable(struct emac_priv *priv) 1025 1022 { 1026 1023 if (priv->version == EMAC_VERSION_2) { 1024 + if (priv->int_enable) 1025 + priv->int_enable(); 1026 + 1027 1027 emac_ctrl_write(EMAC_DM646X_CMRXINTEN, 0xff); 1028 1028 emac_ctrl_write(EMAC_DM646X_CMTXINTEN, 0xff); 1029 1029 ··· 1308 1302 curr_bd = txch->active_queue_head; 1309 1303 if (NULL == curr_bd) { 1310 1304 emac_write(EMAC_TXCP(ch), 1311 - emac_virt_to_phys(txch->last_hw_bdprocessed)); 1305 + emac_virt_to_phys(txch->last_hw_bdprocessed, priv)); 1312 1306 txch->no_active_pkts++; 1313 1307 spin_unlock_irqrestore(&priv->tx_lock, flags); 1314 1308 return 0; ··· 1318 1312 while ((curr_bd) && 1319 1313 ((frame_status & EMAC_CPPI_OWNERSHIP_BIT) == 0) && 1320 1314 (pkts_processed < budget)) { 1321 - emac_write(EMAC_TXCP(ch), emac_virt_to_phys(curr_bd)); 1315 + emac_write(EMAC_TXCP(ch), emac_virt_to_phys(curr_bd, priv)); 1322 1316 txch->active_queue_head = curr_bd->next; 1323 1317 if (frame_status & EMAC_CPPI_EOQ_BIT) { 1324 1318 if (curr_bd->next) { /* misqueued packet */ ··· 1405 1399 txch->active_queue_tail = curr_bd; 1406 1400 if (1 != txch->queue_active) { 1407 1401 emac_write(EMAC_TXHDP(ch), 1408 - emac_virt_to_phys(curr_bd)); 1402 + emac_virt_to_phys(curr_bd, priv)); 1409 1403 txch->queue_active = 1; 1410 1404 } 1411 1405 ++txch->queue_reinit; ··· 1417 1411 tail_bd->next = curr_bd; 1418 1412 txch->active_queue_tail = curr_bd; 1419 1413 tail_bd = EMAC_VIRT_NOCACHE(tail_bd); 1420 - tail_bd->h_next = (int)emac_virt_to_phys(curr_bd); 1414 + tail_bd->h_next = (int)emac_virt_to_phys(curr_bd, priv); 1421 1415 frame_status = tail_bd->mode; 1422 1416 if (frame_status & EMAC_CPPI_EOQ_BIT) { 1423 - emac_write(EMAC_TXHDP(ch), emac_virt_to_phys(curr_bd)); 1417 + emac_write(EMAC_TXHDP(ch), 1418 + emac_virt_to_phys(curr_bd, priv)); 1424 1419 frame_status &= ~(EMAC_CPPI_EOQ_BIT); 1425 1420 tail_bd->mode = frame_status; 1426 1421 ++txch->end_of_queue_add; ··· 1611 1604 } 1612 1605 1613 1606 /* populate the hardware descriptor */ 1614 - curr_bd->h_next = emac_virt_to_phys(rxch->active_queue_head); 1607 + curr_bd->h_next = emac_virt_to_phys(rxch->active_queue_head, 1608 + priv); 1615 1609 /* FIXME buff_ptr = dma_map_single(... data_ptr ...) */ 1616 1610 curr_bd->buff_ptr = virt_to_phys(curr_bd->data_ptr); 1617 1611 curr_bd->off_b_len = rxch->buf_size; ··· 1887 1879 rxch->active_queue_tail = curr_bd; 1888 1880 if (0 != rxch->queue_active) { 1889 1881 emac_write(EMAC_RXHDP(ch), 1890 - emac_virt_to_phys(rxch->active_queue_head)); 1882 + emac_virt_to_phys(rxch->active_queue_head, priv)); 1891 1883 rxch->queue_active = 1; 1892 1884 } 1893 1885 } else { ··· 1898 1890 rxch->active_queue_tail = curr_bd; 1899 1891 tail_bd->next = curr_bd; 1900 1892 tail_bd = EMAC_VIRT_NOCACHE(tail_bd); 1901 - tail_bd->h_next = emac_virt_to_phys(curr_bd); 1893 + tail_bd->h_next = emac_virt_to_phys(curr_bd, priv); 1902 1894 frame_status = tail_bd->mode; 1903 1895 if (frame_status & EMAC_CPPI_EOQ_BIT) { 1904 1896 emac_write(EMAC_RXHDP(ch), 1905 - emac_virt_to_phys(curr_bd)); 1897 + emac_virt_to_phys(curr_bd, priv)); 1906 1898 frame_status &= ~(EMAC_CPPI_EOQ_BIT); 1907 1899 tail_bd->mode = frame_status; 1908 1900 ++rxch->end_of_queue_add; ··· 1995 1987 curr_pkt->num_bufs = 1; 1996 1988 curr_pkt->pkt_length = 1997 1989 (frame_status & EMAC_RX_BD_PKT_LENGTH_MASK); 1998 - emac_write(EMAC_RXCP(ch), emac_virt_to_phys(curr_bd)); 1990 + emac_write(EMAC_RXCP(ch), emac_virt_to_phys(curr_bd, priv)); 1999 1991 ++rxch->processed_bd; 2000 1992 last_bd = curr_bd; 2001 1993 curr_bd = last_bd->next; ··· 2006 1998 if (curr_bd) { 2007 1999 ++rxch->mis_queued_packets; 2008 2000 emac_write(EMAC_RXHDP(ch), 2009 - emac_virt_to_phys(curr_bd)); 2001 + emac_virt_to_phys(curr_bd, priv)); 2010 2002 } else { 2011 2003 ++rxch->end_of_queue; 2012 2004 rxch->queue_active = 0; ··· 2107 2099 emac_write(EMAC_RXINTMASKSET, BIT(ch)); 2108 2100 rxch->queue_active = 1; 2109 2101 emac_write(EMAC_RXHDP(ch), 2110 - emac_virt_to_phys(rxch->active_queue_head)); 2102 + emac_virt_to_phys(rxch->active_queue_head, priv)); 2111 2103 } 2112 2104 2113 2105 /* Enable MII */ ··· 2668 2660 priv->phy_mask = pdata->phy_mask; 2669 2661 priv->rmii_en = pdata->rmii_en; 2670 2662 priv->version = pdata->version; 2663 + priv->int_enable = pdata->interrupt_enable; 2664 + priv->int_disable = pdata->interrupt_disable; 2665 + 2671 2666 emac_dev = &ndev->dev; 2672 2667 /* Get EMAC platform data */ 2673 2668 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ··· 2702 2691 priv->ctrl_base = priv->remap_addr + pdata->ctrl_mod_reg_offset; 2703 2692 priv->ctrl_ram_size = pdata->ctrl_ram_size; 2704 2693 priv->emac_ctrl_ram = priv->remap_addr + pdata->ctrl_ram_offset; 2694 + 2695 + if (pdata->hw_ram_addr) 2696 + priv->hw_ram_addr = pdata->hw_ram_addr; 2697 + else 2698 + priv->hw_ram_addr = (u32 __force)res->start + 2699 + pdata->ctrl_ram_offset; 2705 2700 2706 2701 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 2707 2702 if (!res) {