* Re: [PATCH 1/4] clk/soc: mediatek: mt8183: Bind clock driver from platform device
From: Matthias Brugger @ 2020-05-20 10:53 UTC (permalink / raw)
To: Stephen Boyd, Michael Turquette, Rob Herring, matthias.bgg
Cc: Kate Stewart, devicetree, Greg Kroah-Hartman, linux-kernel,
linux-mediatek, linux-arm-kernel, mtk01761, Thomas Gleixner,
linux-clk, Allison Randal
In-Reply-To: <158996969738.215346.5933135216459465754@swboyd.mtv.corp.google.com>
On 20/05/2020 12:14, Stephen Boyd wrote:
> Quoting matthias.bgg@kernel.org (2020-05-18 04:31:53)
>> From: Matthias Brugger <matthias.bgg@gmail.com>
>>
>> The mmsys driver is now the top level entry point for the multimedia
>> system (mmsys), we bind the clock driver by creating a platform device.
>> We also bind the MediaTek DRM driver which is not yet implement and
>> therefor will errror out for now.
>>
>> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
>> ---
>
> Acked-by: Stephen Boyd <sboyd@kernel.org>
>
Now queued for v5.7-next/soc
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH 2/4] clk/soc: mediatek: mt6797: Bind clock driver from platform device
From: Matthias Brugger @ 2020-05-20 10:53 UTC (permalink / raw)
To: Stephen Boyd, Michael Turquette, Rob Herring, matthias.bgg
Cc: Kate Stewart, devicetree, Greg Kroah-Hartman, linux-kernel,
Richard Fontana, linux-mediatek, linux-arm-kernel, mtk01761,
Thomas Gleixner, linux-clk, Allison Randal
In-Reply-To: <158996970679.215346.601357207492478540@swboyd.mtv.corp.google.com>
On 20/05/2020 12:15, Stephen Boyd wrote:
> Quoting matthias.bgg@kernel.org (2020-05-18 04:31:54)
>> From: Matthias Brugger <matthias.bgg@gmail.com>
>>
>> The mmsys driver is now the top level entry point for the multimedia
>> system (mmsys), we bind the clock driver by creating a platform device.
>> We also bind the MediaTek DRM driver which is not yet implement and
>> therefor will errror out for now.
>>
>> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
>> ---
>
> Acked-by: Stephen Boyd <sboyd@kernel.org>
>
Now queued for v5.7-next/soc
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v2 4/4] arm64: dts: mt8173: Fix mmsys node name
From: Matthias Brugger @ 2020-05-20 10:52 UTC (permalink / raw)
To: Enric Balletbo i Serra, mark.rutland, ck.hu, sboyd,
ulrich.hecht+renesas
Cc: Chun-Kuang Hu, drinkcat, devicetree, matthias.bgg, linux-kernel,
Rob Herring, Matthias Brugger, linux-mediatek, hsinyi,
Collabora Kernel ML, linux-clk, linux-arm-kernel
In-Reply-To: <20200401201736.2980433-4-enric.balletbo@collabora.com>
On 01/04/2020 22:17, Enric Balletbo i Serra wrote:
> Node names are supposed to match the class of the device, mmsys is a
> system controller (syscon) not a clock controller, so change the node
> name accordingly.
>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> Reviewed-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
> ---
Now queued for v5.7-next/dts64
Thanks!
>
> Changes in v2: None
>
> arch/arm64/boot/dts/mediatek/mt8173.dtsi | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> index 8b4e806d5119..a55e8c177832 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> +++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> @@ -908,7 +908,7 @@ u2port1: usb-phy@11291000 {
> };
> };
>
> - mmsys: clock-controller@14000000 {
> + mmsys: syscon@14000000 {
> compatible = "mediatek,mt8173-mmsys", "syscon";
> reg = <0 0x14000000 0 0x1000>;
> power-domains = <&scpsys MT8173_POWER_DOMAIN_MM>;
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v2 1/4] soc: mediatek: Enable mmsys driver by default if Mediatek arch is selected
From: Matthias Brugger @ 2020-05-20 10:51 UTC (permalink / raw)
To: Enric Balletbo i Serra, mark.rutland, ck.hu, sboyd,
ulrich.hecht+renesas
Cc: drinkcat, matthias.bgg, linux-kernel, Matthias Brugger,
linux-mediatek, hsinyi, Collabora Kernel ML, linux-clk,
linux-arm-kernel
In-Reply-To: <20200401201736.2980433-1-enric.balletbo@collabora.com>
On 01/04/2020 22:17, Enric Balletbo i Serra wrote:
> The mmsys driver supports only MT8173 device for now, but like other system
> controllers is an important piece for other Mediatek devices. Actually
> it depends on the mt8173 clock specific driver but that dependency is
> not real as it can build without the clock driver. Instead of depends on
> a specific model, make the driver depends on the generic ARCH_MEDIATEK and
> enable by default so other Mediatek devices can start using it without
> flood the Kconfig.
>
> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
> ---
Now queued for v5.7-next/soc
Thanks!
>
> Changes in v2: None
>
> drivers/soc/mediatek/Kconfig | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/soc/mediatek/Kconfig b/drivers/soc/mediatek/Kconfig
> index e84513318725..59a56cd790ec 100644
> --- a/drivers/soc/mediatek/Kconfig
> +++ b/drivers/soc/mediatek/Kconfig
> @@ -46,8 +46,7 @@ config MTK_SCPSYS
>
> config MTK_MMSYS
> bool "MediaTek MMSYS Support"
> - depends on COMMON_CLK_MT8173_MMSYS
> - default COMMON_CLK_MT8173_MMSYS
> + default ARCH_MEDIATEK
> help
> Say yes here to add support for the MediaTek Multimedia
> Subsystem (MMSYS).
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v2 3/4] clk / soc: mediatek: Bind clock and gpu driver for mt2701
From: Matthias Brugger @ 2020-05-20 10:51 UTC (permalink / raw)
To: Stephen Boyd, Enric Balletbo i Serra, ck.hu, mark.rutland,
ulrich.hecht+renesas
Cc: Kate Stewart, Chun-Kuang Hu, drinkcat, Michael Turquette,
matthias.bgg, linux-kernel, Richard Fontana, Matthias Brugger,
linux-mediatek, Allison Randal, hsinyi, Thomas Gleixner,
Collabora Kernel ML, linux-clk, linux-arm-kernel
In-Reply-To: <158996963892.215346.7498020261398211458@swboyd.mtv.corp.google.com>
On 20/05/2020 12:13, Stephen Boyd wrote:
> Quoting Enric Balletbo i Serra (2020-04-01 13:17:35)
>> Now that the mmsys driver is the top-level entry point for the
>> multimedia subsystem, we could bind the clock and the gpu driver on
>> those devices that is expected to work, so the drm driver is
>> intantiated by the mmsys driver and display, hopefully, working again.
>>
>> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
>> Reviewed-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
>> ---
>
> Acked-by: Stephen Boyd <sboyd@kernel.org>
>
Now queued for v5.7-next/soc
Thanks!
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v2 2/4] clk / soc: mediatek: Bind clock and gpu driver for mt2712
From: Matthias Brugger @ 2020-05-20 10:51 UTC (permalink / raw)
To: Stephen Boyd, Enric Balletbo i Serra, ck.hu, mark.rutland,
ulrich.hecht+renesas
Cc: Chun-Kuang Hu, drinkcat, Greg Kroah-Hartman, Michael Turquette,
matthias.bgg, linux-kernel, Richard Fontana, Matthias Brugger,
linux-mediatek, Allison Randal, hsinyi, Thomas Gleixner,
Collabora Kernel ML, linux-clk, linux-arm-kernel
In-Reply-To: <158996963088.215346.15782560941924531394@swboyd.mtv.corp.google.com>
On 20/05/2020 12:13, Stephen Boyd wrote:
> Quoting Enric Balletbo i Serra (2020-04-01 13:17:34)
>> Now that the mmsys driver is the top-level entry point for the
>> multimedia subsystem, we could bind the clock and the gpu driver on
>> those devices that is expected to work, so the drm driver is
>> intantiated by the mmsys driver and display, hopefully, working again on
>> those devices.
>>
>> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
>> Reviewed-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
>> ---
>
> Acked-by: Stephen Boyd <sboyd@kernel.org>
>
Now queued for v5.7-next/soc
Thanks!
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v2 2/2] arm64: vdso: Fix CFI directives in sigreturn trampoline
From: Will Deacon @ 2020-05-20 10:48 UTC (permalink / raw)
To: linux-arm-kernel
Cc: Tamas Zsoldos, Mark Brown, kernel-team, Dave Martin, Daniel Kiss
In-Reply-To: <20200519162821.16857-3-will@kernel.org>
On Tue, May 19, 2020 at 05:28:21PM +0100, Will Deacon wrote:
> Daniel reports that the .cfi_startproc is misplaced for the sigreturn
> trampoline, which causes LLVM's unwinder to misbehave:
>
> | I run into this with LLVM’s unwinder.
> | This combination was always broken.
>
> This prompted Dave to question our use of CFI directives more generally,
> and I ended up going down a rabbit hole trying to figure out how this
> very poorly documented stuff gets used.
>
> Move the CFI directives so that the "mysterious NOP" is included in
> the .cfi_{start,end}proc block and add a bunch of comments so that I
> can save myself another headache in future.
>
> Cc: Tamas Zsoldos <tamas.zsoldos@arm.com>
> Reported-by: Dave Martin <dave.martin@arm.com>
> Reported-by: Daniel Kiss <daniel.kiss@arm.com>
> Signed-off-by: Will Deacon <will@kernel.org>
> ---
> arch/arm64/kernel/vdso/sigreturn.S | 40 ++++++++++++++++++++++++------
> 1 file changed, 33 insertions(+), 7 deletions(-)
>
> diff --git a/arch/arm64/kernel/vdso/sigreturn.S b/arch/arm64/kernel/vdso/sigreturn.S
> index 0c921130002a..cb47dfb3bd5a 100644
> --- a/arch/arm64/kernel/vdso/sigreturn.S
> +++ b/arch/arm64/kernel/vdso/sigreturn.S
> @@ -1,7 +1,11 @@
> /* SPDX-License-Identifier: GPL-2.0-only */
> /*
> * Sigreturn trampoline for returning from a signal when the SA_RESTORER
> - * flag is not set.
> + * flag is not set. It serves primarily as a hall of shame for crappy
> + * unwinders and features an exciting but mysterious NOP instruction.
> + *
> + * It's also fragile as hell, so please think twice before changing anything
> + * in here.
> *
> * Copyright (C) 2012 ARM Limited
> *
> @@ -14,7 +18,34 @@
>
> .text
>
> - nop
> +/* Ensure that the mysterious NOP can be associated with a function. */
> + .cfi_startproc
> +
> +/*
> + * .cfi_signal_frame causes the corresponding Frame Description Entry in the
> + * .eh_frame section to be annotated as a signal frame. This allows DWARF
> + * unwinders (e.g. libstdc++) to implement _Unwind_GetIPInfo(), which permits
> + * unwinding out of the signal trampoline without the need for the mysterious
> + * NOP.
> + */
> + .cfi_signal_frame
> +
> +/*
> + * Tell the unwinder where to locate the frame record linking back to the
> + * interrupted context.
> + */
> + .cfi_def_cfa x29, 0
> + .cfi_offset x29, 0 * 8
> + .cfi_offset x29, 1 * 8
Oops, just spotted this bug: second entry should be x30.
Will
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH 1/3] arm64: vdso: Don't prefix sigreturn trampoline with a BTI C instruction
From: Mark Brown @ 2020-05-20 10:46 UTC (permalink / raw)
To: Dave Martin
Cc: Tamas Zsoldos, kernel-team, Will Deacon, linux-arm-kernel,
Daniel Kiss
In-Reply-To: <20200520094844.GL5031@arm.com>
[-- Attachment #1.1: Type: text/plain, Size: 1258 bytes --]
On Wed, May 20, 2020 at 10:48:45AM +0100, Dave Martin wrote:
> On Tue, May 19, 2020 at 04:42:47PM +0100, Mark Brown wrote:
> > On Tue, May 19, 2020 at 03:55:15PM +0100, Dave Martin wrote:
> > > > > If BTI {nothing} allows this while disallowing all BR/BLR then we could
> > > > > use that (I can't remember what BTI {nothing} is useful for, if anything).
> > > > > Otherwise, it's less clear what we should have here.
> > > > I can't remember anything that distinguishes it from an explicit NOP.
> > > I think it rejects everything other then fallthrough execution
> > > (BTYPE==0, which includes RET). I might have misunderstood something
> > Right, but since BTI only generates an exception when BTYPE != 0 I'm
> > having trouble differentiating this from a NOP in practical terms.
> The idea would be that if an attacker could fudge some function pointer
> to point at __kernel_rt_sigreturn, attempting to do a call via that
> pointer would still trigger a BTI trap.
We'll get a BTI exception no matter what instruction is here so long as
it's not an appropriate BTI landing pad so unless we want to prevent one
being generated there's no need to change the instruction sequence. Or
perhaps I'm not quite getting the scenario you're thinking of?
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v2 1/2] hwrng: iproc-rng200 - Set the quality value
From: Lukasz Stelmach @ 2020-05-20 10:44 UTC (permalink / raw)
To: Stephan Mueller
Cc: Florian Fainelli, Herbert Xu, Scott Branden, Matthias Brugger,
Greg Kroah-Hartman, Matt Mackall, linux-kernel,
Krzysztof Kozlowski, linux-samsung-soc, Bartlomiej Zolnierkiewicz,
Kukjin Kim, Arnd Bergmann, Stefan Wahren, Ray Jui,
bcm-kernel-feedback-list, Markus Elfring, linux-arm-kernel,
linux-crypto
In-Reply-To: <15745285.MnsZKaK4VV@tauon.chronox.de>
[-- Attachment #1.1: Type: text/plain, Size: 3231 bytes --]
It was <2020-05-20 śro 11:18>, when Stephan Mueller wrote:
> Am Mittwoch, 20. Mai 2020, 11:10:32 CEST schrieb Lukasz Stelmach:
>> It was <2020-05-20 śro 08:23>, when Stephan Mueller wrote:
>>> Am Dienstag, 19. Mai 2020, 23:25:51 CEST schrieb Łukasz Stelmach:
>>>> The value was estimaded with ea_iid[1] using on 10485760 bytes read
>>>> from the RNG via /dev/hwrng. The min-entropy value calculated using
>>>> the most common value estimate (NIST SP 800-90P[2], section 6.3.1)
>>>> was 7.964464.
>>>
>>> I am sorry, but I think I did not make myself clear: testing random
>>> numbers post-processing with the statistical tools does NOT give any
>>> idea about the entropy rate. Thus, all that was calculated is the
>>> proper implementation of the post-processing operation and not the
>>> actual noise source.
>>>
>>> What needs to happen is that we need access to raw, unconditioned
>>> data from the noise source that is analyzed with the statistical
>>> methods.
>>
>> I did understand you and I assure you the data I tested were obtained
>> directly from RNGs. As I pointed before[1], that is how /dev/hwrng
>> works[2].
>
> I understand that /dev/hwrng pulls the data straight from the
> hardware. But the data from the hardware usually is not obtained
> straight from the noise source.
>
> Typically you have a noise source (e.g. a ring oscillator) whose data
> is digitized then fed into a compression function like an LFSR or a
> hash. Then a cryptographic operation like a CBC-MAC, hash or even a
> DRBG is applied to that data when the caller wants to have random
> numbers.
I do understand your point (but not entirely, see below). [opinion]
However, I am really not sure that this is a "typical" setting for a HW
RNG, at least not among RNGs supported by Linux. Otherwise there would
be no hw_random framework and no rngd(8) which are suppsed to
post-process imperfectly random data from HW. [/opinion]
> In order to estimate entropy, we need the raw unconditioned data from
> the, say, ring oscillator and not from the (cryptographic) output
> operation.
Can you tell, why it matters in this case? If I understand correctly,
the quality field describes not the randomness created by the noise
generator but the one delivered by the driver to other software
components.
> That said, the illustrated example is typical for hardware RNGs. Yet
> it is never guaranteed to work that way. Thus, if you can point to
> architecture documentation of your specific hardware RNGs showing that
> the data read from the hardware is pure unconditioned noise data, then
> I have no objections to the patch.
I can tell for sure that this is the case for exynos-trng[1]. There is a
post-processor which I have forgotten about since writing the driver,
because from the very beginning I didn't intend to use it. I knew there
is the software framework for post-processing and simply didn't bother.
With regards to iproc-rng200 I cannot be sure.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/char/hw_random/exynos-trng.c?h=v5.6#n100
Kind regards,
--
Łukasz Stelmach
Samsung R&D Institute Poland
Samsung Electronics
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v5 09/19] mtd: spi-nor: sfdp: parse xSPI Profile 1.0 table
From: Pratyush Yadav @ 2020-05-20 10:37 UTC (permalink / raw)
To: masonccyang
Cc: Alexandre Belloni, Vignesh Raghavendra, Tudor Ambarus, juliensu,
Richard Weinberger, Mark Brown, Sekhar Nori, linux-kernel,
linux-spi, Ludovic Desroches, Boris Brezillon, linux-mediatek,
Miquel Raynal, Matthias Brugger, linux-mtd, linux-arm-kernel
In-Reply-To: <OF98344913.4BF4C313-ON4825856E.0032A810-4825856E.00352141@mxic.com.tw>
On 20/05/20 05:40PM, masonccyang@mxic.com.tw wrote:
>
> Hi Pratyush,
>
> > > > +/**
> > > > + * spi_nor_parse_profile1() - parse the xSPI Profile 1.0 table
> > > > + * @nor: pointer to a 'struct spi_nor'
> > > > + * @param_header: pointer to the 'struct sfdp_parameter_header'
> > > describing
> > > > + * the 4-Byte Address Instruction Table length and version.
> > > > + * @params: pointer to the 'struct spi_nor_flash_parameter' to
> be.
> > > > + *
> > > > + * Return: 0 on success, -errno otherwise.
> > > > + */
> > > > +static int spi_nor_parse_profile1(struct spi_nor *nor,
> > > > + const struct sfdp_parameter_header *profile1_header,
> > > > + struct spi_nor_flash_parameter *params)
> > > > +{
> > > > + u32 *table, opcode, addr;
> > > > + size_t len;
> > > > + int ret, i;
> > > > +
> > > > + len = profile1_header->length * sizeof(*table);
> > > > + table = kmalloc(len, GFP_KERNEL);
> > > > + if (!table)
> > > > + return -ENOMEM;
> > > > +
> > > > + addr = SFDP_PARAM_HEADER_PTP(profile1_header);
> > > > + ret = spi_nor_read_sfdp(nor, addr, len, table);
> > > > + if (ret)
> > > > + goto out;
> > > > +
> > > > + /* Fix endianness of the table DWORDs. */
> > > > + for (i = 0; i < profile1_header->length; i++)
> > > > + table[i] = le32_to_cpu(table[i]);
> > > > +
> > > > + /* Get 8D-8D-8D fast read opcode and dummy cycles. */
> > > > + opcode = FIELD_GET(PROFILE1_DWORD1_RD_FAST_CMD, table[0]);
> > > > +
> > > > + /*
> > > > + * Update the fast read settings. We set the default dummy
> cycles to
> > > 20
> > > > + * here. Flashes can change this value if they need to when
> enabling
> > > > + * octal mode.
> > > > + */
> > > > + spi_nor_set_read_settings(¶ms->reads[SNOR_CMD_READ_8_8_8_DTR],
> > > > + 0, 20, opcode,
> > > > + SNOR_PROTO_8_8_8_DTR);
> > > > +
> > >
> > >
> > > I thought we have a agreement that only do parse here, no other read
> > > parameters setting.
> >
> > Yes, and I considered it. But it didn't make much sense to me to
> > introduce an extra member in struct spi_nor just to make this call in
> > some other function later.
> >
> > Why exactly do you think doing this here is bad? The way I see it, we
> > avoid carrying around an extra member in spi_nor and this also allows
> > flashes to change the read settings easily in a post-sfdp hook. The
> > 4bait parsing function does something similar.
>
> I think it's not a question for good or bad.
>
> 4bait parsing function parse the 4-Byte Address Instruction Table
> and set up read/pp parameters there for sure.
>
> Here we give the function name spi_nor_parse_profile1() but also
But the function that parses 4bait table is also called
spi_nor_parse_4bait().
> do others setting that has nothing to do with it,
Why has setting read opcode and dummy cycles got nothing to do with it?
The purpose of the Profile 1.0 table is to tell us the Read Fast command
and dummy cycles, among other things. I think it _does_ have something
to do with it.
Just like the 4bait table tells us the 4-byte opcodes and we set them up
in our data structures, the profile 1.0 table tells us the 8D read
opcode and dummy cycles, and we set them up in our data structures.
> it seems not good for SW module design.
> oh, it's my humble opinion.
>
> >
> > What are the benefits of doing it otherwise?
>
> For other Octal Flash like mx25*
I mean from a design perspective. How does it make the code better, or
the job of people who need to read/change it easier?
> >
> > Note that I did remove HWCAPS selection from here, which did seem like a
>
> > sane idea.
> >
> > > Driver should get dummy cycles used for various frequencies
> > > from 4th and 5th DWORD of xSPI table.[1]
> > >
> > > [1]
> > >
> https://patchwork.ozlabs.org/project/linux-mtd/patch/1587451187-6889-3-git-
>
> > send-email-masonccyang@mxic.com.tw/
> > >
> > >
> > > In addition, 20 dummy cycles is for 200MHz but not for 100MHz, 133MHz
> and
> > > 166MHz
> > > in case of read performance concern.
> > >
> > > Given a correct dummy cycles for a specific device. [2]
> > >
> > > [2]
> > >
> https://patchwork.ozlabs.org/project/linux-mtd/patch/1587451187-6889-5-git-
>
> > send-email-masonccyang@mxic.com.tw/
> >
> > The problem is that we don't know what speed the controller is driving
> > the flash at, and whether it is using Data Strobe. BFPT tells us the
> > maximum speed of the flash based on if Data Strobe is being used. The
> > controller can also drive it slower than the maximum. And it can drive
> > it with or without DS.
>
> This is for flash, not every Octal flash could work in 200MHz,
> The Max operation speeds for other Octal Flash is 100, 133 , or 166MHz.
>
> If a specific Octal Flash could work in 166MHz(Max), and driver setup the
> correct 16 dummy cycles for it rather than 20 dummy cycles.
> it's for performance concern.
Agreed. Like I mentioned in the next paragraph, will fix.
> >
> > So, we have to be conservative and just use the dummy cycles for the
> > maximum speed so we can at least make sure the flash works, albeit at
> > slightly less efficiency. I hard-coded it to 20 but I suppose we can
> > find it out from the Profile 1.0 table and use that (though we'd have to
>
> > round it to an even value to avoid tripping up controllers). Will fix in
>
> > next version (or, Tudor if you're fine with fixup! patches, I can send
> > that too because I suspect it will be a small change).
> >
--
Regards,
Pratyush Yadav
Texas Instruments India
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v2 2/2] arm64: vdso: Fix CFI directives in sigreturn trampoline
From: Will Deacon @ 2020-05-20 10:36 UTC (permalink / raw)
To: Dave Martin
Cc: Tamas Zsoldos, Mark Brown, kernel-team, linux-arm-kernel,
Daniel Kiss
In-Reply-To: <20200520102747.GM5031@arm.com>
On Wed, May 20, 2020 at 11:27:47AM +0100, Dave Martin wrote:
> On Wed, May 20, 2020 at 10:50:28AM +0100, Will Deacon wrote:
> > On Wed, May 20, 2020 at 10:42:13AM +0100, Dave Martin wrote:
> > > On Tue, May 19, 2020 at 05:28:21PM +0100, Will Deacon wrote:
> > > > @@ -14,7 +18,34 @@
> > > >
> > > > .text
> > > >
> > > > - nop
> > > > +/* Ensure that the mysterious NOP can be associated with a function. */
> > > > + .cfi_startproc
> > > > +
> > > > +/*
> > > > + * .cfi_signal_frame causes the corresponding Frame Description Entry in the
> > > > + * .eh_frame section to be annotated as a signal frame. This allows DWARF
> > > > + * unwinders (e.g. libstdc++) to implement _Unwind_GetIPInfo(), which permits
> > > > + * unwinding out of the signal trampoline without the need for the mysterious
> > > > + * NOP.
> > > > + */
> > > > + .cfi_signal_frame
> > > > +
> > > > +/*
> > > > + * Tell the unwinder where to locate the frame record linking back to the
> > > > + * interrupted context.
> > > > + */
> > > > + .cfi_def_cfa x29, 0
> > > > + .cfi_offset x29, 0 * 8
> > > > + .cfi_offset x29, 1 * 8
> > >
> > > We should also give rationale for why we don't describe how to recover
> > > other regs here. At a signal, every reg is potentially live with data
> > > essential to the backtrace, so custom unwind entries further up the
> > > stack may unwind badly after trying to unwind out of the signal handler.
> >
> > Hmm, I'm not sure I get what you're asking for. We can't recover the other
> > registers even if we tried, can we? I think the only way to get a reliable
> > backtrace here is not to clobber the framepointer.
>
> A caller somewhere up the stack could have stashed stuff in nonstandard
> places, with a custom unwind entry that doesn't use x29 in the usual way.
>
> If x29 and x30 were stashed in x8 and x9, say, then the unwinder needs
> to restore x8 and x9 correctly before that frame is reached. Dwarf
> unwind tables are expressive enough to describe how to unwind such a
> frames: the directives work on all the registers, not just x29, lr.
Understood, I just can't figure out how we could support that even if we
wanted to. The only evidence we have of those registers is in the
sigcontext, but that may have been modified by the time we end up in the
return trampoline. Would we need to push the registers twice (i.e. expand
the frame record to include the GPRs)? Not saying we should do this, just
wondering what it would take.
> For this kind of unwinding scenario to wokr, the userspace environment
> would need to provide correct unwind info for _everything_ rather than
> relying on the frame chain on the stack alone, so this scenario isn't
> applicable to C.
>
> I'm not saying we should try to support this, but a comment to indicate
> what we are and are not trying to do might be a good idea.
>
> How about something along these lines:
>
> /*
> * Don't try to provide unwind into for the other regs of the
> * interrupted context here. C/C++ based runtimes don't rely on
> * this for unwinding in practice. Debuggers need more, but they
> * already have baked-in knowledge about how to unwind out of
> * signals.
> */
I'll fold that in, thanks.
Will
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH] arm64: Fix PTRACE_SYSEMU semantics
From: Bin Lu @ 2020-05-20 10:34 UTC (permalink / raw)
To: catalin.marinas
Cc: linux-kernel, oleg, keno, sudeep.holla, Bin Lu, will,
linux-arm-kernel
In-Reply-To: <20200519120725.GA20313@gaia>
From: Bin Lu <Bin.Lu@arm.com>
On Tue, May 19, 2020 at 01:07:27PM +0100, Catalin Marinas wrote:
> On Mon, May 18, 2020 at 12:41:20PM +0100, Will Deacon wrote:
> > On Fri, May 15, 2020 at 06:22:53PM -0400, Keno Fischer wrote:
> > > Quoth the man page:
> > > ```
> > > If the tracee was restarted by PTRACE_SYSCALL or PTRACE_SYSEMU, the
> > > tracee enters syscall-enter-stop just prior to entering any system
> > > call (which will not be executed if the restart was using
> > > PTRACE_SYSEMU, regardless of any change made to registers at this
> > > point or how the tracee is restarted after this stop).
> > > ```
> > >
> > > The parenthetical comment is currently true on x86 and powerpc,
> > > but not currently true on arm64. arm64 re-checks the _TIF_SYSCALL_EMU
> > > flag after the syscall entry ptrace stop. However, at this point,
> > > it reflects which method was used to re-start the syscall
> > > at the entry stop, rather than the method that was used to reach it.
> > > Fix that by recording the original flag before performing the ptrace
> > > stop, bringing the behavior in line with documentation and x86/powerpc.
> > >
> > > Signed-off-by: Keno Fischer <keno@juliacomputing.com>
> > > ---
> > > arch/arm64/kernel/ptrace.c | 8 +++++---
> > > 1 file changed, 5 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
> > > index b3d3005d9515..b67b4d14aa17 100644
> > > --- a/arch/arm64/kernel/ptrace.c
> > > +++ b/arch/arm64/kernel/ptrace.c
> > > @@ -1829,10 +1829,12 @@ static void tracehook_report_syscall(struct pt_regs *regs,
> > >
> > > int syscall_trace_enter(struct pt_regs *regs)
> > > {
> > > - if (test_thread_flag(TIF_SYSCALL_TRACE) ||
> > > - test_thread_flag(TIF_SYSCALL_EMU)) {
> > > + u32 flags = READ_ONCE(current_thread_info()->flags) &
> > > + (_TIF_SYSCALL_EMU | _TIF_SYSCALL_TRACE);
> > > +
> > > + if (flags) {
> >
> > nit: but I'd rather the '&' operation was in the conditional so that the
> > 'flags' variable holds all of the flags.
> >
> > With that:
> >
> > Acked-by: Will Deacon <will@kernel.org>
> >
> > Also needs:
> >
> > Cc: <stable@vger.kernel.org>
> > Fixes: f086f67485c5 ("arm64: ptrace: add support for syscall emulation")
> >
> > Catalin -- can you pick this up for 5.7 please, with my 'nit' addressed?
>
> I'll queue it with the above addressed. I think flags also needs to be
> unsigned long rather than u32.
>
> However, before sending the pull request, I'd like Sudeep to confirm
> that it doesn't break his original use-case for this feature.
>
Tested-by: Bin Lu <Bin.Lu@arm.com> (for gVisor)
I have just tested all gVisor syscall test cases with ptrace(Regs, FPRegs, TLS)
on Arm64 platform.
The test results are the same as before there was no patch.
My idea is that this kernel patch has no bad effects on gVisor.
Linux Kernel version: 5.7.0-rc6+
gVisor version: release-20200511.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* [next] i2c: mediatek: Use div_u64 for 64-bit division to fix 32-bit kernels
From: qii.wang @ 2020-05-20 10:31 UTC (permalink / raw)
To: wsa
Cc: devicetree, qii.wang, srv_heupstream, leilk.liu, linux-kernel,
linux-mediatek, linux-i2c, linux-arm-kernel
From: Qii Wang <qii.wang@mediatek.com>
Use div_u64 for 64-bit division, and change sample_ns type to
unsigned int. Otherwise, the module will reference __udivdi3
under 32-bit kernels, which is not allowed in kernel space.
Signed-off-by: Qii Wang <qii.wang@mediatek.com>
---
drivers/i2c/busses/i2c-mt65xx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c
index 7020618..deef69e 100644
--- a/drivers/i2c/busses/i2c-mt65xx.c
+++ b/drivers/i2c/busses/i2c-mt65xx.c
@@ -551,7 +551,8 @@ static int mtk_i2c_check_ac_timing(struct mtk_i2c *i2c,
const struct i2c_spec_values *spec;
unsigned int su_sta_cnt, low_cnt, high_cnt, max_step_cnt;
unsigned int sda_max, sda_min, clk_ns, max_sta_cnt = 0x3f;
- long long sample_ns = (1000000000 * (sample_cnt + 1)) / clk_src;
+ unsigned int sample_ns = div_u64(1000000000ULL * (sample_cnt + 1),
+ clk_src);
if (!i2c->dev_comp->timing_adjust)
return 0;
--
1.9.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* Re: [PATCH 0/3] arm64: perf: Add support for Perf NMI interrupts
From: Alexandru Elisei @ 2020-05-20 10:30 UTC (permalink / raw)
To: Mark Rutland, Lecopzer Chen
Cc: Sumit Garg, jolsa, Jian-Lin Chen, alexander.shishkin,
Catalin Marinas, yj.chiang, Linux Kernel Mailing List, acme,
Peter Zijlstra, mingo, linux-mediatek, julien.thierry.kdev,
matthias.bgg, namhyung, Will Deacon, linux-arm-kernel
In-Reply-To: <a9002b5e-aec5-b6e0-7174-87b93351d60c@arm.com>
Hi,
On 5/18/20 12:17 PM, Alexandru Elisei wrote:
> Hi,
>
> On 5/18/20 11:45 AM, Mark Rutland wrote:
>> Hi all,
>>
>> On Mon, May 18, 2020 at 02:26:00PM +0800, Lecopzer Chen wrote:
>>> HI Sumit,
>>>
>>> Thanks for your information.
>>>
>>> I've already implemented IPI (same as you did [1], little difference
>>> in detail), hardlockup detector and perf in last year(2019) for
>>> debuggability.
>>> And now we tend to upstream to reduce kernel maintaining effort.
>>> I'm glad if someone in ARM can do this work :)
>>>
>>> Hi Julien,
>>>
>>> Does any Arm maintainers can proceed this action?
>> Alexandru (Cc'd) has been rebasing and reworking Julien's patches, which
>> is my preferred approach.
>>
>> I understand that's not quite ready for posting since he's investigating
>> some of the nastier subtleties (e.g. mutual exclusion with the NMI), but
>> maybe we can put the work-in-progress patches somewhere in the mean
>> time.
>>
>> Alexandru, do you have an idea of what needs to be done, and/or when you
>> expect you could post that?
> I'm currently working on rebasing the patches on top of 5.7-rc5, when I have
> something usable I'll post a link (should be a couple of days). After that I will
> address the review comments, and I plan to do a thorough testing because I'm not
> 100% confident that some of the assumptions around the locks that were removed are
> correct. My guess is this will take a few weeks.
Pushed a WIP branch on linux-arm.org [1]:
git clone -b WIP-pmu-nmi git://linux-arm.org/linux-ae
Practically untested, I only did perf record on a defconfig kernel running on the
model.
[1] http://www.linux-arm.org/git?p=linux-ae.git;a=shortlog;h=refs/heads/WIP-pmu-nmi
Thanks,
Alex
>
> Thanks,
> Alex
>> Thanks,
>> Mark.
>>
>>> This is really useful in debugging.
>>> Thank you!!
>>>
>>>
>>>
>>> [1] https://lkml.org/lkml/2020/4/24/328
>>>
>>>
>>> Lecopzer
>>>
>>> Sumit Garg <sumit.garg@linaro.org> 於 2020年5月18日 週一 下午1:46寫道:
>>>> + Julien
>>>>
>>>> Hi Lecopzer,
>>>>
>>>> On Sat, 16 May 2020 at 18:20, Lecopzer Chen <lecopzer@gmail.com> wrote:
>>>>> These series implement Perf NMI funxtionality and depends on
>>>>> Pseudo NMI [1] which has been upstreamed.
>>>>>
>>>>> In arm64 with GICv3, Pseudo NMI was implemented for NMI-like interruts.
>>>>> That can be extended to Perf NMI which is the prerequisite for hard-lockup
>>>>> detector which had already a standard interface inside Linux.
>>>>>
>>>>> Thus the first step we need to implement perf NMI interface and make sure
>>>>> it works fine.
>>>>>
>>>> This is something that is already implemented via Julien's patch-set
>>>> [1]. Its v4 has been floating since July, 2019 and I couldn't find any
>>>> major blocking comments but not sure why things haven't progressed
>>>> further.
>>>>
>>>> Maybe Julien or Arm maintainers can provide updates on existing
>>>> patch-set [1] and how we should proceed further with this interesting
>>>> feature.
>>>>
>>>> And regarding hard-lockup detection, I have been able to enable it
>>>> based on perf NMI events using Julien's perf patch-set [1]. Have a
>>>> look at the patch here [2].
>>>>
>>>> [1] https://patchwork.kernel.org/cover/11047407/
>>>> [2] http://lists.infradead.org/pipermail/linux-arm-kernel/2020-May/732227.html
>>>>
>>>> -Sumit
>>>>
>>>>> Perf NMI has been test by dd if=/dev/urandom of=/dev/null like the link [2]
>>>>> did.
>>>>>
>>>>> [1] https://lkml.org/lkml/2019/1/31/535
>>>>> [2] https://www.linaro.org/blog/debugging-arm-kernels-using-nmifiq
>>>>>
>>>>>
>>>>> Lecopzer Chen (3):
>>>>> arm_pmu: Add support for perf NMI interrupts registration
>>>>> arm64: perf: Support NMI context for perf event ISR
>>>>> arm64: Kconfig: Add support for the Perf NMI
>>>>>
>>>>> arch/arm64/Kconfig | 10 +++++++
>>>>> arch/arm64/kernel/perf_event.c | 36 ++++++++++++++++++------
>>>>> drivers/perf/arm_pmu.c | 51 ++++++++++++++++++++++++++++++----
>>>>> include/linux/perf/arm_pmu.h | 6 ++++
>>>>> 4 files changed, 88 insertions(+), 15 deletions(-)
>>>>>
>>>>> --
>>>>> 2.25.1
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> linux-arm-kernel mailing list
>>>>> linux-arm-kernel@lists.infradead.org
>>>>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v2 2/2] arm64: vdso: Fix CFI directives in sigreturn trampoline
From: Dave Martin @ 2020-05-20 10:27 UTC (permalink / raw)
To: Will Deacon
Cc: Tamas Zsoldos, Mark Brown, kernel-team, linux-arm-kernel,
Daniel Kiss
In-Reply-To: <20200520095027.GE24293@willie-the-truck>
On Wed, May 20, 2020 at 10:50:28AM +0100, Will Deacon wrote:
> On Wed, May 20, 2020 at 10:42:13AM +0100, Dave Martin wrote:
> > On Tue, May 19, 2020 at 05:28:21PM +0100, Will Deacon wrote:
> > > @@ -14,7 +18,34 @@
> > >
> > > .text
> > >
> > > - nop
> > > +/* Ensure that the mysterious NOP can be associated with a function. */
> > > + .cfi_startproc
> > > +
> > > +/*
> > > + * .cfi_signal_frame causes the corresponding Frame Description Entry in the
> > > + * .eh_frame section to be annotated as a signal frame. This allows DWARF
> > > + * unwinders (e.g. libstdc++) to implement _Unwind_GetIPInfo(), which permits
> > > + * unwinding out of the signal trampoline without the need for the mysterious
> > > + * NOP.
> > > + */
> > > + .cfi_signal_frame
> > > +
> > > +/*
> > > + * Tell the unwinder where to locate the frame record linking back to the
> > > + * interrupted context.
> > > + */
> > > + .cfi_def_cfa x29, 0
> > > + .cfi_offset x29, 0 * 8
> > > + .cfi_offset x29, 1 * 8
> >
> > We should also give rationale for why we don't describe how to recover
> > other regs here. At a signal, every reg is potentially live with data
> > essential to the backtrace, so custom unwind entries further up the
> > stack may unwind badly after trying to unwind out of the signal handler.
>
> Hmm, I'm not sure I get what you're asking for. We can't recover the other
> registers even if we tried, can we? I think the only way to get a reliable
> backtrace here is not to clobber the framepointer.
A caller somewhere up the stack could have stashed stuff in nonstandard
places, with a custom unwind entry that doesn't use x29 in the usual way.
If x29 and x30 were stashed in x8 and x9, say, then the unwinder needs
to restore x8 and x9 correctly before that frame is reached. Dwarf
unwind tables are expressive enough to describe how to unwind such a
frames: the directives work on all the registers, not just x29, lr.
For this kind of unwinding scenario to wokr, the userspace environment
would need to provide correct unwind info for _everything_ rather than
relying on the frame chain on the stack alone, so this scenario isn't
applicable to C.
I'm not saying we should try to support this, but a comment to indicate
what we are and are not trying to do might be a good idea.
How about something along these lines:
/*
* Don't try to provide unwind into for the other regs of the
* interrupted context here. C/C++ based runtimes don't rely on
* this for unwinding in practice. Debuggers need more, but they
* already have baked-in knowledge about how to unwind out of
* signals.
*/
Cheers
---Dave
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v11 2/3] i2c: npcm7xx: Add Nuvoton NPCM I2C controller driver
From: Andy Shevchenko @ 2020-05-20 10:24 UTC (permalink / raw)
To: Tali Perry
Cc: devicetree, tmaimon77, yuenn, avifishman70, venture, openbmc, wsa,
brendanhiggins, ofery, linux-kernel, kfting, robh+dt, linux-i2c,
linux-arm-kernel, benjaminfair
In-Reply-To: <20200520095113.185414-3-tali.perry1@gmail.com>
On Wed, May 20, 2020 at 12:51:12PM +0300, Tali Perry wrote:
> Add Nuvoton NPCM BMC I2C controller driver.
...
> +#ifdef CONFIG_DEBUG_FS
Why?!
> +#include <linux/debugfs.h>
> +#endif
...
> +/* Status of one I2C module */
> +struct npcm_i2c {
> + struct i2c_adapter adap;
> + struct device *dev;
Isn't it adap.dev->parent?
> +};
...
> +static void npcm_i2c_master_abort(struct npcm_i2c *bus)
> +{
> + /* Only current master is allowed to issue a stop condition */
> + if (npcm_i2c_is_master(bus)) {
if (!npcm_i2c_is_master(bus))
return;
?
> + npcm_i2c_eob_int(bus, true);
> + npcm_i2c_master_stop(bus);
> + npcm_i2c_clear_master_status(bus);
> + }
> +}
...
> +/* SDA status is set - TX or RX, master */
> +static void npcm_i2c_irq_handle_sda(struct npcm_i2c *bus, u8 i2cst)
> +{
> + u8 fif_cts;
> + if (bus->state == I2C_IDLE) {
> + if (npcm_i2c_is_master(bus)) {
if (a) {
if (b) {
...
}
}
==
if (a && b) {
...
}
Check whole code for such pattern.
> + }
> +
> + /* SDA interrupt, after start\restart */
> + } else {
> + if (NPCM_I2CST_XMIT & i2cst) {
> + bus->operation = I2C_WRITE_OPER;
> + npcm_i2c_irq_master_handler_write(bus);
> + } else {
> + bus->operation = I2C_READ_OPER;
> + npcm_i2c_irq_master_handler_read(bus);
> + }
> + }
> +}
...
> + }
> +
+ /* 1MHz */ ?
> + else if (bus_freq_hz <= I2C_MAX_FAST_MODE_PLUS_FREQ) {
> + }
> +
> + /* Frequency larger than 1 MHZ is not supported */
> + else
> + return -EINVAL;
...
> + // master and slave modes share a single irq.
It's again being inconsistent with comment style. Choose one and fix all
comments accordingly (SPDX is another story, though)
...
> +static int i2c_debugfs_get(void *data, u64 *val)
> +{
> + *val = *(u64 *)(data);
> + return 0;
> +}
> +DEFINE_DEBUGFS_ATTRIBUTE(i2c_debugfs_ops, i2c_debugfs_get, NULL, "0x%02llx\n");
Why not to use debugfs_create_u64(), or how is it called?
> +static void i2c_init_debugfs(struct platform_device *pdev, struct npcm_i2c *bus)
> +{
> + if (!npcm_i2c_debugfs_dir)
> + return;
> +
> + if (!pdev || !bus)
> + return;
How is it possible?
> + bus->debugfs = debugfs_create_dir(dev_name(&pdev->dev),
> + npcm_i2c_debugfs_dir);
> + if (IS_ERR_OR_NULL(bus->debugfs)) {
> + bus->debugfs = NULL;
> + return;
> + }
struct dentry *d;
d = create(...);
if (IS_ERR_OR_NULL(d))
return;
bus->... = d;
> +
> + debugfs_create_file("ber_count", 0444, bus->debugfs,
> + &bus->ber_count,
> + &i2c_debugfs_ops);
> +
> + debugfs_create_file("rec_succ_count", 0444, bus->debugfs,
> + &bus->rec_succ_count,
> + &i2c_debugfs_ops);
> +
> + debugfs_create_file("rec_fail_count", 0444, bus->debugfs,
> + &bus->rec_fail_count,
> + &i2c_debugfs_ops);
> +
> + debugfs_create_file("nack_count", 0444, bus->debugfs,
> + &bus->nack_count,
> + &i2c_debugfs_ops);
> +
> + debugfs_create_file("timeout_count", 0444, bus->debugfs,
> + &bus->timeout_count,
> + &i2c_debugfs_ops);
> +}
...
> +#ifdef CONFIG_DEBUG_FS
Why?!
> + i2c_init_debugfs(pdev, bus);
> +#endif
...
> +#ifdef CONFIG_DEBUG_FS
Ditto.
> + debugfs_remove_recursive(bus->debugfs);
> +#endif
> +static int __init npcm_i2c_init(void)
> +{
> + npcm_i2c_debugfs_dir = debugfs_create_dir("i2c", NULL);
You didn't compile this with !CONFIG_DEBUG_FS?
> + if (IS_ERR_OR_NULL(npcm_i2c_debugfs_dir)) {
> + pr_warn("i2c init of debugfs failed\n");
> + npcm_i2c_debugfs_dir = NULL;
> + }
See above for the better pattern. Why do you need noisy warning? What does it
say to user? Can they use device or not?
> + return 0;
> +}
--
With Best Regards,
Andy Shevchenko
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH 06/11] irqchip/gic-v3: Configure SGIs as standard interrupts
From: Marc Zyngier @ 2020-05-20 10:24 UTC (permalink / raw)
To: Sumit Garg
Cc: kernel-team, Russell King, Jason Cooper, Catalin Marinas,
Linux Kernel Mailing List, Thomas Gleixner, Will Deacon,
linux-arm-kernel
In-Reply-To: <CAFA6WYNfZKpQMTX8qP0eFHwyzJK4HK8z59G3OVLN8h0Uuc7P7w@mail.gmail.com>
Hi Sumit,
On 2020-05-20 10:52, Sumit Garg wrote:
> Hi Marc,
>
> On Tue, 19 May 2020 at 21:48, Marc Zyngier <maz@kernel.org> wrote:
>>
>> Change the way we deal with GICv3 SGIs by turning them into proper
>> IRQs, and calling into the arch code to register the interrupt range
>> instead of a callback.
>>
>> Signed-off-by: Marc Zyngier <maz@kernel.org>
>> ---
>> drivers/irqchip/irq-gic-v3.c | 91
>> +++++++++++++++++++++---------------
>> 1 file changed, 53 insertions(+), 38 deletions(-)
>>
>> diff --git a/drivers/irqchip/irq-gic-v3.c
>> b/drivers/irqchip/irq-gic-v3.c
>> index 23d7c87da407..d57289057b75 100644
>> --- a/drivers/irqchip/irq-gic-v3.c
>> +++ b/drivers/irqchip/irq-gic-v3.c
>> @@ -36,6 +36,9 @@
>> #define FLAGS_WORKAROUND_GICR_WAKER_MSM8996 (1ULL << 0)
>> #define FLAGS_WORKAROUND_CAVIUM_ERRATUM_38539 (1ULL << 1)
>>
>> +#define GIC_IRQ_TYPE_PARTITION (GIC_IRQ_TYPE_LPI + 1)
>> +#define GIC_IRQ_TYPE_SGI (GIC_IRQ_TYPE_LPI + 2)
>> +
>> struct redist_region {
>> void __iomem *redist_base;
>> phys_addr_t phys_base;
>> @@ -657,38 +660,14 @@ static asmlinkage void __exception_irq_entry
>> gic_handle_irq(struct pt_regs *regs
>> if ((irqnr >= 1020 && irqnr <= 1023))
>> return;
>>
>> - /* Treat anything but SGIs in a uniform way */
>> - if (likely(irqnr > 15)) {
>> - int err;
>> -
>> - if (static_branch_likely(&supports_deactivate_key))
>> - gic_write_eoir(irqnr);
>> - else
>> - isb();
>> -
>> - err = handle_domain_irq(gic_data.domain, irqnr, regs);
>> - if (err) {
>> - WARN_ONCE(true, "Unexpected interrupt
>> received!\n");
>> - gic_deactivate_unhandled(irqnr);
>> - }
>> - return;
>> - }
>> - if (irqnr < 16) {
>> + if (static_branch_likely(&supports_deactivate_key))
>> gic_write_eoir(irqnr);
>> - if (static_branch_likely(&supports_deactivate_key))
>> - gic_write_dir(irqnr);
>> -#ifdef CONFIG_SMP
>> - /*
>> - * Unlike GICv2, we don't need an smp_rmb() here.
>> - * The control dependency from gic_read_iar to
>> - * the ISB in gic_write_eoir is enough to ensure
>> - * that any shared data read by handle_IPI will
>> - * be read after the ACK.
>> - */
>> - handle_IPI(irqnr, regs);
>> -#else
>> - WARN_ONCE(true, "Unexpected SGI received!\n");
>> -#endif
>> + else
>> + isb();
>> +
>> + if (handle_domain_irq(gic_data.domain, irqnr, regs)) {
>> + WARN_ONCE(true, "Unexpected interrupt received!\n");
>> + gic_deactivate_unhandled(irqnr);
>> }
>> }
>>
>> @@ -1136,11 +1115,11 @@ static void gic_send_sgi(u64 cluster_id, u16
>> tlist, unsigned int irq)
>> gic_write_sgi1r(val);
>> }
>>
>> -static void gic_raise_softirq(const struct cpumask *mask, unsigned
>> int irq)
>> +static void gic_ipi_send_mask(struct irq_data *d, const struct
>> cpumask *mask)
>> {
>> int cpu;
>>
>> - if (WARN_ON(irq >= 16))
>> + if (WARN_ON(d->hwirq >= 16))
>> return;
>>
>> /*
>> @@ -1154,7 +1133,7 @@ static void gic_raise_softirq(const struct
>> cpumask *mask, unsigned int irq)
>> u16 tlist;
>>
>> tlist = gic_compute_target_list(&cpu, mask,
>> cluster_id);
>> - gic_send_sgi(cluster_id, tlist, irq);
>> + gic_send_sgi(cluster_id, tlist, d->hwirq);
>> }
>>
>> /* Force the above writes to ICC_SGI1R_EL1 to be executed */
>> @@ -1163,10 +1142,36 @@ static void gic_raise_softirq(const struct
>> cpumask *mask, unsigned int irq)
>>
>> static void gic_smp_init(void)
>> {
>> - set_smp_cross_call(gic_raise_softirq);
>> + struct irq_fwspec sgi_fwspec = {
>> + .fwnode = gic_data.fwnode,
>> + };
>> + int base_sgi;
>> +
>> cpuhp_setup_state_nocalls(CPUHP_AP_IRQ_GIC_STARTING,
>> "irqchip/arm/gicv3:starting",
>> gic_starting_cpu, NULL);
>> +
>> + if (is_of_node(gic_data.fwnode)) {
>> + /* DT */
>> + sgi_fwspec.param_count = 3;
>> + sgi_fwspec.param[0] = GIC_IRQ_TYPE_SGI;
>> + sgi_fwspec.param[1] = 0;
>> + sgi_fwspec.param[2] = IRQ_TYPE_EDGE_RISING;
>> + } else {
>> + /* ACPI */
>> + sgi_fwspec.param_count = 2;
>> + sgi_fwspec.param[0] = 0;
>> + sgi_fwspec.param[1] = IRQ_TYPE_EDGE_RISING;
>> + }
>> +
>> + /* Register all 8 non-secure SGIs */
>> + base_sgi = __irq_domain_alloc_irqs(gic_data.domain, -1, 8,
>> + NUMA_NO_NODE, &sgi_fwspec,
>> + false, NULL);
>> + if (WARN_ON(base_sgi <= 0))
>> + return;
>> +
>> + set_smp_ipi_range(base_sgi, 8);
>> }
>>
>> static int gic_set_affinity(struct irq_data *d, const struct cpumask
>> *mask_val,
>> @@ -1215,6 +1220,7 @@ static int gic_set_affinity(struct irq_data *d,
>> const struct cpumask *mask_val,
>> }
>> #else
>> #define gic_set_affinity NULL
>> +#define gic_ipi_send_mask NULL
>> #define gic_smp_init() do { } while(0)
>> #endif
>>
>> @@ -1257,6 +1263,7 @@ static struct irq_chip gic_chip = {
>> .irq_set_irqchip_state = gic_irq_set_irqchip_state,
>> .irq_nmi_setup = gic_irq_nmi_setup,
>> .irq_nmi_teardown = gic_irq_nmi_teardown,
>> + .ipi_send_mask = gic_ipi_send_mask,
>> .flags = IRQCHIP_SET_TYPE_MASKED |
>> IRQCHIP_SKIP_SET_WAKE |
>> IRQCHIP_MASK_ON_SUSPEND,
>
> It looks like you missed to update "struct irq_chip gic_eoimode1_chip"
> with similar change as follows:
>
> diff --git a/drivers/irqchip/irq-gic-v3.c
> b/drivers/irqchip/irq-gic-v3.c
> index 2a09634..ceef63b 100644
> --- a/drivers/irqchip/irq-gic-v3.c
> +++ b/drivers/irqchip/irq-gic-v3.c
> @@ -1291,6 +1291,7 @@ static struct irq_chip gic_eoimode1_chip = {
> .irq_set_vcpu_affinity = gic_irq_set_vcpu_affinity,
> .irq_nmi_setup = gic_irq_nmi_setup,
> .irq_nmi_teardown = gic_irq_nmi_teardown,
> + .ipi_send_mask = gic_ipi_send_mask,
> .flags = IRQCHIP_SET_TYPE_MASKED |
> IRQCHIP_SKIP_SET_WAKE |
> IRQCHIP_MASK_ON_SUSPEND,
>
> After incorporating this change, your patch-set works fine on my
> Developerbox machine.
Huh, well spotted. As I said, it has only been tested as guests,
hence not hitting this path. Time to throw it at the bigger stuff.
Thanks,
M.
--
Jazz is not dead. It just smells funny...
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v4 07/13] firmware: arm_scmi: Add notification dispatch and delivery
From: Lukasz Luba @ 2020-05-20 10:23 UTC (permalink / raw)
To: Cristian Marussi, linux-kernel, linux-arm-kernel; +Cc: sudeep.holla
In-Reply-To: <20200520070907.GE17648@e119603-lin.cambridge.arm.com>
Hi Cristian,
On 5/20/20 8:09 AM, Cristian Marussi wrote:
> On Mon, Mar 16, 2020 at 02:46:05PM +0000, Cristian Marussi wrote:
>> On Thu, Mar 12, 2020 at 09:43:31PM +0000, Lukasz Luba wrote:
>>>
>>>
>
> Hi Lukasz,
>
> I went back looking deeper into the possible race issue you pointed out a
> while ago understanding it a bit better down below.
>
>>> On 3/12/20 6:34 PM, Cristian Marussi wrote:
>>>> On 12/03/2020 13:51, Lukasz Luba wrote:
>>>>> Hi Cristian,
>>>>>
>> Hi Lukasz
>>
>>>>> just one comment below...
>> [snip]
>>>>>> + eh.timestamp = ts;
>>>>>> + eh.evt_id = evt_id;
>>>>>> + eh.payld_sz = len;
>>>>>> + kfifo_in(&r_evt->proto->equeue.kfifo, &eh, sizeof(eh));
>>>>>> + kfifo_in(&r_evt->proto->equeue.kfifo, buf, len);
>>>>>> + queue_work(r_evt->proto->equeue.wq,
>>>>>> + &r_evt->proto->equeue.notify_work);
>>>>>
>>>>> Is it safe to ignore the return value from the queue_work here?
>>>>>
>>>>
>>>> In fact yes, we do not want to care: it returns true or false depending on the
>>>> fact that the specific work was or not already queued, and we just rely on
>>>> this behavior to keep kicking the worker only when needed but never kick
>>>> more than one instance of it per-queue (so that there's only one reader
>>>> wq and one writer here in the scmi_notify)...explaining better:
>>>>
>>>> 1. we push an event (hdr+payld) to the protocol queue if we found that there was
>>>> enough space on the queue
>>>>
>>>> 2a. if at the time of the kfifo_in( ) the worker was already running
>>>> (queue not empty) it will process our new event sooner or later and here
>>>> the queue_work will return false, but we do not care in fact ... we
>>>> tried to kick it just in case
>>>>
>>>> 2b. if instead at the time of the kfifo_in() the queue was empty the worker would
>>>> have probably already gone to the sleep and this queue_work() will return true and
>>>> so this time it will effectively wake up the worker to process our items
>>>>
>>>> The important thing here is that we are sure to wakeup the worker when needed
>>>> but we are equally sure we are never causing the scheduling of more than one worker
>>>> thread consuming from the same queue (because that would break the one reader/one writer
>>>> assumption which let us use the fifo in a lockless manner): this is possible because
>>>> queue_work checks if the required work item is already pending and in such a case backs
>>>> out returning false and we have one work_item (notify_work) defined per-protocol and
>>>> so per-queue.
>>>
>>> I see. That's a good assumption: one work_item per protocol and simplify
>>> the locking. What if there would be an edge case scenario when the
>>> consumer (work_item) has handled the last item (there was NULL from
>>> scmi_process_event_header()), while in meantime scmi_notify put into
>>> the fifo new event but couldn't kick the queue_work. Would it stay there
>>> till the next IRQ which triggers queue_work to consume two events (one
>>> potentially a bit old)? Or we can ignore such race situation assuming
>>> that cleaning of work item is instant and kfifo_in is slow?
>>>
>>
>> In fact, this is a very good point, since between the moment the worker
>> determines that the queue is empty and the moment in which the worker
>> effectively exits (and it's marked as no more pending by the Kernel cmwq)
>> there is a window of opportunity for a race in which the ISR could fill
>> the queue with one more event and then fail to kick with queue_work() since
>> the work is in fact still nominally marked as pending from the point of view
>> of Kernel cmwq, as below:
>>
>> ISR (core N) | WQ (core N+1) cmwq flags queued events
>> ------------------------------------------------------------------------------------------------
>> | if (queue_is_empty) - WORK_PENDING 0 events queued
>> + ... - WORK_PENDING 0 events queued
>> + } while (scmi_process_event_payload);
>> +}// worker function exit
>> kfifo_in() + ...cmwq backing out - WORK_PENDING 1 events queued
>> kfifo_in() + ...cmwq backing out - WORK_PENDING 1 events queued
>> queue_work() + ...cmwq backing out - WORK_PENDING 1 events queued
>> -> FALSE (pending) + ...cmwq backing out - WORK_PENDING 1 events queued
>> + ...cmwq backing out - WORK_PENDING 1 events queued
>> + ...cmwq backing out - WORK_PENDING 1 events queued
>> | ---- WORKER THREAD EXIT - !WORK_PENDING 1 events queued
>> | - !WORK_PENDING 1 events queued
>> kfifo_in() | - !WORK_PENDING 2 events queued
>> kfifo_in() | - !WORK_PENDING 2 events queued
>> queue_work() | - !WORK_PENDING 2 events queued
>> -> TRUE | --- WORKER ENTER - WORK_PENDING 2 events queued
>> | - WORK_PENDING 2 events consumed
>>
>> where effectively the last event queued won't be consumed till the next
>> iteration once another event is queued.
>>
>
> In summary, looking better at Kernel cmwq code, my explanation above about
> how the possible race could be exposed by a particular tricky limit condition
> and the values assumed by the WORK_STRUCT_PENDING_BIT was ... bullshit :D
>
> In fact there's no race at all because Kernel cmwq takes care to clear the above
> PENDING flag BEFORE the user-provided worker-function starts to finally run:
> such flag is active only when a work instance is queued pending for execution
> but it is cleared just before execution effctively starts.
>
> kernel/workqueue.c:process_one_work()
>
> set_work_pool_and_clear_pending(work, pool->id);
> ....
> worker->current_func(work);
>
> As a consequence in the racy scenario above where the ISR pushes events on the
> queues after the worker has already determined the queue to be empty but while
> the worker func is still being deactivated in terms of Kernel cmwq internal
> handling, it is not a problem since the worker while running is already NO more
> marked pending so the queue_work succeeds and a new work will simply be queued
> and run once the current instance terminates fully and it is removed from pool.
Sounds good, thanks to for digging into this workqueue code and figuring
it out.
>
> On the other side in the normal non racy scenario, when the worker is processing
> normally a non-empty queue, we'll end-up anyway queueing new items and a new work
> from the ISR even if the currently executing one will in fact consume already
> naturally the queued items: this will result (it's what I observe in fact) in a
> final un-needed quick worker activation/deactivation processing zero items (empty
> queue) which is in fact harmless.
>
> Basically the racy condition is taken care by the Kernel cmwq itself, and in fact
> there is an extensive explanation also of the barriers employed to properly
> realize this in the comments around set_work_pool_and_clear_pending()
>
> I'll add a comment in v8 just to note this behaviour.
Great research.
Regards,
Lukasz
>
> Thanks
>
> Cristian
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH 1/2] ARM: pxa: remove Compulab pxa2xx boards
From: Robert Jarzmik @ 2020-05-20 10:21 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Miquel Raynal, igor, Boris Brezillon, linux-mtd, Mike Rapoport,
Linux ARM
In-Reply-To: <CAK8P3a3E=Fq6ZXLkeQgufeJCP0gZiN1uXA2J=HzpH3D49GOMXQ@mail.gmail.com>
Arnd Bergmann <arnd@arndb.de> writes:
> On Wed, May 13, 2020 at 7:01 PM Robert Jarzmik <robert.jarzmik@free.fr> wrote:
>> CONFIG_MACH_EXEDA=y
>
> CONFIG_MACH_EXEDA should be removed here as well, it refers
> to part of em-x270.c
>
> Similarly, the whole em_x270_defconfig can be removed.
Certainly.
> Now arch/arm/mach-pxa/include/mach/io.h is unused and
> can be removed.
Yes.
> With MACH_ARMCORE gone, the MTD_NAND_CM_X270 and
> PCI_HOST_ITE8152 become impossible to select, and
> a part of PCMCIA_PXA2XX (pxa2xx_cm_x2xx_cs.c) becomes
> unused.
>
> FB_MBX can still be selected, but there are no boards defining
> the platform data any more, so I'd like to remove that as well.
That should be dealt with another time, sorry.
> MACH_EXEDA here is also obsolete, and I'd probably want to
> update the SND_PXA2XX_SOC_EM_X270 dependencies in the
> same patch.
Yes.
>
>> -static struct spi_board_info spi_board_info[] __initdata = {
>> - [0] = {
>> - .modalias = "rtc-max6902",
>> - .max_speed_hz = 1000000,
>> - .bus_num = 1,
>> - .chip_select = 0,
>
> Another last reference, so we can remove that the corresponding driver.
Another patch serie for this as well.
> Same here, there is still one more user left (MACH_ZIPIT2), though
> at some point that might get removed if we decide to drop the handhelds
> with 32MB RAM or less. That is probably something to be left for
> another time, but I see that pxa_defconfig produces a 9.5MB kernel
> image, so this is getting rather tight, and 32MB wasn't much when this
> got added in 2010.
Yeah, but no PXA user would ever use the pxa_defconfig kernel :)
A typical kernel for a PXA board is right now around 4MB, which is very tight
for 32MB platforms, and just enough for 64MB ones.
Cheers.
--
Robert
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* [PATCH v2 1/3] ARM: pxa: remove Compulab pxa2xx boards
From: Robert Jarzmik @ 2020-05-20 10:21 UTC (permalink / raw)
To: Arnd Bergmann, Miquel Raynal, Boris Brezillon, Mike Rapoport
Cc: Robert Jarzmik, linux-mtd, linux-arm-kernel
As these boards have no more users nor testers, and patching them has
become a burden, be that because of the PCI part or the MTD NAND
support, let's remove them.
The cm-x300 will for now remain and represent Compulab boards at its
best in the PXA department.
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
Since v1: Arnd's comments
---
arch/arm/configs/cm_x2xx_defconfig | 173 ----
arch/arm/configs/em_x270_defconfig | 178 ----
arch/arm/configs/pxa_defconfig | 2 -
arch/arm/mach-pxa/Kconfig | 17 -
arch/arm/mach-pxa/Makefile | 5 -
arch/arm/mach-pxa/cm-x255.c | 240 -----
arch/arm/mach-pxa/cm-x270.c | 419 ---------
arch/arm/mach-pxa/cm-x2xx-pci.c | 196 ----
arch/arm/mach-pxa/cm-x2xx-pci.h | 14 -
arch/arm/mach-pxa/cm-x2xx.c | 538 -----------
arch/arm/mach-pxa/em-x270.c | 1286 ---------------------------
arch/arm/mach-pxa/include/mach/io.h | 18 -
12 files changed, 3086 deletions(-)
delete mode 100644 arch/arm/configs/cm_x2xx_defconfig
delete mode 100644 arch/arm/configs/em_x270_defconfig
delete mode 100644 arch/arm/mach-pxa/cm-x255.c
delete mode 100644 arch/arm/mach-pxa/cm-x270.c
delete mode 100644 arch/arm/mach-pxa/cm-x2xx-pci.c
delete mode 100644 arch/arm/mach-pxa/cm-x2xx-pci.h
delete mode 100644 arch/arm/mach-pxa/cm-x2xx.c
delete mode 100644 arch/arm/mach-pxa/em-x270.c
delete mode 100644 arch/arm/mach-pxa/include/mach/io.h
diff --git a/arch/arm/configs/cm_x2xx_defconfig b/arch/arm/configs/cm_x2xx_defconfig
deleted file mode 100644
index fa997ae2673e..000000000000
--- a/arch/arm/configs/cm_x2xx_defconfig
+++ /dev/null
@@ -1,173 +0,0 @@
-# CONFIG_LOCALVERSION_AUTO is not set
-CONFIG_SYSVIPC=y
-CONFIG_IKCONFIG=y
-CONFIG_IKCONFIG_PROC=y
-CONFIG_LOG_BUF_SHIFT=14
-CONFIG_SYSFS_DEPRECATED_V2=y
-CONFIG_BLK_DEV_INITRD=y
-CONFIG_EXPERT=y
-# CONFIG_VM_EVENT_COUNTERS is not set
-# CONFIG_SLUB_DEBUG is not set
-# CONFIG_COMPAT_BRK is not set
-CONFIG_MODULES=y
-CONFIG_MODULE_UNLOAD=y
-# CONFIG_BLK_DEV_BSG is not set
-CONFIG_ARCH_PXA=y
-CONFIG_MACH_ARMCORE=y
-CONFIG_PCI=y
-CONFIG_PCCARD=m
-CONFIG_YENTA=m
-# CONFIG_YENTA_O2 is not set
-# CONFIG_YENTA_RICOH is not set
-# CONFIG_YENTA_ENE_TUNE is not set
-# CONFIG_YENTA_TOSHIBA is not set
-CONFIG_PCMCIA_PXA2XX=m
-CONFIG_NO_HZ=y
-CONFIG_AEABI=y
-CONFIG_ZBOOT_ROM_TEXT=0x0
-CONFIG_ZBOOT_ROM_BSS=0x0
-CONFIG_CMDLINE="root=1f03 mem=32M"
-CONFIG_FPE_NWFPE=y
-CONFIG_PM=y
-CONFIG_APM_EMULATION=m
-CONFIG_NET=y
-CONFIG_PACKET=y
-CONFIG_UNIX=y
-CONFIG_INET=y
-CONFIG_IP_MULTICAST=y
-CONFIG_IP_PNP=y
-CONFIG_IP_PNP_DHCP=y
-CONFIG_IP_PNP_BOOTP=y
-# CONFIG_INET_DIAG is not set
-# CONFIG_IPV6 is not set
-CONFIG_BT=m
-CONFIG_BT_RFCOMM=m
-CONFIG_BT_BNEP=m
-CONFIG_BT_HIDP=m
-CONFIG_LIB80211=m
-CONFIG_FW_LOADER=m
-CONFIG_MTD=y
-CONFIG_MTD_CMDLINE_PARTS=y
-CONFIG_MTD_BLOCK=y
-CONFIG_MTD_CFI=y
-CONFIG_MTD_JEDECPROBE=y
-CONFIG_MTD_CFI_ADV_OPTIONS=y
-CONFIG_MTD_CFI_INTELEXT=y
-CONFIG_MTD_CFI_AMDSTD=y
-CONFIG_MTD_CFI_STAA=y
-CONFIG_MTD_PHYSMAP=y
-CONFIG_MTD_PXA2XX=y
-CONFIG_MTD_RAW_NAND=y
-CONFIG_MTD_NAND_GPIO=m
-CONFIG_MTD_NAND_CM_X270=y
-CONFIG_MTD_NAND_PLATFORM=y
-CONFIG_BLK_DEV_LOOP=y
-CONFIG_BLK_DEV_RAM=y
-CONFIG_SCSI=y
-CONFIG_BLK_DEV_SD=y
-CONFIG_ATA=m
-# CONFIG_SATA_PMP is not set
-CONFIG_PATA_PCMCIA=m
-CONFIG_NETDEVICES=y
-CONFIG_NET_ETHERNET=y
-CONFIG_DM9000=y
-CONFIG_DM9000_DEBUGLEVEL=1
-CONFIG_NET_PCI=y
-CONFIG_8139TOO=m
-# CONFIG_8139TOO_PIO is not set
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-CONFIG_PPP_FILTER=y
-CONFIG_PPP_ASYNC=m
-CONFIG_PPP_DEFLATE=m
-CONFIG_PPP_BSDCOMP=m
-CONFIG_INPUT_EVDEV=y
-CONFIG_KEYBOARD_PXA27x=m
-# CONFIG_INPUT_MOUSE is not set
-CONFIG_INPUT_TOUCHSCREEN=y
-CONFIG_TOUCHSCREEN_UCB1400=m
-# CONFIG_SERIO_SERPORT is not set
-CONFIG_SERIAL_PXA=y
-CONFIG_SERIAL_PXA_CONSOLE=y
-CONFIG_LEGACY_PTY_COUNT=16
-# CONFIG_HW_RANDOM is not set
-CONFIG_I2C=y
-CONFIG_I2C_CHARDEV=m
-CONFIG_I2C_PXA=y
-CONFIG_SPI=y
-CONFIG_SPI_PXA2XX=m
-# CONFIG_HWMON is not set
-CONFIG_UCB1400_CORE=m
-CONFIG_FB=y
-CONFIG_FB_PXA=y
-CONFIG_FB_PXA_PARAMETERS=y
-CONFIG_FB_MBX=m
-# CONFIG_LCD_CLASS_DEVICE is not set
-# CONFIG_BACKLIGHT_CLASS_DEVICE is not set
-# CONFIG_VGA_CONSOLE is not set
-CONFIG_FRAMEBUFFER_CONSOLE=y
-CONFIG_LOGO=y
-CONFIG_SOUND=m
-CONFIG_SND=m
-CONFIG_SND_MIXER_OSS=m
-CONFIG_SND_PCM_OSS=m
-# CONFIG_SND_DRIVERS is not set
-# CONFIG_SND_PCI is not set
-CONFIG_SND_PXA2XX_AC97=m
-# CONFIG_SND_SPI is not set
-# CONFIG_SND_USB is not set
-# CONFIG_SND_PCMCIA is not set
-CONFIG_HID_A4TECH=y
-CONFIG_HID_APPLE=y
-CONFIG_HID_BELKIN=y
-CONFIG_HID_CHERRY=y
-CONFIG_HID_CHICONY=y
-CONFIG_HID_CYPRESS=y
-CONFIG_HID_EZKEY=y
-CONFIG_HID_GYRATION=y
-CONFIG_HID_LOGITECH=y
-CONFIG_HID_MICROSOFT=y
-CONFIG_HID_MONTEREY=y
-CONFIG_HID_PANTHERLORD=y
-CONFIG_HID_PETALYNX=y
-CONFIG_HID_SAMSUNG=y
-CONFIG_HID_SONY=y
-CONFIG_HID_SUNPLUS=y
-CONFIG_USB=y
-CONFIG_USB_MON=y
-CONFIG_USB_OHCI_HCD=y
-CONFIG_USB_STORAGE=y
-CONFIG_MMC=m
-CONFIG_MMC_PXA=m
-CONFIG_NEW_LEDS=y
-CONFIG_LEDS_CLASS=y
-CONFIG_LEDS_GPIO=m
-CONFIG_LEDS_TRIGGERS=y
-CONFIG_LEDS_TRIGGER_HEARTBEAT=y
-CONFIG_RTC_CLASS=y
-CONFIG_RTC_DRV_V3020=y
-CONFIG_RTC_DRV_PXA=y
-CONFIG_EXT2_FS=y
-CONFIG_EXT3_FS=y
-CONFIG_VFAT_FS=m
-# CONFIG_PROC_PAGE_MONITOR is not set
-CONFIG_TMPFS=y
-CONFIG_JFFS2_FS=y
-CONFIG_JFFS2_SUMMARY=y
-CONFIG_NFS_FS=y
-CONFIG_NFS_V3=y
-CONFIG_ROOT_NFS=y
-CONFIG_CIFS=m
-CONFIG_PARTITION_ADVANCED=y
-CONFIG_NLS_CODEPAGE_437=m
-CONFIG_NLS_ISO8859_1=m
-CONFIG_NLS_UTF8=m
-CONFIG_FRAME_WARN=0
-CONFIG_DEBUG_KERNEL=y
-# CONFIG_DETECT_SOFTLOCKUP is not set
-# CONFIG_SCHED_DEBUG is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
-CONFIG_DEBUG_USER=y
-CONFIG_DEBUG_LL=y
-# CONFIG_CRYPTO_ANSI_CPRNG is not set
-# CONFIG_CRYPTO_HW is not set
diff --git a/arch/arm/configs/em_x270_defconfig b/arch/arm/configs/em_x270_defconfig
deleted file mode 100644
index d08f02014755..000000000000
--- a/arch/arm/configs/em_x270_defconfig
+++ /dev/null
@@ -1,178 +0,0 @@
-# CONFIG_LOCALVERSION_AUTO is not set
-CONFIG_SYSVIPC=y
-CONFIG_IKCONFIG=y
-CONFIG_IKCONFIG_PROC=y
-CONFIG_LOG_BUF_SHIFT=14
-CONFIG_SYSFS_DEPRECATED_V2=y
-CONFIG_BLK_DEV_INITRD=y
-CONFIG_EXPERT=y
-# CONFIG_VM_EVENT_COUNTERS is not set
-# CONFIG_SLUB_DEBUG is not set
-# CONFIG_COMPAT_BRK is not set
-CONFIG_MODULES=y
-CONFIG_MODULE_UNLOAD=y
-# CONFIG_BLK_DEV_BSG is not set
-CONFIG_ARCH_PXA=y
-CONFIG_MACH_EM_X270=y
-CONFIG_MACH_EXEDA=y
-CONFIG_NO_HZ=y
-CONFIG_AEABI=y
-CONFIG_ZBOOT_ROM_TEXT=0x0
-CONFIG_ZBOOT_ROM_BSS=0x0
-CONFIG_CMDLINE="root=1f03 mem=32M"
-CONFIG_CPU_FREQ=y
-CONFIG_CPU_FREQ_GOV_USERSPACE=m
-CONFIG_FPE_NWFPE=y
-CONFIG_PM=y
-CONFIG_APM_EMULATION=y
-CONFIG_NET=y
-CONFIG_PACKET=y
-CONFIG_UNIX=y
-CONFIG_INET=y
-CONFIG_IP_MULTICAST=y
-CONFIG_IP_PNP=y
-CONFIG_IP_PNP_DHCP=y
-CONFIG_IP_PNP_BOOTP=y
-# CONFIG_INET_DIAG is not set
-# CONFIG_IPV6 is not set
-CONFIG_BT=m
-CONFIG_BT_RFCOMM=m
-CONFIG_BT_BNEP=m
-CONFIG_BT_HIDP=m
-CONFIG_BT_HCIBTUSB=m
-CONFIG_LIB80211=m
-CONFIG_FW_LOADER=m
-CONFIG_MTD=y
-CONFIG_MTD_CMDLINE_PARTS=y
-CONFIG_MTD_BLOCK=y
-CONFIG_MTD_CFI=y
-CONFIG_MTD_JEDECPROBE=y
-CONFIG_MTD_CFI_ADV_OPTIONS=y
-CONFIG_MTD_CFI_INTELEXT=y
-CONFIG_MTD_CFI_AMDSTD=y
-CONFIG_MTD_CFI_STAA=y
-CONFIG_MTD_PHYSMAP=y
-CONFIG_MTD_PXA2XX=y
-CONFIG_MTD_RAW_NAND=y
-CONFIG_MTD_NAND_PLATFORM=y
-CONFIG_BLK_DEV_LOOP=y
-CONFIG_BLK_DEV_RAM=y
-CONFIG_SCSI=y
-CONFIG_BLK_DEV_SD=y
-# CONFIG_SCSI_LOWLEVEL is not set
-CONFIG_NETDEVICES=y
-CONFIG_NET_ETHERNET=y
-CONFIG_DM9000=y
-CONFIG_DM9000_DEBUGLEVEL=1
-CONFIG_PPP=m
-CONFIG_PPP_MULTILINK=y
-CONFIG_PPP_FILTER=y
-CONFIG_PPP_ASYNC=m
-CONFIG_PPP_DEFLATE=m
-CONFIG_PPP_BSDCOMP=m
-CONFIG_INPUT_EVDEV=y
-CONFIG_INPUT_APMPOWER=y
-CONFIG_KEYBOARD_GPIO=y
-CONFIG_KEYBOARD_PXA27x=y
-# CONFIG_INPUT_MOUSE is not set
-CONFIG_INPUT_TOUCHSCREEN=y
-# CONFIG_TOUCHSCREEN_DA9034 is not set
-CONFIG_TOUCHSCREEN_WM97XX=m
-# CONFIG_TOUCHSCREEN_WM9705 is not set
-# CONFIG_TOUCHSCREEN_WM9713 is not set
-# CONFIG_SERIO_SERPORT is not set
-CONFIG_SERIAL_PXA=y
-CONFIG_SERIAL_PXA_CONSOLE=y
-CONFIG_LEGACY_PTY_COUNT=16
-# CONFIG_HW_RANDOM is not set
-CONFIG_I2C=y
-CONFIG_I2C_CHARDEV=m
-CONFIG_I2C_PXA=y
-CONFIG_SPI=y
-CONFIG_SPI_PXA2XX=y
-CONFIG_POWER_SUPPLY=y
-CONFIG_BATTERY_DA9030=y
-# CONFIG_HWMON is not set
-CONFIG_PMIC_DA903X=y
-CONFIG_REGULATOR=y
-CONFIG_REGULATOR_DA903X=y
-CONFIG_FB=y
-CONFIG_FB_PXA=y
-CONFIG_FB_PXA_PARAMETERS=y
-CONFIG_FB_MBX=m
-CONFIG_LCD_CLASS_DEVICE=y
-CONFIG_LCD_TDO24M=y
-# CONFIG_BACKLIGHT_GENERIC is not set
-CONFIG_BACKLIGHT_DA903X=m
-# CONFIG_VGA_CONSOLE is not set
-CONFIG_FRAMEBUFFER_CONSOLE=y
-CONFIG_LOGO=y
-CONFIG_SOUND=m
-CONFIG_SND=m
-CONFIG_SND_MIXER_OSS=m
-CONFIG_SND_PCM_OSS=m
-# CONFIG_SND_DRIVERS is not set
-# CONFIG_SND_SPI is not set
-# CONFIG_SND_USB is not set
-CONFIG_SND_SOC=m
-CONFIG_SND_PXA2XX_SOC=m
-CONFIG_SND_PXA2XX_SOC_EM_X270=m
-CONFIG_HID_A4TECH=y
-CONFIG_HID_APPLE=y
-CONFIG_HID_BELKIN=y
-CONFIG_HID_CHERRY=y
-CONFIG_HID_CHICONY=y
-CONFIG_HID_CYPRESS=y
-CONFIG_HID_EZKEY=y
-CONFIG_HID_GYRATION=y
-CONFIG_HID_LOGITECH=y
-CONFIG_HID_MICROSOFT=y
-CONFIG_HID_MONTEREY=y
-CONFIG_HID_PANTHERLORD=y
-CONFIG_HID_PETALYNX=y
-CONFIG_HID_SAMSUNG=y
-CONFIG_HID_SONY=y
-CONFIG_HID_SUNPLUS=y
-CONFIG_USB=y
-CONFIG_USB_MON=y
-CONFIG_USB_OHCI_HCD=y
-CONFIG_USB_STORAGE=y
-CONFIG_MMC=m
-CONFIG_MMC_PXA=m
-CONFIG_NEW_LEDS=y
-CONFIG_LEDS_CLASS=y
-CONFIG_LEDS_DA903X=y
-CONFIG_LEDS_TRIGGERS=y
-CONFIG_LEDS_TRIGGER_HEARTBEAT=y
-CONFIG_RTC_CLASS=y
-CONFIG_RTC_DRV_V3020=y
-CONFIG_RTC_DRV_PXA=y
-CONFIG_EXT2_FS=y
-CONFIG_EXT3_FS=y
-CONFIG_VFAT_FS=m
-# CONFIG_PROC_PAGE_MONITOR is not set
-CONFIG_TMPFS=y
-CONFIG_JFFS2_FS=y
-CONFIG_JFFS2_SUMMARY=y
-CONFIG_NFS_FS=y
-CONFIG_NFS_V3=y
-CONFIG_ROOT_NFS=y
-CONFIG_CIFS=m
-CONFIG_PARTITION_ADVANCED=y
-CONFIG_NLS_CODEPAGE_437=m
-CONFIG_NLS_ISO8859_1=m
-CONFIG_NLS_UTF8=m
-CONFIG_FRAME_WARN=0
-CONFIG_DEBUG_FS=y
-CONFIG_DEBUG_KERNEL=y
-# CONFIG_DETECT_SOFTLOCKUP is not set
-# CONFIG_SCHED_DEBUG is not set
-# CONFIG_DEBUG_BUGVERBOSE is not set
-CONFIG_DEBUG_USER=y
-CONFIG_DEBUG_LL=y
-CONFIG_CRYPTO_ECB=m
-CONFIG_CRYPTO_MICHAEL_MIC=m
-CONFIG_CRYPTO_AES=m
-CONFIG_CRYPTO_ARC4=m
-# CONFIG_CRYPTO_ANSI_CPRNG is not set
-# CONFIG_CRYPTO_HW is not set
diff --git a/arch/arm/configs/pxa_defconfig b/arch/arm/configs/pxa_defconfig
index b817c57f05f1..e6559e3350e6 100644
--- a/arch/arm/configs/pxa_defconfig
+++ b/arch/arm/configs/pxa_defconfig
@@ -38,8 +38,6 @@ CONFIG_MACH_ARCOM_ZEUS=y
CONFIG_MACH_BALLOON3=y
CONFIG_MACH_CSB726=y
CONFIG_CSB726_CSB701=y
-CONFIG_MACH_ARMCORE=y
-CONFIG_MACH_EM_X270=y
CONFIG_MACH_EXEDA=y
CONFIG_MACH_CM_X300=y
CONFIG_MACH_CAPC7117=y
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index f60bc29aef68..f7520a6cc7d4 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -123,23 +123,6 @@ config CSB726_CSB701
bool "Enable support for CSB701 baseboard"
depends on MACH_CSB726
-config MACH_ARMCORE
- bool "CompuLab CM-X255/CM-X270 modules"
- select ARCH_HAS_DMA_SET_COHERENT_MASK if PCI
- select IWMMXT
- select HAVE_PCI
- select NEED_MACH_IO_H if PCI
- select PXA25x
- select PXA27x
-
-config MACH_EM_X270
- bool "CompuLab EM-x270 platform"
- select PXA27x
-
-config MACH_EXEDA
- bool "CompuLab eXeda platform"
- select PXA27x
-
config MACH_CM_X300
bool "CompuLab CM-X300 modules"
select CPU_PXA300
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index f70728930c4f..177abe584dd5 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -40,11 +40,6 @@ obj-$(CONFIG_MACH_ARCOM_ZEUS) += zeus.o
obj-$(CONFIG_MACH_BALLOON3) += balloon3.o
obj-$(CONFIG_MACH_CSB726) += csb726.o
obj-$(CONFIG_CSB726_CSB701) += csb701.o
-obj-$(CONFIG_MACH_ARMCORE) += cm-x2xx.o cm-x255.o cm-x270.o
-ifeq ($(CONFIG_PCI),y)
-obj-$(CONFIG_MACH_ARMCORE) += cm-x2xx-pci.o
-endif
-obj-$(CONFIG_MACH_EM_X270) += em-x270.o
obj-$(CONFIG_MACH_CM_X300) += cm-x300.o
obj-$(CONFIG_MACH_CAPC7117) += capc7117.o mxm8x10.o
obj-$(CONFIG_ARCH_GUMSTIX) += gumstix.o
diff --git a/arch/arm/mach-pxa/cm-x255.c b/arch/arm/mach-pxa/cm-x255.c
deleted file mode 100644
index ea1e85775759..000000000000
--- a/arch/arm/mach-pxa/cm-x255.c
+++ /dev/null
@@ -1,240 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * linux/arch/arm/mach-pxa/cm-x255.c
- *
- * Copyright (C) 2007, 2008 CompuLab, Ltd.
- * Mike Rapoport <mike@compulab.co.il>
- */
-
-#include <linux/platform_device.h>
-#include <linux/irq.h>
-#include <linux/mtd/partitions.h>
-#include <linux/mtd/physmap.h>
-#include <linux/mtd/nand-gpio.h>
-#include <linux/gpio/machine.h>
-#include <linux/spi/spi.h>
-#include <linux/spi/pxa2xx_spi.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach-types.h>
-#include <asm/mach/map.h>
-
-#include "pxa25x.h"
-
-#include "generic.h"
-
-#define GPIO_NAND_CS (5)
-#define GPIO_NAND_ALE (4)
-#define GPIO_NAND_CLE (3)
-#define GPIO_NAND_RB (10)
-
-static unsigned long cmx255_pin_config[] = {
- /* AC'97 */
- GPIO28_AC97_BITCLK,
- GPIO29_AC97_SDATA_IN_0,
- GPIO30_AC97_SDATA_OUT,
- GPIO31_AC97_SYNC,
-
- /* BTUART */
- GPIO42_BTUART_RXD,
- GPIO43_BTUART_TXD,
- GPIO44_BTUART_CTS,
- GPIO45_BTUART_RTS,
-
- /* STUART */
- GPIO46_STUART_RXD,
- GPIO47_STUART_TXD,
-
- /* LCD */
- GPIOxx_LCD_TFT_16BPP,
-
- /* SSP1 */
- GPIO23_SSP1_SCLK,
- GPIO24_SSP1_SFRM,
- GPIO25_SSP1_TXD,
- GPIO26_SSP1_RXD,
-
- /* SSP2 */
- GPIO81_SSP2_CLK_OUT,
- GPIO82_SSP2_FRM_OUT,
- GPIO83_SSP2_TXD,
- GPIO84_SSP2_RXD,
-
- /* PC Card */
- GPIO48_nPOE,
- GPIO49_nPWE,
- GPIO50_nPIOR,
- GPIO51_nPIOW,
- GPIO52_nPCE_1,
- GPIO53_nPCE_2,
- GPIO54_nPSKTSEL,
- GPIO55_nPREG,
- GPIO56_nPWAIT,
- GPIO57_nIOIS16,
-
- /* SDRAM and local bus */
- GPIO15_nCS_1,
- GPIO78_nCS_2,
- GPIO79_nCS_3,
- GPIO80_nCS_4,
- GPIO33_nCS_5,
- GPIO18_RDY,
-
- /* GPIO */
- GPIO0_GPIO | WAKEUP_ON_EDGE_BOTH,
- GPIO9_GPIO, /* PC card reset */
-
- /* NAND controls */
- GPIO5_GPIO | MFP_LPM_DRIVE_HIGH, /* NAND CE# */
- GPIO4_GPIO | MFP_LPM_DRIVE_LOW, /* NAND ALE */
- GPIO3_GPIO | MFP_LPM_DRIVE_LOW, /* NAND CLE */
- GPIO10_GPIO, /* NAND Ready/Busy */
-
- /* interrupts */
- GPIO22_GPIO, /* DM9000 interrupt */
-};
-
-#if defined(CONFIG_SPI_PXA2XX)
-static struct pxa2xx_spi_controller pxa_ssp_master_info = {
- .num_chipselect = 1,
-};
-
-static struct spi_board_info spi_board_info[] __initdata = {
- [0] = {
- .modalias = "rtc-max6902",
- .max_speed_hz = 1000000,
- .bus_num = 1,
- .chip_select = 0,
- },
-};
-
-static void __init cmx255_init_rtc(void)
-{
- pxa2xx_set_spi_info(1, &pxa_ssp_master_info);
- spi_register_board_info(ARRAY_AND_SIZE(spi_board_info));
-}
-#else
-static inline void cmx255_init_rtc(void) {}
-#endif
-
-#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
-static struct mtd_partition cmx255_nor_partitions[] = {
- {
- .name = "ARMmon",
- .size = 0x00030000,
- .offset = 0,
- .mask_flags = MTD_WRITEABLE /* force read-only */
- } , {
- .name = "ARMmon setup block",
- .size = 0x00010000,
- .offset = MTDPART_OFS_APPEND,
- .mask_flags = MTD_WRITEABLE /* force read-only */
- } , {
- .name = "kernel",
- .size = 0x00160000,
- .offset = MTDPART_OFS_APPEND,
- } , {
- .name = "ramdisk",
- .size = MTDPART_SIZ_FULL,
- .offset = MTDPART_OFS_APPEND
- }
-};
-
-static struct physmap_flash_data cmx255_nor_flash_data[] = {
- {
- .width = 2, /* bankwidth in bytes */
- .parts = cmx255_nor_partitions,
- .nr_parts = ARRAY_SIZE(cmx255_nor_partitions)
- }
-};
-
-static struct resource cmx255_nor_resource = {
- .start = PXA_CS0_PHYS,
- .end = PXA_CS0_PHYS + SZ_8M - 1,
- .flags = IORESOURCE_MEM,
-};
-
-static struct platform_device cmx255_nor = {
- .name = "physmap-flash",
- .id = -1,
- .dev = {
- .platform_data = cmx255_nor_flash_data,
- },
- .resource = &cmx255_nor_resource,
- .num_resources = 1,
-};
-
-static void __init cmx255_init_nor(void)
-{
- platform_device_register(&cmx255_nor);
-}
-#else
-static inline void cmx255_init_nor(void) {}
-#endif
-
-#if defined(CONFIG_MTD_NAND_GPIO) || defined(CONFIG_MTD_NAND_GPIO_MODULE)
-
-static struct gpiod_lookup_table cmx255_nand_gpiod_table = {
- .dev_id = "gpio-nand",
- .table = {
- GPIO_LOOKUP("gpio-pxa", GPIO_NAND_CS, "nce", GPIO_ACTIVE_HIGH),
- GPIO_LOOKUP("gpio-pxa", GPIO_NAND_CLE, "cle", GPIO_ACTIVE_HIGH),
- GPIO_LOOKUP("gpio-pxa", GPIO_NAND_ALE, "ale", GPIO_ACTIVE_HIGH),
- GPIO_LOOKUP("gpio-pxa", GPIO_NAND_RB, "rdy", GPIO_ACTIVE_HIGH),
- },
-};
-
-static struct resource cmx255_nand_resource[] = {
- [0] = {
- .start = PXA_CS1_PHYS,
- .end = PXA_CS1_PHYS + 11,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = PXA_CS5_PHYS,
- .end = PXA_CS5_PHYS + 3,
- .flags = IORESOURCE_MEM,
- },
-};
-
-static struct mtd_partition cmx255_nand_parts[] = {
- [0] = {
- .name = "cmx255-nand",
- .size = MTDPART_SIZ_FULL,
- .offset = 0,
- },
-};
-
-static struct gpio_nand_platdata cmx255_nand_platdata = {
- .parts = cmx255_nand_parts,
- .num_parts = ARRAY_SIZE(cmx255_nand_parts),
- .chip_delay = 25,
-};
-
-static struct platform_device cmx255_nand = {
- .name = "gpio-nand",
- .num_resources = ARRAY_SIZE(cmx255_nand_resource),
- .resource = cmx255_nand_resource,
- .id = -1,
- .dev = {
- .platform_data = &cmx255_nand_platdata,
- }
-};
-
-static void __init cmx255_init_nand(void)
-{
- gpiod_add_lookup_table(&cmx255_nand_gpiod_table);
- platform_device_register(&cmx255_nand);
-}
-#else
-static inline void cmx255_init_nand(void) {}
-#endif
-
-void __init cmx255_init(void)
-{
- pxa2xx_mfp_config(ARRAY_AND_SIZE(cmx255_pin_config));
-
- cmx255_init_rtc();
- cmx255_init_nor();
- cmx255_init_nand();
-}
diff --git a/arch/arm/mach-pxa/cm-x270.c b/arch/arm/mach-pxa/cm-x270.c
deleted file mode 100644
index 9baad11314f2..000000000000
--- a/arch/arm/mach-pxa/cm-x270.c
+++ /dev/null
@@ -1,419 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * linux/arch/arm/mach-pxa/cm-x270.c
- *
- * Copyright (C) 2007, 2008 CompuLab, Ltd.
- * Mike Rapoport <mike@compulab.co.il>
- */
-
-#include <linux/platform_device.h>
-#include <linux/irq.h>
-#include <linux/gpio.h>
-#include <linux/gpio/machine.h>
-#include <linux/delay.h>
-
-#include <linux/platform_data/rtc-v3020.h>
-#include <video/mbxfb.h>
-
-#include <linux/spi/spi.h>
-#include <linux/spi/pxa2xx_spi.h>
-#include <linux/spi/libertas_spi.h>
-
-#include "pxa27x.h"
-#include <linux/platform_data/usb-ohci-pxa27x.h>
-#include <linux/platform_data/mmc-pxamci.h>
-
-#include "generic.h"
-
-/* physical address if local-bus attached devices */
-#define RTC_PHYS_BASE (PXA_CS1_PHYS + (5 << 22))
-
-/* GPIO IRQ usage */
-#define GPIO83_MMC_IRQ (83)
-
-#define CMX270_MMC_IRQ PXA_GPIO_TO_IRQ(GPIO83_MMC_IRQ)
-
-/* MMC power enable */
-#define GPIO105_MMC_POWER (105)
-
-/* WLAN GPIOS */
-#define GPIO19_WLAN_STRAP (19)
-#define GPIO102_WLAN_RST (102)
-
-static unsigned long cmx270_pin_config[] = {
- /* AC'97 */
- GPIO28_AC97_BITCLK,
- GPIO29_AC97_SDATA_IN_0,
- GPIO30_AC97_SDATA_OUT,
- GPIO31_AC97_SYNC,
- GPIO98_AC97_SYSCLK,
- GPIO113_AC97_nRESET,
-
- /* BTUART */
- GPIO42_BTUART_RXD,
- GPIO43_BTUART_TXD,
- GPIO44_BTUART_CTS,
- GPIO45_BTUART_RTS,
-
- /* STUART */
- GPIO46_STUART_RXD,
- GPIO47_STUART_TXD,
-
- /* MCI controller */
- GPIO32_MMC_CLK,
- GPIO112_MMC_CMD,
- GPIO92_MMC_DAT_0,
- GPIO109_MMC_DAT_1,
- GPIO110_MMC_DAT_2,
- GPIO111_MMC_DAT_3,
-
- /* LCD */
- GPIOxx_LCD_TFT_16BPP,
-
- /* I2C */
- GPIO117_I2C_SCL,
- GPIO118_I2C_SDA,
-
- /* SSP1 */
- GPIO23_SSP1_SCLK,
- GPIO24_SSP1_SFRM,
- GPIO25_SSP1_TXD,
- GPIO26_SSP1_RXD,
-
- /* SSP2 */
- GPIO19_GPIO, /* SSP2 clock is used as GPIO for Libertas pin-strap */
- GPIO14_GPIO,
- GPIO87_SSP2_TXD,
- GPIO88_SSP2_RXD,
-
- /* PC Card */
- GPIO48_nPOE,
- GPIO49_nPWE,
- GPIO50_nPIOR,
- GPIO51_nPIOW,
- GPIO85_nPCE_1,
- GPIO54_nPCE_2,
- GPIO55_nPREG,
- GPIO56_nPWAIT,
- GPIO57_nIOIS16,
-
- /* SDRAM and local bus */
- GPIO15_nCS_1,
- GPIO78_nCS_2,
- GPIO79_nCS_3,
- GPIO80_nCS_4,
- GPIO33_nCS_5,
- GPIO49_nPWE,
- GPIO18_RDY,
-
- /* GPIO */
- GPIO0_GPIO | WAKEUP_ON_EDGE_BOTH,
- GPIO105_GPIO | MFP_LPM_DRIVE_HIGH, /* MMC/SD power */
- GPIO53_GPIO, /* PC card reset */
- GPIO102_GPIO, /* WLAN reset */
-
- /* NAND controls */
- GPIO11_GPIO | MFP_LPM_DRIVE_HIGH, /* NAND CE# */
- GPIO89_GPIO, /* NAND Ready/Busy */
-
- /* interrupts */
- GPIO10_GPIO, /* DM9000 interrupt */
- GPIO83_GPIO, /* MMC card detect */
- GPIO95_GPIO, /* WLAN interrupt */
-};
-
-/* V3020 RTC */
-#if defined(CONFIG_RTC_DRV_V3020) || defined(CONFIG_RTC_DRV_V3020_MODULE)
-static struct resource cmx270_v3020_resource[] = {
- [0] = {
- .start = RTC_PHYS_BASE,
- .end = RTC_PHYS_BASE + 4,
- .flags = IORESOURCE_MEM,
- },
-};
-
-struct v3020_platform_data cmx270_v3020_pdata = {
- .leftshift = 16,
-};
-
-static struct platform_device cmx270_rtc_device = {
- .name = "v3020",
- .num_resources = ARRAY_SIZE(cmx270_v3020_resource),
- .resource = cmx270_v3020_resource,
- .id = -1,
- .dev = {
- .platform_data = &cmx270_v3020_pdata,
- }
-};
-
-static void __init cmx270_init_rtc(void)
-{
- platform_device_register(&cmx270_rtc_device);
-}
-#else
-static inline void cmx270_init_rtc(void) {}
-#endif
-
-/* 2700G graphics */
-#if defined(CONFIG_FB_MBX) || defined(CONFIG_FB_MBX_MODULE)
-static u64 fb_dma_mask = ~(u64)0;
-
-static struct resource cmx270_2700G_resource[] = {
- /* frame buffer memory including ODFB and External SDRAM */
- [0] = {
- .start = PXA_CS2_PHYS,
- .end = PXA_CS2_PHYS + 0x01ffffff,
- .flags = IORESOURCE_MEM,
- },
- /* Marathon registers */
- [1] = {
- .start = PXA_CS2_PHYS + 0x03fe0000,
- .end = PXA_CS2_PHYS + 0x03ffffff,
- .flags = IORESOURCE_MEM,
- },
-};
-
-static unsigned long cmx270_marathon_on[] = {
- GPIO58_GPIO,
- GPIO59_GPIO,
- GPIO60_GPIO,
- GPIO61_GPIO,
- GPIO62_GPIO,
- GPIO63_GPIO,
- GPIO64_GPIO,
- GPIO65_GPIO,
- GPIO66_GPIO,
- GPIO67_GPIO,
- GPIO68_GPIO,
- GPIO69_GPIO,
- GPIO70_GPIO,
- GPIO71_GPIO,
- GPIO72_GPIO,
- GPIO73_GPIO,
- GPIO74_GPIO,
- GPIO75_GPIO,
- GPIO76_GPIO,
- GPIO77_GPIO,
-};
-
-static unsigned long cmx270_marathon_off[] = {
- GPIOxx_LCD_TFT_16BPP,
-};
-
-static int cmx270_marathon_probe(struct fb_info *fb)
-{
- int gpio, err;
-
- for (gpio = 58; gpio <= 77; gpio++) {
- err = gpio_request(gpio, "LCD");
- if (err)
- return err;
- gpio_direction_input(gpio);
- }
-
- pxa2xx_mfp_config(ARRAY_AND_SIZE(cmx270_marathon_on));
- return 0;
-}
-
-static int cmx270_marathon_remove(struct fb_info *fb)
-{
- int gpio;
-
- pxa2xx_mfp_config(ARRAY_AND_SIZE(cmx270_marathon_off));
-
- for (gpio = 58; gpio <= 77; gpio++)
- gpio_free(gpio);
-
- return 0;
-}
-
-static struct mbxfb_platform_data cmx270_2700G_data = {
- .xres = {
- .min = 240,
- .max = 1200,
- .defval = 640,
- },
- .yres = {
- .min = 240,
- .max = 1200,
- .defval = 480,
- },
- .bpp = {
- .min = 16,
- .max = 32,
- .defval = 16,
- },
- .memsize = 8*1024*1024,
- .probe = cmx270_marathon_probe,
- .remove = cmx270_marathon_remove,
-};
-
-static struct platform_device cmx270_2700G = {
- .name = "mbx-fb",
- .dev = {
- .platform_data = &cmx270_2700G_data,
- .dma_mask = &fb_dma_mask,
- .coherent_dma_mask = 0xffffffff,
- },
- .num_resources = ARRAY_SIZE(cmx270_2700G_resource),
- .resource = cmx270_2700G_resource,
- .id = -1,
-};
-
-static void __init cmx270_init_2700G(void)
-{
- platform_device_register(&cmx270_2700G);
-}
-#else
-static inline void cmx270_init_2700G(void) {}
-#endif
-
-/* PXA27x OHCI controller setup */
-#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
-static struct pxaohci_platform_data cmx270_ohci_platform_data = {
- .port_mode = PMM_PERPORT_MODE,
- .flags = ENABLE_PORT1 | ENABLE_PORT2 | POWER_CONTROL_LOW,
-};
-
-static void __init cmx270_init_ohci(void)
-{
- pxa_set_ohci_info(&cmx270_ohci_platform_data);
-}
-#else
-static inline void cmx270_init_ohci(void) {}
-#endif
-
-#if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE)
-static struct pxamci_platform_data cmx270_mci_platform_data = {
- .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
-};
-
-static struct gpiod_lookup_table cmx270_mci_gpio_table = {
- .dev_id = "pxa2xx-mci.0",
- .table = {
- /* Card detect on GPIO 83 */
- GPIO_LOOKUP("gpio-pxa", GPIO83_MMC_IRQ, "cd", GPIO_ACTIVE_LOW),
- /* Power on GPIO 105 */
- GPIO_LOOKUP("gpio-pxa", GPIO105_MMC_POWER,
- "power", GPIO_ACTIVE_LOW),
- { },
- },
-};
-
-static void __init cmx270_init_mmc(void)
-{
- gpiod_add_lookup_table(&cmx270_mci_gpio_table);
- pxa_set_mci_info(&cmx270_mci_platform_data);
-}
-#else
-static inline void cmx270_init_mmc(void) {}
-#endif
-
-#if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
-static struct pxa2xx_spi_controller cm_x270_spi_info = {
- .num_chipselect = 1,
- .enable_dma = 1,
-};
-
-static struct pxa2xx_spi_chip cm_x270_libertas_chip = {
- .rx_threshold = 1,
- .tx_threshold = 1,
- .timeout = 1000,
- .gpio_cs = 14,
-};
-
-static unsigned long cm_x270_libertas_pin_config[] = {
- /* SSP2 */
- GPIO19_SSP2_SCLK,
- GPIO14_GPIO,
- GPIO87_SSP2_TXD,
- GPIO88_SSP2_RXD,
-
-};
-
-static int cm_x270_libertas_setup(struct spi_device *spi)
-{
- int err = gpio_request(GPIO19_WLAN_STRAP, "WLAN STRAP");
- if (err)
- return err;
-
- err = gpio_request(GPIO102_WLAN_RST, "WLAN RST");
- if (err)
- goto err_free_strap;
-
- err = gpio_direction_output(GPIO102_WLAN_RST, 0);
- if (err)
- goto err_free_strap;
- msleep(100);
-
- err = gpio_direction_output(GPIO19_WLAN_STRAP, 1);
- if (err)
- goto err_free_strap;
- msleep(100);
-
- pxa2xx_mfp_config(ARRAY_AND_SIZE(cm_x270_libertas_pin_config));
-
- gpio_set_value(GPIO102_WLAN_RST, 1);
- msleep(100);
-
- spi->bits_per_word = 16;
- spi_setup(spi);
-
- return 0;
-
-err_free_strap:
- gpio_free(GPIO19_WLAN_STRAP);
-
- return err;
-}
-
-static int cm_x270_libertas_teardown(struct spi_device *spi)
-{
- gpio_set_value(GPIO102_WLAN_RST, 0);
- gpio_free(GPIO102_WLAN_RST);
- gpio_free(GPIO19_WLAN_STRAP);
-
- return 0;
-}
-
-struct libertas_spi_platform_data cm_x270_libertas_pdata = {
- .use_dummy_writes = 1,
- .setup = cm_x270_libertas_setup,
- .teardown = cm_x270_libertas_teardown,
-};
-
-static struct spi_board_info cm_x270_spi_devices[] __initdata = {
- {
- .modalias = "libertas_spi",
- .max_speed_hz = 13000000,
- .bus_num = 2,
- .irq = PXA_GPIO_TO_IRQ(95),
- .chip_select = 0,
- .controller_data = &cm_x270_libertas_chip,
- .platform_data = &cm_x270_libertas_pdata,
- },
-};
-
-static void __init cmx270_init_spi(void)
-{
- pxa2xx_set_spi_info(2, &cm_x270_spi_info);
- spi_register_board_info(ARRAY_AND_SIZE(cm_x270_spi_devices));
-}
-#else
-static inline void cmx270_init_spi(void) {}
-#endif
-
-void __init cmx270_init(void)
-{
- pxa2xx_mfp_config(ARRAY_AND_SIZE(cmx270_pin_config));
-
-#ifdef CONFIG_PM
- pxa27x_set_pwrmode(PWRMODE_DEEPSLEEP);
-#endif
-
- cmx270_init_rtc();
- cmx270_init_mmc();
- cmx270_init_ohci();
- cmx270_init_2700G();
- cmx270_init_spi();
-}
diff --git a/arch/arm/mach-pxa/cm-x2xx-pci.c b/arch/arm/mach-pxa/cm-x2xx-pci.c
deleted file mode 100644
index f1c61c6b5610..000000000000
--- a/arch/arm/mach-pxa/cm-x2xx-pci.c
+++ /dev/null
@@ -1,196 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * linux/arch/arm/mach-pxa/cm-x2xx-pci.c
- *
- * PCI bios-type initialisation for PCI machines
- *
- * Bits taken from various places.
- *
- * Copyright (C) 2007, 2008 Compulab, Ltd.
- * Mike Rapoport <mike@compulab.co.il>
- */
-
-#include <linux/kernel.h>
-#include <linux/pci.h>
-#include <linux/init.h>
-#include <linux/device.h>
-#include <linux/platform_device.h>
-#include <linux/irq.h>
-#include <linux/gpio.h>
-
-#include <asm/mach/pci.h>
-#include <asm/mach-types.h>
-
-#include <asm/hardware/it8152.h>
-
-void __iomem *it8152_base_address;
-static int cmx2xx_it8152_irq_gpio;
-
-static void cmx2xx_it8152_irq_demux(struct irq_desc *desc)
-{
- /* clear our parent irq */
- desc->irq_data.chip->irq_ack(&desc->irq_data);
-
- it8152_irq_demux(desc);
-}
-
-void __cmx2xx_pci_init_irq(int irq_gpio)
-{
- it8152_init_irq();
-
- cmx2xx_it8152_irq_gpio = irq_gpio;
-
- irq_set_irq_type(gpio_to_irq(irq_gpio), IRQ_TYPE_EDGE_RISING);
-
- irq_set_chained_handler(gpio_to_irq(irq_gpio),
- cmx2xx_it8152_irq_demux);
-}
-
-#ifdef CONFIG_PM
-static unsigned long sleep_save_ite[10];
-
-void __cmx2xx_pci_suspend(void)
-{
- /* save ITE state */
- sleep_save_ite[0] = __raw_readl(IT8152_INTC_PDCNIMR);
- sleep_save_ite[1] = __raw_readl(IT8152_INTC_LPCNIMR);
- sleep_save_ite[2] = __raw_readl(IT8152_INTC_LPNIAR);
-
- /* Clear ITE IRQ's */
- __raw_writel((0), IT8152_INTC_PDCNIRR);
- __raw_writel((0), IT8152_INTC_LPCNIRR);
-}
-
-void __cmx2xx_pci_resume(void)
-{
- /* restore IT8152 state */
- __raw_writel((sleep_save_ite[0]), IT8152_INTC_PDCNIMR);
- __raw_writel((sleep_save_ite[1]), IT8152_INTC_LPCNIMR);
- __raw_writel((sleep_save_ite[2]), IT8152_INTC_LPNIAR);
-}
-#else
-void cmx2xx_pci_suspend(void) {}
-void cmx2xx_pci_resume(void) {}
-#endif
-
-/* PCI IRQ mapping*/
-static int __init cmx2xx_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
-{
- int irq;
-
- dev_dbg(&dev->dev, "%s: slot=%x, pin=%x\n", __func__, slot, pin);
-
- irq = it8152_pci_map_irq(dev, slot, pin);
- if (irq)
- return irq;
-
- /*
- Here comes the ugly part. The routing is baseboard specific,
- but defining a platform for each possible base of CM-X2XX is
- unrealistic. Here we keep mapping for ATXBase and SB-X2XX.
- */
- /* ATXBASE PCI slot */
- if (slot == 7)
- return IT8152_PCI_INTA;
-
- /* ATXBase/SB-X2XX CardBus */
- if (slot == 8 || slot == 0)
- return IT8152_PCI_INTB;
-
- /* ATXBase Ethernet */
- if (slot == 9)
- return IT8152_PCI_INTA;
-
- /* CM-x255 Onboard Ethernet */
- if (slot == 15)
- return IT8152_PCI_INTC;
-
- /* SB-x2xx Ethernet */
- if (slot == 16)
- return IT8152_PCI_INTA;
-
- /* PC104+ interrupt routing */
- if ((slot == 17) || (slot == 19))
- return IT8152_PCI_INTA;
- if ((slot == 18) || (slot == 20))
- return IT8152_PCI_INTB;
-
- return(0);
-}
-
-static void cmx2xx_pci_preinit(void)
-{
- pr_info("Initializing CM-X2XX PCI subsystem\n");
-
- pcibios_min_io = 0;
- pcibios_min_mem = 0;
-
- __raw_writel(0x800, IT8152_PCI_CFG_ADDR);
- if (__raw_readl(IT8152_PCI_CFG_DATA) == 0x81521283) {
- pr_info("PCI Bridge found.\n");
-
- /* set PCI I/O base at 0 */
- writel(0x848, IT8152_PCI_CFG_ADDR);
- writel(0, IT8152_PCI_CFG_DATA);
-
- /* set PCI memory base at 0 */
- writel(0x840, IT8152_PCI_CFG_ADDR);
- writel(0, IT8152_PCI_CFG_DATA);
-
- writel(0x20, IT8152_GPIO_GPDR);
-
- /* CardBus Controller on ATXbase baseboard */
- writel(0x4000, IT8152_PCI_CFG_ADDR);
- if (readl(IT8152_PCI_CFG_DATA) == 0xAC51104C) {
- pr_info("CardBus Bridge found.\n");
-
- /* Configure socket 0 */
- writel(0x408C, IT8152_PCI_CFG_ADDR);
- writel(0x1022, IT8152_PCI_CFG_DATA);
-
- writel(0x4080, IT8152_PCI_CFG_ADDR);
- writel(0x3844d060, IT8152_PCI_CFG_DATA);
-
- writel(0x4090, IT8152_PCI_CFG_ADDR);
- writel(((readl(IT8152_PCI_CFG_DATA) & 0xffff) |
- 0x60440000),
- IT8152_PCI_CFG_DATA);
-
- writel(0x4018, IT8152_PCI_CFG_ADDR);
- writel(0xb0000000, IT8152_PCI_CFG_DATA);
-
- /* Configure socket 1 */
- writel(0x418C, IT8152_PCI_CFG_ADDR);
- writel(0x1022, IT8152_PCI_CFG_DATA);
-
- writel(0x4180, IT8152_PCI_CFG_ADDR);
- writel(0x3844d060, IT8152_PCI_CFG_DATA);
-
- writel(0x4190, IT8152_PCI_CFG_ADDR);
- writel(((readl(IT8152_PCI_CFG_DATA) & 0xffff) |
- 0x60440000),
- IT8152_PCI_CFG_DATA);
-
- writel(0x4118, IT8152_PCI_CFG_ADDR);
- writel(0xb0000000, IT8152_PCI_CFG_DATA);
- }
- }
-}
-
-static struct hw_pci cmx2xx_pci __initdata = {
- .map_irq = cmx2xx_pci_map_irq,
- .nr_controllers = 1,
- .ops = &it8152_ops,
- .setup = it8152_pci_setup,
- .preinit = cmx2xx_pci_preinit,
-};
-
-static int __init cmx2xx_init_pci(void)
-{
- if (machine_is_armcore())
- pci_common_init(&cmx2xx_pci);
-
- return 0;
-}
-
-subsys_initcall(cmx2xx_init_pci);
diff --git a/arch/arm/mach-pxa/cm-x2xx-pci.h b/arch/arm/mach-pxa/cm-x2xx-pci.h
deleted file mode 100644
index 93ffaaee75d7..000000000000
--- a/arch/arm/mach-pxa/cm-x2xx-pci.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-extern void __cmx2xx_pci_init_irq(int irq_gpio);
-extern void __cmx2xx_pci_suspend(void);
-extern void __cmx2xx_pci_resume(void);
-
-#ifdef CONFIG_PCI
-#define cmx2xx_pci_init_irq(x) __cmx2xx_pci_init_irq(x)
-#define cmx2xx_pci_suspend(x) __cmx2xx_pci_suspend(x)
-#define cmx2xx_pci_resume(x) __cmx2xx_pci_resume(x)
-#else
-#define cmx2xx_pci_init_irq(x) do {} while (0)
-#define cmx2xx_pci_suspend(x) do {} while (0)
-#define cmx2xx_pci_resume(x) do {} while (0)
-#endif
diff --git a/arch/arm/mach-pxa/cm-x2xx.c b/arch/arm/mach-pxa/cm-x2xx.c
deleted file mode 100644
index ff976d1217eb..000000000000
--- a/arch/arm/mach-pxa/cm-x2xx.c
+++ /dev/null
@@ -1,538 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * linux/arch/arm/mach-pxa/cm-x2xx.c
- *
- * Copyright (C) 2008 CompuLab, Ltd.
- * Mike Rapoport <mike@compulab.co.il>
- */
-
-#include <linux/platform_device.h>
-#include <linux/syscore_ops.h>
-#include <linux/irq.h>
-#include <linux/gpio.h>
-#include <linux/regulator/machine.h>
-
-#include <linux/dm9000.h>
-#include <linux/leds.h>
-
-#include <asm/mach/arch.h>
-#include <asm/mach-types.h>
-#include <asm/mach/map.h>
-
-#include "pxa25x.h"
-#undef GPIO24_SSP1_SFRM
-#undef GPIO86_GPIO
-#undef GPIO87_GPIO
-#undef GPIO88_GPIO
-#undef GPIO89_GPIO
-#include "pxa27x.h"
-#undef GPIO24_SSP1_SFRM
-#undef GPIO86_GPIO
-#undef GPIO87_GPIO
-#undef GPIO88_GPIO
-#undef GPIO89_GPIO
-#include <mach/audio.h>
-#include <linux/platform_data/video-pxafb.h>
-#include <mach/smemc.h>
-
-#include <asm/hardware/it8152.h>
-
-#include "generic.h"
-#include "cm-x2xx-pci.h"
-
-extern void cmx255_init(void);
-extern void cmx270_init(void);
-
-/* reserve IRQs for IT8152 */
-#define CMX2XX_NR_IRQS (IRQ_BOARD_START + 40)
-
-/* virtual addresses for statically mapped regions */
-#define CMX2XX_VIRT_BASE (void __iomem *)(0xe8000000)
-#define CMX2XX_IT8152_VIRT (CMX2XX_VIRT_BASE)
-
-/* physical address if local-bus attached devices */
-#define CMX255_DM9000_PHYS_BASE (PXA_CS1_PHYS + (8 << 22))
-#define CMX270_DM9000_PHYS_BASE (PXA_CS1_PHYS + (6 << 22))
-
-/* leds */
-#define CMX255_GPIO_RED (27)
-#define CMX255_GPIO_GREEN (32)
-#define CMX270_GPIO_RED (93)
-#define CMX270_GPIO_GREEN (94)
-
-/* GPIO IRQ usage */
-#define GPIO22_ETHIRQ (22)
-#define GPIO10_ETHIRQ (10)
-#define CMX255_GPIO_IT8152_IRQ (0)
-#define CMX270_GPIO_IT8152_IRQ (22)
-
-#define CMX255_ETHIRQ PXA_GPIO_TO_IRQ(GPIO22_ETHIRQ)
-#define CMX270_ETHIRQ PXA_GPIO_TO_IRQ(GPIO10_ETHIRQ)
-
-#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
-static struct resource cmx255_dm9000_resource[] = {
- [0] = {
- .start = CMX255_DM9000_PHYS_BASE,
- .end = CMX255_DM9000_PHYS_BASE + 3,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = CMX255_DM9000_PHYS_BASE + 4,
- .end = CMX255_DM9000_PHYS_BASE + 4 + 500,
- .flags = IORESOURCE_MEM,
- },
- [2] = {
- .start = CMX255_ETHIRQ,
- .end = CMX255_ETHIRQ,
- .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
- }
-};
-
-static struct resource cmx270_dm9000_resource[] = {
- [0] = {
- .start = CMX270_DM9000_PHYS_BASE,
- .end = CMX270_DM9000_PHYS_BASE + 3,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = CMX270_DM9000_PHYS_BASE + 8,
- .end = CMX270_DM9000_PHYS_BASE + 8 + 500,
- .flags = IORESOURCE_MEM,
- },
- [2] = {
- .start = CMX270_ETHIRQ,
- .end = CMX270_ETHIRQ,
- .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
- }
-};
-
-static struct dm9000_plat_data cmx270_dm9000_platdata = {
- .flags = DM9000_PLATF_32BITONLY | DM9000_PLATF_NO_EEPROM,
-};
-
-static struct platform_device cmx2xx_dm9000_device = {
- .name = "dm9000",
- .id = 0,
- .num_resources = ARRAY_SIZE(cmx270_dm9000_resource),
- .dev = {
- .platform_data = &cmx270_dm9000_platdata,
- }
-};
-
-static void __init cmx2xx_init_dm9000(void)
-{
- if (cpu_is_pxa25x())
- cmx2xx_dm9000_device.resource = cmx255_dm9000_resource;
- else
- cmx2xx_dm9000_device.resource = cmx270_dm9000_resource;
- platform_device_register(&cmx2xx_dm9000_device);
-}
-#else
-static inline void cmx2xx_init_dm9000(void) {}
-#endif
-
-/* UCB1400 touchscreen controller */
-#if defined(CONFIG_TOUCHSCREEN_UCB1400) || defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
-static struct platform_device cmx2xx_ts_device = {
- .name = "ucb1400_core",
- .id = -1,
-};
-
-static void __init cmx2xx_init_touchscreen(void)
-{
- platform_device_register(&cmx2xx_ts_device);
-}
-#else
-static inline void cmx2xx_init_touchscreen(void) {}
-#endif
-
-/* CM-X270 LEDs */
-#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
-static struct gpio_led cmx2xx_leds[] = {
- [0] = {
- .name = "cm-x2xx:red",
- .default_trigger = "nand-disk",
- .active_low = 1,
- },
- [1] = {
- .name = "cm-x2xx:green",
- .default_trigger = "heartbeat",
- .active_low = 1,
- },
-};
-
-static struct gpio_led_platform_data cmx2xx_gpio_led_pdata = {
- .num_leds = ARRAY_SIZE(cmx2xx_leds),
- .leds = cmx2xx_leds,
-};
-
-static struct platform_device cmx2xx_led_device = {
- .name = "leds-gpio",
- .id = -1,
- .dev = {
- .platform_data = &cmx2xx_gpio_led_pdata,
- },
-};
-
-static void __init cmx2xx_init_leds(void)
-{
- if (cpu_is_pxa25x()) {
- cmx2xx_leds[0].gpio = CMX255_GPIO_RED;
- cmx2xx_leds[1].gpio = CMX255_GPIO_GREEN;
- } else {
- cmx2xx_leds[0].gpio = CMX270_GPIO_RED;
- cmx2xx_leds[1].gpio = CMX270_GPIO_GREEN;
- }
- platform_device_register(&cmx2xx_led_device);
-}
-#else
-static inline void cmx2xx_init_leds(void) {}
-#endif
-
-#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
-/*
- Display definitions
- keep these for backwards compatibility, although symbolic names (as
- e.g. in lpd270.c) looks better
-*/
-#define MTYPE_STN320x240 0
-#define MTYPE_TFT640x480 1
-#define MTYPE_CRT640x480 2
-#define MTYPE_CRT800x600 3
-#define MTYPE_TFT320x240 6
-#define MTYPE_STN640x480 7
-
-static struct pxafb_mode_info generic_stn_320x240_mode = {
- .pixclock = 76923,
- .bpp = 8,
- .xres = 320,
- .yres = 240,
- .hsync_len = 3,
- .vsync_len = 2,
- .left_margin = 3,
- .upper_margin = 0,
- .right_margin = 3,
- .lower_margin = 0,
- .sync = (FB_SYNC_HOR_HIGH_ACT |
- FB_SYNC_VERT_HIGH_ACT),
- .cmap_greyscale = 0,
-};
-
-static struct pxafb_mach_info generic_stn_320x240 = {
- .modes = &generic_stn_320x240_mode,
- .num_modes = 1,
- .lcd_conn = LCD_COLOR_STN_8BPP | LCD_PCLK_EDGE_FALL |\
- LCD_AC_BIAS_FREQ(0xff),
- .cmap_inverse = 0,
- .cmap_static = 0,
-};
-
-static struct pxafb_mode_info generic_tft_640x480_mode = {
- .pixclock = 38461,
- .bpp = 8,
- .xres = 640,
- .yres = 480,
- .hsync_len = 60,
- .vsync_len = 2,
- .left_margin = 70,
- .upper_margin = 10,
- .right_margin = 70,
- .lower_margin = 5,
- .sync = 0,
- .cmap_greyscale = 0,
-};
-
-static struct pxafb_mach_info generic_tft_640x480 = {
- .modes = &generic_tft_640x480_mode,
- .num_modes = 1,
- .lcd_conn = LCD_COLOR_TFT_8BPP | LCD_PCLK_EDGE_FALL |\
- LCD_AC_BIAS_FREQ(0xff),
- .cmap_inverse = 0,
- .cmap_static = 0,
-};
-
-static struct pxafb_mode_info generic_crt_640x480_mode = {
- .pixclock = 38461,
- .bpp = 8,
- .xres = 640,
- .yres = 480,
- .hsync_len = 63,
- .vsync_len = 2,
- .left_margin = 81,
- .upper_margin = 33,
- .right_margin = 16,
- .lower_margin = 10,
- .sync = (FB_SYNC_HOR_HIGH_ACT |
- FB_SYNC_VERT_HIGH_ACT),
- .cmap_greyscale = 0,
-};
-
-static struct pxafb_mach_info generic_crt_640x480 = {
- .modes = &generic_crt_640x480_mode,
- .num_modes = 1,
- .lcd_conn = LCD_COLOR_TFT_8BPP | LCD_AC_BIAS_FREQ(0xff),
- .cmap_inverse = 0,
- .cmap_static = 0,
-};
-
-static struct pxafb_mode_info generic_crt_800x600_mode = {
- .pixclock = 28846,
- .bpp = 8,
- .xres = 800,
- .yres = 600,
- .hsync_len = 63,
- .vsync_len = 2,
- .left_margin = 26,
- .upper_margin = 21,
- .right_margin = 26,
- .lower_margin = 11,
- .sync = (FB_SYNC_HOR_HIGH_ACT |
- FB_SYNC_VERT_HIGH_ACT),
- .cmap_greyscale = 0,
-};
-
-static struct pxafb_mach_info generic_crt_800x600 = {
- .modes = &generic_crt_800x600_mode,
- .num_modes = 1,
- .lcd_conn = LCD_COLOR_TFT_8BPP | LCD_AC_BIAS_FREQ(0xff),
- .cmap_inverse = 0,
- .cmap_static = 0,
-};
-
-static struct pxafb_mode_info generic_tft_320x240_mode = {
- .pixclock = 134615,
- .bpp = 16,
- .xres = 320,
- .yres = 240,
- .hsync_len = 63,
- .vsync_len = 7,
- .left_margin = 75,
- .upper_margin = 0,
- .right_margin = 15,
- .lower_margin = 15,
- .sync = 0,
- .cmap_greyscale = 0,
-};
-
-static struct pxafb_mach_info generic_tft_320x240 = {
- .modes = &generic_tft_320x240_mode,
- .num_modes = 1,
- .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_AC_BIAS_FREQ(0xff),
- .cmap_inverse = 0,
- .cmap_static = 0,
-};
-
-static struct pxafb_mode_info generic_stn_640x480_mode = {
- .pixclock = 57692,
- .bpp = 8,
- .xres = 640,
- .yres = 480,
- .hsync_len = 4,
- .vsync_len = 2,
- .left_margin = 10,
- .upper_margin = 5,
- .right_margin = 10,
- .lower_margin = 5,
- .sync = (FB_SYNC_HOR_HIGH_ACT |
- FB_SYNC_VERT_HIGH_ACT),
- .cmap_greyscale = 0,
-};
-
-static struct pxafb_mach_info generic_stn_640x480 = {
- .modes = &generic_stn_640x480_mode,
- .num_modes = 1,
- .lcd_conn = LCD_COLOR_STN_8BPP | LCD_AC_BIAS_FREQ(0xff),
- .cmap_inverse = 0,
- .cmap_static = 0,
-};
-
-static struct pxafb_mach_info *cmx2xx_display = &generic_crt_640x480;
-
-static int __init cmx2xx_set_display(char *str)
-{
- int disp_type = simple_strtol(str, NULL, 0);
- switch (disp_type) {
- case MTYPE_STN320x240:
- cmx2xx_display = &generic_stn_320x240;
- break;
- case MTYPE_TFT640x480:
- cmx2xx_display = &generic_tft_640x480;
- break;
- case MTYPE_CRT640x480:
- cmx2xx_display = &generic_crt_640x480;
- break;
- case MTYPE_CRT800x600:
- cmx2xx_display = &generic_crt_800x600;
- break;
- case MTYPE_TFT320x240:
- cmx2xx_display = &generic_tft_320x240;
- break;
- case MTYPE_STN640x480:
- cmx2xx_display = &generic_stn_640x480;
- break;
- default: /* fallback to CRT 640x480 */
- cmx2xx_display = &generic_crt_640x480;
- break;
- }
- return 1;
-}
-
-/*
- This should be done really early to get proper configuration for
- frame buffer.
- Indeed, pxafb parameters can be used istead, but CM-X2XX bootloader
- has limitied line length for kernel command line, and also it will
- break compatibitlty with proprietary releases already in field.
-*/
-__setup("monitor=", cmx2xx_set_display);
-
-static void __init cmx2xx_init_display(void)
-{
- pxa_set_fb_info(NULL, cmx2xx_display);
-}
-#else
-static inline void cmx2xx_init_display(void) {}
-#endif
-
-#ifdef CONFIG_PM
-static unsigned long sleep_save_msc[10];
-
-static int cmx2xx_suspend(void)
-{
- cmx2xx_pci_suspend();
-
- /* save MSC registers */
- sleep_save_msc[0] = __raw_readl(MSC0);
- sleep_save_msc[1] = __raw_readl(MSC1);
- sleep_save_msc[2] = __raw_readl(MSC2);
-
- /* setup power saving mode registers */
- PCFR = 0x0;
- PSLR = 0xff400000;
- PMCR = 0x00000005;
- PWER = 0x80000000;
- PFER = 0x00000000;
- PRER = 0x00000000;
- PGSR0 = 0xC0018800;
- PGSR1 = 0x004F0002;
- PGSR2 = 0x6021C000;
- PGSR3 = 0x00020000;
-
- return 0;
-}
-
-static void cmx2xx_resume(void)
-{
- cmx2xx_pci_resume();
-
- /* restore MSC registers */
- __raw_writel(sleep_save_msc[0], MSC0);
- __raw_writel(sleep_save_msc[1], MSC1);
- __raw_writel(sleep_save_msc[2], MSC2);
-}
-
-static struct syscore_ops cmx2xx_pm_syscore_ops = {
- .resume = cmx2xx_resume,
- .suspend = cmx2xx_suspend,
-};
-
-static int __init cmx2xx_pm_init(void)
-{
- register_syscore_ops(&cmx2xx_pm_syscore_ops);
-
- return 0;
-}
-#else
-static int __init cmx2xx_pm_init(void) { return 0; }
-#endif
-
-#if defined(CONFIG_SND_PXA2XX_AC97) || defined(CONFIG_SND_PXA2XX_AC97_MODULE)
-static void __init cmx2xx_init_ac97(void)
-{
- pxa_set_ac97_info(NULL);
-}
-#else
-static inline void cmx2xx_init_ac97(void) {}
-#endif
-
-static void __init cmx2xx_init(void)
-{
- pxa_set_ffuart_info(NULL);
- pxa_set_btuart_info(NULL);
- pxa_set_stuart_info(NULL);
-
- cmx2xx_pm_init();
-
- if (cpu_is_pxa25x())
- cmx255_init();
- else
- cmx270_init();
-
- cmx2xx_init_dm9000();
- cmx2xx_init_display();
- cmx2xx_init_ac97();
- cmx2xx_init_touchscreen();
- cmx2xx_init_leds();
-
- regulator_has_full_constraints();
-}
-
-static void __init cmx2xx_init_irq(void)
-{
- if (cpu_is_pxa25x()) {
- pxa25x_init_irq();
- cmx2xx_pci_init_irq(CMX255_GPIO_IT8152_IRQ);
- } else {
- pxa27x_init_irq();
- cmx2xx_pci_init_irq(CMX270_GPIO_IT8152_IRQ);
- }
-}
-
-#ifdef CONFIG_PCI
-/* Map PCI companion statically */
-static struct map_desc cmx2xx_io_desc[] __initdata = {
- [0] = { /* PCI bridge */
- .virtual = (unsigned long)CMX2XX_IT8152_VIRT,
- .pfn = __phys_to_pfn(PXA_CS4_PHYS),
- .length = SZ_64M,
- .type = MT_DEVICE
- },
-};
-
-static void __init cmx2xx_map_io(void)
-{
- if (cpu_is_pxa25x())
- pxa25x_map_io();
-
- if (cpu_is_pxa27x())
- pxa27x_map_io();
-
- iotable_init(cmx2xx_io_desc, ARRAY_SIZE(cmx2xx_io_desc));
-
- it8152_base_address = CMX2XX_IT8152_VIRT;
-}
-#else
-static void __init cmx2xx_map_io(void)
-{
- if (cpu_is_pxa25x())
- pxa25x_map_io();
-
- if (cpu_is_pxa27x())
- pxa27x_map_io();
-}
-#endif
-
-MACHINE_START(ARMCORE, "Compulab CM-X2XX")
- .atag_offset = 0x100,
- .map_io = cmx2xx_map_io,
- .nr_irqs = CMX2XX_NR_IRQS,
- .init_irq = cmx2xx_init_irq,
- /* NOTE: pxa25x_handle_irq() works on PXA27x w/o camera support */
- .handle_irq = pxa25x_handle_irq,
- .init_time = pxa_timer_init,
- .init_machine = cmx2xx_init,
-#ifdef CONFIG_PCI
- .dma_zone_size = SZ_64M,
-#endif
- .restart = pxa_restart,
-MACHINE_END
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
deleted file mode 100644
index d8681a331030..000000000000
--- a/arch/arm/mach-pxa/em-x270.c
+++ /dev/null
@@ -1,1286 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Support for CompuLab EM-X270 platform
- *
- * Copyright (C) 2007, 2008 CompuLab, Ltd.
- * Author: Mike Rapoport <mike@compulab.co.il>
- */
-
-#include <linux/irq.h>
-#include <linux/platform_device.h>
-#include <linux/delay.h>
-
-#include <linux/dm9000.h>
-#include <linux/platform_data/rtc-v3020.h>
-#include <linux/mtd/platnand.h>
-#include <linux/mtd/physmap.h>
-#include <linux/input.h>
-#include <linux/gpio_keys.h>
-#include <linux/gpio.h>
-#include <linux/gpio/machine.h>
-#include <linux/mfd/da903x.h>
-#include <linux/regulator/machine.h>
-#include <linux/regulator/fixed.h>
-#include <linux/spi/spi.h>
-#include <linux/spi/tdo24m.h>
-#include <linux/spi/libertas_spi.h>
-#include <linux/spi/pxa2xx_spi.h>
-#include <linux/power_supply.h>
-#include <linux/apm-emulation.h>
-#include <linux/i2c.h>
-#include <linux/platform_data/pca953x.h>
-#include <linux/platform_data/i2c-pxa.h>
-#include <linux/regulator/userspace-consumer.h>
-
-#include <asm/mach-types.h>
-#include <asm/mach/arch.h>
-
-#include "pxa27x.h"
-#include "pxa27x-udc.h"
-#include <mach/audio.h>
-#include <linux/platform_data/video-pxafb.h>
-#include <linux/platform_data/usb-ohci-pxa27x.h>
-#include <linux/platform_data/mmc-pxamci.h>
-#include <linux/platform_data/keypad-pxa27x.h>
-#include <linux/platform_data/media/camera-pxa.h>
-
-#include "generic.h"
-#include "devices.h"
-
-/* EM-X270 specific GPIOs */
-#define GPIO13_MMC_CD (13)
-#define GPIO95_MMC_WP (95)
-#define GPIO56_NAND_RB (56)
-#define GPIO93_CAM_RESET (93)
-#define GPIO16_USB_HUB_RESET (16)
-
-/* eXeda specific GPIOs */
-#define GPIO114_MMC_CD (114)
-#define GPIO20_NAND_RB (20)
-#define GPIO38_SD_PWEN (38)
-#define GPIO37_WLAN_RST (37)
-#define GPIO95_TOUCHPAD_INT (95)
-#define GPIO130_CAM_RESET (130)
-#define GPIO10_USB_HUB_RESET (10)
-
-/* common GPIOs */
-#define GPIO11_NAND_CS (11)
-#define GPIO41_ETHIRQ (41)
-#define EM_X270_ETHIRQ PXA_GPIO_TO_IRQ(GPIO41_ETHIRQ)
-#define GPIO115_WLAN_PWEN (115)
-#define GPIO19_WLAN_STRAP (19)
-#define GPIO9_USB_VBUS_EN (9)
-
-static int mmc_cd;
-static int nand_rb;
-static int dm9000_flags;
-static int cam_reset;
-static int usb_hub_reset;
-
-static unsigned long common_pin_config[] = {
- /* AC'97 */
- GPIO28_AC97_BITCLK,
- GPIO29_AC97_SDATA_IN_0,
- GPIO30_AC97_SDATA_OUT,
- GPIO31_AC97_SYNC,
- GPIO98_AC97_SYSCLK,
- GPIO113_AC97_nRESET,
-
- /* BTUART */
- GPIO42_BTUART_RXD,
- GPIO43_BTUART_TXD,
- GPIO44_BTUART_CTS,
- GPIO45_BTUART_RTS,
-
- /* STUART */
- GPIO46_STUART_RXD,
- GPIO47_STUART_TXD,
-
- /* MCI controller */
- GPIO32_MMC_CLK,
- GPIO112_MMC_CMD,
- GPIO92_MMC_DAT_0,
- GPIO109_MMC_DAT_1,
- GPIO110_MMC_DAT_2,
- GPIO111_MMC_DAT_3,
-
- /* LCD */
- GPIOxx_LCD_TFT_16BPP,
-
- /* QCI */
- GPIO84_CIF_FV,
- GPIO25_CIF_LV,
- GPIO53_CIF_MCLK,
- GPIO54_CIF_PCLK,
- GPIO81_CIF_DD_0,
- GPIO55_CIF_DD_1,
- GPIO51_CIF_DD_2,
- GPIO50_CIF_DD_3,
- GPIO52_CIF_DD_4,
- GPIO48_CIF_DD_5,
- GPIO17_CIF_DD_6,
- GPIO12_CIF_DD_7,
-
- /* I2C */
- GPIO117_I2C_SCL,
- GPIO118_I2C_SDA,
-
- /* Keypad */
- GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
- GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH,
- GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH,
- GPIO34_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH,
- GPIO39_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH,
- GPIO99_KP_MKIN_5 | WAKEUP_ON_LEVEL_HIGH,
- GPIO91_KP_MKIN_6 | WAKEUP_ON_LEVEL_HIGH,
- GPIO36_KP_MKIN_7 | WAKEUP_ON_LEVEL_HIGH,
- GPIO103_KP_MKOUT_0,
- GPIO104_KP_MKOUT_1,
- GPIO105_KP_MKOUT_2,
- GPIO106_KP_MKOUT_3,
- GPIO107_KP_MKOUT_4,
- GPIO108_KP_MKOUT_5,
- GPIO96_KP_MKOUT_6,
- GPIO22_KP_MKOUT_7,
-
- /* SSP1 */
- GPIO26_SSP1_RXD,
- GPIO23_SSP1_SCLK,
- GPIO24_SSP1_SFRM,
- GPIO57_SSP1_TXD,
-
- /* SSP2 */
- GPIO19_GPIO, /* SSP2 clock is used as GPIO for Libertas pin-strap */
- GPIO14_GPIO,
- GPIO89_SSP2_TXD,
- GPIO88_SSP2_RXD,
-
- /* SDRAM and local bus */
- GPIO15_nCS_1,
- GPIO78_nCS_2,
- GPIO79_nCS_3,
- GPIO80_nCS_4,
- GPIO49_nPWE,
- GPIO18_RDY,
-
- /* GPIO */
- GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, /* sleep/resume button */
-
- /* power controls */
- GPIO20_GPIO | MFP_LPM_DRIVE_LOW, /* GPRS_PWEN */
- GPIO115_GPIO | MFP_LPM_DRIVE_LOW, /* WLAN_PWEN */
-
- /* NAND controls */
- GPIO11_GPIO | MFP_LPM_DRIVE_HIGH, /* NAND CE# */
-
- /* interrupts */
- GPIO41_GPIO, /* DM9000 interrupt */
-};
-
-static unsigned long em_x270_pin_config[] = {
- GPIO13_GPIO, /* MMC card detect */
- GPIO16_GPIO, /* USB hub reset */
- GPIO56_GPIO, /* NAND Ready/Busy */
- GPIO93_GPIO | MFP_LPM_DRIVE_LOW, /* Camera reset */
- GPIO95_GPIO, /* MMC Write protect */
-};
-
-static unsigned long exeda_pin_config[] = {
- GPIO10_GPIO, /* USB hub reset */
- GPIO20_GPIO, /* NAND Ready/Busy */
- GPIO38_GPIO | MFP_LPM_DRIVE_LOW, /* SD slot power */
- GPIO95_GPIO, /* touchpad IRQ */
- GPIO114_GPIO, /* MMC card detect */
-};
-
-#if defined(CONFIG_DM9000) || defined(CONFIG_DM9000_MODULE)
-static struct resource em_x270_dm9000_resource[] = {
- [0] = {
- .start = PXA_CS2_PHYS,
- .end = PXA_CS2_PHYS + 3,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = PXA_CS2_PHYS + 8,
- .end = PXA_CS2_PHYS + 8 + 0x3f,
- .flags = IORESOURCE_MEM,
- },
- [2] = {
- .start = EM_X270_ETHIRQ,
- .end = EM_X270_ETHIRQ,
- .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
- }
-};
-
-static struct dm9000_plat_data em_x270_dm9000_platdata = {
- .flags = DM9000_PLATF_NO_EEPROM,
-};
-
-static struct platform_device em_x270_dm9000 = {
- .name = "dm9000",
- .id = 0,
- .num_resources = ARRAY_SIZE(em_x270_dm9000_resource),
- .resource = em_x270_dm9000_resource,
- .dev = {
- .platform_data = &em_x270_dm9000_platdata,
- }
-};
-
-static void __init em_x270_init_dm9000(void)
-{
- em_x270_dm9000_platdata.flags |= dm9000_flags;
- platform_device_register(&em_x270_dm9000);
-}
-#else
-static inline void em_x270_init_dm9000(void) {}
-#endif
-
-/* V3020 RTC */
-#if defined(CONFIG_RTC_DRV_V3020) || defined(CONFIG_RTC_DRV_V3020_MODULE)
-static struct resource em_x270_v3020_resource[] = {
- [0] = {
- .start = PXA_CS4_PHYS,
- .end = PXA_CS4_PHYS + 3,
- .flags = IORESOURCE_MEM,
- },
-};
-
-static struct v3020_platform_data em_x270_v3020_platdata = {
- .leftshift = 0,
-};
-
-static struct platform_device em_x270_rtc = {
- .name = "v3020",
- .num_resources = ARRAY_SIZE(em_x270_v3020_resource),
- .resource = em_x270_v3020_resource,
- .id = -1,
- .dev = {
- .platform_data = &em_x270_v3020_platdata,
- }
-};
-
-static void __init em_x270_init_rtc(void)
-{
- platform_device_register(&em_x270_rtc);
-}
-#else
-static inline void em_x270_init_rtc(void) {}
-#endif
-
-/* NAND flash */
-#if defined(CONFIG_MTD_NAND_PLATFORM) || defined(CONFIG_MTD_NAND_PLATFORM_MODULE)
-static inline void nand_cs_on(void)
-{
- gpio_set_value(GPIO11_NAND_CS, 0);
-}
-
-static void nand_cs_off(void)
-{
- dsb();
-
- gpio_set_value(GPIO11_NAND_CS, 1);
-}
-
-/* hardware specific access to control-lines */
-static void em_x270_nand_cmd_ctl(struct nand_chip *this, int dat,
- unsigned int ctrl)
-{
- unsigned long nandaddr = (unsigned long)this->legacy.IO_ADDR_W;
-
- dsb();
-
- if (ctrl & NAND_CTRL_CHANGE) {
- if (ctrl & NAND_ALE)
- nandaddr |= (1 << 3);
- else
- nandaddr &= ~(1 << 3);
- if (ctrl & NAND_CLE)
- nandaddr |= (1 << 2);
- else
- nandaddr &= ~(1 << 2);
- if (ctrl & NAND_NCE)
- nand_cs_on();
- else
- nand_cs_off();
- }
-
- dsb();
- this->legacy.IO_ADDR_W = (void __iomem *)nandaddr;
- if (dat != NAND_CMD_NONE)
- writel(dat, this->legacy.IO_ADDR_W);
-
- dsb();
-}
-
-/* read device ready pin */
-static int em_x270_nand_device_ready(struct nand_chip *this)
-{
- dsb();
-
- return gpio_get_value(nand_rb);
-}
-
-static struct mtd_partition em_x270_partition_info[] = {
- [0] = {
- .name = "em_x270-0",
- .offset = 0,
- .size = SZ_4M,
- },
- [1] = {
- .name = "em_x270-1",
- .offset = MTDPART_OFS_APPEND,
- .size = MTDPART_SIZ_FULL
- },
-};
-
-struct platform_nand_data em_x270_nand_platdata = {
- .chip = {
- .nr_chips = 1,
- .chip_offset = 0,
- .nr_partitions = ARRAY_SIZE(em_x270_partition_info),
- .partitions = em_x270_partition_info,
- .chip_delay = 20,
- },
- .ctrl = {
- .dev_ready = em_x270_nand_device_ready,
- .select_chip = 0,
- .cmd_ctrl = em_x270_nand_cmd_ctl,
- },
-};
-
-static struct resource em_x270_nand_resource[] = {
- [0] = {
- .start = PXA_CS1_PHYS,
- .end = PXA_CS1_PHYS + 12,
- .flags = IORESOURCE_MEM,
- },
-};
-
-static struct platform_device em_x270_nand = {
- .name = "gen_nand",
- .num_resources = ARRAY_SIZE(em_x270_nand_resource),
- .resource = em_x270_nand_resource,
- .id = -1,
- .dev = {
- .platform_data = &em_x270_nand_platdata,
- }
-};
-
-static void __init em_x270_init_nand(void)
-{
- int err;
-
- err = gpio_request(GPIO11_NAND_CS, "NAND CS");
- if (err) {
- pr_warn("EM-X270: failed to request NAND CS gpio\n");
- return;
- }
-
- gpio_direction_output(GPIO11_NAND_CS, 1);
-
- err = gpio_request(nand_rb, "NAND R/B");
- if (err) {
- pr_warn("EM-X270: failed to request NAND R/B gpio\n");
- gpio_free(GPIO11_NAND_CS);
- return;
- }
-
- gpio_direction_input(nand_rb);
-
- platform_device_register(&em_x270_nand);
-}
-#else
-static inline void em_x270_init_nand(void) {}
-#endif
-
-#if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
-static struct mtd_partition em_x270_nor_parts[] = {
- {
- .name = "Bootloader",
- .offset = 0x00000000,
- .size = 0x00050000,
- .mask_flags = MTD_WRITEABLE /* force read-only */
- }, {
- .name = "Environment",
- .offset = 0x00050000,
- .size = 0x00010000,
- }, {
- .name = "Reserved",
- .offset = 0x00060000,
- .size = 0x00050000,
- .mask_flags = MTD_WRITEABLE /* force read-only */
- }, {
- .name = "Splashscreen",
- .offset = 0x000b0000,
- .size = 0x00050000,
- }
-};
-
-static struct physmap_flash_data em_x270_nor_data[] = {
- [0] = {
- .width = 2,
- .parts = em_x270_nor_parts,
- .nr_parts = ARRAY_SIZE(em_x270_nor_parts),
- },
-};
-
-static struct resource em_x270_nor_flash_resource = {
- .start = PXA_CS0_PHYS,
- .end = PXA_CS0_PHYS + SZ_1M - 1,
- .flags = IORESOURCE_MEM,
-};
-
-static struct platform_device em_x270_physmap_flash = {
- .name = "physmap-flash",
- .id = 0,
- .num_resources = 1,
- .resource = &em_x270_nor_flash_resource,
- .dev = {
- .platform_data = &em_x270_nor_data,
- },
-};
-
-static void __init em_x270_init_nor(void)
-{
- platform_device_register(&em_x270_physmap_flash);
-}
-#else
-static inline void em_x270_init_nor(void) {}
-#endif
-
-/* PXA27x OHCI controller setup */
-#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
-static struct regulator *em_x270_usb_ldo;
-
-static int em_x270_usb_hub_init(void)
-{
- int err;
-
- em_x270_usb_ldo = regulator_get(NULL, "vcc usb");
- if (IS_ERR(em_x270_usb_ldo))
- return PTR_ERR(em_x270_usb_ldo);
-
- err = gpio_request(GPIO9_USB_VBUS_EN, "vbus en");
- if (err)
- goto err_free_usb_ldo;
-
- err = gpio_request(usb_hub_reset, "hub rst");
- if (err)
- goto err_free_vbus_gpio;
-
- /* USB Hub power-on and reset */
- gpio_direction_output(usb_hub_reset, 1);
- gpio_direction_output(GPIO9_USB_VBUS_EN, 0);
- err = regulator_enable(em_x270_usb_ldo);
- if (err)
- goto err_free_rst_gpio;
-
- gpio_set_value(usb_hub_reset, 0);
- gpio_set_value(usb_hub_reset, 1);
- regulator_disable(em_x270_usb_ldo);
- err = regulator_enable(em_x270_usb_ldo);
- if (err)
- goto err_free_rst_gpio;
-
- gpio_set_value(usb_hub_reset, 0);
- gpio_set_value(GPIO9_USB_VBUS_EN, 1);
-
- return 0;
-
-err_free_rst_gpio:
- gpio_free(usb_hub_reset);
-err_free_vbus_gpio:
- gpio_free(GPIO9_USB_VBUS_EN);
-err_free_usb_ldo:
- regulator_put(em_x270_usb_ldo);
-
- return err;
-}
-
-static int em_x270_ohci_init(struct device *dev)
-{
- int err;
-
- /* we don't want to entirely disable USB if the HUB init failed */
- err = em_x270_usb_hub_init();
- if (err)
- pr_err("USB Hub initialization failed: %d\n", err);
-
- /* enable port 2 transiever */
- UP2OCR = UP2OCR_HXS | UP2OCR_HXOE;
-
- return 0;
-}
-
-static void em_x270_ohci_exit(struct device *dev)
-{
- gpio_free(usb_hub_reset);
- gpio_free(GPIO9_USB_VBUS_EN);
-
- if (!IS_ERR(em_x270_usb_ldo)) {
- if (regulator_is_enabled(em_x270_usb_ldo))
- regulator_disable(em_x270_usb_ldo);
-
- regulator_put(em_x270_usb_ldo);
- }
-}
-
-static struct pxaohci_platform_data em_x270_ohci_platform_data = {
- .port_mode = PMM_PERPORT_MODE,
- .flags = ENABLE_PORT1 | ENABLE_PORT2 | POWER_CONTROL_LOW,
- .init = em_x270_ohci_init,
- .exit = em_x270_ohci_exit,
-};
-
-static void __init em_x270_init_ohci(void)
-{
- pxa_set_ohci_info(&em_x270_ohci_platform_data);
-}
-#else
-static inline void em_x270_init_ohci(void) {}
-#endif
-
-/* MCI controller setup */
-#if defined(CONFIG_MMC) || defined(CONFIG_MMC_MODULE)
-static struct regulator *em_x270_sdio_ldo;
-
-static struct gpiod_lookup_table em_x270_mci_wp_gpio_table = {
- .dev_id = "pxa2xx-mci.0",
- .table = {
- /* Write protect on GPIO 95 */
- GPIO_LOOKUP("gpio-pxa", GPIO95_MMC_WP, "wp", GPIO_ACTIVE_LOW),
- { },
- },
-};
-
-static int em_x270_mci_init(struct device *dev,
- irq_handler_t em_x270_detect_int,
- void *data)
-{
- int err;
-
- em_x270_sdio_ldo = regulator_get(dev, "vcc sdio");
- if (IS_ERR(em_x270_sdio_ldo)) {
- dev_err(dev, "can't request SDIO power supply: %ld\n",
- PTR_ERR(em_x270_sdio_ldo));
- return PTR_ERR(em_x270_sdio_ldo);
- }
-
- err = request_irq(gpio_to_irq(mmc_cd), em_x270_detect_int,
- IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
- "MMC card detect", data);
- if (err) {
- dev_err(dev, "can't request MMC card detect IRQ: %d\n", err);
- goto err_irq;
- }
-
- if (!machine_is_em_x270()) {
- err = gpio_request(GPIO38_SD_PWEN, "sdio power");
- if (err) {
- dev_err(dev, "can't request MMC power control : %d\n",
- err);
- goto err_gpio_wp;
- }
- gpio_direction_output(GPIO38_SD_PWEN, 1);
- }
-
- return 0;
-
-err_gpio_wp:
- free_irq(gpio_to_irq(mmc_cd), data);
-err_irq:
- regulator_put(em_x270_sdio_ldo);
-
- return err;
-}
-
-static int em_x270_mci_setpower(struct device *dev, unsigned int vdd)
-{
- struct pxamci_platform_data* p_d = dev->platform_data;
-
- if ((1 << vdd) & p_d->ocr_mask) {
- int vdd_uV = (2000 + (vdd - __ffs(MMC_VDD_20_21)) * 100) * 1000;
-
- regulator_set_voltage(em_x270_sdio_ldo, vdd_uV, vdd_uV);
- return regulator_enable(em_x270_sdio_ldo);
- } else {
- regulator_disable(em_x270_sdio_ldo);
- }
- return 0;
-}
-
-static void em_x270_mci_exit(struct device *dev, void *data)
-{
- free_irq(gpio_to_irq(mmc_cd), data);
- regulator_put(em_x270_sdio_ldo);
-
- if (!machine_is_em_x270())
- gpio_free(GPIO38_SD_PWEN);
-}
-
-static struct pxamci_platform_data em_x270_mci_platform_data = {
- .detect_delay_ms = 250,
- .ocr_mask = MMC_VDD_20_21|MMC_VDD_21_22|MMC_VDD_22_23|
- MMC_VDD_24_25|MMC_VDD_25_26|MMC_VDD_26_27|
- MMC_VDD_27_28|MMC_VDD_28_29|MMC_VDD_29_30|
- MMC_VDD_30_31|MMC_VDD_31_32,
- .init = em_x270_mci_init,
- .setpower = em_x270_mci_setpower,
- .exit = em_x270_mci_exit,
-};
-
-static void __init em_x270_init_mmc(void)
-{
- if (machine_is_em_x270())
- gpiod_add_lookup_table(&em_x270_mci_wp_gpio_table);
-
- pxa_set_mci_info(&em_x270_mci_platform_data);
-}
-#else
-static inline void em_x270_init_mmc(void) {}
-#endif
-
-/* LCD */
-#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
-static struct pxafb_mode_info em_x270_lcd_modes[] = {
- [0] = {
- .pixclock = 38250,
- .bpp = 16,
- .xres = 480,
- .yres = 640,
- .hsync_len = 8,
- .vsync_len = 2,
- .left_margin = 8,
- .upper_margin = 2,
- .right_margin = 24,
- .lower_margin = 4,
- .sync = 0,
- },
- [1] = {
- .pixclock = 153800,
- .bpp = 16,
- .xres = 240,
- .yres = 320,
- .hsync_len = 8,
- .vsync_len = 2,
- .left_margin = 8,
- .upper_margin = 2,
- .right_margin = 88,
- .lower_margin = 2,
- .sync = 0,
- },
-};
-
-static struct pxafb_mach_info em_x270_lcd = {
- .modes = em_x270_lcd_modes,
- .num_modes = 2,
- .lcd_conn = LCD_COLOR_TFT_16BPP,
-};
-
-static void __init em_x270_init_lcd(void)
-{
- pxa_set_fb_info(NULL, &em_x270_lcd);
-}
-#else
-static inline void em_x270_init_lcd(void) {}
-#endif
-
-#if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
-static struct pxa2xx_spi_controller em_x270_spi_info = {
- .num_chipselect = 1,
-};
-
-static struct pxa2xx_spi_chip em_x270_tdo24m_chip = {
- .rx_threshold = 1,
- .tx_threshold = 1,
- .gpio_cs = -1,
-};
-
-static struct tdo24m_platform_data em_x270_tdo24m_pdata = {
- .model = TDO35S,
-};
-
-static struct pxa2xx_spi_controller em_x270_spi_2_info = {
- .num_chipselect = 1,
- .enable_dma = 1,
-};
-
-static struct pxa2xx_spi_chip em_x270_libertas_chip = {
- .rx_threshold = 1,
- .tx_threshold = 1,
- .timeout = 1000,
- .gpio_cs = 14,
-};
-
-static unsigned long em_x270_libertas_pin_config[] = {
- /* SSP2 */
- GPIO19_SSP2_SCLK,
- GPIO14_GPIO,
- GPIO89_SSP2_TXD,
- GPIO88_SSP2_RXD,
-};
-
-static int em_x270_libertas_setup(struct spi_device *spi)
-{
- int err = gpio_request(GPIO115_WLAN_PWEN, "WLAN PWEN");
- if (err)
- return err;
-
- err = gpio_request(GPIO19_WLAN_STRAP, "WLAN STRAP");
- if (err)
- goto err_free_pwen;
-
- if (machine_is_exeda()) {
- err = gpio_request(GPIO37_WLAN_RST, "WLAN RST");
- if (err)
- goto err_free_strap;
-
- gpio_direction_output(GPIO37_WLAN_RST, 1);
- msleep(100);
- }
-
- gpio_direction_output(GPIO19_WLAN_STRAP, 1);
- msleep(100);
-
- pxa2xx_mfp_config(ARRAY_AND_SIZE(em_x270_libertas_pin_config));
-
- gpio_direction_output(GPIO115_WLAN_PWEN, 0);
- msleep(100);
- gpio_set_value(GPIO115_WLAN_PWEN, 1);
- msleep(100);
-
- spi->bits_per_word = 16;
- spi_setup(spi);
-
- return 0;
-
-err_free_strap:
- gpio_free(GPIO19_WLAN_STRAP);
-err_free_pwen:
- gpio_free(GPIO115_WLAN_PWEN);
-
- return err;
-}
-
-static int em_x270_libertas_teardown(struct spi_device *spi)
-{
- gpio_set_value(GPIO115_WLAN_PWEN, 0);
- gpio_free(GPIO115_WLAN_PWEN);
- gpio_free(GPIO19_WLAN_STRAP);
-
- if (machine_is_exeda()) {
- gpio_set_value(GPIO37_WLAN_RST, 0);
- gpio_free(GPIO37_WLAN_RST);
- }
-
- return 0;
-}
-
-struct libertas_spi_platform_data em_x270_libertas_pdata = {
- .use_dummy_writes = 1,
- .setup = em_x270_libertas_setup,
- .teardown = em_x270_libertas_teardown,
-};
-
-static struct spi_board_info em_x270_spi_devices[] __initdata = {
- {
- .modalias = "tdo24m",
- .max_speed_hz = 1000000,
- .bus_num = 1,
- .chip_select = 0,
- .controller_data = &em_x270_tdo24m_chip,
- .platform_data = &em_x270_tdo24m_pdata,
- },
- {
- .modalias = "libertas_spi",
- .max_speed_hz = 13000000,
- .bus_num = 2,
- .irq = PXA_GPIO_TO_IRQ(116),
- .chip_select = 0,
- .controller_data = &em_x270_libertas_chip,
- .platform_data = &em_x270_libertas_pdata,
- },
-};
-
-static void __init em_x270_init_spi(void)
-{
- pxa2xx_set_spi_info(1, &em_x270_spi_info);
- pxa2xx_set_spi_info(2, &em_x270_spi_2_info);
- spi_register_board_info(ARRAY_AND_SIZE(em_x270_spi_devices));
-}
-#else
-static inline void em_x270_init_spi(void) {}
-#endif
-
-#if defined(CONFIG_SND_PXA2XX_LIB_AC97)
-static pxa2xx_audio_ops_t em_x270_ac97_info = {
- .reset_gpio = 113,
-};
-
-static void __init em_x270_init_ac97(void)
-{
- pxa_set_ac97_info(&em_x270_ac97_info);
-}
-#else
-static inline void em_x270_init_ac97(void) {}
-#endif
-
-#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
-static const unsigned int em_x270_module_matrix_keys[] = {
- KEY(0, 0, KEY_A), KEY(1, 0, KEY_UP), KEY(2, 1, KEY_B),
- KEY(0, 2, KEY_LEFT), KEY(1, 1, KEY_ENTER), KEY(2, 0, KEY_RIGHT),
- KEY(0, 1, KEY_C), KEY(1, 2, KEY_DOWN), KEY(2, 2, KEY_D),
-};
-
-static struct matrix_keymap_data em_x270_matrix_keymap_data = {
- .keymap = em_x270_module_matrix_keys,
- .keymap_size = ARRAY_SIZE(em_x270_module_matrix_keys),
-};
-
-struct pxa27x_keypad_platform_data em_x270_module_keypad_info = {
- /* code map for the matrix keys */
- .matrix_key_rows = 3,
- .matrix_key_cols = 3,
- .matrix_keymap_data = &em_x270_matrix_keymap_data,
-};
-
-static const unsigned int em_x270_exeda_matrix_keys[] = {
- KEY(0, 0, KEY_RIGHTSHIFT), KEY(0, 1, KEY_RIGHTCTRL),
- KEY(0, 2, KEY_RIGHTALT), KEY(0, 3, KEY_SPACE),
- KEY(0, 4, KEY_LEFTALT), KEY(0, 5, KEY_LEFTCTRL),
- KEY(0, 6, KEY_ENTER), KEY(0, 7, KEY_SLASH),
-
- KEY(1, 0, KEY_DOT), KEY(1, 1, KEY_M),
- KEY(1, 2, KEY_N), KEY(1, 3, KEY_B),
- KEY(1, 4, KEY_V), KEY(1, 5, KEY_C),
- KEY(1, 6, KEY_X), KEY(1, 7, KEY_Z),
-
- KEY(2, 0, KEY_LEFTSHIFT), KEY(2, 1, KEY_SEMICOLON),
- KEY(2, 2, KEY_L), KEY(2, 3, KEY_K),
- KEY(2, 4, KEY_J), KEY(2, 5, KEY_H),
- KEY(2, 6, KEY_G), KEY(2, 7, KEY_F),
-
- KEY(3, 0, KEY_D), KEY(3, 1, KEY_S),
- KEY(3, 2, KEY_A), KEY(3, 3, KEY_TAB),
- KEY(3, 4, KEY_BACKSPACE), KEY(3, 5, KEY_P),
- KEY(3, 6, KEY_O), KEY(3, 7, KEY_I),
-
- KEY(4, 0, KEY_U), KEY(4, 1, KEY_Y),
- KEY(4, 2, KEY_T), KEY(4, 3, KEY_R),
- KEY(4, 4, KEY_E), KEY(4, 5, KEY_W),
- KEY(4, 6, KEY_Q), KEY(4, 7, KEY_MINUS),
-
- KEY(5, 0, KEY_0), KEY(5, 1, KEY_9),
- KEY(5, 2, KEY_8), KEY(5, 3, KEY_7),
- KEY(5, 4, KEY_6), KEY(5, 5, KEY_5),
- KEY(5, 6, KEY_4), KEY(5, 7, KEY_3),
-
- KEY(6, 0, KEY_2), KEY(6, 1, KEY_1),
- KEY(6, 2, KEY_ENTER), KEY(6, 3, KEY_END),
- KEY(6, 4, KEY_DOWN), KEY(6, 5, KEY_UP),
- KEY(6, 6, KEY_MENU), KEY(6, 7, KEY_F1),
-
- KEY(7, 0, KEY_LEFT), KEY(7, 1, KEY_RIGHT),
- KEY(7, 2, KEY_BACK), KEY(7, 3, KEY_HOME),
- KEY(7, 4, 0), KEY(7, 5, 0),
- KEY(7, 6, 0), KEY(7, 7, 0),
-};
-
-static struct matrix_keymap_data em_x270_exeda_matrix_keymap_data = {
- .keymap = em_x270_exeda_matrix_keys,
- .keymap_size = ARRAY_SIZE(em_x270_exeda_matrix_keys),
-};
-
-struct pxa27x_keypad_platform_data em_x270_exeda_keypad_info = {
- /* code map for the matrix keys */
- .matrix_key_rows = 8,
- .matrix_key_cols = 8,
- .matrix_keymap_data = &em_x270_exeda_matrix_keymap_data,
-};
-
-static void __init em_x270_init_keypad(void)
-{
- if (machine_is_em_x270())
- pxa_set_keypad_info(&em_x270_module_keypad_info);
- else
- pxa_set_keypad_info(&em_x270_exeda_keypad_info);
-}
-#else
-static inline void em_x270_init_keypad(void) {}
-#endif
-
-#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
-static struct gpio_keys_button gpio_keys_button[] = {
- [0] = {
- .desc = "sleep/wakeup",
- .code = KEY_SUSPEND,
- .type = EV_PWR,
- .gpio = 1,
- .wakeup = 1,
- },
-};
-
-static struct gpio_keys_platform_data em_x270_gpio_keys_data = {
- .buttons = gpio_keys_button,
- .nbuttons = 1,
-};
-
-static struct platform_device em_x270_gpio_keys = {
- .name = "gpio-keys",
- .id = -1,
- .dev = {
- .platform_data = &em_x270_gpio_keys_data,
- },
-};
-
-static void __init em_x270_init_gpio_keys(void)
-{
- platform_device_register(&em_x270_gpio_keys);
-}
-#else
-static inline void em_x270_init_gpio_keys(void) {}
-#endif
-
-/* Quick Capture Interface and sensor setup */
-#if defined(CONFIG_VIDEO_PXA27x) || defined(CONFIG_VIDEO_PXA27x_MODULE)
-static int em_x270_sensor_init(void)
-{
- int ret;
-
- ret = gpio_request(cam_reset, "camera reset");
- if (ret)
- return ret;
-
- gpio_direction_output(cam_reset, 0);
- gpio_set_value(cam_reset, 1);
-
- return 0;
-}
-
-static struct regulator_consumer_supply camera_dummy_supplies[] = {
- REGULATOR_SUPPLY("vdd", "0-005d"),
-};
-
-static struct regulator_init_data camera_dummy_initdata = {
- .consumer_supplies = camera_dummy_supplies,
- .num_consumer_supplies = ARRAY_SIZE(camera_dummy_supplies),
- .constraints = {
- .valid_ops_mask = REGULATOR_CHANGE_STATUS,
- },
-};
-
-static struct fixed_voltage_config camera_dummy_config = {
- .supply_name = "camera_vdd",
- .input_supply = "vcc cam",
- .microvolts = 2800000,
- .init_data = &camera_dummy_initdata,
-};
-
-static struct platform_device camera_supply_dummy_device = {
- .name = "reg-fixed-voltage",
- .id = 1,
- .dev = {
- .platform_data = &camera_dummy_config,
- },
-};
-
-struct pxacamera_platform_data em_x270_camera_platform_data = {
- .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 |
- PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN,
- .mclk_10khz = 2600,
- .sensor_i2c_adapter_id = 0,
- .sensor_i2c_address = 0x5d,
-};
-
-static void __init em_x270_init_camera(void)
-{
- if (em_x270_sensor_init() == 0)
- pxa_set_camera_info(&em_x270_camera_platform_data);
- platform_device_register(&camera_supply_dummy_device);
-}
-#else
-static inline void em_x270_init_camera(void) {}
-#endif
-
-static struct regulator_bulk_data em_x270_gps_consumer_supply = {
- .supply = "vcc gps",
-};
-
-static struct regulator_userspace_consumer_data em_x270_gps_consumer_data = {
- .name = "vcc gps",
- .num_supplies = 1,
- .supplies = &em_x270_gps_consumer_supply,
-};
-
-static struct platform_device em_x270_gps_userspace_consumer = {
- .name = "reg-userspace-consumer",
- .id = 0,
- .dev = {
- .platform_data = &em_x270_gps_consumer_data,
- },
-};
-
-static struct regulator_bulk_data em_x270_gprs_consumer_supply = {
- .supply = "vcc gprs",
-};
-
-static struct regulator_userspace_consumer_data em_x270_gprs_consumer_data = {
- .name = "vcc gprs",
- .num_supplies = 1,
- .supplies = &em_x270_gprs_consumer_supply
-};
-
-static struct platform_device em_x270_gprs_userspace_consumer = {
- .name = "reg-userspace-consumer",
- .id = 1,
- .dev = {
- .platform_data = &em_x270_gprs_consumer_data,
- }
-};
-
-static struct platform_device *em_x270_userspace_consumers[] = {
- &em_x270_gps_userspace_consumer,
- &em_x270_gprs_userspace_consumer,
-};
-
-static void __init em_x270_userspace_consumers_init(void)
-{
- platform_add_devices(ARRAY_AND_SIZE(em_x270_userspace_consumers));
-}
-
-/* DA9030 related initializations */
-#define REGULATOR_CONSUMER(_name, _dev_name, _supply) \
- static struct regulator_consumer_supply _name##_consumers[] = { \
- REGULATOR_SUPPLY(_supply, _dev_name), \
- }
-
-REGULATOR_CONSUMER(ldo3, "reg-userspace-consumer.0", "vcc gps");
-REGULATOR_CONSUMER(ldo5, NULL, "vcc cam");
-REGULATOR_CONSUMER(ldo10, "pxa2xx-mci", "vcc sdio");
-REGULATOR_CONSUMER(ldo12, NULL, "vcc usb");
-REGULATOR_CONSUMER(ldo19, "reg-userspace-consumer.1", "vcc gprs");
-REGULATOR_CONSUMER(buck2, NULL, "vcc_core");
-
-#define REGULATOR_INIT(_ldo, _min_uV, _max_uV, _ops_mask) \
- static struct regulator_init_data _ldo##_data = { \
- .constraints = { \
- .min_uV = _min_uV, \
- .max_uV = _max_uV, \
- .state_mem = { \
- .enabled = 0, \
- }, \
- .valid_ops_mask = _ops_mask, \
- .apply_uV = 1, \
- }, \
- .num_consumer_supplies = ARRAY_SIZE(_ldo##_consumers), \
- .consumer_supplies = _ldo##_consumers, \
- };
-
-REGULATOR_INIT(ldo3, 3200000, 3200000, REGULATOR_CHANGE_STATUS);
-REGULATOR_INIT(ldo5, 3000000, 3000000, REGULATOR_CHANGE_STATUS);
-REGULATOR_INIT(ldo10, 2000000, 3200000,
- REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_VOLTAGE);
-REGULATOR_INIT(ldo12, 3000000, 3000000, REGULATOR_CHANGE_STATUS);
-REGULATOR_INIT(ldo19, 3200000, 3200000, REGULATOR_CHANGE_STATUS);
-REGULATOR_INIT(buck2, 1000000, 1650000, REGULATOR_CHANGE_VOLTAGE);
-
-struct led_info em_x270_led_info = {
- .name = "em-x270:orange",
- .default_trigger = "battery-charging-or-full",
-};
-
-struct power_supply_info em_x270_psy_info = {
- .name = "battery",
- .technology = POWER_SUPPLY_TECHNOLOGY_LIPO,
- .voltage_max_design = 4200000,
- .voltage_min_design = 3000000,
- .use_for_apm = 1,
-};
-
-static void em_x270_battery_low(void)
-{
-#if defined(CONFIG_APM_EMULATION)
- apm_queue_event(APM_LOW_BATTERY);
-#endif
-}
-
-static void em_x270_battery_critical(void)
-{
-#if defined(CONFIG_APM_EMULATION)
- apm_queue_event(APM_CRITICAL_SUSPEND);
-#endif
-}
-
-struct da9030_battery_info em_x270_batterty_info = {
- .battery_info = &em_x270_psy_info,
-
- .charge_milliamp = 1000,
- .charge_millivolt = 4200,
-
- .vbat_low = 3600,
- .vbat_crit = 3400,
- .vbat_charge_start = 4100,
- .vbat_charge_stop = 4200,
- .vbat_charge_restart = 4000,
-
- .vcharge_min = 3200,
- .vcharge_max = 5500,
-
- .tbat_low = 197,
- .tbat_high = 78,
- .tbat_restart = 100,
-
- .batmon_interval = 0,
-
- .battery_low = em_x270_battery_low,
- .battery_critical = em_x270_battery_critical,
-};
-
-#define DA9030_SUBDEV(_name, _id, _pdata) \
- { \
- .name = "da903x-" #_name, \
- .id = DA9030_ID_##_id, \
- .platform_data = _pdata, \
- }
-
-#define DA9030_LDO(num) DA9030_SUBDEV(regulator, LDO##num, &ldo##num##_data)
-
-struct da903x_subdev_info em_x270_da9030_subdevs[] = {
- DA9030_LDO(3),
- DA9030_LDO(5),
- DA9030_LDO(10),
- DA9030_LDO(12),
- DA9030_LDO(19),
-
- DA9030_SUBDEV(regulator, BUCK2, &buck2_data),
-
- DA9030_SUBDEV(led, LED_PC, &em_x270_led_info),
- DA9030_SUBDEV(backlight, WLED, &em_x270_led_info),
- DA9030_SUBDEV(battery, BAT, &em_x270_batterty_info),
-};
-
-static struct da903x_platform_data em_x270_da9030_info = {
- .num_subdevs = ARRAY_SIZE(em_x270_da9030_subdevs),
- .subdevs = em_x270_da9030_subdevs,
-};
-
-static struct i2c_board_info em_x270_i2c_pmic_info = {
- I2C_BOARD_INFO("da9030", 0x49),
- .irq = PXA_GPIO_TO_IRQ(0),
- .platform_data = &em_x270_da9030_info,
-};
-
-static struct i2c_pxa_platform_data em_x270_pwr_i2c_info = {
- .use_pio = 1,
-};
-
-static void __init em_x270_init_da9030(void)
-{
- pxa27x_set_i2c_power_info(&em_x270_pwr_i2c_info);
- i2c_register_board_info(1, &em_x270_i2c_pmic_info, 1);
-}
-
-static struct pca953x_platform_data exeda_gpio_ext_pdata = {
- .gpio_base = 128,
-};
-
-static struct i2c_board_info exeda_i2c_info[] = {
- {
- I2C_BOARD_INFO("pca9555", 0x21),
- .platform_data = &exeda_gpio_ext_pdata,
- },
-};
-
-static struct i2c_pxa_platform_data em_x270_i2c_info = {
- .fast_mode = 1,
-};
-
-static void __init em_x270_init_i2c(void)
-{
- pxa_set_i2c_info(&em_x270_i2c_info);
-
- if (machine_is_exeda())
- i2c_register_board_info(0, ARRAY_AND_SIZE(exeda_i2c_info));
-}
-
-static void __init em_x270_module_init(void)
-{
- pxa2xx_mfp_config(ARRAY_AND_SIZE(em_x270_pin_config));
-
- mmc_cd = GPIO13_MMC_CD;
- nand_rb = GPIO56_NAND_RB;
- dm9000_flags = DM9000_PLATF_32BITONLY;
- cam_reset = GPIO93_CAM_RESET;
- usb_hub_reset = GPIO16_USB_HUB_RESET;
-}
-
-static void __init em_x270_exeda_init(void)
-{
- pxa2xx_mfp_config(ARRAY_AND_SIZE(exeda_pin_config));
-
- mmc_cd = GPIO114_MMC_CD;
- nand_rb = GPIO20_NAND_RB;
- dm9000_flags = DM9000_PLATF_16BITONLY;
- cam_reset = GPIO130_CAM_RESET;
- usb_hub_reset = GPIO10_USB_HUB_RESET;
-}
-
-static void __init em_x270_init(void)
-{
- pxa2xx_mfp_config(ARRAY_AND_SIZE(common_pin_config));
-
- pxa_set_ffuart_info(NULL);
- pxa_set_btuart_info(NULL);
- pxa_set_stuart_info(NULL);
-
-#ifdef CONFIG_PM
- pxa27x_set_pwrmode(PWRMODE_DEEPSLEEP);
-#endif
-
- if (machine_is_em_x270())
- em_x270_module_init();
- else if (machine_is_exeda())
- em_x270_exeda_init();
- else
- panic("Unsupported machine: %d\n", machine_arch_type);
-
- em_x270_init_da9030();
- em_x270_init_dm9000();
- em_x270_init_rtc();
- em_x270_init_nand();
- em_x270_init_nor();
- em_x270_init_lcd();
- em_x270_init_mmc();
- em_x270_init_ohci();
- em_x270_init_keypad();
- em_x270_init_gpio_keys();
- em_x270_init_ac97();
- em_x270_init_spi();
- em_x270_init_i2c();
- em_x270_init_camera();
- em_x270_userspace_consumers_init();
-
- regulator_has_full_constraints();
-}
-
-MACHINE_START(EM_X270, "Compulab EM-X270")
- .atag_offset = 0x100,
- .map_io = pxa27x_map_io,
- .nr_irqs = PXA_NR_IRQS,
- .init_irq = pxa27x_init_irq,
- .handle_irq = pxa27x_handle_irq,
- .init_time = pxa_timer_init,
- .init_machine = em_x270_init,
- .restart = pxa_restart,
-MACHINE_END
-
-MACHINE_START(EXEDA, "Compulab eXeda")
- .atag_offset = 0x100,
- .map_io = pxa27x_map_io,
- .nr_irqs = PXA_NR_IRQS,
- .init_irq = pxa27x_init_irq,
- .handle_irq = pxa27x_handle_irq,
- .init_time = pxa_timer_init,
- .init_machine = em_x270_init,
- .restart = pxa_restart,
-MACHINE_END
diff --git a/arch/arm/mach-pxa/include/mach/io.h b/arch/arm/mach-pxa/include/mach/io.h
deleted file mode 100644
index d54031c4f3df..000000000000
--- a/arch/arm/mach-pxa/include/mach/io.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * arch/arm/mach-pxa/include/mach/io.h
- *
- * Copied from asm/arch/sa1100/io.h
- */
-#ifndef __ASM_ARM_ARCH_IO_H
-#define __ASM_ARM_ARCH_IO_H
-
-#define IO_SPACE_LIMIT 0xffffffff
-
-/*
- * We don't actually have real ISA nor PCI buses, but there is so many
- * drivers out there that might just work if we fake them...
- */
-#define __io(a) __typesafe_io(a)
-
-#endif
--
2.26.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH v2 3/3] ASoC: pxa: remove Compulab pxa2xx boards
From: Robert Jarzmik @ 2020-05-20 10:21 UTC (permalink / raw)
To: Arnd Bergmann, Miquel Raynal, Boris Brezillon, Mike Rapoport
Cc: Robert Jarzmik, linux-mtd, linux-arm-kernel
In-Reply-To: <20200520102125.8934-1-robert.jarzmik@free.fr>
As these boards have been removed from the pxa tree, amend accordingly
the sound subsystem.
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
sound/soc/pxa/Kconfig | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig
index d4c0f580a565..fb2d5ab02b0d 100644
--- a/sound/soc/pxa/Kconfig
+++ b/sound/soc/pxa/Kconfig
@@ -128,9 +128,8 @@ config SND_PXA2XX_SOC_E800
Toshiba e800 PDA
config SND_PXA2XX_SOC_EM_X270
- tristate "SoC Audio support for CompuLab EM-x270, eXeda and CM-X300"
- depends on SND_PXA2XX_SOC && (MACH_EM_X270 || MACH_EXEDA || \
- MACH_CM_X300)
+ tristate "SoC Audio support for CompuLab CM-X300"
+ depends on SND_PXA2XX_SOC && MACH_CM_X300
depends on AC97_BUS=n
select REGMAP
select AC97_BUS_NEW
--
2.26.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* [PATCH v2 2/3] MAINTAINERS: pxa: remove Compulab arm/pxa support
From: Robert Jarzmik @ 2020-05-20 10:21 UTC (permalink / raw)
To: Arnd Bergmann, Miquel Raynal, Boris Brezillon, Mike Rapoport
Cc: Robert Jarzmik, linux-mtd, linux-arm-kernel
In-Reply-To: <20200520102125.8934-1-robert.jarzmik@free.fr>
These boards support is removed from the kernel, so remove the
MAINTAINERS entry for them.
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
MAINTAINERS | 5 -----
1 file changed, 5 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 091ec22c1a23..ad58388fa822 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1684,11 +1684,6 @@ S: Maintained
T: git git://git.armlinux.org.uk/~rmk/linux-arm.git clkdev
F: drivers/clk/clkdev.c
-ARM/COMPULAB CM-X270/EM-X270 and CM-X300 MACHINE SUPPORT
-M: Mike Rapoport <mike@compulab.co.il>
-L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
-S: Maintained
-
ARM/CONEXANT DIGICOLOR MACHINE SUPPORT
M: Baruch Siach <baruch@tkos.co.il>
L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
--
2.26.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related
* Re: [PATCH 3/4] clk/soc: mediatek: mt6779: Bind clock driver from platform device
From: Stephen Boyd @ 2020-05-20 10:21 UTC (permalink / raw)
To: Matthias Brugger, Michael Turquette, Rob Herring, matthias.bgg
Cc: Kate Stewart, devicetree, Greg Kroah-Hartman, linux-kernel,
linux-mediatek, linux-arm-kernel, mtk01761, Thomas Gleixner,
linux-clk, Allison Randal
In-Reply-To: <20200518113156.25009-3-matthias.bgg@kernel.org>
Quoting matthias.bgg@kernel.org (2020-05-18 04:31:55)
> From: Matthias Brugger <matthias.bgg@gmail.com>
>
> The mmsys driver is now the top level entry point for the multimedia
> system (mmsys), we bind the clock driver by creating a platform device.
> We also bind the MediaTek DRM driver which is not yet implement and
> therefor will errror out for now.
>
> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
> ---
Acked-by: Stephen Boyd <sboyd@kernel.org>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v4 2/4] kasan: record and print the free track
From: Walter Wu @ 2020-05-20 10:15 UTC (permalink / raw)
To: Dmitry Vyukov
Cc: wsd_upstream, linux-mediatek, LKML, kasan-dev, Linux-MM,
Alexander Potapenko, Andrey Ryabinin, Linux ARM
In-Reply-To: <CACT4Y+ZD4T7ugvB87wwdnmBPE+Z_N62m5NDrZ0KxJEDgPWBc4w@mail.gmail.com>
On Wed, 2020-05-20 at 11:44 +0200, 'Dmitry Vyukov' via kasan-dev wrote:
> On Wed, May 20, 2020 at 11:17 AM Walter Wu <walter-zh.wu@mediatek.com> wrote:
> > > > On Wed, 2020-05-20 at 13:14 +0800, Walter Wu wrote:
> > > > > > On Wed, May 20, 2020 at 6:03 AM Walter Wu <walter-zh.wu@mediatek.com> wrote:
> > > > > > >
> > > > > > > > On Tue, May 19, 2020 at 4:25 AM Walter Wu <walter-zh.wu@mediatek.com> wrote:
> > > > > > > > >
> > > > > > > > > Move free track from slub alloc meta-data to slub free meta-data in
> > > > > > > > > order to make struct kasan_free_meta size is 16 bytes. It is a good
> > > > > > > > > size because it is the minimal redzone size and a good number of
> > > > > > > > > alignment.
> > > > > > > > >
> > > > > > > > > For free track in generic KASAN, we do the modification in struct
> > > > > > > > > kasan_alloc_meta and kasan_free_meta:
> > > > > > > > > - remove free track from kasan_alloc_meta.
> > > > > > > > > - add free track into kasan_free_meta.
> > > > > > > > >
> > > > > > > > > [1]https://bugzilla.kernel.org/show_bug.cgi?id=198437
> > > > > > > > >
> > > > > > > > > Signed-off-by: Walter Wu <walter-zh.wu@mediatek.com>
> > > > > > > > > Suggested-by: Dmitry Vyukov <dvyukov@google.com>
> > > > > > > > > Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
> > > > > > > > > Cc: Dmitry Vyukov <dvyukov@google.com>
> > > > > > > > > Cc: Alexander Potapenko <glider@google.com>
> > > > > > > > > ---
> > > > > > > > > mm/kasan/common.c | 22 ++--------------------
> > > > > > > > > mm/kasan/generic.c | 18 ++++++++++++++++++
> > > > > > > > > mm/kasan/kasan.h | 7 +++++++
> > > > > > > > > mm/kasan/report.c | 20 --------------------
> > > > > > > > > mm/kasan/tags.c | 37 +++++++++++++++++++++++++++++++++++++
> > > > > > > > > 5 files changed, 64 insertions(+), 40 deletions(-)
> > > > > > > > >
> > > > > > > > > diff --git a/mm/kasan/common.c b/mm/kasan/common.c
> > > > > > > > > index 8bc618289bb1..47b53912f322 100644
> > > > > > > > > --- a/mm/kasan/common.c
> > > > > > > > > +++ b/mm/kasan/common.c
> > > > > > > > > @@ -51,7 +51,7 @@ depot_stack_handle_t kasan_save_stack(gfp_t flags)
> > > > > > > > > return stack_depot_save(entries, nr_entries, flags);
> > > > > > > > > }
> > > > > > > > >
> > > > > > > > > -static inline void set_track(struct kasan_track *track, gfp_t flags)
> > > > > > > > > +void kasan_set_track(struct kasan_track *track, gfp_t flags)
> > > > > > > > > {
> > > > > > > > > track->pid = current->pid;
> > > > > > > > > track->stack = kasan_save_stack(flags);
> > > > > > > > > @@ -299,24 +299,6 @@ struct kasan_free_meta *get_free_info(struct kmem_cache *cache,
> > > > > > > > > return (void *)object + cache->kasan_info.free_meta_offset;
> > > > > > > > > }
> > > > > > > > >
> > > > > > > > > -
> > > > > > > > > -static void kasan_set_free_info(struct kmem_cache *cache,
> > > > > > > > > - void *object, u8 tag)
> > > > > > > > > -{
> > > > > > > > > - struct kasan_alloc_meta *alloc_meta;
> > > > > > > > > - u8 idx = 0;
> > > > > > > > > -
> > > > > > > > > - alloc_meta = get_alloc_info(cache, object);
> > > > > > > > > -
> > > > > > > > > -#ifdef CONFIG_KASAN_SW_TAGS_IDENTIFY
> > > > > > > > > - idx = alloc_meta->free_track_idx;
> > > > > > > > > - alloc_meta->free_pointer_tag[idx] = tag;
> > > > > > > > > - alloc_meta->free_track_idx = (idx + 1) % KASAN_NR_FREE_STACKS;
> > > > > > > > > -#endif
> > > > > > > > > -
> > > > > > > > > - set_track(&alloc_meta->free_track[idx], GFP_NOWAIT);
> > > > > > > > > -}
> > > > > > > > > -
> > > > > > > > > void kasan_poison_slab(struct page *page)
> > > > > > > > > {
> > > > > > > > > unsigned long i;
> > > > > > > > > @@ -492,7 +474,7 @@ static void *__kasan_kmalloc(struct kmem_cache *cache, const void *object,
> > > > > > > > > KASAN_KMALLOC_REDZONE);
> > > > > > > > >
> > > > > > > > > if (cache->flags & SLAB_KASAN)
> > > > > > > > > - set_track(&get_alloc_info(cache, object)->alloc_track, flags);
> > > > > > > > > + kasan_set_track(&get_alloc_info(cache, object)->alloc_track, flags);
> > > > > > > > >
> > > > > > > > > return set_tag(object, tag);
> > > > > > > > > }
> > > > > > > > > diff --git a/mm/kasan/generic.c b/mm/kasan/generic.c
> > > > > > > > > index 3372bdcaf92a..763d8a13e0ac 100644
> > > > > > > > > --- a/mm/kasan/generic.c
> > > > > > > > > +++ b/mm/kasan/generic.c
> > > > > > > > > @@ -344,3 +344,21 @@ void kasan_record_aux_stack(void *addr)
> > > > > > > > > alloc_info->aux_stack[1] = alloc_info->aux_stack[0];
> > > > > > > > > alloc_info->aux_stack[0] = kasan_save_stack(GFP_NOWAIT);
> > > > > > > > > }
> > > > > > > > > +
> > > > > > > > > +void kasan_set_free_info(struct kmem_cache *cache,
> > > > > > > > > + void *object, u8 tag)
> > > > > > > > > +{
> > > > > > > > > + struct kasan_free_meta *free_meta;
> > > > > > > > > +
> > > > > > > > > + free_meta = get_free_info(cache, object);
> > > > > > > > > + kasan_set_track(&free_meta->free_track, GFP_NOWAIT);
> > > > > > > > > +}
> > > > > > > > > +
> > > > > > > > > +struct kasan_track *kasan_get_free_track(struct kmem_cache *cache,
> > > > > > > > > + void *object, u8 tag)
> > > > > > > > > +{
> > > > > > > > > + struct kasan_free_meta *free_meta;
> > > > > > > > > +
> > > > > > > > > + free_meta = get_free_info(cache, object);
> > > > > > > > > + return &free_meta->free_track;
> > > > > > > > > +}
> > > > > > > > > diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h
> > > > > > > > > index a7391bc83070..ad897ec36545 100644
> > > > > > > > > --- a/mm/kasan/kasan.h
> > > > > > > > > +++ b/mm/kasan/kasan.h
> > > > > > > > > @@ -127,6 +127,9 @@ struct kasan_free_meta {
> > > > > > > > > * Otherwise it might be used for the allocator freelist.
> > > > > > > > > */
> > > > > > > > > struct qlist_node quarantine_link;
> > > > > > > > > +#ifdef CONFIG_KASAN_GENERIC
> > > > > > > > > + struct kasan_track free_track;
> > > > > > > > > +#endif
> > > > > > > > > };
> > > > > > > > >
> > > > > > > > > struct kasan_alloc_meta *get_alloc_info(struct kmem_cache *cache,
> > > > > > > > > @@ -168,6 +171,10 @@ void kasan_report_invalid_free(void *object, unsigned long ip);
> > > > > > > > > struct page *kasan_addr_to_page(const void *addr);
> > > > > > > > >
> > > > > > > > > depot_stack_handle_t kasan_save_stack(gfp_t flags);
> > > > > > > > > +void kasan_set_track(struct kasan_track *track, gfp_t flags);
> > > > > > > > > +void kasan_set_free_info(struct kmem_cache *cache, void *object, u8 tag);
> > > > > > > > > +struct kasan_track *kasan_get_free_track(struct kmem_cache *cache,
> > > > > > > > > + void *object, u8 tag);
> > > > > > > > >
> > > > > > > > > #if defined(CONFIG_KASAN_GENERIC) && \
> > > > > > > > > (defined(CONFIG_SLAB) || defined(CONFIG_SLUB))
> > > > > > > > > diff --git a/mm/kasan/report.c b/mm/kasan/report.c
> > > > > > > > > index 6f8f2bf8f53b..96d2657fe70f 100644
> > > > > > > > > --- a/mm/kasan/report.c
> > > > > > > > > +++ b/mm/kasan/report.c
> > > > > > > > > @@ -159,26 +159,6 @@ static void describe_object_addr(struct kmem_cache *cache, void *object,
> > > > > > > > > (void *)(object_addr + cache->object_size));
> > > > > > > > > }
> > > > > > > > >
> > > > > > > > > -static struct kasan_track *kasan_get_free_track(struct kmem_cache *cache,
> > > > > > > > > - void *object, u8 tag)
> > > > > > > > > -{
> > > > > > > > > - struct kasan_alloc_meta *alloc_meta;
> > > > > > > > > - int i = 0;
> > > > > > > > > -
> > > > > > > > > - alloc_meta = get_alloc_info(cache, object);
> > > > > > > > > -
> > > > > > > > > -#ifdef CONFIG_KASAN_SW_TAGS_IDENTIFY
> > > > > > > > > - for (i = 0; i < KASAN_NR_FREE_STACKS; i++) {
> > > > > > > > > - if (alloc_meta->free_pointer_tag[i] == tag)
> > > > > > > > > - break;
> > > > > > > > > - }
> > > > > > > > > - if (i == KASAN_NR_FREE_STACKS)
> > > > > > > > > - i = alloc_meta->free_track_idx;
> > > > > > > > > -#endif
> > > > > > > > > -
> > > > > > > > > - return &alloc_meta->free_track[i];
> > > > > > > > > -}
> > > > > > > > > -
> > > > > > > > > #ifdef CONFIG_KASAN_GENERIC
> > > > > > > > > static void print_stack(depot_stack_handle_t stack)
> > > > > > > > > {
> > > > > > > > > diff --git a/mm/kasan/tags.c b/mm/kasan/tags.c
> > > > > > > > > index 25b7734e7013..201dee5d6ae0 100644
> > > > > > > > > --- a/mm/kasan/tags.c
> > > > > > > > > +++ b/mm/kasan/tags.c
> > > > > > > > > @@ -162,3 +162,40 @@ void __hwasan_tag_memory(unsigned long addr, u8 tag, unsigned long size)
> > > > > > > > > kasan_poison_shadow((void *)addr, size, tag);
> > > > > > > > > }
> > > > > > > > > EXPORT_SYMBOL(__hwasan_tag_memory);
> > > > > > > > > +
> > > > > > > > > +void kasan_set_free_info(struct kmem_cache *cache,
> > > > > > > > > + void *object, u8 tag)
> > > > > > > > > +{
> > > > > > > > > + struct kasan_alloc_meta *alloc_meta;
> > > > > > > > > + u8 idx = 0;
> > > > > > > > > +
> > > > > > > > > + alloc_meta = get_alloc_info(cache, object);
> > > > > > > > > +
> > > > > > > > > +#ifdef CONFIG_KASAN_SW_TAGS_IDENTIFY
> > > > > > > > > + idx = alloc_meta->free_track_idx;
> > > > > > > > > + alloc_meta->free_pointer_tag[idx] = tag;
> > > > > > > > > + alloc_meta->free_track_idx = (idx + 1) % KASAN_NR_FREE_STACKS;
> > > > > > > > > +#endif
> > > > > > > > > +
> > > > > > > > > + kasan_set_track(&alloc_meta->free_track[idx], GFP_NOWAIT);
> > > > > > > > > +}
> > > > > > > > > +
> > > > > > > > > +struct kasan_track *kasan_get_free_track(struct kmem_cache *cache,
> > > > > > > > > + void *object, u8 tag)
> > > > > > > > > +{
> > > > > > > > > + struct kasan_alloc_meta *alloc_meta;
> > > > > > > > > + int i = 0;
> > > > > > > > > +
> > > > > > > > > + alloc_meta = get_alloc_info(cache, object);
> > > > > > > > > +
> > > > > > > > > +#ifdef CONFIG_KASAN_SW_TAGS_IDENTIFY
> > > > > > > > > + for (i = 0; i < KASAN_NR_FREE_STACKS; i++) {
> > > > > > > > > + if (alloc_meta->free_pointer_tag[i] == tag)
> > > > > > > > > + break;
> > > > > > > > > + }
> > > > > > > > > + if (i == KASAN_NR_FREE_STACKS)
> > > > > > > > > + i = alloc_meta->free_track_idx;
> > > > > > > > > +#endif
> > > > > > > > > +
> > > > > > > > > + return &alloc_meta->free_track[i];
> > > > > > > > > +}
> > > > > > > >
> > > > > > > > Hi Walter,
> > > > > > > >
> > > > > > > > FTR I've uploaded this for review purposes here:
> > > > > > > > https://linux-review.googlesource.com/c/linux/kernel/git/torvalds/linux/+/2458
> > > > > > > >
> > > > > > > > Diff from the previous version is available as:
> > > > > > > > https://linux-review.googlesource.com/c/linux/kernel/git/torvalds/linux/+/2458/1..2
> > > > > > > >
> > > > > > > > I've tested this locally and with syzkaller. This is :
> > > > > > > >
> > > > > > > > [ 80.583021][ C3] Freed by task 0:
> > > > > > > > [ 80.583480][ C3] kasan_save_stack+0x1b/0x40 mm/kasan/common.c:49
> > > > > > > > [ 80.584056][ C3] kasan_set_track+0x1c/0x30 mm/kasan/common.c:57
> > > > > > > > [ 80.584617][ C3] kasan_set_free_info+0x1b/0x30 mm/kasan/generic.c:354
> > > > > > > > [ 80.585221][ C3] __kasan_slab_free+0xd8/0x120 mm/kasan/common.c:438
> > > > > > > > [ 80.585814][ C3] __cache_free mm/slab.c:3426 [inline]
> > > > > > > > [ 80.585814][ C3] kfree+0x10b/0x2b0 mm/slab.c:3757
> > > > > > > > [ 80.586291][ C3] kasan_rcu_reclaim+0x16/0x43 [test_kasan]
> > > > > > > > [ 80.587009][ C3] rcu_do_batch kernel/rcu/tree.c:2207 [inline]
> > > > > > > > [ 80.587009][ C3] rcu_core+0x59f/0x1370 kernel/rcu/tree.c:2434
> > > > > > > > [ 80.587537][ C3] __do_softirq+0x26c/0x9fa kernel/softirq.c:292
> > > > > > > > [ 80.588085][ C3]
> > > > > > > > [ 80.588367][ C3] Last one call_rcu() call stack:
> > > > > > > > [ 80.589052][ C3] kasan_save_stack+0x1b/0x40 mm/kasan/common.c:49
> > > > > > > > [ 80.589622][ C3] kasan_record_aux_stack+0x82/0xb0 mm/kasan/generic.c:345
> > > > > > > > [ 80.590254][ C3] __call_rcu kernel/rcu/tree.c:2672 [inline]
> > > > > > > > [ 80.590254][ C3] call_rcu+0x14f/0x7f0 kernel/rcu/tree.c:2746
> > > > > > > > [ 80.590782][ C3] kasan_rcu_uaf+0xe4/0xeb [test_kasan]
> > > > > > > > [ 80.591697][ C3] kmalloc_tests_init+0xbc/0x1097 [test_kasan]
> > > > > > > > [ 80.592900][ C3] do_one_initcall+0x10a/0x7d0 init/main.c:1196
> > > > > > > > [ 80.593494][ C3] do_init_module+0x1e6/0x6d0 kernel/module.c:3539
> > > > > > > > [ 80.594066][ C3] load_module+0x7464/0x9450 kernel/module.c:3890
> > > > > > > > [ 80.594626][ C3] __do_sys_init_module+0x1e3/0x220 kernel/module.c:3953
> > > > > > > > [ 80.595265][ C3] do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295
> > > > > > > > [ 80.595822][ C3] entry_SYSCALL_64_after_hwframe+0x49/0xb3
> > > > > > > >
> > > > > > > >
> > > > > > > > Overall this looks very good to me.
> > > > > > > > But there is one aspect that bothers me. In the previous patch you had
> > > > > > > > code that returned NULL from kasan_get_free_track() if the object is
> > > > > > > > live (which means free meta is not available, it's occupied by object
> > > > > > > > data). Now you dropped that code, but I think we still need it.
> > > > > > > > Otherwise we cast user object data to free meta and print the free
> > > > > > > > stack/pid from whatever garbage is there. This may lead to very
> > > > > > > > confusing output and potentially to crashes in stackdepot.
> > > > > > > >
> > > > > > >
> > > > > > > Yes, I totally agree with you. In the previous email I thought that
> > > > > > > there is a problem with free track, but I did not point it out. Thank
> > > > > > > you for pointing this problem. As you mentioned, we should fix it.
> > > > > > >
> > > > > > > > What do you think about this patch on top of your patches?
> > > > > > > > https://linux-review.googlesource.com/c/linux/kernel/git/torvalds/linux/+/2478
> > > > > > > > This way we very precisely mark the period of time when the object has
> > > > > > > > free track live and set.
> > > > > > > > If it looks good to you, feel free to incorporate it into your series.
> > > > > > > >
> > > > > > >
> > > > > > > Thank you for providing good idea solution.
> > > > > > >
> > > > > > > I saw this patch, that is a great patch. I think it can fix the issue
> > > > > > > which has garbage stack. it should work as described below.
> > > > > > >
> > > > > > > 1). When object is live, then don't print free stack.
> > > > > > > 2). When object is NOT alive, after free object:
> > > > > > > 2a). when object is in quarantine, then it can print free stack
> > > > > > > 2b). when object is NOT in quarantine, then it can NOT print free stack.
> > > > > > >
> > > > > > > I have a question about 2), why we don't directly use
> > > > > > > KASAN_KMALLOC_FREE? if we directly use it, then 2b) can print free
> > > > > > > stack? 2b) may has use-after-free? so that it may need free stack.
> > > > > >
> > > >
> > > > About 2b), I see another question. When do qlink_free(), it will be
> > > > written KASAN_KMALLOC_FREE from KASAN_KMALLOC_FREETRACK? if we don't
> > > > write shadow memory, it is still KASAN_KMALLOC_FREETRACK, then 2b) will
> > > > have free stack? Because I see you add KASAN_KMALLOC_FREETRACK to get
> > > > use-after-free in get_shadow_bug_type(). so should it not write
> > > > KASAN_KMALLOC_FREE?
> > >
> > > It may or may not work.
> > > The potential problem is that when qlink_free calls ___cache_free,
> > > slab/slub may start using object memory for its own purposes, e.g.
> > > store the next link. This next link may overwrite part of free meta.
> > > It actually may work because the slab/slib next link is likely to
> > > overlap with kasan_free_meta.quarantine_link only. And we may have
> > > kasan_free_meta.free_track intact while KASAN_KMALLOC_FREE is set. But
> > > this needs careful checking for both slab and slub and if they may use
> > > more than 1 word in some configurations.
> > >
> >
> > This problem looks like existing, even without this change? currently
> > KASAN may get wrong free stack?
>
> No, we should not have this problem now. Currently free track is
> stored in alloc meta. Alloc meta does not overlap with the object.
> It's only free meta that overlaps with the object and slab metadata at
> different periods of the block lifetime. Schematically what we have
> is:
>
> struct block_t {
> alloc_meta kasan_alloc_meta;
> union {
> user_data char[N];
> slab_meta slab_meta;
> free_meta kasan_free_meta;
> };
> }
>
> free_meta shared storage space with 2 other things.
>
Ah...I forget it is stored in alloc mata, Yes, it should not have this
problem.
Thanks for your detailed explanation
> > Regardless of whether the shadow memory content is
> > KASAN_KMALLOC_FREETRACK or KASAN_KMALLOC_FREE, it may have this problem?
>
> KASAN_KMALLOC_FREETRACK is set only when nobody else uses the storage.
>
Ok, I will use KASAN_KMALLOC_FREE. If you have any concerns, please tell me.
Thanks.
> > But because of kasan_get_free_track() have conditions to get free track,
> > so that if shadow memory content is KASAN_KMALLOC_FREE, then it will
> > avoid this problem and always print right free stack.
>
>
>
> > > > > > We can't use KASAN_KMALLOC_FREE because of this part:
> > > > > >
> > > > > > static bool __kasan_slab_free(struct kmem_cache *cache, void *object,
> > > > > > unsigned long ip, bool quarantine)
> > > > > > {
> > > > > > ...
> > > > > > kasan_poison_shadow(object, rounded_up_size, KASAN_KMALLOC_FREE);
> > > > > >
> > > > > > if ((IS_ENABLED(CONFIG_KASAN_GENERIC) && !quarantine) ||
> > > > > > unlikely(!(cache->flags & SLAB_KASAN)))
> > > > > > return false;
> > > > > >
> > > > > > kasan_set_free_info(cache, object, tag);
> > > > > > ...
> > > > > >
> > > > >
> > > > > Ok, I see. When return false, then the shadow memory content has
> > > > > KASAN_KMALLOC_FREE, but it doesn't set free stack, so that we need to
> > > > > avoid this situation. Thank for you reminder.
> > > > >
> > > > > >
> > > > > > We may set KASAN_KMALLOC_FREE, but not set the track (or even have
> > > > > > memory for the track!).
> > > > > > The object may not have free meta allocated at all, e.g. very large
> > > > > > object with ctor (no place to store meta), or it may be in a mempool:
> > > > > > https://elixir.bootlin.com/linux/v5.7-rc6/source/mm/mempool.c#L109
> > > > > > and mempool may be using the object memory itself (for its own next
> > > > > > link or something).
> > > > > >
> > > > > > KASAN_KMALLOC_FREETRACK very explicitly tracks the exact condition we
> > > > > > want: we have meta info live now and we have free track set.
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH 3/4] clk/soc: mediatek: mt6779: Bind clock driver from platform device
From: Stephen Boyd @ 2020-05-20 10:15 UTC (permalink / raw)
To: Matthias Brugger, Michael Turquette, Rob Herring, matthias.bgg
Cc: Kate Stewart, devicetree, Greg Kroah-Hartman, linux-kernel,
linux-mediatek, linux-arm-kernel, mtk01761, Thomas Gleixner,
linux-clk, Allison Randal
In-Reply-To: <20200518113156.25009-3-matthias.bgg@kernel.org>
Quoting matthias.bgg@kernel.org (2020-05-18 04:31:55)
> From: Matthias Brugger <matthias.bgg@gmail.com>
>
> The mmsys driver is now the top level entry point for the multimedia
> system (mmsys), we bind the clock driver by creating a platform device.
> We also bind the MediaTek DRM driver which is not yet implement and
> therefor will errror out for now.
>
> Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
> ---
Acked-by: Stephen Boyd <sboyd@kernel.org>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox