Browse Source

add am29lv160 support.

git-svn-id: file:///svn/pmon-all/pmon-all@30 214b0138-1524-0410-9122-e5cb4b5bc56c
master
root 18 years ago
parent
commit
5570e6879c
  1. 1
      Targets/Bonito2eCPCI/dev/pflash_tgt.h
  2. 10
      Targets/Bonito2edev/conf/Bonito
  3. 4
      Targets/Bonito2edev/conf/ld.script
  4. 51
      pmon/dev/flash_amd.c
  5. 2
      pmon/dev/flashdev.c
  6. 16
      sys/dev/usb/usb_uhci.c

1
Targets/Bonito2eCPCI/dev/pflash_tgt.h

@ -53,5 +53,6 @@
#else #else
#define TARGET_FLASH_DEVICES_16 \ #define TARGET_FLASH_DEVICES_16 \
{ PHYS_TO_UNCACHED(0x1fc00000), 0x00080000, 1, 1, FL_BUS_8 }, \ { PHYS_TO_UNCACHED(0x1fc00000), 0x00080000, 1, 1, FL_BUS_8 }, \
{ PHYS_TO_UNCACHED(0x1c000000), 0x00200000, 1, 1, FL_BUS_16 }, \
{ 0x00000000, 0x00000000 } { 0x00000000, 0x00000000 }
#endif #endif

10
Targets/Bonito2edev/conf/Bonito

@ -130,14 +130,14 @@ pci* at pcibr?
fxp0 at pci? dev ? function ? # Intel 82559 Device fxp0 at pci? dev ? function ? # Intel 82559 Device
#inphy* at mii? phy ? # Intel 82555 PHYs #inphy* at mii? phy ? # Intel 82555 PHYs
rtl* at pci? dev ? function ? rtl* at pci? dev ? function ?
uhci* at pci? dev ? function ? #uhci* at pci? dev ? function ?
#ohci0 at pci? dev ? function ? #ohci0 at pci? dev ? function ?
usb0 at usbbus ? #usb0 at usbbus ?
#ohci1 at pci? dev ? function ? #ohci1 at pci? dev ? function ?
select mod_usb #select mod_usb
select mod_usb_storage #select mod_usb_storage
select mod_usb_uhci #select mod_usb_uhci
#select mod_usb_ohci #select mod_usb_ohci
#select mod_usb_kbd #select mod_usb_kbd

4
Targets/Bonito2edev/conf/ld.script

@ -1,4 +1,4 @@
/* $Id: ld.script.ram,v 1.1.1.1 2006/09/14 01:59:08 root Exp $ */ /* $Id: ld.script.Bonito,v 1.1.1.1 2006/09/14 01:59:08 root Exp $ */
OUTPUT_FORMAT("elf32-littlemips", "elf32-bigmips", OUTPUT_FORMAT("elf32-littlemips", "elf32-bigmips",
"elf32-littlemips") "elf32-littlemips")
OUTPUT_ARCH(mips) OUTPUT_ARCH(mips)
@ -6,7 +6,7 @@ ENTRY(_start)
SECTIONS SECTIONS
{ {
/* Read-only sections, merged into text segment: */ /* Read-only sections, merged into text segment: */
. = 0x80200000; . = 0x80010000;
.text : .text :
{ {
_ftext = . ; _ftext = . ;

51
pmon/dev/flash_amd.c

@ -76,6 +76,8 @@ static quad_t widedata;
widedata = (quad_t)__a << 32 | __a; \ widedata = (quad_t)__a << 32 | __a; \
} while(0) } while(0)
#define ConvAddr2(A) (A*2)
/* /*
* Inlineable function to Unlock Bypass * Inlineable function to Unlock Bypass
*/ */
@ -91,6 +93,11 @@ fl_unlock_bypass_amd(map)
outb((map->fl_map_base + AMD_CMDOFFS2), 0x55); outb((map->fl_map_base + AMD_CMDOFFS2), 0x55);
outb((map->fl_map_base + AMD_CMDOFFS1), 0x20); outb((map->fl_map_base + AMD_CMDOFFS1), 0x20);
break; break;
case FL_BUS_16:
outw((map->fl_map_base + ConvAddr2(AMD_CMDOFFS1)), 0xaa);
outw((map->fl_map_base + ConvAddr2(AMD_CMDOFFS2)), 0x55);
outw((map->fl_map_base + ConvAddr2(AMD_CMDOFFS1)), 0x20);
break;
case FL_BUS_64: case FL_BUS_64:
break; /* Leave this for now */ break; /* Leave this for now */
case FL_BUS_8_ON_64: case FL_BUS_8_ON_64:
@ -113,6 +120,7 @@ fl_unlock_bypass_reset_amd(map)
switch(map->fl_map_bus) { switch(map->fl_map_bus) {
case FL_BUS_8: case FL_BUS_8:
case FL_BUS_16:
outb((map->fl_map_base), 0x90); outb((map->fl_map_base), 0x90);
outb((map->fl_map_base), 0x00); outb((map->fl_map_base), 0x00);
break; break;
@ -143,6 +151,10 @@ fl_unlock_bypass_program_amd(map, pa, pd)
outb((map->fl_map_base + AMD_CMDOFFS1), 0xaa); outb((map->fl_map_base + AMD_CMDOFFS1), 0xaa);
outb((map->fl_map_base + AMD_CMDOFFS2), 0x55); outb((map->fl_map_base + AMD_CMDOFFS2), 0x55);
break; break;
case FL_BUS_16:
outw((map->fl_map_base + ConvAddr2(AMD_CMDOFFS1)), 0xaa);
outw((map->fl_map_base + ConvAddr2(AMD_CMDOFFS2)), 0x55);
break;
case FL_BUS_64: case FL_BUS_64:
break; /* Leave this for now */ break; /* Leave this for now */
case FL_BUS_8_ON_64: case FL_BUS_8_ON_64:
@ -173,6 +185,14 @@ fl_erase_sector_amd(map, dev, offset)
outb((map->fl_map_base + AMD_CMDOFFS2), 0x55); outb((map->fl_map_base + AMD_CMDOFFS2), 0x55);
outb((map->fl_map_base + offset), FL_SECT); outb((map->fl_map_base + offset), FL_SECT);
break; break;
case FL_BUS_16:
outw((map->fl_map_base + ConvAddr2(AMD_CMDOFFS1)), 0xAA);
outw((map->fl_map_base + ConvAddr2(AMD_CMDOFFS2)), 0x55);
outw((map->fl_map_base + ConvAddr2(AMD_CMDOFFS1)), FL_ERASE);
outw((map->fl_map_base + ConvAddr2(AMD_CMDOFFS1)), 0xAA);
outw((map->fl_map_base + ConvAddr2(AMD_CMDOFFS2)), 0x55);
outw((map->fl_map_base + offset), FL_SECT);
break;
case FL_BUS_64: case FL_BUS_64:
break; /* Leave this for now */ break; /* Leave this for now */
case FL_BUS_8_ON_64: case FL_BUS_8_ON_64:
@ -204,6 +224,12 @@ fl_program_amd(map, dev, pa, pd)
outb((map->fl_map_base + AMD_CMDOFFS1), 0xA0); outb((map->fl_map_base + AMD_CMDOFFS1), 0xA0);
outb((map->fl_map_base + pa), *pd); outb((map->fl_map_base + pa), *pd);
break; break;
case FL_BUS_16:
outw((map->fl_map_base + ConvAddr2(AMD_CMDOFFS1)), 0xAA);
outw((map->fl_map_base + ConvAddr2(AMD_CMDOFFS2)), 0x55);
outw((map->fl_map_base + ConvAddr2(AMD_CMDOFFS1)), 0xA0);
outw((map->fl_map_base + pa), ((int)pd[1]<<8)|pd[0]);
break;
case FL_BUS_8_ON_64: case FL_BUS_8_ON_64:
SETWIDE(0xaa); SETWIDE(0xaa);
movequad((void *)map->fl_map_base + (0x5555 << 3), &widedata); movequad((void *)map->fl_map_base + (0x5555 << 3), &widedata);
@ -239,6 +265,14 @@ fl_erase_chip_amd(map, dev)
outb((map->fl_map_base + AMD_CMDOFFS2), 0x55); outb((map->fl_map_base + AMD_CMDOFFS2), 0x55);
outb((map->fl_map_base + AMD_CMDOFFS1), FL_ERASE_CHIP); outb((map->fl_map_base + AMD_CMDOFFS1), FL_ERASE_CHIP);
break; break;
case FL_BUS_16:
outw((map->fl_map_base + ConvAddr2(AMD_CMDOFFS1)), 0xaa);
outw((map->fl_map_base + ConvAddr2(AMD_CMDOFFS2)), 0x55);
outw((map->fl_map_base + ConvAddr2(AMD_CMDOFFS1)), FL_ERASE);
outw((map->fl_map_base + ConvAddr2(AMD_CMDOFFS1)), 0xaa);
outw((map->fl_map_base + ConvAddr2(AMD_CMDOFFS2)), 0x55);
outw((map->fl_map_base + ConvAddr2(AMD_CMDOFFS1)), FL_ERASE_CHIP);
break;
case FL_BUS_64: case FL_BUS_64:
break; /* Leave this for now */ break; /* Leave this for now */
case FL_BUS_8_ON_64: case FL_BUS_8_ON_64:
@ -261,6 +295,7 @@ fl_erase_suspend_amd(map, dev)
{ {
switch(map->fl_map_bus) { switch(map->fl_map_bus) {
case FL_BUS_16:
case FL_BUS_8: case FL_BUS_8:
outb(map->fl_map_base, FL_SUSPEND); outb(map->fl_map_base, FL_SUSPEND);
break; break;
@ -286,6 +321,7 @@ fl_erase_resume_amd(map, dev)
{ {
switch(map->fl_map_bus) { switch(map->fl_map_bus) {
case FL_BUS_16:
case FL_BUS_8: case FL_BUS_8:
outb(map->fl_map_base, FL_RESUME); outb(map->fl_map_base, FL_RESUME);
break; break;
@ -310,6 +346,7 @@ fl_reset_amd(map, dev)
struct fl_device *dev; struct fl_device *dev;
{ {
switch(map->fl_map_bus) { switch(map->fl_map_bus) {
case FL_BUS_16:
case FL_BUS_8: case FL_BUS_8:
outb((map->fl_map_base), FL_RESET); outb((map->fl_map_base), FL_RESET);
break; break;
@ -420,6 +457,20 @@ fl_isbusy_amd(map, dev, what, offset, erase)
} }
#endif #endif
break; break;
case FL_BUS_16:
while (1) {
unsigned short poll1, poll2;
poll2 = inw(map->fl_map_base + offset);
poll1 = inw(map->fl_map_base + offset);
if((poll1&0x0040)==(poll2&0x0040))return 0;
if((poll2&0x20)!=0x20)return 1;
poll1 = inw(map->fl_map_base + offset);
poll2 = inw(map->fl_map_base + offset);
if((poll1&0x0040)==(poll2&0x0040))return 0;
else return -1;
}
break;
default: default:
/* Not supported but sorted out much earlier */ /* Not supported but sorted out much earlier */
} }

2
pmon/dev/flashdev.c

@ -77,6 +77,8 @@ struct fl_device fl_known_dev[] = {
4096*__KB, 64*__KB, NULL, &fl_func_amd }, 4096*__KB, 64*__KB, NULL, &fl_func_amd },
{ "Am29LV040", 0x01, 0x4f, FL_PROTO_AMD, FL_CAP_DE, { "Am29LV040", 0x01, 0x4f, FL_PROTO_AMD, FL_CAP_DE,
512*__KB, 64*__KB, NULL, &fl_func_amd }, 512*__KB, 64*__KB, NULL, &fl_func_amd },
{ "Am29LV160", 0x01, 0xc4, FL_PROTO_AMD, FL_CAP_DE,
2048*__KB, 64*__KB, NULL, &fl_func_amd },
{ "Am29LV017", 0x01, 0xc8, FL_PROTO_AMD, FL_CAP_DE, { "Am29LV017", 0x01, 0xc8, FL_PROTO_AMD, FL_CAP_DE,
2048*__KB, 64*__KB, NULL, &fl_func_amd }, 2048*__KB, 64*__KB, NULL, &fl_func_amd },
{ "Am29LV065", 0x01, 0xc8, FL_PROTO_AMD, FL_CAP_DE, { "Am29LV065", 0x01, 0xc8, FL_PROTO_AMD, FL_CAP_DE,

16
sys/dev/usb/usb_uhci.c

@ -116,8 +116,8 @@
#define USB_MAX_TEMP_INT_TD 32 /* number of temporary TDs for Interrupt transfers */ #define USB_MAX_TEMP_INT_TD 32 /* number of temporary TDs for Interrupt transfers */
#undef USB_UHCI_DEBUG //#undef USB_UHCI_DEBUG
//#define USB_UHCI_DEBUG #define USB_UHCI_DEBUG
#ifdef USB_UHCI_DEBUG #ifdef USB_UHCI_DEBUG
#define USB_UHCI_PRINTF(fmt,args...) printf (fmt ,##args) #define USB_UHCI_PRINTF(fmt,args...) printf (fmt ,##args)
@ -902,9 +902,10 @@ int handle_usb_interrupt(void *hc_data)
{ {
unsigned short status; unsigned short status;
int s; int s;
//static int count = 0; static int count = 0,count1=0;
//if (count++%1024==0) prom_printf("handle_usb_interrupt,count=%d\n",count); s = splimp();
if (count++%0x80000==0) printf("handle_usb_interrupt,count=%d\n",count);
/* /*
* Read the interrupt status, and write it back to clear the * Read the interrupt status, and write it back to clear the
* interrupt cause * interrupt cause
@ -916,11 +917,10 @@ int handle_usb_interrupt(void *hc_data)
if (!status) /* shared interrupt, not mine */ if (!status) /* shared interrupt, not mine */
return 0; return 0;
//if (count++%1024==0) prom_printf("status=%x,count=%d\n",status,count); if (count1++%0x1000==0) printf("status=%x,count=%d\n",status,count);
s = splimp();
if (status != 1) { if (status != 1) {
/* remove host controller halted state */ /* remove host controller halted state */
#if 0 #if 1
if ((status&0x20) && ((in16r(usb_base_addr+USBCMD) && USBCMD_RS)==0)) { if ((status&0x20) && ((in16r(usb_base_addr+USBCMD) && USBCMD_RS)==0)) {
out16r(usb_base_addr + USBCMD, USBCMD_RS | in16r(usb_base_addr + USBCMD)); out16r(usb_base_addr + USBCMD, USBCMD_RS | in16r(usb_base_addr + USBCMD));
} }
@ -978,7 +978,7 @@ void usb_uhci_stop(void)
* Virtual Root Hub * Virtual Root Hub
* Since the uhci does not have a real HUB, we simulate one ;-) * Since the uhci does not have a real HUB, we simulate one ;-)
*/ */
#undef USB_RH_DEBUG #define USB_RH_DEBUG
#ifdef USB_RH_DEBUG #ifdef USB_RH_DEBUG
#define USB_RH_PRINTF(fmt,args...) printf (fmt ,##args) #define USB_RH_PRINTF(fmt,args...) printf (fmt ,##args)

Loading…
Cancel
Save