From: Johan Jonker <jbx6244@gmail.com>
To: u-boot@0leil.net
Cc: kever.yang@rock-chips.com, sjg@chromium.org, trini@konsulko.com,
u-boot@lists.u-boot-project.org, eddie.cai.linux@gmail.com
Subject: [PATCH v3 01/12] rockchip: scripts: remove rkmux.py
Date: Thu, 30 Jul 2026 15:32:04 +0200 [thread overview]
Message-ID: <29151ea2-7e8b-40f7-bf22-e487def1445f@gmail.com> (raw)
In-Reply-To: <5aed2a27-bd7d-4b71-a6c1-0b46b41f3462@gmail.com>
It's not U-Boot's core business to host a script
to create enums from datasheets where it's unknown
that it has ever been used for any Rockchip SoCs sold
after rk3288. We don't need it to compile, so remove this
relict from the past.
Signed-off-by: Johan Jonker <jbx6244@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
---
MAINTAINERS | 1 -
doc/README.rockchip | 7 --
scripts/pylint.base | 1 -
tools/rkmux.py | 218 --------------------------------------------
4 files changed, 227 deletions(-)
delete mode 100755 tools/rkmux.py
diff --git a/MAINTAINERS b/MAINTAINERS
index 53034b703df8..9660706ad5e1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -547,7 +547,6 @@ F: drivers/spi/rk_spi.[ch]
F: tools/rkcommon.c
F: tools/rkcommon.h
F: tools/rkimage.c
-F: tools/rkmux.py
F: tools/rksd.c
F: tools/rkspi.c
diff --git a/doc/README.rockchip b/doc/README.rockchip
index 96fa49d697bc..5a608ed0bce3 100644
--- a/doc/README.rockchip
+++ b/doc/README.rockchip
@@ -651,13 +651,6 @@ SPI flash.
See above for instructions on how to write a SPI image.
-rkmux.py
---------
-
-You can use this script to create #defines for SoC register access. See the
-script for usage.
-
-
Device tree and driver model
----------------------------
diff --git a/scripts/pylint.base b/scripts/pylint.base
index bc39e2385a31..a0a473b6d998 100644
--- a/scripts/pylint.base
+++ b/scripts/pylint.base
@@ -298,7 +298,6 @@ tools_patman_status 8.52
tools_patman_test_checkpatch 8.51
tools_patman_test_settings 8.78
tools_qconfig 9.79
-tools_rkmux 7.10
tools_rmboard 8.06
tools_u_bootlib___init__.py 0.00
tools_u_bootlib___main__.py 7.78
diff --git a/tools/rkmux.py b/tools/rkmux.py
deleted file mode 100755
index 1226ee201c3b..000000000000
--- a/tools/rkmux.py
+++ /dev/null
@@ -1,218 +0,0 @@
-#!/usr/bin/env python3
-
-# Script to create enums from datasheet register tables
-#
-# Usage:
-#
-# First, create a text file from the datasheet:
-# pdftotext -layout /path/to/rockchip-3288-trm.pdf /tmp/asc
-#
-# Then use this script to output the #defines for a particular register:
-# ./tools/rkmux.py GRF_GPIO4C_IOMUX
-#
-# It will create output suitable for putting in a header file, with SHIFT and
-# MASK values for each bitfield in the register.
-#
-# Note: this tool is not perfect and you may need to edit the resulting code.
-# But it should speed up the process.
-
-import csv
-import re
-import sys
-
-tab_to_col = 3
-
-class RegField:
- def __init__(self, cols=None):
- if cols:
- self.bits, self.attr, self.reset_val, self.desc = (
- [x.strip() for x in cols])
- self.desc = [self.desc]
- else:
- self.bits = ''
- self.attr = ''
- self.reset_val = ''
- self.desc = []
-
- def Setup(self, cols):
- self.bits, self.attr, self.reset_val = cols[0:3]
- if len(cols) > 3:
- self.desc.append(cols[3])
-
- def AddDesc(self, desc):
- self.desc.append(desc)
-
- def Show(self):
- print(self)
- print()
- self.__init__()
-
- def __str__(self):
- return '%s,%s,%s,%s' % (self.bits, self.attr, self.reset_val,
- '\n'.join(self.desc))
-
-class Printer:
- def __init__(self, name):
- self.first = True
- self.name = name
- self.re_sel = re.compile("[1-9]'b([01]+): (.*)")
-
- def __enter__(self):
- return self
-
- def __exit__(self, type, value, traceback):
- if not self.first:
- self.output_footer()
-
- def output_header(self):
- print('/* %s */' % self.name)
- print('enum {')
-
- def output_footer(self):
- print('};');
-
- def output_regfield(self, regfield):
- lines = regfield.desc
- field = lines[0]
- #print 'field:', field
- if field in ['reserved', 'reserve', 'write_enable', 'write_mask']:
- return
- if field.endswith('_sel') or field.endswith('_con'):
- field = field[:-4]
- elif field.endswith(' iomux'):
- field = field[:-6]
- elif field.endswith('_mode') or field.endswith('_mask'):
- field = field[:-5]
- #else:
- #print 'bad field %s' % field
- #return
- field = field.upper()
- if ':' in regfield.bits:
- bit_high, bit_low = [int(x) for x in regfield.bits.split(':')]
- else:
- bit_high = bit_low = int(regfield.bits)
- bit_width = bit_high - bit_low + 1
- mask = (1 << bit_width) - 1
- if self.first:
- self.first = False
- self.output_header()
- else:
- print()
- out_enum(field, 'shift', bit_low)
- out_enum(field, 'mask', mask)
- next_val = -1
- #print 'lines: %s', lines
- for line in lines:
- m = self.re_sel.match(line)
- if m:
- val, enum = int(m.group(1), 2), m.group(2)
- if enum not in ['reserved', 'reserve']:
- out_enum(field, enum, val, val == next_val)
- next_val = val + 1
-
-
-def process_file(name, fd):
- field = RegField()
- reg = ''
-
- fields = []
-
- def add_it(field):
- if field.bits:
- if reg == name:
- fields.append(field)
- field = RegField()
- return field
-
- def is_field_start(line):
- if '=' in line or '+' in line:
- return False
- if (line.startswith('gpio') or line.startswith('peri_') or
- line.endswith('_sel') or line.endswith('_con')):
- return True
- if not ' ' in line: # and '_' in line:
- return True
- return False
-
- for line in fd:
- line = line.rstrip()
- if line[:4] in ['GRF_', 'PMU_', 'CRU_']:
- field = add_it(field)
- reg = line
- do_this = name == reg
- elif not line or not line.startswith(' '):
- continue
- line = line.replace('\xe2\x80\x99', "'")
- leading = len(line) - len(line.lstrip())
- line = line.lstrip()
- cols = re.split(' *', line, 3)
- if leading > 15 or (len(cols) > 3 and is_field_start(cols[3])):
- if is_field_start(line):
- field = add_it(field)
- field.AddDesc(line)
- else:
- if cols[0] == 'Bit' or len(cols) < 3:
- continue
- #print
- #print field
- field = add_it(field)
- field.Setup(cols)
- field = add_it(field)
-
- with Printer(name) as printer:
- for field in fields:
- #print field
- printer.output_regfield(field)
- #print
-
-def out_enum(field, suffix, value, skip_val=False):
- str = '%s_%s' % (field.upper(), suffix.upper())
- if not skip_val:
- tabs = tab_to_col - len(str) / 8
- if value > 9:
- val_str = '%#x' % value
- else:
- val_str = '%d' % value
-
- str += '%s= %s' % ('\t' * tabs, val_str)
- print('\t%s,' % str)
-
-# Process a CSV file, e.g. from tabula
-def process_csv(name, fd):
- reader = csv.reader(fd)
-
- rows = []
-
- field = RegField()
- for row in reader:
- #print field.desc
- if not row[0]:
- field.desc.append(row[3])
- continue
- if field.bits:
- if field.bits != 'Bit':
- rows.append(field)
- #print row
- field = RegField(row)
-
- with Printer(name) as printer:
- for row in rows:
- #print field
- printer.output_regfield(row)
- #print
-
-fname = sys.argv[1]
-name = sys.argv[2]
-
-# Read output from pdftotext -layout
-if 1:
- with open(fname, 'r') as fd:
- process_file(name, fd)
-
-# Use tabula
-# It seems to be better at outputting text for an entire cell in one cell.
-# But it does not always work. E.g. GRF_GPIO7CH_IOMUX.
-# So there is no point in using it.
-if 0:
- with open(fname, 'r') as fd:
- process_csv(name, fd)
--
2.39.5
next prev parent reply other threads:[~2026-07-30 13:32 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 13:29 [PATCH v3 00/12] doc: clean up README.rockchip Johan Jonker
2026-07-30 13:32 ` Johan Jonker [this message]
2026-07-30 15:43 ` [PATCH v3 01/12] rockchip: scripts: remove rkmux.py Quentin Schulz
2026-07-30 13:33 ` [PATCH v3 02/12] rockchip: doc: change TPL phrase Johan Jonker
2026-07-30 15:54 ` Quentin Schulz via U-Boot
2026-07-30 13:33 ` [PATCH v3 03/12] rockchip: doc: add BootROM mode text Johan Jonker
2026-07-31 7:47 ` Jonas Karlman
2026-07-30 13:33 ` [PATCH v3 04/12] rockchip: doc: remove TODO Johan Jonker
2026-07-30 13:34 ` [PATCH v3 05/12] rockchip: doc: add more building instructions Johan Jonker
2026-07-30 13:34 ` [PATCH v3 06/12] rockchip: doc: add more eMMC program examples Johan Jonker
2026-07-31 8:20 ` Jonas Karlman
2026-07-30 13:34 ` [PATCH v3 07/12] rockchip: doc: add boot medium layout text Johan Jonker
2026-07-31 8:32 ` Jonas Karlman
[not found] ` <jonas@kwiboo.se>
2026-07-31 15:10 ` Stefan Monnier
2026-07-31 18:01 ` Jonas Karlman
2026-08-04 15:38 ` [PATCH 1/9] ram: rockchip: rk3568: Simplify get_info() ops Stefan Monnier
2026-08-04 18:53 ` Jonas Karlman
2026-07-30 13:35 ` [PATCH v3 08/12] rockchip: tools: add comment section to rksd.c Johan Jonker
2026-07-31 8:41 ` Jonas Karlman
2026-07-30 13:35 ` [PATCH v3 09/12] rockchip: tools: add comment section to rkspi.c Johan Jonker
2026-07-31 8:51 ` Jonas Karlman
2026-07-30 13:35 ` [PATCH v3 10/12] rockchip: tools: add comment section to rkimage.c Johan Jonker
2026-07-30 13:36 ` [PATCH v3 11/12] rockchip: doc: rockusb: remove refer to README.rockchip Johan Jonker
2026-07-30 13:36 ` [PATCH v3 12/12] rockchip: doc: remove README.rockchip Johan Jonker
-- strict thread matches above, loose matches on Subject: below --
2026-08-04 10:57 [PATCH 0/9] rockchip: Remove unneeded syscon driver for RK35xx Jonas Karlman
2026-08-04 10:57 ` [PATCH 1/9] ram: rockchip: rk3568: Simplify get_info() ops Jonas Karlman
2026-08-04 10:57 ` [PATCH 2/9] ram: rockchip: rk3588: " Jonas Karlman
2026-08-04 10:57 ` [PATCH 3/9] video: rockchip: dw_mipi_dsi: Get GRF base address from phandle Jonas Karlman
2026-08-04 10:57 ` [PATCH 4/9] rockchip: rk3568: Remove unneeded syscon driver Jonas Karlman
2026-08-04 10:57 ` [PATCH 5/9] rockchip: rk3588: " Jonas Karlman
2026-08-04 10:57 ` [PATCH 6/9] rockchip: rk3576: " Jonas Karlman
2026-08-04 10:57 ` [PATCH 7/9] rockchip: rk3528: " Jonas Karlman
2026-08-04 10:57 ` [PATCH 8/9] rockchip: rk3506: " Jonas Karlman
2026-08-04 10:57 ` [PATCH 9/9] rockchip: include: Remove unused ROCKCHIP_SYSCON_x enum values Jonas Karlman
2026-08-04 19:19 ` [PATCH 0/9] rockchip: Remove unneeded syscon driver for RK35xx Simon Glass
2026-08-04 19:57 ` Jonas Karlman
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=29151ea2-7e8b-40f7-bf22-e487def1445f@gmail.com \
--to=jbx6244@gmail.com \
--cc=eddie.cai.linux@gmail.com \
--cc=kever.yang@rock-chips.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@0leil.net \
--cc=u-boot@lists.u-boot-project.org \
/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.