public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heiko Stuebner <heiko@sntech.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 6/8] rockchip: rk3188: Switch to new i2c IP blocks
Date: Sun, 26 Mar 2017 15:01:36 +0200	[thread overview]
Message-ID: <1893897.IBXJPI3aVD@phil> (raw)
In-Reply-To: <CAPnjgZ18YbLBn70R8hsO3uv2FJocftpVc5DJY3Gy=31rKKnreg@mail.gmail.com>

Am Samstag, 25. März 2017, 19:17:33 CEST schrieb Simon Glass:
> Hi Heiko,
> 
> On 24 March 2017 at 01:32, Heiko Stübner <heiko@sntech.de> wrote:
> > Am Donnerstag, 23. März 2017, 21:28:08 CET schrieb Simon Glass:
> >> Hi Heiko,
> >>
> >> On 20 March 2017 at 05:40, Heiko Stuebner <heiko@sntech.de> wrote:
> >> > The rk3066/rk3188 introduced new i2c IP blocks but kept the old ones
> >> > around just in case. The default also points to these old controllers.
> >> >
> >> > The "new" blocks proved stable and nobody ever used the old ones anywhere,
> >> > not in the kernel and not in U-Boot, so to be able to reuse the already
> >> > existing driver make the rk3188 switch to the new ones in U-Boot as well.
> >> >
> >> > Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> >> > ---
> >> >
> >> >  arch/arm/mach-rockchip/rk3188-board-spl.c | 21 +++++++++++++++++++++
> >> >  1 file changed, 21 insertions(+)
> >> >
> >> > diff --git a/arch/arm/mach-rockchip/rk3188-board-spl.c
> >> > b/arch/arm/mach-rockchip/rk3188-board-spl.c index affd959f86..14847a7b1b
> >> > 100644
> >> > --- a/arch/arm/mach-rockchip/rk3188-board-spl.c
> >> > +++ b/arch/arm/mach-rockchip/rk3188-board-spl.c
> >> > @@ -17,6 +17,7 @@
> >> >
> >> >  #include <asm/io.h>
> >> >  #include <asm/arch/bootrom.h>
> >> >  #include <asm/arch/clock.h>
> >> >
> >> > +#include <asm/arch/grf_rk3188.h>
> >> >
> >> >  #include <asm/arch/hardware.h>
> >> >  #include <asm/arch/periph.h>
> >> >  #include <asm/arch/pmu_rk3188.h>
> >> >
> >> > @@ -102,6 +103,7 @@ void board_init_f(ulong dummy)
> >> >
> >> >  {
> >> >
> >> >         struct udevice *pinctrl, *dev;
> >> >         struct rk3188_pmu *pmu;
> >> >
> >> > +       struct rk3188_grf *grf;
> >> >
> >> >         int ret;
> >> >
> >> >         /* Example code showing how to enable the debug UART on RK3188 */
> >> >
> >> > @@ -154,6 +156,25 @@ void board_init_f(ulong dummy)
> >> >
> >> >                 error("pmu syscon returned %ld\n", PTR_ERR(pmu));
> >> >
> >> >         SAVE_SP_ADDR = readl(&pmu->sys_reg[2]);
> >> >
> >> > +       /* init common grf settings */
> >> > +       grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
> >> > +       if (IS_ERR(grf)) {
> >> > +               error("grf syscon returned %ld\n", PTR_ERR(grf));
> >> > +       } else {
> >> > +               /* make i2c controllers use the new IP */
> >> > +               rk_clrsetreg(&grf->soc_con1,
> >> > +                       RKI2C4_SEL_MASK << RKI2C4_SEL_SHIFT |
> >> > +                       RKI2C3_SEL_MASK << RKI2C3_SEL_SHIFT |
> >> > +                       RKI2C2_SEL_MASK << RKI2C2_SEL_SHIFT |
> >> > +                       RKI2C1_SEL_MASK << RKI2C1_SEL_SHIFT |
> >> > +                       RKI2C0_SEL_MASK << RKI2C0_SEL_SHIFT,
> >> > +                       RKI2C4_SEL_MASK << RKI2C4_SEL_SHIFT |
> >> > +                       RKI2C3_SEL_MASK << RKI2C3_SEL_SHIFT |
> >> > +                       RKI2C2_SEL_MASK << RKI2C2_SEL_SHIFT |
> >> > +                       RKI2C1_SEL_MASK << RKI2C1_SEL_SHIFT |
> >> > +                       RKI2C0_SEL_MASK << RKI2C0_SEL_SHIFT);
> >> > +       }
> >>
> >> Can you move this to the pinctrl driver?
> >
> > Are you sure that is the right approach?
> >
> > This setting switches the i2c controller IP block used, while the i2c-pins are
> > not affected by this at all. You could also use the i2c pins with the other
> > i2c controller with the same pinctrl settings, so it feels a tiny bit strange
> > to burden the pinctrl driver with this.
> 
> It still seems like pinctrl to me, in that you are selecting which IP
> block uses those pins. If you don't want it in pinctrl, perhaps this
> whole thing should go in the I2C driver?

no pinctrl is fine, and funnily enough, when I tried moving that there,
I realized that the pinctrl driver had the switch to the new controller
right from the beginning and I just had forgotten about it :-S, see the

	/* enable new i2c controller */
	rk_clrsetreg(&grf->soc_con1, 1 << RKI2C0_SEL_SHIFT,
				     1 << RKI2C0_SEL_SHIFT);

parts in pinctrl_rk3188.c .

So it looks like we can just drop this patch altogether :-) .


