All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 5/7] mips: mt76xx: gardena-smart-gateway: Read default speed and mode values from DT
Date: Mon, 10 Dec 2018 12:47:15 +0100	[thread overview]
Message-ID: <03a43cea-9620-af12-33fc-11eeaefc6d27@denx.de> (raw)
In-Reply-To: <1544439166-5749-6-git-send-email-patrick.delaunay@st.com>

On 10.12.18 11:52, Patrick Delaunay wrote:
> In case of DT boot, don't read default speed and mode for SPI from
> CONFIG_*, instead read from DT node.
> 
> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
> ---
> 
>   board/gardena/smart-gateway-mt7688/board.c | 24 ++++++++++++++++++++----
>   1 file changed, 20 insertions(+), 4 deletions(-)
> 
> diff --git a/board/gardena/smart-gateway-mt7688/board.c b/board/gardena/smart-gateway-mt7688/board.c
> index 6e11077..8a67e70 100644
> --- a/board/gardena/smart-gateway-mt7688/board.c
> +++ b/board/gardena/smart-gateway-mt7688/board.c
> @@ -89,6 +89,14 @@ static void factory_data_env_config(void)
>   	u32 crc;
>   	int ret;
>   	u8 *ptr;
> +	/* In DM mode, defaults will be taken from DT */
> +	unsigned int speed = 0;
> +	unsigned int mode = 0;
> +
> +#ifndef CONFIG_DM_SPI_FLASH
> +	speed = CONFIG_SF_DEFAULT_SPEED;
> +	mode = CONFIG_SF_DEFAULT_MODE;
> +#endif

CONFIG_DM_SPI_FLASH is always enabled in this board. So there should
be no need to handle the non-DM case at all.

Could you please change this patch and remove this unnecessary code?

Thanks,
Stefan

>   
>   	buf = malloc(FACTORY_DATA_SIZE);
>   	if (!buf) {
> @@ -101,8 +109,8 @@ static void factory_data_env_config(void)
>   	 */
>   	sf = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
>   			     CONFIG_SF_DEFAULT_CS,
> -			     CONFIG_SF_DEFAULT_SPEED,
> -			     CONFIG_SF_DEFAULT_MODE);
> +			     speed,
> +			     mode);
>   	if (!sf) {
>   		printf("F-Data:Unable to access SPI NOR flash\n");
>   		goto err_free;
> @@ -207,6 +215,14 @@ int do_fd_write(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>   	struct spi_flash *sf;
>   	u8 *buf;
>   	int ret = CMD_RET_FAILURE;
> +	/* In DM mode, defaults will be taken from DT */
> +	unsigned int speed = 0;
> +	unsigned int mode = 0;
> +
> +#ifndef CONFIG_DM_SPI_FLASH
> +	speed = CONFIG_SF_DEFAULT_SPEED;
> +	mode = CONFIG_SF_DEFAULT_MODE;
> +#endif
>   
>   	buf = malloc(FACTORY_DATA_SECT_SIZE);
>   	if (!buf) {
> @@ -216,8 +232,8 @@ int do_fd_write(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>   
>   	sf = spi_flash_probe(CONFIG_SF_DEFAULT_BUS,
>   			     CONFIG_SF_DEFAULT_CS,
> -			     CONFIG_SF_DEFAULT_SPEED,
> -			     CONFIG_SF_DEFAULT_MODE);
> +			     speed,
> +			     mode);
>   	if (!sf) {
>   		printf("F-Data:Unable to access SPI NOR flash\n");
>   		goto err_free;
> 

Viele Grüße,
Stefan

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de

  reply	other threads:[~2018-12-10 11:47 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10 10:52 [U-Boot] [PATCH 0/7] Remove defines for SPI default speed and mode Patrick Delaunay
2018-12-10 10:52 ` [U-Boot] [PATCH 1/7] spi: update management of " Patrick Delaunay
2018-12-10 11:24   ` Simon Goldschmidt
2018-12-10 20:49     ` Petr Vorel
2018-12-10 20:57       ` Simon Goldschmidt
2018-12-12 19:58   ` Jagan Teki
2018-12-10 10:52 ` [U-Boot] [PATCH 2/7] spi: add comment for spi_flash_probe_bus_cs function Patrick Delaunay
2018-12-10 11:25   ` Simon Goldschmidt
2018-12-10 20:54     ` Petr Vorel
2018-12-10 10:52 ` [U-Boot] [PATCH 3/7] da850evm: sf: Read default speed and mode values from DT Patrick Delaunay
2018-12-10 20:57   ` Petr Vorel
2018-12-12 20:02   ` Jagan Teki
2018-12-13 14:54     ` Patrick DELAUNAY
2018-12-10 10:52 ` [U-Boot] [PATCH 4/7] dfu: " Patrick Delaunay
2018-12-10 11:22   ` Lukasz Majewski
2018-12-10 21:00   ` Petr Vorel
2018-12-10 10:52 ` [U-Boot] [PATCH 5/7] mips: mt76xx: gardena-smart-gateway: " Patrick Delaunay
2018-12-10 11:47   ` Stefan Roese [this message]
2018-12-10 21:01   ` Petr Vorel
2018-12-10 10:52 ` [U-Boot] [PATCH 6/7] env: " Patrick Delaunay
2018-12-10 11:23   ` Lukasz Majewski
2018-12-10 11:27   ` Simon Goldschmidt
2018-12-10 21:08   ` Petr Vorel
2018-12-12 20:07   ` Jagan Teki
2018-12-10 10:52 ` [U-Boot] [PATCH 7/7] spi: remove define for SPI default SPEED and MODE Patrick Delaunay
2018-12-10 11:26   ` Simon Goldschmidt
2018-12-10 21:10     ` Petr Vorel
2018-12-10 15:42 ` [U-Boot] [PATCH 0/7] Remove defines for SPI default speed and mode Adam Ford
2018-12-10 19:20   ` Simon Goldschmidt
2018-12-10 20:17     ` Adam Ford
2018-12-10 21:08       ` Simon Goldschmidt
2018-12-12  7:51         ` Petr Vorel
2018-12-12  9:54           ` Simon Goldschmidt
2018-12-13 14:46             ` Patrick DELAUNAY

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=03a43cea-9620-af12-33fc-11eeaefc6d27@denx.de \
    --to=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.