host_soc.c (c09c9dd2e9c732658c744a802101d5c34fedde22) host_soc.c (541c9a84cd85203244307d9ebb821102eed82789)
1/*
2 * Sonics Silicon Backplane SoC host related functions.
3 * Subsystem core
4 *
5 * Copyright 2005, Broadcom Corporation
6 * Copyright 2006, 2007, Michael Buesch <m@bues.ch>
7 *
8 * Licensed under the GNU/GPL. See COPYING for details.
9 */
10
1/*
2 * Sonics Silicon Backplane SoC host related functions.
3 * Subsystem core
4 *
5 * Copyright 2005, Broadcom Corporation
6 * Copyright 2006, 2007, Michael Buesch <m@bues.ch>
7 *
8 * Licensed under the GNU/GPL. See COPYING for details.
9 */
10
11#include <linux/bcm47xx_nvram.h>
11#include <linux/ssb/ssb.h>
12
13#include "ssb_private.h"
14
15static u8 ssb_host_soc_read8(struct ssb_device *dev, u16 offset)
16{
17 struct ssb_bus *bus = dev->bus;
18

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

166 .write8 = ssb_host_soc_write8,
167 .write16 = ssb_host_soc_write16,
168 .write32 = ssb_host_soc_write32,
169#ifdef CONFIG_SSB_BLOCKIO
170 .block_read = ssb_host_soc_block_read,
171 .block_write = ssb_host_soc_block_write,
172#endif
173};
12#include <linux/ssb/ssb.h>
13
14#include "ssb_private.h"
15
16static u8 ssb_host_soc_read8(struct ssb_device *dev, u16 offset)
17{
18 struct ssb_bus *bus = dev->bus;
19

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

167 .write8 = ssb_host_soc_write8,
168 .write16 = ssb_host_soc_write16,
169 .write32 = ssb_host_soc_write32,
170#ifdef CONFIG_SSB_BLOCKIO
171 .block_read = ssb_host_soc_block_read,
172 .block_write = ssb_host_soc_block_write,
173#endif
174};
175
176int ssb_host_soc_get_invariants(struct ssb_bus *bus,
177 struct ssb_init_invariants *iv)
178{
179 char buf[20];
180 int len, err;
181
182 /* Fill boardinfo structure */
183 memset(&iv->boardinfo, 0, sizeof(struct ssb_boardinfo));
184
185 len = bcm47xx_nvram_getenv("boardvendor", buf, sizeof(buf));
186 if (len > 0) {
187 err = kstrtou16(strim(buf), 0, &iv->boardinfo.vendor);
188 if (err)
189 pr_warn("Couldn't parse nvram board vendor entry with value \"%s\"\n",
190 buf);
191 }
192 if (!iv->boardinfo.vendor)
193 iv->boardinfo.vendor = SSB_BOARDVENDOR_BCM;
194
195 len = bcm47xx_nvram_getenv("boardtype", buf, sizeof(buf));
196 if (len > 0) {
197 err = kstrtou16(strim(buf), 0, &iv->boardinfo.type);
198 if (err)
199 pr_warn("Couldn't parse nvram board type entry with value \"%s\"\n",
200 buf);
201 }
202
203 memset(&iv->sprom, 0, sizeof(struct ssb_sprom));
204 ssb_fill_sprom_with_fallback(bus, &iv->sprom);
205
206 if (bcm47xx_nvram_getenv("cardbus", buf, sizeof(buf)) >= 0)
207 iv->has_cardbus_slot = !!simple_strtoul(buf, NULL, 10);
208
209 return 0;
210}