Heiko

  reply	other threads:[~2017-03-26 13:01 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-20 11:40 [U-Boot] [PATCH 0/8] rockchip: rk3188: fixups and armclk speedup Heiko Stuebner
2017-03-20 11:40 ` [U-Boot] [PATCH 1/8] rockchip: rk3188: sdram: Set correct sdram base Heiko Stuebner
2017-03-24  3:27   ` Simon Glass
2017-03-26  2:42     ` Simon Glass
2017-03-20 11:40 ` [U-Boot] [PATCH 2/8] rockchip: rk3188: Decode the actual amount of ram Heiko Stuebner
2017-03-24  3:27   ` Simon Glass
2017-03-26  2:42     ` Simon Glass
2017-03-20 11:40 ` [U-Boot] [PATCH 3/8] rockchip: rk3188: Cleanup some SPL/TPL rename leftovers Heiko Stuebner
2017-03-24  3:27   ` Simon Glass
2017-03-26  2:42     ` Simon Glass
2017-03-20 11:40 ` [U-Boot] [PATCH 4/8] rockchip: clk: rk3188: Allow configuration of the armclk Heiko Stuebner
2017-03-24  3:27   ` Simon Glass
2017-03-26  2:42     ` Simon Glass
2017-03-20 11:40 ` [U-Boot] [PATCH 5/8] rockchip: rk3188: Setup the armclk in spl Heiko Stuebner
2017-03-24  3:28   ` Simon Glass
2017-03-26  2:42     ` Simon Glass
2017-03-20 11:40 ` [U-Boot] [PATCH 6/8] rockchip: rk3188: Switch to new i2c IP blocks Heiko Stuebner
2017-03-24  3:28   ` Simon Glass
2017-03-24  7:32     ` Heiko Stübner
2017-03-26  1:17       ` Simon Glass
2017-03-26 13:01         ` Heiko Stuebner [this message]
2017-04-01  4:22           ` Simon Glass
2017-03-20 11:40 ` [U-Boot] [PATCH 7/8] rockchip: i2c: Add compatibles for Rockchip Cortex-A9 socs Heiko Stuebner
2017-03-24  3:28   ` Simon Glass
2017-03-26  2:42     ` Simon Glass
2017-03-20 11:40 ` [U-Boot] [PATCH 8/8] rockchip: Enable pmic options and act8846 driver on rk3188 rock boards Heiko Stuebner
2017-03-24  3:28   ` Simon Glass
2017-03-26 19:13     ` Heiko Stuebner
2017-03-24  3:28 ` [U-Boot] [PATCH 0/8] rockchip: rk3188: fixups and armclk speedup Simon Glass
2017-03-24 16:04   ` Heiko Stuebner
2017-03-27 18:36     ` Simon Glass
2017-03-27 20:11       ` Heiko Stuebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1893897.IBXJPI3aVD@phil \
    --to=heiko@sntech.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox