U-Boot
Threads by month
- ----- 2025 -----
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2000 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
August 2015
- 206 participants
- 793 discussions

18 Aug '15
From: Hou Zhiqiang <B48286(a)freescale.com>
The clear flag status register operation was required by Micron
SPI flash chips, which support FSR. And if an error bit of FSR
have been set, it must be cleared by the clear FSR operation.
Signed-off-by: Hou Zhiqiang <B48286(a)freescale.com>
Signed-off-by: Mingkai.Hu <Mingkai.Hu(a)freescale.com>
---
Tested on T1042RDB board.
V6:
Generate the patch based on the latest wait ready logic.
Depend on patch http://patchwork.ozlabs.org/patch/508166/
V5:
1. Removed #ifdef for STMICRO.
2. Add checking Protection and Voltage error bits.
3. Only if there is any error bit set, issue the clear FSR command.
V4:
Split the the patch to 2 patches for clear FSR and SPI flash address mode.
V3:
Generate the patch based on the latest tree git://git.denx.de/u-boot.git.
V2:
Add the operation of enter 3 Byte address mode in probe.
V1:
Based on git://git.denx.de/u-boot.git.
drivers/mtd/spi/sf_internal.h | 15 +++++++++++++++
drivers/mtd/spi/sf_ops.c | 7 +++++++
2 files changed, 22 insertions(+)
diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index 8a3e5ec..fc6d751 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -82,6 +82,7 @@ enum spi_nor_option_flags {
#define CMD_WRITE_ENABLE 0x06
#define CMD_READ_CONFIG 0x35
#define CMD_FLAG_STATUS 0x70
+#define CMD_CLEAR_FLAG_STATUS 0x50
/* Read commands */
#define CMD_READ_ARRAY_SLOW 0x03
@@ -104,7 +105,15 @@ enum spi_nor_option_flags {
#define STATUS_WIP (1 << 0)
#define STATUS_QEB_WINSPAN (1 << 1)
#define STATUS_QEB_MXIC (1 << 6)
+
+/* Flag status for STMICRO */
+#define STATUS_PROT_ERR (1 << 1)
+#define STATUS_VOLT_ERR (1 << 3)
+#define STATUS_PROG_ERR (1 << 4)
+#define STATUS_ERASE_ERR (1 << 5)
#define STATUS_PEC (1 << 7)
+#define FLAG_ERR_MASK (STATUS_PROT_ERR | STATUS_VOLT_ERR | \
+ STATUS_PROG_ERR | STATUS_ERASE_ERR)
/* Flash timeout values */
#define SPI_FLASH_PROG_TIMEOUT (2 * CONFIG_SYS_HZ)
@@ -191,6 +200,12 @@ static inline int spi_flash_cmd_write_disable(struct spi_flash *flash)
return spi_flash_cmd(flash->spi, CMD_WRITE_DISABLE, NULL, 0);
}
+/* Clear flag status register */
+static inline int spi_flash_cmd_clear_flag_status(struct spi_flash *flash)
+{
+ return spi_flash_cmd(flash->spi, CMD_CLEAR_FLAG_STATUS, NULL, 0);
+}
+
/*
* Send the read status command to the device and wait for the wip
* (write-in-progress) bit to clear itself.
diff --git a/drivers/mtd/spi/sf_ops.c b/drivers/mtd/spi/sf_ops.c
index ba5ff0c..78ef08b 100644
--- a/drivers/mtd/spi/sf_ops.c
+++ b/drivers/mtd/spi/sf_ops.c
@@ -174,6 +174,13 @@ static inline int spi_flash_fsr_ready(struct spi_flash *flash)
if (ret < 0)
return ret;
+ if (fsr & FLAG_ERR_MASK) {
+ printf("SF: flag status(0x%x) error occured\n", fsr);
+ ret = spi_flash_cmd_clear_flag_status(flash);
+ if (ret < 0)
+ printf("SF: clear flag status failed\n");
+ return -1;
+ }
return fsr & STATUS_PEC;
}
--
2.1.0.27.g96db324
2
1
From: Hou Zhiqiang <B48286(a)freescale.com>
It doesn't make sense to compare a 'u8' element with Zero.
Signed-off-by: Hou Zhiqiang <B48286(a)freescale.com>
---
drivers/mtd/spi/sf_ops.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/mtd/spi/sf_ops.c b/drivers/mtd/spi/sf_ops.c
index a5487ad..ba5ff0c 100644
--- a/drivers/mtd/spi/sf_ops.c
+++ b/drivers/mtd/spi/sf_ops.c
@@ -162,10 +162,7 @@ static inline int spi_flash_sr_ready(struct spi_flash *flash)
if (ret < 0)
return ret;
- if (sr < 0)
- return sr;
- else
- return !(sr & STATUS_WIP);
+ return !(sr & STATUS_WIP);
}
static inline int spi_flash_fsr_ready(struct spi_flash *flash)
@@ -177,10 +174,7 @@ static inline int spi_flash_fsr_ready(struct spi_flash *flash)
if (ret < 0)
return ret;
- if (fsr < 0)
- return fsr;
- else
- return fsr & STATUS_PEC;
+ return fsr & STATUS_PEC;
}
static int spi_flash_ready(struct spi_flash *flash)
--
2.1.0.27.g96db324
2
1
taurus changes:
- rename at91_spl_board_init to spl_board_init
fixes problems with recovery button and nand erase sector 0
- adapt CONFIG_SPL_MAX_SIZE and CONFIG_SPL_BSS_MAX_SIZE
- add CONFIG_AT91_HW_WDT_TIMEOUT 15
- CONFIG_SF_DEFAULT_MODE SPI_MODE_3 not mode 0
Signed-off-by: Heiko Schocher <hs(a)denx.de>
---
board/siemens/taurus/taurus.c | 8 +++-----
include/configs/taurus.h | 13 +++++++------
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/board/siemens/taurus/taurus.c b/board/siemens/taurus/taurus.c
index 554a0c2..d10411c 100644
--- a/board/siemens/taurus/taurus.c
+++ b/board/siemens/taurus/taurus.c
@@ -79,7 +79,7 @@ void matrix_init(void)
&mat->scfg[3]);
}
-void at91_spl_board_init(void)
+void spl_board_init(void)
{
taurus_nand_hw_init();
at91_spi0_hw_init(TAURUS_SPI_MASK);
@@ -92,9 +92,7 @@ void at91_spl_board_init(void)
at91_set_gpio_output(AT91_PIN_PA10, 0);
at91_set_gpio_output(AT91_PIN_PA11, 0);
at91_set_gpio_output(AT91_PIN_PA12, 0);
-#endif
-#if defined(CONFIG_BOARD_AXM)
/* Configure recovery button PINs */
at91_set_gpio_input(AT91_PIN_PA26, 1);
at91_set_gpio_input(AT91_PIN_PA27, 1);
@@ -113,13 +111,13 @@ void at91_spl_board_init(void)
#endif
struct spi_flash *flash;
- debug("Recovery button pressed\n");
+ puts("Recovery button pressed\n");
nand_init();
spl_nand_erase_one(0, 0);
flash = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
0,
CONFIG_SF_DEFAULT_SPEED,
- SPI_MODE_3);
+ CONFIG_SF_DEFAULT_MODE);
if (!flash) {
puts("no flash\n");
} else {
diff --git a/include/configs/taurus.h b/include/configs/taurus.h
index 6d18f2f..dd35a8f 100644
--- a/include/configs/taurus.h
+++ b/include/configs/taurus.h
@@ -95,7 +95,7 @@
* leaving the correct space for initial global data structure above
* that address while providing maximum stack area below.
*/
-# define CONFIG_SYS_INIT_SP_ADDR \
+#define CONFIG_SYS_INIT_SP_ADDR \
(ATMEL_BASE_SRAM1 + 0x1000 - GENERATED_GBL_DATA_SIZE)
/* NAND flash */
@@ -119,6 +119,7 @@
#define CONFIG_AT91_WANTS_COMMON_PHY
#define CONFIG_AT91SAM9_WATCHDOG
+#define CONFIG_AT91_HW_WDT_TIMEOUT 15
#if !defined(CONFIG_SPL_BUILD)
/* Enable the watchdog */
#define CONFIG_HW_WATCHDOG
@@ -154,8 +155,8 @@
#define CONFIG_SYS_SPI_U_BOOT_OFFS 0x20000
#define CONFIG_SF_DEFAULT_BUS 0
-#define CONFIG_SF_DEFAULT_SPEED 10000000
-#define CONFIG_SF_DEFAULT_MODE SPI_MODE_0
+#define CONFIG_SF_DEFAULT_SPEED 1000000
+#define CONFIG_SF_DEFAULT_MODE SPI_MODE_3
#endif
/* load address */
@@ -255,14 +256,14 @@
/* Defines for SPL */
#define CONFIG_SPL_FRAMEWORK
#define CONFIG_SPL_TEXT_BASE 0x0
-#define CONFIG_SPL_MAX_SIZE (15 * 1024)
-#define CONFIG_SPL_STACK (16 * 1024)
+#define CONFIG_SPL_MAX_SIZE (29 * 512)
+#define CONFIG_SPL_STACK (ATMEL_BASE_SRAM1 + 0x4000)
#define CONFIG_SYS_SPL_MALLOC_START (CONFIG_SYS_TEXT_BASE - \
CONFIG_SYS_MALLOC_LEN)
#define CONFIG_SYS_SPL_MALLOC_SIZE CONFIG_SYS_MALLOC_LEN
#define CONFIG_SPL_BSS_START_ADDR CONFIG_SPL_MAX_SIZE
-#define CONFIG_SPL_BSS_MAX_SIZE (3 * 1024)
+#define CONFIG_SPL_BSS_MAX_SIZE (3 * 512)
#define CONFIG_SPL_LIBCOMMON_SUPPORT
#define CONFIG_SPL_LIBGENERIC_SUPPORT
--
2.1.0
2
2
Signed-off-by: Mingkai Hu <Mingkai.Hu(a)freescale.com>
---
drivers/net/e1000.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
index d5d48b1..e816410 100644
--- a/drivers/net/e1000.c
+++ b/drivers/net/e1000.c
@@ -4980,8 +4980,8 @@ e1000_configure_tx(struct e1000_hw *hw)
unsigned long tipg, tarc;
uint32_t ipgr1, ipgr2;
- E1000_WRITE_REG(hw, TDBAL, (unsigned long)tx_base);
- E1000_WRITE_REG(hw, TDBAH, 0);
+ E1000_WRITE_REG(hw, TDBAL, (unsigned long)tx_base & 0xffffffff);
+ E1000_WRITE_REG(hw, TDBAH, (unsigned long)tx_base >> 32);
E1000_WRITE_REG(hw, TDLEN, 128);
@@ -5124,8 +5124,8 @@ e1000_configure_rx(struct e1000_hw *hw)
E1000_WRITE_FLUSH(hw);
}
/* Setup the Base and Length of the Rx Descriptor Ring */
- E1000_WRITE_REG(hw, RDBAL, (unsigned long)rx_base);
- E1000_WRITE_REG(hw, RDBAH, 0);
+ E1000_WRITE_REG(hw, RDBAL, (unsigned long)rx_base & 0xffffffff);
+ E1000_WRITE_REG(hw, RDBAH, (unsigned long)rx_base >> 32);
E1000_WRITE_REG(hw, RDLEN, 128);
--
2.1.0.27.g96db324
3
2

Re: [U-Boot] [U-BOOT PATCH v3 2/4] x86: Added support for ACPI table generation at the generic layer.
by Bin Meng 18 Aug '15
by Bin Meng 18 Aug '15
18 Aug '15
+ML
Hi Saket,
On Sun, Aug 16, 2015 at 5:39 AM, Saket Sinha <saket.sinha89(a)gmail.com> wrote:
> Hi Bin,
>
> Please find my response inline.
>
> On Thu, Aug 13, 2015 at 3:31 PM, Bin Meng <bmeng.cn(a)gmail.com> wrote:
>> Hi Saket,
>>
>> On Thu, Aug 13, 2015 at 11:01 AM, Saket Sinha <saket.sinha89(a)gmail.com> wrote:
>>
>> Please see my comments in your [1/4] patch regarding to patch title
>> and commit message.
>>
>
> Addressed in patchset series v4.
>
>>> Signed-off-by: Saket Sinha <saket.sinha89(a)gmail.com>
>>> ---
>>>
>>> arch/x86/include/asm/acpi_table.h | 387 +++++++++++++++++++++++++++++++++++
>>> arch/x86/lib/Makefile | 1 +
>>> arch/x86/lib/acpi_table.c | 413 ++++++++++++++++++++++++++++++++++++++
>>> arch/x86/lib/tables.c | 5 +
>>> scripts/Makefile.lib | 11 +
>>> 5 files changed, 817 insertions(+)
>>> create mode 100644 arch/x86/include/asm/acpi_table.h
>>> create mode 100644 arch/x86/lib/acpi_table.c
>>>
[snip]
>
>>> +
>>> diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
>>> index dcfe9ee..6ecd6db 100644
>>> --- a/arch/x86/lib/Makefile
>>> +++ b/arch/x86/lib/Makefile
>>> @@ -30,6 +30,7 @@ obj-y += physmem.o
>>> obj-$(CONFIG_X86_RAMTEST) += ramtest.o
>>> obj-y += sfi.o
>>> obj-y += string.o
>>> +obj-$(CONFIG_GENERATE_ACPI_TABLE) += acpi_table.o
>>> obj-y += tables.o
>>> obj-$(CONFIG_SYS_X86_TSC_TIMER) += tsc_timer.o
>>> obj-$(CONFIG_CMD_ZBOOT) += zimage.o
>>> diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
>>> new file mode 100644
>>> index 0000000..2e20317
>>> --- /dev/null
>>> +++ b/arch/x86/lib/acpi_table.c
>>> @@ -0,0 +1,413 @@
>>> +/*
>>> + * Copyright (C) 2015, Saket Sinha <saket.sinha89(a)gmail.com>
>>> + *
>>
>> Please add comments to give others some hints on where this file is ported from.
>>
>
> Yes. Addressed in patchset series v4.
>
>>> + * SPDX-License-Identifier: GPL-2.0+
>>> + */
>>> +
>>> +#include <asm/acpi_table.h>
>>> +#include <asm/cpu.h>
>>> +#include <asm/ioapic.h>
>>> +#include <asm/lapic.h>
>>> +#include <asm/tables.h>
>>> +#include <asm/pci.h>
>>> +#include <cpu.h>
>>> +#include <dm.h>
>>> +#include <dm/uclass-internal.h>
>>> +#include <dm/lists.h>
>>> +
>>> +extern const unsigned char AmlCode[];
>>
>> Can we avoid using CamelCase here?
>>
>
> No.
> iasl -tc dumps the aamlcode into an array called AmlCode[]. I do not
> see any option to change that.
>
> Kindly refer official iasl documntation at below link -
> https://github.com/disdi/ACPI/blob/master/aslcompiler.pdf - Section
> 6.4.2 Output of –tc (make C hex table) Option
>
Please add a comment block to explain this is required by the IASL and
we cannot rename it to conform U-Boot coding convention.
[snip]
Regards,
Bin
1
0

