Re: [U-Boot] [PATCH v2 08/12] i2c: Drop use of CONFIG_I2C_HARD

2017-05-12 Thread Simon Glass
Hi Tom.

On 12 May 2017 at 09:12, Simon Glass  wrote:
> Hi Tom,
>
> On 12 May 2017 at 08:47, Tom Rini  wrote:
>> On Fri, May 12, 2017 at 08:29:04AM -0600, Simon Glass wrote:
>>> Hi Tom,
>>>
>>> On 12 May 2017 at 08:19, Tom Rini  wrote:
>>> > On Fri, May 12, 2017 at 08:12:14AM -0600, Simon Glass wrote:
>>> >> Hi Tom,
>>> >>
>>> >> On 11 May 2017 at 18:33, Tom Rini  wrote:
>>> >> > On Thu, May 11, 2017 at 06:23:57PM -0600, Simon Glass wrote:
>>> >> >
>>> >> >> Drop use of this long-deprecated option.
>>> >> > [snip]
>>> >> >> diff --git a/include/configs/PATI.h b/include/configs/PATI.h
>>> >> >> index e53db2485b..046aa0d5f1 100644
>>> >> >> --- a/include/configs/PATI.h
>>> >> >> +++ b/include/configs/PATI.h
>>> >> >> @@ -38,7 +38,6 @@
>>> >> >>   */
>>> >> >>  #define CONFIG_CMD_REGINFO
>>> >> >>  #define CONFIG_CMD_REGINFO
>>> >> >> -#define CONFIG_CMD_EEPROM
>>> >> >>  #define CONFIG_CMD_IRQ
>>> >> >>
>>> >> >>  #define CONFIG_BOOTCOMMAND   ""  /* autoboot command 
>>> >> >> */
>>> >> > [snip]
>>> >> >> diff --git a/include/configs/am335x_evm.h 
>>> >> >> b/include/configs/am335x_evm.h
>>> >> >> index fc8a08f5b7..5c1a6d64da 100644
>>> >> >> --- a/include/configs/am335x_evm.h
>>> >> >> +++ b/include/configs/am335x_evm.h
>>> >> >> @@ -176,11 +176,6 @@
>>> >> >>  #define CONFIG_SYS_NS16550_COM5  0x481a8000  /* 
>>> >> >> UART4 */
>>> >> >>  #define CONFIG_SYS_NS16550_COM6  0x481aa000  /* 
>>> >> >> UART5 */
>>> >> >>
>>> >> >> -#define CONFIG_CMD_EEPROM
>>> >> >> -#define CONFIG_ENV_EEPROM_IS_ON_I2C
>>> >> >> -#define CONFIG_SYS_I2C_EEPROM_ADDR   0x50/* Main EEPROM */
>>> >> >> -#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN   2
>>> >> >> -
>>> >> >>  /* PMIC support */
>>> >> >>  #define CONFIG_POWER_TPS65217
>>> >> >>  #define CONFIG_POWER_TPS65910
>>> >> >> diff --git a/include/configs/am43xx_evm.h 
>>> >> >> b/include/configs/am43xx_evm.h
>>> >> >> index 1feb946834..ba185ebf5a 100644
>>> >> >> --- a/include/configs/am43xx_evm.h
>>> >> >> +++ b/include/configs/am43xx_evm.h
>>> >> >> @@ -22,12 +22,6 @@
>>> >> >>  #define CONFIG_SYS_NS16550_SERIAL
>>> >> >>  #endif
>>> >> >>
>>> >> >> -/* I2C Configuration */
>>> >> >> -#define CONFIG_CMD_EEPROM
>>> >> >> -#define CONFIG_ENV_EEPROM_IS_ON_I2C
>>> >> >> -#define CONFIG_SYS_I2C_EEPROM_ADDR   0x50/* Main EEPROM */
>>> >> >> -#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN   2
>>> >> >> -
>>> >> >>  /* Power */
>>> >> >>  #define CONFIG_POWER
>>> >> >>  #define CONFIG_POWER_I2C
>>> >> >> diff --git a/include/configs/ti_armv7_keystone2.h 
>>> >> >> b/include/configs/ti_armv7_keystone2.h
>>> >> >> index 868464cd32..3161c50abb 100644
>>> >> >> --- a/include/configs/ti_armv7_keystone2.h
>>> >> >> +++ b/include/configs/ti_armv7_keystone2.h
>>> >> >> @@ -208,7 +208,6 @@
>>> >> >>  /* U-Boot command configuration */
>>> >> >>  #define CONFIG_CMD_SAVES
>>> >> >>  #define CONFIG_CMD_UBIFS
>>> >> >> -#define CONFIG_CMD_EEPROM
>>> >> >>
>>> >> >>  /* U-Boot general configuration */
>>> >> >>  #define CONFIG_MISC_INIT_R
>>> >> >
>>> >> > Er, what's all of this about EEPROM stuff you're dropping?
>>> >>
>>> >> It uses I2C (as does the environment and RTC on some boards) so I need
>>> >> to drop this too. Let me know if you can think of a better way.
>>> >
>>> > Am I confused, or is CONFIG_SYS_I2C staying (so far..) and
>>> > CONFIG_HARD_I2C going?  cmd/eeprom.c supports CONFIG_SYS_I2C, so we only
>>> > need to drop CMD_EEPROM stuff iff the board was also CONFIG_HARD_I2C.
>>>
>>> Yes that's my intention. But if I have stuffed something up, let me know.
>>
>> Yes, it got stuffed up :)  I know all of the TI related ones are wrong,
>> and you might want to double check the others too.
>
> OK I will take another look. My algorithm was to disable eeprom, env
> or rtc when I got a build error.

I found the problem. I was confused by a double #ifdef. I'll fix this
up and send v3.

>
>>
>>> >> I am not sure this will be enough though. I looked through the CONFIG
>>> >> whitelist a few days ago and there are many boards that have
>>> >> board-specific settings like I2C addresses, speeds, etc. I am not sure
>>> >> how we can keep these board around since we really don't want to add
>>> >> these sorts of board-specific settings to Kconfig. They should be in
>>> >> the device tree.
>>> >
>>> > Yes, there's a lot of CONFIG_xxx stuff that's going to need to move out
>>> > of the CONFIG namespace as it doesn't make sense there.  And I have been
>>> > sending out some private pings about converting PowerPC stuff (and I'm
>>> > getting my own house in order right now).
>>>
>>> Yes PowerPC seems to be the main area, but there are some ARM boards
>>> too. I wonder if we need a tool to automate finding boards with
>>> special configuration.
>>
>> My current plan is to see if people still wish to maintain the board in
>> mainline and if so, prod them about needing 

[U-Boot] [PATCH v3 11/12] Drop CONFIG_I2CFAST

2017-05-12 Thread Simon Glass
This option is not used in U-Boot. Drop it.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 README   |  6 --
 common/board_r.c | 17 -
 scripts/config_whitelist.txt |  1 -
 3 files changed, 24 deletions(-)

diff --git a/README b/README
index 96ce6289ea..71d8de0ba8 100644
--- a/README
+++ b/README
@@ -2323,12 +2323,6 @@ The following options need to be configured:
custom i2c_init_board() routine in boards/xxx/board.c
is run early in the boot sequence.
 
-   CONFIG_I2CFAST (PPC405GP|PPC405EP only)
-
-   This option enables configuration of bi_iic_fast[] flags
-   in u-boot bd_info structure based on u-boot environment
-   variable "i2cfast". (see also i2cfast)
-
CONFIG_I2C_MULTI_BUS
 
This option allows the use of multiple I2C buses, each of which
diff --git a/common/board_r.c b/common/board_r.c
index d69a33c4a3..dba2102b18 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -485,24 +485,7 @@ static int initr_env(void)
 
/* Initialize from environment */
load_addr = getenv_ulong("loadaddr", 16, load_addr);
-#if defined(CONFIG_SYS_EXTBDINFO)
-#if defined(CONFIG_405GP) || defined(CONFIG_405EP)
-#if defined(CONFIG_I2CFAST)
-   /*
-* set bi_iic_fast for linux taking environment variable
-* "i2cfast" into account
-*/
-   {
-   char *s = getenv("i2cfast");
 
-   if (s && ((*s == 'y') || (*s == 'Y'))) {
-   gd->bd->bi_iic_fast[0] = 1;
-   gd->bd->bi_iic_fast[1] = 1;
-   }
-   }
-#endif /* CONFIG_I2CFAST */
-#endif /* CONFIG_405GP, CONFIG_405EP */
-#endif /* CONFIG_SYS_EXTBDINFO */
return 0;
 }
 
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 5cdca33f87..7cdfcd0a52 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -1319,7 +1319,6 @@ CONFIG_HW_ENV_SETTINGS
 CONFIG_HW_WATCHDOG
 CONFIG_HW_WATCHDOG_TIMEOUT_MS
 CONFIG_I2C
-CONFIG_I2CFAST
 CONFIG_I2C_CHIPADDRESS
 CONFIG_I2C_CMD_TREE
 CONFIG_I2C_ENV_EEPROM_BUS
-- 
2.13.0.rc2.291.g57267f2277-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v3 12/12] Drop use of CONFIG_I2C_SOFT

2017-05-12 Thread Simon Glass
This option is not used in U-Boot. Drop it.

Signed-off-by: Simon Glass 
---

Changes in v3:
- Rebase to master

Changes in v2:
- Rebase to master

 README | 32 +---
 1 file changed, 1 insertion(+), 31 deletions(-)

diff --git a/README b/README
index 71d8de0ba8..9525199551 100644
--- a/README
+++ b/README
@@ -2204,37 +2204,7 @@ The following options need to be configured:
 
If you do not have i2c muxes on your board, omit this define.
 
-under removal:
-
-- Legacy I2C Support:  CONFIG_SOFT_I2C
-
-   NOTE: It is intended to move drivers to CONFIG_SYS_I2C which
-   provides the following compelling advantages:
-
-   - more than one i2c adapter is usable
-   - approved multibus support
-   - better i2c mux support
-
-   ** CONFIG_SOFT_I2C is now being removed **
-
-   With CONFIG_SOFT_I2C you will need to define
-   CONFIG_SYS_I2C_SPEED to be the frequency (in Hz) at which you
-   wish your i2c bus to run and CONFIG_SYS_I2C_SLAVE to be the
-   address of this node (ie the CPU's i2c node address).
-
-   Now, the u-boot i2c code for the mpc8xx
-   (arch/powerpc/cpu/mpc8xx/i2c.c) sets the CPU up as a master node
-   and so its address should therefore be cleared to 0 (See,
-   eg, MPC823e User's Manual p.16-473). So, set
-   CONFIG_SYS_I2C_SLAVE to 0.
-
-   When a board is reset during an i2c bus transfer
-   chips might think that the current transfer is still
-   in progress.  Reset the slave devices by sending start
-   commands until the slave device responds.
-
-   That's all that's required for CONFIG_HARD_I2C.
-
+- Legacy I2C Support:
If you use the software i2c interface (CONFIG_SYS_I2C_SOFT)
then the following macros need to be defined (examples are
from include/configs/lwmon.h):
-- 
2.13.0.rc2.291.g57267f2277-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v3 10/12] i2c: Drop CONFIG_SYS_I2C_BOARD_LATE_INIT

2017-05-12 Thread Simon Glass
This option is not used by any boards. Drop it.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 README   | 11 ---
 drivers/i2c/fsl_i2c.c|  9 -
 drivers/i2c/fti2c010.c   |  9 -
 include/i2c.h|  3 ---
 scripts/config_whitelist.txt |  1 -
 5 files changed, 33 deletions(-)

diff --git a/README b/README
index 9f9265dc6d..96ce6289ea 100644
--- a/README
+++ b/README
@@ -2323,17 +2323,6 @@ The following options need to be configured:
custom i2c_init_board() routine in boards/xxx/board.c
is run early in the boot sequence.
 
-   CONFIG_SYS_I2C_BOARD_LATE_INIT
-
-   An alternative to CONFIG_SYS_I2C_INIT_BOARD. If this option is
-   defined a custom i2c_board_late_init() routine in
-   boards/xxx/board.c is run AFTER the operations in i2c_init()
-   is completed. This callpoint can be used to unreset i2c bus
-   using CPU i2c controller register accesses for CPUs whose i2c
-   controller provide such a method. It is called at the end of
-   i2c_init() to allow i2c_init operations to setup the i2c bus
-   controller on the CPU (e.g. setting bus speed & slave address).
-
CONFIG_I2CFAST (PPC405GP|PPC405EP only)
 
This option enables configuration of bi_iic_fast[] flags
diff --git a/drivers/i2c/fsl_i2c.c b/drivers/i2c/fsl_i2c.c
index a1406baa87..ff3dc25927 100644
--- a/drivers/i2c/fsl_i2c.c
+++ b/drivers/i2c/fsl_i2c.c
@@ -284,15 +284,6 @@ static void __i2c_init(const struct fsl_i2c_base *base, 
int speed, int
 
break;
}
-
-#ifdef CONFIG_SYS_I2C_BOARD_LATE_INIT
-   /* Call board specific i2c bus reset routine AFTER the bus has been
-* initialized. Use either this callpoint or i2c_init_board;
-* which is called before i2c_init operations.
-* For details about this problem see doc/I2C_Edge_Conditions.
-   */
-   i2c_board_late_init();
-#endif
 }
 
 static int
diff --git a/drivers/i2c/fti2c010.c b/drivers/i2c/fti2c010.c
index b35d0d2d9c..4da959fa53 100644
--- a/drivers/i2c/fti2c010.c
+++ b/drivers/i2c/fti2c010.c
@@ -146,15 +146,6 @@ static void fti2c010_init(struct i2c_adapter *adap, int 
speed, int slaveaddr)
set_i2c_bus_speed(chip, speed);
 
/* slave init, don't care */
-
-#ifdef CONFIG_SYS_I2C_BOARD_LATE_INIT
-   /* Call board specific i2c bus reset routine AFTER the bus has been
-* initialized. Use either this callpoint or i2c_init_board;
-* which is called before fti2c010_init operations.
-* For details about this problem see doc/I2C_Edge_Conditions.
-   */
-   i2c_board_late_init();
-#endif
 }
 
 /*
diff --git a/include/i2c.h b/include/i2c.h
index cd7f61e1c1..a88cc7cddf 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -706,9 +706,6 @@ void i2c_early_init_f(void);
 #endif
 void i2c_init(int speed, int slaveaddr);
 void i2c_init_board(void);
-#ifdef CONFIG_SYS_I2C_BOARD_LATE_INIT
-void i2c_board_late_init(void);
-#endif
 
 #ifdef CONFIG_SYS_I2C
 /*
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index da37e49c83..5cdca33f87 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -4222,7 +4222,6 @@ CONFIG_SYS_I2C_BASE2
 CONFIG_SYS_I2C_BASE3
 CONFIG_SYS_I2C_BASE4
 CONFIG_SYS_I2C_BASE5
-CONFIG_SYS_I2C_BOARD_LATE_INIT
 CONFIG_SYS_I2C_BOOT_EEPROM_ADDR
 CONFIG_SYS_I2C_BUSES
 CONFIG_SYS_I2C_BUS_MAX
-- 
2.13.0.rc2.291.g57267f2277-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v3 09/12] i2c: README: Drop CONFIG_SYS_I2C_INIT_MPC5XXX

2017-05-12 Thread Simon Glass
This option is not used in U-Boot. Drop it.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 README | 2 --
 1 file changed, 2 deletions(-)

diff --git a/README b/README
index 11fa84ccc4..9f9265dc6d 100644
--- a/README
+++ b/README
@@ -2228,8 +2228,6 @@ The following options need to be configured:
eg, MPC823e User's Manual p.16-473). So, set
CONFIG_SYS_I2C_SLAVE to 0.
 
-   CONFIG_SYS_I2C_INIT_MPC5XXX
-
When a board is reset during an i2c bus transfer
chips might think that the current transfer is still
in progress.  Reset the slave devices by sending start
-- 
2.13.0.rc2.291.g57267f2277-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v3 08/12] i2c: Finish dropping use of CONFIG_I2C_HARD

2017-05-12 Thread Simon Glass
Drop use of this long-deprecated option.

Signed-off-by: Simon Glass 
---

Changes in v3:
- Update commit message so that it is unique in the series
- Fix up #ifdef in cmd/eeprom.c
- Drop changes to include/config headers

Changes in v2:
- Drop changes to omap board.c files

 README   | 16 
 cmd/eeprom.c |  2 --
 common/board_f.c |  4 ++--
 common/stdio.c   |  5 +
 scripts/config_whitelist.txt |  1 -
 5 files changed, 11 insertions(+), 17 deletions(-)

diff --git a/README b/README
index 86f0814f79..11fa84ccc4 100644
--- a/README
+++ b/README
@@ -2204,7 +2204,9 @@ The following options need to be configured:
 
If you do not have i2c muxes on your board, omit this define.
 
-- Legacy I2C Support:  CONFIG_HARD_I2C
+under removal:
+
+- Legacy I2C Support:  CONFIG_SOFT_I2C
 
NOTE: It is intended to move drivers to CONFIG_SYS_I2C which
provides the following compelling advantages:
@@ -2213,14 +2215,12 @@ The following options need to be configured:
- approved multibus support
- better i2c mux support
 
-   ** CONFIG_HARD_I2C is now being removed **
-
-under removal:
+   ** CONFIG_SOFT_I2C is now being removed **
 
-   In both cases you will need to define CONFIG_SYS_I2C_SPEED
-   to be the frequency (in Hz) at which you wish your i2c bus
-   to run and CONFIG_SYS_I2C_SLAVE to be the address of this node 
(ie
-   the CPU's i2c node address).
+   With CONFIG_SOFT_I2C you will need to define
+   CONFIG_SYS_I2C_SPEED to be the frequency (in Hz) at which you
+   wish your i2c bus to run and CONFIG_SYS_I2C_SLAVE to be the
+   address of this node (ie the CPU's i2c node address).
 
Now, the u-boot i2c code for the mpc8xx
(arch/powerpc/cpu/mpc8xx/i2c.c) sets the CPU up as a master node
diff --git a/cmd/eeprom.c b/cmd/eeprom.c
index 0a0e4a2c1c..e43566bc56 100644
--- a/cmd/eeprom.c
+++ b/cmd/eeprom.c
@@ -73,11 +73,9 @@ void eeprom_init(int bus)
 #endif
 
/* I2C EEPROM */
-#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C)
 #if defined(CONFIG_SYS_I2C)
if (bus >= 0)
i2c_set_bus_num(bus);
-#endif
i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
 #endif
 }
diff --git a/common/board_f.c b/common/board_f.c
index d9431ee79a..eed3e7be2a 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -184,7 +184,7 @@ __weak int dram_init_banksize(void)
return 0;
 }
 
-#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C)
+#if defined(CONFIG_SYS_I2C)
 static int init_func_i2c(void)
 {
puts("I2C:   ");
@@ -765,7 +765,7 @@ static const init_fnc_t init_sequence_f[] = {
misc_init_f,
 #endif
INIT_FUNC_WATCHDOG_RESET
-#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C)
+#if defined(CONFIG_SYS_I2C)
init_func_i2c,
 #endif
 #if defined(CONFIG_HARD_SPI)
diff --git a/common/stdio.c b/common/stdio.c
index 4d30017530..ee4f0bda9e 100644
--- a/common/stdio.c
+++ b/common/stdio.c
@@ -21,7 +21,7 @@
 #include 
 #endif
 
-#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C)
+#if defined(CONFIG_SYS_I2C)
 #include 
 #endif
 
@@ -346,9 +346,6 @@ int stdio_add_devices(void)
 #ifdef CONFIG_SYS_I2C
i2c_init_all();
 #else
-#if defined(CONFIG_HARD_I2C)
-   i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
-#endif
 #endif
 #ifdef CONFIG_DM_VIDEO
/*
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 7646bb6842..da37e49c83 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -1134,7 +1134,6 @@ CONFIG_G_DNL_UMS_VENDOR_NUM
 CONFIG_H264_FREQ
 CONFIG_H8300
 CONFIG_HALEAKALA
-CONFIG_HARD_I2C
 CONFIG_HARD_SPI
 CONFIG_HASH_VERIFY
 CONFIG_HAS_DATAFLASH
-- 
2.13.0.rc2.291.g57267f2277-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v3 06/12] i2c: mxc_i2c: Drop use of CONFIG_I2C_HARD

2017-05-12 Thread Simon Glass
Drop use of this long-deprecated option.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 drivers/i2c/mxc_i2c.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c
index 13ec0e63b1..b68e82770b 100644
--- a/drivers/i2c/mxc_i2c.c
+++ b/drivers/i2c/mxc_i2c.c
@@ -69,10 +69,6 @@ DECLARE_GLOBAL_DATA_PTR;
 #define I2SR_IIF_CLEAR (0 << 1)
 #endif
 
-#if defined(CONFIG_HARD_I2C) && !defined(CONFIG_SYS_I2C_BASE)
-#error "define CONFIG_SYS_I2C_BASE to use the mxc_i2c driver"
-#endif
-
 #ifdef I2C_QUIRK_REG
 static u16 i2c_clk_div[60][2] = {
{ 20,   0x00 }, { 22,   0x01 }, { 24,   0x02 }, { 26,   0x03 },
-- 
2.13.0.rc2.291.g57267f2277-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v3 07/12] i2c: omap: Modify code to work without CONFIG_I2C_HARD

2017-05-12 Thread Simon Glass
Drop use of this long-deprecated option.

Signed-off-by: Simon Glass 
Suggested-by: Lokesh Vutla 
---

Changes in v3: None
Changes in v2:
- Add new patch to adjust omap boards to not need CONFIG_I2C_HARD

 board/ti/am335x/board.c | 3 ++-
 board/ti/am43xx/board.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index 3e81521399..517965c0f0 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -72,7 +72,8 @@ void do_board_detect(void)
enable_i2c0_pin_mux();
i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE);
 
-   if (ti_i2c_eeprom_am_get(-1, CONFIG_SYS_I2C_EEPROM_ADDR))
+   if (ti_i2c_eeprom_am_get(CONFIG_EEPROM_BUS_ADDRESS,
+CONFIG_EEPROM_CHIP_ADDRESS))
printf("ti_i2c_eeprom_init failed\n");
 }
 #endif
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index f633e2f85d..f44103d4d6 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -42,7 +42,8 @@ static struct ctrl_dev *cdev = (struct ctrl_dev 
*)CTRL_DEVICE_BASE;
 #ifdef CONFIG_TI_I2C_BOARD_DETECT
 void do_board_detect(void)
 {
-   if (ti_i2c_eeprom_am_get(-1, CONFIG_SYS_I2C_EEPROM_ADDR))
+   if (ti_i2c_eeprom_am_get(CONFIG_EEPROM_BUS_ADDRESS,
+CONFIG_EEPROM_CHIP_ADDRESS))
printf("ti_i2c_eeprom_init failed\n");
 }
 #endif
-- 
2.13.0.rc2.291.g57267f2277-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v3 05/12] i2c: keymile: Drop use of CONFIG_I2C_HARD

2017-05-12 Thread Simon Glass
Drop use of this long-deprecated option.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 board/keymile/km82xx/km82xx.c | 5 -
 board/keymile/km_arm/km_arm.c | 4 
 2 files changed, 9 deletions(-)

diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
index 51b4571d40..f5a98b33e7 100644
--- a/board/keymile/km82xx/km82xx.c
+++ b/board/keymile/km82xx/km82xx.c
@@ -153,13 +153,8 @@ const iop_conf_t iop_conf_tab[4][32] = {
{ 0, 0,   0,   0,   0,   0 }, /* PD18*/
{ 0, 0,   0,   0,   0,   0 }, /* PD17*/
{ 0, 0,   0,   0,   0,   0 }, /* PD16*/
-#if defined(CONFIG_HARD_I2C)
-   { 1, 1,   1,   0,   1,   0 }, /* PD15 I2C SDA*/
-   { 1, 1,   1,   0,   1,   0 }, /* PD14 I2C SCL*/
-#else
{ 1, 0,   0,   0,   1,   1 }, /* PD15*/
{ 1, 0,   0,   1,   1,   1 }, /* PD14*/
-#endif
{ 0, 0,   0,   0,   0,   0 }, /* PD13*/
{ 0, 0,   0,   0,   0,   0 }, /* PD12*/
{ 0, 0,   0,   0,   0,   0 }, /* PD11*/
diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index 079509c979..85785ffc02 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -75,10 +75,6 @@ static const u32 kwmpp_config[] = {
 #if defined(CONFIG_SYS_I2C_SOFT)
MPP8_GPIO,  /* SDA */
MPP9_GPIO,  /* SCL */
-#endif
-#if defined(CONFIG_HARD_I2C)
-   MPP8_TW_SDA,
-   MPP9_TW_SCK,
 #endif
MPP10_UART0_TXD,
MPP11_UART0_RXD,
-- 
2.13.0.rc2.291.g57267f2277-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v3 02/12] i2c: powerpc: Remove use of CONFIG_HARD_I2C

2017-05-12 Thread Simon Glass
Drop use of this long-deprecated option for powerpc.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 arch/powerpc/cpu/mpc512x/Makefile   |   1 -
 arch/powerpc/cpu/mpc512x/i2c.c  | 386 ---
 arch/powerpc/cpu/mpc5xxx/Makefile   |   1 -
 arch/powerpc/cpu/mpc5xxx/i2c.c  | 456 --
 arch/powerpc/cpu/mpc8260/Makefile   |   2 +-
 arch/powerpc/cpu/mpc8260/commproc.c |   4 -
 arch/powerpc/cpu/mpc8260/i2c.c  | 741 
 arch/powerpc/cpu/mpc8xx/Makefile|   1 -
 arch/powerpc/cpu/mpc8xx/i2c.c   | 672 
 board/freescale/m52277evb/README|   1 -
 board/freescale/m53017evb/README|   1 -
 board/freescale/m5373evb/README |   1 -
 board/freescale/m54455evb/README|   1 -
 board/freescale/m547xevb/README |   1 -
 14 files changed, 1 insertion(+), 2268 deletions(-)
 delete mode 100644 arch/powerpc/cpu/mpc512x/i2c.c
 delete mode 100644 arch/powerpc/cpu/mpc5xxx/i2c.c
 delete mode 100644 arch/powerpc/cpu/mpc8260/i2c.c
 delete mode 100644 arch/powerpc/cpu/mpc8xx/i2c.c

diff --git a/arch/powerpc/cpu/mpc512x/Makefile 
b/arch/powerpc/cpu/mpc512x/Makefile
index 98991c688b..933deebdae 100644
--- a/arch/powerpc/cpu/mpc512x/Makefile
+++ b/arch/powerpc/cpu/mpc512x/Makefile
@@ -9,7 +9,6 @@ obj-y   := cpu.o
 obj-y  += traps.o
 obj-y += cpu_init.o
 obj-y += fixed_sdram.o
-obj-y += i2c.o
 obj-y += interrupts.o
 obj-y += iopin.o
 obj-y += serial.o
diff --git a/arch/powerpc/cpu/mpc512x/i2c.c b/arch/powerpc/cpu/mpc512x/i2c.c
deleted file mode 100644
index 15d519a116..00
--- a/arch/powerpc/cpu/mpc512x/i2c.c
+++ /dev/null
@@ -1,386 +0,0 @@
-/*
- * (C) Copyright 2003 - 2009
- * Wolfgang Denk, DENX Software Engineering, w...@denx.de.
- *
- * SPDX-License-Identifier:GPL-2.0+
- *
- * Based on the MPC5xxx code.
- */
-
-#include 
-#include 
-
-DECLARE_GLOBAL_DATA_PTR;
-
-#ifdef CONFIG_HARD_I2C
-
-#include 
-
-/* by default set I2C bus 0 active */
-static unsigned int bus_num __attribute__ ((section (".data"))) = 0;
-
-#define I2C_TIMEOUT100
-#define I2C_RETRIES3
-
-struct mpc512x_i2c_tap {
-   int scl2tap;
-   int tap2tap;
-};
-
-static int  mpc_reg_in(volatile u32 *reg);
-static void mpc_reg_out(volatile u32 *reg, int val, int mask);
-static int  wait_for_bb(void);
-static int  wait_for_pin(int *status);
-static int  do_address(uchar chip, char rdwr_flag);
-static int  send_bytes(uchar chip, char *buf, int len);
-static int  receive_bytes(uchar chip, char *buf, int len);
-static int  mpc_get_fdr(int);
-
-static int mpc_reg_in (volatile u32 *reg)
-{
-   int ret = in_be32(reg) >> 24;
-
-   return ret;
-}
-
-static void mpc_reg_out (volatile u32 *reg, int val, int mask)
-{
-   if (!mask) {
-   out_be32(reg, val << 24);
-   } else {
-   clrsetbits_be32(reg, mask << 24, (val & mask) << 24);
-   }
-}
-
-static int wait_for_bb (void)
-{
-   volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
-   volatile i2c512x_dev_t *regs = >i2c.dev[bus_num];
-   int timeout = I2C_TIMEOUT;
-   int status;
-
-   status = mpc_reg_in (>msr);
-
-   while (timeout-- && (status & I2C_BB)) {
-   mpc_reg_out (>mcr, I2C_STA, I2C_STA);
-   (void)mpc_reg_in(>mdr);
-   mpc_reg_out (>mcr, 0, I2C_STA);
-   mpc_reg_out (>mcr, 0, 0);
-   mpc_reg_out (>mcr, I2C_EN, 0);
-
-   udelay (1000);
-   status = mpc_reg_in (>msr);
-   }
-
-   return (status & I2C_BB);
-}
-
-static int wait_for_pin (int *status)
-{
-   volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
-   volatile i2c512x_dev_t *regs = >i2c.dev[bus_num];
-   int timeout = I2C_TIMEOUT;
-
-   *status = mpc_reg_in (>msr);
-
-   while (timeout-- && !(*status & I2C_IF)) {
-   udelay (1000);
-   *status = mpc_reg_in (>msr);
-   }
-
-   if (!(*status & I2C_IF)) {
-   return -1;
-   }
-
-   mpc_reg_out (>msr, 0, I2C_IF);
-
-   return 0;
-}
-
-static int do_address (uchar chip, char rdwr_flag)
-{
-   volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
-   volatile i2c512x_dev_t *regs = >i2c.dev[bus_num];
-   int status;
-
-   chip <<= 1;
-
-   if (rdwr_flag) {
-   chip |= 1;
-   }
-
-   mpc_reg_out (>mcr, I2C_TX, I2C_TX);
-   mpc_reg_out (>mdr, chip, 0);
-
-   if (wait_for_pin ()) {
-   return -2;
-   }
-
-   if (status & I2C_RXAK) {
-   return -3;
-   }
-
-   return 0;
-}
-
-static int send_bytes (uchar chip, char *buf, int len)
-{
-   volatile immap_t *im = (immap_t *) CONFIG_SYS_IMMR;
-   volatile i2c512x_dev_t *regs = >i2c.dev[bus_num];
-   int wrcount;
-   int status;
-
-   for (wrcount = 0; wrcount < len; ++wrcount) {
-
-   mpc_reg_out (>mdr, buf[wrcount], 0);
-
-   if 

[U-Boot] [PATCH v3 04/12] i2c: pdm360ng: Drop use of CONFIG_I2C_HARD

2017-05-12 Thread Simon Glass
Drop use of this long-deprecated option.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 board/pdm360ng/pdm360ng.c | 30 --
 1 file changed, 30 deletions(-)

diff --git a/board/pdm360ng/pdm360ng.c b/board/pdm360ng/pdm360ng.c
index 9db31d3312..371bcd9e6b 100644
--- a/board/pdm360ng/pdm360ng.c
+++ b/board/pdm360ng/pdm360ng.c
@@ -169,36 +169,6 @@ int misc_init_r(void)
clrsetbits_be32(>gpio.gpdat, 0x0100, 0x0004);
 #endif
 
-#if defined(CONFIG_HARD_I2C)
-   if (!getenv("ethaddr")) {
-   uchar buf[6];
-   uchar ifm_oui[3] = { 0, 2, 1, };
-   int ret;
-
-   /* I2C-0 for on-board eeprom */
-   i2c_set_bus_num(CONFIG_SYS_I2C_EEPROM_BUS_NUM);
-
-   /* Read ethaddr from EEPROM */
-   ret = i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR,
-  CONFIG_SYS_I2C_EEPROM_MAC_OFFSET, 1, buf, 6);
-   if (ret != 0) {
-   printf("Error: Unable to read MAC from I2C"
-   " EEPROM at address %02X:%02X\n",
-   CONFIG_SYS_I2C_EEPROM_ADDR,
-   CONFIG_SYS_I2C_EEPROM_MAC_OFFSET);
-   return 1;
-   }
-
-   /* Owned by IFM ? */
-   if (memcmp(buf, ifm_oui, sizeof(ifm_oui))) {
-   printf("Illegal MAC address in EEPROM: %pM\n", buf);
-   return 1;
-   }
-
-   eth_setenv_enetaddr("ethaddr", buf);
-   }
-#endif /* defined(CONFIG_HARD_I2C) */
-
return 0;
 }
 
-- 
2.13.0.rc2.291.g57267f2277-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v3 01/12] i2c: Drop use of CONFIG_I2C_HARD

2017-05-12 Thread Simon Glass
This option is pretty old. It predates CONFIG_SYS_I2C which is itself
deprecated in favour of driver model. Disable it for all boards.

Also drop I2C options which depend on this.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 README   |  17 +--
 arch/arm/include/asm/arch-armada100/config.h |  12 --
 board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c   |  12 +-
 board/cm5200/cm5200.c|  32 ++---
 board/cm5200/cmd_cm5200.c|  32 +
 board/davedenx/aria/aria.c   |   3 -
 board/esd/mecp5123/mecp5123.c|  12 +-
 board/freescale/mpc5121ads/mpc5121ads.c  |  21 
 board/ifm/ac14xx/ac14xx.c|  53 +---
 board/renesas/r0p7734/r0p7734.c  |  12 +-
 board/tqc/tqm5200/tqm5200.c  |  18 +--
 configs/MiniFAP_defconfig|   2 -
 configs/O2D300_defconfig |   1 -
 configs/O2DNT2_RAMBOOT_defconfig |   1 -
 configs/O2DNT2_defconfig |   1 -
 configs/O2D_defconfig|   1 -
 configs/O2I_defconfig|   1 -
 configs/O2MNT_O2M110_defconfig   |   1 -
 configs/O2MNT_O2M112_defconfig   |   1 -
 configs/O2MNT_O2M113_defconfig   |   1 -
 configs/O2MNT_defconfig  |   1 -
 configs/O3DNT_defconfig  |   1 -
 configs/TQM5200S_HIGHBOOT_defconfig  |   2 -
 configs/TQM5200S_defconfig   |   2 -
 configs/TQM5200_B_HIGHBOOT_defconfig |   2 -
 configs/TQM5200_B_defconfig  |   2 -
 configs/TQM5200_STK100_defconfig |   2 -
 configs/TQM5200_defconfig|   2 -
 configs/a4m072_defconfig |   1 -
 configs/ac14xx_defconfig |   1 -
 configs/ap_sh4a_4a_defconfig |   1 -
 configs/apx4devkit_defconfig |   2 -
 configs/aria_defconfig   |   1 -
 configs/aspenite_defconfig   |   1 -
 configs/cam5200_defconfig|   2 -
 configs/cam5200_niosflash_defconfig  |   2 -
 configs/charon_defconfig |   1 -
 configs/cm5200_defconfig |   1 -
 configs/digsy_mtc_RAMBOOT_defconfig  |   2 -
 configs/digsy_mtc_defconfig  |   2 -
 configs/digsy_mtc_rev5_RAMBOOT_defconfig |   2 -
 configs/digsy_mtc_rev5_defconfig |   2 -
 configs/fo300_defconfig  |   2 -
 configs/gplugd_defconfig |   1 -
 configs/ipek01_defconfig |   2 -
 configs/m28evk_defconfig |   1 -
 configs/mecp5123_defconfig   |   2 -
 configs/motionpro_defconfig  |   2 -
 configs/mpc5121ads_defconfig |   2 -
 configs/mpc5121ads_rev2_defconfig|   2 -
 configs/pcm030_LOWBOOT_defconfig |   2 -
 configs/pcm030_defconfig |   2 -
 configs/pdm360ng_defconfig   |   2 -
 configs/r0p7734_defconfig|   1 -
 configs/v38b_defconfig   |   2 -
 include/common.h |  10 ++
 include/configs/M54418TWR.h  |   1 -
 include/configs/TQM5200.h|  64 +-
 include/configs/a4m072.h |  20 ---
 include/configs/ac14xx.h |  18 ---
 include/configs/ap_sh4a_4a.h |  14 ---
 include/configs/apx4devkit.h |   6 -
 include/configs/aria.h   |  21 
 include/configs/axs10x.h |   2 +-
 include/configs/cm5200.h |  12 +-
 include/configs/digsy_mtc.h  |  31 -
 include/configs/ids8313.h|   1 -
 include/configs/ipek01.h |  23 
 include/configs/jupiter.h|  19 ---
 include/configs/m28evk.h |   6 -
 include/configs/manroland/mpc5200-common.h   | 176 +++
 include/configs/mecp5123.h   |  18 +--
 include/configs/motionpro.h  |  22 
 include/configs/mpc5121ads.h |  18 ---
 include/configs/mxs.h|  10 --
 include/configs/o2dnt-common.h   |  22 
 include/configs/pcm030.h |  31 +
 include/configs/pdm360ng.h   |  30 -
 include/configs/r0p7734.h|  14 ---
 include/configs/s32v234evb.h |  10 --
 include/configs/v38b.h   |  21 
 81 files changed, 211 insertions(+), 701 deletions(-)
 create mode 100644 include/configs/manroland/mpc5200-common.h

diff --git a/README b/README
index 2ca0102b57..86f0814f79 100644
--- a/README
+++ b/README
@@ -2213,22 +2213,9 @@ The 

[U-Boot] [PATCH v3 03/12] i2c: cm5200: Drop use of CONFIG_I2C_HARD

2017-05-12 Thread Simon Glass
Drop use of this long-deprecated option.

Signed-off-by: Simon Glass 
---

Changes in v3: None
Changes in v2: None

 board/cm5200/cm5200.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/board/cm5200/cm5200.c b/board/cm5200/cm5200.c
index 2f55191caf..0c647bbd3d 100644
--- a/board/cm5200/cm5200.c
+++ b/board/cm5200/cm5200.c
@@ -214,7 +214,7 @@ static void compose_module_name(hw_id_t hw_id, char *buf)
strcat(buf, tmp);
 }
 
-#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C_SOFT)
+#if defined(CONFIG_SYS_I2C_SOFT)
 /*
  * Compose string with hostname.
  * buf is assumed to have enough space, and be null-terminated.
@@ -295,7 +295,7 @@ int board_early_init_r(void)
 #ifdef CONFIG_MISC_INIT_R
 int misc_init_r(void)
 {
-#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C_SOFT)
+#if defined(CONFIG_SYS_I2C_SOFT)
uchar buf[6];
char str[18];
char hostname[MODULE_NAME_MAXLEN];
@@ -323,7 +323,7 @@ int misc_init_r(void)
compose_hostname(hw_id, hostname);
setenv("hostname", hostname);
 
-#endif /* defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C_SOFT) */
+#endif /* defined(CONFIG_SYS_I2C_SOFT) */
if (!getenv("ethaddr"))
printf(LOG_PREFIX "MAC address not set, networking is not "
"operational\n");
-- 
2.13.0.rc2.291.g57267f2277-goog

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v3 00/12] i2c: Remove old I2C support

