sandbox.c (3d5ced9e22d32112a20f9dc0f5fb1f22ef088079) sandbox.c (a58986ca8b53d8c7a441397082f84edc7f47d19f)
1/*
2 * Simulate a SPI flash
3 *
4 * Copyright (c) 2011-2013 The Chromium OS Authors.
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
8 * Licensed under the GPL-2 or later.

--- 43 unchanged lines hidden (view full) ---

52 };
53 return states[state];
54}
55#endif /* LOG */
56
57/* Bits for the status register */
58#define STAT_WIP (1 << 0)
59#define STAT_WEL (1 << 1)
1/*
2 * Simulate a SPI flash
3 *
4 * Copyright (c) 2011-2013 The Chromium OS Authors.
5 * See file CREDITS for list of people who contributed to this
6 * project.
7 *
8 * Licensed under the GPL-2 or later.

--- 43 unchanged lines hidden (view full) ---

52 };
53 return states[state];
54}
55#endif /* LOG */
56
57/* Bits for the status register */
58#define STAT_WIP (1 << 0)
59#define STAT_WEL (1 << 1)
60#define STAT_BP_SHIFT 2
61#define STAT_BP_MASK (7 << STAT_BP_SHIFT)
60
61/* Assume all SPI flashes have 3 byte addresses since they do atm */
62#define SF_ADDR_LEN 3
63
64#define IDCODE_LEN 3
65
66/* Used to quickly bulk erase backing store */
67static u8 sandbox_sf_0xff[0x1000];

--- 29 unchanged lines hidden (view full) ---

97
98struct sandbox_spi_flash_plat_data {
99 const char *filename;
100 const char *device_name;
101 int bus;
102 int cs;
103};
104
62
63/* Assume all SPI flashes have 3 byte addresses since they do atm */
64#define SF_ADDR_LEN 3
65
66#define IDCODE_LEN 3
67
68/* Used to quickly bulk erase backing store */
69static u8 sandbox_sf_0xff[0x1000];

--- 29 unchanged lines hidden (view full) ---

99
100struct sandbox_spi_flash_plat_data {
101 const char *filename;
102 const char *device_name;
103 int bus;
104 int cs;
105};
106
107void sandbox_sf_set_block_protect(struct udevice *dev, int bp_mask)
108{
109 struct sandbox_spi_flash *sbsf = dev_get_priv(dev);
110
111 sbsf->status &= ~STAT_BP_MASK;
112 sbsf->status |= bp_mask << STAT_BP_SHIFT;
113}
114
105/**
106 * This is a very strange probe function. If it has platform data (which may
107 * have come from the device tree) then this function gets the filename and
108 * device type from there.
109 */
110static int sandbox_sf_probe(struct udevice *dev)
111{
112 /* spec = idcode:file */

--- 485 unchanged lines hidden ---
115/**
116 * This is a very strange probe function. If it has platform data (which may
117 * have come from the device tree) then this function gets the filename and
118 * device type from there.
119 */
120static int sandbox_sf_probe(struct udevice *dev)
121{
122 /* spec = idcode:file */

--- 485 unchanged lines hidden ---