| Message ID | 20200702084820.35942-1-jagan@amarulasolutions.com |
|---|---|
| State | New |
| Headers |
Return-Path: <linux-amarula+bncBD7MFH7A7EEBB4V6633QKGQEOPEW6NA@amarulasolutions.com> X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 02FA33F082 for <linux-amarula@patchwork.amarulasolutions.com>; Thu, 2 Jul 2020 10:48:52 +0200 (CEST) Received: by mail-pj1-f72.google.com with SMTP id bf1sf11284120pjb.6 for <linux-amarula@patchwork.amarulasolutions.com>; Thu, 02 Jul 2020 01:48:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1593679731; cv=pass; d=google.com; s=arc-20160816; b=nZVlCCDPhFVCR/fmQS0V3r6EMQIU9PlCytkE+SHEVvricTmpyE2sO2KF1HcjVrBm/s wx0nOLeHNOVeQZRmEuhU+TENg6I86efgWmpK+xjhptKlTSIMHjxuxBAODgkMikI20tv2 zvWIADRayzhT0FKFZqdW6EIwt0XSFd/SZaHC45jEZE6pkpLMDahxIOHDEHIfcREFzloS 3Wum0rv64flocFGo1puYEJerblJ8dh/9zYvQ5qbPLdVHZbCQV2oQZtfHUvPK9/SX5WJl kfDMpQ7qTwa+9qXnOIbTNdv+u0AtTLLXDq8TfAjD7Rwcwrr9DRpVKK84d/bwDj6a0Ohs lSMQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:message-id:date:subject:cc:to :from:dkim-signature; bh=OBdihWLyoqePD5iTzWyIom4Jsgl6YKLyibM9pCsplJA=; b=NU43eChY3Zq8Esb551rVoRKUIB0DgiwwLMk5ioGybesATCbGy8abOSQG3YfdoWbBzY qdMXT7ZEwOjmHiAROsazLJPZqz/rqWfEwStBrU1V/6lNgkgt+TTXKYeIattYUhY068JB La/pjFAjnVKwu7Bmx+3MBM4RL9Ev3zeXmrt6DzLfH0HSROtMPt7+F2ZRdue+imtvDg5K FneiWTn4ZaXdBHQYoOocE/CoVYL9/h11d3t30mXgxEYFe/+Ypsm3jI0T6nKE5Ca2Hloc v3qDl9BAtVtPgxKT+duC2hDCGT65XSVyW87H0JcmyE4Mz2Qb71PafNimd1KWwcT9NVt/ HsNw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=FJxO5+ir; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=OBdihWLyoqePD5iTzWyIom4Jsgl6YKLyibM9pCsplJA=; b=PeBT972TwHBIjcYs/+drPIi0/eDESP4Dxg19c81EGoLRHsdxSv97TLfj4R6vCp5bKC PIpk0C6yNaw9v6Ph/u3S4cwmDmRHK7ZNvJJgGkLor6s6uW7r0NyIWv/UTAUAKzmirpaF WnByH4PkLWjEfs50QkGHEPQKZ68/7rzUtmRJQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help :list-archive:list-unsubscribe; bh=OBdihWLyoqePD5iTzWyIom4Jsgl6YKLyibM9pCsplJA=; b=ewdNtZT2sQCSeiv1cY2ui1x9tg3ypkoqmHcPhO1ZVI7ba+gGWULWOUjRiYf1QMzRwL mEu5jiy1JHP9YnjtJWkFiuJfZzhCjGH8Rh2ESaNaGPUPiZDzx3EwwMfHQvkr9Ly5kcik b4Cxysoj9//1hxM0wcNMhxtRDuvHPd9HUmRL0JrAnKZnECHXY6VOX67dqH6ZE1hUph25 mbtM//la2fiRCIaxdjYgNs1ZtjceJX6fVbcpoNCCnOAVveKTQhM8lxeHAwS0Kk+6SMrm WvG+bRL/1vICNefSTePO0Xx4XyLVB5s7nzEjLWKNCHzeSSIuu889+Zce4KSCKvXfBP3K iRzg== X-Gm-Message-State: AOAM532fUlQf52GY8Z3spO3nIaTg+i14y3uTCz/V0X6+vOa4o8AmyrUV ar3atvbNedRfs5AX6EPwexpCaF1z X-Google-Smtp-Source: ABdhPJzwfqsLp4US75mIgacFSEVZwl/zZXMgIEZwchqiSo5d6RbT3BCgRyoNqKzh+ooGW0LpO9uU+Q== X-Received: by 2002:a17:90a:2367:: with SMTP id f94mr32837274pje.20.1593679730918; Thu, 02 Jul 2020 01:48:50 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a62:8446:: with SMTP id k67ls1633417pfd.5.gmail; Thu, 02 Jul 2020 01:48:50 -0700 (PDT) X-Received: by 2002:a63:1f09:: with SMTP id f9mr23137785pgf.324.1593679730422; Thu, 02 Jul 2020 01:48:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593679730; cv=none; d=google.com; s=arc-20160816; b=ShRN5Jjwi6d3ewVyxecmheH3Gg72iAEdYeyR3lAUitGMiy6XFQrzE/OAy1dVMPW2xU z5n2yTuD2oKW7TjQvQ/HSqm+auc1SboUS5EdPxASxES9KA9wvKpF6CCOflNpgil//8/B qXhUY/AeR/mUuCOiimaAhBmtG0fKR758BIov/kdN5uJUO+/wQgXr+XogOJ+TPpDSCqiP ljxAWkqTQxQKcE4NKSyd5w/4p3bt1fOU6Zr+LjKqEB9ODsNCShGUnTKUBgpyfEML3cTy ZuqosBd/n1ZYpQVgF/RqXE15PbxET+W8fHyrSmzGvnk1qzIgo3dgSGTUSnD4TyXyzgCd /GOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=wY3+1bQy75Ooj4SRznvIgDDKWK1pDcQ+Z/6oKkhYiic=; b=g0/9+fNeJ4u3eGgr5HybSP9GF5iJzXehqsNnnqz07bqj2anKRCIyR5x82uIPEGL08z Qscy7l7kSCskH6qmDud5Ggti4oA9XP9iHnvGLkxkk7QMso3T4MaQFloYDby1ugoeoYr2 XrMfrFCz5XNLPoCzgQ3SM308duMKBwsCRYva/xmxaM2eIB6MAOmUSU/po8isSAWfVHQ4 B9+IL1SyKYZibTk63nGArUDXG+8rbXB8oyQsuBUk4NqSflGSLvdBmse5NNFlU08Mu+OO FvQhCtFiEE10EoMhRevZpzXeY1mwTx+7+4OhArtxlSVPvcgbDJMDGchc95qCvf6JFGUS hiBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=FJxO5+ir; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id v11sor10692517pfu.96.2020.07.02.01.48.50 for <linux-amarula@amarulasolutions.com> (Google Transport Security); Thu, 02 Jul 2020 01:48:50 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:aa7:9736:: with SMTP id k22mr26808526pfg.62.1593679729845; Thu, 02 Jul 2020 01:48:49 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c809:c7d5:a961:9b2e:1b93:8ca7]) by smtp.gmail.com with ESMTPSA id q92sm7413406pjh.12.2020.07.02.01.48.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 01:48:49 -0700 (PDT) From: Jagan Teki <jagan@amarulasolutions.com> To: Kever Yang <kever.yang@rock-chips.com>, Philipp Tomsich <philipp.tomsich@theobroma-systems.com>, Simon Glass <sjg@chromium.org>, heiko@sntech.de, mylene.josserand@collabora.com Cc: Suniel Mahesh <sunil@amarulasolutions.com>, Michael Trimarchi <michael@amarulasolutions.com>, U-Boot-Denx <u-boot@lists.denx.de>, linux-rockchip@lists.infradead.org, linux-amarula <linux-amarula@amarulasolutions.com>, Jagan Teki <jagan@amarulasolutions.com> Subject: [PATCH] rockchip: rk3288: Add OF board setup Date: Thu, 2 Jul 2020 14:18:20 +0530 Message-Id: <20200702084820.35942-1-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=FJxO5+ir; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: <linux-amarula.amarulasolutions.com> X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/post>, <mailto:linux-amarula@amarulasolutions.com> List-Help: <https://support.google.com/a/amarulasolutions.com/bin/topic.py?topic=25838>, <mailto:linux-amarula+help@amarulasolutions.com> List-Archive: <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/> List-Unsubscribe: <mailto:googlegroups-manage+476853432473+unsubscribe@googlegroups.com>, <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/subscribe> |
| Series |
rockchip: rk3288: Add OF board setup
|
|
Commit Message
Jagan Teki
July 2, 2020, 8:48 a.m. UTC
The new rk3288 revision rk3288w has some changes with respect
to legacy rk3288 like hclk_vio and usb host0 ohci.
In order to work these on the same in Linux kernel update the
compatible the root compatible with rockchip,rk3288w before
booting.
So, this support during of board setup code of rk3288.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
arch/arm/mach-rockchip/Kconfig | 1 +
arch/arm/mach-rockchip/rk3288/rk3288.c | 26 ++++++++++++++++++++++++++
2 files changed, 27 insertions(+)
Comments
On 2020-07-02 09:48, Jagan Teki wrote: > The new rk3288 revision rk3288w has some changes with respect > to legacy rk3288 like hclk_vio and usb host0 ohci. > > In order to work these on the same in Linux kernel update the > compatible the root compatible with rockchip,rk3288w before > booting. > > So, this support during of board setup code of rk3288. > > Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> > --- > arch/arm/mach-rockchip/Kconfig | 1 + > arch/arm/mach-rockchip/rk3288/rk3288.c | 26 ++++++++++++++++++++++++++ > 2 files changed, 27 insertions(+) > > diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig > index b1008a5058..822d8d4e9c 100644 > --- a/arch/arm/mach-rockchip/Kconfig > +++ b/arch/arm/mach-rockchip/Kconfig > @@ -98,6 +98,7 @@ config ROCKCHIP_RK322X > config ROCKCHIP_RK3288 > bool "Support Rockchip RK3288" > select CPU_V7A > + select OF_BOARD_SETUP > select SUPPORT_SPL > select SPL > select SUPPORT_TPL > diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c > index 804abe8a1b..8a682675e6 100644 > --- a/arch/arm/mach-rockchip/rk3288/rk3288.c > +++ b/arch/arm/mach-rockchip/rk3288/rk3288.c > @@ -115,6 +115,32 @@ int rk_board_late_init(void) > return rk3288_board_late_init(); > } > > +#ifdef CONFIG_OF_BOARD_SETUP > + > +#define RK3288_HDMI_PHYS 0xff980000 > +#define RK3288W_HDMI_REV 0x1A > +#define HDMI_CONFIG0_ID 0x04 > + > +int ft_board_setup(void *blob, bd_t *bd) > +{ > + u8 config0; > + int ret; > + > + config0 = readb(RK3288_HDMI_PHYS + HDMI_CONFIG0_ID); > + if (config0 == RK3288W_HDMI_REV) { > + ret = fdt_setprop_string(blob, 0, > + "compatible", "rockchip,rk3288w"); Does this end up replacing the entire top-level compatible property? i.e. from: compatible = "vendor,board\0rockchip,rk3288"; to just: compatible = "rockchip,rk3288w"; If so, that's a bit of a problem for various drivers that care about the actual board compatible rather than the SoC. Robin. > + if (ret < 0) { > + printf("failed to set rk3288w compatible (ret=%d)\n", > + ret); > + return ret; > + } > + } > + > + return 0; > +} > +#endif > + > static int do_clock(struct cmd_tbl *cmdtp, int flag, int argc, > char *const argv[]) > { >
On Thu, Jul 2, 2020 at 7:26 PM Robin Murphy <robin.murphy@arm.com> wrote: > > On 2020-07-02 09:48, Jagan Teki wrote: > > The new rk3288 revision rk3288w has some changes with respect > > to legacy rk3288 like hclk_vio and usb host0 ohci. > > > > In order to work these on the same in Linux kernel update the > > compatible the root compatible with rockchip,rk3288w before > > booting. > > > > So, this support during of board setup code of rk3288. > > > > Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> > > --- > > arch/arm/mach-rockchip/Kconfig | 1 + > > arch/arm/mach-rockchip/rk3288/rk3288.c | 26 ++++++++++++++++++++++++++ > > 2 files changed, 27 insertions(+) > > > > diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig > > index b1008a5058..822d8d4e9c 100644 > > --- a/arch/arm/mach-rockchip/Kconfig > > +++ b/arch/arm/mach-rockchip/Kconfig > > @@ -98,6 +98,7 @@ config ROCKCHIP_RK322X > > config ROCKCHIP_RK3288 > > bool "Support Rockchip RK3288" > > select CPU_V7A > > + select OF_BOARD_SETUP > > select SUPPORT_SPL > > select SPL > > select SUPPORT_TPL > > diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c > > index 804abe8a1b..8a682675e6 100644 > > --- a/arch/arm/mach-rockchip/rk3288/rk3288.c > > +++ b/arch/arm/mach-rockchip/rk3288/rk3288.c > > @@ -115,6 +115,32 @@ int rk_board_late_init(void) > > return rk3288_board_late_init(); > > } > > > > +#ifdef CONFIG_OF_BOARD_SETUP > > + > > +#define RK3288_HDMI_PHYS 0xff980000 > > +#define RK3288W_HDMI_REV 0x1A > > +#define HDMI_CONFIG0_ID 0x04 > > + > > +int ft_board_setup(void *blob, bd_t *bd) > > +{ > > + u8 config0; > > + int ret; > > + > > + config0 = readb(RK3288_HDMI_PHYS + HDMI_CONFIG0_ID); > > + if (config0 == RK3288W_HDMI_REV) { > > + ret = fdt_setprop_string(blob, 0, > > + "compatible", "rockchip,rk3288w"); > > Does this end up replacing the entire top-level compatible property? > i.e. from: > > compatible = "vendor,board\0rockchip,rk3288"; > > to just: > > compatible = "rockchip,rk3288w"; > > If so, that's a bit of a problem for various drivers that care about the > actual board compatible rather than the SoC. Yes, It looks replacing the entire compatible. I think the root compatible is mostly untouchable because of this reason. But, if we skip the root compatible and trying to replace individual nodes for W revision then it requires extra registration code on in the Linux drivers like Linux clock driver is registering the clock with rockchip,rk3288-cru but updating this compatible with rockchip,rk3288w-cru will require another registration code. Having common rockchip,rk3288w can be possible to check any code in the tree. Jagan.
On 2020-07-03 11:10, Jagan Teki wrote: > On Thu, Jul 2, 2020 at 7:26 PM Robin Murphy <robin.murphy@arm.com> wrote: >> >> On 2020-07-02 09:48, Jagan Teki wrote: >>> The new rk3288 revision rk3288w has some changes with respect >>> to legacy rk3288 like hclk_vio and usb host0 ohci. >>> >>> In order to work these on the same in Linux kernel update the >>> compatible the root compatible with rockchip,rk3288w before >>> booting. >>> >>> So, this support during of board setup code of rk3288. >>> >>> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> >>> --- >>> arch/arm/mach-rockchip/Kconfig | 1 + >>> arch/arm/mach-rockchip/rk3288/rk3288.c | 26 ++++++++++++++++++++++++++ >>> 2 files changed, 27 insertions(+) >>> >>> diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig >>> index b1008a5058..822d8d4e9c 100644 >>> --- a/arch/arm/mach-rockchip/Kconfig >>> +++ b/arch/arm/mach-rockchip/Kconfig >>> @@ -98,6 +98,7 @@ config ROCKCHIP_RK322X >>> config ROCKCHIP_RK3288 >>> bool "Support Rockchip RK3288" >>> select CPU_V7A >>> + select OF_BOARD_SETUP >>> select SUPPORT_SPL >>> select SPL >>> select SUPPORT_TPL >>> diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c >>> index 804abe8a1b..8a682675e6 100644 >>> --- a/arch/arm/mach-rockchip/rk3288/rk3288.c >>> +++ b/arch/arm/mach-rockchip/rk3288/rk3288.c >>> @@ -115,6 +115,32 @@ int rk_board_late_init(void) >>> return rk3288_board_late_init(); >>> } >>> >>> +#ifdef CONFIG_OF_BOARD_SETUP >>> + >>> +#define RK3288_HDMI_PHYS 0xff980000 >>> +#define RK3288W_HDMI_REV 0x1A >>> +#define HDMI_CONFIG0_ID 0x04 >>> + >>> +int ft_board_setup(void *blob, bd_t *bd) >>> +{ >>> + u8 config0; >>> + int ret; >>> + >>> + config0 = readb(RK3288_HDMI_PHYS + HDMI_CONFIG0_ID); >>> + if (config0 == RK3288W_HDMI_REV) { >>> + ret = fdt_setprop_string(blob, 0, >>> + "compatible", "rockchip,rk3288w"); >> >> Does this end up replacing the entire top-level compatible property? >> i.e. from: >> >> compatible = "vendor,board\0rockchip,rk3288"; >> >> to just: >> >> compatible = "rockchip,rk3288w"; >> >> If so, that's a bit of a problem for various drivers that care about the >> actual board compatible rather than the SoC. > > Yes, It looks replacing the entire compatible. I think the root > compatible is mostly untouchable because of this reason. > > But, if we skip the root compatible and trying to replace individual > nodes for W revision then it requires extra registration code on in > the Linux drivers like Linux clock driver is registering the clock > with rockchip,rk3288-cru but updating this compatible with > rockchip,rk3288w-cru will require another registration code. Having > common rockchip,rk3288w can be possible to check any code in the tree. Right, it's definitely reasonable to update the top-level SoC compatible, we just need to be prepared to deal with a whole string list here. It looks like libfdt doesn't offer any nice helpers for inserting/removing/updating in string lists, but given that the SoC should be the last entry here we might be able to cheat a bit - just get the whole raw property, check that the final characters are exactly "rockchip,rk3288", and if so append a "w" to the end and write it back. Robin.
On Fri, Jul 3, 2020 at 6:09 PM Robin Murphy <robin.murphy@arm.com> wrote: > > On 2020-07-03 11:10, Jagan Teki wrote: > > On Thu, Jul 2, 2020 at 7:26 PM Robin Murphy <robin.murphy@arm.com> wrote: > >> > >> On 2020-07-02 09:48, Jagan Teki wrote: > >>> The new rk3288 revision rk3288w has some changes with respect > >>> to legacy rk3288 like hclk_vio and usb host0 ohci. > >>> > >>> In order to work these on the same in Linux kernel update the > >>> compatible the root compatible with rockchip,rk3288w before > >>> booting. > >>> > >>> So, this support during of board setup code of rk3288. > >>> > >>> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> > >>> --- > >>> arch/arm/mach-rockchip/Kconfig | 1 + > >>> arch/arm/mach-rockchip/rk3288/rk3288.c | 26 ++++++++++++++++++++++++++ > >>> 2 files changed, 27 insertions(+) > >>> > >>> diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig > >>> index b1008a5058..822d8d4e9c 100644 > >>> --- a/arch/arm/mach-rockchip/Kconfig > >>> +++ b/arch/arm/mach-rockchip/Kconfig > >>> @@ -98,6 +98,7 @@ config ROCKCHIP_RK322X > >>> config ROCKCHIP_RK3288 > >>> bool "Support Rockchip RK3288" > >>> select CPU_V7A > >>> + select OF_BOARD_SETUP > >>> select SUPPORT_SPL > >>> select SPL > >>> select SUPPORT_TPL > >>> diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c > >>> index 804abe8a1b..8a682675e6 100644 > >>> --- a/arch/arm/mach-rockchip/rk3288/rk3288.c > >>> +++ b/arch/arm/mach-rockchip/rk3288/rk3288.c > >>> @@ -115,6 +115,32 @@ int rk_board_late_init(void) > >>> return rk3288_board_late_init(); > >>> } > >>> > >>> +#ifdef CONFIG_OF_BOARD_SETUP > >>> + > >>> +#define RK3288_HDMI_PHYS 0xff980000 > >>> +#define RK3288W_HDMI_REV 0x1A > >>> +#define HDMI_CONFIG0_ID 0x04 > >>> + > >>> +int ft_board_setup(void *blob, bd_t *bd) > >>> +{ > >>> + u8 config0; > >>> + int ret; > >>> + > >>> + config0 = readb(RK3288_HDMI_PHYS + HDMI_CONFIG0_ID); > >>> + if (config0 == RK3288W_HDMI_REV) { > >>> + ret = fdt_setprop_string(blob, 0, > >>> + "compatible", "rockchip,rk3288w"); > >> > >> Does this end up replacing the entire top-level compatible property? > >> i.e. from: > >> > >> compatible = "vendor,board\0rockchip,rk3288"; > >> > >> to just: > >> > >> compatible = "rockchip,rk3288w"; > >> > >> If so, that's a bit of a problem for various drivers that care about the > >> actual board compatible rather than the SoC. > > > > Yes, It looks replacing the entire compatible. I think the root > > compatible is mostly untouchable because of this reason. > > > > But, if we skip the root compatible and trying to replace individual > > nodes for W revision then it requires extra registration code on in > > the Linux drivers like Linux clock driver is registering the clock > > with rockchip,rk3288-cru but updating this compatible with > > rockchip,rk3288w-cru will require another registration code. Having > > common rockchip,rk3288w can be possible to check any code in the tree. > > Right, it's definitely reasonable to update the top-level SoC > compatible, we just need to be prepared to deal with a whole string list > here. It looks like libfdt doesn't offer any nice helpers for > inserting/removing/updating in string lists, but given that the SoC > should be the last entry here we might be able to cheat a bit - just get > the whole raw property, check that the final characters are exactly > "rockchip,rk3288", and if so append a "w" to the end and write it back. Look like exiting fdt helper does print the compatible up to \0 instead of whole root compatible, at least I have checked with fdt_getpro and fdt_get_property.
On Fri, Jul 3, 2020 at 7:34 PM Jagan Teki <jagan@amarulasolutions.com> wrote: > > On Fri, Jul 3, 2020 at 6:09 PM Robin Murphy <robin.murphy@arm.com> wrote: > > > > On 2020-07-03 11:10, Jagan Teki wrote: > > > On Thu, Jul 2, 2020 at 7:26 PM Robin Murphy <robin.murphy@arm.com> wrote: > > >> > > >> On 2020-07-02 09:48, Jagan Teki wrote: > > >>> The new rk3288 revision rk3288w has some changes with respect > > >>> to legacy rk3288 like hclk_vio and usb host0 ohci. > > >>> > > >>> In order to work these on the same in Linux kernel update the > > >>> compatible the root compatible with rockchip,rk3288w before > > >>> booting. > > >>> > > >>> So, this support during of board setup code of rk3288. > > >>> > > >>> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> > > >>> --- > > >>> arch/arm/mach-rockchip/Kconfig | 1 + > > >>> arch/arm/mach-rockchip/rk3288/rk3288.c | 26 ++++++++++++++++++++++++++ > > >>> 2 files changed, 27 insertions(+) > > >>> > > >>> diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig > > >>> index b1008a5058..822d8d4e9c 100644 > > >>> --- a/arch/arm/mach-rockchip/Kconfig > > >>> +++ b/arch/arm/mach-rockchip/Kconfig > > >>> @@ -98,6 +98,7 @@ config ROCKCHIP_RK322X > > >>> config ROCKCHIP_RK3288 > > >>> bool "Support Rockchip RK3288" > > >>> select CPU_V7A > > >>> + select OF_BOARD_SETUP > > >>> select SUPPORT_SPL > > >>> select SPL > > >>> select SUPPORT_TPL > > >>> diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c > > >>> index 804abe8a1b..8a682675e6 100644 > > >>> --- a/arch/arm/mach-rockchip/rk3288/rk3288.c > > >>> +++ b/arch/arm/mach-rockchip/rk3288/rk3288.c > > >>> @@ -115,6 +115,32 @@ int rk_board_late_init(void) > > >>> return rk3288_board_late_init(); > > >>> } > > >>> > > >>> +#ifdef CONFIG_OF_BOARD_SETUP > > >>> + > > >>> +#define RK3288_HDMI_PHYS 0xff980000 > > >>> +#define RK3288W_HDMI_REV 0x1A > > >>> +#define HDMI_CONFIG0_ID 0x04 > > >>> + > > >>> +int ft_board_setup(void *blob, bd_t *bd) > > >>> +{ > > >>> + u8 config0; > > >>> + int ret; > > >>> + > > >>> + config0 = readb(RK3288_HDMI_PHYS + HDMI_CONFIG0_ID); > > >>> + if (config0 == RK3288W_HDMI_REV) { > > >>> + ret = fdt_setprop_string(blob, 0, > > >>> + "compatible", "rockchip,rk3288w"); > > >> > > >> Does this end up replacing the entire top-level compatible property? > > >> i.e. from: > > >> > > >> compatible = "vendor,board\0rockchip,rk3288"; > > >> > > >> to just: > > >> > > >> compatible = "rockchip,rk3288w"; > > >> > > >> If so, that's a bit of a problem for various drivers that care about the > > >> actual board compatible rather than the SoC. > > > > > > Yes, It looks replacing the entire compatible. I think the root > > > compatible is mostly untouchable because of this reason. > > > > > > But, if we skip the root compatible and trying to replace individual > > > nodes for W revision then it requires extra registration code on in > > > the Linux drivers like Linux clock driver is registering the clock > > > with rockchip,rk3288-cru but updating this compatible with > > > rockchip,rk3288w-cru will require another registration code. Having > > > common rockchip,rk3288w can be possible to check any code in the tree. > > > > Right, it's definitely reasonable to update the top-level SoC > > compatible, we just need to be prepared to deal with a whole string list > > here. It looks like libfdt doesn't offer any nice helpers for > > inserting/removing/updating in string lists, but given that the SoC > > should be the last entry here we might be able to cheat a bit - just get > > the whole raw property, check that the final characters are exactly > > "rockchip,rk3288", and if so append a "w" to the end and write it back. > > Look like exiting fdt helper does print the compatible up to \0 > instead of whole root compatible, at least I have checked with > fdt_getpro and fdt_get_property. Look like we didn't have any requirement to change the root compatible at this point since disabling ohci driver for legacy rk3288 revision chips of no use. Jagan.
On 2020/7/2 下午4:48, Jagan Teki wrote: > The new rk3288 revision rk3288w has some changes with respect > to legacy rk3288 like hclk_vio and usb host0 ohci. > > In order to work these on the same in Linux kernel update the > compatible the root compatible with rockchip,rk3288w before > booting. > > So, this support during of board setup code of rk3288. > > Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> Reviewed-by: Kever Yang<kever.yang@rock-chips.com> Thanks, - Kever > --- > arch/arm/mach-rockchip/Kconfig | 1 + > arch/arm/mach-rockchip/rk3288/rk3288.c | 26 ++++++++++++++++++++++++++ > 2 files changed, 27 insertions(+) > > diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig > index b1008a5058..822d8d4e9c 100644 > --- a/arch/arm/mach-rockchip/Kconfig > +++ b/arch/arm/mach-rockchip/Kconfig > @@ -98,6 +98,7 @@ config ROCKCHIP_RK322X > config ROCKCHIP_RK3288 > bool "Support Rockchip RK3288" > select CPU_V7A > + select OF_BOARD_SETUP > select SUPPORT_SPL > select SPL > select SUPPORT_TPL > diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c > index 804abe8a1b..8a682675e6 100644 > --- a/arch/arm/mach-rockchip/rk3288/rk3288.c > +++ b/arch/arm/mach-rockchip/rk3288/rk3288.c > @@ -115,6 +115,32 @@ int rk_board_late_init(void) > return rk3288_board_late_init(); > } > > +#ifdef CONFIG_OF_BOARD_SETUP > + > +#define RK3288_HDMI_PHYS 0xff980000 > +#define RK3288W_HDMI_REV 0x1A > +#define HDMI_CONFIG0_ID 0x04 > + > +int ft_board_setup(void *blob, bd_t *bd) > +{ > + u8 config0; > + int ret; > + > + config0 = readb(RK3288_HDMI_PHYS + HDMI_CONFIG0_ID); > + if (config0 == RK3288W_HDMI_REV) { > + ret = fdt_setprop_string(blob, 0, > + "compatible", "rockchip,rk3288w"); > + if (ret < 0) { > + printf("failed to set rk3288w compatible (ret=%d)\n", > + ret); > + return ret; > + } > + } > + > + return 0; > +} > +#endif > + > static int do_clock(struct cmd_tbl *cmdtp, int flag, int argc, > char *const argv[]) > {
On Wed, Jul 8, 2020 at 3:35 PM Kever Yang <kever.yang@rock-chips.com> wrote: > > > On 2020/7/2 下午4:48, Jagan Teki wrote: > > The new rk3288 revision rk3288w has some changes with respect > > to legacy rk3288 like hclk_vio and usb host0 ohci. > > > > In order to work these on the same in Linux kernel update the > > compatible the root compatible with rockchip,rk3288w before > > booting. > > > > So, this support during of board setup code of rk3288. > > > > Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> > > Reviewed-by: Kever Yang<kever.yang@rock-chips.com> Added v2 for this. please have a look Jagan.
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig index b1008a5058..822d8d4e9c 100644 --- a/arch/arm/mach-rockchip/Kconfig +++ b/arch/arm/mach-rockchip/Kconfig @@ -98,6 +98,7 @@ config ROCKCHIP_RK322X config ROCKCHIP_RK3288 bool "Support Rockchip RK3288" select CPU_V7A + select OF_BOARD_SETUP select SUPPORT_SPL select SPL select SUPPORT_TPL diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c index 804abe8a1b..8a682675e6 100644 --- a/arch/arm/mach-rockchip/rk3288/rk3288.c +++ b/arch/arm/mach-rockchip/rk3288/rk3288.c @@ -115,6 +115,32 @@ int rk_board_late_init(void) return rk3288_board_late_init(); } +#ifdef CONFIG_OF_BOARD_SETUP + +#define RK3288_HDMI_PHYS 0xff980000 +#define RK3288W_HDMI_REV 0x1A +#define HDMI_CONFIG0_ID 0x04 + +int ft_board_setup(void *blob, bd_t *bd) +{ + u8 config0; + int ret; + + config0 = readb(RK3288_HDMI_PHYS + HDMI_CONFIG0_ID); + if (config0 == RK3288W_HDMI_REV) { + ret = fdt_setprop_string(blob, 0, + "compatible", "rockchip,rk3288w"); + if (ret < 0) { + printf("failed to set rk3288w compatible (ret=%d)\n", + ret); + return ret; + } + } + + return 0; +} +#endif + static int do_clock(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) {