All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adam Van Ymeren <adam@vany.ca>
To: Peter Geis <pgwipeout@gmail.com>
Cc: "open list:ARM/Rockchip SoC..."
	<linux-rockchip@lists.infradead.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Heiko Stuebner <heiko@sntech.de>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] arm64: dts: rockchip: Fix rk3328-roc-cc sdmmcio-regulator
Date: Tue, 4 Feb 2020 11:14:41 -0500	[thread overview]
Message-ID: <7b36198e-25c0-4f3b-d871-6bd5aaf619d8@vany.ca> (raw)
In-Reply-To: <CAMdYzYo5V2rHE6Axx9p67n3FcCFpQ5TA+m7kqaE3Uqn6d0QUhw@mail.gmail.com>


On 2020-02-04 10:15 a.m., Peter Geis wrote:
> I'm interested in this, since I've encountered some oddities with the
> sdcard on this board.
> With the recent addition of support for ddr4 tpl init in u-boot I
> started playing with it again.
> I couldn't get the sdcard to detect leaving tpl into spl, causing a
> boot failure.
> The exact same image works when flashed to the emmc though.

Awesome I was hoping to get mainline u-boot loading this board as well. 
However I don't know how to setup the sdram-params for the dd4 on this
board.  Do you have the appropriate config?  Would be great not to
require the vendor's blob for booting.

