arm: add support for SoC s5p4418 (cpu) / nanopi2 board
Changes in relation to FriendlyARM's U-Boot nanopi2-v2016.01:
- SPL not supported yet --> no spl-dir in arch/arm/cpu/armv7/s5p4418/.
Appropriate line in Makefile removed.
- cpu.c: '#include <cpu_func.h>' added.
- arch/arm/cpu/armv7/s5p4418/u-boot.lds removed, is not required
anylonger.
- "obj-$(CONFIG_ARCH_NEXELL) += s5p-common/" added to
arch/arm/cpu/armv7/Makefile since s5p-common/pwm.c is used instead
of drivers/pwm/pwm-nexell.c.
- s5p4418.dtsi: '#include "../../../include/generated/autoconf.h"'
removed, is not necessary, error at out-of-tree building.
'#ifdef CONFIG_CPU_NXP4330'-blocks (2x) removed. Some minor changes
regarding mmc. 'u-boot,dm-pre-reloc' added to dp0 because of added
DM_VIDEO support.
- board/s5p4418/ renamed to board/friendlyarm/
- All s5p4418-boards except nanopi2 removed because there is no
possibility to test the other boards.
- Kconfig: Changes to have a structure like mach-bcm283x (RaspberryPi),
e.g. "config ..." entries moved from/to other Kconfig.
- "CONFIG_" removed from several s5p4418/nanopi2 specific defines
because the appropriate values do not need to be configurable.
- nanopi2/board.c: All getenv(), getenv_ulong(), setenv() and saveenv()
renamed to env_get(), env_get_ulong(), env_set() and env_save(),
respectively. MACH_TYPE_S5P4418 is not defined anymore, therefore
appropriate code removed (not necessary for DT-kernels).
- nanopi2/onewire.c: All crc8() renamed to crc8_ow() because crc8() is
already defined in lib/crc8.c (with different parameters).
- dts: "nexell,s5pxx18-i2c" used instead of "i2c-gpio", i2c0 and
i2c1 added. gmac-, ehci- and dwc2otg-entries removed because the
appropriate functionality is not supported yet. New mmc-property
"mmcboost" added.
s5p4418-pinctrl.dtsi: gmac-entries removed, mmc- and i2c-entries
added.
- '#ifdef CONFIG...' changed to 'if (IS_ENABLED(CONFIG...))' where
possible (and similar).
Signed-off-by: Stefan Bosch <stefan_b@posteo.net>
2020-07-10 17:07:37 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
/*
|
|
|
|
* Copyright (C) Guangzhou FriendlyARM Computer Tech. Co., Ltd.
|
|
|
|
* (http://www.friendlyarm.com)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
#include <common.h>
|
|
|
|
#include <i2c.h>
|
|
|
|
#include <asm/io.h>
|
|
|
|
|
|
|
|
#include <asm/arch/nexell.h>
|
|
|
|
#include <asm/arch/nx_gpio.h>
|
|
|
|
|
|
|
|
/* Board revision list: <PCB3 | PCB2 | PCB1>
|
|
|
|
* 0b000 - NanoPi 2
|
|
|
|
* 0b001 - NanoPC-T2
|
|
|
|
* 0b010 - NanoPi S2
|
|
|
|
* 0b011 - Smart4418
|
|
|
|
* 0b100 - NanoPi Fire 2A
|
|
|
|
* 0b111 - NanoPi M2A
|
|
|
|
*
|
|
|
|
* Extented revision:
|
|
|
|
* 0b001 - Smart4418-SDK
|
|
|
|
*/
|
|
|
|
#define __IO_GRP 2 /* GPIO_C */
|
|
|
|
#define __IO_PCB1 26
|
|
|
|
#define __IO_PCB2 27
|
|
|
|
#define __IO_PCB3 25
|
|
|
|
|
|
|
|
static int pcb_rev = -1;
|
|
|
|
static int base_rev;
|
|
|
|
|
|
|
|
static void bd_hwrev_config_gpio(void)
|
|
|
|
{
|
|
|
|
int gpios[3][2] = {
|
|
|
|
{ __IO_PCB1, 1 },
|
|
|
|
{ __IO_PCB2, 1 },
|
|
|
|
{ __IO_PCB3, 1 },
|
|
|
|
};
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* gpio input mode, pull-down */
|
|
|
|
for (i = 0; i < 3; i++) {
|
|
|
|
nx_gpio_set_pad_function(__IO_GRP, gpios[i][0], gpios[i][1]);
|
|
|
|
nx_gpio_set_output_enable(__IO_GRP, gpios[i][0], 0);
|
|
|
|
nx_gpio_set_pull_mode(__IO_GRP, gpios[i][0], 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void bd_hwrev_init(void)
|
|
|
|
{
|
|
|
|
if (pcb_rev >= 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
bd_hwrev_config_gpio();
|
|
|
|
|
|
|
|
pcb_rev = nx_gpio_get_input_value(__IO_GRP, __IO_PCB1);
|
|
|
|
pcb_rev |= nx_gpio_get_input_value(__IO_GRP, __IO_PCB2) << 1;
|
|
|
|
pcb_rev |= nx_gpio_get_input_value(__IO_GRP, __IO_PCB3) << 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Get extended revision for SmartXX18 */
|
|
|
|
void bd_base_rev_init(void)
|
|
|
|
{
|
|
|
|
struct udevice *dev;
|
|
|
|
u8 val = 0;
|
|
|
|
|
|
|
|
if (pcb_rev != 0x3)
|
|
|
|
return;
|
|
|
|
|
|
|
|
#define PCA9536_I2C_BUS 2
|
|
|
|
#define PCA9636_I2C_ADDR 0x41
|
|
|
|
if (i2c_get_chip_for_busnum
|
|
|
|
(PCA9536_I2C_BUS, PCA9636_I2C_ADDR, 1, &dev))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!dm_i2c_read(dev, 0, &val, 1))
|
|
|
|
base_rev = (val & 0xf);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* To override __weak symbols */
|
arm: Disable ATAGs support
With the exceptions of ds109, ds414, icnova-a20-swac, nokia_rx51 and
stemmy, disable ATAG support. A large number of platforms had enabled
support but never supported a kernel so old as to require it. Further,
some platforms are old enough to support both, but are well supported by
devicetree booting, and have been for a number of years. This is
because some of the ATAGs related functions have been re-used to provide
the same kind of information, but for devicetree or just generally to
inform the user. When needed still, rename these functions to
get_board_revision() instead, to avoid conflicts. In other cases, these
functions were simply unused, so drop them.
Cc: Andre Przywara <andre.przywara@arm.com>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Phil Sutter <phil@nwl.cc>
Cc: Stefan Bosch <stefan_b@posteo.net>
Signed-off-by: Tom Rini <trini@konsulko.com>
2021-08-30 13:16:30 +00:00
|
|
|
u32 get_board_revision(void)
|
arm: add support for SoC s5p4418 (cpu) / nanopi2 board
Changes in relation to FriendlyARM's U-Boot nanopi2-v2016.01:
- SPL not supported yet --> no spl-dir in arch/arm/cpu/armv7/s5p4418/.
Appropriate line in Makefile removed.
- cpu.c: '#include <cpu_func.h>' added.
- arch/arm/cpu/armv7/s5p4418/u-boot.lds removed, is not required
anylonger.
- "obj-$(CONFIG_ARCH_NEXELL) += s5p-common/" added to
arch/arm/cpu/armv7/Makefile since s5p-common/pwm.c is used instead
of drivers/pwm/pwm-nexell.c.
- s5p4418.dtsi: '#include "../../../include/generated/autoconf.h"'
removed, is not necessary, error at out-of-tree building.
'#ifdef CONFIG_CPU_NXP4330'-blocks (2x) removed. Some minor changes
regarding mmc. 'u-boot,dm-pre-reloc' added to dp0 because of added
DM_VIDEO support.
- board/s5p4418/ renamed to board/friendlyarm/
- All s5p4418-boards except nanopi2 removed because there is no
possibility to test the other boards.
- Kconfig: Changes to have a structure like mach-bcm283x (RaspberryPi),
e.g. "config ..." entries moved from/to other Kconfig.
- "CONFIG_" removed from several s5p4418/nanopi2 specific defines
because the appropriate values do not need to be configurable.
- nanopi2/board.c: All getenv(), getenv_ulong(), setenv() and saveenv()
renamed to env_get(), env_get_ulong(), env_set() and env_save(),
respectively. MACH_TYPE_S5P4418 is not defined anymore, therefore
appropriate code removed (not necessary for DT-kernels).
- nanopi2/onewire.c: All crc8() renamed to crc8_ow() because crc8() is
already defined in lib/crc8.c (with different parameters).
- dts: "nexell,s5pxx18-i2c" used instead of "i2c-gpio", i2c0 and
i2c1 added. gmac-, ehci- and dwc2otg-entries removed because the
appropriate functionality is not supported yet. New mmc-property
"mmcboost" added.
s5p4418-pinctrl.dtsi: gmac-entries removed, mmc- and i2c-entries
added.
- '#ifdef CONFIG...' changed to 'if (IS_ENABLED(CONFIG...))' where
possible (and similar).
Signed-off-by: Stefan Bosch <stefan_b@posteo.net>
2020-07-10 17:07:37 +00:00
|
|
|
{
|
|
|
|
return (base_rev << 8) | pcb_rev;
|
|
|
|
}
|
|
|
|
|
arm: Disable ATAGs support
With the exceptions of ds109, ds414, icnova-a20-swac, nokia_rx51 and
stemmy, disable ATAG support. A large number of platforms had enabled
support but never supported a kernel so old as to require it. Further,
some platforms are old enough to support both, but are well supported by
devicetree booting, and have been for a number of years. This is
because some of the ATAGs related functions have been re-used to provide
the same kind of information, but for devicetree or just generally to
inform the user. When needed still, rename these functions to
get_board_revision() instead, to avoid conflicts. In other cases, these
functions were simply unused, so drop them.
Cc: Andre Przywara <andre.przywara@arm.com>
Cc: Jagan Teki <jagan@amarulasolutions.com>
Cc: Phil Sutter <phil@nwl.cc>
Cc: Stefan Bosch <stefan_b@posteo.net>
Signed-off-by: Tom Rini <trini@konsulko.com>
2021-08-30 13:16:30 +00:00
|
|
|
#ifdef CONFIG_REVISION_TAG
|
|
|
|
u32 get_board_rev(void)
|
|
|
|
{
|
|
|
|
return get_board_revision();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
arm: add support for SoC s5p4418 (cpu) / nanopi2 board
Changes in relation to FriendlyARM's U-Boot nanopi2-v2016.01:
- SPL not supported yet --> no spl-dir in arch/arm/cpu/armv7/s5p4418/.
Appropriate line in Makefile removed.
- cpu.c: '#include <cpu_func.h>' added.
- arch/arm/cpu/armv7/s5p4418/u-boot.lds removed, is not required
anylonger.
- "obj-$(CONFIG_ARCH_NEXELL) += s5p-common/" added to
arch/arm/cpu/armv7/Makefile since s5p-common/pwm.c is used instead
of drivers/pwm/pwm-nexell.c.
- s5p4418.dtsi: '#include "../../../include/generated/autoconf.h"'
removed, is not necessary, error at out-of-tree building.
'#ifdef CONFIG_CPU_NXP4330'-blocks (2x) removed. Some minor changes
regarding mmc. 'u-boot,dm-pre-reloc' added to dp0 because of added
DM_VIDEO support.
- board/s5p4418/ renamed to board/friendlyarm/
- All s5p4418-boards except nanopi2 removed because there is no
possibility to test the other boards.
- Kconfig: Changes to have a structure like mach-bcm283x (RaspberryPi),
e.g. "config ..." entries moved from/to other Kconfig.
- "CONFIG_" removed from several s5p4418/nanopi2 specific defines
because the appropriate values do not need to be configurable.
- nanopi2/board.c: All getenv(), getenv_ulong(), setenv() and saveenv()
renamed to env_get(), env_get_ulong(), env_set() and env_save(),
respectively. MACH_TYPE_S5P4418 is not defined anymore, therefore
appropriate code removed (not necessary for DT-kernels).
- nanopi2/onewire.c: All crc8() renamed to crc8_ow() because crc8() is
already defined in lib/crc8.c (with different parameters).
- dts: "nexell,s5pxx18-i2c" used instead of "i2c-gpio", i2c0 and
i2c1 added. gmac-, ehci- and dwc2otg-entries removed because the
appropriate functionality is not supported yet. New mmc-property
"mmcboost" added.
s5p4418-pinctrl.dtsi: gmac-entries removed, mmc- and i2c-entries
added.
- '#ifdef CONFIG...' changed to 'if (IS_ENABLED(CONFIG...))' where
possible (and similar).
Signed-off-by: Stefan Bosch <stefan_b@posteo.net>
2020-07-10 17:07:37 +00:00
|
|
|
const char *get_board_name(void)
|
|
|
|
{
|
|
|
|
bd_hwrev_init();
|
|
|
|
|
|
|
|
switch (pcb_rev) {
|
|
|
|
case 0:
|
|
|
|
return "NanoPi 2";
|
|
|
|
case 1:
|
|
|
|
return "NanoPC-T2";
|
|
|
|
case 2:
|
|
|
|
return "NanoPi S2";
|
|
|
|
case 3:
|
|
|
|
return "Smart4418";
|
|
|
|
case 4:
|
|
|
|
return "NanoPi Fire 2A";
|
|
|
|
case 7:
|
|
|
|
return "NanoPi M2A";
|
|
|
|
default:
|
|
|
|
return "s5p4418-X";
|
|
|
|
}
|
|
|
|
}
|