11/*
2- * Copyright (C) 2010 OKI SEMICONDUCTOR Co ., LTD.
2+ * Copyright (C) 2010 OKI SEMICONDUCTOR CO ., LTD.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
3333#define PHUB_TIMEOUT 0x05 /* Time out value for Status Register */
3434#define PCH_PHUB_ROM_WRITE_ENABLE 0x01 /* Enabling for writing ROM */
3535#define PCH_PHUB_ROM_WRITE_DISABLE 0x00 /* Disabling for writing ROM */
36- #define PCH_PHUB_ROM_START_ADDR 0x14 /* ROM data area start address offset */
36+ #define PCH_PHUB_MAC_START_ADDR 0x20C /* MAC data area start address offset */
37+ #define PCH_PHUB_ROM_START_ADDR_EG20T 0x14 /* ROM data area start address offset
38+ (Intel EG20T PCH)*/
39+ #define PCH_PHUB_ROM_START_ADDR_ML7213 0x400 /* ROM data area start address
40+ offset(OKI SEMICONDUCTOR ML7213)
41+ */
3742
3843/* MAX number of INT_REDUCE_CONTROL registers */
3944#define MAX_NUM_INT_REDUCE_CONTROL_REG 128
4247#define CLKCFG_CAN_50MHZ 0x12000000
4348#define CLKCFG_CANCLK_MASK 0xFF000000
4449
50+ /* Macros for ML7213 */
51+ #define PCI_VENDOR_ID_ROHM 0x10db
52+ #define PCI_DEVICE_ID_ROHM_ML7213_PHUB 0x801A
53+
4554/* SROM ACCESS Macro */
4655#define PCH_WORD_ADDR_MASK (~((1 << 2) - 1))
4756
@@ -298,7 +307,7 @@ static void pch_phub_read_serial_rom_val(struct pch_phub_reg *chip,
298307{
299308 unsigned int mem_addr ;
300309
301- mem_addr = PCH_PHUB_ROM_START_ADDR +
310+ mem_addr = PCH_PHUB_ROM_START_ADDR_EG20T +
302311 pch_phub_mac_offset [offset_address ];
303312
304313 pch_phub_read_serial_rom (chip , mem_addr , data );
@@ -315,7 +324,7 @@ static int pch_phub_write_serial_rom_val(struct pch_phub_reg *chip,
315324 int retval ;
316325 unsigned int mem_addr ;
317326
318- mem_addr = PCH_PHUB_ROM_START_ADDR +
327+ mem_addr = PCH_PHUB_ROM_START_ADDR_EG20T +
319328 pch_phub_mac_offset [offset_address ];
320329
321330 retval = pch_phub_write_serial_rom (chip , mem_addr , data );
@@ -594,23 +603,38 @@ static int __devinit pch_phub_probe(struct pci_dev *pdev,
594603 "pch_phub_extrom_base_address variable is %p\n" , __func__ ,
595604 chip -> pch_phub_extrom_base_address );
596605
597- pci_set_drvdata (pdev , chip );
598-
599- retval = sysfs_create_file (& pdev -> dev .kobj , & dev_attr_pch_mac .attr );
600- if (retval )
601- goto err_sysfs_create ;
602-
603- retval = sysfs_create_bin_file (& pdev -> dev .kobj , & pch_bin_attr );
604- if (retval )
605- goto exit_bin_attr ;
606-
607- pch_phub_read_modify_write_reg (chip , (unsigned int )CLKCFG_REG_OFFSET ,
608- CLKCFG_CAN_50MHZ , CLKCFG_CANCLK_MASK );
606+ if (id -> driver_data == 1 ) {
607+ retval = sysfs_create_file (& pdev -> dev .kobj ,
608+ & dev_attr_pch_mac .attr );
609+ if (retval )
610+ goto err_sysfs_create ;
609611
610- /* set the prefech value */
611- iowrite32 (0x000affaa , chip -> pch_phub_base_address + 0x14 );
612- /* set the interrupt delay value */
613- iowrite32 (0x25 , chip -> pch_phub_base_address + 0x44 );
612+ retval = sysfs_create_bin_file (& pdev -> dev .kobj , & pch_bin_attr );
613+ if (retval )
614+ goto exit_bin_attr ;
615+
616+ pch_phub_read_modify_write_reg (chip ,
617+ (unsigned int )CLKCFG_REG_OFFSET ,
618+ CLKCFG_CAN_50MHZ ,
619+ CLKCFG_CANCLK_MASK );
620+
621+ /* set the prefech value */
622+ iowrite32 (0x000affaa , chip -> pch_phub_base_address + 0x14 );
623+ /* set the interrupt delay value */
624+ iowrite32 (0x25 , chip -> pch_phub_base_address + 0x44 );
625+ } else if (id -> driver_data == 2 ) {
626+ retval = sysfs_create_bin_file (& pdev -> dev .kobj , & pch_bin_attr );
627+ if (retval )
628+ goto err_sysfs_create ;
629+ /* set the prefech value
630+ * Device2(USB OHCI #1/ USB EHCI #1/ USB Device):a
631+ * Device4(SDIO #0,1,2):f
632+ * Device6(SATA 2):f
633+ * Device8(USB OHCI #0/ USB EHCI #0):a
634+ */
635+ iowrite32 (0x000affa0 , chip -> pch_phub_base_address + 0x14 );
636+ }
637+ pci_set_drvdata (pdev , chip );
614638
615639 return 0 ;
616640exit_bin_attr :
@@ -687,8 +711,9 @@ static int pch_phub_resume(struct pci_dev *pdev)
687711#endif /* CONFIG_PM */
688712
689713static struct pci_device_id pch_phub_pcidev_id [] = {
690- {PCI_DEVICE (PCI_VENDOR_ID_INTEL , PCI_DEVICE_ID_PCH1_PHUB )},
691- {0 ,}
714+ { PCI_VDEVICE (INTEL , PCI_DEVICE_ID_PCH1_PHUB ), 1 , },
715+ { PCI_VDEVICE (ROHM , PCI_DEVICE_ID_ROHM_ML7213_PHUB ), 2 , },
716+ { }
692717};
693718
694719static struct pci_driver pch_phub_driver = {
0 commit comments