[U-Boot] [PATCH 04/18] ARM: uniphier: remove argument from boot_device_is_usb() hook
Masahiro Yamada
yamada.masahiro at socionext.com
Tue Jul 2 08:32:14 UTC 2019
As it turns out, passing the value of PINMON0 to the hook is not
generic. PXs3 needs to read out PINMON2 instead of PINMON0.
Signed-off-by: Masahiro Yamada <yamada.masahiro at socionext.com>
---
.../mach-uniphier/boot-device/boot-device-ld11.c | 9 +++++----
.../mach-uniphier/boot-device/boot-device-pxs2.c | 5 +++--
.../mach-uniphier/boot-device/boot-device-pxs3.c | 2 +-
arch/arm/mach-uniphier/boot-device/boot-device.c | 16 +++++-----------
arch/arm/mach-uniphier/boot-device/boot-device.h | 8 ++++----
5 files changed, 18 insertions(+), 22 deletions(-)
diff --git a/arch/arm/mach-uniphier/boot-device/boot-device-ld11.c b/arch/arm/mach-uniphier/boot-device/boot-device-ld11.c
index 11e70a926fc8..67650e0ae332 100644
--- a/arch/arm/mach-uniphier/boot-device/boot-device-ld11.c
+++ b/arch/arm/mach-uniphier/boot-device/boot-device-ld11.c
@@ -9,6 +9,7 @@
#include <linux/io.h>
#include <linux/kernel.h>
+#include "../sg-regs.h"
#include "boot-device.h"
const struct uniphier_boot_device uniphier_ld11_boot_device_table[] = {
@@ -49,12 +50,12 @@ const struct uniphier_boot_device uniphier_ld11_boot_device_table[] = {
const unsigned uniphier_ld11_boot_device_count =
ARRAY_SIZE(uniphier_ld11_boot_device_table);
-int uniphier_ld11_boot_device_is_usb(u32 pinmon)
+int uniphier_ld11_boot_device_is_usb(void)
{
- return !!(~pinmon & 0x00000080);
+ return !!(~readl(SG_PINMON0) & 0x00000080);
}
-int uniphier_ld20_boot_device_is_usb(u32 pinmon)
+int uniphier_ld20_boot_device_is_usb(void)
{
- return !!(~pinmon & 0x00000780);
+ return !!(~readl(SG_PINMON0) & 0x00000780);
}
diff --git a/arch/arm/mach-uniphier/boot-device/boot-device-pxs2.c b/arch/arm/mach-uniphier/boot-device/boot-device-pxs2.c
index 49c5da1469c7..f032664a0f34 100644
--- a/arch/arm/mach-uniphier/boot-device/boot-device-pxs2.c
+++ b/arch/arm/mach-uniphier/boot-device/boot-device-pxs2.c
@@ -9,6 +9,7 @@
#include <linux/io.h>
#include <linux/kernel.h>
+#include "../sg-regs.h"
#include "boot-device.h"
const struct uniphier_boot_device uniphier_pxs2_boot_device_table[] = {
@@ -49,9 +50,9 @@ const struct uniphier_boot_device uniphier_pxs2_boot_device_table[] = {
const unsigned uniphier_pxs2_boot_device_count =
ARRAY_SIZE(uniphier_pxs2_boot_device_table);
-int uniphier_pxs2_boot_device_is_usb(u32 pinmon)
+int uniphier_pxs2_boot_device_is_usb(void)
{
- return !!(pinmon & 0x00000040);
+ return !!(readl(SG_PINMON0) & 0x00000040);
}
unsigned int uniphier_pxs2_boot_device_fixup(unsigned int mode)
diff --git a/arch/arm/mach-uniphier/boot-device/boot-device-pxs3.c b/arch/arm/mach-uniphier/boot-device/boot-device-pxs3.c
index 01a72c035052..8de3737b2881 100644
--- a/arch/arm/mach-uniphier/boot-device/boot-device-pxs3.c
+++ b/arch/arm/mach-uniphier/boot-device/boot-device-pxs3.c
@@ -34,7 +34,7 @@ const struct uniphier_boot_device uniphier_pxs3_boot_device_table[] = {
const unsigned uniphier_pxs3_boot_device_count =
ARRAY_SIZE(uniphier_pxs3_boot_device_table);
-int uniphier_pxs3_boot_device_is_usb(u32 pinmon)
+int uniphier_pxs3_boot_device_is_usb(void)
{
return !!(readl(SG_PINMON2) & BIT(31));
}
diff --git a/arch/arm/mach-uniphier/boot-device/boot-device.c b/arch/arm/mach-uniphier/boot-device/boot-device.c
index 3c7643302d9e..20902c8a8bbb 100644
--- a/arch/arm/mach-uniphier/boot-device/boot-device.c
+++ b/arch/arm/mach-uniphier/boot-device/boot-device.c
@@ -20,7 +20,7 @@ struct uniphier_boot_device_info {
unsigned int boot_device_sel_shift;
const struct uniphier_boot_device *boot_device_table;
const unsigned int *boot_device_count;
- int (*boot_device_is_usb)(u32 pinmon);
+ int (*boot_device_is_usb)(void);
unsigned int (*boot_device_fixup)(unsigned int mode);
int have_internal_stm;
};
@@ -121,18 +121,15 @@ UNIPHIER_DEFINE_SOCDATA_FUNC(uniphier_get_boot_device_info,
static unsigned int __uniphier_boot_device_raw(
const struct uniphier_boot_device_info *info)
{
- u32 pinmon;
unsigned int boot_sel;
if (boot_is_swapped())
return BOOT_DEVICE_NOR;
- pinmon = readl(SG_PINMON0);
-
- if (info->boot_device_is_usb && info->boot_device_is_usb(pinmon))
+ if (info->boot_device_is_usb && info->boot_device_is_usb())
return BOOT_DEVICE_USB;
- boot_sel = pinmon >> info->boot_device_sel_shift;
+ boot_sel = readl(SG_PINMON0) >> info->boot_device_sel_shift;
BUG_ON(!is_power_of_2(*info->boot_device_count));
boot_sel &= *info->boot_device_count - 1;
@@ -193,7 +190,6 @@ int uniphier_boot_from_backend(void)
static int do_pinmon(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
const struct uniphier_boot_device_info *info;
- u32 pinmon;
unsigned int boot_device_count, boot_sel;
int i;
@@ -209,15 +205,13 @@ static int do_pinmon(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
printf("Boot Swap: %s\n", boot_is_swapped() ? "ON" : "OFF");
- pinmon = readl(SG_PINMON0);
-
if (info->boot_device_is_usb)
printf("USB Boot: %s\n",
- info->boot_device_is_usb(pinmon) ? "ON" : "OFF");
+ info->boot_device_is_usb() ? "ON" : "OFF");
boot_device_count = *info->boot_device_count;
- boot_sel = pinmon >> info->boot_device_sel_shift;
+ boot_sel = readl(SG_PINMON0) >> info->boot_device_sel_shift;
boot_sel &= boot_device_count - 1;
printf("\nBoot Mode Sel:\n");
diff --git a/arch/arm/mach-uniphier/boot-device/boot-device.h b/arch/arm/mach-uniphier/boot-device/boot-device.h
index bbb634316b3a..eeaf8a77eedc 100644
--- a/arch/arm/mach-uniphier/boot-device/boot-device.h
+++ b/arch/arm/mach-uniphier/boot-device/boot-device.h
@@ -24,10 +24,10 @@ extern const unsigned int uniphier_pxs2_boot_device_count;
extern const unsigned int uniphier_ld11_boot_device_count;
extern const unsigned int uniphier_pxs3_boot_device_count;
-int uniphier_pxs2_boot_device_is_usb(u32 pinmon);
-int uniphier_ld11_boot_device_is_usb(u32 pinmon);
-int uniphier_ld20_boot_device_is_usb(u32 pinmon);
-int uniphier_pxs3_boot_device_is_usb(u32 pinmon);
+int uniphier_pxs2_boot_device_is_usb(void);
+int uniphier_ld11_boot_device_is_usb(void);
+int uniphier_ld20_boot_device_is_usb(void);
+int uniphier_pxs3_boot_device_is_usb(void);
unsigned int uniphier_pxs2_boot_device_fixup(unsigned int mode);
--
2.17.1
More information about the U-Boot
mailing list