>
> Once we are in the kernel the sdcard detects fine.
>
> I noticed u-boot doesn't have a grf-gpio driver, so the 3.3v/1.8v
> regulator is unavailable.
>
> root@firefly:/sys/kernel/debug/mmc1# cat ios
> clock:          150000000 Hz
> actual clock:   150000000 Hz
> vdd:            21 (3.3 ~ 3.4 V)
> bus mode:       2 (push-pull)
> chip select:    0 (don't care)
> power mode:     2 (on)
> bus width:      2 (4 bits)
> timing spec:    6 (sd uhs SDR104)
> signal voltage: 1 (1.80 V)
> driver type:    0 (driver type B)
>
> root@firefly:/sys/kernel/debug# cat gpio
> gpiochip0: GPIOs 0-31, parent: platform/pinctrl, gpio0:
>  gpio-0   (                    |vcc-host-5v-regulato) out hi
>  gpio-30  (                    |sdmmc-regulator     ) out lo ACTIVE LOW
>
> gpiochip1: GPIOs 32-63, parent: platform/pinctrl, gpio1:
>  gpio-50  (                    |snps,reset          ) out hi ACTIVE LOW
>  gpio-58  (                    |vcc-host1-5v-regulat) out hi
>
> gpiochip2: GPIOs 64-95, parent: platform/pinctrl, gpio2:
>
> gpiochip3: GPIOs 96-127, parent: platform/pinctrl, gpio3:
>
> gpiochip5: GPIOs 509-510, parent: platform/rk805-pinctrl, rk805-gpio, can sleep:
>  gpio-509 (                    |?                   ) out hi ACTIVE LOW
>  gpio-510 (                    |?                   ) out hi ACTIVE LOW
>
> gpiochip4: GPIOs 511-511, parent: platform/ff100000.syscon:grf-gpio,
> ff100000.syscon:grf-gpio:
>  gpio-511 (                    |vcc_sdio            ) out hi


On my board I tried every combination of GPIO_ACTIVE_HIGH/LOW,
enable-active-high or not, and state = <18... 0x1 33... 0x0> vs state =
<18... 0x0 33...0x1> for the vcc_sdio regulator.  None of those allowed
my kernel to detect the SD Card.  The only reliable method so far seem
to be setting the gpio of the regulator to some non existent pin, but
that clearly isn't the corrent answer.  Both gpios = <&gpio0 25
GPIO_ACTIVE_HIGH> and gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH> allow the
board to board, both of which are non-existent pins from my reading of
the datasheet.

I'm beginning to suspect that it may be a bug in the gpio-syscon driver,
or that the actual circuit on the board just doesn't work as the vendor
intended.

In my dmesg I see

[    0.406830] gpio-syscon ff100000.syscon:grf-gpio: can't read the data
register offset!

which is awfully suspicious.  But this doesn't appear to be a fatal
error for the driver, logging _regmap_write calls shows that it appears
to be updating the correct register (0x428)


From gpio-syscon.c:134

|

static void rockchip_gpio_set(struct gpio_chip *chip, unsigned int offset,
			      int val)
{
	struct syscon_gpio_priv *priv = gpiochip_get_data(chip);
	unsigned int offs;
	u8 bit;
	u32 data;
	int ret;

	offs = priv->dreg_offset + priv->data->dat_bit_offset + offset;
	bit = offs % SYSCON_REG_BITS;
	data = (val ? BIT(bit) : 0) | BIT(bit + 16);
	ret = regmap_write(priv->syscon,
			   (offs / SYSCON_REG_BITS) * SYSCON_REG_SIZE,
			   data);
	if (ret < 0)
		dev_err(chip->parent, "gpio write failed ret(%d)\n", ret);
}

Calling regmap_write seems wrong, as we end up setting all bits in the register, so this should probably be regmap_update_bits.  The top 16-bits are write-enable for the lower 16-bits, but I can't find documentation if it works to set both the write enable bit and the target bit at the same time.

Tonight I will try splitting that into two calls to update the high bit first as well as changing to regmap_update_bits.  Any other ideas welcome.

Sorry if this was too verbose or too much context, I'm new to this kind of work.

|


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-02-04 16:14 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-31 23:38 [PATCH] arm64: dts: rockchip: Fix rk3328-roc-cc sdmmcio-regulator Adam Van Ymeren
2020-01-31 23:38 ` Adam Van Ymeren
2020-02-01 10:51 ` Robin Murphy
2020-02-01 10:51   ` Robin Murphy
2020-02-01 15:41   ` Adam Van Ymeren
2020-02-01 17:46     ` Robin Murphy
2020-02-01 22:10       ` Adam Van Ymeren
     [not found]         ` <510d310b-30af-7b24-d472-907bc6b2ef46-M8Nx6PV4agg@public.gmane.org>
2020-02-04 15:15           ` Peter Geis
2020-02-04 15:15             ` Peter Geis
2020-02-04 16:14             ` Adam Van Ymeren [this message]
     [not found]               ` <7b36198e-25c0-4f3b-d871-6bd5aaf619d8-M8Nx6PV4agg@public.gmane.org>
2020-02-04 17:25                 ` Peter Geis
2020-02-04 17:25                   ` Peter Geis
2020-02-05 16:14                   ` Adam Van Ymeren
2020-02-05 17:39                     ` Robin Murphy
2020-02-05 17:39                       ` Robin Murphy
     [not found]                     ` <2f863743-f5fd-7702-ac22-762dbca834cb-M8Nx6PV4agg@public.gmane.org>
2020-02-05 18:43                       ` Peter Geis
2020-02-05 18:43                         ` Peter Geis
2020-02-05 19:02                         ` Robin Murphy
2020-02-05 19:02                           ` Robin Murphy
2020-02-06  3:05                           ` Thomas McKahan
2020-02-06  3:05                             ` Thomas McKahan
     [not found]                         ` <CAMdYzYopKjRpVnyq2k84XZK0kmR_ZBH8KNjVyPz3upQjx0rLJQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-02-09  1:07                           ` Adam Van Ymeren
2020-02-09  1:07                             ` Adam Van Ymeren
2020-02-10 13:37                             ` Robin Murphy
2020-02-11 21:32                               ` Adam Van Ymeren
2020-02-11 21:39                               ` Adam Van Ymeren

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=7b36198e-25c0-4f3b-d871-6bd5aaf619d8@vany.ca \
    --to=adam@vany.ca \
    --cc=heiko@sntech.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=pgwipeout@gmail.com \
    --cc=robin.murphy@arm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.