[OpenWrt-Devel] [PATCH 2/2 v3] linux: add support of Synopsys ARC770-based boards

Jonas Gorski jogo at openwrt.org
Fri Nov 6 05:58:53 EST 2015


Hi Alexey,

On Thu, Nov 5, 2015 at 8:39 PM, Alexey Brodkin
<Alexey.Brodkin at synopsys.com> wrote:
> Hi Jonas,
>
> On Thu, 2015-11-05 at 20:04 +0100, Jonas Gorski wrote:
>> Hi Alexey,
>>
>> On Thu, Nov 5, 2015 at 7:14 PM, Alexey Brodkin
>> <Alexey.Brodkin at synopsys.com> wrote:
>> > Hi Jonas,
>> >
>> > On Wed, 2015-11-04 at 20:22 +0300, Alexey Brodkin wrote:
>> > > Hi Jonas,
>> > >
>> > > On Wed, 2015-11-04 at 13:06 +0100, Jonas Gorski wrote:
>> > > > Hi,
>> > > >
>> > > > On Tue, Nov 3, 2015 at 12:27 AM, Alexey Brodkin
>> > > > <Alexey.Brodkin at synopsys.com> wrote:
>> > > > > +       ;;
>> > > > > +esac
>> > > > > +
>> > > > > +uci commit network
>> > > > > +
>> > > > > +exit 0
>> > > > > diff --git a/target/linux/arc770/base-files/lib/arc.sh b/target/linux/arc770/base-files/lib/arc.sh
>> > > > > new file mode 100644
>> > > > > index 0000000..b15e94b
>> > > > > --- /dev/null
>> > > > > +++ b/target/linux/arc770/base-files/lib/arc.sh
>> > > > > @@ -0,0 +1,76 @@
>> > > > > +#!/bin/sh
>> > > > > +#
>> > > > > +# Copyright (C) 2015 OpenWrt.org
>> > > > > +#
>> > > > > +
>> > > > > +# defaults
>> > > > > +ARC_BOARD_NAME="generic"
>> > > > > +ARC_BOARD_MODEL="Generic arc board"
>> > > > > +
>> > > > > +arc_board_detect() {
>> > > > > +       local board
>> > > > > +       local model
>> > > > > +
>> > > > > +       [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
>> > > > > +
>> > > > > +       model="$( cat /proc/device-tree/compatible )"
>> > > > > +
>> > > > > +       # We cannot just use "model" as it is because in case of SDP board
>> > > >
>> > > > ePAPR says your dts root nodes must have a "model" property that
>> > > > uniquely identifies the board. I see that is currently missing even in
>> > > > upstream, so please fix your dts files. Then you won't need to grep in
>> > > > the compatible. On a side node, ePAPR also says that the recommended
>> > > > format is the same as compatible but .. *looks at arm* .. apparently
>> > > > nobody does that.
>> > >
>> > > Indeed "model" is a required property.
>> > > So thanks for that suggestion.
>> > >
>> > > Then we'll have:
>> > > ---------------->8------------------
>> > > compatible = "snps,arc-sdp";
>> > > model = "snps,axs101";
>>
>> Grepping through the different arch's dts directories, some arches use
>> compatible like model values (e.g. powerpc), some use free text values
>> (e.g. arm). Might be something discuss worthy for devicetree ML how
>> this spec "violation" should be handled. Especially since the example
>> in Documentation/devicetree/usage-model.txt doesn't have one.
>>
>> > > ---------------->8------------------
>> > > which looks for sure much better!
>> > >
>> > > Will do this for starters here in OpenWRT and will submit a patch upstream
>> > > in Linux kernel.
>> >
>> > I started to think about it and now I understand why we use complicated
>> > "compatible" value.
>> >
>> > This allows us to use multiple platform-specific parts at once.
>> > We use "snps,arc-sdp" here:
>> > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arc/kernel/devtree.c#n35
>> > and "snps,axs101" here:
>> > http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arc/plat-axs10x/axs10x.c#n464
>> >
>> > In the first case it's not really necessary to use "compatible" node but
>> > it's usage is quite convenient, see we only need to execute this oneliner:
>> > -------------------->8----------------------
>> > of_flat_dt_is_compatible(dt_root, "snps,arc-sdp")
>> > -------------------->8----------------------
>> >
>> > But if we use "model" node instead we'll need to do:
>> > 1) of_get_property
>> > 2) strcmp
>> >
>> > This is a bit longer, still possible solution.
>> >
>> > So even though your proposal is very useful and I'm going to discuss it
>> > with Vineet Gupta (ARC Linux maintainer) but if you don't mind I'd go
>> > without that change for this submission. Then if your proposal is implemented
>> > I'll need to rework OpenWRT scripts anyways because newer upstream kernel
>> > will require that.
>> >
>> > Are you OK with that?
>>
>> My suggestion was only for the model detection script part, not to
>> modify anything in the kernel (apart from adding a model property to
>> the dts files). The kernel should just keep using the compatible
>> property as it properly handles multiple compatible names etc, and it
>> doesn't need to be unique.
>
> So should I just add "model" property in .dts files in OpenWRT and correct
> init scripts? This all without patching kernel itself essentially.

Yes, that is my suggestion. Just add a new model property without
touching any of the other ones.


Jonas

P.S: It's "OpenWrt", not "OpenWRT" ;p
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list