On Mon, Sep 3, 2018 at 11:07 PM Georgii Staroselskii <georgii.starosels...@emlid.com> wrote: > > This API is going to be used to configure some pins that are protected > for simple modification. > > It's not a comprehensive pinctrl driver but can be turned into one > when we need this in the future. Now it is planned to be used only > in one place. So that's why I decided not to polute the codebase with a > full-blown pinctrl-merrifield nobody will use. > > This driver reads corresponding fields in DT and configures pins > accordingly. > > The "protected" flag is used to distinguish configuration of SCU-owned > pins from the ordinary ones. > > The code has been adapted from Linux work done by Andy Shevchenko > in pinctrl-merrfifield.c > > Signed-off-by: Georgii Staroselskii <georgii.starosels...@emlid.com> > --- > arch/x86/cpu/tangier/Makefile | 2 +- > arch/x86/cpu/tangier/pinmux.c | 188 > ++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 189 insertions(+), 1 deletion(-) > create mode 100644 arch/x86/cpu/tangier/pinmux.c >
BTW: some more styling issues. > diff --git a/arch/x86/cpu/tangier/Makefile b/arch/x86/cpu/tangier/Makefile > index 8274482..68f4a32 100644 > --- a/arch/x86/cpu/tangier/Makefile > +++ b/arch/x86/cpu/tangier/Makefile > @@ -2,5 +2,5 @@ > # > # Copyright (c) 2017 Intel Corporation > > -obj-y += car.o tangier.o sdram.o sysreset.o > +obj-y += car.o tangier.o sdram.o sysreset.o pinmux.o > obj-$(CONFIG_GENERATE_ACPI_TABLE) += acpi.o > diff --git a/arch/x86/cpu/tangier/pinmux.c b/arch/x86/cpu/tangier/pinmux.c > new file mode 100644 > index 0000000..c59b63c > --- /dev/null > +++ b/arch/x86/cpu/tangier/pinmux.c > @@ -0,0 +1,188 @@ > +// SPDX-License-Identifier: GPL-2.0+ > +/* > + * Copyright (c) 2018 Emlid Limited > + */ > + > +#include <common.h> > +#include <dm.h> > +#include <dm/pinctrl.h> > +#include <fdtdec.h> > +#include <regmap.h> > +#include <syscon.h> > +#include <asm/cpu.h> > +#include <asm/scu.h> > +#include <linux/io.h> > + > +#define BUFCFG_OFFSET 0x100 > + > +#define MRFLD_FAMILY_LEN 0x400 > + > +/* These are taken from Linux kernel */ > +#define MRFLD_PINMODE_MASK 0x07 > + > +#define pin_to_bufno(f, p) ((p) - (f)->pin_base) > + It would be good if you can make the above 4 defines the same indention so that they all look aligned. > +struct mrfld_family { > + unsigned int family_number; > + unsigned int pin_base; > + size_t npins; > + void __iomem *regs; > +}; > + > +#define MRFLD_FAMILY(b, s, e) \ > + { \ nits: and here the ending \ is not aligned with other lines > + .family_number = (b), \ > + .pin_base = (s), \ > + .npins = (e) - (s) + 1, \ > + } > + [snip] Regards, Bin _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot