1 From: Nathan Williams <nathan@traverse.com.au>
2 To: netdev@vger.kernel.org
3 Date: Wed, 05 Oct 2011 15:43:30 +1100
4 Cc: linux-atm-general@lists.sourceforge.net,
5 David Woodhouse <dwmw2@infradead.org>, linux-kernel@vger.kernel.org
6 Subject: [Linux-ATM-General] [PATCH 1/4] atm: solos-pci: Add AnnexA/M
9 BisACapability and BisMCapability allow users to
10 force either Annex A or Annex M.
12 Signed-off-by: Nathan Williams <nathan@traverse.com.au>
14 drivers/atm/solos-attrlist.c | 2 ++
15 1 files changed, 2 insertions(+), 0 deletions(-)
17 diff --git a/drivers/atm/solos-attrlist.c b/drivers/atm/solos-attrlist.c
18 index 9a676ee..8092533 100644
19 --- a/drivers/atm/solos-attrlist.c
20 +++ b/drivers/atm/solos-attrlist.c
21 @@ -71,6 +71,8 @@ SOLOS_ATTR_RW(BisAForceSNRMarginDn)
22 SOLOS_ATTR_RW(BisMForceSNRMarginDn)
23 SOLOS_ATTR_RW(BisAMaxMargin)
24 SOLOS_ATTR_RW(BisMMaxMargin)
25 +SOLOS_ATTR_RW(BisACapability)
26 +SOLOS_ATTR_RW(BisMCapability)
27 SOLOS_ATTR_RW(AnnexAForceSNRMarginDn)
28 SOLOS_ATTR_RW(AnnexAMaxMargin)
29 SOLOS_ATTR_RW(AnnexMMaxMargin)
31 From: Nathan Williams <nathan@traverse.com.au>
32 To: netdev@vger.kernel.org
33 Date: Wed, 05 Oct 2011 15:44:17 +1100
34 Cc: linux-atm-general@lists.sourceforge.net,
35 David Woodhouse <dwmw2@infradead.org>, linux-kernel@vger.kernel.org
36 Subject: [Linux-ATM-General] [PATCH 2/4] atm: solos-pci: Remove annoying
39 "len: %d" isn't particularly useful for anyone and confuses users.
41 Signed-off-by: Nathan Williams <nathan@traverse.com.au>
43 drivers/atm/solos-pci.c | 1 -
44 1 files changed, 0 insertions(+), 1 deletions(-)
46 diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
47 index 5d1d076..bd01aa3 100644
48 --- a/drivers/atm/solos-pci.c
49 +++ b/drivers/atm/solos-pci.c
50 @@ -452,7 +452,6 @@ static ssize_t console_show(struct device *dev, struct device_attribute *attr,
53 memcpy(buf, skb->data, len);
54 - dev_dbg(&card->dev->dev, "len: %d\n", len);
58 From: Nathan Williams <nathan@traverse.com.au>
59 To: netdev@vger.kernel.org
60 Date: Wed, 05 Oct 2011 15:45:15 +1100
61 Cc: linux-atm-general@lists.sourceforge.net,
62 David Woodhouse <dwmw2@infradead.org>, linux-kernel@vger.kernel.org
63 Subject: [Linux-ATM-General] [PATCH 3/4] atm: solos-pci: Add support for
66 Geos ADSL2+ routers have on-board Solos chipsets with some
67 extra I/O pins and a push button connected to the FPGA.
69 PCB version and variant numbers are also made available
70 through the HardwareVersion and HardwareVariant attributes.
72 Signed-off-by: Nathan Williams <nathan@traverse.com.au>
74 drivers/atm/solos-pci.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++
75 1 files changed, 98 insertions(+), 0 deletions(-)
77 diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
78 index bd01aa3..33c0c2b 100644
79 --- a/drivers/atm/solos-pci.c
80 +++ b/drivers/atm/solos-pci.c
82 #define FLASH_BUSY 0x60
83 #define FPGA_MODE 0x5C
84 #define FLASH_MODE 0x58
85 +#define GPIO_STATUS 0x54
86 #define TX_DMA_ADDR(port) (0x40 + (4 * (port)))
87 #define RX_DMA_ADDR(port) (0x30 + (4 * (port)))
89 @@ -498,6 +499,87 @@ static ssize_t console_store(struct device *dev, struct device_attribute *attr,
98 +static struct geos_gpio geos_gpio_pins[] = {
104 + {"PushButton", 14},
108 +static ssize_t geos_gpio_store(struct device *dev, struct device_attribute *attr,
109 + const char *buf, size_t count)
111 + struct atm_dev *atmdev = container_of(dev, struct atm_dev, class_dev);
112 + struct solos_card *card = atmdev->dev_data;
115 + struct geos_gpio *p = geos_gpio_pins;
117 + if(!strcmp(attr->attr.name, p->name)){
123 + data32 = ioread32(card->config_regs + GPIO_STATUS);
125 + data32 |= 1 << p->offset;
126 + iowrite32(data32, card->config_regs + GPIO_STATUS);
127 + } else if(buf[0] == '0') {
128 + data32 &= ~(1 << p->offset);
129 + iowrite32(data32, card->config_regs + GPIO_STATUS);
134 +static ssize_t geos_gpio_show(struct device *dev, struct device_attribute *attr,
137 + struct atm_dev *atmdev = container_of(dev, struct atm_dev, class_dev);
138 + struct solos_card *card = atmdev->dev_data;
141 + struct geos_gpio *p = geos_gpio_pins;
143 + if(!strcmp(attr->attr.name, p->name)){
149 + data32 = ioread32(card->config_regs + GPIO_STATUS);
150 + data32 = (data32 >> p->offset) & 1;
152 + return sprintf(buf, "%d\n", data32);
155 +static ssize_t hardware_show(struct device *dev, struct device_attribute *attr,
158 + struct atm_dev *atmdev = container_of(dev, struct atm_dev, class_dev);
159 + struct solos_card *card = atmdev->dev_data;
162 + data32 = ioread32(card->config_regs + GPIO_STATUS);
163 + if(!strcmp(attr->attr.name, "HardwareVersion")){
164 + data32 = data32 & 0x1F;
165 + return sprintf(buf, "%d\n", data32);
166 + } else if(!strcmp(attr->attr.name, "HardwareVariant")){
167 + data32 = (data32 >> 5) & 0x0F;
168 + return sprintf(buf, "%d\n", data32);
171 + return sprintf(buf, "Error\n");
174 static DEVICE_ATTR(console, 0644, console_show, console_store);
177 @@ -506,6 +588,14 @@ static DEVICE_ATTR(console, 0644, console_show, console_store);
179 #include "solos-attrlist.c"
181 +static DEVICE_ATTR(GPIO1, 0644, geos_gpio_show, geos_gpio_store);
182 +static DEVICE_ATTR(GPIO2, 0644, geos_gpio_show, geos_gpio_store);
183 +static DEVICE_ATTR(GPIO3, 0644, geos_gpio_show, geos_gpio_store);
184 +static DEVICE_ATTR(GPIO4, 0644, geos_gpio_show, geos_gpio_store);
185 +static DEVICE_ATTR(GPIO5, 0644, geos_gpio_show, geos_gpio_store);
186 +static DEVICE_ATTR(PushButton, 0444, geos_gpio_show, NULL);
187 +static DEVICE_ATTR(HardwareVersion, 0444, hardware_show, NULL);
188 +static DEVICE_ATTR(HardwareVariant, 0444, hardware_show, NULL);
192 @@ -514,6 +604,14 @@ static DEVICE_ATTR(console, 0644, console_show, console_store);
194 static struct attribute *solos_attrs[] = {
195 #include "solos-attrlist.c"
196 + &dev_attr_GPIO1.attr,
197 + &dev_attr_GPIO2.attr,
198 + &dev_attr_GPIO3.attr,
199 + &dev_attr_GPIO4.attr,
200 + &dev_attr_GPIO5.attr,
201 + &dev_attr_PushButton.attr,
202 + &dev_attr_HardwareVersion.attr,
203 + &dev_attr_HardwareVariant.attr,
207 From: Nathan Williams <nathan@traverse.com.au>
208 To: netdev@vger.kernel.org
209 Date: Wed, 05 Oct 2011 15:46:08 +1100
210 Cc: linux-atm-general@lists.sourceforge.net,
211 David Woodhouse <dwmw2@infradead.org>, linux-kernel@vger.kernel.org
212 Subject: [Linux-ATM-General] [PATCH 4/4] atm: solos-pci: M25P/M25PE SPI
215 Newer Geos ADSL2+ routers have different SPI flash.
216 The FPGA on these boards require driver version = 1 to enable
217 flash upgrades so old drivers can't corrupt new boards.
219 Signed-off-by: Nathan Williams <nathan@traverse.com.au>
221 drivers/atm/solos-pci.c | 51 ++++++++++++++++++++++++++++++++++++----------
222 1 files changed, 40 insertions(+), 11 deletions(-)
224 diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
225 index 33c0c2b..2a75bf7 100644
226 --- a/drivers/atm/solos-pci.c
227 +++ b/drivers/atm/solos-pci.c
229 #include <linux/swab.h>
230 #include <linux/slab.h>
232 -#define VERSION "0.07"
233 +#define VERSION "1.0"
234 +#define DRIVER_VERSION 0x01
235 #define PTAG "solos-pci"
237 #define CONFIG_RAM_SIZE 128
239 #define FPGA_MODE 0x5C
240 #define FLASH_MODE 0x58
241 #define GPIO_STATUS 0x54
242 +#define DRIVER_VER 0x50
243 #define TX_DMA_ADDR(port) (0x40 + (4 * (port)))
244 #define RX_DMA_ADDR(port) (0x30 + (4 * (port)))
246 #define DATA_RAM_SIZE 32768
247 #define BUF_SIZE 2048
248 #define OLD_BUF_SIZE 4096 /* For FPGA versions <= 2*/
249 -#define FPGA_PAGE 528 /* FPGA flash page size*/
250 -#define SOLOS_PAGE 512 /* Solos flash page size*/
251 -#define FPGA_BLOCK (FPGA_PAGE * 8) /* FPGA flash block size*/
252 -#define SOLOS_BLOCK (SOLOS_PAGE * 8) /* Solos flash block size*/
253 +/* Old boards use ATMEL AD45DB161D flash */
254 +#define ATMEL_FPGA_PAGE 528 /* FPGA flash page size*/
255 +#define ATMEL_SOLOS_PAGE 512 /* Solos flash page size*/
256 +#define ATMEL_FPGA_BLOCK (ATMEL_FPGA_PAGE * 8) /* FPGA block size*/
257 +#define ATMEL_SOLOS_BLOCK (ATMEL_SOLOS_PAGE * 8) /* Solos block size*/
258 +/* Current boards use M25P/M25PE SPI flash */
259 +#define SPI_FLASH_BLOCK (256 * 64)
261 #define RX_BUF(card, nr) ((card->buffers) + (nr)*(card->buffer_size)*2)
262 #define TX_BUF(card, nr) ((card->buffers) + (nr)*(card->buffer_size)*2 + (card->buffer_size))
263 @@ -128,6 +133,7 @@ struct solos_card {
271 @@ -631,16 +637,25 @@ static int flash_upgrade(struct solos_card *card, int chip)
274 fw_name = "solos-FPGA.bin";
275 - blocksize = FPGA_BLOCK;
276 + if (card->atmel_flash)
277 + blocksize = ATMEL_FPGA_BLOCK;
279 + blocksize = SPI_FLASH_BLOCK;
282 fw_name = "solos-Firmware.bin";
283 - blocksize = SOLOS_BLOCK;
284 + if (card->atmel_flash)
285 + blocksize = ATMEL_SOLOS_BLOCK;
287 + blocksize = SPI_FLASH_BLOCK;
290 if (card->fpga_version > LEGACY_BUFFERS){
291 fw_name = "solos-db-FPGA.bin";
292 - blocksize = FPGA_BLOCK;
293 + if (card->atmel_flash)
294 + blocksize = ATMEL_FPGA_BLOCK;
296 + blocksize = SPI_FLASH_BLOCK;
298 dev_info(&card->dev->dev, "FPGA version doesn't support"
299 " daughter board upgrades\n");
300 @@ -650,7 +665,10 @@ static int flash_upgrade(struct solos_card *card, int chip)
302 if (card->fpga_version > LEGACY_BUFFERS){
303 fw_name = "solos-Firmware.bin";
304 - blocksize = SOLOS_BLOCK;
305 + if (card->atmel_flash)
306 + blocksize = ATMEL_SOLOS_BLOCK;
308 + blocksize = SPI_FLASH_BLOCK;
310 dev_info(&card->dev->dev, "FPGA version doesn't support"
311 " daughter board upgrades\n");
312 @@ -695,9 +713,13 @@ static int flash_upgrade(struct solos_card *card, int chip)
313 /* dev_info(&card->dev->dev, "Set FPGA Flash mode to Block Write\n"); */
314 iowrite32(((chip * 2) + 1), card->config_regs + FLASH_MODE);
316 - /* Copy block to buffer, swapping each 16 bits */
317 + /* Copy block to buffer, swapping each 16 bits for Atmel flash */
318 for(i = 0; i < blocksize; i += 4) {
319 - uint32_t word = swahb32p((uint32_t *)(fw->data + offset + i));
321 + if (card->atmel_flash)
322 + word = swahb32p((uint32_t *)(fw->data + offset + i));
324 + word = *(uint32_t *)(fw->data + offset + i);
325 if(card->fpga_version > LEGACY_BUFFERS)
326 iowrite32(word, FLASH_BUF + i);
328 @@ -1249,6 +1271,11 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id)
329 db_fpga_upgrade = db_firmware_upgrade = 0;
332 + /* Stopped using Atmel flash after 0.03-38 */
334 + card->atmel_flash = 1;
336 + card->atmel_flash = 0;
337 if (card->fpga_version >= DMA_SUPPORTED){
340 @@ -1256,6 +1283,8 @@ static int fpga_probe(struct pci_dev *dev, const struct pci_device_id *id)
341 /* Set RX empty flag for all ports */
342 iowrite32(0xF0, card->config_regs + FLAGS_ADDR);
344 + /* New FPGAs require driver version before permitting flash upgrades */
345 + iowrite32(DRIVER_VERSION, card->config_regs + DRIVER_VER);
347 data32 = ioread32(card->config_regs + PORTS);
348 card->nr_ports = (data32 & 0x000000FF);