2017-05-12 Thread Simon Glass
We have about 6600 CONFIG options to convert to Kconfig at the time of
writing and our target is to complete work by the end of the year. We have
no hope of doing this unless we adopt a somewhat more agressive approach
to dropping old boards and options.

There are a very large number of deprecated or very old options. It does
not make sense to convert these to Kconfig just to carry the debt for
another few years. We should remove these options.

Rather than completely dropping boards, one idea is to remove the parts
of their support which have not been migrated. This was done with some
Samsung boards recently, and it provided the maintainers with enough time
to come in and make the changes.

CONFIG_I2C_SOFT and CONFIG_I2C_HARD are very old. This series removes
them. Boards which rely on these options for I2C support lose some of
their functionality. To regain it they would need to be migrated to driver
model.

Changes in v3:
- Update commit message so that it is unique in the series
- Fix up #ifdef in cmd/eeprom.c
- Drop changes to include/config headers
- Rebase to master

Changes in v2:
- Add new patch to adjust omap boards to not need CONFIG_I2C_HARD
- Drop changes to omap board.c files
- Rebase to master

Simon Glass (12):
  i2c: Drop use of CONFIG_I2C_HARD
  i2c: powerpc: Remove use of CONFIG_HARD_I2C
  i2c: cm5200: Drop use of CONFIG_I2C_HARD
  i2c: pdm360ng: Drop use of CONFIG_I2C_HARD
  i2c: keymile: Drop use of CONFIG_I2C_HARD
  i2c: mxc_i2c: Drop use of CONFIG_I2C_HARD
  i2c: omap: Modify code to work without CONFIG_I2C_HARD
  i2c: Finish dropping use of CONFIG_I2C_HARD
  i2c: README: Drop CONFIG_SYS_I2C_INIT_MPC5XXX
  i2c: Drop CONFIG_SYS_I2C_BOARD_LATE_INIT
  Drop CONFIG_I2CFAST
  Drop use of CONFIG_I2C_SOFT

 README   |  64 +--
 arch/arm/include/asm/arch-armada100/config.h |  12 -
 arch/powerpc/cpu/mpc512x/Makefile|   1 -
 arch/powerpc/cpu/mpc512x/i2c.c   | 386 --
 arch/powerpc/cpu/mpc5xxx/Makefile|   1 -
 arch/powerpc/cpu/mpc5xxx/i2c.c   | 456 -
 arch/powerpc/cpu/mpc8260/Makefile|   2 +-
 arch/powerpc/cpu/mpc8260/commproc.c  |   4 -
 arch/powerpc/cpu/mpc8260/i2c.c   | 741 ---
 arch/powerpc/cpu/mpc8xx/Makefile |   1 -
 arch/powerpc/cpu/mpc8xx/i2c.c| 672 
 board/alphaproject/ap_sh4a_4a/ap_sh4a_4a.c   |  12 +-
 board/cm5200/cm5200.c|  36 +-
 board/cm5200/cmd_cm5200.c|  32 +-
 board/davedenx/aria/aria.c   |   3 -
 board/esd/mecp5123/mecp5123.c|  12 +-
 board/freescale/m52277evb/README |   1 -
 board/freescale/m53017evb/README |   1 -
 board/freescale/m5373evb/README  |   1 -
 board/freescale/m54455evb/README |   1 -
 board/freescale/m547xevb/README  |   1 -
 board/freescale/mpc5121ads/mpc5121ads.c  |  21 -
 board/ifm/ac14xx/ac14xx.c|  53 +-
 board/keymile/km82xx/km82xx.c|   5 -
 board/keymile/km_arm/km_arm.c|   4 -
 board/pdm360ng/pdm360ng.c|  30 --
 board/renesas/r0p7734/r0p7734.c  |  12 +-
 board/ti/am335x/board.c  |   3 +-
 board/ti/am43xx/board.c  |   3 +-
 board/tqc/tqm5200/tqm5200.c  |  18 +-
 cmd/eeprom.c |   2 -
 common/board_f.c |   4 +-
 common/board_r.c |  17 -
 common/stdio.c   |   5 +-
 configs/MiniFAP_defconfig|   2 -
 configs/O2D300_defconfig |   1 -
 configs/O2DNT2_RAMBOOT_defconfig |   1 -
 configs/O2DNT2_defconfig |   1 -
 configs/O2D_defconfig|   1 -
 configs/O2I_defconfig|   1 -
 configs/O2MNT_O2M110_defconfig   |   1 -
 configs/O2MNT_O2M112_defconfig   |   1 -
 configs/O2MNT_O2M113_defconfig   |   1 -
 configs/O2MNT_defconfig  |   1 -
 configs/O3DNT_defconfig  |   1 -
 configs/TQM5200S_HIGHBOOT_defconfig  |   2 -
 configs/TQM5200S_defconfig   |   2 -
 configs/TQM5200_B_HIGHBOOT_defconfig |   2 -
 configs/TQM5200_B_defconfig  |   2 -
 configs/TQM5200_STK100_defconfig |   2 -
 configs/TQM5200_defconfig|   2 -
 configs/a4m072_defconfig |   1 -
 configs/ac14xx_defconfig |   1 -
 configs/ap_sh4a_4a_defconfig |   1 -
 configs/apx4devkit_defconfig |   2 -
 configs/aria_defconfig   |   1 -
 configs/aspenite_defconfig   |   1 -
 configs/cam5200_defconfig|   2 -
 

[U-Boot] Machine ID

2017-05-12 Thread Vic

Hi All.

I'm having difficulty with getting a board booting Linux from U-boot. 
This is an existing unit, so I don't get much choice over changing 
versions of kernel of U-boot.


bdinfo gives me the machine ID I expect, but when I try to boot my 
newly-built kernel, I get an "unsupported machine ID" error; the vlaue 
it prints is not what U-boot gives me, and not what I expect. The 
supported types for this kernel do include the machine ID I'm tryin to 
use...


Would someone walk me through the process by which U-boot sends the 
machine ID to the kernel, please? That's clearly gone wrong somewhere.


Many thanks,

Vic.

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 15/17] Kconfig: USB: Migrate CONFIG_USB_EHCI_HCD users to Kconfig

2017-05-12 Thread Tom Rini
Migrate the rest of the users of CONFIG_USB_EHCI_HCD over to Kconfig.
For a few SoCs, imply or default y this if USB is enabled.  In some
cases we had not already migrated to CONFIG_USB so do that as well.

Cc: Marek Vasut 
Signed-off-by: Tom Rini 
---
 arch/powerpc/Kconfig| 1 +
 configs/MPC8315ERDB_defconfig   | 1 +
 configs/MPC8349ITX_LOWBOOT_defconfig| 1 +
 configs/MPC8349ITX_defconfig| 1 +
 configs/MPC837XEMDS_HOST_defconfig  | 1 +
 configs/MPC837XERDB_defconfig   | 1 +
 configs/alt_defconfig   | 1 +
 configs/apalis-tk1_defconfig| 1 +
 configs/apalis_imx6_defconfig   | 1 -
 configs/apalis_imx6_nospl_com_defconfig | 1 -
 configs/apalis_imx6_nospl_it_defconfig  | 1 -
 configs/apalis_t30_defconfig| 1 +
 configs/apx4devkit_defconfig| 1 +
 configs/arndale_defconfig   | 1 +
 configs/beaver_defconfig| 1 +
 configs/cardhu_defconfig| 1 +
 configs/cei-tk1-som_defconfig   | 1 +
 configs/cm_fx6_defconfig| 1 -
 configs/cm_t35_defconfig| 1 +
 configs/cm_t54_defconfig| 1 +
 configs/colibri_imx6_defconfig  | 1 -
 configs/colibri_imx6_nospl_defconfig| 1 -
 configs/colibri_t20_defconfig   | 1 +
 configs/colibri_t30_defconfig   | 1 +
 configs/colibri_vf_defconfig| 1 +
 configs/corvus_defconfig| 1 +
 configs/d2net_v2_defconfig  | 1 +
 configs/dalmore_defconfig   | 1 +
 configs/dns325_defconfig| 1 +
 configs/dockstar_defconfig  | 1 +
 configs/dreamplug_defconfig | 1 +
 configs/ds109_defconfig | 2 ++
 configs/ds414_defconfig | 1 +
 configs/duovero_defconfig   | 1 +
 configs/e2220-1170_defconfig| 1 +
 configs/edminiv2_defconfig  | 1 +
 configs/goflexhome_defconfig| 1 +
 configs/gose_defconfig  | 1 +
 configs/gplugd_defconfig| 1 +
 configs/gurnard_defconfig   | 1 +
 configs/guruplug_defconfig  | 1 +
 configs/harmony_defconfig   | 1 +
 configs/ib62x0_defconfig| 1 +
 configs/iconnect_defconfig  | 1 +
 configs/inetspace_v2_defconfig  | 1 +
 configs/jetson-tk1_defconfig| 1 +
 configs/koelsch_defconfig   | 1 +
 configs/lager_defconfig | 1 +
 configs/liteboard_defconfig | 1 +
 configs/lschlv2_defconfig   | 1 +
 configs/lsxhl_defconfig | 1 +
 configs/lwmon5_defconfig| 1 +
 configs/m28evk_defconfig| 1 +
 configs/ma5d4evk_defconfig  | 1 +
 configs/mccmon6_nor_defconfig   | 1 +
 configs/mccmon6_sd_defconfig| 1 +
 configs/medcom-wide_defconfig   | 1 +
 configs/mpc5121ads_defconfig| 1 +
 configs/mpc5121ads_rev2_defconfig   | 1 +
 configs/mx23_olinuxino_defconfig| 1 +
 configs/mx23evk_defconfig   | 1 +
 configs/mx28evk_auart_console_defconfig | 1 +
 configs/mx28evk_defconfig   | 1 +
 configs/mx28evk_nand_defconfig  | 1 +
 configs/mx28evk_spi_defconfig   | 1 +
 configs/mx35pdk_defconfig   | 1 +
 configs/mx6sllevk_defconfig | 1 -
 configs/mx6sllevk_plugin_defconfig  | 1 -
 configs/nas220_defconfig| 1 +
 configs/net2big_v2_defconfig| 1 +
 configs/netspace_lite_v2_defconfig  | 1 +
 configs/netspace_max_v2_defconfig   | 1 +
 configs/netspace_v2_defconfig   | 1 +
 configs/nsa310s_defconfig   | 1 +
 configs/nyan-big_defconfig  | 1 +
 configs/odroid-xu3_defconfig| 1 +
 configs/odroid_defconfig| 1 +
 configs/omap3_beagle_defconfig  | 1 +
 configs/omap3_ha_defconfig  | 1 +
 configs/omap3_overo_defconfig   | 1 +
 configs/omap4_panda_defconfig   | 1 +
 configs/omap5_uevm_defconfig| 1 +
 configs/openrd_base_defconfig   | 1 +
 configs/openrd_client_defconfig | 1 +
 configs/openrd_ultimate_defconfig   | 1 +
 configs/opos6uldev_defconfig| 1 -
 configs/p2371-_defconfig| 1 +
 configs/p2371-2180_defconfig| 1 +
 configs/p2571_defconfig | 1 +
 configs/paz00_defconfig | 1 +
 configs/picosam9g45_defconfig   | 1 +
 configs/plutux_defconfig| 1 +
 configs/pogo_e02_defconfig  | 1 +
 configs/porter_defconfig| 1 +
 configs/sama5d2_ptc_nandflash_defconfig | 1 +
 configs/sama5d2_ptc_spiflash_defconfig  | 1 +
 configs/sansa_fuze_plus_defconfig   | 1 +
 configs/sc_sps_1_defconfig  | 1 +
 configs/seaboard_defconfig  | 1 +
 configs/sheevaplug_defconfig| 1 +
 

Re: [U-Boot] [PATCH v2 05/71] dm: Add a function to create a 'live' device tree

2017-05-12 Thread Lothar Waßmann
Hi,

On Wed, 10 May 2017 08:20:44 -0600 Simon Glass wrote:
> This function converts the flat device tree into a hierarchical one with
> C structures and pointers. This is easier to access.
> 
> Signed-off-by: Simon Glass 
> ---
> 
> Changes in v2: None
> 
>  include/of_live.h |  24 
>  lib/Makefile  |   1 +
>  lib/of_live.c | 333 
> ++
>  3 files changed, 358 insertions(+)
>  create mode 100644 include/of_live.h
>  create mode 100644 lib/of_live.c
> 
> diff --git a/include/of_live.h b/include/of_live.h
> new file mode 100644
> index 00..f5303bb018
> --- /dev/null
> +++ b/include/of_live.h
> @@ -0,0 +1,24 @@
> +/*
> + * Copyright (c) 2017 Google, Inc
> + * Written by Simon Glass 
> + *
> + * SPDX-License-Identifier:  GPL-2.0+
> + *
> + * Support for a 'live' (as opposed to flat) device tree
> + */
> +
> +#ifndef _OF_LIVE_H
> +#define _OF_LIVE_H
> +
> +struct device_node;
> +
> +/**
> + * of_live_build() - build a live (hierarchical) tree from a flat DT
> + *
> + * @fdt_blob: Input tree to convert
> + * @rootp: Returns live tree that was created
> + * @return 0 if OK, -ve on error
> + */
> +int of_live_build(const void *fdt_blob, struct device_node **rootp);
> +
> +#endif
> diff --git a/lib/Makefile b/lib/Makefile
> index 23e9f1ef11..bc2fb0a361 100644
> --- a/lib/Makefile
> +++ b/lib/Makefile
> @@ -15,6 +15,7 @@ obj-$(CONFIG_ZLIB) += zlib/
>  obj-$(CONFIG_BZIP2) += bzip2/
>  obj-$(CONFIG_TIZEN) += tizen/
>  obj-$(CONFIG_FIT) += libfdt/
> +obj-$(CONFIG_OF_LIVE) += of_live.o
>  obj-$(CONFIG_CMD_DHRYSTONE) += dhry/
>  
>  obj-$(CONFIG_AES) += aes.o
> diff --git a/lib/of_live.c b/lib/of_live.c
> new file mode 100644
> index 00..51927f9e91
> --- /dev/null
> +++ b/lib/of_live.c
> @@ -0,0 +1,333 @@
> +/*
> + * Copyright 2009 Benjamin Herrenschmidt, IBM Corp
> + * b...@kernel.crashing.org
> + *
> + * Based on parts of drivers/of/fdt.c from Linux v4.9
> + * Modifications for U-Boot
> + * Copyright (c) 2017 Google, Inc
> + *
> + * SPDX-License-Identifier:  GPL-2.0+
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +static void *unflatten_dt_alloc(void **mem, unsigned long size,
> + unsigned long align)
> +{
> + void *res;
> +
> + *mem = PTR_ALIGN(*mem, align);
> + res = *mem;
> + *mem += size;
> +
> + return res;
> +}
> +
> +/**
> + * unflatten_dt_node() - Alloc and populate a device_node from the flat tree
> + * @blob: The parent device tree blob
> + * @mem: Memory chunk to use for allocating device nodes and properties
> + * @poffset: pointer to node in flat tree
> + * @dad: Parent struct device_node
> + * @nodepp: The device_node tree created by the call
> + * @fpsize: Size of the node path up at t05he current depth.
> + * @dryrun: If true, do not allocate device nodes but still calculate needed
> + * memory size
> + */
> +static void *unflatten_dt_node(const void *blob, void *mem, int *poffset,
> +struct device_node *dad,
> +struct device_node **nodepp,
> +unsigned long fpsize, bool dryrun)
> +{
> + const __be32 *p;
> + struct device_node *np;
> + struct property *pp, **prev_pp = NULL;
> + const char *pathp;
> + int l;
> + unsigned int allocl;
> + static int depth;
> + int old_depth;
> + int offset;
> + int has_name = 0;
> + int new_format = 0;
> +
> + pathp = fdt_get_name(blob, *poffset, );
> + if (!pathp)
> + return mem;
> +
> + allocl = ++l;
> +
> + /*
> +  * version 0x10 has a more compact unit name here instead of the full
> +  * path. we accumulate the full path size using "fpsize", we'll rebuild
> +  * it later. We detect this because the first character of the name is
> +  * not '/'.
> +  */
> + if ((*pathp) != '/') {
> + new_format = 1;
> + if (fpsize == 0) {
> + /*
> +  * root node: special case. fpsize accounts for path
> +  * plus terminating zero. root node only has '/', so
> +  * fpsize should be 2, but we want to avoid the first
> +  * level nodes to have two '/' so we use fpsize 1 here
> +  */
> + fpsize = 1;
> + allocl = 2;
> + l = 1;
> + pathp = "";
> + } else {
> + /*
> +  * account for '/' and path size minus terminal 0
> +  * already in 'l'
> +  */
> + fpsize += l;
> + allocl = fpsize;
> + }
> + }
> +
> + np = unflatten_dt_alloc(, sizeof(struct device_node) + allocl,
> + 

[U-Boot] [PATCH] board/freescale: Share qbman init between archs

2017-05-12 Thread Roy Pledge
From: Ahmed Mansour 

This patch adds changes necessary to move functionality present in
PowerPC folders with ARM architectures that have DPAA1 QBMan hardware

- Created new board/freescale/common/portals.c to house shared device
  tree fixups for DPAA1 devices with ARM and PowerPC cores
- Added new header file to top includes directory to allow files in
  both architectures to grab the function prototypes
- Port inhibit_portals() from PowerPC to ARM. This function is used in
  setup to disable interrupts on all QMan and BMan portals. It is
  needed because the interrupts are enabled by default for all portals
  including unused/uninitialised portals. When the kernel attempts to
  go to deep sleep the unused portals prevent it from doing so

Signed-off-by: Ahmed Mansour 
Signed-off-by: Roy Pledge 
---
 arch/arm/cpu/armv8/fsl-layerscape/cpu.c|   7 +
 arch/arm/cpu/armv8/fsl-layerscape/fdt.c|  15 +
 .../arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c |   3 +
 .../include/asm/arch-fsl-layerscape/immap_lsch2.h  |  29 ++
 arch/powerpc/cpu/mpc85xx/cpu_init.c|   3 +-
 arch/powerpc/cpu/mpc85xx/fdt.c |   1 +
 arch/powerpc/cpu/mpc85xx/portals.c | 281 ---
 arch/powerpc/include/asm/fsl_liodn.h   |   5 +-
 arch/powerpc/include/asm/fsl_portals.h |   4 -
 arch/powerpc/include/asm/immap_85xx.h  |  60 
 board/freescale/common/Makefile|   2 +
 board/freescale/common/portals.c   | 312 +
 include/configs/ls1043a_common.h   |   2 +
 include/fsl_qbman.h|  75 +
 14 files changed, 451 insertions(+), 348 deletions(-)
 create mode 100644 board/freescale/common/portals.c
 create mode 100644 include/fsl_qbman.h

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c 
b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
index bb02960..4b5b1b4 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
@@ -26,6 +26,10 @@
 #ifdef CONFIG_SYS_FSL_DDR
 #include 
 #endif
+#include 
+#ifdef CONFIG_SYS_DPAA_QBMAN
+#include 
+#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -511,6 +515,9 @@ int arch_early_init_r(void)
 #ifdef CONFIG_FMAN_ENET
fman_enet_init();
 #endif
+#ifdef CONFIG_SYS_DPAA_QBMAN
+   setup_qbman_portals();
+#endif
return 0;
 }
 
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c 
b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
index 05c4577..3b864a5 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
@@ -26,6 +26,8 @@
 #ifdef CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT
 #include 
 #endif
+#include 
+#include 
 
 int fdt_fixup_phy_connection(void *blob, int offset, phy_interface_t phyc)
 {
@@ -364,6 +366,12 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 #endif
 #endif
 
+#ifdef CONFIG_SYS_DPAA_QBMAN
+   struct sys_info sysinfo;
+
+   get_sys_info();
+#endif
+
 #ifdef CONFIG_MP
ft_fixup_cpu(blob);
 #endif
@@ -384,6 +392,13 @@ void ft_cpu_setup(void *blob, bd_t *bd)
fdt_fixup_esdhc(blob, bd);
 #endif
 
+#ifdef CONFIG_SYS_DPAA_QBMAN
+   fdt_fixup_bportals(blob);
+   fdt_fixup_qportals(blob);
+   do_fixup_by_compat_u32(blob, "fsl,qman",
+  "clock-frequency", sysinfo.freq_qman, 1);
+#endif
+
 #ifdef CONFIG_SYS_DPAA_FMAN
fdt_fixup_fman_firmware(blob);
 #endif
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c 
b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c
index 2d7775e..eaab948 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_speed.c
@@ -155,6 +155,9 @@ void get_sys_info(struct sys_info *sys_info)
sys_info->freq_localbus = sys_info->freq_systembus /
CONFIG_SYS_FSL_IFC_CLK_DIV;
 #endif
+#ifdef CONFIG_SYS_DPAA_QBMAN
+   sys_info->freq_qman = sys_info->freq_systembus;
+#endif
 }
 
 int get_clocks(void)
diff --git a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h 
b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
index 8ad199f..a8165b0 100644
--- a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
+++ b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
@@ -24,6 +24,8 @@
 #define CONFIG_SYS_FSL_GUTS_ADDR   (CONFIG_SYS_IMMR + 0x00ee)
 #define CONFIG_SYS_FSL_RST_ADDR(CONFIG_SYS_IMMR + 
0x00ee00b0)
 #define CONFIG_SYS_FSL_SCFG_ADDR   (CONFIG_SYS_IMMR + 0x0057)
+#define CONFIG_SYS_FSL_BMAN_ADDR   (CONFIG_SYS_IMMR + 0x0089)
+#define CONFIG_SYS_FSL_QMAN_ADDR   (CONFIG_SYS_IMMR + 0x0088)
 #define CONFIG_SYS_FSL_FMAN_ADDR   (CONFIG_SYS_IMMR + 0x00a0)
 #define CONFIG_SYS_FSL_SERDES_ADDR (CONFIG_SYS_IMMR + 0x00ea)
 #define 

Re: [U-Boot] [PATCH 3/5] x86: baytrail: secureboot: Add functions for verification of u-boot

2017-05-12 Thread Lothar Waßmann
Hi,

On Thu, 11 May 2017 17:14:54 +0200 Anatolij Gustschin wrote:
> From: Markus Valentin 
> 
> Introduce functions that check the integrity of u-boot by utilising the
> hashes stored in the oem-data block.
> 
> The verification functions get called in fsp_init()
> 
> Signed-off-by: Markus Valentin 
> ---
>  arch/x86/cpu/baytrail/Makefile |   1 +
>  arch/x86/cpu/baytrail/secure_boot.c| 117 
> +
>  .../include/asm/arch-baytrail/fsp/fsp_configs.h|   3 +
>  arch/x86/lib/fsp/fsp_support.c |  15 +++
>  4 files changed, 136 insertions(+)
>  create mode 100644 arch/x86/cpu/baytrail/secure_boot.c
> 
> diff --git a/arch/x86/cpu/baytrail/Makefile b/arch/x86/cpu/baytrail/Makefile
> index a0216f3..dbf9a82 100644
> --- a/arch/x86/cpu/baytrail/Makefile
> +++ b/arch/x86/cpu/baytrail/Makefile
> @@ -8,4 +8,5 @@ obj-y += cpu.o
>  obj-y += early_uart.o
>  obj-y += fsp_configs.o
>  obj-y += valleyview.o
> +obj-$(CONFIG_BAYTRAIL_SECURE_BOOT) += secure_boot.o
>  obj-$(CONFIG_GENERATE_ACPI_TABLE) += acpi.o
> diff --git a/arch/x86/cpu/baytrail/secure_boot.c 
> b/arch/x86/cpu/baytrail/secure_boot.c
> new file mode 100644
> index 000..37c83db
> --- /dev/null
> +++ b/arch/x86/cpu/baytrail/secure_boot.c
> @@ -0,0 +1,117 @@
> +/*
> + * Copyright (C) 2017 Markus Valentin 
> + *
> + * SPDX-License-Identifier: GPL-2.0+
> + */
> +
> +#include 
> +
> +#define SB_MANIFEST_BASE 0xFFFE
> +#define SB_MANIFEST_SIZE 0x400
> +#define SB_MANIFEST_OEM_DATA_OFFSET  0x58
> +#define SB_MANIFEST_OEM_HASH_OFFSET  (SB_MANIFEST_OEM_DATA_OFFSET + 4)
> +#define SB_MANIFEST_OEM_HASH_BASE(SB_MANIFEST_BASE +\
> +  SB_MANIFEST_OEM_HASH_OFFSET)
> +#define SB_MANIFEST_END  (SB_MANIFEST_BASE + 
> SB_MANIFEST_SIZE)
> +
> +#define PUB_KEY_MODULUS_SIZE 0x100
> +#define U_BOOT_STAGE_SIZE0xDD360
> +#define U_BOOT_OFFSET0x2CA0
> +
> +#define U_BOOT_STAGE_START   (CONFIG_SYS_TEXT_BASE + U_BOOT_OFFSET)
> +#define U_BOOT_STAGE_END (U_BOOT_STAGE_START + U_BOOT_STAGE_SIZE)
> +
> +#define SHA256_U_BOOT_STAGE_ID   0
> +#define SHA256_FSP_STAGE2_ID 1
> +#define SHA256_FIT_PUB_KEY_ID2
> +
> +#define FIT_KEY_NAME "dev"
> +
> +/**
> + * This function compares a hash which gets retrieved from the oem data block
> + * with the runtime calculated hash of start_address+size. If they match,
> + * this function returns true. If not, it returns false.
> + *
> + * @param hash_idoffset of oem-data block for hash to compare
> + * @param start_address  address where the hash calculation should start
> + * @param size   length of the region for hash calculation
> + * @return true on success, false on error
> + */
> +static bool verify_oem_sha256(unsigned int hash_id,
> +   void *start_address,
> +   size_t size)
> +{
> + uint8_t value[SHA256_SUM_LEN];
>
'unsigned char' here ...

> + int value_len;
> +
> + /* calculate address of hash to compare in the oemdata block*/
> + void *hash_to_verify = (void *)SB_MANIFEST_OEM_HASH_BASE +
> +(SHA256_SUM_LEN * hash_id);
> +#ifdef DEBUG
> + unsigned int i = 0;
> + uint8_t oem_value[SHA256_SUM_LEN];
> +
> + memcpy(oem_value, hash_to_verify, SHA256_SUM_LEN);
> + printf("SB: Hash to verify:\t");
> + for (i = 0; i < SHA256_SUM_LEN; i++)
> + printf("%X", oem_value[i]);
> + printf("\n");
> +#endif
> +
> + /* caluclate the hash of the binary */
> + calculate_hash(start_address, size, "sha256", (unsigned char *)value,
> +_len);
>
... would avoid the '(unsigned char *)' cast here.

> +
> +#ifdef DEBUG
> + printf("SB: calculated hash:\t");
> + for (i = 0; i < SHA256_SUM_LEN; i++)
> + printf("%X", value[i]);
> + printf("\n");
> +#endif
> + /* compare the two hash  values */
> + if (memcmp(hash_to_verify, value, SHA256_SUM_LEN))
> + return false;
> + return true;
> +}
> +
> +/**
> + * This function verifies the integrity for u-boot, its devicetree and the 
> ucode
> + * appended or inserted to the devicetree.
> + *
> + * @return true on success, false on error
> + */
> +bool verify_u_boot_bin(void)
> +{
> + return verify_oem_sha256(SHA256_U_BOOT_STAGE_ID,
> +  (void *)U_BOOT_STAGE_START,
> +  U_BOOT_STAGE_SIZE);
> +}
> +
> +/**
> + * This function verifies the integrity for the modulus of the public key 
> which
> + * is stored in the u-boot devicetree for fit image verification. It tries to
> + * find the "rsa,modulus" property in the dtb and then verifies it with the
> + * checksum stored in the oem-data block
> + *
> + * @return true on success, false on 

[U-Boot] [PATCH 07/17] omap3: Drop unused CONFIG_OMAP3_xxx board defines

2017-05-12 Thread Tom Rini
We no longer have a need for a per-board CONFIG_OMAP3_xxx define (we
have CONFIG_TARGET_xxx when this is required), so drop these unused
references.

Signed-off-by: Tom Rini 
---
 include/configs/am3517_crane.h | 2 --
 include/configs/devkit8000.h   | 1 -
 include/configs/mcx.h  | 1 -
 include/configs/nokia_rx51.h   | 1 -
 include/configs/omap3_zoom1.h  | 5 -
 scripts/config_whitelist.txt   | 5 -
 6 files changed, 15 deletions(-)

diff --git a/include/configs/am3517_crane.h b/include/configs/am3517_crane.h
index 19d1bc195113..5de39cf740f0 100644
--- a/include/configs/am3517_crane.h
+++ b/include/configs/am3517_crane.h
@@ -16,8 +16,6 @@
 /*
  * High Level Configuration Options
  */
-#define CONFIG_OMAP3_AM3517CRANE   1   /* working with CRANEBOARD */
-
 #define CONFIG_EMIF4   /* The chip has EMIF4 controller */
 
 #include   /* get chip and board defs */
diff --git a/include/configs/devkit8000.h b/include/configs/devkit8000.h
index e72cee0c000d..5884d5c67c18 100644
--- a/include/configs/devkit8000.h
+++ b/include/configs/devkit8000.h
@@ -16,7 +16,6 @@
 #define __CONFIG_H
 
 /* High Level Configuration Options */
-#define CONFIG_OMAP3_DEVKIT80001   /* working with DevKit8000 */
 #define CONFIG_MACH_TYPE   MACH_TYPE_DEVKIT8000
 
 /*
diff --git a/include/configs/mcx.h b/include/configs/mcx.h
index 44d3fa3c10c6..a72696dd683f 100644
--- a/include/configs/mcx.h
+++ b/include/configs/mcx.h
@@ -12,7 +12,6 @@
 /*
  * High Level Configuration Options
  */
-#define CONFIG_OMAP3_MCX   /* working with mcx */
 #define CONFIG_OMAP_GPIO
 
 #define CONFIG_MACH_TYPE   MACH_TYPE_MCX
diff --git a/include/configs/nokia_rx51.h b/include/configs/nokia_rx51.h
index 99d3189b3fa9..e323ea322132 100644
--- a/include/configs/nokia_rx51.h
+++ b/include/configs/nokia_rx51.h
@@ -22,7 +22,6 @@
 /*
  * High Level Configuration Options
  */
-#define CONFIG_OMAP3_RX51  /* working with RX51 */
 #define CONFIG_SYS_L2CACHE_OFF /* pretend there is no L2 CACHE */
 
 #define CONFIG_MACH_TYPE   MACH_TYPE_NOKIA_RX51
diff --git a/include/configs/omap3_zoom1.h b/include/configs/omap3_zoom1.h
index aa27a9e68a42..6c869c4c07b7 100644
--- a/include/configs/omap3_zoom1.h
+++ b/include/configs/omap3_zoom1.h
@@ -13,11 +13,6 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
-/*
- * High Level Configuration Options
- */
-#define CONFIG_OMAP3_ZOOM1 1   /* working with Zoom MDK Rev1 */
-
 #define CONFIG_NAND
 #define CONFIG_NR_DRAM_BANKS   2   /* CS1 may or may not be populated */
 #include   /* get chip and board defs */
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 93ee3035d183..b9676aa71f26 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -1979,19 +1979,14 @@ CONFIG_OF_SPI
 CONFIG_OF_SPI_FLASH
 CONFIG_OF_STDOUT_PATH
 CONFIG_OF_SUPPORT_OLD_DEVICE_TREES
-CONFIG_OMAP3_AM3517CRANE
-CONFIG_OMAP3_DEVKIT8000
 CONFIG_OMAP3_GPIO_2
 CONFIG_OMAP3_GPIO_3
 CONFIG_OMAP3_GPIO_4
 CONFIG_OMAP3_GPIO_5
 CONFIG_OMAP3_GPIO_6
 CONFIG_OMAP3_LOGIC_USE_NEW_PRODUCT_ID
-CONFIG_OMAP3_MCX
 CONFIG_OMAP3_MICRON_DDR
-CONFIG_OMAP3_RX51
 CONFIG_OMAP3_SPI_D0_D1_SWAPPED
-CONFIG_OMAP3_ZOOM1
 CONFIG_OMAP_EHCI_PHY1_RESET_GPIO
 CONFIG_OMAP_EHCI_PHY2_RESET_GPIO
 CONFIG_OMAP_EHCI_PHY3_RESET_GPIO
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 05/17] omap3: Drop CONFIG_OMAP3_EVM, switch to CONFIG_TARGET_OMAP3_EVM when needed

2017-05-12 Thread Tom Rini
We make use of CONFIG_OMAP3_EVM today to know when to do a specific
tweak in MUSB.  This can be tested on via CONFIG_TARGET_OMAP3_EVM
instead, so switch there so we can drop the now unused symbol
CONFIG_OMAP3_EVM.  In investigating what to do about the symbol usage we
see that the cairo board defines the same function, but never called it
(as it does not define CONFIG_OMAP3_EVM) and was just returning anyhow,
so drop that function from that board.

Cc: "Albert ARIBAUD (3ADEV)" 
Cc: Marek Vasut 
Signed-off-by: Tom Rini 
---
 board/quipos/cairo/cairo.c   | 12 
 drivers/usb/musb/omap3.c |  2 +-
 drivers/usb/musb/omap3.h |  2 +-
 include/configs/omap3_evm.h  |  2 --
 scripts/config_whitelist.txt |  1 -
 5 files changed, 2 insertions(+), 17 deletions(-)

diff --git a/board/quipos/cairo/cairo.c b/board/quipos/cairo/cairo.c
index 7a1a61e38697..5e2f486f8e76 100644
--- a/board/quipos/cairo/cairo.c
+++ b/board/quipos/cairo/cairo.c
@@ -26,18 +26,6 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
- * MUSB port on OMAP3EVM Rev >= E requires extvbus programming.
- */
-u8 omap3_evm_need_extvbus(void)
-{
-   u8 retval = 0;
-
-   /* TODO: verify if cairo handheld platform needs extvbus programming */
-
-   return retval;
-}
-
-/*
  * Routine: board_init
  * Description: Early hardware init.
  */
diff --git a/drivers/usb/musb/omap3.c b/drivers/usb/musb/omap3.c
index 97da529b44e9..99b4291a27d8 100644
--- a/drivers/usb/musb/omap3.c
+++ b/drivers/usb/musb/omap3.c
@@ -118,7 +118,7 @@ int musb_platform_init(void)
stdby &= ~OMAP3_OTG_FORCESTDBY_STANDBY;
writel(stdby, >forcestdby);
 
-#ifdef CONFIG_OMAP3_EVM
+#ifdef CONFIG_TARGET_OMAP3_EVM
musb_cfg.extvbus = omap3_evm_need_extvbus();
 #endif
 
diff --git a/drivers/usb/musb/omap3.h b/drivers/usb/musb/omap3.h
index ae645c72de74..d91ad0a85b32 100644
--- a/drivers/usb/musb/omap3.h
+++ b/drivers/usb/musb/omap3.h
@@ -32,7 +32,7 @@
 
 int musb_platform_init(void);
 
-#ifdef CONFIG_OMAP3_EVM
+#ifdef CONFIG_TARGET_OMAP3_EVM
 extern u8 omap3_evm_need_extvbus(void);
 #endif
 
diff --git a/include/configs/omap3_evm.h b/include/configs/omap3_evm.h
index c4cac83bb8b0..2239a029c4dd 100644
--- a/include/configs/omap3_evm.h
+++ b/include/configs/omap3_evm.h
@@ -87,8 +87,6 @@
 
 #define CONFIG_SDRC/* The chip has SDRC controller */
 
-#define CONFIG_OMAP3_EVM   /* This is a OMAP3 EVM */
-
 /*
  * Clock related definitions
  */
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 87719048ca96..4382b6aa1a1f 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -1981,7 +1981,6 @@ CONFIG_OF_STDOUT_PATH
 CONFIG_OF_SUPPORT_OLD_DEVICE_TREES
 CONFIG_OMAP3_AM3517CRANE
 CONFIG_OMAP3_DEVKIT8000
-CONFIG_OMAP3_EVM
 CONFIG_OMAP3_GPIO_2
 CONFIG_OMAP3_GPIO_3
 CONFIG_OMAP3_GPIO_4
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 14/17] Kconfig: USB: Migrate CONFIG_USB_EHCI to CONFIG_USB_EHCI_HCD

2017-05-12 Thread Tom Rini
In order to be able to migrate the various SoC EHCI CONFIG options we
first need to finish the switch from CONFIG_USB_EHCI to
CONFIG_USB_EHCI_HCD.

Cc: Marek Vasut 
Signed-off-by: Tom Rini 
---
 arch/arm/include/asm/arch-mx7ulp/clock.h  | 2 +-
 arch/arm/mach-at91/arm926ejs/at91sam9x5_devices.c | 2 +-
 arch/arm/mach-uniphier/clk/clk-ld11.c | 2 +-
 arch/arm/mach-uniphier/clk/clk-ld4.c  | 2 +-
 arch/arm/mach-uniphier/clk/clk-pro4.c | 2 +-
 board/atmel/at91sam9x5ek/at91sam9x5ek.c   | 2 +-
 board/compulab/cm_t54/cm_t54.c| 2 +-
 board/gumstix/duovero/duovero.c   | 4 ++--
 board/htkw/mcx/mcx.c  | 4 ++--
 board/overo/overo.c   | 6 +++---
 board/technexion/tao3530/tao3530.c| 4 ++--
 board/technexion/twister/twister.c| 4 ++--
 board/teejet/mt_ventoux/mt_ventoux.c  | 4 ++--
 board/ti/beagle/beagle.c  | 6 +++---
 board/ti/omap5_uevm/evm.c | 6 +++---
 board/ti/panda/panda.c| 4 ++--
 common/usb_storage.c  | 2 +-
 drivers/usb/host/Kconfig  | 6 --
 drivers/usb/host/Makefile | 2 +-
 include/configs/B4860QDS.h| 4 ++--
 include/configs/BSC9131RDB.h  | 4 ++--
 include/configs/BSC9132QDS.h  | 4 ++--
 include/configs/M52277EVB.h   | 2 +-
 include/configs/MPC8315ERDB.h | 2 +-
 include/configs/MPC8349ITX.h  | 2 +-
 include/configs/MPC837XEMDS.h | 2 +-
 include/configs/MPC837XERDB.h | 2 +-
 include/configs/MPC8536DS.h   | 4 ++--
 include/configs/MPC8544DS.h   | 4 ++--
 include/configs/MPC8572DS.h   | 4 ++--
 include/configs/P1010RDB.h| 6 +++---
 include/configs/P1022DS.h | 4 ++--
 include/configs/P1023RDB.h| 4 ++--
 include/configs/P2041RDB.h| 2 +-
 include/configs/T102xQDS.h| 2 +-
 include/configs/T102xRDB.h| 2 +-
 include/configs/T1040QDS.h| 4 ++--
 include/configs/T104xRDB.h| 4 ++--
 include/configs/T208xQDS.h| 4 ++--
 include/configs/T208xRDB.h| 4 ++--
 include/configs/T4240QDS.h| 2 +-
 include/configs/T4240RDB.h| 2 +-
 include/configs/UCP1020.h | 4 ++--
 include/configs/advantech_dms-ba16.h  | 2 +-
 include/configs/alt.h | 2 +-
 include/configs/apalis-tk1.h  | 2 +-
 include/configs/apalis_t30.h  | 2 +-
 include/configs/aristainetos-common.h | 2 +-
 include/configs/at91sam9x5ek.h| 4 ++--
 include/configs/beaver.h  | 2 +-
 include/configs/cardhu.h  | 2 +-
 include/configs/cei-tk1-som.h | 2 +-
 include/configs/cgtqmx6eval.h | 2 +-
 include/configs/cm_t35.h  | 2 +-
 include/configs/cm_t3517.h| 2 +-
 include/configs/cm_t54.h  | 2 +-
 include/configs/colibri_t20.h | 2 +-
 include/configs/colibri_t30.h | 2 +-
 include/configs/colibri_vf.h  | 2 +-
 include/configs/controlcenterd.h  | 2 +-
 include/configs/corenet_ds.h  | 2 +-
 include/configs/corvus.h  | 2 +-
 include/configs/cyrus.h   | 2 +-
 include/configs/dalmore.h | 2 +-
 include/configs/ds414.h   | 2 +-
 include/configs/duovero.h | 2 +-
 include/configs/e2220-1170.h  | 2 +-
 include/configs/eco5pk.h  | 2 +-
 include/configs/edminiv2.h| 2 +-
 include/configs/embestmx6boards.h | 2 +-
 include/configs/exynos5250-common.h   | 2 +-
 include/configs/ge_bx50v3.h   | 2 +-
 include/configs/gose.h| 2 +-
 include/configs/gplugd.h  | 2 +-
 include/configs/gw_ventana.h  | 2 +-
 include/configs/harmony.h | 2 +-
 include/configs/jetson-tk1.h  | 2 +-
 include/configs/koelsch.h | 2 +-
 include/configs/lager.h   | 2 +-
 include/configs/liteboard.h   | 2 +-
 include/configs/ls1012aqds.h  | 2 +-
 

[U-Boot] [PATCH 11/17] watchdog: Migrate OMAP_WATCHDOG to Kconfig

2017-05-12 Thread Tom Rini
Move this entry to Kconfig.  As it is a hardware watchdog, select
HW_WATCHDOG.  While we could default to enabling this for all platforms,
it is currently only enabled by default on AM33XX, so keep that logic
today.

Cc: Roger Meier 
Signed-off-by: Tom Rini 
---
Note that 'rut' is in an odd place in that it undefines HW_WATCHDOG for
SPL, but still defines CONFIG_SPL_WATCHDOG_SUPPORT.  If there should be
no watchdog support in SPL, the right thing to do would be to disable
CONFIG_SPL_WATCHDOG_SUPPORT.  This keeps, AFAICT, the status quo.
---
 configs/brppt1_mmc_defconfig   | 1 +
 configs/brppt1_nand_defconfig  | 1 +
 configs/brppt1_spi_defconfig   | 1 +
 configs/draco_defconfig| 1 +
 configs/etamin_defconfig   | 1 +
 configs/pxm2_defconfig | 1 +
 configs/rastaban_defconfig | 1 +
 configs/thuban_defconfig   | 1 +
 drivers/watchdog/Kconfig   | 8 
 include/configs/brppt1.h   | 3 ---
 include/configs/draco.h| 3 ---
 include/configs/etamin.h   | 3 ---
 include/configs/pxm2.h | 3 ---
 include/configs/rastaban.h | 3 ---
 include/configs/rut.h  | 4 
 include/configs/siemens-am33x-common.h | 3 ---
 include/configs/thuban.h   | 3 ---
 include/configs/ti_am335x_common.h | 4 
 scripts/config_whitelist.txt   | 1 -
 19 files changed, 16 insertions(+), 30 deletions(-)

diff --git a/configs/brppt1_mmc_defconfig b/configs/brppt1_mmc_defconfig
index 7d92c139402a..1bdbf9049597 100644
--- a/configs/brppt1_mmc_defconfig
+++ b/configs/brppt1_mmc_defconfig
@@ -57,4 +57,5 @@ CONFIG_USB_MUSB_HOST=y
 CONFIG_USB_STORAGE=y
 CONFIG_SYS_WHITE_ON_BLACK=y
 CONFIG_LCD=y
+CONFIG_OMAP_WATCHDOG=y
 CONFIG_OF_LIBFDT=y
diff --git a/configs/brppt1_nand_defconfig b/configs/brppt1_nand_defconfig
index 9abe61760e10..ed7432d7f42d 100644
--- a/configs/brppt1_nand_defconfig
+++ b/configs/brppt1_nand_defconfig
@@ -57,4 +57,5 @@ CONFIG_USB_MUSB_HOST=y
 CONFIG_USB_STORAGE=y
 CONFIG_SYS_WHITE_ON_BLACK=y
 CONFIG_LCD=y
+CONFIG_OMAP_WATCHDOG=y
 CONFIG_OF_LIBFDT=y
diff --git a/configs/brppt1_spi_defconfig b/configs/brppt1_spi_defconfig
index 79bb9057bfc2..02b5ff60e21d 100644
--- a/configs/brppt1_spi_defconfig
+++ b/configs/brppt1_spi_defconfig
@@ -65,4 +65,5 @@ CONFIG_USB_MUSB_HOST=y
 CONFIG_USB_STORAGE=y
 CONFIG_SYS_WHITE_ON_BLACK=y
 CONFIG_LCD=y
+CONFIG_OMAP_WATCHDOG=y
 CONFIG_OF_LIBFDT=y
diff --git a/configs/draco_defconfig b/configs/draco_defconfig
index 2ecdd3c8f68d..0e50b3109ea2 100644
--- a/configs/draco_defconfig
+++ b/configs/draco_defconfig
@@ -65,3 +65,4 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_G_DNL_MANUFACTURER="Siemens AG"
 CONFIG_G_DNL_VENDOR_NUM=0x0908
 CONFIG_G_DNL_PRODUCT_NUM=0x02d2
+CONFIG_OMAP_WATCHDOG=y
diff --git a/configs/etamin_defconfig b/configs/etamin_defconfig
index 7e0b1923b8ac..b6911fd71743 100644
--- a/configs/etamin_defconfig
+++ b/configs/etamin_defconfig
@@ -65,3 +65,4 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_G_DNL_MANUFACTURER="Siemens AG"
 CONFIG_G_DNL_VENDOR_NUM=0x0908
 CONFIG_G_DNL_PRODUCT_NUM=0x02d2
+CONFIG_OMAP_WATCHDOG=y
diff --git a/configs/pxm2_defconfig b/configs/pxm2_defconfig
index c40684a81d48..67bdfd63f259 100644
--- a/configs/pxm2_defconfig
+++ b/configs/pxm2_defconfig
@@ -72,3 +72,4 @@ CONFIG_G_DNL_PRODUCT_NUM=0x02d2
 # CONFIG_VIDEO_SW_CURSOR is not set
 CONFIG_SYS_CONSOLE_BG_COL=0xff
 CONFIG_SYS_CONSOLE_FG_COL=0x00
+CONFIG_OMAP_WATCHDOG=y
diff --git a/configs/rastaban_defconfig b/configs/rastaban_defconfig
index 01848c5702ab..f77d4d408793 100644
--- a/configs/rastaban_defconfig
+++ b/configs/rastaban_defconfig
@@ -65,3 +65,4 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_G_DNL_MANUFACTURER="Siemens AG"
 CONFIG_G_DNL_VENDOR_NUM=0x0908
 CONFIG_G_DNL_PRODUCT_NUM=0x02d2
+CONFIG_OMAP_WATCHDOG=y
diff --git a/configs/thuban_defconfig b/configs/thuban_defconfig
index dd61ead647cd..914f70fd6a01 100644
--- a/configs/thuban_defconfig
+++ b/configs/thuban_defconfig
@@ -65,3 +65,4 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_G_DNL_MANUFACTURER="Siemens AG"
 CONFIG_G_DNL_VENDOR_NUM=0x0908
 CONFIG_G_DNL_PRODUCT_NUM=0x02d2
+CONFIG_OMAP_WATCHDOG=y
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index bdaf5d4101d2..22a7c4f80180 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -12,6 +12,14 @@ config BCM2835_WDT
  This provides basic infrastructure to support BCM2835/2836 watchdog
  hardware, with a max timeout of ~15secs.
 
+config OMAP_WATCHDOG
+   bool "TI OMAP watchdog driver"
+   depends on ARCH_OMAP2PLUS
+   select HW_WATCHDOG
+   default y if AM33XX
+   help
+ Say Y here to enable the OMAP3+ watchdog driver.
+   
 config ULP_WATCHDOG
bool "i.MX7ULP watchdog"
help
diff --git a/include/configs/brppt1.h b/include/configs/brppt1.h
index 0c1a54d7ba2e..521d097f8a96 100644
--- 

[U-Boot] [PATCH 17/17] Kconfig: OMAP: USB: Migrate CONFIG_USB_EHCI_OMAP to Kconfig

2017-05-12 Thread Tom Rini
Follow the exiting logic for the i.MX options when migrating this
option.

Cc: Marek Vasut 
Signed-off-by: Tom Rini 
---
 configs/eco5pk_defconfig | 1 +
 drivers/usb/host/Kconfig | 8 
 include/configs/cm_t35.h | 1 -
 include/configs/cm_t3517.h   | 1 -
 include/configs/cm_t54.h | 1 -
 include/configs/duovero.h| 1 -
 include/configs/eco5pk.h | 1 -
 include/configs/mcx.h| 1 -
 include/configs/omap3_beagle.h   | 1 -
 include/configs/omap3_overo.h| 1 -
 include/configs/omap4_panda.h| 1 -
 include/configs/omap5_uevm.h | 1 -
 include/configs/tam3517-common.h | 1 -
 include/configs/tao3530.h| 1 -
 scripts/config_whitelist.txt | 1 -
 15 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/configs/eco5pk_defconfig b/configs/eco5pk_defconfig
index a6de0b23e12b..61ac94bbba86 100644
--- a/configs/eco5pk_defconfig
+++ b/configs/eco5pk_defconfig
@@ -25,5 +25,6 @@ CONFIG_MMC_OMAP_HS=y
 CONFIG_SYS_NS16550=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
+# CONFIG_USB_EHCI_OMAP is not set
 CONFIG_USB_STORAGE=y
 CONFIG_OF_LIBFDT=y
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 03c15dd6293e..9a67e43c2d94 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -105,6 +105,14 @@ config USB_EHCI_MX7
---help---
  Enables support for the on-chip EHCI controller on i.MX7 SoCs.
 
+config USB_EHCI_OMAP
+   bool "Support for OMAP3+ on-chip EHCI USB controller"
+   depends on ARCH_OMAP2PLUS
+   default y
+   ---help---
+ Enables support for the on-chip EHCI controller on OMAP3 and later
+ SoCs.
+
 if USB_EHCI_MX7
 
 config MXC_USB_OTG_HACTIVE
diff --git a/include/configs/cm_t35.h b/include/configs/cm_t35.h
index 425b14957466..1898e3837d52 100644
--- a/include/configs/cm_t35.h
+++ b/include/configs/cm_t35.h
@@ -75,7 +75,6 @@
 
 /* USB */
 #define CONFIG_USB_OMAP3
-#define CONFIG_USB_EHCI_OMAP
 #define CONFIG_USB_MUSB_UDC
 #define CONFIG_TWL4030_USB
 
diff --git a/include/configs/cm_t3517.h b/include/configs/cm_t3517.h
index 2417d16375c0..0df7d4269cbb 100644
--- a/include/configs/cm_t3517.h
+++ b/include/configs/cm_t3517.h
@@ -84,7 +84,6 @@
 
 #ifndef CONFIG_USB_MUSB_AM35X
 #define CONFIG_USB_OMAP3
-#define CONFIG_USB_EHCI_OMAP
 #define CONFIG_OMAP_EHCI_PHY1_RESET_GPIO 146
 #define CONFIG_OMAP_EHCI_PHY2_RESET_GPIO 147
 #else /* !CONFIG_USB_MUSB_AM35X */
diff --git a/include/configs/cm_t54.h b/include/configs/cm_t54.h
index 5c3bf6930046..ccaa56800946 100644
--- a/include/configs/cm_t54.h
+++ b/include/configs/cm_t54.h
@@ -58,7 +58,6 @@
 #define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \
CONFIG_SYS_SCSI_MAX_LUN)
 /* USB UHH support options */
-#define CONFIG_USB_EHCI_OMAP
 #define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
 
diff --git a/include/configs/duovero.h b/include/configs/duovero.h
index e7fcc7e01899..f1422316891f 100644
--- a/include/configs/duovero.h
+++ b/include/configs/duovero.h
@@ -25,7 +25,6 @@
 #define CONFIG_SYS_DEFAULT_LPDDR2_TIMINGS
 
 /* USB UHH support options */
-#define CONFIG_USB_EHCI_OMAP
 #define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3
 
 #define CONFIG_OMAP_EHCI_PHY1_RESET_GPIO 1
diff --git a/include/configs/eco5pk.h b/include/configs/eco5pk.h
index c0953d7c04b0..3d7a168bc4ee 100644
--- a/include/configs/eco5pk.h
+++ b/include/configs/eco5pk.h
@@ -15,7 +15,6 @@
 
 #include "tam3517-common.h"
 
-#undef CONFIG_USB_EHCI_OMAP
 #undef CONFIG_USB_OMAP3
 
 /* Our console port is port3 */
diff --git a/include/configs/mcx.h b/include/configs/mcx.h
index 09f8b968ede8..c70e68c5b0c3 100644
--- a/include/configs/mcx.h
+++ b/include/configs/mcx.h
@@ -73,7 +73,6 @@
115200}
 
 /* EHCI */
-#define CONFIG_USB_EHCI_OMAP
 #define CONFIG_OMAP_EHCI_PHY1_RESET_GPIO   57
 #define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3
 #defineCONFIG_USB_HOST_ETHER
diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h
index d27ceec30c96..0d48d4ecc1c9 100644
--- a/include/configs/omap3_beagle.h
+++ b/include/configs/omap3_beagle.h
@@ -56,7 +56,6 @@
 
 /* USB EHCI */
 
-#define CONFIG_USB_EHCI_OMAP
 #define CONFIG_OMAP_EHCI_PHY1_RESET_GPIO   147
 
 #define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3
diff --git a/include/configs/omap3_overo.h b/include/configs/omap3_overo.h
index 050c3b1f4309..111aec58d391 100644
--- a/include/configs/omap3_overo.h
+++ b/include/configs/omap3_overo.h
@@ -40,7 +40,6 @@
 #define CONFIG_TWL4030_LED
 
 /* USB EHCI */
-#define CONFIG_USB_EHCI_OMAP
 #define CONFIG_OMAP_EHCI_PHY1_RESET_GPIO   183
 #define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3
 
diff --git a/include/configs/omap4_panda.h b/include/configs/omap4_panda.h
index 51a3c8c409ff..e1263b68bcf2 100644
--- a/include/configs/omap4_panda.h
+++ b/include/configs/omap4_panda.h
@@ 

[U-Boot] [PATCH 09/17] omap3: Migrate CONFIG_OMAP3_GPIO_X to Kconfig

2017-05-12 Thread Tom Rini
The symbols CONFIG_OMAP3_GPIO_X control if we enable the clocks for a
given GPIO bank in U-Boot.  select the required banks for each target.
In some cases we need to also migrate from CONFIG_USB_EHCI (deprecated,
in include/configs/) to CONFIG_USB_EHCI_HCD as we only require the GPIO
bank to be enabled if USB is also enabled.

Signed-off-by: Tom Rini 
---
 arch/arm/mach-omap2/omap3/Kconfig | 54 +++
 configs/eco5pk_defconfig  |  1 +
 configs/mcx_defconfig |  1 +
 configs/mt_ventoux_defconfig  |  1 +
 configs/twister_defconfig |  1 +
 include/configs/cm_t35.h  |  7 -
 include/configs/cm_t3517.h|  7 -
 include/configs/mcx.h |  3 ---
 include/configs/mt_ventoux.h  |  1 -
 include/configs/omap3_beagle.h|  4 ---
 include/configs/omap3_igep00x0.h  |  5 
 include/configs/omap3_logic.h |  4 ---
 include/configs/omap3_overo.h |  7 -
 include/configs/omap3_pandora.h   |  4 ---
 include/configs/sniper.h  |  9 ---
 include/configs/tam3517-common.h  |  2 --
 include/configs/tao3530.h |  7 -
 include/configs/tricorder.h   |  5 
 include/configs/twister.h |  3 ---
 scripts/config_whitelist.txt  |  5 
 20 files changed, 58 insertions(+), 73 deletions(-)

diff --git a/arch/arm/mach-omap2/omap3/Kconfig 
b/arch/arm/mach-omap2/omap3/Kconfig
index 933fcba37cf5..7b298d671dd5 100644
--- a/arch/arm/mach-omap2/omap3/Kconfig
+++ b/arch/arm/mach-omap2/omap3/Kconfig
@@ -1,5 +1,21 @@
 if OMAP34XX
 
+# We only enable the clocks for the GPIO banks that a given board requies.
+config OMAP3_GPIO_2
+   bool
+
+config OMAP3_GPIO_3
+   bool
+
+config OMAP3_GPIO_4
+   bool
+
+config OMAP3_GPIO_5
+   bool
+
+config OMAP3_GPIO_6
+   bool
+
 choice
prompt "OMAP3 board select"
optional
@@ -9,18 +25,28 @@ config TARGET_AM3517_EVM
 
 config TARGET_MT_VENTOUX
bool "TeeJet Mt.Ventoux"
+   select OMAP3_GPIO_4
+   select OMAP3_GPIO_5 if USB_EHCI_HCD
 
 config TARGET_OMAP3_BEAGLE
bool "TI OMAP3 BeagleBoard"
select DM
select DM_SERIAL
select DM_GPIO
+   select OMAP3_GPIO_5
+   select OMAP3_GPIO_6
 
 config TARGET_CM_T35
bool "CompuLab CM-T3530 and CM-T3730 boards"
+   select OMAP3_GPIO_2
+   select OMAP3_GPIO_5
+   select OMAP3_GPIO_6 if LED_STATUS
 
 config TARGET_CM_T3517
bool "CompuLab CM-T3517 boards"
+   select OMAP3_GPIO_2
+   select OMAP3_GPIO_5
+   select OMAP3_GPIO_6 if LED_STATUS
 
 config TARGET_DEVKIT8000
bool "TimLL OMAP3 Devkit8000"
@@ -36,12 +62,20 @@ config TARGET_OMAP3_IGEP00X0
select DM
select DM_SERIAL
select DM_GPIO
+   select OMAP3_GPIO_3
+   select OMAP3_GPIO_5
+   select OMAP3_GPIO_6
 
 config TARGET_OMAP3_OVERO
bool "OMAP35xx Gumstix Overo"
select DM
select DM_SERIAL
select DM_GPIO
+   select OMAP3_GPIO_2
+   select OMAP3_GPIO_3
+   select OMAP3_GPIO_4
+   select OMAP3_GPIO_5
+   select OMAP3_GPIO_6
 
 config TARGET_OMAP3_ZOOM1
bool "TI Zoom1"
@@ -54,16 +88,22 @@ config TARGET_AM3517_CRANE
 
 config TARGET_OMAP3_PANDORA
bool "OMAP3 Pandora"
+   select OMAP3_GPIO_4
+   select OMAP3_GPIO_6
 
 config TARGET_ECO5PK
bool "ECO5PK"
+   select OMAP3_GPIO_5 if USB_EHCI_HCD
 
 config TARGET_TRICORDER
bool "Tricorder"
+   select OMAP3_GPIO_2
 
 config TARGET_MCX
bool "MCX"
select BOARD_LATE_INIT
+   select OMAP3_GPIO_2 if USB_EHCI_HCD
+   select OMAP3_GPIO_5 if USB_EHCI_HCD
 
 config TARGET_OMAP3_LOGIC
bool "OMAP3 Logic"
@@ -71,15 +111,24 @@ config TARGET_OMAP3_LOGIC
select DM
select DM_SERIAL
select DM_GPIO
+   select OMAP3_GPIO_4
+   select OMAP3_GPIO_6
 
 config TARGET_NOKIA_RX51
bool "Nokia RX51"
 
 config TARGET_TAO3530
bool "TAO3530"
+   select OMAP3_GPIO_2
+   select OMAP3_GPIO_3
+   select OMAP3_GPIO_4
+   select OMAP3_GPIO_5
+   select OMAP3_GPIO_6
 
 config TARGET_TWISTER
bool "Twister"
+   select OMAP3_GPIO_2
+   select OMAP3_GPIO_5 if USB_EHCI_HCD
 
 config TARGET_OMAP3_CAIRO
bool "QUIPOS CAIRO"
@@ -92,6 +141,11 @@ config TARGET_SNIPER
select DM
select DM_SERIAL
select DM_GPIO
+   select OMAP3_GPIO_2
+   select OMAP3_GPIO_3
+   select OMAP3_GPIO_4
+   select OMAP3_GPIO_5
+   select OMAP3_GPIO_6
 
 endchoice
 
diff --git a/configs/eco5pk_defconfig b/configs/eco5pk_defconfig
index 2f3d81416390..a6de0b23e12b 100644
--- a/configs/eco5pk_defconfig
+++ b/configs/eco5pk_defconfig
@@ -24,5 +24,6 @@ CONFIG_CMD_UBI=y
 CONFIG_MMC_OMAP_HS=y
 CONFIG_SYS_NS16550=y
 CONFIG_USB=y
+CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
 CONFIG_OF_LIBFDT=y
diff --git a/configs/mcx_defconfig b/configs/mcx_defconfig
index 

[U-Boot] [PATCH 08/17] gpio: Move OMAP_GPIO to Kconfig

2017-05-12 Thread Tom Rini
This driver is used often enough such that we want to have this enabled
by default on any ARCH_OMAP2PLUS board, and this only compiles on
ARCH_OMAP2PLUS due to required defines, so mark that as the depends.

Signed-off-by: Tom Rini 
---
 drivers/gpio/Kconfig   | 8 
 include/configs/am3517_evm.h   | 3 ---
 include/configs/bur_am335x_common.h| 2 --
 include/configs/cm_t35.h   | 1 -
 include/configs/cm_t3517.h | 2 --
 include/configs/kc1.h  | 6 --
 include/configs/mcx.h  | 1 -
 include/configs/nokia_rx51.h   | 1 -
 include/configs/omap3_evm.h| 1 -
 include/configs/siemens-am33x-common.h | 4 
 include/configs/sniper.h   | 2 --
 include/configs/tam3517-common.h   | 1 -
 include/configs/tao3530.h  | 1 -
 include/configs/ti814x_evm.h   | 2 --
 include/configs/ti816x_evm.h   | 1 -
 include/configs/ti_armv7_omap.h| 3 ---
 include/configs/tricorder.h| 3 ---
 scripts/config_whitelist.txt   | 1 -
 18 files changed, 8 insertions(+), 35 deletions(-)

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 325d053931f7..15135e538dc6 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -95,6 +95,14 @@ config MSM_GPIO
  - APQ8016
  - MSM8916
 
+config OMAP_GPIO
+   bool "TI OMAP GPIO driver"
+   depends on ARCH_OMAP2PLUS
+   default y
+   help
+ Support GPIO controllers on the TI OMAP3/4/5 and related (such as
+ AM335x/AM43xx/AM57xx/DRA7xx/etc) families of SoCs.
+
 config PM8916_GPIO
bool "Qualcomm PM8916 PMIC GPIO/keypad driver"
depends on DM_GPIO && PMIC_PM8916
diff --git a/include/configs/am3517_evm.h b/include/configs/am3517_evm.h
index 27d64eaf8a54..feb7b6eb9745 100644
--- a/include/configs/am3517_evm.h
+++ b/include/configs/am3517_evm.h
@@ -45,9 +45,6 @@
 
 /* Hardware drivers */
 
-/* OMAP GPIO configuration */
-#define CONFIG_OMAP_GPIO
-
 /* NS16550 Configuration */
 #define V_NS16550_CLK  4800/* 48MHz (APLL96/2) */
 #define CONFIG_SYS_NS16550_SERIAL
diff --git a/include/configs/bur_am335x_common.h 
b/include/configs/bur_am335x_common.h
index 4f57241e1feb..7aad7ea51f69 100644
--- a/include/configs/bur_am335x_common.h
+++ b/include/configs/bur_am335x_common.h
@@ -75,8 +75,6 @@
 #define CONFIG_SYS_OMAP24_I2C_SPEED10
 #define CONFIG_SYS_OMAP24_I2C_SLAVE1
 #define CONFIG_SYS_I2C_OMAP24XX
-/* GPIO */
-#define CONFIG_OMAP_GPIO
 
 /*
  * Our platforms make use of SPL to initalize the hardware (primarily
diff --git a/include/configs/cm_t35.h b/include/configs/cm_t35.h
index 2d5b6f21d38a..349a8de77739 100644
--- a/include/configs/cm_t35.h
+++ b/include/configs/cm_t35.h
@@ -22,7 +22,6 @@
 /*
  * High Level Configuration Options
  */
-#define CONFIG_OMAP_GPIO
 #define CONFIG_CM_T3X  /* working with CM-T35 and CM-T3730 */
 
 #define CONFIG_SDRC/* The chip has SDRC controller */
diff --git a/include/configs/cm_t3517.h b/include/configs/cm_t3517.h
index 8093e7fc7736..2fed3124f736 100644
--- a/include/configs/cm_t3517.h
+++ b/include/configs/cm_t3517.h
@@ -79,8 +79,6 @@
 #define CONFIG_SYS_BAUDRATE_TABLE  {4800, 9600, 19200, 38400, 57600,\
115200}
 
-#define CONFIG_OMAP_GPIO
-
 /* USB */
 #define CONFIG_USB_MUSB_AM35X
 
diff --git a/include/configs/kc1.h b/include/configs/kc1.h
index 39c750c15e01..343685a652de 100644
--- a/include/configs/kc1.h
+++ b/include/configs/kc1.h
@@ -54,12 +54,6 @@
 #define CONFIG_SYS_MALLOC_LEN  (1024 * 1024 + CONFIG_ENV_SIZE)
 
 /*
- * GPIO
- */
-
-#define CONFIG_OMAP_GPIO
-
-/*
  * I2C
  */
 
diff --git a/include/configs/mcx.h b/include/configs/mcx.h
index a72696dd683f..c698166c4ea0 100644
--- a/include/configs/mcx.h
+++ b/include/configs/mcx.h
@@ -12,7 +12,6 @@
 /*
  * High Level Configuration Options
  */
-#define CONFIG_OMAP_GPIO
 
 #define CONFIG_MACH_TYPE   MACH_TYPE_MCX
 
diff --git a/include/configs/nokia_rx51.h b/include/configs/nokia_rx51.h
index e323ea322132..5e2d5991e76d 100644
--- a/include/configs/nokia_rx51.h
+++ b/include/configs/nokia_rx51.h
@@ -125,7 +125,6 @@
 #define CONFIG_TWL4030_LED
 #define CONFIG_TWL4030_KEYPAD
 
-#define CONFIG_OMAP_GPIO
 #define GPIO_SLIDE 71
 
 /*
diff --git a/include/configs/omap3_evm.h b/include/configs/omap3_evm.h
index 2239a029c4dd..d8ca6225d6e6 100644
--- a/include/configs/omap3_evm.h
+++ b/include/configs/omap3_evm.h
@@ -83,7 +83,6 @@
 /*
  * High level configuration options
  */
-#define CONFIG_OMAP_GPIO
 
 #define CONFIG_SDRC/* The chip has SDRC controller */
 
diff --git a/include/configs/siemens-am33x-common.h 
b/include/configs/siemens-am33x-common.h
index 68278c06cc7a..81586969e263 100644
--- a/include/configs/siemens-am33x-common.h
+++ b/include/configs/siemens-am33x-common.h
@@ -547,10 +547,6 @@
 #endif
 #endif
 

[U-Boot] [PATCH 16/17] Kconfig: USB: Migrate existing USB_EHCI_xxx options

2017-05-12 Thread Tom Rini
The following options are migrated over fully now:
- USB_EHCI_ATMEL
- USB_EHCI_MARVELL
- USB_EHCI_MX6
- USB_EHCI_MX7
- USB_EHCI_MSM
- USB_EHCI_ZYNQ
- USB_EHCI_GENERIC

This also requires fixing the depends on USB_EHCI_MARVELL as it's used
by Orion5X and Kirkwood as well.

Cc: Marek Vasut 
Signed-off-by: Tom Rini 
---
 arch/arm/mach-kirkwood/include/mach/config.h | 1 -
 drivers/usb/host/Kconfig | 4 ++--
 include/configs/advantech_dms-ba16.h | 1 -
 include/configs/aristainetos-common.h| 1 -
 include/configs/cgtqmx6eval.h| 1 -
 include/configs/corvus.h | 1 -
 include/configs/ds414.h  | 1 -
 include/configs/edminiv2.h   | 1 -
 include/configs/embestmx6boards.h| 1 -
 include/configs/ge_bx50v3.h  | 1 -
 include/configs/gw_ventana.h | 1 -
 include/configs/liteboard.h  | 1 -
 include/configs/ma5d4evk.h   | 1 -
 include/configs/mccmon6.h| 1 -
 include/configs/mx6cuboxi.h  | 1 -
 include/configs/mx6qarm2.h   | 1 -
 include/configs/mx6qsabreauto.h  | 1 -
 include/configs/mx6sabresd.h | 1 -
 include/configs/mx6slevk.h   | 1 -
 include/configs/mx6sxsabreauto.h | 1 -
 include/configs/mx6sxsabresd.h   | 1 -
 include/configs/mx6ul_14x14_evk.h| 1 -
 include/configs/nitrogen6x.h | 1 -
 include/configs/novena.h | 1 -
 include/configs/ot1200.h | 1 -
 include/configs/pico-imx6ul.h| 1 -
 include/configs/picosam9g45.h| 1 -
 include/configs/platinum.h   | 1 -
 include/configs/sama5d2_ptc.h| 1 -
 include/configs/snapper9g45.h| 1 -
 include/configs/tbs2910.h| 1 -
 include/configs/titanium.h   | 1 -
 include/configs/tqma6.h  | 1 -
 include/configs/vinco.h  | 1 -
 include/configs/vining_2000.h| 1 -
 include/configs/wandboard.h  | 1 -
 include/configs/warp.h   | 1 -
 include/configs/xpress.h | 1 -
 38 files changed, 2 insertions(+), 39 deletions(-)

diff --git a/arch/arm/mach-kirkwood/include/mach/config.h 
b/arch/arm/mach-kirkwood/include/mach/config.h
index b786df0aaf61..c7beb58e8000 100644
--- a/arch/arm/mach-kirkwood/include/mach/config.h
+++ b/arch/arm/mach-kirkwood/include/mach/config.h
@@ -89,7 +89,6 @@
  * USB/EHCI
  */
 #ifdef CONFIG_CMD_USB
-#define CONFIG_USB_EHCI_MARVELL
 #define CONFIG_EHCI_IS_TDI
 #endif /* CONFIG_CMD_USB */
 
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index ab2ae737c81e..03c15dd6293e 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -85,8 +85,8 @@ config USB_EHCI_ATMEL
  Enables support for the on-chip EHCI controller on Atmel chips.
 
 config USB_EHCI_MARVELL
-   bool "Support for MVEBU (AXP / A38x) on-chip EHCI USB controller"
-   depends on ARCH_MVEBU
+   bool "Support for Marvell on-chip EHCI USB controller"
+   depends on ARCH_MVEBU || KIRKWOOD || ORION5X
default y
---help---
  Enables support for the on-chip EHCI controller on MVEBU SoCs.
diff --git a/include/configs/advantech_dms-ba16.h 
b/include/configs/advantech_dms-ba16.h
index 2a39ae572a6e..b76f376a042f 100644
--- a/include/configs/advantech_dms-ba16.h
+++ b/include/configs/advantech_dms-ba16.h
@@ -55,7 +55,6 @@
 #define CONFIG_BOUNCE_BUFFER
 
 /* USB Configs */
-#define CONFIG_USB_EHCI_MX6
 #define CONFIG_USB_STORAGE
 #define CONFIG_USB_MAX_CONTROLLER_COUNT 2
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
diff --git a/include/configs/aristainetos-common.h 
b/include/configs/aristainetos-common.h
index 3d5130405dee..7360e11ff14d 100644
--- a/include/configs/aristainetos-common.h
+++ b/include/configs/aristainetos-common.h
@@ -202,7 +202,6 @@
 #define CONFIG_RTC_M41T11
 
 /* USB Configs */
-#define CONFIG_USB_EHCI_MX6
 #define CONFIG_USB_MAX_CONTROLLER_COUNT 2
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET   /* For OTG port */
 #define CONFIG_MXC_USB_PORTSC  (PORT_PTS_UTMI | PORT_PTS_PTW)
diff --git a/include/configs/cgtqmx6eval.h b/include/configs/cgtqmx6eval.h
index 46c297e24234..cad1357f5cfd 100644
--- a/include/configs/cgtqmx6eval.h
+++ b/include/configs/cgtqmx6eval.h
@@ -61,7 +61,6 @@
 #define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08
 
 /* USB Configs */
-#define CONFIG_USB_EHCI_MX6
 #define CONFIG_EHCI_HCD_INIT_AFTER_RESET
 #define CONFIG_USB_HOST_ETHER
 #define CONFIG_USB_ETHER_ASIX
diff --git a/include/configs/corvus.h b/include/configs/corvus.h
index 565f8a98b1eb..71b428f1f745 100644
--- a/include/configs/corvus.h
+++ b/include/configs/corvus.h
@@ -96,7 +96,6 @@
 #define CONFIG_AT91_WANTS_COMMON_PHY
 
 /* USB */
-#define 

[U-Boot] [PATCH 06/17] omap4: Drop redundant CONFIG_OMAP4430 symbol

2017-05-12 Thread Tom Rini
While there are a few different OMAP4 SoCs, today we always set
CONFIG_OMAP4430 and CONFIG_OMAP44XX.  Convert the few test of
CONFIG_OMAP4430 to CONFIG_OMAP44XX.

Cc: Marek Vasut 
Cc: Paul Kocialkowski 
Signed-off-by: Tom Rini 
---
 drivers/usb/musb-new/linux-compat.h | 2 +-
 drivers/usb/musb-new/omap2430.c | 2 +-
 drivers/usb/musb/omap3.c| 4 ++--
 include/configs/kc1.h   | 5 -
 include/configs/ti_omap4_common.h   | 4 
 scripts/config_whitelist.txt| 1 -
 6 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/usb/musb-new/linux-compat.h 
b/drivers/usb/musb-new/linux-compat.h
index 92449775799f..4dae83ed6850 100644
--- a/drivers/usb/musb-new/linux-compat.h
+++ b/drivers/usb/musb-new/linux-compat.h
@@ -30,7 +30,7 @@
 #define CONFIG_SOC_OMAP3430
 #endif
 
-#ifdef CONFIG_OMAP4430
+#ifdef CONFIG_OMAP44XX
 #define CONFIG_ARCH_OMAP4
 #endif
 
diff --git a/drivers/usb/musb-new/omap2430.c b/drivers/usb/musb-new/omap2430.c
index 684ad9539af5..ba22dfe6cb09 100644
--- a/drivers/usb/musb-new/omap2430.c
+++ b/drivers/usb/musb-new/omap2430.c
@@ -441,7 +441,7 @@ static int omap2430_musb_enable(struct musb *musb)
twl6030_usb_device_settings();
 #endif
 
-#ifdef CONFIG_OMAP4430
+#ifdef CONFIG_OMAP44XX
u32 *usbotghs_control = (u32 *)((*ctrl)->control_usbotghs_ctrl);
*usbotghs_control = USBOTGHS_CONTROL_AVALID |
USBOTGHS_CONTROL_VBUSVALID | USBOTGHS_CONTROL_IDDIG;
diff --git a/drivers/usb/musb/omap3.c b/drivers/usb/musb/omap3.c
index 99b4291a27d8..57889ef0e7d2 100644
--- a/drivers/usb/musb/omap3.c
+++ b/drivers/usb/musb/omap3.c
@@ -55,7 +55,7 @@ static struct omap3_otg_regs *otg;
 #define OMAP3_OTG_SYSSTATUS_RESETDONE  0x0001
 
 /* OMAP4430 has an internal PHY, use it */
-#ifdef CONFIG_OMAP4430
+#ifdef CONFIG_OMAP44XX
 #define OMAP3_OTG_INTERFSEL_OMAP   0x
 #else
 #define OMAP3_OTG_INTERFSEL_OMAP   0x0001
@@ -122,7 +122,7 @@ int musb_platform_init(void)
musb_cfg.extvbus = omap3_evm_need_extvbus();
 #endif
 
-#ifdef CONFIG_OMAP4430
+#ifdef CONFIG_OMAP44XX
u32 *usbotghs_control =
(u32 *)((*ctrl)->control_usbotghs_ctrl);
*usbotghs_control = 0x15;
diff --git a/include/configs/kc1.h b/include/configs/kc1.h
index 939bd6c8129e..39c750c15e01 100644
--- a/include/configs/kc1.h
+++ b/include/configs/kc1.h
@@ -24,11 +24,6 @@
 #define CONFIG_SYS_PL310_BASE  0x48242000
 
 /*
- * Platform
- */
-#define CONFIG_OMAP4430
-
-/*
  * Board
  */
 
diff --git a/include/configs/ti_omap4_common.h 
b/include/configs/ti_omap4_common.h
index b85db500b574..1a6551e24d20 100644
--- a/include/configs/ti_omap4_common.h
+++ b/include/configs/ti_omap4_common.h
@@ -12,10 +12,6 @@
 #ifndef __CONFIG_TI_OMAP4_COMMON_H
 #define __CONFIG_TI_OMAP4_COMMON_H
 
-/*
- * High Level Configuration Options
- */
-#define CONFIG_OMAP44301   /* which is in a 4430 */
 #define CONFIG_MISC_INIT_R
 
 #ifndef CONFIG_SYS_L2CACHE_OFF
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index 4382b6aa1a1f..93ee3035d183 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -1992,7 +1992,6 @@ CONFIG_OMAP3_MICRON_DDR
 CONFIG_OMAP3_RX51
 CONFIG_OMAP3_SPI_D0_D1_SWAPPED
 CONFIG_OMAP3_ZOOM1
-CONFIG_OMAP4430
 CONFIG_OMAP_EHCI_PHY1_RESET_GPIO
 CONFIG_OMAP_EHCI_PHY2_RESET_GPIO
 CONFIG_OMAP_EHCI_PHY3_RESET_GPIO
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 13/17] whitelist: Drop more unused OMAP symbols

2017-05-12 Thread Tom Rini
The symbol CONFIG_OMAP3_LOGIC_USE_NEW_PRODUCT_ID was recently dropped
from usage and CONFIG_OMAP3_MICRON_DDR is unused in code.

Signed-off-by: Tom Rini 
---
 include/configs/tam3517-common.h | 1 -
 scripts/config_whitelist.txt | 2 --
 2 files changed, 3 deletions(-)

diff --git a/include/configs/tam3517-common.h b/include/configs/tam3517-common.h
index 9dfda1e03895..7d898f831ef7 100644
--- a/include/configs/tam3517-common.h
+++ b/include/configs/tam3517-common.h
@@ -41,7 +41,6 @@
 /*
  * DDR related
  */
