Re: [PATCH] Add stlc45xx, wi-fi driver for stlc4550/4560

2008-12-07 Thread Johannes Berg
On Sat, 2008-12-06 at 19:32 +0200, Kalle Valo wrote:


 +static const u8 default_cal_channels[] = {
 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x09,
 + 0x00, 0x00, 0xc9, 0xff, 0xd8, 0xff, 0x00, 0x00, 0x00, 0x01, 0x10,
 + 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0xe0, 0x00, 0xe0, 0x00,
 + 0xe0, 0x00, 0xe0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0,
 + 0x00, 0x54, 0x01, 0xab, 0xf6, 0xc0, 0x42, 0xc0, 0x42, 0xc0, 0x42,
 + 0xc0, 0x42, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00,
 + 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x22, 0x01, 0x37, 0xa9,
 + 0xc0, 0x33, 0xc0, 0x33, 0xc0, 0x33, 0xc0, 0x33, 0x00, 0xbc, 0x00,
 + 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc,
 + 0x00, 0xbc, 0xfb, 0x00, 0xca, 0x79, 0xc0, 0x2b, 0xc0, 0x2b, 0xc0,
 + 0x2b, 0xc0, 0x2b, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4,
 + 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0xd0, 0x00, 0x5d,
 + 0x54, 0xc0, 0x21, 0xc0, 0x21, 0xc0, 0x21, 0xc0, 0x21, 0x00, 0xaa,
 + 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x00,
 + 0xaa, 0x00, 0xaa, 0xa7, 0x00, 0xa9, 0x3d, 0xc0, 0x17, 0xc0, 0x17,
 + 0xc0, 0x17, 0xc0, 0x17, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00,
 + 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x00, 0xa0, 0x7a, 0x00,
 + 0x06, 0x2c, 0xc0, 0x0d, 0xc0, 0x0d, 0xc0, 0x0d, 0xc0, 0x0d, 0x00,
 + 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96, 0x00, 0x96,
 + 0x00, 0x96, 0x00, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 + 0x00, 0x00, 0x06, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 + 0x00, 0x00, 0x00, 0x00, 0x71, 0x09, 0x00, 0x00, 0xc9, 0xff, 0xd8,
 + 0xff, 0x00, 0x00, 0x00, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
 + 0x10, 0x01, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xd0,
 + 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0x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x00,
 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80,
 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76,
 + 0x09, 0x00, 0x00, 0xc9, 0xff, 0xd8, 0xff, 0x00, 0x00, 0x00, 0x01,
 + 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0xf0, 0x00, 0xf0,
 + 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
 + 0xd0, 0x00, 0x54, 0x01, 0xab, 0xf6, 0xc0, 0x42, 0xc0, 0x42, 0xc0,
 + 0x42, 0xc0, 0x42, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb,
 + 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x00, 0xcb, 0x22, 0x01, 0x37,
 + 0xa9, 0xc0, 0x33, 0xc0, 0x33, 0xc0, 0x33, 0xc0, 0x33, 0x00, 0xbc,
 + 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00, 0xbc, 0x00,
 + 0xbc, 0x00, 0xbc, 0xfb, 0x00, 0xca, 0x79, 0xc0, 0x2b, 0xc0, 0x2b,
 + 0xc0, 0x2b, 0xc0, 0x2b, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00,
 + 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0x00, 0xb4, 0xd0, 0x00,
 + 0x5d, 0x54, 0xc0, 0x21, 0xc0, 0x21, 0xc0, 0x21, 0xc0, 0x21, 0x00,
 + 

Re: [PATCH] Add stlc45xx, wi-fi driver for stlc4550/4560

2008-12-07 Thread Kalle Valo
Johannes Berg [EMAIL PROTECTED] writes:

 On Sat, 2008-12-06 at 19:32 +0200, Kalle Valo wrote:


 +static const u8 default_cal_channels[] = {
 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 +0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x09,

[...]

 +0x00 };
 +
 +static const u8 default_cal_rssi[] = {
 +0x0a, 0x01, 0x72, 0xfe, 0x1a, 0x00, 0x00, 0x00, 0x0a, 0x01, 0x72,

[...]

 +0x00, 0x00, 0x00, 0x00, 0x00 };

 Is this data actually usable?

Yes, it is. I tested it yesterday and it works ok.

 The static data in cx3110x didn't even parse correctly iirc.

I don't even remember cx3110x having any static calibration data,
wlan-cal provided it always. But then again I haven't looked at
cx3110x for a long time, I might remember wrong.

 +static void stlc45xx_tx_edcf(struct stlc45xx *stlc);
 +static void stlc45xx_tx_setup(struct stlc45xx *stlc);
 +static void stlc45xx_tx_scan(struct stlc45xx *stlc);
 +static void stlc45xx_tx_psm(struct stlc45xx *stlc, bool enable);
 +static int stlc45xx_tx_nullfunc(struct stlc45xx *stlc, bool powersave);
 +static int stlc45xx_tx_pspoll(struct stlc45xx *stlc, bool powersave);

 Can you reorder the file?

Sure.

 And I think you must be basing this on top of your PS patches, so
 could you not put Vivek's in the middle too?

Actually I didn't use my PS patches when I tested this patch. But
true, I should try Vivek's patch also with stlc45xx.

 +static ssize_t stlc45xx_sysfs_store_cal_rssi(struct device *dev,
 + struct device_attribute *attr,
 + const char *buf, size_t count)

 I still think it would be better to use the firmware framework with a
 custom helper for this. At least it should provide a uevent like crda
 does so userspace knows automatically when to upload the files after you
 reload the module for example, I think?

Yeah, you talked about this already and I liked it. I haven't
implemented it just because a lack of time. I'll add it to the todo
list.


 +static ssize_t stlc45xx_sysfs_show_tx_buf(struct device *dev,
 +  struct device_attribute *attr,
 +  char *buf)
 +{

 That should be in debugfs, I think?

I think I should even remove it.

 +static int stlc45xx_request_firmware(struct stlc45xx *stlc)
 +{
 +const struct firmware *fw;
 +int ret;
 +
 +/* FIXME: should driver use it's own struct device? */
 +ret = request_firmware(fw, 3826.arm, stlc-spi-dev);

 own struct device? I don't see why it should? It doesn't have one
 anyway, does it?

There is stlc45xx_device:

ret = platform_device_register(stlc45xx_device);

All this device class stuff is not yet fully clear to me, that's why I
added that comment. I guess I should study this more on a boring train
ride.

 +static int stlc45xx_upload_firmware(struct stlc45xx *stlc)

 +fw_addr = FIRMWARE_ADDRESS;
 +fw_len = stlc-fw_len;

 +stlc45xx_spi_write(stlc, SPI_ADRS_DMA_DATA, stlc-fw, _fw_len);
 +
 +/* FIXME: I think this doesn't work if firmware is large,
 + * this loop goes to second round. fw-data is not
 + * increased at all! */
 +}

 Indeed, the last _spi_write above needs to have something like 
   stlc-fw + fw_addr - FIRMWARE_ADDRESS

Thanks, I'll fix it at some point.

 +/*
 + * FIXME: this gives warning from __ieee80211_rx()
 + *
 + * status.rate_idx = data-rate;
 + */

 That works on p54, afaik?

Yes, I haven't looked at this yet.

 +edcf-queues[0].aifs = 2;
 +edcf-queues[0].pad0 = 1;
 +edcf-queues[0].cwmin = 3;
 +edcf-queues[0].cwmax = 7;
 +edcf-queues[0].txop = 47;
 +edcf-queues[1].aifs = 2;
 +edcf-queues[1].pad0 = 0;
 +edcf-queues[1].cwmin = 7;
 +edcf-queues[1].cwmax = 15;
 +edcf-queues[1].txop = 94;
 +edcf-queues[2].aifs = 3;
 +edcf-queues[2].pad0 = 0;
 +edcf-queues[2].cwmin = 15;
 +edcf-queues[2].cwmax = 1023;
 +edcf-queues[2].txop = 0;
 +edcf-queues[3].aifs = 7;
 +edcf-queues[3].pad0 = 0;
 +edcf-queues[3].cwmin = 15;
 +edcf-queues[3].cwmax = 1023;
 +edcf-queues[3].txop = 0;

 Shouldn't that be taking values from mac80211?

Definitely, just has been pending on my todo list.

 +setup-bratemask = 0x;

 That should also take values from the BSS config.

Will fix.

 +scan-flags = LM_SCAN_EXIT;
 +scan-bratemask = 0x15f;

 or that? not sure

Me neither :)

 +static int stlc45xx_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
 +{

 +entry = stlc45xx_txbuffer_alloc(stlc, skb-len);
 +if (!entry) {
 +/* the queue should be stopped before the firmware buffer
 + * is full, so firmware buffer should always have enough
 + * space */
 +if (net_ratelimit())
 +stlc45xx_warning(firmware buffer full);
 +

Re: [PATCH] Add stlc45xx, wi-fi driver for stlc4550/4560

2008-12-06 Thread Kalle Valo
Kalle Valo [EMAIL PROTECTED] writes:

 This patch adds a new driver called stlc45xx, which supports wi-fi chipsets
 stlc4550 and stlc4560 from ST-NXP Wireless. The chipset can be found, for
 example, from Nokia N800 and N810 products.

 The driver is implemented based on the firmware interface information
 published by ST-NXP Wireless here:

 http://wireless.kernel.org/en/developers/Documentation/specs#STMicroelectronicshardware

 Currently only SPI interface is supported.

Crap, just now I realised to try to compile this with pristine
wireless-testing tree:

In file included from drivers/net/wireless/stlc45xx.c:24:
drivers/net/wireless/stlc45xx.h:27:24: error: mach/board.h: No such file or 
directory
drivers/net/wireless/stlc45xx.c: In function 'stlc45xx_power_off':
drivers/net/wireless/stlc45xx.c:958: error: dereferencing pointer to incomplete 
type
drivers/net/wireless/stlc45xx.c:959: error: dereferencing pointer to incomplete 
type

I usually merge linux-omap to wireless-testing and that's why I didn't
notice this. I will implement the platform data solution in v2 which
should fix this compile error. But I would still love to hear any
comments people have about v1.

-- 
Kalle Valo
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html