1 From aa9d5d64ca6441cb24e22dc3c1f707da62da2887 Mon Sep 17 00:00:00 2001
2 From: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
3 Date: Tue, 6 Nov 2012 19:35:17 +0100
4 Subject: sf: add init function
6 Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
8 --- a/drivers/mtd/spi/spi_flash.c
9 +++ b/drivers/mtd/spi/spi_flash.c
10 @@ -482,3 +482,36 @@ void spi_flash_free(struct spi_flash *fl
11 spi_flash_free_spl(flash);
15 +#ifdef CONFIG_SPI_FLASH_MTD
16 +static int spi_flash_mtd_register(void)
18 + struct spi_flash *flash;
21 + flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS,
22 + CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
26 + err = spi_flash_mtd_init(flash);
28 + spi_flash_free(flash);
33 +static int spi_flash_mtd_register(void)
39 +int spi_flash_init(void)
43 + err = spi_flash_mtd_register();
47 --- a/include/spi_flash.h
48 +++ b/include/spi_flash.h
49 @@ -51,6 +51,8 @@ struct spi_flash {
53 +int spi_flash_init(void);
55 struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs,
56 unsigned int max_hz, unsigned int spi_mode);
57 void spi_flash_free(struct spi_flash *flash);