-#define CONFIG_OMAP3_MICRON_DDR/* Micron DDR */
 #define CONFIG_SYS_CS0_SIZE(256 * 1024 * 1024)
 
 /*
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index bb73ba774e3d..140185b4f8e8 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -1979,8 +1979,6 @@ CONFIG_OF_SPI
 CONFIG_OF_SPI_FLASH
 CONFIG_OF_STDOUT_PATH
 CONFIG_OF_SUPPORT_OLD_DEVICE_TREES
-CONFIG_OMAP3_LOGIC_USE_NEW_PRODUCT_ID
-CONFIG_OMAP3_MICRON_DDR
 CONFIG_OMAP_EHCI_PHY1_RESET_GPIO
 CONFIG_OMAP_EHCI_PHY2_RESET_GPIO
 CONFIG_OMAP_EHCI_PHY3_RESET_GPIO
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 10/17] omap: spi: Drop CONFIG_OMAP3_SPI_D0_D1_SWAPPED support

2017-05-12 Thread Tom Rini
This particular quirk is not enabled in any config files today.  It does
however exist and is handled correctly in device trees and via
CONFIG_DM_SPI.  So we drop the symbol now and add a comment to indicate
that any (new) boards that require this quirk need to enable DM_SPI
instead.

Signed-off-by: Tom Rini 
---
 drivers/spi/omap3_spi.c  | 3 ++-
 scripts/config_whitelist.txt | 1 -
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/omap3_spi.c b/drivers/spi/omap3_spi.c
index 76d376ac4450..3caea151c548 100644
--- a/drivers/spi/omap3_spi.c
+++ b/drivers/spi/omap3_spi.c
@@ -568,7 +568,8 @@ struct spi_slave *spi_setup_slave(unsigned int bus, 
unsigned int cs,
priv->freq = max_hz;
priv->mode = mode;
priv->wordlen = priv->slave.wordlen;
-#ifdef CONFIG_OMAP3_SPI_D0_D1_SWAPPED
+#if 0
+   /* Please migrate to DM_SPI support for this feature. */
priv->pin_dir = MCSPI_PINDIR_D0_OUT_D1_IN;
 #endif
 
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index ee8f215c2f7f..ebe3fd7996de 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -1981,7 +1981,6 @@ CONFIG_OF_STDOUT_PATH
 CONFIG_OF_SUPPORT_OLD_DEVICE_TREES
 CONFIG_OMAP3_LOGIC_USE_NEW_PRODUCT_ID
 CONFIG_OMAP3_MICRON_DDR
-CONFIG_OMAP3_SPI_D0_D1_SWAPPED
 CONFIG_OMAP_EHCI_PHY1_RESET_GPIO
 CONFIG_OMAP_EHCI_PHY2_RESET_GPIO
 CONFIG_OMAP_EHCI_PHY3_RESET_GPIO
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 03/17] TI: Drop 'CONFIG_OMAP'

2017-05-12 Thread Tom Rini
In the two cases in the code where we use CONFIG_OMAP as a useful test
currently we can make use of CONFIG_ARCH_OMAP2PLUS instead.  With that
changed we can drop all defines of CONFIG_OMAP.  While in here,
CONFIG_OMAP3430 is only defined and then never used, so drop.

Signed-off-by: Tom Rini 
---
 arch/arm/include/asm/spl.h |  2 +-
 drivers/serial/ns16550.c   | 10 +++---
 include/configs/am3517_crane.h |  1 -
 include/configs/am3517_evm.h   |  4 
 include/configs/bur_am335x_common.h|  1 -
 include/configs/cm_t35.h   |  1 -
 include/configs/cm_t3517.h |  1 -
 include/configs/kc1.h  |  2 --
 include/configs/mcx.h  |  1 -
 include/configs/nokia_rx51.h   |  3 ---
 include/configs/omap3_evm.h|  1 -
 include/configs/siemens-am33x-common.h |  1 -
 include/configs/sniper.h   |  6 --
 include/configs/tam3517-common.h   |  1 -
 include/configs/tao3530.h  |  2 --
 include/configs/ti814x_evm.h   |  1 -
 include/configs/ti816x_evm.h   |  1 -
 include/configs/ti_armv7_omap.h|  3 ---
 include/configs/tricorder.h|  3 ---
 scripts/config_whitelist.txt   |  2 --
 20 files changed, 4 insertions(+), 43 deletions(-)

diff --git a/arch/arm/include/asm/spl.h b/arch/arm/include/asm/spl.h
index a0bda28104a9..5d7f7e6ec562 100644
--- a/arch/arm/include/asm/spl.h
+++ b/arch/arm/include/asm/spl.h
@@ -7,7 +7,7 @@
 #ifndef_ASM_SPL_H_
 #define_ASM_SPL_H_
 
-#if defined(CONFIG_OMAP) \
+#if defined(CONFIG_ARCH_OMAP2PLUS) \
|| defined(CONFIG_EXYNOS4) || defined(CONFIG_EXYNOS5) \
|| defined(CONFIG_EXYNOS4210)
 /* Platform-specific defines */
diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index ca55df78b7e4..0eb7c025618b 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -175,21 +175,17 @@ void NS16550_init(NS16550_t com_port, int baud_divisor)
;
 
serial_out(CONFIG_SYS_NS16550_IER, _port->ier);
-#if defined(CONFIG_OMAP) || defined(CONFIG_AM33XX) || \
-   defined(CONFIG_TI81XX) || defined(CONFIG_AM43XX)
+#if defined(CONFIG_ARCH_OMAP2PLUS)
serial_out(0x7, _port->mdr1);   /* mode select reset TL16C750*/
 #endif
serial_out(UART_MCRVAL, _port->mcr);
serial_out(ns16550_getfcr(com_port), _port->fcr);
if (baud_divisor != -1)
NS16550_setbrg(com_port, baud_divisor);
-#if defined(CONFIG_OMAP) || \
-   defined(CONFIG_AM33XX) || defined(CONFIG_SOC_DA8XX) || \
-   defined(CONFIG_TI81XX) || defined(CONFIG_AM43XX)
-
+#if defined(CONFIG_ARCH_OMAP2PLUS) || defined(CONFIG_SOC_DA8XX)
/* /16 is proper to hit 115200 with 48MHz */
serial_out(0, _port->mdr1);
-#endif /* CONFIG_OMAP */
+#endif
 #if defined(CONFIG_SOC_KEYSTONE)
serial_out(UART_REG_VAL_PWREMU_MGMT_UART_ENABLE, _port->regC);
 #endif
diff --git a/include/configs/am3517_crane.h b/include/configs/am3517_crane.h
index 8be49af9f11f..19d1bc195113 100644
--- a/include/configs/am3517_crane.h
+++ b/include/configs/am3517_crane.h
@@ -16,7 +16,6 @@
 /*
  * High Level Configuration Options
  */
-#define CONFIG_OMAP1   /* in a TI OMAP core */
 #define CONFIG_OMAP3_AM3517CRANE   1   /* working with CRANEBOARD */
 
 #define CONFIG_EMIF4   /* The chip has EMIF4 controller */
diff --git a/include/configs/am3517_evm.h b/include/configs/am3517_evm.h
index 7490f2b5eaf8..27d64eaf8a54 100644
--- a/include/configs/am3517_evm.h
+++ b/include/configs/am3517_evm.h
@@ -13,10 +13,6 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
-/* High Level Configuration Options */
-
-#define CONFIG_OMAP
-
 #define CONFIG_NR_DRAM_BANKS   2   /* CS1 may or may not be populated */
 
 #define CONFIG_EMIF4   /* The chip has EMIF4 controller */
diff --git a/include/configs/bur_am335x_common.h 
b/include/configs/bur_am335x_common.h
index 3742514a6e66..4f57241e1feb 100644
--- a/include/configs/bur_am335x_common.h
+++ b/include/configs/bur_am335x_common.h
@@ -13,7 +13,6 @@
 #define __BUR_AM335X_COMMON_H__
 /* - */
 #define CONFIG_AM33XX
-#define CONFIG_OMAP
 #define CONFIG_MAX_RAM_BANK_SIZE   (1024 << 20)/* 1GB */
 
 /* Timer information */
diff --git a/include/configs/cm_t35.h b/include/configs/cm_t35.h
index dfdad6c3d098..2d5b6f21d38a 100644
--- a/include/configs/cm_t35.h
+++ b/include/configs/cm_t35.h
@@ -22,7 +22,6 @@
 /*
  * High Level Configuration Options
  */
-#define CONFIG_OMAP/* in a TI OMAP core */
 #define CONFIG_OMAP_GPIO
 #define CONFIG_CM_T3X  /* working with CM-T35 and CM-T3730 */
 
diff --git a/include/configs/cm_t3517.h b/include/configs/cm_t3517.h
index e12dc020ff7b..8093e7fc7736 100644
--- a/include/configs/cm_t3517.h
+++ b/include/configs/cm_t3517.h
@@ -13,7 +13,6 @@
 /*
  * High Level Configuration Options

[U-Boot] [PATCH 12/17] omap: Drop CONFIG_OMAP_VC_I2C_HS_MCODE

2017-05-12 Thread Tom Rini
The symbol CONFIG_OMAP_VC_I2C_HS_MCODE always uses the default value.
Restructure the comment and code such that if a need arises later to use
another value we can address this then.

Signed-off-by: Tom Rini 
---
 arch/arm/mach-omap2/vc.c | 14 --
 scripts/config_whitelist.txt |  1 -
 2 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
index a68f1d145dcb..b7f79800de57 100644
--- a/arch/arm/mach-omap2/vc.c
+++ b/arch/arm/mach-omap2/vc.c
@@ -19,14 +19,6 @@
 #include 
 #include 
 
-/*
- * Define Master code if there are multiple masters on the I2C_SR bus.
- * Normally not required
- */
-#ifndef CONFIG_OMAP_VC_I2C_HS_MCODE
-#define CONFIG_OMAP_VC_I2C_HS_MCODE 0x0
-#endif
-
 /* Register defines and masks for VC IP Block */
 /* PRM_VC_CFG_I2C_MODE */
 #define PRM_VC_CFG_I2C_MODE_DFILTEREN_BIT  (0x1 << 6)
@@ -84,8 +76,10 @@ static void omap_vc_init(u16 speed_khz)
   (cycles_low << PRM_VC_CFG_I2C_CLK_SCLL_SHIFT);
writel(val, (*prcm)->prm_vc_cfg_i2c_clk);
 
-   val = CONFIG_OMAP_VC_I2C_HS_MCODE <<
-   PRM_VC_CFG_I2C_MODE_HSMCODE_SHIFT;
+   /*
+* Master code if there are multiple masters on the I2C_SR bus.
+*/
+   val = 0x0 << PRM_VC_CFG_I2C_MODE_HSMCODE_SHIFT;
/* No HS mode for now */
val &= ~PRM_VC_CFG_I2C_MODE_HSMODEEN_BIT;
writel(val, (*prcm)->prm_vc_cfg_i2c_mode);
diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
index e86e7388dce5..bb73ba774e3d 100644
--- a/scripts/config_whitelist.txt
+++ b/scripts/config_whitelist.txt
@@ -1987,7 +1987,6 @@ CONFIG_OMAP_EHCI_PHY3_RESET_GPIO
 CONFIG_OMAP_USB2PHY2_HOST
 CONFIG_OMAP_USB3PHY1_HOST
 CONFIG_OMAP_USB_PHY
-CONFIG_OMAP_VC_I2C_HS_MCODE
 CONFIG_OPTREX_BW
 CONFIG_ORIGEN
 CONFIG_OS1_ENV_ADDR
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 04/17] omap5: Migrate CONFIG_OMAP_PLATFORM_RESET_TIME_MAX_USEC to Kconfig

2017-05-12 Thread Tom Rini
While in theory this value could be used in places outside of "omap5"
(such as OMAP4), we only make use of it today in OMAP5, so place the
Kconfig entry there.  Given that Kconfig lets us provide a default, we
drop CONFIG_DEFAULT_OMAP_RESET_TIME_MAX_USEC entirely.  The contents of
doc/README.omap-reset-time make a good help entry, so adjust them
slightly and delete the file.  Move the comment about range to where we
use the value now, and have Kconfig enforce the upper bound.

Signed-off-by: Tom Rini 
---
 README  |  5 -
 arch/arm/include/asm/arch-omap5/clock.h |  7 ---
 arch/arm/mach-omap2/omap5/Kconfig   | 17 +
 arch/arm/mach-omap2/omap5/hwinit.c  | 13 +++--
 configs/cm_t54_defconfig|  1 +
 configs/omap5_uevm_defconfig|  1 +
 doc/README.omap-reset-time  | 20 
 include/configs/cm_t54.h|  3 ---
 include/configs/omap5_uevm.h|  3 ---
 scripts/config_whitelist.txt|  2 --
 10 files changed, 26 insertions(+), 46 deletions(-)
 delete mode 100644 doc/README.omap-reset-time

diff --git a/README b/README
index 2ca0102b57b7..f4eecd0a0bd1 100644
--- a/README
+++ b/README
@@ -3708,11 +3708,6 @@ Configuration Settings:
If defined, don't allow the -f switch to env set override variable
access flags.
 
-- CONFIG_OMAP_PLATFORM_RESET_TIME_MAX_USEC (OMAP only)
-   This is set by OMAP boards for the max time that reset should
-   be asserted. See doc/README.omap-reset-time for details on how
-   the value can be calculated on a given board.
-
 - CONFIG_USE_STDINT
If stdint.h is available with your toolchain you can define this
option to enable it. You can provide option 'USE_STDINT=1' when
diff --git a/arch/arm/include/asm/arch-omap5/clock.h 
b/arch/arm/include/asm/arch-omap5/clock.h
index 7ea7199f2b74..0c99bbdc9320 100644
--- a/arch/arm/include/asm/arch-omap5/clock.h
+++ b/arch/arm/include/asm/arch-omap5/clock.h
@@ -370,13 +370,6 @@
 #define DPLL_NO_LOCK   0
 #define DPLL_LOCK  1
 
-/*
- * MAX value for PRM_RSTTIME[9:0]RSTTIME1 stored is 0x3ff.
- * 0x3ff is in the no of FUNC_32K_CLK cycles. Converting cycles
- * into microsec and passing the value.
- */
-#define CONFIG_DEFAULT_OMAP_RESET_TIME_MAX_USEC31219
-
 #if defined(CONFIG_DRA7XX)
 #define V_OSCK 2000/* Clock output from T2 */
 #else
diff --git a/arch/arm/mach-omap2/omap5/Kconfig 
b/arch/arm/mach-omap2/omap5/Kconfig
index c89c43830587..1a66abdeb297 100644
--- a/arch/arm/mach-omap2/omap5/Kconfig
+++ b/arch/arm/mach-omap2/omap5/Kconfig
@@ -63,6 +63,23 @@ config TI_SECURE_EMIF_PROTECTED_REGION_SIZE
  using hardware memory firewalls. This value must be smaller than the
  TI_SECURE_EMIF_TOTAL_REGION_SIZE value.
 
+config OMAP_PLATFORM_RESET_TIME_MAX_USEC
+   int "Something"
+   range 0  31219
+   default 31219
+   help
+ Most OMAPs' provide a way to specify the time for which the reset
+ should be held low while the voltages and Oscillator outputs
+ stabilize.
+ This time is mostly board and PMIC dependent. Hence the boards are
+ expected to specify a pre-computed time using the above option.
+ This value can be computed using a summation of the below 3
+ parameters
+ 1: Time taken by the Osciallator to stop and restart
+ 2: PMIC OTP time
+ 3: Voltage ramp time, which can be derived using the PMIC slew rate
+and value of voltage ramp needed.
+
 if TARGET_DRA7XX_EVM || TARGET_AM57XX_EVM
 menu "Voltage Domain OPP selections"
 
diff --git a/arch/arm/mach-omap2/omap5/hwinit.c 
b/arch/arm/mach-omap2/omap5/hwinit.c
index 839d79d10204..afe59e0b5826 100644
--- a/arch/arm/mach-omap2/omap5/hwinit.c
+++ b/arch/arm/mach-omap2/omap5/hwinit.c
@@ -414,12 +414,13 @@ void setup_warmreset_time(void)
 {
u32 rst_time, rst_val;
 
-#ifndef CONFIG_OMAP_PLATFORM_RESET_TIME_MAX_USEC
-   rst_time = CONFIG_DEFAULT_OMAP_RESET_TIME_MAX_USEC;
-#else
-   rst_time = CONFIG_OMAP_PLATFORM_RESET_TIME_MAX_USEC;
-#endif
-   rst_time = usec_to_32k(rst_time) << RSTTIME1_SHIFT;
+   /*
+* MAX value for PRM_RSTTIME[9:0]RSTTIME1 stored is 0x3ff.
+* 0x3ff is in the no of FUNC_32K_CLK cycles. Converting cycles
+* into microsec and passing the value.
+*/
+   rst_time = usec_to_32k(CONFIG_OMAP_PLATFORM_RESET_TIME_MAX_USEC)
+   << RSTTIME1_SHIFT;
 
if (rst_time > RSTTIME1_MASK)
rst_time = RSTTIME1_MASK;
diff --git a/configs/cm_t54_defconfig b/configs/cm_t54_defconfig
index d7fd995f7a40..0afc6a27416f 100644
--- a/configs/cm_t54_defconfig
+++ b/configs/cm_t54_defconfig
@@ -2,6 +2,7 @@ CONFIG_ARM=y
 CONFIG_ARCH_OMAP2PLUS=y
 CONFIG_OMAP54XX=y
 CONFIG_TARGET_CM_T54=y
+CONFIG_OMAP_PLATFORM_RESET_TIME_MAX_USEC=16296
 # 

[U-Boot] [PATCH 01/17] arch/arm/cpu/arm926ejs/omap: Remove

2017-05-12 Thread Tom Rini
This code has been unused since the removal of the "omap2" platforms,
remove.

Signed-off-by: Tom Rini 
---
 arch/arm/cpu/arm926ejs/omap/Makefile  |  10 --
 arch/arm/cpu/arm926ejs/omap/cpuinfo.c | 242 --
 arch/arm/cpu/arm926ejs/omap/reset.S   |  29 
 arch/arm/cpu/arm926ejs/omap/timer.c   | 152 -
 4 files changed, 433 deletions(-)
 delete mode 100644 arch/arm/cpu/arm926ejs/omap/Makefile
 delete mode 100644 arch/arm/cpu/arm926ejs/omap/cpuinfo.c
 delete mode 100644 arch/arm/cpu/arm926ejs/omap/reset.S
 delete mode 100644 arch/arm/cpu/arm926ejs/omap/timer.c

diff --git a/arch/arm/cpu/arm926ejs/omap/Makefile 
b/arch/arm/cpu/arm926ejs/omap/Makefile
deleted file mode 100644
index add923276c9c..
--- a/arch/arm/cpu/arm926ejs/omap/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-#
-# (C) Copyright 2000-2006
-# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
-#
-# SPDX-License-Identifier: GPL-2.0+
-#
-
-obj-y  = timer.o
-obj-$(CONFIG_DISPLAY_CPUINFO) += cpuinfo.o
-obj-y  += reset.o
diff --git a/arch/arm/cpu/arm926ejs/omap/cpuinfo.c 
b/arch/arm/cpu/arm926ejs/omap/cpuinfo.c
deleted file mode 100644
index 587d99a2bb02..
--- a/arch/arm/cpu/arm926ejs/omap/cpuinfo.c
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * OMAP1 CPU identification code
- *
- * Copyright (C) 2004 Nokia Corporation
- * Written by Tony Lindgren 
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include 
-#include 
-#include 
-
-#if defined(CONFIG_OMAP)
-
-#define omap_readw(x)  *(volatile unsigned short *)(x)
-#define omap_readl(x)  *(volatile unsigned long *)(x)
-
-#define OMAP_DIE_ID_0  0xfffe1800
-#define OMAP_DIE_ID_1  0xfffe1804
-#define OMAP_PRODUCTION_ID_0   0xfffe2000
-#define OMAP_PRODUCTION_ID_1   0xfffe2004
-#define OMAP32_ID_00xfffed400
-#define OMAP32_ID_10xfffed404
-
-struct omap_id {
-   u16 jtag_id;/* Used to determine OMAP type */
-   u8  die_rev;/* Processor revision */
-   u32 omap_id;/* OMAP revision */
-   u32 type;   /* Cpu id bits [31:08], cpu class bits [07:00] 
*/
-};
-
-/* Register values to detect the OMAP version */
-static struct omap_id omap_ids[] = {
-   { .jtag_id = 0xb574, .die_rev = 0x2, .omap_id = 0x03310315, .type = 
0x0310},
-   { .jtag_id = 0x355f, .die_rev = 0x0, .omap_id = 0x0332, .type = 
0x07300100},
-   { .jtag_id = 0xb55f, .die_rev = 0x0, .omap_id = 0x0332, .type = 
0x07300300},
-   { .jtag_id = 0xb470, .die_rev = 0x0, .omap_id = 0x03310100, .type = 
0x1510},
-   { .jtag_id = 0xb576, .die_rev = 0x0, .omap_id = 0x0332, .type = 
0x1610},
-   { .jtag_id = 0xb576, .die_rev = 0x2, .omap_id = 0x03320100, .type = 
0x1611},
-   { .jtag_id = 0xb576, .die_rev = 0x3, .omap_id = 0x03320100, .type = 
0x16100c00},
-   { .jtag_id = 0xb576, .die_rev = 0x0, .omap_id = 0x03320200, .type = 
0x16100d00},
-   { .jtag_id = 0xb613, .die_rev = 0x0, .omap_id = 0x03320300, .type = 
0x1610ef00},
-   { .jtag_id = 0xb613, .die_rev = 0x0, .omap_id = 0x03320300, .type = 
0x1610ef00},
-   { .jtag_id = 0xb576, .die_rev = 0x1, .omap_id = 0x03320100, .type = 
0x1611},
-   { .jtag_id = 0xb58c, .die_rev = 0x2, .omap_id = 0x03320200, .type = 
0x16110b00},
-   { .jtag_id = 0xb58c, .die_rev = 0x3, .omap_id = 0x03320200, .type = 
0x16110c00},
-   { .jtag_id = 0xb65f, .die_rev = 0x0, .omap_id = 0x03320400, .type = 
0x16212300},
-   { .jtag_id = 0xb65f, .die_rev = 0x1, .omap_id = 0x03320400, .type = 
0x16212300},
-   { .jtag_id = 0xb65f, .die_rev = 0x1, .omap_id = 0x03320500, .type = 
0x16212300},
-   { .jtag_id = 0xb5f7, .die_rev = 0x0, .omap_id = 0x0333, .type = 
0x1710},
-   { .jtag_id = 0xb5f7, .die_rev = 0x1, .omap_id = 0x03330100, .type = 
0x1710},
-   { .jtag_id = 0xb5f7, .die_rev = 0x2, .omap_id = 0x03330100, .type = 
0x1710},
-};
-
-/*
- * Get OMAP type from PROD_ID.
- * 1710 has the PROD_ID in bits 15:00, not in 16:01 as documented in TRM.
- * 1510 PROD_ID is empty, and 1610 PROD_ID does not make sense.
- * Undocumented register in TEST BLOCK is used as fallback; This seems to
- * work on 1510, 1610 & 1710. The official way hopefully will work in future
- * processors.
- */
-static u16 omap_get_jtag_id(void)
-{
-   u32 prod_id, omap_id;
-
-   prod_id = omap_readl(OMAP_PRODUCTION_ID_1);
-   omap_id = omap_readl(OMAP32_ID_1);
-
-   /* Check for unusable OMAP_PRODUCTION_ID_1 on 1611B/5912 and 730 */
-   if (((prod_id >> 20) == 0) || (prod_id == omap_id))
-   prod_id = 0;
-   else
-   prod_id &= 0x;
-
-   if (prod_id)
-   return prod_id;
-
-   /* Use OMAP32_ID_1 as fallback 

[U-Boot] [PATCH 02/17] omap24xx_i2c.c: Drop references to CONFIG_OMAP243X

2017-05-12 Thread Tom Rini
We have nothing defining CONFIG_OMAP243X since we dropped the omap243x
platforms, drop these tests.

Signed-off-by: Tom Rini 
---
 drivers/i2c/omap24xx_i2c.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c
index a23737ab7813..4b8397a890d6 100644
--- a/drivers/i2c/omap24xx_i2c.c
+++ b/drivers/i2c/omap24xx_i2c.c
@@ -122,7 +122,7 @@ static int wait_for_bb(struct i2c *i2c_base, int waitdelay)
u16 stat;
 
writew(0x, _base->stat);/* clear current interrupts...*/
-#if defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX)
+#if defined(CONFIG_OMAP34XX)
while ((stat = readw(_base->stat) & I2C_STAT_BB) && timeout--) {
 #else
/* Read RAW status */
@@ -153,7 +153,7 @@ static u16 wait_for_event(struct i2c *i2c_base, int 
waitdelay)
 
do {
udelay(waitdelay);
-#if defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX)
+#if defined(CONFIG_OMAP34XX)
status = readw(_base->stat);
 #else
/* Read RAW status */
@@ -338,7 +338,7 @@ retry:
/* own address */
writew(slaveadd, _base->oa);
 
-#if defined(CONFIG_OMAP243X) || defined(CONFIG_OMAP34XX)
+#if defined(CONFIG_OMAP34XX)
/*
 * Have to enable interrupts for OMAP2/3, these IPs don't have
 * an 'irqstatus_raw' register and we shall have to poll 'stat'
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 8/9] dm: core: Add ofnode to represent device tree nodes

2017-05-12 Thread Simon Glass
Hi Masahiro,

On 10 May 2017 at 20:33, Masahiro Yamada  wrote:
> 2017-05-02 0:18 GMT+09:00 Simon Glass :
>
>> diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
>> new file mode 100644
>> index 00..f952c989d2
>> --- /dev/null
>> +++ b/include/dm/ofnode.h
>> @@ -0,0 +1,100 @@
>> +/*
>> + * Copyright (c) 2017 Google, Inc
>> + * Written by Simon Glass 
>> + *
>> + * SPDX-License-Identifier:GPL-2.0+
>> + */
>> +
>> +#ifndef _DM_OFNODE_H
>> +#define _DM_OFNODE_H
>> +
>> +DECLARE_GLOBAL_DATA_PTR;
>
> Which line in this header references gd?

It is actually needed in dev.h when that is inlined. I originally had
to access it here but can move it.

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 5/9] Fix up inclusion of common.h

2017-05-12 Thread Simon Glass
Hi Masahiro,

On 10 May 2017 at 20:21, Masahiro Yamada  wrote:
> Hi Simon
>
> 2017-05-11 6:43 GMT+09:00 Tom Rini :
>> On Mon, May 01, 2017 at 09:18:48AM -0600, Simon Glass wrote:
>>
>>> It is good practice to include common.h as the first header. This ensures
>>> that required features like the DECLARE_GLOBAL_DATA_PTR macro,
>>> configuration options and common types are available.
>>>
>>> Fix up some files which currently don't do this. This is necessary because
>>> driver model will soon start using global data and configuration in the
>>> dm/ofnode.h header file, included via dm.h.
>>>
>>> Signed-off-by: Simon Glass 
>>
>> Reviewed-by: Tom Rini 
>
>
> NACK.
>
> include/common.h is really bad idea
> and this is a step backward.
>
> If you need something in your include/dm/ofnode.h
> you should include needed header(s) from it.
>
> Why do you need to touch lots of C files?

All of these files fail to build when they cannot see global_data.
Also we need access to CONFIG options in dm.h. So I think we have to
have common.h - it is (I think) a rule that all files should have
common.h and have it first, because any other header.

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 1/9] dm: Use dm.h header when driver mode is used

2017-05-12 Thread Simon Glass
Hi Masahiro,

On 10 May 2017 at 20:12, Masahiro Yamada  wrote:
> Hi Simon,
>
>
> 2017-05-11 6:43 GMT+09:00 Tom Rini :
>> On Mon, May 01, 2017 at 09:18:44AM -0600, Simon Glass wrote:
>>
>>> This header includes things that are needed to make driver build. Adjust
>>> existing users to include that always, even if other dm/ includes are
>>> present
>>>
>>> Signed-off-by: Simon Glass 
>>
>> Reviewed-by: Tom Rini 
>>
>
> I'd say this is a bad idea.
> I believe .c files should include headers that are really necessary.
>
> Mostly, drivers need only dm/device.h, but this commit
> requires additional parse of dm/uclass.h and dm/platdata.h.
>
> Rather, it is better to deprecate dm.h.
>
> Its concept is DM common header that you force drivers to include
> where some in them may not be necessary.

I did consider this right at the start but I think it is too painful
for users. There are only a few files that we pull in so the overhead
is not great. It avoids having to add new headers because some other
function is used.

One option might be to define all the structs in one header, since
those are the things that are really painful to figure out. We could
then make the function name prefixes fully consistent with the header
file name (mostly they are, but see lists.h and root.h). That would
make it easier.

>
> It is a similar idea to include/common.h,
> which is one of the biggest design mistakes in U-Boot.

We have been slowing pulling things out of common.h - see for example
mapmem.h and vsprint.h. We also have a lot of files in include/ which
really should be arch-specific.

But in any case I think common.h is useful just to include the
configuration and some common declarations (like global_data). The
problem is that it has too much in it.

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] WIP: Disable SCSI on x86

2017-05-12 Thread Simon Glass
Hi Bin,

On 8 May 2017 at 01:05, Bin Meng  wrote:
> Hi Simon,
>
> On Mon, Apr 10, 2017 at 8:38 AM, Simon Glass  wrote:
>> This is not to be applied. It is needed to test using CONFIG_DM_MMC on x86
>> since SCSI is broken with this setup.
>>
>> Signed-off-by: Simon Glass 
>> ---
>
> When you said "SCSI is broken with this setup", did you mean GP#
> exception when boot up with a hard disk like below?

Yes that's right.

>
> SCSI:  Target spinup took 0 ms.
> SATA link 1 timeout.
> AHCI 0001.0300 32 slots 2 ports 3 Gbps 0x3 impl SATA mode
> flags: 64bit ncq stag pm led clo pio slum part sxs
> scanning bus for devices...
> General Protection
> EIP: 0010:[<46174204>] EFLAGS: 00010202
> Original EIP :[]
> EAX:  EBX: 46174204 ECX:  EDX: 
> ESI: 7b347f80 EDI: 7b5c3fc8 EBP: 7b3481c4 ESP: 7b347f58
>  DS: 0018 ES: 0018 FS: 0020 GS: 0018 SS: 0018
> CR0: 0033 CR2:  CR3:  CR4: 0600
> DR0:  DR1:  DR2:  DR3: 
> DR6: 0ff0 DR7: 0400
> Stack:
> 0x7b347f98 : 0x20202020
> 0x7b347f94 : 0x20202020
> 0x7b347f90 : 0x
> 0x7b347f8c : 0x003f
> 0x7b347f88 : 0x
> 0x7b347f84 : 0x0010c837
> 0x7b347f80 : 0x3fff0c5a
> 0x7b347f7c : 0x7b585f7d
> 0x7b347f78 : 0x7b347f80
> 0x7b347f74 : 0x
> 0x7b347f70 : 0x0001
> 0x7b347f6c : 0x7b57b01d
> 0x7b347f68 : 0x7b5c3fc8
> 0x7b347f64 : 0x7b347f80
> 0x7b347f60 : 0x
> 0x7b347f5c : 0x0001
> --->0x7b347f58 : 0x7b57cd1a
> 0x7b347f54 : 0x00010202
> 0x7b347f50 : 0x0010
> 0x7b347f4c : 0x46174204
> ### ERROR ### Please RESET the board ###
>
>
> [snip]
>
> Regards,
> Bin

- Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] Xpedite boards

2017-05-12 Thread Simon Glass
Hi Peter,

On 11 May 2017 at 17:27, Peter Tyser  wrote:
>
> Hi Simon,
>
> >
> > I am trying to help with the U-Boot conversion of CONFIG options to
> > Kconfig. I notice that the Xpedite boards use a ds4510 driver which
> > defines quite a few of these options. I could potentially convert it
> > to Kconfig.
>
> Thanks, and thanks for your work on U-Boot improvements in general over
> the last few years!  I've been out of the development loop, but it's
> neat to see the improvements you've been shepherding.

OK thanks!

>
> > However, many of the options in these boards define I2C addresses,
> > which these days should be done with driver model / device tree.
> >
> > I wonder if you have any interest in converting these boards as part
> > of ongoing work?
>
> I definitely have interest, but am iffy on the time:)  From what I
> understand PowerPC has been pretty tardy on moving to the driver model
> / device tree, and no PowerPC board uses the device tree control at
> this point.  To make sure I understand the end goal, you're asking
> about defining CONFIG_OF_CONTROL for the XPedite boards?  This would
> primarily entail getting CONFIG_OF_CONTROL working, at which point the
> driver model should "just work"?  Let me know if I'm missing the high
> level picture.

PowerPC does support this - e.g. see glacier and related boards.

I think the steps are something like:
- Set up a suitable device tree for the board (can be bare-bones)
- Enable OF_CONTROL etc.
- Move the CONFIG options to the device tree
- Convert anything remaining with the moveconfig.py tool

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 3/6] dm: ram: bmips: split bcm6358_get_ram_size

2017-05-12 Thread Álvaro Fernández Rojas
This is done in order to reuse ram size calculation for BCM6338/BCM6348

Signed-off-by: Álvaro Fernández Rojas 
---
 drivers/ram/bmips_ram.c | 23 +--
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/ram/bmips_ram.c b/drivers/ram/bmips_ram.c
index d0f7cd7..382e231 100644
--- a/drivers/ram/bmips_ram.c
+++ b/drivers/ram/bmips_ram.c
@@ -40,24 +40,27 @@ static ulong bcm6328_get_ram_size(struct bmips_ram_priv 
*priv)
return readl_be(priv->regs + DDR_CSEND_REG) << 24;
 }
 
+static ulong bmips_dram_size(unsigned int cols, unsigned int rows,
+unsigned int is_32b, unsigned int banks)
+{
+   rows += 11; /* 0 => 11 address bits ... 2 => 13 address bits */
+   cols += 8; /* 0 => 8 address bits ... 2 => 10 address bits */
+   is_32b += 1;
+
+   return 1 << (cols + rows + is_32b + banks);
+}
+
 static ulong bcm6358_get_ram_size(struct bmips_ram_priv *priv)
 {
-   unsigned int cols = 0, rows = 0, is_32bits = 0, banks = 0;
+   unsigned int cols = 0, rows = 0, is_32b = 0;
u32 val;
 
val = readl_be(priv->regs + MEMC_CFG_REG);
rows = (val & MEMC_CFG_ROW_MASK) >> MEMC_CFG_ROW_SHIFT;
cols = (val & MEMC_CFG_COL_MASK) >> MEMC_CFG_COL_SHIFT;
-   is_32bits = (val & MEMC_CFG_32B_MASK) ? 0 : 1;
-   banks = 2;
-
-   /* 0 => 11 address bits ... 2 => 13 address bits */
-   rows += 11;
-
-   /* 0 => 8 address bits ... 2 => 10 address bits */
-   cols += 8;
+   is_32b = (val & MEMC_CFG_32B_MASK) ? 0 : 1;
 
-   return 1 << (cols + rows + (is_32bits + 1) + banks);
+   return bmips_dram_size(cols, rows, is_32b, 2);
 }
 
 static int bmips_ram_get_info(struct udevice *dev, struct ram_info *info)
-- 
2.1.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 0/6] mips: bmips: add BCM6348 SoC support

2017-05-12 Thread Álvaro Fernández Rojas
BCM6348 is one of the first BCM63xx SoCs and prior to BCM6358, which means
that it also needs ioremap "hacks".
Appart from that, rev a1 BCM6348 SoCs have a HW bug and it's pll_conf
register can't be used to perform reboots.

Álvaro Fernández Rojas (6):
  dm: cpu: bmips: rename cpu_desc specific functions
  dm: cpu: bmips: add BCM6348 support
  dm: ram: bmips: split bcm6358_get_ram_size
  dm: cpu: bmips: add BCM6338/BCM6348 support
  MIPS: add support for Broadcom MIPS BCM6348 SoC family
  MIPS: add BMIPS Comtrend CT-5361 board

 arch/mips/dts/Makefile|   1 +
 arch/mips/dts/brcm,bcm6348.dtsi   | 127 ++
 arch/mips/dts/comtrend,ct-5361.dts|  49 
 arch/mips/mach-bmips/Kconfig  |  18 +
 arch/mips/mach-bmips/include/ioremap.h|   3 +-
 board/comtrend/ct5361/Kconfig |  12 +++
 board/comtrend/ct5361/MAINTAINERS |   6 ++
 board/comtrend/ct5361/Makefile|   5 ++
 board/comtrend/ct5361/ct-5361.c   |   7 ++
 configs/comtrend_ct5361_ram_defconfig |  57 ++
 drivers/cpu/bmips_cpu.c   |  44 +--
 drivers/ram/bmips_ram.c   |  54 ++---
 include/configs/bmips_bcm6348.h   |  30 +++
 include/configs/comtrend_ct5361.h |  20 +
 include/dt-bindings/clock/bcm6348-clock.h |  22 ++
 include/dt-bindings/reset/bcm6348-reset.h |  22 ++
 16 files changed, 461 insertions(+), 16 deletions(-)
 create mode 100644 arch/mips/dts/brcm,bcm6348.dtsi
 create mode 100644 arch/mips/dts/comtrend,ct-5361.dts
 create mode 100644 board/comtrend/ct5361/Kconfig
 create mode 100644 board/comtrend/ct5361/MAINTAINERS
 create mode 100644 board/comtrend/ct5361/Makefile
 create mode 100644 board/comtrend/ct5361/ct-5361.c
 create mode 100644 configs/comtrend_ct5361_ram_defconfig
 create mode 100644 include/configs/bmips_bcm6348.h
 create mode 100644 include/configs/comtrend_ct5361.h
 create mode 100644 include/dt-bindings/clock/bcm6348-clock.h
 create mode 100644 include/dt-bindings/reset/bcm6348-reset.h

-- 
2.1.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 2/6] dm: cpu: bmips: add BCM6348 support

2017-05-12 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 drivers/cpu/bmips_cpu.c | 34 ++
 1 file changed, 34 insertions(+)

diff --git a/drivers/cpu/bmips_cpu.c b/drivers/cpu/bmips_cpu.c
index 6087163..03b503a 100644
--- a/drivers/cpu/bmips_cpu.c
+++ b/drivers/cpu/bmips_cpu.c
@@ -30,6 +30,14 @@ DECLARE_GLOBAL_DATA_PTR;
 #define STRAPBUS_6328_FCVO_SHIFT   7
 #define STRAPBUS_6328_FCVO_MASK(0x1f << 
STRAPBUS_6328_FCVO_SHIFT)
 
+#define REG_BCM6348_PERF_MIPSPLLCFG0x34
+#define MIPSPLLCFG_6348_M1CPU_SHIFT6
+#define MIPSPLLCFG_6348_M1CPU_MASK (0x7 << MIPSPLLCFG_6348_M1CPU_SHIFT)
+#define MIPSPLLCFG_6348_N2_SHIFT   15
+#define MIPSPLLCFG_6348_N2_MASK(0x1F << 
MIPSPLLCFG_6348_N2_SHIFT)
+#define MIPSPLLCFG_6348_N1_SHIFT   20
+#define MIPSPLLCFG_6348_N1_MASK(0x7 << 
MIPSPLLCFG_6348_N1_SHIFT)
+
 #define REG_BCM6358_DDR_DMIPSPLLCFG0x12b8
 #define DMIPSPLLCFG_6358_M1_SHIFT  0
 #define DMIPSPLLCFG_6358_M1_MASK   (0xff << DMIPSPLLCFG_6358_M1_SHIFT)
@@ -115,6 +123,18 @@ static ulong bcm6328_get_cpu_freq(struct bmips_cpu_priv 
*priv)
}
 }
 
