[coreboot] SB600 SPI Driver for Flashrom (unfinished)

Sean Nelson snelson at nmt.edu
Thu Oct 16 19:45:57 CEST 2008


Peter Stuge wrote:
> Sean Nelson wrote:
>   
>> sb600 spi driver file for flashrom
>>     
>
> This one needs some more work.
>
> The SB600 SPI controller registers aren't IO mapped like on the
> superios, but memory mapped according to the 0xa0 BAR in the LPC
> bridge. See page 260 of 46155_sb600_rrg_pub_3.03.pdf.
>
> This driver must also be careful to properly synchronize when ROM
> sharing is being used.
>
>
> Some more comments:
>
>
>   
>> +static uint16_t find_sb600_spi_flash_port(uint16_t device_id)
>> +{
>> +	struct pci_dev *dev;
>> +	uint16_t flashport = 0;
>> +
>> +	/* sb600's LPC ISA Bridge */
>> +	dev = pci_dev_find(0x1002, device_id);
>>     
>
> Must check return value here:
>
> 	if (!dev)
> 		return 1;
>
>
>   
>> +int sb600_probe_spi_flash(const char *name)
>> +{
>> +	sb600_flashport = find_ite_spi_flash_port(0x438d);
>> +
>> +	if (sb600_flashport)
>> +		flashbus = BUS_TYPE_SB600_SPI;
>> +
>> +	return (!it8716f_flashport);
>> +}
>>     
>
> I'd prefer merging these two functions into one because
> find_ite_spi_flash_port() will never be called from anywhere else.
>
> Also there seems to be a copypaste error here, it8716f_flashport
> can't be right. :)
>
>
>   
>> +int sb600_spi_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr)
>> +{
>> +	uint8_t busy, speed;
>> +	int i;
>> +
>> +	if (readcnt > 8) {
>> +		printf("%s called with unsupported readcnt %i.\n",
>> +			__FUNCTION__, readcnt);
>> +		return 1;
>> +	}
>>     
>
> Make sure to check writecnt as well. And please use __func__ instead
> of __FUNCTION__ everywhere.
>
>
> //Peter
>
> --
> coreboot mailing list: coreboot at coreboot.org
> http://www.coreboot.org/mailman/listinfo/coreboot
>
>   
Thanks to Jordan Crouse, for telling me to change flashrom to use sb600 
SPI drive.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: sb600_spi_driver_rev3.diff
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20081016/a933672f/attachment.ksh>


More information about the coreboot mailing list