diff options
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-omap2/am35xx-emac.c | 90 | ||||
-rw-r--r-- | arch/arm/mach-omap2/clock3xxx_data.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap2/include/mach/am35xx.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 105 |
4 files changed, 154 insertions, 45 deletions
diff --git a/arch/arm/mach-omap2/am35xx-emac.c b/arch/arm/mach-omap2/am35xx-emac.c index 447682c4e11c..2c90ac686686 100644 --- a/arch/arm/mach-omap2/am35xx-emac.c +++ b/arch/arm/mach-omap2/am35xx-emac.c | |||
@@ -15,27 +15,13 @@ | |||
15 | * General Public License for more details. | 15 | * General Public License for more details. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/clk.h> | 18 | #include <linux/err.h> |
19 | #include <linux/davinci_emac.h> | 19 | #include <linux/davinci_emac.h> |
20 | #include <linux/platform_device.h> | 20 | #include <asm/system.h> |
21 | #include <plat/irqs.h> | 21 | #include <plat/omap_device.h> |
22 | #include <mach/am35xx.h> | 22 | #include <mach/am35xx.h> |
23 | |||
24 | #include "control.h" | 23 | #include "control.h" |
25 | 24 | #include "am35xx-emac.h" | |
26 | static struct mdio_platform_data am35xx_emac_mdio_pdata; | ||
27 | |||
28 | static struct resource am35xx_emac_mdio_resources[] = { | ||
29 | DEFINE_RES_MEM(AM35XX_IPSS_EMAC_BASE + AM35XX_EMAC_MDIO_OFFSET, SZ_4K), | ||
30 | }; | ||
31 | |||
32 | static struct platform_device am35xx_emac_mdio_device = { | ||
33 | .name = "davinci_mdio", | ||
34 | .id = 0, | ||
35 | .num_resources = ARRAY_SIZE(am35xx_emac_mdio_resources), | ||
36 | .resource = am35xx_emac_mdio_resources, | ||
37 | .dev.platform_data = &am35xx_emac_mdio_pdata, | ||
38 | }; | ||
39 | 25 | ||
40 | static void am35xx_enable_emac_int(void) | 26 | static void am35xx_enable_emac_int(void) |
41 | { | 27 | { |
@@ -69,41 +55,57 @@ static struct emac_platform_data am35xx_emac_pdata = { | |||
69 | .interrupt_disable = am35xx_disable_emac_int, | 55 | .interrupt_disable = am35xx_disable_emac_int, |
70 | }; | 56 | }; |
71 | 57 | ||
72 | static struct resource am35xx_emac_resources[] = { | 58 | static struct mdio_platform_data am35xx_mdio_pdata; |
73 | DEFINE_RES_MEM(AM35XX_IPSS_EMAC_BASE, 0x30000), | ||
74 | DEFINE_RES_IRQ(INT_35XX_EMAC_C0_RXTHRESH_IRQ), | ||
75 | DEFINE_RES_IRQ(INT_35XX_EMAC_C0_RX_PULSE_IRQ), | ||
76 | DEFINE_RES_IRQ(INT_35XX_EMAC_C0_TX_PULSE_IRQ), | ||
77 | DEFINE_RES_IRQ(INT_35XX_EMAC_C0_MISC_PULSE_IRQ), | ||
78 | }; | ||
79 | 59 | ||
80 | static struct platform_device am35xx_emac_device = { | 60 | static int __init omap_davinci_emac_dev_init(struct omap_hwmod *oh, |
81 | .name = "davinci_emac", | 61 | void *pdata, int pdata_len) |
82 | .id = -1, | 62 | { |
83 | .num_resources = ARRAY_SIZE(am35xx_emac_resources), | 63 | struct platform_device *pdev; |
84 | .resource = am35xx_emac_resources, | 64 | |
85 | .dev = { | 65 | pdev = omap_device_build(oh->class->name, 0, oh, pdata, pdata_len, |
86 | .platform_data = &am35xx_emac_pdata, | 66 | NULL, 0, false); |
87 | }, | 67 | if (IS_ERR(pdev)) { |
88 | }; | 68 | WARN(1, "Can't build omap_device for %s:%s.\n", |
69 | oh->class->name, oh->name); | ||
70 | return PTR_ERR(pdev); | ||
71 | } | ||
72 | |||
73 | return 0; | ||
74 | } | ||
89 | 75 | ||
90 | void __init am35xx_emac_init(unsigned long mdio_bus_freq, u8 rmii_en) | 76 | void __init am35xx_emac_init(unsigned long mdio_bus_freq, u8 rmii_en) |
91 | { | 77 | { |
78 | struct omap_hwmod *oh; | ||
92 | u32 v; | 79 | u32 v; |
93 | int err; | 80 | int ret; |
94 | 81 | ||
95 | am35xx_emac_pdata.rmii_en = rmii_en; | 82 | oh = omap_hwmod_lookup("davinci_mdio"); |
96 | am35xx_emac_mdio_pdata.bus_freq = mdio_bus_freq; | 83 | if (!oh) { |
97 | err = platform_device_register(&am35xx_emac_device); | 84 | pr_err("Could not find davinci_mdio hwmod\n"); |
98 | if (err) { | 85 | return; |
99 | pr_err("AM35x: failed registering EMAC device: %d\n", err); | 86 | } |
87 | |||
88 | am35xx_mdio_pdata.bus_freq = mdio_bus_freq; | ||
89 | |||
90 | ret = omap_davinci_emac_dev_init(oh, &am35xx_mdio_pdata, | ||
91 | sizeof(am35xx_mdio_pdata)); | ||
92 | if (ret) { | ||
93 | pr_err("Could not build davinci_mdio hwmod device\n"); | ||
100 | return; | 94 | return; |
101 | } | 95 | } |
102 | 96 | ||
103 | err = platform_device_register(&am35xx_emac_mdio_device); | 97 | oh = omap_hwmod_lookup("davinci_emac"); |
104 | if (err) { | 98 | if (!oh) { |
105 | pr_err("AM35x: failed registering EMAC MDIO device: %d\n", err); | 99 | pr_err("Could not find davinci_emac hwmod\n"); |
106 | platform_device_unregister(&am35xx_emac_device); | 100 | return; |
101 | } | ||
102 | |||
103 | am35xx_emac_pdata.rmii_en = rmii_en; | ||
104 | |||
105 | ret = omap_davinci_emac_dev_init(oh, &am35xx_emac_pdata, | ||
106 | sizeof(am35xx_emac_pdata)); | ||
107 | if (ret) { | ||
108 | pr_err("Could not build davinci_emac hwmod device\n"); | ||
107 | return; | 109 | return; |
108 | } | 110 | } |
109 | 111 | ||
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c index 1efdec236ae8..10c139580ff1 100644 --- a/arch/arm/mach-omap2/clock3xxx_data.c +++ b/arch/arm/mach-omap2/clock3xxx_data.c | |||
@@ -3474,7 +3474,7 @@ static struct omap_clk omap3xxx_clks[] = { | |||
3474 | CLK(NULL, "ipss_ick", &ipss_ick, CK_AM35XX), | 3474 | CLK(NULL, "ipss_ick", &ipss_ick, CK_AM35XX), |
3475 | CLK(NULL, "rmii_ck", &rmii_ck, CK_AM35XX), | 3475 | CLK(NULL, "rmii_ck", &rmii_ck, CK_AM35XX), |
3476 | CLK(NULL, "pclk_ck", &pclk_ck, CK_AM35XX), | 3476 | CLK(NULL, "pclk_ck", &pclk_ck, CK_AM35XX), |
3477 | CLK("davinci_emac", NULL, &emac_ick, CK_AM35XX), | 3477 | CLK("davinci_emac.0", NULL, &emac_ick, CK_AM35XX), |
3478 | CLK("davinci_mdio.0", NULL, &emac_fck, CK_AM35XX), | 3478 | CLK("davinci_mdio.0", NULL, &emac_fck, CK_AM35XX), |
3479 | CLK("vpfe-capture", "master", &vpfe_ick, CK_AM35XX), | 3479 | CLK("vpfe-capture", "master", &vpfe_ick, CK_AM35XX), |
3480 | CLK("vpfe-capture", "slave", &vpfe_fck, CK_AM35XX), | 3480 | CLK("vpfe-capture", "slave", &vpfe_fck, CK_AM35XX), |
diff --git a/arch/arm/mach-omap2/include/mach/am35xx.h b/arch/arm/mach-omap2/include/mach/am35xx.h index f1e13d1ca5e7..95594495fcf6 100644 --- a/arch/arm/mach-omap2/include/mach/am35xx.h +++ b/arch/arm/mach-omap2/include/mach/am35xx.h | |||
@@ -36,6 +36,8 @@ | |||
36 | #define AM35XX_EMAC_CNTRL_MOD_OFFSET (0x0) | 36 | #define AM35XX_EMAC_CNTRL_MOD_OFFSET (0x0) |
37 | #define AM35XX_EMAC_CNTRL_RAM_OFFSET (0x20000) | 37 | #define AM35XX_EMAC_CNTRL_RAM_OFFSET (0x20000) |
38 | #define AM35XX_EMAC_MDIO_OFFSET (0x30000) | 38 | #define AM35XX_EMAC_MDIO_OFFSET (0x30000) |
39 | #define AM35XX_IPSS_MDIO_BASE (AM35XX_IPSS_EMAC_BASE + \ | ||
40 | AM35XX_EMAC_MDIO_OFFSET) | ||
39 | #define AM35XX_EMAC_CNTRL_RAM_SIZE (0x2000) | 41 | #define AM35XX_EMAC_CNTRL_RAM_SIZE (0x2000) |
40 | #define AM35XX_EMAC_RAM_ADDR (AM3517_EMAC_BASE + \ | 42 | #define AM35XX_EMAC_RAM_ADDR (AM3517_EMAC_BASE + \ |
41 | AM3517_EMAC_CNTRL_RAM_OFFSET) | 43 | AM3517_EMAC_CNTRL_RAM_OFFSET) |
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index b26d3c9bca16..a16b832f1d9c 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | |||
@@ -3138,6 +3138,107 @@ static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__counter_32k = { | |||
3138 | .user = OCP_USER_MPU | OCP_USER_SDMA, | 3138 | .user = OCP_USER_MPU | OCP_USER_SDMA, |
3139 | }; | 3139 | }; |
3140 | 3140 | ||
3141 | /* am35xx has Davinci MDIO & EMAC */ | ||
3142 | static struct omap_hwmod_class am35xx_mdio_class = { | ||
3143 | .name = "davinci_mdio", | ||
3144 | }; | ||
3145 | |||
3146 | static struct omap_hwmod am35xx_mdio_hwmod = { | ||
3147 | .name = "davinci_mdio", | ||
3148 | .class = &am35xx_mdio_class, | ||
3149 | .flags = HWMOD_NO_IDLEST, | ||
3150 | }; | ||
3151 | |||
3152 | /* | ||
3153 | * XXX Should be connected to an IPSS hwmod, not the L3 directly; | ||
3154 | * but this will probably require some additional hwmod core support, | ||
3155 | * so is left as a future to-do item. | ||
3156 | */ | ||
3157 | static struct omap_hwmod_ocp_if am35xx_mdio__l3 = { | ||
3158 | .master = &am35xx_mdio_hwmod, | ||
3159 | .slave = &omap3xxx_l3_main_hwmod, | ||
3160 | .clk = "emac_fck", | ||
3161 | .user = OCP_USER_MPU, | ||
3162 | }; | ||
3163 | |||
3164 | static struct omap_hwmod_addr_space am35xx_mdio_addrs[] = { | ||
3165 | { | ||
3166 | .pa_start = AM35XX_IPSS_MDIO_BASE, | ||
3167 | .pa_end = AM35XX_IPSS_MDIO_BASE + SZ_4K - 1, | ||
3168 | .flags = ADDR_TYPE_RT, | ||
3169 | }, | ||
3170 | { } | ||
3171 | }; | ||
3172 | |||
3173 | /* l4_core -> davinci mdio */ | ||
3174 | /* | ||
3175 | * XXX Should be connected to an IPSS hwmod, not the L4_CORE directly; | ||
3176 | * but this will probably require some additional hwmod core support, | ||
3177 | * so is left as a future to-do item. | ||
3178 | */ | ||
3179 | static struct omap_hwmod_ocp_if am35xx_l4_core__mdio = { | ||
3180 | .master = &omap3xxx_l4_core_hwmod, | ||
3181 | .slave = &am35xx_mdio_hwmod, | ||
3182 | .clk = "emac_fck", | ||
3183 | .addr = am35xx_mdio_addrs, | ||
3184 | .user = OCP_USER_MPU, | ||
3185 | }; | ||
3186 | |||
3187 | static struct omap_hwmod_irq_info am35xx_emac_mpu_irqs[] = { | ||
3188 | { .name = "rxthresh", .irq = INT_35XX_EMAC_C0_RXTHRESH_IRQ }, | ||
3189 | { .name = "rx_pulse", .irq = INT_35XX_EMAC_C0_RX_PULSE_IRQ }, | ||
3190 | { .name = "tx_pulse", .irq = INT_35XX_EMAC_C0_TX_PULSE_IRQ }, | ||
3191 | { .name = "misc_pulse", .irq = INT_35XX_EMAC_C0_MISC_PULSE_IRQ }, | ||
3192 | { .irq = -1 } | ||
3193 | }; | ||
3194 | |||
3195 | static struct omap_hwmod_class am35xx_emac_class = { | ||
3196 | .name = "davinci_emac", | ||
3197 | }; | ||
3198 | |||
3199 | static struct omap_hwmod am35xx_emac_hwmod = { | ||
3200 | .name = "davinci_emac", | ||
3201 | .mpu_irqs = am35xx_emac_mpu_irqs, | ||
3202 | .class = &am35xx_emac_class, | ||
3203 | .flags = HWMOD_NO_IDLEST, | ||
3204 | }; | ||
3205 | |||
3206 | /* l3_core -> davinci emac interface */ | ||
3207 | /* | ||
3208 | * XXX Should be connected to an IPSS hwmod, not the L3 directly; | ||
3209 | * but this will probably require some additional hwmod core support, | ||
3210 | * so is left as a future to-do item. | ||
3211 | */ | ||
3212 | static struct omap_hwmod_ocp_if am35xx_emac__l3 = { | ||
3213 | .master = &am35xx_emac_hwmod, | ||
3214 | .slave = &omap3xxx_l3_main_hwmod, | ||
3215 | .clk = "emac_ick", | ||
3216 | .user = OCP_USER_MPU, | ||
3217 | }; | ||
3218 | |||
3219 | static struct omap_hwmod_addr_space am35xx_emac_addrs[] = { | ||
3220 | { | ||
3221 | .pa_start = AM35XX_IPSS_EMAC_BASE, | ||
3222 | .pa_end = AM35XX_IPSS_EMAC_BASE + 0x30000 - 1, | ||
3223 | .flags = ADDR_TYPE_RT, | ||
3224 | }, | ||
3225 | { } | ||
3226 | }; | ||
3227 | |||
3228 | /* l4_core -> davinci emac */ | ||
3229 | /* | ||
3230 | * XXX Should be connected to an IPSS hwmod, not the L4_CORE directly; | ||
3231 | * but this will probably require some additional hwmod core support, | ||
3232 | * so is left as a future to-do item. | ||
3233 | */ | ||
3234 | static struct omap_hwmod_ocp_if am35xx_l4_core__emac = { | ||
3235 | .master = &omap3xxx_l4_core_hwmod, | ||
3236 | .slave = &am35xx_emac_hwmod, | ||
3237 | .clk = "emac_ick", | ||
3238 | .addr = am35xx_emac_addrs, | ||
3239 | .user = OCP_USER_MPU, | ||
3240 | }; | ||
3241 | |||
3141 | static struct omap_hwmod_ocp_if *omap3xxx_hwmod_ocp_ifs[] __initdata = { | 3242 | static struct omap_hwmod_ocp_if *omap3xxx_hwmod_ocp_ifs[] __initdata = { |
3142 | &omap3xxx_l3_main__l4_core, | 3243 | &omap3xxx_l3_main__l4_core, |
3143 | &omap3xxx_l3_main__l4_per, | 3244 | &omap3xxx_l3_main__l4_per, |
@@ -3266,6 +3367,10 @@ static struct omap_hwmod_ocp_if *am35xx_hwmod_ocp_ifs[] __initdata = { | |||
3266 | &omap3xxx_l4_core__usb_tll_hs, | 3367 | &omap3xxx_l4_core__usb_tll_hs, |
3267 | &omap3xxx_l4_core__es3plus_mmc1, | 3368 | &omap3xxx_l4_core__es3plus_mmc1, |
3268 | &omap3xxx_l4_core__es3plus_mmc2, | 3369 | &omap3xxx_l4_core__es3plus_mmc2, |
3370 | &am35xx_mdio__l3, | ||
3371 | &am35xx_l4_core__mdio, | ||
3372 | &am35xx_emac__l3, | ||
3373 | &am35xx_l4_core__emac, | ||
3269 | NULL | 3374 | NULL |
3270 | }; | 3375 | }; |
3271 | 3376 | ||