+static ulong bcm6348_get_cpu_freq(struct bmips_cpu_priv *priv)
+{
+   unsigned int tmp, n1, n2, m1;
+
+   tmp = readl_be(priv->regs + REG_BCM6348_PERF_MIPSPLLCFG);
+   n1 = (tmp & MIPSPLLCFG_6348_N1_MASK) >> MIPSPLLCFG_6348_N1_SHIFT;
+   n2 = (tmp & MIPSPLLCFG_6348_N2_MASK) >> MIPSPLLCFG_6348_N2_SHIFT;
+   m1 = (tmp & MIPSPLLCFG_6348_M1CPU_MASK) >> MIPSPLLCFG_6348_M1CPU_SHIFT;
+
+   return (16 * 100 * (n1 + 1) * (n2 + 2)) / (m1 + 1);
+}
+
 static ulong bcm6358_get_cpu_freq(struct bmips_cpu_priv *priv)
 {
unsigned int tmp, n1, n2, m1;
@@ -160,6 +180,11 @@ static int bcm6328_get_cpu_count(struct bmips_cpu_priv 
*priv)
return 2;
 }
 
+static int bcm6345_get_cpu_count(struct bmips_cpu_priv *priv)
+{
+   return 1;
+}
+
 static int bcm6358_get_cpu_count(struct bmips_cpu_priv *priv)
 {
return 2;
@@ -171,6 +196,12 @@ static const struct bmips_cpu_hw bmips_cpu_bcm6328 = {
.get_cpu_count = bcm6328_get_cpu_count,
 };
 
+static const struct bmips_cpu_hw bmips_cpu_bcm6348 = {
+   .get_cpu_desc = bmips_short_cpu_desc,
+   .get_cpu_freq = bcm6348_get_cpu_freq,
+   .get_cpu_count = bcm6345_get_cpu_count,
+};
+
 static const struct bmips_cpu_hw bmips_cpu_bcm6358 = {
.get_cpu_desc = bmips_short_cpu_desc,
.get_cpu_freq = bcm6358_get_cpu_freq,
@@ -262,6 +293,9 @@ static const struct udevice_id bmips_cpu_ids[] = {
.compatible = "brcm,bcm6328-cpu",
.data = (ulong)_cpu_bcm6328,
}, {
+   .compatible = "brcm,bcm6348-cpu",
+   .data = (ulong)_cpu_bcm6348,
+   }, {
.compatible = "brcm,bcm6358-cpu",
.data = (ulong)_cpu_bcm6358,
}, {
-- 
2.1.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 5/6] MIPS: add support for Broadcom MIPS BCM6348 SoC family

2017-05-12 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 arch/mips/dts/brcm,bcm6348.dtsi   | 127 ++
 arch/mips/mach-bmips/Kconfig  |  18 +
 arch/mips/mach-bmips/include/ioremap.h|   3 +-
 include/configs/bmips_bcm6348.h   |  30 +++
 include/dt-bindings/clock/bcm6348-clock.h |  22 ++
 include/dt-bindings/reset/bcm6348-reset.h |  22 ++
 6 files changed, 221 insertions(+), 1 deletion(-)
 create mode 100644 arch/mips/dts/brcm,bcm6348.dtsi
 create mode 100644 include/configs/bmips_bcm6348.h
 create mode 100644 include/dt-bindings/clock/bcm6348-clock.h
 create mode 100644 include/dt-bindings/reset/bcm6348-reset.h

diff --git a/arch/mips/dts/brcm,bcm6348.dtsi b/arch/mips/dts/brcm,bcm6348.dtsi
new file mode 100644
index 000..711b643
--- /dev/null
+++ b/arch/mips/dts/brcm,bcm6348.dtsi
@@ -0,0 +1,127 @@
+/*
+ * Copyright (C) 2017 Álvaro Fernández Rojas 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include "skeleton.dtsi"
+
+/ {
+   compatible = "brcm,bcm6348";
+
+   cpus {
+   reg = <0xfffe 0x4>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+   u-boot,dm-pre-reloc;
+
+   cpu@0 {
+   compatible = "brcm,bcm6348-cpu", "mips,mips4Kc";
+   device_type = "cpu";
+   reg = <0>;
+   u-boot,dm-pre-reloc;
+   };
+   };
+
+   clocks {
+   compatible = "simple-bus";
+   #address-cells = <1>;
+   #size-cells = <1>;
+   u-boot,dm-pre-reloc;
+
+   periph_osc: periph-osc {
+   compatible = "fixed-clock";
+   #clock-cells = <0>;
+   clock-frequency = <5000>;
+   u-boot,dm-pre-reloc;
+   };
+
+   periph_clk: periph-clk {
+   compatible = "brcm,bcm6345-clk";
+   reg = <0xfffe0004 0x4>;
+   #clock-cells = <1>;
+   };
+   };
+
+   pflash: nor@1fc0 {
+   compatible = "cfi-flash";
+   reg = <0x1fc0 0x200>;
+   bank-width = <2>;
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   status = "disabled";
+   };
+
+   ubus {
+   compatible = "simple-bus";
+   #address-cells = <1>;
+   #size-cells = <1>;
+   u-boot,dm-pre-reloc;
+
+   pll_cntl: syscon@fffe0008 {
+   compatible = "syscon";
+   reg = <0xfffe0008 0x4>;
+   };
+
+   syscon-reboot {
+   compatible = "syscon-reboot";
+   regmap = <_cntl>;
+   offset = <0x0>;
+   mask = <0x1>;
+   };
+
+   periph_rst: reset-controller@fffe0028 {
+   compatible = "brcm,bcm6345-reset";
+   reg = <0xfffe0028 0x4>;
+   #reset-cells = <1>;
+   };
+
+   wdt: watchdog@fffe021c {
+   compatible = "brcm,bcm6345-wdt";
+   reg = <0xfffe021c 0xc>;
+   clocks = <_osc>;
+   };
+
+   wdt-reboot {
+   compatible = "wdt-reboot";
+   wdt = <>;
+   };
+
+   uart0: serial@fffe0300 {
+   compatible = "brcm,bcm6345-uart";
+   reg = <0xfffe0300 0x18>;
+   clocks = <_osc>;
+
+   status = "disabled";
+   };
+
+   gpio1: gpio-controller@fffe0400 {
+   compatible = "brcm,bcm6345-gpio";
+   reg = <0xfffe0400 0x4>, <0xfffe0408 0x4>;
+   gpio-controller;
+   #gpio-cells = <2>;
+   ngpios = <5>;
+
+   status = "disabled";
+   };
+
+   gpio0: gpio-controller@fffe0404 {
+   compatible = "brcm,bcm6345-gpio";
+   reg = <0xfffe0404 0x4>, <0xfffe040c 0x4>;
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   status = "disabled";
+   };
+
+   memory-controller@fffe2300 {
+   compatible = "brcm,bcm6338-mc";
+   reg = <0xfffe2300 0x38>;
+   u-boot,dm-pre-reloc;
+   };
+   };
+};
diff --git a/arch/mips/mach-bmips/Kconfig b/arch/mips/mach-bmips/Kconfig
index 4a0c383..c2b0f89 100644
--- a/arch/mips/mach-bmips/Kconfig
+++ b/arch/mips/mach-bmips/Kconfig
@@ -3,6 +3,7 @@ menu "Broadcom MIPS platforms"
 
 

[U-Boot] [PATCH 4/6] dm: cpu: bmips: add BCM6338/BCM6348 support

2017-05-12 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 drivers/ram/bmips_ram.c | 31 +++
 1 file changed, 31 insertions(+)

diff --git a/drivers/ram/bmips_ram.c b/drivers/ram/bmips_ram.c
index 382e231..ac35fbe 100644
--- a/drivers/ram/bmips_ram.c
+++ b/drivers/ram/bmips_ram.c
@@ -14,6 +14,16 @@
 #include 
 #include 
 
+#define SDRAM_CFG_REG  0x0
+#define SDRAM_CFG_COL_SHIFT4
+#define SDRAM_CFG_COL_MASK (0x3 << SDRAM_CFG_COL_SHIFT)
+#define SDRAM_CFG_ROW_SHIFT6
+#define SDRAM_CFG_ROW_MASK (0x3 << SDRAM_CFG_ROW_SHIFT)
+#define SDRAM_CFG_32B_SHIFT10
+#define SDRAM_CFG_32B_MASK (1 << SDRAM_CFG_32B_SHIFT)
+#define SDRAM_CFG_BANK_SHIFT   13
+#define SDRAM_CFG_BANK_MASK(1 << SDRAM_CFG_BANK_SHIFT)
+
 #define MEMC_CFG_REG   0x4
 #define MEMC_CFG_32B_SHIFT 1
 #define MEMC_CFG_32B_MASK  (1 << MEMC_CFG_32B_SHIFT)
@@ -50,6 +60,20 @@ static ulong bmips_dram_size(unsigned int cols, unsigned int 
rows,
return 1 << (cols + rows + is_32b + banks);
 }
 
+static ulong bcm6338_get_ram_size(struct bmips_ram_priv *priv)
+{
+   unsigned int cols = 0, rows = 0, is_32b = 0, banks = 0;
+   u32 val;
+
+   val = readl_be(priv->regs + SDRAM_CFG_REG);
+   rows = (val & SDRAM_CFG_ROW_MASK) >> SDRAM_CFG_ROW_SHIFT;
+   cols = (val & SDRAM_CFG_COL_MASK) >> SDRAM_CFG_COL_SHIFT;
+   is_32b = (val & SDRAM_CFG_32B_MASK) ? 1 : 0;
+   banks = (val & SDRAM_CFG_BANK_MASK) ? 2 : 1;
+
+   return bmips_dram_size(cols, rows, is_32b, banks);
+}
+
 static ulong bcm6358_get_ram_size(struct bmips_ram_priv *priv)
 {
unsigned int cols = 0, rows = 0, is_32b = 0;
@@ -82,6 +106,10 @@ static const struct bmips_ram_hw bmips_ram_bcm6328 = {
.get_ram_size = bcm6328_get_ram_size,
 };
 
+static const struct bmips_ram_hw bmips_ram_bcm6338 = {
+   .get_ram_size = bcm6338_get_ram_size,
+};
+
 static const struct bmips_ram_hw bmips_ram_bcm6358 = {
.get_ram_size = bcm6358_get_ram_size,
 };
@@ -91,6 +119,9 @@ static const struct udevice_id bmips_ram_ids[] = {
.compatible = "brcm,bcm6328-mc",
.data = (ulong)_ram_bcm6328,
}, {
+   .compatible = "brcm,bcm6338-mc",
+   .data = (ulong)_ram_bcm6338,
+   }, {
.compatible = "brcm,bcm6358-mc",
.data = (ulong)_ram_bcm6358,
}, { /* sentinel */ }
-- 
2.1.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/6] dm: cpu: bmips: rename cpu_desc specific functions

2017-05-12 Thread Álvaro Fernández Rojas
Use a generic name for cpu_desc functions instead of using a specific SoC one.

Signed-off-by: Álvaro Fernández Rojas 
---
 drivers/cpu/bmips_cpu.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/cpu/bmips_cpu.c b/drivers/cpu/bmips_cpu.c
index 379acf2..6087163 100644
--- a/drivers/cpu/bmips_cpu.c
+++ b/drivers/cpu/bmips_cpu.c
@@ -56,7 +56,7 @@ struct bmips_cpu_priv {
 };
 
 /* Specific CPU Ops */
-static int bcm6358_get_cpu_desc(struct bmips_cpu_priv *priv, char *buf,
+static int bmips_short_cpu_desc(struct bmips_cpu_priv *priv, char *buf,
int size)
 {
unsigned short cpu_id;
@@ -72,7 +72,7 @@ static int bcm6358_get_cpu_desc(struct bmips_cpu_priv *priv, 
char *buf,
return 0;
 }
 
-static int bcm6328_get_cpu_desc(struct bmips_cpu_priv *priv, char *buf,
+static int bmips_long_cpu_desc(struct bmips_cpu_priv *priv, char *buf,
int size)
 {
unsigned int cpu_id;
@@ -166,19 +166,19 @@ static int bcm6358_get_cpu_count(struct bmips_cpu_priv 
*priv)
 }
 
 static const struct bmips_cpu_hw bmips_cpu_bcm6328 = {
-   .get_cpu_desc = bcm6328_get_cpu_desc,
+   .get_cpu_desc = bmips_long_cpu_desc,
.get_cpu_freq = bcm6328_get_cpu_freq,
.get_cpu_count = bcm6328_get_cpu_count,
 };
 
 static const struct bmips_cpu_hw bmips_cpu_bcm6358 = {
-   .get_cpu_desc = bcm6358_get_cpu_desc,
+   .get_cpu_desc = bmips_short_cpu_desc,
.get_cpu_freq = bcm6358_get_cpu_freq,
.get_cpu_count = bcm6358_get_cpu_count,
 };
 
 static const struct bmips_cpu_hw bmips_cpu_bcm63268 = {
-   .get_cpu_desc = bcm6328_get_cpu_desc,
+   .get_cpu_desc = bmips_long_cpu_desc,
.get_cpu_freq = bcm63268_get_cpu_freq,
.get_cpu_count = bcm6358_get_cpu_count,
 };
-- 
2.1.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 6/8] mips: bmips: add wdt-reboot driver support for BCM6358

2017-05-12 Thread Álvaro Fernández Rojas
This driver allows rebooting the SoC by calling wdt_expire_now op.

Signed-off-by: Álvaro Fernández Rojas 
---
 arch/mips/dts/brcm,bcm6358.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/mips/dts/brcm,bcm6358.dtsi b/arch/mips/dts/brcm,bcm6358.dtsi
index 5d8399c..4f63cf8 100644
--- a/arch/mips/dts/brcm,bcm6358.dtsi
+++ b/arch/mips/dts/brcm,bcm6358.dtsi
@@ -93,6 +93,11 @@
clocks = <_osc>;
};
 
+   wdt-reboot {
+   compatible = "wdt-reboot";
+   wdt = <>;
+   };
+
gpio1: gpio-controller@fffe0080 {
compatible = "brcm,bcm6345-gpio";
reg = <0xfffe0080 0x4>, <0xfffe0088 0x4>;
-- 
2.1.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 6/6] MIPS: add BMIPS Comtrend CT-5361 board

2017-05-12 Thread Álvaro Fernández Rojas
Signed-off-by: Álvaro Fernández Rojas 
---
 arch/mips/dts/Makefile|  1 +
 arch/mips/dts/comtrend,ct-5361.dts| 49 ++
 board/comtrend/ct5361/Kconfig | 12 
 board/comtrend/ct5361/MAINTAINERS |  6 
 board/comtrend/ct5361/Makefile|  5 +++
 board/comtrend/ct5361/ct-5361.c   |  7 +
 configs/comtrend_ct5361_ram_defconfig | 57 +++
 include/configs/comtrend_ct5361.h | 20 
 8 files changed, 157 insertions(+)
 create mode 100644 arch/mips/dts/comtrend,ct-5361.dts
 create mode 100644 board/comtrend/ct5361/Kconfig
 create mode 100644 board/comtrend/ct5361/MAINTAINERS
 create mode 100644 board/comtrend/ct5361/Makefile
 create mode 100644 board/comtrend/ct5361/ct-5361.c
 create mode 100644 configs/comtrend_ct5361_ram_defconfig
 create mode 100644 include/configs/comtrend_ct5361.h

diff --git a/arch/mips/dts/Makefile b/arch/mips/dts/Makefile
index 4c02c48..9bab744 100644
--- a/arch/mips/dts/Makefile
+++ b/arch/mips/dts/Makefile
@@ -9,6 +9,7 @@ dtb-$(CONFIG_TARGET_MALTA) += mti,malta.dtb
 dtb-$(CONFIG_TARGET_PIC32MZDASK) += pic32mzda_sk.dtb
 dtb-$(CONFIG_TARGET_XILFPGA) += nexys4ddr.dtb
 dtb-$(CONFIG_BOARD_COMTREND_AR5387UN) += comtrend,ar-5387un.dtb
+dtb-$(CONFIG_BOARD_COMTREND_CT5361) += comtrend,ct-5361.dtb
 dtb-$(CONFIG_BOARD_COMTREND_VR3032U) += comtrend,vr-3032u.dtb
 dtb-$(CONFIG_BOARD_HUAWEI_HG556A) += huawei,hg556a.dtb
 dtb-$(CONFIG_BOARD_TPLINK_WDR4300) += tplink_wdr4300.dtb
diff --git a/arch/mips/dts/comtrend,ct-5361.dts 
b/arch/mips/dts/comtrend,ct-5361.dts
new file mode 100644
index 000..c909a52
--- /dev/null
+++ b/arch/mips/dts/comtrend,ct-5361.dts
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2017 Álvaro Fernández Rojas 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+/dts-v1/;
+
+#include "brcm,bcm6348.dtsi"
+
+/ {
+   model = "Comtrend CT-5361";
+   compatible = "comtrend,ct-5361", "brcm,bcm6348";
+
+   aliases {
+   serial0 = 
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+
+   gpio-leds {
+   compatible = "gpio-leds";
+
+   power_green {
+   label = "CT-5361:green:power";
+   gpios = < 0 1>;
+   };
+
+   alarm_red {
+   label = "CT-5361:red:alarm";
+   gpios = < 2 1>;
+   };
+   };
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   u-boot,dm-pre-reloc;
+   status = "okay";
+};
diff --git a/board/comtrend/ct5361/Kconfig b/board/comtrend/ct5361/Kconfig
new file mode 100644
index 000..d77d814
--- /dev/null
+++ b/board/comtrend/ct5361/Kconfig
@@ -0,0 +1,12 @@
+if BOARD_COMTREND_CT5361
+
+config SYS_BOARD
+   default "ct5361"
+
+config SYS_VENDOR
+   default "comtrend"
+
+config SYS_CONFIG_NAME
+   default "comtrend_ct5361"
+
+endif
diff --git a/board/comtrend/ct5361/MAINTAINERS 
b/board/comtrend/ct5361/MAINTAINERS
new file mode 100644
index 000..aea737a
--- /dev/null
+++ b/board/comtrend/ct5361/MAINTAINERS
@@ -0,0 +1,6 @@
+COMTREND CT-5361 BOARD
+M: Álvaro Fernández Rojas 
+S: Maintained
+F: board/comtrend/ct-5361/
+F: include/configs/comtrend_ct5361.h
+F: configs/comtrend_ct5361_ram_defconfig
diff --git a/board/comtrend/ct5361/Makefile b/board/comtrend/ct5361/Makefile
new file mode 100644
index 000..872e80a
--- /dev/null
+++ b/board/comtrend/ct5361/Makefile
@@ -0,0 +1,5 @@
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y += ct-5361.o
diff --git a/board/comtrend/ct5361/ct-5361.c b/board/comtrend/ct5361/ct-5361.c
new file mode 100644
index 000..d181ca6
--- /dev/null
+++ b/board/comtrend/ct5361/ct-5361.c
@@ -0,0 +1,7 @@
+/*
+ * Copyright (C) 2017 Álvaro Fernández Rojas 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
diff --git a/configs/comtrend_ct5361_ram_defconfig 
b/configs/comtrend_ct5361_ram_defconfig
new file mode 100644
index 000..9ec0c41
--- /dev/null
+++ b/configs/comtrend_ct5361_ram_defconfig
@@ -0,0 +1,57 @@
+CONFIG_ARCH_BMIPS=y
+CONFIG_BAUDRATE=115200
+CONFIG_BCM6345_CLK=y
+CONFIG_BCM6345_GPIO=y
+CONFIG_BCM6345_SERIAL=y
+CONFIG_BMIPS_BOOT_RAM=y
+CONFIG_BOARD_COMTREND_CT5361=y
+CONFIG_CFI_FLASH=y
+# CONFIG_CMD_BOOTD is not set
+CONFIG_CMD_BOOTM=y
+CONFIG_CMD_CPU=y
+# CONFIG_CMD_CRC32 is not set
+# CONFIG_CMD_EDITENV is not set
+# CONFIG_CMD_ELF is not set
+# CONFIG_CMD_ENV_EXISTS is not set
+# CONFIG_CMD_EXPORTENV is not set
+CONFIG_CMD_FLASH=y
+# CONFIG_CMD_FPGA is not set
+# CONFIG_CMD_GPIO is not set
+# CONFIG_CMD_IMLS is not set
+# CONFIG_CMD_IMPORTENV is not set
+CONFIG_CMD_LED=y
+CONFIG_CMD_LICENSE=y
+CONFIG_CMD_LOADB=y
+# CONFIG_CMD_LOADS is not set
+CONFIG_CMD_MEMINFO=y
+# CONFIG_CMD_MISC is not set
+# CONFIG_CMD_NET is not set
+# CONFIG_CMD_NFS is not set

[U-Boot] [PATCH 2/8] mips: bmips: add bcm6345-wdt driver support for BCM6358

2017-05-12 Thread Álvaro Fernández Rojas
This driver controls the watchdog present on this SoC.

Signed-off-by: Álvaro Fernández Rojas 
---
 arch/mips/dts/brcm,bcm6358.dtsi | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/mips/dts/brcm,bcm6358.dtsi b/arch/mips/dts/brcm,bcm6358.dtsi
index 0dad998..5d8399c 100644
--- a/arch/mips/dts/brcm,bcm6358.dtsi
+++ b/arch/mips/dts/brcm,bcm6358.dtsi
@@ -87,6 +87,12 @@
#reset-cells = <1>;
};
 
+   wdt: watchdog@fffe005c {
+   compatible = "brcm,bcm6345-wdt";
+   reg = <0xfffe005c 0xc>;
+   clocks = <_osc>;
+   };
+
gpio1: gpio-controller@fffe0080 {
compatible = "brcm,bcm6345-gpio";
reg = <0xfffe0080 0x4>, <0xfffe0088 0x4>;
-- 
2.1.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 3/8] mips: bmips: add bcm6345-wdt driver support for BCM6328

2017-05-12 Thread Álvaro Fernández Rojas
This driver controls the watchdog present on this SoC.

Signed-off-by: Álvaro Fernández Rojas 
---
 arch/mips/dts/brcm,bcm6328.dtsi | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/mips/dts/brcm,bcm6328.dtsi b/arch/mips/dts/brcm,bcm6328.dtsi
index 3926885..36dd8bc 100644
--- a/arch/mips/dts/brcm,bcm6328.dtsi
+++ b/arch/mips/dts/brcm,bcm6328.dtsi
@@ -78,6 +78,12 @@
mask = <0x1>;
};
 
+   wdt: watchdog@105c {
+   compatible = "brcm,bcm6345-wdt";
+   reg = <0x105c 0xc>;
+   clocks = <_osc>;
+   };
+
gpio: gpio-controller@1084 {
compatible = "brcm,bcm6345-gpio";
reg = <0x1084 0x4>, <0x108c 0x4>;
-- 
2.1.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 7/8] mips: bmips: add wdt-reboot driver support for BCM6328

2017-05-12 Thread Álvaro Fernández Rojas
This driver allows rebooting the SoC by calling wdt_expire_now op.

Signed-off-by: Álvaro Fernández Rojas 
---
 arch/mips/dts/brcm,bcm6328.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/mips/dts/brcm,bcm6328.dtsi b/arch/mips/dts/brcm,bcm6328.dtsi
index 36dd8bc..a996075 100644
--- a/arch/mips/dts/brcm,bcm6328.dtsi
+++ b/arch/mips/dts/brcm,bcm6328.dtsi
@@ -84,6 +84,11 @@
clocks = <_osc>;
};
 
+   wdt-reboot {
+   compatible = "wdt-reboot";
+   wdt = <>;
+   };
+
gpio: gpio-controller@1084 {
compatible = "brcm,bcm6345-gpio";
reg = <0x1084 0x4>, <0x108c 0x4>;
-- 
2.1.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 4/8] mips: bmips: add bcm6345-wdt driver support for BCM63268

2017-05-12 Thread Álvaro Fernández Rojas
This driver controls the watchdog present on this SoC.

Signed-off-by: Álvaro Fernández Rojas 
---
 arch/mips/dts/brcm,bcm63268.dtsi | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/mips/dts/brcm,bcm63268.dtsi b/arch/mips/dts/brcm,bcm63268.dtsi
index b03763f..a3b7e73 100644
--- a/arch/mips/dts/brcm,bcm63268.dtsi
+++ b/arch/mips/dts/brcm,bcm63268.dtsi
@@ -84,6 +84,12 @@
#reset-cells = <1>;
};
 
+   wdt: watchdog@109c {
+   compatible = "brcm,bcm6345-wdt";
+   reg = <0x109c 0xc>;
+   clocks = <_osc>;
+   };
+
gpio1: gpio-controller@10c0 {
compatible = "brcm,bcm6345-gpio";
reg = <0x10c0 0x4>, <0x10c8 0x4>;
-- 
2.1.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 5/8] dm: sysreset: add watchdog-reboot driver

2017-05-12 Thread Álvaro Fernández Rojas
Add a new sysreset driver that uses the recently added watchdog support.
It performs a full SoC reset by calling wdt_expire_now op.

Signed-off-by: Álvaro Fernández Rojas 
---
 drivers/sysreset/Kconfig |  6 
 drivers/sysreset/Makefile|  1 +
 drivers/sysreset/sysreset_watchdog.c | 57 
 3 files changed, 64 insertions(+)
 create mode 100644 drivers/sysreset/sysreset_watchdog.c

diff --git a/drivers/sysreset/Kconfig b/drivers/sysreset/Kconfig
index b2f7464..a6d48e8 100644
--- a/drivers/sysreset/Kconfig
+++ b/drivers/sysreset/Kconfig
@@ -31,4 +31,10 @@ config SYSRESET_SYSCON
help
  Reboot support for generic SYSCON mapped register reset.
 
+config SYSRESET_WATCHDOG
+   bool "Enable support for watchdog reboot driver"
+   select WDT
+   help
+ Reboot support for generic watchdog reset.
+
 endmenu
diff --git a/drivers/sysreset/Makefile b/drivers/sysreset/Makefile
index bd352e7..b683811 100644
--- a/drivers/sysreset/Makefile
+++ b/drivers/sysreset/Makefile
@@ -7,6 +7,7 @@
 obj-$(CONFIG_SYSRESET) += sysreset-uclass.o
 obj-$(CONFIG_SYSRESET_PSCI) += sysreset_psci.o
 obj-$(CONFIG_SYSRESET_SYSCON) += sysreset_syscon.o
+obj-$(CONFIG_SYSRESET_WATCHDOG) += sysreset_watchdog.o
 
 ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_ROCKCHIP_RK3036) += sysreset_rk3036.o
diff --git a/drivers/sysreset/sysreset_watchdog.c 
b/drivers/sysreset/sysreset_watchdog.c
new file mode 100644
index 000..caeb039
--- /dev/null
+++ b/drivers/sysreset/sysreset_watchdog.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2017 Álvaro Fernández Rojas 
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct wdt_reboot_priv {
+   struct udevice *wdt;
+};
+
+static int wdt_reboot_request(struct udevice *dev, enum sysreset_t type)
+{
+   struct wdt_reboot_priv *priv = dev_get_priv(dev);
+
+   wdt_expire_now(priv->wdt, 0);
+
+   return -EINPROGRESS;
+}
+
+static struct sysreset_ops wdt_reboot_ops = {
+   .request = wdt_reboot_request,
+};
+
+int wdt_reboot_probe(struct udevice *dev)
+{
+   struct wdt_reboot_priv *priv = dev_get_priv(dev);
+   int err;
+
+   err = uclass_get_device_by_phandle(UCLASS_WDT, dev,
+  "wdt", >wdt);
+   if (err) {
+   error("unable to find wdt device\n");
+   return err;
+   }
+
+   return 0;
+}
+
+static const struct udevice_id wdt_reboot_ids[] = {
+   { .compatible = "wdt-reboot" },
+   { /* sentinel */ }
+};
+
+U_BOOT_DRIVER(wdt_reboot) = {
+   .name = "wdt_reboot",
+   .id = UCLASS_SYSRESET,
+   .of_match = wdt_reboot_ids,
+   .ops = _reboot_ops,
+   .priv_auto_alloc_size = sizeof(struct wdt_reboot_priv),
+   .probe = wdt_reboot_probe,
+};
-- 
2.1.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 8/8] mips: bmips: add wdt-reboot driver support for BCM63268

2017-05-12 Thread Álvaro Fernández Rojas
This driver allows rebooting the SoC by calling wdt_expire_now op.

Signed-off-by: Álvaro Fernández Rojas 
---
 arch/mips/dts/brcm,bcm63268.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/mips/dts/brcm,bcm63268.dtsi b/arch/mips/dts/brcm,bcm63268.dtsi
index a3b7e73..113a96b 100644
--- a/arch/mips/dts/brcm,bcm63268.dtsi
+++ b/arch/mips/dts/brcm,bcm63268.dtsi
@@ -90,6 +90,11 @@
clocks = <_osc>;
};
 
+   wdt-reboot {
+   compatible = "wdt-reboot";
+   wdt = <>;
+   };
+
gpio1: gpio-controller@10c0 {
compatible = "brcm,bcm6345-gpio";
reg = <0x10c0 0x4>, <0x10c8 0x4>;
-- 
2.1.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 1/8] dm: watchdog: add BCM6345 watchdog driver

2017-05-12 Thread Álvaro Fernández Rojas
This driver is a simplified version of linux/drivers/watchdog/bcm63xx_wdt.c

Signed-off-by: Álvaro Fernández Rojas 
---
 drivers/watchdog/Kconfig   |   8 +++
 drivers/watchdog/Makefile  |   1 +
 drivers/watchdog/bcm6345_wdt.c | 109 +
 3 files changed, 118 insertions(+)
 create mode 100644 drivers/watchdog/bcm6345_wdt.c

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index bdaf5d4..8d56af7 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -46,4 +46,12 @@ config WDT_ASPEED
  It currently does not support Boot Flash Addressing Mode Detection or
  Second Boot.
 
+config WDT_BCM6345
+   bool "BCM6345 watchdog timer support"
+   depends on WDT && ARCH_BMIPS
+   help
+ Select this to enable watchdog timer for BCM6345 SoCs.
+ The watchdog timer is stopped when initialized.
+ It performs full SoC reset.
+
 endmenu
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index 8378601..4b19e4c 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -18,4 +18,5 @@ obj-$(CONFIG_ULP_WATCHDOG) += ulp_wdog.o
 obj-$(CONFIG_WDT) += wdt-uclass.o
 obj-$(CONFIG_WDT_SANDBOX) += sandbox_wdt.o
 obj-$(CONFIG_WDT_ASPEED) += ast_wdt.o
+obj-$(CONFIG_WDT_BCM6345) += bcm6345_wdt.o
 obj-$(CONFIG_BCM2835_WDT)   += bcm2835_wdt.o
diff --git a/drivers/watchdog/bcm6345_wdt.c b/drivers/watchdog/bcm6345_wdt.c
new file mode 100644
index 000..858b6d5
--- /dev/null
+++ b/drivers/watchdog/bcm6345_wdt.c
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2017 Álvaro Fernández Rojas 
+ *
+ * Derived from linux/drivers/watchdog/bcm63xx_wdt.c:
+ * Copyright (C) 2007 Miguel Gaio 
+ * Copyright (C) 2008 Florian Fainelli 
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+/* WDT Value register */
+#define WDT_VAL_REG0x0
+#define WDT_VAL_MIN0x0002
+#define WDT_VAL_MAX0xfffe
+
+/* WDT Control register */
+#define WDT_CTL_REG0x4
+#define WDT_CTL_START1_MASK0xff00
+#define WDT_CTL_START2_MASK0x00ff
+#define WDT_CTL_STOP1_MASK 0xee00
+#define WDT_CTL_STOP2_MASK 0x00ee
+
+struct bcm6345_wdt_priv {
+   void __iomem *regs;
+};
+
+static int bcm6345_wdt_reset(struct udevice *dev)
+{
+   struct bcm6345_wdt_priv *priv = dev_get_priv(dev);
+
+   writel_be(WDT_CTL_START1_MASK, priv->regs + WDT_CTL_REG);
+   writel_be(WDT_CTL_START2_MASK, priv->regs + WDT_CTL_REG);
+
+   return 0;
+}
+
+static int bcm6345_wdt_start(struct udevice *dev, u64 timeout, ulong flags)
+{
+   struct bcm6345_wdt_priv *priv = dev_get_priv(dev);
+
+   if (timeout < WDT_VAL_MIN) {
+   debug("watchdog won't fire with less than 2 ticks\n");
+   timeout = WDT_VAL_MIN;
+   } else if (timeout > WDT_VAL_MAX) {
+   debug("maximum watchdog timeout exceeded\n");
+   timeout = WDT_VAL_MAX;
+   }
+
+   writel_be(timeout, priv->regs + WDT_VAL_REG);
+
+   return bcm6345_wdt_reset(dev);
+}
+
+static int bcm6345_wdt_expire_now(struct udevice *dev, ulong flags)
+{
+   return bcm6345_wdt_start(dev, WDT_VAL_MIN, flags);
+}
+
+static int bcm6345_wdt_stop(struct udevice *dev)
+{
+   struct bcm6345_wdt_priv *priv = dev_get_priv(dev);
+
+   writel_be(WDT_CTL_STOP1_MASK, priv->regs + WDT_CTL_REG);
+   writel_be(WDT_CTL_STOP2_MASK, priv->regs + WDT_CTL_REG);
+
+   return 0;
+}
+
+static const struct wdt_ops bcm6345_wdt_ops = {
+   .expire_now = bcm6345_wdt_expire_now,
+   .reset = bcm6345_wdt_reset,
+   .start = bcm6345_wdt_start,
+   .stop = bcm6345_wdt_stop,
+};
+
+static const struct udevice_id bcm6345_wdt_ids[] = {
+   { .compatible = "brcm,bcm6345-wdt" },
+   { /* sentinel */ }
+};
+
+static int bcm6345_wdt_probe(struct udevice *dev)
+{
+   struct bcm6345_wdt_priv *priv = dev_get_priv(dev);
+   fdt_addr_t addr;
+   fdt_size_t size;
+
+   addr = dev_get_addr_size_index(dev, 0, );
+   if (addr == FDT_ADDR_T_NONE)
+   return -EINVAL;
+
+   priv->regs = ioremap(addr, size);
+
+   bcm6345_wdt_stop(dev);
+
+   return 0;
+}
+
+U_BOOT_DRIVER(wdt_bcm6345) = {
+   .name = "wdt_bcm6345",
+   .id = UCLASS_WDT,
+   .of_match = bcm6345_wdt_ids,
+   .ops = _wdt_ops,
+   .priv_auto_alloc_size = sizeof(struct bcm6345_wdt_priv),
+   .probe = bcm6345_wdt_probe,
+};
-- 
2.1.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 0/8] mips: bmips: add bcm6345 watchdog support

2017-05-12 Thread Álvaro Fernández Rojas
Adds support for Broadcom MIPS BCM6345 watchdog controller.
Also adds a generic watchdog sysreset driver to allow rebooting by expiring
the SoC watchdog.
This is needed for some specific Broadcom MIPS SoCs where pll_conf if bugged
and it can't be used to perform SoC reboots, like in BCM6348 (a1 rev).

Álvaro Fernández Rojas (8):
  dm: watchdog: add BCM6345 watchdog driver
  mips: bmips: add bcm6345-wdt driver support for BCM6358
  mips: bmips: add bcm6345-wdt driver support for BCM6328
  mips: bmips: add bcm6345-wdt driver support for BCM63268
  dm: sysreset: add watchdog-reboot driver
  mips: bmips: add wdt-reboot driver support for BCM6358
  mips: bmips: add wdt-reboot driver support for BCM6328
  mips: bmips: add wdt-reboot driver support for BCM63268

 arch/mips/dts/brcm,bcm63268.dtsi |  11 
 arch/mips/dts/brcm,bcm6328.dtsi  |  11 
 arch/mips/dts/brcm,bcm6358.dtsi  |  11 
 drivers/sysreset/Kconfig |   6 ++
 drivers/sysreset/Makefile|   1 +
 drivers/sysreset/sysreset_watchdog.c |  57 ++
 drivers/watchdog/Kconfig |   8 +++
 drivers/watchdog/Makefile|   1 +
 drivers/watchdog/bcm6345_wdt.c   | 109 +++
 9 files changed, 215 insertions(+)
 create mode 100644 drivers/sysreset/sysreset_watchdog.c
 create mode 100644 drivers/watchdog/bcm6345_wdt.c

-- 
2.1.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v5 00/33] ARM: i.MX6: SabreSD: Add dts support

2017-05-12 Thread Fabio Estevam
Hi Jagan,

On Thu, May 4, 2017 at 12:11 PM, Jagan Teki  wrote:
> From: Jagan Teki 
>
> Compared to previous series, this series
> - remove DCD addition on SPL for duallite, since it's not working

I fixed SPL support on mx6dl and sent the patches with you on Cc.

In case you send a v6 series, please generate on top them.

Thanks
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] Pull request: u-boot-mips/master

2017-05-12 Thread Daniel Schwierzeck
Hi Tom,

please pull some follow-up fixes for Broadcom MIPS and some minor updates for 
MIPS Boston board.

Travis CI: https://travis-ci.org/danielschwierzeck/u-boot/builds/231519583


The following changes since commit 1f5541c8818d3ecd243f9bbf58db9ea5f55a3195:

  Merge git://git.denx.de/u-boot-rockchip (2017-05-10 17:40:11 -0400)

are available in the git repository at:

  git://git.denx.de/u-boot-mips.git master

for you to fetch changes up to bc34986c86fc119813f406d95bb43e75e09b0df9:

  boston: Enable CONFIG_DISTRO_DEFAULTS in defconfigs (2017-05-12 13:29:50 
+0200)


Paul Burton (5):
  MIPS: Make CM GCR base configurable
  boston: Move CM GCRs away from flash
  boston: Setup memory ranges in FDT provided to Linux
  boston: Bump CONFIG_SYS_BOOTM_LEN to 64MiB
  boston: Enable CONFIG_DISTRO_DEFAULTS in defconfigs

Álvaro Fernández Rojas (5):
  mips: bmips: bcm6358: fix brcm, bcm6358-mc size
  mips: bmips: bcm6328: fix brcm, bcm6328-mc size
  mips: bmips: bcm63268: fix brcm, bcm6328-mc size
  dm: ram: remove unneeded brcm,bcm63268-mc id
  mips: bmips: add missing SFR NeufBox 4 config

 arch/mips/Kconfig| 21 -
 arch/mips/dts/brcm,bcm63268.dtsi |  2 +-
 arch/mips/dts/brcm,bcm6328.dtsi  |  2 +-
 arch/mips/dts/brcm,bcm6358.dtsi  |  2 +-
 arch/mips/lib/cache.c|  2 ++
 arch/mips/mach-bmips/Kconfig |  6 ++
 board/imgtec/boston/Makefile |  1 +
 board/imgtec/boston/dt.c | 27 +++
 configs/boston32r2_defconfig |  7 +--
 configs/boston32r2el_defconfig   |  7 +--
 configs/boston64r2_defconfig |  7 +--
 configs/boston64r2el_defconfig   |  7 +--
 drivers/ram/bmips_ram.c  |  6 +-
 include/configs/boston.h |  5 +
 14 files changed, 61 insertions(+), 41 deletions(-)
 create mode 100644 board/imgtec/boston/dt.c



signature.asc
Description: OpenPGP digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 5/6] boston: Bump CONFIG_SYS_BOOTM_LEN to 64MiB

2017-05-12 Thread Daniel Schwierzeck


Am 30.04.2017 um 21:22 schrieb Daniel Schwierzeck:
> From: Paul Burton 
> 
> The default value of CONFIG_SYS_BOOTM_LEN is too small for typical
> boston Linux kernels. Increase the limit to 64MB, which covers current
> kernels with plenty of breathing room.
> 
> Signed-off-by: Paul Burton 
> Signed-off-by: Daniel Schwierzeck 
> 
> ---
> 
> Changes in v2:
> - rebased to current mainline
> 
>  include/configs/boston.h | 5 +
>  1 file changed, 5 insertions(+)
> 

applied to u-boot-mips/master, thanks.




signature.asc
Description: OpenPGP digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 6/6] boston: Enable CONFIG_DISTRO_DEFAULTS in defconfigs

2017-05-12 Thread Daniel Schwierzeck


Am 30.04.2017 um 21:22 schrieb Daniel Schwierzeck:
> From: Paul Burton 
> 
> CONFIG_DISTRO_DEFAULTS selects a number of things we want for Boston
> defconfigs & generally describes what we want - to be able to boot an
> arbitrary Linux distribution. Enable it in order to shorten the
> defconfigs & to automatically keep up with any changes in the choice of
> Kconfig symbols selected.
> 
> Signed-off-by: Paul Burton 
> Signed-off-by: Daniel Schwierzeck 
> 
> ---
> 
> Changes in v2:
> - rebased to current mainline
> 
>  configs/boston32r2_defconfig   | 7 +--
>  configs/boston32r2el_defconfig | 7 +--
>  configs/boston64r2_defconfig   | 7 +--
>  configs/boston64r2el_defconfig | 7 +--
>  4 files changed, 4 insertions(+), 24 deletions(-)
> 

applied to u-boot-mips/master, thanks.



signature.asc
Description: OpenPGP digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 3/6] boston: Move CM GCRs away from flash

2017-05-12 Thread Daniel Schwierzeck


Am 30.04.2017 um 21:22 schrieb Daniel Schwierzeck:
> From: Paul Burton 
> 
> Move the MIPS Coherence Manager (CM) Global Configuration Registers
> (GCRs) away from the region of the physical address space which the
> Boston board's parallel flash is found in, such that we can access all
> of flash without clobbering GCRs.
> 
> Signed-off-by: Paul Burton 
> Signed-off-by: Daniel Schwierzeck 
> 
> ---
> 
> Changes in v2:
> - set default value for Boston in arch/mips/Kconfig
> 
>  arch/mips/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 

applied to u-boot-mips/master, thanks.



signature.asc
Description: OpenPGP digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v2 4/6] boston: Setup memory ranges in FDT provided to Linux

2017-05-12 Thread Daniel Schwierzeck


Am 30.04.2017 um 21:22 schrieb Daniel Schwierzeck:
> From: Paul Burton 
> 
> The boston memory map isn't suited to the simple "all memory starting
> from 0" approach that the MIPS arch_fixup_fdt() implementation takes.
> Instead we need to indicate the first 256MiB of DDR from 0 and the rest
> from 0x9000. Implement ft_board_setup to do that.
> 
> Signed-off-by: Paul Burton 
> Signed-off-by: Daniel Schwierzeck 
> ---
> 
> Changes in v2: None
> 
>  arch/mips/Kconfig|  1 +
>  board/imgtec/boston/Makefile |  1 +
>  board/imgtec/boston/dt.c | 27 +++
>  3 files changed, 29 insertions(+)
>  create mode 100644 board/imgtec/boston/dt.c
> 

applied to u-boot-mips/master, thanks.



signature.asc
Description: OpenPGP digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RESEND PATCH v3 1/5] MIPS: Make CM GCR base configurable

2017-05-12 Thread Daniel Schwierzeck


Am 12.05.2017 um 13:26 schrieb Daniel Schwierzeck:
> From: Paul Burton 
> 
> Without adding a prompt for CONFIG_MIPS_CM_BASE, Kconfig doesn't allow
> defconfigs to set it. Provide the prompt in order to allow for that.
> 
> Signed-off-by: Paul Burton 
> Signed-off-by: Daniel Schwierzeck 
> Reviewed-by: Simon Glass 
> 
> ---
> 
> Changes in v3:
> - fix build error if CONFIG_MIPS_CM is not selected
> 
> Changes in v2:
> - move to menu "General setup"
> 
>  arch/mips/Kconfig | 19 ++-
>  arch/mips/lib/cache.c |  2 ++
>  2 files changed, 12 insertions(+), 9 deletions(-)
> 

applied to u-boot-mips/master, thanks.



signature.asc
Description: OpenPGP digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 5/5] mips: bmips: add missing SFR NeufBox 4 config

2017-05-12 Thread Daniel Schwierzeck


Am 11.05.2017 um 11:01 schrieb Álvaro Fernández Rojas:
> Fixes commit a186d26, which missed including SFR NeufBox config from bmips
> 
> Signed-off-by: Álvaro Fernández Rojas 
> ---
>  arch/mips/mach-bmips/Kconfig | 6 ++
>  1 file changed, 6 insertions(+)
> 

applied to u-boot-mips/master, thanks.



signature.asc
Description: OpenPGP digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 4/5] dm: ram: remove unneeded brcm, bcm63268-mc id

2017-05-12 Thread Daniel Schwierzeck


Am 11.05.2017 um 11:01 schrieb Álvaro Fernández Rojas:
> brcm,bcm63268.dtsi uses brcm,bcm6328-mc instead of brcm,bcm63268-mc
> 
> Signed-off-by: Álvaro Fernández Rojas 
> ---
>  drivers/ram/bmips_ram.c | 6 +-
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 

applied to u-boot-mips/master, thanks.



signature.asc
Description: OpenPGP digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 3/5] mips: bmips: bcm63268: fix brcm, bcm6328-mc size

2017-05-12 Thread Daniel Schwierzeck


Am 11.05.2017 um 11:01 schrieb Álvaro Fernández Rojas:
> Shrink brcm,bcm6328-mc size to avoid overlapping with other controllers
> 
> Signed-off-by: Álvaro Fernández Rojas 
> ---
>  arch/mips/dts/brcm,bcm63268.dtsi | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

applied to u-boot-mips/master, thanks.



signature.asc
Description: OpenPGP digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 2/5] mips: bmips: bcm6328: fix brcm, bcm6328-mc size

2017-05-12 Thread Daniel Schwierzeck


Am 11.05.2017 um 11:01 schrieb Álvaro Fernández Rojas:
> Shrink brcm,bcm6328-mc size to avoid overlapping with other controllers
> 
> Signed-off-by: Álvaro Fernández Rojas 
> ---
>  arch/mips/dts/brcm,bcm6328.dtsi | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

applied to u-boot-mips/master, thanks.



signature.asc
Description: OpenPGP digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/5] mips: bmips: bcm6358: fix brcm, bcm6358-mc size

2017-05-12 Thread Daniel Schwierzeck


Am 11.05.2017 um 11:01 schrieb Álvaro Fernández Rojas:
> Shrink brcm,bcm6358-mc size to avoid overlapping with other controllers
> 
> Signed-off-by: Álvaro Fernández Rojas 
> ---
>  arch/mips/dts/brcm,bcm6358.dtsi | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

applied to u-boot-mips/master, thanks.



signature.asc
Description: OpenPGP digital signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 4/5] usb: host: replace printf() by error() in ehci-generic

2017-05-12 Thread Marek Vasut
On 05/12/2017 07:27 PM, patrice.chot...@st.com wrote:
> From: Patrice Chotard 

Commit message does not explain WHY this change is needed. In fact ...
commit message is missing altogether ...

> Signed-off-by: Patrice Chotard 
> ---
> 
> v2:   _ create this independant path for printf() replacement
> 
>  drivers/usb/host/ehci-generic.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-generic.c b/drivers/usb/host/ehci-generic.c
> index 808..39b56de 100644
> --- a/drivers/usb/host/ehci-generic.c
> +++ b/drivers/usb/host/ehci-generic.c
> @@ -74,7 +74,7 @@ static int ehci_usb_probe(struct udevice *dev)
>   if (ret < 0)
>   break;
>   if (clk_enable()) {
> - printf("failed to enable clock %d\n", i);
> + error("failed to enable clock %d\n", i);
>   clk_free();
>   goto clk_err;
>   }
> @@ -88,7 +88,7 @@ static int ehci_usb_probe(struct udevice *dev)
>   if (ret < 0)
>   break;
>   if (reset_deassert()) {
> - printf("failed to deassert reset %d\n", i);
> + error("failed to deassert reset %d\n", i);
>   reset_free();
>   goto reset_err;
>   }
> 


-- 
Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 3/5] usb: host: extend generic EHCI driver with PHY

2017-05-12 Thread Marek Vasut
On 05/12/2017 07:27 PM, patrice.chot...@st.com wrote:
> From: Patrice Chotard 
> 
> Add support of generic PHY framework
> 
> Signed-off-by: Patrice Chotard 
> ---
> 
> v2:   _ split previous path 1, add generic PHY framework
> 
>  drivers/usb/host/ehci-generic.c | 11 +++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/usb/host/ehci-generic.c b/drivers/usb/host/ehci-generic.c
> index 0c29f63..808 100644
> --- a/drivers/usb/host/ehci-generic.c
> +++ b/drivers/usb/host/ehci-generic.c
> @@ -6,6 +6,8 @@
>  
>  #include 
>  #include 
> +#include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -23,6 +25,7 @@ struct generic_ehci {
>   struct ehci_ctrl ctrl;
>   struct clk clks[EHCI_MAX_CLOCKS];
>   struct reset_ctl resets[EHCI_MAX_RESETS];
> + struct phy phy;
>  };
>  
>  static void ehci_assert_resets(struct udevice *dev) {
> @@ -92,6 +95,10 @@ static int ehci_usb_probe(struct udevice *dev)
>   reset_free();
>   }
>  
> + if (!generic_phy_get_by_index(dev, 0, >phy))
> + if (generic_phy_init(>phy))
> + error("failed to init usb phy %d\n", i);
> +
>   hccr = map_physmem(dev_get_addr(dev), 0x100, MAP_NOCACHE);
>   hcor = (struct ehci_hcor *)((uintptr_t)hccr +
>   HC_LENGTH(ehci_readl(>cr_capbase)));
> @@ -100,6 +107,8 @@ static int ehci_usb_probe(struct udevice *dev)
>   if (!ret)
>   return ret;
>  
> + generic_phy_exit(>phy);

So you probe the EHCI controller driver and then you disable it's PHY ?
That's a bit odd, isn't it ?

>  reset_err:
>   ehci_assert_resets(dev);
>  clk_err:
> @@ -109,7 +118,9 @@ clk_err:
>  }
>  
>  static int ehci_usb_remove(struct udevice *dev) {
> + struct generic_ehci *priv = dev_get_priv(dev);
>  
> + generic_phy_exit(>phy);
>   ehci_assert_resets(dev);
>   ehci_disable_clocks(dev);
>  
> 


-- 
Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 2/5] usb: host: add error path and remove callback in ehci-generic

2017-05-12 Thread Marek Vasut
On 05/12/2017 07:27 PM, patrice.chot...@st.com wrote:
> From: Patrice Chotard 
> 
> Add error path to disable enabled clocks and to assert
> deasserted resets
> Populate the remove callback
> 
> Signed-off-by: Patrice Chotard 
> ---
> v2:   _ split previous path 1, add error path and .remove callback
> 
>  drivers/usb/host/ehci-generic.c | 81 
> +++--
>  1 file changed, 70 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-generic.c b/drivers/usb/host/ehci-generic.c
> index 2190adb..0c29f63 100644
> --- a/drivers/usb/host/ehci-generic.c
> +++ b/drivers/usb/host/ehci-generic.c
> @@ -11,6 +11,9 @@
>  #include 
>  #include "ehci.h"
>  
> +#define EHCI_MAX_CLOCKS 3
> +#define EHCI_MAX_RESETS 3

And then someone invents controller with four resets and this whole
thing ... breaks.

>  /*
>   * Even though here we don't explicitly use "struct ehci_ctrl"
>   * ehci_register() expects it to be the first thing that resides in
> @@ -18,35 +21,74 @@
>   */
>  struct generic_ehci {
>   struct ehci_ctrl ctrl;
> + struct clk clks[EHCI_MAX_CLOCKS];
> + struct reset_ctl resets[EHCI_MAX_RESETS];
>  };
>  
> +static void ehci_assert_resets(struct udevice *dev) {
> + struct generic_ehci *priv = dev_get_priv(dev);
> + struct reset_ctl reset;
> + int i;
> +
> + for (i = EHCI_MAX_RESETS; i >= 0; --i) {

Why start from the end ?

> + reset = priv->resets[i];
> +
> + if (reset.dev) {
> +reset_request();
> +reset_assert();
> +reset_free();
> + }
> + }
> +}
> +
> +static void ehci_disable_clocks(struct udevice *dev) {
> + struct generic_ehci *priv = dev_get_priv(dev);
> + struct clk clk;
> + int i;
> +
> + for (i = EHCI_MAX_CLOCKS; i >= 0; --i) {
> + clk = priv->clks[i];
> +
> + if (clk.dev) {
> + clk_request(clk.dev, );
> + clk_disable();
> + clk_free();
> + }
> + }
> +}
> +
>  static int ehci_usb_probe(struct udevice *dev)
>  {
> + struct generic_ehci *priv = dev_get_priv(dev);
>   struct ehci_hccr *hccr;
>   struct ehci_hcor *hcor;
> - int i;
> + int i, ret;
>  
> - for (i = 0; ; i++) {
> - struct clk clk;
> - int ret;
> + for (i = 0; i < EHCI_MAX_CLOCKS; i++) {
> + struct clk clk = priv->clks[i];
>  
>   ret = clk_get_by_index(dev, i, );
>   if (ret < 0)
>   break;
> - if (clk_enable())
> + if (clk_enable()) {
>   printf("failed to enable clock %d\n", i);
> + clk_free();
> + goto clk_err;
> + }
>   clk_free();
>   }
>  
> - for (i = 0; ; i++) {
> - struct reset_ctl reset;
> - int ret;
> + for (i = 0; i < EHCI_MAX_RESETS ; i++) {
> + struct reset_ctl reset = priv->resets[i];
>  
>   ret = reset_get_by_index(dev, i, );
>   if (ret < 0)
>   break;
> - if (reset_deassert())
> + if (reset_deassert()) {
>   printf("failed to deassert reset %d\n", i);
> + reset_free();
> + goto reset_err;
> + }
>   reset_free();
>   }
>  
> @@ -54,7 +96,24 @@ static int ehci_usb_probe(struct udevice *dev)
>   hcor = (struct ehci_hcor *)((uintptr_t)hccr +
>   HC_LENGTH(ehci_readl(>cr_capbase)));
>  
> - return ehci_register(dev, hccr, hcor, NULL, 0, USB_INIT_HOST);
> + ret = ehci_register(dev, hccr, hcor, NULL, 0, USB_INIT_HOST);
> + if (!ret)
> + return ret;
> +
> +reset_err:
> + ehci_assert_resets(dev);
> +clk_err:
> + ehci_disable_clocks(dev);
> +
> + return ret;
> +}
> +
> +static int ehci_usb_remove(struct udevice *dev) {
> +
> + ehci_assert_resets(dev);
> + ehci_disable_clocks(dev);
> +
> + return ehci_deregister(dev);
>  }
>  
>  static const struct udevice_id ehci_usb_ids[] = {
> @@ -67,7 +126,7 @@ U_BOOT_DRIVER(ehci_generic) = {
>   .id = UCLASS_USB,
>   .of_match = ehci_usb_ids,
>   .probe = ehci_usb_probe,
> - .remove = ehci_deregister,
> + .remove = ehci_usb_remove,
>   .ops= _usb_ops,
>   .priv_auto_alloc_size = sizeof(struct generic_ehci),
>   .flags  = DM_FLAG_ALLOC_PRIV_DMA,
> 


-- 
Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] drivers: pci: imx: add imx_pcie_remove function

2017-05-12 Thread Soeren Moch
> There is no dedicated reset signal wired up for the MX6QDL thus if the
> bootloader enables the link we need some special handling to get the core
> back into a state where it is safe to touch it for configuration.
>
> While there has been some special handling in the Linux kernel to do this,
> it was removed in 4.11 thus we need to do it properly in the bootloader
> and therefore without this if you enable PCI in the bootloader you
will hang
> while booting the 4.11 kernel.
>
> This puts the PCIe controller back into a safe state for the kernel driver
> before launching the kernel.
>
> Signed-off-by: Tim Harvey 

Successfully tested on a tbs2910 board.

Tested-by: Soeren Moch 

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [U-Boot, 1/2] armv7m: cache: add flush & invalidate all dcache

2017-05-12 Thread Vikas MANOCHA
Hi,

> -Original Message-
> From: Tom Rini [mailto:tr...@konsulko.com]
> Sent: Friday, May 12, 2017 10:18 AM
> To: Vikas MANOCHA 
> Cc: u-boot@lists.denx.de
> Subject: Re: [U-Boot,1/2] armv7m: cache: add flush & invalidate all dcache
> 
> On Wed, May 03, 2017 at 03:48:25PM -0700, Vikas Manocha wrote:
> 
> > Add functionality to flush & invalidate all the dcache using the
> > prototype declared in common header file.
> >
> > Signed-off-by: Vikas Manocha 
> 
> After adding dummy functions for the cache not enabled side (to match other 
> CPU families, ie armv7, and not break stm32f429-
> discovery builds), applied to u-boot/master, thanks!

Thanks Tom.

Cheers,
Vikas

> 
> --
> Tom
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] sunxi: Add clock support for TV encoder

2017-05-12 Thread Maxime Ripard
On Fri, May 12, 2017 at 06:55:56PM +0200, Jernej Škrabec wrote:
> Hi Maxime,
> 
> Dne petek, 12. maj 2017 ob 17:47:17 CEST je Maxime Ripard napisal(a):
> > Hi Jernej,
> > 
> > On Wed, May 10, 2017 at 06:46:29PM +0200, Jernej Skrabec wrote:
> > > This patch adds support for TV encoder clocks which will be used later.
> > > 
> > > Signed-off-by: Jernej Skrabec 
> > > ---
> > > 
> > >  arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 8 +++-
> > >  1 file changed, 7 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/arch/arm/include/asm/arch-sunxi/clock_sun6i.h
> > > b/arch/arm/include/asm/arch-sunxi/clock_sun6i.h index
> > > a44ea77576..dc011cc964 100644
> > > --- a/arch/arm/include/asm/arch-sunxi/clock_sun6i.h
> > > +++ b/arch/arm/include/asm/arch-sunxi/clock_sun6i.h
> > > @@ -83,7 +83,8 @@ struct sunxi_ccm_reg {
> > > 
> > >   u32 lcd0_ch0_clk_cfg;   /* 0x118 LCD0 CH0 module clock */
> > >   u32 lcd1_ch0_clk_cfg;   /* 0x11c LCD1 CH0 module clock */
> > >  
> > >  #endif
> > > 
> > > - u32 reserved14[3];
> > > + u32 tve_clk_cfg;/* 0x120 TVE module clock */
> > > + u32 reserved14[2];
> > 
> > Maybe we should protect that with a comment, or an ifdef, that this is
> > only for the H3-generation SoCs?
> 
> I vote for extending the comment, like: 
> /* 0x120 H3/H5 TVE module clock */
> 
> Would that be ok?

That works, thanks!
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


signature.asc
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] drivers: pci: imx: add imx_pcie_remove function

2017-05-12 Thread Fabio Estevam
Hi Tim,

On Fri, May 12, 2017 at 4:58 PM, Tim Harvey  wrote:
> There is no dedicated reset signal wired up for the MX6QDL thus if the
> bootloader enables the link we need some special handling to get the core
> back into a state where it is safe to touch it for configuration.
>
> While there has been some special handling in the Linux kernel to do this,
> it was removed in 4.11 thus we need to do it properly in the bootloader
> and therefore without this if you enable PCI in the bootloader you will hang
> while booting the 4.11 kernel.
>
> This puts the PCIe controller back into a safe state for the kernel driver
> before launching the kernel.
>
> Signed-off-by: Tim Harvey 

This looks good:

Reviewed-by: Fabio Estevam 

Added Peter on Cc in case he could send his Tested-by tag.

> ---
>  arch/arm/imx-common/cpu.c |  3 +++
>  drivers/pci/pcie_imx.c| 38 ++
>  include/pci.h |  4 
>  3 files changed, 45 insertions(+)
>
> diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
> index 40fe813..74bdd24 100644
> --- a/arch/arm/imx-common/cpu.c
> +++ b/arch/arm/imx-common/cpu.c
> @@ -275,6 +275,9 @@ u32 get_ahb_clk(void)
>
>  void arch_preboot_os(void)
>  {
> +#if defined(CONFIG_PCIE_IMX)
> +   imx_pcie_remove();
> +#endif
>  #if defined(CONFIG_CMD_SATA)
> sata_stop();
>  #if defined(CONFIG_MX6)
> diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c
> index 732d59d..eab0a2b 100644
> --- a/drivers/pci/pcie_imx.c
> +++ b/drivers/pci/pcie_imx.c
> @@ -42,6 +42,9 @@
>
>  /* PCIe Port Logic registers (memory-mapped) */
>  #define PL_OFFSET 0x700
> +#define PCIE_PL_PFLR (PL_OFFSET + 0x08)
> +#define PCIE_PL_PFLR_LINK_STATE_MASK   (0x3f << 16)
> +#define PCIE_PL_PFLR_FORCE_LINK(1 << 15)
>  #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28)
>  #define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c)
>  #define PCIE_PHY_DEBUG_R1_LINK_UP  (1 << 4)
> @@ -445,6 +448,36 @@ static int imx6_pcie_assert_core_reset(void)
> /* Power up PCIe PHY */
> setbits_le32(_regs->cntr, PCIE_PHY_PUP_REQ);
>  #else
> +   /*
> +* If the bootloader already enabled the link we need some special
> +* handling to get the core back into a state where it is safe to
> +* touch it for configuration.  As there is no dedicated reset signal
> +* wired up for MX6QDL, we need to manually force LTSSM into "detect"
> +* state before completely disabling LTSSM, which is a prerequisite
> +* for core configuration.
> +*
> +* If both LTSSM_ENABLE and REF_SSP_ENABLE are active we have a strong
> +* indication that the bootloader activated the link.
> +*/
> +   if (is_mx6dq()) {
> +   u32 val, gpr1, gpr12;
> +
> +   gpr1 = readl(_regs->gpr[1]);
> +   gpr12 = readl(_regs->gpr[12]);
> +   if ((gpr1 & IOMUXC_GPR1_PCIE_REF_CLK_EN) &&
> +   (gpr12 & IOMUXC_GPR12_PCIE_CTL_2)) {
> +   val = readl(MX6_DBI_ADDR + PCIE_PL_PFLR);
> +   val &= ~PCIE_PL_PFLR_LINK_STATE_MASK;
> +   val |= PCIE_PL_PFLR_FORCE_LINK;
> +
> +   imx_pcie_fix_dabt_handler(true);
> +   writel(val, MX6_DBI_ADDR + PCIE_PL_PFLR);
> +   imx_pcie_fix_dabt_handler(false);
> +
> +   gpr12 &= ~IOMUXC_GPR12_PCIE_CTL_2;
> +   writel(val, _regs->gpr[12]);
> +   }
> +   }
> setbits_le32(_regs->gpr[1], IOMUXC_GPR1_TEST_POWERDOWN);
> clrbits_le32(_regs->gpr[1], IOMUXC_GPR1_REF_SSP_EN);
>  #endif
> @@ -652,6 +685,11 @@ void imx_pcie_init(void)
> }
>  }
>
> +void imx_pcie_remove(void)
> +{
> +   imx6_pcie_assert_core_reset();
> +}
> +
>  /* Probe function. */
>  void pci_init_board(void)
>  {
> diff --git a/include/pci.h b/include/pci.h
> index d3c955e..c8ef997 100644
> --- a/include/pci.h
> +++ b/include/pci.h
> @@ -754,6 +754,10 @@ int pci_last_busno(void);
>  extern void pci_mpc85xx_init (struct pci_controller *hose);
>  #endif
>
> +#ifdef CONFIG_PCIE_IMX
> +extern void imx_pcie_remove(void);
> +#endif
> +
>  #if !defined(CONFIG_DM_PCI) || defined(CONFIG_DM_PCI_COMPAT)
>  /**
>   * pci_write_bar32() - Write the address of a BAR including control bits
> --
> 2.7.4
>
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH 1/5] usb: dwc3: Add helper functions to enable snooping and burst settings

2017-05-12 Thread York Sun

On 05/03/2017 04:15 AM, yinbo.zhu wrote:

From: Rajat Srivastava 

Adds helper functions to enable snooping and outstanding burst beat
settings.

Signed-off-by: Rajat Srivastava 
Signed-off-by: Rajesh Bhagat 
---
 drivers/usb/dwc3/core.c | 45 +
 drivers/usb/dwc3/core.h |  7 +++
 2 files changed, 52 insertions(+)



Look like you repost this patch in another set without mentioning it. 
Since this set is older, I am going to mark them as "Superseded". Some 
tips for your future patches.


1. Copy maintainers
Use patman to generate patches, or call get_maintainer.pl to get the 
maintainers.


2. Add change logs
Please update change log every time you post a new version.

3. Do not assign to different maintainers in patchwork
Maybe you did, or someone did it for you. These two patches were 
assigned to different maintainers.


4. Keep your patches in meaningful set
It is not a good idea to mix architecture or board specific patches with 
general drivers. It is not easy to assign them to one maintainer. Try to 
separate them and add a note describing dependency if necessary.


Happy coding!

York
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] drivers: pci: imx: add imx_pcie_remove function

2017-05-12 Thread Tim Harvey
There is no dedicated reset signal wired up for the MX6QDL thus if the
bootloader enables the link we need some special handling to get the core
back into a state where it is safe to touch it for configuration.

While there has been some special handling in the Linux kernel to do this,
it was removed in 4.11 thus we need to do it properly in the bootloader
and therefore without this if you enable PCI in the bootloader you will hang
while booting the 4.11 kernel.

This puts the PCIe controller back into a safe state for the kernel driver
before launching the kernel.

Signed-off-by: Tim Harvey 
---
 arch/arm/imx-common/cpu.c |  3 +++
 drivers/pci/pcie_imx.c| 38 ++
 include/pci.h |  4 
 3 files changed, 45 insertions(+)

diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
index 40fe813..74bdd24 100644
--- a/arch/arm/imx-common/cpu.c
+++ b/arch/arm/imx-common/cpu.c
@@ -275,6 +275,9 @@ u32 get_ahb_clk(void)
 
 void arch_preboot_os(void)
 {
+#if defined(CONFIG_PCIE_IMX)
+   imx_pcie_remove();
+#endif
 #if defined(CONFIG_CMD_SATA)
sata_stop();
 #if defined(CONFIG_MX6)
diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c
index 732d59d..eab0a2b 100644
--- a/drivers/pci/pcie_imx.c
+++ b/drivers/pci/pcie_imx.c
@@ -42,6 +42,9 @@
 
 /* PCIe Port Logic registers (memory-mapped) */
 #define PL_OFFSET 0x700
+#define PCIE_PL_PFLR (PL_OFFSET + 0x08)
+#define PCIE_PL_PFLR_LINK_STATE_MASK   (0x3f << 16)
+#define PCIE_PL_PFLR_FORCE_LINK(1 << 15)
 #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28)
 #define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c)
 #define PCIE_PHY_DEBUG_R1_LINK_UP  (1 << 4)
@@ -445,6 +448,36 @@ static int imx6_pcie_assert_core_reset(void)
/* Power up PCIe PHY */
setbits_le32(_regs->cntr, PCIE_PHY_PUP_REQ);
 #else
+   /*
+* If the bootloader already enabled the link we need some special
+* handling to get the core back into a state where it is safe to
+* touch it for configuration.  As there is no dedicated reset signal
+* wired up for MX6QDL, we need to manually force LTSSM into "detect"
+* state before completely disabling LTSSM, which is a prerequisite
+* for core configuration.
+*
+* If both LTSSM_ENABLE and REF_SSP_ENABLE are active we have a strong
+* indication that the bootloader activated the link.
+*/
+   if (is_mx6dq()) {
+   u32 val, gpr1, gpr12;
+
+   gpr1 = readl(_regs->gpr[1]);
+   gpr12 = readl(_regs->gpr[12]);
+   if ((gpr1 & IOMUXC_GPR1_PCIE_REF_CLK_EN) &&
+   (gpr12 & IOMUXC_GPR12_PCIE_CTL_2)) {
+   val = readl(MX6_DBI_ADDR + PCIE_PL_PFLR);
+   val &= ~PCIE_PL_PFLR_LINK_STATE_MASK;
+   val |= PCIE_PL_PFLR_FORCE_LINK;
+
+   imx_pcie_fix_dabt_handler(true);
+   writel(val, MX6_DBI_ADDR + PCIE_PL_PFLR);
+   imx_pcie_fix_dabt_handler(false);
+
+   gpr12 &= ~IOMUXC_GPR12_PCIE_CTL_2;
+   writel(val, _regs->gpr[12]);
+   }
+   }
setbits_le32(_regs->gpr[1], IOMUXC_GPR1_TEST_POWERDOWN);
clrbits_le32(_regs->gpr[1], IOMUXC_GPR1_REF_SSP_EN);
 #endif
@@ -652,6 +685,11 @@ void imx_pcie_init(void)
}
 }
 
+void imx_pcie_remove(void)
+{
+   imx6_pcie_assert_core_reset();
+}
+
 /* Probe function. */
 void pci_init_board(void)
 {
diff --git a/include/pci.h b/include/pci.h
index d3c955e..c8ef997 100644
--- a/include/pci.h
+++ b/include/pci.h
@@ -754,6 +754,10 @@ int pci_last_busno(void);
 extern void pci_mpc85xx_init (struct pci_controller *hose);
 #endif
 
+#ifdef CONFIG_PCIE_IMX
+extern void imx_pcie_remove(void);
+#endif
+
 #if !defined(CONFIG_DM_PCI) || defined(CONFIG_DM_PCI_COMPAT)
 /**
  * pci_write_bar32() - Write the address of a BAR including control bits
-- 
2.7.4

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RFC] drivers: pci: imx: add imx_pcie_remove function

2017-05-12 Thread Tim Harvey
On Fri, May 12, 2017 at 12:27 PM, Soeren Moch  wrote:
>> Date: Thu, 11 May 2017 07:02:52 -0700
>> From: Tim Harvey 
>> To: Stefano Babic 
>> Cc: Marek Vasut , U-Boot-Denx ,
>> Peter Senna Tschudin , Lucas Stach
>> 
>> Subject: Re: [U-Boot] [RFC] drivers: pci: imx: add imx_pcie_remove
>> function
>> Message-ID:
>> 
>> Content-Type: text/plain; charset="UTF-8"
>>
>> On Thu, May 11, 2017 at 6:18 AM, Stefano Babic  wrote:
>> > Hi Fabio,
>> >
>> > On 11/05/2017 13:06, Fabio Estevam wrote:
>> >> On Thu, May 11, 2017 at 6:01 AM, Peter Senna Tschudin
>> >>  wrote:
>> >>
>> >>> Thank you for working on this! Your patch worked for me, but I
> needed to
>> >>> add an "extern void imx_pcie_remove(void);" before calling the
> function,
>> >>> which probably means I'm missing something.
>> >> The extern should be added into a header file.
>> >>
>> >>> After applying this patch to u-boot, u-boot can initialize PCI and
>> >>> 4.11.0-next-20170510 will boot. Without your patch
> 4.11.0-next-20170510
>> >>> do not boot if u-boot initialize the PCI bus.
>> >>>
>> >>> Thanks a lot!
>> >>>
>> >>> Here is the patch I'm using for our board:
>> >> Stefano,
>> >>
>> >> The patches that Tim/Peter posted solve a kernel hang with kernel 4.11
>> >> on mx6q when U-Boot has PCI support.
>> >>
>> >> Could you please take a look and let us know if there is a more
>> >> generic way to fix this issue, like fixing it for all mx6qdl boards
>> >> that have PCI support?
>> >>
>> >> I understand that ideally the imx6 pci driver should be converted to
>> >> driver model and then we add the .remove hook, like Lucas did for
>> >> Barebox:
>> >>
> https://git.pengutronix.de/cgit/barebox/commit/?id=f1da98da2760c21487bbba8f7fb957c843a22896
>> >>
>> >> While the imx pci driver is not converted to device model, would you
>> >> be willing to accept such per board patches for the time being?
>> >>
>> >> Please advise.
>> >
>> > Ok - let wait for Tim's answer, if he has enough time to work on this to
>> > move to DM. If not, it will be ok for now to fix it in this way, hoping
>> > to move soon to DM.
>> >
>> > Regards,
>> > Stefano
>> Stefano,
>>
>> I don't have enough time to work on the DM conversion currently but it
>> sounds like this would be a welcomed 'fix' that we should get in
>> sooner than later.
>>
>> I know the include is missing from a header but I didn't bother as I
>> though there would be a better arch-specific place to put the call to
>> the remove. I don't think putting it in ft_board_setup made sense. Do
>> you have any suggestions where it should go?
>>
>> Tim
>
> Tim,
>
> this patch in addition to your original drivers/pci/pcie_imx.c changes
> works for me on a tbs2910 board.
> Since I did not touch board-specific code, this should also work for
> all affected boards.
>

Soeren,

Perfect, that's what I was looking for 'arch_preboot_os' seems like a
good place for it!

I will put together a non-RFC patch.

Tim
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [RFC] drivers: pci: imx: add imx_pcie_remove function

2017-05-12 Thread Soeren Moch
> Date: Thu, 11 May 2017 07:02:52 -0700
> From: Tim Harvey 
> To: Stefano Babic 
> Cc: Marek Vasut , U-Boot-Denx ,
> Peter Senna Tschudin , Lucas Stach
> 
> Subject: Re: [U-Boot] [RFC] drivers: pci: imx: add imx_pcie_remove
> function
> Message-ID:
> 
> Content-Type: text/plain; charset="UTF-8"
>
> On Thu, May 11, 2017 at 6:18 AM, Stefano Babic  wrote:
> > Hi Fabio,
> >
> > On 11/05/2017 13:06, Fabio Estevam wrote:
> >> On Thu, May 11, 2017 at 6:01 AM, Peter Senna Tschudin
> >>  wrote:
> >>
> >>> Thank you for working on this! Your patch worked for me, but I
needed to
> >>> add an "extern void imx_pcie_remove(void);" before calling the
function,
> >>> which probably means I'm missing something.
> >> The extern should be added into a header file.
> >>
> >>> After applying this patch to u-boot, u-boot can initialize PCI and
> >>> 4.11.0-next-20170510 will boot. Without your patch
4.11.0-next-20170510
> >>> do not boot if u-boot initialize the PCI bus.
> >>>
> >>> Thanks a lot!
> >>>
> >>> Here is the patch I'm using for our board:
> >> Stefano,
> >>
> >> The patches that Tim/Peter posted solve a kernel hang with kernel 4.11
> >> on mx6q when U-Boot has PCI support.
> >>
> >> Could you please take a look and let us know if there is a more
> >> generic way to fix this issue, like fixing it for all mx6qdl boards
> >> that have PCI support?
> >>
> >> I understand that ideally the imx6 pci driver should be converted to
> >> driver model and then we add the .remove hook, like Lucas did for
> >> Barebox:
> >>
https://git.pengutronix.de/cgit/barebox/commit/?id=f1da98da2760c21487bbba8f7fb957c843a22896
> >>
> >> While the imx pci driver is not converted to device model, would you
> >> be willing to accept such per board patches for the time being?
> >>
> >> Please advise.
> >
> > Ok - let wait for Tim's answer, if he has enough time to work on this to
> > move to DM. If not, it will be ok for now to fix it in this way, hoping
> > to move soon to DM.
> >
> > Regards,
> > Stefano
> Stefano,
>
> I don't have enough time to work on the DM conversion currently but it
> sounds like this would be a welcomed 'fix' that we should get in
> sooner than later.
>
> I know the include is missing from a header but I didn't bother as I
> though there would be a better arch-specific place to put the call to
> the remove. I don't think putting it in ft_board_setup made sense. Do
> you have any suggestions where it should go?
>
> Tim

Tim,

this patch in addition to your original drivers/pci/pcie_imx.c changes
works for me on a tbs2910 board.
Since I did not touch board-specific code, this should also work for
all affected boards.

Regards,
Soeren


diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
index 40fe813..7ed9ca0 100644
--- a/arch/arm/imx-common/cpu.c
+++ b/arch/arm/imx-common/cpu.c
@@ -273,8 +273,13 @@ u32 get_ahb_clk(void)
 }
 #endif
 
+extern void imx_pcie_remove(void);
+
 void arch_preboot_os(void)
 {
+#if defined(CONFIG_PCIE_IMX)
+   imx_pcie_remove();
+#endif
 #if defined(CONFIG_CMD_SATA)
sata_stop();
 #if defined(CONFIG_MX6)


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH] ARMv8/sec_firmware : Update chosen/kaslr-seed

2017-05-12 Thread Ruchika Gupta
kASLR support in kernel requires a random number to be passed via
chosen/kaslr-seed propert. sec_firmware generates this random seed
which can then be passed in the device tree node

sec_firmware reserves JR3 for it's own usage. Node for JR3 is
removed from device-tree.

Signed-off-by: Ruchika Gupta 
---
 arch/arm/cpu/armv8/fsl-layerscape/fdt.c   | 73 +++
 arch/arm/cpu/armv8/sec_firmware.c | 53 ++
 arch/arm/include/asm/armv8/sec_firmware.h |  9 
 3 files changed, 135 insertions(+)

diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c 
b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
index 05c4577..d4ca129 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
@@ -345,6 +345,75 @@ static void fdt_fixup_msi(void *blob)
 }
 #endif
 
+
+int fdt_fixup_kaslr(void *fdt)
+{
+   int nodeoffset;
+   int err, ret = 0;
+   u8 rand[8];
+
+#if defined(CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT)
+   /* Check if random seed generation is  supported */
+   if (sec_firmware_support_hwrng() == false)
+   return 0;
+
+   ret = sec_firmware_get_random(rand, 8);
+   if (ret < 0) {
+   printf("WARNING: could not get random number to set",
+  "kaslr-seed\n");
+   return 0;
+   }
+
+   err = fdt_check_header(fdt);
+   if (err < 0) {
+   printf("fdt_chosen: %s\n", fdt_strerror(err));
+   return 0;
+   }
+
+   /* find or create "/chosen" node. */
+   nodeoffset = fdt_find_or_add_subnode(fdt, 0, "chosen");
+   if (nodeoffset < 0)
+   return 0;
+
+   err = fdt_setprop(fdt, nodeoffset, "kaslr-seed", rand,
+ sizeof(rand));
+   if (err < 0) {
+   printf("WARNING: could not set kaslr-seed %s.\n",
+  fdt_strerror(err));
+   return 0;
+   }
+   ret = 1;
+#endif
+
+   return ret;
+}
+
+/* Remove JR node used by SEC firmware */
+void fdt_fixup_remove_jr(void *blob)
+{
+   int jr_node, addr_cells, len;
+   int crypto_node = fdt_path_offset(blob, "crypto");
+   u64 jr_offset, used_jr;
+   fdt32_t *reg;
+
+   used_jr = sec_firmware_used_jobring_offset();
+   of_bus_default_count_cells(blob, crypto_node, _cells, NULL);
+
+   jr_node = fdt_node_offset_by_compatible(blob, crypto_node,
+   "fsl,sec-v4.0-job-ring");
+
+   while (jr_node != -FDT_ERR_NOTFOUND) {
+   reg = (fdt32_t *)fdt_getprop(blob, jr_node, "reg", );
+   jr_offset = of_read_number(reg, addr_cells);
+   if (jr_offset == used_jr) {
+   fdt_del_node(blob, jr_node);
+   break;
+   }
+   jr_node = fdt_node_offset_by_compatible(blob, jr_node,
+   
"fsl,sec-v4.0-job-ring");
+   }
+}
+
 void ft_cpu_setup(void *blob, bd_t *bd)
 {
 #ifdef CONFIG_FSL_LSCH2
@@ -358,6 +427,9 @@ void ft_cpu_setup(void *blob, bd_t *bd)
else {
ccsr_sec_t __iomem *sec;
 
+   if (fdt_fixup_kaslr(blob))
+   fdt_fixup_remove_jr(blob);
+
sec = (void __iomem *)CONFIG_SYS_FSL_SEC_ADDR;
fdt_fixup_crypto_node(blob, sec_in32(>secvid_ms));
}
@@ -396,4 +468,5 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 #ifdef CONFIG_HAS_FEATURE_ENHANCED_MSI
fdt_fixup_msi(blob);
 #endif
+
 }
diff --git a/arch/arm/cpu/armv8/sec_firmware.c 
b/arch/arm/cpu/armv8/sec_firmware.c
index 4afa3ad..f460cca 100644
--- a/arch/arm/cpu/armv8/sec_firmware.c
+++ b/arch/arm/cpu/armv8/sec_firmware.c
@@ -232,6 +232,59 @@ unsigned int sec_firmware_support_psci_version(void)
 #endif
 
 /*
+ * Check with sec_firmware if it supports random number generation
+ * via HW RNG
+ *
+ * The return value will be true if it is supported
+ */
+bool sec_firmware_support_hwrng(void)
+{
+   uint8_t rand[8];
+   if (sec_firmware_addr & SEC_FIRMWARE_RUNNING) {
+   if (!sec_firmware_get_random(rand, 8))
+   return true;
+   }
+
+   return false;
+}
+
+/*
+ * sec_firmware_get_random - Initialize the SEC Firmware
+ * @rand:  random number buffer to be filled
+ * @bytes: Number of bytes of random number to be supported
+ * @eret:  -1 in case of error, 0 for success
+ */
+int sec_firmware_get_random(uint8_t *rand, int bytes)
+{
+   unsigned long long num;
+   struct pt_regs regs;
+   int param1;
+
+   if (!bytes || bytes > 8) {
+   printf("Max Random bytes genration supported is 8\n");
+   return -1;
+   }
+#define SIP_RNG_64 0xC200FF11
+   regs.regs[0] = SIP_RNG_64;
+
+   if (bytes <= 4)
+   param1 = 0;
+   else
+   param1 = 1;
+   

[U-Boot] [PATCH 22/22] mmc: Retry some MMC cmds on failure

2017-05-12 Thread Jean-Jacques Hiblot
From: Vignesh R 

With certain SD cards like Kingston 8GB/16GB UHS card, it is seen that
MMC_CMD_ALL_SEND_CID cmd fails on first attempt, but succeeds
subsequently. Therefore, retry MMC_CMD_ALL_SEND_CID cmd at least thrice
as done in Linux kernel.
Similarly, it is seen that MMC_CMD_SET_BLOCKLEN may fail on first
attempt, therefore retry this cmd five times as done in kernel.

Signed-off-by: Vignesh R 
Signed-off-by: Kishon Vijay Abraham I 
Signed-off-by: Jean-Jacques Hiblot 
---
 drivers/mmc/mmc.c | 15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index c7dda64..49edf52 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -275,6 +275,8 @@ int mmc_send_status(struct mmc *mmc, int timeout)
 int mmc_set_blocklen(struct mmc *mmc, int len)
 {
struct mmc_cmd cmd;
+   int retries = 5;
+   int err;
 
if (mmc->ddr_mode)
return 0;
@@ -282,8 +284,13 @@ int mmc_set_blocklen(struct mmc *mmc, int len)
cmd.cmdidx = MMC_CMD_SET_BLOCKLEN;
cmd.resp_type = MMC_RSP_R1;
cmd.cmdarg = len;
+   do {
+   err = mmc_send_cmd(mmc, , NULL);
+   if (!err)
+   break;
+   } while (retries--);
 
-   return mmc_send_cmd(mmc, , NULL);
+   return err;
 }
 
 static int mmc_read_blocks(struct mmc *mmc, void *dst, lbaint_t start,
@@ -1867,6 +1874,7 @@ static int mmc_startup(struct mmc *mmc)
u64 cmult, csize;
struct mmc_cmd cmd;
struct blk_desc *bdesc;
+   int retries = 3;
 
 #ifdef CONFIG_MMC_SPI_CRC_ON
if (mmc_host_is_spi(mmc)) { /* enable CRC check for spi */
@@ -1874,7 +1882,6 @@ static int mmc_startup(struct mmc *mmc)
cmd.resp_type = MMC_RSP_R1;
cmd.cmdarg = 1;
err = mmc_send_cmd(mmc, , NULL);
-
if (err)
return err;
}
@@ -1886,7 +1893,9 @@ static int mmc_startup(struct mmc *mmc)
cmd.resp_type = MMC_RSP_R2;
cmd.cmdarg = 0;
 
-   err = mmc_send_cmd(mmc, , NULL);
+   do {
+   err = mmc_send_cmd(mmc, , NULL);
+   } while (err && retries-- > 0);
 
if (err)
return err;
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 14/22] mmc: add power cyle support in mmc core

2017-05-12 Thread Jean-Jacques Hiblot
mmc/sd specification requires vdd to be disabled for 1 ms
and then enabled again during power cycle. Add a
function in mmc core to perform power cycle and set
the io signal to it's initial state.

Signed-off-by: Kishon Vijay Abraham I 
Signed-off-by: Jean-Jacques Hiblot 
---
 drivers/mmc/mmc.c | 50 +-
 1 file changed, 41 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index d40a22b..032260b 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -30,6 +30,7 @@ static const unsigned int sd_au_size[] = {
SZ_16M / 512,   (SZ_16M + SZ_8M) / 512, SZ_32M / 512,   SZ_64M / 512,
 };
 static int mmc_set_signal_voltage(struct mmc *mmc, uint signal_voltage);
+static void mmc_power_cycle(struct mmc *mmc);
 
 #if CONFIG_IS_ENABLED(MMC_TINY)
 static struct mmc mmc_static;
@@ -1915,6 +1916,45 @@ static int mmc_power_init(struct mmc *mmc)
return 0;
 }
 
+static void mmc_set_initial_state(struct mmc *mmc)
+{
+   int err;
+
+   /* First try to set 3.3V. If it fails set to 1.8V */
+   err = mmc_set_signal_voltage(mmc, MMC_SIGNAL_VOLTAGE_330);
+   if (err != 0)
+   err = mmc_set_signal_voltage(mmc, MMC_SIGNAL_VOLTAGE_180);
+   if (err != 0)
+   printf("failed to set signal voltage\n");
+
+   mmc_set_bus_width(mmc, 1);
+   mmc_set_clock(mmc, 1);
+   mmc_select_mode(mmc, MMC_LEGACY);
+}
+
+static void mmc_power_up(struct mmc *mmc)
+{
+   mmc_set_initial_state(mmc);
+   mmc_set_vdd(mmc, true);
+   udelay(1);
+}
+
+static void mmc_power_off(struct mmc *mmc)
+{
+   mmc_set_vdd(mmc, false);
+}
+
+static void mmc_power_cycle(struct mmc *mmc)
+{
+   mmc_power_off(mmc);
+   /*
+* SD spec recommends at least 1ms of delay. Let's wait for 2ms
+* to be on the safer side.
+*/
+   udelay(2000);
+   mmc_power_up(mmc);
+}
+
 int mmc_start_init(struct mmc *mmc)
 {
bool no_card;
@@ -1952,16 +1992,8 @@ int mmc_start_init(struct mmc *mmc)
return err;
 #endif
mmc->ddr_mode = 0;
-   mmc_set_vdd(mmc, true);
-   /* First try to set 3.3V. If it fails set to 1.8V */
-   err = mmc_set_signal_voltage(mmc, MMC_SIGNAL_VOLTAGE_330);
-   if (err != 0)
-   err = mmc_set_signal_voltage(mmc, MMC_SIGNAL_VOLTAGE_180);
-   if (err != 0)
-   printf("failed to set signal voltage\n");
 
-   mmc_set_bus_width(mmc, 1);
-   mmc_set_clock(mmc, 1);
+   mmc_power_cycle(mmc);
 
/* Reset the Card */
err = mmc_go_idle(mmc);
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 08/22] cmd: mmc: display the mode name and current bus speed in the mmc info

2017-05-12 Thread Jean-Jacques Hiblot
Display the mode name when the user execute 'mmc info'. Also instead of
displaying tran_speed, display the actual bus speed.

Signed-off-by: Jean-Jacques Hiblot 
---
 cmd/mmc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cmd/mmc.c b/cmd/mmc.c
index f83032e..59c8023 100644
--- a/cmd/mmc.c
+++ b/cmd/mmc.c
@@ -23,7 +23,8 @@ static void print_mmcinfo(struct mmc *mmc)
(mmc->cid[1] >> 24), (mmc->cid[1] >> 16) & 0xff,
(mmc->cid[1] >> 8) & 0xff, mmc->cid[1] & 0xff);
 
-   printf("Tran Speed: %d\n", mmc->tran_speed);
+   printf("Bus Speed: %d\n", mmc->clock);
+   printf("Mode : %s\n", mmc_mode_name(mmc->selected_mode));
printf("Rd Block Len: %d\n", mmc->read_bl_len);
 
printf("%s version %d.%d", IS_SD(mmc) ? "SD" : "MMC",
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 15/22] mmc: add a new mmc parameter to disable mmc clock

2017-05-12 Thread Jean-Jacques Hiblot
mmc clock has to be disabled in certain cases like during
the voltage switch sequence. Modify mmc_set_clock function
to take disable as an argument that signifies if the
clock has to be enabled or disabled.

Signed-off-by: Kishon Vijay Abraham I 
Signed-off-by: Jean-Jacques Hiblot 
---
 drivers/mmc/fsl_esdhc.c |  2 +-
 drivers/mmc/mmc.c   | 11 ++-
 include/mmc.h   |  3 ++-
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index f3c6358..b631392 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -658,7 +658,7 @@ static int esdhc_init(struct mmc *mmc)
 #endif
 
/* Set the initial clock speed */
-   mmc_set_clock(mmc, 40);
+   mmc_set_clock(mmc, 40, false);
 
/* Disable the BRR and BWR bits in IRQSTAT */
esdhc_clrbits32(>irqstaten, IRQSTATEN_BRR | IRQSTATEN_BWR);
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 032260b..70b7d19 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1216,7 +1216,7 @@ static int mmc_set_ios(struct mmc *mmc)
 }
 #endif
 
-int mmc_set_clock(struct mmc *mmc, uint clock)
+int mmc_set_clock(struct mmc *mmc, uint clock, u8 disable)
 {
if (clock > mmc->cfg->f_max)
clock = mmc->cfg->f_max;
@@ -1225,6 +1225,7 @@ int mmc_set_clock(struct mmc *mmc, uint clock)
clock = mmc->cfg->f_min;
 
mmc->clock = clock;
+   mmc->clk_disable = disable;
 
return mmc_set_ios(mmc);
 }
@@ -1316,7 +1317,7 @@ static int sd_select_mode_and_width(struct mmc *mmc)
 
/* configure the bus mode (host) */
mmc_select_mode(mmc, mwt->mode);
-   mmc_set_clock(mmc, mmc->tran_speed);
+   mmc_set_clock(mmc, mmc->tran_speed, false);
 
err = sd_read_ssr(mmc);
if (!err)
@@ -1327,7 +1328,7 @@ static int sd_select_mode_and_width(struct mmc *mmc)
 error:
/* revert to a safer bus speed */
mmc_select_mode(mmc, SD_LEGACY);
-   mmc_set_clock(mmc, mmc->tran_speed);
+   mmc_set_clock(mmc, mmc->tran_speed, false);
}
}
}
@@ -1465,7 +1466,7 @@ static int mmc_select_mode_and_width(struct mmc *mmc)
 
/* configure the bus mode (host) */
mmc_select_mode(mmc, mwt->mode);
-   mmc_set_clock(mmc, mmc->tran_speed);
+   mmc_set_clock(mmc, mmc->tran_speed, false);
 
/* do a transfer to check the configuration */
err = mmc_read_and_compare_ext_csd(mmc);
@@ -1928,7 +1929,7 @@ static void mmc_set_initial_state(struct mmc *mmc)
printf("failed to set signal voltage\n");
 
mmc_set_bus_width(mmc, 1);
-   mmc_set_clock(mmc, 1);
+   mmc_set_clock(mmc, 1, false);
mmc_select_mode(mmc, MMC_LEGACY);
 }
 
diff --git a/include/mmc.h b/include/mmc.h
index 43d37a4..097a685 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -466,6 +466,7 @@ struct mmc {
void *priv;
uint has_init;
int high_capacity;
+   u8 clk_disable;
uint bus_width;
uint clock;
uint signal_voltage;
@@ -557,7 +558,7 @@ int mmc_unbind(struct udevice *dev);
 int mmc_initialize(bd_t *bis);
 int mmc_init(struct mmc *mmc);
 int mmc_read(struct mmc *mmc, u64 src, uchar *dst, int size);
-int mmc_set_clock(struct mmc *mmc, uint clock);
+int mmc_set_clock(struct mmc *mmc, uint clock, u8 disable);
 struct mmc *find_mmc_device(int dev_num);
 int mmc_set_dev(int dev_num);
 void print_mmc_devices(char separator);
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 20/22] mmc: Add support for UHS modes

2017-05-12 Thread Jean-Jacques Hiblot
Add UHS modes to the list of supported modes, get the UHS capabilites of
the SDcard and implement the procedure to switch the voltage (UHS modes
use 1v8 IO lines)
During the voltage switch procedure, DAT0 is used by the card to signal
when it's ready. The optional card_busy() callback can be used to get this
information from the host driver.

Signed-off-by: Jean-Jacques Hiblot 
---
 drivers/mmc/mmc.c | 169 +++---
 include/mmc.h |  27 -
 2 files changed, 188 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index f6509f1..074d286 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -31,6 +31,7 @@ static const unsigned int sd_au_size[] = {
 };
 static int mmc_set_signal_voltage(struct mmc *mmc, uint signal_voltage);
 static void mmc_power_cycle(struct mmc *mmc);
+static int mmc_card_busy(struct mmc *mmc);
 
 #if CONFIG_IS_ENABLED(MMC_TINY)
 static struct mmc mmc_static;
@@ -403,7 +404,68 @@ static int mmc_go_idle(struct mmc *mmc)
return 0;
 }
 
-static int sd_send_op_cond(struct mmc *mmc)
+static int mmc_switch_voltage(struct mmc *mmc, int signal_voltage)
+{
+   struct mmc_cmd cmd;
+   int err = 0;
+
+   /*
+* Send CMD11 only if the request is to switch the card to
+* 1.8V signalling.
+*/
+   if (signal_voltage == MMC_SIGNAL_VOLTAGE_330)
+   return mmc_set_signal_voltage(mmc, signal_voltage);
+
+   cmd.cmdidx = SD_CMD_SWITCH_UHS18V;
+   cmd.cmdarg = 0;
+   cmd.resp_type = MMC_RSP_R1;
+
+   err = mmc_send_cmd(mmc, , NULL);
+   if (err)
+   goto fail;
+
+   if (!mmc_host_is_spi(host) && (cmd.response[0] & MMC_STATUS_ERROR))
+   goto fail;
+
+   /*
+* The card should drive cmd and dat[0:3] low immediately
+* after the response of cmd11, but wait 1 ms to be sure
+*/
+   udelay(1000);
+   if (mmc_card_busy(mmc))
+   goto fail;
+
+   /*
+* During a signal voltage level switch, the clock must be gated
+* for 5 ms according to the SD spec
+*/
+   mmc_set_clock(mmc, mmc->clock, true);
+
+   err = mmc_set_signal_voltage(mmc, signal_voltage);
+   if (err)
+   goto fail;
+
+   /* Keep clock gated for at least 10 ms, though spec only says 5 ms */
+   udelay(1);
+   mmc_set_clock(mmc, mmc->clock, false);
+
+   /* Wait for at least 1 ms according to spec */
+   udelay(1000);
+
+   /*
+* Failure to switch is indicated by the card holding
+* dat[0:3] low
+*/
+   if (mmc_card_busy(mmc))
+   goto fail;
+
+   return 0;
+
+fail:
+   return -EIO;
+}
+
+static int sd_send_op_cond(struct mmc *mmc, bool uhs_en)
 {
int timeout = 1000;
int err;
@@ -435,6 +497,9 @@ static int sd_send_op_cond(struct mmc *mmc)
if (mmc->version == SD_VERSION_2)
cmd.cmdarg |= OCR_HCS;
 
+   if (uhs_en)
+   cmd.cmdarg |= OCR_S18R;
+
err = mmc_send_cmd(mmc, , NULL);
 
if (err)
@@ -465,6 +530,13 @@ static int sd_send_op_cond(struct mmc *mmc)
 
mmc->ocr = cmd.response[0];
 
+   if (!(mmc_host_is_spi(mmc)) && (cmd.response[0] & 0x4100)
+   == 0x4100) {
+   err = mmc_switch_voltage(mmc, MMC_SIGNAL_VOLTAGE_180);
+   if (err)
+   return err;
+   }
+
mmc->high_capacity = ((mmc->ocr & OCR_HCS) == OCR_HCS);
mmc->rca = 0;
 
@@ -977,6 +1049,7 @@ static int sd_get_capabilities(struct mmc *mmc)
ALLOC_CACHE_ALIGN_BUFFER(uint, switch_status, 16);
struct mmc_data data;
int timeout;
+   u32 sd3_bus_mode;
 
mmc->card_caps = MMC_MODE_1BIT;
 
@@ -1058,6 +1131,22 @@ retry_scr:
if (__be32_to_cpu(switch_status[3]) & SD_HIGHSPEED_SUPPORTED)
mmc->card_caps |= MMC_CAP(SD_HS);
 
+   /* Version before 3.0 don't support UHS modes */
+   if (mmc->version < SD_VERSION_3)
+   return 0;
+
+   sd3_bus_mode = __be32_to_cpu(switch_status[3]) >> 16 & 0x1f;
+   if (sd3_bus_mode & SD_MODE_UHS_SDR104)
+   mmc->card_caps |= MMC_CAP(UHS_SDR104);
+   if (sd3_bus_mode & SD_MODE_UHS_SDR50)
+   mmc->card_caps |= MMC_CAP(UHS_SDR50);
+   if (sd3_bus_mode & SD_MODE_UHS_SDR25)
+   mmc->card_caps |= MMC_CAP(UHS_SDR25);
+   if (sd3_bus_mode & SD_MODE_UHS_SDR12)
+   mmc->card_caps |= MMC_CAP(UHS_SDR12);
+   if (sd3_bus_mode & SD_MODE_UHS_DDR50)
+   mmc->card_caps |= MMC_CAP(UHS_DDR50);
+
return 0;
 }
 
@@ -1065,13 +1154,36 @@ static int sd_set_card_speed(struct mmc *mmc, enum 
bus_mode mode)
 {
int err;
ALLOC_CACHE_ALIGN_BUFFER(uint, switch_status, 16);
+   int speed;
+
+   switch (mode) {
+   case SD_LEGACY:
+ 

[U-Boot] [PATCH 18/22] mmc: add HS200 support in MMC core

2017-05-12 Thread Jean-Jacques Hiblot
Add HS200 to the list of supported modes and introduce tuning in the MMC
startup process.

Signed-off-by: Kishon Vijay Abraham I 
Signed-off-by: Jean-Jacques Hiblot 
---
 drivers/mmc/mmc.c | 22 --
 include/mmc.h | 17 +
 2 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index d7d1c91..2b710fe 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -621,6 +621,10 @@ static int mmc_set_card_speed(struct mmc *mmc, enum 
bus_mode mode)
case MMC_HS_52:
case MMC_DDR_52:
  speed_bits = EXT_CSD_TIMING_HS;
+ break;
+   case MMC_HS_200:
+ speed_bits = EXT_CSD_TIMING_HS200;
+ break;
case MMC_LEGACY:
  speed_bits = EXT_CSD_TIMING_LEGACY;
  break;
@@ -667,9 +671,12 @@ static int mmc_get_capabilities(struct mmc *mmc)
 
mmc->card_caps |= MMC_MODE_4BIT | MMC_MODE_8BIT;
 
-   cardtype = ext_csd[EXT_CSD_CARD_TYPE] & 0xf;
+   cardtype = ext_csd[EXT_CSD_CARD_TYPE] & 0x3f;
 
-   /* High Speed is set, there are two types: 52MHz and 26MHz */
+   if (cardtype & (EXT_CSD_CARD_TYPE_HS200_1_2V |
+   EXT_CSD_CARD_TYPE_HS200_1_8V)) {
+   mmc->card_caps |= MMC_MODE_HS200;
+   }
if (cardtype & EXT_CSD_CARD_TYPE_52) {
if (cardtype & EXT_CSD_CARD_TYPE_DDR_52)
mmc->card_caps |= MMC_MODE_DDR_52MHz;
@@ -1263,6 +1270,7 @@ void mmc_dump_capabilities(const char *text, uint caps)
 struct mode_width_tuning {
enum bus_mode mode;
uint widths;
+   uint tuning;
 };
 
 static int mmc_set_signal_voltage(struct mmc *mmc, uint signal_voltage)
@@ -1373,6 +1381,7 @@ static const struct mode_width_tuning mmc_modes_by_pref[] 
= {
{
.mode = MMC_HS_200,
.widths = MMC_MODE_8BIT | MMC_MODE_4BIT,
+   .tuning = MMC_SEND_TUNING_BLOCK_HS200
},
{
.mode = MMC_DDR_52,
@@ -1473,6 +1482,15 @@ static int mmc_select_mode_and_width(struct mmc *mmc)
mmc_select_mode(mmc, mwt->mode);
mmc_set_clock(mmc, mmc->tran_speed, false);
 
+   /* execute tuning if needed */
+   if (mwt->tuning) {
+   err = mmc_execute_tuning(mmc, mwt->tuning);
+   if (err) {
+   debug("tuning failed\n");
+   goto error;
+   }
+   }
+
/* do a transfer to check the configuration */
err = mmc_read_and_compare_ext_csd(mmc);
if (!err)
diff --git a/include/mmc.h b/include/mmc.h
index dab68c5..b4ffa6a 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -56,6 +56,7 @@
 #define MMC_MODE_HS(MMC_CAP(MMC_HS) | MMC_CAP(SD_HS))
 #define MMC_MODE_HS_52MHz  MMC_CAP(MMC_HS_52)
 #define MMC_MODE_DDR_52MHz MMC_CAP(MMC_DDR_52)
+#define MMC_MODE_HS200 MMC_CAP(MMC_HS_200)
 
 #define MMC_MODE_8BIT  (1 << 30)
 #define MMC_MODE_4BIT  (1 << 29)
@@ -86,6 +87,7 @@
 #define MMC_CMD_SET_BLOCKLEN   16
 #define MMC_CMD_READ_SINGLE_BLOCK  17
 #define MMC_CMD_READ_MULTIPLE_BLOCK18
+#define MMC_SEND_TUNING_BLOCK_HS20021
 #define MMC_CMD_SET_BLOCK_COUNT 23
 #define MMC_CMD_WRITE_SINGLE_BLOCK 24
 #define MMC_CMD_WRITE_MULTIPLE_BLOCK   25
@@ -113,6 +115,13 @@
 #define SD_CMD_APP_SEND_OP_COND41
 #define SD_CMD_APP_SEND_SCR51
 
+static inline bool mmc_is_tuning_cmd(uint cmdidx)
+{
+   if (cmdidx == MMC_SEND_TUNING_BLOCK_HS200)
+   return true;
+   return false;
+}
+
 /* SCR definitions in different words */
 #define SD_HIGHSPEED_BUSY  0x0002
 #define SD_HIGHSPEED_SUPPORTED 0x0002
@@ -210,6 +219,12 @@
 #define EXT_CSD_CARD_TYPE_DDR_52   (EXT_CSD_CARD_TYPE_DDR_1_8V \
| EXT_CSD_CARD_TYPE_DDR_1_2V)
 
+#define EXT_CSD_CARD_TYPE_HS200_1_8V   (1<<4)  /* Card can run at 200MHz */
+#define EXT_CSD_CARD_TYPE_HS200_1_2V   (1<<5)  /* Card can run at 200MHz */
+   /* SDR mode @1.2V I/O */
+#define EXT_CSD_CARD_TYPE_HS200(EXT_CSD_CARD_TYPE_HS200_1_8V | 
\
+EXT_CSD_CARD_TYPE_HS200_1_2V)
+
 #define EXT_CSD_BUS_WIDTH_10   /* Card is in 1 bit mode */
 #define EXT_CSD_BUS_WIDTH_41   /* Card is in 4 bit mode */
 #define EXT_CSD_BUS_WIDTH_82   /* Card is in 8 bit mode */
@@ -217,6 +232,8 @@
 
 #define EXT_CSD_TIMING_LEGACY  0   /* no high speed */
 #define EXT_CSD_TIMING_HS  1   /* HS */
+#define EXT_CSD_TIMING_HS200   2   /* HS200 */
+
 #define EXT_CSD_BOOT_ACK_ENABLE  

[U-Boot] [PATCH 06/22] mmc: Add a fonction to dump the mmc capabilities

2017-05-12 Thread Jean-Jacques Hiblot
This adds a simple helper function to display information (bus width and
mode) based on a capability mask. Useful for debug.

Signed-off-by: Jean-Jacques Hiblot 
---
 drivers/mmc/mmc.c | 17 +
 include/mmc.h |  1 +
 2 files changed, 18 insertions(+)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 2e1cb0d..5d418c5 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1133,6 +1133,23 @@ static void mmc_set_bus_width(struct mmc *mmc, uint 
width)
mmc_set_ios(mmc);
 }
 
+void mmc_dump_capabilities(const char *text, uint caps)
+{
+   enum bus_mode mode;
+
+   printf("%s: widths [", text);
+   if (caps & MMC_MODE_8BIT)
+   printf("8, ");
+   if (caps & MMC_MODE_4BIT)
+   printf("4, ");
+   printf("1] modes [");
+
+   for (mode = MMC_LEGACY; mode < MMC_MODES_END; mode++)
+   if (MMC_CAP(mode) & caps)
+   printf("%s, ", mmc_mode_name(mode));
+   printf("\b\b]\n");
+}
+
 static int sd_select_bus_freq_width(struct mmc *mmc)
 {
int err;
diff --git a/include/mmc.h b/include/mmc.h
index 60a43b0..afda02d 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -422,6 +422,7 @@ enum bus_mode {
 };
 
 const char *mmc_mode_name(enum bus_mode mode);
+void mmc_dump_capabilities(const char *text, uint caps);
 /*
  * With CONFIG_DM_MMC enabled, struct mmc can be accessed from the MMC device
  * with mmc_get_mmc_dev().
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 10/22] mmc: refactor MMC startup to make it easier to support new modes

2017-05-12 Thread Jean-Jacques Hiblot
The MMC startup process currently handles 4 modes. To make it easier to
add support for more modes, let's make the process more generic and use a
list of the modes to try.
The major functional change is that when a mode fails we try the next one.
Not all modes are tried, only those supported by the card and the host.

Signed-off-by: Jean-Jacques Hiblot 
---
 drivers/mmc/mmc.c | 238 +-
 include/mmc.h |  15 +++-
 2 files changed, 157 insertions(+), 96 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index f42a0fe..2931871 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -200,6 +200,7 @@ static int mmc_select_mode(struct mmc *mmc, enum bus_mode 
mode)
 {
mmc->selected_mode = mode;
mmc->tran_speed = mmc_mode2freq(mmc, mode);
+   mmc->ddr_mode = mmc_is_mode_ddr(mode);
debug("selecting mode %s (freq : %d MHz)\n", mmc_mode_name(mode),
  mmc->tran_speed / 100);
return 0;
@@ -602,11 +603,46 @@ int mmc_switch(struct mmc *mmc, u8 set, u8 index, u8 
value)
 
 }
 
-static int mmc_change_freq(struct mmc *mmc)
+static int mmc_set_card_speed(struct mmc *mmc, enum bus_mode mode)
 {
-   ALLOC_CACHE_ALIGN_BUFFER(u8, ext_csd, MMC_MAX_BLOCK_LEN);
-   char cardtype;
int err;
+   int speed_bits;
+   ALLOC_CACHE_ALIGN_BUFFER(u8, test_csd, MMC_MAX_BLOCK_LEN);
+
+   switch (mode) {
+   case MMC_HS:
+   case MMC_HS_52:
+   case MMC_DDR_52:
+ speed_bits = EXT_CSD_TIMING_HS;
+   case MMC_LEGACY:
+ speed_bits = EXT_CSD_TIMING_LEGACY;
+ break;
+   default:
+ return -EINVAL;
+   }
+   err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_HS_TIMING,
+speed_bits);
+   if (err)
+   return err;
+
+   if ((mode == MMC_HS) || (mode == MMC_HS_52)) {
+   /* Now check to see that it worked */
+   err = mmc_send_ext_csd(mmc, test_csd);
+   if (err)
+   return err;
+
+   /* No high-speed support */
+   if (!test_csd[EXT_CSD_HS_TIMING])
+   return -ENOTSUPP;
+   }
+
+   return 0;
+}
+
+static int mmc_get_capabilities(struct mmc *mmc)
+{
+   u8 *ext_csd = mmc->ext_csd;
+   char cardtype;
 
mmc->card_caps = MMC_MODE_1BIT;
 
@@ -617,38 +653,23 @@ static int mmc_change_freq(struct mmc *mmc)
if (mmc->version < MMC_VERSION_4)
return 0;
 
-   mmc->card_caps |= MMC_MODE_4BIT | MMC_MODE_8BIT;
-
-   err = mmc_send_ext_csd(mmc, ext_csd);
+   if (!ext_csd) {
+   error("No ext_csd found!\n"); /* this should enver happen */
+   return -ENOTSUPP;
+   }
 
-   if (err)
-   return err;
+   mmc->card_caps |= MMC_MODE_4BIT | MMC_MODE_8BIT;
 
cardtype = ext_csd[EXT_CSD_CARD_TYPE] & 0xf;
 
-   err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_HS_TIMING, 1);
-
-   if (err)
-   return err;
-
-   /* Now check to see that it worked */
-   err = mmc_send_ext_csd(mmc, ext_csd);
-
-   if (err)
-   return err;
-
-   /* No high-speed support */
-   if (!ext_csd[EXT_CSD_HS_TIMING])
-   return 0;
-
/* High Speed is set, there are two types: 52MHz and 26MHz */
if (cardtype & EXT_CSD_CARD_TYPE_52) {
-   if (cardtype & EXT_CSD_CARD_TYPE_DDR_1_8V)
+   if (cardtype & EXT_CSD_CARD_TYPE_DDR_52)
mmc->card_caps |= MMC_MODE_DDR_52MHz;
-   mmc->card_caps |= MMC_MODE_HS_52MHz | MMC_MODE_HS;
-   } else {
-   mmc->card_caps |= MMC_MODE_HS;
+   mmc->card_caps |= MMC_MODE_HS_52MHz;
}
+   if (cardtype & EXT_CSD_CARD_TYPE_26)
+   mmc->card_caps |= MMC_MODE_HS;
 
return 0;
 }
@@ -1320,33 +1341,58 @@ static int mmc_read_and_compare_ext_csd(struct mmc *mmc)
 }
 
 
-static int mmc_select_bus_freq_width(struct mmc *mmc)
+static const struct mode_width_tuning mmc_modes_by_pref[] = {
+   {
+   .mode = MMC_HS_200,
+   .widths = MMC_MODE_8BIT | MMC_MODE_4BIT,
+   },
+   {
+   .mode = MMC_DDR_52,
+   .widths = MMC_MODE_8BIT | MMC_MODE_4BIT,
+   },
+   {
+   .mode = MMC_HS_52,
+   .widths = MMC_MODE_8BIT | MMC_MODE_4BIT | MMC_MODE_1BIT,
+   },
+   {
+   .mode = MMC_HS,
+   .widths = MMC_MODE_8BIT | MMC_MODE_4BIT | MMC_MODE_1BIT,
+   },
+   {
+   .mode = MMC_LEGACY,
+   .widths = MMC_MODE_8BIT | MMC_MODE_4BIT | MMC_MODE_1BIT,
+   }
+};
+#define for_each_mmc_mode_by_pref(caps, mwt) \
+   for (mwt = mmc_modes_by_pref;\
+   mwt < mmc_modes_by_pref + ARRAY_SIZE(mmc_modes_by_pref);\
+   mwt++) \
+   if 

[U-Boot] [PATCH 07/22] mmc: use mmc modes to select the correct bus speed

2017-05-12 Thread Jean-Jacques Hiblot
Signed-off-by: Jean-Jacques Hiblot 
---
 drivers/mmc/mmc.c | 40 +---
 1 file changed, 29 insertions(+), 11 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 5d418c5..dc7985f 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -171,9 +171,35 @@ const char *mmc_mode_name(enum bus_mode mode)
else
return names[mode];
 }
+
+static uint mmc_mode2freq(struct mmc *mmc, enum bus_mode mode)
+{
+   static const int freqs[] = {
+ [SD_LEGACY]   = 2500,
+ [MMC_HS]  = 2600,
+ [SD_HS]   = 5000,
+ [UHS_SDR12]   = 2500,
+ [UHS_SDR25]   = 5000,
+ [UHS_SDR50]   = 1,
+ [UHS_SDR104]  = 20800,
+ [UHS_DDR50]   = 5000,
+ [MMC_HS_52]   = 5200,
+ [MMC_DDR_52]  = 5200,
+ [MMC_HS_200]  = 2,
+   };
+
+   if (mode == MMC_LEGACY)
+   return mmc->legacy_speed;
+   else if (mode >= MMC_MODES_END)
+   return 0;
+   else
+   return freqs[mode];
+}
+
 static int mmc_select_mode(struct mmc *mmc, enum bus_mode mode)
 {
mmc->selected_mode = mode;
+   mmc->tran_speed = mmc_mode2freq(mmc, mode);
debug("selecting mode %s (freq : %d MHz)\n", mmc_mode_name(mode),
  mmc->tran_speed / 100);
return 0;
@@ -1185,13 +1211,10 @@ static int sd_select_bus_freq_width(struct mmc *mmc)
if (err)
return err;
 
-   if (mmc->card_caps & MMC_MODE_HS) {
+   if (mmc->card_caps & MMC_MODE_HS)
mmc_select_mode(mmc, SD_HS);
-   mmc->tran_speed = 5000;
-   } else {
+   else
mmc_select_mode(mmc, SD_LEGACY);
-   mmc->tran_speed = 2500;
-   }
 
return 0;
 }
@@ -1310,11 +1333,8 @@ static int mmc_select_bus_freq_width(struct mmc *mmc)
mmc_select_mode(mmc, MMC_DDR_52);
else
mmc_select_mode(mmc, MMC_HS_52);
-   mmc->tran_speed = 5200;
-   } else if (mmc->card_caps & MMC_MODE_HS) {
+   } else if (mmc->card_caps & MMC_MODE_HS)
mmc_select_mode(mmc, MMC_HS);
-   mmc->tran_speed = 2600;
-   }
 
return err;
 }
@@ -1584,7 +1604,6 @@ static int mmc_startup(struct mmc *mmc)
mult = multipliers[((cmd.response[0] >> 3) & 0xf)];
 
mmc->legacy_speed = freq * mult;
-   mmc->tran_speed = mmc->legacy_speed;
mmc_select_mode(mmc, MMC_LEGACY);
 
mmc->dsr_imp = ((cmd.response[1] >> 12) & 0x1);
@@ -1659,7 +1678,6 @@ static int mmc_startup(struct mmc *mmc)
if (err)
return err;
 
-   mmc_set_clock(mmc, mmc->tran_speed);
 
/* Fix the block length for DDR mode */
if (mmc->ddr_mode) {
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 21/22] mmc: Change mode when switching to a boot partition

2017-05-12 Thread Jean-Jacques Hiblot
Boot partitions do not support HS200. Changing to a lower performance mode
is required to access them.
mmc_select_mode_and_width() and sd_select_mode_and_width() are modified to
make it easier to call them outside of the initialization context.

Signed-off-by: Jean-Jacques Hiblot 
---
 drivers/mmc/mmc.c | 66 +--
 include/mmc.h |  1 +
 2 files changed, 50 insertions(+), 17 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 074d286..c7dda64 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -32,6 +32,7 @@ static const unsigned int sd_au_size[] = {
 static int mmc_set_signal_voltage(struct mmc *mmc, uint signal_voltage);
 static void mmc_power_cycle(struct mmc *mmc);
 static int mmc_card_busy(struct mmc *mmc);
+static int mmc_select_mode_and_width(struct mmc *mmc, uint card_caps);
 
 #if CONFIG_IS_ENABLED(MMC_TINY)
 static struct mmc mmc_static;
@@ -788,10 +789,38 @@ static int mmc_set_capacity(struct mmc *mmc, int part_num)
return 0;
 }
 
+static int mmc_boot_part_access_chk(struct mmc *mmc, unsigned int part_num)
+{
+   int forbiden = 0;
+   bool change = false;
+
+   if (part_num & PART_ACCESS_MASK)
+   forbiden = MMC_CAP(MMC_HS_200);
+
+   if (MMC_CAP(mmc->selected_mode) & forbiden) {
+   debug("selected mode (%s) is forbiden for part %d\n",
+ mmc_mode_name(mmc->selected_mode), part_num);
+   change = true;
+   } else if (mmc->selected_mode != mmc->best_mode) {
+   debug("selected mode is not optimal\n");
+   change = true;
+   }
+
+   if (change)
+   return mmc_select_mode_and_width(mmc,
+mmc->card_caps & ~forbiden);
+
+   return 0;
+}
+
 int mmc_switch_part(struct mmc *mmc, unsigned int part_num)
 {
int ret;
 
+   ret = mmc_boot_part_access_chk(mmc, part_num);
+   if (ret)
+   return ret;
+
ret = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, EXT_CSD_PART_CONF,
 (mmc->part_config & ~PART_ACCESS_MASK)
 | (part_num & PART_ACCESS_MASK));
@@ -1438,7 +1467,7 @@ static const struct mode_width_tuning sd_modes_by_pref[] 
= {
 mwt++) \
if (caps & MMC_CAP(mwt->mode))
 
