hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/arch/arm/mach-omap2/pdata-quirks.c
....@@ -1,11 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Legacy platform_data quirks
34 *
45 * Copyright (C) 2013 Texas Instruments
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.
96 */
107 #include <linux/clk.h>
118 #include <linux/davinci_emac.h>
....@@ -13,7 +10,6 @@
1310 #include <linux/init.h>
1411 #include <linux/kernel.h>
1512 #include <linux/of_platform.h>
16
-#include <linux/ti_wilink_st.h>
1713 #include <linux/wl12xx.h>
1814 #include <linux/mmc/card.h>
1915 #include <linux/mmc/host.h>
....@@ -27,14 +23,15 @@
2723 #include <linux/platform_data/ti-sysc.h>
2824 #include <linux/platform_data/wkup_m3.h>
2925 #include <linux/platform_data/asoc-ti-mcbsp.h>
26
+#include <linux/platform_data/ti-prm.h>
3027
28
+#include "clockdomain.h"
3129 #include "common.h"
3230 #include "common-board-devices.h"
3331 #include "control.h"
3432 #include "omap_device.h"
3533 #include "omap-secure.h"
3634 #include "soc.h"
37
-#include "hsmmc.h"
3835
3936 static struct omap_hsmmc_platform_data __maybe_unused mmc_pdata[2];
4037
....@@ -45,6 +42,17 @@
4542
4643 static struct of_dev_auxdata omap_auxdata_lookup[];
4744 static struct twl4030_gpio_platform_data twl_gpio_auxdata;
45
+
46
+#if IS_ENABLED(CONFIG_OMAP_IOMMU)
47
+int omap_iommu_set_pwrdm_constraint(struct platform_device *pdev, bool request,
48
+ u8 *pwrst);
49
+#else
50
+static inline int omap_iommu_set_pwrdm_constraint(struct platform_device *pdev,
51
+ bool request, u8 *pwrst)
52
+{
53
+ return 0;
54
+}
55
+#endif
4856
4957 #ifdef CONFIG_MACH_NOKIA_N8X0
5058 static void __init omap2420_n8x0_legacy_init(void)
....@@ -90,6 +98,13 @@
9098 .reset_name = "mmu",
9199 .assert_reset = omap_device_assert_hardreset,
92100 .deassert_reset = omap_device_deassert_hardreset,
101
+ .device_enable = omap_device_enable,
102
+ .device_idle = omap_device_idle,
103
+};
104
+
105
+static struct iommu_platform_data omap3_iommu_isp_pdata = {
106
+ .device_enable = omap_device_enable,
107
+ .device_idle = omap_device_idle,
93108 };
94109
95110 static int omap3_sbc_t3730_twl_callback(struct device *dev,
....@@ -138,53 +153,6 @@
138153 static void __init omap3_sbc_t3530_legacy_init(void)
139154 {
140155 omap3_sbc_t3x_usb_hub_init(167, "sb-t35 usb hub");
141
-}
142
-
143
-static struct ti_st_plat_data wilink_pdata = {
144
- .nshutdown_gpio = 137,
145
- .dev_name = "/dev/ttyO1",
146
- .flow_cntrl = 1,
147
- .baud_rate = 300000,
148
-};
149
-
150
-static struct platform_device wl18xx_device = {
151
- .name = "kim",
152
- .id = -1,
153
- .dev = {
154
- .platform_data = &wilink_pdata,
155
- }
156
-};
157
-
158
-static struct ti_st_plat_data wilink7_pdata = {
159
- .nshutdown_gpio = 162,
160
- .dev_name = "/dev/ttyO1",
161
- .flow_cntrl = 1,
162
- .baud_rate = 3000000,
163
-};
164
-
165
-static struct platform_device wl128x_device = {
166
- .name = "kim",
167
- .id = -1,
168
- .dev = {
169
- .platform_data = &wilink7_pdata,
170
- }
171
-};
172
-
173
-static struct platform_device btwilink_device = {
174
- .name = "btwilink",
175
- .id = -1,
176
-};
177
-
178
-static void __init omap3_igep0020_rev_f_legacy_init(void)
179
-{
180
- platform_device_register(&wl18xx_device);
181
- platform_device_register(&btwilink_device);
182
-}
183
-
184
-static void __init omap3_igep0030_rev_g_legacy_init(void)
185
-{
186
- platform_device_register(&wl18xx_device);
187
- platform_device_register(&btwilink_device);
188156 }
189157
190158 static void __init omap3_evm_legacy_init(void)
....@@ -269,7 +237,7 @@
269237 mmc_pdata[0].name = "external";
270238 mmc_pdata[1].name = "internal";
271239
272
- if (omap_type() == OMAP2_DEVICE_TYPE_SEC) {
240
+ if (omap_type() != OMAP2_DEVICE_TYPE_GP) {
273241 if (IS_ENABLED(CONFIG_ARM_ERRATA_430973)) {
274242 pr_info("RX-51: Enabling ARM errata 430973 workaround\n");
275243 /* set IBE to 1 */
....@@ -289,8 +257,6 @@
289257 static void __init omap3_logicpd_torpedo_init(void)
290258 {
291259 omap3_gpio126_127_129();
292
- platform_device_register(&wl128x_device);
293
- platform_device_register(&btwilink_device);
294260 }
295261
296262 /* omap3pandora legacy devices */
....@@ -305,14 +271,6 @@
305271 platform_device_register(&pandora_backlight);
306272 }
307273 #endif /* CONFIG_ARCH_OMAP3 */
308
-
309
-#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
310
-static struct iommu_platform_data omap4_iommu_pdata = {
311
- .reset_name = "mmu_cache",
312
- .assert_reset = omap_device_assert_hardreset,
313
- .deassert_reset = omap_device_deassert_hardreset,
314
-};
315
-#endif
316274
317275 #if defined(CONFIG_SOC_AM33XX) || defined(CONFIG_SOC_AM43XX)
318276 static struct wkup_m3_platform_data wkup_m3_data = {
....@@ -329,6 +287,10 @@
329287 #endif
330288
331289 #ifdef CONFIG_SOC_DRA7XX
290
+static struct iommu_platform_data dra7_ipu1_dsp_iommu_pdata = {
291
+ .set_pwrdm_constraint = omap_iommu_set_pwrdm_constraint,
292
+};
293
+
332294 static struct omap_hsmmc_platform_data dra7_hsmmc_data_mmc1;
333295 static struct omap_hsmmc_platform_data dra7_hsmmc_data_mmc2;
334296 static struct omap_hsmmc_platform_data dra7_hsmmc_data_mmc3;
....@@ -347,6 +309,66 @@
347309 }
348310 }
349311 #endif
312
+
313
+static struct clockdomain *ti_sysc_find_one_clockdomain(struct clk *clk)
314
+{
315
+ struct clk_hw *hw = __clk_get_hw(clk);
316
+ struct clockdomain *clkdm = NULL;
317
+ struct clk_hw_omap *hwclk;
318
+
319
+ hwclk = to_clk_hw_omap(hw);
320
+ if (!omap2_clk_is_hw_omap(hw))
321
+ return NULL;
322
+
323
+ if (hwclk && hwclk->clkdm_name)
324
+ clkdm = clkdm_lookup(hwclk->clkdm_name);
325
+
326
+ return clkdm;
327
+}
328
+
329
+/**
330
+ * ti_sysc_clkdm_init - find clockdomain based on clock
331
+ * @fck: device functional clock
332
+ * @ick: device interface clock
333
+ * @dev: struct device
334
+ *
335
+ * Populate clockdomain based on clock. It is needed for
336
+ * clkdm_deny_idle() and clkdm_allow_idle() for blocking clockdomain
337
+ * clockdomain idle during reset, enable and idle.
338
+ *
339
+ * Note that we assume interconnect driver manages the clocks
340
+ * and do not need to populate oh->_clk for dynamically
341
+ * allocated modules.
342
+ */
343
+static int ti_sysc_clkdm_init(struct device *dev,
344
+ struct clk *fck, struct clk *ick,
345
+ struct ti_sysc_cookie *cookie)
346
+{
347
+ if (!IS_ERR(fck))
348
+ cookie->clkdm = ti_sysc_find_one_clockdomain(fck);
349
+ if (cookie->clkdm)
350
+ return 0;
351
+ if (!IS_ERR(ick))
352
+ cookie->clkdm = ti_sysc_find_one_clockdomain(ick);
353
+ if (cookie->clkdm)
354
+ return 0;
355
+
356
+ return -ENODEV;
357
+}
358
+
359
+static void ti_sysc_clkdm_deny_idle(struct device *dev,
360
+ const struct ti_sysc_cookie *cookie)
361
+{
362
+ if (cookie->clkdm)
363
+ clkdm_deny_idle(cookie->clkdm);
364
+}
365
+
366
+static void ti_sysc_clkdm_allow_idle(struct device *dev,
367
+ const struct ti_sysc_cookie *cookie)
368
+{
369
+ if (cookie->clkdm)
370
+ clkdm_allow_idle(cookie->clkdm);
371
+}
350372
351373 static int ti_sysc_enable_module(struct device *dev,
352374 const struct ti_sysc_cookie *cookie)
....@@ -375,10 +397,19 @@
375397 return omap_hwmod_shutdown(cookie->data);
376398 }
377399
400
+static bool ti_sysc_soc_type_gp(void)
401
+{
402
+ return omap_type() == OMAP2_DEVICE_TYPE_GP;
403
+}
404
+
378405 static struct of_dev_auxdata omap_auxdata_lookup[];
379406
380407 static struct ti_sysc_platform_data ti_sysc_pdata = {
381408 .auxdata = omap_auxdata_lookup,
409
+ .soc_type_gp = ti_sysc_soc_type_gp,
410
+ .init_clockdomain = ti_sysc_clkdm_init,
411
+ .clkdm_deny_idle = ti_sysc_clkdm_deny_idle,
412
+ .clkdm_allow_idle = ti_sysc_clkdm_allow_idle,
382413 .init_module = omap_hwmod_init_module,
383414 .enable_module = ti_sysc_enable_module,
384415 .idle_module = ti_sysc_idle_module,
....@@ -392,6 +423,12 @@
392423 pcs_pdata.irq = irq;
393424 pcs_pdata.rearm = rearm;
394425 }
426
+
427
+static struct ti_prm_platform_data ti_prm_pdata = {
428
+ .clkdm_deny_idle = clkdm_deny_idle,
429
+ .clkdm_allow_idle = clkdm_allow_idle,
430
+ .clkdm_lookup = clkdm_lookup,
431
+};
395432
396433 /*
397434 * GPIOs for TWL are initialized by the I2C bus and need custom
....@@ -408,7 +445,7 @@
408445 dev->platform_data = &twl_gpio_auxdata;
409446 }
410447
411
-#if IS_ENABLED(CONFIG_SND_OMAP_SOC_MCBSP)
448
+#if IS_ENABLED(CONFIG_SND_SOC_OMAP_MCBSP)
412449 static struct omap_mcbsp_platform_data mcbsp_pdata;
413450 static void __init omap3_mcbsp_init(void)
414451 {
....@@ -445,6 +482,8 @@
445482 #ifdef CONFIG_ARCH_OMAP3
446483 OF_DEV_AUXDATA("ti,omap2-iommu", 0x5d000000, "5d000000.mmu",
447484 &omap3_iommu_pdata),
485
+ OF_DEV_AUXDATA("ti,omap2-iommu", 0x480bd400, "480bd400.mmu",
486
+ &omap3_iommu_isp_pdata),
448487 OF_DEV_AUXDATA("ti,omap3-smartreflex-core", 0x480cb000,
449488 "480cb000.smartreflex", &omap_sr_pdata[OMAP_SR_CORE]),
450489 OF_DEV_AUXDATA("ti,omap3-smartreflex-mpu-iva", 0x480c9000,
....@@ -457,7 +496,7 @@
457496 &am35xx_emac_pdata),
458497 OF_DEV_AUXDATA("nokia,n900-rom-rng", 0, NULL, rx51_secure_rng_call),
459498 /* McBSP modules with sidetone core */
460
-#if IS_ENABLED(CONFIG_SND_OMAP_SOC_MCBSP)
499
+#if IS_ENABLED(CONFIG_SND_SOC_OMAP_MCBSP)
461500 OF_DEV_AUXDATA("ti,omap3-mcbsp", 0x49022000, "49022000.mcbsp", &mcbsp_pdata),
462501 OF_DEV_AUXDATA("ti,omap3-mcbsp", 0x49024000, "49024000.mcbsp", &mcbsp_pdata),
463502 #endif
....@@ -471,10 +510,6 @@
471510 &wkup_m3_data),
472511 #endif
473512 #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
474
- OF_DEV_AUXDATA("ti,omap4-iommu", 0x4a066000, "4a066000.mmu",
475
- &omap4_iommu_pdata),
476
- OF_DEV_AUXDATA("ti,omap4-iommu", 0x55082000, "55082000.mmu",
477
- &omap4_iommu_pdata),
478513 OF_DEV_AUXDATA("ti,omap4-smartreflex-iva", 0x4a0db000,
479514 "4a0db000.smartreflex", &omap_sr_pdata[OMAP_SR_IVA]),
480515 OF_DEV_AUXDATA("ti,omap4-smartreflex-core", 0x4a0dd000,
....@@ -489,10 +524,18 @@
489524 &dra7_hsmmc_data_mmc2),
490525 OF_DEV_AUXDATA("ti,dra7-hsmmc", 0x480ad000, "480ad000.mmc",
491526 &dra7_hsmmc_data_mmc3),
527
+ OF_DEV_AUXDATA("ti,dra7-dsp-iommu", 0x40d01000, "40d01000.mmu",
528
+ &dra7_ipu1_dsp_iommu_pdata),
529
+ OF_DEV_AUXDATA("ti,dra7-dsp-iommu", 0x41501000, "41501000.mmu",
530
+ &dra7_ipu1_dsp_iommu_pdata),
531
+ OF_DEV_AUXDATA("ti,dra7-iommu", 0x58882000, "58882000.mmu",
532
+ &dra7_ipu1_dsp_iommu_pdata),
492533 #endif
493534 /* Common auxdata */
494535 OF_DEV_AUXDATA("ti,sysc", 0, NULL, &ti_sysc_pdata),
495536 OF_DEV_AUXDATA("pinctrl-single", 0, NULL, &pcs_pdata),
537
+ OF_DEV_AUXDATA("ti,omap-prm-inst", 0, NULL, &ti_prm_pdata),
538
+ OF_DEV_AUXDATA("ti,omap-sdma", 0, NULL, &dma_plat_info),
496539 { /* sentinel */ },
497540 };
498541
....@@ -508,8 +551,6 @@
508551 { "nokia,omap3-n900", nokia_n900_legacy_init, },
509552 { "nokia,omap3-n9", hsmmc2_internal_input_clk, },
510553 { "nokia,omap3-n950", hsmmc2_internal_input_clk, },
511
- { "isee,omap3-igep0020-rev-f", omap3_igep0020_rev_f_legacy_init, },
512
- { "isee,omap3-igep0030-rev-g", omap3_igep0030_rev_g_legacy_init, },
513554 { "logicpd,dm3730-torpedo-devkit", omap3_logicpd_torpedo_init, },
514555 { "ti,omap3-evm-37xx", omap3_evm_legacy_init, },
515556 { "ti,am3517-evm", am3517_evm_legacy_init, },