* [PATCH v2 2/9] pinctrl: single: support gpio request and free
From: Haojian Zhuang @ 2012-10-29 1:58 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20121022202805.GG4730@atomide.com>
On Tue, Oct 23, 2012 at 4:28 AM, Tony Lindgren <tony@atomide.com> wrote:
> * Haojian Zhuang <haojian.zhuang@gmail.com> [121022 09:11]:
>> Marvell's PXA/MMP silicon also match the behavior of pinctrl-single.
>> Each pin binds to one register. A lot of pins could be configured
>> as gpio.
>>
>> Now add three properties in below.
>> pinctrl-single,gpio-ranges: gpio range array
>> pinctrl-single,gpio: <gpio base, npins in range, pin base in range>
>> pinctrl-single,gpio-func: <gpio function value in mux>
>>
>> Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
>> ---
>> drivers/pinctrl/pinctrl-single.c | 94 +++++++++++++++++++++++++++++++++++++-
>> 1 files changed, 92 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
>> index 726a729..6a0b24b 100644
>> --- a/drivers/pinctrl/pinctrl-single.c
>> +++ b/drivers/pinctrl/pinctrl-single.c
>> @@ -28,8 +28,10 @@
>> #define DRIVER_NAME "pinctrl-single"
>> #define PCS_MUX_PINS_NAME "pinctrl-single,pins"
>> #define PCS_MUX_BITS_NAME "pinctrl-single,bits"
>> +#define PCS_GPIO_FUNC_NAME "pinctrl-single,gpio-func"
>
> I think we can now get rid of these defines, I initially added
> them as we had a bit hard time finding a suitable name for the
> driver. These are only used in one location, so let's not add
> new ones here.
>
I'll fix.
>> static int pcs_request_gpio(struct pinctrl_dev *pctldev,
>> - struct pinctrl_gpio_range *range, unsigned offset)
>> + struct pinctrl_gpio_range *range, unsigned pin)
>> {
>> - return -ENOTSUPP;
>> + struct pcs_device *pcs = pinctrl_dev_get_drvdata(pctldev);
>> + struct pcs_gpio_range *gpio = NULL;
>> + int end, mux_bytes;
>> + unsigned data;
>> +
>> + gpio = container_of(range, struct pcs_gpio_range, range);
>> + if (!gpio->func_en)
>> + return 0;
>> + end = range->pin_base + range->npins - 1;
>> + if (pin < range->pin_base || pin > end) {
>> + dev_err(pctldev->dev, "pin %d isn't in the range of "
>> + "%d to %d\n", pin, range->pin_base, end);
>> + return -EINVAL;
>> + }
>> + mux_bytes = pcs->width / BITS_PER_BYTE;
>> + data = pcs_readl(pcs->base + pin * mux_bytes) & ~pcs->fmask;
>> + data |= gpio->gpio_func;
>> + pcs_writel(data, pcs->base + pin * mux_bytes);
>> + return 0;
>> }
>
> I think I already commented on this one.. Is this safe if you don't
> have GPIOs configured? Or should you return -ENODEV in that case?
>
OK. I'll use ENOTSUPP instead.
+ gpio = container_of(range, struct pcs_gpio_range, range);
+ if (!gpio->func_en)
+ return -ENOTSUPP;
>> +static int __devinit pcs_add_gpio_range(struct device_node *node,
>> + struct pcs_device *pcs)
>> +{
>> + struct pcs_gpio_range *gpio;
>> + struct device_node *np;
>> + const __be32 *list;
>> + const char list_name[] = "pinctrl-single,gpio-ranges";
>> + const char name[] = "pinctrl-single";
>> + u32 gpiores[PCS_MAX_GPIO_VALUES];
>> + int ret, size, i, mux_bytes = 0;
>> +
>> + list = of_get_property(node, list_name, &size);
>> + if (!list)
>> + return -ENOENT;
>
> Here you should return 0 if not found, otherwise things go bad for
> me at least as I don't have GPIOs configured. See more below.
>
OK. Use return 0 instead.
>> + gpio->range.name = kmemdup(name, sizeof(name), GFP_KERNEL);
>> + pinctrl_add_gpio_range(pcs->pctl, &gpio->range);
>
> Just checking.. These get released with pinctrl_unregister() when
> unloading, right? And nothing else to free in pinctrl-single.c
> either?
>
I'll fix.
>> @@ -975,6 +1061,10 @@ static int __devinit pcs_probe(struct platform_device *pdev)
>> goto free;
>> }
>>
>> + ret = pcs_add_gpio_range(np, pcs);
>> + if (ret < 0)
>> + return ret;
>> +
>
> Here you need to goto free on error. Maybe just fold in the
> attached fix if that looks OK to you:
>
> --- a/drivers/pinctrl/pinctrl-single.c
> +++ b/drivers/pinctrl/pinctrl-single.c
> @@ -930,7 +930,7 @@ static int __devinit pcs_add_gpio_range(struct device_node *node,
>
> list = of_get_property(node, list_name, &size);
> if (!list)
> - return -ENOENT;
> + return 0;
> size = size / sizeof(*list);
> for (i = 0; i < size; i++) {
> np = of_parse_phandle(node, list_name, i);
> @@ -1065,7 +1065,7 @@ static int __devinit pcs_probe(struct platform_device *pdev)
>
> ret = pcs_add_gpio_range(np, pcs);
> if (ret < 0)
> - return ret;
> + goto free;
>
> dev_info(pcs->dev, "%i pins at pa %p size %u\n",
> pcs->desc.npins, pcs->base, pcs->size);
I'll take your fix into this patch.
^ permalink raw reply
* [PATCH v2 2/9] pinctrl: single: support gpio request and free
From: Haojian Zhuang @ 2012-10-29 1:55 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20121022213709.GL4730@atomide.com>
On Tue, Oct 23, 2012 at 5:37 AM, Tony Lindgren <tony@atomide.com> wrote:
> * Tony Lindgren <tony@atomide.com> [121022 13:29]:
>> * Haojian Zhuang <haojian.zhuang@gmail.com> [121022 09:11]:
>> > --- a/drivers/pinctrl/pinctrl-single.c
>> > +++ b/drivers/pinctrl/pinctrl-single.c
>> > @@ -28,8 +28,10 @@
>> > #define DRIVER_NAME "pinctrl-single"
>> > #define PCS_MUX_PINS_NAME "pinctrl-single,pins"
>> > #define PCS_MUX_BITS_NAME "pinctrl-single,bits"
>> > +#define PCS_GPIO_FUNC_NAME "pinctrl-single,gpio-func"
>>
>> I think we can now get rid of these defines, I initially added
>> them as we had a bit hard time finding a suitable name for the
>> driver. These are only used in one location, so let's not add
>> new ones here.
>>
>> > static int pcs_request_gpio(struct pinctrl_dev *pctldev,
>> > - struct pinctrl_gpio_range *range, unsigned offset)
>> > + struct pinctrl_gpio_range *range, unsigned pin)
>> > {
>> > - return -ENOTSUPP;
>> > + struct pcs_device *pcs = pinctrl_dev_get_drvdata(pctldev);
>> > + struct pcs_gpio_range *gpio = NULL;
>> > + int end, mux_bytes;
>> > + unsigned data;
>> > +
>> > + gpio = container_of(range, struct pcs_gpio_range, range);
>> > + if (!gpio->func_en)
>> > + return 0;
>> > + end = range->pin_base + range->npins - 1;
>> > + if (pin < range->pin_base || pin > end) {
>> > + dev_err(pctldev->dev, "pin %d isn't in the range of "
>> > + "%d to %d\n", pin, range->pin_base, end);
>> > + return -EINVAL;
>> > + }
>> > + mux_bytes = pcs->width / BITS_PER_BYTE;
>> > + data = pcs_readl(pcs->base + pin * mux_bytes) & ~pcs->fmask;
>> > + data |= gpio->gpio_func;
>> > + pcs_writel(data, pcs->base + pin * mux_bytes);
>> > + return 0;
>> > }
>>
>> I think I already commented on this one.. Is this safe if you don't
>> have GPIOs configured? Or should you return -ENODEV in that case?
>
> Oops also you should not use pcs_readl/pcs_writel in the driver
> directly but use pcs_read instead as you can have register width other
> than 32-bits.
>
I think you're meaning pcs->read(). I'll use this interface.
^ permalink raw reply
* [PATCH 3/4] pinctrl: samsung: Add support for Exynos4x12
From: Kyungmin Park @ 2012-10-29 0:30 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <CACRpkdaoQP2jat_mr2wr30M39eogKAq77Gw2VoNPWbgHjgW+zw@mail.gmail.com>
On 10/29/12, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Wed, Oct 24, 2012 at 4:37 PM, Tomasz Figa <t.figa@samsung.com> wrote:
>
>> This patch extends the driver with any necessary SoC-specific
>> definitions to support Exynos4x12 SoCs.
>>
>> Signed-off-by: Tomasz Figa <t.figa@samsung.com>
>> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>
> Acked-by: Linus Walleij <linus.walleij@linaro.org>
>
> I guess you need all of this to go into my Samsung branch?
> I need and ACK from the Samsung maintainer and preferably
> Thomas A as well.
Hi,
Now we're trying to send the standalone patches to avoid the conflict.
and hope to merge patches via proper subsystem. In this case, pinctl.
Thank you,
Kyungmin Park
>
> Yours,
> Linus Walleij
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
^ permalink raw reply
* [PATCH for soc] socfpga: map uart into virtual address space so that early_printk() works
From: Pavel Machek @ 2012-10-29 0:27 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <201210271539.20156.arnd@arndb.de>
Early printk code needs UART to be mapped early during
boot. early_printk() is left there during the start-up; it is useful
as our emulators are fairly slow.
Signed-off-by: Pavel Machek <pavel@denx.de>
Acked-by: Dinh Nguyen <dinguyen@altera.com>
diff --git a/arch/arm/mach-socfpga/socfpga.c b/arch/arm/mach-socfpga/socfpga.c
index ab81ea9..49fb62b 100644
--- a/arch/arm/mach-socfpga/socfpga.c
+++ b/arch/arm/mach-socfpga/socfpga.c
@@ -37,6 +37,15 @@ static struct map_desc scu_io_desc __initdata = {
.type = MT_DEVICE,
};
+
+
+static struct map_desc uart_io_desc __initdata = {
+ .virtual = 0xfec02000,
+ .pfn = __phys_to_pfn(0xffc02000),
+ .length = SZ_8K,
+ .type = MT_DEVICE,
+};
+
static void __init socfpga_scu_map_io(void)
{
unsigned long base;
@@ -51,6 +60,8 @@ static void __init socfpga_scu_map_io(void)
static void __init socfpga_map_io(void)
{
socfpga_scu_map_io();
+ iotable_init(&uart_io_desc, 1);
+ early_printk("Early printk initialized\n");
}
const static struct of_device_id irq_match[] = {
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply related
* [PATCH v4 0/5] zynq subarch cleanups
From: Josh Cartwright @ 2012-10-29 0:16 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <cover.1351466765.git.josh.cartwright@ni.com>
On Sun, Oct 28, 2012 at 05:26:05PM -0600, Josh Cartwright wrote:
> Michal-
Ugh, sorry everyone, I fatfingered the subject line. This is indeed v5.
Josh
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121028/2ab3abf4/attachment.sig>
^ permalink raw reply
* [PATCH v4 0/5] zynq subarch cleanups
From: Josh Cartwright @ 2012-10-28 23:26 UTC (permalink / raw)
To: linux-arm-kernel
Michal-
Here is a v5 of the zynq cleanup patchset that addresses your feedback. I've
intentionally left patches 4 and 5 in the set until we figure out the
appropriate way to get them in tree (feel free to just apply 1-3)
I've also moved the uart mapping in patch 5 to a known working address, until
we can work out what is happening there. This should allow this patchset to be
applied and have the zc702 boot.
You had suggested removing/renaming the zynq-ep107.dts; it wasn't clear whether
you had wanted that in this patchset or not. I'm going to assume not. I'll
follow up with this, after this patchset is applied, if that works for you.
Thanks,
Josh
---
Things have been relatively quiet on the Zynq front lately. This patchset does
a bit of cleanup of the Zynq subarchitecture. It was the necessary set of
things I had to do to get a zynq target booting with the upstream qemu model.
Patches 1 and 2 move zynq to use the GIC and pl310 L2 cache controller device
tree bindings respectively.
Patch 3 removes unused clock infrastructure. The plan is to rework the
out-of-tree Xilinx generic clk support into something suitable for merging.
What's in tree now just isn't used at all, and can be removed.
Patch 4 and 5 move around the static peripheral mappings into the vmalloc area.
---
Changes since v4:
- Fixed uart interrupt spec in zynq-ep107.dtb (patch 1)
- Moved early uart mapping to a known working address (patch 5)
Changes since v3:
- Patch 3 also removes the zynq "use" of versatile
Changes since v2:
- Reordered patchset to prevent remapping peripherals that were subsequently
removed from the static map
- Use DT bindings for the L2 cache controller
Changes since v1:
- Make sure arm at kernel.org was included
- Rebased on arm-soc/for-next
- Added a cover letter
- Elaborated a bit on why I removed CLKDEV_LOOKUP
---
Josh Cartwright (5):
zynq: use GIC device tree bindings
zynq: use pl310 device tree bindings
zynq: remove use of CLKDEV_LOOKUP
ARM: annotate VMALLOC_END definition with _AC
zynq: move static peripheral mappings
arch/arm/Kconfig | 1 -
arch/arm/Makefile | 1 -
arch/arm/boot/dts/zynq-ep107.dts | 19 ++++++++++++++----
arch/arm/include/asm/pgtable.h | 2 +-
arch/arm/mach-zynq/common.c | 23 ++++++++++-----------
arch/arm/mach-zynq/include/mach/clkdev.h | 32 ------------------------------
arch/arm/mach-zynq/include/mach/zynq_soc.h | 31 ++++++++++++++---------------
7 files changed, 41 insertions(+), 68 deletions(-)
delete mode 100644 arch/arm/mach-zynq/include/mach/clkdev.h
--
1.8.0
^ permalink raw reply
* arm-soc tree was Re: [PATCH] Fix socfpga compilation with early_printk() enabled
From: Pavel Machek @ 2012-10-28 23:13 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20121028230153.GA8284@elf.ucw.cz>
Hi!
> > > > > This fixes early_printk() compilation for
> > > > > socfpga. (senduart/busyuart/waituart were missing). It does that by
> > > > > making Picochip code generic.
> > > > >
> > > > > Signed-off-by: Pavel Machek <pavel@denx.de>
> > > > > Acked-by: Dinh Nguyen <dinguyen@altera.com>
> > > > > Acked-by: Jamie Iles <jamie@jamieiles.com
> > > >
> > > > Applied to fixes branch of arm-soc, but please be more explicit about
> > > > what you want to happen with patches in the future. Ideally we would
> > > > get pull requests for patches on each platform from only one person,
> > > > so please coordinate with Dinh Nguyen who that should be.
> > >
> > > Dinh is the maintainer, so if we can only send patches from one
> > > person, it needs to be him. If you'd be willing to take patches from
> > > second person, that would help us... if not, of course I can send all
> > > the patches through Dinh.
> >
> > You can both send patches, we just need to know what to expect. For most
> > platforms it works best if one person collects the patches from
> > everyone.
>
> > If you are sending patches with both Dinh and us as the recipients,
> > just make it clear who you want to pick up the patch.
>
> Thanks. Would "[PATCH for soc]" in subject line be suitable markup?
>
> BTW current for-next soc tree does not compile for me, with
>
> arch/arm/mach-vexpress/built-in.o: In function `v2m_timer_init':
> hotplug.c:(.init.text+0xd0): undefined reference to
> `vexpress_clk_init'
> arch/arm/mach-vexpress/built-in.o: In function `v2m_dt_timer_init':
> hotplug.c:(.init.text+0x100): undefined reference to
> `vexpress_clk_of_init'
> make: *** [vmlinux] Error 1
Aha, grep shows:
arch/arm/mach-vexpress/v2m.c: vexpress_clk_init(ioremap(V2M_SYSCTL, SZ_4K));
include/linux/vexpress.h:void vexpress_clk_init(void __iomem *sp810_base);
...seems vexpress_clk_init is not there, yet... And what is more
serious:
pavel at amd:~/mainline-altera/linux$ grep mach-vexpress MAINTAINERS
pavel at amd:~/mainline-altera/linux$
vexpress_clk_of_init(); has same problem.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply
* Please add bcm2835 tree to linux-next
From: Stephen Rothwell @ 2012-10-28 23:07 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <5089FD2F.9090507@wwwdotorg.org>
Hi Stephen,
On Thu, 25 Oct 2012 21:02:07 -0600 Stephen Warren <swarren@wwwdotorg.org> wrote:
>
> Could you please add the bcm2835 ARM SoC tree to linux-next. It's
> available at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/swarren/linux-rpi.git for-next
>
> Its probably best to insert it into the list somewhere after the
> existing arm-soc tree. I also maintain the Tegra tree, so if you insert
> it right next to that, any issues related to me will be triggered at the
> same time:-)
>
> Right now, it's based on v3.7-rc2, plus 5 patches.
Added from today.
Thanks for adding your subsystem tree as a participant of linux-next. As
you may know, this is not a judgment of your code. The purpose of
linux-next is for integration testing and to lower the impact of
conflicts between subsystems in the next merge window.
You will need to ensure that the patches/commits in your tree/series have
been:
* submitted under GPL v2 (or later) and include the Contributor's
Signed-off-by,
* posted to the relevant mailing list,
* reviewed by you (or another maintainer of your subsystem tree),
* successfully unit tested, and
* destined for the current or next Linux merge window.
Basically, this should be just what you would send to Linus (or ask him
to fetch). It is allowed to be rebased if you deem it necessary.
--
Cheers,
Stephen Rothwell
sfr at canb.auug.org.au
Legal Stuff:
By participating in linux-next, your subsystem tree contributions are
public and will be included in the linux-next trees. You may be sent
e-mail messages indicating errors or other issues when the
patches/commits from your subsystem tree are merged and tested in
linux-next. These messages may also be cross-posted to the linux-next
mailing list, the linux-kernel mailing list, etc. The linux-next tree
project and IBM (my employer) make no warranties regarding the linux-next
project, the testing procedures, the results, the e-mails, etc. If you
don't agree to these ground rules, let me know and I'll remove your tree
from participation in linux-next.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121029/36a8a1b8/attachment.sig>
^ permalink raw reply
* arm-soc tree was Re: [PATCH] Fix socfpga compilation with early_printk() enabled
From: Pavel Machek @ 2012-10-28 23:01 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <201210271539.20156.arnd@arndb.de>
Hi!
> > > > This fixes early_printk() compilation for
> > > > socfpga. (senduart/busyuart/waituart were missing). It does that by
> > > > making Picochip code generic.
> > > >
> > > > Signed-off-by: Pavel Machek <pavel@denx.de>
> > > > Acked-by: Dinh Nguyen <dinguyen@altera.com>
> > > > Acked-by: Jamie Iles <jamie@jamieiles.com
> > >
> > > Applied to fixes branch of arm-soc, but please be more explicit about
> > > what you want to happen with patches in the future. Ideally we would
> > > get pull requests for patches on each platform from only one person,
> > > so please coordinate with Dinh Nguyen who that should be.
> >
> > Dinh is the maintainer, so if we can only send patches from one
> > person, it needs to be him. If you'd be willing to take patches from
> > second person, that would help us... if not, of course I can send all
> > the patches through Dinh.
>
> You can both send patches, we just need to know what to expect. For most
> platforms it works best if one person collects the patches from
> everyone.
> If you are sending patches with both Dinh and us as the recipients,
> just make it clear who you want to pick up the patch.
Thanks. Would "[PATCH for soc]" in subject line be suitable markup?
BTW current for-next soc tree does not compile for me, with
arch/arm/mach-vexpress/built-in.o: In function `v2m_timer_init':
hotplug.c:(.init.text+0xd0): undefined reference to
`vexpress_clk_init'
arch/arm/mach-vexpress/built-in.o: In function `v2m_dt_timer_init':
hotplug.c:(.init.text+0x100): undefined reference to
`vexpress_clk_of_init'
make: *** [vmlinux] Error 1
config attached.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: config.bug.gz
Type: application/octet-stream
Size: 11441 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121029/536fdb2a/attachment-0001.obj>
^ permalink raw reply
* [PATCH 0/8] clk: ux500: Fixup smp_twd clk for clk notifiers
From: Samuel Ortiz @ 2012-10-28 22:59 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <CAPDyKFof65xAVyOo3FrdS2uYQwB1Wq3553PKj04FR6JXaJsH6Q@mail.gmail.com>
Hi Ulf,
On Fri, Oct 26, 2012 at 10:19:24AM +0200, Ulf Hansson wrote:
> On 11 October 2012 17:19, Lee Jones <lee.jones@linaro.org> wrote:
> > On Thu, 11 Oct 2012, Linus Walleij wrote:
> >
> >> On Thu, Oct 11, 2012 at 3:44 PM, Lee Jones <lee.jones@linaro.org> wrote:
> >>
> >> >> Patches are based on Linus Torvalds tree with latest commit as of okt 10.
> >> >
> >> > Hmm... I get:
> >> >
> >> > Applying: clk: ux500: Support for prcmu_scalable_rate clock
> >> > error: drivers/clk/ux500/clk-prcmu.c: does not exist in index
> >> > error: drivers/clk/ux500/clk.h: does not exist in index
> >> > Patch failed at 0001 clk: ux500: Support for prcmu_scalable_rate clock
> >> >
> >> > So when did drivers/clk/ux500/* arrive?
> >>
> >> Exactly here, 10 days ago on Torvalds' master branch:
> >
> > Ah I see. Basing patches on commits half way through the merge
> > window. Good move! ;)
> >
> > --
> > Lee Jones
> > Linaro ST-Ericsson Landing Team Lead
> > Linaro.org ? Open source software for ARM SoCs
> > Follow Linaro: Facebook | Twitter | Blog
>
> Samuel, a kind reminder on this, trying to collect acks to be able to
> advise Mike to take this series through his clk tree. There are two
> mfd patches.
> [PATCH 2/8] mfd: db8500: Provide cpufreq table as platform data
> [PATCH 5/8] mfd: db8500: Connect ARMSS clk to ARM OPP
Sorry for the delay:
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Cheers,
Samuel.
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply
* [PATCH 2/5] ARM: PXA: Zipit Z2: Add USB host and device support
From: Daniel Mack @ 2012-10-28 22:58 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <CA+E=qVftf+A=U5CEvkFia4LMYgeU6iF5WpKPS3FVkf1d3rABFQ@mail.gmail.com>
On Oct 28, 2012 11:44 PM, "Vasily Khoruzhick" <anarsoul@gmail.com> wrote:
>
> On Mon, Oct 29, 2012 at 12:59 AM, Marek Vasut <marex@denx.de> wrote:
> > Dear Vasily Khoruzhick,
> >
> > missing commit message.
>
> OK
>
> >> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
> >> ---
> >> arch/arm/mach-pxa/z2.c | 52
> >> ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52
> >> insertions(+)
> >>
> >> diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c
> >> index c97485f..ce90fa9 100644
> >> --- a/arch/arm/mach-pxa/z2.c
> >> +++ b/arch/arm/mach-pxa/z2.c
> >> @@ -41,6 +41,9 @@
> >> #include <linux/platform_data/mmc-pxamci.h>
> >> #include <linux/platform_data/keypad-pxa27x.h>
> >> #include <mach/pm.h>
> >> +#include <mach/pxa27x-udc.h>
> >> +#include <mach/udc.h>
> >> +#include <linux/platform_data/usb-ohci-pxa27x.h>
> >>
> >> #include "generic.h"
> >> #include "devices.h"
> >> @@ -680,6 +683,52 @@ static void __init z2_pmic_init(void)
> >> static inline void z2_pmic_init(void) {}
> >> #endif
> >>
> >>
+/*************************************************************************
> >> ***** + * USB Switch
> >> +
> >>
**************************************************************************
> >> ****/ +static struct platform_device z2_usb_switch = {
> >> + .name = "z2-usb-switch",
> >> + .id = -1,
> >> +};
> >> +
> >> +static void __init z2_usb_switch_init(void)
> >> +{
> >> + platform_device_register(&z2_usb_switch);
> >> +}
> >> +
> >>
+/*************************************************************************
> >> ***** + * USB Gadget
> >> +
> >>
**************************************************************************
> >> ****/ +#if defined(CONFIG_USB_GADGET_PXA27X) \
> >> + || defined(CONFIG_USB_GADGET_PXA27X_MODULE)
> >> +static int z2_udc_is_connected(void)
> >> +{
> >> + return 1;
> >> +}
> >> +
> >> +static struct pxa2xx_udc_mach_info z2_udc_info __initdata = {
> >> + .udc_is_connected = z2_udc_is_connected,
> >> + .gpio_pullup = -1,
> >> +};
> >> +
> >> +static void __init z2_udc_init(void)
> >> +{
> >> + pxa_set_udc_info(&z2_udc_info);
> >> +}
> >> +#else
> >> +static inline void z2_udc_init(void) {}
> >> +#endif
> >
> > We really should work on the DT here.
>
> Any volunteers? :) It requires huge amount of work,
Well, it's actually quite straight forward. With the changes that got
merged to 3.7, pxa3xx platforms boot, and I also ported some pxa specific
peripheral drivers that should work for both 2xx and 3xx. Adding CPU
support for 27x should also just be a matter of some extra lines.
So I would clearly say you should give the DT approach a try first and see
which bits are missing. And I would vote for not taking any new features
for the legay board support files but just bugfixes.
> and right now my goal
> is to get every piece of Z2 HW working with vanilla kernel, before those
changes
> are lost in my github repo. I see no advantages in moving Z2 to DT except
> self-education. I'm OK with DT, but it needs some time. Let's get non-DT
> version working properly first.
At least there is a reference :-) For mainline though, things should be
done right in the first place.
Daniel
>
> >>
+/*************************************************************************
> >> ***** + * USB Host (OHCI)
> >> +
> >>
**************************************************************************
> >> ****/ +static struct pxaohci_platform_data z2_ohci_platform_data = {
> >> + .port_mode = PMM_PERPORT_MODE,
> >> + .flags = ENABLE_PORT2 | NO_OC_PROTECTION,
> >> + .power_on_delay = 10,
> >> + .power_budget = 500,
> >> +};
> >> +
> >> #ifdef CONFIG_PM
> >> static void z2_power_off(void)
> >> {
> >> @@ -705,10 +754,12 @@ static void __init z2_init(void)
> >> pxa_set_ffuart_info(NULL);
> >> pxa_set_btuart_info(NULL);
> >> pxa_set_stuart_info(NULL);
> >> + pxa_set_ohci_info(&z2_ohci_platform_data);
> >>
> >> z2_lcd_init();
> >> z2_mmc_init();
> >> z2_mkp_init();
> >> + z2_udc_init();
> >
> > This patch adds _host_ ? So why do you have udc in here ?
>
> Both, host and device.
>
> > Besides, pxa_set_ohci_info() should also be wrapped in some
z2_uhc_init()
>
> OK
>
> >> z2_i2c_init();
> >> z2_spi_init();
> >> z2_nor_init();
> >> @@ -716,6 +767,7 @@ static void __init z2_init(void)
> >> z2_leds_init();
> >> z2_keys_init();
> >> z2_pmic_init();
> >> + z2_usb_switch_init();
> >>
> >> pm_power_off = z2_power_off;
> >> }
> >
> > Best regards,
> > Marek Vasut
>
> Regards
> Vasily
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121028/5f3462f4/attachment-0001.html>
^ permalink raw reply
* [PATCH v2 1/5] ARM: PXA: Add z2-usb-switch driver
From: Marek Vasut @ 2012-10-28 22:48 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <CA+E=qVccYJApm=zx7XvS5gbi0w3=HgKxRJQfXoStSMVhuVy9cQ@mail.gmail.com>
Dear Vasily Khoruzhick,
> On Mon, Oct 29, 2012 at 1:38 AM, Marek Vasut <marex@denx.de> wrote:
> > Dear Vasily Khoruzhick,
> >
> >> On Mon, Oct 29, 2012 at 12:57 AM, Marek Vasut <marex@denx.de> wrote:
> >> > Dear Vasily Khoruzhick,
> >>
> >> Dear Marek Vasut,
> >>
> >> >> This driver controls mode of USB port #2 pins - device or host.
> >> >
> >> > Please supply proper commit message. This short message describes
> >> > nothing.
> >>
> >> OK, "This driver allows user to choose USB port #2 mode between device
> >> and host" - that would be OK?
> >
> > Please describe why is this needed at all and what it does.
>
> Because one might need USB device and USB host functionality provided
> by USB port #2?
> It switches pins mode from device to host and backwards.
Good, now compile it into the commit message for v3 please.
> > [...]
> >
> >> > I wonder if we have no better means to control enforcement of mode.
> >>
> >> Why? sysfs fits nicely.
> >
> > Because if there is already an API to implement this OTG in kernel, you
> > should use that and not reinvent wheel.
>
> One needs to select USB mode manually (btw, Z2 can't even power USB
> device properly, only 3.3v or external 5v).
> There's no way to determine what type of device (device/host)
> connected to Z2 at the moment.
Good, so your OTG is software controlled.
[...]
Best regards,
Marek Vasut
^ permalink raw reply
* [PATCH v2 1/5] ARM: PXA: Add z2-usb-switch driver
From: Vasily Khoruzhick @ 2012-10-28 22:45 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <201210282338.03505.marex@denx.de>
On Mon, Oct 29, 2012 at 1:38 AM, Marek Vasut <marex@denx.de> wrote:
> Dear Vasily Khoruzhick,
>
>> On Mon, Oct 29, 2012 at 12:57 AM, Marek Vasut <marex@denx.de> wrote:
>> > Dear Vasily Khoruzhick,
>>
>> Dear Marek Vasut,
>>
>> >> This driver controls mode of USB port #2 pins - device or host.
>> >
>> > Please supply proper commit message. This short message describes
>> > nothing.
>>
>> OK, "This driver allows user to choose USB port #2 mode between device
>> and host" - that would be OK?
>
> Please describe why is this needed at all and what it does.
Because one might need USB device and USB host functionality provided
by USB port #2?
It switches pins mode from device to host and backwards.
> [...]
>
>> > I wonder if we have no better means to control enforcement of mode.
>>
>> Why? sysfs fits nicely.
>
> Because if there is already an API to implement this OTG in kernel, you should
> use that and not reinvent wheel.
One needs to select USB mode manually (btw, Z2 can't even power USB
device properly, only 3.3v or external 5v).
There's no way to determine what type of device (device/host)
connected to Z2 at the moment.
> [...]
>
> Best regards,
> Marek Vasut
Regards
Vasily
^ permalink raw reply
* [PATCH 2/5] ARM: PXA: Zipit Z2: Add USB host and device support
From: Marek Vasut @ 2012-10-28 22:43 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <CA+E=qVftf+A=U5CEvkFia4LMYgeU6iF5WpKPS3FVkf1d3rABFQ@mail.gmail.com>
Dear Vasily Khoruzhick,
[...]
> > We really should work on the DT here.
>
> Any volunteers? :)
Daniel, did you get anywhere with migrating PXA to DT please?
> It requires huge amount of work, and right now my goal
> is to get every piece of Z2 HW working with vanilla kernel, before those
> changes are lost in my github repo.
Good, but next time please focus on DT instead. It will need a massive amount of
work, indeed, but then it will also weed out some legacy code.
> I see no advantages in moving Z2 to DT
> except self-education.
One less platform file after the platform is fully DT, that's always good.
Besides, the legacy binding code is really annoying.
> I'm OK with DT, but it needs some time. Let's get
> non-DT version working properly first.
While I'm not saying I'm NAKing these, such attitude usually leads to people
abandoning the DT idea and running away right after the patches are applied.
Just my $0.02.
[...]
> >> + z2_udc_init();
> >
> > This patch adds _host_ ? So why do you have udc in here ?
>
> Both, host and device.
UDC == usb device controller.
[...]
Best regards,
Marek Vasut
^ permalink raw reply
* [PATCH 5/5] ARM: PXA: Zipit Z2: Fix backlight PWM device number
From: Marek Vasut @ 2012-10-28 22:39 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <CA+E=qVf_y6Opq9iE1r1J_2QpVsJJXW+3yiy0CrhmhmZ=0T6eqA@mail.gmail.com>
Dear Vasily Khoruzhick,
> On Mon, Oct 29, 2012 at 1:01 AM, Marek Vasut <marex@denx.de> wrote:
> > Dear Vasily Khoruzhick,
> >
> >> Recent changes to PXA PWM support changed the PXA27X PWM device
> >> numbering scheme, so keyboard and LCD backlight is not
> >> working anymore on Z2.
> >>
> >> Fix it and move from legacy to new PWM API.
> >
> > The proper fix here would be to start moving towards DT.
> >
> >> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
> >
> > [...]
> >
> > Best regards,
> > Marek Vasut
>
> Dear Marek Vasut,
>
> Sure, but it'll take some time. For now this simple fix is sufficient.
> I'll get DT working for pxa27x to familiarize myself with DT.
Good, please focus yourself onto DT as the legacy implementations are not too
favored anymore.
Best regards,
Marek Vasut
^ permalink raw reply
* [PATCH 2/5] ARM: PXA: Zipit Z2: Add USB host and device support
From: Vasily Khoruzhick @ 2012-10-28 22:38 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <201210282259.46491.marex@denx.de>
On Mon, Oct 29, 2012 at 12:59 AM, Marek Vasut <marex@denx.de> wrote:
> Dear Vasily Khoruzhick,
>
> missing commit message.
OK
>> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
>> ---
>> arch/arm/mach-pxa/z2.c | 52
>> ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52
>> insertions(+)
>>
>> diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c
>> index c97485f..ce90fa9 100644
>> --- a/arch/arm/mach-pxa/z2.c
>> +++ b/arch/arm/mach-pxa/z2.c
>> @@ -41,6 +41,9 @@
>> #include <linux/platform_data/mmc-pxamci.h>
>> #include <linux/platform_data/keypad-pxa27x.h>
>> #include <mach/pm.h>
>> +#include <mach/pxa27x-udc.h>
>> +#include <mach/udc.h>
>> +#include <linux/platform_data/usb-ohci-pxa27x.h>
>>
>> #include "generic.h"
>> #include "devices.h"
>> @@ -680,6 +683,52 @@ static void __init z2_pmic_init(void)
>> static inline void z2_pmic_init(void) {}
>> #endif
>>
>> +/*************************************************************************
>> ***** + * USB Switch
>> +
>> **************************************************************************
>> ****/ +static struct platform_device z2_usb_switch = {
>> + .name = "z2-usb-switch",
>> + .id = -1,
>> +};
>> +
>> +static void __init z2_usb_switch_init(void)
>> +{
>> + platform_device_register(&z2_usb_switch);
>> +}
>> +
>> +/*************************************************************************
>> ***** + * USB Gadget
>> +
>> **************************************************************************
>> ****/ +#if defined(CONFIG_USB_GADGET_PXA27X) \
>> + || defined(CONFIG_USB_GADGET_PXA27X_MODULE)
>> +static int z2_udc_is_connected(void)
>> +{
>> + return 1;
>> +}
>> +
>> +static struct pxa2xx_udc_mach_info z2_udc_info __initdata = {
>> + .udc_is_connected = z2_udc_is_connected,
>> + .gpio_pullup = -1,
>> +};
>> +
>> +static void __init z2_udc_init(void)
>> +{
>> + pxa_set_udc_info(&z2_udc_info);
>> +}
>> +#else
>> +static inline void z2_udc_init(void) {}
>> +#endif
>
> We really should work on the DT here.
Any volunteers? :) It requires huge amount of work, and right now my goal
is to get every piece of Z2 HW working with vanilla kernel, before those changes
are lost in my github repo. I see no advantages in moving Z2 to DT except
self-education. I'm OK with DT, but it needs some time. Let's get non-DT
version working properly first.
>> +/*************************************************************************
>> ***** + * USB Host (OHCI)
>> +
>> **************************************************************************
>> ****/ +static struct pxaohci_platform_data z2_ohci_platform_data = {
>> + .port_mode = PMM_PERPORT_MODE,
>> + .flags = ENABLE_PORT2 | NO_OC_PROTECTION,
>> + .power_on_delay = 10,
>> + .power_budget = 500,
>> +};
>> +
>> #ifdef CONFIG_PM
>> static void z2_power_off(void)
>> {
>> @@ -705,10 +754,12 @@ static void __init z2_init(void)
>> pxa_set_ffuart_info(NULL);
>> pxa_set_btuart_info(NULL);
>> pxa_set_stuart_info(NULL);
>> + pxa_set_ohci_info(&z2_ohci_platform_data);
>>
>> z2_lcd_init();
>> z2_mmc_init();
>> z2_mkp_init();
>> + z2_udc_init();
>
> This patch adds _host_ ? So why do you have udc in here ?
Both, host and device.
> Besides, pxa_set_ohci_info() should also be wrapped in some z2_uhc_init()
OK
>> z2_i2c_init();
>> z2_spi_init();
>> z2_nor_init();
>> @@ -716,6 +767,7 @@ static void __init z2_init(void)
>> z2_leds_init();
>> z2_keys_init();
>> z2_pmic_init();
>> + z2_usb_switch_init();
>>
>> pm_power_off = z2_power_off;
>> }
>
> Best regards,
> Marek Vasut
Regards
Vasily
^ permalink raw reply
* [PATCH v2 1/5] ARM: PXA: Add z2-usb-switch driver
From: Marek Vasut @ 2012-10-28 22:38 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <CA+E=qVdEPcBobVDODcyjZkbhZD6KXmGR7Fo5T40GRSPWNhujsQ@mail.gmail.com>
Dear Vasily Khoruzhick,
> On Mon, Oct 29, 2012 at 12:57 AM, Marek Vasut <marex@denx.de> wrote:
> > Dear Vasily Khoruzhick,
>
> Dear Marek Vasut,
>
> >> This driver controls mode of USB port #2 pins - device or host.
> >
> > Please supply proper commit message. This short message describes
> > nothing.
>
> OK, "This driver allows user to choose USB port #2 mode between device
> and host" - that would be OK?
Please describe why is this needed at all and what it does.
[...]
> > I wonder if we have no better means to control enforcement of mode.
>
> Why? sysfs fits nicely.
Because if there is already an API to implement this OTG in kernel, you should
use that and not reinvent wheel.
[...]
Best regards,
Marek Vasut
^ permalink raw reply
* [PATCH 4/5] ARM: PXA: Zipit Z2: Change active_state of power button
From: mark at engine12.com @ 2012-10-28 22:31 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <201210282301.04714.marex@denx.de>
full name include:
On 2012-10-28 15:01, Marek Vasut wrote:
> Dear Vasily Khoruzhick,
>
>> From: Mark Majeres <mark@engine12.com>
>
> Read [1]
>
>> Otherwise userspace might be confused about button state
>>
>> Signed-off-by: Mark Majeres <mark@engine12.com>
>
> Attribution of code shall be done only towards people known by their
> name.
>
>> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
>> ---
>> arch/arm/mach-pxa/z2.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c
>> index ce90fa9..fac7cba 100644
>> --- a/arch/arm/mach-pxa/z2.c
>> +++ b/arch/arm/mach-pxa/z2.c
>> @@ -437,7 +437,7 @@ static struct gpio_keys_button z2_pxa_buttons[]
>> = {
>> {
>> .code = KEY_POWER,
>> .gpio = GPIO1_ZIPITZ2_POWER_BUTTON,
>> - .active_low = 0,
>> + .active_low = 1,
>> .desc = "Power Button",
>> .wakeup = 1,
>> .type = EV_KEY,
>
> [1] http://lwn.net/Articles/195643/
>
> Best regards,
> Marek Vasut
^ permalink raw reply
* [PATCH v2 1/5] ARM: PXA: Add z2-usb-switch driver
From: Vasily Khoruzhick @ 2012-10-28 22:27 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <201210282257.48770.marex@denx.de>
On Mon, Oct 29, 2012 at 12:57 AM, Marek Vasut <marex@denx.de> wrote:
> Dear Vasily Khoruzhick,
Dear Marek Vasut,
>> This driver controls mode of USB port #2 pins - device or host.
>
> Please supply proper commit message. This short message describes nothing.
OK, "This driver allows user to choose USB port #2 mode between device
and host" - that would be OK?
> [...]
>
>> @@ -0,0 +1,100 @@
>> +/*
>> + * USB mode switcher for Z2
>> + *
>> + * Copyright (c) 2011 Vasily Khoruzhick
>
> 2012
Actually, it was implemented early in 2011, so 2011-2012
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2 as
>> + * published by the Free Software Foundation.
>> + *
>> + */
>> +
>> +#include <linux/kernel.h>
>> +#include <linux/module.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/delay.h>
>> +
>> +#include <mach/pxa27x.h>
>> +#include <mach/pxa27x-udc.h>
>> +
>> +#include <asm/io.h>
>> +
>> +#define MIN(a, b) ((a) < (b) ? (a) : (b))
>
> min() is already defined in kernel.h
OK
>> +static ssize_t usb_mode_show(struct device *dev, struct device_attribute
>> *attr, + char *buf)
>> +{
>> + if (UP2OCR & UP2OCR_HXS)
>> + return sprintf(buf, "host\n");
>> + else
>> + return sprintf(buf, "device\n");
>> +}
>> +
>> +static ssize_t usb_mode_set(struct device *dev, struct device_attribute
>> *attr, + const char *buf, size_t count)
>> +{
>> + if (strncmp(buf, "host", MIN(count, 4)) == 0) {
>> + UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
>> + return count;
>> + } else if (strncmp(buf, "device", MIN(count, 6)) == 0) {
>> + UP2OCR = UP2OCR_HXOE | UP2OCR_DPPUE;
>> + return count;
>> + }
>> + return -EINVAL;
>> +}
>> +
>> +static DEVICE_ATTR(usb_mode, 0644, usb_mode_show, usb_mode_set);
>
> I wonder if we have no better means to control enforcement of mode.
Why? sysfs fits nicely.
>> +static const struct attribute *attrs[] = {
>> + &dev_attr_usb_mode.attr,
>> + NULL,
>> +};
>> +
>> +static const struct attribute_group attr_group = {
>> + .attrs = (struct attribute **)attrs,
>> +};
>
> Isn't there some macro to do this assignment?
Will check
>> +static int z2_usb_switch_probe(struct platform_device *dev)
>
> Missing __devinit
OK
>> +{
>> + int res;
>> +
>> + res = sysfs_create_group(&dev->dev.kobj, &attr_group);
>> + if (res)
>> + return res;
>> +
>> + UP2OCR = UP2OCR_HXOE | UP2OCR_DPPUE;
>> +
>> + return 0;
>> +}
>> +
>> +static int __devexit z2_usb_switch_remove(struct platform_device *dev)
>> +{
>> + UP2OCR = UP2OCR_HXOE;
>> + sysfs_remove_group(&dev->dev.kobj, &attr_group);
>> +
>> + return 0;
>> +}
>> +
>> +static struct platform_driver z2_usb_switch_driver = {
>> + .probe = z2_usb_switch_probe,
>> + .remove = __devexit_p(z2_usb_switch_remove),
>> +
>> + .driver = {
>> + .name = "z2-usb-switch",
>> + .owner = THIS_MODULE,
>> + },
>> +};
>> +
>> +
>> +static int __init z2_usb_switch_init(void)
>> +{
>> + return platform_driver_register(&z2_usb_switch_driver);
>> +}
>> +
>> +static void __exit z2_usb_switch_exit(void)
>> +{
>> + platform_driver_unregister(&z2_usb_switch_driver);
>> +}
>> +
>> +module_init(z2_usb_switch_init);
>> +module_exit(z2_usb_switch_exit);
>
> module_platform_driver()
OK
> Best regards,
> Marek Vasut
Thanks for review!
Regards
Vasily
^ permalink raw reply
* [PATCH 5/5] ARM: PXA: Zipit Z2: Fix backlight PWM device number
From: Vasily Khoruzhick @ 2012-10-28 22:23 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <201210282301.45790.marex@denx.de>
On Mon, Oct 29, 2012 at 1:01 AM, Marek Vasut <marex@denx.de> wrote:
> Dear Vasily Khoruzhick,
>
>> Recent changes to PXA PWM support changed the PXA27X PWM device
>> numbering scheme, so keyboard and LCD backlight is not
>> working anymore on Z2.
>>
>> Fix it and move from legacy to new PWM API.
>
> The proper fix here would be to start moving towards DT.
>
>> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
> [...]
>
> Best regards,
> Marek Vasut
Dear Marek Vasut,
Sure, but it'll take some time. For now this simple fix is sufficient.
I'll get DT working for pxa27x to familiarize myself with DT.
Regards
Vasily
^ permalink raw reply
* [PATCH v3 4/4] irqchip: add to the directories part of the IRQ subsystem in MAINTAINERS
From: Thomas Petazzoni @ 2012-10-28 22:19 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1351462748-5224-1-git-send-email-thomas.petazzoni@free-electrons.com>
Now that the drivers/irqchip/ directory is getting more code, it needs
a maintainer. The obvious maintainer for it is Thomas Gleixner, who is
maintaining the overall IRQ subsystem. So we add drivers/irqchip/ in
the list of directories that are part of the IRQ subsystem.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Rob Herring <rob.herring@calxeda.com>
---
MAINTAINERS | 1 +
1 file changed, 1 insertion(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index 027ec2b..70bd390 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4034,6 +4034,7 @@ M: Thomas Gleixner <tglx@linutronix.de>
S: Maintained
T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq/core
F: kernel/irq/
+F: drivers/irqchip/
IRQ DOMAINS (IRQ NUMBER MAPPING LIBRARY)
M: Benjamin Herrenschmidt <benh@kernel.crashing.org>
--
1.7.9.5
^ permalink raw reply related
* [PATCH v3 3/4] arm: mvebu: move irq controller driver to drivers/irqchip
From: Thomas Petazzoni @ 2012-10-28 22:19 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1351462748-5224-1-git-send-email-thomas.petazzoni@free-electrons.com>
Now that the drivers/irqchip/ directory has a minimal infrastructure
to support the addition of irq controller driver, we move the irq
controller driver for Armada 370 and Armada XP ARM SoCs from the
arch/arm/mach-mvebu/ directory to the drivers/irqchip/ directory and
update the irqchip infrastructure to take into account this new
driver.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Stephen Warren <swarren@wwwdotorg.org>
Reviewed-by: Rob Herring <rob.herring@calxeda.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Gregory Clement <gregory.clement@free-electrons.com>
---
arch/arm/mach-mvebu/Makefile | 2 +-
arch/arm/mach-mvebu/armada-370-xp.c | 4 ++--
arch/arm/mach-mvebu/common.h | 3 ---
drivers/irqchip/Makefile | 1 +
.../irqchip}/irq-armada-370-xp.c | 25 +++++++++-----------
drivers/irqchip/irqchip.c | 6 +++++
drivers/irqchip/irqchip.h | 2 ++
7 files changed, 23 insertions(+), 20 deletions(-)
rename {arch/arm/mach-mvebu => drivers/irqchip}/irq-armada-370-xp.c (87%)
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
index 57f996b..7f4e9f4 100644
--- a/arch/arm/mach-mvebu/Makefile
+++ b/arch/arm/mach-mvebu/Makefile
@@ -2,4 +2,4 @@ ccflags-$(CONFIG_ARCH_MULTIPLATFORM) := -I$(srctree)/$(src)/include \
-I$(srctree)/arch/arm/plat-orion/include
obj-y += system-controller.o
-obj-$(CONFIG_MACH_ARMADA_370_XP) += armada-370-xp.o irq-armada-370-xp.o addr-map.o
+obj-$(CONFIG_MACH_ARMADA_370_XP) += armada-370-xp.o addr-map.o
diff --git a/arch/arm/mach-mvebu/armada-370-xp.c b/arch/arm/mach-mvebu/armada-370-xp.c
index 3d6c540..8e94888 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.c
+++ b/arch/arm/mach-mvebu/armada-370-xp.c
@@ -16,6 +16,7 @@
#include <linux/init.h>
#include <linux/of_platform.h>
#include <linux/io.h>
+#include <linux/irqchip.h>
#include <linux/time-armada-370-xp.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
@@ -57,8 +58,7 @@ static const char * const armada_370_xp_dt_board_dt_compat[] = {
DT_MACHINE_START(ARMADA_XP_DT, "Marvell Aramada 370/XP (Device Tree)")
.init_machine = armada_370_xp_dt_init,
.map_io = armada_370_xp_map_io,
- .init_irq = armada_370_xp_init_irq,
- .handle_irq = armada_370_xp_handle_irq,
+ .init_irq = irqchip_init,
.timer = &armada_370_xp_timer,
.restart = mvebu_restart,
.dt_compat = armada_370_xp_dt_board_dt_compat,
diff --git a/arch/arm/mach-mvebu/common.h b/arch/arm/mach-mvebu/common.h
index 02f89ea..f0eaa21 100644
--- a/arch/arm/mach-mvebu/common.h
+++ b/arch/arm/mach-mvebu/common.h
@@ -17,7 +17,4 @@
void mvebu_restart(char mode, const char *cmd);
-void armada_370_xp_init_irq(void);
-void armada_370_xp_handle_irq(struct pt_regs *regs);
-
#endif
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index 6b5a6e0..5148ffd 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -1,2 +1,3 @@
obj-$(CONFIG_IRQCHIP) += irqchip.o
obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o
+obj-$(CONFIG_ARCH_MVEBU) += irq-armada-370-xp.o
diff --git a/arch/arm/mach-mvebu/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
similarity index 87%
rename from arch/arm/mach-mvebu/irq-armada-370-xp.c
rename to drivers/irqchip/irq-armada-370-xp.c
index 5f5f939..140c6b3 100644
--- a/arch/arm/mach-mvebu/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -23,6 +23,7 @@
#include <linux/of_irq.h>
#include <linux/irqdomain.h>
#include <asm/mach/arch.h>
+#include <asm/mach/irq.h>
#include <asm/exception.h>
/* Interrupt Controller Registers Map */
@@ -77,8 +78,11 @@ static struct irq_domain_ops armada_370_xp_mpic_irq_ops = {
.xlate = irq_domain_xlate_onecell,
};
-static int __init armada_370_xp_mpic_of_init(struct device_node *node,
- struct device_node *parent)
+static asmlinkage void
+armada_370_xp_handle_irq(struct pt_regs *regs);
+
+int __init armada_370_xp_mpic_of_init(struct device_node *node,
+ struct device_node *parent)
{
u32 control;
@@ -98,11 +102,14 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node,
panic("Unable to add Armada_370_Xp MPIC irq domain (DT)\n");
irq_set_default_host(armada_370_xp_mpic_domain);
+
+ handle_arch_irq = armada_370_xp_handle_irq;
+
return 0;
}
-asmlinkage void __exception_irq_entry armada_370_xp_handle_irq(struct pt_regs
- *regs)
+static asmlinkage void __exception_irq_entry
+armada_370_xp_handle_irq(struct pt_regs *regs)
{
u32 irqstat, irqnr;
@@ -121,13 +128,3 @@ asmlinkage void __exception_irq_entry armada_370_xp_handle_irq(struct pt_regs
break;
} while (1);
}
-
-static const struct of_device_id mpic_of_match[] __initconst = {
- {.compatible = "marvell,mpic", .data = armada_370_xp_mpic_of_init},
- {},
-};
-
-void __init armada_370_xp_init_irq(void)
-{
- of_irq_init(mpic_of_match);
-}
diff --git a/drivers/irqchip/irqchip.c b/drivers/irqchip/irqchip.c
index e2496e4..f36d423 100644
--- a/drivers/irqchip/irqchip.c
+++ b/drivers/irqchip/irqchip.c
@@ -20,6 +20,12 @@ static const struct of_device_id irqchip_of_match[] __initconst = {
.data = bcm2835_irqchip_init,
},
#endif
+#ifdef CONFIG_ARCH_MVEBU
+ {
+ .compatible = "marvell,mpic",
+ .data = armada_370_xp_mpic_of_init,
+ },
+#endif
{},
};
diff --git a/drivers/irqchip/irqchip.h b/drivers/irqchip/irqchip.h
index 1075537..0a0d7af 100644
--- a/drivers/irqchip/irqchip.h
+++ b/drivers/irqchip/irqchip.h
@@ -12,5 +12,7 @@
#define _IRQCHIP_H
int bcm2835_irqchip_init(struct device_node *node, struct device_node *parent);
+int armada_370_xp_mpic_of_init(struct device_node *node,
+ struct device_node *parent);
#endif
--
1.7.9.5
^ permalink raw reply related
* [PATCH v3 2/4] arm: bcm2835: convert to the irqchip infrastructure
From: Thomas Petazzoni @ 2012-10-28 22:19 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1351462748-5224-1-git-send-email-thomas.petazzoni@free-electrons.com>
Register the irq controller driver in the main
drivers/irqchip/irqchip.c file, and make sure that the initialization
function of the driver sets handle_arch_irq() appropriately. This
requires a bit of movement in the driver since the
bcm2835_handle_irq() must move before the armctrl_of_init() function
to avoid a forward declaration.
On the arch/arm side, use irqchip_init() as the ->init_irq() callback,
and remove the definition of ->handle_irq() since this is now done by
the irq controller driver.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Reviewed-by: Rob Herring <rob.herring@calxeda.com>
---
arch/arm/mach-bcm2835/bcm2835.c | 5 ++---
drivers/irqchip/irq-bcm2835.c | 24 +++++++++++-------------
drivers/irqchip/irqchip.c | 6 ++++++
drivers/irqchip/irqchip.h | 2 ++
include/linux/irqchip/bcm2835.h | 29 -----------------------------
5 files changed, 21 insertions(+), 45 deletions(-)
delete mode 100644 include/linux/irqchip/bcm2835.h
diff --git a/arch/arm/mach-bcm2835/bcm2835.c b/arch/arm/mach-bcm2835/bcm2835.c
index f6fea49..ab1bccd 100644
--- a/arch/arm/mach-bcm2835/bcm2835.c
+++ b/arch/arm/mach-bcm2835/bcm2835.c
@@ -13,10 +13,10 @@
*/
#include <linux/init.h>
-#include <linux/irqchip/bcm2835.h>
#include <linux/of_platform.h>
#include <linux/bcm2835_timer.h>
#include <linux/clk/bcm2835.h>
+#include <linux/irqchip.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
@@ -56,8 +56,7 @@ static const char * const bcm2835_compat[] = {
DT_MACHINE_START(BCM2835, "BCM2835")
.map_io = bcm2835_map_io,
- .init_irq = bcm2835_init_irq,
- .handle_irq = bcm2835_handle_irq,
+ .init_irq = irqchip_init,
.init_machine = bcm2835_init,
.timer = &bcm2835_timer,
.dt_compat = bcm2835_compat
diff --git a/drivers/irqchip/irq-bcm2835.c b/drivers/irqchip/irq-bcm2835.c
index dc670cc..62d1dad 100644
--- a/drivers/irqchip/irq-bcm2835.c
+++ b/drivers/irqchip/irq-bcm2835.c
@@ -49,9 +49,11 @@
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/irqdomain.h>
-#include <linux/irqchip/bcm2835.h>
#include <asm/exception.h>
+#include <asm/mach/irq.h>
+
+#include "irqchip.h"
/* Put the bank and irq (32 bits) into the hwirq */
#define MAKE_HWIRQ(b, n) ((b << 5) | (n))
@@ -135,8 +137,10 @@ static struct irq_domain_ops armctrl_ops = {
.xlate = armctrl_xlate
};
-static int __init armctrl_of_init(struct device_node *node,
- struct device_node *parent)
+static asmlinkage void bcm2835_handle_irq(struct pt_regs *regs);
+
+int __init bcm2835_irqchip_init(struct device_node *node,
+ struct device_node *parent)
{
void __iomem *base;
int irq, b, i;
@@ -164,16 +168,10 @@ static int __init armctrl_of_init(struct device_node *node,
set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
}
}
- return 0;
-}
-static struct of_device_id irq_of_match[] __initconst = {
- { .compatible = "brcm,bcm2835-armctrl-ic", .data = armctrl_of_init }
-};
+ handle_arch_irq = bcm2835_handle_irq;
-void __init bcm2835_init_irq(void)
-{
- of_irq_init(irq_of_match);
+ return 0;
}
/*
@@ -199,8 +197,8 @@ static void armctrl_handle_shortcut(int bank, struct pt_regs *regs,
handle_IRQ(irq_linear_revmap(intc.domain, irq), regs);
}
-asmlinkage void __exception_irq_entry bcm2835_handle_irq(
- struct pt_regs *regs)
+static asmlinkage void __exception_irq_entry
+bcm2835_handle_irq(struct pt_regs *regs)
{
u32 stat, irq;
diff --git a/drivers/irqchip/irqchip.c b/drivers/irqchip/irqchip.c
index 410f99f..e2496e4 100644
--- a/drivers/irqchip/irqchip.c
+++ b/drivers/irqchip/irqchip.c
@@ -14,6 +14,12 @@
#include "irqchip.h"
static const struct of_device_id irqchip_of_match[] __initconst = {
+#ifdef CONFIG_ARCH_BCM2835
+ {
+ .compatible = "brcm,bcm2835-armctrl-ic",
+ .data = bcm2835_irqchip_init,
+ },
+#endif
{},
};
diff --git a/drivers/irqchip/irqchip.h b/drivers/irqchip/irqchip.h
index 1e7a5c2..1075537 100644
--- a/drivers/irqchip/irqchip.h
+++ b/drivers/irqchip/irqchip.h
@@ -11,4 +11,6 @@
#ifndef _IRQCHIP_H
#define _IRQCHIP_H
+int bcm2835_irqchip_init(struct device_node *node, struct device_node *parent);
+
#endif
diff --git a/include/linux/irqchip/bcm2835.h b/include/linux/irqchip/bcm2835.h
deleted file mode 100644
index 48a859b..0000000
--- a/include/linux/irqchip/bcm2835.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2010 Broadcom
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef __LINUX_IRQCHIP_BCM2835_H_
-#define __LINUX_IRQCHIP_BCM2835_H_
-
-#include <asm/exception.h>
-
-extern void bcm2835_init_irq(void);
-
-extern asmlinkage void __exception_irq_entry bcm2835_handle_irq(
- struct pt_regs *regs);
-
-#endif
--
1.7.9.5
^ permalink raw reply related
* [PATCH v3 1/4] irqchip: add basic infrastructure
From: Thomas Petazzoni @ 2012-10-28 22:19 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1351462748-5224-1-git-send-email-thomas.petazzoni@free-electrons.com>
With the recent creation of the drivers/irqchip/ directory, it is
desirable to move irq controller drivers here. At the moment, the only
driver here is irq-bcm2835, the driver for the irq controller found in
the ARM BCM2835 SoC, present in Rasberry Pi systems. This irq
controller driver was exporting its initialization function and its
irq handling function through a header file in
<linux/irqchip/bcm2835.h>.
When proposing to also move another irq controller driver in
drivers/irqchip, Rob Herring raised the very valid point that moving
things to drivers/irqchip was good in order to remove more stuff from
arch/arm, but if it means adding gazillions of headers files in
include/linux/irqchip/, it would not be very nice.
So, upon the suggestion of Rob Herring and Arnd Bergmann, this commit
introduces a small infrastructure that defines a central
irqchip_init() function in drivers/irqchip/irqchip.c, which is meant
to be called as the ->init_irq() callback of ARM platforms. This
function calls of_irq_init() with an array that will progressively
contain the compatible strings of each irq controller driver, and also
a reference to the initialization functions of such drivers. The
drivers/irqchip/irqchip.h header file, currently empty, is added to
allow irq controller drivers to expose their initialization function
to the main irqchip.c file. Note that the irq controller driver
initialization function is responsible for setting the global
handle_arch_irq() variable, so that ARM platforms no longer have to
define the ->handle_irq field in their DT_MACHINE structure.
A global header, <linux/irqchip.h> is also added to expose the single
irqchip_init() function to the reset of the kernel.
A further commit moves the BCM2835 irq controller driver to this new
small infrastructure, therefore removing the include/linux/irqchip/
directory.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Stephen Warren <swarren@wwwdotorg.org>
Reviewed-by: Rob Herring <rob.herring@calxeda.com>
---
drivers/irqchip/Kconfig | 4 +++-
drivers/irqchip/Makefile | 1 +
drivers/irqchip/irqchip.c | 23 +++++++++++++++++++++++
drivers/irqchip/irqchip.h | 14 ++++++++++++++
include/linux/irqchip.h | 16 ++++++++++++++++
5 files changed, 57 insertions(+), 1 deletion(-)
create mode 100644 drivers/irqchip/irqchip.c
create mode 100644 drivers/irqchip/irqchip.h
create mode 100644 include/linux/irqchip.h
diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index 1bb8bf6..88b0929 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -1 +1,3 @@
-# empty
+config IRQCHIP
+ def_bool y
+ depends on OF_IRQ
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index 054321d..6b5a6e0 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -1 +1,2 @@
+obj-$(CONFIG_IRQCHIP) += irqchip.o
obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o
diff --git a/drivers/irqchip/irqchip.c b/drivers/irqchip/irqchip.c
new file mode 100644
index 0000000..410f99f
--- /dev/null
+++ b/drivers/irqchip/irqchip.c
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2012 Thomas Petazzoni
+ *
+ * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/init.h>
+#include <linux/of_irq.h>
+
+#include "irqchip.h"
+
+static const struct of_device_id irqchip_of_match[] __initconst = {
+ {},
+};
+
+void __init irqchip_init(void)
+{
+ of_irq_init(irqchip_of_match);
+}
diff --git a/drivers/irqchip/irqchip.h b/drivers/irqchip/irqchip.h
new file mode 100644
index 0000000..1e7a5c2
--- /dev/null
+++ b/drivers/irqchip/irqchip.h
@@ -0,0 +1,14 @@
+/*
+ * Copyright (C) 2012 Thomas Petazzoni
+ *
+ * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#ifndef _IRQCHIP_H
+#define _IRQCHIP_H
+
+#endif
diff --git a/include/linux/irqchip.h b/include/linux/irqchip.h
new file mode 100644
index 0000000..e0006f1
--- /dev/null
+++ b/include/linux/irqchip.h
@@ -0,0 +1,16 @@
+/*
+ * Copyright (C) 2012 Thomas Petazzoni
+ *
+ * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#ifndef _LINUX_IRQCHIP_H
+#define _LINUX_IRQCHIP_H
+
+void irqchip_init(void);
+
+#endif
--
1.7.9.5
^ permalink raw reply related
* [PATCH v3] Introduce minimal irqchip infrastructure
From: Thomas Petazzoni @ 2012-10-28 22:19 UTC (permalink / raw)
To: linux-arm-kernel
Thomas, Rob, Arnd,
Here is a small set of patches that introduces a small irqchip
infrastructure that allows the registration of irqchip drivers without
having each of those drivers to expose a public API in
include/linux/irqchip/ (patch 1/4), moves the only existing irqchip
driver, irq-bcm2835 to this infrastructure (patch 2/4), moves the
irqchip driver for the Armada 370 / Armada XP SoCs to the
drivers/irqchip directory (patch 3/4) and finally adds the
drivers/irqchip directory to the IRQ subsystem entry in the
MAINTAINERS file (patch 4/4).
Changes since v2:
* Fixed the entry in the MAINTAINERS file. Noticed by Rob Herring.
* Simplified the Kconfig logic by making the IRQCHIP option enabled
by default as soon as OF_IRQ is enabled. The individual ARCH_<foo>
Kconfig options no longer have to select IRQCHIP. Also, the option
was renamed from USE_IRQCHIP to just IRQCHIP. Suggested by Rob
Herring.
* Added Reviewed-by tags given by Rob Herring.
Changes since v1:
* Add a new patch mentionning the drivers/irqchip in the list of
directories part of the IRQ subsystem maintained by Thomas Gleixner
in the MAINTAINERS file. Requested by Arnd Bergmann.
* Reduce the amount of code movement in the irq-bcm2835.c and
irq-armada-370-xp.c files by using one forward declaration for the
IRQ handling entry point. Requested by Stephen Warren.
* Rename the armctrl_of_init() function to bcm2835_irqchip_init() as
requested by Stephen Warren.
* Added the formal Acked-by and Reviewed-by received from Stephen
Warren.
Thanks,
Thomas
^ 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