sandbox: Rename sb_cmdline_option to sandbox_cmdline_option
Subsystems (5)
PATCH v2 1/6 sandbox: Rename sb_cmdline_option to sandbox_cmdline_option
The new name is longer but more clearly related to sandbox.
This is in a separate patch within the same series since some comments on the SPI series rely on it.
---
Changes in v2: None
arch/sandbox/cpu/os.c | 2 +- arch/sandbox/cpu/start.c | 17 +++++++++-------- arch/sandbox/include/asm/getopt.h | 23 ++++++++++++----------- arch/sandbox/include/asm/sections.h | 4 ++-- 4 files changed, 24 insertions(+), 22 deletions(-)
arch/sandbox/cpu/os.c +1 -1
@@ -161,7 +161,7 @@ static struct option *long_opts;int os_parse_args (struct sandbox_state *state,int argc,char *argv[]) { -struct sb_cmdline_option **sb_opt = __u_boot_sandbox_option_start; +struct sandbox_cmdline_option **sb_opt = __u_boot_sandbox_option_start;size_t num_options =__u_boot_sandbox_option_count ();size_t i;
arch/sandbox/cpu/start.c +9 -8
@@ -13,7 +13,7 @@int sandbox_early_getopt_check (void ) {struct sandbox_state *state =state_get_current (); -struct sb_cmdline_option **sb_opt = __u_boot_sandbox_option_start; +struct sandbox_cmdline_option **sb_opt = __u_boot_sandbox_option_start;size_t num_options =__u_boot_sandbox_option_count ();size_t i;int max_arg_len, max_noarg_len;
@@ -40,7 +40,7 @@ int sandbox_early_getopt_check(void) max_noarg_len = max_arg_len +7 ;for (i =0 ; i < num_options; ++i) { -struct sb_cmdline_option *opt = sb_opt[i]; +struct sandbox_cmdline_option *opt = sb_opt[i];/* first output the short flag if it has one */ if (opt->flag_short >=0x100 )
@@ -61,12 +61,12 @@ int sandbox_early_getopt_check(void)os_exit (0 ); } -static int sb_cmdline_cb_help (struct sandbox_state *state,const char *arg) +static int sandbox_cmdline_cb_help (struct sandbox_state *state,const char *arg) {/* just flag to sandbox_early_getopt_check to show usage */ return 1 ; } -SB_CMDLINE_OPT_SHORT (help,'h' ,0 ,"Display help" ); +SANDBOX_CMDLINE_OPT_SHORT (help,'h' ,0 ,"Display help" );int sandbox_main_loop_init (void ) {
@@ -81,19 +81,20 @@ int sandbox_main_loop_init(void)return 0 ; } -static int sb_cmdline_cb_command (struct sandbox_state *state,const char *arg) +static int sandbox_cmdline_cb_command (struct sandbox_state *state, +const char *arg) { state->cmd = arg;return 0 ; } -SB_CMDLINE_OPT_SHORT (command,'c' ,1 ,"Execute U-Boot command" ); +SANDBOX_CMDLINE_OPT_SHORT (command,'c' ,1 ,"Execute U-Boot command" ); -static int sb_cmdline_cb_fdt (struct sandbox_state *state,const char *arg) +static int sandbox_cmdline_cb_fdt (struct sandbox_state *state,const char *arg) { state->fdt_fname = arg;return 0 ; } -SB_CMDLINE_OPT_SHORT (fdt,'d' ,1 ,"Specify U-Boot's control FDT" ); +SANDBOX_CMDLINE_OPT_SHORT (fdt,'d' ,1 ,"Specify U-Boot's control FDT" );int main (int argc,char *argv[]) {
arch/sandbox/include/asm/getopt.h +12 -11
@@ -18,7 +18,7 @@ struct sandbox_state;* consumer code should focus on the macros below and * the callback function. */ -struct sb_cmdline_option { +struct sandbox_cmdline_option {/* The long flag name: "help" for "--help" */ const char *flag;/* The (optional) short flag name: "h" for "-h" */
@@ -35,18 +35,19 @@ struct sb_cmdline_option {* Internal macro to expand the lower macros into the necessary * magic junk that makes this all work. */ -#define _SB_CMDLINE_OPT (f, s, ha, h) \ - static struct sb_cmdline_option sb_cmdline_option_##f = { \ +#define _SANDBOX_CMDLINE_OPT (f, s, ha, h) \ + static struct sandbox_cmdline_option sandbox_cmdline_option_##f = { \ .flag = #f, \ .flag_short = s, \ .help = h, \ .has_arg = ha, \ - .callback = sb_cmdline_cb_##f, \ + .callback = sandbox_cmdline_cb_##f, \ }; \/* Ppointer to the struct in a special section for the linker script */ \ static __attribute__((section(".u_boot_sandbox_getopt"), used)) \ - struct sb_cmdline_option *sb_cmdline_option_##f##_ptr = \ - &sb_cmdline_option_##f + struct sandbox_cmdline_option \ + *sandbox_cmdline_option_##f##_ptr = \ + &sandbox_cmdline_option_##f/** * Macros for end code to declare new command line flags.
@@ -56,16 +57,16 @@ struct sb_cmdline_option {* @param h The help string displayed when showing --help * * This invocation: -* SB_CMDLINE_OPT(foo, 0, "The foo arg"); +* SANDBOX_CMDLINE_OPT(foo, 0, "The foo arg"); * Will create a new flag named "--foo" (no short option) that takes * no argument. If the user specifies "--foo", then the callback func -* sb_cmdline_cb_foo() will automatically be called. +* sandbox_cmdline_cb_foo() will automatically be called. */ -#define SB_CMDLINE_OPT (f, ha, h) _SB_CMDLINE_OPT(f, 0, ha, h) +#define SANDBOX_CMDLINE_OPT (f, ha, h) _SANDBOX_CMDLINE_OPT(f, 0, ha, h)/* * Same as above, but @s is used to specify a short flag e.g. -* SB_CMDLINE_OPT(foo, 'f', 0, "The foo arg"); +* SANDBOX_CMDLINE_OPT(foo, 'f', 0, "The foo arg"); */ -#define SB_CMDLINE_OPT_SHORT (f, s, ha, h) _SB_CMDLINE_OPT(f, s, ha, h) +#define SANDBOX_CMDLINE_OPT_SHORT (f, s, ha, h) _SANDBOX_CMDLINE_OPT(f, s, ha, h)#endif
arch/sandbox/include/asm/sections.h +2 -2
@@ -11,9 +11,9 @@#include <asm-generic/sections.h> -struct sb_cmdline_option ; +struct sandbox_cmdline_option ; -extern struct sb_cmdline_option *__u_boot_sandbox_option_start[], +extern struct sandbox_cmdline_option *__u_boot_sandbox_option_start[], *__u_boot_sandbox_option_end[];static inline size_t __u_boot_sandbox_option_count (void )
Signature · 1 line
1.8.4.1
PATCH v2 2/6 spi_flash: Add spi_flash_probe_fdt() to locate SPI by FDT node
This allows us to put the SPI flash chip inside the SPI interface node, with U-Boot finding the correct bus and chip select automatically.
---
Changes in v2:
- Adjust FDT interface to keep it wholely within the FDT domain
drivers/misc/cros_ec_spi.c | 3 +-- drivers/mtd/spi/sf_probe.c | 25 +++++++++++++++++++++---- drivers/spi/exynos_spi.c | 10 +++++----- drivers/spi/spi.c | 19 +++++++++++++++++++ include/configs/exynos5250-dt.h | 1 + include/spi.h | 23 +++++++++++++++++------ include/spi_flash.h | 13 +++++++++++++ 7 files changed, 77 insertions(+), 17 deletions(-)
drivers/misc/cros_ec_spi.c +1 -2
@@ -135,8 +135,7 @@ int cros_ec_spi_decode_fdt(struct cros_ec_dev *dev, const void *blob)*/ int cros_ec_spi_init (struct cros_ec_dev *dev,const void *blob) { - dev->spi =spi_setup_slave_fdt (blob, dev->parent_node, - dev->cs, dev->max_frequency,0 ); + dev->spi =spi_setup_slave_fdt (blob, dev->parent_node, dev->node);if (!dev->spi) {debug ("%s: Could not setup SPI slave\n" , __func__);return -1 ;
drivers/mtd/spi/sf_probe.c +21 -4
@@ -285,16 +285,13 @@ int spi_flash_decode_fdt(const void *blob, struct spi_flash *flash) }#endif /* CONFIG_OF_CONTROL */ -struct spi_flash *spi_flash_probe (unsigned int bus,unsigned int cs, -unsigned int max_hz,unsigned int spi_mode) +static struct spi_flash *spi_flash_probe_slave (struct spi_slave *spi) { -struct spi_slave *spi;struct spi_flash *flash =NULL ;u8 idcode[5 ];int ret;/* Setup spi_slave */ - spi =spi_setup_slave (bus, cs, max_hz, spi_mode);if (!spi) {printf ("SF: Failed to set up slave\n" );return NULL ;
@@ -358,6 +355,26 @@ err_claim_bus:return NULL ; } +struct spi_flash *spi_flash_probe (unsigned int bus,unsigned int cs, +unsigned int max_hz,unsigned int spi_mode) +{ +struct spi_slave *spi; + + spi =spi_setup_slave (bus, cs, max_hz, spi_mode); +return spi_flash_probe_slave (spi); +} + +#ifdef CONFIG_OF_SPI_FLASH +struct spi_flash *spi_flash_probe_fdt (const void *blob,int slave_node, +int spi_node) +{ +struct spi_slave *spi; + + spi =spi_setup_slave_fdt (blob, slave_node, spi_node); +return spi_flash_probe_slave (spi); +} +#endif +void spi_flash_free (struct spi_flash *flash) {spi_free_slave (flash->spi);
drivers/spi/exynos_spi.c +5 -5
@@ -529,18 +529,18 @@ static int process_nodes(const void *blob, int node_list[], int count)* @param node SPI peripheral node to use * @return 0 if ok, -1 on error */ -struct spi_slave *spi_setup_slave_fdt (const void *blob,int node, -unsigned int cs,unsigned int max_hz,unsigned int mode) +struct spi_slave *spi_setup_slave_fdt (const void *blob,int slave_node, +int spi_node) {struct spi_bus *bus;unsigned int i;for (i =0 , bus = spi_bus; i < bus_count; i++, bus++) { -if (bus->node == node) -return spi_setup_slave (i, cs, max_hz, mode); +if (bus->node == spi_node) +return spi_base_setup_slave_fdt (blob, i, slave_node); } -debug ("%s: Failed to find bus node %d\n" , __func__, node); +debug ("%s: Failed to find bus node %d\n" , __func__, spi_node);return NULL ; }
drivers/spi/spi.c +19 -0
@@ -5,6 +5,7 @@*/ #include <common.h> +#include <fdtdec.h> #include <malloc.h> #include <spi.h>
@@ -37,3 +38,21 @@ void *spi_do_alloc_slave(int offset, int size, unsigned int bus,return ptr; } + +#ifdef CONFIG_OF_SPI +struct spi_slave *spi_base_setup_slave_fdt (const void *blob,int busnum, +int node) +{ +int cs, max_hz, mode =0 ; + + cs =fdtdec_get_int (blob, node,"reg" ,-1 ); + max_hz =fdtdec_get_int (blob, node,"spi-max-frequency" ,100000 ); +if (fdtdec_get_bool (blob, node,"spi-cpol" )) + mode |=SPI_CPOL ; +if (fdtdec_get_bool (blob, node,"spi-cpha" )) + mode |=SPI_CPHA ; +if (fdtdec_get_bool (blob, node,"spi-cs-high" )) + mode |=SPI_CS_HIGH ; +return spi_setup_slave (busnum, cs, max_hz, mode); +} +#endif
include/configs/exynos5250-dt.h +1 -0
@@ -276,6 +276,7 @@#define CONFIG_SF_DEFAULT_MODE SPI_MODE_0#define CONFIG_SF_DEFAULT_SPEED 50000000#define EXYNOS5_SPI_NUM_CONTROLLERS 5 +#define CONFIG_OF_SPI #endif #ifdef CONFIG_ENV_IS_IN_SPI_FLASH
include/spi.h +17 -6
@@ -259,13 +259,24 @@ static inline int spi_w8r8(struct spi_slave *slave, unsigned char byte)* spi_free_slave() to free it later. * * @param blob: Device tree blob -* @param node: SPI peripheral node to use -* @param cs: Chip select to use -* @param max_hz: Maximum SCK rate in Hz (0 for default) -* @param mode: Clock polarity, clock phase and other parameters +* @param slave_node: Slave node to use +* @param spi_node: SPI peripheral node to use * @return pointer to new spi_slave structure */ -struct spi_slave *spi_setup_slave_fdt (const void *blob,int node, -unsigned int cs,unsigned int max_hz,unsigned int mode); +struct spi_slave *spi_setup_slave_fdt (const void *blob,int slave_node, +int spi_node); + +/** +* spi_base_setup_slave_fdt() - helper function to set up a SPI slace +* +* This decodes SPI properties from the slave node to determine the +* chip select and SPI parameters. +* +* @blob: Device tree blob +* @busnum: Bus number to use +* @node: Device tree node for the SPI bus +*/ +struct spi_slave *spi_base_setup_slave_fdt (const void *blob,int busnum, +int node);#endif /* _SPI_H_ */
include/spi_flash.h +13 -0
@@ -67,6 +67,19 @@ struct spi_flash {struct spi_flash *spi_flash_probe (unsigned int bus,unsigned int cs,unsigned int max_hz,unsigned int spi_mode); + +/** +* Set up a new SPI flash from an fdt node +* +* @param blob Device tree blob +* @param slave_node Pointer to this SPI slave node in the device tree +* @param spi_node Cached pointer to the SPI interface this node belongs +* to +* @return 0 if ok, -1 on error +*/ +struct spi_flash *spi_flash_probe_fdt (const void *blob,int slave_node, +int spi_node); +void spi_flash_free (struct spi_flash *flash); static inline int spi_flash_read(struct spi_flash *flash, u32 offset,
Signature · 1 line
1.8.4.1
PATCH v2 3/6 spi: Add device tree binding for SPI bus
In reply to Simon GlassThis was obtained from Linux 3.12 commit 5e01dc7b26.
---
Changes in v2:
- Use entire Linux SPI binding
doc/device-tree-bindings/spi/spi-bus.txt | 92 ++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 doc/device-tree-bindings/spi/spi-bus.txt
doc/device-tree-bindings/spi/spi-bus.txt new file +92 -0
@@ -0,0 +1,92 @@ +SPI (Serial Peripheral Interface) busses + +SPI busses can be described with a node for the SPI master device +and a set of child nodes for each SPI slave on the bus. For this +discussion, it is assumed that the system's SPI controller is in +SPI master mode. This binding does not describe SPI controllers +in slave mode. + +The SPI master node requires the following properties: +- #address-cells - number of cells required to define a chip select + address on the SPI bus. +- #size-cells - should be zero. +- compatible - name of SPI bus controller following generic names + recommended practice. +- cs-gpios - (optional) gpios chip select. +No other properties are required in the SPI bus node. It is assumed +that a driver for an SPI bus device will understand that it is an SPI bus. +However, the binding does not attempt to define the specific method for +assigning chip select numbers. Since SPI chip select configuration is +flexible and non-standardized, it is left out of this binding with the +assumption that board specific platform code will be used to manage +chip selects. Individual drivers can define additional properties to +support describing the chip select layout. + +Optional property: +- num-cs : total number of chipselects + +If cs-gpios is used the number of chip select will automatically increased +with max(cs-gpios > hw cs) + +So if for example the controller has 2 CS lines, and the cs-gpios +property looks like this: + +cs-gpios = <&gpio1 0 0> <0> <&gpio1 1 0> <&gpio1 2 0>; + +Then it should be configured so that num_chipselect = 4 with the +following mapping: + +cs0 : &gpio1 0 0 +cs1 : native +cs2 : &gpio1 1 0 +cs3 : &gpio1 2 0 + +SPI slave nodes must be children of the SPI master node and can +contain the following properties. +- reg - (required) chip select address of device. +- compatible - (required) name of SPI device following generic names + recommended practice +- spi-max-frequency - (required) Maximum SPI clocking speed of device in Hz +- spi-cpol - (optional) Empty property indicating device requires + inverse clock polarity (CPOL) mode +- spi-cpha - (optional) Empty property indicating device requires + shifted clock phase (CPHA) mode +- spi-cs-high - (optional) Empty property indicating device requires + chip select active high +- spi-3wire - (optional) Empty property indicating device requires + 3-wire mode. +- spi-tx-bus-width - (optional) The bus width(number of data wires) that + used for MOSI. Defaults to 1 if not present. +- spi-rx-bus-width - (optional) The bus width(number of data wires) that + used for MISO. Defaults to 1 if not present. + +Some SPI controllers and devices support Dual and Quad SPI transfer mode. +It allows data in SPI system transfered in 2 wires(DUAL) or 4 wires(QUAD). +Now the value that spi-tx-bus-width and spi-rx-bus-width can receive is +only 1(SINGLE), 2(DUAL) and 4(QUAD). +Dual/Quad mode is not allowed when 3-wire mode is used. + +If a gpio chipselect is used for the SPI slave the gpio number will be passed +via the cs_gpio + +SPI example for an MPC5200 SPI bus: + spi at f00 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "fsl,mpc5200b-spi","fsl,mpc5200-spi"; + reg = <0xf00 0x20>; + interrupts = <2 13 0 2 14 0>; + interrupt-parent = <&mpc5200_pic>; + + ethernet-switch at 0 { + compatible = "micrel,ks8995m"; + spi-max-frequency = <1000000>; + reg = <0>; + }; + + codec at 1 { + compatible = "ti,tlv320aic26"; + spi-max-frequency = <100000>; + reg = <1>; + }; + };
Signature · 1 line
1.8.4.1
PATCH v2 4/6 sandbox: spi: Add SPI emulation bus
In reply to Simon GlassFrom: Mike Frysinger <[email protected]>
This adds a SPI framework for people to hook up simulated SPI clients.
---
Changes in v2: None
arch/sandbox/include/asm/config.h | 8 ++ arch/sandbox/include/asm/spi.h | 58 +++++++++++ arch/sandbox/include/asm/state.h | 9 ++ drivers/spi/Makefile | 1 + drivers/spi/sandbox_spi.c | 204 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 280 insertions(+) create mode 100644 arch/sandbox/include/asm/spi.h create mode 100644 drivers/spi/sandbox_spi.c
arch/sandbox/include/asm/config.h +8 -0
@@ -9,4 +9,12 @@#define CONFIG_SANDBOX_ARCH +/* Used by drivers/spi/sandbox_spi.c and arch/sandbox/include/asm/state.h */ +#ifndef CONFIG_SANDBOX_SPI_MAX_BUS +#define CONFIG_SANDBOX_SPI_MAX_BUS 1 +#endif +#ifndef CONFIG_SANDBOX_SPI_MAX_CS +#define CONFIG_SANDBOX_SPI_MAX_CS 10 +#endif +#endif
arch/sandbox/include/asm/spi.h new file +58 -0
58 lines not on this page · raw message
arch/sandbox/include/asm/state.h +9 -0
@@ -15,6 +15,11 @@ enum exit_type_id { STATE_EXIT_POWER_OFF, }; +struct sandbox_spi_info { +const char *spec; +const struct sandbox_spi_emu_ops *ops; +}; +/* The complete state of the test system */ struct sandbox_state {const char *cmd;/* Command to execute */
@@ -23,6 +28,10 @@ struct sandbox_state {const char *parse_err;/* Error to report from parsing */ int argc;/* Program arguments */ char **argv; + +/* Pointer to information for each SPI bus/cs */ +struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS ] + [CONFIG_SANDBOX_SPI_MAX_CS ]; };/**
drivers/spi/Makefile +1 -0
@@ -27,6 +27,7 @@ obj-$(CONFIG_MXC_SPI) += mxc_spi.o obj-$(CONFIG_MXS_SPI) += mxs_spi.o obj-$(CONFIG_OC_TINY_SPI) += oc_tiny_spi.o obj-$(CONFIG_OMAP3_SPI) += omap3_spi.o +obj-$(CONFIG_SANDBOX_SPI) += sandbox_spi.o obj-$(CONFIG_SOFT_SPI) += soft_spi.o obj-$(CONFIG_SH_SPI) += sh_spi.o obj-$(CONFIG_FSL_ESPI) += fsl_espi.o
drivers/spi/sandbox_spi.c new file +204 -0
204 lines not on this page · raw message
Signature · 1 line
1.8.4.1
PATCH v2 5/6 sandbox: spi: Add new SPI flash driver
In reply to Simon GlassFrom: Mike Frysinger <[email protected]>
This adds a SPI flash driver which simulates SPI flash clients. Currently supports the bare min that U-Boot requires: you can probe, read, erase, and write. Should be easy to extend to make it behave more exactly like a real SPI flash, but this is good enough to merge now.
sjg at chromium.org added a README and tidied up code a little. Added a required map_sysmem() for sandbox.
---
Changes in v2: None
board/sandbox/sandbox/README.sandbox | 54 ++++ doc/SPI/README.sandbox-spi | 64 +++++ drivers/mtd/spi/Makefile | 1 + drivers/mtd/spi/sandbox.c | 483 +++++++++++++++++++++++++++++++++++ drivers/mtd/spi/sf_internal.h | 1 + drivers/mtd/spi/sf_probe.c | 3 +- 6 files changed, 605 insertions(+), 1 deletion(-) create mode 100644 doc/SPI/README.sandbox-spi create mode 100644 drivers/mtd/spi/sandbox.c
board/sandbox/sandbox/README.sandbox +54 -0
@@ -31,6 +31,60 @@ the console. It does not set the terminal into raw mode, so cursor keys and history will not work yet. +SPI Emulation +------------- + +Sandbox supports SPI and SPI flash emulation. + +This is controlled by the spi_sf argument, the format of which is: + + bus:cs:device:file + + bus - SPI bus number + cs - SPI chip select number + device - SPI device emulation name + file - File on disk containing the data + +For example: + + dd if=/dev/zero of=spi.bin bs=1M count=4 + ./u-boot --spi_sf 0:0:M25P16:spi.bin + +With this setup you can issue SPI flash commands as normal: + +=>sf probe +SF: Detected M25P16 with page size 64 KiB, total 2 MiB +=>sf read 0 0 10000 +SF: 65536 bytes @ 0x0 Read: OK +=> + +Since this is a full SPI emulation (rather than just flash), you can +also use low-level SPI commands: + +=>sspi 0:0 32 9f +FF202015 + +This is issuing a READ_ID command and getting back 20 (ST Micro) part +0x2015 (the M25P16). + +Drivers are connected to a particular bus/cs using sandbox's state +structure (see the 'spi' member). A set of operations must be provided +for each driver. + + +Configuration settings for the curious are: + +CONFIG_SANDBOX_SPI_MAX_BUS + The maximum number of SPI buses supported by the driver (default 1). + +CONFIG_SANDBOX_SPI_MAX_CS + The maximum number of chip selects supported by the driver + (default 10). + +CONFIG_SPI_IDLE_VAL + The idle value on the SPI bus + + Tests -----
doc/SPI/README.sandbox-spi new file +64 -0
64 lines not on this page · raw message
drivers/mtd/spi/Makefile +1 -0
@@ -13,4 +13,5 @@ endif obj-$(CONFIG_CMD_SF) += sf.o obj-$(CONFIG_SPI_FLASH) += sf_probe.o sf_ops.o obj-$(CONFIG_SPI_FRAM_RAMTRON) += ramtron.o +obj-$(CONFIG_SPI_FLASH_SANDBOX) += sandbox.o obj-$(CONFIG_SPI_M95XXX) += eeprom_m95xxx.o
drivers/mtd/spi/sandbox.c new file +483 -0
483 lines not on this page · raw message
drivers/mtd/spi/sf_internal.h +1 -0
@@ -28,6 +28,7 @@#define CMD_PAGE_PROGRAM 0x02#define CMD_WRITE_DISABLE 0x04#define CMD_READ_STATUS 0x05 +#define CMD_READ_STATUS1 0x35#define CMD_WRITE_ENABLE 0x06#define CMD_READ_CONFIG 0x35#define CMD_FLAG_STATUS 0x70
drivers/mtd/spi/sf_probe.c +2 -1
@@ -13,6 +13,7 @@#include <malloc.h> #include <spi.h> #include <spi_flash.h> +#include <asm/io.h> #include "sf_internal.h"
@@ -279,7 +280,7 @@ int spi_flash_decode_fdt(const void *blob, struct spi_flash *flash)debug ("%s: Memory map must cover entire device\n" , __func__);return -1 ; } - flash->memory_map = (void *)addr; + flash->memory_map =map_sysmem (addr, size);return 0 ; }
Signature · 1 line
1.8.4.1
PATCH v2 6/6 sandbox: spi: Enable new spi/sf layers
In reply to Simon GlassFrom: Mike Frysinger <[email protected]>
We want to test SPI flash code in the sandbox, so enable the new drivers and the 'sf test' command.
This command is used to validate the sandbox SPI / SPI flash implementation, so enable it.
---
We can perform SPI flash operations in sandbox now:
./u-boot --spi_sf 0:0:W25Q128:b/chromeos_sandbox/out/image.bin
=>sf probe
SF: Detected W25Q128 with page size 4 KiB, total 16 MiB =>sf test 0 100000
SPI flash test:
0 erase: 1 ticks, 1024000 KiB/s 8192.000 Mbps 1 check: 4 ticks, 256000 KiB/s 2048.000 Mbps
2 write: 6 ticks, 170666 KiB/s 1365.328 Mbps
3 read: 0 ticks, 1048576000 KiB/s -201326.-592 Mbps Test passed
0 erase: 1 ticks, 1024000 KiB/s 8192.000 Mbps 1 check: 4 ticks, 256000 KiB/s 2048.000 Mbps
2 write: 6 ticks, 170666 KiB/s 1365.328 Mbps
3 read: 0 ticks, 1048576000 KiB/s -201326.-592 Mbps =>
Changes in v2:
- Add test to commit message
include/configs/sandbox.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
include/configs/sandbox.h +10 -0
@@ -71,6 +71,16 @@#define CONFIG_ENV_SIZE 8192#define CONFIG_ENV_IS_NOWHERE +/* SPI */ +#define CONFIG_SANDBOX_SPI +#define CONFIG_CMD_SF +#define CONFIG_CMD_SF_TEST +#define CONFIG_CMD_SPI +#define CONFIG_SPI_FLASH +#define CONFIG_SPI_FLASH_SANDBOX +#define CONFIG_SPI_FLASH_STMICRO +#define CONFIG_SPI_FLASH_WINBOND +/* Memory things - we don't really want a memory test */ #define CONFIG_SYS_LOAD_ADDR 0x00000000#define CONFIG_SYS_MEMTEST_START 0x00100000
Signature · 1 line
1.8.4.1