-static int sd_select_mode_and_width(struct mmc *mmc)
+static int sd_select_mode_and_width(struct mmc *mmc, uint card_caps)
 {
int err;
uint widths[] = {MMC_MODE_4BIT, MMC_MODE_1BIT};
@@ -1447,11 +1476,8 @@ static int sd_select_mode_and_width(struct mmc *mmc)
uint caps;
 
 
-   err = sd_get_capabilities(mmc);
-   if (err)
-   return err;
/* Restrict card's capabilities by what the host can do */
-   caps = mmc->card_caps & (mmc->cfg->host_caps | MMC_MODE_1BIT);
+   caps = card_caps & (mmc->cfg->host_caps | MMC_MODE_1BIT);
 
if (!uhs_en)
caps &= ~UHS_CAPS;
@@ -1582,18 +1608,14 @@ static const struct ext_csd_bus_width {
ecbv++) \
if ((ddr == ecbv->is_ddr) && (caps & ecbv->cap))
 
-static int mmc_select_mode_and_width(struct mmc *mmc)
+static int mmc_select_mode_and_width(struct mmc *mmc, uint card_caps)
 {
int err;
const struct mode_width_tuning *mwt;
const struct ext_csd_bus_width *ecbw;
 
-   err = mmc_get_capabilities(mmc);
-   if (err)
-   return err;
-
/* Restrict card's capabilities by what the host can do */
-   mmc->card_caps &= (mmc->cfg->host_caps | MMC_MODE_1BIT);
+   card_caps &= (mmc->cfg->host_caps | MMC_MODE_1BIT);
 
/* Only version 4 of MMC supports wider bus widths */
if (mmc->version < MMC_VERSION_4)
@@ -1605,8 +1627,10 @@ static int mmc_select_mode_and_width(struct mmc *mmc)
return -ENOTSUPP;
}
 
-   for_each_mmc_mode_by_pref(mmc->card_caps, mwt) {
-   for_each_supported_width(mmc->card_caps & mwt->widths,
+   mmc_set_clock(mmc, mmc->legacy_speed, false);
+
+   for_each_mmc_mode_by_pref(card_caps, mwt) {
+   for_each_supported_width(card_caps & mwt->widths,
 mmc_is_mode_ddr(mwt->mode), ecbw) {
debug("trying mode %s width %d (at %d MHz)\n",
  mmc_mode_name(mwt->mode),
@@ -1999,14 +2023,22 @@ static int mmc_startup(struct mmc *mmc)
if (err)
return err;
 
-   if (IS_SD(mmc))
-   err = sd_select_mode_and_width(mmc);
-   else
-   err = mmc_select_mode_and_width(mmc);
+   if (IS_SD(mmc)) {
+   err = sd_get_capabilities(mmc);
+   if (err)
+   return err;
+   err = sd_select_mode_and_width(mmc, mmc->card_caps);
+   } else {
+   err = mmc_get_capabilities(mmc);
+   if (err)
+ 

[U-Boot] [PATCH 19/22] mmc: Add a new callback function to check if the card is busy

2017-05-12 Thread Jean-Jacques Hiblot
Add a new callback function *card_busy* which can be used to check if the
card is busy. This is useful during UHS voltage switching to check if the
switch was successful. Not all controllers may support this, so it's
optional and when not provided the card is deemed ready.

Signed-off-by: Jean-Jacques Hiblot 
---
 drivers/mmc/mmc-uclass.c | 14 ++
 drivers/mmc/mmc.c| 10 ++
 include/mmc.h| 11 +++
 3 files changed, 35 insertions(+)

diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index b7433cf..75352ed 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -66,6 +66,20 @@ int mmc_set_vdd(struct mmc *mmc, bool enable)
return dm_mmc_set_vdd(mmc->dev, enable);
 }
 
+int dm_mmc_card_busy(struct udevice *dev)
+{
+   struct dm_mmc_ops *ops = mmc_get_ops(dev);
+
+   if (!ops->card_busy)
+   return 0;
+   return ops->card_busy(dev);
+}
+
+int mmc_card_busy(struct mmc *mmc)
+{
+   return dm_mmc_card_busy(mmc->dev);
+}
+
 int dm_mmc_get_wp(struct udevice *dev)
 {
struct dm_mmc_ops *ops = mmc_get_ops(dev);
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 2b710fe..f6509f1 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1217,6 +1217,16 @@ static int mmc_set_vdd(struct mmc *mmc, bool enable)
return ret;
 }
 
+static int mmc_card_busy(struct mmc *mmc)
+{
+   int ret = 0;
+
+   if (mmc->cfg->ops->card_busy)
+   ret = mmc->cfg->ops->card_busy(mmc);
+
+   return ret;
+}
+
 static int mmc_set_ios(struct mmc *mmc)
 {
int ret = 0;
diff --git a/include/mmc.h b/include/mmc.h
index b4ffa6a..b42f686 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -401,6 +401,14 @@ struct dm_mmc_ops {
 * @return 0 if OK, -ve on error
 */
int (*execute_tuning)(struct udevice *dev, uint opcode);
+
+   /**
+* card_busy() - See whether a card is busy
+*
+* @dev:Device to check
+* @return 1 if busy, O if not busy
+*/
+   int (*card_busy)(struct udevice *dev);
 };
 
 #define mmc_get_ops(dev)((struct dm_mmc_ops *)(dev)->driver->ops)
@@ -412,6 +420,7 @@ int dm_mmc_set_vdd(struct udevice *dev, bool enable);
 int dm_mmc_get_cd(struct udevice *dev);
 int dm_mmc_get_wp(struct udevice *dev);
 int dm_mmc_execute_tuning(struct udevice *dev, uint opcode);
+int dm_mmc_card_busy(struct udevice *dev);
 
 /* Transition functions for compatibility */
 int mmc_set_ios(struct mmc *mmc);
@@ -419,6 +428,7 @@ int mmc_set_vdd(struct mmc *mmc, bool enable);
 int mmc_getcd(struct mmc *mmc);
 int mmc_getwp(struct mmc *mmc);
 int mmc_execute_tuning(struct mmc *mmc, uint opcode);
+int mmc_card_busy(struct mmc *mmc);
 
 #else
 struct mmc_ops {
@@ -430,6 +440,7 @@ struct mmc_ops {
int (*getcd)(struct mmc *mmc);
int (*getwp)(struct mmc *mmc);
int (*execute_tuning)(struct mmc *mmc, uint opcode);
+   int (*card_busy)(struct mmc *mmc);
 };
 #endif
 
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 02/22] mmc: move the MMC startup for version above v4.0 in a separate function

2017-05-12 Thread Jean-Jacques Hiblot
no functionnal change. This is only to further reduce the size o
mmc_startup().

Signed-off-by: Jean-Jacques Hiblot 
---
 drivers/mmc/mmc.c | 316 --
 1 file changed, 165 insertions(+), 151 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 7a17bac..1ae10d1 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1250,15 +1250,174 @@ static int mmc_select_bus_freq_width(struct mmc *mmc, 
const u8 *ext_csd)
return err;
 }
 
+static int mmc_startup_v4(struct mmc *mmc, u8 *ext_csd)
+{
+   int err, i;
+   u64 capacity;
+   bool has_parts = false;
+   bool part_completed;
+
+   if (IS_SD(mmc) || (mmc->version < MMC_VERSION_4))
+   return 0;
+
+   /* check  ext_csd version and capacity */
+   err = mmc_send_ext_csd(mmc, ext_csd);
+   if (err)
+   return err;
+   if (ext_csd[EXT_CSD_REV] >= 2) {
+   /*
+ * According to the JEDEC Standard, the value of
+ * ext_csd's capacity is valid if the value is more
+ * than 2GB
+ */
+   capacity = ext_csd[EXT_CSD_SEC_CNT] << 0
+   | ext_csd[EXT_CSD_SEC_CNT + 1] << 8
+   | ext_csd[EXT_CSD_SEC_CNT + 2] << 16
+   | ext_csd[EXT_CSD_SEC_CNT + 3] << 24;
+   capacity *= MMC_MAX_BLOCK_LEN;
+   if ((capacity >> 20) > 2 * 1024)
+   mmc->capacity_user = capacity;
+   }
+
+   switch (ext_csd[EXT_CSD_REV]) {
+   case 1:
+   mmc->version = MMC_VERSION_4_1;
+   break;
+   case 2:
+   mmc->version = MMC_VERSION_4_2;
+   break;
+   case 3:
+   mmc->version = MMC_VERSION_4_3;
+   break;
+   case 5:
+   mmc->version = MMC_VERSION_4_41;
+   break;
+   case 6:
+   mmc->version = MMC_VERSION_4_5;
+   break;
+   case 7:
+   mmc->version = MMC_VERSION_5_0;
+   break;
+   case 8:
+   mmc->version = MMC_VERSION_5_1;
+   break;
+   }
+
+   /* The partition data may be non-zero but it is only
+ * effective if PARTITION_SETTING_COMPLETED is set in
+ * EXT_CSD, so ignore any data if this bit is not set,
+ * except for enabling the high-capacity group size
+ * definition (see below). */
+   part_completed = !!(ext_csd[EXT_CSD_PARTITION_SETTING] &
+   EXT_CSD_PARTITION_SETTING_COMPLETED);
+
+   /* store the partition info of emmc */
+   mmc->part_support = ext_csd[EXT_CSD_PARTITIONING_SUPPORT];
+   if ((ext_csd[EXT_CSD_PARTITIONING_SUPPORT] & PART_SUPPORT) ||
+   ext_csd[EXT_CSD_BOOT_MULT])
+   mmc->part_config = ext_csd[EXT_CSD_PART_CONF];
+   if (part_completed &&
+   (ext_csd[EXT_CSD_PARTITIONING_SUPPORT] & ENHNCD_SUPPORT))
+   mmc->part_attr = ext_csd[EXT_CSD_PARTITIONS_ATTRIBUTE];
+
+   mmc->capacity_boot = ext_csd[EXT_CSD_BOOT_MULT] << 17;
+
+   mmc->capacity_rpmb = ext_csd[EXT_CSD_RPMB_MULT] << 17;
+
+   for (i = 0; i < 4; i++) {
+   int idx = EXT_CSD_GP_SIZE_MULT + i * 3;
+   uint mult = (ext_csd[idx + 2] << 16) +
+   (ext_csd[idx + 1] << 8) + ext_csd[idx];
+   if (mult)
+   has_parts = true;
+   if (!part_completed)
+   continue;
+   mmc->capacity_gp[i] = mult;
+   mmc->capacity_gp[i] *=
+   ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE];
+   mmc->capacity_gp[i] *= ext_csd[EXT_CSD_HC_WP_GRP_SIZE];
+   mmc->capacity_gp[i] <<= 19;
+   }
+
+   if (part_completed) {
+   mmc->enh_user_size =
+   (ext_csd[EXT_CSD_ENH_SIZE_MULT+2] << 16) +
+   (ext_csd[EXT_CSD_ENH_SIZE_MULT+1] << 8) +
+   ext_csd[EXT_CSD_ENH_SIZE_MULT];
+   mmc->enh_user_size *= ext_csd[EXT_CSD_HC_ERASE_GRP_SIZE];
+   mmc->enh_user_size *= ext_csd[EXT_CSD_HC_WP_GRP_SIZE];
+   mmc->enh_user_size <<= 19;
+   mmc->enh_user_start =
+   (ext_csd[EXT_CSD_ENH_START_ADDR+3] << 24) +
+   (ext_csd[EXT_CSD_ENH_START_ADDR+2] << 16) +
+   (ext_csd[EXT_CSD_ENH_START_ADDR+1] << 8) +
+   ext_csd[EXT_CSD_ENH_START_ADDR];
+   if (mmc->high_capacity)
+   mmc->enh_user_start <<= 9;
+   }
+
+   /*
+ * Host needs to enable ERASE_GRP_DEF bit if device is
+ * partitioned. This bit will be lost every time after a reset
+ * or power off. This will affect erase size.
+ */
+   if (part_completed)
+   has_parts = 

[U-Boot] [PATCH 17/22] mmc: Add a execute_tuning() callback to the mmc operations.

2017-05-12 Thread Jean-Jacques Hiblot
Tuning is a mandatory step in the initialization of SDR104 and HS200 modes.
This callback execute the tuning process.

Signed-off-by: Jean-Jacques Hiblot 
---
 drivers/mmc/mmc-uclass.c | 14 ++
 drivers/mmc/mmc.c|  5 +
 include/mmc.h| 12 
 3 files changed, 31 insertions(+)

diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index e1f7995..b7433cf 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -93,6 +93,20 @@ int mmc_getcd(struct mmc *mmc)
 {
return dm_mmc_get_cd(mmc->dev);
 }
+
+int dm_mmc_execute_tuning(struct udevice *dev, uint opcode)
+{
+   struct dm_mmc_ops *ops = mmc_get_ops(dev);
+
+   if (!ops->execute_tuning)
+   return -ENOSYS;
+   return ops->execute_tuning(dev, opcode);
+}
+
+int mmc_execute_tuning(struct mmc *mmc, uint opcode)
+{
+   return dm_mmc_execute_tuning(mmc->dev, opcode);
+}
 #endif
 
 struct mmc *mmc_get_mmc_dev(struct udevice *dev)
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 415484e..d7d1c91 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -219,6 +219,11 @@ int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, 
struct mmc_data *data)
 
return ret;
 }
+
+int mmc_execute_tuning(struct mmc *mmc, uint opcode)
+{
+   return mmc->cfg->ops->execute_tuning(mmc, opcode);
+}
 #endif
 
 int mmc_send_status(struct mmc *mmc, int timeout)
diff --git a/include/mmc.h b/include/mmc.h
index 097a685..dab68c5 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -375,6 +375,15 @@ struct dm_mmc_ops {
 * @return 0 if write-enabled, 1 if write-protected, -ve on error
 */
int (*get_wp)(struct udevice *dev);
+
+   /**
+* execute_tuning() - Start the tuning process
+*
+* @dev:Device to start the tuning
+* @opcode: Command opcode to send
+* @return 0 if OK, -ve on error
+*/
+   int (*execute_tuning)(struct udevice *dev, uint opcode);
 };
 
 #define mmc_get_ops(dev)((struct dm_mmc_ops *)(dev)->driver->ops)
@@ -385,12 +394,14 @@ int dm_mmc_set_ios(struct udevice *dev);
 int dm_mmc_set_vdd(struct udevice *dev, bool enable);
 int dm_mmc_get_cd(struct udevice *dev);
 int dm_mmc_get_wp(struct udevice *dev);
+int dm_mmc_execute_tuning(struct udevice *dev, uint opcode);
 
 /* Transition functions for compatibility */
 int mmc_set_ios(struct mmc *mmc);
 int mmc_set_vdd(struct mmc *mmc, bool enable);
 int mmc_getcd(struct mmc *mmc);
 int mmc_getwp(struct mmc *mmc);
+int mmc_execute_tuning(struct mmc *mmc, uint opcode);
 
 #else
 struct mmc_ops {
@@ -401,6 +412,7 @@ struct mmc_ops {
int (*set_vdd)(struct mmc *mmc, bool enable);
int (*getcd)(struct mmc *mmc);
int (*getwp)(struct mmc *mmc);
+   int (*execute_tuning)(struct mmc *mmc, uint opcode);
 };
 #endif
 
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 11/22] mmc: make mmc_set_ios() return status

2017-05-12 Thread Jean-Jacques Hiblot
set_ios callback has a return value of 'int' but the mmc_set_ios()
function ignore this. Modify mmc_set_ios() and the callers of mmc_set_ios() to
to return the error status.

Signed-off-by: Jean-Jacques Hiblot 
---
 drivers/mmc/mmc.c | 16 ++--
 include/mmc.h |  2 +-
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 2931871..2ae6f1c 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1193,14 +1193,18 @@ static inline int bus_width(uint cap)
 }
 
 #ifndef CONFIG_DM_MMC_OPS
-static void mmc_set_ios(struct mmc *mmc)
+static int mmc_set_ios(struct mmc *mmc)
 {
+   int ret = 0;
+
if (mmc->cfg->ops->set_ios)
-   mmc->cfg->ops->set_ios(mmc);
+   ret = mmc->cfg->ops->set_ios(mmc);
+
+   return ret;
 }
 #endif
 
-void mmc_set_clock(struct mmc *mmc, uint clock)
+int mmc_set_clock(struct mmc *mmc, uint clock)
 {
if (clock > mmc->cfg->f_max)
clock = mmc->cfg->f_max;
@@ -1210,14 +1214,14 @@ void mmc_set_clock(struct mmc *mmc, uint clock)
 
mmc->clock = clock;
 
-   mmc_set_ios(mmc);
+   return mmc_set_ios(mmc);
 }
 
-static void mmc_set_bus_width(struct mmc *mmc, uint width)
+static int mmc_set_bus_width(struct mmc *mmc, uint width)
 {
mmc->bus_width = width;
 
-   mmc_set_ios(mmc);
+   return mmc_set_ios(mmc);
 }
 
 void mmc_dump_capabilities(const char *text, uint caps)
diff --git a/include/mmc.h b/include/mmc.h
index 3c6971d..9f20eb4 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -540,7 +540,7 @@ int mmc_unbind(struct udevice *dev);
 int mmc_initialize(bd_t *bis);
 int mmc_init(struct mmc *mmc);
 int mmc_read(struct mmc *mmc, u64 src, uchar *dst, int size);
-void mmc_set_clock(struct mmc *mmc, uint clock);
+int mmc_set_clock(struct mmc *mmc, uint clock);
 struct mmc *find_mmc_device(int dev_num);
 int mmc_set_dev(int dev_num);
 void print_mmc_devices(char separator);
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 12/22] mmc: Enable signal voltage to be selected from mmc core

2017-05-12 Thread Jean-Jacques Hiblot
From: Kishon Vijay Abraham I 

Add a new function *mmc_set_signal_voltage* in mmc core
which can be used during mmc initialization to select the
signal voltage. Platform driver should use the set_ios
callback function to select the signal voltage.

Signed-off-by: Kishon Vijay Abraham I 
Signed-off-by: Jean-Jacques Hiblot 
---
 drivers/mmc/mmc.c | 15 +++
 include/mmc.h |  5 +
 2 files changed, 20 insertions(+)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 2ae6f1c..10af81d 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -29,6 +29,7 @@ static const unsigned int sd_au_size[] = {
SZ_4M / 512,SZ_8M / 512,(SZ_8M + SZ_4M) / 512,
SZ_16M / 512,   (SZ_16M + SZ_8M) / 512, SZ_32M / 512,   SZ_64M / 512,
 };
+static int mmc_set_signal_voltage(struct mmc *mmc, uint signal_voltage);
 
 #if CONFIG_IS_ENABLED(MMC_TINY)
 static struct mmc mmc_static;
@@ -1247,6 +1248,12 @@ struct mode_width_tuning {
uint widths;
 };
 
+static int mmc_set_signal_voltage(struct mmc *mmc, uint signal_voltage)
+{
+   mmc->signal_voltage = signal_voltage;
+   return mmc_set_ios(mmc);
+}
+
 static const struct mode_width_tuning sd_modes_by_pref[] = {
{
.mode = SD_HS,
@@ -1935,6 +1942,14 @@ int mmc_start_init(struct mmc *mmc)
return err;
 #endif
mmc->ddr_mode = 0;
+
+   /* First try to set 3.3V. If it fails set to 1.8V */
+   err = mmc_set_signal_voltage(mmc, MMC_SIGNAL_VOLTAGE_330);
+   if (err != 0)
+   err = mmc_set_signal_voltage(mmc, MMC_SIGNAL_VOLTAGE_180);
+   if (err != 0)
+   printf("failed to set signal voltage\n");
+
mmc_set_bus_width(mmc, 1);
mmc_set_clock(mmc, 1);
 
diff --git a/include/mmc.h b/include/mmc.h
index 9f20eb4..89cb26c 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -266,6 +266,10 @@
 #define ENHNCD_SUPPORT (0x2)
 #define PART_ENH_ATTRIB(0x1f)
 
+#define MMC_SIGNAL_VOLTAGE_330 1
+#define MMC_SIGNAL_VOLTAGE_180 2
+#define MMC_SIGNAL_VOLTAGE_120 3
+
 /* Maximum block size for MMC */
 #define MMC_MAX_BLOCK_LEN  512
 
@@ -452,6 +456,7 @@ struct mmc {
int high_capacity;
uint bus_width;
uint clock;
+   uint signal_voltage;
uint card_caps;
uint ocr;
uint dsr;
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 00/22] mmc: Add support for HS200 and UHS modes

2017-05-12 Thread Jean-Jacques Hiblot
This series brings support for HS200 and UHS modes to the mmc core.
It has been tested with the hsmmc driver on several platforms (DRA7,
AM57x, AM437x, beaglebone black). Some modifications are required in
the host driver to take advantage of this (voltage switching, tuning).
The changes to the host driver will be posted a another series as this
one is already long enough. 

The series starts with a small refactoring of th sd/mmc startup. The first 4 
commits
are mostly moving code around with little or no functionnal change.

Then the notion of "mode" is introduced. Until now, this information wasn't
kept in struct mmc. Only the clock and a flag for ddr was kept. Later the mode
information will be used to select the clock frequency, the ddr flag and the
tuning procedure. It will be also be check against the host capabilities.

Then comes the big refactoring job in:
"mmc: refactor MMC startup to make it easier to support new modes" and
"mmc: refactor SD startup to make it easier to support new modes"
Since the number of modes is increasing, it makes sense to try them in a more
organized way. those commits use a list of supported modes and iterate through
them to find the best working one. It also allows to switch more easilly from
one mode to another (switching from HS200 to DDR52 to access boot partitions 
for example)

Then there are a couple of new callback added to:
- enable/disable Vdd
- check if the card is busy (used during UHS voltage switching)
- select the IO voltage

Then Power cycle is added. Without power cycle, if a UHS card fails to 
enumerate in
UHS mode, it can't fall back to high speed mode and card enumeration will fail.

And finally the last commits add the support for HS200 and UHS.
I haven't been able to test the UHS SDR104 mode by lack of compatible sdcard.

With this in place and the required changes in the HSMMC (including DAM), we 
observe significant
improvements in the performances on a DRA7 evm:
eMMC HS200: 130 MB/s
eMMC DDR52: 80 MB/s
sd   SDR50: 80 MB/s

cheers,

Jean-Jacques


Jean-Jacques Hiblot (18):
  mmc: split mmc_startup()
  mmc: move the MMC startup for version above v4.0 in a separate
function
  mmc: make ext_csd part of struct mmc
  mmc: add a function to read and test the ext csd (mmc >= 4)
  mmc: introduces mmc modes.
  mmc: Add a fonction to dump the mmc capabilities
  mmc: use mmc modes to select the correct bus speed
  cmd: mmc: display the mode name and current bus speed in the mmc info
  mmc: refactor SD startup to make it easier to support new modes
  mmc: refactor MMC startup to make it easier to support new modes
  mmc: make mmc_set_ios() return status
  mmc: add power cyle support in mmc core
  mmc: add a new mmc parameter to disable mmc clock
  mmc: Add a execute_tuning() callback to the mmc operations.
  mmc: add HS200 support in MMC core
  mmc: Add a new callback function to check if the card is busy
  mmc: Add support for UHS modes
  mmc: Change mode when switching to a boot partition

Kishon Vijay Abraham I (3):
  mmc: Enable signal voltage to be selected from mmc core
  mmc: Add a new callback function to enable/disable vdd
  mmc: disable the mmc clock during power off

Vignesh R (1):
  mmc: Retry some MMC cmds on failure

 cmd/mmc.c|3 +-
 drivers/mmc/fsl_esdhc.c  |2 +-
 drivers/mmc/mmc-uclass.c |   42 ++
 drivers/mmc/mmc.c| 1220 +-
 include/mmc.h|  138 +-
 5 files changed, 1058 insertions(+), 347 deletions(-)

-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 09/22] mmc: refactor SD startup to make it easier to support new modes

2017-05-12 Thread Jean-Jacques Hiblot
The SDcard startup process currently handles only 2 modes. To make it
easier to add support for more modes, let's make the process more generic
and use a list of the modes to try.
The major functional change is that when a mode fails we try the next one.
Not all modes are tried, only those supported by the card and the host.

Signed-off-by: Jean-Jacques Hiblot 
---
 drivers/mmc/mmc.c | 180 ++
 include/mmc.h |   1 +
 2 files changed, 128 insertions(+), 53 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index dc7985f..f42a0fe 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -608,7 +608,7 @@ static int mmc_change_freq(struct mmc *mmc)
char cardtype;
int err;
 
-   mmc->card_caps = 0;
+   mmc->card_caps = MMC_MODE_1BIT;
 
if (mmc_host_is_spi(mmc))
return 0;
@@ -934,7 +934,7 @@ static int sd_switch(struct mmc *mmc, int mode, int group, 
u8 value, u8 *resp)
 }
 
 
-static int sd_change_freq(struct mmc *mmc)
+static int sd_get_capabilities(struct mmc *mmc)
 {
int err;
struct mmc_cmd cmd;
@@ -943,7 +943,7 @@ static int sd_change_freq(struct mmc *mmc)
struct mmc_data data;
int timeout;
 
-   mmc->card_caps = 0;
+   mmc->card_caps = MMC_MODE_1BIT;
 
if (mmc_host_is_spi(mmc))
return 0;
@@ -1020,26 +1020,53 @@ retry_scr:
}
 
/* If high-speed isn't supported, we return */
-   if (!(__be32_to_cpu(switch_status[3]) & SD_HIGHSPEED_SUPPORTED))
-   return 0;
+   if (__be32_to_cpu(switch_status[3]) & SD_HIGHSPEED_SUPPORTED)
+   mmc->card_caps |= MMC_CAP(SD_HS);
 
-   /*
-* If the host doesn't support SD_HIGHSPEED, do not switch card to
-* HIGHSPEED mode even if the card support SD_HIGHSPPED.
-* This can avoid furthur problem when the card runs in different
-* mode between the host.
-*/
-   if (!((mmc->cfg->host_caps & MMC_MODE_HS_52MHz) &&
-   (mmc->cfg->host_caps & MMC_MODE_HS)))
-   return 0;
+   return 0;
+}
+
+static int sd_set_card_speed(struct mmc *mmc, enum bus_mode mode)
+{
+   int err;
+   ALLOC_CACHE_ALIGN_BUFFER(uint, switch_status, 16);
 
err = sd_switch(mmc, SD_SWITCH_SWITCH, 0, 1, (u8 *)switch_status);
 
if (err)
return err;
 
-   if ((__be32_to_cpu(switch_status[4]) & 0x0f00) == 0x0100)
-   mmc->card_caps |= MMC_MODE_HS;
+   if ((__be32_to_cpu(switch_status[4]) & 0x0f00) != 0x0100)
+   return -ENOTSUPP;
+
+   return 0;
+}
+
+int sd_select_bus_width(struct mmc *mmc, int w)
+{
+   int err;
+   struct mmc_cmd cmd;
+
+   if ((w != 4) && (w != 1))
+   return -EINVAL;
+
+   cmd.cmdidx = MMC_CMD_APP_CMD;
+   cmd.resp_type = MMC_RSP_R1;
+   cmd.cmdarg = mmc->rca << 16;
+
+   err = mmc_send_cmd(mmc, , NULL);
+   if (err)
+   return err;
+
+   cmd.cmdidx = SD_CMD_APP_SET_BUS_WIDTH;
+   cmd.resp_type = MMC_RSP_R1;
+   if (w == 4)
+   cmd.cmdarg = 2;
+   else if (w == 1)
+   cmd.cmdarg = 0;
+   err = mmc_send_cmd(mmc, , NULL);
+   if (err)
+   return err;
 
return 0;
 }
@@ -1131,6 +1158,19 @@ static const u8 multipliers[] = {
80,
 };
 
+
+static inline int bus_width(uint cap)
+{
+   if (cap == MMC_MODE_8BIT)
+   return 8;
+   if (cap == MMC_MODE_4BIT)
+   return 4;
+   if (cap == MMC_MODE_1BIT)
+   return 1;
+   error("invalid bus witdh capability 0x%x\n", cap);
+   return 0;
+}
+
 #ifndef CONFIG_DM_MMC_OPS
 static void mmc_set_ios(struct mmc *mmc)
 {
@@ -1168,55 +1208,89 @@ void mmc_dump_capabilities(const char *text, uint caps)
printf("8, ");
if (caps & MMC_MODE_4BIT)
printf("4, ");
-   printf("1] modes [");
-
+   if (caps & MMC_MODE_1BIT)
+   printf("1, ");
+   printf("\b\b] modes [");
for (mode = MMC_LEGACY; mode < MMC_MODES_END; mode++)
if (MMC_CAP(mode) & caps)
printf("%s, ", mmc_mode_name(mode));
printf("\b\b]\n");
 }
 
-static int sd_select_bus_freq_width(struct mmc *mmc)
+struct mode_width_tuning {
+   enum bus_mode mode;
+   uint widths;
+};
+
+static const struct mode_width_tuning sd_modes_by_pref[] = {
+   {
+   .mode = SD_HS,
+   .widths = MMC_MODE_4BIT | MMC_MODE_1BIT,
+   },
+   {
+   .mode = SD_LEGACY,
+   .widths = MMC_MODE_4BIT | MMC_MODE_1BIT,
+   }
+};
+#define for_each_sd_mode_by_pref(caps, mwt) \
+   for (mwt = sd_modes_by_pref;\
+mwt < sd_modes_by_pref + ARRAY_SIZE(sd_modes_by_pref);\
+mwt++) \
+   if (caps & MMC_CAP(mwt->mode))
+
+static int 

[U-Boot] [PATCH 13/22] mmc: Add a new callback function to enable/disable vdd

2017-05-12 Thread Jean-Jacques Hiblot
From: Kishon Vijay Abraham I 

Add a new callback function *set_vdd* which can be used
by the platform mmc driver to enable or disable vdd.
The mmc core can use *mmc_set_vdd* in order to invoke
the callback function. This will be used during power cycle
where the specification requires vdd to be disabled for
1ms and enabled again.

Signed-off-by: Kishon Vijay Abraham I 
Signed-off-by: Jean-Jacques Hiblot 
---
 drivers/mmc/mmc-uclass.c | 14 ++
 drivers/mmc/mmc.c| 12 +++-
 include/mmc.h| 12 
 3 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index 9c07871..e1f7995 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -52,6 +52,20 @@ int mmc_set_ios(struct mmc *mmc)
return dm_mmc_set_ios(mmc->dev);
 }
 
+int dm_mmc_set_vdd(struct udevice *dev, bool enable)
+{
+   struct dm_mmc_ops *ops = mmc_get_ops(dev);
+
+   if (!ops->set_vdd)
+   return -ENOSYS;
+   return ops->set_vdd(dev, enable);
+}
+
+int mmc_set_vdd(struct mmc *mmc, bool enable)
+{
+   return dm_mmc_set_vdd(mmc->dev, enable);
+}
+
 int dm_mmc_get_wp(struct udevice *dev)
 {
struct dm_mmc_ops *ops = mmc_get_ops(dev);
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 10af81d..d40a22b 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1194,6 +1194,16 @@ static inline int bus_width(uint cap)
 }
 
 #ifndef CONFIG_DM_MMC_OPS
+static int mmc_set_vdd(struct mmc *mmc, bool enable)
+{
+   int ret = 0;
+
+   if (mmc->cfg->ops->set_vdd)
+   ret = mmc->cfg->ops->set_vdd(mmc, enable);
+
+   return ret;
+}
+
 static int mmc_set_ios(struct mmc *mmc)
 {
int ret = 0;
@@ -1942,7 +1952,7 @@ int mmc_start_init(struct mmc *mmc)
return err;
 #endif
mmc->ddr_mode = 0;
-
+   mmc_set_vdd(mmc, true);
/* First try to set 3.3V. If it fails set to 1.8V */
err = mmc_set_signal_voltage(mmc, MMC_SIGNAL_VOLTAGE_330);
if (err != 0)
diff --git a/include/mmc.h b/include/mmc.h
index 89cb26c..43d37a4 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -352,6 +352,15 @@ struct dm_mmc_ops {
int (*set_ios)(struct udevice *dev);
 
/**
+* set_vdd() - Enable or Disable the Vdd line
+*
+* @dev:Device to update
+* @enable: true or false to enable or disable Vdd respectively
+* @return 0 if OK, -ve on error
+*/
+   int (*set_vdd)(struct udevice *dev, bool enable);
+
+   /**
 * get_cd() - See whether a card is present
 *
 * @dev:Device to check
@@ -373,11 +382,13 @@ struct dm_mmc_ops {
 int dm_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd,
struct mmc_data *data);
 int dm_mmc_set_ios(struct udevice *dev);
+int dm_mmc_set_vdd(struct udevice *dev, bool enable);
 int dm_mmc_get_cd(struct udevice *dev);
 int dm_mmc_get_wp(struct udevice *dev);
 
 /* Transition functions for compatibility */
 int mmc_set_ios(struct mmc *mmc);
+int mmc_set_vdd(struct mmc *mmc, bool enable);
 int mmc_getcd(struct mmc *mmc);
 int mmc_getwp(struct mmc *mmc);
 
@@ -387,6 +398,7 @@ struct mmc_ops {
struct mmc_cmd *cmd, struct mmc_data *data);
int (*set_ios)(struct mmc *mmc);
int (*init)(struct mmc *mmc);
+   int (*set_vdd)(struct mmc *mmc, bool enable);
int (*getcd)(struct mmc *mmc);
int (*getwp)(struct mmc *mmc);
 };
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH 05/22] mmc: introduces mmc modes.

2017-05-12 Thread Jean-Jacques Hiblot
no functionnal changes.
In order to add the support for the high speed SD and MMC modes, it is
useful to track this information.

Signed-off-by: Jean-Jacques Hiblot 
---
 drivers/mmc/mmc.c | 53 ++---
 include/mmc.h | 34 --
 2 files changed, 74 insertions(+), 13 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 344d760..2e1cb0d 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -149,6 +149,36 @@ void mmc_trace_state(struct mmc *mmc, struct mmc_cmd *cmd)
 }
 #endif
 
+const char *mmc_mode_name(enum bus_mode mode)
+{
+   static const char *const names[] = {
+ [MMC_LEGACY]  = "MMC legacy",
+ [SD_LEGACY]   = "SD Legacy",
+ [MMC_HS]  = "MMC High Speed (26MHz)",
+ [SD_HS]   = "SD High Speed (50MHz)",
+ [UHS_SDR12]   = "UHS SDR12 (25MHz)",
+ [UHS_SDR25]   = "UHS SDR25 (50MHz)",
+ [UHS_SDR50]   = "UHS SDR50 (100MHz)",
+ [UHS_SDR104]  = "UHS SDR104 (208MHz)",
+ [UHS_DDR50]   = "UHS DDR50 (50MHz)",
+ [MMC_HS_52]   = "MMC High Speed (52MHz)",
+ [MMC_DDR_52]  = "MMC DDR52 (52MHz)",
+ [MMC_HS_200]  = "HS200 (200MHz)",
+   };
+
+   if (mode >= MMC_MODES_END)
+   return "Unknown mode";
+   else
+   return names[mode];
+}
+static int mmc_select_mode(struct mmc *mmc, enum bus_mode mode)
+{
+   mmc->selected_mode = mode;
+   debug("selecting mode %s (freq : %d MHz)\n", mmc_mode_name(mode),
+ mmc->tran_speed / 100);
+   return 0;
+}
+
 #ifndef CONFIG_DM_MMC_OPS
 int mmc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data)
 {
@@ -1138,10 +1168,13 @@ static int sd_select_bus_freq_width(struct mmc *mmc)
if (err)
return err;
 
-   if (mmc->card_caps & MMC_MODE_HS)
+   if (mmc->card_caps & MMC_MODE_HS) {
+   mmc_select_mode(mmc, SD_HS);
mmc->tran_speed = 5000;
-   else
+   } else {
+   mmc_select_mode(mmc, SD_LEGACY);
mmc->tran_speed = 2500;
+   }
 
return 0;
 }
@@ -1255,11 +1288,15 @@ static int mmc_select_bus_freq_width(struct mmc *mmc)
if (err)
return err;
 
-   if (mmc->card_caps & MMC_MODE_HS) {
-   if (mmc->card_caps & MMC_MODE_HS_52MHz)
-   mmc->tran_speed = 5200;
+   if (mmc->card_caps & MMC_MODE_HS_52MHz) {
+   if (mmc->ddr_mode)
+   mmc_select_mode(mmc, MMC_DDR_52);
else
-   mmc->tran_speed = 2600;
+   mmc_select_mode(mmc, MMC_HS_52);
+   mmc->tran_speed = 5200;
+   } else if (mmc->card_caps & MMC_MODE_HS) {
+   mmc_select_mode(mmc, MMC_HS);
+   mmc->tran_speed = 2600;
}
 
return err;
@@ -1529,7 +1566,9 @@ static int mmc_startup(struct mmc *mmc)
freq = fbase[(cmd.response[0] & 0x7)];
mult = multipliers[((cmd.response[0] >> 3) & 0xf)];
 
-   mmc->tran_speed = freq * mult;
+   mmc->legacy_speed = freq * mult;
+   mmc->tran_speed = mmc->legacy_speed;
+   mmc_select_mode(mmc, MMC_LEGACY);
 
mmc->dsr_imp = ((cmd.response[1] >> 12) & 0x1);
mmc->read_bl_len = 1 << ((cmd.response[1] >> 16) & 0xf);
diff --git a/include/mmc.h b/include/mmc.h
index 9af6b52..60a43b0 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -52,12 +52,15 @@
 #define MMC_VERSION_5_0MAKE_MMC_VERSION(5, 0, 0)
 #define MMC_VERSION_5_1MAKE_MMC_VERSION(5, 1, 0)
 
-#define MMC_MODE_HS(1 << 0)
-#define MMC_MODE_HS_52MHz  (1 << 1)
-#define MMC_MODE_4BIT  (1 << 2)
-#define MMC_MODE_8BIT  (1 << 3)
-#define MMC_MODE_SPI   (1 << 4)
-#define MMC_MODE_DDR_52MHz (1 << 5)
+#define MMC_CAP(mode)  (1 << mode)
+#define MMC_MODE_HS(MMC_CAP(MMC_HS) | MMC_CAP(SD_HS))
+#define MMC_MODE_HS_52MHz  MMC_CAP(MMC_HS_52)
+#define MMC_MODE_DDR_52MHz MMC_CAP(MMC_DDR_52)
+
+#define MMC_MODE_8BIT  (1 << 30)
+#define MMC_MODE_4BIT  (1 << 29)
+#define MMC_MODE_SPI   (1 << 27)
+
 
 #define SD_DATA_4BIT   0x0004
 
@@ -402,6 +405,23 @@ struct sd_ssr {
unsigned int erase_offset;  /* In milliseconds */
 };
 
+enum bus_mode {
+   MMC_LEGACY  = 0,
+   SD_LEGACY   = 1,
+   MMC_HS  = 2,
+   SD_HS   = 3,
+   UHS_SDR12   = 4,
+   UHS_SDR25   = 5,
+   UHS_SDR50   = 6,
+   UHS_SDR104  = 7,
+   UHS_DDR50   = 8,
+   MMC_HS_52   = 9,
+   MMC_DDR_52  = 10,
+   MMC_HS_200  = 11,
+   MMC_MODES_END
+};
+
+const char *mmc_mode_name(enum bus_mode mode);
 /*
  * With CONFIG_DM_MMC 

[U-Boot] [PATCH 16/22] mmc: disable the mmc clock during power off

2017-05-12 Thread Jean-Jacques Hiblot
From: Kishon Vijay Abraham I 

There is no point in having the mmc clock enabled during
power off. Disable the mmc clock. This is similar to how it's
programmed in Linux Kernel.

Signed-off-by: Kishon Vijay Abraham I 
Signed-off-by: Vignesh R 
Signed-off-by: Jean-Jacques Hiblot 
---
 drivers/mmc/mmc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 70b7d19..415484e 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1943,6 +1943,7 @@ static void mmc_power_up(struct mmc *mmc)
 static void mmc_power_off(struct mmc *mmc)
 {
mmc_set_vdd(mmc, false);
+   mmc_set_clock(mmc, 1, true);
 }
 
 static void mmc_power_cycle(struct mmc *mmc)
-- 
1.9.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


  1   2   3   >