[U-Boot] [PATCH 1/2] RFT: arm: Switch 32-bit ARM to using generic global_data setup
by Simon Glass 18 Aug '15
by Simon Glass 18 Aug '15
18 Aug '15
There is quite a bit of assembler code that can be removed if we use the
generic global_data setup. Less arch-specific code makes it easier to add
new features and maintain the start-up code.
Drop the unneeded code and adjust the hooks in board_f.c to cope.
Signed-off-by: Simon Glass <sjg(a)chromium.org>
---
arch/arm/lib/crt0.S | 28 ++++------------------------
1 file changed, 4 insertions(+), 24 deletions(-)
diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S
index afd4f10..fc1252d 100644
--- a/arch/arm/lib/crt0.S
+++ b/arch/arm/lib/crt0.S
@@ -76,31 +76,11 @@ ENTRY(_main)
#else
bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
#endif
- mov r2, sp
- sub sp, sp, #GD_SIZE /* allocate one GD above SP */
-#if defined(CONFIG_CPU_V7M) /* v7M forbids using SP as BIC destination */
- mov r3, sp
- bic r3, r3, #7
- mov sp, r3
-#else
- bic sp, sp, #7 /* 8-byte alignment for ABI compliance */
-#endif
- mov r9, sp /* GD is above SP */
- mov r1, sp
+ mov r0, sp
+ bl board_init_f_mem
+ mov sp, r0
+
mov r0, #0
-clr_gd:
- cmp r1, r2 /* while not at end of GD */
-#if defined(CONFIG_CPU_V7M)
- itt lo
-#endif
- strlo r0, [r1] /* clear 32-bit GD word */
- addlo r1, r1, #4 /* move to next */
- blo clr_gd
-#if defined(CONFIG_SYS_MALLOC_F_LEN)
- sub sp, sp, #CONFIG_SYS_MALLOC_F_LEN
- str sp, [r9, #GD_MALLOC_BASE]
-#endif
- /* mov r0, #0 not needed due to above code */
bl board_init_f
#if ! defined(CONFIG_SPL_BUILD)
--
2.5.0.276.gf5e568e
1
1

18 Aug '15
This has not been converted to Generic Board, so should be removed.
(See doc/README.generic-board for details.)
Signed-off-by: Masahiro Yamada <yamada.masahiro(a)socionext.com>
Cc: Heiko Schocher <hs(a)denx.de>
---
arch/arm/mach-davinci/Kconfig | 5 -
board/ait/cam_enc_4xx/Kconfig | 12 -
board/ait/cam_enc_4xx/MAINTAINERS | 6 -
board/ait/cam_enc_4xx/Makefile | 10 -
board/ait/cam_enc_4xx/cam_enc_4xx.c | 1106 ----------------------------------
board/ait/cam_enc_4xx/config.mk | 20 -
board/ait/cam_enc_4xx/u-boot-spl.lds | 57 --
board/ait/cam_enc_4xx/ublimage.cfg | 31 -
configs/cam_enc_4xx_defconfig | 10 -
doc/README.scrapyard | 1 +
include/configs/cam_enc_4xx.h | 504 ----------------
11 files changed, 1 insertion(+), 1761 deletions(-)
delete mode 100644 board/ait/cam_enc_4xx/Kconfig
delete mode 100644 board/ait/cam_enc_4xx/MAINTAINERS
delete mode 100644 board/ait/cam_enc_4xx/Makefile
delete mode 100644 board/ait/cam_enc_4xx/cam_enc_4xx.c
delete mode 100644 board/ait/cam_enc_4xx/config.mk
delete mode 100644 board/ait/cam_enc_4xx/u-boot-spl.lds
delete mode 100644 board/ait/cam_enc_4xx/ublimage.cfg
delete mode 100644 configs/cam_enc_4xx_defconfig
delete mode 100644 include/configs/cam_enc_4xx.h
diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index e6cb390..681270d 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -18,10 +18,6 @@ config TARGET_DA850EVM
bool "DA850 EVM board"
select SUPPORT_SPL
-config TARGET_CAM_ENC_4XX
- bool "CAM ENC 4xx board"
- select SUPPORT_SPL
-
config TARGET_OMAPL138_LCDK
bool "OMAPL138 LCDK"
select SUPPORT_SPL
@@ -62,7 +58,6 @@ config SYS_SOC
default "davinci"
source "board/enbw/enbw_cmc/Kconfig"
-source "board/ait/cam_enc_4xx/Kconfig"
source "board/Barix/ipam390/Kconfig"
source "board/davinci/da8xxevm/Kconfig"
source "board/davinci/dm355evm/Kconfig"
diff --git a/board/ait/cam_enc_4xx/Kconfig b/board/ait/cam_enc_4xx/Kconfig
deleted file mode 100644
index 64e18f4..0000000
--- a/board/ait/cam_enc_4xx/Kconfig
+++ /dev/null
@@ -1,12 +0,0 @@
-if TARGET_CAM_ENC_4XX
-
-config SYS_BOARD
- default "cam_enc_4xx"
-
-config SYS_VENDOR
- default "ait"
-
-config SYS_CONFIG_NAME
- default "cam_enc_4xx"
-
-endif
diff --git a/board/ait/cam_enc_4xx/MAINTAINERS b/board/ait/cam_enc_4xx/MAINTAINERS
deleted file mode 100644
index d6477c6..0000000
--- a/board/ait/cam_enc_4xx/MAINTAINERS
+++ /dev/null
@@ -1,6 +0,0 @@
-CAM_ENC_4XX BOARD
-M: Heiko Schocher <hs(a)denx.de>
-S: Maintained
-F: board/ait/cam_enc_4xx/
-F: include/configs/cam_enc_4xx.h
-F: configs/cam_enc_4xx_defconfig
diff --git a/board/ait/cam_enc_4xx/Makefile b/board/ait/cam_enc_4xx/Makefile
deleted file mode 100644
index 0d03ce0..0000000
--- a/board/ait/cam_enc_4xx/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# (C) Copyright 2000, 2001, 2002
-# Wolfgang Denk, DENX Software Engineering, wd(a)denx.de.
-#
-# Copyright (C) 2007 Sergey Kubushyn <ksi(a)koi8.net>
-#
-# SPDX-License-Identifier: GPL-2.0+
-#
-
-obj-y := cam_enc_4xx.o
diff --git a/board/ait/cam_enc_4xx/cam_enc_4xx.c b/board/ait/cam_enc_4xx/cam_enc_4xx.c
deleted file mode 100644
index c5687ba..0000000
--- a/board/ait/cam_enc_4xx/cam_enc_4xx.c
+++ /dev/null
@@ -1,1106 +0,0 @@
-/*
- * Copyright (C) 2009 Texas Instruments Incorporated
- *
- * Copyright (C) 2011
- * Heiko Schocher, DENX Software Engineering, hs(a)denx.de.
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#include <common.h>
-#include <cli.h>
-#include <errno.h>
-#include <linux/mtd/nand.h>
-#include <nand.h>
-#include <miiphy.h>
-#include <netdev.h>
-#include <asm/io.h>
-#include <asm/arch/hardware.h>
-#include <asm/ti-common/davinci_nand.h>
-#include <asm/arch/davinci_misc.h>
-#ifdef CONFIG_DAVINCI_MMC
-#include <mmc.h>
-#include <asm/arch/sdmmc_defs.h>
-#endif
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#ifndef CONFIG_SPL_BUILD
-static struct davinci_timer *timer =
- (struct davinci_timer *)DAVINCI_TIMER3_BASE;
-
-static unsigned long get_timer_val(void)
-{
- unsigned long now = readl(&timer->tim34);
-
- return now;
-}
-
-static int timer_running(void)
-{
- return readl(&timer->tcr) &
- (DV_TIMER_TCR_ENAMODE_MASK << DV_TIMER_TCR_ENAMODE34_SHIFT);
-}
-
-static void stop_timer(void)
-{
- writel(0x0, &timer->tcr);
- return;
-}
-
-int checkboard(void)
-{
- printf("Board: AIT CAM ENC 4XX\n");
- return 0;
-}
-
-int board_init(void)
-{
- gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
-
- return 0;
-}
-
-#ifdef CONFIG_DRIVER_TI_EMAC
-static int cam_enc_4xx_check_network(void)
-{
- char *s;
-
- s = getenv("ethaddr");
- if (!s)
- return -EINVAL;
-
- if (!is_valid_ethaddr((const u8 *)s))
- return -EINVAL;
-
- s = getenv("ipaddr");
- if (!s)
- return -EINVAL;
-
- s = getenv("netmask");
- if (!s)
- return -EINVAL;
-
- s = getenv("serverip");
- if (!s)
- return -EINVAL;
-
- s = getenv("gatewayip");
- if (!s)
- return -EINVAL;
-
- return 0;
-}
-int board_eth_init(bd_t *bis)
-{
- int ret;
-
- ret = cam_enc_4xx_check_network();
- if (ret)
- return ret;
-
- davinci_emac_initialize();
-
- return 0;
-}
-#endif
-
-#ifdef CONFIG_NAND_DAVINCI
-static int
-davinci_std_read_page_syndrome(struct mtd_info *mtd, struct nand_chip *chip,
- uint8_t *buf, int oob_required, int page)
-{
- struct nand_chip *this = mtd->priv;
- int i, eccsize = chip->ecc.size;
- int eccbytes = chip->ecc.bytes;
- int eccsteps = chip->ecc.steps;
- uint8_t *p = buf;
- uint8_t *oob = chip->oob_poi;
-
- chip->cmdfunc(mtd, NAND_CMD_READOOB, 0x0, page & this->pagemask);
-
- chip->read_buf(mtd, oob, mtd->oobsize);
-
- chip->cmdfunc(mtd, NAND_CMD_READ0, 0x0, page & this->pagemask);
-
-
- for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
- int stat;
-
- chip->ecc.hwctl(mtd, NAND_ECC_READ);
- chip->read_buf(mtd, p, eccsize);
- chip->ecc.hwctl(mtd, NAND_ECC_READSYN);
-
- if (chip->ecc.prepad)
- oob += chip->ecc.prepad;
-
- stat = chip->ecc.correct(mtd, p, oob, NULL);
-
- if (stat == -1)
- mtd->ecc_stats.failed++;
- else
- mtd->ecc_stats.corrected += stat;
-
- oob += eccbytes;
-
- if (chip->ecc.postpad)
- oob += chip->ecc.postpad;
- }
-
- /* Calculate remaining oob bytes */
- i = mtd->oobsize - (oob - chip->oob_poi);
- if (i)
- chip->read_buf(mtd, oob, i);
-
- return 0;
-}
-
-static int davinci_std_write_page_syndrome(struct mtd_info *mtd,
- struct nand_chip *chip, const uint8_t *buf,
- int oob_required)
-{
- unsigned char davinci_ecc_buf[NAND_MAX_OOBSIZE];
- struct nand_chip *this = mtd->priv;
- int i, eccsize = chip->ecc.size;
- int eccbytes = chip->ecc.bytes;
- int eccsteps = chip->ecc.steps;
- int chunk = chip->ecc.bytes + chip->ecc.prepad + chip->ecc.postpad;
- int offset = 0;
- const uint8_t *p = buf;
- uint8_t *oob = chip->oob_poi;
-
- for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
- chip->ecc.hwctl(mtd, NAND_ECC_WRITE);
- chip->write_buf(mtd, p, eccsize);
-
- /* Calculate ECC without prepad */
- chip->ecc.calculate(mtd, p, oob + chip->ecc.prepad);
-
- if (chip->ecc.prepad) {
- offset = (chip->ecc.steps - eccsteps) * chunk;
- memcpy(&davinci_ecc_buf[offset], oob, chip->ecc.prepad);
- oob += chip->ecc.prepad;
- }
-
- offset = ((chip->ecc.steps - eccsteps) * chunk) +
- chip->ecc.prepad;
- memcpy(&davinci_ecc_buf[offset], oob, eccbytes);
- oob += eccbytes;
-
- if (chip->ecc.postpad) {
- offset = ((chip->ecc.steps - eccsteps) * chunk) +
- chip->ecc.prepad + eccbytes;
- memcpy(&davinci_ecc_buf[offset], oob,
- chip->ecc.postpad);
- oob += chip->ecc.postpad;
- }
- }
-
- /*
- * Write the sparebytes into the page once
- * all eccsteps have been covered
- */
- for (i = 0; i < mtd->oobsize; i++)
- writeb(davinci_ecc_buf[i], this->IO_ADDR_W);
-
- /* Calculate remaining oob bytes */
- i = mtd->oobsize - (oob - chip->oob_poi);
- if (i)
- chip->write_buf(mtd, oob, i);
- return 0;
-}
-
-static int davinci_std_write_oob_syndrome(struct mtd_info *mtd,
- struct nand_chip *chip, int page)
-{
- int pos, status = 0;
- const uint8_t *bufpoi = chip->oob_poi;
-
- pos = mtd->writesize;
-
- chip->cmdfunc(mtd, NAND_CMD_SEQIN, pos, page);
-
- chip->write_buf(mtd, bufpoi, mtd->oobsize);
-
- chip->cmdfunc(mtd, NAND_CMD_PAGEPROG, -1, -1);
- status = chip->waitfunc(mtd, chip);
-
- return status & NAND_STATUS_FAIL ? -1 : 0;
-}
-
-static int davinci_std_read_oob_syndrome(struct mtd_info *mtd,
- struct nand_chip *chip, int page)
-{
- struct nand_chip *this = mtd->priv;
- uint8_t *buf = chip->oob_poi;
- uint8_t *bufpoi = buf;
-
- chip->cmdfunc(mtd, NAND_CMD_READOOB, 0x0, page & this->pagemask);
-
- chip->read_buf(mtd, bufpoi, mtd->oobsize);
-
- return 0;
-}
-
-static void nand_dm365evm_select_chip(struct mtd_info *mtd, int chip)
-{
- struct nand_chip *this = mtd->priv;
- unsigned long wbase = (unsigned long) this->IO_ADDR_W;
- unsigned long rbase = (unsigned long) this->IO_ADDR_R;
-
- if (chip == 1) {
- __set_bit(14, &wbase);
- __set_bit(14, &rbase);
- } else {
- __clear_bit(14, &wbase);
- __clear_bit(14, &rbase);
- }
- this->IO_ADDR_W = (void *)wbase;
- this->IO_ADDR_R = (void *)rbase;
-}
-
-int board_nand_init(struct nand_chip *nand)
-{
- davinci_nand_init(nand);
- nand->select_chip = nand_dm365evm_select_chip;
-
- return 0;
-}
-
-struct nand_ecc_ctrl org_ecc;
-static int notsaved = 1;
-
-static int nand_switch_hw_func(int mode)
-{
- struct nand_chip *nand;
- struct mtd_info *mtd;
-
- if (nand_curr_device < 0 ||
- nand_curr_device >= CONFIG_SYS_MAX_NAND_DEVICE ||
- !nand_info[nand_curr_device].name) {
- printf("Error: Can't switch hw functions," \
- " no devices available\n");
- return -1;
- }
-
- mtd = &nand_info[nand_curr_device];
- nand = mtd->priv;
-
- if (mode == 0) {
- if (notsaved == 0) {
- printf("switching to uboot hw functions.\n");
- memcpy(&nand->ecc, &org_ecc,
- sizeof(struct nand_ecc_ctrl));
- }
- } else {
- /* RBL */
- printf("switching to RBL hw functions.\n");
- if (notsaved == 1) {
- memcpy(&org_ecc, &nand->ecc,
- sizeof(struct nand_ecc_ctrl));
- notsaved = 0;
- }
- nand->ecc.mode = NAND_ECC_HW_SYNDROME;
- nand->ecc.prepad = 6;
- nand->ecc.read_page = davinci_std_read_page_syndrome;
- nand->ecc.write_page = davinci_std_write_page_syndrome;
- nand->ecc.read_oob = davinci_std_read_oob_syndrome;
- nand->ecc.write_oob = davinci_std_write_oob_syndrome;
- }
- return mode;
-}
-
-static int hwmode;
-
-static int do_switch_ecc(cmd_tbl_t *cmdtp, int flag, int argc,
- char *const argv[])
-{
- if (argc != 2)
- goto usage;
- if (strncmp(argv[1], "rbl", 2) == 0)
- hwmode = nand_switch_hw_func(1);
- else if (strncmp(argv[1], "uboot", 2) == 0)
- hwmode = nand_switch_hw_func(0);
- else
- goto usage;
-
- return 0;
-
-usage:
- printf("Usage: nandrbl %s\n", cmdtp->usage);
- return 1;
-}
-
-U_BOOT_CMD(
- nandrbl, 2, 1, do_switch_ecc,
- "switch between rbl/uboot NAND ECC calculation algorithm",
- "[rbl/uboot] - Switch between rbl/uboot NAND ECC algorithm"
-);
-
-
-#endif /* #ifdef CONFIG_NAND_DAVINCI */
-
-#ifdef CONFIG_DAVINCI_MMC
-static struct davinci_mmc mmc_sd0 = {
- .reg_base = (struct davinci_mmc_regs *)DAVINCI_MMC_SD0_BASE,
- .input_clk = 121500000,
- .host_caps = MMC_MODE_4BIT,
- .voltages = MMC_VDD_32_33 | MMC_VDD_33_34,
- .version = MMC_CTLR_VERSION_2,
-};
-
-int board_mmc_init(bd_t *bis)
-{
- int err;
-
- /* Add slot-0 to mmc subsystem */
- err = davinci_mmc_init(bis, &mmc_sd0);
-
- return err;
-}
-#endif
-
-int board_late_init(void)
-{
- struct davinci_gpio *gpio = davinci_gpio_bank45;
-
- /* 24MHz InputClock / 15 prediv -> 1.6 MHz timer running */
- while ((get_timer_val() < CONFIG_AIT_TIMER_TIMEOUT) &&
- timer_running())
- ;
-
- /* 1 sec reached -> stop timer, clear all LED */
- stop_timer();
- clrbits_le32(&gpio->out_data, CONFIG_CAM_ENC_LED_MASK);
- return 0;
-}
-
-void reset_phy(void)
-{
- char *name = "GENERIC @ 0x00";
-
- /* reset the phy */
- miiphy_reset(name, 0x0);
-}
-
-#else /* #ifndef CONFIG_SPL_BUILD */
-static void cam_enc_4xx_set_all_led(void)
-{
- struct davinci_gpio *gpio = davinci_gpio_bank45;
-
- setbits_le32(&gpio->out_data, CONFIG_CAM_ENC_LED_MASK);
-}
-
-/*
- * TIMER 0 is used for tick
- */
-static struct davinci_timer *timer =
- (struct davinci_timer *)DAVINCI_TIMER3_BASE;
-
-#define TIMER_LOAD_VAL 0xffffffff
-#define TIM_CLK_DIV 16
-
-static int cam_enc_4xx_timer_init(void)
-{
- /* We are using timer34 in unchained 32-bit mode, full speed */
- writel(0x0, &timer->tcr);
- writel(0x0, &timer->tgcr);
- writel(0x06 | ((TIM_CLK_DIV - 1) << 8), &timer->tgcr);
- writel(0x0, &timer->tim34);
- writel(TIMER_LOAD_VAL, &timer->prd34);
- writel(2 << 22, &timer->tcr);
- return 0;
-}
-
-void board_gpio_init(void)
-{
- struct davinci_gpio *gpio;
-
- cam_enc_4xx_set_all_led();
- cam_enc_4xx_timer_init();
- gpio = davinci_gpio_bank01;
- clrbits_le32(&gpio->dir, ~0xfdfffffe);
- /* clear LED D14 = GPIO25 */
- clrbits_le32(&gpio->out_data, 0x02000000);
- gpio = davinci_gpio_bank23;
- clrbits_le32(&gpio->dir, ~0x5ff0afef);
- /* set GPIO61 to 1 -> intern UART0 as Console */
- setbits_le32(&gpio->out_data, 0x20000000);
- /*
- * PHY out of reset GIO 50 = 1
- * NAND WP off GIO 51 = 1
- */
- setbits_le32(&gpio->out_data, 0x000c0004);
- gpio = davinci_gpio_bank45;
- clrbits_le32(&gpio->dir, ~(0xdb2fffff) | CONFIG_CAM_ENC_LED_MASK);
- /*
- * clear LED:
- * D17 = GPIO86
- * D11 = GPIO87
- * GPIO88
- * GPIO89
- * D13 = GPIO90
- * GPIO91
- */
- clrbits_le32(&gpio->out_data, CONFIG_CAM_ENC_LED_MASK);
- gpio = davinci_gpio_bank67;
- clrbits_le32(&gpio->dir, ~0x000007ff);
-}
-
-/*
- * functions for the post memory test.
- */
-int arch_memory_test_prepare(u32 *vstart, u32 *size, phys_addr_t *phys_offset)
-{
- *vstart = CONFIG_SYS_SDRAM_BASE;
- *size = PHYS_SDRAM_1_SIZE;
- *phys_offset = 0;
- return 0;
-}
-
-void arch_memory_failure_handle(void)
-{
- cam_enc_4xx_set_all_led();
- puts("mem failure\n");
- while (1)
- ;
-}
-#endif
-#if defined(CONFIG_MENU)
-#include "menu.h"
-
-#define MENU_EXIT -1
-#define MENU_EXIT_BOOTCMD -2
-#define MENU_STAY 0
-#define MENU_MAIN 1
-#define MENU_UPDATE 2
-#define MENU_NETWORK 3
-#define MENU_LOAD 4
-
-static int menu_start;
-
-#define FIT_SUBTYPE_UNKNOWN 0
-#define FIT_SUBTYPE_UBL_HEADER 1
-#define FIT_SUBTYPE_SPL_IMAGE 2
-#define FIT_SUBTYPE_UBOOT_IMAGE 3
-#define FIT_SUBTYPE_DF_ENV_IMAGE 4
-#define FIT_SUBTYPE_RAMDISK_IMAGE 5
-
-struct fit_images_info {
- u_int8_t type;
- int subtype;
- char desc[200];
- const void *data;
- size_t size;
-};
-
-static struct fit_images_info imgs[10];
-
-struct menu_display {
- char title[50];
- int timeout; /* in sec */
- int id; /* MENU_* */
- char **menulist;
- int (*menu_evaluate)(char *choice);
-};
-
-char *menu_main[] = {
- "(1) Boot",
- "(2) Update Software",
- "(3) Reset to default setting and boot",
- "(4) Enter U-Boot console",
- NULL
-};
-
-char *menu_update[] = {
- "(1) Network settings",
- "(2) load image",
- "(3) back to main",
- NULL
-};
-
-char *menu_load[] = {
- "(1) install image",
- "(2) cancel",
- NULL
-};
-
-char *menu_network[] = {
- "(1) ipaddr ",
- "(2) netmask ",
- "(3) serverip ",
- "(4) gatewayip",
- "(5) tftp image name",
- "(6) back to update software",
- NULL
-};
-
-static void ait_menu_print(void *data)
-{
- printf("%s\n", (char *)data);
- return;
-}
-
-static char *menu_handle(struct menu_display *display)
-{
- struct menu *m;
- int i;
- void *choice = NULL;
- char key[2];
- int ret;
- char *s;
- char temp[6][200];
-
- m = menu_create(display->title, display->timeout, 1, ait_menu_print,
- NULL, NULL);
-
- for (i = 0; display->menulist[i]; i++) {
- sprintf(key, "%d", i + 1);
- if (display->id == MENU_NETWORK) {
- switch (i) {
- case 0:
- s = getenv("ipaddr");
- break;
- case 1:
- s = getenv("netmask");
- break;
- case 2:
- s = getenv("serverip");
- break;
- case 3:
- s = getenv("gatewayip");
- break;
- case 4:
- s = getenv("img_file");
- break;
- default:
- s = NULL;
- break;
- }
- if (s) {
- sprintf(temp[i], "%s: %s",
- display->menulist[i], s);
- ret = menu_item_add(m, key, temp[i]);
- } else {
- ret = menu_item_add(m, key,
- display->menulist[i]);
- }
- } else {
- ret = menu_item_add(m, key, display->menulist[i]);
- }
-
- if (ret != 1) {
- printf("failed to add item!");
- menu_destroy(m);
- return NULL;
- }
- }
- sprintf(key, "%d", 1);
- menu_default_set(m, key);
-
- if (menu_get_choice(m, &choice) != 1)
- debug("Problem picking a choice!\n");
-
- menu_destroy(m);
-
- return choice;
-}
-
-static int ait_menu_show(struct menu_display *display, int bootdelay)
-{
- int end = MENU_STAY;
- char *choice;
-
- if ((menu_start == 0) && (display->id == MENU_MAIN))
- display->timeout = bootdelay;
- else
- display->timeout = 0;
-
- while (end == MENU_STAY) {
- choice = menu_handle(display);
- if (choice)
- end = display->menu_evaluate(choice);
-
- if (end == display->id)
- end = MENU_STAY;
- if (display->id == MENU_MAIN) {
- if (menu_start == 0)
- end = MENU_EXIT_BOOTCMD;
- else
- display->timeout = 0;
- }
- }
- return end;
-}
-
-static int ait_writeublheader(void)
-{
- char s[20];
- unsigned long i;
- int ret;
-
- for (i = CONFIG_SYS_NAND_BLOCK_SIZE;
- i < CONFIG_SYS_NAND_U_BOOT_OFFS;
- i += CONFIG_SYS_NAND_BLOCK_SIZE) {
- sprintf(s, "%lx", i);
- ret = setenv("header_addr", s);
- if (ret == 0)
- ret = run_command("run img_writeheader", 0);
- if (ret != 0)
- break;
- }
- return ret;
-}
-
-static int ait_menu_install_images(void)
-{
- int ret = 0;
- int count = 0;
- char s[100];
- char *t;
-
- /*
- * possible image types:
- * FIT_SUBTYPE_UNKNOWN
- * FIT_SUBTYPE_UBL_HEADER
- * FIT_SUBTYPE_SPL_IMAGE
- * FIT_SUBTYPE_UBOOT_IMAGE
- * FIT_SUBTYPE_DF_ENV_IMAGE
- * FIT_SUBTYPE_RAMDISK_IMAGE
- *
- * use Envvariables:
- * img_addr_r: image start addr
- * header_addr: addr where to write to UBL header
- * img_writeheader: write ubl header to nand
- * img_writespl: write spl to nand
- * img_writeuboot: write uboot to nand
- * img_writedfenv: write default environment to ubi volume
- * img_volume: which ubi volume should be updated with img_writeramdisk
- * filesize: size of data for updating ubi volume
- * img_writeramdisk: write ramdisk to ubi volume
- */
-
- while (imgs[count].type != IH_TYPE_INVALID) {
- printf("Installing %s\n",
- genimg_get_type_name(imgs[count].type));
- sprintf(s, "%p", imgs[count].data);
- setenv("img_addr_r", s);
- sprintf(s, "%lx", (unsigned long)imgs[count].size);
- setenv("filesize", s);
- switch (imgs[count].subtype) {
- case FIT_SUBTYPE_DF_ENV_IMAGE:
- ret = run_command("run img_writedfenv", 0);
- break;
- case FIT_SUBTYPE_RAMDISK_IMAGE:
- t = getenv("img_volume");
- if (!t) {
- ret = setenv("img_volume", "rootfs1");
- } else {
- /* switch to other volume */
- if (strncmp(t, "rootfs1", 7) == 0)
- ret = setenv("img_volume", "rootfs2");
- else
- ret = setenv("img_volume", "rootfs1");
- }
- if (ret != 0)
- break;
-
- ret = run_command("run img_writeramdisk", 0);
- break;
- case FIT_SUBTYPE_SPL_IMAGE:
- ret = run_command("run img_writespl", 0);
- break;
- case FIT_SUBTYPE_UBL_HEADER:
- ret = ait_writeublheader();
- break;
- case FIT_SUBTYPE_UBOOT_IMAGE:
- ret = run_command("run img_writeuboot", 0);
- break;
- default:
- /* not supported type */
- break;
- }
- count++;
- }
- /* now save dvn_* and img_volume env vars to new values */
- if (ret == 0) {
- t = getenv("x_dvn_boot_vers");
- if (t)
- setenv("dvn_boot_vers", t);
-
- t = getenv("x_dvn_app_vers");
- if (t)
- setenv("dvn_boot_vers", t);
-
- setenv("x_dvn_boot_vers", NULL);
- setenv("x_dvn_app_vers", NULL);
- ret = run_command("run savenewvers", 0);
- }
-
- return ret;
-}
-
-static int ait_menu_evaluate_load(char *choice)
-{
- if (!choice)
- return -1;
-
- switch (choice[1]) {
- case '1':
- /* install image */
- ait_menu_install_images();
- break;
- case '2':
- /* cancel, back to main */
- setenv("x_dvn_boot_vers", NULL);
- setenv("x_dvn_app_vers", NULL);
- break;
- }
-
- return MENU_MAIN;
-}
-
-struct menu_display ait_load = {
- .title = "AIT load image",
- .timeout = 0,
- .id = MENU_LOAD,
- .menulist = menu_load,
- .menu_evaluate = ait_menu_evaluate_load,
-};
-
-static void ait_menu_read_env(char *name)
-{
- char output[CONFIG_SYS_CBSIZE];
- char cbuf[CONFIG_SYS_CBSIZE];
- int readret;
- int ret;
-
- sprintf(output, "%s old: %s value: ", name, getenv(name));
- memset(cbuf, 0, CONFIG_SYS_CBSIZE);
- readret = cli_readline_into_buffer(output, cbuf, 0);
-
- if (readret >= 0) {
- ret = setenv(name, cbuf);
- if (ret) {
- printf("Error setting %s\n", name);
- return;
- }
- }
- return;
-}
-
-static int ait_menu_evaluate_network(char *choice)
-{
- if (!choice)
- return MENU_MAIN;
-
- switch (choice[1]) {
- case '1':
- ait_menu_read_env("ipaddr");
- break;
- case '2':
- ait_menu_read_env("netmask");
- break;
- case '3':
- ait_menu_read_env("serverip");
- break;
- case '4':
- ait_menu_read_env("gatewayip");
- break;
- case '5':
- ait_menu_read_env("img_file");
- break;
- case '6':
- return MENU_UPDATE;
- break;
- }
-
- return MENU_STAY;
-}
-
-struct menu_display ait_network = {
- .title = "AIT network settings",
- .timeout = 0,
- .id = MENU_NETWORK,
- .menulist = menu_network,
- .menu_evaluate = ait_menu_evaluate_network,
-};
-
-static int fit_get_subtype(const void *fit, int noffset, char **subtype)
-{
- int len;
-
- *subtype = (char *)fdt_getprop(fit, noffset, "subtype", &len);
- if (*subtype == NULL)
- return -1;
-
- return 0;
-}
-
-static int ait_subtype_nr(char *subtype)
-{
- int ret = FIT_SUBTYPE_UNKNOWN;
-
- if (!strncmp("ublheader", subtype, strlen("ublheader")))
- return FIT_SUBTYPE_UBL_HEADER;
- if (!strncmp("splimage", subtype, strlen("splimage")))
- return FIT_SUBTYPE_SPL_IMAGE;
- if (!strncmp("ubootimage", subtype, strlen("ubootimage")))
- return FIT_SUBTYPE_UBOOT_IMAGE;
- if (!strncmp("dfenvimage", subtype, strlen("dfenvimage")))
- return FIT_SUBTYPE_DF_ENV_IMAGE;
-
- return ret;
-}
-
-static int ait_menu_check_image(void)
-{
- char *s;
- unsigned long fit_addr;
- void *addr;
- int format;
- char *desc;
- char *subtype;
- int images_noffset;
- int noffset;
- int ndepth;
- int count = 0;
- int ret;
- int i;
- int found_uboot = -1;
- int found_ramdisk = -1;
-
- memset(imgs, 0, sizeof(imgs));
- s = getenv("fit_addr_r");
- fit_addr = s ? (unsigned long)simple_strtol(s, NULL, 16) : \
- CONFIG_BOARD_IMG_ADDR_R;
-
- addr = (void *)fit_addr;
- /* check if it is a FIT image */
- format = genimg_get_format(addr);
- if (format != IMAGE_FORMAT_FIT)
- return -EINVAL;
-
- if (!fit_check_format(addr))
- return -EINVAL;
-
- /* print the FIT description */
- ret = fit_get_desc(addr, 0, &desc);
- printf("FIT description: ");
- if (ret)
- printf("unavailable\n");
- else
- printf("%s\n", desc);
-
- /* find images */
- images_noffset = fdt_path_offset(addr, FIT_IMAGES_PATH);
- if (images_noffset < 0) {
- printf("Can't find images parent node '%s' (%s)\n",
- FIT_IMAGES_PATH, fdt_strerror(images_noffset));
- return -EINVAL;
- }
-
- /* Process its subnodes, print out component images details */
- for (ndepth = 0, count = 0,
- noffset = fdt_next_node(addr, images_noffset, &ndepth);
- (noffset >= 0) && (ndepth > 0);
- noffset = fdt_next_node(addr, noffset, &ndepth)) {
- if (ndepth == 1) {
- /*
- * Direct child node of the images parent node,
- * i.e. component image node.
- */
- printf("Image %u (%s)\n", count,
- fit_get_name(addr, noffset, NULL));
-
- fit_image_print(addr, noffset, "");
-
- fit_image_get_type(addr, noffset,
- &imgs[count].type);
- /* Mandatory properties */
- ret = fit_get_desc(addr, noffset, &desc);
- printf("Description: ");
- if (ret)
- printf("unavailable\n");
- else
- printf("%s\n", desc);
-
- ret = fit_get_subtype(addr, noffset, &subtype);
- printf("Subtype: ");
- if (ret) {
- printf("unavailable\n");
- } else {
- imgs[count].subtype = ait_subtype_nr(subtype);
- printf("%s %d\n", subtype,
- imgs[count].subtype);
- }
-
- sprintf(imgs[count].desc, "%s", desc);
-
- ret = fit_image_get_data(addr, noffset,
- &imgs[count].data,
- &imgs[count].size);
-
- printf("Data Size: ");
- if (ret)
- printf("unavailable\n");
- else
- genimg_print_size(imgs[count].size);
- printf("Data @ %p\n", imgs[count].data);
- count++;
- }
- }
-
- for (i = 0; i < count; i++) {
- if (imgs[i].subtype == FIT_SUBTYPE_UBOOT_IMAGE)
- found_uboot = i;
- if (imgs[i].type == IH_TYPE_RAMDISK) {
- found_ramdisk = i;
- imgs[i].subtype = FIT_SUBTYPE_RAMDISK_IMAGE;
- }
- }
-
- /* dvn_* env var update, if the FIT descriptors are different */
- if (found_uboot >= 0) {
- s = getenv("dvn_boot_vers");
- if (s) {
- ret = strcmp(s, imgs[found_uboot].desc);
- if (ret != 0) {
- setenv("x_dvn_boot_vers",
- imgs[found_uboot].desc);
- } else {
- found_uboot = -1;
- printf("no new uboot version\n");
- }
- } else {
- setenv("dvn_boot_vers", imgs[found_uboot].desc);
- }
- }
- if (found_ramdisk >= 0) {
- s = getenv("dvn_app_vers");
- if (s) {
- ret = strcmp(s, imgs[found_ramdisk].desc);
- if (ret != 0) {
- setenv("x_dvn_app_vers",
- imgs[found_ramdisk].desc);
- } else {
- found_ramdisk = -1;
- printf("no new ramdisk version\n");
- }
- } else {
- setenv("dvn_app_vers", imgs[found_ramdisk].desc);
- }
- }
- if ((found_uboot == -1) && (found_ramdisk == -1))
- return -EINVAL;
-
- return 0;
-}
-
-static int ait_menu_evaluate_update(char *choice)
-{
- int ret;
-
- if (!choice)
- return MENU_MAIN;
-
- switch (choice[1]) {
- case '1':
- return ait_menu_show(&ait_network, 0);
- break;
- case '2':
- /* load image */
- ret = run_command("run load_img", 0);
- printf("ret: %d\n", ret);
- if (ret)
- return MENU_UPDATE;
-
- ret = ait_menu_check_image();
- if (ret)
- return MENU_UPDATE;
-
- return ait_menu_show(&ait_load, 0);
- break;
- case '3':
- return MENU_MAIN;
- break;
-
- }
-
- return MENU_MAIN;
-}
-
-struct menu_display ait_update = {
- .title = "AIT Update Software",
- .timeout = 0,
- .id = MENU_UPDATE,
- .menulist = menu_update,
- .menu_evaluate = ait_menu_evaluate_update,
-};
-
-static int ait_menu_evaluate_main(char *choice)
-{
- if (!choice)
- return MENU_STAY;
-
- menu_start = 1;
- switch (choice[1]) {
- case '1':
- /* run bootcmd */
- return MENU_EXIT_BOOTCMD;
- break;
- case '2':
- return ait_menu_show(&ait_update, 0);
- break;
- case '3':
- /* reset to default settings */
- setenv("app_reset", "yes");
- return MENU_EXIT_BOOTCMD;
- break;
- case '4':
- /* u-boot shell */
- return MENU_EXIT;
- break;
- }
-
- return MENU_EXIT;
-}
-
-struct menu_display ait_main = {
- .title = "AIT Main",
- .timeout = CONFIG_BOOTDELAY,
- .id = MENU_MAIN,
- .menulist = menu_main,
- .menu_evaluate = ait_menu_evaluate_main,
-};
-
-int menu_show(int bootdelay)
-{
- int ret;
-
- run_command("run saveparms", 0);
- ret = ait_menu_show(&ait_main, bootdelay);
- run_command("run restoreparms", 0);
-
- if (ret == MENU_EXIT_BOOTCMD)
- return 0;
-
- return MENU_EXIT;
-}
-
-void menu_display_statusline(struct menu *m)
-{
- char *s1, *s2;
-
- s1 = getenv("x_dvn_boot_vers");
- if (!s1)
- s1 = getenv("dvn_boot_vers");
-
- s2 = getenv("x_dvn_app_vers");
- if (!s2)
- s2 = getenv("dvn_app_vers");
-
- printf("State: dvn_boot_vers: %s dvn_app_vers: %s\n", s1, s2);
- return;
-}
-#endif
diff --git a/board/ait/cam_enc_4xx/config.mk b/board/ait/cam_enc_4xx/config.mk
deleted file mode 100644
index 2022151..0000000
--- a/board/ait/cam_enc_4xx/config.mk
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# AIT cam_enc_4xx board
-# cam_enc_4xx board has 1 bank of 256 MB DDR RAM
-# Physical Address: 8000'0000 to 9000'0000
-#
-# Linux Kernel is expected to be at 8000'8000, entry 8000'8000
-# (mem base + reserved)
-#
-
-UBL_CONFIG = $(srctree)/board/$(BOARDDIR)/ublimage.cfg
-ifndef CONFIG_SPL_BUILD
-ALL-y += u-boot.ubl
-else
-# as SPL_TEXT_BASE is not page-aligned, we need for some
-# linkers the -n flag (Do not page align data), to prevent
-# the following error message:
-# arm-linux-ld: u-boot-spl: Not enough room for program headers, try linking
-# with -N
-LDFLAGS_u-boot-spl += -n
-endif
diff --git a/board/ait/cam_enc_4xx/u-boot-spl.lds b/board/ait/cam_enc_4xx/u-boot-spl.lds
deleted file mode 100644
index f5c19df..0000000
--- a/board/ait/cam_enc_4xx/u-boot-spl.lds
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * (C) Copyright 2002
- * Gary Jennejohn, DENX Software Engineering, <garyj(a)denx.de>
- *
- * (C) Copyright 2008
- * Guennadi Liakhovetki, DENX Software Engineering, <lg(a)denx.de>
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE,\
- LENGTH = CONFIG_SPL_MAX_FOOTPRINT }
-
-OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
-OUTPUT_ARCH(arm)
-ENTRY(_start)
-SECTIONS
-{
- . = CONFIG_SPL_TEXT_BASE;
-
- . = ALIGN(4);
- .text :
- {
- __start = .;
- *(.vectors)
- arch/arm/cpu/arm926ejs/start.o (.text*)
- *(.text*)
- } >.sram
-
- . = ALIGN(4);
- .rodata : { *(SORT_BY_ALIGNMENT(.rodata*)) } >.sram
-
- . = ALIGN(4);
- .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram
- . = ALIGN(4);
- .rel.dyn : {
- __rel_dyn_start = .;
- *(.rel*)
- __rel_dyn_end = .;
- } >.sram
-
- .bss :
- {
- . = ALIGN(4);
- __bss_start = .;
- *(.bss*)
- . = ALIGN(4);
- __bss_end = .;
- } >.sram
-
- __image_copy_end = .;
-
- .end :
- {
- *(.__end)
- }
-}
diff --git a/board/ait/cam_enc_4xx/ublimage.cfg b/board/ait/cam_enc_4xx/ublimage.cfg
deleted file mode 100644
index d4fe705..0000000
--- a/board/ait/cam_enc_4xx/ublimage.cfg
+++ /dev/null
@@ -1,31 +0,0 @@
-#
-# (C Copyright 2011
-# Heiko Schocher DENX Software Engineering hs(a)denx.de.
-#
-# SPDX-License-Identifier: GPL-2.0+
-#
-# Refer doc/README.ublimage for more details about how-to configure
-# and create ublimage boot image
-#
-# The syntax is taken as close as possible with the kwbimage
-
-# UBL special mode : one of
-# safe (the board has no nand neither onenand)
-MODE safe
-
-# Entry point address for the user bootloader (absolute address)
-# nand spl TEXT_BASE = 0x20 !!
-ENTRY 0x00000020
-
-# Number of pages (size of user bootloader in number of pages)
-# @ nand spl 6 pages
-PAGES 6
-
-# Block number where user bootloader is present
-START_BLOCK 0
-
-# Page number where user bootloader is present
-# Page 0 is always UBL header
-START_PAGE 0
-
-LD_ADDR 0x20
diff --git a/configs/cam_enc_4xx_defconfig b/configs/cam_enc_4xx_defconfig
deleted file mode 100644
index a67bf0e..0000000
--- a/configs/cam_enc_4xx_defconfig
+++ /dev/null
@@ -1,10 +0,0 @@
-CONFIG_ARM=y
-CONFIG_ARCH_DAVINCI=y
-CONFIG_TARGET_CAM_ENC_4XX=y
-CONFIG_SPL=y
-# CONFIG_CMD_IMLS is not set
-# CONFIG_CMD_FLASH is not set
-# CONFIG_CMD_FPGA is not set
-# CONFIG_CMD_SETEXPR is not set
-CONFIG_SPI_FLASH=y
-CONFIG_SYS_PROMPT="cam_enc_4xx> "
diff --git a/doc/README.scrapyard b/doc/README.scrapyard
index f029a0f..63f86fc 100644
--- a/doc/README.scrapyard
+++ b/doc/README.scrapyard
@@ -12,6 +12,7 @@ The list should be sorted in reverse chronological order.
Board Arch CPU Commit Removed Last known maintainer/contact
=================================================================================================
+CAM_ENC_4xx arm arm926ejs - - Heiko Schocher <hs(a)denx.de>
atstk1003 avr32 - e5354b8a 2015-06-10 Haavard Skinnemoen <haavard.skinnemoen(a)atmel.com>
atstk1004 avr32 - e5354b8a 2015-06-10 Haavard Skinnemoen <haavard.skinnemoen(a)atmel.com>
atstk1006 avr32 - e5354b8a 2015-06-10 Haavard Skinnemoen <haavard.skinnemoen(a)atmel.com>
diff --git a/include/configs/cam_enc_4xx.h b/include/configs/cam_enc_4xx.h
deleted file mode 100644
index 578c4ab..0000000
--- a/include/configs/cam_enc_4xx.h
+++ /dev/null
@@ -1,504 +0,0 @@
-/*
- * Copyright (C) 2009 Texas Instruments Incorporated
- *
- * Copyright (C) 2011
- * Heiko Schocher, DENX Software Engineering, hs(a)denx.de.
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#ifndef __CONFIG_H
-#define __CONFIG_H
-
-#define CONFIG_SYS_NO_FLASH /* that is, no *NOR* flash */
-#define CONFIG_SYS_CONSOLE_INFO_QUIET
-
-/* SoC Configuration */
-#define CONFIG_SYS_TIMERBASE 0x01c21400 /* use timer 0 */
-#define CONFIG_SYS_HZ_CLOCK 24000000 /* timer0 freq */
-#define CONFIG_SOC_DM365
-
-#define CONFIG_MACH_TYPE MACH_TYPE_DAVINCI_DM365_EVM
-
-#define CONFIG_HOSTNAME cam_enc_4xx
-
-#define CONFIG_BOARD_LATE_INIT
-#define CONFIG_CAM_ENC_LED_MASK 0x0fc00000
-
-/* Memory Info */
-#define CONFIG_NR_DRAM_BANKS 1
-#define PHYS_SDRAM_1 0x80000000
-#define PHYS_SDRAM_1_SIZE (256 << 20) /* 256 MiB */
-#define DDR_4BANKS /* 4-bank DDR2 (256MB) */
-#define CONFIG_MAX_RAM_BANK_SIZE (256 << 20) /* 256 MB */
-#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1
-
-/* Serial Driver info: UART0 for console */
-#define CONFIG_SYS_NS16550
-#define CONFIG_SYS_NS16550_SERIAL
-#define CONFIG_SYS_NS16550_REG_SIZE -4
-#define CONFIG_SYS_NS16550_COM1 0x01c20000
-#define CONFIG_SYS_NS16550_CLK CONFIG_SYS_HZ_CLOCK
-#define CONFIG_CONS_INDEX 1
-#define CONFIG_BAUDRATE 115200
-
-/* Network Configuration */
-#define CONFIG_DRIVER_TI_EMAC
-#define CONFIG_EMAC_MDIO_PHY_NUM 0
-#define CONFIG_SYS_EMAC_TI_CLKDIV 0xa9 /* 1MHz */
-#define CONFIG_MII
-#define CONFIG_BOOTP_DNS
-#define CONFIG_BOOTP_DNS2
-#define CONFIG_BOOTP_SEND_HOSTNAME
-#define CONFIG_NET_RETRY_COUNT 10
-#define CONFIG_CMD_MII
-#define CONFIG_SYS_DCACHE_OFF
-#define CONFIG_RESET_PHY_R
-
-/* I2C */
-#define CONFIG_SYS_I2C
-#define CONFIG_SYS_I2C_DAVINCI
-#define CONFIG_SYS_DAVINCI_I2C_SPEED 400000
-#define CONFIG_SYS_DAVINCI_I2C_SLAVE 0x10 /* SMBus host address */
-
-/* NAND: socketed, two chipselects, normally 2 GBytes */
-#define CONFIG_NAND_DAVINCI
-#define CONFIG_SYS_NAND_CS 2
-#define CONFIG_SYS_NAND_USE_FLASH_BBT
-#define CONFIG_SYS_NAND_4BIT_HW_ECC_OOBFIRST
-#define CONFIG_SYS_NAND_PAGE_2K
-
-#define CONFIG_SYS_NAND_LARGEPAGE
-#define CONFIG_SYS_NAND_BASE_LIST { 0x02000000, }
-/* socket has two chipselects, nCE0 gated by address BIT(14) */
-#define CONFIG_SYS_MAX_NAND_DEVICE 1
-
-/* SPI support */
-#define CONFIG_SPI
-#define CONFIG_SPI_FLASH_STMICRO
-#define CONFIG_DAVINCI_SPI
-#define CONFIG_SYS_SPI_BASE DAVINCI_SPI1_BASE
-#define CONFIG_SYS_SPI_CLK davinci_clk_get(SPI_PLLDIV)
-#define CONFIG_SF_DEFAULT_SPEED 3000000
-#define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED
-#define CONFIG_CMD_SF
-
-/* SD/MMC */
-#define CONFIG_MMC
-#define CONFIG_GENERIC_MMC
-#define CONFIG_DAVINCI_MMC
-#define CONFIG_MMC_MBLOCK
-
-/* U-Boot command configuration */
-#define CONFIG_CMD_ASKENV
-#define CONFIG_CMD_CACHE
-#define CONFIG_CMD_DHCP
-#define CONFIG_CMD_I2C
-#define CONFIG_CMD_PING
-#define CONFIG_CMD_SAVES
-
-#ifdef CONFIG_CMD_BDI
-#define CONFIG_CLOCKS
-#endif
-
-#ifdef CONFIG_MMC
-#define CONFIG_DOS_PARTITION
-#define CONFIG_CMD_EXT2
-#define CONFIG_CMD_FAT
-#define CONFIG_CMD_MMC
-#endif
-
-#ifdef CONFIG_NAND_DAVINCI
-#define CONFIG_CMD_MTDPARTS
-#define CONFIG_MTD_PARTITIONS
-#define CONFIG_MTD_DEVICE
-#define CONFIG_CMD_NAND
-#define CONFIG_CMD_UBI
-#define CONFIG_CMD_UBIFS
-#define CONFIG_RBTREE
-#define CONFIG_LZO
-#endif
-
-#define CONFIG_CRC32_VERIFY
-#define CONFIG_MX_CYCLIC
-
-/* U-Boot general configuration */
-#define CONFIG_BOOTFILE "uImage" /* Boot file name */
-#define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
-#define CONFIG_SYS_PBSIZE /* Print buffer size */ \
- (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)
-#define CONFIG_SYS_MAXARGS 16 /* max number of command args */
-#define CONFIG_SYS_HUSH_PARSER
-#define CONFIG_SYS_LONGHELP
-
-#define CONFIG_MENU
-#define CONFIG_MENU_SHOW
-#define CONFIG_FIT
-#define CONFIG_BOARD_IMG_ADDR_R 0x80000000
-
-#ifdef CONFIG_NAND_DAVINCI
-#define CONFIG_ENV_SIZE (16 << 10)
-#define CONFIG_ENV_IS_IN_NAND
-#define CONFIG_ENV_OFFSET 0x180000
-#define CONFIG_ENV_RANGE 0x040000
-#define CONFIG_ENV_OFFSET_REDUND 0x1c0000
-#undef CONFIG_ENV_IS_IN_FLASH
-#endif
-
-#if defined(CONFIG_MMC) && !defined(CONFIG_ENV_IS_IN_NAND)
-#define CONFIG_CMD_ENV
-#define CONFIG_SYS_MMC_ENV_DEV 0
-#define CONFIG_ENV_SIZE (16 << 10) /* 16 KiB */
-#define CONFIG_ENV_OFFSET (51 << 9) /* Sector 51 */
-#define CONFIG_ENV_IS_IN_MMC
-#undef CONFIG_ENV_IS_IN_FLASH
-#endif
-
-#define CONFIG_BOOTDELAY 3
-/*
- * 24MHz InputClock / 15 prediv -> 1.6 MHz timer running
- * Timeout 1 second.
- */
-#define CONFIG_AIT_TIMER_TIMEOUT 0x186a00
-
-#define CONFIG_CMDLINE_EDITING
-#define CONFIG_VERSION_VARIABLE
-#define CONFIG_TIMESTAMP
-
-/* U-Boot memory configuration */
-#define CONFIG_SYS_MALLOC_LEN (1 << 20) /* 1 MiB */
-#define CONFIG_SYS_MEMTEST_START 0x80000000 /* physical address */
-#define CONFIG_SYS_MEMTEST_END 0x81000000 /* test 16MB RAM */
-
-/* Linux interfacing */
-#define CONFIG_CMDLINE_TAG
-#define CONFIG_SETUP_MEMORY_TAGS
-#define CONFIG_SYS_BARGSIZE 1024 /* bootarg Size */
-#define CONFIG_SYS_LOAD_ADDR 0x80700000 /* kernel address */
-
-#define MTDIDS_DEFAULT "nand0=davinci_nand.0"
-#define MTDPARTS_DEFAULT \
- "mtdparts=" \
- "davinci_nand.0:" \
- "128k(spl)," \
- "384k(UBLheader)," \
- "1m(u-boot)," \
- "512k(env)," \
- "-(ubi)"
-
-#define CONFIG_SYS_NAND_PAGE_SIZE 0x800
-#define CONFIG_SYS_NAND_BLOCK_SIZE 0x20000
-
-/* Defines for SPL */
-#define CONFIG_SPL_FRAMEWORK
-#define CONFIG_SPL_BOARD_INIT
-#define CONFIG_SPL_LIBGENERIC_SUPPORT
-#define CONFIG_SPL_NAND_SUPPORT
-#define CONFIG_SPL_NAND_BASE
-#define CONFIG_SPL_NAND_DRIVERS
-#define CONFIG_SPL_NAND_ECC
-#define CONFIG_SPL_NAND_SIMPLE
-#define CONFIG_SYS_NAND_HW_ECC_OOBFIRST
-#define CONFIG_SPL_SERIAL_SUPPORT
-#define CONFIG_SPL_POST_MEM_SUPPORT
-#define CONFIG_SPL_LDSCRIPT "$(BOARDDIR)/u-boot-spl.lds"
-#define CONFIG_SPL_STACK (0x00010000 + 0x7f00)
-
-#define CONFIG_SPL_TEXT_BASE 0x00000020 /*CONFIG_SYS_SRAM_START*/
-/* Provide at least 16MB spacing between us and the Linux Kernel image */
-#define CONFIG_SPL_PAD_TO 12320
-#define CONFIG_SPL_MAX_FOOTPRINT 12288
-
-#ifndef CONFIG_SPL_BUILD
-#define CONFIG_SYS_TEXT_BASE 0x81080000
-#endif
-
-#define CONFIG_SYS_NAND_BASE 0x02000000
-#define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / \
- CONFIG_SYS_NAND_PAGE_SIZE)
-
-#define CONFIG_SYS_NAND_ECCPOS { \
- 24, 25, 26, 27, 28, \
- 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, \
- 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, \
- 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, \
- 59, 60, 61, 62, 63 }
-#define CONFIG_SYS_NAND_BAD_BLOCK_POS 0
-#define CONFIG_SYS_NAND_ECCSIZE 0x200
-#define CONFIG_SYS_NAND_ECCBYTES 10
-#define CONFIG_SYS_NAND_MAX_OOBFREE 2
-#define CONFIG_SYS_NAND_MAX_ECCPOS 56
-#define CONFIG_SYS_NAND_OOBSIZE 64
-#define CONFIG_SYS_NAND_5_ADDR_CYCLE
-
-/*
- * RBL searches from Block n (n = 1..24)
- * so we can define, how many UBL Headers
- * we can write before the real spl code
- */
-#define CONFIG_SYS_NROF_PAGES_NAND_SPL 6
-
-#define CONFIG_SYS_NAND_U_BOOT_DST 0x81080000 /* u-boot TEXT_BASE */
-#define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_NAND_U_BOOT_DST
-
-/*
- * Post tests for memory testing
- */
-#define CONFIG_POST CONFIG_SYS_POST_MEMORY
-#define _POST_WORD_ADDR 0x0
-
-#define CONFIG_DISPLAY_BOARDINFO
-
-#define CONFIG_SYS_INIT_SP_ADDR CONFIG_SPL_STACK
-
-#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x80000
-#define CONFIG_SYS_NAND_U_BOOT_SIZE 0xa0000
-#define CONFIG_SYS_NAND_U_BOOT_ERA_SIZE 0x100000
-
-/* for UBL header */
-#define CONFIG_SYS_UBL_BLOCK (CONFIG_SYS_NAND_PAGE_SIZE)
-
-#define CONFIG_SYS_DM36x_PLL1_PLLM 0x55
-#define CONFIG_SYS_DM36x_PLL1_PREDIV 0x8005
-#define CONFIG_SYS_DM36x_PLL2_PLLM 0x09
-#define CONFIG_SYS_DM36x_PLL2_PREDIV 0x8000
-#define CONFIG_SYS_DM36x_PERI_CLK_CTRL 0x243F04FC
-#define CONFIG_SYS_DM36x_PLL1_PLLDIV1 0x801b
-#define CONFIG_SYS_DM36x_PLL1_PLLDIV2 0x8001
-/* POST DIV 680/2 = 340Mhz -> MJCP and HDVICP bus interface clock */
-#define CONFIG_SYS_DM36x_PLL1_PLLDIV3 0x8001
-/*
- * POST DIV 680/4 = 170Mhz -> EDMA/Peripheral CFG0(1/2 MJCP/HDVICP bus
- * interface clk)
- */
-#define CONFIG_SYS_DM36x_PLL1_PLLDIV4 0x8003
-/* POST DIV 680/2 = 340Mhz -> VPSS */
-#define CONFIG_SYS_DM36x_PLL1_PLLDIV5 0x8001
-/* POST DIV 680/9 = 75.6 Mhz -> VENC */
-#define CONFIG_SYS_DM36x_PLL1_PLLDIV6 0x8008
-/*
- * POST DIV 680/1 = 680Mhz -> DDRx2(with internal divider of 2, clock boils
- * down to 340 Mhz)
- */
-#define CONFIG_SYS_DM36x_PLL1_PLLDIV7 0x8000
-/* POST DIV 680/7= 97Mhz-> MMC0/SD0 */
-#define CONFIG_SYS_DM36x_PLL1_PLLDIV8 0x8006
-/* POST DIV 680/28 = 24.3Mhz-> CLKOUT */
-#define CONFIG_SYS_DM36x_PLL1_PLLDIV9 0x801b
-
-#define CONFIG_SYS_DM36x_PLL2_PLLDIV1 0x8011
-/* POST DIV 432/1=432 Mhz -> ARM926/(HDVICP block) clk */
-#define CONFIG_SYS_DM36x_PLL2_PLLDIV2 0x8000
-#define CONFIG_SYS_DM36x_PLL2_PLLDIV3 0x8001
-/* POST DIV 432/21= 20.5714 Mhz->VOICE Codec clk */
-#define CONFIG_SYS_DM36x_PLL2_PLLDIV4 0x8014
-/* POST DIV 432/16=27 Mhz -> VENC(For SD modes, requires) */
-#define CONFIG_SYS_DM36x_PLL2_PLLDIV5 0x800f
-
-/*
- * READ LATENCY 7 (CL + 2)
- * CONFIG_PWRDNEN = 1
- * CONFIG_EXT_STRBEN = 1
- */
-#define CONFIG_SYS_DM36x_DDR2_DDRPHYCR (0 \
- | DV_DDR_PHY_EXT_STRBEN \
- | DV_DDR_PHY_PWRDNEN \
- | (7 << DV_DDR_PHY_RD_LATENCY_SHIFT))
-
-/*
- * T_RFC = (trfc/DDR_CLK) - 1 = (195 / 2.941) - 1
- * T_RP = (trp/DDR_CLK) - 1 = (12.5 / 2.941) - 1
- * T_RCD = (trcd/DDR_CLK) - 1 = (12.5 / 2.941) - 1
- * T_WR = (twr/DDR_CLK) - 1 = (15 / 2.941) - 1
- * T_RAS = (tras/DDR_CLK) - 1 = (45 / 2.941) - 1
- * T_RC = (trc/DDR_CLK) - 1 = (57.5 / 2.941) - 1
- * T_RRD = (trrd/DDR_CLK) - 1 = (7.5 / 2.941) - 1
- * T_WTR = (twtr/DDR_CLK) - 1 = (7.5 / 2.941) - 1
- */
-#define CONFIG_SYS_DM36x_DDR2_SDTIMR (0 \
- | (66 << DV_DDR_SDTMR1_RFC_SHIFT) \
- | (4 << DV_DDR_SDTMR1_RP_SHIFT) \
- | (4 << DV_DDR_SDTMR1_RCD_SHIFT) \
- | (5 << DV_DDR_SDTMR1_WR_SHIFT) \
- | (14 << DV_DDR_SDTMR1_RAS_SHIFT) \
- | (19 << DV_DDR_SDTMR1_RC_SHIFT) \
- | (2 << DV_DDR_SDTMR1_RRD_SHIFT) \
- | (2 << DV_DDR_SDTMR1_WTR_SHIFT))
-
-/*
- * T_RASMAX = (trasmax/refresh_rate) - 1 = (70K / 7812.6) - 1
- * T_XP = tCKE - 1 = 3 - 2
- * T_XSNR= ((trfc + 10)/DDR_CLK) - 1 = (205 / 2.941) - 1
- * T_XSRD = txsrd - 1 = 200 - 1
- * T_RTP = (trtp/DDR_CLK) - 1 = (7.5 / 2.941) - 1
- * T_CKE = tcke - 1 = 3 - 1
- */
-#define CONFIG_SYS_DM36x_DDR2_SDTIMR2 (0 \
- | (8 << DV_DDR_SDTMR2_RASMAX_SHIFT) \
- | (2 << DV_DDR_SDTMR2_XP_SHIFT) \
- | (69 << DV_DDR_SDTMR2_XSNR_SHIFT) \
- | (199 << DV_DDR_SDTMR2_XSRD_SHIFT) \
- | (2 << DV_DDR_SDTMR2_RTP_SHIFT) \
- | (2 << DV_DDR_SDTMR2_CKE_SHIFT))
-
-/* PR_OLD_COUNT = 0xfe */
-#define CONFIG_SYS_DM36x_DDR2_PBBPR 0x000000FE
-/* refresh rate = 0x768 */
-#define CONFIG_SYS_DM36x_DDR2_SDRCR 0x00000768
-
-#define CONFIG_SYS_DM36x_DDR2_SDBCR (0 \
- | (2 << DV_DDR_SDCR_PAGESIZE_SHIFT) \
- | (3 << DV_DDR_SDCR_IBANK_SHIFT) \
- | (5 << DV_DDR_SDCR_CL_SHIFT) \
- | (1 << DV_DDR_SDCR_BUS_WIDTH_SHIFT) \
- | (1 << DV_DDR_SDCR_TIMUNLOCK_SHIFT) \
- | (1 << DV_DDR_SDCR_DDREN_SHIFT) \
- | (0 << DV_DDR_SDCR_DDRDRIVE0_SHIFT) \
- | (1 << DV_DDR_SDCR_DDR2EN_SHIFT) \
- | (1 << DV_DDR_SDCR_DDR_DDQS_SHIFT) \
- | (1 << DV_DDR_SDCR_BOOTUNLOCK_SHIFT))
-
-#define CONFIG_SYS_DM36x_AWCCR 0xff
-#define CONFIG_SYS_DM36x_AB1CR 0x40400204
-#define CONFIG_SYS_DM36x_AB2CR 0x04ca2650
-
-/* All Video Inputs */
-#define CONFIG_SYS_DM36x_PINMUX0 0x00000000
-/*
- * All Video Outputs,
- * GPIO 86, 87 + 90 0x0000f030
- */
-#define CONFIG_SYS_DM36x_PINMUX1 0x00530002
-#define CONFIG_SYS_DM36x_PINMUX2 0x00001815
-/*
- * SPI1, UART1, I2C, SD0, SD1, McBSP0, CLKOUTs
- * GPIO 25 0x60000000
- */
-#define CONFIG_SYS_DM36x_PINMUX3 0x9b5affff
-/*
- * MMC/SD0 instead of MS, SPI0
- * GPIO 34 0x0000c000
- */
-#define CONFIG_SYS_DM36x_PINMUX4 0x00002655
-
-/*
- * Default environment settings
- */
-
-#define DVN4XX_UBOOT_ADDR_R_RAM 0x80000000
-/* (DVN4XX_UBOOT_ADDR_R_RAM + CONFIG_SYS_NAND_PAGE_SIZE) */
-#define DVN4XX_UBOOT_ADDR_R_NAND_SPL 0x80000800
-/*
- * (DVN4XX_UBOOT_ADDR_R_NAND_SPL + (CONFIG_SYS_NROF_PAGES_NAND_SPL * \
- * CONFIG_SYS_NAND_PAGE_SIZE))
- */
-#define DVN4XX_UBOOT_ADDR_R_UBOOT 0x80003800
-
-#define CONFIG_EXTRA_ENV_SETTINGS \
- "u_boot_addr_r=" __stringify(DVN4XX_UBOOT_ADDR_R_RAM) "\0" \
- "u-boot=" __stringify(CONFIG_HOSTNAME) "/u-boot.ubl\0" \
- "load=tftp ${u_boot_addr_r} ${u-boot}\0" \
- "pagesz=" __stringify(CONFIG_SYS_NAND_PAGE_SIZE) "\0" \
- "writeheader=nandrbl rbl;nand erase 20000 ${pagesz};" \
- "nand write ${u_boot_addr_r} 20000 ${pagesz};" \
- "nandrbl uboot\0" \
- "writenand_spl=nandrbl rbl;nand erase 0 3000;" \
- "nand write " __stringify(DVN4XX_UBOOT_ADDR_R_NAND_SPL) \
- " 0 3000;nandrbl uboot\0" \
- "writeuboot=nandrbl uboot;" \
- "nand erase " __stringify(CONFIG_SYS_NAND_U_BOOT_OFFS) " "\
- __stringify(CONFIG_SYS_NAND_U_BOOT_ERA_SIZE) \
- ";nand write " __stringify(DVN4XX_UBOOT_ADDR_R_UBOOT) \
- " " __stringify(CONFIG_SYS_NAND_U_BOOT_OFFS) " " \
- __stringify(CONFIG_SYS_NAND_U_BOOT_SIZE) "\0" \
- "update=run load writenand_spl writeuboot\0" \
- "bootcmd=run net_nfs\0" \
- "rootpath=/opt/eldk-arm/arm\0" \
- "mtdids=" MTDIDS_DEFAULT "\0" \
- "mtdparts=" MTDPARTS_DEFAULT "\0" \
- "netdev=eth0\0" \
- "addmtd=setenv bootargs ${bootargs} ${mtdparts}\0" \
- "addmisc=setenv bootargs ${bootargs} app_reset=${app_reset}\0" \
- "addcon=setenv bootargs ${bootargs} console=ttyS0," \
- "${baudrate}n8\0" \
- "addip=setenv bootargs ${bootargs} " \
- "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \
- ":${hostname}:${netdev}:off eth=${ethaddr} panic=1\0" \
- "rootpath=/opt/eldk-arm/arm\0" \
- "nfsargs=setenv bootargs root=/dev/nfs rw " \
- "nfsroot=${serverip}:${rootpath}\0" \
- "bootfile=" __stringify(CONFIG_HOSTNAME) "/uImage \0" \
- "kernel_addr_r=80600000\0" \
- "load_kernel=tftp ${kernel_addr_r} ${bootfile}\0" \
- "ubi_load_kernel=ubi part ubi 2048;ubifsmount ubi:${img_volume};" \
- "ubifsload ${kernel_addr_r} boot/uImage\0" \
- "fit_addr_r=" __stringify(CONFIG_BOARD_IMG_ADDR_R) "\0" \
- "img_addr_r=" __stringify(CONFIG_BOARD_IMG_ADDR_R) "\0" \
- "img_file=" __stringify(CONFIG_HOSTNAME) "/ait.itb\0" \
- "header_addr=20000\0" \
- "img_writeheader=nandrbl rbl;" \
- "nand erase ${header_addr} ${pagesz};" \
- "nand write ${img_addr_r} ${header_addr} ${pagesz};" \
- "nandrbl uboot\0" \
- "img_writespl=nandrbl rbl;nand erase 0 3000;" \
- "nand write ${img_addr_r} 0 3000;nandrbl uboot\0" \
- "img_writeuboot=nandrbl uboot;" \
- "nand erase " __stringify(CONFIG_SYS_NAND_U_BOOT_OFFS) " "\
- __stringify(CONFIG_SYS_NAND_U_BOOT_ERA_SIZE) \
- ";nand write ${img_addr_r} " \
- __stringify(CONFIG_SYS_NAND_U_BOOT_OFFS) " " \
- __stringify(CONFIG_SYS_NAND_U_BOOT_SIZE) "\0" \
- "img_writedfenv=ubi part ubi 2048;" \
- "ubi write ${img_addr_r} default ${filesize}\0" \
- "img_volume=rootfs1\0" \
- "img_writeramdisk=ubi part ubi 2048;" \
- "ubi write ${img_addr_r} ${img_volume} ${filesize}\0" \
- "load_img=tftp ${fit_addr_r} ${img_file}\0" \
- "net_nfs=run load_kernel; " \
- "run nfsargs addip addcon addmtd addmisc;" \
- "bootm ${kernel_addr_r}\0" \
- "ubi_ubi=run ubi_load_kernel; " \
- "run ubiargs addip addcon addmtd addmisc;" \
- "bootm ${kernel_addr_r}\0" \
- "ubiargs=setenv bootargs ubi.mtd=4,2048" \
- " root=ubi0:${img_volume} rw rootfstype=ubifs\0" \
- "app_reset=no\0" \
- "dvn_app_vers=void\0" \
- "dvn_boot_vers=void\0" \
- "savenewvers=run savetmpparms restoreparms; saveenv;" \
- "run restoretmpparms\0" \
- "savetmpparms=setenv y_ipaddr ${ipaddr};" \
- "setenv y_netmask ${netmask};" \
- "setenv y_serverip ${serverip};" \
- "setenv y_gatewayip ${gatewayip}\0" \
- "saveparms=setenv x_ipaddr ${ipaddr};" \
- "setenv x_netmask ${netmask};" \
- "setenv x_serverip ${serverip};" \
- "setenv x_gatewayip ${gatewayip}\0" \
- "restoreparms=setenv ipaddr ${x_ipaddr};" \
- "setenv netmask ${x_netmask};" \
- "setenv serverip ${x_serverip};" \
- "setenv gatewayip ${x_gatewayip}\0" \
- "restoretmpparms=setenv ipaddr ${y_ipaddr};" \
- "setenv netmask ${y_netmask};" \
- "setenv serverip ${y_serverip};" \
- "setenv gatewayip ${y_gatewayip}\0" \
- "\0"
-
-/* USB Configuration */
-#define CONFIG_USB_DAVINCI
-#define CONFIG_USB_MUSB_HCD
-#define CONFIG_DV_USBPHY_CTL (USBPHY_SESNDEN | USBPHY_VBDTCTEN | \
- USBPHY_PHY24MHZ)
-
-#define CONFIG_CMD_USB /* include support for usb cmd */
-#define CONFIG_USB_STORAGE /* MSC class support */
-#define CONFIG_CMD_STORAGE /* inclue support for usb-storage cmd */
-#define CONFIG_CMD_FAT /* inclue support for FAT/storage */
-#define CONFIG_DOS_PARTITION /* inclue support for FAT/storage */
-
-#undef DAVINCI_DM365EVM
-#define PINMUX4_USBDRVBUS_BITCLEAR 0x3000
-#define PINMUX4_USBDRVBUS_BITSET 0x2000
-
-#endif /* __CONFIG_H */
--
1.9.1
4
6

