diff options
| author | Charulatha V <charu@ti.com> | 2011-02-17 12:53:09 -0500 |
|---|---|---|
| committer | Tony Lindgren <tony@atomide.com> | 2011-02-17 12:53:09 -0500 |
| commit | 617871deacea4e1a5713dd37564dc94a392d80c3 (patch) | |
| tree | 396c807d3f9c4fbeb3a3906b7299e23e53658d97 | |
| parent | d9e45731debd83e2b249be349993595907dddeae (diff) | |
OMAP2420: hwmod data: Add McSPI
Update the omap2420 hwmod data with the McSPI info.
Add a device attribute structure which will be used
for passing number of chipselects from hwmod data.
Add revision macros to be passed from rev field from
hwmod.
Signed-off-by: Charulatha V <charu@ti.com>
Signed-off-by: Govindraj.R <govindraj.raja@ti.com>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Reviewed-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
| -rw-r--r-- | arch/arm/mach-omap2/omap_hwmod_2420_data.c | 156 | ||||
| -rw-r--r-- | arch/arm/plat-omap/include/plat/mcspi.h | 8 |
2 files changed, 164 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c index b85c630b64d6..7fffd340c76f 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <plat/serial.h> | 18 | #include <plat/serial.h> |
| 19 | #include <plat/i2c.h> | 19 | #include <plat/i2c.h> |
| 20 | #include <plat/gpio.h> | 20 | #include <plat/gpio.h> |
| 21 | #include <plat/mcspi.h> | ||
| 21 | 22 | ||
| 22 | #include "omap_hwmod_common_data.h" | 23 | #include "omap_hwmod_common_data.h" |
| 23 | 24 | ||
| @@ -44,6 +45,8 @@ static struct omap_hwmod omap2420_gpio2_hwmod; | |||
| 44 | static struct omap_hwmod omap2420_gpio3_hwmod; | 45 | static struct omap_hwmod omap2420_gpio3_hwmod; |
| 45 | static struct omap_hwmod omap2420_gpio4_hwmod; | 46 | static struct omap_hwmod omap2420_gpio4_hwmod; |
| 46 | static struct omap_hwmod omap2420_dma_system_hwmod; | 47 | static struct omap_hwmod omap2420_dma_system_hwmod; |
| 48 | static struct omap_hwmod omap2420_mcspi1_hwmod; | ||
| 49 | static struct omap_hwmod omap2420_mcspi2_hwmod; | ||
| 47 | 50 | ||
| 48 | /* L3 -> L4_CORE interface */ | 51 | /* L3 -> L4_CORE interface */ |
| 49 | static struct omap_hwmod_ocp_if omap2420_l3_main__l4_core = { | 52 | static struct omap_hwmod_ocp_if omap2420_l3_main__l4_core = { |
| @@ -88,6 +91,42 @@ static struct omap_hwmod omap2420_uart3_hwmod; | |||
| 88 | static struct omap_hwmod omap2420_i2c1_hwmod; | 91 | static struct omap_hwmod omap2420_i2c1_hwmod; |
| 89 | static struct omap_hwmod omap2420_i2c2_hwmod; | 92 | static struct omap_hwmod omap2420_i2c2_hwmod; |
| 90 | 93 | ||
| 94 | /* l4 core -> mcspi1 interface */ | ||
| 95 | static struct omap_hwmod_addr_space omap2420_mcspi1_addr_space[] = { | ||
| 96 | { | ||
| 97 | .pa_start = 0x48098000, | ||
| 98 | .pa_end = 0x480980ff, | ||
| 99 | .flags = ADDR_TYPE_RT, | ||
| 100 | }, | ||
| 101 | }; | ||
| 102 | |||
| 103 | static struct omap_hwmod_ocp_if omap2420_l4_core__mcspi1 = { | ||
| 104 | .master = &omap2420_l4_core_hwmod, | ||
| 105 | .slave = &omap2420_mcspi1_hwmod, | ||
| 106 | .clk = "mcspi1_ick", | ||
| 107 | .addr = omap2420_mcspi1_addr_space, | ||
| 108 | .addr_cnt = ARRAY_SIZE(omap2420_mcspi1_addr_space), | ||
| 109 | .user = OCP_USER_MPU | OCP_USER_SDMA, | ||
| 110 | }; | ||
| 111 | |||
| 112 | /* l4 core -> mcspi2 interface */ | ||
| 113 | static struct omap_hwmod_addr_space omap2420_mcspi2_addr_space[] = { | ||
| 114 | { | ||
| 115 | .pa_start = 0x4809a000, | ||
| 116 | .pa_end = 0x4809a0ff, | ||
| 117 | .flags = ADDR_TYPE_RT, | ||
| 118 | }, | ||
| 119 | }; | ||
| 120 | |||
| 121 | static struct omap_hwmod_ocp_if omap2420_l4_core__mcspi2 = { | ||
| 122 | .master = &omap2420_l4_core_hwmod, | ||
| 123 | .slave = &omap2420_mcspi2_hwmod, | ||
| 124 | .clk = "mcspi2_ick", | ||
| 125 | .addr = omap2420_mcspi2_addr_space, | ||
| 126 | .addr_cnt = ARRAY_SIZE(omap2420_mcspi2_addr_space), | ||
| 127 | .user = OCP_USER_MPU | OCP_USER_SDMA, | ||
| 128 | }; | ||
| 129 | |||
| 91 | /* L4_CORE -> L4_WKUP interface */ | 130 | /* L4_CORE -> L4_WKUP interface */ |
| 92 | static struct omap_hwmod_ocp_if omap2420_l4_core__l4_wkup = { | 131 | static struct omap_hwmod_ocp_if omap2420_l4_core__l4_wkup = { |
| 93 | .master = &omap2420_l4_core_hwmod, | 132 | .master = &omap2420_l4_core_hwmod, |
| @@ -864,6 +903,119 @@ static struct omap_hwmod omap2420_dma_system_hwmod = { | |||
| 864 | .flags = HWMOD_NO_IDLEST, | 903 | .flags = HWMOD_NO_IDLEST, |
| 865 | }; | 904 | }; |
| 866 | 905 | ||
| 906 | /* | ||
| 907 | * 'mcspi' class | ||
| 908 | * multichannel serial port interface (mcspi) / master/slave synchronous serial | ||
| 909 | * bus | ||
| 910 | */ | ||
| 911 | |||
| 912 | static struct omap_hwmod_class_sysconfig omap2420_mcspi_sysc = { | ||
| 913 | .rev_offs = 0x0000, | ||
| 914 | .sysc_offs = 0x0010, | ||
| 915 | .syss_offs = 0x0014, | ||
| 916 | .sysc_flags = (SYSC_HAS_CLOCKACTIVITY | SYSC_HAS_SIDLEMODE | | ||
| 917 | SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | | ||
| 918 | SYSC_HAS_AUTOIDLE | SYSS_HAS_RESET_STATUS), | ||
| 919 | .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), | ||
| 920 | .sysc_fields = &omap_hwmod_sysc_type1, | ||
| 921 | }; | ||
| 922 | |||
| 923 | static struct omap_hwmod_class omap2420_mcspi_class = { | ||
| 924 | .name = "mcspi", | ||
| 925 | .sysc = &omap2420_mcspi_sysc, | ||
| 926 | .rev = OMAP2_MCSPI_REV, | ||
| 927 | }; | ||
| 928 | |||
| 929 | /* mcspi1 */ | ||
| 930 | static struct omap_hwmod_irq_info omap2420_mcspi1_mpu_irqs[] = { | ||
| 931 | { .irq = 65 }, | ||
| 932 | }; | ||
| 933 | |||
| 934 | static struct omap_hwmod_dma_info omap2420_mcspi1_sdma_reqs[] = { | ||
| 935 | { .name = "tx0", .dma_req = 35 }, /* DMA_SPI1_TX0 */ | ||
| 936 | { .name = "rx0", .dma_req = 36 }, /* DMA_SPI1_RX0 */ | ||
| 937 | { .name = "tx1", .dma_req = 37 }, /* DMA_SPI1_TX1 */ | ||
| 938 | { .name = "rx1", .dma_req = 38 }, /* DMA_SPI1_RX1 */ | ||
| 939 | { .name = "tx2", .dma_req = 39 }, /* DMA_SPI1_TX2 */ | ||
| 940 | { .name = "rx2", .dma_req = 40 }, /* DMA_SPI1_RX2 */ | ||
| 941 | { .name = "tx3", .dma_req = 41 }, /* DMA_SPI1_TX3 */ | ||
| 942 | { .name = "rx3", .dma_req = 42 }, /* DMA_SPI1_RX3 */ | ||
| 943 | }; | ||
| 944 | |||
| 945 | static struct omap_hwmod_ocp_if *omap2420_mcspi1_slaves[] = { | ||
| 946 | &omap2420_l4_core__mcspi1, | ||
| 947 | }; | ||
| 948 | |||
| 949 | static struct omap2_mcspi_dev_attr omap_mcspi1_dev_attr = { | ||
| 950 | .num_chipselect = 4, | ||
| 951 | }; | ||
| 952 | |||
| 953 | static struct omap_hwmod omap2420_mcspi1_hwmod = { | ||
| 954 | .name = "mcspi1_hwmod", | ||
| 955 | .mpu_irqs = omap2420_mcspi1_mpu_irqs, | ||
| 956 | .mpu_irqs_cnt = ARRAY_SIZE(omap2420_mcspi1_mpu_irqs), | ||
| 957 | .sdma_reqs = omap2420_mcspi1_sdma_reqs, | ||
| 958 | .sdma_reqs_cnt = ARRAY_SIZE(omap2420_mcspi1_sdma_reqs), | ||
| 959 | .main_clk = "mcspi1_fck", | ||
| 960 | .prcm = { | ||
| 961 | .omap2 = { | ||
| 962 | .module_offs = CORE_MOD, | ||
| 963 | .prcm_reg_id = 1, | ||
| 964 | .module_bit = OMAP24XX_EN_MCSPI1_SHIFT, | ||
| 965 | .idlest_reg_id = 1, | ||
| 966 | .idlest_idle_bit = OMAP24XX_ST_MCSPI1_SHIFT, | ||
| 967 | }, | ||
| 968 | }, | ||
| 969 | .slaves = omap2420_mcspi1_slaves, | ||
| 970 | .slaves_cnt = ARRAY_SIZE(omap2420_mcspi1_slaves), | ||
| 971 | .class = &omap2420_mcspi_class, | ||
| 972 | .dev_attr = &omap_mcspi1_dev_attr, | ||
| 973 | .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420), | ||
| 974 | }; | ||
| 975 | |||
| 976 | /* mcspi2 */ | ||
| 977 | static struct omap_hwmod_irq_info omap2420_mcspi2_mpu_irqs[] = { | ||
| 978 | { .irq = 66 }, | ||
| 979 | }; | ||
| 980 | |||
| 981 | static struct omap_hwmod_dma_info omap2420_mcspi2_sdma_reqs[] = { | ||
| 982 | { .name = "tx0", .dma_req = 43 }, /* DMA_SPI2_TX0 */ | ||
| 983 | { .name = "rx0", .dma_req = 44 }, /* DMA_SPI2_RX0 */ | ||
| 984 | { .name = "tx1", .dma_req = 45 }, /* DMA_SPI2_TX1 */ | ||
| 985 | { .name = "rx1", .dma_req = 46 }, /* DMA_SPI2_RX1 */ | ||
| 986 | }; | ||
| 987 | |||
| 988 | static struct omap_hwmod_ocp_if *omap2420_mcspi2_slaves[] = { | ||
| 989 | &omap2420_l4_core__mcspi2, | ||
| 990 | }; | ||
| 991 | |||
| 992 | static struct omap2_mcspi_dev_attr omap_mcspi2_dev_attr = { | ||
| 993 | .num_chipselect = 2, | ||
| 994 | }; | ||
| 995 | |||
| 996 | static struct omap_hwmod omap2420_mcspi2_hwmod = { | ||
| 997 | .name = "mcspi2_hwmod", | ||
| 998 | .mpu_irqs = omap2420_mcspi2_mpu_irqs, | ||
| 999 | .mpu_irqs_cnt = ARRAY_SIZE(omap2420_mcspi2_mpu_irqs), | ||
| 1000 | .sdma_reqs = omap2420_mcspi2_sdma_reqs, | ||
| 1001 | .sdma_reqs_cnt = ARRAY_SIZE(omap2420_mcspi2_sdma_reqs), | ||
| 1002 | .main_clk = "mcspi2_fck", | ||
| 1003 | .prcm = { | ||
| 1004 | .omap2 = { | ||
| 1005 | .module_offs = CORE_MOD, | ||
| 1006 | .prcm_reg_id = 1, | ||
| 1007 | .module_bit = OMAP24XX_EN_MCSPI2_SHIFT, | ||
| 1008 | .idlest_reg_id = 1, | ||
| 1009 | .idlest_idle_bit = OMAP24XX_ST_MCSPI2_SHIFT, | ||
| 1010 | }, | ||
| 1011 | }, | ||
| 1012 | .slaves = omap2420_mcspi2_slaves, | ||
| 1013 | .slaves_cnt = ARRAY_SIZE(omap2420_mcspi2_slaves), | ||
| 1014 | .class = &omap2420_mcspi_class, | ||
| 1015 | .dev_attr = &omap_mcspi2_dev_attr, | ||
| 1016 | .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420), | ||
| 1017 | }; | ||
| 1018 | |||
| 867 | static __initdata struct omap_hwmod *omap2420_hwmods[] = { | 1019 | static __initdata struct omap_hwmod *omap2420_hwmods[] = { |
| 868 | &omap2420_l3_main_hwmod, | 1020 | &omap2420_l3_main_hwmod, |
| 869 | &omap2420_l4_core_hwmod, | 1021 | &omap2420_l4_core_hwmod, |
| @@ -885,6 +1037,10 @@ static __initdata struct omap_hwmod *omap2420_hwmods[] = { | |||
| 885 | 1037 | ||
| 886 | /* dma_system class*/ | 1038 | /* dma_system class*/ |
| 887 | &omap2420_dma_system_hwmod, | 1039 | &omap2420_dma_system_hwmod, |
| 1040 | |||
| 1041 | /* mcspi class */ | ||
| 1042 | &omap2420_mcspi1_hwmod, | ||
| 1043 | &omap2420_mcspi2_hwmod, | ||
| 888 | NULL, | 1044 | NULL, |
| 889 | }; | 1045 | }; |
| 890 | 1046 | ||
diff --git a/arch/arm/plat-omap/include/plat/mcspi.h b/arch/arm/plat-omap/include/plat/mcspi.h index 1254e4945b6f..560e266da8a1 100644 --- a/arch/arm/plat-omap/include/plat/mcspi.h +++ b/arch/arm/plat-omap/include/plat/mcspi.h | |||
| @@ -1,10 +1,18 @@ | |||
| 1 | #ifndef _OMAP2_MCSPI_H | 1 | #ifndef _OMAP2_MCSPI_H |
| 2 | #define _OMAP2_MCSPI_H | 2 | #define _OMAP2_MCSPI_H |
| 3 | 3 | ||
| 4 | #define OMAP2_MCSPI_REV 0 | ||
| 5 | #define OMAP3_MCSPI_REV 1 | ||
| 6 | #define OMAP4_MCSPI_REV 2 | ||
| 7 | |||
| 4 | struct omap2_mcspi_platform_config { | 8 | struct omap2_mcspi_platform_config { |
| 5 | unsigned short num_cs; | 9 | unsigned short num_cs; |
| 6 | }; | 10 | }; |
| 7 | 11 | ||
| 12 | struct omap2_mcspi_dev_attr { | ||
| 13 | unsigned short num_chipselect; | ||
| 14 | }; | ||
| 15 | |||
| 8 | struct omap2_mcspi_device_config { | 16 | struct omap2_mcspi_device_config { |
| 9 | unsigned turbo_mode:1; | 17 | unsigned turbo_mode:1; |
| 10 | 18 | ||
