diff options
| -rw-r--r-- | arch/arm/mach-davinci/dm365.c | 70 | ||||
| -rw-r--r-- | arch/arm/mach-davinci/include/mach/dm365.h | 2 |
2 files changed, 72 insertions, 0 deletions
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c index e88f2624df68..27772e18e45b 100644 --- a/arch/arm/mach-davinci/dm365.c +++ b/arch/arm/mach-davinci/dm365.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
| 19 | #include <linux/dma-mapping.h> | 19 | #include <linux/dma-mapping.h> |
| 20 | #include <linux/gpio.h> | 20 | #include <linux/gpio.h> |
| 21 | #include <linux/spi/spi.h> | ||
| 21 | 22 | ||
| 22 | #include <asm/mach/map.h> | 23 | #include <asm/mach/map.h> |
| 23 | 24 | ||
| @@ -32,6 +33,8 @@ | |||
| 32 | #include <mach/common.h> | 33 | #include <mach/common.h> |
| 33 | #include <mach/asp.h> | 34 | #include <mach/asp.h> |
| 34 | #include <mach/keyscan.h> | 35 | #include <mach/keyscan.h> |
| 36 | #include <mach/spi.h> | ||
| 37 | |||
| 35 | 38 | ||
| 36 | #include "clock.h" | 39 | #include "clock.h" |
| 37 | #include "mux.h" | 40 | #include "mux.h" |
| @@ -611,6 +614,73 @@ EVT_CFG(DM365, EVT3_VC_RX, 1, 1, 1, false) | |||
| 611 | #endif | 614 | #endif |
| 612 | }; | 615 | }; |
| 613 | 616 | ||
| 617 | static u64 dm365_spi0_dma_mask = DMA_BIT_MASK(32); | ||
| 618 | |||
| 619 | static struct davinci_spi_platform_data dm365_spi0_pdata = { | ||
| 620 | .version = SPI_VERSION_1, | ||
| 621 | .num_chipselect = 2, | ||
| 622 | .clk_internal = 1, | ||
| 623 | .cs_hold = 1, | ||
| 624 | .intr_level = 0, | ||
| 625 | .poll_mode = 1, /* 0 -> interrupt mode 1-> polling mode */ | ||
| 626 | .c2tdelay = 0, | ||
| 627 | .t2cdelay = 0, | ||
| 628 | }; | ||
| 629 | |||
| 630 | static struct resource dm365_spi0_resources[] = { | ||
| 631 | { | ||
| 632 | .start = 0x01c66000, | ||
| 633 | .end = 0x01c667ff, | ||
| 634 | .flags = IORESOURCE_MEM, | ||
| 635 | }, | ||
| 636 | { | ||
| 637 | .start = IRQ_DM365_SPIINT0_0, | ||
| 638 | .flags = IORESOURCE_IRQ, | ||
| 639 | }, | ||
| 640 | { | ||
| 641 | .start = 17, | ||
| 642 | .flags = IORESOURCE_DMA, | ||
| 643 | }, | ||
| 644 | { | ||
| 645 | .start = 16, | ||
| 646 | .flags = IORESOURCE_DMA, | ||
| 647 | }, | ||
| 648 | { | ||
| 649 | .start = EVENTQ_3, | ||
| 650 | .flags = IORESOURCE_DMA, | ||
| 651 | }, | ||
| 652 | }; | ||
| 653 | |||
| 654 | static struct platform_device dm365_spi0_device = { | ||
| 655 | .name = "spi_davinci", | ||
| 656 | .id = 0, | ||
| 657 | .dev = { | ||
| 658 | .dma_mask = &dm365_spi0_dma_mask, | ||
| 659 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
| 660 | .platform_data = &dm365_spi0_pdata, | ||
| 661 | }, | ||
| 662 | .num_resources = ARRAY_SIZE(dm365_spi0_resources), | ||
| 663 | .resource = dm365_spi0_resources, | ||
| 664 | }; | ||
| 665 | |||
| 666 | void __init dm365_init_spi0(unsigned chipselect_mask, | ||
| 667 | struct spi_board_info *info, unsigned len) | ||
| 668 | { | ||
| 669 | davinci_cfg_reg(DM365_SPI0_SCLK); | ||
| 670 | davinci_cfg_reg(DM365_SPI0_SDI); | ||
| 671 | davinci_cfg_reg(DM365_SPI0_SDO); | ||
| 672 | |||
| 673 | /* not all slaves will be wired up */ | ||
| 674 | if (chipselect_mask & BIT(0)) | ||
| 675 | davinci_cfg_reg(DM365_SPI0_SDENA0); | ||
| 676 | if (chipselect_mask & BIT(1)) | ||
| 677 | davinci_cfg_reg(DM365_SPI0_SDENA1); | ||
| 678 | |||
| 679 | spi_register_board_info(info, len); | ||
| 680 | |||
| 681 | platform_device_register(&dm365_spi0_device); | ||
| 682 | } | ||
| 683 | |||
| 614 | static struct emac_platform_data dm365_emac_pdata = { | 684 | static struct emac_platform_data dm365_emac_pdata = { |
| 615 | .ctrl_reg_offset = DM365_EMAC_CNTRL_OFFSET, | 685 | .ctrl_reg_offset = DM365_EMAC_CNTRL_OFFSET, |
| 616 | .ctrl_mod_reg_offset = DM365_EMAC_CNTRL_MOD_OFFSET, | 686 | .ctrl_mod_reg_offset = DM365_EMAC_CNTRL_MOD_OFFSET, |
diff --git a/arch/arm/mach-davinci/include/mach/dm365.h b/arch/arm/mach-davinci/include/mach/dm365.h index fdf6f8507cc3..3a37b5a6983c 100644 --- a/arch/arm/mach-davinci/include/mach/dm365.h +++ b/arch/arm/mach-davinci/include/mach/dm365.h | |||
| @@ -41,6 +41,8 @@ void __init dm365_init_asp(struct snd_platform_data *pdata); | |||
| 41 | void __init dm365_init_vc(struct snd_platform_data *pdata); | 41 | void __init dm365_init_vc(struct snd_platform_data *pdata); |
| 42 | void __init dm365_init_ks(struct davinci_ks_platform_data *pdata); | 42 | void __init dm365_init_ks(struct davinci_ks_platform_data *pdata); |
| 43 | void __init dm365_init_rtc(void); | 43 | void __init dm365_init_rtc(void); |
| 44 | void dm365_init_spi0(unsigned chipselect_mask, | ||
| 45 | struct spi_board_info *info, unsigned len); | ||
| 44 | 46 | ||
| 45 | void dm365_set_vpfe_config(struct vpfe_config *cfg); | 47 | void dm365_set_vpfe_config(struct vpfe_config *cfg); |
| 46 | #endif /* __ASM_ARCH_DM365_H */ | 48 | #endif /* __ASM_ARCH_DM365_H */ |
