Linux v4.18 rebase
This commit is contained in:
parent
5a10a74844
commit
151d4019f7
|
@ -1,99 +0,0 @@
|
|||
From 714fe15daa07e7691c9731c88de71aa57f84b6c2 Mon Sep 17 00:00:00 2001
|
||||
From: Hans de Goede <hdegoede@redhat.com>
|
||||
Date: Wed, 3 Jan 2018 11:13:54 +0100
|
||||
Subject: [PATCH] platform/x86: dell-laptop: Filter out spurious keyboard
|
||||
backlight change events
|
||||
|
||||
On some Dell XPS models WMI events of type 0x0000 reporting a keycode of
|
||||
0xe00c get reported when the brightness of the LCD panel changes.
|
||||
|
||||
This leads to us reporting false-positive kbd_led change events to
|
||||
userspace which in turn leads to the kbd backlight OSD showing when it
|
||||
should not.
|
||||
|
||||
We already read the current keyboard backlight brightness value when
|
||||
reporting events because the led_classdev_notify_brightness_hw_changed
|
||||
API requires this. Compare this value to the last known value and filter
|
||||
out duplicate events, fixing this.
|
||||
|
||||
Note the fixed issue is esp. a problem on XPS models with an ambient light
|
||||
sensor and automatic brightness adjustments turned on, this causes the kbd
|
||||
backlight OSD to show all the time there.
|
||||
|
||||
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1514969
|
||||
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||
---
|
||||
drivers/platform/x86/dell-laptop.c | 24 ++++++++++++++++++++++--
|
||||
1 file changed, 22 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
|
||||
index cd4725e7e0b5..2ef3297a9efc 100644
|
||||
--- a/drivers/platform/x86/dell-laptop.c
|
||||
+++ b/drivers/platform/x86/dell-laptop.c
|
||||
@@ -1133,6 +1133,7 @@ static u8 kbd_previous_mode_bit;
|
||||
|
||||
static bool kbd_led_present;
|
||||
static DEFINE_MUTEX(kbd_led_mutex);
|
||||
+static enum led_brightness kbd_led_level;
|
||||
|
||||
/*
|
||||
* NOTE: there are three ways to set the keyboard backlight level.
|
||||
@@ -1947,6 +1948,7 @@ static enum led_brightness kbd_led_level_get(struct led_classdev *led_cdev)
|
||||
static int kbd_led_level_set(struct led_classdev *led_cdev,
|
||||
enum led_brightness value)
|
||||
{
|
||||
+ enum led_brightness new_value = value;
|
||||
struct kbd_state state;
|
||||
struct kbd_state new_state;
|
||||
u16 num;
|
||||
@@ -1976,6 +1978,9 @@ static int kbd_led_level_set(struct led_classdev *led_cdev,
|
||||
}
|
||||
|
||||
out:
|
||||
+ if (ret == 0)
|
||||
+ kbd_led_level = new_value;
|
||||
+
|
||||
mutex_unlock(&kbd_led_mutex);
|
||||
return ret;
|
||||
}
|
||||
@@ -2003,6 +2008,9 @@ static int __init kbd_led_init(struct device *dev)
|
||||
if (kbd_led.max_brightness)
|
||||
kbd_led.max_brightness--;
|
||||
}
|
||||
+
|
||||
+ kbd_led_level = kbd_led_level_get(NULL);
|
||||
+
|
||||
ret = led_classdev_register(dev, &kbd_led);
|
||||
if (ret)
|
||||
kbd_led_present = false;
|
||||
@@ -2027,13 +2035,25 @@ static void kbd_led_exit(void)
|
||||
static int dell_laptop_notifier_call(struct notifier_block *nb,
|
||||
unsigned long action, void *data)
|
||||
{
|
||||
+ bool changed = false;
|
||||
+ enum led_brightness new_kbd_led_level;
|
||||
+
|
||||
switch (action) {
|
||||
case DELL_LAPTOP_KBD_BACKLIGHT_BRIGHTNESS_CHANGED:
|
||||
if (!kbd_led_present)
|
||||
break;
|
||||
|
||||
- led_classdev_notify_brightness_hw_changed(&kbd_led,
|
||||
- kbd_led_level_get(&kbd_led));
|
||||
+ mutex_lock(&kbd_led_mutex);
|
||||
+ new_kbd_led_level = kbd_led_level_get(&kbd_led);
|
||||
+ if (kbd_led_level != new_kbd_led_level) {
|
||||
+ kbd_led_level = new_kbd_led_level;
|
||||
+ changed = true;
|
||||
+ }
|
||||
+ mutex_unlock(&kbd_led_mutex);
|
||||
+
|
||||
+ if (changed)
|
||||
+ led_classdev_notify_brightness_hw_changed(&kbd_led,
|
||||
+ kbd_led_level);
|
||||
break;
|
||||
}
|
||||
|
||||
--
|
||||
2.14.3
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
From 0c362f96e1c6bb76ab9b0b828985655fd2516bfa Mon Sep 17 00:00:00 2001
|
||||
From: "Eric W. Biederman" <ebiederm@xmission.com>
|
||||
Date: Sat, 14 Apr 2018 14:20:30 -0500
|
||||
Subject: [PATCH] signal: Stop special casing TRAP_FIXME and FPE_FIXME in
|
||||
siginfo_layout
|
||||
|
||||
After more experience with the cases where no one the si_code of 0
|
||||
is used both as a signal specific si_code, and as SI_USER it appears
|
||||
that no one cares about the signal specific si_code case and the
|
||||
good solution is to just fix the architectures by using
|
||||
a different si_code.
|
||||
|
||||
In none of the conversations has anyone even suggested that
|
||||
anything depends on the signal specific redefinition of SI_USER.
|
||||
|
||||
There are at least test cases that care when si_code as 0 does
|
||||
not work as si_user.
|
||||
|
||||
So make things simple and keep the generic code from introducing
|
||||
problems by removing the special casing of TRAP_FIXME and FPE_FIXME.
|
||||
This will ensure the generic case of sending a signal with
|
||||
kill will always set SI_USER and work.
|
||||
|
||||
The architecture specific, and signal specific overloads that
|
||||
set si_code to 0 will now have problems with signalfd and
|
||||
the 32bit compat versions of siginfo copying. At least
|
||||
until they are fixed.
|
||||
|
||||
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
|
||||
---
|
||||
kernel/signal.c | 9 ---------
|
||||
1 file changed, 9 deletions(-)
|
||||
|
||||
diff --git a/kernel/signal.c b/kernel/signal.c
|
||||
index d56f4d496c89..fc82d2c0918f 100644
|
||||
--- a/kernel/signal.c
|
||||
+++ b/kernel/signal.c
|
||||
@@ -2835,15 +2835,6 @@ enum siginfo_layout siginfo_layout(int sig, int si_code)
|
||||
layout = SIL_POLL;
|
||||
else if (si_code < 0)
|
||||
layout = SIL_RT;
|
||||
- /* Tests to support buggy kernel ABIs */
|
||||
-#ifdef TRAP_FIXME
|
||||
- if ((sig == SIGTRAP) && (si_code == TRAP_FIXME))
|
||||
- layout = SIL_FAULT;
|
||||
-#endif
|
||||
-#ifdef FPE_FIXME
|
||||
- if ((sig == SIGFPE) && (si_code == FPE_FIXME))
|
||||
- layout = SIL_FAULT;
|
||||
-#endif
|
||||
}
|
||||
return layout;
|
||||
}
|
||||
--
|
||||
2.17.1
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
From 85721e6bfc5da3c8f7971c4acb1a0ad16fb2c16a Mon Sep 17 00:00:00 2001
|
||||
From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
|
||||
Date: Thu, 1 Feb 2018 13:29:38 +1100
|
||||
Subject: [PATCH] tools/lib/subcmd/pager.c: do not alias select() params
|
||||
|
||||
Use a separate fd set for select()-s exception fds param to fix the
|
||||
following gcc warning:
|
||||
|
||||
pager.c:36:12: error: passing argument 2 to restrict-qualified
|
||||
parameter aliases with argument 4 [-Werror=restrict]
|
||||
select(1, &in, NULL, &in, NULL);
|
||||
^~~ ~~~
|
||||
|
||||
Link: http://lkml.kernel.org/r/20180101105626.7168-1-sergey.senozhatsky@gmail.com
|
||||
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
|
||||
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
|
||||
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
|
||||
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
|
||||
---
|
||||
tools/lib/subcmd/pager.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/lib/subcmd/pager.c b/tools/lib/subcmd/pager.c
|
||||
index 5ba754d17952..9997a8805a82 100644
|
||||
--- a/tools/lib/subcmd/pager.c
|
||||
+++ b/tools/lib/subcmd/pager.c
|
||||
@@ -30,10 +30,13 @@ static void pager_preexec(void)
|
||||
* have real input
|
||||
*/
|
||||
fd_set in;
|
||||
+ fd_set exception;
|
||||
|
||||
FD_ZERO(&in);
|
||||
+ FD_ZERO(&exception);
|
||||
FD_SET(0, &in);
|
||||
- select(1, &in, NULL, &in, NULL);
|
||||
+ FD_SET(0, &exception);
|
||||
+ select(1, &in, NULL, &exception, NULL);
|
||||
|
||||
setenv("LESS", "FRSX", 0);
|
||||
}
|
||||
--
|
||||
2.14.3
|
||||
|
|
@ -1,223 +0,0 @@
|
|||
From 7d71a671a2d900606d3a62ed5976d3b0feada3a6 Mon Sep 17 00:00:00 2001
|
||||
From: Dave Chinner <dchinner@redhat.com>
|
||||
Date: Tue, 5 Jun 2018 10:06:44 -0700
|
||||
Subject: [PATCH] xfs: verify extent size hint is valid in inode verifier
|
||||
|
||||
There are rules for vald extent size hints. We enforce them when
|
||||
applications set them, but fuzzers violate those rules and that
|
||||
screws us over.
|
||||
|
||||
This results in alignment assertion failures when setting up
|
||||
allocations such as this in direct IO:
|
||||
|
||||
XFS: Assertion failed: ap->length, file: fs/xfs/libxfs/xfs_bmap.c, line: 3432
|
||||
....
|
||||
Call Trace:
|
||||
xfs_bmap_btalloc+0x415/0x910
|
||||
xfs_bmapi_write+0x71c/0x12e0
|
||||
xfs_iomap_write_direct+0x2a9/0x420
|
||||
xfs_file_iomap_begin+0x4dc/0xa70
|
||||
iomap_apply+0x43/0x100
|
||||
iomap_file_buffered_write+0x62/0x90
|
||||
xfs_file_buffered_aio_write+0xba/0x300
|
||||
__vfs_write+0xd5/0x150
|
||||
vfs_write+0xb6/0x180
|
||||
ksys_write+0x45/0xa0
|
||||
do_syscall_64+0x5a/0x180
|
||||
entry_SYSCALL_64_after_hwframe+0x49/0xbe
|
||||
|
||||
And from xfs_db:
|
||||
|
||||
core.extsize = 10380288
|
||||
|
||||
Which is not an integer multiple of the block size, and so violates
|
||||
Rule #7 for setting extent size hints. Validate extent size hint
|
||||
rules in the inode verifier to catch this.
|
||||
|
||||
Signed-off-by: Dave Chinner <dchinner@redhat.com>
|
||||
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
|
||||
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
|
||||
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
|
||||
Signed-off-by: Jeremy Cline <jcline@redhat.com>
|
||||
---
|
||||
fs/xfs/libxfs/xfs_inode_buf.c | 9 ++++++++-
|
||||
1 file changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c
|
||||
index 1201107eabc6..1fe18555b451 100644
|
||||
--- a/fs/xfs/libxfs/xfs_inode_buf.c
|
||||
+++ b/fs/xfs/libxfs/xfs_inode_buf.c
|
||||
@@ -397,6 +397,7 @@ xfs_dinode_verify(
|
||||
xfs_ino_t ino,
|
||||
struct xfs_dinode *dip)
|
||||
{
|
||||
+ xfs_failaddr_t fa;
|
||||
uint16_t mode;
|
||||
uint16_t flags;
|
||||
uint64_t flags2;
|
||||
@@ -513,6 +514,12 @@ xfs_dinode_verify(
|
||||
return __this_address;
|
||||
}
|
||||
|
||||
+ /* extent size hint validation */
|
||||
+ fa = xfs_inode_validate_extsize(mp, be32_to_cpu(dip->di_extsize),
|
||||
+ mode, flags);
|
||||
+ if (fa)
|
||||
+ return fa;
|
||||
+
|
||||
/* only version 3 or greater inodes are extensively verified here */
|
||||
if (dip->di_version < 3)
|
||||
return NULL;
|
||||
@@ -521,7 +528,7 @@ xfs_dinode_verify(
|
||||
|
||||
/* don't allow reflink/cowextsize if we don't have reflink */
|
||||
if ((flags2 & (XFS_DIFLAG2_REFLINK | XFS_DIFLAG2_COWEXTSIZE)) &&
|
||||
- !xfs_sb_version_hasreflink(&mp->m_sb))
|
||||
+ !xfs_sb_version_hasreflink(&mp->m_sb))
|
||||
return __this_address;
|
||||
|
||||
/* only regular files get reflink */
|
||||
--
|
||||
2.17.1
|
||||
|
||||
From 23fcb3340d033d9f081e21e6c12c2db7eaa541d3 Mon Sep 17 00:00:00 2001
|
||||
From: Dave Chinner <dchinner@redhat.com>
|
||||
Date: Thu, 21 Jun 2018 23:25:57 -0700
|
||||
Subject: [PATCH] xfs: More robust inode extent count validation
|
||||
|
||||
When the inode is in extent format, it can't have more extents that
|
||||
fit in the inode fork. We don't currenty check this, and so this
|
||||
corruption goes unnoticed by the inode verifiers. This can lead to
|
||||
crashes operating on invalid in-memory structures.
|
||||
|
||||
Attempts to access such a inode will now error out in the verifier
|
||||
rather than allowing modification operations to proceed.
|
||||
|
||||
Reported-by: Wen Xu <wen.xu@gatech.edu>
|
||||
Signed-off-by: Dave Chinner <dchinner@redhat.com>
|
||||
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
|
||||
[darrick: fix a typedef, add some braces and breaks to shut up compiler warnings]
|
||||
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
|
||||
---
|
||||
fs/xfs/libxfs/xfs_format.h | 3 ++
|
||||
fs/xfs/libxfs/xfs_inode_buf.c | 76 ++++++++++++++++++++++-------------
|
||||
2 files changed, 50 insertions(+), 29 deletions(-)
|
||||
|
||||
diff --git a/fs/xfs/libxfs/xfs_format.h b/fs/xfs/libxfs/xfs_format.h
|
||||
index 1c5a8aaf2bfc..7b4a43deb83e 100644
|
||||
--- a/fs/xfs/libxfs/xfs_format.h
|
||||
+++ b/fs/xfs/libxfs/xfs_format.h
|
||||
@@ -962,6 +962,9 @@ typedef enum xfs_dinode_fmt {
|
||||
XFS_DFORK_DSIZE(dip, mp) : \
|
||||
XFS_DFORK_ASIZE(dip, mp))
|
||||
|
||||
+#define XFS_DFORK_MAXEXT(dip, mp, w) \
|
||||
+ (XFS_DFORK_SIZE(dip, mp, w) / sizeof(struct xfs_bmbt_rec))
|
||||
+
|
||||
/*
|
||||
* Return pointers to the data or attribute forks.
|
||||
*/
|
||||
diff --git a/fs/xfs/libxfs/xfs_inode_buf.c b/fs/xfs/libxfs/xfs_inode_buf.c
|
||||
index d38d724534c4..33dc34655ac3 100644
|
||||
--- a/fs/xfs/libxfs/xfs_inode_buf.c
|
||||
+++ b/fs/xfs/libxfs/xfs_inode_buf.c
|
||||
@@ -374,6 +374,47 @@ xfs_log_dinode_to_disk(
|
||||
}
|
||||
}
|
||||
|
||||
+static xfs_failaddr_t
|
||||
+xfs_dinode_verify_fork(
|
||||
+ struct xfs_dinode *dip,
|
||||
+ struct xfs_mount *mp,
|
||||
+ int whichfork)
|
||||
+{
|
||||
+ uint32_t di_nextents = XFS_DFORK_NEXTENTS(dip, whichfork);
|
||||
+
|
||||
+ switch (XFS_DFORK_FORMAT(dip, whichfork)) {
|
||||
+ case XFS_DINODE_FMT_LOCAL:
|
||||
+ /*
|
||||
+ * no local regular files yet
|
||||
+ */
|
||||
+ if (whichfork == XFS_DATA_FORK) {
|
||||
+ if (S_ISREG(be16_to_cpu(dip->di_mode)))
|
||||
+ return __this_address;
|
||||
+ if (be64_to_cpu(dip->di_size) >
|
||||
+ XFS_DFORK_SIZE(dip, mp, whichfork))
|
||||
+ return __this_address;
|
||||
+ }
|
||||
+ if (di_nextents)
|
||||
+ return __this_address;
|
||||
+ break;
|
||||
+ case XFS_DINODE_FMT_EXTENTS:
|
||||
+ if (di_nextents > XFS_DFORK_MAXEXT(dip, mp, whichfork))
|
||||
+ return __this_address;
|
||||
+ break;
|
||||
+ case XFS_DINODE_FMT_BTREE:
|
||||
+ if (whichfork == XFS_ATTR_FORK) {
|
||||
+ if (di_nextents > MAXAEXTNUM)
|
||||
+ return __this_address;
|
||||
+ } else if (di_nextents > MAXEXTNUM) {
|
||||
+ return __this_address;
|
||||
+ }
|
||||
+ break;
|
||||
+ default:
|
||||
+ return __this_address;
|
||||
+ }
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
xfs_failaddr_t
|
||||
xfs_dinode_verify(
|
||||
struct xfs_mount *mp,
|
||||
@@ -441,24 +482,9 @@ xfs_dinode_verify(
|
||||
case S_IFREG:
|
||||
case S_IFLNK:
|
||||
case S_IFDIR:
|
||||
- switch (dip->di_format) {
|
||||
- case XFS_DINODE_FMT_LOCAL:
|
||||
- /*
|
||||
- * no local regular files yet
|
||||
- */
|
||||
- if (S_ISREG(mode))
|
||||
- return __this_address;
|
||||
- if (di_size > XFS_DFORK_DSIZE(dip, mp))
|
||||
- return __this_address;
|
||||
- if (dip->di_nextents)
|
||||
- return __this_address;
|
||||
- /* fall through */
|
||||
- case XFS_DINODE_FMT_EXTENTS:
|
||||
- case XFS_DINODE_FMT_BTREE:
|
||||
- break;
|
||||
- default:
|
||||
- return __this_address;
|
||||
- }
|
||||
+ fa = xfs_dinode_verify_fork(dip, mp, XFS_DATA_FORK);
|
||||
+ if (fa)
|
||||
+ return fa;
|
||||
break;
|
||||
case 0:
|
||||
/* Uninitialized inode ok. */
|
||||
@@ -468,17 +494,9 @@ xfs_dinode_verify(
|
||||
}
|
||||
|
||||
if (XFS_DFORK_Q(dip)) {
|
||||
- switch (dip->di_aformat) {
|
||||
- case XFS_DINODE_FMT_LOCAL:
|
||||
- if (dip->di_anextents)
|
||||
- return __this_address;
|
||||
- /* fall through */
|
||||
- case XFS_DINODE_FMT_EXTENTS:
|
||||
- case XFS_DINODE_FMT_BTREE:
|
||||
- break;
|
||||
- default:
|
||||
- return __this_address;
|
||||
- }
|
||||
+ fa = xfs_dinode_verify_fork(dip, mp, XFS_ATTR_FORK);
|
||||
+ if (fa)
|
||||
+ return fa;
|
||||
} else {
|
||||
/*
|
||||
* If there is no fork offset, this may be a freshly-made inode
|
||||
--
|
||||
2.17.1
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
From patchwork Tue Jun 26 13:21:31 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [1/2] posix-timers: Make forward callback return s64
|
||||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
X-Patchwork-Id: 10489059
|
||||
Message-Id: <20180626132704.922098090@linutronix.de>
|
||||
To: LKML <linux-kernel@vger.kernel.org>
|
||||
Cc: John Stultz <john.stultz@linaro.org>,
|
||||
Peter Zijlstra <peterz@infradead.org>,
|
||||
Michael Kerrisk <mtk.manpages@gmail.com>, air icy <icytxw@gmail.com>
|
||||
Date: Tue, 26 Jun 2018 15:21:31 +0200
|
||||
|
||||
The posix timer ti_overrun handling is broken because the forwarding
|
||||
functions can return a huge number of overruns which does not fit in an
|
||||
int. As a consequence timer_getoverrun(2) and siginfo::si_overrun can turn
|
||||
into random number generators.
|
||||
|
||||
As a first step to address that let the timer_forward() callbacks return
|
||||
the full 64 bit value.
|
||||
|
||||
Cast it to (int) temporarily until k_itimer::ti_overrun is converted to
|
||||
64bit and the conversion to user space visible values is sanitized.
|
||||
|
||||
Reported-by: air icy <icytxw@gmail.com>
|
||||
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
Acked-by: John Stultz <john.stultz@linaro.org>
|
||||
---
|
||||
kernel/time/alarmtimer.c | 4 ++--
|
||||
kernel/time/posix-timers.c | 6 +++---
|
||||
kernel/time/posix-timers.h | 2 +-
|
||||
3 files changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
--- a/kernel/time/alarmtimer.c
|
||||
+++ b/kernel/time/alarmtimer.c
|
||||
@@ -581,11 +581,11 @@ static void alarm_timer_rearm(struct k_i
|
||||
* @timr: Pointer to the posixtimer data struct
|
||||
* @now: Current time to forward the timer against
|
||||
*/
|
||||
-static int alarm_timer_forward(struct k_itimer *timr, ktime_t now)
|
||||
+static s64 alarm_timer_forward(struct k_itimer *timr, ktime_t now)
|
||||
{
|
||||
struct alarm *alarm = &timr->it.alarm.alarmtimer;
|
||||
|
||||
- return (int) alarm_forward(alarm, timr->it_interval, now);
|
||||
+ return alarm_forward(alarm, timr->it_interval, now);
|
||||
}
|
||||
|
||||
/**
|
||||
--- a/kernel/time/posix-timers.c
|
||||
+++ b/kernel/time/posix-timers.c
|
||||
@@ -645,11 +645,11 @@ static ktime_t common_hrtimer_remaining(
|
||||
return __hrtimer_expires_remaining_adjusted(timer, now);
|
||||
}
|
||||
|
||||
-static int common_hrtimer_forward(struct k_itimer *timr, ktime_t now)
|
||||
+static s64 common_hrtimer_forward(struct k_itimer *timr, ktime_t now)
|
||||
{
|
||||
struct hrtimer *timer = &timr->it.real.timer;
|
||||
|
||||
- return (int)hrtimer_forward(timer, now, timr->it_interval);
|
||||
+ return hrtimer_forward(timer, now, timr->it_interval);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -702,7 +702,7 @@ void common_timer_get(struct k_itimer *t
|
||||
* expiry time forward by intervals, so expiry is > now.
|
||||
*/
|
||||
if (iv && (timr->it_requeue_pending & REQUEUE_PENDING || sig_none))
|
||||
- timr->it_overrun += kc->timer_forward(timr, now);
|
||||
+ timr->it_overrun += (int)kc->timer_forward(timr, now);
|
||||
|
||||
remaining = kc->timer_remaining(timr, now);
|
||||
/* Return 0 only, when the timer is expired and not pending */
|
||||
--- a/kernel/time/posix-timers.h
|
||||
+++ b/kernel/time/posix-timers.h
|
||||
@@ -19,7 +19,7 @@ struct k_clock {
|
||||
void (*timer_get)(struct k_itimer *timr,
|
||||
struct itimerspec64 *cur_setting);
|
||||
void (*timer_rearm)(struct k_itimer *timr);
|
||||
- int (*timer_forward)(struct k_itimer *timr, ktime_t now);
|
||||
+ s64 (*timer_forward)(struct k_itimer *timr, ktime_t now);
|
||||
ktime_t (*timer_remaining)(struct k_itimer *timr, ktime_t now);
|
||||
int (*timer_try_to_cancel)(struct k_itimer *timr);
|
||||
void (*timer_arm)(struct k_itimer *timr, ktime_t expires,
|
|
@ -1,145 +0,0 @@
|
|||
From patchwork Tue Jun 26 13:21:32 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [2/2] posix-timers: Sanitize overrun handling
|
||||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
X-Patchwork-Id: 10489053
|
||||
Message-Id: <20180626132705.018623573@linutronix.de>
|
||||
To: LKML <linux-kernel@vger.kernel.org>
|
||||
Cc: John Stultz <john.stultz@linaro.org>,
|
||||
Peter Zijlstra <peterz@infradead.org>,
|
||||
Michael Kerrisk <mtk.manpages@gmail.com>, air icy <icytxw@gmail.com>
|
||||
Date: Tue, 26 Jun 2018 15:21:32 +0200
|
||||
|
||||
The posix timer overrun handling is broken because the forwarding functions
|
||||
can return a huge number of overruns which does not fit in an int. As a
|
||||
consequence timer_getoverrun(2) and siginfo::si_overrun can turn into
|
||||
random number generators.
|
||||
|
||||
The k_clock::timer_forward() callbacks return a 64 bit value now. Make
|
||||
k_itimer::ti_overrun[_last] 64bit as well, so the kernel internal
|
||||
accounting is correct. 3Remove the temporary (int) casts.
|
||||
|
||||
Add a helper function which clamps the overrun value returned to user space
|
||||
via timer_getoverrun(2) or siginfo::si_overrun limited to a positive value
|
||||
between 0 and INT_MAX. INT_MAX is an indicator for user space that the
|
||||
overrun value has been clamped.
|
||||
|
||||
Reported-by: air icy <icytxw@gmail.com>
|
||||
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
Acked-by: John Stultz <john.stultz@linaro.org>
|
||||
---
|
||||
include/linux/posix-timers.h | 4 ++--
|
||||
kernel/time/posix-cpu-timers.c | 2 +-
|
||||
kernel/time/posix-timers.c | 31 ++++++++++++++++++++-----------
|
||||
3 files changed, 23 insertions(+), 14 deletions(-)
|
||||
|
||||
--- a/include/linux/posix-timers.h
|
||||
+++ b/include/linux/posix-timers.h
|
||||
@@ -95,8 +95,8 @@ struct k_itimer {
|
||||
clockid_t it_clock;
|
||||
timer_t it_id;
|
||||
int it_active;
|
||||
- int it_overrun;
|
||||
- int it_overrun_last;
|
||||
+ s64 it_overrun;
|
||||
+ s64 it_overrun_last;
|
||||
int it_requeue_pending;
|
||||
int it_sigev_notify;
|
||||
ktime_t it_interval;
|
||||
--- a/kernel/time/posix-cpu-timers.c
|
||||
+++ b/kernel/time/posix-cpu-timers.c
|
||||
@@ -85,7 +85,7 @@ static void bump_cpu_timer(struct k_itim
|
||||
continue;
|
||||
|
||||
timer->it.cpu.expires += incr;
|
||||
- timer->it_overrun += 1 << i;
|
||||
+ timer->it_overrun += 1LL << i;
|
||||
delta -= incr;
|
||||
}
|
||||
}
|
||||
--- a/kernel/time/posix-timers.c
|
||||
+++ b/kernel/time/posix-timers.c
|
||||
@@ -283,6 +283,17 @@ static __init int init_posix_timers(void
|
||||
}
|
||||
__initcall(init_posix_timers);
|
||||
|
||||
+/*
|
||||
+ * The siginfo si_overrun field and the return value of timer_getoverrun(2)
|
||||
+ * are of type int. Clamp the overrun value to INT_MAX
|
||||
+ */
|
||||
+static inline int timer_overrun_to_int(struct k_itimer *timr, int baseval)
|
||||
+{
|
||||
+ s64 sum = timr->it_overrun_last + (s64)baseval;
|
||||
+
|
||||
+ return sum > (s64)INT_MAX ? INT_MAX : (int)sum;
|
||||
+}
|
||||
+
|
||||
static void common_hrtimer_rearm(struct k_itimer *timr)
|
||||
{
|
||||
struct hrtimer *timer = &timr->it.real.timer;
|
||||
@@ -290,9 +301,8 @@ static void common_hrtimer_rearm(struct
|
||||
if (!timr->it_interval)
|
||||
return;
|
||||
|
||||
- timr->it_overrun += (unsigned int) hrtimer_forward(timer,
|
||||
- timer->base->get_time(),
|
||||
- timr->it_interval);
|
||||
+ timr->it_overrun += hrtimer_forward(timer, timer->base->get_time(),
|
||||
+ timr->it_interval);
|
||||
hrtimer_restart(timer);
|
||||
}
|
||||
|
||||
@@ -321,10 +331,10 @@ void posixtimer_rearm(struct siginfo *in
|
||||
|
||||
timr->it_active = 1;
|
||||
timr->it_overrun_last = timr->it_overrun;
|
||||
- timr->it_overrun = -1;
|
||||
+ timr->it_overrun = -1LL;
|
||||
++timr->it_requeue_pending;
|
||||
|
||||
- info->si_overrun += timr->it_overrun_last;
|
||||
+ info->si_overrun = timer_overrun_to_int(timr, info->si_overrun);
|
||||
}
|
||||
|
||||
unlock_timer(timr, flags);
|
||||
@@ -418,9 +428,8 @@ static enum hrtimer_restart posix_timer_
|
||||
now = ktime_add(now, kj);
|
||||
}
|
||||
#endif
|
||||
- timr->it_overrun += (unsigned int)
|
||||
- hrtimer_forward(timer, now,
|
||||
- timr->it_interval);
|
||||
+ timr->it_overrun += hrtimer_forward(timer, now,
|
||||
+ timr->it_interval);
|
||||
ret = HRTIMER_RESTART;
|
||||
++timr->it_requeue_pending;
|
||||
timr->it_active = 1;
|
||||
@@ -524,7 +533,7 @@ static int do_timer_create(clockid_t whi
|
||||
new_timer->it_id = (timer_t) new_timer_id;
|
||||
new_timer->it_clock = which_clock;
|
||||
new_timer->kclock = kc;
|
||||
- new_timer->it_overrun = -1;
|
||||
+ new_timer->it_overrun = -1LL;
|
||||
|
||||
if (event) {
|
||||
rcu_read_lock();
|
||||
@@ -702,7 +711,7 @@ void common_timer_get(struct k_itimer *t
|
||||
* expiry time forward by intervals, so expiry is > now.
|
||||
*/
|
||||
if (iv && (timr->it_requeue_pending & REQUEUE_PENDING || sig_none))
|
||||
- timr->it_overrun += (int)kc->timer_forward(timr, now);
|
||||
+ timr->it_overrun += kc->timer_forward(timr, now);
|
||||
|
||||
remaining = kc->timer_remaining(timr, now);
|
||||
/* Return 0 only, when the timer is expired and not pending */
|
||||
@@ -791,7 +800,7 @@ SYSCALL_DEFINE1(timer_getoverrun, timer_
|
||||
if (!timr)
|
||||
return -EINVAL;
|
||||
|
||||
- overrun = timr->it_overrun_last;
|
||||
+ overrun = timer_overrun_to_int(timr, 0);
|
||||
unlock_timer(timr, flags);
|
||||
|
||||
return overrun;
|
|
@ -1,63 +0,0 @@
|
|||
From 1cd2fabf4bdcf95eda6a1bcebc4a0a965509da36 Mon Sep 17 00:00:00 2001
|
||||
From: Artiom Vaskov <velemas@gmail.com>
|
||||
Date: Wed, 30 May 2018 11:23:00 +0300
|
||||
Subject: [PATCH] Bluetooth: btusb: Add additional device ID for RTL8822BE
|
||||
|
||||
The Asus ROG GL702ZC laptop contains a Realtek RTL8822BE device with
|
||||
an associated BT chip using a USB ID of 13d3:3526. This ID is added
|
||||
to the driver.
|
||||
|
||||
The /sys/kernel/debug/usb/devices portion for this device is:
|
||||
|
||||
T: Bus=01 Lev=01 Prnt=01 Port=09 Cnt=04 Dev#= 5 Spd=12 MxCh= 0
|
||||
D: Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
|
||||
P: Vendor=13d3 ProdID=3526 Rev= 1.10
|
||||
S: Manufacturer=Realtek
|
||||
S: Product=Bluetooth Radio
|
||||
S: SerialNumber=00e04c000001
|
||||
C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=500mA
|
||||
I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
|
||||
E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms
|
||||
E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
|
||||
E: Ad=82(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
|
||||
I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
|
||||
E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms
|
||||
E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms
|
||||
I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
|
||||
E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms
|
||||
E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms
|
||||
I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
|
||||
E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms
|
||||
E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms
|
||||
I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
|
||||
E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms
|
||||
E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms
|
||||
I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
|
||||
E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms
|
||||
E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms
|
||||
I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
|
||||
E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms
|
||||
E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
|
||||
|
||||
Signed-off-by: Artiom Vaskov <velemas@gmail.com>
|
||||
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
|
||||
Signed-off-by: Jeremy Cline <jcline@redhat.com>
|
||||
---
|
||||
drivers/bluetooth/btusb.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
|
||||
index 3a477b6b3ce6..f73a27ea28cc 100644
|
||||
--- a/drivers/bluetooth/btusb.c
|
||||
+++ b/drivers/bluetooth/btusb.c
|
||||
@@ -384,6 +384,7 @@ static const struct usb_device_id blacklist_table[] = {
|
||||
{ USB_DEVICE(0x13d3, 0x3462), .driver_info = BTUSB_REALTEK },
|
||||
|
||||
/* Additional Realtek 8822BE Bluetooth devices */
|
||||
+ { USB_DEVICE(0x13d3, 0x3526), .driver_info = BTUSB_REALTEK },
|
||||
{ USB_DEVICE(0x0b05, 0x185c), .driver_info = BTUSB_REALTEK },
|
||||
|
||||
/* Silicon Wave based devices */
|
||||
--
|
||||
2.17.1
|
||||
|
|
@ -1,180 +0,0 @@
|
|||
From: "J. Bruce Fields" <bfields@redhat.com>
|
||||
Date: 2017-04-14 15:04:40
|
||||
Subject: [PATCH] nfsd: check for oversized NFSv2/v3 arguments
|
||||
|
||||
A client can append random data to the end of an NFSv2 or NFSv3 RPC call
|
||||
without our complaining; we'll just stop parsing at the end of the
|
||||
expected data and ignore the rest.
|
||||
|
||||
Encoded arguments and replies are stored together in an array of pages,
|
||||
and if a call is too large it could leave inadequate space for the
|
||||
reply. This is normally OK because NFS RPC's typically have either
|
||||
short arguments and long replies (like READ) or long arguments and short
|
||||
replies (like WRITE). But a client that sends an incorrectly long reply
|
||||
can violate those assumptions. This was observed to cause crashes.
|
||||
|
||||
So, insist that the argument not be any longer than we expect.
|
||||
|
||||
Also, several operations increment rq_next_page in the decode routine
|
||||
before checking the argument size, which can leave rq_next_page pointing
|
||||
well past the end of the page array, causing trouble later in
|
||||
svc_free_pages.
|
||||
|
||||
As followup we may also want to rewrite the encoding routines to check
|
||||
more carefully that they aren't running off the end of the page array.
|
||||
|
||||
Reported-by: Tuomas Haanpää <thaan@synopsys.com>
|
||||
Reported-by: Ari Kauppi <ari@synopsys.com>
|
||||
Cc: stable@vger.kernel.org
|
||||
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
|
||||
---
|
||||
fs/nfsd/nfs3xdr.c | 23 +++++++++++++++++------
|
||||
fs/nfsd/nfsxdr.c | 13 ++++++++++---
|
||||
include/linux/sunrpc/svc.h | 3 +--
|
||||
3 files changed, 28 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
|
||||
index dba2ff8eaa68..be66bcadfaea 100644
|
||||
--- a/fs/nfsd/nfs3xdr.c
|
||||
+++ b/fs/nfsd/nfs3xdr.c
|
||||
@@ -334,8 +334,11 @@ nfs3svc_decode_readargs(struct svc_rqst *rqstp, __be32 *p,
|
||||
if (!p)
|
||||
return 0;
|
||||
p = xdr_decode_hyper(p, &args->offset);
|
||||
-
|
||||
args->count = ntohl(*p++);
|
||||
+
|
||||
+ if (!xdr_argsize_check(rqstp, p))
|
||||
+ return 0;
|
||||
+
|
||||
len = min(args->count, max_blocksize);
|
||||
|
||||
/* set up the kvec */
|
||||
@@ -349,7 +352,7 @@ nfs3svc_decode_readargs(struct svc_rqst *rqstp, __be32 *p,
|
||||
v++;
|
||||
}
|
||||
args->vlen = v;
|
||||
- return xdr_argsize_check(rqstp, p);
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -536,9 +539,11 @@ nfs3svc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p,
|
||||
p = decode_fh(p, &args->fh);
|
||||
if (!p)
|
||||
return 0;
|
||||
+ if (!xdr_argsize_check(rqstp, p))
|
||||
+ return 0;
|
||||
args->buffer = page_address(*(rqstp->rq_next_page++));
|
||||
|
||||
- return xdr_argsize_check(rqstp, p);
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -564,10 +569,14 @@ nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p,
|
||||
args->verf = p; p += 2;
|
||||
args->dircount = ~0;
|
||||
args->count = ntohl(*p++);
|
||||
+
|
||||
+ if (!xdr_argsize_check(rqstp, p))
|
||||
+ return 0;
|
||||
+
|
||||
args->count = min_t(u32, args->count, PAGE_SIZE);
|
||||
args->buffer = page_address(*(rqstp->rq_next_page++));
|
||||
|
||||
- return xdr_argsize_check(rqstp, p);
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -585,6 +594,9 @@ nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, __be32 *p,
|
||||
args->dircount = ntohl(*p++);
|
||||
args->count = ntohl(*p++);
|
||||
|
||||
+ if (!xdr_argsize_check(rqstp, p))
|
||||
+ return 0;
|
||||
+
|
||||
len = args->count = min(args->count, max_blocksize);
|
||||
while (len > 0) {
|
||||
struct page *p = *(rqstp->rq_next_page++);
|
||||
@@ -592,8 +604,7 @@ nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, __be32 *p,
|
||||
args->buffer = page_address(p);
|
||||
len -= PAGE_SIZE;
|
||||
}
|
||||
-
|
||||
- return xdr_argsize_check(rqstp, p);
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
int
|
||||
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c
|
||||
index 41b468a6a90f..79268369f7b3 100644
|
||||
--- a/fs/nfsd/nfsxdr.c
|
||||
+++ b/fs/nfsd/nfsxdr.c
|
||||
@@ -257,6 +257,9 @@ nfssvc_decode_readargs(struct svc_rqst *rqstp, __be32 *p,
|
||||
len = args->count = ntohl(*p++);
|
||||
p++; /* totalcount - unused */
|
||||
|
||||
+ if (!xdr_argsize_check(rqstp, p))
|
||||
+ return 0;
|
||||
+
|
||||
len = min_t(unsigned int, len, NFSSVC_MAXBLKSIZE_V2);
|
||||
|
||||
/* set up somewhere to store response.
|
||||
@@ -272,7 +275,7 @@ nfssvc_decode_readargs(struct svc_rqst *rqstp, __be32 *p,
|
||||
v++;
|
||||
}
|
||||
args->vlen = v;
|
||||
- return xdr_argsize_check(rqstp, p);
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -360,9 +363,11 @@ nfssvc_decode_readlinkargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd_readli
|
||||
p = decode_fh(p, &args->fh);
|
||||
if (!p)
|
||||
return 0;
|
||||
+ if (!xdr_argsize_check(rqstp, p))
|
||||
+ return 0;
|
||||
args->buffer = page_address(*(rqstp->rq_next_page++));
|
||||
|
||||
- return xdr_argsize_check(rqstp, p);
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -400,9 +405,11 @@ nfssvc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p,
|
||||
args->cookie = ntohl(*p++);
|
||||
args->count = ntohl(*p++);
|
||||
args->count = min_t(u32, args->count, PAGE_SIZE);
|
||||
+ if (!xdr_argsize_check(rqstp, p))
|
||||
+ return 0;
|
||||
args->buffer = page_address(*(rqstp->rq_next_page++));
|
||||
|
||||
- return xdr_argsize_check(rqstp, p);
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
|
||||
index e770abeed32d..6ef19cf658b4 100644
|
||||
--- a/include/linux/sunrpc/svc.h
|
||||
+++ b/include/linux/sunrpc/svc.h
|
||||
@@ -336,8 +336,7 @@ xdr_argsize_check(struct svc_rqst *rqstp, __be32 *p)
|
||||
{
|
||||
char *cp = (char *)p;
|
||||
struct kvec *vec = &rqstp->rq_arg.head[0];
|
||||
- return cp >= (char*)vec->iov_base
|
||||
- && cp <= (char*)vec->iov_base + vec->iov_len;
|
||||
+ return cp == (char *)vec->iov_base + vec->iov_len;
|
||||
}
|
||||
|
||||
static inline int
|
||||
--
|
||||
2.9.3
|
||||
|
||||
--
|
||||
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
|
||||
the body of a message to majordomo@vger.kernel.org
|
||||
More majordomo info at http://vger.kernel.org/majordomo-info.html
|
|
@ -1,130 +0,0 @@
|
|||
From 7289bfaee2a42bdb56eecab0625907c045d080ba Mon Sep 17 00:00:00 2001
|
||||
From: Eric Biggers <ebiggers@google.com>
|
||||
Date: Wed, 27 Sep 2017 12:50:41 -0700
|
||||
Subject: [PATCH] KEYS: don't let add_key() update an uninstantiated key
|
||||
|
||||
Currently, add_key() will, when passed a key that already exists, call
|
||||
the key's ->update() method. But this is heavily broken in the case
|
||||
where the key is uninstantiated because it doesn't call
|
||||
__key_instantiate_and_link(). Consequently, it doesn't do most of the
|
||||
things that are supposed to happen when the key is instantiated, such as
|
||||
setting KEY_FLAG_INSTANTIATED, clearing KEY_FLAG_USER_CONSTRUCT and
|
||||
awakening tasks waiting on it, and incrementing key->user->nikeys.
|
||||
|
||||
It also never takes key_construction_mutex, which means that
|
||||
->instantiate() can run concurrently with ->update() on the same key.
|
||||
In the case of the "user" and "logon" key types this causes a memory
|
||||
leak, at best. Maybe even worse, the ->update() methods of the
|
||||
"encrypted" and "trusted" key types actually just dereference a NULL
|
||||
pointer when passed an uninstantiated key.
|
||||
|
||||
Therefore, change find_key_to_update() to return NULL if the found key
|
||||
is uninstantiated, so that add_key() replaces the key rather than
|
||||
instantiating it. This seems to be better than fixing __key_update() to
|
||||
call __key_instantiate_and_link(), since given all the bugs noted above
|
||||
as well as that the existing behavior was undocumented and
|
||||
keyctl_instantiate() is supposed to be used instead, I doubt anyone was
|
||||
relying on the existing behavior.
|
||||
|
||||
This patch only affects *uninstantiated* keys. For now we still allow a
|
||||
negatively instantiated key to be updated (thereby positively
|
||||
instantiating it), although that's broken too (the next patch fixes it)
|
||||
and I'm not sure that anyone actually uses that functionality either.
|
||||
|
||||
Here is a simple reproducer for the bug using the "encrypted" key type
|
||||
(requires CONFIG_ENCRYPTED_KEYS=y), though as noted above the bug
|
||||
pertained to more than just the "encrypted" key type:
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <keyutils.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int ringid = keyctl_join_session_keyring(NULL);
|
||||
|
||||
if (fork()) {
|
||||
for (;;) {
|
||||
const char payload[] = "update user:foo 32";
|
||||
|
||||
usleep(rand() % 10000);
|
||||
add_key("encrypted", "desc", payload, sizeof(payload), ringid);
|
||||
keyctl_clear(ringid);
|
||||
}
|
||||
} else {
|
||||
for (;;)
|
||||
request_key("encrypted", "desc", "callout_info", ringid);
|
||||
}
|
||||
}
|
||||
|
||||
It causes:
|
||||
|
||||
BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
|
||||
IP: encrypted_update+0xb0/0x170
|
||||
PGD 7a178067 P4D 7a178067 PUD 77269067 PMD 0
|
||||
PREEMPT SMP
|
||||
CPU: 0 PID: 340 Comm: reproduce Tainted: G D 4.14.0-rc1-00025-g428490e38b2e #796
|
||||
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
|
||||
task: ffff8a467a39a340 task.stack: ffffb15c40770000
|
||||
RIP: 0010:encrypted_update+0xb0/0x170
|
||||
RSP: 0018:ffffb15c40773de8 EFLAGS: 00010246
|
||||
RAX: 0000000000000000 RBX: ffff8a467a275b00 RCX: 0000000000000000
|
||||
RDX: 0000000000000005 RSI: ffff8a467a275b14 RDI: ffffffffb742f303
|
||||
RBP: ffffb15c40773e20 R08: 0000000000000000 R09: ffff8a467a275b17
|
||||
R10: 0000000000000020 R11: 0000000000000000 R12: 0000000000000000
|
||||
R13: 0000000000000000 R14: ffff8a4677057180 R15: ffff8a467a275b0f
|
||||
FS: 00007f5d7fb08700(0000) GS:ffff8a467f200000(0000) knlGS:0000000000000000
|
||||
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
|
||||
CR2: 0000000000000018 CR3: 0000000077262005 CR4: 00000000001606f0
|
||||
Call Trace:
|
||||
key_create_or_update+0x2bc/0x460
|
||||
SyS_add_key+0x10c/0x1d0
|
||||
entry_SYSCALL_64_fastpath+0x1f/0xbe
|
||||
RIP: 0033:0x7f5d7f211259
|
||||
RSP: 002b:00007ffed03904c8 EFLAGS: 00000246 ORIG_RAX: 00000000000000f8
|
||||
RAX: ffffffffffffffda RBX: 000000003b2a7955 RCX: 00007f5d7f211259
|
||||
RDX: 00000000004009e4 RSI: 00000000004009ff RDI: 0000000000400a04
|
||||
RBP: 0000000068db8bad R08: 000000003b2a7955 R09: 0000000000000004
|
||||
R10: 000000000000001a R11: 0000000000000246 R12: 0000000000400868
|
||||
R13: 00007ffed03905d0 R14: 0000000000000000 R15: 0000000000000000
|
||||
Code: 77 28 e8 64 34 1f 00 45 31 c0 31 c9 48 8d 55 c8 48 89 df 48 8d 75 d0 e8 ff f9 ff ff 85 c0 41 89 c4 0f 88 84 00 00 00 4c 8b 7d c8 <49> 8b 75 18 4c 89 ff e8 24 f8 ff ff 85 c0 41 89 c4 78 6d 49 8b
|
||||
RIP: encrypted_update+0xb0/0x170 RSP: ffffb15c40773de8
|
||||
CR2: 0000000000000018
|
||||
|
||||
Cc: <stable@vger.kernel.org> [v2.6.12+]
|
||||
Signed-off-by: Eric Biggers <ebiggers@google.com>
|
||||
---
|
||||
security/keys/keyring.c | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/security/keys/keyring.c b/security/keys/keyring.c
|
||||
index 4fa82a8a9c0e..129a4175760b 100644
|
||||
--- a/security/keys/keyring.c
|
||||
+++ b/security/keys/keyring.c
|
||||
@@ -1056,8 +1056,8 @@ EXPORT_SYMBOL(keyring_restrict);
|
||||
* caller must also hold a lock on the keyring semaphore.
|
||||
*
|
||||
* Returns a pointer to the found key with usage count incremented if
|
||||
- * successful and returns NULL if not found. Revoked and invalidated keys are
|
||||
- * skipped over.
|
||||
+ * successful and returns NULL if not found. Revoked, invalidated, and
|
||||
+ * uninstantiated keys are skipped over. (But negative keys are not!)
|
||||
*
|
||||
* If successful, the possession indicator is propagated from the keyring ref
|
||||
* to the returned key reference.
|
||||
@@ -1084,8 +1084,10 @@ key_ref_t find_key_to_update(key_ref_t keyring_ref,
|
||||
|
||||
found:
|
||||
key = keyring_ptr_to_key(object);
|
||||
- if (key->flags & ((1 << KEY_FLAG_INVALIDATED) |
|
||||
- (1 << KEY_FLAG_REVOKED))) {
|
||||
+ if ((key->flags & ((1 << KEY_FLAG_INVALIDATED) |
|
||||
+ (1 << KEY_FLAG_REVOKED) |
|
||||
+ (1 << KEY_FLAG_INSTANTIATED))) !=
|
||||
+ (1 << KEY_FLAG_INSTANTIATED)) {
|
||||
kleave(" = NULL [x]");
|
||||
return NULL;
|
||||
}
|
||||
--
|
||||
2.13.6
|
||||
|
|
@ -1,160 +0,0 @@
|
|||
From 5744a0927df22f46e4b7f134b3dfb405fdfcf6ce Mon Sep 17 00:00:00 2001
|
||||
From: Jeremy Cline <jeremy@jcline.org>
|
||||
Date: Wed, 2 May 2018 15:16:29 -0400
|
||||
Subject: [PATCH 1/2] Revert "random: use a different mixing algorithm for
|
||||
add_device_randomness()"
|
||||
|
||||
This reverts commit 89b59f050347d376c2ace8b1ceb908a218cfdc2e.
|
||||
|
||||
Signed-off-by: Jeremy Cline <jeremy@jcline.org>
|
||||
---
|
||||
drivers/char/random.c | 55 ++++---------------------------------------
|
||||
1 file changed, 4 insertions(+), 51 deletions(-)
|
||||
|
||||
diff --git a/drivers/char/random.c b/drivers/char/random.c
|
||||
index 8f4e11842c60..aa5b04af86c6 100644
|
||||
--- a/drivers/char/random.c
|
||||
+++ b/drivers/char/random.c
|
||||
@@ -831,10 +831,6 @@ static void numa_crng_init(void)
|
||||
static void numa_crng_init(void) {}
|
||||
#endif
|
||||
|
||||
-/*
|
||||
- * crng_fast_load() can be called by code in the interrupt service
|
||||
- * path. So we can't afford to dilly-dally.
|
||||
- */
|
||||
static int crng_fast_load(const char *cp, size_t len)
|
||||
{
|
||||
unsigned long flags;
|
||||
@@ -861,51 +857,6 @@ static int crng_fast_load(const char *cp, size_t len)
|
||||
return 1;
|
||||
}
|
||||
|
||||
-/*
|
||||
- * crng_slow_load() is called by add_device_randomness, which has two
|
||||
- * attributes. (1) We can't trust the buffer passed to it is
|
||||
- * guaranteed to be unpredictable (so it might not have any entropy at
|
||||
- * all), and (2) it doesn't have the performance constraints of
|
||||
- * crng_fast_load().
|
||||
- *
|
||||
- * So we do something more comprehensive which is guaranteed to touch
|
||||
- * all of the primary_crng's state, and which uses a LFSR with a
|
||||
- * period of 255 as part of the mixing algorithm. Finally, we do
|
||||
- * *not* advance crng_init_cnt since buffer we may get may be something
|
||||
- * like a fixed DMI table (for example), which might very well be
|
||||
- * unique to the machine, but is otherwise unvarying.
|
||||
- */
|
||||
-static int crng_slow_load(const char *cp, size_t len)
|
||||
-{
|
||||
- unsigned long flags;
|
||||
- static unsigned char lfsr = 1;
|
||||
- unsigned char tmp;
|
||||
- unsigned i, max = CHACHA20_KEY_SIZE;
|
||||
- const char * src_buf = cp;
|
||||
- char * dest_buf = (char *) &primary_crng.state[4];
|
||||
-
|
||||
- if (!spin_trylock_irqsave(&primary_crng.lock, flags))
|
||||
- return 0;
|
||||
- if (crng_init != 0) {
|
||||
- spin_unlock_irqrestore(&primary_crng.lock, flags);
|
||||
- return 0;
|
||||
- }
|
||||
- if (len > max)
|
||||
- max = len;
|
||||
-
|
||||
- for (i = 0; i < max ; i++) {
|
||||
- tmp = lfsr;
|
||||
- lfsr >>= 1;
|
||||
- if (tmp & 1)
|
||||
- lfsr ^= 0xE1;
|
||||
- tmp = dest_buf[i % CHACHA20_KEY_SIZE];
|
||||
- dest_buf[i % CHACHA20_KEY_SIZE] ^= src_buf[i % len] ^ lfsr;
|
||||
- lfsr += (tmp << 3) | (tmp >> 5);
|
||||
- }
|
||||
- spin_unlock_irqrestore(&primary_crng.lock, flags);
|
||||
- return 1;
|
||||
-}
|
||||
-
|
||||
static void crng_reseed(struct crng_state *crng, struct entropy_store *r)
|
||||
{
|
||||
unsigned long flags;
|
||||
@@ -1089,8 +1040,10 @@ void add_device_randomness(const void *buf, unsigned int size)
|
||||
unsigned long time = random_get_entropy() ^ jiffies;
|
||||
unsigned long flags;
|
||||
|
||||
- if (!crng_ready() && size)
|
||||
- crng_slow_load(buf, size);
|
||||
+ if (!crng_ready()) {
|
||||
+ crng_fast_load(buf, size);
|
||||
+ return;
|
||||
+ }
|
||||
|
||||
trace_add_device_randomness(size, _RET_IP_);
|
||||
spin_lock_irqsave(&input_pool.lock, flags);
|
||||
--
|
||||
2.17.0
|
||||
|
||||
From e1b1b5b62740b0e6ea8258a4eb81b2a336538fed Mon Sep 17 00:00:00 2001
|
||||
From: Jeremy Cline <jeremy@jcline.org>
|
||||
Date: Wed, 2 May 2018 15:18:03 -0400
|
||||
Subject: [PATCH 2/2] Revert "random: fix crng_ready() test"
|
||||
|
||||
This reverts commit cd8d7a5778a4abf76ee8fe8f1bfcf78976029f8d.
|
||||
|
||||
Signed-off-by: Jeremy Cline <jeremy@jcline.org>
|
||||
---
|
||||
drivers/char/random.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/drivers/char/random.c b/drivers/char/random.c
|
||||
index aa5b04af86c6..ef05cc685b74 100644
|
||||
--- a/drivers/char/random.c
|
||||
+++ b/drivers/char/random.c
|
||||
@@ -428,7 +428,7 @@ struct crng_state primary_crng = {
|
||||
* its value (from 0->1->2).
|
||||
*/
|
||||
static int crng_init = 0;
|
||||
-#define crng_ready() (likely(crng_init > 1))
|
||||
+#define crng_ready() (likely(crng_init > 0))
|
||||
static int crng_init_cnt = 0;
|
||||
static unsigned long crng_global_init_time = 0;
|
||||
#define CRNG_INIT_CNT_THRESH (2*CHACHA20_KEY_SIZE)
|
||||
@@ -838,7 +838,7 @@ static int crng_fast_load(const char *cp, size_t len)
|
||||
|
||||
if (!spin_trylock_irqsave(&primary_crng.lock, flags))
|
||||
return 0;
|
||||
- if (crng_init != 0) {
|
||||
+ if (crng_ready()) {
|
||||
spin_unlock_irqrestore(&primary_crng.lock, flags);
|
||||
return 0;
|
||||
}
|
||||
@@ -913,7 +913,7 @@ static void _extract_crng(struct crng_state *crng,
|
||||
{
|
||||
unsigned long v, flags;
|
||||
|
||||
- if (crng_ready() &&
|
||||
+ if (crng_init > 1 &&
|
||||
(time_after(crng_global_init_time, crng->init_time) ||
|
||||
time_after(jiffies, crng->init_time + CRNG_RESEED_INTERVAL)))
|
||||
crng_reseed(crng, crng == &primary_crng ? &input_pool : NULL);
|
||||
@@ -1200,7 +1200,7 @@ void add_interrupt_randomness(int irq, int irq_flags)
|
||||
fast_mix(fast_pool);
|
||||
add_interrupt_bench(cycles);
|
||||
|
||||
- if (unlikely(crng_init == 0)) {
|
||||
+ if (!crng_ready()) {
|
||||
if ((fast_pool->count >= 64) &&
|
||||
crng_fast_load((char *) fast_pool->pool,
|
||||
sizeof(fast_pool->pool))) {
|
||||
@@ -2269,7 +2269,7 @@ void add_hwgenerator_randomness(const char *buffer, size_t count,
|
||||
{
|
||||
struct entropy_store *poolp = &input_pool;
|
||||
|
||||
- if (unlikely(crng_init == 0)) {
|
||||
+ if (!crng_ready()) {
|
||||
crng_fast_load(buffer, count);
|
||||
return;
|
||||
}
|
||||
--
|
||||
2.17.0
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
From 5f936e19cc0ef97dbe3a56e9498922ad5ba1edef Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Mon, 2 Jul 2018 09:34:29 +0200
|
||||
Subject: alarmtimer: Prevent overflow for relative nanosleep
|
||||
|
||||
Air Icy reported:
|
||||
|
||||
UBSAN: Undefined behaviour in kernel/time/alarmtimer.c:811:7
|
||||
signed integer overflow:
|
||||
1529859276030040771 + 9223372036854775807 cannot be represented in type 'long long int'
|
||||
Call Trace:
|
||||
alarm_timer_nsleep+0x44c/0x510 kernel/time/alarmtimer.c:811
|
||||
__do_sys_clock_nanosleep kernel/time/posix-timers.c:1235 [inline]
|
||||
__se_sys_clock_nanosleep kernel/time/posix-timers.c:1213 [inline]
|
||||
__x64_sys_clock_nanosleep+0x326/0x4e0 kernel/time/posix-timers.c:1213
|
||||
do_syscall_64+0xb8/0x3a0 arch/x86/entry/common.c:290
|
||||
|
||||
alarm_timer_nsleep() uses ktime_add() to add the current time and the
|
||||
relative expiry value. ktime_add() has no sanity checks so the addition
|
||||
can overflow when the relative timeout is large enough.
|
||||
|
||||
Use ktime_add_safe() which has the necessary sanity checks in place and
|
||||
limits the result to the valid range.
|
||||
|
||||
Fixes: 9a7adcf5c6de ("timers: Posix interface for alarm-timers")
|
||||
Reported-by: Team OWL337 <icytxw@gmail.com>
|
||||
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
Cc: John Stultz <john.stultz@linaro.org>
|
||||
Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1807020926360.1595@nanos.tec.linutronix.de
|
||||
---
|
||||
kernel/time/alarmtimer.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
|
||||
index 78a3cc5..fa5de5e 100644
|
||||
--- a/kernel/time/alarmtimer.c
|
||||
+++ b/kernel/time/alarmtimer.c
|
||||
@@ -808,7 +808,8 @@ static int alarm_timer_nsleep(const clockid_t which_clock, int flags,
|
||||
/* Convert (if necessary) to absolute time */
|
||||
if (flags != TIMER_ABSTIME) {
|
||||
ktime_t now = alarm_bases[type].gettime();
|
||||
- exp = ktime_add(now, exp);
|
||||
+
|
||||
+ exp = ktime_add_safe(now, exp);
|
||||
}
|
||||
|
||||
ret = alarmtimer_do_nsleep(&alarm, exp, type);
|
||||
--
|
||||
cgit v1.1
|
||||
|
|
@ -1,432 +0,0 @@
|
|||
From patchwork Tue Apr 17 17:14:04 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [v3] ARM: dts: Add am335x-pocketbeagle
|
||||
From: Robert Nelson <robertcnelson@gmail.com>
|
||||
X-Patchwork-Id: 10346089
|
||||
Message-Id: <20180417171404.13624-1-robertcnelson@gmail.com>
|
||||
To: tony@atomide.com,
|
||||
devicetree@vger.kernel.org
|
||||
Cc: Drew Fustini <drew@beagleboard.org>,
|
||||
Peter Robinson <pbrobinson@redhat.com>,
|
||||
Jason Kridner <jkridner@beagleboard.org>, linux-omap@vger.kernel.org,
|
||||
Robert Nelson <robertcnelson@gmail.com>,
|
||||
linux-arm-kernel@lists.infradead.org
|
||||
Date: Tue, 17 Apr 2018 12:14:04 -0500
|
||||
|
||||
PocketBeagle is an ultra-tiny-yet-complete open-source USB-key-fob computer.
|
||||
|
||||
This board family can be indentified by the A335PBGL in the at24 eeprom:
|
||||
A2: [aa 55 33 ee 41 33 33 35 50 42 47 4c 30 30 41 32 |.U3.A335PBGL00A2|]
|
||||
|
||||
http://beagleboard.org/pocket
|
||||
https://github.com/beagleboard/pocketbeagle
|
||||
|
||||
Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
|
||||
CC: Tony Lindgren <tony@atomide.com>
|
||||
CC: Jason Kridner <jkridner@beagleboard.org>
|
||||
CC: Drew Fustini <drew@beagleboard.org>
|
||||
CC: Peter Robinson <pbrobinson@redhat.com>
|
||||
---
|
||||
Changes in v3:
|
||||
- Fix: Board eeprom in subject message. (accidently copied PocketBone)
|
||||
Changes in v2:
|
||||
- Use SPDX tags.
|
||||
- Use eeprom@50, remove repeated node and fix and remove '_' to fix node_name_chars_strict Warning
|
||||
- Fix: PocketBeagle Name in Subject (not PocketBeagle Blue)
|
||||
- Fix: leds remove '_' to fix node_name_chars_strict warning
|
||||
- Fix: node_name_chars_strict pinmux_*_pins label's.
|
||||
---
|
||||
arch/arm/boot/dts/Makefile | 1 +
|
||||
arch/arm/boot/dts/am335x-osd335x-common.dtsi | 124 ++++++++++
|
||||
arch/arm/boot/dts/am335x-pocketbeagle.dts | 237 +++++++++++++++++++
|
||||
3 files changed, 362 insertions(+)
|
||||
create mode 100644 arch/arm/boot/dts/am335x-osd335x-common.dtsi
|
||||
create mode 100644 arch/arm/boot/dts/am335x-pocketbeagle.dts
|
||||
|
||||
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
|
||||
index 7e2424957809..5a09ff15743b 100644
|
||||
--- a/arch/arm/boot/dts/Makefile
|
||||
+++ b/arch/arm/boot/dts/Makefile
|
||||
@@ -688,6 +688,7 @@ dtb-$(CONFIG_SOC_AM33XX) += \
|
||||
am335x-pdu001.dtb \
|
||||
am335x-pepper.dtb \
|
||||
am335x-phycore-rdk.dtb \
|
||||
+ am335x-pocketbeagle.dtb \
|
||||
am335x-shc.dtb \
|
||||
am335x-sbc-t335.dtb \
|
||||
am335x-sl50.dtb \
|
||||
diff --git a/arch/arm/boot/dts/am335x-osd335x-common.dtsi b/arch/arm/boot/dts/am335x-osd335x-common.dtsi
|
||||
new file mode 100644
|
||||
index 000000000000..d2150d207b7a
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/boot/dts/am335x-osd335x-common.dtsi
|
||||
@@ -0,0 +1,124 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
|
||||
+ *
|
||||
+ * Author: Robert Nelson <robertcnelson@gmail.com>
|
||||
+ */
|
||||
+
|
||||
+/ {
|
||||
+ cpus {
|
||||
+ cpu@0 {
|
||||
+ cpu0-supply = <&dcdc2_reg>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ memory@80000000 {
|
||||
+ device_type = "memory";
|
||||
+ reg = <0x80000000 0x20000000>; /* 512 MB */
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&cpu0_opp_table {
|
||||
+ /*
|
||||
+ * Octavo Systems:
|
||||
+ * The EFUSE_SMA register is not programmed for any of the AM335x wafers
|
||||
+ * we get and we are not programming them during our production test.
|
||||
+ * Therefore, from a DEVICE_ID revision point of view, the silicon looks
|
||||
+ * like it is Revision 2.1. However, from an EFUSE_SMA point of view for
|
||||
+ * the HW OPP table, the silicon looks like it is Revision 1.0 (ie the
|
||||
+ * EFUSE_SMA register reads as all zeros).
|
||||
+ */
|
||||
+ oppnitro-1000000000 {
|
||||
+ opp-supported-hw = <0x06 0x0100>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&am33xx_pinmux {
|
||||
+ i2c0_pins: pinmux-i2c0-pins {
|
||||
+ pinctrl-single,pins = <
|
||||
+ AM33XX_IOPAD(0x988, PIN_INPUT_PULLUP | MUX_MODE0) /* (C17) I2C0_SDA.I2C0_SDA */
|
||||
+ AM33XX_IOPAD(0x98c, PIN_INPUT_PULLUP | MUX_MODE0) /* (C16) I2C0_SCL.I2C0_SCL */
|
||||
+ >;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&i2c0 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&i2c0_pins>;
|
||||
+
|
||||
+ status = "okay";
|
||||
+ clock-frequency = <400000>;
|
||||
+
|
||||
+ tps: tps@24 {
|
||||
+ reg = <0x24>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+/include/ "tps65217.dtsi"
|
||||
+
|
||||
+&tps {
|
||||
+ interrupts = <7>; /* NMI */
|
||||
+ interrupt-parent = <&intc>;
|
||||
+
|
||||
+ ti,pmic-shutdown-controller;
|
||||
+
|
||||
+ pwrbutton {
|
||||
+ interrupts = <2>;
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+
|
||||
+ regulators {
|
||||
+ dcdc1_reg: regulator@0 {
|
||||
+ regulator-name = "vdds_dpr";
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
+ dcdc2_reg: regulator@1 {
|
||||
+ /* VDD_MPU voltage limits 0.95V - 1.26V with +/-4% tolerance */
|
||||
+ regulator-name = "vdd_mpu";
|
||||
+ regulator-min-microvolt = <925000>;
|
||||
+ regulator-max-microvolt = <1351500>;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
+ dcdc3_reg: regulator@2 {
|
||||
+ /* VDD_CORE voltage limits 0.95V - 1.1V with +/-4% tolerance */
|
||||
+ regulator-name = "vdd_core";
|
||||
+ regulator-min-microvolt = <925000>;
|
||||
+ regulator-max-microvolt = <1150000>;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
+ ldo1_reg: regulator@3 {
|
||||
+ regulator-name = "vio,vrtc,vdds";
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
+ ldo2_reg: regulator@4 {
|
||||
+ regulator-name = "vdd_3v3aux";
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
+ ldo3_reg: regulator@5 {
|
||||
+ regulator-name = "vdd_1v8";
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
+ regulator-max-microvolt = <1800000>;
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
+ ldo4_reg: regulator@6 {
|
||||
+ regulator-name = "vdd_3v3a";
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&aes {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&sham {
|
||||
+ status = "okay";
|
||||
+};
|
||||
diff --git a/arch/arm/boot/dts/am335x-pocketbeagle.dts b/arch/arm/boot/dts/am335x-pocketbeagle.dts
|
||||
new file mode 100644
|
||||
index 000000000000..62fe5cab9fae
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/boot/dts/am335x-pocketbeagle.dts
|
||||
@@ -0,0 +1,237 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
|
||||
+ *
|
||||
+ * Author: Robert Nelson <robertcnelson@gmail.com>
|
||||
+ */
|
||||
+/dts-v1/;
|
||||
+
|
||||
+#include "am33xx.dtsi"
|
||||
+#include "am335x-osd335x-common.dtsi"
|
||||
+
|
||||
+/ {
|
||||
+ model = "TI AM335x PocketBeagle";
|
||||
+ compatible = "ti,am335x-pocketbeagle", "ti,am335x-bone", "ti,am33xx";
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = &uart0;
|
||||
+ };
|
||||
+
|
||||
+ leds {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&usr_leds_pins>;
|
||||
+
|
||||
+ compatible = "gpio-leds";
|
||||
+
|
||||
+ usr0 {
|
||||
+ label = "beaglebone:green:usr0";
|
||||
+ gpios = <&gpio1 21 GPIO_ACTIVE_HIGH>;
|
||||
+ linux,default-trigger = "heartbeat";
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+
|
||||
+ usr1 {
|
||||
+ label = "beaglebone:green:usr1";
|
||||
+ gpios = <&gpio1 22 GPIO_ACTIVE_HIGH>;
|
||||
+ linux,default-trigger = "mmc0";
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+
|
||||
+ usr2 {
|
||||
+ label = "beaglebone:green:usr2";
|
||||
+ gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>;
|
||||
+ linux,default-trigger = "cpu0";
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+
|
||||
+ usr3 {
|
||||
+ label = "beaglebone:green:usr3";
|
||||
+ gpios = <&gpio1 24 GPIO_ACTIVE_HIGH>;
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ vmmcsd_fixed: fixedregulator0 {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "vmmcsd_fixed";
|
||||
+ regulator-min-microvolt = <3300000>;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&am33xx_pinmux {
|
||||
+ i2c2_pins: pinmux-i2c2-pins {
|
||||
+ pinctrl-single,pins = <
|
||||
+ AM33XX_IOPAD(0x97c, PIN_INPUT_PULLUP | MUX_MODE3) /* (D17) uart1_rtsn.I2C2_SCL */
|
||||
+ AM33XX_IOPAD(0x978, PIN_INPUT_PULLUP | MUX_MODE3) /* (D18) uart1_ctsn.I2C2_SDA */
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ ehrpwm0_pins: pinmux-ehrpwm0-pins {
|
||||
+ pinctrl-single,pins = <
|
||||
+ AM33XX_IOPAD(0x990, PIN_OUTPUT_PULLDOWN | MUX_MODE1) /* (A13) mcasp0_aclkx.ehrpwm0A */
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ ehrpwm1_pins: pinmux-ehrpwm1-pins {
|
||||
+ pinctrl-single,pins = <
|
||||
+ AM33XX_IOPAD(0x848, PIN_OUTPUT_PULLDOWN | MUX_MODE6) /* (U14) gpmc_a2.ehrpwm1A */
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ mmc0_pins: pinmux-mmc0-pins {
|
||||
+ pinctrl-single,pins = <
|
||||
+ AM33XX_IOPAD(0x960, PIN_INPUT | MUX_MODE7) /* (C15) spi0_cs1.gpio0[6] */
|
||||
+ AM33XX_IOPAD(0x8fc, PIN_INPUT_PULLUP | MUX_MODE0) /* (G16) mmc0_dat0.mmc0_dat0 */
|
||||
+ AM33XX_IOPAD(0x8f8, PIN_INPUT_PULLUP | MUX_MODE0) /* (G15) mmc0_dat1.mmc0_dat1 */
|
||||
+ AM33XX_IOPAD(0x8f4, PIN_INPUT_PULLUP | MUX_MODE0) /* (F18) mmc0_dat2.mmc0_dat2 */
|
||||
+ AM33XX_IOPAD(0x8f0, PIN_INPUT_PULLUP | MUX_MODE0) /* (F17) mmc0_dat3.mmc0_dat3 */
|
||||
+ AM33XX_IOPAD(0x904, PIN_INPUT_PULLUP | MUX_MODE0) /* (G18) mmc0_cmd.mmc0_cmd */
|
||||
+ AM33XX_IOPAD(0x900, PIN_INPUT_PULLUP | MUX_MODE0) /* (G17) mmc0_clk.mmc0_clk */
|
||||
+ AM33XX_IOPAD(0x9a0, PIN_INPUT | MUX_MODE4) /* (B12) mcasp0_aclkr.mmc0_sdwp */
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ spi0_pins: pinmux-spi0-pins {
|
||||
+ pinctrl-single,pins = <
|
||||
+ AM33XX_IOPAD(0x950, PIN_INPUT_PULLUP | MUX_MODE0) /* (A17) spi0_sclk.spi0_sclk */
|
||||
+ AM33XX_IOPAD(0x954, PIN_INPUT_PULLUP | MUX_MODE0) /* (B17) spi0_d0.spi0_d0 */
|
||||
+ AM33XX_IOPAD(0x958, PIN_INPUT_PULLUP | MUX_MODE0) /* (B16) spi0_d1.spi0_d1 */
|
||||
+ AM33XX_IOPAD(0x95c, PIN_INPUT_PULLUP | MUX_MODE0) /* (A16) spi0_cs0.spi0_cs0 */
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ spi1_pins: pinmux-spi1-pins {
|
||||
+ pinctrl-single,pins = <
|
||||
+ AM33XX_IOPAD(0x964, PIN_INPUT_PULLUP | MUX_MODE4) /* (C18) eCAP0_in_PWM0_out.spi1_sclk */
|
||||
+ AM33XX_IOPAD(0x968, PIN_INPUT_PULLUP | MUX_MODE4) /* (E18) uart0_ctsn.spi1_d0 */
|
||||
+ AM33XX_IOPAD(0x96c, PIN_INPUT_PULLUP | MUX_MODE4) /* (E17) uart0_rtsn.spi1_d1 */
|
||||
+ AM33XX_IOPAD(0x9b0, PIN_INPUT_PULLUP | MUX_MODE4) /* (A15) xdma_event_intr0.spi1_cs1 */
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ usr_leds_pins: pinmux-usr-leds-pins {
|
||||
+ pinctrl-single,pins = <
|
||||
+ AM33XX_IOPAD(0x854, PIN_OUTPUT | MUX_MODE7) /* (V15) gpmc_a5.gpio1[21] - USR_LED_0 */
|
||||
+ AM33XX_IOPAD(0x858, PIN_OUTPUT | MUX_MODE7) /* (U15) gpmc_a6.gpio1[22] - USR_LED_1 */
|
||||
+ AM33XX_IOPAD(0x85c, PIN_OUTPUT | MUX_MODE7) /* (T15) gpmc_a7.gpio1[23] - USR_LED_2 */
|
||||
+ AM33XX_IOPAD(0x860, PIN_OUTPUT | MUX_MODE7) /* (V16) gpmc_a8.gpio1[24] - USR_LED_3 */
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ uart0_pins: pinmux-uart0-pins {
|
||||
+ pinctrl-single,pins = <
|
||||
+ AM33XX_IOPAD(0x970, PIN_INPUT_PULLUP | MUX_MODE0) /* (E15) uart0_rxd.uart0_rxd */
|
||||
+ AM33XX_IOPAD(0x974, PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* (E16) uart0_txd.uart0_txd */
|
||||
+ >;
|
||||
+ };
|
||||
+
|
||||
+ uart4_pins: pinmux-uart4-pins {
|
||||
+ pinctrl-single,pins = <
|
||||
+ AM33XX_IOPAD(0x870, PIN_INPUT_PULLUP | MUX_MODE6) /* (T17) gpmc_wait0.uart4_rxd */
|
||||
+ AM33XX_IOPAD(0x874, PIN_OUTPUT_PULLDOWN | MUX_MODE6) /* (U17) gpmc_wpn.uart4_txd */
|
||||
+ >;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&epwmss0 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&ehrpwm0 {
|
||||
+ status = "okay";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&ehrpwm0_pins>;
|
||||
+};
|
||||
+
|
||||
+&epwmss1 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&ehrpwm1 {
|
||||
+ status = "okay";
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&ehrpwm1_pins>;
|
||||
+};
|
||||
+
|
||||
+&i2c0 {
|
||||
+ eeprom: eeprom@50 {
|
||||
+ compatible = "atmel,24c256";
|
||||
+ reg = <0x50>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&i2c2 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&i2c2_pins>;
|
||||
+
|
||||
+ status = "okay";
|
||||
+ clock-frequency = <400000>;
|
||||
+};
|
||||
+
|
||||
+&mmc1 {
|
||||
+ status = "okay";
|
||||
+ vmmc-supply = <&vmmcsd_fixed>;
|
||||
+ bus-width = <4>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&mmc0_pins>;
|
||||
+ cd-gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
|
||||
+};
|
||||
+
|
||||
+&rtc {
|
||||
+ system-power-controller;
|
||||
+};
|
||||
+
|
||||
+&tscadc {
|
||||
+ status = "okay";
|
||||
+ adc {
|
||||
+ ti,adc-channels = <0 1 2 3 4 5 6 7>;
|
||||
+ ti,chan-step-avg = <16 16 16 16 16 16 16 16>;
|
||||
+ ti,chan-step-opendelay = <0x98 0x98 0x98 0x98 0x98 0x98 0x98 0x98>;
|
||||
+ ti,chan-step-sampledelay = <0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&uart0 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart0_pins>;
|
||||
+
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&uart4 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart4_pins>;
|
||||
+
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usb {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usb_ctrl_mod {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usb0_phy {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usb0 {
|
||||
+ status = "okay";
|
||||
+ dr_mode = "otg";
|
||||
+};
|
||||
+
|
||||
+&usb1_phy {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&usb1 {
|
||||
+ status = "okay";
|
||||
+ dr_mode = "host";
|
||||
+};
|
||||
+
|
||||
+&cppi41dma {
|
||||
+ status = "okay";
|
||||
+};
|
|
@ -0,0 +1,352 @@
|
|||
From ced8025b569e21c31b52cc80410ed49d0bf13368 Mon Sep 17 00:00:00 2001
|
||||
From: Dennis Gilmore <dennis@ausil.us>
|
||||
Date: Tue, 5 Jun 2018 17:15:45 -0500
|
||||
Subject: ARM: dts: armada388-helios4
|
||||
|
||||
The helios4 is a Armada388 based nas board designed by SolidRun and
|
||||
based on their SOM. It is sold by kobol.io the dts file came from
|
||||
https://raw.githubusercontent.com/armbian/build/master/patch/kernel/mvebu-default/95-helios4-device-tree.patch
|
||||
I added a SPDX license line to match the clearfog it says it was based
|
||||
on and a compatible line for "kobol,helios4"
|
||||
|
||||
Signed-off-by: Dennis Gilmore <dennis@ausil.us>
|
||||
Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com>
|
||||
---
|
||||
arch/arm/boot/dts/Makefile | 1 +
|
||||
arch/arm/boot/dts/armada-388-helios4.dts | 313 +++++++++++++++++++++++++++++++
|
||||
2 files changed, 314 insertions(+)
|
||||
create mode 100644 arch/arm/boot/dts/armada-388-helios4.dts
|
||||
|
||||
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
|
||||
index 37a3de760d40..55133fac83ab 100644
|
||||
--- a/arch/arm/boot/dts/Makefile
|
||||
+++ b/arch/arm/boot/dts/Makefile
|
||||
@@ -1138,6 +1138,7 @@ dtb-$(CONFIG_MACH_ARMADA_38X) += \
|
||||
armada-388-clearfog-pro.dtb \
|
||||
armada-388-db.dtb \
|
||||
armada-388-gp.dtb \
|
||||
+ armada-388-helios4.dtb \
|
||||
armada-388-rd.dtb
|
||||
dtb-$(CONFIG_MACH_ARMADA_39X) += \
|
||||
armada-398-db.dtb
|
||||
diff --git a/arch/arm/boot/dts/armada-388-helios4.dts b/arch/arm/boot/dts/armada-388-helios4.dts
|
||||
new file mode 100644
|
||||
index 000000000000..705adfa8c680
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/boot/dts/armada-388-helios4.dts
|
||||
@@ -0,0 +1,313 @@
|
||||
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
|
||||
+/*
|
||||
+ * Device Tree file for Helios4
|
||||
+ * based on SolidRun Clearfog revision A1 rev 2.0 (88F6828)
|
||||
+ *
|
||||
+ * Copyright (C) 2017 Aditya Prayoga <aditya@kobol.io>
|
||||
+ *
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include "armada-388.dtsi"
|
||||
+#include "armada-38x-solidrun-microsom.dtsi"
|
||||
+
|
||||
+/ {
|
||||
+ model = "Helios4";
|
||||
+ compatible = "kobol,helios4", "marvell,armada388",
|
||||
+ "marvell,armada385", "marvell,armada380";
|
||||
+
|
||||
+ memory {
|
||||
+ device_type = "memory";
|
||||
+ reg = <0x00000000 0x80000000>; /* 2 GB */
|
||||
+ };
|
||||
+
|
||||
+ aliases {
|
||||
+ /* So that mvebu u-boot can update the MAC addresses */
|
||||
+ ethernet1 = ð0;
|
||||
+ };
|
||||
+
|
||||
+ chosen {
|
||||
+ stdout-path = "serial0:115200n8";
|
||||
+ };
|
||||
+
|
||||
+ reg_12v: regulator-12v {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "power_brick_12V";
|
||||
+ regulator-min-microvolt = <12000000>;
|
||||
+ regulator-max-microvolt = <12000000>;
|
||||
+ regulator-always-on;
|
||||
+ };
|
||||
+
|
||||
+ reg_3p3v: regulator-3p3v {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "3P3V";
|
||||
+ regulator-min-microvolt = <3300000>;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+ regulator-always-on;
|
||||
+ vin-supply = <®_12v>;
|
||||
+ };
|
||||
+
|
||||
+ reg_5p0v_hdd: regulator-5v-hdd {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "5V_HDD";
|
||||
+ regulator-min-microvolt = <5000000>;
|
||||
+ regulator-max-microvolt = <5000000>;
|
||||
+ regulator-always-on;
|
||||
+ vin-supply = <®_12v>;
|
||||
+ };
|
||||
+
|
||||
+ reg_5p0v_usb: regulator-5v-usb {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "USB-PWR";
|
||||
+ regulator-min-microvolt = <5000000>;
|
||||
+ regulator-max-microvolt = <5000000>;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-always-on;
|
||||
+ enable-active-high;
|
||||
+ gpio = <&expander0 6 GPIO_ACTIVE_HIGH>;
|
||||
+ vin-supply = <®_12v>;
|
||||
+ };
|
||||
+
|
||||
+ system-leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+ status-led {
|
||||
+ label = "helios4:green:status";
|
||||
+ gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
|
||||
+ linux,default-trigger = "heartbeat";
|
||||
+ default-state = "on";
|
||||
+ };
|
||||
+
|
||||
+ fault-led {
|
||||
+ label = "helios4:red:fault";
|
||||
+ gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
|
||||
+ default-state = "keep";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ io-leds {
|
||||
+ compatible = "gpio-leds";
|
||||
+ sata1-led {
|
||||
+ label = "helios4:green:ata1";
|
||||
+ gpios = <&gpio1 17 GPIO_ACTIVE_LOW>;
|
||||
+ linux,default-trigger = "ata1";
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+ sata2-led {
|
||||
+ label = "helios4:green:ata2";
|
||||
+ gpios = <&gpio1 18 GPIO_ACTIVE_LOW>;
|
||||
+ linux,default-trigger = "ata2";
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+ sata3-led {
|
||||
+ label = "helios4:green:ata3";
|
||||
+ gpios = <&gpio1 20 GPIO_ACTIVE_LOW>;
|
||||
+ linux,default-trigger = "ata3";
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+ sata4-led {
|
||||
+ label = "helios4:green:ata4";
|
||||
+ gpios = <&gpio1 21 GPIO_ACTIVE_LOW>;
|
||||
+ linux,default-trigger = "ata4";
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+ usb-led {
|
||||
+ label = "helios4:green:usb";
|
||||
+ gpios = <&gpio1 22 GPIO_ACTIVE_LOW>;
|
||||
+ linux,default-trigger = "usb-host";
|
||||
+ default-state = "off";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ fan1: j10-pwm {
|
||||
+ compatible = "pwm-fan";
|
||||
+ pwms = <&gpio1 9 40000>; /* Target freq:25 kHz */
|
||||
+ };
|
||||
+
|
||||
+ fan2: j17-pwm {
|
||||
+ compatible = "pwm-fan";
|
||||
+ pwms = <&gpio1 23 40000>; /* Target freq:25 kHz */
|
||||
+ };
|
||||
+
|
||||
+ usb2_phy: usb2-phy {
|
||||
+ compatible = "usb-nop-xceiv";
|
||||
+ vbus-regulator = <®_5p0v_usb>;
|
||||
+ };
|
||||
+
|
||||
+ usb3_phy: usb3-phy {
|
||||
+ compatible = "usb-nop-xceiv";
|
||||
+ };
|
||||
+
|
||||
+ soc {
|
||||
+ internal-regs {
|
||||
+ i2c@11000 {
|
||||
+ clock-frequency = <400000>;
|
||||
+ pinctrl-0 = <&i2c0_pins>;
|
||||
+ pinctrl-names = "default";
|
||||
+ status = "okay";
|
||||
+
|
||||
+ /*
|
||||
+ * PCA9655 GPIO expander, up to 1MHz clock.
|
||||
+ * 0-Board Revision bit 0 #
|
||||
+ * 1-Board Revision bit 1 #
|
||||
+ * 5-USB3 overcurrent
|
||||
+ * 6-USB3 power
|
||||
+ */
|
||||
+ expander0: gpio-expander@20 {
|
||||
+ /*
|
||||
+ * This is how it should be:
|
||||
+ * compatible = "onnn,pca9655",
|
||||
+ * "nxp,pca9555";
|
||||
+ * but you can't do this because of
|
||||
+ * the way I2C works.
|
||||
+ */
|
||||
+ compatible = "nxp,pca9555";
|
||||
+ gpio-controller;
|
||||
+ #gpio-cells = <2>;
|
||||
+ reg = <0x20>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pca0_pins>;
|
||||
+ interrupt-parent = <&gpio0>;
|
||||
+ interrupts = <23 IRQ_TYPE_EDGE_FALLING>;
|
||||
+ interrupt-controller;
|
||||
+ #interrupt-cells = <2>;
|
||||
+
|
||||
+ board_rev_bit_0 {
|
||||
+ gpio-hog;
|
||||
+ gpios = <0 GPIO_ACTIVE_LOW>;
|
||||
+ input;
|
||||
+ line-name = "board-rev-0";
|
||||
+ };
|
||||
+ board_rev_bit_1 {
|
||||
+ gpio-hog;
|
||||
+ gpios = <1 GPIO_ACTIVE_LOW>;
|
||||
+ input;
|
||||
+ line-name = "board-rev-1";
|
||||
+ };
|
||||
+ usb3_ilimit {
|
||||
+ gpio-hog;
|
||||
+ gpios = <5 GPIO_ACTIVE_HIGH>;
|
||||
+ input;
|
||||
+ line-name = "usb-overcurrent-status";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ temp_sensor: temp@4c {
|
||||
+ compatible = "ti,lm75";
|
||||
+ reg = <0x4c>;
|
||||
+ vcc-supply = <®_3p3v>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ i2c@11100 {
|
||||
+ /*
|
||||
+ * External I2C Bus for user peripheral
|
||||
+ */
|
||||
+ clock-frequency = <400000>;
|
||||
+ pinctrl-0 = <&helios_i2c1_pins>;
|
||||
+ pinctrl-names = "default";
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+
|
||||
+ sata@a8000 {
|
||||
+ status = "okay";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ sata0: sata-port@0 {
|
||||
+ reg = <0>;
|
||||
+ };
|
||||
+
|
||||
+ sata1: sata-port@1 {
|
||||
+ reg = <1>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ sata@e0000 {
|
||||
+ status = "okay";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ sata2: sata-port@0 {
|
||||
+ reg = <0>;
|
||||
+ };
|
||||
+
|
||||
+ sata3: sata-port@1 {
|
||||
+ reg = <1>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ spi@10680 {
|
||||
+ pinctrl-0 = <&spi1_pins
|
||||
+ µsom_spi1_cs_pins>;
|
||||
+ pinctrl-names = "default";
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+
|
||||
+ sdhci@d8000 {
|
||||
+ bus-width = <4>;
|
||||
+ cd-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
|
||||
+ no-1-8-v;
|
||||
+ pinctrl-0 = <&helios_sdhci_pins
|
||||
+ &helios_sdhci_cd_pins>;
|
||||
+ pinctrl-names = "default";
|
||||
+ status = "okay";
|
||||
+ vmmc = <®_3p3v>;
|
||||
+ wp-inverted;
|
||||
+ };
|
||||
+
|
||||
+ usb@58000 {
|
||||
+ usb-phy = <&usb2_phy>;
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+
|
||||
+ usb3@f0000 {
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+
|
||||
+ usb3@f8000 {
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+
|
||||
+ pinctrl@18000 {
|
||||
+ pca0_pins: pca0-pins {
|
||||
+ marvell,pins = "mpp23";
|
||||
+ marvell,function = "gpio";
|
||||
+ };
|
||||
+ microsom_phy0_int_pins: microsom-phy0-int-pins {
|
||||
+ marvell,pins = "mpp18";
|
||||
+ marvell,function = "gpio";
|
||||
+ };
|
||||
+ helios_i2c1_pins: i2c1-pins {
|
||||
+ marvell,pins = "mpp26", "mpp27";
|
||||
+ marvell,function = "i2c1";
|
||||
+ };
|
||||
+ helios_sdhci_cd_pins: helios-sdhci-cd-pins {
|
||||
+ marvell,pins = "mpp20";
|
||||
+ marvell,function = "gpio";
|
||||
+ };
|
||||
+ helios_sdhci_pins: helios-sdhci-pins {
|
||||
+ marvell,pins = "mpp21", "mpp28",
|
||||
+ "mpp37", "mpp38",
|
||||
+ "mpp39", "mpp40";
|
||||
+ marvell,function = "sd0";
|
||||
+ };
|
||||
+ helios_led_pins: helios-led-pins {
|
||||
+ marvell,pins = "mpp24", "mpp25",
|
||||
+ "mpp49", "mpp50",
|
||||
+ "mpp52", "mpp53",
|
||||
+ "mpp54";
|
||||
+ marvell,function = "gpio";
|
||||
+ };
|
||||
+ helios_fan_pins: helios-fan-pins {
|
||||
+ marvell,pins = "mpp41", "mpp43",
|
||||
+ "mpp48", "mpp55";
|
||||
+ marvell,function = "gpio";
|
||||
+ };
|
||||
+ microsom_spi1_cs_pins: spi1-cs-pins {
|
||||
+ marvell,pins = "mpp59";
|
||||
+ marvell,function = "spi1";
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
--
|
||||
cgit 1.2-0.3.lf.el7
|
|
@ -0,0 +1,172 @@
|
|||
From patchwork Thu Jun 28 07:31:36 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: mmc: sdhci-esdhc-imx: support eMMC DDR mode when running at 3.3V
|
||||
From: Stefan Agner <stefan@agner.ch>
|
||||
X-Patchwork-Id: 10493185
|
||||
Message-Id: <20180628073136.21748-1-stefan@agner.ch>
|
||||
To: adrian.hunter@intel.com, ulf.hansson@linaro.org
|
||||
Cc: fabio.estevam@nxp.com, haibo.chen@nxp.com, aisheng.dong@nxp.com,
|
||||
michael@amarulasolutions.com, linux-mmc@vger.kernel.org,
|
||||
linux-kernel@vger.kernel.org, Stefan Agner <stefan@agner.ch>
|
||||
Date: Thu, 28 Jun 2018 09:31:36 +0200
|
||||
|
||||
The uSDHC supports DDR modes for eMMC devices running at 3.3V. This
|
||||
allows to run eMMC with 3.3V signaling voltage at DDR52 mode:
|
||||
|
||||
# cat /sys/kernel/debug/mmc1/ios
|
||||
clock: 52000000 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: 3 (8 bits)
|
||||
timing spec: 8 (mmc DDR52)
|
||||
signal voltage: 0 (3.30 V)
|
||||
driver type: 0 (driver type B)
|
||||
|
||||
Signed-off-by: Stefan Agner <stefan@agner.ch>
|
||||
---
|
||||
drivers/mmc/host/sdhci-esdhc-imx.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
|
||||
index b716b933f00a..6f444731754d 100644
|
||||
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
|
||||
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
|
||||
@@ -1324,7 +1324,7 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
|
||||
|
||||
if (esdhc_is_usdhc(imx_data)) {
|
||||
host->quirks2 |= SDHCI_QUIRK2_PRESET_VALUE_BROKEN;
|
||||
- host->mmc->caps |= MMC_CAP_1_8V_DDR;
|
||||
+ host->mmc->caps |= MMC_CAP_1_8V_DDR | MMC_CAP_3_3V_DDR;
|
||||
if (!(imx_data->socdata->flags & ESDHC_FLAG_HS200))
|
||||
host->quirks2 |= SDHCI_QUIRK2_BROKEN_HS200;
|
||||
|
||||
From patchwork Thu Jun 28 08:13:29 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [1/3] mmc: sdhci-esdhc-imx: get rid of support_vsel
|
||||
From: Stefan Agner <stefan@agner.ch>
|
||||
X-Patchwork-Id: 10493269
|
||||
Message-Id: <20180628081331.13051-2-stefan@agner.ch>
|
||||
To: adrian.hunter@intel.com, ulf.hansson@linaro.org
|
||||
Cc: fabio.estevam@nxp.com, haibo.chen@nxp.com, aisheng.dong@nxp.com,
|
||||
michael@amarulasolutions.com, rmk+kernel@armlinux.org.uk,
|
||||
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
|
||||
Stefan Agner <stefan@agner.ch>
|
||||
Date: Thu, 28 Jun 2018 10:13:29 +0200
|
||||
|
||||
The field support_vsel is currently only used in the device tree
|
||||
case. Get rid of it. No change in behavior.
|
||||
|
||||
Signed-off-by: Stefan Agner <stefan@agner.ch>
|
||||
---
|
||||
drivers/mmc/host/sdhci-esdhc-imx.c | 8 ++------
|
||||
include/linux/platform_data/mmc-esdhc-imx.h | 2 --
|
||||
2 files changed, 2 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
|
||||
index 6f444731754d..20a420b765b3 100644
|
||||
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
|
||||
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
|
||||
@@ -1145,18 +1145,14 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,
|
||||
&boarddata->tuning_start_tap);
|
||||
|
||||
if (of_find_property(np, "no-1-8-v", NULL))
|
||||
- boarddata->support_vsel = false;
|
||||
- else
|
||||
- boarddata->support_vsel = true;
|
||||
+ host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
|
||||
|
||||
if (of_property_read_u32(np, "fsl,delay-line", &boarddata->delay_line))
|
||||
boarddata->delay_line = 0;
|
||||
|
||||
mmc_of_parse_voltage(np, &host->ocr_mask);
|
||||
|
||||
- /* sdr50 and sdr104 need work on 1.8v signal voltage */
|
||||
- if ((boarddata->support_vsel) && esdhc_is_usdhc(imx_data) &&
|
||||
- !IS_ERR(imx_data->pins_default)) {
|
||||
+ if (esdhc_is_usdhc(imx_data) && !IS_ERR(imx_data->pins_default)) {
|
||||
imx_data->pins_100mhz = pinctrl_lookup_state(imx_data->pinctrl,
|
||||
ESDHC_PINCTRL_STATE_100MHZ);
|
||||
imx_data->pins_200mhz = pinctrl_lookup_state(imx_data->pinctrl,
|
||||
diff --git a/include/linux/platform_data/mmc-esdhc-imx.h b/include/linux/platform_data/mmc-esdhc-imx.h
|
||||
index 7daa78a2f342..640dec8b5b0c 100644
|
||||
--- a/include/linux/platform_data/mmc-esdhc-imx.h
|
||||
+++ b/include/linux/platform_data/mmc-esdhc-imx.h
|
||||
@@ -34,7 +34,6 @@ enum cd_types {
|
||||
* @cd_gpio: gpio for card_detect interrupt
|
||||
* @wp_type: type of write_protect method (see wp_types enum above)
|
||||
* @cd_type: type of card_detect method (see cd_types enum above)
|
||||
- * @support_vsel: indicate it supports 1.8v switching
|
||||
*/
|
||||
|
||||
struct esdhc_platform_data {
|
||||
@@ -43,7 +42,6 @@ struct esdhc_platform_data {
|
||||
enum wp_types wp_type;
|
||||
enum cd_types cd_type;
|
||||
int max_bus_width;
|
||||
- bool support_vsel;
|
||||
unsigned int delay_line;
|
||||
unsigned int tuning_step; /* The delay cell steps in tuning procedure */
|
||||
unsigned int tuning_start_tap; /* The start delay cell point in tuning procedure */
|
||||
From patchwork Thu Jun 28 08:13:30 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [2/3] mmc: sdhci: add quirk to prevent higher speed modes
|
||||
From: Stefan Agner <stefan@agner.ch>
|
||||
X-Patchwork-Id: 10493273
|
||||
Message-Id: <20180628081331.13051-3-stefan@agner.ch>
|
||||
To: adrian.hunter@intel.com, ulf.hansson@linaro.org
|
||||
Cc: fabio.estevam@nxp.com, haibo.chen@nxp.com, aisheng.dong@nxp.com,
|
||||
michael@amarulasolutions.com, rmk+kernel@armlinux.org.uk,
|
||||
linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org,
|
||||
Stefan Agner <stefan@agner.ch>
|
||||
Date: Thu, 28 Jun 2018 10:13:30 +0200
|
||||
|
||||
Some hosts are capable of running higher speed modes but do not
|
||||
have the board support for it. Introduce a quirk which prevents
|
||||
the stack from using modes running at 100MHz or faster.
|
||||
|
||||
Signed-off-by: Stefan Agner <stefan@agner.ch>
|
||||
---
|
||||
drivers/mmc/host/sdhci.c | 8 ++++++++
|
||||
drivers/mmc/host/sdhci.h | 2 ++
|
||||
2 files changed, 10 insertions(+)
|
||||
|
||||
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
|
||||
index 1c828e0e9905..8ac257dfaab3 100644
|
||||
--- a/drivers/mmc/host/sdhci.c
|
||||
+++ b/drivers/mmc/host/sdhci.c
|
||||
@@ -3749,6 +3749,14 @@ int sdhci_setup_host(struct sdhci_host *host)
|
||||
}
|
||||
}
|
||||
|
||||
+ if (host->quirks2 & SDHCI_QUIRK2_NO_UHS_HS200_HS400) {
|
||||
+ host->caps1 &= ~(SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_SDR50 |
|
||||
+ SDHCI_SUPPORT_DDR50);
|
||||
+
|
||||
+ mmc->caps2 &= ~(MMC_CAP2_HSX00_1_8V | MMC_CAP2_HSX00_1_2V |
|
||||
+ MMC_CAP2_HS400_ES);
|
||||
+ }
|
||||
+
|
||||
if (host->quirks2 & SDHCI_QUIRK2_NO_1_8_V) {
|
||||
host->caps1 &= ~(SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_SDR50 |
|
||||
SDHCI_SUPPORT_DDR50);
|
||||
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
|
||||
index 23966f887da6..cb2433d6d61f 100644
|
||||
--- a/drivers/mmc/host/sdhci.h
|
||||
+++ b/drivers/mmc/host/sdhci.h
|
||||
@@ -450,6 +450,8 @@ struct sdhci_host {
|
||||
* obtainable timeout.
|
||||
*/
|
||||
#define SDHCI_QUIRK2_DISABLE_HW_TIMEOUT (1<<17)
|
||||
+/* Do not support any higher speeds (>50MHz) */
|
||||
+#define SDHCI_QUIRK2_NO_UHS_HS200_HS400 (1<<18)
|
||||
|
||||
int irq; /* Device IRQ */
|
||||
void __iomem *ioaddr; /* Mapped address */
|
|
@ -1,610 +0,0 @@
|
|||
From patchwork Mon Apr 9 22:02:57 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [v3,1/3] usb: phy: tegra: Cleanup error messages
|
||||
X-Patchwork-Submitter: Dmitry Osipenko <digetx@gmail.com>
|
||||
X-Patchwork-Id: 896433
|
||||
Message-Id: <c08393c7ac6964d14750e8a4b0ffa34884b1416f.1523307883.git.digetx@gmail.com>
|
||||
To: Thierry Reding <thierry.reding@gmail.com>,
|
||||
Jonathan Hunter <jonathanh@nvidia.com>, Felipe Balbi <balbi@kernel.org>,
|
||||
Alan Stern <stern@rowland.harvard.edu>,
|
||||
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Cc: linux-usb@vger.kernel.org, linux-tegra@vger.kernel.org,
|
||||
linux-kernel@vger.kernel.org
|
||||
Date: Tue, 10 Apr 2018 01:02:57 +0300
|
||||
From: Dmitry Osipenko <digetx@gmail.com>
|
||||
List-Id: <linux-tegra.vger.kernel.org>
|
||||
|
||||
Tegra's PHY driver has a mix of pr_err() and dev_err(), let's switch to
|
||||
dev_err() and use common errors message formatting across the driver for
|
||||
consistency.
|
||||
|
||||
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
|
||||
---
|
||||
drivers/usb/phy/phy-tegra-usb.c | 69 ++++++++++++++++++++++++-----------------
|
||||
1 file changed, 41 insertions(+), 28 deletions(-)
|
||||
|
||||
diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c
|
||||
index 0e8d23e51732..e46219e7fa93 100644
|
||||
--- a/drivers/usb/phy/phy-tegra-usb.c
|
||||
+++ b/drivers/usb/phy/phy-tegra-usb.c
|
||||
@@ -236,10 +236,14 @@ static void set_phcd(struct tegra_usb_phy *phy, bool enable)
|
||||
|
||||
static int utmip_pad_open(struct tegra_usb_phy *phy)
|
||||
{
|
||||
+ int err;
|
||||
+
|
||||
phy->pad_clk = devm_clk_get(phy->u_phy.dev, "utmi-pads");
|
||||
if (IS_ERR(phy->pad_clk)) {
|
||||
- pr_err("%s: can't get utmip pad clock\n", __func__);
|
||||
- return PTR_ERR(phy->pad_clk);
|
||||
+ err = PTR_ERR(phy->pad_clk);
|
||||
+ dev_err(phy->u_phy.dev,
|
||||
+ "Failed to get UTMIP pad clock: %d\n", err);
|
||||
+ return err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -282,7 +286,7 @@ static int utmip_pad_power_off(struct tegra_usb_phy *phy)
|
||||
void __iomem *base = phy->pad_regs;
|
||||
|
||||
if (!utmip_pad_count) {
|
||||
- pr_err("%s: utmip pad already powered off\n", __func__);
|
||||
+ dev_err(phy->u_phy.dev, "UTMIP pad already powered off\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -338,7 +342,8 @@ static void utmi_phy_clk_disable(struct tegra_usb_phy *phy)
|
||||
set_phcd(phy, true);
|
||||
|
||||
if (utmi_wait_register(base + USB_SUSP_CTRL, USB_PHY_CLK_VALID, 0) < 0)
|
||||
- pr_err("%s: timeout waiting for phy to stabilize\n", __func__);
|
||||
+ dev_err(phy->u_phy.dev,
|
||||
+ "Timeout waiting for PHY to stabilize on disable\n");
|
||||
}
|
||||
|
||||
static void utmi_phy_clk_enable(struct tegra_usb_phy *phy)
|
||||
@@ -370,7 +375,8 @@ static void utmi_phy_clk_enable(struct tegra_usb_phy *phy)
|
||||
|
||||
if (utmi_wait_register(base + USB_SUSP_CTRL, USB_PHY_CLK_VALID,
|
||||
USB_PHY_CLK_VALID))
|
||||
- pr_err("%s: timeout waiting for phy to stabilize\n", __func__);
|
||||
+ dev_err(phy->u_phy.dev,
|
||||
+ "Timeout waiting for PHY to stabilize on enable\n");
|
||||
}
|
||||
|
||||
static int utmi_phy_power_on(struct tegra_usb_phy *phy)
|
||||
@@ -617,15 +623,15 @@ static int ulpi_phy_power_on(struct tegra_usb_phy *phy)
|
||||
|
||||
ret = gpio_direction_output(phy->reset_gpio, 0);
|
||||
if (ret < 0) {
|
||||
- dev_err(phy->u_phy.dev, "gpio %d not set to 0\n",
|
||||
- phy->reset_gpio);
|
||||
+ dev_err(phy->u_phy.dev, "GPIO %d not set to 0: %d\n",
|
||||
+ phy->reset_gpio, ret);
|
||||
return ret;
|
||||
}
|
||||
msleep(5);
|
||||
ret = gpio_direction_output(phy->reset_gpio, 1);
|
||||
if (ret < 0) {
|
||||
- dev_err(phy->u_phy.dev, "gpio %d not set to 1\n",
|
||||
- phy->reset_gpio);
|
||||
+ dev_err(phy->u_phy.dev, "GPIO %d not set to 1: %d\n",
|
||||
+ phy->reset_gpio, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -661,13 +667,13 @@ static int ulpi_phy_power_on(struct tegra_usb_phy *phy)
|
||||
/* Fix VbusInvalid due to floating VBUS */
|
||||
ret = usb_phy_io_write(phy->ulpi, 0x40, 0x08);
|
||||
if (ret) {
|
||||
- pr_err("%s: ulpi write failed\n", __func__);
|
||||
+ dev_err(phy->u_phy.dev, "ULPI write failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = usb_phy_io_write(phy->ulpi, 0x80, 0x0B);
|
||||
if (ret) {
|
||||
- pr_err("%s: ulpi write failed\n", __func__);
|
||||
+ dev_err(phy->u_phy.dev, "ULPI write failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -728,28 +734,30 @@ static int ulpi_open(struct tegra_usb_phy *phy)
|
||||
|
||||
phy->clk = devm_clk_get(phy->u_phy.dev, "ulpi-link");
|
||||
if (IS_ERR(phy->clk)) {
|
||||
- pr_err("%s: can't get ulpi clock\n", __func__);
|
||||
- return PTR_ERR(phy->clk);
|
||||
+ err = PTR_ERR(phy->clk);
|
||||
+ dev_err(phy->u_phy.dev, "Failed to get ULPI clock: %d\n", err);
|
||||
+ return err;
|
||||
}
|
||||
|
||||
err = devm_gpio_request(phy->u_phy.dev, phy->reset_gpio,
|
||||
"ulpi_phy_reset_b");
|
||||
if (err < 0) {
|
||||
- dev_err(phy->u_phy.dev, "request failed for gpio: %d\n",
|
||||
- phy->reset_gpio);
|
||||
+ dev_err(phy->u_phy.dev, "Request failed for GPIO %d: %d\n",
|
||||
+ phy->reset_gpio, err);
|
||||
return err;
|
||||
}
|
||||
|
||||
err = gpio_direction_output(phy->reset_gpio, 0);
|
||||
if (err < 0) {
|
||||
- dev_err(phy->u_phy.dev, "gpio %d direction not set to output\n",
|
||||
- phy->reset_gpio);
|
||||
+ dev_err(phy->u_phy.dev,
|
||||
+ "GPIO %d direction not set to output: %d\n",
|
||||
+ phy->reset_gpio, err);
|
||||
return err;
|
||||
}
|
||||
|
||||
phy->ulpi = otg_ulpi_create(&ulpi_viewport_access_ops, 0);
|
||||
if (!phy->ulpi) {
|
||||
- dev_err(phy->u_phy.dev, "otg_ulpi_create returned NULL\n");
|
||||
+ dev_err(phy->u_phy.dev, "Failed to create ULPI OTG\n");
|
||||
err = -ENOMEM;
|
||||
return err;
|
||||
}
|
||||
@@ -766,8 +774,10 @@ static int tegra_usb_phy_init(struct tegra_usb_phy *phy)
|
||||
|
||||
phy->pll_u = devm_clk_get(phy->u_phy.dev, "pll_u");
|
||||
if (IS_ERR(phy->pll_u)) {
|
||||
- pr_err("Can't get pll_u clock\n");
|
||||
- return PTR_ERR(phy->pll_u);
|
||||
+ err = PTR_ERR(phy->pll_u);
|
||||
+ dev_err(phy->u_phy.dev,
|
||||
+ "Failed to get pll_u clock: %d\n", err);
|
||||
+ return err;
|
||||
}
|
||||
|
||||
err = clk_prepare_enable(phy->pll_u);
|
||||
@@ -782,7 +792,8 @@ static int tegra_usb_phy_init(struct tegra_usb_phy *phy)
|
||||
}
|
||||
}
|
||||
if (!phy->freq) {
|
||||
- pr_err("invalid pll_u parent rate %ld\n", parent_rate);
|
||||
+ dev_err(phy->u_phy.dev, "Invalid pll_u parent rate %ld\n",
|
||||
+ parent_rate);
|
||||
err = -EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
@@ -791,7 +802,7 @@ static int tegra_usb_phy_init(struct tegra_usb_phy *phy)
|
||||
err = regulator_enable(phy->vbus);
|
||||
if (err) {
|
||||
dev_err(phy->u_phy.dev,
|
||||
- "failed to enable usb vbus regulator: %d\n",
|
||||
+ "Failed to enable USB VBUS regulator: %d\n",
|
||||
err);
|
||||
goto fail;
|
||||
}
|
||||
@@ -855,7 +866,8 @@ static int read_utmi_param(struct platform_device *pdev, const char *param,
|
||||
int err = of_property_read_u32(pdev->dev.of_node, param, &value);
|
||||
*dest = (u8)value;
|
||||
if (err < 0)
|
||||
- dev_err(&pdev->dev, "Failed to read USB UTMI parameter %s: %d\n",
|
||||
+ dev_err(&pdev->dev,
|
||||
+ "Failed to read USB UTMI parameter %s: %d\n",
|
||||
param, err);
|
||||
return err;
|
||||
}
|
||||
@@ -871,14 +883,14 @@ static int utmi_phy_probe(struct tegra_usb_phy *tegra_phy,
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
|
||||
if (!res) {
|
||||
- dev_err(&pdev->dev, "Failed to get UTMI Pad regs\n");
|
||||
+ dev_err(&pdev->dev, "Failed to get UTMI pad regs\n");
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
tegra_phy->pad_regs = devm_ioremap(&pdev->dev, res->start,
|
||||
resource_size(res));
|
||||
if (!tegra_phy->pad_regs) {
|
||||
- dev_err(&pdev->dev, "Failed to remap UTMI Pad regs\n");
|
||||
+ dev_err(&pdev->dev, "Failed to remap UTMI pad regs\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@@ -1020,15 +1032,16 @@ static int tegra_usb_phy_probe(struct platform_device *pdev)
|
||||
tegra_phy->reset_gpio =
|
||||
of_get_named_gpio(np, "nvidia,phy-reset-gpio", 0);
|
||||
if (!gpio_is_valid(tegra_phy->reset_gpio)) {
|
||||
- dev_err(&pdev->dev, "invalid gpio: %d\n",
|
||||
- tegra_phy->reset_gpio);
|
||||
+ dev_err(&pdev->dev,
|
||||
+ "Invalid GPIO: %d\n", tegra_phy->reset_gpio);
|
||||
return tegra_phy->reset_gpio;
|
||||
}
|
||||
tegra_phy->config = NULL;
|
||||
break;
|
||||
|
||||
default:
|
||||
- dev_err(&pdev->dev, "phy_type is invalid or unsupported\n");
|
||||
+ dev_err(&pdev->dev, "phy_type %u is invalid or unsupported\n",
|
||||
+ phy_type);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
From patchwork Mon Apr 9 22:02:58 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [v3,
|
||||
2/3] usb: tegra: Move utmi-pads reset from ehci-tegra to tegra-phy
|
||||
X-Patchwork-Submitter: Dmitry Osipenko <digetx@gmail.com>
|
||||
X-Patchwork-Id: 896435
|
||||
Message-Id: <66330166c6a53e8f463ec231e3cb8195fa3036cc.1523307883.git.digetx@gmail.com>
|
||||
To: Thierry Reding <thierry.reding@gmail.com>,
|
||||
Jonathan Hunter <jonathanh@nvidia.com>, Felipe Balbi <balbi@kernel.org>,
|
||||
Alan Stern <stern@rowland.harvard.edu>,
|
||||
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Cc: linux-usb@vger.kernel.org, linux-tegra@vger.kernel.org,
|
||||
linux-kernel@vger.kernel.org
|
||||
Date: Tue, 10 Apr 2018 01:02:58 +0300
|
||||
From: Dmitry Osipenko <digetx@gmail.com>
|
||||
List-Id: <linux-tegra.vger.kernel.org>
|
||||
|
||||
UTMI pads are shared by USB controllers and reset of UTMI pads is shared
|
||||
with the reset of USB1 controller. Currently reset of UTMI pads is done by
|
||||
the EHCI driver and ChipIdea UDC works because EHCI driver always happen
|
||||
to be probed first. Move reset controls from ehci-tegra to tegra-phy in
|
||||
order to resolve the problem.
|
||||
|
||||
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
|
||||
---
|
||||
drivers/usb/host/ehci-tegra.c | 87 ++++++++++++++++++---------------------
|
||||
drivers/usb/phy/phy-tegra-usb.c | 79 ++++++++++++++++++++++++++++++++---
|
||||
include/linux/usb/tegra_usb_phy.h | 2 +
|
||||
3 files changed, 115 insertions(+), 53 deletions(-)
|
||||
|
||||
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
|
||||
index a6f4389f7e88..4d2cdec4cb78 100644
|
||||
--- a/drivers/usb/host/ehci-tegra.c
|
||||
+++ b/drivers/usb/host/ehci-tegra.c
|
||||
@@ -36,7 +36,6 @@
|
||||
#define DRV_NAME "tegra-ehci"
|
||||
|
||||
static struct hc_driver __read_mostly tegra_ehci_hc_driver;
|
||||
-static bool usb1_reset_attempted;
|
||||
|
||||
struct tegra_ehci_soc_config {
|
||||
bool has_hostpc;
|
||||
@@ -51,67 +50,54 @@ struct tegra_ehci_hcd {
|
||||
enum tegra_usb_phy_port_speed port_speed;
|
||||
};
|
||||
|
||||
-/*
|
||||
- * The 1st USB controller contains some UTMI pad registers that are global for
|
||||
- * all the controllers on the chip. Those registers are also cleared when
|
||||
- * reset is asserted to the 1st controller. This means that the 1st controller
|
||||
- * can only be reset when no other controlled has finished probing. So we'll
|
||||
- * reset the 1st controller before doing any other setup on any of the
|
||||
- * controllers, and then never again.
|
||||
- *
|
||||
- * Since this is a PHY issue, the Tegra PHY driver should probably be doing
|
||||
- * the resetting of the USB controllers. But to keep compatibility with old
|
||||
- * device trees that don't have reset phandles in the PHYs, do it here.
|
||||
- * Those old DTs will be vulnerable to total USB breakage if the 1st EHCI
|
||||
- * device isn't the first one to finish probing, so warn them.
|
||||
- */
|
||||
static int tegra_reset_usb_controller(struct platform_device *pdev)
|
||||
{
|
||||
struct device_node *phy_np;
|
||||
struct usb_hcd *hcd = platform_get_drvdata(pdev);
|
||||
struct tegra_ehci_hcd *tegra =
|
||||
(struct tegra_ehci_hcd *)hcd_to_ehci(hcd)->priv;
|
||||
- bool has_utmi_pad_registers = false;
|
||||
+ struct reset_control *rst;
|
||||
+ int err;
|
||||
|
||||
phy_np = of_parse_phandle(pdev->dev.of_node, "nvidia,phy", 0);
|
||||
if (!phy_np)
|
||||
return -ENOENT;
|
||||
|
||||
- if (of_property_read_bool(phy_np, "nvidia,has-utmi-pad-registers"))
|
||||
- has_utmi_pad_registers = true;
|
||||
+ /*
|
||||
+ * The 1st USB controller contains some UTMI pad registers that are
|
||||
+ * global for all the controllers on the chip. Those registers are
|
||||
+ * also cleared when reset is asserted to the 1st controller.
|
||||
+ */
|
||||
+ rst = of_reset_control_get_shared(phy_np, "utmi-pads");
|
||||
+ if (IS_ERR(rst)) {
|
||||
+ dev_warn(&pdev->dev,
|
||||
+ "can't get utmi-pads reset from the PHY\n");
|
||||
+ dev_warn(&pdev->dev,
|
||||
+ "continuing, but please update your DT\n");
|
||||
+ } else {
|
||||
+ /*
|
||||
+ * PHY driver performs UTMI-pads reset in a case of
|
||||
+ * non-legacy DT.
|
||||
+ */
|
||||
+ reset_control_put(rst);
|
||||
+ }
|
||||
|
||||
- if (!usb1_reset_attempted) {
|
||||
- struct reset_control *usb1_reset;
|
||||
+ of_node_put(phy_np);
|
||||
|
||||
- if (!has_utmi_pad_registers)
|
||||
- usb1_reset = of_reset_control_get(phy_np, "utmi-pads");
|
||||
- else
|
||||
- usb1_reset = tegra->rst;
|
||||
-
|
||||
- if (IS_ERR(usb1_reset)) {
|
||||
- dev_warn(&pdev->dev,
|
||||
- "can't get utmi-pads reset from the PHY\n");
|
||||
- dev_warn(&pdev->dev,
|
||||
- "continuing, but please update your DT\n");
|
||||
- } else {
|
||||
- reset_control_assert(usb1_reset);
|
||||
- udelay(1);
|
||||
- reset_control_deassert(usb1_reset);
|
||||
-
|
||||
- if (!has_utmi_pad_registers)
|
||||
- reset_control_put(usb1_reset);
|
||||
- }
|
||||
+ /* reset control is shared, hence initialize it first */
|
||||
+ err = reset_control_deassert(tegra->rst);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
|
||||
- usb1_reset_attempted = true;
|
||||
- }
|
||||
+ err = reset_control_assert(tegra->rst);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
|
||||
- if (!has_utmi_pad_registers) {
|
||||
- reset_control_assert(tegra->rst);
|
||||
- udelay(1);
|
||||
- reset_control_deassert(tegra->rst);
|
||||
- }
|
||||
+ udelay(1);
|
||||
|
||||
- of_node_put(phy_np);
|
||||
+ err = reset_control_deassert(tegra->rst);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -440,7 +426,7 @@ static int tegra_ehci_probe(struct platform_device *pdev)
|
||||
goto cleanup_hcd_create;
|
||||
}
|
||||
|
||||
- tegra->rst = devm_reset_control_get(&pdev->dev, "usb");
|
||||
+ tegra->rst = devm_reset_control_get_shared(&pdev->dev, "usb");
|
||||
if (IS_ERR(tegra->rst)) {
|
||||
dev_err(&pdev->dev, "Can't get ehci reset\n");
|
||||
err = PTR_ERR(tegra->rst);
|
||||
@@ -452,8 +438,10 @@ static int tegra_ehci_probe(struct platform_device *pdev)
|
||||
goto cleanup_hcd_create;
|
||||
|
||||
err = tegra_reset_usb_controller(pdev);
|
||||
- if (err)
|
||||
+ if (err) {
|
||||
+ dev_err(&pdev->dev, "Failed to reset controller\n");
|
||||
goto cleanup_clk_en;
|
||||
+ }
|
||||
|
||||
u_phy = devm_usb_get_phy_by_phandle(&pdev->dev, "nvidia,phy", 0);
|
||||
if (IS_ERR(u_phy)) {
|
||||
@@ -538,6 +526,9 @@ static int tegra_ehci_remove(struct platform_device *pdev)
|
||||
usb_phy_shutdown(hcd->usb_phy);
|
||||
usb_remove_hcd(hcd);
|
||||
|
||||
+ reset_control_assert(tegra->rst);
|
||||
+ udelay(1);
|
||||
+
|
||||
clk_disable_unprepare(tegra->clk);
|
||||
|
||||
usb_put_hcd(hcd);
|
||||
diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c
|
||||
index e46219e7fa93..ea7ef1dc0b42 100644
|
||||
--- a/drivers/usb/phy/phy-tegra-usb.c
|
||||
+++ b/drivers/usb/phy/phy-tegra-usb.c
|
||||
@@ -236,17 +236,83 @@ static void set_phcd(struct tegra_usb_phy *phy, bool enable)
|
||||
|
||||
static int utmip_pad_open(struct tegra_usb_phy *phy)
|
||||
{
|
||||
- int err;
|
||||
+ int ret;
|
||||
|
||||
phy->pad_clk = devm_clk_get(phy->u_phy.dev, "utmi-pads");
|
||||
if (IS_ERR(phy->pad_clk)) {
|
||||
- err = PTR_ERR(phy->pad_clk);
|
||||
+ ret = PTR_ERR(phy->pad_clk);
|
||||
dev_err(phy->u_phy.dev,
|
||||
- "Failed to get UTMIP pad clock: %d\n", err);
|
||||
- return err;
|
||||
+ "Failed to get UTMIP pad clock: %d\n", ret);
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
- return 0;
|
||||
+ phy->pad_rst = devm_reset_control_get_optional_shared(
|
||||
+ phy->u_phy.dev, "utmi-pads");
|
||||
+ if (IS_ERR(phy->pad_rst)) {
|
||||
+ ret = PTR_ERR(phy->pad_rst);
|
||||
+ dev_err(phy->u_phy.dev,
|
||||
+ "Failed to get UTMI-pads reset: %d\n", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ ret = clk_prepare_enable(phy->pad_clk);
|
||||
+ if (ret) {
|
||||
+ dev_err(phy->u_phy.dev,
|
||||
+ "Failed to enable UTMI-pads clock: %d\n", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ spin_lock(&utmip_pad_lock);
|
||||
+
|
||||
+ ret = reset_control_deassert(phy->pad_rst);
|
||||
+ if (ret) {
|
||||
+ dev_err(phy->u_phy.dev,
|
||||
+ "Failed to initialize UTMI-pads reset: %d\n", ret);
|
||||
+ goto unlock;
|
||||
+ }
|
||||
+
|
||||
+ ret = reset_control_assert(phy->pad_rst);
|
||||
+ if (ret) {
|
||||
+ dev_err(phy->u_phy.dev,
|
||||
+ "Failed to assert UTMI-pads reset: %d\n", ret);
|
||||
+ goto unlock;
|
||||
+ }
|
||||
+
|
||||
+ udelay(1);
|
||||
+
|
||||
+ ret = reset_control_deassert(phy->pad_rst);
|
||||
+ if (ret)
|
||||
+ dev_err(phy->u_phy.dev,
|
||||
+ "Failed to deassert UTMI-pads reset: %d\n", ret);
|
||||
+unlock:
|
||||
+ spin_unlock(&utmip_pad_lock);
|
||||
+
|
||||
+ clk_disable_unprepare(phy->pad_clk);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int utmip_pad_close(struct tegra_usb_phy *phy)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = clk_prepare_enable(phy->pad_clk);
|
||||
+ if (ret) {
|
||||
+ dev_err(phy->u_phy.dev,
|
||||
+ "Failed to enable UTMI-pads clock: %d\n", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ ret = reset_control_assert(phy->pad_rst);
|
||||
+ if (ret)
|
||||
+ dev_err(phy->u_phy.dev,
|
||||
+ "Failed to assert UTMI-pads reset: %d\n", ret);
|
||||
+
|
||||
+ udelay(1);
|
||||
+
|
||||
+ clk_disable_unprepare(phy->pad_clk);
|
||||
+
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
static void utmip_pad_power_on(struct tegra_usb_phy *phy)
|
||||
@@ -700,6 +766,9 @@ static void tegra_usb_phy_close(struct tegra_usb_phy *phy)
|
||||
if (!IS_ERR(phy->vbus))
|
||||
regulator_disable(phy->vbus);
|
||||
|
||||
+ if (!phy->is_ulpi_phy)
|
||||
+ utmip_pad_close(phy);
|
||||
+
|
||||
clk_disable_unprepare(phy->pll_u);
|
||||
}
|
||||
|
||||
diff --git a/include/linux/usb/tegra_usb_phy.h b/include/linux/usb/tegra_usb_phy.h
|
||||
index d641ea1660b7..0c5c3ea8b2d7 100644
|
||||
--- a/include/linux/usb/tegra_usb_phy.h
|
||||
+++ b/include/linux/usb/tegra_usb_phy.h
|
||||
@@ -17,6 +17,7 @@
|
||||
#define __TEGRA_USB_PHY_H
|
||||
|
||||
#include <linux/clk.h>
|
||||
+#include <linux/reset.h>
|
||||
#include <linux/usb/otg.h>
|
||||
|
||||
/*
|
||||
@@ -76,6 +77,7 @@ struct tegra_usb_phy {
|
||||
bool is_legacy_phy;
|
||||
bool is_ulpi_phy;
|
||||
int reset_gpio;
|
||||
+ struct reset_control *pad_rst;
|
||||
};
|
||||
|
||||
void tegra_usb_phy_preresume(struct usb_phy *phy);
|
||||
|
||||
From patchwork Mon Apr 9 22:02:59 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [v3,3/3] usb: phy: Add Kconfig entry for Tegra PHY driver
|
||||
X-Patchwork-Submitter: Dmitry Osipenko <digetx@gmail.com>
|
||||
X-Patchwork-Id: 896434
|
||||
Message-Id: <aad79a65528636ee5fd217cfb7273de10147fc13.1523307883.git.digetx@gmail.com>
|
||||
To: Thierry Reding <thierry.reding@gmail.com>,
|
||||
Jonathan Hunter <jonathanh@nvidia.com>, Felipe Balbi <balbi@kernel.org>,
|
||||
Alan Stern <stern@rowland.harvard.edu>,
|
||||
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
||||
Cc: linux-usb@vger.kernel.org, linux-tegra@vger.kernel.org,
|
||||
linux-kernel@vger.kernel.org
|
||||
Date: Tue, 10 Apr 2018 01:02:59 +0300
|
||||
From: Dmitry Osipenko <digetx@gmail.com>
|
||||
List-Id: <linux-tegra.vger.kernel.org>
|
||||
|
||||
Tegra's EHCI driver has a build dependency on Tegra's PHY driver and
|
||||
currently Tegra's PHY driver is built only when Tegra's EHCI driver is
|
||||
built. Add own Kconfig entry for the Tegra's PHY driver so that drivers
|
||||
other than ehci-tegra (like ChipIdea UDC) could work with ehci-tegra
|
||||
driver being disabled in kernels config by allowing user to manually
|
||||
select the PHY driver.
|
||||
|
||||
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
|
||||
---
|
||||
drivers/usb/host/Kconfig | 4 +---
|
||||
drivers/usb/phy/Kconfig | 9 +++++++++
|
||||
drivers/usb/phy/Makefile | 2 +-
|
||||
3 files changed, 11 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
|
||||
index 5d958da8e1bc..9f0aeb068acb 100644
|
||||
--- a/drivers/usb/host/Kconfig
|
||||
+++ b/drivers/usb/host/Kconfig
|
||||
@@ -234,9 +234,7 @@ config USB_EHCI_TEGRA
|
||||
tristate "NVIDIA Tegra HCD support"
|
||||
depends on ARCH_TEGRA
|
||||
select USB_EHCI_ROOT_HUB_TT
|
||||
- select USB_PHY
|
||||
- select USB_ULPI
|
||||
- select USB_ULPI_VIEWPORT
|
||||
+ select USB_TEGRA_PHY
|
||||
help
|
||||
This driver enables support for the internal USB Host Controllers
|
||||
found in NVIDIA Tegra SoCs. The controllers are EHCI compliant.
|
||||
diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
|
||||
index 0f8ab981d572..b9b0a44be679 100644
|
||||
--- a/drivers/usb/phy/Kconfig
|
||||
+++ b/drivers/usb/phy/Kconfig
|
||||
@@ -159,6 +159,15 @@ config USB_MXS_PHY
|
||||
|
||||
MXS Phy is used by some of the i.MX SoCs, for example imx23/28/6x.
|
||||
|
||||
+config USB_TEGRA_PHY
|
||||
+ tristate "NVIDIA Tegra USB PHY Driver"
|
||||
+ depends on ARCH_TEGRA
|
||||
+ select USB_PHY
|
||||
+ select USB_ULPI
|
||||
+ help
|
||||
+ This driver provides PHY support for the USB controllers found
|
||||
+ on NVIDIA Tegra SoC's.
|
||||
+
|
||||
config USB_ULPI
|
||||
bool "Generic ULPI Transceiver Driver"
|
||||
depends on ARM || ARM64
|
||||
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
|
||||
index 25e579fb92b8..df1d99010079 100644
|
||||
--- a/drivers/usb/phy/Makefile
|
||||
+++ b/drivers/usb/phy/Makefile
|
||||
@@ -16,7 +16,7 @@ obj-$(CONFIG_AM335X_CONTROL_USB) += phy-am335x-control.o
|
||||
obj-$(CONFIG_AM335X_PHY_USB) += phy-am335x.o
|
||||
obj-$(CONFIG_OMAP_OTG) += phy-omap-otg.o
|
||||
obj-$(CONFIG_TWL6030_USB) += phy-twl6030-usb.o
|
||||
-obj-$(CONFIG_USB_EHCI_TEGRA) += phy-tegra-usb.o
|
||||
+obj-$(CONFIG_USB_TEGRA_PHY) += phy-tegra-usb.o
|
||||
obj-$(CONFIG_USB_GPIO_VBUS) += phy-gpio-vbus-usb.o
|
||||
obj-$(CONFIG_USB_ISP1301) += phy-isp1301.o
|
||||
obj-$(CONFIG_USB_MV_OTG) += phy-mv-usb.o
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,184 @@
|
|||
From patchwork Fri May 11 02:27:50 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Subject: [1/2] arm64: arch_timer: Workaround for Allwinner A64 timer
|
||||
instability
|
||||
From: Samuel Holland <samuel@sholland.org>
|
||||
X-Patchwork-Id: 10392891
|
||||
Message-Id: <20180511022751.9096-2-samuel@sholland.org>
|
||||
To: Maxime Ripard <maxime.ripard@bootlin.com>, Chen-Yu Tsai <wens@csie.org>,
|
||||
Catalin Marinas <catalin.marinas@arm.com>,
|
||||
Will Deacon <will.deacon@arm.com>,
|
||||
Daniel Lezcano <daniel.lezcano@linaro.org>,
|
||||
Thomas Gleixner <tglx@linutronix.de>, Marc Zyngier <marc.zyngier@arm.com>
|
||||
Cc: linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org,
|
||||
linux-arm-kernel@lists.infradead.org, Samuel Holland <samuel@sholland.org>
|
||||
Date: Thu, 10 May 2018 21:27:50 -0500
|
||||
|
||||
The Allwinner A64 SoC is known [1] to have an unstable architectural
|
||||
timer, which manifests itself most obviously in the time jumping forward
|
||||
a multiple of 95 years [2][3]. This coincides with 2^56 cycles at a
|
||||
timer frequency of 24 MHz, implying that the time went slightly backward
|
||||
(and this was interpreted by the kernel as it jumping forward and
|
||||
wrapping around past the epoch).
|
||||
|
||||
Further investigation revealed instability in the low bits of CNTVCT at
|
||||
the point a high bit rolls over. This leads to power-of-two cycle
|
||||
forward and backward jumps. (Testing shows that forward jumps are about
|
||||
twice as likely as backward jumps.)
|
||||
|
||||
Without trapping reads to CNTVCT, a userspace program is able to read it
|
||||
in a loop faster than it changes. A test program running on all 4 CPU
|
||||
cores that reported jumps larger than 100 ms was run for 13.6 hours and
|
||||
reported the following:
|
||||
|
||||
Count | Event
|
||||
-------+---------------------------
|
||||
9940 | jumped backward 699ms
|
||||
268 | jumped backward 1398ms
|
||||
1 | jumped backward 2097ms
|
||||
16020 | jumped forward 175ms
|
||||
6443 | jumped forward 699ms
|
||||
2976 | jumped forward 1398ms
|
||||
9 | jumped forward 356516ms
|
||||
9 | jumped forward 357215ms
|
||||
4 | jumped forward 714430ms
|
||||
1 | jumped forward 3578440ms
|
||||
|
||||
This works out to a jump larger than 100 ms about every 5.5 seconds on
|
||||
each CPU core.
|
||||
|
||||
The largest jump (almost an hour!) was the following sequence of reads:
|
||||
0x0000007fffffffff → 0x00000093feffffff → 0x0000008000000000
|
||||
|
||||
Note that the middle bits don't necessarily all read as all zeroes or
|
||||
all ones during the anomalous behavior; however the low 11 bits checked
|
||||
by the function in this patch have never been observed with any other
|
||||
value.
|
||||
|
||||
Also note that smaller jumps are much more common, with the smallest
|
||||
backward jumps of 2048 cycles observed over 400 times per second on each
|
||||
core. (Of course, this is partially due to lower bits rolling over more
|
||||
frequently.) Any one of these could have caused the 95 year time skip.
|
||||
|
||||
Similar anomalies were observed while reading CNTPCT (after patching the
|
||||
kernel to allow reads from userspace). However, the jumps are much less
|
||||
frequent, and only small jumps were observed. The same program as before
|
||||
(except now reading CNTPCT) observed after 72 hours:
|
||||
|
||||
Count | Event
|
||||
-------+---------------------------
|
||||
17 | jumped backward 699ms
|
||||
52 | jumped forward 175ms
|
||||
2831 | jumped forward 699ms
|
||||
5 | jumped forward 1398ms
|
||||
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
|
||||
Tested-by: Andre Przywara <andre.przywara@arm.com>
|
||||
|
||||
========================================================================
|
||||
|
||||
Because the CPU can read the CNTPCT/CNTVCT registers faster than they
|
||||
change, performing two reads of the register and comparing the high bits
|
||||
(like other workarounds) is not a workable solution. And because the
|
||||
timer can jump both forward and backward, no pair of reads can
|
||||
distinguish a good value from a bad one. The only way to guarantee a
|
||||
good value from consecutive reads would be to read _three_ times, and
|
||||
take the middle value iff the three values are 1) individually unique
|
||||
and 2) increasing. This takes at minimum 3 cycles (125 ns), or more if
|
||||
an anomaly is detected.
|
||||
|
||||
However, since there is a distinct pattern to the bad values, we can
|
||||
optimize the common case (2046/2048 of the time) to a single read by
|
||||
simply ignoring values that match the pattern. This still takes no more
|
||||
than 3 cycles in the worst case, and requires much less code.
|
||||
|
||||
[1]: https://github.com/armbian/build/commit/a08cd6fe7ae9
|
||||
[2]: https://forum.armbian.com/topic/3458-a64-datetime-clock-issue/
|
||||
[3]: https://irclog.whitequark.org/linux-sunxi/2018-01-26
|
||||
|
||||
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
||||
---
|
||||
drivers/clocksource/Kconfig | 11 ++++++++++
|
||||
drivers/clocksource/arm_arch_timer.c | 39 ++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 50 insertions(+)
|
||||
|
||||
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
|
||||
index 8e8a09755d10..7a5d434dd30b 100644
|
||||
--- a/drivers/clocksource/Kconfig
|
||||
+++ b/drivers/clocksource/Kconfig
|
||||
@@ -364,6 +364,17 @@ config ARM64_ERRATUM_858921
|
||||
The workaround will be dynamically enabled when an affected
|
||||
core is detected.
|
||||
|
||||
+config SUN50I_A64_UNSTABLE_TIMER
|
||||
+ bool "Workaround for Allwinner A64 timer instability"
|
||||
+ default y
|
||||
+ depends on ARM_ARCH_TIMER && ARM64 && ARCH_SUNXI
|
||||
+ select ARM_ARCH_TIMER_OOL_WORKAROUND
|
||||
+ help
|
||||
+ This option enables a workaround for instability in the timer on
|
||||
+ the Allwinner A64 SoC. The workaround will only be active if the
|
||||
+ allwinner,sun50i-a64-unstable-timer property is found in the
|
||||
+ timer node.
|
||||
+
|
||||
config ARM_GLOBAL_TIMER
|
||||
bool "Support for the ARM global timer" if COMPILE_TEST
|
||||
select TIMER_OF if OF
|
||||
diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c
|
||||
index 57cb2f00fc07..66ce13578c52 100644
|
||||
--- a/drivers/clocksource/arm_arch_timer.c
|
||||
+++ b/drivers/clocksource/arm_arch_timer.c
|
||||
@@ -319,6 +319,36 @@ static u64 notrace arm64_858921_read_cntvct_el0(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
+#ifdef CONFIG_SUN50I_A64_UNSTABLE_TIMER
|
||||
+/*
|
||||
+ * The low bits of each register can transiently read as all ones or all zeroes
|
||||
+ * when bit 11 or greater rolls over. Since the value can jump both backward
|
||||
+ * (7ff -> 000 -> 800) and forward (7ff -> fff -> 800), it is simplest to just
|
||||
+ * ignore register values with all ones or zeros in the low bits.
|
||||
+ */
|
||||
+static u64 notrace sun50i_a64_read_cntpct_el0(void)
|
||||
+{
|
||||
+ u64 val;
|
||||
+
|
||||
+ do {
|
||||
+ val = read_sysreg(cntpct_el0);
|
||||
+ } while (((val + 1) & GENMASK(10, 0)) <= 1);
|
||||
+
|
||||
+ return val;
|
||||
+}
|
||||
+
|
||||
+static u64 notrace sun50i_a64_read_cntvct_el0(void)
|
||||
+{
|
||||
+ u64 val;
|
||||
+
|
||||
+ do {
|
||||
+ val = read_sysreg(cntvct_el0);
|
||||
+ } while (((val + 1) & GENMASK(10, 0)) <= 1);
|
||||
+
|
||||
+ return val;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
#ifdef CONFIG_ARM_ARCH_TIMER_OOL_WORKAROUND
|
||||
DEFINE_PER_CPU(const struct arch_timer_erratum_workaround *, timer_unstable_counter_workaround);
|
||||
EXPORT_SYMBOL_GPL(timer_unstable_counter_workaround);
|
||||
@@ -408,6 +438,15 @@ static const struct arch_timer_erratum_workaround ool_workarounds[] = {
|
||||
.read_cntvct_el0 = arm64_858921_read_cntvct_el0,
|
||||
},
|
||||
#endif
|
||||
+#ifdef CONFIG_SUN50I_A64_UNSTABLE_TIMER
|
||||
+ {
|
||||
+ .match_type = ate_match_dt,
|
||||
+ .id = "allwinner,sun50i-a64-unstable-timer",
|
||||
+ .desc = "Allwinner A64 timer instability",
|
||||
+ .read_cntpct_el0 = sun50i_a64_read_cntpct_el0,
|
||||
+ .read_cntvct_el0 = sun50i_a64_read_cntvct_el0,
|
||||
+ },
|
||||
+#endif
|
||||
};
|
||||
|
||||
typedef bool (*ate_match_fn_t)(const struct arch_timer_erratum_workaround *,
|
|
@ -0,0 +1,38 @@
|
|||
From patchwork Fri May 11 02:27:51 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [2/2] arm64: dts: allwinner: a64: Enable A64 timer workaround
|
||||
From: Samuel Holland <samuel@sholland.org>
|
||||
X-Patchwork-Id: 10392889
|
||||
Message-Id: <20180511022751.9096-3-samuel@sholland.org>
|
||||
To: Maxime Ripard <maxime.ripard@bootlin.com>, Chen-Yu Tsai <wens@csie.org>,
|
||||
Catalin Marinas <catalin.marinas@arm.com>,
|
||||
Will Deacon <will.deacon@arm.com>,
|
||||
Daniel Lezcano <daniel.lezcano@linaro.org>,
|
||||
Thomas Gleixner <tglx@linutronix.de>, Marc Zyngier <marc.zyngier@arm.com>
|
||||
Cc: linux-sunxi@googlegroups.com, linux-kernel@vger.kernel.org,
|
||||
linux-arm-kernel@lists.infradead.org, Samuel Holland <samuel@sholland.org>
|
||||
Date: Thu, 10 May 2018 21:27:51 -0500
|
||||
|
||||
As instability in the architectural timer has been observed on multiple
|
||||
devices using this SoC, inluding the Pine64 and the Orange Pi Win,
|
||||
enable the workaround in the SoC's device tree.
|
||||
|
||||
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
||||
---
|
||||
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||
index 1b2ef28c42bd..5202b76e9684 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||
@@ -152,6 +152,7 @@
|
||||
|
||||
timer {
|
||||
compatible = "arm,armv8-timer";
|
||||
+ allwinner,sun50i-a64-unstable-timer;
|
||||
interrupts = <GIC_PPI 13
|
||||
(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>,
|
||||
<GIC_PPI 14
|
|
@ -1,116 +0,0 @@
|
|||
From patchwork Wed Apr 18 16:34:15 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: arm64: msm8916: fix gic_irq_domain_translate warnings
|
||||
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
X-Patchwork-Id: 10348701
|
||||
Message-Id: <20180418163415.21646-1-srinivas.kandagatla@linaro.org>
|
||||
To: andy.gross@linaro.org, linux-arm-msm@vger.kernel.org
|
||||
Cc: david.brown@linaro.org, robh+dt@kernel.org,
|
||||
linux-soc@vger.kernel.org, linux-kernel@vger.kernel.org,
|
||||
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
|
||||
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
Date: Wed, 18 Apr 2018 17:34:15 +0100
|
||||
|
||||
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
|
||||
Remove the usage of IRQ_TYPE_NONE to fix loud warnings from
|
||||
patch (83a86fbb5b56b "irqchip/gic: Loudly complain about
|
||||
the use of IRQ_TYPE_NONE").
|
||||
|
||||
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
|
||||
Reviewed-by: Thierry Escande <thierry.escande@linaro.org>
|
||||
Tested-by: Thierry Escande <thierry.escande@linaro.org>
|
||||
Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org>
|
||||
Tested-by: Amit Kucheria <amit.kucheria@linaro.org>
|
||||
Tested-by: Vinod Koul <vkoul@kernel.org>
|
||||
---
|
||||
arch/arm64/boot/dts/qcom/msm8916.dtsi | 18 +++++++++---------
|
||||
1 file changed, 9 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi
|
||||
index cfbd72186762..5d66a575c7e1 100644
|
||||
--- a/arch/arm64/boot/dts/qcom/msm8916.dtsi
|
||||
+++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi
|
||||
@@ -180,7 +180,7 @@
|
||||
|
||||
pmu {
|
||||
compatible = "arm,cortex-a53-pmu";
|
||||
- interrupts = <GIC_PPI 7 GIC_CPU_MASK_SIMPLE(4)>;
|
||||
+ interrupts = <GIC_PPI 7 (GIC_CPU_MASK_SIMPLE(4)| IRQ_TYPE_LEVEL_HIGH)>;
|
||||
};
|
||||
|
||||
thermal-zones {
|
||||
@@ -513,7 +513,7 @@
|
||||
blsp_i2c2: i2c@78b6000 {
|
||||
compatible = "qcom,i2c-qup-v2.2.1";
|
||||
reg = <0x078b6000 0x500>;
|
||||
- interrupts = <GIC_SPI 96 0>;
|
||||
+ interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&gcc GCC_BLSP1_AHB_CLK>,
|
||||
<&gcc GCC_BLSP1_QUP2_I2C_APPS_CLK>;
|
||||
clock-names = "iface", "core";
|
||||
@@ -528,7 +528,7 @@
|
||||
blsp_i2c4: i2c@78b8000 {
|
||||
compatible = "qcom,i2c-qup-v2.2.1";
|
||||
reg = <0x078b8000 0x500>;
|
||||
- interrupts = <GIC_SPI 98 0>;
|
||||
+ interrupts = <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&gcc GCC_BLSP1_AHB_CLK>,
|
||||
<&gcc GCC_BLSP1_QUP4_I2C_APPS_CLK>;
|
||||
clock-names = "iface", "core";
|
||||
@@ -543,7 +543,7 @@
|
||||
blsp_i2c6: i2c@78ba000 {
|
||||
compatible = "qcom,i2c-qup-v2.2.1";
|
||||
reg = <0x078ba000 0x500>;
|
||||
- interrupts = <GIC_SPI 100 0>;
|
||||
+ interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clocks = <&gcc GCC_BLSP1_AHB_CLK>,
|
||||
<&gcc GCC_BLSP1_QUP6_I2C_APPS_CLK>;
|
||||
clock-names = "iface", "core";
|
||||
@@ -575,7 +575,7 @@
|
||||
"mi2s-bit-clk3";
|
||||
#sound-dai-cells = <1>;
|
||||
|
||||
- interrupts = <0 160 0>;
|
||||
+ interrupts = <0 160 IRQ_TYPE_LEVEL_HIGH>;
|
||||
interrupt-names = "lpass-irq-lpaif";
|
||||
reg = <0x07708000 0x10000>;
|
||||
reg-names = "lpass-lpaif";
|
||||
@@ -595,7 +595,7 @@
|
||||
reg = <0x07824900 0x11c>, <0x07824000 0x800>;
|
||||
reg-names = "hc_mem", "core_mem";
|
||||
|
||||
- interrupts = <0 123 0>, <0 138 0>;
|
||||
+ interrupts = <0 123 IRQ_TYPE_LEVEL_HIGH>, <0 138 IRQ_TYPE_LEVEL_HIGH>;
|
||||
interrupt-names = "hc_irq", "pwr_irq";
|
||||
clocks = <&gcc GCC_SDCC1_APPS_CLK>,
|
||||
<&gcc GCC_SDCC1_AHB_CLK>,
|
||||
@@ -612,7 +612,7 @@
|
||||
reg = <0x07864900 0x11c>, <0x07864000 0x800>;
|
||||
reg-names = "hc_mem", "core_mem";
|
||||
|
||||
- interrupts = <0 125 0>, <0 221 0>;
|
||||
+ interrupts = <0 125 IRQ_TYPE_LEVEL_HIGH>, <0 221 IRQ_TYPE_LEVEL_HIGH>;
|
||||
interrupt-names = "hc_irq", "pwr_irq";
|
||||
clocks = <&gcc GCC_SDCC2_APPS_CLK>,
|
||||
<&gcc GCC_SDCC2_AHB_CLK>,
|
||||
@@ -819,7 +819,7 @@
|
||||
iommu-ctx@2000 {
|
||||
compatible = "qcom,msm-iommu-v1-ns";
|
||||
reg = <0x2000 0x1000>;
|
||||
- interrupts = <GIC_SPI 242 0>;
|
||||
+ interrupts = <GIC_SPI 242 IRQ_TYPE_LEVEL_HIGH>;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -864,7 +864,7 @@
|
||||
"bus_clk",
|
||||
"vsync_clk";
|
||||
|
||||
- interrupts = <0 72 0>;
|
||||
+ interrupts = <0 72 IRQ_TYPE_LEVEL_HIGH>;
|
||||
|
||||
interrupt-controller;
|
||||
#interrupt-cells = <1>;
|
|
@ -1,182 +0,0 @@
|
|||
From patchwork Mon Apr 9 15:45:52 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [v2,3/5] crypto: thunderx_zip: Prevent division by zero
|
||||
From: Jan Glauber <jglauber@cavium.com>
|
||||
X-Patchwork-Id: 10331709
|
||||
Message-Id: <20180409154554.7578-4-jglauber@cavium.com>
|
||||
To: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
Cc: "David S . Miller" <davem@davemloft.net>,
|
||||
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
|
||||
Mahipal Challa <Mahipal.Challa@cavium.com>,
|
||||
Robert Richter <rrichter@cavium.com>, Jan Glauber <jglauber@cavium.com>
|
||||
Date: Mon, 9 Apr 2018 17:45:52 +0200
|
||||
|
||||
Avoid two potential divisions by zero when calculating average
|
||||
values for the zip statistics.
|
||||
|
||||
Signed-off-by: Jan Glauber <jglauber@cavium.com>
|
||||
Reviewed-by: Robert Richter <rrichter@cavium.com>
|
||||
---
|
||||
drivers/crypto/cavium/zip/zip_main.c | 9 +++++----
|
||||
1 file changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/drivers/crypto/cavium/zip/zip_main.c b/drivers/crypto/cavium/zip/zip_main.c
|
||||
index 1cd8aa488185..79b449e0f955 100644
|
||||
--- a/drivers/crypto/cavium/zip/zip_main.c
|
||||
+++ b/drivers/crypto/cavium/zip/zip_main.c
|
||||
@@ -482,10 +482,11 @@ static int zip_show_stats(struct seq_file *s, void *unused)
|
||||
atomic64_add(val, &st->pending_req);
|
||||
}
|
||||
|
||||
- avg_chunk = (atomic64_read(&st->comp_in_bytes) /
|
||||
- atomic64_read(&st->comp_req_complete));
|
||||
- avg_cr = (atomic64_read(&st->comp_in_bytes) /
|
||||
- atomic64_read(&st->comp_out_bytes));
|
||||
+ val = atomic64_read(&st->comp_req_complete);
|
||||
+ avg_chunk = (val) ? atomic64_read(&st->comp_in_bytes) / val : 0;
|
||||
+
|
||||
+ val = atomic64_read(&st->comp_out_bytes);
|
||||
+ avg_cr = (val) ? atomic64_read(&st->comp_in_bytes) / val : 0;
|
||||
seq_printf(s, " ZIP Device %d Stats\n"
|
||||
"-----------------------------------\n"
|
||||
"Comp Req Submitted : \t%lld\n"
|
||||
From patchwork Mon Apr 9 15:45:53 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [v2,4/5] crypto: thunderx_zip: Fix statistics pending request value
|
||||
From: Jan Glauber <jglauber@cavium.com>
|
||||
X-Patchwork-Id: 10331711
|
||||
Message-Id: <20180409154554.7578-5-jglauber@cavium.com>
|
||||
To: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
Cc: "David S . Miller" <davem@davemloft.net>,
|
||||
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
|
||||
Mahipal Challa <Mahipal.Challa@cavium.com>,
|
||||
Robert Richter <rrichter@cavium.com>, Jan Glauber <jglauber@cavium.com>
|
||||
Date: Mon, 9 Apr 2018 17:45:53 +0200
|
||||
|
||||
The pending request counter was read from the wrong register. While
|
||||
at it, there is no need to use an atomic for it as it is only read
|
||||
localy in a loop.
|
||||
|
||||
Signed-off-by: Jan Glauber <jglauber@cavium.com>
|
||||
Reviewed-by: Robert Richter <rrichter@cavium.com>
|
||||
---
|
||||
drivers/crypto/cavium/zip/zip_main.c | 13 +++++--------
|
||||
drivers/crypto/cavium/zip/zip_main.h | 1 -
|
||||
2 files changed, 5 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/drivers/crypto/cavium/zip/zip_main.c b/drivers/crypto/cavium/zip/zip_main.c
|
||||
index 79b449e0f955..ae5b20c695ca 100644
|
||||
--- a/drivers/crypto/cavium/zip/zip_main.c
|
||||
+++ b/drivers/crypto/cavium/zip/zip_main.c
|
||||
@@ -469,6 +469,8 @@ static int zip_show_stats(struct seq_file *s, void *unused)
|
||||
struct zip_stats *st;
|
||||
|
||||
for (index = 0; index < MAX_ZIP_DEVICES; index++) {
|
||||
+ u64 pending = 0;
|
||||
+
|
||||
if (zip_dev[index]) {
|
||||
zip = zip_dev[index];
|
||||
st = &zip->stats;
|
||||
@@ -476,10 +478,8 @@ static int zip_show_stats(struct seq_file *s, void *unused)
|
||||
/* Get all the pending requests */
|
||||
for (q = 0; q < ZIP_NUM_QUEUES; q++) {
|
||||
val = zip_reg_read((zip->reg_base +
|
||||
- ZIP_DBG_COREX_STA(q)));
|
||||
- val = (val >> 32);
|
||||
- val = val & 0xffffff;
|
||||
- atomic64_add(val, &st->pending_req);
|
||||
+ ZIP_DBG_QUEX_STA(q)));
|
||||
+ pending += val >> 32 & 0xffffff;
|
||||
}
|
||||
|
||||
val = atomic64_read(&st->comp_req_complete);
|
||||
@@ -514,10 +514,7 @@ static int zip_show_stats(struct seq_file *s, void *unused)
|
||||
(u64)atomic64_read(&st->decomp_in_bytes),
|
||||
(u64)atomic64_read(&st->decomp_out_bytes),
|
||||
(u64)atomic64_read(&st->decomp_bad_reqs),
|
||||
- (u64)atomic64_read(&st->pending_req));
|
||||
-
|
||||
- /* Reset pending requests count */
|
||||
- atomic64_set(&st->pending_req, 0);
|
||||
+ pending);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
diff --git a/drivers/crypto/cavium/zip/zip_main.h b/drivers/crypto/cavium/zip/zip_main.h
|
||||
index 64e051f60784..e1e4fa92ce80 100644
|
||||
--- a/drivers/crypto/cavium/zip/zip_main.h
|
||||
+++ b/drivers/crypto/cavium/zip/zip_main.h
|
||||
@@ -74,7 +74,6 @@ struct zip_stats {
|
||||
atomic64_t comp_req_complete;
|
||||
atomic64_t decomp_req_submit;
|
||||
atomic64_t decomp_req_complete;
|
||||
- atomic64_t pending_req;
|
||||
atomic64_t comp_in_bytes;
|
||||
atomic64_t comp_out_bytes;
|
||||
atomic64_t decomp_in_bytes;
|
||||
From patchwork Mon Apr 9 15:45:54 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [v2,5/5] crypto: thunderx_zip: Fix smp_processor_id() warnings
|
||||
From: Jan Glauber <jglauber@cavium.com>
|
||||
X-Patchwork-Id: 10331715
|
||||
Message-Id: <20180409154554.7578-6-jglauber@cavium.com>
|
||||
To: Herbert Xu <herbert@gondor.apana.org.au>
|
||||
Cc: "David S . Miller" <davem@davemloft.net>,
|
||||
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
|
||||
Mahipal Challa <Mahipal.Challa@cavium.com>,
|
||||
Robert Richter <rrichter@cavium.com>, Jan Glauber <jglauber@cavium.com>
|
||||
Date: Mon, 9 Apr 2018 17:45:54 +0200
|
||||
|
||||
Switch to raw_smp_processor_id() to prevent a number of
|
||||
warnings from kernel debugging. We do not care about
|
||||
preemption here, as the CPU number is only used as a
|
||||
poor mans load balancing or device selection. If preemption
|
||||
happens during a compress/decompress operation a small performance
|
||||
hit will occur but everything will continue to work, so just
|
||||
ignore it.
|
||||
|
||||
Signed-off-by: Jan Glauber <jglauber@cavium.com>
|
||||
Reviewed-by: Robert Richter <rrichter@cavium.com>
|
||||
---
|
||||
drivers/crypto/cavium/zip/zip_device.c | 4 ++--
|
||||
drivers/crypto/cavium/zip/zip_main.c | 2 +-
|
||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/drivers/crypto/cavium/zip/zip_device.c b/drivers/crypto/cavium/zip/zip_device.c
|
||||
index ccf21fb91513..f174ec29ed69 100644
|
||||
--- a/drivers/crypto/cavium/zip/zip_device.c
|
||||
+++ b/drivers/crypto/cavium/zip/zip_device.c
|
||||
@@ -87,12 +87,12 @@ u32 zip_load_instr(union zip_inst_s *instr,
|
||||
* Distribute the instructions between the enabled queues based on
|
||||
* the CPU id.
|
||||
*/
|
||||
- if (smp_processor_id() % 2 == 0)
|
||||
+ if (raw_smp_processor_id() % 2 == 0)
|
||||
queue = 0;
|
||||
else
|
||||
queue = 1;
|
||||
|
||||
- zip_dbg("CPU Core: %d Queue number:%d", smp_processor_id(), queue);
|
||||
+ zip_dbg("CPU Core: %d Queue number:%d", raw_smp_processor_id(), queue);
|
||||
|
||||
/* Take cmd buffer lock */
|
||||
spin_lock(&zip_dev->iq[queue].lock);
|
||||
diff --git a/drivers/crypto/cavium/zip/zip_main.c b/drivers/crypto/cavium/zip/zip_main.c
|
||||
index ae5b20c695ca..be055b9547f6 100644
|
||||
--- a/drivers/crypto/cavium/zip/zip_main.c
|
||||
+++ b/drivers/crypto/cavium/zip/zip_main.c
|
||||
@@ -113,7 +113,7 @@ struct zip_device *zip_get_device(int node)
|
||||
*/
|
||||
int zip_get_node_id(void)
|
||||
{
|
||||
- return cpu_to_node(smp_processor_id());
|
||||
+ return cpu_to_node(raw_smp_processor_id());
|
||||
}
|
||||
|
||||
/* Initializes the ZIP h/w sub-system */
|
|
@ -0,0 +1,301 @@
|
|||
From 624e057827435de39274c34e20c2d937cb9d4ac3 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Robinson <pbrobinson@gmail.com>
|
||||
Date: Thu, 31 May 2018 19:08:12 +0100
|
||||
Subject: [PATCH] bcm2835: cpufreq: add CPU frequency control driver
|
||||
|
||||
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
|
||||
---
|
||||
arch/arm/boot/dts/bcm2835-rpi.dtsi | 7 ++
|
||||
arch/arm/boot/dts/bcm2837.dtsi | 33 +++++++
|
||||
drivers/clk/bcm/Kconfig | 8 ++
|
||||
drivers/clk/bcm/Makefile | 1 +
|
||||
drivers/clk/bcm/clk-raspberrypi.c | 138 +++++++++++++++++++++++++++++
|
||||
5 files changed, 187 insertions(+)
|
||||
create mode 100644 drivers/clk/bcm/clk-raspberrypi.c
|
||||
|
||||
diff --git a/arch/arm/boot/dts/bcm2835-rpi.dtsi b/arch/arm/boot/dts/bcm2835-rpi.dtsi
|
||||
index 6c3cfaa77f3d..e6d1627ec421 100644
|
||||
--- a/arch/arm/boot/dts/bcm2835-rpi.dtsi
|
||||
+++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi
|
||||
@@ -35,6 +35,13 @@
|
||||
reg = <0x7e00b840 0xf>;
|
||||
interrupts = <0 2>;
|
||||
};
|
||||
+
|
||||
+ arm_clk: arm_clk {
|
||||
+ compatible = "raspberrypi,bcm2835-cpu";
|
||||
+ clocks = <&clocks BCM2835_CLOCK_VPU>;
|
||||
+ #clock-cells = <0>;
|
||||
+ clock-output-names = "arm";
|
||||
+ };
|
||||
};
|
||||
};
|
||||
|
||||
diff --git a/arch/arm/boot/dts/bcm2837.dtsi b/arch/arm/boot/dts/bcm2837.dtsi
|
||||
index 7704bb029605..c24176282a1f 100644
|
||||
--- a/arch/arm/boot/dts/bcm2837.dtsi
|
||||
+++ b/arch/arm/boot/dts/bcm2837.dtsi
|
||||
@@ -38,6 +38,9 @@
|
||||
reg = <0>;
|
||||
enable-method = "spin-table";
|
||||
cpu-release-addr = <0x0 0x000000d8>;
|
||||
+ clocks = <&arm_clk>;
|
||||
+ clock-names = "cpu";
|
||||
+ operating-points-v2 = <&cpu0_opp_table>;
|
||||
};
|
||||
|
||||
cpu1: cpu@1 {
|
||||
@@ -46,6 +49,9 @@
|
||||
reg = <1>;
|
||||
enable-method = "spin-table";
|
||||
cpu-release-addr = <0x0 0x000000e0>;
|
||||
+ clocks = <&arm_clk>;
|
||||
+ clock-names = "cpu";
|
||||
+ operating-points-v2 = <&cpu0_opp_table>;
|
||||
};
|
||||
|
||||
cpu2: cpu@2 {
|
||||
@@ -54,6 +60,9 @@
|
||||
reg = <2>;
|
||||
enable-method = "spin-table";
|
||||
cpu-release-addr = <0x0 0x000000e8>;
|
||||
+ clocks = <&arm_clk>;
|
||||
+ clock-names = "cpu";
|
||||
+ operating-points-v2 = <&cpu0_opp_table>;
|
||||
};
|
||||
|
||||
cpu3: cpu@3 {
|
||||
@@ -62,6 +71,30 @@
|
||||
reg = <3>;
|
||||
enable-method = "spin-table";
|
||||
cpu-release-addr = <0x0 0x000000f0>;
|
||||
+ clocks = <&arm_clk>;
|
||||
+ clock-names = "cpu";
|
||||
+ operating-points-v2 = <&cpu0_opp_table>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ cpu0_opp_table: opp_table0 {
|
||||
+ compatible = "operating-points-v2";
|
||||
+ opp-shared;
|
||||
+
|
||||
+ opp@600000000 {
|
||||
+ opp-hz = /bits/ 64 <600000000>;
|
||||
+ clock-latency-ns = <355000>;
|
||||
+ opp-suspend;
|
||||
+ };
|
||||
+
|
||||
+ opp@900000000 {
|
||||
+ opp-hz = /bits/ 64 <900000000>;
|
||||
+ clock-latency-ns = <355000>;
|
||||
+ };
|
||||
+
|
||||
+ opp@1200000000 {
|
||||
+ opp-hz = /bits/ 64 <1200000000>;
|
||||
+ clock-latency-ns = <355000>;
|
||||
};
|
||||
};
|
||||
};
|
||||
diff --git a/drivers/clk/bcm/Kconfig b/drivers/clk/bcm/Kconfig
|
||||
index 4c4bd85f707c..e40bd19da22b 100644
|
||||
--- a/drivers/clk/bcm/Kconfig
|
||||
+++ b/drivers/clk/bcm/Kconfig
|
||||
@@ -63,3 +63,11 @@ config CLK_BCM_SR
|
||||
default ARCH_BCM_IPROC
|
||||
help
|
||||
Enable common clock framework support for the Broadcom Stingray SoC
|
||||
+
|
||||
+config CLK_RASPBERRYPI_CPU
|
||||
+ bool "Raspberry Pi CPU clock driver"
|
||||
+ depends on ARCH_BCM2835 || (COMPILE_TEST && OF)
|
||||
+ depends on RASPBERRYPI_FIRMWARE=y
|
||||
+ help
|
||||
+ This enables support for the RPi CPU clock which can be adjusted
|
||||
+ via the RPi firmware.
|
||||
diff --git a/drivers/clk/bcm/Makefile b/drivers/clk/bcm/Makefile
|
||||
index 002661d39128..a028b0a90b6e 100644
|
||||
--- a/drivers/clk/bcm/Makefile
|
||||
+++ b/drivers/clk/bcm/Makefile
|
||||
@@ -8,6 +8,7 @@ obj-$(CONFIG_COMMON_CLK_IPROC) += clk-iproc-armpll.o clk-iproc-pll.o clk-iproc-a
|
||||
obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835.o
|
||||
obj-$(CONFIG_ARCH_BCM2835) += clk-bcm2835-aux.o
|
||||
obj-$(CONFIG_ARCH_BCM_53573) += clk-bcm53573-ilp.o
|
||||
+obj-$(CONFIG_CLK_RASPBERRYPI_CPU) += clk-raspberrypi.o
|
||||
obj-$(CONFIG_CLK_BCM_CYGNUS) += clk-cygnus.o
|
||||
obj-$(CONFIG_CLK_BCM_HR2) += clk-hr2.o
|
||||
obj-$(CONFIG_CLK_BCM_NSP) += clk-nsp.o
|
||||
diff --git a/drivers/clk/bcm/clk-raspberrypi.c b/drivers/clk/bcm/clk-raspberrypi.c
|
||||
new file mode 100644
|
||||
index 000000000000..046efc822a59
|
||||
--- /dev/null
|
||||
+++ b/drivers/clk/bcm/clk-raspberrypi.c
|
||||
@@ -0,0 +1,138 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * Raspberry Pi CPU clock driver
|
||||
+ *
|
||||
+ * Copyright (C) 2018 Stefan Wahren <stefan.wahren@i2se.com>
|
||||
+ */
|
||||
+
|
||||
+#include <linux/clk.h>
|
||||
+#include <linux/clk-provider.h>
|
||||
+#include <linux/device.h>
|
||||
+#include <linux/err.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/of_device.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/slab.h>
|
||||
+#include <soc/bcm2835/raspberrypi-firmware.h>
|
||||
+
|
||||
+#define VCMSG_ID_ARM_CLOCK 0x000000003 /* Clock/Voltage ID's */
|
||||
+
|
||||
+struct rpi_cpu_clkgen {
|
||||
+ struct clk_hw hw;
|
||||
+ struct rpi_firmware *fw;
|
||||
+};
|
||||
+
|
||||
+/* tag part of the message */
|
||||
+struct prop {
|
||||
+ u32 id; /* the ID of the clock/voltage to get or set */
|
||||
+ u32 val; /* the value (e.g. rate (in Hz)) to set */
|
||||
+} __packed;
|
||||
+
|
||||
+static int rpi_cpu_clock_property(struct rpi_firmware *fw, u32 tag, u32 *val)
|
||||
+{
|
||||
+ int ret;
|
||||
+ struct prop msg = {
|
||||
+ .id = VCMSG_ID_ARM_CLOCK,
|
||||
+ .val = *val,
|
||||
+ };
|
||||
+
|
||||
+ ret = rpi_firmware_property(fw, tag, &msg, sizeof(msg));
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ *val = msg.val;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static unsigned long rpi_cpu_get_rate(struct clk_hw *hw,
|
||||
+ unsigned long parent_rate)
|
||||
+{
|
||||
+ struct rpi_cpu_clkgen *cpu = container_of(hw, struct rpi_cpu_clkgen, hw);
|
||||
+ u32 rate = 0;
|
||||
+
|
||||
+ rpi_cpu_clock_property(cpu->fw, RPI_FIRMWARE_GET_CLOCK_RATE, &rate);
|
||||
+
|
||||
+ return rate;
|
||||
+}
|
||||
+
|
||||
+static long rpi_cpu_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||
+ unsigned long *parent_rate)
|
||||
+{
|
||||
+ return rate;
|
||||
+}
|
||||
+
|
||||
+static int rpi_cpu_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
+ unsigned long parent_rate)
|
||||
+{
|
||||
+ struct rpi_cpu_clkgen *cpu = container_of(hw, struct rpi_cpu_clkgen, hw);
|
||||
+ u32 new_rate = rate;
|
||||
+
|
||||
+ return rpi_cpu_clock_property(cpu->fw, RPI_FIRMWARE_SET_CLOCK_RATE,
|
||||
+ &new_rate);
|
||||
+}
|
||||
+
|
||||
+static const struct clk_ops rpi_cpu_ops = {
|
||||
+ .recalc_rate = rpi_cpu_get_rate,
|
||||
+ .round_rate = rpi_cpu_round_rate,
|
||||
+ .set_rate = rpi_cpu_set_rate,
|
||||
+};
|
||||
+
|
||||
+static int rpi_cpu_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct device_node *fw_node;
|
||||
+ struct rpi_cpu_clkgen *cpu;
|
||||
+ struct clk_init_data *init;
|
||||
+ int ret;
|
||||
+
|
||||
+ cpu = devm_kzalloc(dev, sizeof(*cpu), GFP_KERNEL);
|
||||
+ if (!cpu)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ init = devm_kzalloc(dev, sizeof(*init), GFP_KERNEL);
|
||||
+ if (!init)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ fw_node = of_find_compatible_node(NULL, NULL,
|
||||
+ "raspberrypi,bcm2835-firmware");
|
||||
+ if (!fw_node) {
|
||||
+ dev_err(dev, "Missing firmware node\n");
|
||||
+ return -ENOENT;
|
||||
+ }
|
||||
+
|
||||
+ cpu->fw = rpi_firmware_get(fw_node);
|
||||
+ of_node_put(fw_node);
|
||||
+ if (!cpu->fw)
|
||||
+ return -EPROBE_DEFER;
|
||||
+
|
||||
+ init->name = dev->of_node->name;
|
||||
+ init->ops = &rpi_cpu_ops;
|
||||
+
|
||||
+ cpu->hw.init = init;
|
||||
+ ret = devm_clk_hw_register(dev, &cpu->hw);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ return of_clk_add_hw_provider(dev->of_node, of_clk_hw_simple_get,
|
||||
+ &cpu->hw);
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id rpi_cpu_of_match[] = {
|
||||
+ { .compatible = "raspberrypi,bcm2835-cpu", },
|
||||
+ {},
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, rpi_cpu_of_match);
|
||||
+
|
||||
+static struct platform_driver rpi_cpu_driver = {
|
||||
+ .driver = {
|
||||
+ .name = "raspberrypi-cpu",
|
||||
+ .of_match_table = rpi_cpu_of_match,
|
||||
+ },
|
||||
+ .probe = rpi_cpu_probe,
|
||||
+};
|
||||
+builtin_platform_driver(rpi_cpu_driver);
|
||||
+
|
||||
+MODULE_AUTHOR("Stefan Wahren <stefan.wahren@i2se.com>");
|
||||
+MODULE_DESCRIPTION("Raspberry Pi CPU clock driver");
|
||||
+MODULE_LICENSE("GPL v2");
|
||||
--
|
||||
2.17.0
|
||||
|
||||
From 40a82f71737891581dcbe45331d15a29dd3e7805 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Robinson <pbrobinson@gmail.com>
|
||||
Date: Mon, 4 Jun 2018 09:14:10 +0100
|
||||
Subject: [PATCH 7/7] add 1.4 ghz OPP for the 3B+
|
||||
|
||||
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
|
||||
---
|
||||
arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts b/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts
|
||||
index 4adb85e66be3..aaefb078f391 100644
|
||||
--- a/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts
|
||||
+++ b/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts
|
||||
@@ -106,3 +106,10 @@
|
||||
pinctrl-0 = <&uart1_gpio14>;
|
||||
status = "okay";
|
||||
};
|
||||
+
|
||||
+&cpu0_opp_table {
|
||||
+ opp@1400000000 {
|
||||
+ opp-hz = /bits/ 64 <1400000000>;
|
||||
+ clock-latency-ns = <355000>;
|
||||
+ };
|
||||
+};
|
||||
--
|
||||
2.17.1
|
||||
|
|
@ -0,0 +1,403 @@
|
|||
From be3035e3627d2570de4c2c612ecd095968986437 Mon Sep 17 00:00:00 2001
|
||||
From: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
Date: Fri, 25 May 2018 21:24:34 +0200
|
||||
Subject: [PATCH 1/4] ARM: bcm2835: Add GET_THROTTLED firmware property
|
||||
|
||||
Recent Raspberry Pi firmware provides a mailbox property to detect
|
||||
under-voltage conditions. Here is the current definition.
|
||||
|
||||
The u32 value returned by the firmware is divided into 2 parts:
|
||||
- lower 16-bits are the live value
|
||||
- upper 16-bits are the history or sticky value
|
||||
|
||||
Bits:
|
||||
0: undervoltage
|
||||
1: arm frequency capped
|
||||
2: currently throttled
|
||||
16: undervoltage has occurred
|
||||
17: arm frequency capped has occurred
|
||||
18: throttling has occurred
|
||||
|
||||
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
Signed-off-by: Eric Anholt <eric@anholt.net>
|
||||
Reviewed-by: Eric Anholt <eric@anholt.net>
|
||||
---
|
||||
include/soc/bcm2835/raspberrypi-firmware.h | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/include/soc/bcm2835/raspberrypi-firmware.h b/include/soc/bcm2835/raspberrypi-firmware.h
|
||||
index 8ee8991aa099a..c4a5c9e9fb478 100644
|
||||
--- a/include/soc/bcm2835/raspberrypi-firmware.h
|
||||
+++ b/include/soc/bcm2835/raspberrypi-firmware.h
|
||||
@@ -75,6 +75,7 @@ enum rpi_firmware_property_tag {
|
||||
RPI_FIRMWARE_GET_EDID_BLOCK = 0x00030020,
|
||||
RPI_FIRMWARE_GET_CUSTOMER_OTP = 0x00030021,
|
||||
RPI_FIRMWARE_GET_DOMAIN_STATE = 0x00030030,
|
||||
+ RPI_FIRMWARE_GET_THROTTLED = 0x00030046,
|
||||
RPI_FIRMWARE_SET_CLOCK_STATE = 0x00038001,
|
||||
RPI_FIRMWARE_SET_CLOCK_RATE = 0x00038002,
|
||||
RPI_FIRMWARE_SET_VOLTAGE = 0x00038003,
|
||||
--
|
||||
2.17.1
|
||||
|
||||
From 3c493c885cf8abf0986c9877875161dfd0a29273 Mon Sep 17 00:00:00 2001
|
||||
From: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
Date: Fri, 25 May 2018 21:24:35 +0200
|
||||
Subject: [PATCH 2/4] hwmon: Add support for RPi voltage sensor
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Currently there is no easy way to detect undervoltage conditions on a
|
||||
remote Raspberry Pi. This hwmon driver retrieves the state of the
|
||||
undervoltage sensor via mailbox interface. The handling based on
|
||||
Noralf's modifications to the downstream firmware driver. In case of
|
||||
an undervoltage condition only an entry is written to the kernel log.
|
||||
|
||||
CC: "Noralf Trønnes" <noralf@tronnes.org>
|
||||
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
Signed-off-by: Eric Anholt <eric@anholt.net>
|
||||
Acked-by: Guenter Roeck <linux@roeck-us.net>
|
||||
---
|
||||
Documentation/hwmon/raspberrypi-hwmon | 22 ++++
|
||||
drivers/hwmon/Kconfig | 10 ++
|
||||
drivers/hwmon/Makefile | 1 +
|
||||
drivers/hwmon/raspberrypi-hwmon.c | 166 ++++++++++++++++++++++++++
|
||||
4 files changed, 199 insertions(+)
|
||||
create mode 100644 Documentation/hwmon/raspberrypi-hwmon
|
||||
create mode 100644 drivers/hwmon/raspberrypi-hwmon.c
|
||||
|
||||
diff --git a/Documentation/hwmon/raspberrypi-hwmon b/Documentation/hwmon/raspberrypi-hwmon
|
||||
new file mode 100644
|
||||
index 0000000000000..3c92e2cb52d60
|
||||
--- /dev/null
|
||||
+++ b/Documentation/hwmon/raspberrypi-hwmon
|
||||
@@ -0,0 +1,22 @@
|
||||
+Kernel driver raspberrypi-hwmon
|
||||
+===============================
|
||||
+
|
||||
+Supported boards:
|
||||
+ * Raspberry Pi A+ (via GPIO on SoC)
|
||||
+ * Raspberry Pi B+ (via GPIO on SoC)
|
||||
+ * Raspberry Pi 2 B (via GPIO on SoC)
|
||||
+ * Raspberry Pi 3 B (via GPIO on port expander)
|
||||
+ * Raspberry Pi 3 B+ (via PMIC)
|
||||
+
|
||||
+Author: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
+
|
||||
+Description
|
||||
+-----------
|
||||
+
|
||||
+This driver periodically polls a mailbox property of the VC4 firmware to detect
|
||||
+undervoltage conditions.
|
||||
+
|
||||
+Sysfs entries
|
||||
+-------------
|
||||
+
|
||||
+in0_lcrit_alarm Undervoltage alarm
|
||||
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
|
||||
index f10840ad465c2..fdaab8229686f 100644
|
||||
--- a/drivers/hwmon/Kconfig
|
||||
+++ b/drivers/hwmon/Kconfig
|
||||
@@ -1298,6 +1298,16 @@ config SENSORS_PWM_FAN
|
||||
This driver can also be built as a module. If so, the module
|
||||
will be called pwm-fan.
|
||||
|
||||
+config SENSORS_RASPBERRYPI_HWMON
|
||||
+ tristate "Raspberry Pi voltage monitor"
|
||||
+ depends on RASPBERRYPI_FIRMWARE || COMPILE_TEST
|
||||
+ help
|
||||
+ If you say yes here you get support for voltage sensor on the
|
||||
+ Raspberry Pi.
|
||||
+
|
||||
+ This driver can also be built as a module. If so, the module
|
||||
+ will be called raspberrypi-hwmon.
|
||||
+
|
||||
config SENSORS_SHT15
|
||||
tristate "Sensiron humidity and temperature sensors. SHT15 and compat."
|
||||
depends on GPIOLIB || COMPILE_TEST
|
||||
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
|
||||
index e7d52a36e6c4f..a9297703fd6e4 100644
|
||||
--- a/drivers/hwmon/Makefile
|
||||
+++ b/drivers/hwmon/Makefile
|
||||
@@ -141,6 +141,7 @@ obj-$(CONFIG_SENSORS_PC87427) += pc87427.o
|
||||
obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o
|
||||
obj-$(CONFIG_SENSORS_POWR1220) += powr1220.o
|
||||
obj-$(CONFIG_SENSORS_PWM_FAN) += pwm-fan.o
|
||||
+obj-$(CONFIG_SENSORS_RASPBERRYPI_HWMON) += raspberrypi-hwmon.o
|
||||
obj-$(CONFIG_SENSORS_S3C) += s3c-hwmon.o
|
||||
obj-$(CONFIG_SENSORS_SCH56XX_COMMON)+= sch56xx-common.o
|
||||
obj-$(CONFIG_SENSORS_SCH5627) += sch5627.o
|
||||
diff --git a/drivers/hwmon/raspberrypi-hwmon.c b/drivers/hwmon/raspberrypi-hwmon.c
|
||||
new file mode 100644
|
||||
index 0000000000000..fb4e4a6bb1f63
|
||||
--- /dev/null
|
||||
+++ b/drivers/hwmon/raspberrypi-hwmon.c
|
||||
@@ -0,0 +1,166 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * Raspberry Pi voltage sensor driver
|
||||
+ *
|
||||
+ * Based on firmware/raspberrypi.c by Noralf Trønnes
|
||||
+ *
|
||||
+ * Copyright (C) 2018 Stefan Wahren <stefan.wahren@i2se.com>
|
||||
+ */
|
||||
+#include <linux/device.h>
|
||||
+#include <linux/err.h>
|
||||
+#include <linux/hwmon.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/slab.h>
|
||||
+#include <linux/workqueue.h>
|
||||
+#include <soc/bcm2835/raspberrypi-firmware.h>
|
||||
+
|
||||
+#define UNDERVOLTAGE_STICKY_BIT BIT(16)
|
||||
+
|
||||
+struct rpi_hwmon_data {
|
||||
+ struct device *hwmon_dev;
|
||||
+ struct rpi_firmware *fw;
|
||||
+ u32 last_throttled;
|
||||
+ struct delayed_work get_values_poll_work;
|
||||
+};
|
||||
+
|
||||
+static void rpi_firmware_get_throttled(struct rpi_hwmon_data *data)
|
||||
+{
|
||||
+ u32 new_uv, old_uv, value;
|
||||
+ int ret;
|
||||
+
|
||||
+ /* Request firmware to clear sticky bits */
|
||||
+ value = 0xffff;
|
||||
+
|
||||
+ ret = rpi_firmware_property(data->fw, RPI_FIRMWARE_GET_THROTTLED,
|
||||
+ &value, sizeof(value));
|
||||
+ if (ret) {
|
||||
+ dev_err_once(data->hwmon_dev, "Failed to get throttled (%d)\n",
|
||||
+ ret);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ new_uv = value & UNDERVOLTAGE_STICKY_BIT;
|
||||
+ old_uv = data->last_throttled & UNDERVOLTAGE_STICKY_BIT;
|
||||
+ data->last_throttled = value;
|
||||
+
|
||||
+ if (new_uv == old_uv)
|
||||
+ return;
|
||||
+
|
||||
+ if (new_uv)
|
||||
+ dev_crit(data->hwmon_dev, "Undervoltage detected!\n");
|
||||
+ else
|
||||
+ dev_info(data->hwmon_dev, "Voltage normalised\n");
|
||||
+
|
||||
+ sysfs_notify(&data->hwmon_dev->kobj, NULL, "in0_lcrit_alarm");
|
||||
+}
|
||||
+
|
||||
+static void get_values_poll(struct work_struct *work)
|
||||
+{
|
||||
+ struct rpi_hwmon_data *data;
|
||||
+
|
||||
+ data = container_of(work, struct rpi_hwmon_data,
|
||||
+ get_values_poll_work.work);
|
||||
+
|
||||
+ rpi_firmware_get_throttled(data);
|
||||
+
|
||||
+ /*
|
||||
+ * We can't run faster than the sticky shift (100ms) since we get
|
||||
+ * flipping in the sticky bits that are cleared.
|
||||
+ */
|
||||
+ schedule_delayed_work(&data->get_values_poll_work, 2 * HZ);
|
||||
+}
|
||||
+
|
||||
+static int rpi_read(struct device *dev, enum hwmon_sensor_types type,
|
||||
+ u32 attr, int channel, long *val)
|
||||
+{
|
||||
+ struct rpi_hwmon_data *data = dev_get_drvdata(dev);
|
||||
+
|
||||
+ *val = !!(data->last_throttled & UNDERVOLTAGE_STICKY_BIT);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static umode_t rpi_is_visible(const void *_data, enum hwmon_sensor_types type,
|
||||
+ u32 attr, int channel)
|
||||
+{
|
||||
+ return 0444;
|
||||
+}
|
||||
+
|
||||
+static const u32 rpi_in_config[] = {
|
||||
+ HWMON_I_LCRIT_ALARM,
|
||||
+ 0
|
||||
+};
|
||||
+
|
||||
+static const struct hwmon_channel_info rpi_in = {
|
||||
+ .type = hwmon_in,
|
||||
+ .config = rpi_in_config,
|
||||
+};
|
||||
+
|
||||
+static const struct hwmon_channel_info *rpi_info[] = {
|
||||
+ &rpi_in,
|
||||
+ NULL
|
||||
+};
|
||||
+
|
||||
+static const struct hwmon_ops rpi_hwmon_ops = {
|
||||
+ .is_visible = rpi_is_visible,
|
||||
+ .read = rpi_read,
|
||||
+};
|
||||
+
|
||||
+static const struct hwmon_chip_info rpi_chip_info = {
|
||||
+ .ops = &rpi_hwmon_ops,
|
||||
+ .info = rpi_info,
|
||||
+};
|
||||
+
|
||||
+static int rpi_hwmon_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct rpi_hwmon_data *data;
|
||||
+ int ret;
|
||||
+
|
||||
+ data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
|
||||
+ if (!data)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ /* Parent driver assure that firmware is correct */
|
||||
+ data->fw = dev_get_drvdata(dev->parent);
|
||||
+
|
||||
+ /* Init throttled */
|
||||
+ ret = rpi_firmware_property(data->fw, RPI_FIRMWARE_GET_THROTTLED,
|
||||
+ &data->last_throttled,
|
||||
+ sizeof(data->last_throttled));
|
||||
+
|
||||
+ data->hwmon_dev = devm_hwmon_device_register_with_info(dev, "rpi_volt",
|
||||
+ data,
|
||||
+ &rpi_chip_info,
|
||||
+ NULL);
|
||||
+
|
||||
+ INIT_DELAYED_WORK(&data->get_values_poll_work, get_values_poll);
|
||||
+ platform_set_drvdata(pdev, data);
|
||||
+
|
||||
+ if (!PTR_ERR_OR_ZERO(data->hwmon_dev))
|
||||
+ schedule_delayed_work(&data->get_values_poll_work, 2 * HZ);
|
||||
+
|
||||
+ return PTR_ERR_OR_ZERO(data->hwmon_dev);
|
||||
+}
|
||||
+
|
||||
+static int rpi_hwmon_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct rpi_hwmon_data *data = platform_get_drvdata(pdev);
|
||||
+
|
||||
+ cancel_delayed_work_sync(&data->get_values_poll_work);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct platform_driver rpi_hwmon_driver = {
|
||||
+ .probe = rpi_hwmon_probe,
|
||||
+ .remove = rpi_hwmon_remove,
|
||||
+ .driver = {
|
||||
+ .name = "raspberrypi-hwmon",
|
||||
+ },
|
||||
+};
|
||||
+module_platform_driver(rpi_hwmon_driver);
|
||||
+
|
||||
+MODULE_AUTHOR("Stefan Wahren <stefan.wahren@i2se.com>");
|
||||
+MODULE_DESCRIPTION("Raspberry Pi voltage sensor driver");
|
||||
+MODULE_LICENSE("GPL v2");
|
||||
--
|
||||
2.17.1
|
||||
|
||||
From 4ebe8673279b7afbbcbcf92094c9012a3c91f240 Mon Sep 17 00:00:00 2001
|
||||
From: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
Date: Fri, 25 May 2018 21:24:36 +0200
|
||||
Subject: [PATCH 3/4] firmware: raspberrypi: Register hwmon driver
|
||||
|
||||
Since the raspberrypi-hwmon driver is tied to the VC4 firmware instead of
|
||||
particular hardware its registration should be in the firmware driver.
|
||||
|
||||
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
Signed-off-by: Eric Anholt <eric@anholt.net>
|
||||
---
|
||||
drivers/firmware/raspberrypi.c | 19 +++++++++++++++++++
|
||||
1 file changed, 19 insertions(+)
|
||||
|
||||
diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c
|
||||
index 6692888f04cfb..0602626bf72d0 100644
|
||||
--- a/drivers/firmware/raspberrypi.c
|
||||
+++ b/drivers/firmware/raspberrypi.c
|
||||
@@ -21,6 +21,8 @@
|
||||
#define MBOX_DATA28(msg) ((msg) & ~0xf)
|
||||
#define MBOX_CHAN_PROPERTY 8
|
||||
|
||||
+static struct platform_device *rpi_hwmon;
|
||||
+
|
||||
struct rpi_firmware {
|
||||
struct mbox_client cl;
|
||||
struct mbox_chan *chan; /* The property channel. */
|
||||
@@ -183,6 +185,20 @@ rpi_firmware_print_firmware_revision(struct rpi_firmware *fw)
|
||||
}
|
||||
}
|
||||
|
||||
+static void
|
||||
+rpi_register_hwmon_driver(struct device *dev, struct rpi_firmware *fw)
|
||||
+{
|
||||
+ u32 packet;
|
||||
+ int ret = rpi_firmware_property(fw, RPI_FIRMWARE_GET_THROTTLED,
|
||||
+ &packet, sizeof(packet));
|
||||
+
|
||||
+ if (ret)
|
||||
+ return;
|
||||
+
|
||||
+ rpi_hwmon = platform_device_register_data(dev, "raspberrypi-hwmon",
|
||||
+ -1, NULL, 0);
|
||||
+}
|
||||
+
|
||||
static int rpi_firmware_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
@@ -209,6 +225,7 @@ static int rpi_firmware_probe(struct platform_device *pdev)
|
||||
platform_set_drvdata(pdev, fw);
|
||||
|
||||
rpi_firmware_print_firmware_revision(fw);
|
||||
+ rpi_register_hwmon_driver(dev, fw);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -217,6 +234,8 @@ static int rpi_firmware_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct rpi_firmware *fw = platform_get_drvdata(pdev);
|
||||
|
||||
+ platform_device_unregister(rpi_hwmon);
|
||||
+ rpi_hwmon = NULL;
|
||||
mbox_free_channel(fw->chan);
|
||||
|
||||
return 0;
|
||||
--
|
||||
2.17.1
|
||||
|
||||
From a0cf7704b6bc145a9f198a9b2bcf92ccc5d6b6be Mon Sep 17 00:00:00 2001
|
||||
From: Peter Robinson <pbrobinson@gmail.com>
|
||||
Date: Fri, 20 Jul 2018 12:58:37 +0100
|
||||
Subject: [PATCH] hwmon: rpi: add module alias to raspberrypi-hwmon
|
||||
|
||||
The raspberrypi-hwmon driver doesn't automatically load, although it does work
|
||||
when loaded, by adding the alias it auto loads as expected when built as a
|
||||
module. Tested on RPi2/RPi3 on 32 bit kernel and RPi3B+ on aarch64 with
|
||||
Fedora 28 and a patched 4.18 RC kernel.
|
||||
|
||||
Fixes: q3c493c885cf ("hwmon: Add support for RPi voltage sensor")
|
||||
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
|
||||
CC: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
CC: Eric Anholt <eric@anholt.net>
|
||||
---
|
||||
drivers/hwmon/raspberrypi-hwmon.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/drivers/hwmon/raspberrypi-hwmon.c b/drivers/hwmon/raspberrypi-hwmon.c
|
||||
index fb4e4a6bb1f63..be5ba46908953 100644
|
||||
--- a/drivers/hwmon/raspberrypi-hwmon.c
|
||||
+++ b/drivers/hwmon/raspberrypi-hwmon.c
|
||||
@@ -164,3 +164,4 @@ module_platform_driver(rpi_hwmon_driver);
|
||||
MODULE_AUTHOR("Stefan Wahren <stefan.wahren@i2se.com>");
|
||||
MODULE_DESCRIPTION("Raspberry Pi voltage sensor driver");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
+MODULE_ALIAS("platform:raspberrypi-hwmon");
|
||||
--
|
||||
2.17.1
|
||||
|
|
@ -1,452 +0,0 @@
|
|||
From bce4fe9fa48df0cbbe842e80d9a520f7265b4cd4 Mon Sep 17 00:00:00 2001
|
||||
From: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
Date: Wed, 4 Apr 2018 16:34:24 +0100
|
||||
Subject: [PATCH 5/9] net: lan78xx: Allow for VLAN headers in timeout.
|
||||
|
||||
The frame abort timeout being set by lan78xx_set_rx_max_frame_length
|
||||
didn't account for any VLAN headers, resulting in very low
|
||||
throughput if used with tagged VLANs.
|
||||
Use VLAN_ETH_HLEN instead of ETH_HLEN to correct for this.
|
||||
|
||||
See https://github.com/raspberrypi/linux/issues/2458
|
||||
|
||||
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
---
|
||||
drivers/net/usb/lan78xx.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
|
||||
index 0867f7275852..5b46998a6dce 100644
|
||||
--- a/drivers/net/usb/lan78xx.c
|
||||
+++ b/drivers/net/usb/lan78xx.c
|
||||
@@ -2178,7 +2178,7 @@ static int lan78xx_change_mtu(struct net_device *netdev, int new_mtu)
|
||||
if ((ll_mtu % dev->maxpacket) == 0)
|
||||
return -EDOM;
|
||||
|
||||
- ret = lan78xx_set_rx_max_frame_length(dev, new_mtu + ETH_HLEN);
|
||||
+ ret = lan78xx_set_rx_max_frame_length(dev, new_mtu + VLAN_ETH_HLEN);
|
||||
|
||||
netdev->mtu = new_mtu;
|
||||
|
||||
@@ -2467,7 +2467,8 @@ static int lan78xx_reset(struct lan78xx_net *dev)
|
||||
buf |= FCT_TX_CTL_EN_;
|
||||
ret = lan78xx_write_reg(dev, FCT_TX_CTL, buf);
|
||||
|
||||
- ret = lan78xx_set_rx_max_frame_length(dev, dev->net->mtu + ETH_HLEN);
|
||||
+ ret = lan78xx_set_rx_max_frame_length(dev,
|
||||
+ dev->net->mtu + VLAN_ETH_HLEN);
|
||||
|
||||
ret = lan78xx_read_reg(dev, MAC_RX, &buf);
|
||||
buf |= MAC_RX_RXEN_;
|
||||
--
|
||||
2.17.0
|
||||
|
||||
From 6fecd97fd35e9c624d101495ca34c83b1cb23e3d Mon Sep 17 00:00:00 2001
|
||||
From: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
Date: Mon, 9 Apr 2018 14:31:54 +0100
|
||||
Subject: [PATCH 6/9] net: lan78xx: Request s/w csum check on VLAN tagged
|
||||
packets.
|
||||
|
||||
There appears to be some issue in the LAN78xx where the checksum
|
||||
computed on a VLAN tagged packet is incorrect, or at least not
|
||||
in the form that the kernel is after. This is most easily shown
|
||||
by pinging a device via a VLAN tagged interface and it will dump
|
||||
out the error message and stack trace from netdev_rx_csum_fault.
|
||||
It has also been seen with standard TCP and UDP packets.
|
||||
|
||||
Until this is fully understood, request that the network stack
|
||||
computes the checksum on packets signalled as having a VLAN tag
|
||||
applied.
|
||||
|
||||
See https://github.com/raspberrypi/linux/issues/2458
|
||||
|
||||
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
|
||||
---
|
||||
drivers/net/usb/lan78xx.c | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
|
||||
index 5b46998a6dce..6b61bb21f2ae 100644
|
||||
--- a/drivers/net/usb/lan78xx.c
|
||||
+++ b/drivers/net/usb/lan78xx.c
|
||||
@@ -2920,8 +2920,12 @@ static void lan78xx_rx_csum_offload(struct lan78xx_net *dev,
|
||||
struct sk_buff *skb,
|
||||
u32 rx_cmd_a, u32 rx_cmd_b)
|
||||
{
|
||||
+ /* Checksum offload appears to be flawed if used with VLANs.
|
||||
+ * Elect for sw checksum check instead.
|
||||
+ */
|
||||
if (!(dev->net->features & NETIF_F_RXCSUM) ||
|
||||
- unlikely(rx_cmd_a & RX_CMD_A_ICSM_)) {
|
||||
+ unlikely(rx_cmd_a & RX_CMD_A_ICSM_) ||
|
||||
+ (rx_cmd_a & RX_CMD_A_FVTG_)) {
|
||||
skb->ip_summed = CHECKSUM_NONE;
|
||||
} else {
|
||||
skb->csum = ntohs((u16)(rx_cmd_b >> RX_CMD_B_CSUM_SHIFT_));
|
||||
--
|
||||
2.17.0
|
||||
|
||||
From 7528d39c5d01383fadb17a84b9840f9f685d1e0b Mon Sep 17 00:00:00 2001
|
||||
From: Phil Elwell <phil@raspberrypi.org>
|
||||
Date: Thu, 19 Apr 2018 17:59:38 +0100
|
||||
Subject: [PATCH 7/9] lan78xx: Read MAC address from DT if present
|
||||
|
||||
There is a standard mechanism for locating and using a MAC address from
|
||||
the Device Tree. Use this facility in the lan78xx driver to support
|
||||
applications without programmed EEPROM or OTP. At the same time,
|
||||
regularise the handling of the different address sources.
|
||||
|
||||
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
|
||||
---
|
||||
drivers/net/usb/lan78xx.c | 42 +++++++++++++++++++--------------------
|
||||
1 file changed, 20 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
|
||||
index 6b61bb21f2ae..6c38a74bb32d 100644
|
||||
--- a/drivers/net/usb/lan78xx.c
|
||||
+++ b/drivers/net/usb/lan78xx.c
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <linux/irqchip/chained_irq.h>
|
||||
#include <linux/microchipphy.h>
|
||||
#include <linux/phy.h>
|
||||
+#include <linux/of_net.h>
|
||||
#include "lan78xx.h"
|
||||
|
||||
#define DRIVER_AUTHOR "WOOJUNG HUH <woojung.huh@microchip.com>"
|
||||
@@ -1652,34 +1653,31 @@ static void lan78xx_init_mac_address(struct lan78xx_net *dev)
|
||||
addr[5] = (addr_hi >> 8) & 0xFF;
|
||||
|
||||
if (!is_valid_ether_addr(addr)) {
|
||||
- /* reading mac address from EEPROM or OTP */
|
||||
- if ((lan78xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
|
||||
- addr) == 0) ||
|
||||
- (lan78xx_read_otp(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
|
||||
- addr) == 0)) {
|
||||
- if (is_valid_ether_addr(addr)) {
|
||||
- /* eeprom values are valid so use them */
|
||||
- netif_dbg(dev, ifup, dev->net,
|
||||
- "MAC address read from EEPROM");
|
||||
- } else {
|
||||
- /* generate random MAC */
|
||||
- random_ether_addr(addr);
|
||||
- netif_dbg(dev, ifup, dev->net,
|
||||
- "MAC address set to random addr");
|
||||
- }
|
||||
-
|
||||
- addr_lo = addr[0] | (addr[1] << 8) |
|
||||
- (addr[2] << 16) | (addr[3] << 24);
|
||||
- addr_hi = addr[4] | (addr[5] << 8);
|
||||
-
|
||||
- ret = lan78xx_write_reg(dev, RX_ADDRL, addr_lo);
|
||||
- ret = lan78xx_write_reg(dev, RX_ADDRH, addr_hi);
|
||||
+ if (!eth_platform_get_mac_address(&dev->udev->dev, addr)) {
|
||||
+ /* valid address present in Device Tree */
|
||||
+ netif_dbg(dev, ifup, dev->net,
|
||||
+ "MAC address read from Device Tree");
|
||||
+ } else if (((lan78xx_read_eeprom(dev, EEPROM_MAC_OFFSET,
|
||||
+ ETH_ALEN, addr) == 0) ||
|
||||
+ (lan78xx_read_otp(dev, EEPROM_MAC_OFFSET,
|
||||
+ ETH_ALEN, addr) == 0)) &&
|
||||
+ is_valid_ether_addr(addr)) {
|
||||
+ /* eeprom values are valid so use them */
|
||||
+ netif_dbg(dev, ifup, dev->net,
|
||||
+ "MAC address read from EEPROM");
|
||||
} else {
|
||||
/* generate random MAC */
|
||||
random_ether_addr(addr);
|
||||
netif_dbg(dev, ifup, dev->net,
|
||||
"MAC address set to random addr");
|
||||
}
|
||||
+
|
||||
+ addr_lo = addr[0] | (addr[1] << 8) |
|
||||
+ (addr[2] << 16) | (addr[3] << 24);
|
||||
+ addr_hi = addr[4] | (addr[5] << 8);
|
||||
+
|
||||
+ ret = lan78xx_write_reg(dev, RX_ADDRL, addr_lo);
|
||||
+ ret = lan78xx_write_reg(dev, RX_ADDRH, addr_hi);
|
||||
}
|
||||
|
||||
ret = lan78xx_write_reg(dev, MAF_LO(0), addr_lo);
|
||||
--
|
||||
2.17.0
|
||||
|
||||
From f8f9ad43b37f5db5895619e4304aa9ba286cbbb0 Mon Sep 17 00:00:00 2001
|
||||
From: Phil Elwell <phil@raspberrypi.org>
|
||||
Date: Thu, 19 Apr 2018 17:59:40 +0100
|
||||
Subject: [PATCH 8/9] dt-bindings: Document the DT bindings for lan78xx
|
||||
|
||||
The Microchip LAN78XX family of devices are Ethernet controllers with
|
||||
a USB interface. Despite being discoverable devices it can be useful to
|
||||
be able to configure them from Device Tree, particularly in low-cost
|
||||
applications without an EEPROM or programmed OTP.
|
||||
|
||||
Document the supported properties in a bindings file.
|
||||
|
||||
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
---
|
||||
.../bindings/net/microchip,lan78xx.txt | 54 +++++++++++++++++++
|
||||
1 file changed, 54 insertions(+)
|
||||
create mode 100644 Documentation/devicetree/bindings/net/microchip,lan78xx.txt
|
||||
|
||||
diff --git a/Documentation/devicetree/bindings/net/microchip,lan78xx.txt b/Documentation/devicetree/bindings/net/microchip,lan78xx.txt
|
||||
new file mode 100644
|
||||
index 000000000000..76786a0f6d3d
|
||||
--- /dev/null
|
||||
+++ b/Documentation/devicetree/bindings/net/microchip,lan78xx.txt
|
||||
@@ -0,0 +1,54 @@
|
||||
+Microchip LAN78xx Gigabit Ethernet controller
|
||||
+
|
||||
+The LAN78XX devices are usually configured by programming their OTP or with
|
||||
+an external EEPROM, but some platforms (e.g. Raspberry Pi 3 B+) have neither.
|
||||
+The Device Tree properties, if present, override the OTP and EEPROM.
|
||||
+
|
||||
+Required properties:
|
||||
+- compatible: Should be one of "usb424,7800", "usb424,7801" or "usb424,7850".
|
||||
+
|
||||
+Optional properties:
|
||||
+- local-mac-address: see ethernet.txt
|
||||
+- mac-address: see ethernet.txt
|
||||
+
|
||||
+Optional properties of the embedded PHY:
|
||||
+- microchip,led-modes: a 0..4 element vector, with each element configuring
|
||||
+ the operating mode of an LED. Omitted LEDs are turned off. Allowed values
|
||||
+ are defined in "include/dt-bindings/net/microchip-lan78xx.h".
|
||||
+
|
||||
+Example:
|
||||
+
|
||||
+/* Based on the configuration for a Raspberry Pi 3 B+ */
|
||||
+&usb {
|
||||
+ usb-port@1 {
|
||||
+ compatible = "usb424,2514";
|
||||
+ reg = <1>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ usb-port@1 {
|
||||
+ compatible = "usb424,2514";
|
||||
+ reg = <1>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ ethernet: ethernet@1 {
|
||||
+ compatible = "usb424,7800";
|
||||
+ reg = <1>;
|
||||
+ local-mac-address = [ 00 11 22 33 44 55 ];
|
||||
+
|
||||
+ mdio {
|
||||
+ #address-cells = <0x1>;
|
||||
+ #size-cells = <0x0>;
|
||||
+ eth_phy: ethernet-phy@1 {
|
||||
+ reg = <1>;
|
||||
+ microchip,led-modes = <
|
||||
+ LAN78XX_LINK_1000_ACTIVITY
|
||||
+ LAN78XX_LINK_10_100_ACTIVITY
|
||||
+ >;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
--
|
||||
2.17.0
|
||||
|
||||
From be24db04ec2949e9b03763366f100ae40836c61e Mon Sep 17 00:00:00 2001
|
||||
From: Peter Robinson <pbrobinson@gmail.com>
|
||||
Date: Mon, 23 Apr 2018 14:31:26 +0100
|
||||
Subject: [PATCH 9/9] lan78xx: Read LED states from Device Tree
|
||||
|
||||
Add support for DT property "microchip,led-modes", a vector of zero
|
||||
to four cells (u32s) in the range 0-15, each of which sets the mode
|
||||
for one of the LEDs. Some possible values are:
|
||||
|
||||
0=link/activity 1=link1000/activity
|
||||
2=link100/activity 3=link10/activity
|
||||
4=link100/1000/activity 5=link10/1000/activity
|
||||
6=link10/100/activity 14=off 15=on
|
||||
|
||||
These values are given symbolic constants in a dt-bindings header.
|
||||
|
||||
Also use the presence of the DT property to indicate that the
|
||||
LEDs should be enabled - necessary in the event that no valid OTP
|
||||
or EEPROM is available.
|
||||
|
||||
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
|
||||
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
|
||||
---
|
||||
MAINTAINERS | 1 +
|
||||
drivers/net/phy/microchip.c | 25 ++++++++++++++++
|
||||
drivers/net/usb/lan78xx.c | 32 ++++++++++++++++++++-
|
||||
include/dt-bindings/net/microchip-lan78xx.h | 21 ++++++++++++++
|
||||
include/linux/microchipphy.h | 3 ++
|
||||
5 files changed, 81 insertions(+), 1 deletion(-)
|
||||
create mode 100644 include/dt-bindings/net/microchip-lan78xx.h
|
||||
|
||||
diff --git a/MAINTAINERS b/MAINTAINERS
|
||||
index 6e950b8b4a41..c7d5f8c60a2c 100644
|
||||
--- a/MAINTAINERS
|
||||
+++ b/MAINTAINERS
|
||||
@@ -14437,6 +14437,7 @@ M: Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>
|
||||
L: netdev@vger.kernel.org
|
||||
S: Maintained
|
||||
F: drivers/net/usb/lan78xx.*
|
||||
+F: include/dt-bindings/net/microchip-lan78xx.h
|
||||
|
||||
USB MASS STORAGE DRIVER
|
||||
M: Alan Stern <stern@rowland.harvard.edu>
|
||||
diff --git a/drivers/net/phy/microchip.c b/drivers/net/phy/microchip.c
|
||||
index a97ac8c12c4c..2d67937866a3 100644
|
||||
--- a/drivers/net/phy/microchip.c
|
||||
+++ b/drivers/net/phy/microchip.c
|
||||
@@ -21,6 +21,8 @@
|
||||
#include <linux/phy.h>
|
||||
#include <linux/microchipphy.h>
|
||||
#include <linux/delay.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <dt-bindings/net/microchip-lan78xx.h>
|
||||
|
||||
#define DRIVER_AUTHOR "WOOJUNG HUH <woojung.huh@microchip.com>"
|
||||
#define DRIVER_DESC "Microchip LAN88XX PHY driver"
|
||||
@@ -225,6 +227,8 @@ static int lan88xx_probe(struct phy_device *phydev)
|
||||
{
|
||||
struct device *dev = &phydev->mdio.dev;
|
||||
struct lan88xx_priv *priv;
|
||||
+ u32 led_modes[4];
|
||||
+ int len;
|
||||
|
||||
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
||||
if (!priv)
|
||||
@@ -232,6 +236,27 @@ static int lan88xx_probe(struct phy_device *phydev)
|
||||
|
||||
priv->wolopts = 0;
|
||||
|
||||
+ len = of_property_read_variable_u32_array(dev->of_node,
|
||||
+ "microchip,led-modes",
|
||||
+ led_modes,
|
||||
+ 0,
|
||||
+ ARRAY_SIZE(led_modes));
|
||||
+ if (len >= 0) {
|
||||
+ u32 reg = 0;
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < len; i++) {
|
||||
+ if (led_modes[i] > 15)
|
||||
+ return -EINVAL;
|
||||
+ reg |= led_modes[i] << (i * 4);
|
||||
+ }
|
||||
+ for (; i < ARRAY_SIZE(led_modes); i++)
|
||||
+ reg |= LAN78XX_FORCE_LED_OFF << (i * 4);
|
||||
+ (void)phy_write(phydev, LAN78XX_PHY_LED_MODE_SELECT, reg);
|
||||
+ } else if (len == -EOVERFLOW) {
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
/* these values can be used to identify internal PHY */
|
||||
priv->chip_id = phy_read_mmd(phydev, 3, LAN88XX_MMD3_CHIP_ID);
|
||||
priv->chip_rev = phy_read_mmd(phydev, 3, LAN88XX_MMD3_CHIP_REV);
|
||||
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
|
||||
index 6c38a74bb32d..01b876daa600 100644
|
||||
--- a/drivers/net/usb/lan78xx.c
|
||||
+++ b/drivers/net/usb/lan78xx.c
|
||||
@@ -37,6 +37,7 @@
|
||||
#include <linux/irqchip/chained_irq.h>
|
||||
#include <linux/microchipphy.h>
|
||||
#include <linux/phy.h>
|
||||
+#include <linux/of_mdio.h>
|
||||
#include <linux/of_net.h>
|
||||
#include "lan78xx.h"
|
||||
|
||||
@@ -1760,6 +1761,7 @@ static int lan78xx_mdiobus_write(struct mii_bus *bus, int phy_id, int idx,
|
||||
|
||||
static int lan78xx_mdio_init(struct lan78xx_net *dev)
|
||||
{
|
||||
+ struct device_node *node;
|
||||
int ret;
|
||||
|
||||
dev->mdiobus = mdiobus_alloc();
|
||||
@@ -1788,7 +1790,13 @@ static int lan78xx_mdio_init(struct lan78xx_net *dev)
|
||||
break;
|
||||
}
|
||||
|
||||
- ret = mdiobus_register(dev->mdiobus);
|
||||
+ node = of_get_child_by_name(dev->udev->dev.of_node, "mdio");
|
||||
+ if (node) {
|
||||
+ ret = of_mdiobus_register(dev->mdiobus, node);
|
||||
+ of_node_put(node);
|
||||
+ } else {
|
||||
+ ret = mdiobus_register(dev->mdiobus);
|
||||
+ }
|
||||
if (ret) {
|
||||
netdev_err(dev->net, "can't register MDIO bus\n");
|
||||
goto exit1;
|
||||
@@ -2077,6 +2085,28 @@ static int lan78xx_phy_init(struct lan78xx_net *dev)
|
||||
mii_adv = (u32)mii_advertise_flowctrl(dev->fc_request_control);
|
||||
phydev->advertising |= mii_adv_to_ethtool_adv_t(mii_adv);
|
||||
|
||||
+ if (phydev->mdio.dev.of_node) {
|
||||
+ u32 reg;
|
||||
+ int len;
|
||||
+
|
||||
+ len = of_property_count_elems_of_size(phydev->mdio.dev.of_node,
|
||||
+ "microchip,led-modes",
|
||||
+ sizeof(u32));
|
||||
+ if (len >= 0) {
|
||||
+ /* Ensure the appropriate LEDs are enabled */
|
||||
+ lan78xx_read_reg(dev, HW_CFG, ®);
|
||||
+ reg &= ~(HW_CFG_LED0_EN_ |
|
||||
+ HW_CFG_LED1_EN_ |
|
||||
+ HW_CFG_LED2_EN_ |
|
||||
+ HW_CFG_LED3_EN_);
|
||||
+ reg |= (len > 0) * HW_CFG_LED0_EN_ |
|
||||
+ (len > 1) * HW_CFG_LED1_EN_ |
|
||||
+ (len > 2) * HW_CFG_LED2_EN_ |
|
||||
+ (len > 3) * HW_CFG_LED3_EN_;
|
||||
+ lan78xx_write_reg(dev, HW_CFG, reg);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
genphy_config_aneg(phydev);
|
||||
|
||||
dev->fc_autoneg = phydev->autoneg;
|
||||
diff --git a/include/dt-bindings/net/microchip-lan78xx.h b/include/dt-bindings/net/microchip-lan78xx.h
|
||||
new file mode 100644
|
||||
index 000000000000..0742ff075307
|
||||
--- /dev/null
|
||||
+++ b/include/dt-bindings/net/microchip-lan78xx.h
|
||||
@@ -0,0 +1,21 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0 */
|
||||
+#ifndef _DT_BINDINGS_MICROCHIP_LAN78XX_H
|
||||
+#define _DT_BINDINGS_MICROCHIP_LAN78XX_H
|
||||
+
|
||||
+/* LED modes for LAN7800/LAN7850 embedded PHY */
|
||||
+
|
||||
+#define LAN78XX_LINK_ACTIVITY 0
|
||||
+#define LAN78XX_LINK_1000_ACTIVITY 1
|
||||
+#define LAN78XX_LINK_100_ACTIVITY 2
|
||||
+#define LAN78XX_LINK_10_ACTIVITY 3
|
||||
+#define LAN78XX_LINK_100_1000_ACTIVITY 4
|
||||
+#define LAN78XX_LINK_10_1000_ACTIVITY 5
|
||||
+#define LAN78XX_LINK_10_100_ACTIVITY 6
|
||||
+#define LAN78XX_DUPLEX_COLLISION 8
|
||||
+#define LAN78XX_COLLISION 9
|
||||
+#define LAN78XX_ACTIVITY 10
|
||||
+#define LAN78XX_AUTONEG_FAULT 12
|
||||
+#define LAN78XX_FORCE_LED_OFF 14
|
||||
+#define LAN78XX_FORCE_LED_ON 15
|
||||
+
|
||||
+#endif
|
||||
diff --git a/include/linux/microchipphy.h b/include/linux/microchipphy.h
|
||||
index 8f9c90379732..fd1fc8c248ef 100644
|
||||
--- a/include/linux/microchipphy.h
|
||||
+++ b/include/linux/microchipphy.h
|
||||
@@ -78,4 +78,7 @@
|
||||
#define LAN88XX_EXT_PAGE_TR_LOW_DATA 17
|
||||
#define LAN88XX_EXT_PAGE_TR_HIGH_DATA 18
|
||||
|
||||
+/* Registers specific to the LAN7800/LAN7850 embedded phy */
|
||||
+#define LAN78XX_PHY_LED_MODE_SELECT (0x1D)
|
||||
+
|
||||
#endif /* _MICROCHIPPHY_H */
|
||||
--
|
||||
2.17.0
|
|
@ -1,560 +0,0 @@
|
|||
From patchwork Sat Apr 21 11:28:34 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [V2,1/9] ARM: dts: bcm283x: Fix PWM pin assignment
|
||||
From: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
X-Patchwork-Id: 10354085
|
||||
Message-Id: <1524310122-9439-2-git-send-email-stefan.wahren@i2se.com>
|
||||
To: Rob Herring <robh+dt@kernel.org>, Mark Rutland <mark.rutland@arm.com>,
|
||||
Eric Anholt <eric@anholt.net>, Catalin Marinas <catalin.marinas@arm.com>,
|
||||
Will Deacon <will.deacon@arm.com>
|
||||
Cc: Stefan Wahren <stefan.wahren@i2se.com>, devicetree@vger.kernel.org,
|
||||
Florian Fainelli <f.fainelli@gmail.com>, Arnd Bergmann <arnd@arndb.de>,
|
||||
Scott Branden <sbranden@broadcom.com>, Ray Jui <rjui@broadcom.com>,
|
||||
Phil Elwell <phil@raspberrypi.org>, Alexander Graf <agraf@suse.de>,
|
||||
bcm-kernel-feedback-list@broadcom.com,
|
||||
linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org
|
||||
Date: Sat, 21 Apr 2018 13:28:34 +0200
|
||||
|
||||
All RPi 1 and 2 boards used the PWM (audio out) on pin 40 and 45.
|
||||
So it was easy to define them in bcm2835-rpi.dtsi. Starting with RPi 3
|
||||
this wont work anymore, because it uses pin 40 and 41. Furthermore the
|
||||
Zero variants doesn't have audio out.
|
||||
|
||||
This patch fixes this pin conflict by moving the PWM node to the board-level.
|
||||
|
||||
Change summary:
|
||||
RPi 3 B: PWM1 45 -> 41
|
||||
Zero, Zero W: PWM disabled
|
||||
all other: no functional change
|
||||
|
||||
Reported-by: Baruch Siach <baruch@tkos.co.il>
|
||||
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
Reviewed-by: Eric Anholt <eric@anholt.net>
|
||||
---
|
||||
arch/arm/boot/dts/bcm2835-rpi-a-plus.dts | 6 ++++++
|
||||
arch/arm/boot/dts/bcm2835-rpi-a.dts | 6 ++++++
|
||||
arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 6 ++++++
|
||||
arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts | 6 ++++++
|
||||
arch/arm/boot/dts/bcm2835-rpi-b.dts | 6 ++++++
|
||||
arch/arm/boot/dts/bcm2835-rpi.dtsi | 6 ------
|
||||
arch/arm/boot/dts/bcm2836-rpi-2-b.dts | 6 ++++++
|
||||
arch/arm/boot/dts/bcm2837-rpi-3-b.dts | 6 ++++++
|
||||
8 files changed, 42 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts b/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts
|
||||
index aa1fc7b..2cd9c5e 100644
|
||||
--- a/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts
|
||||
+++ b/arch/arm/boot/dts/bcm2835-rpi-a-plus.dts
|
||||
@@ -101,6 +101,12 @@
|
||||
hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
+&pwm {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pwm0_gpio40 &pwm1_gpio45>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&uart0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart0_gpio14>;
|
||||
diff --git a/arch/arm/boot/dts/bcm2835-rpi-a.dts b/arch/arm/boot/dts/bcm2835-rpi-a.dts
|
||||
index 425f6b0..067d1f0 100644
|
||||
--- a/arch/arm/boot/dts/bcm2835-rpi-a.dts
|
||||
+++ b/arch/arm/boot/dts/bcm2835-rpi-a.dts
|
||||
@@ -96,6 +96,12 @@
|
||||
hpd-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
|
||||
+&pwm {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pwm0_gpio40 &pwm1_gpio45>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&uart0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart0_gpio14>;
|
||||
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
|
||||
index effa195..cfbdaac 100644
|
||||
--- a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
|
||||
+++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
|
||||
@@ -103,6 +103,12 @@
|
||||
hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
+&pwm {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pwm0_gpio40 &pwm1_gpio45>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&uart0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart0_gpio14>;
|
||||
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts b/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
|
||||
index 772ec3b..5641d16 100644
|
||||
--- a/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
|
||||
+++ b/arch/arm/boot/dts/bcm2835-rpi-b-rev2.dts
|
||||
@@ -96,6 +96,12 @@
|
||||
hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
+&pwm {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pwm0_gpio40 &pwm1_gpio45>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&uart0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart0_gpio14>;
|
||||
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b.dts b/arch/arm/boot/dts/bcm2835-rpi-b.dts
|
||||
index 434483d..31ff602 100644
|
||||
--- a/arch/arm/boot/dts/bcm2835-rpi-b.dts
|
||||
+++ b/arch/arm/boot/dts/bcm2835-rpi-b.dts
|
||||
@@ -91,6 +91,12 @@
|
||||
hpd-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
|
||||
+&pwm {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pwm0_gpio40 &pwm1_gpio45>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&uart0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart0_gpio14>;
|
||||
diff --git a/arch/arm/boot/dts/bcm2835-rpi.dtsi b/arch/arm/boot/dts/bcm2835-rpi.dtsi
|
||||
index 6c3cfaa..cb2d6d7 100644
|
||||
--- a/arch/arm/boot/dts/bcm2835-rpi.dtsi
|
||||
+++ b/arch/arm/boot/dts/bcm2835-rpi.dtsi
|
||||
@@ -83,12 +83,6 @@
|
||||
bus-width = <4>;
|
||||
};
|
||||
|
||||
-&pwm {
|
||||
- pinctrl-names = "default";
|
||||
- pinctrl-0 = <&pwm0_gpio40 &pwm1_gpio45>;
|
||||
- status = "okay";
|
||||
-};
|
||||
-
|
||||
&usb {
|
||||
power-domains = <&power RPI_POWER_DOMAIN_USB>;
|
||||
};
|
||||
diff --git a/arch/arm/boot/dts/bcm2836-rpi-2-b.dts b/arch/arm/boot/dts/bcm2836-rpi-2-b.dts
|
||||
index 5c339ad..2fef70a 100644
|
||||
--- a/arch/arm/boot/dts/bcm2836-rpi-2-b.dts
|
||||
+++ b/arch/arm/boot/dts/bcm2836-rpi-2-b.dts
|
||||
@@ -41,6 +41,12 @@
|
||||
hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
+&pwm {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pwm0_gpio40 &pwm1_gpio45>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&uart0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart0_gpio14>;
|
||||
diff --git a/arch/arm/boot/dts/bcm2837-rpi-3-b.dts b/arch/arm/boot/dts/bcm2837-rpi-3-b.dts
|
||||
index 0b31d99..cc39b6f 100644
|
||||
--- a/arch/arm/boot/dts/bcm2837-rpi-3-b.dts
|
||||
+++ b/arch/arm/boot/dts/bcm2837-rpi-3-b.dts
|
||||
@@ -42,6 +42,12 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&pwm {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pwm0_gpio40 &pwm1_gpio41>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
/* uart0 communicates with the BT module */
|
||||
&uart0 {
|
||||
pinctrl-names = "default";
|
||||
From patchwork Sat Apr 21 11:28:35 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [V2,2/9] ARM: dts: bcm2837: Add missing GPIOs of Expander
|
||||
From: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
X-Patchwork-Id: 10354079
|
||||
Message-Id: <1524310122-9439-3-git-send-email-stefan.wahren@i2se.com>
|
||||
To: Rob Herring <robh+dt@kernel.org>, Mark Rutland <mark.rutland@arm.com>,
|
||||
Eric Anholt <eric@anholt.net>, Catalin Marinas <catalin.marinas@arm.com>,
|
||||
Will Deacon <will.deacon@arm.com>
|
||||
Cc: Stefan Wahren <stefan.wahren@i2se.com>, devicetree@vger.kernel.org,
|
||||
Florian Fainelli <f.fainelli@gmail.com>, Arnd Bergmann <arnd@arndb.de>,
|
||||
Scott Branden <sbranden@broadcom.com>, Ray Jui <rjui@broadcom.com>,
|
||||
Phil Elwell <phil@raspberrypi.org>, Alexander Graf <agraf@suse.de>,
|
||||
bcm-kernel-feedback-list@broadcom.com,
|
||||
linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org
|
||||
Date: Sat, 21 Apr 2018 13:28:35 +0200
|
||||
|
||||
After commit a98d90e7d588 ("gpio: raspberrypi-exp: Driver for RPi3 GPIO
|
||||
expander via mailbox service") we are able to control the rest of the
|
||||
GPIOs of the RPi 3. So add all the missing parts (ACT LED,
|
||||
Wifi & BT control, HDMI detect) to the DT.
|
||||
|
||||
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
Reviewed-by: Eric Anholt <eric@anholt.net>
|
||||
---
|
||||
arch/arm/boot/dts/bcm2837-rpi-3-b.dts | 20 +++++++++++++++++++-
|
||||
1 file changed, 19 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/arm/boot/dts/bcm2837-rpi-3-b.dts b/arch/arm/boot/dts/bcm2837-rpi-3-b.dts
|
||||
index cc39b6f..c318bcb 100644
|
||||
--- a/arch/arm/boot/dts/bcm2837-rpi-3-b.dts
|
||||
+++ b/arch/arm/boot/dts/bcm2837-rpi-3-b.dts
|
||||
@@ -20,9 +20,14 @@
|
||||
|
||||
leds {
|
||||
act {
|
||||
- gpios = <&gpio 47 GPIO_ACTIVE_HIGH>;
|
||||
+ gpios = <&expgpio 2 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
};
|
||||
+
|
||||
+ wifi_pwrseq: wifi-pwrseq {
|
||||
+ compatible = "mmc-pwrseq-simple";
|
||||
+ reset-gpios = <&expgpio 1 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
};
|
||||
|
||||
&firmware {
|
||||
@@ -48,6 +53,10 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&hdmi {
|
||||
+ hpd-gpios = <&expgpio 4 GPIO_ACTIVE_LOW>;
|
||||
+};
|
||||
+
|
||||
/* uart0 communicates with the BT module */
|
||||
&uart0 {
|
||||
pinctrl-names = "default";
|
||||
@@ -57,6 +66,7 @@
|
||||
bluetooth {
|
||||
compatible = "brcm,bcm43438-bt";
|
||||
max-speed = <2000000>;
|
||||
+ shutdown-gpios = <&expgpio 0 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -69,11 +79,19 @@
|
||||
|
||||
/* SDHCI is used to control the SDIO for wireless */
|
||||
&sdhci {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&emmc_gpio34>;
|
||||
status = "okay";
|
||||
bus-width = <4>;
|
||||
non-removable;
|
||||
+ mmc-pwrseq = <&wifi_pwrseq>;
|
||||
+
|
||||
+ brcmf: wifi@1 {
|
||||
+ reg = <1>;
|
||||
+ compatible = "brcm,bcm4329-fmac";
|
||||
+ };
|
||||
};
|
||||
|
||||
/* SDHOST is used to drive the SD card */
|
||||
From patchwork Sat Apr 21 11:28:36 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [V2,3/9] dt-bindings: bcm: Add Raspberry Pi 3 B+
|
||||
From: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
X-Patchwork-Id: 10354081
|
||||
Message-Id: <1524310122-9439-4-git-send-email-stefan.wahren@i2se.com>
|
||||
To: Rob Herring <robh+dt@kernel.org>, Mark Rutland <mark.rutland@arm.com>,
|
||||
Eric Anholt <eric@anholt.net>, Catalin Marinas <catalin.marinas@arm.com>,
|
||||
Will Deacon <will.deacon@arm.com>
|
||||
Cc: Stefan Wahren <stefan.wahren@i2se.com>, devicetree@vger.kernel.org,
|
||||
Florian Fainelli <f.fainelli@gmail.com>, Arnd Bergmann <arnd@arndb.de>,
|
||||
Scott Branden <sbranden@broadcom.com>, Ray Jui <rjui@broadcom.com>,
|
||||
Phil Elwell <phil@raspberrypi.org>, Alexander Graf <agraf@suse.de>,
|
||||
bcm-kernel-feedback-list@broadcom.com,
|
||||
linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org
|
||||
Date: Sat, 21 Apr 2018 13:28:36 +0200
|
||||
|
||||
This adds the root properties for the Raspberry Pi 3 B+
|
||||
|
||||
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
Reviewed-by: Eric Anholt <eric@anholt.net>
|
||||
Reviewed-by: Rob Herring <robh@kernel.org>
|
||||
---
|
||||
Documentation/devicetree/bindings/arm/bcm/brcm,bcm2835.txt | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/Documentation/devicetree/bindings/arm/bcm/brcm,bcm2835.txt b/Documentation/devicetree/bindings/arm/bcm/brcm,bcm2835.txt
|
||||
index 3e3efa0..1e3e29a 100644
|
||||
--- a/Documentation/devicetree/bindings/arm/bcm/brcm,bcm2835.txt
|
||||
+++ b/Documentation/devicetree/bindings/arm/bcm/brcm,bcm2835.txt
|
||||
@@ -34,6 +34,10 @@ Raspberry Pi 3 Model B
|
||||
Required root node properties:
|
||||
compatible = "raspberrypi,3-model-b", "brcm,bcm2837";
|
||||
|
||||
+Raspberry Pi 3 Model B+
|
||||
+Required root node properties:
|
||||
+compatible = "raspberrypi,3-model-b-plus", "brcm,bcm2837";
|
||||
+
|
||||
Raspberry Pi Compute Module
|
||||
Required root node properties:
|
||||
compatible = "raspberrypi,compute-module", "brcm,bcm2835";
|
||||
From patchwork Sat Apr 21 11:28:37 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [V2,4/9] ARM: dts: bcm2837: Add Raspberry Pi 3 B+
|
||||
From: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
X-Patchwork-Id: 10354075
|
||||
Message-Id: <1524310122-9439-5-git-send-email-stefan.wahren@i2se.com>
|
||||
To: Rob Herring <robh+dt@kernel.org>, Mark Rutland <mark.rutland@arm.com>,
|
||||
Eric Anholt <eric@anholt.net>, Catalin Marinas <catalin.marinas@arm.com>,
|
||||
Will Deacon <will.deacon@arm.com>
|
||||
Cc: Stefan Wahren <stefan.wahren@i2se.com>, devicetree@vger.kernel.org,
|
||||
Florian Fainelli <f.fainelli@gmail.com>, Arnd Bergmann <arnd@arndb.de>,
|
||||
Scott Branden <sbranden@broadcom.com>, Ray Jui <rjui@broadcom.com>,
|
||||
Phil Elwell <phil@raspberrypi.org>, Alexander Graf <agraf@suse.de>,
|
||||
bcm-kernel-feedback-list@broadcom.com,
|
||||
linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org
|
||||
Date: Sat, 21 Apr 2018 13:28:37 +0200
|
||||
|
||||
The Raspberry Pi 3 B+ has the following major differences compared
|
||||
to the model 3 B:
|
||||
* Microchip LAN7515 (Gigabit Ethernet with integrated USB 2.0 HUB)
|
||||
* Cypress CYW43455 (802.11n/ac and BT 4.2)
|
||||
|
||||
We need to add the USB LAN chip so the bootloader can add the MAC address.
|
||||
This is necessary because there ain't an EEPROM or a valid OTP.
|
||||
|
||||
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
|
||||
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
Reviewed-by: Eric Anholt <eric@anholt.net>
|
||||
---
|
||||
arch/arm/boot/dts/Makefile | 1 +
|
||||
arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts | 108 +++++++++++++++++++++++++++++
|
||||
arch/arm/boot/dts/bcm283x-rpi-lan7515.dtsi | 27 ++++++++
|
||||
3 files changed, 136 insertions(+)
|
||||
create mode 100644 arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts
|
||||
create mode 100644 arch/arm/boot/dts/bcm283x-rpi-lan7515.dtsi
|
||||
|
||||
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
|
||||
index 7e24249..a300a35 100644
|
||||
--- a/arch/arm/boot/dts/Makefile
|
||||
+++ b/arch/arm/boot/dts/Makefile
|
||||
@@ -75,6 +75,7 @@ dtb-$(CONFIG_ARCH_BCM2835) += \
|
||||
bcm2835-rpi-a-plus.dtb \
|
||||
bcm2836-rpi-2-b.dtb \
|
||||
bcm2837-rpi-3-b.dtb \
|
||||
+ bcm2837-rpi-3-b-plus.dtb \
|
||||
bcm2835-rpi-zero.dtb \
|
||||
bcm2835-rpi-zero-w.dtb
|
||||
dtb-$(CONFIG_ARCH_BCM_5301X) += \
|
||||
diff --git a/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts b/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts
|
||||
new file mode 100644
|
||||
index 0000000..4adb85e
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts
|
||||
@@ -0,0 +1,108 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/dts-v1/;
|
||||
+#include "bcm2837.dtsi"
|
||||
+#include "bcm2835-rpi.dtsi"
|
||||
+#include "bcm283x-rpi-lan7515.dtsi"
|
||||
+#include "bcm283x-rpi-usb-host.dtsi"
|
||||
+
|
||||
+/ {
|
||||
+ compatible = "raspberrypi,3-model-b-plus", "brcm,bcm2837";
|
||||
+ model = "Raspberry Pi 3 Model B+";
|
||||
+
|
||||
+ chosen {
|
||||
+ /* 8250 auxiliary UART instead of pl011 */
|
||||
+ stdout-path = "serial1:115200n8";
|
||||
+ };
|
||||
+
|
||||
+ memory {
|
||||
+ reg = <0 0x40000000>;
|
||||
+ };
|
||||
+
|
||||
+ leds {
|
||||
+ act {
|
||||
+ gpios = <&gpio 29 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+
|
||||
+ pwr {
|
||||
+ label = "PWR";
|
||||
+ gpios = <&expgpio 2 GPIO_ACTIVE_LOW>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ wifi_pwrseq: wifi-pwrseq {
|
||||
+ compatible = "mmc-pwrseq-simple";
|
||||
+ reset-gpios = <&expgpio 1 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&firmware {
|
||||
+ expgpio: gpio {
|
||||
+ compatible = "raspberrypi,firmware-gpio";
|
||||
+ gpio-controller;
|
||||
+ #gpio-cells = <2>;
|
||||
+ gpio-line-names = "BT_ON",
|
||||
+ "WL_ON",
|
||||
+ "STATUS_LED",
|
||||
+ "LAN_RUN",
|
||||
+ "",
|
||||
+ "CAM_GPIO0",
|
||||
+ "CAM_GPIO1",
|
||||
+ "";
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&hdmi {
|
||||
+ hpd-gpios = <&gpio 28 GPIO_ACTIVE_LOW>;
|
||||
+};
|
||||
+
|
||||
+&pwm {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pwm0_gpio40 &pwm1_gpio41>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+/* SDHCI is used to control the SDIO for wireless */
|
||||
+&sdhci {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&emmc_gpio34>;
|
||||
+ status = "okay";
|
||||
+ bus-width = <4>;
|
||||
+ non-removable;
|
||||
+ mmc-pwrseq = <&wifi_pwrseq>;
|
||||
+
|
||||
+ brcmf: wifi@1 {
|
||||
+ reg = <1>;
|
||||
+ compatible = "brcm,bcm4329-fmac";
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+/* SDHOST is used to drive the SD card */
|
||||
+&sdhost {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&sdhost_gpio48>;
|
||||
+ status = "okay";
|
||||
+ bus-width = <4>;
|
||||
+};
|
||||
+
|
||||
+/* uart0 communicates with the BT module */
|
||||
+&uart0 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart0_ctsrts_gpio30 &uart0_gpio32 &gpclk2_gpio43>;
|
||||
+ status = "okay";
|
||||
+
|
||||
+ bluetooth {
|
||||
+ compatible = "brcm,bcm43438-bt";
|
||||
+ max-speed = <2000000>;
|
||||
+ shutdown-gpios = <&expgpio 0 GPIO_ACTIVE_HIGH>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+/* uart1 is mapped to the pin header */
|
||||
+&uart1 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart1_gpio14>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
diff --git a/arch/arm/boot/dts/bcm283x-rpi-lan7515.dtsi b/arch/arm/boot/dts/bcm283x-rpi-lan7515.dtsi
|
||||
new file mode 100644
|
||||
index 0000000..9403da0
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/boot/dts/bcm283x-rpi-lan7515.dtsi
|
||||
@@ -0,0 +1,27 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/ {
|
||||
+ aliases {
|
||||
+ ethernet0 = ðernet;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&usb {
|
||||
+ usb-port@1 {
|
||||
+ compatible = "usb424,2514";
|
||||
+ reg = <1>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ usb-port@1 {
|
||||
+ compatible = "usb424,2514";
|
||||
+ reg = <1>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ ethernet: ethernet@1 {
|
||||
+ compatible = "usb424,7800";
|
||||
+ reg = <1>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
From patchwork Sat Apr 21 11:28:42 2018
|
||||
Content-Type: text/plain; charset="utf-8"
|
||||
MIME-Version: 1.0
|
||||
Content-Transfer-Encoding: 7bit
|
||||
Subject: [V2,9/9] arm64: dts: broadcom: Add reference to Raspberry Pi 3 B+
|
||||
From: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
X-Patchwork-Id: 10354077
|
||||
Message-Id: <1524310122-9439-10-git-send-email-stefan.wahren@i2se.com>
|
||||
To: Rob Herring <robh+dt@kernel.org>, Mark Rutland <mark.rutland@arm.com>,
|
||||
Eric Anholt <eric@anholt.net>, Catalin Marinas <catalin.marinas@arm.com>,
|
||||
Will Deacon <will.deacon@arm.com>
|
||||
Cc: Stefan Wahren <stefan.wahren@i2se.com>, devicetree@vger.kernel.org,
|
||||
Florian Fainelli <f.fainelli@gmail.com>, Arnd Bergmann <arnd@arndb.de>,
|
||||
Scott Branden <sbranden@broadcom.com>, Ray Jui <rjui@broadcom.com>,
|
||||
Phil Elwell <phil@raspberrypi.org>, Alexander Graf <agraf@suse.de>,
|
||||
bcm-kernel-feedback-list@broadcom.com,
|
||||
linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org
|
||||
Date: Sat, 21 Apr 2018 13:28:42 +0200
|
||||
|
||||
This adds a reference to the dts of the Raspberry Pi 3 B+
|
||||
in arm, so don't need to maintain the content in arm64.
|
||||
|
||||
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
|
||||
Reviewed-by: Eric Anholt <eric@anholt.net>
|
||||
---
|
||||
arch/arm64/boot/dts/broadcom/Makefile | 3 ++-
|
||||
arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b-plus.dts | 2 ++
|
||||
2 files changed, 4 insertions(+), 1 deletion(-)
|
||||
create mode 100644 arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b-plus.dts
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/broadcom/Makefile b/arch/arm64/boot/dts/broadcom/Makefile
|
||||
index 2a2591e..1193a9e 100644
|
||||
--- a/arch/arm64/boot/dts/broadcom/Makefile
|
||||
+++ b/arch/arm64/boot/dts/broadcom/Makefile
|
||||
@@ -1,5 +1,6 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
-dtb-$(CONFIG_ARCH_BCM2835) += bcm2837-rpi-3-b.dtb
|
||||
+dtb-$(CONFIG_ARCH_BCM2835) += bcm2837-rpi-3-b.dtb \
|
||||
+ bcm2837-rpi-3-b-plus.dtb
|
||||
|
||||
subdir-y += northstar2
|
||||
subdir-y += stingray
|
||||
diff --git a/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b-plus.dts b/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b-plus.dts
|
||||
new file mode 100644
|
||||
index 0000000..46ad202
|
||||
--- /dev/null
|
||||
+++ b/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b-plus.dts
|
||||
@@ -0,0 +1,2 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+#include "arm/bcm2837-rpi-3-b-plus.dts"
|
|
@ -11,6 +11,8 @@ SCRIPT="$(readlink -f $0)"
|
|||
OUTPUT_DIR="$PWD"
|
||||
SCRIPT_DIR="$(dirname $SCRIPT)"
|
||||
|
||||
LANG=en_US.UTF-8
|
||||
|
||||
# to handle this script being a symlink
|
||||
cd $SCRIPT_DIR
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_AD5686_SPI is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_AD5696_I2C is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_ALTERA_PR_IP_CORE=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_ALTERA_PR_IP_CORE_PLAT=m
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_ASIX_PHY is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_ATH10K_SNOC is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_AUTOFS_FS=y
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_BPFILTER is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_BUILD_ID_SALT=0x12345678
|
|
@ -0,0 +1 @@
|
|||
CONFIG_BUILD_SALT=""
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CHROMEOS_TBMC is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_CONSOLE_LOGLEVEL_QUIET=3
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CRYPTO_AEGIS128 is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CRYPTO_AEGIS128L is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CRYPTO_AEGIS128L_AESNI_SSE2 is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CRYPTO_AEGIS128_AESNI_SSE2 is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CRYPTO_AEGIS256 is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CRYPTO_AEGIS256_AESNI_SSE2 is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CRYPTO_MORUS1280 is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CRYPTO_MORUS1280_AVX2 is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CRYPTO_MORUS1280_SSE2 is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CRYPTO_MORUS640 is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CRYPTO_MORUS640_SSE2 is not set
|
|
@ -1 +1 @@
|
|||
CONFIG_CRYPTO_SPECK=m
|
||||
# CONFIG_CRYPTO_SPECK is not set
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_CRYPTO_ZSTD is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_DMA_API_DEBUG_SG is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_DM_WRITECACHE is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_DP83TC811_PHY is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_DRM_CDNS_DSI is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_DRM_DEBUG_SELFTEST is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_DRM_I2C_NXP_TDA9950 is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_DRM_SUN6I_DSI is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_DRM_THINE_THC63LVD1024 is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_DRM_XEN is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_FAILOVER=m
|
|
@ -1 +1 @@
|
|||
CONFIG_FIXED_PHY=y
|
||||
CONFIG_FIXED_PHY=m
|
||||
|
|
|
@ -1 +1 @@
|
|||
# CONFIG_FPGA is not set
|
||||
CONFIG_FPGA=m
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
CONFIG_FPGA_BRIDGE=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_FPGA_MGR_ALTERA_CVP=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_FPGA_MGR_ALTERA_PS_SPI=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_FPGA_MGR_ICE40_SPI=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_FPGA_MGR_MACHXO2_SPI=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_FPGA_MGR_XILINX_SPI=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_FPGA_MGR_ZYNQ_FPGA=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_FPGA_REGION=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_FRAMEBUFFER_CONSOLE_DEFERRED_TAKEOVER=y
|
|
@ -1 +1 @@
|
|||
# CONFIG_FUNCTION_GRAPH_TRACER is not set
|
||||
CONFIG_FUNCTION_GRAPH_TRACER=y
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
CONFIG_GPIOLIB_FASTPATH_LIMIT=512
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_HID_REDRAGON is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_HID_STEAM=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_IIO_RESCALE=m
|
|
@ -1 +0,0 @@
|
|||
# CONFIG_IPMI_PROC_INTERFACE is not set
|
|
@ -1 +0,0 @@
|
|||
# CONFIG_IPX is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_IP_VS_MH is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_IP_VS_MH_TAB_INDEX=12
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_LCD_OTM3225A is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_LEDS_CR0014114 is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_LEDS_LM3601X is not set
|
|
@ -1 +0,0 @@
|
|||
# CONFIG_LUSTRE_FS is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_MDIO_DEVICE=m
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_MDIO_MSCC_MIIM is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_MICROCHIP_T1_PHY is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_MMC_DW_BLUEFIELD is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_MSCC_OCELOT_SWITCH is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_MSM_GCC_8998 is not set
|
|
@ -1 +0,0 @@
|
|||
# CONFIG_NCP_FS is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_NET_FAILOVER=m
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_NET_VENDOR_MICROSEMI is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_NFP_APP_ABM_NIC is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_NFT_CONNLIMIT is not set
|
|
@ -0,0 +1 @@
|
|||
# CONFIG_NFT_SOCKET is not set
|
|
@ -0,0 +1 @@
|
|||
CONFIG_NF_TABLES_SET=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_NF_TPROXY_IPV4=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_NF_TPROXY_IPV6=m
|
|
@ -0,0 +1 @@
|
|||
CONFIG_OF_FPGA_REGION=m
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue