333a9d1212ba554c8cf10aa5a0f32255c8b4acf2
[openwrt/openwrt.git] / target / linux / layerscape / patches-4.9 / 201-config-support-layerscape.patch
1 From 7992b4384d94c5e1bad998ca3a9a5781caac8e62 Mon Sep 17 00:00:00 2001
2 From: Yangbo Lu <yangbo.lu@nxp.com>
3 Date: Mon, 25 Sep 2017 09:52:26 +0800
4 Subject: [PATCH] config: support layerscape
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 This is a integrated patch for layerscape config/makefile support.
10
11 Signed-off-by: Yuantian Tang <andy.tang@nxp.com>
12 Signed-off-by: Zhang Ying-22455 <ying.zhang22455@nxp.com>
13 Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
14 Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
15 Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
16 Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
17 Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
18 ---
19 drivers/base/Kconfig | 1 +
20 drivers/crypto/Makefile | 2 +-
21 drivers/net/ethernet/freescale/Kconfig | 4 +-
22 drivers/net/ethernet/freescale/Makefile | 2 +
23 drivers/ptp/Kconfig | 29 ++++++
24 drivers/rtc/Kconfig | 8 ++
25 drivers/rtc/Makefile | 1 +
26 drivers/soc/Kconfig | 3 +-
27 drivers/soc/fsl/Kconfig | 22 +++++
28 drivers/soc/fsl/Kconfig.arm | 16 ++++
29 drivers/soc/fsl/Makefile | 4 +
30 drivers/soc/fsl/layerscape/Kconfig | 10 +++
31 drivers/soc/fsl/layerscape/Makefile | 1 +
32 drivers/soc/fsl/rcpm.c | 154 ++++++++++++++++++++++++++++++++
33 drivers/staging/Kconfig | 6 ++
34 drivers/staging/Makefile | 3 +
35 drivers/staging/fsl-dpaa2/Kconfig | 41 +++++++++
36 drivers/staging/fsl-dpaa2/Makefile | 9 ++
37 18 files changed, 312 insertions(+), 4 deletions(-)
38 create mode 100644 drivers/soc/fsl/Kconfig
39 create mode 100644 drivers/soc/fsl/Kconfig.arm
40 create mode 100644 drivers/soc/fsl/layerscape/Kconfig
41 create mode 100644 drivers/soc/fsl/layerscape/Makefile
42 create mode 100644 drivers/soc/fsl/rcpm.c
43 create mode 100644 drivers/staging/fsl-dpaa2/Kconfig
44 create mode 100644 drivers/staging/fsl-dpaa2/Makefile
45
46 --- a/drivers/base/Kconfig
47 +++ b/drivers/base/Kconfig
48 @@ -237,6 +237,7 @@ config GENERIC_CPU_AUTOPROBE
49
50 config SOC_BUS
51 bool
52 + select GLOB
53
54 source "drivers/base/regmap/Kconfig"
55
56 --- a/drivers/crypto/Makefile
57 +++ b/drivers/crypto/Makefile
58 @@ -3,7 +3,7 @@ obj-$(CONFIG_CRYPTO_DEV_ATMEL_SHA) += at
59 obj-$(CONFIG_CRYPTO_DEV_ATMEL_TDES) += atmel-tdes.o
60 obj-$(CONFIG_CRYPTO_DEV_BFIN_CRC) += bfin_crc.o
61 obj-$(CONFIG_CRYPTO_DEV_CCP) += ccp/
62 -obj-$(CONFIG_CRYPTO_DEV_FSL_CAAM) += caam/
63 +obj-$(CONFIG_CRYPTO_DEV_FSL_CAAM_COMMON) += caam/
64 obj-$(CONFIG_CRYPTO_DEV_GEODE) += geode-aes.o
65 obj-$(CONFIG_CRYPTO_DEV_HIFN_795X) += hifn_795x.o
66 obj-$(CONFIG_CRYPTO_DEV_IMGTEC_HASH) += img-hash.o
67 --- a/drivers/net/ethernet/freescale/Kconfig
68 +++ b/drivers/net/ethernet/freescale/Kconfig
69 @@ -5,7 +5,7 @@
70 config NET_VENDOR_FREESCALE
71 bool "Freescale devices"
72 default y
73 - depends on FSL_SOC || QUICC_ENGINE || CPM1 || CPM2 || PPC_MPC512x || \
74 + depends on FSL_SOC || (QUICC_ENGINE && PPC32) || CPM1 || CPM2 || PPC_MPC512x || \
75 M523x || M527x || M5272 || M528x || M520x || M532x || \
76 ARCH_MXC || ARCH_MXS || (PPC_MPC52xx && PPC_BESTCOMM) || \
77 ARCH_LAYERSCAPE
78 @@ -93,4 +93,6 @@ config GIANFAR
79 and MPC86xx family of chips, the eTSEC on LS1021A and the FEC
80 on the 8540.
81
82 +source "drivers/net/ethernet/freescale/sdk_fman/Kconfig"
83 +source "drivers/net/ethernet/freescale/sdk_dpaa/Kconfig"
84 endif # NET_VENDOR_FREESCALE
85 --- a/drivers/net/ethernet/freescale/Makefile
86 +++ b/drivers/net/ethernet/freescale/Makefile
87 @@ -21,4 +21,6 @@ gianfar_driver-objs := gianfar.o \
88 obj-$(CONFIG_UCC_GETH) += ucc_geth_driver.o
89 ucc_geth_driver-objs := ucc_geth.o ucc_geth_ethtool.o
90
91 +obj-$(if $(CONFIG_FSL_SDK_FMAN),y) += sdk_fman/
92 +obj-$(if $(CONFIG_FSL_SDK_DPAA_ETH),y) += sdk_dpaa/
93 obj-$(CONFIG_FSL_FMAN) += fman/
94 --- a/drivers/ptp/Kconfig
95 +++ b/drivers/ptp/Kconfig
96 @@ -39,6 +39,35 @@ config PTP_1588_CLOCK_GIANFAR
97 To compile this driver as a module, choose M here: the module
98 will be called gianfar_ptp.
99
100 +config PTP_1588_CLOCK_DPAA
101 + tristate "Freescale DPAA as PTP clock"
102 + depends on FSL_SDK_DPAA_ETH
103 + select PTP_1588_CLOCK
104 + select FSL_DPAA_TS
105 + default n
106 + help
107 + This driver adds support for using the DPAA 1588 timer module
108 + as a PTP clock. This clock is only useful if your PTP programs are
109 + getting hardware time stamps on the PTP Ethernet packets
110 + using the SO_TIMESTAMPING API.
111 +
112 + To compile this driver as a module, choose M here: the module
113 + will be called dpaa_ptp.
114 +
115 +config PTP_1588_CLOCK_DPAA2
116 + tristate "Freescale DPAA2 as PTP clock"
117 + depends on FSL_DPAA2_ETH
118 + select PTP_1588_CLOCK
119 + default y
120 + help
121 + This driver adds support for using the DPAA2 1588 timer module
122 + as a PTP clock. This clock is only useful if your PTP programs are
123 + getting hardware time stamps on the PTP Ethernet packets
124 + using the SO_TIMESTAMPING API.
125 +
126 + To compile this driver as a module, choose M here: the module
127 + will be called dpaa2-rtc.
128 +
129 config PTP_1588_CLOCK_IXP46X
130 tristate "Intel IXP46x as PTP clock"
131 depends on IXP4XX_ETH
132 --- a/drivers/rtc/Kconfig
133 +++ b/drivers/rtc/Kconfig
134 @@ -414,6 +414,14 @@ config RTC_DRV_PCF85063
135 This driver can also be built as a module. If so, the module
136 will be called rtc-pcf85063.
137
138 +config RTC_DRV_PCF85263
139 + tristate "NXP PCF85263"
140 + help
141 + If you say yes here you get support for the PCF85263 RTC chip
142 +
143 + This driver can also be built as a module. If so, the module
144 + will be called rtc-pcf85263.
145 +
146 config RTC_DRV_PCF8563
147 tristate "Philips PCF8563/Epson RTC8564"
148 help
149 --- a/drivers/rtc/Makefile
150 +++ b/drivers/rtc/Makefile
151 @@ -111,6 +111,7 @@ obj-$(CONFIG_RTC_DRV_PCF2127) += rtc-pcf
152 obj-$(CONFIG_RTC_DRV_PCF50633) += rtc-pcf50633.o
153 obj-$(CONFIG_RTC_DRV_PCF85063) += rtc-pcf85063.o
154 obj-$(CONFIG_RTC_DRV_PCF8523) += rtc-pcf8523.o
155 +obj-$(CONFIG_RTC_DRV_PCF85263) += rtc-pcf85263.o
156 obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o
157 obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o
158 obj-$(CONFIG_RTC_DRV_PIC32) += rtc-pic32.o
159 --- a/drivers/soc/Kconfig
160 +++ b/drivers/soc/Kconfig
161 @@ -1,8 +1,7 @@
162 menu "SOC (System On Chip) specific Drivers"
163
164 source "drivers/soc/bcm/Kconfig"
165 -source "drivers/soc/fsl/qbman/Kconfig"
166 -source "drivers/soc/fsl/qe/Kconfig"
167 +source "drivers/soc/fsl/Kconfig"
168 source "drivers/soc/mediatek/Kconfig"
169 source "drivers/soc/qcom/Kconfig"
170 source "drivers/soc/rockchip/Kconfig"
171 --- /dev/null
172 +++ b/drivers/soc/fsl/Kconfig
173 @@ -0,0 +1,22 @@
174 +#
175 +# Freescale SOC drivers
176 +#
177 +
178 +source "drivers/soc/fsl/qbman/Kconfig"
179 +source "drivers/soc/fsl/qe/Kconfig"
180 +source "drivers/soc/fsl/ls2-console/Kconfig"
181 +
182 +config FSL_GUTS
183 + bool
184 + select SOC_BUS
185 + help
186 + The global utilities block controls power management, I/O device
187 + enabling, power-onreset(POR) configuration monitoring, alternate
188 + function selection for multiplexed signals,and clock control.
189 + This driver is to manage and access global utilities block.
190 + Initially only reading SVR and registering soc device are supported.
191 + Other guts accesses, such as reading RCW, should eventually be moved
192 + into this driver as well.
193 +if ARM || ARM64
194 +source "drivers/soc/fsl/Kconfig.arm"
195 +endif
196 --- /dev/null
197 +++ b/drivers/soc/fsl/Kconfig.arm
198 @@ -0,0 +1,16 @@
199 +#
200 +# Freescale ARM SOC Drivers
201 +#
202 +
203 +config LS_SOC_DRIVERS
204 + bool "Layerscape Soc Drivers"
205 + depends on ARCH_LAYERSCAPE || SOC_LS1021A
206 + default n
207 + help
208 + Say y here to enable Freescale Layerscape Soc Device Drivers support.
209 + The Soc Drivers provides the device driver that is a specific block
210 + or feature on Layerscape platform.
211 +
212 +if LS_SOC_DRIVERS
213 + source "drivers/soc/fsl/layerscape/Kconfig"
214 +endif
215 --- a/drivers/soc/fsl/Makefile
216 +++ b/drivers/soc/fsl/Makefile
217 @@ -5,3 +5,7 @@
218 obj-$(CONFIG_FSL_DPAA) += qbman/
219 obj-$(CONFIG_QUICC_ENGINE) += qe/
220 obj-$(CONFIG_CPM) += qe/
221 +obj-$(CONFIG_FSL_GUTS) += guts.o
222 +obj-$(CONFIG_FSL_LS2_CONSOLE) += ls2-console/
223 +obj-$(CONFIG_SUSPEND) += rcpm.o
224 +obj-$(CONFIG_LS_SOC_DRIVERS) += layerscape/
225 --- /dev/null
226 +++ b/drivers/soc/fsl/layerscape/Kconfig
227 @@ -0,0 +1,10 @@
228 +#
229 +# Layerscape Soc drivers
230 +#
231 +config FTM_ALARM
232 + bool "FTM alarm driver"
233 + default n
234 + help
235 + Say y here to enable FTM alarm support. The FTM alarm provides
236 + alarm functions for wakeup system from deep sleep. There is only
237 + one FTM can be used in ALARM(FTM 0).
238 --- /dev/null
239 +++ b/drivers/soc/fsl/layerscape/Makefile
240 @@ -0,0 +1 @@
241 +obj-$(CONFIG_FTM_ALARM) += ftm_alarm.o
242 --- /dev/null
243 +++ b/drivers/soc/fsl/rcpm.c
244 @@ -0,0 +1,154 @@
245 +/*
246 + * Run Control and Power Management (RCPM) driver
247 + *
248 + * Copyright 2016 NXP
249 + *
250 + * This program is free software; you can redistribute it and/or modify
251 + * it under the terms of the GNU General Public License as published by
252 + * the Free Software Foundation; either version 2 of the License, or
253 + * (at your option) any later version.
254 + *
255 + * This program is distributed in the hope that it will be useful,
256 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
257 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
258 + * GNU General Public License for more details.
259 + *
260 + */
261 +#define pr_fmt(fmt) "RCPM: %s: " fmt, __func__
262 +
263 +#include <linux/kernel.h>
264 +#include <linux/io.h>
265 +#include <linux/of_platform.h>
266 +#include <linux/of_address.h>
267 +#include <linux/suspend.h>
268 +
269 +/* RCPM register offset */
270 +#define RCPM_IPPDEXPCR0 0x140
271 +
272 +#define RCPM_WAKEUP_CELL_SIZE 2
273 +
274 +struct rcpm_config {
275 + int ipp_num;
276 + int ippdexpcr_offset;
277 + u32 ippdexpcr[2];
278 + void *rcpm_reg_base;
279 +};
280 +
281 +static struct rcpm_config *rcpm;
282 +
283 +static inline void rcpm_reg_write(u32 offset, u32 value)
284 +{
285 + iowrite32be(value, rcpm->rcpm_reg_base + offset);
286 +}
287 +
288 +static inline u32 rcpm_reg_read(u32 offset)
289 +{
290 + return ioread32be(rcpm->rcpm_reg_base + offset);
291 +}
292 +
293 +static void rcpm_wakeup_fixup(struct device *dev, void *data)
294 +{
295 + struct device_node *node = dev ? dev->of_node : NULL;
296 + u32 value[RCPM_WAKEUP_CELL_SIZE];
297 + int ret, i;
298 +
299 + if (!dev || !node || !device_may_wakeup(dev))
300 + return;
301 +
302 + /*
303 + * Get the values in the "rcpm-wakeup" property.
304 + * Three values are:
305 + * The first is a pointer to the RCPM node.
306 + * The second is the value of the ippdexpcr0 register.
307 + * The third is the value of the ippdexpcr1 register.
308 + */
309 + ret = of_property_read_u32_array(node, "fsl,rcpm-wakeup",
310 + value, RCPM_WAKEUP_CELL_SIZE);
311 + if (ret)
312 + return;
313 +
314 + pr_debug("wakeup source: the device %s\n", node->full_name);
315 +
316 + for (i = 0; i < rcpm->ipp_num; i++)
317 + rcpm->ippdexpcr[i] |= value[i + 1];
318 +}
319 +
320 +static int rcpm_suspend_prepare(void)
321 +{
322 + int i;
323 +
324 + BUG_ON(!rcpm);
325 +
326 + for (i = 0; i < rcpm->ipp_num; i++)
327 + rcpm->ippdexpcr[i] = 0;
328 +
329 + dpm_for_each_dev(NULL, rcpm_wakeup_fixup);
330 +
331 + for (i = 0; i < rcpm->ipp_num; i++) {
332 + rcpm_reg_write(rcpm->ippdexpcr_offset + 4 * i,
333 + rcpm->ippdexpcr[i]);
334 + pr_debug("ippdexpcr%d = 0x%x\n", i, rcpm->ippdexpcr[i]);
335 + }
336 +
337 + return 0;
338 +}
339 +
340 +static int rcpm_suspend_notifier_call(struct notifier_block *bl,
341 + unsigned long state,
342 + void *unused)
343 +{
344 + switch (state) {
345 + case PM_SUSPEND_PREPARE:
346 + rcpm_suspend_prepare();
347 + break;
348 + }
349 +
350 + return NOTIFY_DONE;
351 +}
352 +
353 +static struct rcpm_config rcpm_default_config = {
354 + .ipp_num = 1,
355 + .ippdexpcr_offset = RCPM_IPPDEXPCR0,
356 +};
357 +
358 +static const struct of_device_id rcpm_matches[] = {
359 + {
360 + .compatible = "fsl,qoriq-rcpm-2.1",
361 + .data = &rcpm_default_config,
362 + },
363 + {}
364 +};
365 +
366 +static struct notifier_block rcpm_suspend_notifier = {
367 + .notifier_call = rcpm_suspend_notifier_call,
368 +};
369 +
370 +static int __init layerscape_rcpm_init(void)
371 +{
372 + const struct of_device_id *match;
373 + struct device_node *np;
374 +
375 + np = of_find_matching_node_and_match(NULL, rcpm_matches, &match);
376 + if (!np) {
377 + pr_err("Can't find the RCPM node.\n");
378 + return -EINVAL;
379 + }
380 +
381 + if (match->data)
382 + rcpm = (struct rcpm_config *)match->data;
383 + else
384 + return -EINVAL;
385 +
386 + rcpm->rcpm_reg_base = of_iomap(np, 0);
387 + of_node_put(np);
388 + if (!rcpm->rcpm_reg_base)
389 + return -ENOMEM;
390 +
391 + register_pm_notifier(&rcpm_suspend_notifier);
392 +
393 + pr_info("The RCPM driver initialized.\n");
394 +
395 + return 0;
396 +}
397 +
398 +subsys_initcall(layerscape_rcpm_init);
399 --- a/drivers/staging/Kconfig
400 +++ b/drivers/staging/Kconfig
401 @@ -94,6 +94,8 @@ source "drivers/staging/fbtft/Kconfig"
402
403 source "drivers/staging/fsl-mc/Kconfig"
404
405 +source "drivers/staging/fsl-dpaa2/Kconfig"
406 +
407 source "drivers/staging/wilc1000/Kconfig"
408
409 source "drivers/staging/most/Kconfig"
410 @@ -106,4 +108,8 @@ source "drivers/staging/greybus/Kconfig"
411
412 source "drivers/staging/vc04_services/Kconfig"
413
414 +source "drivers/staging/fsl_qbman/Kconfig"
415 +
416 +source "drivers/staging/fsl_ppfe/Kconfig"
417 +
418 endif # STAGING
419 --- a/drivers/staging/Makefile
420 +++ b/drivers/staging/Makefile
421 @@ -36,9 +36,12 @@ obj-$(CONFIG_UNISYSSPAR) += unisys/
422 obj-$(CONFIG_COMMON_CLK_XLNX_CLKWZRD) += clocking-wizard/
423 obj-$(CONFIG_FB_TFT) += fbtft/
424 obj-$(CONFIG_FSL_MC_BUS) += fsl-mc/
425 +obj-$(CONFIG_FSL_DPAA2) += fsl-dpaa2/
426 obj-$(CONFIG_WILC1000) += wilc1000/
427 obj-$(CONFIG_MOST) += most/
428 obj-$(CONFIG_ISDN_I4L) += i4l/
429 obj-$(CONFIG_KS7010) += ks7010/
430 obj-$(CONFIG_GREYBUS) += greybus/
431 obj-$(CONFIG_BCM2708_VCHIQ) += vc04_services/
432 +obj-$(CONFIG_FSL_SDK_DPA) += fsl_qbman/
433 +obj-$(CONFIG_FSL_PPFE) += fsl_ppfe/
434 --- /dev/null
435 +++ b/drivers/staging/fsl-dpaa2/Kconfig
436 @@ -0,0 +1,41 @@
437 +#
438 +# Freescale DataPath Acceleration Architecture Gen2 (DPAA2) drivers
439 +#
440 +
441 +config FSL_DPAA2
442 + bool "Freescale DPAA2 devices"
443 + depends on FSL_MC_BUS
444 + ---help---
445 + Build drivers for Freescale DataPath Acceleration
446 + Architecture (DPAA2) family of SoCs.
447 +
448 +config FSL_DPAA2_ETH
449 + tristate "Freescale DPAA2 Ethernet"
450 + depends on FSL_DPAA2 && FSL_MC_DPIO
451 + ---help---
452 + Ethernet driver for Freescale DPAA2 SoCs, using the
453 + Freescale MC bus driver
454 +
455 +if FSL_DPAA2_ETH
456 +config FSL_DPAA2_ETH_USE_ERR_QUEUE
457 + bool "Enable Rx error queue"
458 + default n
459 + ---help---
460 + Allow Rx error frames to be enqueued on an error queue
461 + and processed by the driver (by default they are dropped
462 + in hardware).
463 + This may impact performance, recommended for debugging
464 + purposes only.
465 +
466 +# QBMAN_DEBUG requires some additional DPIO APIs
467 +config FSL_DPAA2_ETH_DEBUGFS
468 + depends on DEBUG_FS && FSL_QBMAN_DEBUG
469 + bool "Enable debugfs support"
470 + default n
471 + ---help---
472 + Enable advanced statistics through debugfs interface.
473 +endif
474 +
475 +source "drivers/staging/fsl-dpaa2/mac/Kconfig"
476 +source "drivers/staging/fsl-dpaa2/evb/Kconfig"
477 +source "drivers/staging/fsl-dpaa2/ethsw/Kconfig"
478 --- /dev/null
479 +++ b/drivers/staging/fsl-dpaa2/Makefile
480 @@ -0,0 +1,9 @@
481 +#
482 +# Freescale DataPath Acceleration Architecture Gen2 (DPAA2) drivers
483 +#
484 +
485 +obj-$(CONFIG_FSL_DPAA2_ETH) += ethernet/
486 +obj-$(CONFIG_FSL_DPAA2_MAC) += mac/
487 +obj-$(CONFIG_FSL_DPAA2_EVB) += evb/
488 +obj-$(CONFIG_FSL_DPAA2_ETHSW) += ethsw/
489 +obj-$(CONFIG_PTP_1588_CLOCK_DPAA2) += rtc/