[U-Boot] [PATCH 4/5] video: cfb_console: Allow VGA device to work without i8042 keyboard
by Bin Meng 18 Aug '15
by Bin Meng 18 Aug '15
18 Aug '15
So far if CONFIG_VGA_AS_SINGLE_DEVICE is not defined, the VGA device
will try to initialize a keyboard device (for x86, it is i8042). But
if i8042 controller initialization fails (eg: there is no keyboard
connected to the PS/2 port), drv_video_init() just simply returns.
This kills the opportunity of using a usb keyboard later with the vga
concole, as the vga initialization part is actually ok, only keyboard
part fails. Change the code logic to allow this.
Signed-off-by: Bin Meng <bmeng.cn(a)gmail.com>
---
In the long term, we should remove CONFIG_VGA_AS_SINGLE_DEVICE and
treat the cfb_concole an output device only. The keyboard part should
be moved out of cfb_console driver and be as a input device driver
separately.
drivers/video/cfb_console.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index 30e0317..aa7ca86 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -2247,16 +2247,17 @@ __weak int board_video_skip(void)
int drv_video_init(void)
{
- int skip_dev_init;
struct stdio_dev console_dev;
bool have_keyboard;
+ bool __maybe_unused keyboard_ok = false;
/* Check if video initialization should be skipped */
if (board_video_skip())
return 0;
/* Init video chip - returns with framebuffer cleared */
- skip_dev_init = (video_init() == -1);
+ if (video_init() == -1)
+ return 0;
if (board_cfb_skip())
return 0;
@@ -2272,11 +2273,9 @@ int drv_video_init(void)
if (have_keyboard) {
debug("KBD: Keyboard init ...\n");
#if !defined(CONFIG_VGA_AS_SINGLE_DEVICE)
- skip_dev_init |= (VIDEO_KBD_INIT_FCT == -1);
+ keyboard_ok = !(VIDEO_KBD_INIT_FCT == -1);
#endif
}
- if (skip_dev_init)
- return 0;
/* Init vga device */
memset(&console_dev, 0, sizeof(console_dev));
@@ -2287,7 +2286,7 @@ int drv_video_init(void)
console_dev.puts = video_puts; /* 'puts' function */
#if !defined(CONFIG_VGA_AS_SINGLE_DEVICE)
- if (have_keyboard) {
+ if (have_keyboard && keyboard_ok) {
/* Also init console device */
console_dev.flags |= DEV_FLAGS_INPUT;
console_dev.tstc = VIDEO_TSTC_FCT; /* 'tstc' function */
--
1.8.2.1
2
2
This commit cleans up the existing i8042 driver by:
- Reorder those static function so that their declarations can be removed
- Remove unused routines i8042_flush() and i8042_disable()
- Remove unused CONFIG_USE_CPCIDVI wrapped codes
- Remove __weak board_i8042_skip()
- Rename CamelCase variables to conform U-Boot coding convention
- Rename wait_until_kbd_output_full() to kbd_output_full()
- Change to use macros for i8042 command and control register bits
Signed-off-by: Bin Meng <bmeng.cn(a)gmail.com>
---
drivers/input/i8042.c | 633 +++++++++++++++++++++-----------------------------
include/i8042.h | 112 +++++----
2 files changed, 317 insertions(+), 428 deletions(-)
diff --git a/drivers/input/i8042.c b/drivers/input/i8042.c
index 3799580..3812733 100644
--- a/drivers/input/i8042.c
+++ b/drivers/input/i8042.c
@@ -10,49 +10,30 @@
/* includes */
#include <common.h>
-#include <linux/compiler.h>
-
-#ifdef CONFIG_USE_CPCIDVI
-extern u8 gt_cpcidvi_in8(u32 offset);
-extern void gt_cpcidvi_out8(u32 offset, u8 data);
-
-#define in8(a) gt_cpcidvi_in8(a)
-#define out8(a, b) gt_cpcidvi_out8(a, b)
-#endif
-
+#include <asm/io.h>
#include <i8042.h>
/* defines */
+#define in8(p) inb(p)
+#define out8(p, v) outb(v, p)
#ifdef CONFIG_CONSOLE_CURSOR
extern void console_cursor(int state);
-static int blinkCount = CONFIG_SYS_CONSOLE_BLINK_COUNT;
+static int blink_count = CONFIG_SYS_CONSOLE_BLINK_COUNT;
static int cursor_state;
#endif
/* locals */
-static int kbd_input = -1; /* no input yet */
-static int kbd_mapping = KBD_US; /* default US keyboard */
-static int kbd_flags = NORMAL; /* after reset */
-static int kbd_state; /* unshift code */
-
-static void kbd_conv_char(unsigned char scan_code);
-static void kbd_led_set(void);
-static void kbd_normal(unsigned char scan_code);
-static void kbd_shift(unsigned char scan_code);
-static void kbd_ctrl(unsigned char scan_code);
-static void kbd_num(unsigned char scan_code);
-static void kbd_caps(unsigned char scan_code);
-static void kbd_scroll(unsigned char scan_code);
-static void kbd_alt(unsigned char scan_code);
-static int kbd_input_empty(void);
-static int kbd_reset(void);
+static int kbd_input = -1; /* no input yet */
+static int kbd_mapping = KBD_US; /* default US keyboard */
+static int kbd_flags = NORMAL; /* after reset */
+static int kbd_state; /* unshift code */
static unsigned char kbd_fct_map[144] = {
/* kbd_fct_map table for scan code */
- 0, AS, AS, AS, AS, AS, AS, AS, /* scan 0- 7 */
- AS, AS, AS, AS, AS, AS, AS, AS, /* scan 8- F */
+ 0, AS, AS, AS, AS, AS, AS, AS, /* scan 00-07 */
+ AS, AS, AS, AS, AS, AS, AS, AS, /* scan 08-0F */
AS, AS, AS, AS, AS, AS, AS, AS, /* scan 10-17 */
AS, AS, AS, AS, AS, CN, AS, AS, /* scan 18-1F */
AS, AS, AS, AS, AS, AS, AS, AS, /* scan 20-27 */
@@ -74,8 +55,8 @@ static unsigned char kbd_fct_map[144] = {
static unsigned char kbd_key_map[2][5][144] = {
{ /* US keyboard */
{ /* unshift code */
- 0, 0x1b, '1', '2', '3', '4', '5', '6', /* scan 0- 7 */
- '7', '8', '9', '0', '-', '=', 0x08, '\t', /* scan 8- F */
+ 0, 0x1b, '1', '2', '3', '4', '5', '6', /* scan 00-07 */
+ '7', '8', '9', '0', '-', '=', 0x08, '\t', /* scan 08-0F */
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', /* scan 10-17 */
'o', 'p', '[', ']', '\r', CN, 'a', 's', /* scan 18-1F */
'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', /* scan 20-27 */
@@ -94,8 +75,8 @@ static unsigned char kbd_key_map[2][5][144] = {
0, 'D', 'C', 0, 'B', 0, '@', 'P' /* extended */
},
{ /* shift code */
- 0, 0x1b, '!', '@', '#', '$', '%', '^', /* scan 0- 7 */
- '&', '*', '(', ')', '_', '+', 0x08, '\t', /* scan 8- F */
+ 0, 0x1b, '!', '@', '#', '$', '%', '^', /* scan 00-07 */
+ '&', '*', '(', ')', '_', '+', 0x08, '\t', /* scan 08-0F */
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', /* scan 10-17 */
'O', 'P', '{', '}', '\r', CN, 'A', 'S', /* scan 18-1F */
'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', /* scan 20-27 */
@@ -114,8 +95,8 @@ static unsigned char kbd_key_map[2][5][144] = {
0, 'D', 'C', 0, 'B', 0, '@', 'P' /* extended */
},
{ /* control code */
- 0xff, 0x1b, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, /* scan 0- 7 */
- 0x1e, 0xff, 0xff, 0xff, 0x1f, 0xff, 0xff, '\t', /* scan 8- F */
+ 0xff, 0x1b, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, /* scan 00-07 */
+ 0x1e, 0xff, 0xff, 0xff, 0x1f, 0xff, 0xff, '\t', /* scan 08-0F */
0x11, 0x17, 0x05, 0x12, 0x14, 0x19, 0x15, 0x09, /* scan 10-17 */
0x0f, 0x10, 0x1b, 0x1d, '\r', CN, 0x01, 0x13, /* scan 18-1F */
0x04, 0x06, 0x07, 0x08, 0x0a, 0x0b, 0x0c, 0xff, /* scan 20-27 */
@@ -134,8 +115,8 @@ static unsigned char kbd_key_map[2][5][144] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff /* extended */
},
{ /* non numeric code */
- 0, 0x1b, '1', '2', '3', '4', '5', '6', /* scan 0- 7 */
- '7', '8', '9', '0', '-', '=', 0x08, '\t', /* scan 8- F */
+ 0, 0x1b, '1', '2', '3', '4', '5', '6', /* scan 00-07 */
+ '7', '8', '9', '0', '-', '=', 0x08, '\t', /* scan 08-0F */
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', /* scan 10-17 */
'o', 'p', '[', ']', '\r', CN, 'a', 's', /* scan 18-1F */
'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', /* scan 20-27 */
@@ -154,30 +135,30 @@ static unsigned char kbd_key_map[2][5][144] = {
0, 'D', 'C', 0, 'B', 0, '@', 'P' /* extended */
},
{ /* right alt mode - not used in US keyboard */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 0 - 7 */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 8 - F */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 10 -17 */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 18 -1F */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 20 -27 */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 28 -2F */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 30 -37 */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 38 -3F */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 40 -47 */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 48 -4F */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 50 -57 */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 58 -5F */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 60 -67 */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 68 -6F */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 70 -77 */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 78 -7F */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 00-07 */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 08-0F */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 10-17 */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 18-1F */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 20-27 */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 28-2F */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 30-37 */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 38-3F */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 40-47 */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 48-4F */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 50-57 */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 58-5F */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 60-67 */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 68-6F */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 70-77 */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 78-7F */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* extended */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff /* extended */
}
},
- { /* german keyboard */
+ { /* German keyboard */
{ /* unshift code */
- 0, 0x1b, '1', '2', '3', '4', '5', '6', /* scan 0- 7 */
- '7', '8', '9', '0', 0xe1, '\'', 0x08, '\t', /* scan 8- F */
+ 0, 0x1b, '1', '2', '3', '4', '5', '6', /* scan 00-07 */
+ '7', '8', '9', '0', 0xe1, '\'', 0x08, '\t', /* scan 08-0F */
'q', 'w', 'e', 'r', 't', 'z', 'u', 'i', /* scan 10-17 */
'o', 'p', 0x81, '+', '\r', CN, 'a', 's', /* scan 18-1F */
'd', 'f', 'g', 'h', 'j', 'k', 'l', 0x94, /* scan 20-27 */
@@ -196,8 +177,8 @@ static unsigned char kbd_key_map[2][5][144] = {
0, 'D', 'C', 0, 'B', 0, '@', 'P' /* extended */
},
{ /* shift code */
- 0, 0x1b, '!', '"', 0x15, '$', '%', '&', /* scan 0- 7 */
- '/', '(', ')', '=', '?', '`', 0x08, '\t', /* scan 8- F */
+ 0, 0x1b, '!', '"', 0x15, '$', '%', '&', /* scan 00-07 */
+ '/', '(', ')', '=', '?', '`', 0x08, '\t', /* scan 08-0F */
'Q', 'W', 'E', 'R', 'T', 'Z', 'U', 'I', /* scan 10-17 */
'O', 'P', 0x9a, '*', '\r', CN, 'A', 'S', /* scan 18-1F */
'D', 'F', 'G', 'H', 'J', 'K', 'L', 0x99, /* scan 20-27 */
@@ -216,8 +197,8 @@ static unsigned char kbd_key_map[2][5][144] = {
0, 'D', 'C', 0, 'B', 0, '@', 'P' /* extended */
},
{ /* control code */
- 0xff, 0x1b, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, /* scan 0- 7 */
- 0x1e, 0xff, 0xff, 0xff, 0x1f, 0xff, 0xff, '\t', /* scan 8- F */
+ 0xff, 0x1b, 0xff, 0x00, 0xff, 0xff, 0xff, 0xff, /* scan 00-07 */
+ 0x1e, 0xff, 0xff, 0xff, 0x1f, 0xff, 0xff, '\t', /* scan 08-0F */
0x11, 0x17, 0x05, 0x12, 0x14, 0x19, 0x15, 0x09, /* scan 10-17 */
0x0f, 0x10, 0x1b, 0x1d, '\r', CN, 0x01, 0x13, /* scan 18-1F */
0x04, 0x06, 0x07, 0x08, 0x0a, 0x0b, 0x0c, 0xff, /* scan 20-27 */
@@ -236,8 +217,8 @@ static unsigned char kbd_key_map[2][5][144] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff /* extended */
},
{ /* non numeric code */
- 0, 0x1b, '1', '2', '3', '4', '5', '6', /* scan 0- 7 */
- '7', '8', '9', '0', 0xe1, '\'', 0x08, '\t', /* scan 8- F */
+ 0, 0x1b, '1', '2', '3', '4', '5', '6', /* scan 00-07 */
+ '7', '8', '9', '0', 0xe1, '\'', 0x08, '\t', /* scan 08-0F */
'q', 'w', 'e', 'r', 't', 'z', 'u', 'i', /* scan 10-17 */
'o', 'p', 0x81, '+', '\r', CN, 'a', 's', /* scan 18-1F */
'd', 'f', 'g', 'h', 'j', 'k', 'l', 0x94, /* scan 20-27 */
@@ -255,23 +236,23 @@ static unsigned char kbd_key_map[2][5][144] = {
'\r', CN, '/', '*', ' ', ST, 'F', 'A', /* extended */
0, 'D', 'C', 0, 'B', 0, '@', 'P' /* extended */
},
- { /* Right alt mode - is used in German keyboard */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 0 - 7 */
- '{', '[', ']', '}', '\\', 0xff, 0xff, 0xff, /* scan 8 - F */
- '@', 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 10 -17 */
- 0xff, 0xff, 0xff, '~', 0xff, 0xff, 0xff, 0xff, /* scan 18 -1F */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 20 -27 */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 28 -2F */
- 0xff, 0xff, 0xe6, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 30 -37 */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 38 -3F */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 40 -47 */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 48 -4F */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, '|', 0xff, /* scan 50 -57 */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 58 -5F */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 60 -67 */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 68 -6F */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 70 -77 */
- 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 78 -7F */
+ { /* right alt mode - is used in German keyboard */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 00-07 */
+ '{', '[', ']', '}', '\\', 0xff, 0xff, 0xff, /* scan 08-0F */
+ '@', 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 10-17 */
+ 0xff, 0xff, 0xff, '~', 0xff, 0xff, 0xff, 0xff, /* scan 18-1F */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 20-27 */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 28-2F */
+ 0xff, 0xff, 0xe6, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 30-37 */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 38-3F */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 40-47 */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 48-4F */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, '|', 0xff, /* scan 50-57 */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 58-5F */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 60-67 */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 68-6F */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 70-77 */
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* scan 78-7F */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* extended */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff /* extended */
}
@@ -298,167 +279,113 @@ static unsigned char ext_key_map[] = {
0x00 /* map end */
};
-/******************************************************************************/
-
-static int kbd_controller_present(void)
-{
- return in8(I8042_STATUS_REG) != 0xff;
-}
-
-/*
- * Implement a weak default function for boards that optionally
- * need to skip the i8042 initialization.
- */
-int __weak board_i8042_skip(void)
+static int kbd_input_empty(void)
{
- /* As default, don't skip */
- return 0;
-}
+ int kbd_timeout = KBD_TIMEOUT * 1000;
-void i8042_flush(void)
-{
- int timeout;
-
- /*
- * The delay is to give the keyboard controller some time to fill the
- * next byte.
- */
- while (1) {
- timeout = 100; /* wait for no longer than 100us */
- while (timeout > 0 && !(in8(I8042_STATUS_REG) & 0x01)) {
- udelay(1);
- timeout--;
- }
+ while ((in8(I8042_STS_REG) & STATUS_IBF) && kbd_timeout--)
+ udelay(1);
- /* Try to pull next byte if not timeout. */
- if (in8(I8042_STATUS_REG) & 0x01)
- in8(I8042_DATA_REG);
- else
- break;
- }
+ return kbd_timeout != -1;
}
-int i8042_disable(void)
+static int kbd_output_full(void)
{
- if (kbd_input_empty() == 0)
- return -1;
-
- /* Disable keyboard */
- out8(I8042_COMMAND_REG, 0xad);
+ int kbd_timeout = KBD_TIMEOUT * 1000;
- if (kbd_input_empty() == 0)
- return -1;
+ while (((in8(I8042_STS_REG) & STATUS_OBF) == 0) && kbd_timeout--)
+ udelay(1);
- return 0;
+ return kbd_timeout != -1;
}
-
-/*******************************************************************************
- *
- * i8042_kbd_init - reset keyboard and init state flags
- */
-int i8042_kbd_init(void)
+static void kbd_led_set(void)
{
- int keymap, try;
- char *penv;
+ kbd_input_empty();
+ out8(I8042_DATA_REG, CMD_SET_KBD_LED);
+ kbd_input_empty();
+ out8(I8042_DATA_REG, (kbd_flags & 0x7));
+}
- if (!kbd_controller_present() || board_i8042_skip())
- return -1;
+static void kbd_normal(unsigned char scan_code)
+{
+ unsigned char chr;
-#ifdef CONFIG_USE_CPCIDVI
- penv = getenv("console");
- if (penv != NULL) {
- if (strncmp(penv, "serial", 7) == 0)
- return -1;
- }
-#endif
- /* Init keyboard device (default US layout) */
- keymap = KBD_US;
- penv = getenv("keymap");
- if (penv != NULL) {
- if (strncmp(penv, "de", 3) == 0)
- keymap = KBD_GER;
- }
+ if ((kbd_flags & BRK) == NORMAL) {
+ chr = kbd_key_map[kbd_mapping][kbd_state][scan_code];
+ if ((chr == 0xff) || (chr == 0x00))
+ return;
- for (try = 0; try < KBD_RESET_TRIES; try++) {
- if (kbd_reset() == 0) {
- kbd_mapping = keymap;
- kbd_flags = NORMAL;
- kbd_state = 0;
- kbd_led_set();
- return 0;
+ /* if caps lock convert upper to lower */
+ if (((kbd_flags & CAPS) == CAPS) &&
+ (chr >= 'a' && chr <= 'z')) {
+ chr -= 'a' - 'A';
}
+ kbd_input = chr;
}
- return -1;
}
-
-/*******************************************************************************
- *
- * i8042_tstc - test if keyboard input is available
- * option: cursor blinking if called in a loop
- */
-int i8042_tstc(struct stdio_dev *dev)
+static void kbd_shift(unsigned char scan_code)
{
- unsigned char scan_code = 0;
-
-#ifdef CONFIG_CONSOLE_CURSOR
- if (--blinkCount == 0) {
- cursor_state ^= 1;
- console_cursor(cursor_state);
- blinkCount = CONFIG_SYS_CONSOLE_BLINK_COUNT;
- udelay(10);
+ if ((kbd_flags & BRK) == BRK) {
+ kbd_state = AS;
+ kbd_flags &= (~SHIFT);
+ } else {
+ kbd_state = SH;
+ kbd_flags |= SHIFT;
}
-#endif
+}
- if ((in8(I8042_STATUS_REG) & 0x01) == 0) {
- return 0;
+static void kbd_ctrl(unsigned char scan_code)
+{
+ if ((kbd_flags & BRK) == BRK) {
+ kbd_state = AS;
+ kbd_flags &= (~CTRL);
} else {
- scan_code = in8(I8042_DATA_REG);
- if (scan_code == 0xfa)
- return 0;
-
- kbd_conv_char(scan_code);
-
- if (kbd_input != -1)
- return 1;
+ kbd_state = CN;
+ kbd_flags |= CTRL;
}
- return 0;
}
-
-/*******************************************************************************
- *
- * i8042_getc - wait till keyboard input is available
- * option: turn on/off cursor while waiting
- */
-int i8042_getc(struct stdio_dev *dev)
+static void kbd_num(unsigned char scan_code)
{
- int ret_chr;
- unsigned char scan_code;
+ if ((kbd_flags & BRK) == NORMAL) {
+ kbd_flags ^= NUM;
+ kbd_state = (kbd_flags & NUM) ? AS : NM;
+ kbd_led_set();
+ }
+}
- while (kbd_input == -1) {
- while ((in8(I8042_STATUS_REG) & 0x01) == 0) {
-#ifdef CONFIG_CONSOLE_CURSOR
- if (--blinkCount == 0) {
- cursor_state ^= 1;
- console_cursor(cursor_state);
- blinkCount = CONFIG_SYS_CONSOLE_BLINK_COUNT;
- }
- udelay(10);
-#endif
- }
- scan_code = in8(I8042_DATA_REG);
- if (scan_code != 0xfa)
- kbd_conv_char (scan_code);
+static void kbd_alt(unsigned char scan_code)
+{
+ if ((kbd_flags & BRK) == BRK) {
+ kbd_state = AS;
+ kbd_flags &= (~ALT);
+ } else {
+ kbd_state = AK;
+ kbd_flags &= ALT;
}
- ret_chr = kbd_input;
- kbd_input = -1;
- return ret_chr;
}
+static void kbd_caps(unsigned char scan_code)
+{
+ if ((kbd_flags & BRK) == NORMAL) {
+ kbd_flags ^= CAPS;
+ kbd_led_set();
+ }
+}
-/******************************************************************************/
+static void kbd_scroll(unsigned char scan_code)
+{
+ if ((kbd_flags & BRK) == NORMAL) {
+ kbd_flags ^= STP;
+ kbd_led_set();
+ if (kbd_flags & STP)
+ kbd_input = 0x13;
+ else
+ kbd_input = 0x11;
+ }
+}
static void kbd_conv_char(unsigned char scan_code)
{
@@ -475,8 +402,8 @@ static void kbd_conv_char(unsigned char scan_code)
if ((scan_code == 0xe1) || (kbd_flags & E1)) {
if (scan_code == 0xe1) {
- kbd_flags ^= BRK; /* reset the break flag */
- kbd_flags ^= E1; /* bitwise EXOR with E1 flag */
+ kbd_flags ^= BRK; /* reset the break flag */
+ kbd_flags ^= E1; /* bitwise EXOR with E1 flag */
}
return;
}
@@ -511,207 +438,171 @@ static void kbd_conv_char(unsigned char scan_code)
case NM:
kbd_num(scan_code);
break;
+ case AK:
+ kbd_alt(scan_code);
+ break;
case CP:
kbd_caps(scan_code);
break;
case ST:
kbd_scroll(scan_code);
break;
- case AK:
- kbd_alt(scan_code);
- break;
}
+
return;
}
-
-/******************************************************************************/
-
-static void kbd_normal(unsigned char scan_code)
+static int kbd_reset(void)
{
- unsigned char chr;
+ u8 config;
- if ((kbd_flags & BRK) == NORMAL) {
- chr = kbd_key_map[kbd_mapping][kbd_state][scan_code];
- if ((chr == 0xff) || (chr == 0x00))
- return;
+ /* controller self test */
+ if (kbd_input_empty() == 0)
+ return -1;
+ out8(I8042_CMD_REG, CMD_SELF_TEST);
+ if (kbd_output_full() == 0)
+ return -1;
+ if (in8(I8042_DATA_REG) != KBC_TEST_OK)
+ return -1;
- /* if caps lock convert upper to lower */
- if (((kbd_flags & CAPS) == CAPS) &&
- (chr >= 'a' && chr <= 'z')) {
- chr -= 'a' - 'A';
- }
- kbd_input = chr;
- }
-}
+ /* keyboard reset */
+ if (kbd_input_empty() == 0)
+ return -1;
+ out8(I8042_DATA_REG, CMD_RESET_KBD);
+ if (kbd_output_full() == 0)
+ return -1;
+ if (in8(I8042_DATA_REG) != KBD_ACK)
+ return -1;
+ if (kbd_output_full() == 0)
+ return -1;
+ if (in8(I8042_DATA_REG) != KBD_POR)
+ return -1;
+ /* set AT translation and disable irq */
+ if (kbd_input_empty() == 0)
+ return -1;
+ out8(I8042_CMD_REG, CMD_RD_CONFIG);
+ if (kbd_output_full() == 0)
+ return -1;
+ config = in8(I8042_DATA_REG);
+ config |= CONFIG_AT_TRANS;
+ config &= ~(CONFIG_KIRQ_EN | CONFIG_MIRQ_EN);
+ if (kbd_input_empty() == 0)
+ return -1;
+ out8(I8042_CMD_REG, CMD_WR_CONFIG);
+ if (kbd_input_empty() == 0)
+ return -1;
+ out8(I8042_DATA_REG, config);
-/******************************************************************************/
+ /* enable keyboard */
+ if (kbd_input_empty() == 0)
+ return -1;
+ out8(I8042_CMD_REG, CMD_KBD_EN);
+ if (kbd_input_empty() == 0)
+ return -1;
-static void kbd_shift(unsigned char scan_code)
-{
- if ((kbd_flags & BRK) == BRK) {
- kbd_state = AS;
- kbd_flags &= (~SHIFT);
- } else {
- kbd_state = SH;
- kbd_flags |= SHIFT;
- }
+ return 0;
}
-
-/******************************************************************************/
-
-static void kbd_ctrl(unsigned char scan_code)
+static int kbd_controller_present(void)
{
- if ((kbd_flags & BRK) == BRK) {
- kbd_state = AS;
- kbd_flags &= (~CTRL);
- } else {
- kbd_state = CN;
- kbd_flags |= CTRL;
- }
+ return in8(I8042_STS_REG) != 0xff;
}
-
-/******************************************************************************/
-
-static void kbd_caps(unsigned char scan_code)
+/* i8042_kbd_init - reset keyboard and init state flags */
+int i8042_kbd_init(void)
{
- if ((kbd_flags & BRK) == NORMAL) {
- kbd_flags ^= CAPS;
- kbd_led_set(); /* update keyboard LED */
- }
-}
-
-
-/******************************************************************************/
+ int keymap, try;
+ char *penv;
-static void kbd_num(unsigned char scan_code)
-{
- if ((kbd_flags & BRK) == NORMAL) {
- kbd_flags ^= NUM;
- kbd_state = (kbd_flags & NUM) ? AS : NM;
- kbd_led_set(); /* update keyboard LED */
+ if (!kbd_controller_present()) {
+ debug("i8042 keyboard controller is not present\n");
+ return -1;
}
-}
-
-
-/******************************************************************************/
-static void kbd_scroll(unsigned char scan_code)
-{
- if ((kbd_flags & BRK) == NORMAL) {
- kbd_flags ^= STP;
- kbd_led_set(); /* update keyboard LED */
- if (kbd_flags & STP)
- kbd_input = 0x13;
- else
- kbd_input = 0x11;
+ /* Init keyboard device (default US layout) */
+ keymap = KBD_US;
+ penv = getenv("keymap");
+ if (penv != NULL) {
+ if (strncmp(penv, "de", 3) == 0)
+ keymap = KBD_GER;
}
-}
-/******************************************************************************/
+ for (try = 0; try < KBD_RESET_TRIES; try++) {
+ if (kbd_reset() == 0) {
+ kbd_mapping = keymap;
+ kbd_flags = NORMAL;
+ kbd_state = 0;
+ kbd_led_set();
-static void kbd_alt(unsigned char scan_code)
-{
- if ((kbd_flags & BRK) == BRK) {
- kbd_state = AS;
- kbd_flags &= (~ALT);
- } else {
- kbd_state = AK;
- kbd_flags &= ALT;
+ return 0;
+ }
}
-}
-
-/******************************************************************************/
-
-static void kbd_led_set(void)
-{
- kbd_input_empty();
- out8(I8042_DATA_REG, 0xed); /* SET LED command */
- kbd_input_empty();
- out8(I8042_DATA_REG, (kbd_flags & 0x7)); /* LED bits only */
+ return -1;
}
-
-/******************************************************************************/
-
-static int kbd_input_empty(void)
+/*
+ * i8042_tstc - test if keyboard input is available
+ *
+ * option: cursor blinking if called in a loop
+ */
+int i8042_tstc(struct stdio_dev *dev)
{
- int kbdTimeout = KBD_TIMEOUT * 1000;
-
- while ((in8(I8042_STATUS_REG) & I8042_STATUS_IN_DATA) && kbdTimeout--)
- udelay(1);
+ unsigned char scan_code = 0;
- return kbdTimeout != -1;
-}
+#ifdef CONFIG_CONSOLE_CURSOR
+ if (--blink_count == 0) {
+ cursor_state ^= 1;
+ console_cursor(cursor_state);
+ blink_count = CONFIG_SYS_CONSOLE_BLINK_COUNT;
+ udelay(10);
+ }
+#endif
-/******************************************************************************/
+ if ((in8(I8042_STS_REG) & STATUS_OBF) == 0) {
+ return 0;
+ } else {
+ scan_code = in8(I8042_DATA_REG);
+ if (scan_code == 0xfa)
+ return 0;
-static int wait_until_kbd_output_full(void)
-{
- int kbdTimeout = KBD_TIMEOUT * 1000;
+ kbd_conv_char(scan_code);
- while (((in8(I8042_STATUS_REG) & 0x01) == 0) && kbdTimeout--)
- udelay(1);
+ if (kbd_input != -1)
+ return 1;
+ }
- return kbdTimeout != -1;
+ return 0;
}
-/******************************************************************************/
-
-static int kbd_reset(void)
+/*
+ * i8042_getc - wait till keyboard input is available
+ *
+ * option: turn on/off cursor while waiting
+ */
+int i8042_getc(struct stdio_dev *dev)
{
- /* controller self test */
- if (kbd_input_empty() == 0)
- return -1;
-
- out8(I8042_COMMAND_REG, 0xaa);
-
- if (wait_until_kbd_output_full() == 0)
- return -1;
-
- if (in8(I8042_DATA_REG) != 0x55) /* success */
- return -1;
-
- /* KB Reset */
- if (kbd_input_empty() == 0)
- return -1;
-
- out8(I8042_DATA_REG, 0xff);
-
- if (wait_until_kbd_output_full() == 0)
- return -1;
-
- if (in8(I8042_DATA_REG) != 0xfa) /* ACK */
- return -1;
-
- if (wait_until_kbd_output_full() == 0)
- return -1;
-
- if (in8(I8042_DATA_REG) != 0xaa) /* Test Pass*/
- return -1;
-
- if (kbd_input_empty() == 0)
- return -1;
-
- /* Set KBC mode */
- out8(I8042_COMMAND_REG, 0x60);
-
- if (kbd_input_empty() == 0)
- return -1;
-
- out8(I8042_DATA_REG, 0x44);
-
- if (kbd_input_empty() == 0)
- return -1;
+ int ret_chr;
+ unsigned char scan_code;
- /* Enable Keyboard */
- out8(I8042_COMMAND_REG, 0xae);
- if (kbd_input_empty() == 0)
- return -1;
+ while (kbd_input == -1) {
+ while ((in8(I8042_STS_REG) & STATUS_OBF) == 0) {
+#ifdef CONFIG_CONSOLE_CURSOR
+ if (--blink_count == 0) {
+ cursor_state ^= 1;
+ console_cursor(cursor_state);
+ blink_count = CONFIG_SYS_CONSOLE_BLINK_COUNT;
+ }
+ udelay(10);
+#endif
+ }
+ scan_code = in8(I8042_DATA_REG);
+ if (scan_code != 0xfa)
+ kbd_conv_char(scan_code);
+ }
+ ret_chr = kbd_input;
+ kbd_input = -1;
- return 0;
+ return ret_chr;
}
diff --git a/include/i8042.h b/include/i8042.h
index 58c85ec..5b4f0d5 100644
--- a/include/i8042.h
+++ b/include/i8042.h
@@ -10,68 +10,66 @@
#ifndef _I8042_H_
#define _I8042_H_
-#ifdef __I386__
-#include <common.h>
-#include <asm/io.h>
-#define in8(p) inb(p)
-#define out8(p,v) outb(v,p)
-#endif
-
/* defines */
-#define I8042_DATA_REG (CONFIG_SYS_ISA_IO + 0x0060) /* keyboard i/o buffer */
-#define I8042_STATUS_REG (CONFIG_SYS_ISA_IO + 0x0064) /* keyboard status read */
-#define I8042_COMMAND_REG (CONFIG_SYS_ISA_IO + 0x0064) /* keyboard ctrl write */
-
-enum {
- /* Output register (I8042_DATA_REG) has data for system */
- I8042_STATUS_OUT_DATA = 1 << 0,
- I8042_STATUS_IN_DATA = 1 << 1,
-};
-
-#define KBD_US 0 /* default US layout */
-#define KBD_GER 1 /* german layout */
-
-#define KBD_TIMEOUT 1000 /* 1 sec */
-#define KBD_RESET_TRIES 3
-
-#define AS 0 /* normal character index */
-#define SH 1 /* shift index */
-#define CN 2 /* control index */
-#define NM 3 /* numeric lock index */
-#define AK 4 /* right alt key */
-#define CP 5 /* capslock index */
-#define ST 6 /* stop output index */
-#define EX 7 /* extended code index */
-#define ES 8 /* escape and extended code index */
-
-#define NORMAL 0x0000 /* normal key */
-#define STP 0x0001 /* scroll lock stop output*/
-#define NUM 0x0002 /* numeric lock */
-#define CAPS 0x0004 /* capslock */
-#define SHIFT 0x0008 /* shift */
-#define CTRL 0x0010 /* control*/
-#define EXT 0x0020 /* extended scan code 0xe0 */
-#define ESC 0x0040 /* escape key press */
-#define E1 0x0080 /* extended scan code 0xe1 */
-#define BRK 0x0100 /* make break flag for keyboard */
-#define ALT 0x0200 /* right alt */
+#define I8042_DATA_REG 0x60 /* keyboard i/o buffer */
+#define I8042_STS_REG 0x64 /* keyboard status read */
+#define I8042_CMD_REG 0x64 /* keyboard ctrl write */
+
+/* Status register bit defines */
+#define STATUS_OBF (1 << 0)
+#define STATUS_IBF (1 << 1)
+
+/* Configuration byte bit defines */
+#define CONFIG_KIRQ_EN (1 << 0)
+#define CONFIG_MIRQ_EN (1 << 1)
+#define CONFIG_AT_TRANS (1 << 6)
+
+/* i8042 commands */
+#define CMD_RD_CONFIG 0x20 /* read configuration byte */
+#define CMD_WR_CONFIG 0x60 /* write configuration byte */
+#define CMD_SELF_TEST 0xaa /* controller self-test */
+#define CMD_KBD_EN 0xae /* keyboard enable */
+#define CMD_SET_KBD_LED 0xed /* set keyboard led */
+#define CMD_RESET_KBD 0xff /* reset keyboard */
+
+/* i8042 command result */
+#define KBC_TEST_OK 0x55
+#define KBD_ACK 0xfa
+#define KBD_POR 0xaa
+
+/* keyboard scan codes */
+
+#define KBD_US 0 /* default US layout */
+#define KBD_GER 1 /* german layout */
+
+#define KBD_TIMEOUT 1000 /* 1 sec */
+#define KBD_RESET_TRIES 3
+
+#define AS 0 /* normal character index */
+#define SH 1 /* shift index */
+#define CN 2 /* control index */
+#define NM 3 /* numeric lock index */
+#define AK 4 /* right alt key */
+#define CP 5 /* capslock index */
+#define ST 6 /* stop output index */
+#define EX 7 /* extended code index */
+#define ES 8 /* escape and extended code index */
+
+#define NORMAL 0x0000 /* normal key */
+#define STP 0x0001 /* scroll lock stop output*/
+#define NUM 0x0002 /* numeric lock */
+#define CAPS 0x0004 /* capslock */
+#define SHIFT 0x0008 /* shift */
+#define CTRL 0x0010 /* control*/
+#define EXT 0x0020 /* extended scan code 0xe0 */
+#define ESC 0x0040 /* escape key press */
+#define E1 0x0080 /* extended scan code 0xe1 */
+#define BRK 0x0100 /* make break flag for keyboard */
+#define ALT 0x0200 /* right alt */
/* exports */
-/**
- * Flush all buffer from keyboard controller to host.
- */
-void i8042_flush(void);
-
-/**
- * Disables the keyboard so that key strokes no longer generate scancodes to
- * the host.
- *
- * @return 0 if ok, -1 if keyboard input was found while disabling
- */
-int i8042_disable(void);
-
struct stdio_dev;
int i8042_kbd_init(void);
--
1.8.2.1
2
2

[U-Boot] [PATCH 1/5] x86: superio: Add keyboard controller support to smsc_lpc47m driver
by Bin Meng 18 Aug '15
by Bin Meng 18 Aug '15
18 Aug '15
Add an api to enable and configure the integrated keyboard controller
on SMSC LPC47m superio chipset. It also adds several macros to help
future extension.
Signed-off-by: Bin Meng <bmeng.cn(a)gmail.com>
---
arch/x86/include/asm/ibmpc.h | 3 +++
drivers/misc/smsc_lpc47m.c | 11 +++++++++++
include/smsc_lpc47m.h | 27 ++++++++++++++++++++++++---
3 files changed, 38 insertions(+), 3 deletions(-)
diff --git a/arch/x86/include/asm/ibmpc.h b/arch/x86/include/asm/ibmpc.h
index 678cde4..1e9058c 100644
--- a/arch/x86/include/asm/ibmpc.h
+++ b/arch/x86/include/asm/ibmpc.h
@@ -24,4 +24,7 @@
#define UART0_IRQ 4
#define UART1_IRQ 3
+#define KBD_IRQ 1
+#define MSE_IRQ 12
+
#endif
diff --git a/drivers/misc/smsc_lpc47m.c b/drivers/misc/smsc_lpc47m.c
index 1e50d5b..3f209d9 100644
--- a/drivers/misc/smsc_lpc47m.c
+++ b/drivers/misc/smsc_lpc47m.c
@@ -32,3 +32,14 @@ void lpc47m_enable_serial(u16 dev, u16 iobase, u8 irq)
pnp_set_enable(dev, 1);
pnp_exit_conf_state(dev);
}
+
+void lpc47m_enable_kbc(u16 dev, u8 irq0, u8 irq1)
+{
+ pnp_enter_conf_state(dev);
+ pnp_set_logical_device(dev);
+ pnp_set_enable(dev, 0);
+ pnp_set_irq(dev, PNP_IDX_IRQ0, irq0);
+ pnp_set_irq(dev, PNP_IDX_IRQ1, irq1);
+ pnp_set_enable(dev, 1);
+ pnp_exit_conf_state(dev);
+}
diff --git a/include/smsc_lpc47m.h b/include/smsc_lpc47m.h
index 32b069d..585a404 100644
--- a/include/smsc_lpc47m.h
+++ b/include/smsc_lpc47m.h
@@ -7,14 +7,35 @@
#ifndef _SMSC_LPC47M_H_
#define _SMSC_LPC47M_H_
+/* I/O address of LPC47M */
+#define LPC47M_IO_PORT 0x2e
+
+/* Logical device number */
+#define LPC47M_FDC 0 /* Floppy */
+#define LPC47M_SP2 2 /* Serial Port 2 */
+#define LPC47M_PP 3 /* Parallel Port */
+#define LPC47M_SP1 4 /* Serial Port 1 */
+#define LPC47M_KBC 7 /* Keyboard & Mouse */
+#define LPC47M_PME 10 /* Power Control */
+
/**
* Configure the base I/O port of the specified serial device and enable the
* serial device.
*
- * @dev: High 8 bits = Super I/O port, low 8 bits = logical device number.
- * @iobase: Processor I/O port address to assign to this serial device.
- * @irq: Processor IRQ number to assign to this serial device.
+ * @dev: high 8 bits = super I/O port, low 8 bits = logical device number
+ * @iobase: processor I/O port address to assign to this serial device
+ * @irq: processor IRQ number to assign to this serial device
*/
void lpc47m_enable_serial(u16 dev, u16 iobase, u8 irq);
+/**
+ * Configure the specified keyboard controller device and enable the keyboard
+ * controller device.
+ *
+ * @dev: high 8 bits = Super I/O port, low 8 bits = logical device number
+ * @irq0: processor IRQ number to assign to keyboard
+ * @irq1: processor IRQ number to assign to mouse
+ */
+void lpc47m_enable_kbc(u16 dev, u8 irq0, u8 irq1);
+
#endif /* _SMSC_LPC47M_H_ */
--
1.8.2.1
2
2