Commit 3dc064d2 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'soc-fixes-5.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc

Pull ARM SoC fixes from Arnd Bergmann:
 "Lots of small fixes for Arm SoCs this time, nothing too worrying:

   - omap/beaglebone boot regression fix in gpt12 timer

   - revert for i.mx8 soc driver breaking as a platform_driver

   - kexec/kdump fixes for op-tee

   - various fixes for incorrect DT settings on imx, mvebu, omap, stm32,
     and tegra causing problems.

   - device tree fixes for static checks in nomadik, versatile, stm32

   - code fixes for issues found in build testing and with static
     checking on tegra, ixp4xx, imx, omap"

* tag 'soc-fixes-5.14-2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (36 commits)
  soc: ixp4xx/qmgr: fix invalid __iomem access
  soc: ixp4xx: fix printing resources
  ARM: ixp4xx: goramo_mlr depends on old PCI driver
  ARM: ixp4xx: fix compile-testing soc drivers
  soc/tegra: Make regulator couplers depend on CONFIG_REGULATOR
  ARM: dts: nomadik: Fix up interrupt controller node names
  ARM: dts: stm32: Fix touchscreen IRQ line assignment on DHCOM
  ARM: dts: stm32: Disable LAN8710 EDPD on DHCOM
  ARM: dts: stm32: Prefer HW RTC on DHCOM SoM
  omap5-board-common: remove not physically existing vdds_1v8_main fixed-regulator
  ARM: dts: am437x-l4: fix typo in can@0 node
  ARM: dts: am43x-epos-evm: Reduce i2c0 bus speed for tps65218
  bus: ti-sysc: AM3: RNG is GP only
  ARM: omap2+: hwmod: fix potential NULL pointer access
  arm64: dts: armada-3720-turris-mox: remove mrvl,i2c-fast-mode
  arm64: dts: armada-3720-turris-mox: fixed indices for the SDHC controllers
  ARM: dts: imx: Swap M53Menlo pinctrl_power_button/pinctrl_power_out pins
  ARM: imx: fix missing 3rd argument in macro imx_mmdc_perf_init
  ARM: dts: colibri-imx6ull: limit SDIO clock to 25MHz
  arm64: dts: ls1028: sl28: fix networking for variant 2
  ...
