1cf4ece53SMasayuki Ohtak /* 27f2732c8STomoya MORINAGA * Copyright (C) 2011 LAPIS Semiconductor Co., Ltd. 3cf4ece53SMasayuki Ohtak * 4cf4ece53SMasayuki Ohtak * This program is free software; you can redistribute it and/or modify 5cf4ece53SMasayuki Ohtak * it under the terms of the GNU General Public License as published by 6cf4ece53SMasayuki Ohtak * the Free Software Foundation; version 2 of the License. 7cf4ece53SMasayuki Ohtak * 8cf4ece53SMasayuki Ohtak * This program is distributed in the hope that it will be useful, 9cf4ece53SMasayuki Ohtak * but WITHOUT ANY WARRANTY; without even the implied warranty of 10cf4ece53SMasayuki Ohtak * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11cf4ece53SMasayuki Ohtak * GNU General Public License for more details. 12cf4ece53SMasayuki Ohtak * 13cf4ece53SMasayuki Ohtak * You should have received a copy of the GNU General Public License 14cf4ece53SMasayuki Ohtak * along with this program; if not, write to the Free Software 15cf4ece53SMasayuki Ohtak * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 16cf4ece53SMasayuki Ohtak */ 17cf4ece53SMasayuki Ohtak 18cf4ece53SMasayuki Ohtak #include <linux/module.h> 19cf4ece53SMasayuki Ohtak #include <linux/kernel.h> 20cf4ece53SMasayuki Ohtak #include <linux/types.h> 21cf4ece53SMasayuki Ohtak #include <linux/fs.h> 22cf4ece53SMasayuki Ohtak #include <linux/uaccess.h> 23cf4ece53SMasayuki Ohtak #include <linux/string.h> 24cf4ece53SMasayuki Ohtak #include <linux/pci.h> 25cf4ece53SMasayuki Ohtak #include <linux/io.h> 26cf4ece53SMasayuki Ohtak #include <linux/delay.h> 27cf4ece53SMasayuki Ohtak #include <linux/mutex.h> 28cf4ece53SMasayuki Ohtak #include <linux/if_ether.h> 29cf4ece53SMasayuki Ohtak #include <linux/ctype.h> 306ae705b2SDenis Turischev #include <linux/dmi.h> 31cf4ece53SMasayuki Ohtak 32cf4ece53SMasayuki Ohtak #define PHUB_STATUS 0x00 /* Status Register offset */ 33cf4ece53SMasayuki Ohtak #define PHUB_CONTROL 0x04 /* Control Register offset */ 34cf4ece53SMasayuki Ohtak #define PHUB_TIMEOUT 0x05 /* Time out value for Status Register */ 35cf4ece53SMasayuki Ohtak #define PCH_PHUB_ROM_WRITE_ENABLE 0x01 /* Enabling for writing ROM */ 36cf4ece53SMasayuki Ohtak #define PCH_PHUB_ROM_WRITE_DISABLE 0x00 /* Disabling for writing ROM */ 37275640b0STomoya MORINAGA #define PCH_PHUB_MAC_START_ADDR_EG20T 0x14 /* MAC data area start address 38275640b0STomoya MORINAGA offset */ 39275640b0STomoya MORINAGA #define PCH_PHUB_MAC_START_ADDR_ML7223 0x20C /* MAC data area start address 40275640b0STomoya MORINAGA offset */ 41275640b0STomoya MORINAGA #define PCH_PHUB_ROM_START_ADDR_EG20T 0x80 /* ROM data area start address offset 42c47dda7dSTomoya MORINAGA (Intel EG20T PCH)*/ 43c47dda7dSTomoya MORINAGA #define PCH_PHUB_ROM_START_ADDR_ML7213 0x400 /* ROM data area start address 447f2732c8STomoya MORINAGA offset(LAPIS Semicon ML7213) 45c47dda7dSTomoya MORINAGA */ 46275640b0STomoya MORINAGA #define PCH_PHUB_ROM_START_ADDR_ML7223 0x400 /* ROM data area start address 477f2732c8STomoya MORINAGA offset(LAPIS Semicon ML7223) 48275640b0STomoya MORINAGA */ 49cf4ece53SMasayuki Ohtak 50cf4ece53SMasayuki Ohtak /* MAX number of INT_REDUCE_CONTROL registers */ 51cf4ece53SMasayuki Ohtak #define MAX_NUM_INT_REDUCE_CONTROL_REG 128 52cf4ece53SMasayuki Ohtak #define PCI_DEVICE_ID_PCH1_PHUB 0x8801 53cf4ece53SMasayuki Ohtak #define PCH_MINOR_NOS 1 54cf4ece53SMasayuki Ohtak #define CLKCFG_CAN_50MHZ 0x12000000 55cf4ece53SMasayuki Ohtak #define CLKCFG_CANCLK_MASK 0xFF000000 566ae705b2SDenis Turischev #define CLKCFG_UART_MASK 0xFFFFFF 576ae705b2SDenis Turischev 586ae705b2SDenis Turischev /* CM-iTC */ 596ae705b2SDenis Turischev #define CLKCFG_UART_48MHZ (1 << 16) 606ae705b2SDenis Turischev #define CLKCFG_BAUDDIV (2 << 20) 616ae705b2SDenis Turischev #define CLKCFG_PLL2VCO (8 << 9) 626ae705b2SDenis Turischev #define CLKCFG_UARTCLKSEL (1 << 18) 63cf4ece53SMasayuki Ohtak 641a738dcfSTomoya MORINAGA /* Macros for ML7213 */ 651a738dcfSTomoya MORINAGA #define PCI_VENDOR_ID_ROHM 0x10db 661a738dcfSTomoya MORINAGA #define PCI_DEVICE_ID_ROHM_ML7213_PHUB 0x801A 67cf4ece53SMasayuki Ohtak 68275640b0STomoya MORINAGA /* Macros for ML7223 */ 69275640b0STomoya MORINAGA #define PCI_DEVICE_ID_ROHM_ML7223_mPHUB 0x8012 /* for Bus-m */ 70275640b0STomoya MORINAGA #define PCI_DEVICE_ID_ROHM_ML7223_nPHUB 0x8002 /* for Bus-n */ 71275640b0STomoya MORINAGA 72584ad00cSTomoya MORINAGA /* Macros for ML7831 */ 73584ad00cSTomoya MORINAGA #define PCI_DEVICE_ID_ROHM_ML7831_PHUB 0x8801 74584ad00cSTomoya MORINAGA 75cf4ece53SMasayuki Ohtak /* SROM ACCESS Macro */ 76cf4ece53SMasayuki Ohtak #define PCH_WORD_ADDR_MASK (~((1 << 2) - 1)) 77cf4ece53SMasayuki Ohtak 78cf4ece53SMasayuki Ohtak /* Registers address offset */ 79cf4ece53SMasayuki Ohtak #define PCH_PHUB_ID_REG 0x0000 80cf4ece53SMasayuki Ohtak #define PCH_PHUB_QUEUE_PRI_VAL_REG 0x0004 81cf4ece53SMasayuki Ohtak #define PCH_PHUB_RC_QUEUE_MAXSIZE_REG 0x0008 82cf4ece53SMasayuki Ohtak #define PCH_PHUB_BRI_QUEUE_MAXSIZE_REG 0x000C 83cf4ece53SMasayuki Ohtak #define PCH_PHUB_COMP_RESP_TIMEOUT_REG 0x0010 84cf4ece53SMasayuki Ohtak #define PCH_PHUB_BUS_SLAVE_CONTROL_REG 0x0014 85cf4ece53SMasayuki Ohtak #define PCH_PHUB_DEADLOCK_AVOID_TYPE_REG 0x0018 86cf4ece53SMasayuki Ohtak #define PCH_PHUB_INTPIN_REG_WPERMIT_REG0 0x0020 87cf4ece53SMasayuki Ohtak #define PCH_PHUB_INTPIN_REG_WPERMIT_REG1 0x0024 88cf4ece53SMasayuki Ohtak #define PCH_PHUB_INTPIN_REG_WPERMIT_REG2 0x0028 89cf4ece53SMasayuki Ohtak #define PCH_PHUB_INTPIN_REG_WPERMIT_REG3 0x002C 90cf4ece53SMasayuki Ohtak #define PCH_PHUB_INT_REDUCE_CONTROL_REG_BASE 0x0040 91cf4ece53SMasayuki Ohtak #define CLKCFG_REG_OFFSET 0x500 92dd7d7feaSTomoya MORINAGA #define FUNCSEL_REG_OFFSET 0x508 93cf4ece53SMasayuki Ohtak 94cf4ece53SMasayuki Ohtak #define PCH_PHUB_OROM_SIZE 15360 95cf4ece53SMasayuki Ohtak 96cf4ece53SMasayuki Ohtak /** 97cf4ece53SMasayuki Ohtak * struct pch_phub_reg - PHUB register structure 98cf4ece53SMasayuki Ohtak * @phub_id_reg: PHUB_ID register val 99cf4ece53SMasayuki Ohtak * @q_pri_val_reg: QUEUE_PRI_VAL register val 100cf4ece53SMasayuki Ohtak * @rc_q_maxsize_reg: RC_QUEUE_MAXSIZE register val 101cf4ece53SMasayuki Ohtak * @bri_q_maxsize_reg: BRI_QUEUE_MAXSIZE register val 102cf4ece53SMasayuki Ohtak * @comp_resp_timeout_reg: COMP_RESP_TIMEOUT register val 103cf4ece53SMasayuki Ohtak * @bus_slave_control_reg: BUS_SLAVE_CONTROL_REG register val 104cf4ece53SMasayuki Ohtak * @deadlock_avoid_type_reg: DEADLOCK_AVOID_TYPE register val 105cf4ece53SMasayuki Ohtak * @intpin_reg_wpermit_reg0: INTPIN_REG_WPERMIT register 0 val 106cf4ece53SMasayuki Ohtak * @intpin_reg_wpermit_reg1: INTPIN_REG_WPERMIT register 1 val 107cf4ece53SMasayuki Ohtak * @intpin_reg_wpermit_reg2: INTPIN_REG_WPERMIT register 2 val 108cf4ece53SMasayuki Ohtak * @intpin_reg_wpermit_reg3: INTPIN_REG_WPERMIT register 3 val 109cf4ece53SMasayuki Ohtak * @int_reduce_control_reg: INT_REDUCE_CONTROL registers val 110cf4ece53SMasayuki Ohtak * @clkcfg_reg: CLK CFG register val 111dd7d7feaSTomoya MORINAGA * @funcsel_reg: Function select register value 112cf4ece53SMasayuki Ohtak * @pch_phub_base_address: Register base address 113cf4ece53SMasayuki Ohtak * @pch_phub_extrom_base_address: external rom base address 114275640b0STomoya MORINAGA * @pch_mac_start_address: MAC address area start address 115275640b0STomoya MORINAGA * @pch_opt_rom_start_address: Option ROM start address 116275640b0STomoya MORINAGA * @ioh_type: Save IOH type 1179914a0deSTomoya MORINAGA * @pdev: pointer to pci device struct 118cf4ece53SMasayuki Ohtak */ 119cf4ece53SMasayuki Ohtak struct pch_phub_reg { 120cf4ece53SMasayuki Ohtak u32 phub_id_reg; 121cf4ece53SMasayuki Ohtak u32 q_pri_val_reg; 122cf4ece53SMasayuki Ohtak u32 rc_q_maxsize_reg; 123cf4ece53SMasayuki Ohtak u32 bri_q_maxsize_reg; 124cf4ece53SMasayuki Ohtak u32 comp_resp_timeout_reg; 125cf4ece53SMasayuki Ohtak u32 bus_slave_control_reg; 126cf4ece53SMasayuki Ohtak u32 deadlock_avoid_type_reg; 127cf4ece53SMasayuki Ohtak u32 intpin_reg_wpermit_reg0; 128cf4ece53SMasayuki Ohtak u32 intpin_reg_wpermit_reg1; 129cf4ece53SMasayuki Ohtak u32 intpin_reg_wpermit_reg2; 130cf4ece53SMasayuki Ohtak u32 intpin_reg_wpermit_reg3; 131cf4ece53SMasayuki Ohtak u32 int_reduce_control_reg[MAX_NUM_INT_REDUCE_CONTROL_REG]; 132cf4ece53SMasayuki Ohtak u32 clkcfg_reg; 133dd7d7feaSTomoya MORINAGA u32 funcsel_reg; 134cf4ece53SMasayuki Ohtak void __iomem *pch_phub_base_address; 135cf4ece53SMasayuki Ohtak void __iomem *pch_phub_extrom_base_address; 136275640b0STomoya MORINAGA u32 pch_mac_start_address; 137275640b0STomoya MORINAGA u32 pch_opt_rom_start_address; 138275640b0STomoya MORINAGA int ioh_type; 1399914a0deSTomoya MORINAGA struct pci_dev *pdev; 140cf4ece53SMasayuki Ohtak }; 141cf4ece53SMasayuki Ohtak 142cf4ece53SMasayuki Ohtak /* SROM SPEC for MAC address assignment offset */ 143cf4ece53SMasayuki Ohtak static const int pch_phub_mac_offset[ETH_ALEN] = {0x3, 0x2, 0x1, 0x0, 0xb, 0xa}; 144cf4ece53SMasayuki Ohtak 145cf4ece53SMasayuki Ohtak static DEFINE_MUTEX(pch_phub_mutex); 146cf4ece53SMasayuki Ohtak 147cf4ece53SMasayuki Ohtak /** 148cf4ece53SMasayuki Ohtak * pch_phub_read_modify_write_reg() - Reading modifying and writing register 149cf4ece53SMasayuki Ohtak * @reg_addr_offset: Register offset address value. 150cf4ece53SMasayuki Ohtak * @data: Writing value. 151cf4ece53SMasayuki Ohtak * @mask: Mask value. 152cf4ece53SMasayuki Ohtak */ 153cf4ece53SMasayuki Ohtak static void pch_phub_read_modify_write_reg(struct pch_phub_reg *chip, 154cf4ece53SMasayuki Ohtak unsigned int reg_addr_offset, 155cf4ece53SMasayuki Ohtak unsigned int data, unsigned int mask) 156cf4ece53SMasayuki Ohtak { 157cf4ece53SMasayuki Ohtak void __iomem *reg_addr = chip->pch_phub_base_address + reg_addr_offset; 158cf4ece53SMasayuki Ohtak iowrite32(((ioread32(reg_addr) & ~mask)) | data, reg_addr); 159cf4ece53SMasayuki Ohtak } 160cf4ece53SMasayuki Ohtak 161cf4ece53SMasayuki Ohtak /* pch_phub_save_reg_conf - saves register configuration */ 162cf4ece53SMasayuki Ohtak static void pch_phub_save_reg_conf(struct pci_dev *pdev) 163cf4ece53SMasayuki Ohtak { 164cf4ece53SMasayuki Ohtak unsigned int i; 165cf4ece53SMasayuki Ohtak struct pch_phub_reg *chip = pci_get_drvdata(pdev); 166cf4ece53SMasayuki Ohtak 167cf4ece53SMasayuki Ohtak void __iomem *p = chip->pch_phub_base_address; 168cf4ece53SMasayuki Ohtak 169cf4ece53SMasayuki Ohtak chip->phub_id_reg = ioread32(p + PCH_PHUB_ID_REG); 170cf4ece53SMasayuki Ohtak chip->q_pri_val_reg = ioread32(p + PCH_PHUB_QUEUE_PRI_VAL_REG); 171cf4ece53SMasayuki Ohtak chip->rc_q_maxsize_reg = ioread32(p + PCH_PHUB_RC_QUEUE_MAXSIZE_REG); 172cf4ece53SMasayuki Ohtak chip->bri_q_maxsize_reg = ioread32(p + PCH_PHUB_BRI_QUEUE_MAXSIZE_REG); 173cf4ece53SMasayuki Ohtak chip->comp_resp_timeout_reg = 174cf4ece53SMasayuki Ohtak ioread32(p + PCH_PHUB_COMP_RESP_TIMEOUT_REG); 175cf4ece53SMasayuki Ohtak chip->bus_slave_control_reg = 176cf4ece53SMasayuki Ohtak ioread32(p + PCH_PHUB_BUS_SLAVE_CONTROL_REG); 177cf4ece53SMasayuki Ohtak chip->deadlock_avoid_type_reg = 178cf4ece53SMasayuki Ohtak ioread32(p + PCH_PHUB_DEADLOCK_AVOID_TYPE_REG); 179cf4ece53SMasayuki Ohtak chip->intpin_reg_wpermit_reg0 = 180cf4ece53SMasayuki Ohtak ioread32(p + PCH_PHUB_INTPIN_REG_WPERMIT_REG0); 181cf4ece53SMasayuki Ohtak chip->intpin_reg_wpermit_reg1 = 182cf4ece53SMasayuki Ohtak ioread32(p + PCH_PHUB_INTPIN_REG_WPERMIT_REG1); 183cf4ece53SMasayuki Ohtak chip->intpin_reg_wpermit_reg2 = 184cf4ece53SMasayuki Ohtak ioread32(p + PCH_PHUB_INTPIN_REG_WPERMIT_REG2); 185cf4ece53SMasayuki Ohtak chip->intpin_reg_wpermit_reg3 = 186cf4ece53SMasayuki Ohtak ioread32(p + PCH_PHUB_INTPIN_REG_WPERMIT_REG3); 187cf4ece53SMasayuki Ohtak dev_dbg(&pdev->dev, "%s : " 188cf4ece53SMasayuki Ohtak "chip->phub_id_reg=%x, " 189cf4ece53SMasayuki Ohtak "chip->q_pri_val_reg=%x, " 190cf4ece53SMasayuki Ohtak "chip->rc_q_maxsize_reg=%x, " 191cf4ece53SMasayuki Ohtak "chip->bri_q_maxsize_reg=%x, " 192cf4ece53SMasayuki Ohtak "chip->comp_resp_timeout_reg=%x, " 193cf4ece53SMasayuki Ohtak "chip->bus_slave_control_reg=%x, " 194cf4ece53SMasayuki Ohtak "chip->deadlock_avoid_type_reg=%x, " 195cf4ece53SMasayuki Ohtak "chip->intpin_reg_wpermit_reg0=%x, " 196cf4ece53SMasayuki Ohtak "chip->intpin_reg_wpermit_reg1=%x, " 197cf4ece53SMasayuki Ohtak "chip->intpin_reg_wpermit_reg2=%x, " 198cf4ece53SMasayuki Ohtak "chip->intpin_reg_wpermit_reg3=%x\n", __func__, 199cf4ece53SMasayuki Ohtak chip->phub_id_reg, 200cf4ece53SMasayuki Ohtak chip->q_pri_val_reg, 201cf4ece53SMasayuki Ohtak chip->rc_q_maxsize_reg, 202cf4ece53SMasayuki Ohtak chip->bri_q_maxsize_reg, 203cf4ece53SMasayuki Ohtak chip->comp_resp_timeout_reg, 204cf4ece53SMasayuki Ohtak chip->bus_slave_control_reg, 205cf4ece53SMasayuki Ohtak chip->deadlock_avoid_type_reg, 206cf4ece53SMasayuki Ohtak chip->intpin_reg_wpermit_reg0, 207cf4ece53SMasayuki Ohtak chip->intpin_reg_wpermit_reg1, 208cf4ece53SMasayuki Ohtak chip->intpin_reg_wpermit_reg2, 209cf4ece53SMasayuki Ohtak chip->intpin_reg_wpermit_reg3); 210cf4ece53SMasayuki Ohtak for (i = 0; i < MAX_NUM_INT_REDUCE_CONTROL_REG; i++) { 211cf4ece53SMasayuki Ohtak chip->int_reduce_control_reg[i] = 212cf4ece53SMasayuki Ohtak ioread32(p + PCH_PHUB_INT_REDUCE_CONTROL_REG_BASE + 4 * i); 213cf4ece53SMasayuki Ohtak dev_dbg(&pdev->dev, "%s : " 214cf4ece53SMasayuki Ohtak "chip->int_reduce_control_reg[%d]=%x\n", 215cf4ece53SMasayuki Ohtak __func__, i, chip->int_reduce_control_reg[i]); 216cf4ece53SMasayuki Ohtak } 217cf4ece53SMasayuki Ohtak chip->clkcfg_reg = ioread32(p + CLKCFG_REG_OFFSET); 218dd7d7feaSTomoya MORINAGA if ((chip->ioh_type == 2) || (chip->ioh_type == 4)) 219dd7d7feaSTomoya MORINAGA chip->funcsel_reg = ioread32(p + FUNCSEL_REG_OFFSET); 220cf4ece53SMasayuki Ohtak } 221cf4ece53SMasayuki Ohtak 222cf4ece53SMasayuki Ohtak /* pch_phub_restore_reg_conf - restore register configuration */ 223cf4ece53SMasayuki Ohtak static void pch_phub_restore_reg_conf(struct pci_dev *pdev) 224cf4ece53SMasayuki Ohtak { 225cf4ece53SMasayuki Ohtak unsigned int i; 226cf4ece53SMasayuki Ohtak struct pch_phub_reg *chip = pci_get_drvdata(pdev); 227cf4ece53SMasayuki Ohtak void __iomem *p; 228cf4ece53SMasayuki Ohtak p = chip->pch_phub_base_address; 229cf4ece53SMasayuki Ohtak 230cf4ece53SMasayuki Ohtak iowrite32(chip->phub_id_reg, p + PCH_PHUB_ID_REG); 231cf4ece53SMasayuki Ohtak iowrite32(chip->q_pri_val_reg, p + PCH_PHUB_QUEUE_PRI_VAL_REG); 232cf4ece53SMasayuki Ohtak iowrite32(chip->rc_q_maxsize_reg, p + PCH_PHUB_RC_QUEUE_MAXSIZE_REG); 233cf4ece53SMasayuki Ohtak iowrite32(chip->bri_q_maxsize_reg, p + PCH_PHUB_BRI_QUEUE_MAXSIZE_REG); 234cf4ece53SMasayuki Ohtak iowrite32(chip->comp_resp_timeout_reg, 235cf4ece53SMasayuki Ohtak p + PCH_PHUB_COMP_RESP_TIMEOUT_REG); 236cf4ece53SMasayuki Ohtak iowrite32(chip->bus_slave_control_reg, 237cf4ece53SMasayuki Ohtak p + PCH_PHUB_BUS_SLAVE_CONTROL_REG); 238cf4ece53SMasayuki Ohtak iowrite32(chip->deadlock_avoid_type_reg, 239cf4ece53SMasayuki Ohtak p + PCH_PHUB_DEADLOCK_AVOID_TYPE_REG); 240cf4ece53SMasayuki Ohtak iowrite32(chip->intpin_reg_wpermit_reg0, 241cf4ece53SMasayuki Ohtak p + PCH_PHUB_INTPIN_REG_WPERMIT_REG0); 242cf4ece53SMasayuki Ohtak iowrite32(chip->intpin_reg_wpermit_reg1, 243cf4ece53SMasayuki Ohtak p + PCH_PHUB_INTPIN_REG_WPERMIT_REG1); 244cf4ece53SMasayuki Ohtak iowrite32(chip->intpin_reg_wpermit_reg2, 245cf4ece53SMasayuki Ohtak p + PCH_PHUB_INTPIN_REG_WPERMIT_REG2); 246cf4ece53SMasayuki Ohtak iowrite32(chip->intpin_reg_wpermit_reg3, 247cf4ece53SMasayuki Ohtak p + PCH_PHUB_INTPIN_REG_WPERMIT_REG3); 248cf4ece53SMasayuki Ohtak dev_dbg(&pdev->dev, "%s : " 249cf4ece53SMasayuki Ohtak "chip->phub_id_reg=%x, " 250cf4ece53SMasayuki Ohtak "chip->q_pri_val_reg=%x, " 251cf4ece53SMasayuki Ohtak "chip->rc_q_maxsize_reg=%x, " 252cf4ece53SMasayuki Ohtak "chip->bri_q_maxsize_reg=%x, " 253cf4ece53SMasayuki Ohtak "chip->comp_resp_timeout_reg=%x, " 254cf4ece53SMasayuki Ohtak "chip->bus_slave_control_reg=%x, " 255cf4ece53SMasayuki Ohtak "chip->deadlock_avoid_type_reg=%x, " 256cf4ece53SMasayuki Ohtak "chip->intpin_reg_wpermit_reg0=%x, " 257cf4ece53SMasayuki Ohtak "chip->intpin_reg_wpermit_reg1=%x, " 258cf4ece53SMasayuki Ohtak "chip->intpin_reg_wpermit_reg2=%x, " 259cf4ece53SMasayuki Ohtak "chip->intpin_reg_wpermit_reg3=%x\n", __func__, 260cf4ece53SMasayuki Ohtak chip->phub_id_reg, 261cf4ece53SMasayuki Ohtak chip->q_pri_val_reg, 262cf4ece53SMasayuki Ohtak chip->rc_q_maxsize_reg, 263cf4ece53SMasayuki Ohtak chip->bri_q_maxsize_reg, 264cf4ece53SMasayuki Ohtak chip->comp_resp_timeout_reg, 265cf4ece53SMasayuki Ohtak chip->bus_slave_control_reg, 266cf4ece53SMasayuki Ohtak chip->deadlock_avoid_type_reg, 267cf4ece53SMasayuki Ohtak chip->intpin_reg_wpermit_reg0, 268cf4ece53SMasayuki Ohtak chip->intpin_reg_wpermit_reg1, 269cf4ece53SMasayuki Ohtak chip->intpin_reg_wpermit_reg2, 270cf4ece53SMasayuki Ohtak chip->intpin_reg_wpermit_reg3); 271cf4ece53SMasayuki Ohtak for (i = 0; i < MAX_NUM_INT_REDUCE_CONTROL_REG; i++) { 272cf4ece53SMasayuki Ohtak iowrite32(chip->int_reduce_control_reg[i], 273cf4ece53SMasayuki Ohtak p + PCH_PHUB_INT_REDUCE_CONTROL_REG_BASE + 4 * i); 274cf4ece53SMasayuki Ohtak dev_dbg(&pdev->dev, "%s : " 275cf4ece53SMasayuki Ohtak "chip->int_reduce_control_reg[%d]=%x\n", 276cf4ece53SMasayuki Ohtak __func__, i, chip->int_reduce_control_reg[i]); 277cf4ece53SMasayuki Ohtak } 278cf4ece53SMasayuki Ohtak 279cf4ece53SMasayuki Ohtak iowrite32(chip->clkcfg_reg, p + CLKCFG_REG_OFFSET); 280dd7d7feaSTomoya MORINAGA if ((chip->ioh_type == 2) || (chip->ioh_type == 4)) 281dd7d7feaSTomoya MORINAGA iowrite32(chip->funcsel_reg, p + FUNCSEL_REG_OFFSET); 282cf4ece53SMasayuki Ohtak } 283cf4ece53SMasayuki Ohtak 284cf4ece53SMasayuki Ohtak /** 285cf4ece53SMasayuki Ohtak * pch_phub_read_serial_rom() - Reading Serial ROM 286cf4ece53SMasayuki Ohtak * @offset_address: Serial ROM offset address to read. 287cf4ece53SMasayuki Ohtak * @data: Read buffer for specified Serial ROM value. 288cf4ece53SMasayuki Ohtak */ 289cf4ece53SMasayuki Ohtak static void pch_phub_read_serial_rom(struct pch_phub_reg *chip, 290cf4ece53SMasayuki Ohtak unsigned int offset_address, u8 *data) 291cf4ece53SMasayuki Ohtak { 292cf4ece53SMasayuki Ohtak void __iomem *mem_addr = chip->pch_phub_extrom_base_address + 293cf4ece53SMasayuki Ohtak offset_address; 294cf4ece53SMasayuki Ohtak 295cf4ece53SMasayuki Ohtak *data = ioread8(mem_addr); 296cf4ece53SMasayuki Ohtak } 297cf4ece53SMasayuki Ohtak 298cf4ece53SMasayuki Ohtak /** 299cf4ece53SMasayuki Ohtak * pch_phub_write_serial_rom() - Writing Serial ROM 300cf4ece53SMasayuki Ohtak * @offset_address: Serial ROM offset address. 301cf4ece53SMasayuki Ohtak * @data: Serial ROM value to write. 302cf4ece53SMasayuki Ohtak */ 303cf4ece53SMasayuki Ohtak static int pch_phub_write_serial_rom(struct pch_phub_reg *chip, 304cf4ece53SMasayuki Ohtak unsigned int offset_address, u8 data) 305cf4ece53SMasayuki Ohtak { 306cf4ece53SMasayuki Ohtak void __iomem *mem_addr = chip->pch_phub_extrom_base_address + 307cf4ece53SMasayuki Ohtak (offset_address & PCH_WORD_ADDR_MASK); 308cf4ece53SMasayuki Ohtak int i; 309cf4ece53SMasayuki Ohtak unsigned int word_data; 310cf4ece53SMasayuki Ohtak unsigned int pos; 311cf4ece53SMasayuki Ohtak unsigned int mask; 312cf4ece53SMasayuki Ohtak pos = (offset_address % 4) * 8; 313cf4ece53SMasayuki Ohtak mask = ~(0xFF << pos); 314cf4ece53SMasayuki Ohtak 315cf4ece53SMasayuki Ohtak iowrite32(PCH_PHUB_ROM_WRITE_ENABLE, 316cf4ece53SMasayuki Ohtak chip->pch_phub_extrom_base_address + PHUB_CONTROL); 317cf4ece53SMasayuki Ohtak 318cf4ece53SMasayuki Ohtak word_data = ioread32(mem_addr); 319cf4ece53SMasayuki Ohtak iowrite32((word_data & mask) | (u32)data << pos, mem_addr); 320cf4ece53SMasayuki Ohtak 321cf4ece53SMasayuki Ohtak i = 0; 322cf4ece53SMasayuki Ohtak while (ioread8(chip->pch_phub_extrom_base_address + 323cf4ece53SMasayuki Ohtak PHUB_STATUS) != 0x00) { 324cf4ece53SMasayuki Ohtak msleep(1); 325cf4ece53SMasayuki Ohtak if (i == PHUB_TIMEOUT) 326cf4ece53SMasayuki Ohtak return -ETIMEDOUT; 327cf4ece53SMasayuki Ohtak i++; 328cf4ece53SMasayuki Ohtak } 329cf4ece53SMasayuki Ohtak 330cf4ece53SMasayuki Ohtak iowrite32(PCH_PHUB_ROM_WRITE_DISABLE, 331cf4ece53SMasayuki Ohtak chip->pch_phub_extrom_base_address + PHUB_CONTROL); 332cf4ece53SMasayuki Ohtak 333cf4ece53SMasayuki Ohtak return 0; 334cf4ece53SMasayuki Ohtak } 335cf4ece53SMasayuki Ohtak 336cf4ece53SMasayuki Ohtak /** 337cf4ece53SMasayuki Ohtak * pch_phub_read_serial_rom_val() - Read Serial ROM value 338cf4ece53SMasayuki Ohtak * @offset_address: Serial ROM address offset value. 339cf4ece53SMasayuki Ohtak * @data: Serial ROM value to read. 340cf4ece53SMasayuki Ohtak */ 341cf4ece53SMasayuki Ohtak static void pch_phub_read_serial_rom_val(struct pch_phub_reg *chip, 342cf4ece53SMasayuki Ohtak unsigned int offset_address, u8 *data) 343cf4ece53SMasayuki Ohtak { 344cf4ece53SMasayuki Ohtak unsigned int mem_addr; 345cf4ece53SMasayuki Ohtak 346275640b0STomoya MORINAGA mem_addr = chip->pch_mac_start_address + 347cf4ece53SMasayuki Ohtak pch_phub_mac_offset[offset_address]; 348cf4ece53SMasayuki Ohtak 349cf4ece53SMasayuki Ohtak pch_phub_read_serial_rom(chip, mem_addr, data); 350cf4ece53SMasayuki Ohtak } 351cf4ece53SMasayuki Ohtak 352cf4ece53SMasayuki Ohtak /** 353cf4ece53SMasayuki Ohtak * pch_phub_write_serial_rom_val() - writing Serial ROM value 354cf4ece53SMasayuki Ohtak * @offset_address: Serial ROM address offset value. 355cf4ece53SMasayuki Ohtak * @data: Serial ROM value. 356cf4ece53SMasayuki Ohtak */ 357cf4ece53SMasayuki Ohtak static int pch_phub_write_serial_rom_val(struct pch_phub_reg *chip, 358cf4ece53SMasayuki Ohtak unsigned int offset_address, u8 data) 359cf4ece53SMasayuki Ohtak { 360cf4ece53SMasayuki Ohtak int retval; 361cf4ece53SMasayuki Ohtak unsigned int mem_addr; 362cf4ece53SMasayuki Ohtak 363275640b0STomoya MORINAGA mem_addr = chip->pch_mac_start_address + 364cf4ece53SMasayuki Ohtak pch_phub_mac_offset[offset_address]; 365cf4ece53SMasayuki Ohtak 366cf4ece53SMasayuki Ohtak retval = pch_phub_write_serial_rom(chip, mem_addr, data); 367cf4ece53SMasayuki Ohtak 368cf4ece53SMasayuki Ohtak return retval; 369cf4ece53SMasayuki Ohtak } 370cf4ece53SMasayuki Ohtak 371cf4ece53SMasayuki Ohtak /* pch_phub_gbe_serial_rom_conf - makes Serial ROM header format configuration 372cf4ece53SMasayuki Ohtak * for Gigabit Ethernet MAC address 373cf4ece53SMasayuki Ohtak */ 374cf4ece53SMasayuki Ohtak static int pch_phub_gbe_serial_rom_conf(struct pch_phub_reg *chip) 375cf4ece53SMasayuki Ohtak { 376cf4ece53SMasayuki Ohtak int retval; 377cf4ece53SMasayuki Ohtak 378cf4ece53SMasayuki Ohtak retval = pch_phub_write_serial_rom(chip, 0x0b, 0xbc); 379cf4ece53SMasayuki Ohtak retval |= pch_phub_write_serial_rom(chip, 0x0a, 0x10); 380cf4ece53SMasayuki Ohtak retval |= pch_phub_write_serial_rom(chip, 0x09, 0x01); 381cf4ece53SMasayuki Ohtak retval |= pch_phub_write_serial_rom(chip, 0x08, 0x02); 382cf4ece53SMasayuki Ohtak 383cf4ece53SMasayuki Ohtak retval |= pch_phub_write_serial_rom(chip, 0x0f, 0x00); 384cf4ece53SMasayuki Ohtak retval |= pch_phub_write_serial_rom(chip, 0x0e, 0x00); 385cf4ece53SMasayuki Ohtak retval |= pch_phub_write_serial_rom(chip, 0x0d, 0x00); 386cf4ece53SMasayuki Ohtak retval |= pch_phub_write_serial_rom(chip, 0x0c, 0x80); 387cf4ece53SMasayuki Ohtak 388cf4ece53SMasayuki Ohtak retval |= pch_phub_write_serial_rom(chip, 0x13, 0xbc); 389cf4ece53SMasayuki Ohtak retval |= pch_phub_write_serial_rom(chip, 0x12, 0x10); 390cf4ece53SMasayuki Ohtak retval |= pch_phub_write_serial_rom(chip, 0x11, 0x01); 391cf4ece53SMasayuki Ohtak retval |= pch_phub_write_serial_rom(chip, 0x10, 0x18); 392cf4ece53SMasayuki Ohtak 393cf4ece53SMasayuki Ohtak retval |= pch_phub_write_serial_rom(chip, 0x1b, 0xbc); 394cf4ece53SMasayuki Ohtak retval |= pch_phub_write_serial_rom(chip, 0x1a, 0x10); 395cf4ece53SMasayuki Ohtak retval |= pch_phub_write_serial_rom(chip, 0x19, 0x01); 396cf4ece53SMasayuki Ohtak retval |= pch_phub_write_serial_rom(chip, 0x18, 0x19); 397cf4ece53SMasayuki Ohtak 398cf4ece53SMasayuki Ohtak retval |= pch_phub_write_serial_rom(chip, 0x23, 0xbc); 399cf4ece53SMasayuki Ohtak retval |= pch_phub_write_serial_rom(chip, 0x22, 0x10); 400cf4ece53SMasayuki Ohtak retval |= pch_phub_write_serial_rom(chip, 0x21, 0x01); 401cf4ece53SMasayuki Ohtak retval |= pch_phub_write_serial_rom(chip, 0x20, 0x3a); 402cf4ece53SMasayuki Ohtak 403cf4ece53SMasayuki Ohtak retval |= pch_phub_write_serial_rom(chip, 0x27, 0x01); 404cf4ece53SMasayuki Ohtak retval |= pch_phub_write_serial_rom(chip, 0x26, 0x00); 405cf4ece53SMasayuki Ohtak retval |= pch_phub_write_serial_rom(chip, 0x25, 0x00); 406cf4ece53SMasayuki Ohtak retval |= pch_phub_write_serial_rom(chip, 0x24, 0x00); 407cf4ece53SMasayuki Ohtak 408cf4ece53SMasayuki Ohtak return retval; 409cf4ece53SMasayuki Ohtak } 410cf4ece53SMasayuki Ohtak 411275640b0STomoya MORINAGA /* pch_phub_gbe_serial_rom_conf_mp - makes SerialROM header format configuration 412275640b0STomoya MORINAGA * for Gigabit Ethernet MAC address 413275640b0STomoya MORINAGA */ 414275640b0STomoya MORINAGA static int pch_phub_gbe_serial_rom_conf_mp(struct pch_phub_reg *chip) 415275640b0STomoya MORINAGA { 416275640b0STomoya MORINAGA int retval; 417275640b0STomoya MORINAGA u32 offset_addr; 418275640b0STomoya MORINAGA 419275640b0STomoya MORINAGA offset_addr = 0x200; 420275640b0STomoya MORINAGA retval = pch_phub_write_serial_rom(chip, 0x03 + offset_addr, 0xbc); 421275640b0STomoya MORINAGA retval |= pch_phub_write_serial_rom(chip, 0x02 + offset_addr, 0x00); 422275640b0STomoya MORINAGA retval |= pch_phub_write_serial_rom(chip, 0x01 + offset_addr, 0x40); 423275640b0STomoya MORINAGA retval |= pch_phub_write_serial_rom(chip, 0x00 + offset_addr, 0x02); 424275640b0STomoya MORINAGA 425275640b0STomoya MORINAGA retval |= pch_phub_write_serial_rom(chip, 0x07 + offset_addr, 0x00); 426275640b0STomoya MORINAGA retval |= pch_phub_write_serial_rom(chip, 0x06 + offset_addr, 0x00); 427275640b0STomoya MORINAGA retval |= pch_phub_write_serial_rom(chip, 0x05 + offset_addr, 0x00); 428275640b0STomoya MORINAGA retval |= pch_phub_write_serial_rom(chip, 0x04 + offset_addr, 0x80); 429275640b0STomoya MORINAGA 430275640b0STomoya MORINAGA retval |= pch_phub_write_serial_rom(chip, 0x0b + offset_addr, 0xbc); 431275640b0STomoya MORINAGA retval |= pch_phub_write_serial_rom(chip, 0x0a + offset_addr, 0x00); 432275640b0STomoya MORINAGA retval |= pch_phub_write_serial_rom(chip, 0x09 + offset_addr, 0x40); 433275640b0STomoya MORINAGA retval |= pch_phub_write_serial_rom(chip, 0x08 + offset_addr, 0x18); 434275640b0STomoya MORINAGA 435275640b0STomoya MORINAGA retval |= pch_phub_write_serial_rom(chip, 0x13 + offset_addr, 0xbc); 436275640b0STomoya MORINAGA retval |= pch_phub_write_serial_rom(chip, 0x12 + offset_addr, 0x00); 437275640b0STomoya MORINAGA retval |= pch_phub_write_serial_rom(chip, 0x11 + offset_addr, 0x40); 438275640b0STomoya MORINAGA retval |= pch_phub_write_serial_rom(chip, 0x10 + offset_addr, 0x19); 439275640b0STomoya MORINAGA 440275640b0STomoya MORINAGA retval |= pch_phub_write_serial_rom(chip, 0x1b + offset_addr, 0xbc); 441275640b0STomoya MORINAGA retval |= pch_phub_write_serial_rom(chip, 0x1a + offset_addr, 0x00); 442275640b0STomoya MORINAGA retval |= pch_phub_write_serial_rom(chip, 0x19 + offset_addr, 0x40); 443275640b0STomoya MORINAGA retval |= pch_phub_write_serial_rom(chip, 0x18 + offset_addr, 0x3a); 444275640b0STomoya MORINAGA 445275640b0STomoya MORINAGA retval |= pch_phub_write_serial_rom(chip, 0x1f + offset_addr, 0x01); 446275640b0STomoya MORINAGA retval |= pch_phub_write_serial_rom(chip, 0x1e + offset_addr, 0x00); 447275640b0STomoya MORINAGA retval |= pch_phub_write_serial_rom(chip, 0x1d + offset_addr, 0x00); 448275640b0STomoya MORINAGA retval |= pch_phub_write_serial_rom(chip, 0x1c + offset_addr, 0x00); 449275640b0STomoya MORINAGA 450275640b0STomoya MORINAGA return retval; 451275640b0STomoya MORINAGA } 452275640b0STomoya MORINAGA 453cf4ece53SMasayuki Ohtak /** 454cf4ece53SMasayuki Ohtak * pch_phub_read_gbe_mac_addr() - Read Gigabit Ethernet MAC address 455cf4ece53SMasayuki Ohtak * @offset_address: Gigabit Ethernet MAC address offset value. 456cf4ece53SMasayuki Ohtak * @data: Buffer of the Gigabit Ethernet MAC address value. 457cf4ece53SMasayuki Ohtak */ 458cf4ece53SMasayuki Ohtak static void pch_phub_read_gbe_mac_addr(struct pch_phub_reg *chip, u8 *data) 459cf4ece53SMasayuki Ohtak { 460cf4ece53SMasayuki Ohtak int i; 461cf4ece53SMasayuki Ohtak for (i = 0; i < ETH_ALEN; i++) 462cf4ece53SMasayuki Ohtak pch_phub_read_serial_rom_val(chip, i, &data[i]); 463cf4ece53SMasayuki Ohtak } 464cf4ece53SMasayuki Ohtak 465cf4ece53SMasayuki Ohtak /** 466cf4ece53SMasayuki Ohtak * pch_phub_write_gbe_mac_addr() - Write MAC address 467cf4ece53SMasayuki Ohtak * @offset_address: Gigabit Ethernet MAC address offset value. 468cf4ece53SMasayuki Ohtak * @data: Gigabit Ethernet MAC address value. 469cf4ece53SMasayuki Ohtak */ 470cf4ece53SMasayuki Ohtak static int pch_phub_write_gbe_mac_addr(struct pch_phub_reg *chip, u8 *data) 471cf4ece53SMasayuki Ohtak { 472cf4ece53SMasayuki Ohtak int retval; 473cf4ece53SMasayuki Ohtak int i; 474cf4ece53SMasayuki Ohtak 4752a988791STomoya MORINAGA if ((chip->ioh_type == 1) || (chip->ioh_type == 5)) /* EG20T or ML7831*/ 476cf4ece53SMasayuki Ohtak retval = pch_phub_gbe_serial_rom_conf(chip); 477275640b0STomoya MORINAGA else /* ML7223 */ 478275640b0STomoya MORINAGA retval = pch_phub_gbe_serial_rom_conf_mp(chip); 479cf4ece53SMasayuki Ohtak if (retval) 480cf4ece53SMasayuki Ohtak return retval; 481cf4ece53SMasayuki Ohtak 482cf4ece53SMasayuki Ohtak for (i = 0; i < ETH_ALEN; i++) { 483cf4ece53SMasayuki Ohtak retval = pch_phub_write_serial_rom_val(chip, i, data[i]); 484cf4ece53SMasayuki Ohtak if (retval) 485cf4ece53SMasayuki Ohtak return retval; 486cf4ece53SMasayuki Ohtak } 487cf4ece53SMasayuki Ohtak 488cf4ece53SMasayuki Ohtak return retval; 489cf4ece53SMasayuki Ohtak } 490cf4ece53SMasayuki Ohtak 491cf4ece53SMasayuki Ohtak static ssize_t pch_phub_bin_read(struct file *filp, struct kobject *kobj, 492cf4ece53SMasayuki Ohtak struct bin_attribute *attr, char *buf, 493cf4ece53SMasayuki Ohtak loff_t off, size_t count) 494cf4ece53SMasayuki Ohtak { 495cf4ece53SMasayuki Ohtak unsigned int rom_signature; 496cf4ece53SMasayuki Ohtak unsigned char rom_length; 497cf4ece53SMasayuki Ohtak unsigned int tmp; 498cf4ece53SMasayuki Ohtak unsigned int addr_offset; 499cf4ece53SMasayuki Ohtak unsigned int orom_size; 500cf4ece53SMasayuki Ohtak int ret; 501cf4ece53SMasayuki Ohtak int err; 5029914a0deSTomoya MORINAGA ssize_t rom_size; 503cf4ece53SMasayuki Ohtak 504cf4ece53SMasayuki Ohtak struct pch_phub_reg *chip = 505cf4ece53SMasayuki Ohtak dev_get_drvdata(container_of(kobj, struct device, kobj)); 506cf4ece53SMasayuki Ohtak 507cf4ece53SMasayuki Ohtak ret = mutex_lock_interruptible(&pch_phub_mutex); 508cf4ece53SMasayuki Ohtak if (ret) { 509cf4ece53SMasayuki Ohtak err = -ERESTARTSYS; 510cf4ece53SMasayuki Ohtak goto return_err_nomutex; 511cf4ece53SMasayuki Ohtak } 512cf4ece53SMasayuki Ohtak 513cf4ece53SMasayuki Ohtak /* Get Rom signature */ 5149914a0deSTomoya MORINAGA chip->pch_phub_extrom_base_address = pci_map_rom(chip->pdev, &rom_size); 5159914a0deSTomoya MORINAGA if (!chip->pch_phub_extrom_base_address) 5169914a0deSTomoya MORINAGA goto exrom_map_err; 5179914a0deSTomoya MORINAGA 518275640b0STomoya MORINAGA pch_phub_read_serial_rom(chip, chip->pch_opt_rom_start_address, 519275640b0STomoya MORINAGA (unsigned char *)&rom_signature); 520cf4ece53SMasayuki Ohtak rom_signature &= 0xff; 521275640b0STomoya MORINAGA pch_phub_read_serial_rom(chip, chip->pch_opt_rom_start_address + 1, 522275640b0STomoya MORINAGA (unsigned char *)&tmp); 523cf4ece53SMasayuki Ohtak rom_signature |= (tmp & 0xff) << 8; 524cf4ece53SMasayuki Ohtak if (rom_signature == 0xAA55) { 525275640b0STomoya MORINAGA pch_phub_read_serial_rom(chip, 526275640b0STomoya MORINAGA chip->pch_opt_rom_start_address + 2, 527275640b0STomoya MORINAGA &rom_length); 528cf4ece53SMasayuki Ohtak orom_size = rom_length * 512; 529cf4ece53SMasayuki Ohtak if (orom_size < off) { 530cf4ece53SMasayuki Ohtak addr_offset = 0; 531cf4ece53SMasayuki Ohtak goto return_ok; 532cf4ece53SMasayuki Ohtak } 533cf4ece53SMasayuki Ohtak if (orom_size < count) { 534cf4ece53SMasayuki Ohtak addr_offset = 0; 535cf4ece53SMasayuki Ohtak goto return_ok; 536cf4ece53SMasayuki Ohtak } 537cf4ece53SMasayuki Ohtak 538cf4ece53SMasayuki Ohtak for (addr_offset = 0; addr_offset < count; addr_offset++) { 539275640b0STomoya MORINAGA pch_phub_read_serial_rom(chip, 540275640b0STomoya MORINAGA chip->pch_opt_rom_start_address + addr_offset + off, 541cf4ece53SMasayuki Ohtak &buf[addr_offset]); 542cf4ece53SMasayuki Ohtak } 543cf4ece53SMasayuki Ohtak } else { 544cf4ece53SMasayuki Ohtak err = -ENODATA; 545cf4ece53SMasayuki Ohtak goto return_err; 546cf4ece53SMasayuki Ohtak } 547cf4ece53SMasayuki Ohtak return_ok: 5489914a0deSTomoya MORINAGA pci_unmap_rom(chip->pdev, chip->pch_phub_extrom_base_address); 549cf4ece53SMasayuki Ohtak mutex_unlock(&pch_phub_mutex); 550cf4ece53SMasayuki Ohtak return addr_offset; 551cf4ece53SMasayuki Ohtak 552cf4ece53SMasayuki Ohtak return_err: 5539914a0deSTomoya MORINAGA pci_unmap_rom(chip->pdev, chip->pch_phub_extrom_base_address); 5549914a0deSTomoya MORINAGA exrom_map_err: 555cf4ece53SMasayuki Ohtak mutex_unlock(&pch_phub_mutex); 556cf4ece53SMasayuki Ohtak return_err_nomutex: 557cf4ece53SMasayuki Ohtak return err; 558cf4ece53SMasayuki Ohtak } 559cf4ece53SMasayuki Ohtak 560cf4ece53SMasayuki Ohtak static ssize_t pch_phub_bin_write(struct file *filp, struct kobject *kobj, 561cf4ece53SMasayuki Ohtak struct bin_attribute *attr, 562cf4ece53SMasayuki Ohtak char *buf, loff_t off, size_t count) 563cf4ece53SMasayuki Ohtak { 564cf4ece53SMasayuki Ohtak int err; 565cf4ece53SMasayuki Ohtak unsigned int addr_offset; 566cf4ece53SMasayuki Ohtak int ret; 5679914a0deSTomoya MORINAGA ssize_t rom_size; 568cf4ece53SMasayuki Ohtak struct pch_phub_reg *chip = 569cf4ece53SMasayuki Ohtak dev_get_drvdata(container_of(kobj, struct device, kobj)); 570cf4ece53SMasayuki Ohtak 571cf4ece53SMasayuki Ohtak ret = mutex_lock_interruptible(&pch_phub_mutex); 572cf4ece53SMasayuki Ohtak if (ret) 573cf4ece53SMasayuki Ohtak return -ERESTARTSYS; 574cf4ece53SMasayuki Ohtak 575cf4ece53SMasayuki Ohtak if (off > PCH_PHUB_OROM_SIZE) { 576cf4ece53SMasayuki Ohtak addr_offset = 0; 577cf4ece53SMasayuki Ohtak goto return_ok; 578cf4ece53SMasayuki Ohtak } 579cf4ece53SMasayuki Ohtak if (count > PCH_PHUB_OROM_SIZE) { 580cf4ece53SMasayuki Ohtak addr_offset = 0; 581cf4ece53SMasayuki Ohtak goto return_ok; 582cf4ece53SMasayuki Ohtak } 583cf4ece53SMasayuki Ohtak 5849914a0deSTomoya MORINAGA chip->pch_phub_extrom_base_address = pci_map_rom(chip->pdev, &rom_size); 5859914a0deSTomoya MORINAGA if (!chip->pch_phub_extrom_base_address) { 5869914a0deSTomoya MORINAGA err = -ENOMEM; 5879914a0deSTomoya MORINAGA goto exrom_map_err; 5889914a0deSTomoya MORINAGA } 5899914a0deSTomoya MORINAGA 590cf4ece53SMasayuki Ohtak for (addr_offset = 0; addr_offset < count; addr_offset++) { 591cf4ece53SMasayuki Ohtak if (PCH_PHUB_OROM_SIZE < off + addr_offset) 592cf4ece53SMasayuki Ohtak goto return_ok; 593cf4ece53SMasayuki Ohtak 594275640b0STomoya MORINAGA ret = pch_phub_write_serial_rom(chip, 595275640b0STomoya MORINAGA chip->pch_opt_rom_start_address + addr_offset + off, 596cf4ece53SMasayuki Ohtak buf[addr_offset]); 597cf4ece53SMasayuki Ohtak if (ret) { 598cf4ece53SMasayuki Ohtak err = ret; 599cf4ece53SMasayuki Ohtak goto return_err; 600cf4ece53SMasayuki Ohtak } 601cf4ece53SMasayuki Ohtak } 602cf4ece53SMasayuki Ohtak 603cf4ece53SMasayuki Ohtak return_ok: 6049914a0deSTomoya MORINAGA pci_unmap_rom(chip->pdev, chip->pch_phub_extrom_base_address); 605cf4ece53SMasayuki Ohtak mutex_unlock(&pch_phub_mutex); 606cf4ece53SMasayuki Ohtak return addr_offset; 607cf4ece53SMasayuki Ohtak 608cf4ece53SMasayuki Ohtak return_err: 6099914a0deSTomoya MORINAGA pci_unmap_rom(chip->pdev, chip->pch_phub_extrom_base_address); 6109914a0deSTomoya MORINAGA 6119914a0deSTomoya MORINAGA exrom_map_err: 612cf4ece53SMasayuki Ohtak mutex_unlock(&pch_phub_mutex); 613cf4ece53SMasayuki Ohtak return err; 614cf4ece53SMasayuki Ohtak } 615cf4ece53SMasayuki Ohtak 616cf4ece53SMasayuki Ohtak static ssize_t show_pch_mac(struct device *dev, struct device_attribute *attr, 617cf4ece53SMasayuki Ohtak char *buf) 618cf4ece53SMasayuki Ohtak { 619cf4ece53SMasayuki Ohtak u8 mac[8]; 620cf4ece53SMasayuki Ohtak struct pch_phub_reg *chip = dev_get_drvdata(dev); 6219914a0deSTomoya MORINAGA ssize_t rom_size; 6229914a0deSTomoya MORINAGA 6239914a0deSTomoya MORINAGA chip->pch_phub_extrom_base_address = pci_map_rom(chip->pdev, &rom_size); 6249914a0deSTomoya MORINAGA if (!chip->pch_phub_extrom_base_address) 6259914a0deSTomoya MORINAGA return -ENOMEM; 626cf4ece53SMasayuki Ohtak 627cf4ece53SMasayuki Ohtak pch_phub_read_gbe_mac_addr(chip, mac); 6289914a0deSTomoya MORINAGA pci_unmap_rom(chip->pdev, chip->pch_phub_extrom_base_address); 629cf4ece53SMasayuki Ohtak 63025b8a88cSAndy Shevchenko return sprintf(buf, "%pM\n", mac); 631cf4ece53SMasayuki Ohtak } 632cf4ece53SMasayuki Ohtak 633cf4ece53SMasayuki Ohtak static ssize_t store_pch_mac(struct device *dev, struct device_attribute *attr, 634cf4ece53SMasayuki Ohtak const char *buf, size_t count) 635cf4ece53SMasayuki Ohtak { 636143e9c76SAndy Shevchenko u8 mac[ETH_ALEN]; 6379914a0deSTomoya MORINAGA ssize_t rom_size; 638cf4ece53SMasayuki Ohtak struct pch_phub_reg *chip = dev_get_drvdata(dev); 639*a246b973SAlexander Stein int ret; 640cf4ece53SMasayuki Ohtak 641143e9c76SAndy Shevchenko if (!mac_pton(buf, mac)) 642cf4ece53SMasayuki Ohtak return -EINVAL; 643cf4ece53SMasayuki Ohtak 6449914a0deSTomoya MORINAGA chip->pch_phub_extrom_base_address = pci_map_rom(chip->pdev, &rom_size); 6459914a0deSTomoya MORINAGA if (!chip->pch_phub_extrom_base_address) 6469914a0deSTomoya MORINAGA return -ENOMEM; 6479914a0deSTomoya MORINAGA 648*a246b973SAlexander Stein ret = pch_phub_write_gbe_mac_addr(chip, mac); 6499914a0deSTomoya MORINAGA pci_unmap_rom(chip->pdev, chip->pch_phub_extrom_base_address); 650*a246b973SAlexander Stein if (ret) 651*a246b973SAlexander Stein return ret; 652cf4ece53SMasayuki Ohtak 653cf4ece53SMasayuki Ohtak return count; 654cf4ece53SMasayuki Ohtak } 655cf4ece53SMasayuki Ohtak 656cf4ece53SMasayuki Ohtak static DEVICE_ATTR(pch_mac, S_IRUGO | S_IWUSR, show_pch_mac, store_pch_mac); 657cf4ece53SMasayuki Ohtak 658cf4ece53SMasayuki Ohtak static struct bin_attribute pch_bin_attr = { 659cf4ece53SMasayuki Ohtak .attr = { 660cf4ece53SMasayuki Ohtak .name = "pch_firmware", 661cf4ece53SMasayuki Ohtak .mode = S_IRUGO | S_IWUSR, 662cf4ece53SMasayuki Ohtak }, 663cf4ece53SMasayuki Ohtak .size = PCH_PHUB_OROM_SIZE + 1, 664cf4ece53SMasayuki Ohtak .read = pch_phub_bin_read, 665cf4ece53SMasayuki Ohtak .write = pch_phub_bin_write, 666cf4ece53SMasayuki Ohtak }; 667cf4ece53SMasayuki Ohtak 66880c8ae28SBill Pemberton static int pch_phub_probe(struct pci_dev *pdev, 669cf4ece53SMasayuki Ohtak const struct pci_device_id *id) 670cf4ece53SMasayuki Ohtak { 671cf4ece53SMasayuki Ohtak int ret; 672cf4ece53SMasayuki Ohtak struct pch_phub_reg *chip; 673cf4ece53SMasayuki Ohtak 674cf4ece53SMasayuki Ohtak chip = kzalloc(sizeof(struct pch_phub_reg), GFP_KERNEL); 675cf4ece53SMasayuki Ohtak if (chip == NULL) 676cf4ece53SMasayuki Ohtak return -ENOMEM; 677cf4ece53SMasayuki Ohtak 678cf4ece53SMasayuki Ohtak ret = pci_enable_device(pdev); 679cf4ece53SMasayuki Ohtak if (ret) { 680cf4ece53SMasayuki Ohtak dev_err(&pdev->dev, 681cf4ece53SMasayuki Ohtak "%s : pci_enable_device FAILED(ret=%d)", __func__, ret); 682cf4ece53SMasayuki Ohtak goto err_pci_enable_dev; 683cf4ece53SMasayuki Ohtak } 684cf4ece53SMasayuki Ohtak dev_dbg(&pdev->dev, "%s : pci_enable_device returns %d\n", __func__, 685cf4ece53SMasayuki Ohtak ret); 686cf4ece53SMasayuki Ohtak 687cf4ece53SMasayuki Ohtak ret = pci_request_regions(pdev, KBUILD_MODNAME); 688cf4ece53SMasayuki Ohtak if (ret) { 689cf4ece53SMasayuki Ohtak dev_err(&pdev->dev, 690cf4ece53SMasayuki Ohtak "%s : pci_request_regions FAILED(ret=%d)", __func__, ret); 691cf4ece53SMasayuki Ohtak goto err_req_regions; 692cf4ece53SMasayuki Ohtak } 693cf4ece53SMasayuki Ohtak dev_dbg(&pdev->dev, "%s : " 694cf4ece53SMasayuki Ohtak "pci_request_regions returns %d\n", __func__, ret); 695cf4ece53SMasayuki Ohtak 696cf4ece53SMasayuki Ohtak chip->pch_phub_base_address = pci_iomap(pdev, 1, 0); 697cf4ece53SMasayuki Ohtak 698cf4ece53SMasayuki Ohtak 69973ac0e9eSDevendra Naga if (chip->pch_phub_base_address == NULL) { 700cf4ece53SMasayuki Ohtak dev_err(&pdev->dev, "%s : pci_iomap FAILED", __func__); 701cf4ece53SMasayuki Ohtak ret = -ENOMEM; 702cf4ece53SMasayuki Ohtak goto err_pci_iomap; 703cf4ece53SMasayuki Ohtak } 704cf4ece53SMasayuki Ohtak dev_dbg(&pdev->dev, "%s : pci_iomap SUCCESS and value " 705da0d7f98SGreg Kroah-Hartman "in pch_phub_base_address variable is %p\n", __func__, 706da0d7f98SGreg Kroah-Hartman chip->pch_phub_base_address); 707cf4ece53SMasayuki Ohtak 7089914a0deSTomoya MORINAGA chip->pdev = pdev; /* Save pci device struct */ 709cf4ece53SMasayuki Ohtak 710275640b0STomoya MORINAGA if (id->driver_data == 1) { /* EG20T PCH */ 7112b934c62SAlexander Stein const char *board_name; 7122b934c62SAlexander Stein 71329ddae2aSWei Yongjun ret = sysfs_create_file(&pdev->dev.kobj, 714c47dda7dSTomoya MORINAGA &dev_attr_pch_mac.attr); 71529ddae2aSWei Yongjun if (ret) 716cf4ece53SMasayuki Ohtak goto err_sysfs_create; 717cf4ece53SMasayuki Ohtak 71829ddae2aSWei Yongjun ret = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr); 71929ddae2aSWei Yongjun if (ret) 720cf4ece53SMasayuki Ohtak goto exit_bin_attr; 721cf4ece53SMasayuki Ohtak 722c47dda7dSTomoya MORINAGA pch_phub_read_modify_write_reg(chip, 723c47dda7dSTomoya MORINAGA (unsigned int)CLKCFG_REG_OFFSET, 724c47dda7dSTomoya MORINAGA CLKCFG_CAN_50MHZ, 725c47dda7dSTomoya MORINAGA CLKCFG_CANCLK_MASK); 726cf4ece53SMasayuki Ohtak 7276ae705b2SDenis Turischev /* quirk for CM-iTC board */ 7282b934c62SAlexander Stein board_name = dmi_get_system_info(DMI_BOARD_NAME); 7292b934c62SAlexander Stein if (board_name && strstr(board_name, "CM-iTC")) 7306ae705b2SDenis Turischev pch_phub_read_modify_write_reg(chip, 7316ae705b2SDenis Turischev (unsigned int)CLKCFG_REG_OFFSET, 7326ae705b2SDenis Turischev CLKCFG_UART_48MHZ | CLKCFG_BAUDDIV | 7336ae705b2SDenis Turischev CLKCFG_PLL2VCO | CLKCFG_UARTCLKSEL, 7346ae705b2SDenis Turischev CLKCFG_UART_MASK); 7356ae705b2SDenis Turischev 736cf4ece53SMasayuki Ohtak /* set the prefech value */ 737cf4ece53SMasayuki Ohtak iowrite32(0x000affaa, chip->pch_phub_base_address + 0x14); 738cf4ece53SMasayuki Ohtak /* set the interrupt delay value */ 739cf4ece53SMasayuki Ohtak iowrite32(0x25, chip->pch_phub_base_address + 0x44); 740275640b0STomoya MORINAGA chip->pch_opt_rom_start_address = PCH_PHUB_ROM_START_ADDR_EG20T; 741275640b0STomoya MORINAGA chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_EG20T; 742275640b0STomoya MORINAGA } else if (id->driver_data == 2) { /* ML7213 IOH */ 74329ddae2aSWei Yongjun ret = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr); 74429ddae2aSWei Yongjun if (ret) 745c47dda7dSTomoya MORINAGA goto err_sysfs_create; 746c47dda7dSTomoya MORINAGA /* set the prefech value 747c47dda7dSTomoya MORINAGA * Device2(USB OHCI #1/ USB EHCI #1/ USB Device):a 748c47dda7dSTomoya MORINAGA * Device4(SDIO #0,1,2):f 749c47dda7dSTomoya MORINAGA * Device6(SATA 2):f 750c47dda7dSTomoya MORINAGA * Device8(USB OHCI #0/ USB EHCI #0):a 751c47dda7dSTomoya MORINAGA */ 752c47dda7dSTomoya MORINAGA iowrite32(0x000affa0, chip->pch_phub_base_address + 0x14); 753275640b0STomoya MORINAGA chip->pch_opt_rom_start_address =\ 754275640b0STomoya MORINAGA PCH_PHUB_ROM_START_ADDR_ML7213; 755275640b0STomoya MORINAGA } else if (id->driver_data == 3) { /* ML7223 IOH Bus-m*/ 756275640b0STomoya MORINAGA /* set the prefech value 757275640b0STomoya MORINAGA * Device8(GbE) 758275640b0STomoya MORINAGA */ 759275640b0STomoya MORINAGA iowrite32(0x000a0000, chip->pch_phub_base_address + 0x14); 76020ae6d0bSTomoya MORINAGA /* set the interrupt delay value */ 76120ae6d0bSTomoya MORINAGA iowrite32(0x25, chip->pch_phub_base_address + 0x140); 762275640b0STomoya MORINAGA chip->pch_opt_rom_start_address =\ 763275640b0STomoya MORINAGA PCH_PHUB_ROM_START_ADDR_ML7223; 764275640b0STomoya MORINAGA chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_ML7223; 765275640b0STomoya MORINAGA } else if (id->driver_data == 4) { /* ML7223 IOH Bus-n*/ 76629ddae2aSWei Yongjun ret = sysfs_create_file(&pdev->dev.kobj, 767275640b0STomoya MORINAGA &dev_attr_pch_mac.attr); 76829ddae2aSWei Yongjun if (ret) 769275640b0STomoya MORINAGA goto err_sysfs_create; 77029ddae2aSWei Yongjun ret = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr); 77129ddae2aSWei Yongjun if (ret) 772275640b0STomoya MORINAGA goto exit_bin_attr; 773275640b0STomoya MORINAGA /* set the prefech value 774275640b0STomoya MORINAGA * Device2(USB OHCI #0,1,2,3/ USB EHCI #0):a 775275640b0STomoya MORINAGA * Device4(SDIO #0,1):f 776275640b0STomoya MORINAGA * Device6(SATA 2):f 777275640b0STomoya MORINAGA */ 778275640b0STomoya MORINAGA iowrite32(0x0000ffa0, chip->pch_phub_base_address + 0x14); 779275640b0STomoya MORINAGA chip->pch_opt_rom_start_address =\ 780275640b0STomoya MORINAGA PCH_PHUB_ROM_START_ADDR_ML7223; 781275640b0STomoya MORINAGA chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_ML7223; 782584ad00cSTomoya MORINAGA } else if (id->driver_data == 5) { /* ML7831 */ 78329ddae2aSWei Yongjun ret = sysfs_create_file(&pdev->dev.kobj, 784584ad00cSTomoya MORINAGA &dev_attr_pch_mac.attr); 78529ddae2aSWei Yongjun if (ret) 786584ad00cSTomoya MORINAGA goto err_sysfs_create; 787584ad00cSTomoya MORINAGA 78829ddae2aSWei Yongjun ret = sysfs_create_bin_file(&pdev->dev.kobj, &pch_bin_attr); 78929ddae2aSWei Yongjun if (ret) 790584ad00cSTomoya MORINAGA goto exit_bin_attr; 791584ad00cSTomoya MORINAGA 792584ad00cSTomoya MORINAGA /* set the prefech value */ 793584ad00cSTomoya MORINAGA iowrite32(0x000affaa, chip->pch_phub_base_address + 0x14); 794584ad00cSTomoya MORINAGA /* set the interrupt delay value */ 795584ad00cSTomoya MORINAGA iowrite32(0x25, chip->pch_phub_base_address + 0x44); 796584ad00cSTomoya MORINAGA chip->pch_opt_rom_start_address = PCH_PHUB_ROM_START_ADDR_EG20T; 797584ad00cSTomoya MORINAGA chip->pch_mac_start_address = PCH_PHUB_MAC_START_ADDR_EG20T; 798c47dda7dSTomoya MORINAGA } 799275640b0STomoya MORINAGA 800275640b0STomoya MORINAGA chip->ioh_type = id->driver_data; 801c47dda7dSTomoya MORINAGA pci_set_drvdata(pdev, chip); 802cf4ece53SMasayuki Ohtak 803cf4ece53SMasayuki Ohtak return 0; 804cf4ece53SMasayuki Ohtak exit_bin_attr: 805cf4ece53SMasayuki Ohtak sysfs_remove_file(&pdev->dev.kobj, &dev_attr_pch_mac.attr); 806cf4ece53SMasayuki Ohtak 807cf4ece53SMasayuki Ohtak err_sysfs_create: 808cf4ece53SMasayuki Ohtak pci_iounmap(pdev, chip->pch_phub_base_address); 809cf4ece53SMasayuki Ohtak err_pci_iomap: 810cf4ece53SMasayuki Ohtak pci_release_regions(pdev); 811cf4ece53SMasayuki Ohtak err_req_regions: 812cf4ece53SMasayuki Ohtak pci_disable_device(pdev); 813cf4ece53SMasayuki Ohtak err_pci_enable_dev: 814cf4ece53SMasayuki Ohtak kfree(chip); 815cf4ece53SMasayuki Ohtak dev_err(&pdev->dev, "%s returns %d\n", __func__, ret); 816cf4ece53SMasayuki Ohtak return ret; 817cf4ece53SMasayuki Ohtak } 818cf4ece53SMasayuki Ohtak 819486a5c28SBill Pemberton static void pch_phub_remove(struct pci_dev *pdev) 820cf4ece53SMasayuki Ohtak { 821cf4ece53SMasayuki Ohtak struct pch_phub_reg *chip = pci_get_drvdata(pdev); 822cf4ece53SMasayuki Ohtak 823cf4ece53SMasayuki Ohtak sysfs_remove_file(&pdev->dev.kobj, &dev_attr_pch_mac.attr); 824cf4ece53SMasayuki Ohtak sysfs_remove_bin_file(&pdev->dev.kobj, &pch_bin_attr); 825cf4ece53SMasayuki Ohtak pci_iounmap(pdev, chip->pch_phub_base_address); 826cf4ece53SMasayuki Ohtak pci_release_regions(pdev); 827cf4ece53SMasayuki Ohtak pci_disable_device(pdev); 828cf4ece53SMasayuki Ohtak kfree(chip); 829cf4ece53SMasayuki Ohtak } 830cf4ece53SMasayuki Ohtak 831cf4ece53SMasayuki Ohtak #ifdef CONFIG_PM 832cf4ece53SMasayuki Ohtak 833cf4ece53SMasayuki Ohtak static int pch_phub_suspend(struct pci_dev *pdev, pm_message_t state) 834cf4ece53SMasayuki Ohtak { 835cf4ece53SMasayuki Ohtak int ret; 836cf4ece53SMasayuki Ohtak 837cf4ece53SMasayuki Ohtak pch_phub_save_reg_conf(pdev); 838cf4ece53SMasayuki Ohtak ret = pci_save_state(pdev); 839cf4ece53SMasayuki Ohtak if (ret) { 840cf4ece53SMasayuki Ohtak dev_err(&pdev->dev, 841cf4ece53SMasayuki Ohtak " %s -pci_save_state returns %d\n", __func__, ret); 842cf4ece53SMasayuki Ohtak return ret; 843cf4ece53SMasayuki Ohtak } 844cf4ece53SMasayuki Ohtak pci_enable_wake(pdev, PCI_D3hot, 0); 845cf4ece53SMasayuki Ohtak pci_disable_device(pdev); 846cf4ece53SMasayuki Ohtak pci_set_power_state(pdev, pci_choose_state(pdev, state)); 847cf4ece53SMasayuki Ohtak 848cf4ece53SMasayuki Ohtak return 0; 849cf4ece53SMasayuki Ohtak } 850cf4ece53SMasayuki Ohtak 851cf4ece53SMasayuki Ohtak static int pch_phub_resume(struct pci_dev *pdev) 852cf4ece53SMasayuki Ohtak { 853cf4ece53SMasayuki Ohtak int ret; 854cf4ece53SMasayuki Ohtak 855cf4ece53SMasayuki Ohtak pci_set_power_state(pdev, PCI_D0); 856cf4ece53SMasayuki Ohtak pci_restore_state(pdev); 857cf4ece53SMasayuki Ohtak ret = pci_enable_device(pdev); 858cf4ece53SMasayuki Ohtak if (ret) { 859cf4ece53SMasayuki Ohtak dev_err(&pdev->dev, 860cf4ece53SMasayuki Ohtak "%s-pci_enable_device failed(ret=%d) ", __func__, ret); 861cf4ece53SMasayuki Ohtak return ret; 862cf4ece53SMasayuki Ohtak } 863cf4ece53SMasayuki Ohtak 864cf4ece53SMasayuki Ohtak pci_enable_wake(pdev, PCI_D3hot, 0); 865cf4ece53SMasayuki Ohtak pch_phub_restore_reg_conf(pdev); 866cf4ece53SMasayuki Ohtak 867cf4ece53SMasayuki Ohtak return 0; 868cf4ece53SMasayuki Ohtak } 869cf4ece53SMasayuki Ohtak #else 870cf4ece53SMasayuki Ohtak #define pch_phub_suspend NULL 871cf4ece53SMasayuki Ohtak #define pch_phub_resume NULL 872cf4ece53SMasayuki Ohtak #endif /* CONFIG_PM */ 873cf4ece53SMasayuki Ohtak 874cf4ece53SMasayuki Ohtak static struct pci_device_id pch_phub_pcidev_id[] = { 875c47dda7dSTomoya MORINAGA { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_PCH1_PHUB), 1, }, 876c47dda7dSTomoya MORINAGA { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7213_PHUB), 2, }, 877275640b0STomoya MORINAGA { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7223_mPHUB), 3, }, 878275640b0STomoya MORINAGA { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7223_nPHUB), 4, }, 879584ad00cSTomoya MORINAGA { PCI_VDEVICE(ROHM, PCI_DEVICE_ID_ROHM_ML7831_PHUB), 5, }, 880c47dda7dSTomoya MORINAGA { } 881cf4ece53SMasayuki Ohtak }; 882b2595142SAxel Lin MODULE_DEVICE_TABLE(pci, pch_phub_pcidev_id); 883cf4ece53SMasayuki Ohtak 884cf4ece53SMasayuki Ohtak static struct pci_driver pch_phub_driver = { 885cf4ece53SMasayuki Ohtak .name = "pch_phub", 886cf4ece53SMasayuki Ohtak .id_table = pch_phub_pcidev_id, 887cf4ece53SMasayuki Ohtak .probe = pch_phub_probe, 8882d6bed9cSBill Pemberton .remove = pch_phub_remove, 889cf4ece53SMasayuki Ohtak .suspend = pch_phub_suspend, 890cf4ece53SMasayuki Ohtak .resume = pch_phub_resume 891cf4ece53SMasayuki Ohtak }; 892cf4ece53SMasayuki Ohtak 893cfeb2852SDevendra Naga module_pci_driver(pch_phub_driver); 894cf4ece53SMasayuki Ohtak 8957f2732c8STomoya MORINAGA MODULE_DESCRIPTION("Intel EG20T PCH/LAPIS Semiconductor IOH(ML7213/ML7223) PHUB"); 896cf4ece53SMasayuki Ohtak MODULE_LICENSE("GPL"); 897