20 #include <mach/cputype.h>
21 #include <mach/common.h>
22 #include <mach/time.h>
24 #include <mach/cpuidle.h>
29 #define DA8XX_TPCC_BASE 0x01c00000
30 #define DA8XX_TPTC0_BASE 0x01c08000
31 #define DA8XX_TPTC1_BASE 0x01c08400
32 #define DA8XX_WDOG_BASE 0x01c21000
33 #define DA8XX_I2C0_BASE 0x01c22000
34 #define DA8XX_RTC_BASE 0x01c23000
35 #define DA8XX_MMCSD0_BASE 0x01c40000
36 #define DA8XX_SPI0_BASE 0x01c41000
37 #define DA830_SPI1_BASE 0x01e12000
38 #define DA8XX_LCD_CNTRL_BASE 0x01e13000
39 #define DA850_SATA_BASE 0x01e18000
40 #define DA850_MMCSD1_BASE 0x01e1b000
41 #define DA8XX_EMAC_CPPI_PORT_BASE 0x01e20000
42 #define DA8XX_EMAC_CPGMACSS_BASE 0x01e22000
43 #define DA8XX_EMAC_CPGMAC_BASE 0x01e23000
44 #define DA8XX_EMAC_MDIO_BASE 0x01e24000
45 #define DA8XX_I2C1_BASE 0x01e28000
46 #define DA850_TPCC1_BASE 0x01e30000
47 #define DA850_TPTC2_BASE 0x01e38000
48 #define DA850_SPI1_BASE 0x01f0e000
49 #define DA8XX_DDR2_CTL_BASE 0xb0000000
51 #define DA8XX_EMAC_CTRL_REG_OFFSET 0x3000
52 #define DA8XX_EMAC_MOD_REG_OFFSET 0x2000
53 #define DA8XX_EMAC_RAM_OFFSET 0x0000
54 #define DA8XX_EMAC_CTRL_RAM_SIZE SZ_8K
56 #define DA8XX_DMA_SPI0_RX EDMA_CTLR_CHAN(0, 14)
57 #define DA8XX_DMA_SPI0_TX EDMA_CTLR_CHAN(0, 15)
58 #define DA8XX_DMA_MMCSD0_RX EDMA_CTLR_CHAN(0, 16)
59 #define DA8XX_DMA_MMCSD0_TX EDMA_CTLR_CHAN(0, 17)
60 #define DA8XX_DMA_SPI1_RX EDMA_CTLR_CHAN(0, 18)
61 #define DA8XX_DMA_SPI1_TX EDMA_CTLR_CHAN(0, 19)
62 #define DA850_DMA_MMCSD1_RX EDMA_CTLR_CHAN(1, 28)
63 #define DA850_DMA_MMCSD1_TX EDMA_CTLR_CHAN(1, 29)
102 .platform_data = da8xx_serial_pdata,
106 static const s8 da8xx_queue_tc_mapping[][2] = {
113 static const s8 da8xx_queue_priority_mapping[][2] = {
120 static const s8 da850_queue_tc_mapping[][2] = {
126 static const s8 da850_queue_priority_mapping[][2] = {
138 .queue_tc_mapping = da8xx_queue_tc_mapping,
139 .queue_priority_mapping = da8xx_queue_priority_mapping,
144 &da830_edma_cc0_info,
154 .queue_tc_mapping = da8xx_queue_tc_mapping,
155 .queue_priority_mapping = da8xx_queue_priority_mapping,
164 .queue_tc_mapping = da850_queue_tc_mapping,
165 .queue_priority_mapping = da850_queue_priority_mapping,
171 &da850_edma_cc_info[0],
172 &da850_edma_cc_info[1],
175 static struct resource da830_edma_resources[] = {
206 static struct resource da850_edma_resources[] = {
263 .platform_data = da830_edma_info,
265 .num_resources =
ARRAY_SIZE(da830_edma_resources),
266 .resource = da830_edma_resources,
273 .platform_data = da850_edma_info,
275 .num_resources =
ARRAY_SIZE(da850_edma_resources),
276 .resource = da850_edma_resources,
281 da830_edma_cc0_info.
rsv =
rsv;
289 da850_edma_cc_info[0].
rsv = rsv[0];
290 da850_edma_cc_info[1].
rsv = rsv[1];
296 static struct resource da8xx_i2c_resources0[] = {
310 .name =
"i2c_davinci",
312 .num_resources =
ARRAY_SIZE(da8xx_i2c_resources0),
313 .resource = da8xx_i2c_resources0,
316 static struct resource da8xx_i2c_resources1[] = {
330 .name =
"i2c_davinci",
332 .num_resources =
ARRAY_SIZE(da8xx_i2c_resources1),
333 .resource = da8xx_i2c_resources1,
342 pdev = &da8xx_i2c_device0;
343 else if (instance == 1)
344 pdev = &da8xx_i2c_device1;
352 static struct resource da8xx_watchdog_resources[] = {
363 .num_resources =
ARRAY_SIZE(da8xx_watchdog_resources),
364 .resource = da8xx_watchdog_resources,
377 static struct resource da8xx_emac_resources[] = {
414 .name =
"davinci_emac",
419 .num_resources =
ARRAY_SIZE(da8xx_emac_resources),
420 .resource = da8xx_emac_resources,
423 static struct resource da8xx_mdio_resources[] = {
432 .name =
"davinci_mdio",
434 .num_resources =
ARRAY_SIZE(da8xx_mdio_resources),
435 .resource = da8xx_mdio_resources,
453 static struct resource da830_mcasp1_resources[] = {
475 .name =
"davinci-mcasp",
477 .num_resources =
ARRAY_SIZE(da830_mcasp1_resources),
478 .resource = da830_mcasp1_resources,
481 static struct resource da850_mcasp_resources[] = {
503 .name =
"davinci-mcasp",
505 .num_resources =
ARRAY_SIZE(da850_mcasp_resources),
506 .resource = da850_mcasp_resources,
513 da830_mcasp1_device.
dev.platform_data =
pdata;
516 da850_mcasp_device.
dev.platform_data =
pdata;
538 .invert_line_clock = 1,
539 .invert_frm_clock = 1,
547 .manu_name =
"sharp",
548 .controller_data = &lcd_cfg,
549 .type =
"Sharp_LCD035Q3DG01",
553 .manu_name =
"sharp",
554 .controller_data = &lcd_cfg,
555 .type =
"Sharp_LK043T1DG01",
558 static struct resource da8xx_lcdc_resources[] = {
572 .name =
"da8xx_lcdc",
574 .num_resources =
ARRAY_SIZE(da8xx_lcdc_resources),
575 .resource = da8xx_lcdc_resources,
580 da8xx_lcdc_device.
dev.platform_data =
pdata;
584 static struct resource da8xx_mmcsd0_resources[] = {
608 .name =
"davinci_mmc",
610 .num_resources =
ARRAY_SIZE(da8xx_mmcsd0_resources),
611 .resource = da8xx_mmcsd0_resources,
616 da8xx_mmcsd0_device.
dev.platform_data =
config;
620 #ifdef CONFIG_ARCH_DAVINCI_DA850
621 static struct resource da850_mmcsd1_resources[] = {
645 .
name =
"davinci_mmc",
647 .num_resources =
ARRAY_SIZE(da850_mmcsd1_resources),
648 .resource = da850_mmcsd1_resources,
653 da850_mmcsd1_device.
dev.platform_data =
config;
658 static struct resource da8xx_rtc_resources[] = {
679 .num_resources =
ARRAY_SIZE(da8xx_rtc_resources),
680 .resource = da8xx_rtc_resources,
706 static void __iomem *da8xx_ddr2_ctlr_base;
709 if (da8xx_ddr2_ctlr_base)
710 return da8xx_ddr2_ctlr_base;
713 if (!da8xx_ddr2_ctlr_base)
714 pr_warning(
"%s: Unable to map DDR2 controller", __func__);
716 return da8xx_ddr2_ctlr_base;
719 static struct resource da8xx_cpuidle_resources[] = {
734 .name =
"cpuidle-davinci",
735 .num_resources =
ARRAY_SIZE(da8xx_cpuidle_resources),
736 .resource = da8xx_cpuidle_resources,
738 .platform_data = &da8xx_cpuidle_pdata,
749 static struct resource da8xx_spi0_resources[] = {
772 static struct resource da8xx_spi1_resources[] = {
810 .name =
"spi_davinci",
812 .num_resources =
ARRAY_SIZE(da8xx_spi0_resources),
813 .resource = da8xx_spi0_resources,
815 .platform_data = &da8xx_spi_pdata[0],
819 .name =
"spi_davinci",
821 .num_resources =
ARRAY_SIZE(da8xx_spi1_resources),
822 .resource = da8xx_spi1_resources,
824 .platform_data = &da8xx_spi_pdata[1],
834 if (instance < 0 || instance > 1)
839 pr_warning(
"%s: failed to register board info for spi %d :"
840 " %d\n", __func__, instance, ret);
852 #ifdef CONFIG_ARCH_DAVINCI_DA850
854 static struct resource da850_sata_resources[] = {
867 #define SATA_P0PHYCR_REG 0x178
869 #define SATA_PHY_MPY(x) ((x) << 0)
870 #define SATA_PHY_LOS(x) ((x) << 6)
871 #define SATA_PHY_RXCDR(x) ((x) << 10)
872 #define SATA_PHY_RXEQ(x) ((x) << 13)
873 #define SATA_PHY_TXSWING(x) ((x) << 19)
874 #define SATA_PHY_ENPLL(x) ((x) << 31)
876 static struct clk *da850_sata_clk;
877 static unsigned long da850_sata_refclkpn;
880 #define KHZ_TO_HZ(freq) ((freq) * 1000)
881 static unsigned long da850_sata_xtal[] = {
900 if (IS_ERR(da850_sata_clk))
901 return PTR_ERR(da850_sata_clk);
913 for (i = 0; i <
ARRAY_SIZE(da850_sata_xtal); i++)
914 if (da850_sata_xtal[i] == da850_sata_refclkpn)
922 val = SATA_PHY_MPY(i + 1) |
926 SATA_PHY_TXSWING(3) |
940 static void da850_sata_exit(
struct device *dev)
947 .
init = da850_sata_init,
948 .exit = da850_sata_exit,
957 .platform_data = &da850_sata_pdata,
958 .dma_mask = &da850_sata_dmamask,
961 .num_resources =
ARRAY_SIZE(da850_sata_resources),
962 .resource = da850_sata_resources,
967 da850_sata_refclkpn = refclkpn;
968 if (!da850_sata_refclkpn)