parents 73f25536 19c1eb36
...@@ -1595,7 +1595,7 @@ dcan1: can@0 { ...@@ -1595,7 +1595,7 @@ dcan1: can@0 {
compatible = "ti,am4372-d_can", "ti,am3352-d_can"; compatible = "ti,am4372-d_can", "ti,am3352-d_can";
reg = <0x0 0x2000>; reg = <0x0 0x2000>;
clocks = <&dcan1_fck>; clocks = <&dcan1_fck>;
clock-name = "fck"; clock-names = "fck";
syscon-raminit = <&scm_conf 0x644 1>; syscon-raminit = <&scm_conf 0x644 1>;
interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>; interrupts = <GIC_SPI 49 IRQ_TYPE_LEVEL_HIGH>;
status = "disabled"; status = "disabled";
......
...@@ -582,7 +582,7 @@ &i2c0 { ...@@ -582,7 +582,7 @@ &i2c0 {
status = "okay"; status = "okay";
pinctrl-names = "default"; pinctrl-names = "default";
pinctrl-0 = <&i2c0_pins>; pinctrl-0 = <&i2c0_pins>;
clock-frequency = <400000>; clock-frequency = <100000>;
tps65218: tps65218@24 { tps65218: tps65218@24 {
reg = <0x24>; reg = <0x24>;
......
...@@ -388,13 +388,13 @@ MX53_PAD_LVDS0_TX3_P__LDB_LVDS0_TX3 0x80000000 ...@@ -388,13 +388,13 @@ MX53_PAD_LVDS0_TX3_P__LDB_LVDS0_TX3 0x80000000
pinctrl_power_button: powerbutgrp { pinctrl_power_button: powerbutgrp {
fsl,pins = < fsl,pins = <
MX53_PAD_SD2_DATA2__GPIO1_13 0x1e4 MX53_PAD_SD2_DATA0__GPIO1_15 0x1e4
>; >;
}; };
pinctrl_power_out: poweroutgrp { pinctrl_power_out: poweroutgrp {
fsl,pins = < fsl,pins = <
MX53_PAD_SD2_DATA0__GPIO1_15 0x1e4 MX53_PAD_SD2_DATA2__GPIO1_13 0x1e4
>; >;
}; };
......
...@@ -54,7 +54,13 @@ &fec { ...@@ -54,7 +54,13 @@ &fec {
pinctrl-names = "default"; pinctrl-names = "default";
pinctrl-0 = <&pinctrl_microsom_enet_ar8035>; pinctrl-0 = <&pinctrl_microsom_enet_ar8035>;
phy-mode = "rgmii-id"; phy-mode = "rgmii-id";
phy-reset-duration = <2>;
/*
* The PHY seems to require a long-enough reset duration to avoid
* some rare issues where the PHY gets stuck in an inconsistent and
* non-functional state at boot-up. 10ms proved to be fine .
*/
phy-reset-duration = <10>;
phy-reset-gpios = <&gpio4 15 GPIO_ACTIVE_LOW>; phy-reset-gpios = <&gpio4 15 GPIO_ACTIVE_LOW>;
status = "okay"; status = "okay";
......
...@@ -43,6 +43,7 @@ &usdhc2 { ...@@ -43,6 +43,7 @@ &usdhc2 {
assigned-clock-rates = <0>, <198000000>; assigned-clock-rates = <0>, <198000000>;
cap-power-off-card; cap-power-off-card;
keep-power-in-suspend; keep-power-in-suspend;
max-frequency = <25000000>;
mmc-pwrseq = <&wifi_pwrseq>; mmc-pwrseq = <&wifi_pwrseq>;
no-1-8-v; no-1-8-v;
non-removable; non-removable;
......
...@@ -30,14 +30,6 @@ vsys_cobra: fixedregulator-vsys_cobra { ...@@ -30,14 +30,6 @@ vsys_cobra: fixedregulator-vsys_cobra {
regulator-max-microvolt = <5000000>; regulator-max-microvolt = <5000000>;
}; };
vdds_1v8_main: fixedregulator-vdds_1v8_main {
compatible = "regulator-fixed";
regulator-name = "vdds_1v8_main";
vin-supply = <&smps7_reg>;
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
};
vmmcsd_fixed: fixedregulator-mmcsd { vmmcsd_fixed: fixedregulator-mmcsd {
compatible = "regulator-fixed"; compatible = "regulator-fixed";
regulator-name = "vmmcsd_fixed"; regulator-name = "vmmcsd_fixed";
...@@ -487,6 +479,7 @@ smps6_reg: smps6 { ...@@ -487,6 +479,7 @@ smps6_reg: smps6 {
regulator-boot-on; regulator-boot-on;
}; };
vdds_1v8_main:
smps7_reg: smps7 { smps7_reg: smps7 {
/* VDDS_1v8_OMAP over VDDS_1v8_MAIN */ /* VDDS_1v8_OMAP over VDDS_1v8_MAIN */
regulator-name = "smps7"; regulator-name = "smps7";
......
...@@ -755,14 +755,14 @@ clcd@10120000 { ...@@ -755,14 +755,14 @@ clcd@10120000 {
status = "disabled"; status = "disabled";
}; };
vica: intc@10140000 { vica: interrupt-controller@10140000 {
compatible = "arm,versatile-vic"; compatible = "arm,versatile-vic";
interrupt-controller; interrupt-controller;
#interrupt-cells = <1>; #interrupt-cells = <1>;
reg = <0x10140000 0x20>; reg = <0x10140000 0x20>;
}; };
vicb: intc@10140020 { vicb: interrupt-controller@10140020 {
compatible = "arm,versatile-vic"; compatible = "arm,versatile-vic";
interrupt-controller; interrupt-controller;
#interrupt-cells = <1>; #interrupt-cells = <1>;
......
...@@ -37,7 +37,7 @@ gpio-keys-polled { ...@@ -37,7 +37,7 @@ gpio-keys-polled {
poll-interval = <20>; poll-interval = <20>;
/* /*
* The EXTi IRQ line 3 is shared with touchscreen and ethernet, * The EXTi IRQ line 3 is shared with ethernet,
* so mark this as polled GPIO key. * so mark this as polled GPIO key.
*/ */
button-0 { button-0 {
...@@ -46,6 +46,16 @@ button-0 { ...@@ -46,6 +46,16 @@ button-0 {
gpios = <&gpiof 3 GPIO_ACTIVE_LOW>; gpios = <&gpiof 3 GPIO_ACTIVE_LOW>;
}; };
/*
* The EXTi IRQ line 6 is shared with touchscreen,
* so mark this as polled GPIO key.
*/
button-1 {
label = "TA2-GPIO-B";
linux,code = <KEY_B>;
gpios = <&gpiod 6 GPIO_ACTIVE_LOW>;
};
/* /*
* The EXTi IRQ line 0 is shared with PMIC, * The EXTi IRQ line 0 is shared with PMIC,
* so mark this as polled GPIO key. * so mark this as polled GPIO key.
...@@ -60,13 +70,6 @@ button-2 { ...@@ -60,13 +70,6 @@ button-2 {
gpio-keys { gpio-keys {
compatible = "gpio-keys"; compatible = "gpio-keys";
button-1 {
label = "TA2-GPIO-B";
linux,code = <KEY_B>;
gpios = <&gpiod 6 GPIO_ACTIVE_LOW>;
wakeup-source;
};
button-3 { button-3 {
label = "TA4-GPIO-D"; label = "TA4-GPIO-D";
linux,code = <KEY_D>; linux,code = <KEY_D>;
...@@ -82,6 +85,7 @@ led-0 { ...@@ -82,6 +85,7 @@ led-0 {
label = "green:led5"; label = "green:led5";
gpios = <&gpioc 6 GPIO_ACTIVE_HIGH>; gpios = <&gpioc 6 GPIO_ACTIVE_HIGH>;
default-state = "off"; default-state = "off";
status = "disabled";
}; };
led-1 { led-1 {
...@@ -185,8 +189,8 @@ sgtl5000_rx_endpoint: endpoint@1 { ...@@ -185,8 +189,8 @@ sgtl5000_rx_endpoint: endpoint@1 {
touchscreen@38 { touchscreen@38 {
compatible = "edt,edt-ft5406"; compatible = "edt,edt-ft5406";
reg = <0x38>; reg = <0x38>;
interrupt-parent = <&gpiog>; interrupt-parent = <&gpioc>;
interrupts = <2 IRQ_TYPE_EDGE_FALLING>; /* GPIO E */ interrupts = <6 IRQ_TYPE_EDGE_FALLING>; /* GPIO E */
}; };
}; };
......
...@@ -12,6 +12,8 @@ / { ...@@ -12,6 +12,8 @@ / {
aliases { aliases {
ethernet0 = &ethernet0; ethernet0 = &ethernet0;
ethernet1 = &ksz8851; ethernet1 = &ksz8851;
rtc0 = &hwrtc;
rtc1 = &rtc;
}; };
memory@c0000000 { memory@c0000000 {
...@@ -138,6 +140,7 @@ phy0: ethernet-phy@1 { ...@@ -138,6 +140,7 @@ phy0: ethernet-phy@1 {
reset-gpios = <&gpioh 3 GPIO_ACTIVE_LOW>; reset-gpios = <&gpioh 3 GPIO_ACTIVE_LOW>;
reset-assert-us = <500>; reset-assert-us = <500>;
reset-deassert-us = <500>; reset-deassert-us = <500>;
smsc,disable-energy-detect;
interrupt-parent = <&gpioi>; interrupt-parent = <&gpioi>;
interrupts = <11 IRQ_TYPE_LEVEL_LOW>; interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
}; };
...@@ -248,7 +251,7 @@ &i2c4 { ...@@ -248,7 +251,7 @@ &i2c4 {
/delete-property/dmas; /delete-property/dmas;
/delete-property/dma-names; /delete-property/dma-names;
rtc@32 { hwrtc: rtc@32 {
compatible = "microcrystal,rv8803"; compatible = "microcrystal,rv8803";
reg = <0x32>; reg = <0x32>;
}; };
......
...@@ -68,7 +68,6 @@ void imx_set_cpu_arg(int cpu, u32 arg); ...@@ -68,7 +68,6 @@ void imx_set_cpu_arg(int cpu, u32 arg);
void v7_secondary_startup(void); void v7_secondary_startup(void);
void imx_scu_map_io(void); void imx_scu_map_io(void);
void imx_smp_prepare(void); void imx_smp_prepare(void);
void imx_gpcv2_set_core1_pdn_pup_by_software(bool pdn);
#else #else
static inline void imx_scu_map_io(void) {} static inline void imx_scu_map_io(void) {}
static inline void imx_smp_prepare(void) {} static inline void imx_smp_prepare(void) {}
...@@ -81,6 +80,7 @@ void imx_gpc_mask_all(void); ...@@ -81,6 +80,7 @@ void imx_gpc_mask_all(void);
void imx_gpc_restore_all(void); void imx_gpc_restore_all(void);
void imx_gpc_hwirq_mask(unsigned int hwirq); void imx_gpc_hwirq_mask(unsigned int hwirq);
void imx_gpc_hwirq_unmask(unsigned int hwirq); void imx_gpc_hwirq_unmask(unsigned int hwirq);
void imx_gpcv2_set_core1_pdn_pup_by_software(bool pdn);
void imx_anatop_init(void); void imx_anatop_init(void);
void imx_anatop_pre_suspend(void); void imx_anatop_pre_suspend(void);
void imx_anatop_post_resume(void); void imx_anatop_post_resume(void);
......
...@@ -103,6 +103,7 @@ struct mmdc_pmu { ...@@ -103,6 +103,7 @@ struct mmdc_pmu {
struct perf_event *mmdc_events[MMDC_NUM_COUNTERS]; struct perf_event *mmdc_events[MMDC_NUM_COUNTERS];
struct hlist_node node; struct hlist_node node;
struct fsl_mmdc_devtype_data *devtype_data; struct fsl_mmdc_devtype_data *devtype_data;
struct clk *mmdc_ipg_clk;
}; };
/* /*
...@@ -462,11 +463,14 @@ static int imx_mmdc_remove(struct platform_device *pdev) ...@@ -462,11 +463,14 @@ static int imx_mmdc_remove(struct platform_device *pdev)
cpuhp_state_remove_instance_nocalls(cpuhp_mmdc_state, &pmu_mmdc->node); cpuhp_state_remove_instance_nocalls(cpuhp_mmdc_state, &pmu_mmdc->node);
perf_pmu_unregister(&pmu_mmdc->pmu); perf_pmu_unregister(&pmu_mmdc->pmu);
iounmap(pmu_mmdc->mmdc_base);
clk_disable_unprepare(pmu_mmdc->mmdc_ipg_clk);
kfree(pmu_mmdc); kfree(pmu_mmdc);
return 0; return 0;
} }
static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_base) static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_base,
struct clk *mmdc_ipg_clk)
{ {
struct mmdc_pmu *pmu_mmdc; struct mmdc_pmu *pmu_mmdc;
char *name; char *name;
...@@ -494,6 +498,7 @@ static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_b ...@@ -494,6 +498,7 @@ static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_b
} }
mmdc_num = mmdc_pmu_init(pmu_mmdc, mmdc_base, &pdev->dev); mmdc_num = mmdc_pmu_init(pmu_mmdc, mmdc_base, &pdev->dev);
pmu_mmdc->mmdc_ipg_clk = mmdc_ipg_clk;
if (mmdc_num == 0) if (mmdc_num == 0)
name = "mmdc"; name = "mmdc";
else else
...@@ -529,7 +534,7 @@ static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_b ...@@ -529,7 +534,7 @@ static int imx_mmdc_perf_init(struct platform_device *pdev, void __iomem *mmdc_b
#else #else
#define imx_mmdc_remove NULL #define imx_mmdc_remove NULL
#define imx_mmdc_perf_init(pdev, mmdc_base) 0 #define imx_mmdc_perf_init(pdev, mmdc_base, mmdc_ipg_clk) 0
#endif #endif
static int imx_mmdc_probe(struct platform_device *pdev) static int imx_mmdc_probe(struct platform_device *pdev)
...@@ -567,7 +572,13 @@ static int imx_mmdc_probe(struct platform_device *pdev) ...@@ -567,7 +572,13 @@ static int imx_mmdc_probe(struct platform_device *pdev)
val &= ~(1 << BP_MMDC_MAPSR_PSD); val &= ~(1 << BP_MMDC_MAPSR_PSD);
writel_relaxed(val, reg); writel_relaxed(val, reg);
return imx_mmdc_perf_init(pdev, mmdc_base); err = imx_mmdc_perf_init(pdev, mmdc_base, mmdc_ipg_clk);
if (err) {
iounmap(mmdc_base);
clk_disable_unprepare(mmdc_ipg_clk);
}
return err;
} }
int imx_mmdc_get_ddr_type(void) int imx_mmdc_get_ddr_type(void)
......
...@@ -91,6 +91,7 @@ config MACH_IXDP465 ...@@ -91,6 +91,7 @@ config MACH_IXDP465
config MACH_GORAMO_MLR config MACH_GORAMO_MLR
bool "GORAMO Multi Link Router" bool "GORAMO Multi Link Router"
depends on IXP4XX_PCI_LEGACY
help help
Say 'Y' here if you want your kernel to support GORAMO Say 'Y' here if you want your kernel to support GORAMO
MultiLink router. MultiLink router.
......
...@@ -3776,6 +3776,7 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh) ...@@ -3776,6 +3776,7 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh)
struct omap_hwmod_ocp_if *oi; struct omap_hwmod_ocp_if *oi;
struct clockdomain *clkdm; struct clockdomain *clkdm;
struct clk_hw_omap *clk; struct clk_hw_omap *clk;
struct clk_hw *hw;
if (!oh) if (!oh)
return NULL; return NULL;
...@@ -3792,7 +3793,14 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh) ...@@ -3792,7 +3793,14 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh)
c = oi->_clk; c = oi->_clk;
} }
clk = to_clk_hw_omap(__clk_get_hw(c)); hw = __clk_get_hw(c);
if (!hw)
return NULL;
clk = to_clk_hw_omap(hw);
if (!clk)
return NULL;
clkdm = clk->clkdm; clkdm = clk->clkdm;
if (!clkdm) if (!clkdm)
return NULL; return NULL;
......
...@@ -54,6 +54,7 @@ &mscc_felix { ...@@ -54,6 +54,7 @@ &mscc_felix {
&mscc_felix_port0 { &mscc_felix_port0 {
label = "swp0"; label = "swp0";
managed = "in-band-status";
phy-handle = <&phy0>; phy-handle = <&phy0>;
phy-mode = "sgmii"; phy-mode = "sgmii";
status = "okay"; status = "okay";
...@@ -61,6 +62,7 @@ &mscc_felix_port0 { ...@@ -61,6 +62,7 @@ &mscc_felix_port0 {
&mscc_felix_port1 { &mscc_felix_port1 {
label = "swp1"; label = "swp1";
managed = "in-band-status";
phy-handle = <&phy1>; phy-handle = <&phy1>;
phy-mode = "sgmii"; phy-mode = "sgmii";
status = "okay"; status = "okay";
......
...@@ -66,7 +66,7 @@ CPU_PW20: cpu-pw20 { ...@@ -66,7 +66,7 @@ CPU_PW20: cpu-pw20 {
}; };
}; };
sysclk: clock-sysclk { sysclk: sysclk {
compatible = "fixed-clock"; compatible = "fixed-clock";
#clock-cells = <0>; #clock-cells = <0>;
clock-frequency = <100000000>; clock-frequency = <100000000>;
......
...@@ -19,6 +19,8 @@ / { ...@@ -19,6 +19,8 @@ / {
aliases { aliases {
spi0 = &spi0; spi0 = &spi0;
ethernet1 = &eth1; ethernet1 = &eth1;
mmc0 = &sdhci0;
mmc1 = &sdhci1;
}; };
chosen { chosen {
...@@ -119,6 +121,7 @@ &i2c0 { ...@@ -119,6 +121,7 @@ &i2c0 {
pinctrl-names = "default"; pinctrl-names = "default";
pinctrl-0 = <&i2c1_pins>; pinctrl-0 = <&i2c1_pins>;
clock-frequency = <100000>; clock-frequency = <100000>;
/delete-property/ mrvl,i2c-fast-mode;
status = "okay"; status = "okay";
rtc@6f { rtc@6f {
......
...@@ -1840,7 +1840,11 @@ pcie@14100000 { ...@@ -1840,7 +1840,11 @@ pcie@14100000 {
interconnects = <&mc TEGRA194_MEMORY_CLIENT_PCIE1R &emc>, interconnects = <&mc TEGRA194_MEMORY_CLIENT_PCIE1R &emc>,
<&mc TEGRA194_MEMORY_CLIENT_PCIE1W &emc>; <&mc TEGRA194_MEMORY_CLIENT_PCIE1W &emc>;
interconnect-names = "read", "write"; interconnect-names = "dma-mem", "write";
iommus = <&smmu TEGRA194_SID_PCIE1>;
iommu-map = <0x0 &smmu TEGRA194_SID_PCIE1 0x1000>;
iommu-map-mask = <0x0>;
dma-coherent;
}; };
pcie@14120000 { pcie@14120000 {
...@@ -1890,7 +1894,11 @@ pcie@14120000 { ...@@ -1890,7 +1894,11 @@ pcie@14120000 {
interconnects = <&mc TEGRA194_MEMORY_CLIENT_PCIE2AR &emc>, interconnects = <&mc TEGRA194_MEMORY_CLIENT_PCIE2AR &emc>,
<&mc TEGRA194_MEMORY_CLIENT_PCIE2AW &emc>; <&mc TEGRA194_MEMORY_CLIENT_PCIE2AW &emc>;
interconnect-names = "read", "write"; interconnect-names = "dma-mem", "write";
iommus = <&smmu TEGRA194_SID_PCIE2>;
iommu-map = <0x0 &smmu TEGRA194_SID_PCIE2 0x1000>;
iommu-map-mask = <0x0>;
dma-coherent;
}; };
pcie@14140000 { pcie@14140000 {
...@@ -1940,7 +1948,11 @@ pcie@14140000 { ...@@ -1940,7 +1948,11 @@ pcie@14140000 {
interconnects = <&mc TEGRA194_MEMORY_CLIENT_PCIE3R &emc>, interconnects = <&mc TEGRA194_MEMORY_CLIENT_PCIE3R &emc>,
<&mc TEGRA194_MEMORY_CLIENT_PCIE3W &emc>; <&mc TEGRA194_MEMORY_CLIENT_PCIE3W &emc>;
interconnect-names = "read", "write"; interconnect-names = "dma-mem", "write";
iommus = <&smmu TEGRA194_SID_PCIE3>;
iommu-map = <0x0 &smmu TEGRA194_SID_PCIE3 0x1000>;
iommu-map-mask = <0x0>;
dma-coherent;
}; };
pcie@14160000 { pcie@14160000 {
...@@ -1990,7 +2002,11 @@ pcie@14160000 { ...@@ -1990,7 +2002,11 @@ pcie@14160000 {
interconnects = <&mc TEGRA194_MEMORY_CLIENT_PCIE4R &emc>, interconnects = <&mc TEGRA194_MEMORY_CLIENT_PCIE4R &emc>,
<&mc TEGRA194_MEMORY_CLIENT_PCIE4W &emc>; <&mc TEGRA194_MEMORY_CLIENT_PCIE4W &emc>;
interconnect-names = "read", "write"; interconnect-names = "dma-mem", "write";
iommus = <&smmu TEGRA194_SID_PCIE4>;
iommu-map = <0x0 &smmu TEGRA194_SID_PCIE4 0x1000>;
iommu-map-mask = <0x0>;
dma-coherent;
}; };
pcie@14180000 { pcie@14180000 {
...@@ -2040,7 +2056,11 @@ pcie@14180000 { ...@@ -2040,7 +2056,11 @@ pcie@14180000 {
interconnects = <&mc TEGRA194_MEMORY_CLIENT_PCIE0R &emc>, interconnects = <&mc TEGRA194_MEMORY_CLIENT_PCIE0R &emc>,
<&mc TEGRA194_MEMORY_CLIENT_PCIE0W &emc>; <&mc TEGRA194_MEMORY_CLIENT_PCIE0W &emc>;
interconnect-names = "read", "write"; interconnect-names = "dma-mem", "write";
iommus = <&smmu TEGRA194_SID_PCIE0>;
iommu-map = <0x0 &smmu TEGRA194_SID_PCIE0 0x1000>;
iommu-map-mask = <0x0>;
dma-coherent;
}; };
pcie@141a0000 { pcie@141a0000 {
...@@ -2094,7 +2114,11 @@ pcie@141a0000 { ...@@ -2094,7 +2114,11 @@ pcie@141a0000 {
interconnects = <&mc TEGRA194_MEMORY_CLIENT_PCIE5R &emc>, interconnects = <&mc TEGRA194_MEMORY_CLIENT_PCIE5R &emc>,
<&mc TEGRA194_MEMORY_CLIENT_PCIE5W &emc>; <&mc TEGRA194_MEMORY_CLIENT_PCIE5W &emc>;
interconnect-names = "read", "write"; interconnect-names = "dma-mem", "write";
iommus = <&smmu TEGRA194_SID_PCIE5>;
iommu-map = <0x0 &smmu TEGRA194_SID_PCIE5 0x1000>;
iommu-map-mask = <0x0>;
dma-coherent;
}; };
pcie_ep@14160000 { pcie_ep@14160000 {
...@@ -2127,6 +2151,14 @@ pcie_ep@14160000 { ...@@ -2127,6 +2151,14 @@ pcie_ep@14160000 {
nvidia,aspm-cmrt-us = <60>; nvidia,aspm-cmrt-us = <60>;
nvidia,aspm-pwr-on-t-us = <20>; nvidia,aspm-pwr-on-t-us = <20>;
nvidia,aspm-l0s-entrance-latency-us = <3>; nvidia,aspm-l0s-entrance-latency-us = <3>;
interconnects = <&mc TEGRA194_MEMORY_CLIENT_PCIE4R &emc>,
<&mc TEGRA194_MEMORY_CLIENT_PCIE4W &emc>;
interconnect-names = "dma-mem", "write";
iommus = <&smmu TEGRA194_SID_PCIE4>;
iommu-map = <0x0 &smmu TEGRA194_SID_PCIE4 0x1000>;
iommu-map-mask = <0x0>;
dma-coherent;
}; };
pcie_ep@14180000 { pcie_ep@14180000 {
...@@ -2159,6 +2191,14 @@ pcie_ep@14180000 { ...@@ -2159,6 +2191,14 @@ pcie_ep@14180000 {
nvidia,aspm-cmrt-us = <60>; nvidia,aspm-cmrt-us = <60>;
nvidia,aspm-pwr-on-t-us = <20>; nvidia,aspm-pwr-on-t-us = <20>;
nvidia,aspm-l0s-entrance-latency-us = <3>; nvidia,aspm-l0s-entrance-latency-us = <3>;
interconnects = <&mc TEGRA194_MEMORY_CLIENT_PCIE0R &emc>,
<&mc TEGRA194_MEMORY_CLIENT_PCIE0W &emc>;
interconnect-names = "dma-mem", "write";
iommus = <&smmu TEGRA194_SID_PCIE0>;
iommu-map = <0x0 &smmu TEGRA194_SID_PCIE0 0x1000>;
iommu-map-mask = <0x0>;
dma-coherent;
}; };
pcie_ep@141a0000 { pcie_ep@141a0000 {
...@@ -2194,6 +2234,14 @@ pcie_ep@141a0000 { ...@@ -2194,6 +2234,14 @@ pcie_ep@141a0000 {
nvidia,aspm-cmrt-us = <60>; nvidia,aspm-cmrt-us = <60>;
nvidia,aspm-pwr-on-t-us = <20>; nvidia,aspm-pwr-on-t-us = <20>;
nvidia,aspm-l0s-entrance-latency-us = <3>; nvidia,aspm-l0s-entrance-latency-us = <3>;
interconnects = <&mc TEGRA194_MEMORY_CLIENT_PCIE5R &emc>,
<&mc TEGRA194_MEMORY_CLIENT_PCIE5W &emc>;
interconnect-names = "dma-mem", "write";
iommus = <&smmu TEGRA194_SID_PCIE5>;
iommu-map = <0x0 &smmu TEGRA194_SID_PCIE5 0x1000>;
iommu-map-mask = <0x0>;
dma-coherent;
}; };
sram@40000000 { sram@40000000 {
......
...@@ -100,6 +100,7 @@ static const char * const clock_names[SYSC_MAX_CLOCKS] = { ...@@ -100,6 +100,7 @@ static const char * const clock_names[SYSC_MAX_CLOCKS] = {
* @cookie: data used by legacy platform callbacks * @cookie: data used by legacy platform callbacks
* @name: name if available * @name: name if available
* @revision: interconnect target module revision * @revision: interconnect target module revision
* @reserved: target module is reserved and already in use
* @enabled: sysc runtime enabled status * @enabled: sysc runtime enabled status
* @needs_resume: runtime resume needed on resume from suspend * @needs_resume: runtime resume needed on resume from suspend
* @child_needs_resume: runtime resume needed for child on resume from suspend * @child_needs_resume: runtime resume needed for child on resume from suspend
...@@ -130,6 +131,7 @@ struct sysc { ...@@ -130,6 +131,7 @@ struct sysc {
struct ti_sysc_cookie cookie; struct ti_sysc_cookie cookie;
const char *name; const char *name;
u32 revision; u32 revision;
unsigned int reserved:1;
unsigned int enabled:1; unsigned int enabled:1;
unsigned int needs_resume:1; unsigned int needs_resume:1;
unsigned int child_needs_resume:1; unsigned int child_needs_resume:1;
...@@ -2951,6 +2953,8 @@ static int sysc_init_soc(struct sysc *ddata) ...@@ -2951,6 +2953,8 @@ static int sysc_init_soc(struct sysc *ddata)
case SOC_3430 ... SOC_3630: case SOC_3430 ... SOC_3630:
sysc_add_disabled(0x48304000); /* timer12 */ sysc_add_disabled(0x48304000); /* timer12 */
break; break;
case SOC_AM3:
sysc_add_disabled(0x48310000); /* rng */
default: default:
break; break;
} }
...@@ -3093,8 +3097,8 @@ static int sysc_probe(struct platform_device *pdev) ...@@ -3093,8 +3097,8 @@ static int sysc_probe(struct platform_device *pdev)
return error; return error;
error = sysc_check_active_timer(ddata); error = sysc_check_active_timer(ddata);
if (error) if (error == -EBUSY)
return error; ddata->reserved = true;
error = sysc_get_clocks(ddata); error = sysc_get_clocks(ddata);
if (error) if (error)
...@@ -3130,11 +3134,15 @@ static int sysc_probe(struct platform_device *pdev) ...@@ -3130,11 +3134,15 @@ static int sysc_probe(struct platform_device *pdev)
sysc_show_registers(ddata); sysc_show_registers(ddata);
ddata->dev->type = &sysc_device_type; ddata->dev->type = &sysc_device_type;
error = of_platform_populate(ddata->dev->of_node, sysc_match_table,
pdata ? pdata->auxdata : NULL, if (!ddata->reserved) {
ddata->dev); error = of_platform_populate(ddata->dev->of_node,
if (error) sysc_match_table,
goto err; pdata ? pdata->auxdata : NULL,
ddata->dev);
if (error)
goto err;
}
INIT_DELAYED_WORK(&ddata->idle_work, ti_sysc_idle); INIT_DELAYED_WORK(&ddata->idle_work, ti_sysc_idle);
......
...@@ -254,11 +254,11 @@ static int ftpm_tee_probe(struct device *dev) ...@@ -254,11 +254,11 @@ static int ftpm_tee_probe(struct device *dev)
pvt_data->session = sess_arg.session; pvt_data->session = sess_arg.session;
/* Allocate dynamic shared memory with fTPM TA */ /* Allocate dynamic shared memory with fTPM TA */
pvt_data->shm = tee_shm_alloc(pvt_data->ctx, pvt_data->shm = tee_shm_alloc_kernel_buf(pvt_data->ctx,
MAX_COMMAND_SIZE + MAX_RESPONSE_SIZE, MAX_COMMAND_SIZE +
TEE_SHM_MAPPED | TEE_SHM_DMA_BUF); MAX_RESPONSE_SIZE);
if (IS_ERR(pvt_data->shm)) { if (IS_ERR(pvt_data->shm)) {
dev_err(dev, "%s: tee_shm_alloc failed\n", __func__); dev_err(dev, "%s: tee_shm_alloc_kernel_buf failed\n", __func__);
rc = -ENOMEM; rc = -ENOMEM;
goto out_shm_alloc; goto out_shm_alloc;
} }
......
...@@ -212,10 +212,9 @@ static int tee_bnxt_fw_probe(struct device *dev) ...@@ -212,10 +212,9 @@ static int tee_bnxt_fw_probe(struct device *dev)
pvt_data.dev = dev; pvt_data.dev = dev;
fw_shm_pool = tee_shm_alloc(pvt_data.ctx, MAX_SHM_MEM_SZ, fw_shm_pool = tee_shm_alloc_kernel_buf(pvt_data.ctx, MAX_SHM_MEM_SZ);
TEE_SHM_MAPPED | TEE_SHM_DMA_BUF);
if (IS_ERR(fw_shm_pool)) { if (IS_ERR(fw_shm_pool)) {
dev_err(pvt_data.dev, "tee_shm_alloc failed\n"); dev_err(pvt_data.dev, "tee_shm_alloc_kernel_buf failed\n");
err = PTR_ERR(fw_shm_pool); err = PTR_ERR(fw_shm_pool);
goto out_sess; goto out_sess;
} }
...@@ -242,6 +241,14 @@ static int tee_bnxt_fw_remove(struct device *dev) ...@@ -242,6 +241,14 @@ static int tee_bnxt_fw_remove(struct device *dev)
return 0; return 0;
} }
static void tee_bnxt_fw_shutdown(struct device *dev)
{
tee_shm_free(pvt_data.fw_shm_pool);
tee_client_close_session(pvt_data.ctx, pvt_data.session_id);
tee_client_close_context(pvt_data.ctx);
pvt_data.ctx = NULL;
}
static const struct tee_client_device_id tee_bnxt_fw_id_table[] = { static const struct tee_client_device_id tee_bnxt_fw_id_table[] = {
{UUID_INIT(0x6272636D, 0x2019, 0x0716, {UUID_INIT(0x6272636D, 0x2019, 0x0716,
0x42, 0x43, 0x4D, 0x5F, 0x53, 0x43, 0x48, 0x49)}, 0x42, 0x43, 0x4D, 0x5F, 0x53, 0x43, 0x48, 0x49)},
...@@ -257,6 +264,7 @@ static struct tee_client_driver tee_bnxt_fw_driver = { ...@@ -257,6 +264,7 @@ static struct tee_client_driver tee_bnxt_fw_driver = {
.bus = &tee_bus_type, .bus = &tee_bus_type,
.probe = tee_bnxt_fw_probe, .probe = tee_bnxt_fw_probe,
.remove = tee_bnxt_fw_remove, .remove = tee_bnxt_fw_remove,
.shutdown = tee_bnxt_fw_shutdown,
}, },
}; };
......
...@@ -13,7 +13,7 @@ obj-$(CONFIG_MACH_DOVE) += dove/ ...@@ -13,7 +13,7 @@ obj-$(CONFIG_MACH_DOVE) += dove/
obj-y += fsl/ obj-y += fsl/
obj-$(CONFIG_ARCH_GEMINI) += gemini/ obj-$(CONFIG_ARCH_GEMINI) += gemini/
obj-y += imx/ obj-y += imx/
obj-$(CONFIG_ARCH_IXP4XX) += ixp4xx/ obj-y += ixp4xx/
obj-$(CONFIG_SOC_XWAY) += lantiq/ obj-$(CONFIG_SOC_XWAY) += lantiq/
obj-$(CONFIG_LITEX_SOC_CONTROLLER) += litex/ obj-$(CONFIG_LITEX_SOC_CONTROLLER) += litex/
obj-y += mediatek/ obj-y += mediatek/
......
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/module.h>
#include <linux/nvmem-consumer.h>
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/sys_soc.h> #include <linux/sys_soc.h>
...@@ -31,7 +29,7 @@ ...@@ -31,7 +29,7 @@
struct imx8_soc_data { struct imx8_soc_data {
char *name; char *name;
u32 (*soc_revision)(struct device *dev); u32 (*soc_revision)(void);
}; };
static u64 soc_uid; static u64 soc_uid;
...@@ -52,7 +50,7 @@ static u32 imx8mq_soc_revision_from_atf(void) ...@@ -52,7 +50,7 @@ static u32 imx8mq_soc_revision_from_atf(void)
static inline u32 imx8mq_soc_revision_from_atf(void) { return 0; }; static inline u32 imx8mq_soc_revision_from_atf(void) { return 0; };
#endif #endif
static u32 __init imx8mq_soc_revision(struct device *dev) static u32 __init imx8mq_soc_revision(void)
{ {
struct device_node *np; struct device_node *np;
void __iomem *ocotp_base; void __iomem *ocotp_base;
...@@ -77,20 +75,9 @@ static u32 __init imx8mq_soc_revision(struct device *dev) ...@@ -77,20 +75,9 @@ static u32 __init imx8mq_soc_revision(struct device *dev)
rev = REV_B1; rev = REV_B1;
} }
if (dev) { soc_uid = readl_relaxed(ocotp_base + OCOTP_UID_HIGH);
int ret; soc_uid <<= 32;
soc_uid |= readl_relaxed(ocotp_base + OCOTP_UID_LOW);
ret = nvmem_cell_read_u64(dev, "soc_unique_id", &soc_uid);
if (ret) {
iounmap(ocotp_base);
of_node_put(np);
return ret;
}
} else {
soc_uid = readl_relaxed(ocotp_base + OCOTP_UID_HIGH);
soc_uid <<= 32;
soc_uid |= readl_relaxed(ocotp_base + OCOTP_UID_LOW);
}
iounmap(ocotp_base); iounmap(ocotp_base);
of_node_put(np); of_node_put(np);
...@@ -120,7 +107,7 @@ static void __init imx8mm_soc_uid(void) ...@@ -120,7 +107,7 @@ static void __init imx8mm_soc_uid(void)
of_node_put(np); of_node_put(np);
} }
static u32 __init imx8mm_soc_revision(struct device *dev) static u32 __init imx8mm_soc_revision(void)
{ {
struct device_node *np; struct device_node *np;
void __iomem *anatop_base; void __iomem *anatop_base;
...@@ -138,15 +125,7 @@ static u32 __init imx8mm_soc_revision(struct device *dev) ...@@ -138,15 +125,7 @@ static u32 __init imx8mm_soc_revision(struct device *dev)
iounmap(anatop_base); iounmap(anatop_base);
of_node_put(np); of_node_put(np);
if (dev) { imx8mm_soc_uid();
int ret;
ret = nvmem_cell_read_u64(dev, "soc_unique_id", &soc_uid);
if (ret)
return ret;
} else {
imx8mm_soc_uid();
}
return rev; return rev;
} }
...@@ -171,7 +150,7 @@ static const struct imx8_soc_data imx8mp_soc_data = { ...@@ -171,7 +150,7 @@ static const struct imx8_soc_data imx8mp_soc_data = {
.soc_revision = imx8mm_soc_revision, .soc_revision = imx8mm_soc_revision,
}; };
static __maybe_unused const struct of_device_id imx8_machine_match[] = { static __maybe_unused const struct of_device_id imx8_soc_match[] = {
{ .compatible = "fsl,imx8mq", .data = &imx8mq_soc_data, }, { .compatible = "fsl,imx8mq", .data = &imx8mq_soc_data, },
{ .compatible = "fsl,imx8mm", .data = &imx8mm_soc_data, }, { .compatible = "fsl,imx8mm", .data = &imx8mm_soc_data, },
{ .compatible = "fsl,imx8mn", .data = &imx8mn_soc_data, }, { .compatible = "fsl,imx8mn", .data = &imx8mn_soc_data, },
...@@ -179,20 +158,12 @@ static __maybe_unused const struct of_device_id imx8_machine_match[] = { ...@@ -179,20 +158,12 @@ static __maybe_unused const struct of_device_id imx8_machine_match[] = {
{ } { }
}; };
static __maybe_unused const struct of_device_id imx8_soc_match[] = {
{ .compatible = "fsl,imx8mq-soc", .data = &imx8mq_soc_data, },
{ .compatible = "fsl,imx8mm-soc", .data = &imx8mm_soc_data, },
{ .compatible = "fsl,imx8mn-soc", .data = &imx8mn_soc_data, },
{ .compatible = "fsl,imx8mp-soc", .data = &imx8mp_soc_data, },
{ }
};
#define imx8_revision(soc_rev) \ #define imx8_revision(soc_rev) \
soc_rev ? \ soc_rev ? \
kasprintf(GFP_KERNEL, "%d.%d", (soc_rev >> 4) & 0xf, soc_rev & 0xf) : \ kasprintf(GFP_KERNEL, "%d.%d", (soc_rev >> 4) & 0xf, soc_rev & 0xf) : \
"unknown" "unknown"
static int imx8_soc_info(struct platform_device *pdev) static int __init imx8_soc_init(void)
{ {
struct soc_device_attribute *soc_dev_attr; struct soc_device_attribute *soc_dev_attr;
struct soc_device *soc_dev; struct soc_device *soc_dev;
...@@ -211,10 +182,7 @@ static int imx8_soc_info(struct platform_device *pdev) ...@@ -211,10 +182,7 @@ static int imx8_soc_info(struct platform_device *pdev)
if (ret) if (ret)
goto free_soc; goto free_soc;
if (pdev) id = of_match_node(imx8_soc_match, of_root);
id = of_match_node(imx8_soc_match, pdev->dev.of_node);
else
id = of_match_node(imx8_machine_match, of_root);
if (!id) { if (!id) {
ret = -ENODEV; ret = -ENODEV;
goto free_soc; goto free_soc;
...@@ -223,16 +191,8 @@ static int imx8_soc_info(struct platform_device *pdev) ...@@ -223,16 +191,8 @@ static int imx8_soc_info(struct platform_device *pdev)
data = id->data; data = id->data;
if (data) { if (data) {
soc_dev_attr->soc_id = data->name; soc_dev_attr->soc_id = data->name;
if (data->soc_revision) { if (data->soc_revision)
if (pdev) { soc_rev = data->soc_revision();
soc_rev = data->soc_revision(&pdev->dev);
ret = soc_rev;
if (ret < 0)
goto free_soc;
} else {
soc_rev = data->soc_revision(NULL);
}
}
} }
soc_dev_attr->revision = imx8_revision(soc_rev); soc_dev_attr->revision = imx8_revision(soc_rev);
...@@ -270,24 +230,4 @@ static int imx8_soc_info(struct platform_device *pdev) ...@@ -270,24 +230,4 @@ static int imx8_soc_info(struct platform_device *pdev)
kfree(soc_dev_attr); kfree(soc_dev_attr);
return ret; return ret;
} }
/* Retain device_initcall is for backward compatibility with DTS. */
static int __init imx8_soc_init(void)
{
if (of_find_matching_node_and_match(NULL, imx8_soc_match, NULL))
return 0;
return imx8_soc_info(NULL);
}
device_initcall(imx8_soc_init); device_initcall(imx8_soc_init);
static struct platform_driver imx8_soc_info_driver = {
.probe = imx8_soc_info,
.driver = {
.name = "imx8_soc_info",
.of_match_table = imx8_soc_match,
},
};
module_platform_driver(imx8_soc_info_driver);
MODULE_LICENSE("GPL v2");
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/soc/ixp4xx/npe.h> #include <linux/soc/ixp4xx/npe.h>
#include <mach/hardware.h>
#include <linux/soc/ixp4xx/cpu.h> #include <linux/soc/ixp4xx/cpu.h>
#define DEBUG_MSG 0 #define DEBUG_MSG 0
...@@ -694,8 +693,8 @@ static int ixp4xx_npe_probe(struct platform_device *pdev) ...@@ -694,8 +693,8 @@ static int ixp4xx_npe_probe(struct platform_device *pdev)
if (!(ixp4xx_read_feature_bits() & if (!(ixp4xx_read_feature_bits() &
(IXP4XX_FEATURE_RESET_NPEA << i))) { (IXP4XX_FEATURE_RESET_NPEA << i))) {
dev_info(dev, "NPE%d at 0x%08x-0x%08x not available\n", dev_info(dev, "NPE%d at %pR not available\n",
i, res->start, res->end); i, res);
continue; /* NPE already disabled or not present */ continue; /* NPE already disabled or not present */
} }
npe->regs = devm_ioremap_resource(dev, res); npe->regs = devm_ioremap_resource(dev, res);
...@@ -703,13 +702,12 @@ static int ixp4xx_npe_probe(struct platform_device *pdev) ...@@ -703,13 +702,12 @@ static int ixp4xx_npe_probe(struct platform_device *pdev)
return PTR_ERR(npe->regs); return PTR_ERR(npe->regs);
if (npe_reset(npe)) { if (npe_reset(npe)) {
dev_info(dev, "NPE%d at 0x%08x-0x%08x does not reset\n", dev_info(dev, "NPE%d at %pR does not reset\n",
i, res->start, res->end); i, res);
continue; continue;
} }
npe->valid = 1; npe->valid = 1;
dev_info(dev, "NPE%d at 0x%08x-0x%08x registered\n", dev_info(dev, "NPE%d at %pR registered\n", i, res);
i, res->start, res->end);
found++; found++;
} }
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <linux/of.h> #include <linux/of.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/soc/ixp4xx/qmgr.h> #include <linux/soc/ixp4xx/qmgr.h>
#include <mach/hardware.h>
#include <linux/soc/ixp4xx/cpu.h> #include <linux/soc/ixp4xx/cpu.h>
static struct qmgr_regs __iomem *qmgr_regs; static struct qmgr_regs __iomem *qmgr_regs;
...@@ -147,12 +146,12 @@ static irqreturn_t qmgr_irq1_a0(int irq, void *pdev) ...@@ -147,12 +146,12 @@ static irqreturn_t qmgr_irq1_a0(int irq, void *pdev)
/* ACK - it may clear any bits so don't rely on it */ /* ACK - it may clear any bits so don't rely on it */
__raw_writel(0xFFFFFFFF, &qmgr_regs->irqstat[0]); __raw_writel(0xFFFFFFFF, &qmgr_regs->irqstat[0]);
en_bitmap = qmgr_regs->irqen[0]; en_bitmap = __raw_readl(&qmgr_regs->irqen[0]);
while (en_bitmap) { while (en_bitmap) {
i = __fls(en_bitmap); /* number of the last "low" queue */ i = __fls(en_bitmap); /* number of the last "low" queue */
en_bitmap &= ~BIT(i); en_bitmap &= ~BIT(i);
src = qmgr_regs->irqsrc[i >> 3]; src = __raw_readl(&qmgr_regs->irqsrc[i >> 3]);
stat = qmgr_regs->stat1[i >> 3]; stat = __raw_readl(&qmgr_regs->stat1[i >> 3]);
if (src & 4) /* the IRQ condition is inverted */ if (src & 4) /* the IRQ condition is inverted */
stat = ~stat; stat = ~stat;
if (stat & BIT(src & 3)) { if (stat & BIT(src & 3)) {
...@@ -172,7 +171,8 @@ static irqreturn_t qmgr_irq2_a0(int irq, void *pdev) ...@@ -172,7 +171,8 @@ static irqreturn_t qmgr_irq2_a0(int irq, void *pdev)
/* ACK - it may clear any bits so don't rely on it */ /* ACK - it may clear any bits so don't rely on it */
__raw_writel(0xFFFFFFFF, &qmgr_regs->irqstat[1]); __raw_writel(0xFFFFFFFF, &qmgr_regs->irqstat[1]);
req_bitmap = qmgr_regs->irqen[1] & qmgr_regs->statne_h; req_bitmap = __raw_readl(&qmgr_regs->irqen[1]) &
__raw_readl(&qmgr_regs->statne_h);
while (req_bitmap) { while (req_bitmap) {
i = __fls(req_bitmap); /* number of the last "high" queue */ i = __fls(req_bitmap); /* number of the last "high" queue */
req_bitmap &= ~BIT(i); req_bitmap &= ~BIT(i);
......
...@@ -15,7 +15,7 @@ config ARCH_TEGRA_2x_SOC ...@@ -15,7 +15,7 @@ config ARCH_TEGRA_2x_SOC
select PL310_ERRATA_769419 if CACHE_L2X0 select PL310_ERRATA_769419 if CACHE_L2X0
select SOC_TEGRA_FLOWCTRL select SOC_TEGRA_FLOWCTRL
select SOC_TEGRA_PMC select SOC_TEGRA_PMC
select SOC_TEGRA20_VOLTAGE_COUPLER select SOC_TEGRA20_VOLTAGE_COUPLER if REGULATOR
select TEGRA_TIMER select TEGRA_TIMER
help help
Support for NVIDIA Tegra AP20 and T20 processors, based on the Support for NVIDIA Tegra AP20 and T20 processors, based on the
...@@ -29,7 +29,7 @@ config ARCH_TEGRA_3x_SOC ...@@ -29,7 +29,7 @@ config ARCH_TEGRA_3x_SOC
select PL310_ERRATA_769419 if CACHE_L2X0 select PL310_ERRATA_769419 if CACHE_L2X0
select SOC_TEGRA_FLOWCTRL select SOC_TEGRA_FLOWCTRL
select SOC_TEGRA_PMC select SOC_TEGRA_PMC
select SOC_TEGRA30_VOLTAGE_COUPLER select SOC_TEGRA30_VOLTAGE_COUPLER if REGULATOR
select TEGRA_TIMER select TEGRA_TIMER
help help
Support for NVIDIA Tegra T30 processor family, based on the Support for NVIDIA Tegra T30 processor family, based on the
...@@ -155,7 +155,9 @@ config SOC_TEGRA_POWERGATE_BPMP ...@@ -155,7 +155,9 @@ config SOC_TEGRA_POWERGATE_BPMP
config SOC_TEGRA20_VOLTAGE_COUPLER config SOC_TEGRA20_VOLTAGE_COUPLER
bool "Voltage scaling support for Tegra20 SoCs" bool "Voltage scaling support for Tegra20 SoCs"
depends on ARCH_TEGRA_2x_SOC || COMPILE_TEST depends on ARCH_TEGRA_2x_SOC || COMPILE_TEST
depends on REGULATOR
config SOC_TEGRA30_VOLTAGE_COUPLER config SOC_TEGRA30_VOLTAGE_COUPLER
bool "Voltage scaling support for Tegra30 SoCs" bool "Voltage scaling support for Tegra30 SoCs"
depends on ARCH_TEGRA_3x_SOC || COMPILE_TEST depends on ARCH_TEGRA_3x_SOC || COMPILE_TEST
depends on REGULATOR
...@@ -184,7 +184,7 @@ static struct tee_shm *get_msg_arg(struct tee_context *ctx, size_t num_params, ...@@ -184,7 +184,7 @@ static struct tee_shm *get_msg_arg(struct tee_context *ctx, size_t num_params,
struct optee_msg_arg *ma; struct optee_msg_arg *ma;
shm = tee_shm_alloc(ctx, OPTEE_MSG_GET_ARG_SIZE(num_params), shm = tee_shm_alloc(ctx, OPTEE_MSG_GET_ARG_SIZE(num_params),
TEE_SHM_MAPPED); TEE_SHM_MAPPED | TEE_SHM_PRIV);
if (IS_ERR(shm)) if (IS_ERR(shm))
return shm; return shm;
...@@ -416,11 +416,13 @@ void optee_enable_shm_cache(struct optee *optee) ...@@ -416,11 +416,13 @@ void optee_enable_shm_cache(struct optee *optee)
} }
/** /**
* optee_disable_shm_cache() - Disables caching of some shared memory allocation * __optee_disable_shm_cache() - Disables caching of some shared memory
* in OP-TEE * allocation in OP-TEE
* @optee: main service struct * @optee: main service struct
* @is_mapped: true if the cached shared memory addresses were mapped by this
* kernel, are safe to dereference, and should be freed
*/ */
void optee_disable_shm_cache(struct optee *optee) static void __optee_disable_shm_cache(struct optee *optee, bool is_mapped)
{ {
struct optee_call_waiter w; struct optee_call_waiter w;
...@@ -439,6 +441,13 @@ void optee_disable_shm_cache(struct optee *optee) ...@@ -439,6 +441,13 @@ void optee_disable_shm_cache(struct optee *optee)
if (res.result.status == OPTEE_SMC_RETURN_OK) { if (res.result.status == OPTEE_SMC_RETURN_OK) {
struct tee_shm *shm; struct tee_shm *shm;
/*
* Shared memory references that were not mapped by
* this kernel must be ignored to prevent a crash.
*/
if (!is_mapped)
continue;
shm = reg_pair_to_ptr(res.result.shm_upper32, shm = reg_pair_to_ptr(res.result.shm_upper32,
res.result.shm_lower32); res.result.shm_lower32);
tee_shm_free(shm); tee_shm_free(shm);
...@@ -449,6 +458,27 @@ void optee_disable_shm_cache(struct optee *optee) ...@@ -449,6 +458,27 @@ void optee_disable_shm_cache(struct optee *optee)
optee_cq_wait_final(&optee->call_queue, &w); optee_cq_wait_final(&optee->call_queue, &w);
} }
/**
* optee_disable_shm_cache() - Disables caching of mapped shared memory
* allocations in OP-TEE
* @optee: main service struct
*/
void optee_disable_shm_cache(struct optee *optee)
{
return __optee_disable_shm_cache(optee, true);
}
/**
* optee_disable_unmapped_shm_cache() - Disables caching of shared memory
* allocations in OP-TEE which are not
* currently mapped
* @optee: main service struct
*/
void optee_disable_unmapped_shm_cache(struct optee *optee)
{
return __optee_disable_shm_cache(optee, false);
}
#define PAGELIST_ENTRIES_PER_PAGE \ #define PAGELIST_ENTRIES_PER_PAGE \
((OPTEE_MSG_NONCONTIG_PAGE_SIZE / sizeof(u64)) - 1) ((OPTEE_MSG_NONCONTIG_PAGE_SIZE / sizeof(u64)) - 1)
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/arm-smccc.h> #include <linux/arm-smccc.h>
#include <linux/crash_dump.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -277,7 +278,8 @@ static void optee_release(struct tee_context *ctx) ...@@ -277,7 +278,8 @@ static void optee_release(struct tee_context *ctx)
if (!ctxdata) if (!ctxdata)
return; return;
shm = tee_shm_alloc(ctx, sizeof(struct optee_msg_arg), TEE_SHM_MAPPED); shm = tee_shm_alloc(ctx, sizeof(struct optee_msg_arg),
TEE_SHM_MAPPED | TEE_SHM_PRIV);
if (!IS_ERR(shm)) { if (!IS_ERR(shm)) {
arg = tee_shm_get_va(shm, 0); arg = tee_shm_get_va(shm, 0);
/* /*
...@@ -572,6 +574,13 @@ static optee_invoke_fn *get_invoke_func(struct device *dev) ...@@ -572,6 +574,13 @@ static optee_invoke_fn *get_invoke_func(struct device *dev)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
/* optee_remove - Device Removal Routine
* @pdev: platform device information struct
*
* optee_remove is called by platform subsystem to alert the driver
* that it should release the device
*/
static int optee_remove(struct platform_device *pdev) static int optee_remove(struct platform_device *pdev)
{ {
struct optee *optee = platform_get_drvdata(pdev); struct optee *optee = platform_get_drvdata(pdev);
...@@ -602,6 +611,18 @@ static int optee_remove(struct platform_device *pdev) ...@@ -602,6 +611,18 @@ static int optee_remove(struct platform_device *pdev)
return 0; return 0;
} }
/* optee_shutdown - Device Removal Routine
* @pdev: platform device information struct
*
* platform_shutdown is called by the platform subsystem to alert
* the driver that a shutdown, reboot, or kexec is happening and
* device must be disabled.
*/
static void optee_shutdown(struct platform_device *pdev)
{
optee_disable_shm_cache(platform_get_drvdata(pdev));
}
static int optee_probe(struct platform_device *pdev) static int optee_probe(struct platform_device *pdev)
{ {
optee_invoke_fn *invoke_fn; optee_invoke_fn *invoke_fn;
...@@ -612,6 +633,16 @@ static int optee_probe(struct platform_device *pdev) ...@@ -612,6 +633,16 @@ static int optee_probe(struct platform_device *pdev)
u32 sec_caps; u32 sec_caps;
int rc; int rc;
/*
* The kernel may have crashed at the same time that all available
* secure world threads were suspended and we cannot reschedule the
* suspended threads without access to the crashed kernel's wait_queue.
* Therefore, we cannot reliably initialize the OP-TEE driver in the
* kdump kernel.
*/
if (is_kdump_kernel())
return -ENODEV;
invoke_fn = get_invoke_func(&pdev->dev); invoke_fn = get_invoke_func(&pdev->dev);
if (IS_ERR(invoke_fn)) if (IS_ERR(invoke_fn))
return PTR_ERR(invoke_fn); return PTR_ERR(invoke_fn);
...@@ -686,6 +717,15 @@ static int optee_probe(struct platform_device *pdev) ...@@ -686,6 +717,15 @@ static int optee_probe(struct platform_device *pdev)
optee->memremaped_shm = memremaped_shm; optee->memremaped_shm = memremaped_shm;
optee->pool = pool; optee->pool = pool;
/*
* Ensure that there are no pre-existing shm objects before enabling
* the shm cache so that there's no chance of receiving an invalid
* address during shutdown. This could occur, for example, if we're
* kexec booting from an older kernel that did not properly cleanup the
* shm cache.
*/
optee_disable_unmapped_shm_cache(optee);
optee_enable_shm_cache(optee); optee_enable_shm_cache(optee);
if (optee->sec_caps & OPTEE_SMC_SEC_CAP_DYNAMIC_SHM) if (optee->sec_caps & OPTEE_SMC_SEC_CAP_DYNAMIC_SHM)
...@@ -728,6 +768,7 @@ MODULE_DEVICE_TABLE(of, optee_dt_match); ...@@ -728,6 +768,7 @@ MODULE_DEVICE_TABLE(of, optee_dt_match);
static struct platform_driver optee_driver = { static struct platform_driver optee_driver = {
.probe = optee_probe, .probe = optee_probe,
.remove = optee_remove, .remove = optee_remove,
.shutdown = optee_shutdown,
.driver = { .driver = {
.name = "optee", .name = "optee",
.of_match_table = optee_dt_match, .of_match_table = optee_dt_match,
......
...@@ -159,6 +159,7 @@ int optee_cancel_req(struct tee_context *ctx, u32 cancel_id, u32 session); ...@@ -159,6 +159,7 @@ int optee_cancel_req(struct tee_context *ctx, u32 cancel_id, u32 session);
void optee_enable_shm_cache(struct optee *optee); void optee_enable_shm_cache(struct optee *optee);
void optee_disable_shm_cache(struct optee *optee); void optee_disable_shm_cache(struct optee *optee);
void optee_disable_unmapped_shm_cache(struct optee *optee);
int optee_shm_register(struct tee_context *ctx, struct tee_shm *shm, int optee_shm_register(struct tee_context *ctx, struct tee_shm *shm,
struct page **pages, size_t num_pages, struct page **pages, size_t num_pages,
......
...@@ -314,7 +314,7 @@ static void handle_rpc_func_cmd_shm_alloc(struct tee_context *ctx, ...@@ -314,7 +314,7 @@ static void handle_rpc_func_cmd_shm_alloc(struct tee_context *ctx,
shm = cmd_alloc_suppl(ctx, sz); shm = cmd_alloc_suppl(ctx, sz);
break; break;
case OPTEE_RPC_SHM_TYPE_KERNEL: case OPTEE_RPC_SHM_TYPE_KERNEL:
shm = tee_shm_alloc(ctx, sz, TEE_SHM_MAPPED); shm = tee_shm_alloc(ctx, sz, TEE_SHM_MAPPED | TEE_SHM_PRIV);
break; break;
default: default:
arg->ret = TEEC_ERROR_BAD_PARAMETERS; arg->ret = TEEC_ERROR_BAD_PARAMETERS;
...@@ -502,7 +502,8 @@ void optee_handle_rpc(struct tee_context *ctx, struct optee_rpc_param *param, ...@@ -502,7 +502,8 @@ void optee_handle_rpc(struct tee_context *ctx, struct optee_rpc_param *param,
switch (OPTEE_SMC_RETURN_GET_RPC_FUNC(param->a0)) { switch (OPTEE_SMC_RETURN_GET_RPC_FUNC(param->a0)) {
case OPTEE_SMC_RPC_FUNC_ALLOC: case OPTEE_SMC_RPC_FUNC_ALLOC:
shm = tee_shm_alloc(ctx, param->a1, TEE_SHM_MAPPED); shm = tee_shm_alloc(ctx, param->a1,
TEE_SHM_MAPPED | TEE_SHM_PRIV);
if (!IS_ERR(shm) && !tee_shm_get_pa(shm, 0, &pa)) { if (!IS_ERR(shm) && !tee_shm_get_pa(shm, 0, &pa)) {
reg_pair_from_64(&param->a1, &param->a2, pa); reg_pair_from_64(&param->a1, &param->a2, pa);
reg_pair_from_64(&param->a4, &param->a5, reg_pair_from_64(&param->a4, &param->a5,
......
...@@ -27,13 +27,19 @@ static int pool_op_alloc(struct tee_shm_pool_mgr *poolm, ...@@ -27,13 +27,19 @@ static int pool_op_alloc(struct tee_shm_pool_mgr *poolm,
shm->paddr = page_to_phys(page); shm->paddr = page_to_phys(page);
shm->size = PAGE_SIZE << order; shm->size = PAGE_SIZE << order;
if (shm->flags & TEE_SHM_DMA_BUF) { /*
* Shared memory private to the OP-TEE driver doesn't need
* to be registered with OP-TEE.
*/
if (!(shm->flags & TEE_SHM_PRIV)) {
unsigned int nr_pages = 1 << order, i; unsigned int nr_pages = 1 << order, i;
struct page **pages; struct page **pages;
pages = kcalloc(nr_pages, sizeof(pages), GFP_KERNEL); pages = kcalloc(nr_pages, sizeof(pages), GFP_KERNEL);
if (!pages) if (!pages) {
return -ENOMEM; rc = -ENOMEM;
goto err;
}
for (i = 0; i < nr_pages; i++) { for (i = 0; i < nr_pages; i++) {
pages[i] = page; pages[i] = page;
...@@ -44,15 +50,21 @@ static int pool_op_alloc(struct tee_shm_pool_mgr *poolm, ...@@ -44,15 +50,21 @@ static int pool_op_alloc(struct tee_shm_pool_mgr *poolm,
rc = optee_shm_register(shm->ctx, shm, pages, nr_pages, rc = optee_shm_register(shm->ctx, shm, pages, nr_pages,
(unsigned long)shm->kaddr); (unsigned long)shm->kaddr);
kfree(pages); kfree(pages);
if (rc)
goto err;
} }
return 0;
err:
__free_pages(page, order);
return rc; return rc;
} }
static void pool_op_free(struct tee_shm_pool_mgr *poolm, static void pool_op_free(struct tee_shm_pool_mgr *poolm,
struct tee_shm *shm) struct tee_shm *shm)
{ {
if (shm->flags & TEE_SHM_DMA_BUF) if (!(shm->flags & TEE_SHM_PRIV))
optee_shm_unregister(shm->ctx, shm); optee_shm_unregister(shm->ctx, shm);
free_pages((unsigned long)shm->kaddr, get_order(shm->size)); free_pages((unsigned long)shm->kaddr, get_order(shm->size));
......
...@@ -117,7 +117,7 @@ struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags) ...@@ -117,7 +117,7 @@ struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
if ((flags & ~(TEE_SHM_MAPPED | TEE_SHM_DMA_BUF))) { if ((flags & ~(TEE_SHM_MAPPED | TEE_SHM_DMA_BUF | TEE_SHM_PRIV))) {
dev_err(teedev->dev.parent, "invalid shm flags 0x%x", flags); dev_err(teedev->dev.parent, "invalid shm flags 0x%x", flags);
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
...@@ -193,6 +193,24 @@ struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags) ...@@ -193,6 +193,24 @@ struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags)
} }
EXPORT_SYMBOL_GPL(tee_shm_alloc); EXPORT_SYMBOL_GPL(tee_shm_alloc);
/**
* tee_shm_alloc_kernel_buf() - Allocate shared memory for kernel buffer
* @ctx: Context that allocates the shared memory
* @size: Requested size of shared memory
*
* The returned memory registered in secure world and is suitable to be
* passed as a memory buffer in parameter argument to
* tee_client_invoke_func(). The memory allocated is later freed with a
* call to tee_shm_free().
*
* @returns a pointer to 'struct tee_shm'
*/
struct tee_shm *tee_shm_alloc_kernel_buf(struct tee_context *ctx, size_t size)
{
return tee_shm_alloc(ctx, size, TEE_SHM_MAPPED);
}
EXPORT_SYMBOL_GPL(tee_shm_alloc_kernel_buf);
struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr, struct tee_shm *tee_shm_register(struct tee_context *ctx, unsigned long addr,
size_t length, u32 flags) size_t length, u32 flags)
{ {
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#define TEE_SHM_USER_MAPPED BIT(4) /* Memory mapped in user space */ #define TEE_SHM_USER_MAPPED BIT(4) /* Memory mapped in user space */
#define TEE_SHM_POOL BIT(5) /* Memory allocated from pool */ #define TEE_SHM_POOL BIT(5) /* Memory allocated from pool */
#define TEE_SHM_KERNEL_MAPPED BIT(6) /* Memory mapped in kernel space */ #define TEE_SHM_KERNEL_MAPPED BIT(6) /* Memory mapped in kernel space */
#define TEE_SHM_PRIV BIT(7) /* Memory private to TEE driver */
struct device; struct device;
struct tee_device; struct tee_device;
...@@ -332,6 +333,7 @@ void *tee_get_drvdata(struct tee_device *teedev); ...@@ -332,6 +333,7 @@ void *tee_get_drvdata(struct tee_device *teedev);
* @returns a pointer to 'struct tee_shm' * @returns a pointer to 'struct tee_shm'
*/ */
struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags); struct tee_shm *tee_shm_alloc(struct tee_context *ctx, size_t size, u32 flags);
struct tee_shm *tee_shm_alloc_kernel_buf(struct tee_context *ctx, size_t size);
/** /**
* tee_shm_register() - Register shared memory buffer * tee_shm_register() - Register shared memory buffer
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment