diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2011-12-05 13:13:39 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-12-06 16:07:07 -0500 |
commit | 439678f8b0fca7aeca06c6581e3679eef618721a (patch) | |
tree | 3a447b563f90144306c9548456e48cb37edd56d7 /drivers/bcma | |
parent | 3df6eaea76a9e1351b539541c0314129a0e4b10c (diff) |
bcma: pci: use fixed windows when possible
Some cores are mapped in the fixed way, they registers can be accessed
all the time.
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/bcma')
-rw-r--r-- | drivers/bcma/host_pci.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/drivers/bcma/host_pci.c b/drivers/bcma/host_pci.c index 1b51d8b7ac80..b0994c0e05dc 100644 --- a/drivers/bcma/host_pci.c +++ b/drivers/bcma/host_pci.c | |||
@@ -21,48 +21,58 @@ static void bcma_host_pci_switch_core(struct bcma_device *core) | |||
21 | pr_debug("Switched to core: 0x%X\n", core->id.id); | 21 | pr_debug("Switched to core: 0x%X\n", core->id.id); |
22 | } | 22 | } |
23 | 23 | ||
24 | static u8 bcma_host_pci_read8(struct bcma_device *core, u16 offset) | 24 | /* Provides access to the requested core. Returns base offset that has to be |
25 | * used. It makes use of fixed windows when possible. */ | ||
26 | static u16 bcma_host_pci_provide_access_to_core(struct bcma_device *core) | ||
25 | { | 27 | { |
28 | switch (core->id.id) { | ||
29 | case BCMA_CORE_CHIPCOMMON: | ||
30 | return 3 * BCMA_CORE_SIZE; | ||
31 | case BCMA_CORE_PCIE: | ||
32 | return 2 * BCMA_CORE_SIZE; | ||
33 | } | ||
34 | |||
26 | if (core->bus->mapped_core != core) | 35 | if (core->bus->mapped_core != core) |
27 | bcma_host_pci_switch_core(core); | 36 | bcma_host_pci_switch_core(core); |
37 | return 0; | ||
38 | } | ||
39 | |||
40 | static u8 bcma_host_pci_read8(struct bcma_device *core, u16 offset) | ||
41 | { | ||
42 | offset += bcma_host_pci_provide_access_to_core(core); | ||
28 | return ioread8(core->bus->mmio + offset); | 43 | return ioread8(core->bus->mmio + offset); |
29 | } | 44 | } |
30 | 45 | ||
31 | static u16 bcma_host_pci_read16(struct bcma_device *core, u16 offset) | 46 | static u16 bcma_host_pci_read16(struct bcma_device *core, u16 offset) |
32 | { | 47 | { |
33 | if (core->bus->mapped_core != core) | 48 | offset += bcma_host_pci_provide_access_to_core(core); |
34 | bcma_host_pci_switch_core(core); | ||
35 | return ioread16(core->bus->mmio + offset); | 49 | return ioread16(core->bus->mmio + offset); |
36 | } | 50 | } |
37 | 51 | ||
38 | static u32 bcma_host_pci_read32(struct bcma_device *core, u16 offset) | 52 | static u32 bcma_host_pci_read32(struct bcma_device *core, u16 offset) |
39 | { | 53 | { |
40 | if (core->bus->mapped_core != core) | 54 | offset += bcma_host_pci_provide_access_to_core(core); |
41 | bcma_host_pci_switch_core(core); | ||
42 | return ioread32(core->bus->mmio + offset); | 55 | return ioread32(core->bus->mmio + offset); |
43 | } | 56 | } |
44 | 57 | ||
45 | static void bcma_host_pci_write8(struct bcma_device *core, u16 offset, | 58 | static void bcma_host_pci_write8(struct bcma_device *core, u16 offset, |
46 | u8 value) | 59 | u8 value) |
47 | { | 60 | { |
48 | if (core->bus->mapped_core != core) | 61 | offset += bcma_host_pci_provide_access_to_core(core); |
49 | bcma_host_pci_switch_core(core); | ||
50 | iowrite8(value, core->bus->mmio + offset); | 62 | iowrite8(value, core->bus->mmio + offset); |
51 | } | 63 | } |
52 | 64 | ||
53 | static void bcma_host_pci_write16(struct bcma_device *core, u16 offset, | 65 | static void bcma_host_pci_write16(struct bcma_device *core, u16 offset, |
54 | u16 value) | 66 | u16 value) |
55 | { | 67 | { |
56 | if (core->bus->mapped_core != core) | 68 | offset += bcma_host_pci_provide_access_to_core(core); |
57 | bcma_host_pci_switch_core(core); | ||
58 | iowrite16(value, core->bus->mmio + offset); | 69 | iowrite16(value, core->bus->mmio + offset); |
59 | } | 70 | } |
60 | 71 | ||
61 | static void bcma_host_pci_write32(struct bcma_device *core, u16 offset, | 72 | static void bcma_host_pci_write32(struct bcma_device *core, u16 offset, |
62 | u32 value) | 73 | u32 value) |
63 | { | 74 | { |
64 | if (core->bus->mapped_core != core) | 75 | offset += bcma_host_pci_provide_access_to_core(core); |
65 | bcma_host_pci_switch_core(core); | ||
66 | iowrite32(value, core->bus->mmio + offset); | 76 | iowrite32(value, core->bus->mmio + offset); |
67 | } | 77 | } |
68 | 78 | ||