public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sean Anderson <seanga2@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH v5 11/11] riscv: Add FPIOA and GPIO support for Kendryte K210
Date: Sat, 15 Aug 2020 11:52:37 -0400	[thread overview]
Message-ID: <20200815155237.467720-12-seanga2@gmail.com> (raw)
In-Reply-To: <20200815155237.467720-1-seanga2@gmail.com>

This patch adds the necessary configs and docs for FPIOA and GPIO support
on the K210.

The board does not boot unless CONSOLE_LOGLEVEL is set to a non-default
value . It also boots when the tree is dirty (and CONSOLE_LOGLEVEL is not
changed). It also boots when changes are made to the device tree and then
committed. I don't know why this happens. These breakages only occur after
bf2fb81ad3.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
---

Changes in v5:
- Increase CONSOLE_LOGLEVEL to 5 as a hack to get the board booting again
- Patch 05/12 "gpio: sifive: Use generic reg read function" has been superseded
  by commit 2548493ab4.

Changes in v3:
- Document pins 6 and 7 as not set

Changes in v2:
- Remove SPI flash related Kconfig settings

 board/sipeed/maix/Kconfig          |  9 +++++
 configs/sipeed_maix_bitm_defconfig |  2 +
 doc/board/sipeed/maix.rst          | 64 +++++++++++++++++++++++++++++-
 3 files changed, 73 insertions(+), 2 deletions(-)

diff --git a/board/sipeed/maix/Kconfig b/board/sipeed/maix/Kconfig
index 0cdcd32adc..4c42dd2087 100644
--- a/board/sipeed/maix/Kconfig
+++ b/board/sipeed/maix/Kconfig
@@ -44,4 +44,13 @@ config BOARD_SPECIFIC_OPTIONS
 	imply RESET_SYSCON
 	imply SYSRESET
 	imply SYSRESET_SYSCON
+	imply PINCTRL
+	imply PINCONF
+	imply PINCTRL_K210
+	imply DM_GPIO
+	imply DWAPB_GPIO
+	imply SIFIVE_GPIO
+	imply CMD_GPIO
+	imply LED
+	imply LED_GPIO
 endif
diff --git a/configs/sipeed_maix_bitm_defconfig b/configs/sipeed_maix_bitm_defconfig
index 459bf0d530..0b038ff0a1 100644
--- a/configs/sipeed_maix_bitm_defconfig
+++ b/configs/sipeed_maix_bitm_defconfig
@@ -2,6 +2,8 @@ CONFIG_RISCV=y
 CONFIG_TARGET_SIPEED_MAIX=y
 CONFIG_ARCH_RV64I=y
 CONFIG_STACK_SIZE=0x100000
+# FIXME: Dirty hack to get boot working!
+CONFIG_LOGLEVEL=5
 # CONFIG_NET is not set
 # CONFIG_INPUT is not set
 # CONFIG_DM_ETH is not set
diff --git a/doc/board/sipeed/maix.rst b/doc/board/sipeed/maix.rst
index b1894f3a6f..3811eac61f 100644
--- a/doc/board/sipeed/maix.rst
+++ b/doc/board/sipeed/maix.rst
@@ -156,7 +156,7 @@ To run legacy images, use the ``bootm`` command:
     Load Address: 80000000
     Entry Point:  80000000
 
-    $ picocom -b 115200 /dev/ttyUSB0i
+    $ picocom -b 115200 /dev/ttyUSB0
     => loady
     ## Ready for binary (ymodem) download to 0x80000000 at 115200 bps...
     C
@@ -187,6 +187,66 @@ To run legacy images, use the ``bootm`` command:
     argv[0] = "<NULL>"
     Hit any key to exit ...
 
+Pin Assignment
+--------------
+
+The K210 contains a Fully Programmable I/O Array (FPIOA), which can remap any of
+its 256 input functions to any any of 48 output pins. The following table has
+the default pin assignments for the BitM.
+
+===== ========== =======
+Pin   Function   Comment
+===== ========== =======
+IO_0  JTAG_TCLK
+IO_1  JTAG_TDI
+IO_2  JTAG_TMS
+IO_3  JTAG_TDO
+IO_4  UARTHS_RX
+IO_5  UARTHS_TX
+IO_6             Not set
+IO_7             Not set
+IO_8  GPIO_0
+IO_9  GPIO_1
+IO_10 GPIO_2
+IO_11 GPIO_3
+IO_12 GPIO_4     Green LED
+IO_13 GPIO_5     Red LED
+IO_14 GPIO_6     Blue LED
+IO_15 GPIO_7
+IO_16 GPIOHS_0   ISP
+IO_17 GPIOHS_1
+IO_18 I2S0_SCLK  MIC CLK
+IO_19 I2S0_WS    MIC WS
+IO_20 I2S0_IN_D0 MIC SD
+IO_21 GPIOHS_5
+IO_22 GPIOHS_6
+IO_23 GPIOHS_7
+IO_24 GPIOHS_8
+IO_25 GPIOHS_9
+IO_26 SPI1_D1    MMC MISO
+IO_27 SPI1_SCLK  MMC CLK
+IO_28 SPI1_D0    MMC MOSI
+IO_29 GPIOHS_13  MMC CS
+IO_30 GPIOHS_14
+IO_31 GPIOHS_15
+IO_32 GPIOHS_16
+IO_33 GPIOHS_17
+IO_34 GPIOHS_18
+IO_35 GPIOHS_19
+IO_36 GPIOHS_20  Panel CS
+IO_37 GPIOHS_21  Panel RST
+IO_38 GPIOHS_22  Panel DC
+IO_39 SPI0_SCK   Panel WR
+IO_40 SCCP_SDA
+IO_41 SCCP_SCLK
+IO_42 DVP_RST
+IO_43 DVP_VSYNC
+IO_44 DVP_PWDN
+IO_45 DVP_HSYNC
+IO_46 DVP_XCLK
+IO_47 DVP_PCLK
+===== ========== =======
+
 Over- and Under-clocking
 ------------------------
 
@@ -361,5 +421,5 @@ Address    Size      Description
 0x8801C000 0x1000    riscv priv spec 1.9 config
 0x8801D000 0x2000    flattened device tree (contains only addresses and
                      interrupts)
-0x8801f000 0x1000    credits
+0x8801F000 0x1000    credits
 ========== ========= ===========
-- 
2.28.0

  parent reply	other threads:[~2020-08-15 15:52 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-15 15:52 [PATCH v5 00/11] riscv: Add FPIOA and GPIO support for Kendryte K210 Sean Anderson
2020-08-15 15:52 ` [PATCH v5 01/11] pinctrl: Add pinmux property support to pinctrl-generic Sean Anderson
2020-08-15 15:52 ` [PATCH v5 02/11] pinctrl: Reformat documentation in dm/pinctrl.h Sean Anderson
2020-09-02 12:26   ` Heinrich Schuchardt
2020-09-02 14:56     ` Sean Anderson
2020-09-02 15:17       ` Heinrich Schuchardt
2020-09-02 15:38         ` Sean Anderson
2020-08-15 15:52 ` [PATCH v5 03/11] test: pinmux: Add test for pin muxing Sean Anderson
2020-08-15 15:52 ` [PATCH v5 04/11] pinctrl: Add support for Kendryte K210 FPIOA Sean Anderson
2020-08-15 15:52 ` [PATCH v5 05/11] gpio: dw: Fix warnings about casting int to pointer Sean Anderson
2020-08-15 15:52 ` [PATCH v5 06/11] gpio: dw: Add a trailing underscore to generated name Sean Anderson
2020-08-15 15:52 ` [PATCH v5 07/11] gpio: dw: Return output value when direction is out Sean Anderson
2020-08-15 15:52 ` [PATCH v5 08/11] led: gpio: Default to using node name if label is absent Sean Anderson
2020-08-15 15:52 ` [PATCH v5 09/11] test: dm: Test for default led naming Sean Anderson
2020-08-15 15:52 ` [PATCH v5 10/11] riscv: Add pinmux and gpio bindings for Kendryte K210 Sean Anderson
2020-09-02 18:04   ` Heinrich Schuchardt
2020-09-02 20:43     ` Sean Anderson
2020-08-15 15:52 ` Sean Anderson [this message]
2020-08-19  3:48   ` [PATCH v5 11/11] riscv: Add FPIOA and GPIO support " Rick Chen
2020-08-19 11:12     ` Sean Anderson
2020-08-20  8:07       ` Rick Chen
2020-08-20  8:47         ` Rick Chen
2020-08-31 21:48           ` Sean Anderson
2020-09-01  1:19             ` Rick Chen
2020-09-02 12:26               ` Heinrich Schuchardt
2020-09-02 15:59                 ` Sean Anderson
2020-09-05 14:40                   ` Sean Anderson
     [not found]       ` <752D002CFF5D0F4FA35C0100F1D73F3FA473754A@ATCPCS16.andestech.com>
2020-08-21  9:08         ` Ruinland ChuanTzu Tsai
2020-08-21 10:06           ` Sean Anderson

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=20200815155237.467720-12-seanga2@gmail.com \
    --to=seanga2@gmail.com \
    --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